PageSourceSearch

https://rrt.lt/dist/vendor/lightbox.min.js?v=6739c95539deb3db82e7a8d1e9ea84b3

js rrt.lt collected 2026-10-02 04:31:06 UTC 65,218 bytes, 5 lines download raw bytes

vendor: 64,500 bytes, lines 1-4
1(function(M,f){typeof exports=="object"&&typeof module<"u"?f(exports):typeof define=="function"&&define.amd?define(["exports"],f):f((M=typeof globalThis<"u"?globalThis:M||self).Lightbox3={})})(this,function(M){"use strict";function f(x,t,i,e){const{stiffness:s,damping:o,mass:n=1}=x;if(e>.02){let a={...t},h=e;for(;h>0;){const r=Math.min(h,.008),l=N(s,o,n,a,i,r);if(l.settled)return l;a=l,h-=r}return{...a,settled:!1}}return N(s,o,n,t,i,e)}function N(x,t,i,e,s,o){const n=(-x*(e.position-s)+-t*e.velocity)/i,a=e.velocity+n*o,h=e.position+a*o,r=Math.abs(h-s)<.01&&Math.abs(a)<.01;return{position:r?s:h,velocity:r?0:a,settled:r}}const k={selector:"[data-lightbox]",springOpen:{stiffness:260,damping:26,mass:1},springClose:{stiffness:500,damping:38,mass:1},padding:40,loop:!1,upscale:!1,debug:!1},Y=.15,C=.35,P={stiffness:170,damping:26,mass:1},R={stiffness:300,damping:30,mass:1},A={stiffness:200,damping:28,mass:1},I=16,F={stiffness:300,damping:20,mass:1};class z{constructor(t={}){this.listeners=new Map,this.state={isOpen:!1,isAnimating:!1,isClosing:!1,isDismissClosing:!1,triggerEl:null,currentSrc:""},this.zoom=this.defaultZoomState(),this.overlay=null,this.backdrop=null,this.imgEl=null,this.stripEl=null,this.currentSlideEl=null,this.prevSlideEl=null,this.prevSlideImg=null,this.nextSlideEl=null,this.nextSlideImg=null,this.gallery=[],this.currentIndex=0,this.userHasNavigated=!1,this.stripRafId=null,this.stripOffset=0,this.pendingNavDirection=null,this.swipeNav=this.defaultSwipeNavState(),this.preloadCache=new Map,this.preloadTimer=null,this.preloadQueue=[],this.preloadingActive=!1,this.velocitySamples=[],this.pointerCache=[],this.pinch=this.defaultPinchState(),this.dismiss=this.defaultDismissState(),this.rafId=null,this.bounceRafId=null,this.cropInsets={top:0,right:0,bottom:0,left:0},this.thumbBorderRadius=0,this.isTextLink=!1,this.shrinkingToCenter=!1,this.spinnerEl=null,this.spinnerTimer=null,this.chromeBar=null,this.chromeCounter=null,this.chromeCaption=null,this.chromeClose=null,this.chromePrev=null,this.chromeNext=null,this.chromeRafId=null,this.chromeSpring={position:0,velocity:0},this.chromeBaseOpacity=0,this.chromeDriftProgress=0,this.chromeDriftVectors={bar:{x:0,y:0},prev:{x:0,y:0},next:{x:0,y:0}},this.chromeFadeSwapped=!1,this.pressSprings=new Map,this.pressRafId=null,this.fitRafId=null,this.previouslyFocusedEl=null,this.savedBodyOverflow="",this.savedHtmlPaddingRight="",this.wheelDismissY=0,this.wheelGestureTimer=null,this.wheelSnapBackTimer=null,this.wheelNavCommitted=!1,this.wheelNavTotalDelta=0,this.reducedMotion=!1,this.reducedMotionQuery=null,this.debugEl=null,this.debugStateEl=null,this.debugLogEl=null,this.debugRafId=null,this.debugLogEntries=[],this.debugT0=0,this.opts={...k,...t},this.reducedMotionQuery=window.matchMedia("(prefers-reduced-motion: reduce)"),this.reducedMotion=this.reducedMotionQuery.matches,this.reducedMotionQuery.addEventListener("change",i=>{this.reducedMotion=i.matches}),this.handleClick=this.handleClick.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.handlePointerEnter=this.handlePointerEnter.bind(this),this.handlePointerLeave=this.handlePointerLeave.bind(this),this.handleImagePointerDown=this.handleImagePointerDown.bind(this),this.handleOverlayPointerDown=this.handleOverlayPointerDown.bind(this),this.handlePointerMove=this.handlePointerMove.bind(this),this.handlePointerUp=this.handlePointerUp.bind(this),this.handleWheel=this.handleWheel.bind(this),this.close=this.close.bind(this),this.attach()}static init(t){return z.instance?(t&&z.instance.configure(t),z.instance):(z.instance=new z(t),z.instance)}configure(t){return this.opts={...this.opts,...t},this}on(t,i){let e=this.listeners.get(t);return e||(e=new Set,this.listeners.set(t,e)),e.add(i),this}off(t,i){return this.listeners.get(t)?.delete(i),this}emit(t){const i=this.listeners.get(t);if(!i||i.size===0)return;const e={src:this.state.currentSrc,triggerEl:this.state.triggerEl,index:this.currentIndex,total:Math.max(this.gallery.length,1)};for(const s of i)s(e)}attach(){document.addEventListener("click",this.handleClick),document.addEventListener("pointerenter",this.handlePointerEnter,!0),document.addEventListener("pointerleave",this.handlePointerLeave,!0)}destroy(){this.stopDebugPanel(),document.removeEventListener("click",this.handleClick),document.removeEventListener("pointerenter",this.handlePointerEnter,!0),document.removeEventListener("pointerleave",this.handlePointerLeave,!0),this.cancelPreload(),this.stopSpring(),this.stopStripSpring(),this.stopFitTransition(),this.removeOverlay(),this.listeners.clear(),z.instance===this&&(z.instance=null)}defaultZoomState(){return{zoomed:!1,zoomingOut:!1,fitRect:new DOMRect,naturalWidth:0,naturalHeight:0,scale:1,panX:0,panY:0,isDragging:!1,dragStartX:0,dragStartY:0,dragStartPanX:0,dragStartPanY:0,dragMoved:!1}}defaultPinchState(){return{active:!1,initialDistance:0,initialScale:1,initialPanX:0,initialPanY:0,initialMidX:0,initialMidY:0,prevScale:1,prevScaleTime:0}}defaultDismissState(){return{tracking:!1,active:!1,fromOverlay:!1,startX:0,startY:0,offsetX:0,offsetY:0,scale:1,opacity:1}}defaultSwipeNavState(){return{active:!1,startX:0,offsetX:0,initialOffset:0}}handlePointerEnter(t){if(t.pointerType!=="mouse"||!(t.target instanceof Element))return;const i=t.target.closest(this.opts.selector);if(!i)return;const e=this.getSrcFromTrigger(i);e&&!this.preloadCache.has(e)&&(this.preloadTimer=setTimeout(()=>this.preloadImage(e),80))}handlePointerLeave(t){t.pointerType==="mouse"&&t.target instanceof Element&&t.target.closest(this.opts.selector)&&this.cancelPreload()}cancelPreload(){this.preloadTimer&&(clearTimeout(this.preloadTimer),this.preloadTimer=null)}preloadImage(t){if(this.preloadCache.has(t))return;const i=new Image;i.decoding="async",i.src=t,this.preloadCache.set(t,i)}schedulePreloads(){this.canNavigate(-1)&&this.preloadImage(this.gallery[this.wrapIndex(this.currentIndex-1)].src),this.canNavigate(1)&&this.preloadImage(this.gallery[this.wrapIndex(this.currentIndex+1)].src),this.userHasNavigated&&this.enqueueRemainingPreloads()}enqueueRemainingPreloads(){const t=[],i=new Set,e=s=>{const o=this.gallery[s]?.src;o&&!i.has(o)&&(i.add(o),t.push(o))};for(let s=2;s<this.gallery.length;s++){const o=this.currentIndex+s,n=this.currentIndex-s;this.opts.loop?(e(this.wrapIndex(o)),e(this.wrapIndex(n))):(o<this.gallery.length&&e(o),n>=0&&e(n))}this.preloadQueue=t.filter(s=>!this.preloadCache.has(s)),this.processPreloadQueue()}processPreloadQueue(){if(this.preloadingActive||this.preloadQueue.length===0)return;const t=this.preloadQueue.shift();if(this.preloadCache.has(t))return void this.processPreloadQueue();this.preloadingActive=!0;const i=new Image;i.decoding="async",i.onload=i.onerror=()=>{this.preloadingActive=!1,this.processPreloadQueue()},i.src=t,this.preloadCache.set(t,i)}buildGallery(t){const i=t.getAttribute("data-lightbox");if(!i)return this.gallery=[],void(this.currentIndex=0);const e=document.querySelectorAll(`[data-lightbox="${CSS.escape(i)}"]`);this.gallery=Array.from(e).map(s=>{const o=s,n=o.querySelector("img");return{triggerEl:o,src:this.getSrcFromTrigger(o),thumbSrc:n?.currentSrc||n?.src||"",caption:o.getAttribute("data-caption")||o.getAttribute("data-title")||"",alt:o.getAttribute("data-alt")||n?.alt||""}}),this.currentIndex=this.gallery.findIndex(s=>s.triggerEl===t),this.currentIndex===-1&&(this.currentIndex=0),this.userHasNavigated=!1}handleClick(t){const i=t.target.closest(this.opts.selector);i&&(t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.button!==0||(t.preventDefault(),this.openTrigger(i)))}handleKeydown(t){if(t.key!=="Tab")if(t.key==="Escape"){if(this.dismiss.active)return void this.dismissClose(0,0);this.zoom.zoomingOut?this.close():this.zoom.zoomed||this.zoom.scale!==1?this.zoomOut():this.close()}else t.key==="ArrowRight"?this.zoom.scale!==1||this.swipeNav.active||this.next():t.key==="ArrowLeft"&&(this.zoom.scale!==1||this.swipeNav.active||this.prev());else this.trapFocus(t)}trapFocus(t){if(!this.overlay)return;const i=this.overlay.querySelectorAll('button:not([disabled]):not([style*="display: none"])');if(i.length===0)return;const e=i[0],s=i[i.length-1];t.shiftKey?document.activeElement!==e&&this.overlay.contains(document.activeElement)||(t.preventDefault(),s.focus()):document.activeElement!==s&&this.overlay.contains(document.activeElement)||(t.preventDefault(),e.focus())}getSrcFromTrigger(t){const i=t.closest("a")||t;return i.getAttribute("href")||i.querySelector("img")?.src||""}open(t,i){if(t instanceof HTMLElement)this.openTrigger(t.closest(this.opts.selector)||t);else{if(!(i instanceof HTMLElement)){const e=document.querySelectorAll(`[data-lightbox="${CSS.escape(t)}"]`);if(e.length>0){const s=Math.min(Math.max(Math.trunc(i||0),0),e.length-1);return void this.openTrigger(e[s])}}this.resetForOpen(),this.openImage(t,i instanceof HTMLElement?i:void 0)}}openTrigger(t){const i=this.getSrcFromTrigger(t);i&&(this.resetForOpen(),this.buildGallery(t),this.openImage(i,t))}resetForOpen(){(this.state.isOpen||this.state.isAnimating||this.state.isClosing)&&(this.stopSpring(),this.stopFitTransition(),this.stopStripSpring(),this.state.isAnimating=!1,this.state.isClosing=!1,this.state.isDismissClosing=!1,this.finishClose())}openImage(t,i){if(this.state.isOpen||this.state.isAnimating)return;this.debugLog("open"),this.bounceRafId!==null&&(cancelAnimationFrame(this.bounceRafId),this.bounceRafId=null),this.state.isOpen=!0,this.state.isAnimating=!0,this.state.triggerEl=i||null,this.state.currentSrc=t,this.previouslyFocusedEl=document.activeElement,this.lockBodyScroll(),this.startDebugPanel(),this.emit("open");const e=i?.querySelector("img"),s=e?.currentSrc||e?.src||"";if(this.isTextLink=!e,this.isTextLink)return this.thumbBorderRadius=0,void this.openTextLink(i||null,t);const o=this.getThumbRect(i);this.thumbBorderRadius=this.getThumbBorderRadius(i);const n=o.width===0||o.height===0||!this.isInViewport(o),a=this.preloadCache.get(t),h=a?.complete&&a.naturalWidth>0,r=this.getDimensionHint(i);if(n&&!h&&!r&&!e.naturalWidth)return void this.openTextLink(null,t);const l=n?new DOMRect(window.innerWidth/2,window.innerHeight/2,0,0):o;this.createOverlay(s||t),this.createChrome(),this.computeChromeDrift(l.x+l.width/2,l.y+l.height/2),document.addEventListener("keydown",this.handleKeydown),this.setThumbVisibility(!1);const c=e.naturalWidth||o.width,u=e.naturalHeight||o.height;let p,m,d;h?(p=a.naturalWidth,m=a.naturalHeight,d=this.computeTargetRect(p,m)):r?(p=r.w,m=r.h,d=this.computeTargetRect(p,m)):(p=c,m=u,d=this.computeTargetRectFromAspectRatio(p,m)),this.positionImage(d),this.zoom=this.defaultZoomState(),this.zoom.fitRect=d,this.zoom.naturalWidth=p,this.zoom.naturalHeight=m;const g=l.x+l.width/2-(d.x+d.width/2),y=l.y+l.height/2-(d.y+d.height/2),{flipScale:S,hasCrop:w}=n?{flipScale:0,hasCrop:!1}:this.computeFlipCrop(o,d,i,!1);s&&s!==t&&this.swapToFullRes(t),this.gallery.length>1&&this.schedulePreloads(),this.populateAdjacentSlides(),this.animateSpring({translateX:g,translateY:y,scale:S,opacity:0,crop:w?1:0,borderRadius:this.thumbBorderRadius},{translateX:0,translateY:0,scale:1,opacity:1,crop:0,borderRadius:this.getTargetBorderRadius()},this.opts.springOpen,()=>{this.state.isAnimating=!1,this.updateCursorState(),this.emit("opened")},void 0,void 0,void 0,b=>b.opacity>.99)}openTextLink(t,i){const e=this.preloadCache.get(i);if(e?.complete&&e.naturalWidth>0)return void this.openTextLinkWithImage(t,i,e.naturalWidth,e.naturalHeight);this.createOverlay(""),this.createChrome();const s=t?t.getBoundingClientRect().x+t.getBoundingClientRect().width/2:window.innerWidth/2,o=t?t.getBoundingClientRect().y+t.getBoundingClientRect().height/2:window.innerHeight/2;this.computeChromeDrift(s,o),document.addEventListener("keydown",this.handleKeydown),this.imgEl&&(this.imgEl.style.opacity="0"),this.spinnerTimer=setTimeout(()=>{if(this.overlay&&this.state.currentSrc===i){const a=document.createElement("div");a.className="lightbox3-spinner",this.overlay.appendChild(a),this.spinnerEl=a}},300);const n=this.getTargetBorderRadius();this.animateSpring({translateX:0,translateY:0,scale:1,opacity:0,crop:0,borderRadius:n},{translateX:0,translateY:0,scale:1,opacity:1,crop:0,borderRadius:n},this.opts.springOpen,()=>{},void 0),this.loadImage(i).then(a=>{this.imgEl&&this.state.currentSrc===i&&!this.state.isClosing&&this.state.isOpen&&(this.removeSpinner(),this.openTextLinkWithImage(t,i,a.width,a.height))})}openTextLinkWithImage(t,i,e,s){const o=t?this.getThumbRect(t):new DOMRect(window.innerWidth/2,window.innerHeight/2,0,0),n=this.computeTargetRect(e,s);this.overlay?this.imgEl.src=i:(this.createOverlay(i),this.createChrome(),this.computeChromeDrift(o.x+o.width/2,o.y+o.height/2),document.addEventListener("keydown",this.handleKeydown)),this.positionImage(n),this.zoom=this.defaultZoomState(),this.zoom.fitRect=n,this.zoom.naturalWidth=e,this.zoom.naturalHeight=s,this.gallery.length>1&&this.schedulePreloads(),this.populateAdjacentSlides();const a=this.textLinkFlipRect(o,e,s),h=a.width/n.width,r=a.height/n.height,l=Math.min(h,r),c=a.x+a.width/2-(n.x+n.width/2),u=a.y+a.height/2-(n.y+n.height/2),p=this.getTargetBorderRadius();this.animateSpring({translateX:c,translateY:u,scale:l,opacity:0,crop:0,borderRadius:0},{translateX:0,translateY:0,scale:1,opacity:1,crop:0,borderRadius:p},this.opts.springOpen,()=>{this.state.isAnimating=!1,this.updateCursorState(),this.emit("opened")},void 0,void 0,void 0,m=>m.opacity>.99)}textLinkFlipRect(t,i,e){const s=i/e,o=t.height,n=o*s,a=t.x+t.width/2,h=t.y+t.height/2;return new DOMRect(a-n/2,h-o/2,n,o)}removeSpinner(){this.spinnerTimer&&(clearTimeout(this.spinnerTimer),this.spinnerTimer=null),this.spinnerEl&&(this.spinnerEl.remove(),this.spinnerEl=null)}swapToFullRes(t){this.loadImage(t).then(i=>{if(this.imgEl&&this.state.currentSrc===t&&!this.state.isClosing&&this.state.isOpen){if(this.imgEl.src=t,this.zoom.naturalWidth=i.width,this.zoom.naturalHeight=i.height,!this.zoom.zoomed){const e=this.computeTargetRect(i.width,i.height),s=this.zoom.fitRect,o=Math.abs(e.x-s.x),n=Math.abs(e.y-s.y),a=Math.abs(e.width-s.width),h=Math.abs(e.height-s.height);o>1||n>1||a>1||h>1?this.animateFitTransition(s,e):(this.zoom.fitRect=e,this.positionImage(e))}this.updateCursorState()}})}animateFitTransition(t,i){if(this.stopFitTransition(),this.reducedMotion)return this.zoom.fitRect=i,void this.positionImage(i);const e=this.imgEl,s=P,o={x:{position:t.x,velocity:0,settled:!1},y:{position:t.y,velocity:0,settled:!1},w:{position:t.width,velocity:0,settled:!1},h:{position:t.height,velocity:0,settled:!1}};let n=performance.now();const a=h=>{const r=Math.min((h-n)/1e3,.064);if(n=h,o.x=f(s,o.x,i.x,r),o.y=f(s,o.y,i.y,r),o.w=f(s,o.w,i.width,r),o.h=f(s,o.h,i.height,r),Object.assign(e.style,{left:`${o.x.position}px`,top:`${o.y.position}px`,width:`${o.w.position}px`,height:`${o.h.position}px`}),o.x.settled&&o.y.settled&&o.w.settled&&o.h.settled)return this.zoom.fitRect=i,this.positionImage(i),void(this.fitRafId=null);this.zoom.fitRect=new DOMRect(o.x.position,o.y.position,o.w.position,o.h.position),this.fitRafId=requestAnimationFrame(a)};this.fitRafId=requestAnimationFrame(a)}stopFitTransition(){this.fitRafId!==null&&(cancelAnimationFrame(this.fitRafId),this.fitRafId=null)}close(){if(this.state.isClosing||!this.state.isOpen&&!this.state.isAnimating)return;if(this.dismiss.active)return void this.dismissClose(0,0);if(this.pinch.active&&this.zoom.scale<1)return this.pinch.active=!1,void this.pinchClose();if(this.stopStripSpring(),this.stripOffset=0,this.stripEl&&(this.stripEl.style.transform=""),this.swipeNav=this.defaultSwipeNavState(),this.state.isClosing=!0,this.emit("close"),this.stopSpring(),this.stopFitTransition(),this.stopChromeSpring(),this.chromeSpring={position:0,velocity:0},this.state.isAnimating=!1,this.dismiss=this.defaultDismissState(),this.overlay){const p=this.overlay;setTimeout(()=>{p.style.pointerEvents="none"},80)}(this.zoom.zoomed||this.zoom.zoomingOut||this.zoom.scale!==1)&&(this.zoom.scale=1,this.zoom.panX=0,this.zoom.panY=0,this.zoom.zoomed=!1,this.zoom.zoomingOut=!1,this.imgEl.style.transform=""),this.state.isAnimating=!0;const t=this.state.triggerEl?this.getThumbRect(this.state.triggerEl):null,i=!!t&&this.isInViewport(t);i?this.computeChromeDrift(t.x+t.width/2,t.y+t.height/2):this.computeChromeDrift(window.innerWidth/2,window.innerHeight/2);const e=this.state.triggerEl;let s=!1;const o=p=>p.opacity<.01&&(!s&&e&&(s=!0,this.bounceTrigger(e)),!0),n=this.getTargetBorderRadius();if(!i)return this.shrinkingToCenter=!0,void this.animateSpring({translateX:0,translateY:0,scale:1,opacity:1,crop:0,borderRadius:n},{translateX:0,translateY:0,scale:0,opacity:0,crop:0,borderRadius:n},A,()=>this.finishClose(),o);const{fitRect:a}=this.zoom,h=this.isTextLink?this.textLinkFlipRect(t,this.zoom.naturalWidth,this.zoom.naturalHeight):t,r=h.x+h.width/2-(a.x+a.width/2),l=h.y+h.height/2-(a.y+a.height/2),{flipScale:c,hasCrop:u}=this.computeFlipCrop(h,a,this.state.triggerEl,this.isTextLink);this.animateSpring({translateX:0,translateY:0,scale:1,opacity:1,crop:0,borderRadius:n},{translateX:r,translateY:l,scale:c,opacity:0,crop:u?1:0,borderRadius:this.thumbBorderRadius},this.opts.springClose,()=>this.finishClose(),o)}finishClose(){this.debugLog("finishClose"),this.stopDebugPanel(),this.removeSpinner(),this.stopFitTransition(),this.stopChromeSpring(),this.chromeSpring={position:0,velocity:0},this.chromeBaseOpacity=0,this.resetChromeDrift(),this.setThumbVisibility(!0),this.removeOverlay(),this.unlockBodyScroll(),document.removeEventListener("keydown",this.handleKeydown),this.previouslyFocusedEl&&(this.previouslyFocusedEl.focus(),this.previouslyFocusedEl=null),this.emit("closed"),this.state.isOpen=!1,this.state.isAnimating=!1,this.state.isClosing=!1,this.state.isDismissClosing=!1,this.state.triggerEl=null,this.shrinkingToCenter=!1,this.zoom=this.defaultZoomState(),this.pointerCache=[],this.pinch=this.defaultPinchState(),this.dismiss=this.defaultDismissState(),this.swipeNav=this.defaultSwipeNavState(),this.pendingNavDirection=null,this.gallery=[],this.currentIndex=0,this.userHasNavigated=!1,this.stripOffset=0,this.preloadQueue=[],this.preloadingActive=!1,this.wheelDismissY=0,this.wheelNavCommitted=!1,this.wheelNavTotalDelta=0,this.wheelGestureTimer!==null&&(clearTimeout(this.wheelGestureTimer),this.wheelGestureTimer=null),this.wheelSnapBackTimer!==null&&(clearTimeout(this.wheelSnapBackTimer),this.wheelSnapBackTimer=null)}bounceTrigger(t){if(this.reducedMotion)return;this.bounceRafId!==null&&(cancelAnimationFrame(this.bounceRafId),this.bounceRafId=null);const i={stiffness:900,damping:80,mass:1},e={position:.98,velocity:0};let s=performance.now();t.style.transform=`scale(${e.position})`;const o=n=>{const a=Math.min((n-s)/1e3,.064);s=n;const h=f(i,e,1,a);e.position=h.position,e.velocity=h.velocity,t.style.transform=h.settled?"":`scale(${h.position})`,h.settled?this.bounceRafId=null:this.bounceRafId=requestAnimationFrame(o)};this.bounceRafId=requestAnimationFrame(o)}wrapIndex(t){const i=this.gallery.length;return i===0?0:(t%i+i)%i}canNavigate(t){const i=this.gallery.length;return!(i<=1)&&(!!this.opts.loop||(t===1?this.currentIndex<i-1:this.currentIndex>0))}next(){this.gallery.length<=1||this.zoom.scale===1&&(this.forceCompleteStripAnimation(),this.canNavigate(1)?this.navigateTo(1):this.bounceStrip(-1))}prev(){this.gallery.length<=1||this.zoom.scale===1&&(this.forceCompleteStripAnimation(),this.canNavigate(-1)?this.navigateTo(-1):this.bounceStrip(1))}navigateTo(t){this.debugLog(`navigateTo(${t>0?"next":"prev"})`),this.userHasNavigated=!0,this.pendingNavDirection=t;const i=t===1?this.nextSlideEl:this.prevSlideEl;i&&(i.style.pointerEvents="auto");const e=window.innerWidth+I,s=-t*e;this.animateStrip(this.stripOffset,s,this.opts.springOpen,0,()=>this.completeNavigation(t))}completeNavigation(t){this.debugLog(`completeNavigation(${t>0?"next":"prev"})`),this.pendingNavDirection=null,this.setThumbVisibility(!0),this.currentIndex=this.wrapIndex(this.currentIndex+t);const i=this.gallery[this.currentIndex];this.state.triggerEl=i.triggerEl,this.state.currentSrc=i.src,this.thumbBorderRadius=this.getThumbBorderRadius(i.triggerEl),this.setThumbVisibility(!1),this.emit("navigate"),this.updateChromeContent(),this.chromeFadeSwapped=!1,this.chromeCaption&&(this.chromeCaption.style.opacity=""),this.chromeCounter&&(this.chromeCounter.style.opacity=""),this.stripOffset=0,this.stripEl&&(this.stripEl.style.transform=""),this.schedulePreloads(),this.recycleSlots(t),this.setupCurrentImage(),this.wheelNavCommitted=!1,this.wheelNavTotalDelta=0}recycleSlots(t){const i=window.innerWidth+I;t===1?(this.prevSlideEl&&this.prevSlideEl.remove(),this.prevSlideEl=this.currentSlideEl,this.prevSlideImg=this.imgEl,this.prevSlideEl&&(this.prevSlideEl.style.left=-i+"px",this.prevSlideEl.style.pointerEvents="none"),this.currentSlideEl=this.nextSlideEl,this.imgEl=this.nextSlideImg,this.currentSlideEl&&(this.currentSlideEl.style.left="0",this.currentSlideEl.style.pointerEvents="auto"),this.nextSlideEl=null,this.nextSlideImg=null,this.canNavigate(1)&&this.createAdjacentSlide(this.wrapIndex(this.currentIndex+1),i)):(this.nextSlideEl&&this.nextSlideEl.remove(),this.nextSlideEl=this.currentSlideEl,this.nextSlideImg=this.imgEl,this.nextSlideEl&&(this.nextSlideEl.style.left=`${i}px`,this.nextSlideEl.style.pointerEvents="none"),this.currentSlideEl=this.prevSlideEl,this.imgEl=this.prevSlideImg,this.currentSlideEl&&(this.currentSlideEl.style.left="0",this.currentSlideEl.style.pointerEvents="auto"),this.prevSlideEl=null,this.prevSlideImg=null,this.canNavigate(-1)&&this.createAdjacentSlide(this.wrapIndex(this.currentIndex-1),-i))}setupCurrentImage(){this.zoom=this.defaultZoomState(),this.stopFitTransition();const t=this.gallery[this.currentIndex];if(!t||!this.imgEl)return;const i=this.preloadCache.get(t.src),e=i?.complete&&i.naturalWidth>0,s=this.imgEl.src===t.src&&this.imgEl.complete&&this.imgEl.naturalWidth>0;if(e||s){const n=e?i.naturalWidth:this.imgEl.naturalWidth,a=e?i.naturalHeight:this.imgEl.naturalHeight;this.zoom.naturalWidth=n,this.zoom.naturalHeight=a,this.zoom.fitRect=this.computeTargetRect(n,a),this.imgEl.src=t.src,this.positionImage(this.zoom.fitRect)}else{const n=this.getDimensionHint(t.triggerEl);if(n)this.zoom.naturalWidth=n.w,this.zoom.naturalHeight=n.h,this.zoom.fitRect=this.computeTargetRect(n.w,n.h);else{const a=t.triggerEl.querySelector("img"),h=a?.naturalWidth||400,r=a?.naturalHeight||300;this.zoom.naturalWidth=h,this.zoom.naturalHeight=r,this.zoom.fitRect=this.computeTargetRectFromAspectRatio(h,r)}this.positionImage(this.zoom.fitRect),this.swapToFullRes(t.src)}const o=this.getTargetBorderRadius();this.imgEl&&(this.imgEl.style.borderRadius=o>0?`${o}px`:""),this.updateCursorState()}resolveStripAnimation(){if(this.stripRafId===null)return;this.stopStripSpring();const t=window.innerWidth+I;if(Math.abs(this.stripOffset)>t/2){const i=this.stripOffset<0?1:-1;this.canNavigate(i)&&(this.stripOffset+=i*t,this.completeNavigation(i))}this.applyStripOffset(this.stripOffset)}animateSpring(t,i,e,s,o,n,a,h){this.stopSpring();const r=this.imgEl,l=this.backdrop;if(this.reducedMotion)return this.applyAnimState(r,l,i),void s();const c=[{key:"translateX",state:{position:t.translateX,velocity:n?.translateX??0},target:i.translateX,config:a?.translateX??e},{key:"translateY",state:{position:t.translateY,velocity:n?.translateY??0},target:i.translateY,config:a?.translateY??e},{key:"scale",state:{position:t.scale,velocity:n?.scale??0},target:i.scale,config:a?.scale??e},{key:"opacity",state:{position:t.opacity,velocity:n?.opacity??0},target:i.opacity,config:a?.opacity??e},{key:"crop",state:{position:t.crop,velocity:n?.crop??0},target:i.crop,config:a?.crop??e},{key:"borderRadius",state:{position:t.borderRadius,velocity:n?.borderRadius??0},target:i.borderRadius,config:a?.borderRadius??e}];let u=performance.now(),p=!1;this.applyAnimState(r,l,t);const m=d=>{const g=Math.min((d-u)/1e3,.064);u=d;let y=!0;const S={};for(const b of c){const v=f(b.config,b.state,b.target,g);b.state=v,S[b.key]=v.position,v.settled||(y=!1)}const w=S;if(this.applyAnimState(r,l,w),!p&&h?.(w)&&(p=!0,s()),y||o?.(w))return this.applyAnimState(r,l,i),this.debugLog("mainRaf settled"+(o?.(w)?" (early)":"")),this.rafId=null,void(p||s());this.rafId=requestAnimationFrame(m)};this.rafId=requestAnimationFrame(m)}applyAnimState(t,i,e){if(t.style.transform=`translate(${e.translateX}px, ${e.translateY}px) scale(${e.scale})`,i.style.opacity=String(e.opacity),this.shrinkingToCenter){const s=(e.scale-Y)/.35;t.style.opacity=String(Math.min(1,Math.max(0,s)))}else this.isTextLink?t.style.opacity=String(Math.min(1,e.opacity/.2)):this.state.isClosing&&!this.state.isDismissClosing&&window.innerWidth<=600?t.style.opacity=e.opacity<.02?String(e.opacity/.02):"":t.style.opacity="";if(e.crop>.001){const{top:s,right:o,bottom:n,left:a}=this.cropInsets,h=e.borderRadius>.1?e.borderRadius/Math.max(e.scale,.01):0;t.style.clipPath=`inset(${e.crop*s}px ${e.crop*o}px ${e.crop*n}px ${e.crop*a}px round ${h}px)`}else t.style.clipPath="";if(e.crop<=.001){const s=e.borderRadius>.1?e.borderRadius/Math.max(e.scale,.01):0;t.style.borderRadius=s>.1?`${s}px`:""}else t.style.borderRadius="";this.chromeBaseOpacity=this.state.isClosing?Math.pow(e.opacity,2):e.opacity,this.chromeDriftProgress=1-e.opacity,this.updateChromeVisuals()}animateStrip(t,i,e,s,o){if(this.stopStripSpring(),this.reducedMotion)return this.stripOffset=i,this.applyStripOffset(i),void o();let n={position:t,velocity:s},a=performance.now();const h=r=>{const l=Math.min((r-a)/1e3,.064);a=r;const c=f(e,n,i,l);n=c,this.stripOffset=c.position,this.applyStripOffset(c.position);const u=Math.abs(c.position-i)<1&&Math.abs(c.velocity)<5;if(c.settled||u)return this.stripOffset=i,this.applyStripOffset(i),this.debugLog("stripRaf settled"),this.stripRafId=null,void o();this.stripRafId=requestAnimationFrame(h)};this.stripRafId=requestAnimationFrame(h)}stopStripSpring(){this.stripRafId!==null&&(cancelAnimationFrame(this.stripRafId),this.stripRafId=null)}applyStripOffset(t){this.stripEl&&(this.stripEl.style.transform=t?`translateX(${t}px)`:""),this.updateChromeFade(t)}updateChromeFade(t){if(this.gallery.length<=1)return;if(t===0)return this.chromeCaption&&(this.chromeCaption.style.opacity=""),this.chromeCounter&&(this.chromeCounter.style.opacity=""),void(this.chromeFadeSwapped=!1);const i=t<0?1:-1;if(!this.canNavigate(i))return;const e=this.wrapIndex(this.currentIndex+i),s=window.innerWidth+I,o=Math.min(1,Math.abs(t)/s),n=Math.abs(1-2*o);if(o>.5&&!this.chromeFadeSwapped){this.chromeFadeSwapped=!0;const a=this.gallery[e];if(this.chromeCounter&&(this.chromeCounter.textContent=`${e+1}\u2009/\u2009${this.gallery.length}`),this.chromeCaption){const h=a?.caption||"";this.chromeCaption.innerHTML=h,this.chromeCaption.style.display=h?"":"none"}}else if(o<=.5&&this.chromeFadeSwapped){this.chromeFadeSwapped=!1;const a=this.gallery[this.currentIndex];if(this.chromeCounter&&(this.chromeCounter.textContent=`${this.currentIndex+1}\u2009/\u2009${this.gallery.length}`),this.chromeCaption){const h=a?.caption||"";this.chromeCaption.innerHTML=h,this.chromeCaption.style.display=h?"":"none"}}this.chromeCaption&&(this.chromeCaption.style.opacity=String(n)),this.chromeCounter&&(this.chromeCounter.style.opacity=String(n))}bounceStrip(t){this.debugLog(`bounceStrip(${t>0?"right":"left"})`),this.animateStrip(0,0,{stiffness:400,damping:24,mass:1},1200*t,()=>{this.stripOffset=0})}forceCompleteStripAnimation(){this.stripRafId!==null&&(this.stopStripSpring(),this.pendingNavDirection!==null?this.completeNavigation(this.pendingNavDirection):(this.stripOffset=0,this.applyStripOffset(0)))}isZoomable(){const{fitRect:t,naturalWidth:i,naturalHeight:e}=this.zoom;return i>1.05*t.width||e>1.05*t.height}getTapZoomScale(){const{fitRect:t,naturalWidth:i}=this.zoom,e=i/t.width;return Math.min(Math.max(e,2),3)}getMaxZoomScale(){const{fitRect:t,naturalWidth:i}=this.zoom,e=i/t.width;return Math.max(e,2)}zoomIn(t,i){if(!this.imgEl||!this.isZoomable())return;this.debugLog("zoomIn"),this.emit("zoomIn"),this.stopSpring(),this.state.isAnimating=!0,this.animateChrome(1);const{fitRect:e}=this.zoom,s=this.getTapZoomScale(),o=t-(e.x+e.width/2),n=i-(e.y+e.height/2);let a=-(o*s-o),h=-(n*s-n);const r=this.computePanBounds(s);if(a=E(a,r.minX,r.maxX),h=E(h,r.minY,r.maxY),this.reducedMotion)return this.zoom.panX=a,this.zoom.panY=h,this.zoom.scale=s,this.zoom.zoomed=!0,this.applyPanTransform(),this.state.isAnimating=!1,void this.updateCursorState();const l=this.zoom.panX,c=this.zoom.panY,u=this.zoom.scale;let p={position:l,velocity:0},m={position:c,velocity:0},d={position:u,velocity:0};const g=this.opts.springOpen;let y=performance.now(),S=!1;const w=b=>{const v=Math.min((b-y)/1e3,.064);y=b;const T=f(g,p,a,v),O=f(g,m,h,v),X=f(g,d,s,v);if(p=T,m=O,d=X,this.zoom.panX=T.position,this.zoom.panY=O.position,this.zoom.scale=X.position,this.applyPanTransform(),!S&&X.position>1&&(S=!0,this.zoom.zoomed=!0,this.state.isAnimating=!1,this.updateCursorState()),T.settled&&O.settled&&X.settled)return this.zoom.panX=a,this.zoom.panY=h,this.zoom.scale=s,this.applyPanTransform(),this.rafId=null,void(S||(this.zoom.zoomed=!0,this.state.isAnimating=!1,this.updateCursorState()));this.rafId=requestAnimationFrame(w)};this.rafId=requestAnimationFrame(w)}zoomOut(){if(!this.imgEl)return;if(this.debugLog("zoomOut"),this.emit("zoomOut"),this.stopSpring(),this.state.isAnimating=!0,this.zoom.zoomingOut=!0,this.animateChrome(0),this.reducedMotion)return this.zoom.panX=0,this.zoom.panY=0,this.zoom.scale=1,this.zoom.zoomed=!1,this.zoom.zoomingOut=!1,this.applyPanTransform(),this.state.isAnimating=!1,void this.updateCursorState();const t=this.zoom.panX,i=this.zoom.panY,e=this.zoom.scale;let s={position:t,velocity:0},o={position:i,velocity:0},n={position:e,velocity:0};const a=this.opts.springClose;let h=performance.now(),r=!1;const l=c=>{const u=Math.min((c-h)/1e3,.064);h=c;const p=f(a,s,0,u),m=f(a,o,0,u),d=f(a,n,1,u);if(s=p,o=m,n=d,this.zoom.panX=p.position,this.zoom.panY=m.position,this.zoom.scale=d.position,this.applyPanTransform(),!r&&Math.abs(d.position-1)<.005&&Math.abs(p.position)<1&&Math.abs(m.position)<1&&(r=!0,this.zoom.zoomed=!1,this.zoom.zoomingOut=!1,this.state.isAnimating=!1,this.updateCursorState()),p.settled&&m.settled&&d.settled)return this.zoom.panX=0,this.zoom.panY=0,this.zoom.scale=1,this.applyPanTransform(),this.rafId=null,void(r||(this.zoom.zoomed=!1,this.zoom.zoomingOut=!1,this.state.isAnimating=!1,this.updateCursorState()));this.rafId=requestAnimationFrame(l)};this.rafId=requestAnimationFrame(l)}handleImagePointerDown(t){if(t.preventDefault(),this.pointerCache.push(t),t.target.setPointerCapture(t.pointerId),this.pointerCache.length===2)return void this.startPinch();const i=!this.zoom.zoomed||this.zoom.zoomingOut,e=this.state.isAnimating&&!this.zoom.zoomingOut;if(i&&!e)return this.resolveStripAnimation(),this.stopSpring(),this.zoom.scale=1,this.zoom.panX=0,this.zoom.panY=0,this.zoom.zoomed=!1,this.zoom.zoomingOut=!1,this.applyPanTransform(),this.state.isAnimating=!1,this.dismiss.tracking=!0,this.dismiss.startX=t.clientX,this.dismiss.startY=t.clientY,this.velocitySamples=[],void this.addVelocitySample(t.clientX,t.clientY);this.stopSpring(),this.zoom.zoomed=!0,this.state.isAnimating=!1,this.zoom.isDragging=!0,this.zoom.dragMoved=!1,this.zoom.dragStartX=t.clientX,this.zoom.dragStartY=t.clientY,this.zoom.dragStartPanX=this.zoom.panX,this.zoom.dragStartPanY=this.zoom.panY,this.velocitySamples=[],this.addVelocitySample(t.clientX,t.clientY),this.updateCursorState()}handleOverlayPointerDown(t){if(t.target===this.imgEl||this.chromeBar&&this.chromeBar.contains(t.target))return;const i=!this.zoom.zoomed||this.zoom.zoomingOut,e=this.state.isAnimating&&!this.zoom.zoomingOut;i&&!e&&(t.preventDefault(),this.overlay.setPointerCapture(t.pointerId),this.resolveStripAnimation(),this.stopSpring(),this.zoom.zoomingOut&&(this.zoom.scale=1,this.zoom.panX=0,this.zoom.panY=0,this.zoom.zoomed=!1,this.zoom.zoomingOut=!1,this.applyPanTransform()),this.state.isAnimating=!1,this.dismiss.tracking=!0,this.dismiss.fromOverlay=!0,this.dismiss.startX=t.clientX,this.dismiss.startY=t.clientY,this.velocitySamples=[],this.addVelocitySample(t.clientX,t.clientY))}handlePointerMove(t){if(!this.imgEl)return;const i=this.pointerCache.findIndex(h=>h.pointerId===t.pointerId);if(i>=0&&(this.pointerCache[i]=t),this.pinch.active&&this.pointerCache.length===2)return void this.updatePinch();if(this.swipeNav.active)return void this.handleSwipeNavMove(t);if(this.dismiss.tracking||this.dismiss.active)return void this.handleDismissMove(t);if(!this.zoom.isDragging)return;const e=t.clientX-this.zoom.dragStartX,s=t.clientY-this.zoom.dragStartY;!this.zoom.dragMoved&&Math.hypot(e,s)>4&&(this.zoom.dragMoved=!0),this.addVelocitySample(t.clientX,t.clientY);let o=this.zoom.dragStartPanX+e,n=this.zoom.dragStartPanY+s;const a=this.computePanBounds(this.zoom.scale);o=D(o,a.minX,a.maxX),n=D(n,a.minY,a.maxY),this.zoom.panX=o,this.zoom.panY=n,this.applyPanTransform()}handlePointerUp(t){this.pointerCache=this.pointerCache.filter(s=>s.pointerId!==t.pointerId);try{t.target.releasePointerCapture(t.pointerId)}catch{}if(this.pinch.active)return void(this.pointerCache.length<2&&this.endPinch());if(this.swipeNav.active)return void this.handleSwipeNavRelease();if(this.dismiss.tracking||this.dismiss.active)return void this.handleDismissRelease();if(!this.zoom.isDragging)return;const i=this.zoom.dragMoved;if(this.zoom.isDragging=!1,this.updateCursorState(),!i)return this.zoomOut(),void(this.zoom.dragMoved=!0);const e=this.computeVelocity();this.startPanMomentum(e.vx,e.vy)}addVelocitySample(t,i){const e=performance.now();this.velocitySamples.push({x:t,y:i,t:e});const s=e-80;for(;this.velocitySamples.length>1&&this.velocitySamples[0].t<s;)this.velocitySamples.shift()}computeVelocity(){const t=this.velocitySamples;if(t.length<2)return{vx:0,vy:0};const i=t[0],e=t[t.length-1],s=(e.t-i.t)/1e3;return s<.001?{vx:0,vy:0}:{vx:(e.x-i.x)/s,vy:(e.y-i.y)/s}}handleDismissMove(t){const i=t.clientX-this.dismiss.startX,e=t.clientY-this.dismiss.startY;if(!this.dismiss.active){if(Math.hypot(i,e)<10)return;if(!(Math.abs(e)>1.5*Math.abs(i))){if(this.gallery.length>1){const n=this.dismiss.startX;this.dismiss=this.defaultDismissState(),this.zoom.dragMoved=!0,this.startSwipeNav(n,t.clientX)}else this.dismiss=this.defaultDismissState();return}this.dismiss.active=!0,this.dismiss.tracking=!1,this.zoom.dragMoved=!0,this.stripOffset!==0&&(this.stripOffset=0,this.applyStripOffset(0))}this.addVelocitySample(t.clientX,t.clientY),this.dismiss.offsetX=i,this.dismiss.offsetY=e;const s=window.innerHeight,o=Math.hypot(i,e)/s;this.dismiss.scale=Math.max(.7,1-.3*o),this.dismiss.opacity=Math.max(0,1-o/.4),this.applyDismissTransform()}applyDismissTransform(){if(!this.imgEl||!this.backdrop)return;const{offsetX:t,offsetY:i,scale:e}=this.dismiss;this.imgEl.style.transform=`translate(${t}px, ${i}px) scale(${e})`,this.backdrop.style.opacity=String(this.dismiss.opacity),this.chromeBaseOpacity=this.dismiss.opacity,this.updateChromeVisuals()}handleDismissRelease(){if(!this.dismiss.active){const o=this.dismiss.fromOverlay;return this.dismiss=this.defaultDismissState(),void(o&&this.close())}const{vx:t,vy:i}=this.computeVelocity(),e=Math.hypot(this.dismiss.offsetX,this.dismiss.offsetY),s=Math.hypot(t,i);e<5&&s<50?this.dismissSnapBack(t,i):this.dismissClose(t,i)}dismissClose(t,i){if(this.debugLog("dismissClose"),this.state.isClosing=!0,this.state.isDismissClosing=!0,this.emit("close"),this.state.isAnimating=!0,this.stopFitTransition(),this.overlay){const v=this.overlay;setTimeout(()=>{v.style.pointerEvents="none"},80)}const{offsetX:e,offsetY:s,scale:o,opacity:n}=this.dismiss;this.dismiss=this.defaultDismissState();const a=this.state.triggerEl?this.getThumbRect(this.state.triggerEl):null,h=this.getTargetBorderRadius();if(!a||!this.isInViewport(a))return this.shrinkingToCenter=!0,void this.animateSpring({translateX:e,translateY:s,scale:o,opacity:n,crop:0,borderRadius:h},{translateX:0,translateY:0,scale:0,opacity:0,crop:0,borderRadius:h},A,()=>this.finishClose(),v=>v.opacity<.01&&v.scale<Y,{translateX:t,translateY:i});const{fitRect:r}=this.zoom,l=this.isTextLink?this.textLinkFlipRect(a,this.zoom.naturalWidth,this.zoom.naturalHeight):a,c=l.x+l.width/2-(r.x+r.width/2),u=l.y+l.height/2-(r.y+r.height/2),{flipScale:p,hasCrop:m}=this.computeFlipCrop(l,r,this.state.triggerEl,this.isTextLink),d=this.state.triggerEl;let g=!1;const y=this.opts.springClose,S=Math.abs(t),w=Math.abs(i);let b;if(Math.max(S,w)/(Math.min(S,w)||1)>1.5&&Math.max(S,w)>100){const v={...y,stiffness:.55*y.stiffness,damping:.85*y.damping};b=w>S?{translateY:v}:{translateX:v}}this.animateSpring({translateX:e,translateY:s,scale:o,opacity:n,crop:0,borderRadius:h},{translateX:c,translateY:u,scale:p,opacity:0,crop:m?1:0,borderRadius:this.thumbBorderRadius},this.opts.springClose,()=>this.finishClose(),v=>{const T=Math.abs(v.scale-p)<.05&&Math.abs(v.translateX-c)<20&&Math.abs(v.translateY-u)<20;return T&&!g&&d&&(g=!0,this.bounceTrigger(d)),T},{translateX:t,translateY:i},b)}dismissSnapBack(t,i){const{offsetX:e,offsetY:s,scale:o,opacity:n}=this.dismiss;this.dismiss=this.defaultDismissState();const a=this.getTargetBorderRadius();this.animateSpring({translateX:e,translateY:s,scale:o,opacity:n,crop:0,borderRadius:a},{translateX:0,translateY:0,scale:1,opacity:1,crop:0,borderRadius:a},R,()=>{},void 0,{translateX:t,translateY:i})}lockBodyScroll(){const t=window.innerWidth-document.documentElement.clientWidth;this.savedBodyOverflow=document.body.style.overflow,this.savedHtmlPaddingRight=document.documentElement.style.paddingRight,document.body.style.overflow="hidden",t>0&&(document.documentElement.style.paddingRight=`${t}px`)}unlockBodyScroll(){document.body.style.overflow=this.savedBodyOverflow,document.documentElement.style.paddingRight=this.savedHtmlPaddingRight}handleWheel(t){t.preventDefault(),!this.state.isClosing&&this.state.isOpen&&(this.dismiss.active||this.dismiss.tracking||this.swipeNav.active||this.zoom.isDragging||(this.wheelGestureTimer!==null&&clearTimeout(this.wheelGestureTimer),this.wheelGestureTimer=setTimeout(()=>{this.debugLog("gesture timer \u2192 reset wheel state"),this.wheelGestureTimer=null,this.wheelDismissY=0,this.wheelNavCommitted=!1,this.wheelNavTotalDelta=0},80),this.handleScroll(t)))}handleScroll(t){const i=t.deltaMode===1?16:1,e=t.deltaX*i,s=t.deltaY*i,o=Math.abs(e),n=Math.abs(s);this.zoom.zoomed||this.zoom.scale!==1?this.wheelPan(e,s):o>n&&this.gallery.length>1?this.wheelNavigate(e):n>0&&this.wheelDismiss(s)}wheelPan(t,i){this.stopSpring();const e=this.computePanBounds(this.zoom.scale);if(this.zoom.panX-=t,this.zoom.panY-=i,this.zoom.panX<e.minX){const s=e.minX-this.zoom.panX;this.zoom.panX=e.minX-s*C}else if(this.zoom.panX>e.maxX){const s=this.zoom.panX-e.maxX;this.zoom.panX=e.maxX+s*C}if(this.zoom.panY<e.minY){const s=e.minY-this.zoom.panY;this.zoom.panY=e.minY-s*C}else if(this.zoom.panY>e.maxY){const s=this.zoom.panY-e.maxY;this.zoom.panY=e.maxY+s*C}this.applyPanTransform(),this.scheduleWheelSnapBack()}scheduleWheelSnapBack(){this.wheelSnapBackTimer!==null&&clearTimeout(this.wheelSnapBackTimer),this.wheelSnapBackTimer=setTimeout(()=>{if(this.wheelSnapBackTimer=null,this.state.isClosing||!this.state.isOpen||!this.zoom.zoomed&&this.zoom.scale===1)return;const t=this.computePanBounds(this.zoom.scale);(this.zoom.panX<t.minX||this.zoom.panX>t.maxX||this.zoom.panY<t.minY||this.zoom.panY>t.maxY)&&this.startPanMomentum(0,0)},100)}wheelNavigate(t){if(!this.wheelNavCommitted&&(this.wheelNavTotalDelta+=t,Math.abs(this.wheelNavTotalDelta)>60)){this.wheelNavCommitted=!0;const i=this.wheelNavTotalDelta>0?"next":"prev";this.debugLog(`wheelNav commit \u2192 ${i}`),this.wheelNavTotalDelta>0?this.next():this.prev()}}wheelDismiss(t){this.wheelDismissY+=Math.abs(t),this.wheelDismissY>150&&(this.wheelDismissY=0,this.dismissClose(0,600))}startSwipeNav(t,i){const e=this.stripOffset;this.swipeNav={active:!0,startX:t,offsetX:e+(i-t),initialOffset:e},this.applyStripOffset(this.swipeNav.offsetX),this.stripOffset=this.swipeNav.offsetX}handleSwipeNavMove(t){const i=t.clientX-this.swipeNav.startX;let e=this.swipeNav.initialOffset+i;const s=!this.canNavigate(-1),o=!this.canNavigate(1);s&&e>0&&(e*=C),o&&e<0&&(e*=C),this.swipeNav.offsetX=e,this.stripOffset=e,this.addVelocitySample(t.clientX,t.clientY),this.applyStripOffset(e)}handleSwipeNavRelease(){const{vx:t}=this.computeVelocity(),i=this.swipeNav.offsetX;this.swipeNav=this.defaultSwipeNavState();const e=window.innerWidth+I,s=Math.abs(i)/e;let o=Math.abs(t)>300||s>.3;const n=i<0?1:-1;this.canNavigate(n)||(o=!1),o?this.completeSwipeNav(n,t):this.snapBackSwipeNav(t)}completeSwipeNav(t,i){this.pendingNavDirection=t;const e=t===1?this.nextSlideEl:this.prevSlideEl;e&&(e.style.pointerEvents="auto");const s=window.innerWidth+I,o=-t*s;this.animateStrip(this.stripOffset,o,this.opts.springOpen,i,()=>this.completeNavigation(t))}snapBackSwipeNav(t){this.animateStrip(this.stripOffset,0,R,t,()=>{this.stripOffset=0})}startPinch(){this.stopSpring(),this.state.isAnimating=!1,this.zoom.isDragging=!1,this.dismiss=this.defaultDismissState();const[t,i]=this.pointerCache,e=Math.hypot(i.clientX-t.clientX,i.clientY-t.clientY),s=(t.clientX+i.clientX)/2,o=(t.clientY+i.clientY)/2;this.pinch={active:!0,initialDistance:e,initialScale:this.zoom.scale,initialPanX:this.zoom.panX,initialPanY:this.zoom.panY,initialMidX:s,initialMidY:o,prevScale:this.zoom.scale,prevScaleTime:performance.now()}}updatePinch(){const[t,i]=this.pointerCache,e=Math.hypot(i.clientX-t.clientX,i.clientY-t.clientY),s=(t.clientX+i.clientX)/2,o=(t.clientY+i.clientY)/2,n=e/this.pinch.initialDistance,a=this.getMaxZoomScale();let h=this.pinch.initialScale*n;h<1?h=1-.65*(1-h):h>a&&(h=a+.4*(h-a));const r=performance.now();this.pinch.prevScale=this.zoom.scale,this.pinch.prevScaleTime=r;const{fitRect:l}=this.zoom,c=l.x+l.width/2,u=l.y+l.height/2,p=this.pinch.initialMidX-c,m=this.pinch.initialMidY-u,d=h/this.pinch.initialScale,g=this.pinch.initialPanX+(s-this.pinch.initialMidX)-(p-this.pinch.initialPanX)*(d-1),y=this.pinch.initialPanY+(o-this.pinch.initialMidY)-(m-this.pinch.initialPanY)*(d-1);if(this.zoom.scale=h,this.zoom.panX=g,this.zoom.panY=y,this.applyPanTransform(),h<1){const S=1-h,w=Math.max(0,1-S/.35);this.backdrop.style.opacity=String(w),this.chromeBaseOpacity=w,this.chromeSpring={position:0,velocity:0},this.updateChromeVisuals()}else{const S=Math.min(1,Math.max(0,(h-1)/.5));this.chromeSpring={position:S,velocity:0},this.updateChromeVisuals()}}endPinch(){this.pinch.active=!1,this.zoom.dragMoved=!0;const t=this.getMaxZoomScale();if(this.zoom.scale<1){const i=(performance.now()-this.pinch.prevScaleTime)/1e3,e=i>.001?(this.zoom.scale-this.pinch.prevScale)/i:0;this.zoom.scale<.8||e<-2?this.pinchClose():this.pinchSnapBack()}else if(this.zoom.scale>t){const i=this.computePanBounds(t),e=E(this.zoom.panX,i.minX,i.maxX),s=E(this.zoom.panY,i.minY,i.maxY);this.springToZoomState(t,e,s,R,!0),this.animateChrome(1)}else{this.zoom.zoomed=this.zoom.scale>1,this.animateChrome(this.zoom.scale>1?1:0);const i=this.computePanBounds(this.zoom.scale),e=this.zoom.panX>=i.minX&&this.zoom.panX<=i.maxX,s=this.zoom.panY>=i.minY&&this.zoom.panY<=i.maxY;if(e&&s)this.updateCursorState();else{const o=E(this.zoom.panX,i.minX,i.maxX),n=E(this.zoom.panY,i.minY,i.maxY);this.springToZoomState(this.zoom.scale,o,n,R,this.zoom.scale>1)}}}pinchClose(){if(this.debugLog("pinchClose"),this.state.isClosing=!0,this.state.isDismissClosing=!0,this.emit("close"),this.state.isAnimating=!0,this.stopFitTransition(),this.stopStripSpring(),this.stripOffset=0,this.stripEl&&(this.stripEl.style.transform=""),this.swipeNav=this.defaultSwipeNavState(),this.overlay){const g=this.overlay;setTimeout(()=>{g.style.pointerEvents="none"},80)}const{panX:t,panY:i,scale:e}=this.zoom,s=1-e,o=Math.max(0,1-s/.35);this.zoom.scale=1,this.zoom.panX=0,this.zoom.panY=0,this.zoom.zoomed=!1;const n=this.state.triggerEl?this.getThumbRect(this.state.triggerEl):null,a=this.getTargetBorderRadius();if(!n||!this.isInViewport(n))return this.shrinkingToCenter=!0,void this.animateSpring({translateX:t,translateY:i,scale:e,opacity:o,crop:0,borderRadius:a},{translateX:0,translateY:0,scale:0,opacity:0,crop:0,borderRadius:a},A,()=>this.finishClose(),g=>g.opacity<.01&&g.scale<Y);const{fitRect:h}=this.zoom,r=this.isTextLink?this.textLinkFlipRect(n,this.zoom.naturalWidth,this.zoom.naturalHeight):n,l=r.x+r.width/2-(h.x+h.width/2),c=r.y+r.height/2-(h.y+h.height/2),{flipScale:u,hasCrop:p}=this.computeFlipCrop(r,h,this.state.triggerEl,this.isTextLink),m=this.state.triggerEl;let d=!1;this.animateSpring({translateX:t,translateY:i,scale:e,opacity:o,crop:0,borderRadius:a},{translateX:l,translateY:c,scale:u,opacity:0,crop:p?1:0,borderRadius:this.thumbBorderRadius},this.opts.springClose,()=>this.finishClose(),g=>{const y=Math.abs(g.scale-u)<.05&&Math.abs(g.translateX-l)<20&&Math.abs(g.translateY-c)<20;return y&&!d&&m&&(d=!0,this.bounceTrigger(m)),y})}pinchSnapBack(){const{panX:t,panY:i,scale:e}=this.zoom,s=1-e,o=Math.max(0,1-s/.35);this.zoom.scale=1,this.zoom.panX=0,this.zoom.panY=0,this.zoom.zoomed=!1;const n=this.getTargetBorderRadius();this.animateSpring({translateX:t,translateY:i,scale:e,opacity:o,crop:0,borderRadius:n},{translateX:0,translateY:0,scale:1,opacity:1,crop:0,borderRadius:n},R,()=>{})}springToZoomState(t,i,e,s,o){if(this.stopSpring(),this.state.isAnimating=!0,this.reducedMotion)return this.zoom.panX=i,this.zoom.panY=e,this.zoom.scale=t,this.zoom.zoomed=o,this.applyPanTransform(),this.state.isAnimating=!1,void this.updateCursorState();let n={position:this.zoom.panX,velocity:0},a={position:this.zoom.panY,velocity:0},h={position:this.zoom.scale,velocity:0},r=performance.now(),l=!1;const c=u=>{const p=Math.min((u-r)/1e3,.064);r=u;const m=f(s,n,i,p),d=f(s,a,e,p),g=f(s,h,t,p);if(n=m,a=d,h=g,this.zoom.panX=m.position,this.zoom.panY=d.position,this.zoom.scale=g.position,this.applyPanTransform(),!l&&Math.abs(g.position-t)<.005*t&&Math.abs(m.position-i)<1&&Math.abs(d.position-e)<1&&(l=!0,this.zoom.zoomed=o,this.state.isAnimating=!1,this.updateCursorState()),m.settled&&d.settled&&g.settled)return this.zoom.panX=i,this.zoom.panY=e,this.zoom.scale=t,this.applyPanTransform(),this.rafId=null,void(l||(this.zoom.zoomed=o,this.state.isAnimating=!1,this.updateCursorState()));this.rafId=requestAnimationFrame(c)};this.rafId=requestAnimationFrame(c)}startPanMomentum(t,i){const e=this.computePanBounds(this.zoom.scale),s=this.zoom.panX>=e.minX&&this.zoom.panX<=e.maxX,o=this.zoom.panY>=e.minY&&this.zoom.panY<=e.maxY,n=E(s?this.zoom.panX+.15*t:this.zoom.panX,e.minX,e.maxX),a=E(o?this.zoom.panY+.15*i:this.zoom.panY,e.minY,e.maxY);if(this.reducedMotion)return this.zoom.panX=n,this.zoom.panY=a,void this.applyPanTransform();let h={position:this.zoom.panX,velocity:s?t:0},r={position:this.zoom.panY,velocity:o?i:0};const l=s?P:R,c=o?P:R;let u=performance.now();const p=m=>{const d=Math.min((m-u)/1e3,.064);u=m;const g=f(l,h,n,d),y=f(c,r,a,d);h=g,r=y,this.zoom.panX=g.position,this.zoom.panY=y.position,this.applyPanTransform(),g.settled&&y.settled?this.rafId=null:this.rafId=requestAnimationFrame(p)};this.rafId=requestAnimationFrame(p)}stopSpring(){this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null)}applyPanTransform(){this.imgEl&&(this.imgEl.style.transform=`translate(${this.zoom.panX}px, ${this.zoom.panY}px) scale(${this.zoom.scale})`)}computePanBounds(t){const{fitRect:i}=this.zoom,e=window.innerWidth,s=window.innerHeight,o=i.width*t,n=i.height*t,a=Math.max(0,(o-e)/2),h=Math.max(0,(n-s)/2);return{minX:-a,maxX:a,minY:-h,maxY:h}}handleImageClick(t){this.zoom.dragMoved?this.zoom.dragMoved=!1:(this.pendingNavDirection!==null&&this.forceCompleteStripAnimation(),this.zoom.zoomed||this.zoom.scale!==1?this.zoomOut():this.isZoomable()?this.zoomIn(t.clientX,t.clientY):this.close())}updateCursorState(){if(!this.imgEl)return;const t=this.imgEl;this.zoom.isDragging?t.style.cursor="grabbing":this.zoom.zoomed?t.style.cursor="grab":this.isZoomable()?t.style.cursor="zoom-in":t.style.cursor="pointer"}createChrome(){if(!this.overlay)return;const t=this.gallery.length>1,i=this.getCurrentCaption(),e=t||!!i,s=document.createElement("div");s.className="lightbox3-chrome",e||s.classList.add("lightbox3-chrome--minimal");const o=document.createElement("span");o.className="lightbox3-counter",t?o.textContent=`${this.currentIndex+1}\u2009/\u2009${this.gallery.length}`:o.style.display="none",s.appendChild(o),this.chromeCounter=o;const n=document.createElement("span");n.className="lightbox3-caption",n.innerHTML=i,i||(n.style.display="none"),s.appendChild(n),this.chromeCaption=n;const a=document.createElement("button");if(a.className="lightbox3-close",a.setAttribute("aria-label","Close"),a.type="button",a.innerHTML='<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="4" y1="4" x2="12" y2="12"/><line x1="12" y1="4" x2="4" y2="12"/></svg>',a.addEventListener("click",h=>{h.stopPropagation(),this.close()}),a.addEventListener("pointerdown",h=>h.stopPropagation()),s.appendChild(a),this.chromeClose=a,this.bindPressSpring(a),s.addEventListener("click",h=>{h.stopPropagation()}),this.overlay.appendChild(s),this.chromeBar=s,this.overlay.focus({preventScroll:!0}),t){const h=document.createElement("button");h.className="lightbox3-arrow lightbox3-arrow-prev",h.setAttribute("aria-label","Previous image"),h.type="button",h.innerHTML='<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="12,4 6,10 12,16"/></svg>',h.addEventListener("click",l=>{l.stopPropagation(),this.prev()}),h.addEventListener("pointerdown",l=>l.stopPropagation()),this.overlay.appendChild(h),this.chromePrev=h,this.bindPressSpring(h);const r=document.createElement("button");r.className="lightbox3-arrow lightbox3-arrow-next",r.setAttribute("aria-label","Next image"),r.type="button",r.innerHTML='<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="8,4 14,10 8,16"/></svg>',r.addEventListener("click",l=>{l.stopPropagation(),this.next()}),r.addEventListener("pointerdown",l=>l.stopPropagation()),this.overlay.appendChild(r),this.chromeNext=r,this.bindPressSpring(r),this.updateArrowVisibility()}}getCurrentCaption(){return this.gallery.length>0?this.gallery[this.currentIndex]?.caption||"":this.state.triggerEl?.getAttribute("data-caption")||this.state.triggerEl?.getAttribute("data-title")||""}getCurrentAlt(){if(this.gallery.length>0)return this.gallery[this.currentIndex]?.alt||"";const t=this.state.triggerEl,i=t?.querySelector("img");return t?.getAttribute("data-alt")||i?.alt||""}updateChromeContent(){const t=this.getCurrentCaption();this.chromeCounter&&(this.chromeCounter.textContent=`${this.currentIndex+1}\u2009/\u2009${this.gallery.length}`),this.chromeCaption&&(this.chromeCaption.innerHTML=t,this.chromeCaption.style.display=t?"":"none"),this.updateArrowVisibility()}updateArrowVisibility(){this.chromePrev&&(this.chromePrev.style.display=this.canNavigate(-1)?"":"none"),this.chromeNext&&(this.chromeNext.style.display=this.canNavigate(1)?"":"none")}computeChromeDrift(t,i){const s=window.innerWidth,o=window.innerHeight,n=s/2,a=o-16,h=36,r=o/2,l=s-36,c=o/2;this.chromeDriftVectors={bar:{x:(t-n)*.05,y:(i-a)*.05},prev:{x:(t-h)*.05,y:(i-r)*.05},next:{x:(t-l)*.05,y:(i-c)*.05}}}resetChromeDrift(){this.chromeDriftProgress=0,this.chromeDriftVectors={bar:{x:0,y:0},prev:{x:0,y:0},next:{x:0,y:0}}}animateChrome(t){if(this.stopChromeSpring(),this.resetChromeDrift(),this.reducedMotion)return this.chromeSpring={position:t,velocity:0},void this.updateChromeVisuals();const i=t===1?this.opts.springOpen:this.opts.springClose;let e=performance.now();const s=o=>{const n=Math.min((o-e)/1e3,.064);e=o;const a=f(i,this.chromeSpring,t,n);this.chromeSpring=a,this.updateChromeVisuals(),a.settled?this.chromeRafId=null:this.chromeRafId=requestAnimationFrame(s)};this.chromeRafId=requestAnimationFrame(s)}updateChromeVisuals(){const t=this.chromeSpring.position,i=this.chromeBaseOpacity,e=i>.1&&t<.5,s=120*t,o=100*t,n=this.chromeDriftProgress,a=this.chromeDriftVectors;if(this.chromeBar&&(this.chromeBar.style.opacity=String(i),this.chromeBar.style.transform=`translateX(calc(-50% + ${a.bar.x*n}px)) translateY(${s+a.bar.y*n}px)`,this.chromeBar.style.pointerEvents=e?"":"none"),this.chromePrev){const h=this.getPressScale(this.chromePrev);this.chromePrev.style.opacity=String(i),this.chromePrev.style.transform=`translateY(calc(-50% + ${a.prev.y*n}px)) translateX(${-o+a.prev.x*n}px) scale(${h})`,this.chromePrev.style.pointerEvents=e?"":"none"}if(this.chromeNext){const h=this.getPressScale(this.chromeNext);this.chromeNext.style.opacity=String(i),this.chromeNext.style.transform=`translateY(calc(-50% + ${a.next.y*n}px)) translateX(${o+a.next.x*n}px) scale(${h})`,this.chromeNext.style.pointerEvents=e?"":"none"}if(this.chromeClose){const h=this.getPressScale(this.chromeClose);this.chromeClose.style.transform=`scale(${h})`,this.chromeClose.style.pointerEvents=e?"":"none"}}stopChromeSpring(){this.chromeRafId!==null&&(cancelAnimationFrame(this.chromeRafId),this.chromeRafId=null)}bindPressSpring(t){this.pressSprings.set(t,{state:{position:1,velocity:0},target:1}),t.addEventListener("pointerdown",()=>this.animatePressSpring(t,.85)),t.addEventListener("pointerup",()=>this.animatePressSpring(t,1)),t.addEventListener("pointerleave",()=>this.animatePressSpring(t,1))}getPressScale(t){if(!t)return 1;const i=this.pressSprings.get(t);return i?i.state.position:1}animatePressSpring(t,i){const e=this.pressSprings.get(t);e&&(e.target=i,this.startPressLoop())}startPressLoop(){if(this.pressRafId!==null)return;if(this.reducedMotion){for(const[,e]of this.pressSprings)e.state={position:e.target,velocity:0};return void this.updateChromeVisuals()}let t=performance.now();const i=e=>{const s=Math.min((e-t)/1e3,.064);t=e;let o=!0;for(const[,n]of this.pressSprings){const a=f(F,n.state,n.target,s);n.state=a,a.settled||(o=!1)}this.updateChromeVisuals(),this.pressRafId=o?null:requestAnimationFrame(i)};this.pressRafId=requestAnimationFrame(i)}createOverlay(t){const i=document.createElement("div");i.className="lightbox3-overlay",i.setAttribute("role","dialog"),i.setAttribute("aria-modal","true"),i.tabIndex=-1;const e=document.createElement("div");e.className="lightbox3-backdrop",e.style.opacity="0",e.addEventListener("click",this.close);const s=document.createElement("div");s.className="lightbox3-strip";const{slide:o,img:n}=this.createSlide(t,this.getCurrentAlt());o.style.left="0",o.style.pointerEvents="auto",s.appendChild(o),i.addEventListener("pointerdown",this.handleOverlayPointerDown),i.addEventListener("pointermove",this.handlePointerMove),i.addEventListener("pointerup",this.handlePointerUp),i.addEventListener("pointercancel",this.handlePointerUp),i.addEventListener("wheel",this.handleWheel,{passive:!1}),i.appendChild(e),i.appendChild(s),document.body.appendChild(i),this.overlay=i,this.backdrop=e,this.stripEl=s,this.currentSlideEl=o,this.imgEl=n}createSlide(t,i=""){const e=document.createElement("div");e.className="lightbox3-slide";const s=document.createElement("img");return s.className="lightbox3-image",s.decoding="async",t&&(s.src=t),s.alt=i,s.draggable=!1,s.addEventListener("click",o=>this.handleImageClick(o)),s.addEventListener("pointerdown",this.handleImagePointerDown),s.addEventListener("pointermove",this.handlePointerMove),s.addEventListener("pointerup",this.handlePointerUp),s.addEventListener("pointercancel",this.handlePointerUp),e.appendChild(s),{slide:e,img:s}}createAdjacentSlide(t,i){if(!this.stripEl)return;const e=this.gallery[t];if(!e)return;const{slide:s,img:o}=this.createSlide("",e.alt);s.style.left=`${i}px`,s.style.pointerEvents="none",this.setupSlideImage(o,e),this.stripEl.appendChild(s),i<0?(this.prevSlideEl=s,this.prevSlideImg=o):(this.nextSlideEl=s,this.nextSlideImg=o)}setupSlideImage(t,i){const e=this.getTargetBorderRadius();t.style.borderRadius=e>0?`${e}px`:"";const s=this.preloadCache.get(i.src);if(s?.complete&&s.naturalWidth>0){t.src=i.src;const o=this.computeTargetRect(s.naturalWidth,s.naturalHeight);this.positionImageEl(t,o)}else{t.src=i.thumbSrc||i.src;const o=i.triggerEl.querySelector("img"),n=o?.naturalWidth||400,a=o?.naturalHeight||300,h=this.computeTargetRectFromAspectRatio(n,a);if(this.positionImageEl(t,h),s&&!s.complete){const r=()=>{if(s.removeEventListener("error",l),!this.state.isClosing&&this.state.isOpen&&(t===this.prevSlideImg||t===this.nextSlideImg)&&s.naturalWidth>0){t.src=i.src;const c=this.computeTargetRect(s.naturalWidth,s.naturalHeight);this.positionImageEl(t,c)}},l=()=>s.removeEventListener("load",r);s.addEventListener("load",r,{once:!0}),s.addEventListener("error",l,{once:!0})}}}positionImageEl(t,i){Object.assign(t.style,{left:`${i.x}px`,top:`${i.y}px`,width:`${i.width}px`,height:`${i.height}px`})}populateAdjacentSlides(){if(!this.stripEl||this.gallery.length<=1)return;const t=window.innerWidth+I;this.canNavigate(-1)&&this.createAdjacentSlide(this.wrapIndex(this.currentIndex-1),-t),this.canNavigate(1)&&this.createAdjacentSlide(this.wrapIndex(this.currentIndex+1),t)}removeOverlay(){this.overlay&&(this.overlay.remove(),this.overlay=null,this.backdrop=null,this.imgEl=null,this.stripEl=null,this.currentSlideEl=null,this.prevSlideEl=null,this.prevSlideImg=null,this.nextSlideEl=null,this.nextSlideImg=null,this.chromeBar=null,this.chromeCounter=null,this.chromeCaption=null,this.chromeClose=null,this.chromePrev=null,this.chromeNext=null,this.pressSprings.clear(),this.pressRafId!==null&&(cancelAnimationFrame(this.pressRafId),this.pressRafId=null))}positionImage(t){this.imgEl&&Object.assign(this.imgEl.style,{left:`${t.x}px`,top:`${t.y}px`,width:`${t.width}px`,height:`${t.height}px`})}getTargetBorderRadius(){if(this.overlay){const t=getComputedStyle(this.overlay).getPropertyValue("--lb-image-border-radius");if(t)return parseFloat(t)||0}return 24}getTargetImagePadding(){if(this.overlay){const t=getComputedStyle(this.overlay).getPropertyValue("--lb-image-padding");if(t)return parseFloat(t)||0}return this.opts.padding}getThumbBorderRadius(t){const i=parseFloat(getComputedStyle(t).borderTopLeftRadius)||0;if(i>0)return i;const e=t.querySelector("img");return e&&parseFloat(getComputedStyle(e).borderTopLeftRadius)||0}getThumbRect(t){const i=t.querySelector("img");if(!i)return t.getBoundingClientRect();const e=i.getBoundingClientRect();if(getComputedStyle(i).objectFit!=="cover"||!i.naturalWidth||!i.naturalHeight)return e;const s=i.naturalWidth/i.naturalHeight;let o,n;s>e.width/e.height?(n=e.height,o=e.height*s):(o=e.width,n=e.width/s);const a=(getComputedStyle(i).objectPosition||"50% 50%").split(/\s+/),h=a[0]?.endsWith("%")?parseFloat(a[0])/100:.5,r=a[1]?.endsWith("%")?parseFloat(a[1])/100:.5,l=(e.width-o)*h,c=(e.height-n)*r;return new DOMRect(e.x+l,e.y+c,o,n)}computeCropInsets(t,i,e){const s=t.querySelector("img");if(!s||getComputedStyle(s).objectFit!=="cover")return{top:0,right:0,bottom:0,left:0};const o=s.getBoundingClientRect(),n=Math.max(0,o.top-i.top)/i.height,a=Math.max(0,o.left-i.left)/i.width,h=Math.max(0,i.bottom-o.bottom)/i.height,r=Math.max(0,i.right-o.right)/i.width;return{top:n*e.height,right:r*e.width,bottom:h*e.height,left:a*e.width}}computeFlipCrop(t,i,e,s){const o=t.width/i.width,n=t.height/i.height;if(!s&&e&&(this.cropInsets=this.computeCropInsets(e,t,i),this.cropInsets.top+this.cropInsets.right+this.cropInsets.bottom+this.cropInsets.left>1))return{flipScale:Math.min(o,n),hasCrop:!0};const a=t.width/t.height,h=i.width/i.height,r=Math.abs(a-h)/Math.max(a,h);if(!s&&r>.05){const l=Math.max(o,n),c=t.width/l,u=t.height/l;return this.cropInsets={top:Math.max(0,(i.height-u)/2),bottom:Math.max(0,(i.height-u)/2),left:Math.max(0,(i.width-c)/2),right:Math.max(0,(i.width-c)/2)},{flipScale:l,hasCrop:!0}}return{flipScale:Math.min(o,n),hasCrop:!1}}setThumbVisibility(t){if(window.innerWidth<=600)return;const i=this.state.triggerEl;i&&(i.style.visibility=t?"":"hidden")}getDimensionHint(t){const i=parseFloat(t.getAttribute("data-width")||""),e=parseFloat(t.getAttribute("data-height")||"");return i>0&&e>0?{w:i,h:e}:null}maxFitScale(){const{upscale:t}=this.opts;return t===!0?1/0:typeof t=="number"&&t>1?t:1}computeTargetRect(t,i,e=this.maxFitScale()){const s=window.innerWidth,o=window.innerHeight,n=this.getTargetImagePadding(),a=Math.min((s-2*n)/t,(o-2*n)/i,e),h=t*a,r=i*a;return new DOMRect((s-h)/2,(o-r)/2,h,r)}computeTargetRectFromAspectRatio(t,i){return this.computeTargetRect(t,i,1/0)}loadImage(t){const i=this.preloadCache.get(t);return i?.complete&&i.naturalWidth>0?Promise.resolve({width:i.naturalWidth,height:i.naturalHeight}):new Promise(e=>{const s=i||new Image;s.onload=()=>e({width:s.naturalWidth,height:s.naturalHeight}),s.onerror=()=>e({width:800,height:600}),i||(s.decoding="async",s.src=t,this.preloadCache.set(t,s))})}isInViewport(t){return t.bottom>0&&t.top<window.innerHeight&&t.right>0&&t.left<window.innerWidth}startDebugPanel(){if(!this.opts.debug||this.debugEl)return;this.debugT0=performance.now(),this.debugLogEntries=[];const t=document.createElement("div");Object.assign(t.style,{position:"fixed",top:"8px",left:"8px",zIndex:"9999999",display:"flex",gap:"8px",fontFamily:"monospace",fontSize:"11px",lineHeight:"1.5",pointerEvents:"none"});const i=document.createElement("div");Object.assign(i.style,{background:"rgba(0,0,0,0.85)",color:"#0f0",padding:"8px 12px",borderRadius:"6px",whiteSpace:"pre",minWidth:"260px"});const e=document.createElement("div");Object.assign(e.style,{background:"rgba(0,0,0,0.85)",color:"#ccc",padding:"8px 12px",borderRadius:"6px",whiteSpace:"pre",minWidth:"280px",maxHeight:"400px",overflowY:"auto",pointerEvents:"auto"}),e.textContent=`\u2500\u2500 event log \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
2`,t.appendChild(i),t.appendChild(e),document.body.appendChild(t),this.debugEl=t,this.debugStateEl=i,this.debugLogEl=e;const s=()=>{this.updateDebugPanel(),this.debugRafId=requestAnimationFrame(s)};this.debugRafId=requestAnimationFrame(s)}stopDebugPanel(){this.debugRafId!==null&&(cancelAnimationFrame(this.debugRafId),this.debugRafId=null),this.debugEl&&(this.debugEl.remove(),this.debugEl=null,this.debugStateEl=null,this.debugLogEl=null)}debugLog(t){if(!this.debugLogEl)return;const i=`${((performance.now()-this.debugT0)/1e3).toFixed(2)}s  ${t}`;this.debugLogEntries.push(i),this.debugLogEntries.length>100&&this.debugLogEntries.shift(),this.debugLogEl.textContent=`\u2500\u2500 event log \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
3`+this.debugLogEntries.join(`
4`),this.debugLogEl.scrollTop=this.debugLogEl.scrollHeight}updateDebugPanel(){if(!this.debugStateEl)return;const t=s=>s?"\u25CF":"\u25CB",i=s=>s.toFixed(1),e=["\u2500\u2500 state \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500",`isOpen:${t(this.state.isOpen)}  isAnim:${t(this.state.isAnimating)}  isClosing:${t(this.state.isClosing)}`,`gallery: ${this.currentIndex+1}/${this.gallery.length||1}  loop:${t(this.opts.loop)}`,"","\u2500\u2500 springs \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500",`mainRaf:  ${t(this.rafId!==null)}`,`stripRaf: ${t(this.stripRafId!==null)}  offset: ${i(this.stripOffset)}`,`chromeRaf:${t(this.chromeRafId!==null)}`,`pendingNav: ${this.pendingNavDirection??"none"}`,"","\u2500\u2500 zoom \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500",`scale: ${i(this.zoom.scale)}  zoomed:${t(this.zoom.zoomed)}`,`pan: ${i(this.zoom.panX)}, ${i(this.zoom.panY)}`,`dragging:${t(this.zoom.isDragging)}  dragMoved:${t(this.zoom.dragMoved)}`,"","\u2500\u2500 gestures \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500",`dismiss: track:${t(this.dismiss.tracking)} active:${t(this.dismiss.active)}`,`swipeNav: ${t(this.swipeNav.active)}`,`pinch: ${t(this.pinch.active)}`,"","\u2500\u2500 wheel nav \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500",`committed:${t(this.wheelNavCommitted)}`,`totalDelta: ${i(this.wheelNavTotalDelta)}`,`gestureTimer: ${t(this.wheelGestureTimer!==null)}`,`dismissY: ${i(this.wheelDismissY)}`];if(this.gallery.length>1){e.push("","\u2500\u2500 gallery preload \u2500\u2500\u2500\u2500");for(let s=0;s<this.gallery.length;s++){const o=this.gallery[s],n=this.preloadCache.get(o.src),a=s===this.currentIndex?"\u25B8":" ";let h;
4h=n?.complete&&n.naturalWidth>0?`\u25CF ${n.naturalWidth}\xD7${n.naturalHeight}`:n?"\u25D0 loading":"\u25CB pending";const r=o.src.split("/").pop()||o.src,l=r.length>20?r.slice(0,19)+"\u2026":r;e.push(`${a}${String(s+1).padStart(2)} ${l.padEnd(20)} ${h}`)}}this.debugStateEl.textContent=e.join(`
5`)}}function E(x,t,i){return Math.max(t,Math.min(i,x))}function D(x,t,i){return x<t?t-(t-x)*C:x>i?i+(x-i)*C:x}function L(){if(!document.querySelector("[data-lightbox]"))return;const x=typeof location<"u"&&new URLSearchParams(location.search).has("debug");z.init(x?{debug:!0}:void 0)}z.instance=null,typeof document<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",L):L()),M.Lightbox=z});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.