vendor: 1,587 bytes, line 1
1!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i((t="undefined"!=typeof globalThis?globalThis:t||self).Lightbox3={})}(this,function(t){"use strict";function i(t,i,s,o){const{stiffness:n,damping:a,mass:h=1}=t;if(o>.02){let t={...i},r=o;for(;r>0;){const i=Math.min(r,.008),o=e(n,a,h,t,s,i);if(o.settled)return o;t=o,r-=i}return{...t,settled:!1}}return e(n,a,h,i,s,o)}function e(t,i,e,s,o,n){const a=(-t*(s.position-o)+-i*s.velocity)/e,h=s.velocity+a*n,r=s.position+h*n,l=Math.abs(r-o)<.01&&Math.abs(h)<.01;return{position:l?o:r,velocity:l?0:h,settled:l}}const s={selector:"[data-lightbox]",springOpen:{stiffness:260,damping:26,mass:1},springClose:{stiffness:500,damping:38,mass:1},padding:40,debug:!1},o=.35,n={stiffness:170,damping:26,mass:1},a={stiffness:300,damping:30,mass:1},h=16,r={stiffness:300,damping:20,mass:1};class l{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.pointerCac
1he=[],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.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={...s,...t},this.reducedMotionQuery=window.matchMedia("(prefers-reduced-motion: reduce)"),this.reducedMotion=this.reducedMotionQuery.matches,this.reducedMotionQuery.addEventListener("change",t=>{this.reducedMotion=t.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 l.instance?(t&&l.instance.configure(t),l.instance):(l.instance=new l(t),l.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||0===i.size)return;const e={src:this.state.currentSrc,triggerEl:this.state.triggerEl,index:this.currentIndex,total:Math.max(this.gallery.length,1)};for(const t of i)t(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(),l.instance===this&&(l.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("mouse"!==t.pointerType)return;if(!(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){if("mouse"!==t.pointerType)return;if(!(t.target instanceof Element))return;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.currentIndex>0&&this.preloadImage(this.gallery[this.currentIndex-1].src),this.currentIndex<this.gallery.length-1&&this.preloadImage(this.gallery[this.currentIndex+1].src),this.userHasNavigated&&this.enqueueRemainingPreloads()}enqueueRemainingPreloads(){const t=[];for(let i=2;i<this.gallery.length;i++){const e=this.currentIndex+i,s=this.currentIndex-i;e<this.gallery.length&&t.push(this.gallery[e].src),s>=0&&t.push(this.gallery[s].src)}this.preloadQueue=t.filter(t=>!this.preloadCache.has(t)),this.processPreloadQueue()}processPreloadQueue(){if(this.preloadingActive||0===this.preloadQueue.length)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(t=>{const i=t,e=i.querySelector("img");return{triggerEl:i,src:this.getSrcFromTrigger(i),thumbSrc:e?.currentSrc||e?.src||"",caption:i.getAttribute("data-caption")||i.getAttribute("data-title")||"",alt:i.getAttribute("data-alt")||e?.alt||""}}),this.currentIndex=this.gallery.findIndex(i=>i.triggerEl===t),-1===this.currentIndex&&(this.currentIndex=0),this.userHasNavigated=!1}handleClick(t){const i=t.target.closest(this.opts.selector);if(!i)return;if(t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||0!==t.button)return;t.preventDefault();const e=this.getSrcFromTrigger(i);e&&((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()),this.buildGallery(i),this.open(e,i))}handleKeydown(t){if("Tab"!==t.key)if("Escape"===t.key){if(this.dismiss.active)return void this.dismissClose(0,0);this.zoom.zoomingOut?this.close():this.zoom.zoomed||1!==this.zoom.scale?this.zoomOut():this.close()}else"ArrowRight"===t.key?1!==this.zoom.scale||this.swipeNav.active||this.next():"ArrowLeft"===t.key&&(1!==this.zoom.scale||this.swipeNav.active||this.prev());else this.trapFocus(t)}
vendor: 8,653 bytes, line 1
1trapFocus(t){if(!this.overlay)return;const i=this.overlay.querySelectorAll('button:not([disabled]):not([style*="display: none"])');if(0===i.length)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(this.state.isOpen||this.state.isAnimating)return;this.debugLog("open"),null!==this.bounceRafId&&(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),this.createOverlay(s||t),this.createChrome(),this.computeChromeDrift(o.x+o.width/2,o.y+o.height/2),document.addEventListener("keydown",this.handleKeydown),this.setThumbVisibility(!1);const n=e.naturalWidth||o.width,a=e.naturalHeight||o.height,h=this.preloadCache.get(t),r=h?.complete&&h.naturalWidth>0,l=this.getDimensionHint(i);let c,d,p;r?(c=h.naturalWidth,d=h.naturalHeight,p=this.computeTargetRect(c,d)):l?(c=l.w,d=l.h,p=this.computeTargetRect(c,d)):(c=n,d=a,p=this.computeTargetRectFromAspectRatio(c,d)),this.positionImage(p),this.zoom=this.defaultZoomState(),this.zoom.fitRect=p,this.zoom.naturalWidth=c,this.zoom.naturalHeight=d;const m=o.x+o.width/2-(p.x+p.width/2),u=o.y+o.height/2-(p.y+p.height/2),{flipScale:g,hasCrop:f}=this.computeFlipCrop(o,p,i,!1);s&&s!==t&&this.swapToFullRes(t),this.gallery.length>1&&this.schedulePreloads(),this.populateAdjacentSlides();this.animateSpring({translateX:m,translateY:u,scale:g,opacity:0,crop:f?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,t=>t.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 t=document.createElement("div");t.className="lightbox3-spinner",this.overlay.appendChild(t),this.spinnerEl=t}},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(e=>{this.imgEl&&this.state.currentSrc===i&&!this.state.isClosing&&this.state.isOpen&&(this.removeSpinner(),this.openTextLinkWithImage(t,i,e.width,e.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),d=a.y+a.height/2-(n.y+n.height/2),p=this.getTargetBorderRadius();this.animateSpring({translateX:c,translateY:d,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,t=>t.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 t=this.computeTargetRect(i.width,i.height),e=this.zoom.fitRect,s=Math.abs(t.x-e.x),o=Math.abs(t.y-e.y),n=Math.abs(t.width-e.width),a=Math.abs(t.height-e.height);s>1||o>1||n>1||a>1?this.animateFitTransition(e,t):(this.zoom.fitRect=t,this.positionImage(t))}this.updateCursorState()}})}animateFitTransition(t,e){if(this.stopFitTransition(),this.reducedMotion)return this.zoom.fitRect=e,void this.positionImage(e);const s=this.imgEl,o=n,a={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 h=performance.now();const r=t=>{const n=Math.min((t-h)/1e3,.064);h=t,a.x=i(o,a.x,e.x,n),a.y=i(o,a.y,e.y,n),a.w=i(o,a.w,e.width,n),a.h=i(o,a.h,e.height,n),Object.assign(s.style,{left:`${a.x.position}px`,top:`${a.y.position}px`,width:`${a.w.position}px`,height:`${a.h.position}px`});if(a.x.settled&&a.y.settled&&a.w.settled&&a.h.settled)return this.zoom.fitRect=e,this.positionImage(e),void(this.fitRafId=null);this.zoom.fitRect=new DOMRect(a.x.position,a.y.position,a.w.position,a.h.position),this.fitRafId=requestAnimationFrame(r)};this.fitRafId=requestAnimationFrame(r)}stopFitTransition(){null!==this.fitRafId&&(cancelAnimationFrame(this.fitRafId),this.fitRafId=null)}close(){if(this.state.isClosing)return;if(!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 t=this.overlay;setTimeout(()=>{t.style.pointerEvents="none"},80)}(this.zoom.zoomed||this.zoom.zoomingOut||1!==this.zoom.scale)&&(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;t&&this.computeChromeDrift(t.x+t.width/2,t.y+t.height/2);const i=this.state.triggerEl;let e=!1;const s=t=>t.opacity<.01&&(!e&&i&&(e=!0,this.bounceTrigger(i)),!0),o=this.getTargetBorderRadius();if(!t||!this.isInViewport(t))return void this.animateSpring({translateX:0,translateY:0,scale:1,opacity:1,crop:0,borderRadius:o},{translateX:0,translateY:0,scale:1,opacity:0,crop:0,borderRadius:o},this.opts.springClose,()=>this.finishClose(),s);const{fitRect:n}=this.zoom,a=this.isTextLink?this.textLinkFlipRect(t,this.zoom.naturalWidth,this.zoom.naturalHeight):t,h=a.x+a.width/2-(n.x+n.width/2),r=a.y+a.height/2-(n.y+n.height/2),{flipScale:l,hasCrop:c}=this.computeFlipCrop(a,n,this.state.triggerEl,this.isTextLink);this.animateSpring({translateX:0,translateY:0,scale:1,opacity:1,crop:0,borderRadius:o},{translateX:h,translateY:r,scale:l,opacity:0,crop:c?1:0,borderRadius:this.thumbBorderRadius},this.opts.springClose,()=>this.finishClose(),s)}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
1("closed"),this.state.isOpen=!1,this.state.isAnimating=!1,this.state.isClosing=!1,this.state.isDismissClosing=!1,this.state.triggerEl=null,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,null!==this.wheelGestureTimer&&(clearTimeout(this.wheelGestureTimer),this.wheelGestureTimer=null),null!==this.wheelSnapBackTimer&&(clearTimeout(this.wheelSnapBackTimer),this.wheelSnapBackTimer=null)}bounceTrigger(t){if(this.reducedMotion)return;null!==this.bounceRafId&&(cancelAnimationFrame(this.bounceRafId),this.bounceRafId=null);const e={stiffness:900,damping:80,mass:1},s={position:.98,velocity:0};let o=performance.now();t.style.transform=`scale(${s.position})`;const n=a=>{const h=Math.min((a-o)/1e3,.064);o=a;const r=i(e,s,1,h);s.position=r.position,s.velocity=r.velocity,t.style.transform=r.settled?"":`scale(${r.position})`,r.settled?this.bounceRafId=null:this.bounceRafId=requestAnimationFrame(n)};this.bounceRafId=requestAnimationFrame(n)}next(){this.gallery.length<=1||1===this.zoom.scale&&(this.forceCompleteStripAnimation(),this.currentIndex>=this.gallery.length-1?this.bounceStrip(-1):this.navigateTo(1))}prev(){this.gallery.length<=1||1===this.zoom.scale&&(this.forceCompleteStripAnimation(),this.currentIndex<=0?this.bounceStrip(1):this.navigateTo(-1))}navigateTo(t){this.debugLog(`navigateTo(${t>0?"next":"prev"})`),this.userHasNavigated=!0,this.pendingNavDirection=t;const i=1===t?this.nextSlideEl:this.prevSlideEl;i&&(i.style.pointerEvents="auto");const e=window.innerWidth+h,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+=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+h;1===t?(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.currentIndex<this.gallery.length-1&&this.createAdjacentSlide(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.currentIndex>0&&this.createAdjacentSlide(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 s=e?i.naturalWidth:this.imgEl.naturalWidth,o=e?i.naturalHeight:this.imgEl.naturalHeight;
vendor: 8,182 bytes, line 1
1this.zoom.naturalWidth=s,this.zoom.naturalHeight=o,this.zoom.fitRect=this.computeTargetRect(s,o),this.imgEl.src=t.src,this.positionImage(this.zoom.fitRect)}else{const i=this.getDimensionHint(t.triggerEl);if(i)this.zoom.naturalWidth=i.w,this.zoom.naturalHeight=i.h,this.zoom.fitRect=this.computeTargetRect(i.w,i.h);else{const i=t.triggerEl.querySelector("img"),e=i?.naturalWidth||400,s=i?.naturalHeight||300;this.zoom.naturalWidth=e,this.zoom.naturalHeight=s,this.zoom.fitRect=this.computeTargetRectFromAspectRatio(e,s)}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(null===this.stripRafId)return;this.stopStripSpring();const t=window.innerWidth+h;if(Math.abs(this.stripOffset)>t/2){const i=this.stripOffset<0?1:-1,e=this.currentIndex+i;e>=0&&e<this.gallery.length&&(this.stripOffset+=i*t,this.completeNavigation(i))}this.applyStripOffset(this.stripOffset)}animateSpring(t,e,s,o,n,a,h,r){this.stopSpring();const l=this.imgEl,c=this.backdrop;if(this.reducedMotion)return this.applyAnimState(l,c,e),void o();const d=[{key:"translateX",state:{position:t.translateX,velocity:a?.translateX??0},target:e.translateX,config:h?.translateX??s},{key:"translateY",state:{position:t.translateY,velocity:a?.translateY??0},target:e.translateY,config:h?.translateY??s},{key:"scale",state:{position:t.scale,velocity:a?.scale??0},target:e.scale,config:h?.scale??s},{key:"opacity",state:{position:t.opacity,velocity:a?.opacity??0},target:e.opacity,config:h?.opacity??s},{key:"crop",state:{position:t.crop,velocity:a?.crop??0},target:e.crop,config:h?.crop??s},{key:"borderRadius",state:{position:t.borderRadius,velocity:a?.borderRadius??0},target:e.borderRadius,config:h?.borderRadius??s}];let p=performance.now(),m=!1;this.applyAnimState(l,c,t);const u=t=>{const s=Math.min((t-p)/1e3,.064);p=t;let a=!0;const h={};for(const t of d){const e=i(t.config,t.state,t.target,s);t.state=e,h[t.key]=e.position,e.settled||(a=!1)}const g=h;if(this.applyAnimState(l,c,g),!m&&r?.(g)&&(m=!0,o()),a||n?.(g))return this.applyAnimState(l,c,e),this.debugLog("mainRaf settled"+(n?.(g)?" (early)":"")),this.rafId=null,void(m||o());this.rafId=requestAnimationFrame(u)};this.rafId=requestAnimationFrame(u)}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.isTextLink)t.style.opacity=String(Math.min(1,e.opacity/.2));else if(this.state.isClosing&&!this.state.isDismissClosing&&window.innerWidth<=600){const i=.02;t.style.opacity=e.opacity<i?String(e.opacity/i):""}else t.style.opacity="";if(e.crop>.001){const{top:i,right:s,bottom:o,left:n}=this.cropInsets,a=e.borderRadius>.1?e.borderRadius/Math.max(e.scale,.01):0;t.style.clipPath=`inset(${e.crop*i}px ${e.crop*s}px ${e.crop*o}px ${e.crop*n}px round ${a}px)`}else t.style.clipPath="";if(e.crop<=.001){const i=e.borderRadius>.1?e.borderRadius/Math.max(e.scale,.01):0;t.style.borderRadius=i>.1?`${i}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,e,s,o,n){if(this.stopStripSpring(),this.reducedMotion)return this.stripOffset=e,this.applyStripOffset(e),void n();let a={position:t,velocity:o},h=performance.now();const r=t=>{const o=Math.min((t-h)/1e3,.064);h=t;const l=i(s,a,e,o);a=l,this.stripOffset=l.position,this.applyStripOffset(l.position);const c=Math.abs(l.position-e)<1&&Math.abs(l.velocity)<5;if(l.settled||c)return this.stripOffset=e,this.applyStripOffset(e),this.debugLog("stripRaf settled"),this.stripRafId=null,void n();this.stripRafId=requestAnimationFrame(r)};this.stripRafId=requestAnimationFrame(r)}stopStripSpring(){null!==this.stripRafId&&(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(0===t)return this.chromeCaption&&(this.chromeCaption.style.opacity=""),this.chromeCounter&&(this.chromeCounter.style.opacity=""),void(this.chromeFadeSwapped=!1);const i=t<0?1:-1,e=this.currentIndex+i;if(!(e>=0&&e<this.gallery.length))return;const s=window.innerWidth+h,o=Math.min(1,Math.abs(t)/s),n=Math.abs(1-2*o);if(o>.5&&!this.chromeFadeSwapped){this.chromeFadeSwapped=!0;const t=this.gallery[e];if(this.chromeCounter&&(this.chromeCounter.textContent=`${e+1}â/â${this.gallery.length}`),this.chromeCaption){const i=t?.caption||"";this.chromeCaption.innerHTML=i,this.chromeCaption.style.display=i?"":"none"}}else if(o<=.5&&this.chromeFadeSwapped){this.chromeFadeSwapped=!1;const t=this.gallery[this.currentIndex];if(this.chromeCounter&&(this.chromeCounter.textContent=`${this.currentIndex+1}â/â${this.gallery.length}`),this.chromeCaption){const i=t?.caption||"";this.chromeCaption.innerHTML=i,this.chromeCaption.style.display=i?"":"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(){null!==this.stripRafId&&(this.stopStripSpring(),null!==this.pendingNavDirection?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,e){if(!this.imgEl||!this.isZoomable())return;this.debugLog("zoomIn"),this.emit("zoomIn"),this.stopSpring(),this.state.isAnimating=!0,this.animateChrome(1);const{fitRect:s}=this.zoom,o=this.getTapZoomScale(),n=t-(s.x+s.width/2),a=e-(s.y+s.height/2);let h=-(n*o-n),r=-(a*o-a);const l=this.computePanBounds(o);if(h=c(h,l.minX,l.maxX),r=c(r,l.minY,l.maxY),this.reducedMotion)return this.zoom.panX=h,this.zoom.panY=r,this.zoom.scale=o,this.zoom.zoomed=!0,this.applyPanTransform(),this.state.isAnimating=!1,void this.updateCursorState();const d=this.zoom.panX,p=this.zoom.panY,m=this.zoom.scale;let u={position:d,velocity:0},g={position:p,velocity:0},f={position:m,velocity:0};const y=this.opts.springOpen;let v=performance.now(),S=!1;const x=t=>{const e=Math.min((t-v)/1e3,.064);v=t;const s=i(y,u,h,e),n=i(y,g,r,e),a=i(y,f,o,e);if(u=s,g=n,f=a,this.zoom.panX=s.position,this.zoom.panY=n.position,this.zoom.scale=a.position,this.applyPanTransform(),!S&&a.position>1&&(S=!0,this.zoom.zoomed=!0,this.state.isAnimating=!1,this.updateCursorState()),s.settled&&n.settled&&a.settled)return this.zoom.panX=h,this.zoom.panY=r,this.zoom.scale=o,this.applyPanTransform(),this.rafId=null,void(S||(this.zoom.zoomed=!0,this.state.isAnimating=!1,this.updateCursorState()));this.rafId=requestAnimationFrame(x)};this.rafId=requestAnimationFrame(x)}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,e=this.zoom.panY,s=this.zoom.scale;let o={position:t,velocity:0},n={position:e,velocity:0},a={position:s,velocity:0};const h=this.opts.springClose;let r=performance.now(),l=!1;const c=t=>{const e=Math.min((t-r)/1e3,.064);r=t;const s=i(h,o,0,e),d=i(h,n,0,e),p=i(h,a,1,e);if(o=s,n=d,a=p,this.zoom.panX=s.position,this.zoom.panY=d.position,this.zoom.scale=p.position,this.applyPanTransform(),!l&&Math.abs(p.position-1)<.005&&Math.abs(s.position)<1&&Math.abs(d.position)<1&&(l=!0,this.zoom.zoomed=!1,this.zoom.zoomingOut=!1,this.state.isAnimating=!1,this.updateCursorState()),s.settled&&d.settled&&p
vendor: 2,648 bytes, line 1
1.settled)return this.zoom.panX=0,this.zoom.panY=0,this.zoom.scale=1,this.applyPanTransform(),this.rafId=null,void(l||(this.zoom.zoomed=!1,this.zoom.zoomingOut=!1,this.state.isAnimating=!1,this.updateCursorState()));this.rafId=requestAnimationFrame(c)};this.rafId=requestAnimationFrame(c)}handleImagePointerDown(t){if(t.preventDefault(),this.pointerCache.push(t),t.target.setPointerCapture(t.pointerId),2===this.pointerCache.length)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)return;if(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(i=>i.pointerId===t.pointerId);if(i>=0&&(this.pointerCache[i]=t),this.pinch.active&&2===this.pointerCache.length)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=
vendor: 21,578 bytes, line 1
1d(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(i=>i.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 i=this.dismiss.startX;this.dismiss=this.defaultDismissState(),this.zoom.dragMoved=!0,this.startSwipeNav(i,t.clientX)}else this.dismiss=this.defaultDismissState();return}this.dismiss.active=!0,this.dismiss.tracking=!1,this.zoom.dragMoved=!0,0!==this.stripOffset&&(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 t=this.dismiss.fromOverlay;return this.dismiss=this.defaultDismissState(),void(t&&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 t=this.overlay;setTimeout(()=>{t.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 void this.animateSpring({translateX:e,translateY:s,scale:o,opacity:n,crop:0,borderRadius:h},{translateX:e,translateY:s,scale:o,opacity:0,crop:0,borderRadius:h},this.opts.springClose,()=>this.finishClose(),t=>t.opacity<.01,{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),d=l.y+l.height/2-(r.y+r.height/2),{flipScale:p,hasCrop:m}=this.computeFlipCrop(l,r,this.state.triggerEl,this.isTextLink),u=this.state.triggerEl;let g=!1;const f=this.opts.springClose,y=Math.abs(t),v=Math.abs(i);let S;if(Math.max(y,v)/(Math.min(y,v)||1)>1.5&&Math.max(y,v)>100){const t={...f,stiffness:.55*f.stiffness,damping:.85*f.damping};S=v>y?{translateY:t}:{translateX:t}}this.animateSpring({translateX:e,translateY:s,scale:o,opacity:n,crop:0,borderRadius:h},{translateX:c,translateY:d,scale:p,opacity:0,crop:m?1:0,borderRadius:this.thumbBorderRadius},this.opts.springClose,()=>this.finishClose(),t=>{const i=Math.abs(t.scale-p)<.05&&Math.abs(t.translateX-c)<20&&Math.abs(t.translateY-d)<20;return i&&!g&&u&&(g=!0,this.bounceTrigger(u)),i},{translateX:t,translateY:i},S)}dismissSnapBack(t,i){const{offsetX:e,offsetY:s,scale:o,opacity:n}=this.dismiss;this.dismiss=this.defaultDismissState();const h=this.getTargetBorderRadius();this.animateSpring({translateX:e,translateY:s,scale:o,opacity:n,crop:0,borderRadius:h},{translateX:0,translateY:0,scale:1,opacity:1,crop:0,borderRadius:h},a,()=>{},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||(null!==this.wheelGestureTimer&&clearTimeout(this.wheelGestureTimer),this.wheelGestureTimer=setTimeout(()=>{this.debugLog("gesture timer â reset wheel state"),this.wheelGestureTimer=null,this.wheelDismissY=0,this.wheelNavCommitted=!1,this.wheelNavTotalDelta=0},80),this.handleScroll(t)))}handleScroll(t){const i=1===t.deltaMode?16:1,e=t.deltaX*i,s=t.deltaY*i,o=Math.abs(e),n=Math.abs(s);this.zoom.zoomed||1!==this.zoom.scale?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 t=e.minX-this.zoom.panX;this.zoom.panX=e.minX-t*o}else if(this.zoom.panX>e.maxX){const t=this.zoom.panX-e.maxX;this.zoom.panX=e.maxX+t*o}if(this.zoom.panY<e.minY){const t=e.minY-this.zoom.panY;this.zoom.panY=e.minY-t*o}else if(this.zoom.panY>e.maxY){const t=this.zoom.panY-e.maxY;this.zoom.panY=e.maxY+t*o}this.applyPanTransform(),this.scheduleWheelSnapBack()}scheduleWheelSnapBack(){null!==this.wheelSnapBackTimer&&clearTimeout(this.wheelSnapBackTimer),this.wheelSnapBackTimer=setTimeout(()=>{if(this.wheelSnapBackTimer=null,this.state.isClosing||!this.state.isOpen)return;if(!this.zoom.zoomed&&1===this.zoom.scale)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 t=this.wheelNavTotalDelta>0?"next":"prev";this.debugLog(`wheelNav commit â ${t}`),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=0===this.currentIndex,n=this.currentIndex===this.gallery.length-1;s&&e>0&&(e*=o),n&&e<0&&(e*=o),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+h,s=Math.abs(i)/e;let o=Math.abs(t)>300||s>.3;const n=i<0?1:-1;1===n&&this.currentIndex>=this.gallery.length-1&&(o=!1),-1===n&&this.currentIndex<=0&&(o=!1),o?this.completeSwipeNav(n,t):this.snapBackSwipeNav(t)}completeSwipeNav(t,i){this.pendingNavDirection=t;const e=1===t?this.nextSlideEl:this.prevSlideEl;e&&(e.style.pointerEvents="auto");const s=window.innerWidth+h,o=-t*s;this.animateStrip(this.stripOffset,o,this.opts.springOpen,i,()=>this.completeNavigation(t))}snapBackSwipeNav(t){this.animateStrip(this.stripOffset,0,a,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,d=l.y+l.height/2,p=this.pinch.initialMidX-c,m=this.pinch.initialMidY-d,u=h/this.pinch.initialScale,g=this.pinch.initialPanX+(s-this.pinch.initialMidX)-(p-this.pinch.initialPanX)*(u-1),f=this.pinch.initialPanY+(o-this.pinch.initialMidY)-(m-this.pinch.initialPanY)*(u-1);if(this.zoom.scale=h,this.zoom.panX=g,this.zoom.panY=f,this.applyPanTransform(),h<1){const t=1-h,i=Math.max(0,1-t/.35);this.backdrop.style.opacity=String(i),this.chromeBaseOpacity=i,this.chromeSpring={position:0,velocity:0},this.updateChromeVisuals()}else{const t=Math.min(1,Math.max(0,(h-1)/.5));this.chromeSpring={position:t,velocity:0},this.updateChromeVisuals()}}endPinch(){this.pinch.active=!1,this.zoom.dragMoved=!0;const t=this.getMaxZoomScale();if(this.zoom.scale<1){const t=(performance.now()-this.pinch.prevScaleTime)/1e3,i=t>.001?(this.zoom.scale-this.pinch.prevScale)/t:0;this.zoom.scale<.8||i<-2?this.pinchClose():this.pinchSnapBack()}else if(this.zoom.scale>t){const i=this.computePanBounds(t),e=c(this.zoom.panX,i.minX,i.maxX),s=c(this.zoom.panY,i.minY,i.maxY);this.springToZoomState(t,e,s,a,!0),this.animateChrome(1)}else{this.zoom.zoomed=this.zoom.scale>1,this.animateChrome(this.zoom.scale>1?1:0);const t=this.computePanBounds(this.zoom.scale),i=this.zoom.panX>=t.minX&&this.zoom.panX<=t.maxX,e=this.zoom.panY>=t.minY&&this.zoom.panY<=t.maxY;if(i&&e)this.updateCursorState();else{const i=c(this.zoom.panX,t.minX,t.maxX),e=c(this.zoom.panY,t.minY,t.maxY);this.springToZoomState(this.zoom.scale,i,e,a,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 t=this.overlay;setTimeout(()=>{t.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 void this.animateSpring({translateX:t,translateY:i,scale:e,opacity:o,crop:0,borderRadius:a},{translateX:t,translateY:i,scale:e,opacity:0,crop:0,borderRadius:a},this.opts.springClose,()=>this.finishClose(),t=>t.opacity<.01);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:d,hasCrop:p}=this.computeFlipCrop(r,h,this.state.triggerEl,this.isTextLink),m=this.state.triggerEl;let u=!1;this.animateSpring({translateX:t,translateY:i,scale:e,opacity:o,crop:0,borderRadius:a},{translateX:l,translateY:c,scale:d,opacity:0,crop:p?1:0,borderRadius:this.thumbBorderRadius},this.opts.springClose,()=>this.finishClose(),t=>{const i=Math.abs(t.scale-d)<.05&&Math.abs(t.translateX-l)<20&&Math.abs(t.translateY-c)<20;return i&&!u&&m&&(u=!0,this.bounceTrigger(m)),i})}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},a,()=>{})}springToZoomState(t,e,s,o,n){if(this.stopSpring(),this.state.isAnimating=!0,this.reducedMotion)return this.zoom.panX=e,this.zoom.panY=s,this.zoom.scale=t,this.zoom.zoomed=n,this.applyPanTransform(),this.state.isAnimating=!1,void this.updateCursorState();let a={position:this.zoom.panX,velocity:0},h={position:this.zoom.panY,velocity:0},r={position:this.zoom.scale,velocity:0},l=performance.now(),c=!1;const d=p=>{const m=Math.min((p-l)/1e3,.064);l=p;const u=i(o,a,e,m),g=i(o,h,s,m),f=i(o,r,t,m);if(a=u,h=g,r=f,this.zoom.panX=u.position,this.zoom.panY=g.position,this.zoom.scale=f.position,this.applyPanTransform(),!c&&Math.abs(f.position-t)<.005*t&&Math.abs(u.position-e)<1&&Math.abs(g.position-s)<1&&(c=!0,this.zoom.zoomed=n,this.state.isAnimating=!1,this.updateCursorState()),u.settled&&g.settled&&f.settled)return this.zoom.panX=e,this.zoom.panY=s,this.zoom.scale=t,this.applyPanTransform(),this.rafId=null,void(c||(this.zoom.zoomed=n,this.state.isAnimating=!1,this.updateCursorState()));this.rafId=requestAnimationFrame(d)};this.rafId=requestAnimationFrame(d)}startPanMomentum(t,e){const s=this.computePanBounds(this.zoom.scale),o=this.zoom.panX>=s.minX&&this.zoom.panX<=s.maxX,h=this.zoom.panY>=s.minY&&this.zoom.panY<=s.maxY,r=c(o?this.zoom.panX+.15*t:this.zoom.panX,s.minX,s.maxX),l=c(h?this.zoom.panY+.15*e:this.zoom.panY,s.minY,s.maxY);if(this.reducedMotion)return this.zoom.panX=r,this.zoom.panY=l,void this.applyPanTransform();let d={position:this.zoom.panX,velocity:o?t:0},p={position:this.zoom.panY,velocity:h?e:0};const m=o?n:a,u=h?n:a;let g=performance.now();const f=t=>{const e=Math.min((t-g)/1e3,.064);g=t;const s=i(m,d,r,e),o=i(u,p,l,e);d=s,p=o,this.zoom.panX=s.position,this.zoom.panY=o.position,this.applyPanTransform(),s.settled&&o.settled?this.rafId=null:this.rafId=requestAnimationFrame(f)};this.rafId=requestAnimationFrame(f)}stopSpring(){null!==this.rafId&&(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:(null!==this.pendingNavDirection&&this.forceCompleteStripAnimation(),this.zoom.zoomed||1!==this.zoom.scale?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}â/â${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",t=>{t.stopPropagation(),this.close()}),a.addEventListener("pointerdown",t=>t.stopPropagation()),s.appendChild(a),this.chromeClose=a,this.bindPressSpring(a),s.addEventListener("click",t=>{t.stopPropagation()}),this.overlay.appendChild(s),this.chromeBar=s,this.overlay.focus({preventScroll:!0}),t){const t=document.createElement("button");t.className="lightbox3-arrow lightbox3-arrow-prev",t.setAttribute("aria-label","Previous image"),t.type="button",t.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>',t.addEventListener("click",t=>{t.stopPropagation(),this.prev()}),t.addEventListener("pointerdown",t=>t.stopPropagation()),this.overlay.appendChild(t),this.chromePrev=t,this.bindPressSpring(t);const i=document.createElement("button");i.className="lightbox3-arrow lightbox3-arrow-next",i.setAttribute("aria-label","Next image"),i.type="button",i.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>',i.addEventListener("click",t=>{t.stopPropagation(),this.next()}),i.addEventListener("pointerdown",t=>t.stopPropagation()),this.overlay.appendChild(i),this.chromeNext=i,this.bindPressSpring(i),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}â/â${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.currentIndex>0?"":"none"),this.chromeNext&&(this.chromeNext.style.display=this.currentIndex<this.gallery.length-1?"":"none")}computeChromeDrift(t,i){const e=.05,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)*e,y:(i-a)*e},prev:{x:(t-h)*e,y:(i-r)*e},next:{x:(t-l)*e,y:(i-c)*e}}}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 e=1===t?this.opts.springOpen:this.opts.springClose;let s=performance.now();const o=n=>{const a=Math.min((n-s)/1e3,.064);s=n;const h=i(e,this.chromeSpring,t,a);this.chromeSpring=h,this.updateChromeVisuals(),h.settled?this.chromeRafId=null:this.chromeRafId=requestAnimationFrame(o)};this.chromeRafId=requestAnimationFrame(o)}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 t=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(${t})`,this.chromePrev.style.pointerEvents=e?"":"none"}if(this.chromeNext){const t=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(${t})`,this.chromeNext.style.pointerEvents=e?"":"none"}if(this.chromeClose){const t=this.getPressScale(this.chromeClose);this.chromeClose.style.transform=`scale(${t})`,this.chromeClose.style.pointerEvents=e?"":"none"}}stopChromeSpring(){null!==this.chromeRafId&&(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(null!==this.pressRafId)return;if(this.reducedMotion){for(const[,t]of this.pressSprings)t.state={position:t.target,velocity:0};return void this.updateChromeVisuals()}let t=performance.now();const e=s=>{const o=Math.min((s-t)/1e3,.064);t=s;let n=!0;for(const[,t]of this.pressSprings){const e=i(r,t.state,t.target,o);t.state=e,e.settled||(n=!1)}this.updateChromeVisuals(),this.pressRafId=n?null:requestAnimationFrame(e)};this.pressRafId=requestAnimationFrame(e)}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");
1e.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",t=>this.handleImageClick(t)),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 e=this.computeTargetRect(s.naturalWidth,s.naturalHeight);this.positionImageEl(t,e)}else{t.src=i.thumbSrc||i.src;const e=i.triggerEl.querySelector("img"),o=e?.naturalWidth||400,n=e?.naturalHeight||300,a=this.computeTargetRectFromAspectRatio(o,n);if(this.positionImageEl(t,a),s&&!s.complete){const e=()=>{if(s.removeEventListener("load",e),!this.state.isClosing&&this.state.isOpen&&(t===this.prevSlideImg||t===this.nextSlideImg)&&s.naturalWidth>0){t.src=i.src;const e=this.computeTargetRect(s.naturalWidth,s.naturalHeight);this.positionImageEl(t,e)}};s.addEventListener("load",e)}}}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+h;this.currentIndex>0&&this.createAdjacentSlide(this.currentIndex-1,-t),this.currentIndex<this.gallery.length-1&&this.createAdjacentSlide(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(),null!==this.pressRafId&&(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("cover"!==getComputedStyle(i).objectFit||!i.naturalWidth||!i.naturalHeight)return e;
vendor: 6,314 bytes, lines 1-2
1const 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||"cover"!==getComputedStyle(s).objectFit)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);if(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 e=Math.max(o,n),s=t.width/e,a=t.height/e;return this.cropInsets={top:Math.max(0,(i.height-a)/2),bottom:Math.max(0,(i.height-a)/2),left:Math.max(0,(i.width-s)/2),right:Math.max(0,(i.width-s)/2)},{flipScale:e,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}computeTargetRect(t,i){const e=window.innerWidth,s=window.innerHeight,o=this.getTargetImagePadding(),n=Math.min((e-2*o)/t,(s-2*o)/i,1),a=t*n,h=i*n;return new DOMRect((e-a)/2,(s-h)/2,a,h)}computeTargetRectFromAspectRatio(t,i){const e=window.innerWidth,s=window.innerHeight,o=this.getTargetImagePadding(),n=Math.min((e-2*o)/t,(s-2*o)/i),a=t*n,h=i*n;return new DOMRect((e-a)/2,(s-h)/2,a,h)}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="ââ event log ââââââââââ\n",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(){null!==this.debugRafId&&(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="ââ event log ââââââââââ\n"+this.debugLogEntries.join("\n"),this.debugLogEl.scrollTop=this.debugLogEl.scrollHeight}updateDebugPanel(){if(!this.debugStateEl)return;const t=t=>t?"â":"â",i=t=>t.toFixed(1),e=["ââ state ââââââââââââââ",`isOpen:${t(this.state.isOpen)} isAnim:${t(this.state.isAnimating)} isClosing:${t(this.state.isClosing)}`,`gallery: ${this.currentIndex+1}/${this.gallery.length||1}`,"","ââ springs ââââââââââââ",`mainRaf: ${t(null!==this.rafId)}`,`stripRaf: ${t(null!==this.stripRafId)} offset: ${i(this.stripOffset)}`,`chromeRaf:${t(null!==this.chromeRafId)}`,`pendingNav: ${this.pendingNavDirection??"none"}`,"","ââ zoom âââââââââââââââ",`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)}`,"","ââ gestures âââââââââââ",`dismiss: track:${t(this.dismiss.tracking)} active:${t(this.dismiss.active)}`,`swipeNav: ${t(this.swipeNav.active)}`,`pinch: ${t(this.pinch.active)}`,"","ââ wheel nav ââââââââââ",`committed:${t(this.wheelNavCommitted)}`,`totalDelta: ${i(this.wheelNavTotalDelta)}`,`gestureTimer: ${t(null!==this.wheelGestureTimer)}`,`dismissY: ${i(this.wheelDismissY)}`];if(this.gallery.length>1){e.push("","ââ gallery preload ââââ");for(let t=0;t<this.gallery.length;t++){const i=this.gallery[t],s=this.preloadCache.get(i.src),o=t===this.currentIndex?"â¸":" ";let n;n=s?.complete&&s.naturalWidth>0?`â ${s.naturalWidth}Ã${s.naturalHeight}`:s?"â loading":"â pending";const a=i.src.split("/").pop()||i.src,h=a.length>20?a.slice(0,19)+"â¦":a;e.push(`${o}${String(t+1).padStart(2)} ${h.padEnd(20)} ${n}`)}}this.debugStateEl.textContent=e.join("\n")}}function c(t,i,e){return Math.max(i,Math.min(e,t))}function d(t,i,e){return t<i?i-(i-t)*o:t>e?e+(t-e)*o:t}function p(){if(!document.querySelector("[data-lightbox]"))return;const t="undefined"!=typeof location&&new URLSearchParams(location.search).has("debug");l.init(t?{debug:!0}:void 0)}l.instance=null,"undefined"!=typeof document&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",p):p()),t.Lightbox=l}); 2//# sourceMappingURL=lightbox3.min.js.map
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.