@atom63/ui-react 0.2.0-beta.14 → 0.2.0-beta.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/chunk-3LGXD3HE.js +450 -0
  2. package/dist/chunk-3LGXD3HE.js.map +1 -0
  3. package/dist/chunk-6HKGC3HE.js +3 -0
  4. package/dist/chunk-6HKGC3HE.js.map +1 -0
  5. package/dist/chunk-6VV4EBOO.js +25 -0
  6. package/dist/chunk-6VV4EBOO.js.map +1 -0
  7. package/dist/{chunk-IXWOWQBP.js → chunk-ALARPBUL.js} +5 -22
  8. package/dist/chunk-ALARPBUL.js.map +1 -0
  9. package/dist/chunk-FHL2NLXP.js +101 -0
  10. package/dist/chunk-FHL2NLXP.js.map +1 -0
  11. package/dist/chunk-HPUHI2YJ.js +69 -0
  12. package/dist/chunk-HPUHI2YJ.js.map +1 -0
  13. package/dist/chunk-QU33S646.js +118 -0
  14. package/dist/chunk-QU33S646.js.map +1 -0
  15. package/dist/components/art-plate/index.js +7 -0
  16. package/dist/components/art-plate/index.js.map +1 -0
  17. package/dist/components/layered-scene/index.js +7 -0
  18. package/dist/components/layered-scene/index.js.map +1 -0
  19. package/dist/components/segmented-control/index.js +1 -1
  20. package/dist/index.d.ts +89 -6
  21. package/dist/index.js +18 -13
  22. package/dist/media/index.d.ts +24 -3
  23. package/dist/media/index.js +9 -361
  24. package/dist/media/index.js.map +1 -1
  25. package/dist/media/media-lightbox/parts/index.js +2 -1
  26. package/dist/preview/index.js +4 -4
  27. package/dist/theme/index.d.ts +6 -2
  28. package/dist/theme/index.js +10 -1
  29. package/dist/theme/index.js.map +1 -1
  30. package/package.json +5 -3
  31. package/src/components/alert-dialog/alert-dialog.css +1 -1
  32. package/src/components/art-plate/art-plate.css +172 -0
  33. package/src/components/autocomplete/autocomplete.css +3 -3
  34. package/src/components/checkbox/checkbox.css +1 -1
  35. package/src/components/feedback-state/feedback-state.css +1 -1
  36. package/src/components/field/field.css +1 -1
  37. package/src/components/form/form.css +1 -1
  38. package/src/components/input/input.css +3 -3
  39. package/src/components/input-otp/input-otp.css +3 -3
  40. package/src/components/layered-scene/layered-scene.css +117 -0
  41. package/src/components/load-more-trigger/load-more-trigger.css +4 -2
  42. package/src/components/radio/radio.css +1 -1
  43. package/src/components/rating/rating.css +18 -17
  44. package/src/components/segmented-control/segmented-control.css +11 -11
  45. package/src/components/select/select.css +3 -3
  46. package/src/components/textarea/textarea.css +3 -3
  47. package/src/styles/recipes.css +2 -0
  48. package/dist/chunk-IXWOWQBP.js.map +0 -1
  49. package/dist/chunk-T7FUZUZO.js +0 -70
  50. package/dist/chunk-T7FUZUZO.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/media/media-lightbox/parts/context.ts","../src/media/media-lightbox/parts/refs.ts","../src/media/hooks/use-reduced-motion.ts","../src/media/media-lightbox/labels.ts","../src/media/media-lightbox/reveal-origin.ts","../src/media/media-lightbox/motion.ts","../src/media/media-lightbox/timing.ts","../src/media/media-lightbox/view-transition.ts","../src/media/media-lightbox/parts/thumbnails-registry.ts","../src/media/media-lightbox/parts/zoom-registry.ts","../src/media/media-lightbox/parts/root.tsx","../src/media/media-lightbox/direction.ts","../src/media/media-lightbox/scroll-lock.ts","../src/media/media-lightbox/use-media-zoom.ts","../src/media/media-lightbox/velocity.ts","../src/media/media-lightbox/wheel-momentum.ts","../src/media/media-lightbox/use-pull-to-dismiss.ts","../src/media/media-lightbox/parts/zoom-options.ts","../src/media/media-lightbox/parts/content.tsx","../src/media/media-lightbox/track-physics.ts","../src/media/media-lightbox/use-slide-track.ts","../src/media/media-lightbox/parts/slides.tsx","../src/media/media-lightbox/origin-morph.ts","../src/media/media-lightbox/slide-media.tsx","../src/media/media-lightbox/use-media-aspect.ts","../src/media/media-lightbox/parts/frame.tsx","../src/media/media-lightbox/parts/chrome.tsx","../src/media/media-lightbox/parts/zoom-controls.tsx","../src/media/media-lightbox/parts/thumbnails.tsx","../src/media/media-lightbox/parts/extras.tsx","../src/media/media-lightbox/parts/index.ts"],"names":["createContext","useContext","useState","createElement","useEffect","useRef","useCallback","img","from","animate","jsx","step","startPosition","velocity","useRender","mergeProps","useLayoutEffect","motion"],"mappings":";;;;;;;;;;;AAgDO,IAAM,qBAAA,GAAwB,cAAqC,IAAI,CAAA;AACvE,IAAM,oBAAA,GAAuB,cAAoC,IAAI,CAAA;AACrE,IAAM,oBAAA,GAAuB,cAAoC,IAAI,CAAA;AAE5E,SAAS,QAAA,CAAY,OAAiB,IAAA,EAAiB;AACrD,EAAA,IAAI,UAAU,IAAA,EAAM;AAClB,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,EAAG,IAAI,CAAA,uCAAA,CAAyC,CAAA;AAAA,EAClE;AACA,EAAA,OAAO,KAAA;AACT;AAEO,SAAS,iBAAA,GAAoC;AAClD,EAAA,OAAO,QAAA,CAAS,UAAA,CAAW,qBAAqB,CAAA,EAAG,oBAAoB,CAAA;AACzE;AAGO,SAAS,yBAAA,GAAmD;AACjE,EAAA,OAAO,WAAW,qBAAqB,CAAA;AACzC;AAEO,SAAS,gBAAA,GAAkC;AAChD,EAAA,OAAO,QAAA,CAAS,UAAA,CAAW,oBAAoB,CAAA,EAAG,oBAAoB,CAAA;AACxE;AAGO,SAAS,gBAAA,GAAyC;AACvD,EAAA,OAAO,WAAW,oBAAoB,CAAA;AACxC;ACxDO,IAAM,mBAAA,GAAsBA,cAAmC,IAAI,CAAA;AAEnE,SAAS,eAAA,GAAgC;AAC9C,EAAA,MAAM,IAAA,GAAOC,WAAW,mBAAmB,CAAA;AAC3C,EAAA,IAAI,SAAS,IAAA,EAAM;AACjB,IAAA,MAAM,IAAI,MAAM,2DAA2D,CAAA;AAAA,EAC7E;AACA,EAAA,OAAO,IAAA;AACT;ACzBO,SAAS,gBAAA,GAA4B;AAC1C,EAAA,MAAM,CAAC,oBAAA,EAAsB,uBAAuB,CAAA,GAAI,SAAS,KAAK,CAAA;A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GAEvF;AAEJ;;;ACrCO,IAAM,QAAA,GAAW;AAAA,EACtB,gBAAA,EAAkB,wBAAA;AAAA,EAClB,QAAA,EAAU,gBAAA;AAAA,EACV,OAAA,EAAS,eAAA;AAAA,EACT,KAAA,EAAO,aAAA;AAAA,EACP,OAAA,EAAS,eAAA;AAAA,EACT,OAAA,EAAS,eAAA;AAAA,EACT,WAAA,EAAa,mBAAA;AAAA,EACb,KAAA,EAAO,aAAA;AAAA,EACP,KAAA,EAAO,aAAA;AAAA,EACP,IAAA,EAAM,YAAA;AAAA,EACN,MAAA,EAAQ,cAAA;AAAA,EACR,QAAA,EAAU,gBAAA;AAAA,EACV,IAAA,EAAM,YAAA;AAAA,EACN,KAAA,EAAO,aAAA;AAAA,EACP,MAAA,EAAQ,cAAA;AAAA,EACR,MAAA,EAAQ,cAAA;AAAA,EACR,SAAA,EAAW,iBAAA;AAAA,EACX,UAAA,EAAY,kBAAA;AAAA,EACZ,QAAA,EAAU,gBAAA;AAAA,EACV,IAAA,EAAM,YAAA;AAAA,EACN,MAAA,EAAQ,cAAA;AAAA,EACR,OAAA,EAAS;AACX","file":"chunk-IXWOWQBP.js","sourcesContent":["'use client'\n\nimport { createContext, useContext } from 'react'\nimport type { LightboxTiming } from '../timing'\nimport type {\n MediaLightboxAppearance,\n MediaLightboxItem,\n MediaLightboxLabels,\n MediaLightboxTransition,\n} from '../types'\n\n/**\n * 按变化频率分三层,而不是一个大 context。\n *\n * `items` 与 `labels` 一整场都不变,`index` 每次翻页变一次。合在一起的话,\n * 一次滑动会把每张 slide 的每个 chrome 部件全部重渲染一遍。\n */\nexport interface LightboxConfig {\n items: readonly MediaLightboxItem[]\n labels: MediaLightboxLabels\n appearance: Record<string, MediaLightboxAppearance> | undefined\n onAppearanceChange: ((id: string, appearance: MediaLightboxAppearance) => void) | undefined\n open: boolean\n preload: number\n transition: MediaLightboxTransition\n reducedMotion: boolean\n origin: HTMLElement | null | undefined\n timing: LightboxTiming\n}\n\nexport interface LightboxState {\n index: number\n itemCount: number\n isZoomed: boolean\n goTo: (index: number) => void\n close: () => void\n zoomIn: () => void\n zoomOut: () => void\n}\n\nexport interface LightboxSlide {\n item: MediaLightboxItem\n slideIndex: number\n isActive: boolean\n /** 在 preload 邻域内,媒体应当挂载。 */\n isNear: boolean\n}\n\nexport const LightboxConfigContext = createContext<LightboxConfig | null>(null)\nexport const LightboxStateContext = createContext<LightboxState | null>(null)\nexport const LightboxSlideContext = createContext<LightboxSlide | null>(null)\n\nfunction required<T>(value: T | null, part: string): T {\n if (value === null) {\n throw new Error(`${part} must be rendered inside Lightbox.Root.`)\n }\n return value\n}\n\nexport function useLightboxConfig(): LightboxConfig {\n return required(useContext(LightboxConfigContext), 'This lightbox part')\n}\n\n/** 供 preset 之外的宿主判断自己是否在 lightbox 里,不抛错。 */\nexport function useOptionalLightboxConfig(): LightboxConfig | null {\n return useContext(LightboxConfigContext)\n}\n\nexport function useLightboxState(): LightboxState {\n return required(useContext(LightboxStateContext), 'This lightbox part')\n}\n\n/** slide 之外使用是合法的(chrome 就在 slide 之外),故返回 null 而不抛错。 */\nexport function useLightboxSlide(): LightboxSlide | null {\n return useContext(LightboxSlideContext)\n}\n","'use client'\n\nimport { createContext, useContext, type RefObject } from 'react'\n\n/**\n * 手势与形变 hook 需要同时看到轨道、画框、缩放层和根元素,但这些元素分属不同\n * 部件。部件把自己的宿主元素登记到这里,hook 在 `Content` 层统一取用。\n *\n * 槽位为 null 是合法状态:省略 `Slides` 就没有轨道,对应的手势静默不启用。\n */\nexport interface LightboxRefs {\n rootRef: RefObject<HTMLDivElement | null>\n backdropRef: RefObject<HTMLDivElement | null>\n stageRef: RefObject<HTMLDivElement | null>\n trackRef: RefObject<HTMLDivElement | null>\n mediaRef: RefObject<HTMLDivElement | null>\n zoomRef: RefObject<HTMLDivElement | null>\n}\n\nexport const LightboxRefsContext = createContext<LightboxRefs | null>(null)\n\nexport function useLightboxRefs(): LightboxRefs {\n const refs = useContext(LightboxRefsContext)\n if (refs === null) {\n throw new Error('This lightbox part must be rendered inside Lightbox.Root.')\n }\n return refs\n}\n","import { useEffect, useState } from 'react'\n\nexport function useReducedMotion(): boolean {\n const [prefersReducedMotion, setPrefersReducedMotion] = useState(false)\n\n useEffect(() => {\n // Not every host provides matchMedia (older jsdom, some embedded views).\n // Treating that as \"no preference\" is safer than throwing on mount.\n if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') {\n return\n }\n\n const mediaQuery = window.matchMedia('(prefers-reduced-motion: reduce)')\n\n // Set initial value\n setPrefersReducedMotion(mediaQuery.matches)\n\n // Listen for changes\n const handleChange = (event: MediaQueryListEvent) => {\n setPrefersReducedMotion(event.matches)\n }\n\n mediaQuery.addEventListener('change', handleChange)\n\n return () => {\n mediaQuery.removeEventListener('change', handleChange)\n }\n }, [])\n\n return prefersReducedMotion\n}\n","import type { MediaLightboxLabels } from './types'\n\n/**\n * English defaults so the common case needs no wiring. A localized surface\n * passes `labels` and overrides only the pieces it needs.\n */\nexport const DEFAULT_MEDIA_LIGHTBOX_LABELS: MediaLightboxLabels = {\n appearance: (title, target) => `Show ${target} version of ${title}`,\n carousel: 'carousel',\n close: 'Close media viewer',\n gallery: 'Media',\n next: 'Next media',\n openDestination: title => `Open ${title}`,\n position: (index, total) => `${index + 1} of ${total}`,\n previous: 'Previous media',\n slide: 'slide',\n thumbnails: 'Choose media',\n view: title => `View ${title}`,\n zoomIn: title => `Zoom into ${title}`,\n zoomOut: title => `Zoom out of ${title}`,\n}\n\nexport function resolveLabels(\n overrides: Partial<MediaLightboxLabels> | undefined\n): MediaLightboxLabels {\n return overrides\n ? { ...DEFAULT_MEDIA_LIGHTBOX_LABELS, ...overrides }\n : DEFAULT_MEDIA_LIGHTBOX_LABELS\n}\n","/**\n * Keeping the tile the lightbox returns to where the closing morph can see it.\n *\n * A gallery opened from a scrolling row can be paged far past the tile it\n * opened from. The tile for the photo on screen is then outside the row's\n * scroll viewport, and a morph aimed at it flies into a clipped or hidden box.\n * The fix is the one a native viewer uses: keep the timeline behind the viewer\n * in step, and check that the target is really visible before morphing to it.\n */\n\n/**\n * Scrolls every scroll container around `element` just enough to show it.\n *\n * Instant, overriding any `scroll-behavior: smooth`: the lightbox covers the\n * page, so the jump is never seen, and a smooth scroll would still be moving\n * the tile when the morph measures it. The body scroll lock only sets\n * `overflow: hidden`, which stops the user scrolling, not a script.\n */\nexport function revealOrigin(element: HTMLElement | null | undefined): void {\n // `scrollIntoView` is missing in jsdom and any non-browser host.\n element?.scrollIntoView?.({ behavior: 'instant', block: 'nearest', inline: 'nearest' })\n}\n\n/**\n * The tile a closing morph should land on: revealed first, then `null` if an\n * `overflow` ancestor still cuts it off, in which case the caller cross-fades.\n * Being inside the viewport is not enough: a tile scrolled out of its row is\n * still on screen, only hidden by the row.\n */\nexport function revealReturnTarget(origin: HTMLElement | null | undefined): HTMLElement | null {\n if (!origin) {\n return null\n }\n revealOrigin(origin)\n return isClippedByAncestor(origin) ? null : origin\n}\n\n/** Subpixel layout leaves a tile a fraction of a pixel short of its container. */\nconst CLIP_TOLERANCE = 1\n\nfunction clips(element: Element): boolean {\n const style = getComputedStyle(element)\n return style.overflowX !== 'visible' || style.overflowY !== 'visible'\n}\n\n/**\n * Whether an `overflow` ancestor cuts any of `element` off.\n *\n * `html` and `body` are skipped: their overflow applies to the viewport, which\n * the caller checks on its own, and the body scroll lock sets `overflow:\n * hidden` on `body` without clipping anything.\n */\nexport function isClippedByAncestor(element: Element): boolean {\n const rect = element.getBoundingClientRect()\n const root = element.ownerDocument.documentElement\n const body = element.ownerDocument.body\n for (\n let ancestor = element.parentElement;\n ancestor && ancestor !== root && ancestor !== body;\n ancestor = ancestor.parentElement\n ) {\n if (!clips(ancestor)) {\n continue\n }\n const bounds = ancestor.getBoundingClientRect()\n if (\n rect.left < bounds.left - CLIP_TOLERANCE ||\n rect.top < bounds.top - CLIP_TOLERANCE ||\n rect.right > bounds.right + CLIP_TOLERANCE ||\n rect.bottom > bounds.bottom + CLIP_TOLERANCE\n ) {\n return true\n }\n }\n return false\n}\n","import type { Transition } from 'motion/react'\n\n/**\n * Every timing the lightbox animates on, in one place.\n *\n * The tile, the overlay, and the gesture hooks all read from here so the\n * opening morph, the closing morph, and the caller's own hover-freeze cannot\n * drift apart into three slightly different ideas of how long a close takes.\n */\n\n/**\n * The open/close morph and the pull-to-dismiss settle.\n *\n * A spring rather than a fixed duration: a spring re-targets from wherever it\n * currently is, so closing a lightbox that is still opening reads as one object\n * changing its mind rather than two animations fighting. Damped just under\n * critical — enough life to feel physical, not enough to visibly overshoot a\n * photograph's edges.\n */\nexport const MEDIA_SPRING = {\n type: 'spring',\n stiffness: 520,\n damping: 44,\n mass: 1,\n restDelta: 0.0005,\n} as const satisfies Transition\n\n/** Returning the media to centre after a pull that did not travel far enough. */\nexport const PULL_SETTLE_SPRING = {\n type: 'spring',\n stiffness: 400,\n damping: 40,\n mass: 1,\n restDelta: 0.01,\n} as const satisfies Transition\n\n/**\n * The paging track settling onto a slide, in slide units (1 = one slide plus\n * the gap). Just under critical damping: a released flick hands the spring its\n * speed and glides in without bouncing off the neighbour's edge. `restSpeed`\n * is explicit because the default is tuned for pixels, and a slide unit is a\n * whole screen.\n */\nexport const PAGE_SPRING = {\n type: 'spring',\n stiffness: 420,\n damping: 40,\n mass: 1,\n restDelta: 0.0005,\n restSpeed: 0.01,\n} as const satisfies Transition\n\n/** Discrete zoom steps: buttons, `+`/`-`, double-tap. Critically damped — a photo that bounces at the end of a zoom looks broken. */\nexport const ZOOM_STEP_SPRING = {\n type: 'spring',\n stiffness: 700,\n damping: 52,\n mass: 1,\n restDelta: 0.0005,\n} as const satisfies Transition\n\n/** No thumbnail to grow from, or it has scrolled away: cross-fade instead. */\nexport const MEDIA_FADE = { duration: 0.22, ease: [0.32, 0.72, 0, 1] } as const satisfies Transition\n\n/**\n * Opacity stays on tweens.\n *\n * A spring's overshoot is invisible on a transform and obvious on an opacity —\n * it clips at 1 and the fade appears to stall. These also stage the exit:\n * chrome leaves first, the photo flies home, the backdrop lifts last, so the\n * close reads as a sequence instead of everything blinking out at once.\n */\nexport const BACKDROP_IN = {\n duration: 0.18,\n ease: [0.25, 0.46, 0.45, 0.94],\n} as const satisfies Transition\n\nexport const BACKDROP_OUT = {\n delay: 0.14,\n duration: 0.12,\n ease: 'linear',\n} as const satisfies Transition\n\nexport const CHROME_IN = {\n delay: 0.06,\n duration: 0.16,\n ease: 'easeOut',\n} as const satisfies Transition\n\nexport const CHROME_OUT = { duration: 0.12, ease: 'easeIn' } as const satisfies Transition\n\n/** How far the dock and the floating controls drop as they leave. */\nexport const CHROME_EXIT_OFFSET = 8\n","import type { Transition } from 'motion/react'\nimport { MEDIA_SPRING } from './motion'\n\n/**\n * 开合形变的时序档位。\n *\n * 只给具名档位、不收任意 easing 字符串:未经验证的曲线在 iOS Safari 上会被\n * 整段跳过或抖动,而一个 lightbox 的开合是它最显眼的一次动画。\n */\nexport type LightboxTiming = 'default' | 'snappy' | 'relaxed' | 'spring'\n\nexport interface LightboxTimingSpec {\n /** 驱动 FLIP 形变与下拉回弹。 */\n mediaSpring: Transition & { stiffness: number; damping: number }\n /** 驱动 View Transitions 伪元素,经 CSS 变量下发。 */\n vtDurationMs: number\n vtEasing: string\n}\n\nconst EMPHASIZED = 'var(--a63-motion-ease-emphasized, cubic-bezier(0.32, 0.72, 0, 1))'\n\nexport const LIGHTBOX_TIMING: Record<LightboxTiming, LightboxTimingSpec> = {\n default: { mediaSpring: MEDIA_SPRING, vtDurationMs: 360, vtEasing: EMPHASIZED },\n snappy: {\n mediaSpring: { ...MEDIA_SPRING, damping: 40, stiffness: 640 },\n vtDurationMs: 340,\n vtEasing: EMPHASIZED,\n },\n relaxed: {\n mediaSpring: { ...MEDIA_SPRING, damping: 46, stiffness: 420 },\n vtDurationMs: 400,\n vtEasing: EMPHASIZED,\n },\n spring: {\n mediaSpring: { ...MEDIA_SPRING, damping: 34, stiffness: 380 },\n vtDurationMs: 450,\n vtEasing: EMPHASIZED,\n },\n}\n\nconst DURATION_VAR = '--a63-lightbox-vt-duration'\nconst EASING_VAR = '--a63-lightbox-vt-easing'\n\n/**\n * `::view-transition-*` 伪元素只解析 `:root` 上的自定义属性,所以时序不能写在\n * lightbox 自己的元素上——必须落到 documentElement,用完再收走。\n */\nexport function applyTimingVars(element: HTMLElement, timing: LightboxTiming): void {\n const spec = LIGHTBOX_TIMING[timing]\n element.style.setProperty(DURATION_VAR, `${spec.vtDurationMs}ms`)\n element.style.setProperty(EASING_VAR, spec.vtEasing)\n}\n\nexport function clearTimingVars(element: HTMLElement): void {\n element.style.removeProperty(DURATION_VAR)\n element.style.removeProperty(EASING_VAR)\n}\n","import { flushSync } from 'react-dom'\nimport { revealReturnTarget } from './reveal-origin'\nimport type { LightboxTiming } from './timing'\nimport { applyTimingVars, clearTimingVars } from './timing'\n\n/** The name both the thumbnail and the enlarged media answer to during a morph. */\nexport const MEDIA_VIEW_TRANSITION_NAME = 'a63-media-lightbox-media'\n\n/** Scopes the lightbox's `::view-transition-*` rules to its own transitions. */\nconst TRANSITION_CLASS = 'a63-media-lightbox-vt'\n\nconst DIRECTION_CLASS = {\n in: 'a63-media-lightbox-vt-in',\n out: 'a63-media-lightbox-vt-out',\n} as const\n\n/**\n * Marks the one element allowed to keep a `view-transition-name` while the\n * lightbox owns the transition. See `media-lightbox.css` § name isolation.\n */\nexport const MORPH_TARGET_ATTRIBUTE = 'data-a63-morph-target'\n\n/**\n * A view transition cannot be interrupted, and starting a second one while the\n * first is in flight loses updates and strands the morph name. One at a time.\n */\nlet inFlight = false\n\nconst settleWaiters: Array<() => void> = []\n\nfunction notifySettled(): void {\n const waiters = settleWaiters.splice(0, settleWaiters.length)\n for (const waiter of waiters) {\n waiter()\n }\n}\n\n/** Resolves when the in-flight lightbox morph has released the document. */\nexport function whenMediaViewTransitionSettles(): Promise<void> {\n if (\n !inFlight &&\n (typeof document === 'undefined' ||\n !document.documentElement.classList.contains(TRANSITION_CLASS))\n ) {\n return Promise.resolve()\n }\n return new Promise(resolve => {\n settleWaiters.push(resolve)\n })\n}\n\n/**\n * Thumbnails this module marked imperatively.\n *\n * Only these are cleaned up. The lightbox's own media carries the same\n * attribute, but React owns it — stripping it from the DOM behind React's back\n * would leave it off on the next render and break the closing morph.\n */\nconst claimedOrigins = new Set<HTMLElement>()\n\nexport function supportsViewTransitions(): boolean {\n return typeof document !== 'undefined' && typeof document.startViewTransition === 'function'\n}\n\n/**\n * View Transitions snapshot the whole document. On a homepage that is already\n * a lot of compositor work, so constrained devices skip the morph and use the\n * measured FLIP (or a fade with no origin) instead.\n */\nexport function preferCheapMediaTransition(): boolean {\n if (typeof window === 'undefined') {\n return false\n }\n\n if (\n typeof window.matchMedia === 'function' &&\n (window.matchMedia('(prefers-reduced-motion: reduce)').matches ||\n window.matchMedia('(prefers-reduced-data: reduce)').matches)\n ) {\n return true\n }\n\n const nav = navigator as Navigator & {\n connection?: { saveData?: boolean; effectiveType?: string }\n deviceMemory?: number\n }\n if (nav.connection?.saveData) {\n return true\n }\n const effectiveType = nav.connection?.effectiveType\n if (effectiveType === 'slow-2g' || effectiveType === '2g') {\n return true\n }\n // Fingerprint-rounded; 4 and under is a phone-class GPU for this morph.\n if (typeof nav.deviceMemory === 'number' && nav.deviceMemory <= 4) {\n return true\n }\n\n return false\n}\n\ninterface MediaViewTransitionOptions {\n /** The thumbnail the morph starts from (opening) or returns to (closing). */\n origin: HTMLElement | null | undefined\n direction: 'in' | 'out'\n /** The state change that mounts or unmounts the lightbox. */\n update: () => void\n /** Timing preset for the view-transition duration and easing. */\n timing?: LightboxTiming\n}\n\n/**\n * Morphs between the thumbnail and the enlarged media with the View Transitions\n * API, and reports whether it ran.\n *\n * Only one element may carry a given `view-transition-name` in a captured state,\n * so ownership is handed over inside the update callback: opening, the thumbnail\n * holds the name for the old snapshot and gives it up before the new one;\n * closing, it takes the name back as the lightbox unmounts.\n *\n * Unlike a shared layout or a measured FLIP, this morphs the thumbnail's\n * *composition* — a cropped tile grows into the full frame — because the browser\n * animates snapshots of the whole document rather than one element's box.\n */\nexport function runMediaViewTransition({\n origin,\n direction,\n update,\n timing = 'default',\n}: MediaViewTransitionOptions): boolean {\n if (!supportsViewTransitions() || inFlight) {\n // The caller applies the change without a morph rather than dropping it.\n return false\n }\n\n const root = document.documentElement\n // Closing, the tile comes back into its row before the old snapshot is\n // taken; the lightbox covers the page, so the scroll is never seen. A tile\n // still cut off by its row gets no name, and the photo fades out instead of\n // morphing into a box nobody can see.\n const target = direction === 'out' ? revealReturnTarget(origin) : origin\n const claim = () => {\n if (target) {\n target.style.viewTransitionName = MEDIA_VIEW_TRANSITION_NAME\n target.setAttribute(MORPH_TARGET_ATTRIBUTE, '')\n claimedOrigins.add(target)\n }\n }\n\n /**\n * Clears every thumbnail this module marked, not just this origin: a rapid\n * open/close can interleave two claims, and a stranded name would keep\n * painting over the page long after the lightbox is gone.\n */\n const release = () => {\n for (const marked of claimedOrigins) {\n marked.style.viewTransitionName = ''\n marked.removeAttribute(MORPH_TARGET_ATTRIBUTE)\n }\n claimedOrigins.clear()\n }\n\n inFlight = true\n const directionClass = DIRECTION_CLASS[direction]\n root.classList.add(TRANSITION_CLASS, directionClass)\n applyTimingVars(root, timing)\n if (direction === 'in') {\n claim()\n }\n\n const transition = document.startViewTransition(() => {\n if (direction === 'in') {\n release()\n flushSync(update)\n return\n }\n flushSync(update)\n claim()\n })\n\n const cleanup = () => {\n inFlight = false\n root.classList.remove(TRANSITION_CLASS, directionClass)\n clearTimingVars(root)\n release()\n notifySettled()\n }\n void transition.finished.then(cleanup, cleanup)\n\n return true\n}\n","'use client'\n\nimport { createContext, createElement, useContext, useState, type ReactNode } from 'react'\n\n/**\n * Internal wiring between a thumbnail strip and each `Slide`: presence only,\n * not the strip's data. `Slide` reads whether a strip is registered to choose\n * between `role=\"tabpanel\"` (labelled by that thumbnail) and a standalone\n * `role=\"group\"` — exactly the branch `media-lightbox.tsx` took on its own\n * `showThumbnails` flag. Task 9's `Lightbox.Thumbnails` is the registrant.\n *\n * Do not re-export this module from the public parts barrel.\n */\nconst LightboxThumbnailsPresenceContext = createContext(false)\nconst LightboxThumbnailsRegistryContext = createContext<((present: boolean) => void) | null>(null)\n\nexport function LightboxThumbnailsRegistryProvider({ children }: { children: ReactNode }) {\n const [present, setPresent] = useState(false)\n return createElement(\n LightboxThumbnailsRegistryContext.Provider,\n { value: setPresent },\n createElement(LightboxThumbnailsPresenceContext.Provider, { value: present }, children)\n )\n}\n\n/** Read by `Slide` to pick its `role` and label. `false` when no strip is registered. */\nexport function useLightboxThumbnailsPresence(): boolean {\n return useContext(LightboxThumbnailsPresenceContext)\n}\n\n/** Called by the thumbnail strip to declare itself present or absent. */\nexport function useLightboxThumbnailsRegistry(): (present: boolean) => void {\n const register = useContext(LightboxThumbnailsRegistryContext)\n if (register === null) {\n throw new Error('This lightbox part must be rendered inside Lightbox.Root.')\n }\n return register\n}\n","'use client'\n\nimport {\n createElement,\n createContext,\n useContext,\n type Dispatch,\n type ReactNode,\n type SetStateAction,\n} from 'react'\n\n/**\n * Internal wiring between Root and Content for zoom state registration.\n * Do not re-export this module from the public parts barrel.\n */\nexport interface LightboxZoomApi {\n isZoomed: boolean\n zoomIn: () => void\n zoomOut: () => void\n}\n\nexport const IDLE_ZOOM_API: LightboxZoomApi = {\n isZoomed: false,\n zoomIn: () => {},\n zoomOut: () => {},\n}\n\nconst LightboxZoomRegistryContext = createContext<Dispatch<SetStateAction<LightboxZoomApi>> | null>(\n null\n)\n\nexport function LightboxZoomRegistryProvider({\n children,\n value,\n}: {\n children: ReactNode\n value: Dispatch<SetStateAction<LightboxZoomApi>>\n}) {\n return createElement(LightboxZoomRegistryContext.Provider, { value }, children)\n}\n\nexport function useLightboxZoomRegistry(): Dispatch<SetStateAction<LightboxZoomApi>> {\n const registerZoom = useContext(LightboxZoomRegistryContext)\n if (registerZoom === null) {\n throw new Error('This lightbox part must be rendered inside Lightbox.Root.')\n }\n return registerZoom\n}\n","'use client'\n\nimport { Children, useCallback, useEffect, useMemo, useRef, useState, type ReactNode } from 'react'\nimport { createPortal } from 'react-dom'\nimport { AnimatePresence } from 'motion/react'\nimport { usePortalContainer } from '../../../components/portal-container'\nimport { useReducedMotion } from '../../hooks/use-reduced-motion'\nimport { resolveLabels } from '../labels'\nimport type { LightboxTiming } from '../timing'\nimport type {\n MediaLightboxAppearance,\n MediaLightboxItem,\n MediaLightboxLabels,\n MediaLightboxTransition,\n} from '../types'\nimport { whenMediaViewTransitionSettles } from '../view-transition'\nimport { LightboxConfigContext, LightboxStateContext, useLightboxConfig } from './context'\nimport { LightboxRefsContext } from './refs'\nimport { LightboxThumbnailsRegistryProvider } from './thumbnails-registry'\nimport { IDLE_ZOOM_API, LightboxZoomRegistryProvider } from './zoom-registry'\n\nexport interface LightboxRootProps {\n items: readonly MediaLightboxItem[]\n index: number\n open: boolean\n onIndexChange: (index: number) => void\n onOpenChange: (open: boolean) => void\n onAppearanceChange?: (id: string, appearance: MediaLightboxAppearance) => void\n appearance?: Record<string, MediaLightboxAppearance>\n labels?: Partial<MediaLightboxLabels>\n origin?: HTMLElement | null\n preload?: number\n transition?: MediaLightboxTransition\n timing?: LightboxTiming\n children: ReactNode\n}\n\nexport interface LightboxPortalProps {\n children: ReactNode\n /** 关闭形变结束、overlay 已离开 DOM 后触发。 */\n onExitComplete?: () => void\n}\n\nexport function LightboxRoot({\n appearance,\n children,\n index,\n items,\n labels: labelOverrides,\n onAppearanceChange,\n onIndexChange,\n onOpenChange,\n open,\n origin,\n preload = 1,\n timing = 'default',\n transition = 'flip',\n}: LightboxRootProps) {\n const reducedMotion = useReducedMotion()\n const [zoomApi, setZoomApi] = useState(IDLE_ZOOM_API)\n\n const labels = useMemo(() => resolveLabels(labelOverrides), [labelOverrides])\n\n const rootRef = useRef<HTMLDivElement>(null)\n const backdropRef = useRef<HTMLDivElement>(null)\n const stageRef = useRef<HTMLDivElement>(null)\n const trackRef = useRef<HTMLDivElement>(null)\n const mediaRef = useRef<HTMLDivElement>(null)\n const zoomRef = useRef<HTMLDivElement>(null)\n\n const refs = useMemo(\n () => ({\n backdropRef,\n mediaRef,\n rootRef,\n stageRef,\n trackRef,\n zoomRef,\n }),\n []\n )\n\n const goTo = useCallback(\n (nextIndex: number) => {\n if (nextIndex < 0 || nextIndex >= items.length) {\n return\n }\n onIndexChange(nextIndex)\n },\n [items.length, onIndexChange]\n )\n\n const close = useCallback(() => {\n onOpenChange(false)\n }, [onOpenChange])\n\n const config = useMemo(\n () => ({\n appearance,\n items,\n labels,\n onAppearanceChange,\n open,\n origin,\n preload,\n reducedMotion,\n timing,\n transition,\n }),\n [\n appearance,\n items,\n labels,\n onAppearanceChange,\n open,\n origin,\n preload,\n reducedMotion,\n timing,\n transition,\n ]\n )\n\n const state = useMemo(\n () => ({\n close,\n goTo,\n index,\n isZoomed: zoomApi.isZoomed,\n itemCount: items.length,\n zoomIn: zoomApi.zoomIn,\n zoomOut: zoomApi.zoomOut,\n }),\n [close, goTo, index, items.length, zoomApi]\n )\n\n return (\n <LightboxThumbnailsRegistryProvider>\n <LightboxZoomRegistryProvider value={setZoomApi}>\n <LightboxConfigContext.Provider value={config}>\n <LightboxStateContext.Provider value={state}>\n <LightboxRefsContext.Provider value={refs}>{children}</LightboxRefsContext.Provider>\n </LightboxStateContext.Provider>\n </LightboxConfigContext.Provider>\n </LightboxZoomRegistryProvider>\n </LightboxThumbnailsRegistryProvider>\n )\n}\n\nexport function LightboxPortal({ children, onExitComplete }: LightboxPortalProps) {\n const { open, transition } = useLightboxConfig()\n const portalContainer = usePortalContainer()\n const viewTransition = transition === 'view-transition'\n const wasOpenRef = useRef(open)\n\n // The view-transition path has no `AnimatePresence` to report from — the\n // browser owns that exit, so its settle promise is what \"finished\" means.\n useEffect(() => {\n const wasOpen = wasOpenRef.current\n wasOpenRef.current = open\n if (!viewTransition || open || !wasOpen) {\n return\n }\n let cancelled = false\n void whenMediaViewTransitionSettles().then(() => {\n if (!cancelled) {\n onExitComplete?.()\n }\n })\n return () => {\n cancelled = true\n }\n }, [onExitComplete, open, viewTransition])\n\n if (typeof document === 'undefined') {\n return null\n }\n\n // `open` gates the *child*, not this component: `AnimatePresence` needs to\n // stay mounted across the transition from present to absent to run its exit\n // animation at all. A view transition captures the new state right after the\n // update that closes the lightbox, so that unmount has to be synchronous —\n // `AnimatePresence` holding children back for an exit animation would leave\n // the lightbox in the new snapshot and make the browser skip the transition\n // entirely. `toArray` keys the children by position: `AnimatePresence`\n // tracks each direct child by key, and the backdrop and content arrive\n // unkeyed as siblings.\n const content = open ? Children.toArray(children) : null\n\n return createPortal(\n viewTransition ? (\n content\n ) : (\n <AnimatePresence onExitComplete={onExitComplete}>{content}</AnimatePresence>\n ),\n portalContainer ?? document.body\n )\n}\n","/**\n * Reading and writing the slide track along the *inline* axis.\n *\n * `scrollLeft` is a physical-axis property, and in a right-to-left track its\n * origin moves to the right edge: the first slide sits at `0` and later slides\n * run negative. Index arithmetic written against the physical axis therefore\n * asks for a positive offset the browser clamps straight back to zero — the\n * caption says slide seven while the picture is still slide one, with no error\n * anywhere to notice.\n *\n * Everything here works in inline space, where the first slide is always at 0\n * and later slides are always positive, and converts at the boundary.\n */\n\nexport function isRtlTrack(track: HTMLElement): boolean {\n return getComputedStyle(track).direction === 'rtl'\n}\n\n/**\n * Which way the horizontal arrows move.\n *\n * Right means \"onward\" only in a left-to-right reading order; mirroring it is\n * the whole reason a right-to-left reader can use the gallery at all. The\n * vertical arrows never mirror — up is not a reading direction.\n */\nexport function arrowIndexDelta(key: string, rtl: boolean): number | undefined {\n if (key === 'ArrowRight') {\n return rtl ? -1 : 1\n }\n if (key === 'ArrowLeft') {\n return rtl ? 1 : -1\n }\n return undefined\n}\n","/**\n * A body scroll lock that can outlive the element which took it.\n *\n * The reason it has to is specific and not obvious. A trackpad keeps emitting\n * `wheel` events for up to a second after the fingers lift, so a swipe that\n * dismisses an overlay is still arriving when that overlay unmounts — and the\n * page underneath, now scrollable again, scrolls itself.\n *\n * Cancelling those events does not work. Both engines decide at gesture start\n * whether a wheel sequence is blocking, and then gate blocking dispatch on a\n * hit test against a *committed* region of non-passive wheel handlers\n * (Chromium's `InputHandlerProxy::HandleMouseWheel` /\n * `Layer::SetWheelEventRegion`; WebKit's `ScrollingTree::determineWheelEventProcessing`).\n * The moment the overlay unmounts, that region stops covering the pointer, and\n * momentum events are scrolled on the compositor without the main thread ever\n * being asked. A listener added at dismiss time only rejoins the region at the\n * next commit — several frames too late, which is why cancelling appears to\n * work and then intermittently does not.\n *\n * Holding the lock sidesteps all of it: with no viewport scroll container there\n * is nothing for the compositor to scroll, and `overflow` travels in the same\n * commit as the rest of the layout.\n */\n\n/** Silence that means the coast is over. */\nconst QUIET_MS = 600\n/** No trackpad coasts this long. A backstop, never the normal exit. */\nconst MAX_MS = 1500\n\nlet depth = 0\nlet previousOverflow: string | null = null\nlet quietTimer: ReturnType<typeof setTimeout> | null = null\nlet capTimer: ReturnType<typeof setTimeout> | null = null\nlet listening: ((event: WheelEvent) => void) | null = null\n\nfunction engage(): void {\n if (previousOverflow === null) {\n previousOverflow = document.body.style.overflow\n }\n document.body.style.overflow = 'hidden'\n}\n\nfunction releaseIfIdle(): void {\n if (depth > 0 || quietTimer !== null || previousOverflow === null) {\n return\n }\n document.body.style.overflow = previousOverflow\n previousOverflow = null\n}\n\n/** Locks the page while the caller holds it. Ref-counted; call the result once. */\nexport function lockBodyScroll(): () => void {\n if (typeof document === 'undefined') {\n return () => {}\n }\n depth += 1\n engage()\n\n let released = false\n return () => {\n if (released) {\n return\n }\n released = true\n depth = Math.max(depth - 1, 0)\n releaseIfIdle()\n }\n}\n\n/**\n * Keeps the page locked past the caller's own lock, until the wheel falls\n * silent.\n *\n * The listener is deliberately passive: the lock is what stops the scrolling,\n * so there is nothing here to cancel and no cancellability to depend on. It\n * only needs to hear that events are still arriving.\n */\nexport function holdBodyScrollThroughMomentum(): void {\n if (typeof window === 'undefined') {\n return\n }\n engage()\n\n const stop = () => {\n if (quietTimer) {\n clearTimeout(quietTimer)\n quietTimer = null\n }\n if (capTimer) {\n clearTimeout(capTimer)\n capTimer = null\n }\n if (listening) {\n window.removeEventListener('wheel', listening, { capture: true })\n listening = null\n }\n releaseIfIdle()\n }\n\n const extend = () => {\n if (quietTimer) {\n clearTimeout(quietTimer)\n }\n quietTimer = setTimeout(stop, QUIET_MS)\n }\n\n if (listening) {\n extend()\n return\n }\n\n listening = extend\n window.addEventListener('wheel', listening, { capture: true, passive: true })\n capTimer = setTimeout(stop, MAX_MS)\n extend()\n}\n","import { animate } from 'motion/react'\nimport { type RefObject, useCallback, useEffect, useRef, useState } from 'react'\nimport { ZOOM_STEP_SPRING } from './motion'\n\nconst MIN_SCALE = 1\n/** Used only when the media's natural size is unknown. */\nconst FALLBACK_MAX_SCALE = 4\n/** Button and keyboard steps multiply rather than add, like every photos app. */\nconst ZOOM_STEP = 2\n/** Content pixels an arrow key moves the media while zoomed. */\nconst KEYBOARD_PAN = 50\n/** What a double-tap jumps to, and what a second one comes back from. */\nconst DOUBLE_TAP_SCALE = 2.5\n/** Below this the media is treated as un-zoomed, so swiping and pulling resume. */\nconst ZOOM_EPSILON = 0.01\n\ninterface Transform {\n scale: number\n x: number\n y: number\n}\n\nconst IDENTITY: Transform = { scale: 1, x: 0, y: 0 }\n\nfunction baselineTransform(scale: number): Transform {\n return { scale, x: 0, y: 0 }\n}\n\ninterface MediaZoomOptions {\n enabled: boolean\n reducedMotion: boolean\n /** Resets the zoom whenever the gallery moves to another slide. */\n index: number\n zoomRef: RefObject<HTMLDivElement | null>\n trackRef: RefObject<HTMLDivElement | null>\n /** Fit to frame is 1; there is no point going below it. */\n minZoom?: number\n /** Omit to derive from naturalWidth, with 4 as a fallback. */\n maxZoom?: number\n /** Button and keyboard steps multiply rather than add, like every photos app. */\n zoomStep?: number\n doubleTapScale?: number\n keyboardPanDistance?: number\n wheelSensitivity?: number\n /** Plain wheel should not hijack page scroll unless a caller opts in. */\n scrollToZoom?: boolean\n onZoomChange?: (zoom: number) => void\n}\n\nexport interface MediaZoomResult {\n isZoomed: boolean\n /** Steps in from fit, anchored on the centre. */\n zoomIn: () => void\n /** Steps back toward fit, anchored on the centre. */\n zoomOut: () => void\n /** `+` / `-` / `0` and, while zoomed, the arrow keys. Reports what it used. */\n handleKey: (key: string) => boolean\n}\n\nfunction clamp(value: number, min: number, max: number): number {\n return Math.min(Math.max(value, min), max)\n}\n\n/**\n * Pinch on a trackpad or touch screen, double-tap, or ctrl + scroll to zoom at\n * the pointer; drag to pan.\n *\n * Zooming is exclusive with the gallery's own gestures: while the media is\n * larger than its frame, a drag pans it instead of turning the page, so the\n * track's horizontal scrolling and the pull-to-dismiss gesture stand down until\n * it is back to fit.\n */\nexport function useMediaZoom({\n enabled,\n reducedMotion,\n index,\n zoomRef,\n trackRef,\n minZoom,\n maxZoom,\n zoomStep,\n doubleTapScale,\n keyboardPanDistance,\n wheelSensitivity,\n scrollToZoom = false,\n onZoomChange,\n}: MediaZoomOptions): MediaZoomResult {\n const [isZoomed, setIsZoomed] = useState(false)\n const transformRef = useRef<Transform>(IDENTITY)\n const applyRef = useRef<(next: Transform, animated?: boolean) => void>(() => {})\n const keyRef = useRef<(key: string) => boolean>(() => false)\n const zoomInRef = useRef<() => void>(() => {})\n const zoomOutRef = useRef<() => void>(() => {})\n const zoomChangeRef = useRef(onZoomChange)\n zoomChangeRef.current = onZoomChange\n\n const handleKey = useCallback((key: string) => keyRef.current(key), [])\n const zoomIn = useCallback(() => {\n zoomInRef.current()\n }, [])\n const zoomOut = useCallback(() => {\n zoomOutRef.current()\n }, [])\n\n // `index` is a dependency because the zoom layer belongs to the active slide:\n // without it this effect keeps a closure over the element the gallery has\n // already scrolled past, and the zoom lands on media nobody is looking at.\n useEffect(() => {\n const zoom = zoomRef.current\n const track = trackRef.current\n if (!enabled || !zoom || !track) {\n return\n }\n\n const resolvedMinZoom = minZoom ?? MIN_SCALE\n const resolvedZoomStep = zoomStep ?? ZOOM_STEP\n const resolvedDoubleTapScale = doubleTapScale ?? DOUBLE_TAP_SCALE\n const resolvedKeyboardPanDistance = keyboardPanDistance ?? KEYBOARD_PAN\n const resolvedWheelSensitivity = wheelSensitivity ?? 100\n const baseline = baselineTransform(resolvedMinZoom)\n const previousTransform = transformRef.current\n\n // A zoom belongs to the image it was made on.\n transformRef.current = baseline\n\n let frameW = 0\n let frameH = 0\n let naturalW = 0\n /** Untransformed centre in the viewport; pan is added on top. */\n let originX = 0\n let originY = 0\n let zoomed = previousTransform.scale > resolvedMinZoom + ZOOM_EPSILON\n let gestureRaf = 0\n let wheelMul = 1\n let wheelX = 0\n let wheelY = 0\n let pinchPending: { scale: number; x: number; y: number } | null = null\n let stepAnimation: { stop: () => void } | null = null\n /**\n * What is currently on screen, which during a step is behind what the\n * transform *is*. Interrupting a step picks up from here so the media does\n * not jump to the last target before starting for the new one.\n */\n let drawn: Transform = previousTransform\n\n const draw = (next: Transform) => {\n if (drawn.scale !== next.scale) {\n zoomChangeRef.current?.(next.scale)\n }\n const ceiling = maxScale()\n const progress =\n ceiling > resolvedMinZoom ? (next.scale - resolvedMinZoom) / (ceiling - resolvedMinZoom) : 0\n drawn = next\n zoom.style.transform = `translate3d(${next.x}px, ${next.y}px, 0) scale(${next.scale})`\n zoom.style.setProperty('--a63-lightbox-zoom-progress', progress.toFixed(3))\n }\n\n const cacheOrigin = () => {\n const rect = zoom.getBoundingClientRect()\n const current = transformRef.current\n originX = rect.left + rect.width / 2 - current.x\n originY = rect.top + rect.height / 2 - current.y\n }\n\n const measure = () => {\n frameW = zoom.offsetWidth\n frameH = zoom.offsetHeight\n // The full photo, not the small stand-in beside it: the zoom ceiling is\n // the pixels that actually exist, and the stand-in has almost none.\n const img = zoom.querySelector<HTMLImageElement>('[data-slot=\"media-lightbox-image\"]')\n if (img && img.naturalWidth > 0) {\n naturalW = img.naturalWidth\n }\n cacheOrigin()\n }\n measure()\n\n /**\n * Past the media's own resolution a zoom only magnifies compression, so the\n * ceiling is the pixels that actually exist.\n */\n const maxScale = () => {\n if (typeof maxZoom === 'number') {\n return maxZoom\n }\n if (naturalW > 0 && frameW > 0) {\n return Math.max(naturalW / frameW, resolvedMinZoom + 0.5)\n }\n return FALLBACK_MAX_SCALE\n }\n\n /** Keeps the media from being dragged clean off its own frame. */\n const limit = (next: Transform): Transform => {\n const overflowX = (frameW * (next.scale - 1)) / 2\n const overflowY = (frameH * (next.scale - 1)) / 2\n return {\n scale: next.scale,\n x: clamp(next.x, -overflowX, overflowX),\n y: clamp(next.y, -overflowY, overflowY),\n }\n }\n\n const paint = (next: Transform) => {\n transformRef.current = next\n draw(next)\n }\n\n const syncChrome = (zoomedNow: boolean) => {\n if (zoomedNow === zoomed) {\n return\n }\n zoomed = zoomedNow\n setIsZoomed(zoomedNow)\n zoom.style.cursor = zoomedNow ? 'grab' : ''\n zoom.style.willChange = zoomedNow ? 'transform' : ''\n track.style.overflowX = zoomedNow ? 'hidden' : ''\n track.style.touchAction = zoomedNow ? 'none' : ''\n }\n\n const apply = (next: Transform, animated = false) => {\n const bounded = limit({ ...next, scale: clamp(next.scale, resolvedMinZoom, maxScale()) })\n syncChrome(bounded.scale > resolvedMinZoom + ZOOM_EPSILON)\n // A live pinch or wheel is already frame-by-frame; only a discrete step\n // has anywhere to travel. Either way the previous step gives up its claim\n // on the transform, so a second press re-aims from where it currently is\n // rather than fighting for the same property.\n stepAnimation?.stop()\n stepAnimation = null\n if (!animated || reducedMotion) {\n paint(bounded)\n return\n }\n // The target becomes the transform immediately; the spring only catches\n // the pixels up. Anything that reads the zoom — the next step, the pan\n // limits, whether the gallery may swipe again — then reads where the\n // media is going rather than an intermediate frame it is passing through.\n const from = drawn\n transformRef.current = bounded\n stepAnimation = animate(0, 1, {\n ...ZOOM_STEP_SPRING,\n onComplete: () => {\n stepAnimation = null\n draw(bounded)\n },\n onUpdate: progress => {\n draw({\n scale: from.scale + (bounded.scale - from.scale) * progress,\n x: from.x + (bounded.x - from.x) * progress,\n y: from.y + (bounded.y - from.y) * progress,\n })\n },\n })\n }\n applyRef.current = apply\n apply(baseline)\n\n const visualCentre = () => {\n const current = transformRef.current\n return { x: originX + current.x, y: originY + current.y }\n }\n\n /** Scales around a screen point, keeping whatever is under it in place. */\n const scaleAt = (nextScale: number, clientX: number, clientY: number, animated = false) => {\n const current = transformRef.current\n const target = clamp(nextScale, resolvedMinZoom, maxScale())\n if (target === current.scale) {\n return\n }\n const centre = visualCentre()\n const unitX = (clientX - centre.x) / current.scale\n const unitY = (clientY - centre.y) / current.scale\n apply(\n {\n scale: target,\n x: current.x + unitX * (current.scale - target),\n y: current.y + unitY * (current.scale - target),\n },\n animated\n )\n }\n\n const flushGesture = () => {\n gestureRaf = 0\n if (pinchPending) {\n const pending = pinchPending\n pinchPending = null\n wheelMul = 1\n scaleAt(pending.scale, pending.x, pending.y)\n return\n }\n if (wheelMul === 1) {\n return\n }\n const mul = wheelMul\n wheelMul = 1\n scaleAt(transformRef.current.scale * mul, wheelX, wheelY)\n }\n\n const scheduleGesture = () => {\n if (!gestureRaf) {\n gestureRaf = requestAnimationFrame(flushGesture)\n }\n }\n\n zoomInRef.current = () => {\n const current = transformRef.current\n const c = visualCentre()\n scaleAt(current.scale * resolvedZoomStep, c.x, c.y, true)\n }\n zoomOutRef.current = () => {\n const current = transformRef.current\n if (current.scale <= resolvedMinZoom + ZOOM_EPSILON) {\n return\n }\n const c = visualCentre()\n scaleAt(current.scale / resolvedZoomStep, c.x, c.y, true)\n }\n\n const handleWheel = (event: WheelEvent) => {\n // A trackpad pinch arrives as ctrl + wheel; a plain wheel is not ours\n // unless the caller explicitly opts into scroll-to-zoom.\n if (!event.ctrlKey && !scrollToZoom) {\n return\n }\n event.preventDefault()\n pinchPending = null\n wheelMul *= Math.exp(-event.deltaY / resolvedWheelSensitivity)\n wheelX = event.clientX\n wheelY = event.clientY\n scheduleGesture()\n }\n\n const handleDoubleClick = (event: MouseEvent) => {\n event.preventDefault()\n if (transformRef.current.scale > resolvedMinZoom + ZOOM_EPSILON) {\n apply(baseline, true)\n return\n }\n const current = transformRef.current\n const centre = visualCentre()\n const unitX = (event.clientX - centre.x) / current.scale\n const unitY = (event.clientY - centre.y) / current.scale\n apply(\n {\n scale: resolvedDoubleTapScale,\n x: current.x + unitX * (current.scale - resolvedDoubleTapScale),\n y: current.y + unitY * (current.scale - resolvedDoubleTapScale),\n },\n true\n )\n }\n\n const points = new Map<number, { x: number; y: number }>()\n let pinchDistance = 0\n let pinchScale = 1\n let panning = false\n let panX = 0\n let panY = 0\n\n const centreOf = () => {\n const all = [...points.values()]\n const sum = all.reduce((acc, p) => ({ x: acc.x + p.x, y: acc.y + p.y }), { x: 0, y: 0 })\n return { x: sum.x / all.length, y: sum.y / all.length }\n }\n\n const spread = () => {\n const [a, b] = [...points.values()]\n if (!a || !b) {\n return 0\n }\n return Math.hypot(a.x - b.x, a.y - b.y)\n }\n\n const handlePointerDown = (event: PointerEvent) => {\n const zoomedNow = transformRef.current.scale > resolvedMinZoom + ZOOM_EPSILON\n // A mouse only ever pans, and only once there is something to pan. Below\n // that the track's own drag owns the pointer.\n if (event.pointerType === 'mouse' && !zoomedNow) {\n return\n }\n if ((event.target as HTMLElement | null)?.closest('[data-a63-no-drag]')) {\n return\n }\n points.set(event.pointerId, { x: event.clientX, y: event.clientY })\n if (points.size === 2) {\n pinchDistance = spread()\n pinchScale = transformRef.current.scale\n panning = false\n return\n }\n if (points.size === 1 && zoomedNow) {\n panning = true\n panX = event.clientX\n panY = event.clientY\n }\n }\n\n const handlePointerMove = (event: PointerEvent) => {\n if (!points.has(event.pointerId)) {\n return\n }\n points.set(event.pointerId, { x: event.clientX, y: event.clientY })\n\n if (points.size >= 2) {\n const distance = spread()\n if (pinchDistance > 0 && distance > 0) {\n const centre = centreOf()\n pinchPending = {\n scale: (pinchScale * distance) / pinchDistance,\n x: centre.x,\n y: centre.y,\n }\n wheelMul = 1\n scheduleGesture()\n }\n return\n }\n if (!panning) {\n return\n }\n const current = transformRef.current\n apply({\n scale: current.scale,\n x: current.x + event.clientX - panX,\n y: current.y + event.clientY - panY,\n })\n panX = event.clientX\n panY = event.clientY\n }\n\n const endPointer = (event: PointerEvent) => {\n points.delete(event.pointerId)\n if (points.size < 2) {\n pinchDistance = 0\n }\n if (points.size === 0) {\n panning = false\n }\n }\n\n keyRef.current = (key: string) => {\n const current = transformRef.current\n const zoomedNow = current.scale > resolvedMinZoom + ZOOM_EPSILON\n const centre = visualCentre()\n\n // Unmodified keys only. `⌘+` / `Ctrl+` stay the browser's page zoom, which\n // WCAG 1.4.4 requires to keep working while a dialog is open.\n if (key === '+' || key === '=') {\n scaleAt(current.scale * resolvedZoomStep, centre.x, centre.y, true)\n return true\n }\n if (key === '-' || key === '_') {\n scaleAt(current.scale / resolvedZoomStep, centre.x, centre.y, true)\n return true\n }\n if (key === '0') {\n apply(baseline, true)\n return true\n }\n if (!zoomedNow) {\n return false\n }\n // While zoomed the arrows pan the media; the gallery keeps them at 1x.\n const pan: Record<string, [number, number]> = {\n ArrowDown: [0, -resolvedKeyboardPanDistance],\n ArrowLeft: [resolvedKeyboardPanDistance, 0],\n ArrowRight: [-resolvedKeyboardPanDistance, 0],\n ArrowUp: [0, resolvedKeyboardPanDistance],\n }\n const delta = pan[key]\n if (!delta) {\n return false\n }\n apply({ scale: current.scale, x: current.x + delta[0], y: current.y + delta[1] })\n return true\n }\n\n // A smaller viewport shrinks the media's own overflow, which would leave an\n // existing pan hanging outside its frame.\n const handleResize = () => {\n measure()\n apply(transformRef.current)\n }\n const handleImageLoad = () => {\n measure()\n apply(transformRef.current)\n }\n const img = zoom.querySelector<HTMLImageElement>('[data-slot=\"media-lightbox-image\"]')\n img?.addEventListener('load', handleImageLoad)\n window.addEventListener('resize', handleResize)\n\n track.addEventListener('wheel', handleWheel, { passive: false })\n track.addEventListener('dblclick', handleDoubleClick)\n track.addEventListener('pointerdown', handlePointerDown, { passive: true })\n window.addEventListener('pointermove', handlePointerMove, { passive: true })\n window.addEventListener('pointerup', endPointer, { passive: true })\n window.addEventListener('pointercancel', endPointer, { passive: true })\n\n return () => {\n applyRef.current = () => {}\n keyRef.current = () => false\n zoomInRef.current = () => {}\n zoomOutRef.current = () => {}\n if (gestureRaf) {\n cancelAnimationFrame(gestureRaf)\n }\n stepAnimation?.stop()\n stepAnimation = null\n window.removeEventListener('resize', handleResize)\n img?.removeEventListener('load', handleImageLoad)\n track.removeEventListener('wheel', handleWheel)\n track.removeEventListener('dblclick', handleDoubleClick)\n track.removeEventListener('pointerdown', handlePointerDown)\n window.removeEventListener('pointermove', handlePointerMove)\n window.removeEventListener('pointerup', endPointer)\n window.removeEventListener('pointercancel', endPointer)\n track.style.overflowX = ''\n track.style.touchAction = ''\n zoom.style.transform = ''\n zoom.style.cursor = ''\n zoom.style.transition = ''\n zoom.style.willChange = ''\n zoom.style.removeProperty('--a63-lightbox-zoom-progress')\n }\n }, [\n enabled,\n index,\n reducedMotion,\n minZoom,\n maxZoom,\n zoomStep,\n doubleTapScale,\n keyboardPanDistance,\n wheelSensitivity,\n scrollToZoom,\n trackRef,\n zoomRef,\n ])\n\n return { handleKey, isZoomed, zoomIn, zoomOut }\n}\n","/**\n * Trailing-window velocity for a one-dimensional gesture.\n *\n * Dividing total travel by total elapsed time answers the wrong question: a\n * slow drag that ends in a flick reports the slow average and refuses to throw,\n * and a fast nudge that then rests reports the fast average and throws when the\n * finger had already stopped. What decides a flick is how fast the pointer was\n * moving *as it left*, so only the last few samples count.\n */\n\n/** Long enough to survive a dropped frame, short enough to still mean \"now\". */\nconst DEFAULT_WINDOW_MS = 100\n/**\n * Below one frame there is no evidence, only noise: two samples a fraction of a\n * millisecond apart divide a real distance by almost nothing and report a speed\n * no hand produced. Coalesced events and synthetic ones both land here.\n */\nconst MIN_SPAN_MS = 8\n\ninterface Sample {\n time: number\n value: number\n}\n\nexport interface VelocityTracker {\n /** Starts a new gesture. */\n reset: (value: number, time: number) => void\n push: (value: number, time: number) => void\n /** Units per millisecond over the trailing window. */\n velocity: () => number\n}\n\nexport function createVelocityTracker(windowMs: number = DEFAULT_WINDOW_MS): VelocityTracker {\n let samples: Sample[] = []\n\n const push = (value: number, time: number) => {\n samples.push({ time, value })\n // Bounded, but generously: `velocity` picks its own span out of these, and\n // trimming to exactly the window would leave a single sample after a gap.\n const cutoff = time - windowMs * 2\n const keepFrom = samples.findIndex(sample => sample.time >= cutoff)\n if (keepFrom > 1) {\n samples = samples.slice(keepFrom - 1)\n }\n }\n\n return {\n push,\n reset: (value, time) => {\n samples = [{ time, value }]\n },\n velocity: () => {\n const last = samples.at(-1)\n if (!last) {\n return 0\n }\n // The oldest sample still inside the window, so a gesture that ended fast\n // reports fast even if it spent a second crawling first.\n const first =\n samples.find(sample => last.time - sample.time <= windowMs) ?? samples.at(-2) ?? last\n const span = first === last ? (samples.at(-2) ?? last) : first\n const elapsed = last.time - span.time\n if (elapsed < MIN_SPAN_MS) {\n return 0\n }\n return (last.value - span.value) / elapsed\n },\n }\n}\n","/**\n * Tells a trackpad's momentum tail apart from the part of a wheel gesture the\n * user is actually driving.\n *\n * macOS keeps emitting `wheel` events for up to about a second after the\n * fingers leave the trackpad, with deltas decaying smoothly toward zero. The\n * DOM exposes no phase for this, so a gesture that ends at the user's fingertips\n * looks, to a listener, exactly like one that is still going. Feeding that tail\n * into a pull-to-dismiss means the media keeps travelling after the hand has\n * stopped, and the decision about whether to dismiss waits for the coast to\n * finish — half a second after the user made up their mind.\n *\n * The tail has a shape the driven part does not: deltas that shrink, event after\n * event, arriving at frame rate. A real wheel gives evenly-sized notches spaced\n * far further apart, so it never trips this.\n */\n\n/** Consecutive strictly-shrinking deltas before the tail is called. */\nconst MIN_DECAYING_SAMPLES = 3\n/** Momentum arrives at frame rate; a wheel notch does not. */\nconst MAX_GAP_MS = 50\n/** How far below the gesture's peak a delta must fall to count as decaying. */\nconst PEAK_RATIO = 0.85\n\n/** A coast this quiet has ended. */\nconst MOMENTUM_QUIET_MS = 120\n/** No trackpad coasts longer than this; a backstop, never the normal exit. */\nconst MOMENTUM_MAX_MS = 1200\n\nexport interface WheelMomentum {\n /** Feed each wheel delta. True once this event belongs to the tail. */\n push: (delta: number, time: number) => boolean\n reset: () => void\n}\n\n/**\n * Swallows what is left of a trackpad's coast after the gesture has been acted\n * on.\n *\n * A belt, never the mechanism. Both engines decide at gesture start whether a\n * wheel sequence can be cancelled, and then gate blocking dispatch on a hit\n * test against a committed region of non-passive handlers — so a listener added\n * once the overlay has gone only rejoins that region at the next commit, and\n * the events in between are scrolled on the compositor without ever reaching\n * it. `holdBodyScrollThroughMomentum` is what actually stops the page moving;\n * this only helps in the frames where it happens to be consulted.\n */\nexport function swallowWheelMomentum(): void {\n if (typeof window === 'undefined') {\n return\n }\n\n let quiet: ReturnType<typeof setTimeout> | null = null\n\n const stop = () => {\n if (quiet) {\n clearTimeout(quiet)\n quiet = null\n }\n clearTimeout(cap)\n window.removeEventListener('wheel', onWheel, { capture: true })\n }\n\n const onWheel = (event: WheelEvent) => {\n // Guarded because a wheel sequence that began uncancellable stays that way,\n // and calling it anyway is a no-op the console complains about.\n if (event.cancelable) {\n event.preventDefault()\n }\n if (quiet) {\n clearTimeout(quiet)\n }\n quiet = setTimeout(stop, MOMENTUM_QUIET_MS)\n }\n\n const cap = setTimeout(stop, MOMENTUM_MAX_MS)\n window.addEventListener('wheel', onWheel, { capture: true, passive: false })\n quiet = setTimeout(stop, MOMENTUM_QUIET_MS)\n}\n\nexport function createWheelMomentum(): WheelMomentum {\n let peak = 0\n let previous = 0\n let previousTime = 0\n let decaying = 0\n let started = false\n\n const reset = () => {\n peak = 0\n previous = 0\n previousTime = 0\n decaying = 0\n started = false\n }\n\n return {\n push: (delta, time) => {\n const magnitude = Math.abs(delta)\n const gap = started ? time - previousTime : 0\n const rapid = started && gap >= 0 && gap <= MAX_GAP_MS\n\n // A pause breaks the tail: whatever follows is the user again.\n if (started && !rapid) {\n peak = magnitude\n decaying = 0\n } else if (magnitude < previous && magnitude < peak * PEAK_RATIO) {\n decaying += 1\n } else {\n decaying = 0\n }\n\n peak = Math.max(peak, magnitude)\n previous = magnitude\n previousTime = time\n started = true\n\n return decaying >= MIN_DECAYING_SAMPLES\n },\n reset,\n }\n}\n","import { animate } from 'motion/react'\nimport { type RefObject, useEffect } from 'react'\nimport { PULL_SETTLE_SPRING } from './motion'\nimport { holdBodyScrollThroughMomentum } from './scroll-lock'\nimport { createVelocityTracker } from './velocity'\nimport { createWheelMomentum, swallowWheelMomentum } from './wheel-momentum'\n\n/** How far the media must travel before letting go closes the lightbox. */\nconst DISMISS_DISTANCE_CAP = 120\n/** Proportion of the viewport a pull must cover on a short screen. */\nconst DISMISS_DISTANCE_RATIO = 0.14\n/** A flick closes below the distance threshold if it is fast enough. */\nconst DISMISS_VELOCITY = 0.6\n/** Wheel gestures have no pointerup, so they settle on a quiet period instead. */\nconst WHEEL_SETTLE_MS = 140\n/**\n * How long a stranded pull waits before it unwinds itself.\n *\n * Only reachable when a controlled consumer ignores the dismiss and leaves the\n * lightbox up. It has to outlast a real close: unwinding into one dragged the\n * stage out from under the closing morph, which is what made a dismissed photo\n * hitch on its way home.\n */\nconst DISMISSED_UNWIND_MS = 900\nconst MAX_SCALE_DROP = 0.2\nconst BACKDROP_FLOOR = 0.35\n\n/**\n * Fixed at 120px a pull had to cross a fifth of a phone screen and a tenth of a\n * laptop's, so the same gesture felt heavy on the device most likely to make it.\n */\nfunction dismissDistance(): number {\n if (typeof window === 'undefined') {\n return DISMISS_DISTANCE_CAP\n }\n return Math.min(DISMISS_DISTANCE_CAP, window.innerHeight * DISMISS_DISTANCE_RATIO)\n}\n\ninterface PullToDismissOptions {\n enabled: boolean\n reducedMotion: boolean\n onDismiss: () => void\n stageRef: RefObject<HTMLDivElement | null>\n backdropRef: RefObject<HTMLDivElement | null>\n trackRef: RefObject<HTMLDivElement | null>\n /** Receives `data-pulling` and the progress variable so chrome can stand down. */\n rootRef: RefObject<HTMLDivElement | null>\n}\n\n/**\n * Drag the media off in either direction — touch, pen, mouse, or a trackpad's\n * wheel — to close.\n *\n * Up and down both dismiss, and symmetrically: a photo that can be flung away\n * has no reason to care which way the hand went, and resisting one of them only\n * teaches the user that half their gestures are wrong.\n *\n * Written against the DOM rather than React state on purpose: this runs on every\n * pointer sample, and re-rendering a gallery per frame is how a direct\n * manipulation stops feeling direct.\n */\nexport function usePullToDismiss({\n enabled,\n reducedMotion,\n onDismiss,\n stageRef,\n backdropRef,\n trackRef,\n rootRef,\n}: PullToDismissOptions): void {\n useEffect(() => {\n const stage = stageRef.current\n const backdrop = backdropRef.current\n const track = trackRef.current\n const root = rootRef.current\n if (!enabled || !stage || !track) {\n return\n }\n\n let offset = 0\n let startX = 0\n let startY = 0\n let pointerId: number | null = null\n /** Re-read per gesture: the viewport can change between two of them. */\n let threshold = dismissDistance()\n const velocity = createVelocityTracker()\n /** null until the first move decides whether this is a pull or a swipe. */\n let claimed: boolean | null = null\n let wheelTimer: ReturnType<typeof setTimeout> | null = null\n /** The wheel gesture the events currently belong to, if any. */\n let wheelLastTime = 0\n let wheelOpen = false\n /**\n * Raised once a wheel gesture has had its say. The momentum that follows a\n * decision is the browser coasting, and must not start a second one.\n */\n let wheelSpent = false\n const wheelMomentum = createWheelMomentum()\n let suppressNextClick = false\n let suppressTimer: ReturnType<typeof setTimeout> | null = null\n let unwindTimer: ReturnType<typeof setTimeout> | null = null\n\n const paint = (value: number) => {\n // Promote only for the duration of the gesture. A permanent compositor\n // layer on a full-viewport element is memory nobody is using at rest.\n stage.style.willChange = 'transform'\n offset = value\n const progress = Math.min(Math.abs(value) / threshold, 1)\n if (root) {\n root.dataset.pulling = value === 0 ? 'false' : 'true'\n root.style.setProperty('--a63-media-lightbox-pull', String(progress))\n root.style.setProperty('--a63-lightbox-pull-progress', String(progress))\n }\n const fade = Math.min(Math.abs(value) / (threshold * 3), 1)\n const scale = reducedMotion ? 1 : 1 - fade * MAX_SCALE_DROP\n stage.style.transform = `translate3d(0, ${value}px, 0) scale(${scale})`\n if (backdrop) {\n backdrop.style.opacity = String(1 - fade * (1 - BACKDROP_FLOOR))\n }\n }\n\n const reset = () => {\n stage.style.transform = ''\n stage.style.transformOrigin = ''\n stage.style.willChange = ''\n if (backdrop) {\n backdrop.style.opacity = ''\n }\n if (root) {\n root.dataset.pulling = 'false'\n root.style.removeProperty('--a63-media-lightbox-pull')\n root.style.removeProperty('--a63-lightbox-pull-progress')\n }\n offset = 0\n }\n\n const settle = (velocityPxPerMs: number): boolean => {\n const shouldDismiss =\n Math.abs(offset) > threshold || Math.abs(velocityPxPerMs) > DISMISS_VELOCITY\n if (shouldDismiss) {\n // Deliberately keep the offset: the closing morph is captured from the\n // current state, so resetting first would snap the media back to centre\n // before it flies home. The stage then stays frozen for the whole close\n // — the morph measured against this transform, and moving it underneath\n // would drag the photo away from where the morph is aiming it.\n onDismiss()\n // Only for a consumer that ignores the request and leaves the lightbox\n // up: the media must not stay stranded off-centre. Long enough to be\n // sure a real close has finished, since unwinding into one is the hitch\n // this used to cause.\n unwindTimer = setTimeout(() => {\n unwindTimer = null\n if (stage.isConnected) {\n const from = offset\n if (reducedMotion) {\n paint(0)\n reset()\n return\n }\n void animate(from, 0, {\n ...PULL_SETTLE_SPRING,\n onComplete: reset,\n onUpdate: paint,\n velocity: velocityPxPerMs * 1000,\n })\n }\n }, DISMISSED_UNWIND_MS)\n return true\n }\n if (offset === 0) {\n return false\n }\n if (reducedMotion) {\n paint(0)\n reset()\n return false\n }\n const from = offset\n void animate(from, 0, {\n ...PULL_SETTLE_SPRING,\n onComplete: reset,\n onUpdate: paint,\n // Hand the spring the speed the finger let go at, so the rubber-band\n // continues the gesture instead of restarting from stationary.\n velocity: velocityPxPerMs * 1000,\n })\n return false\n }\n\n const handlePointerDown = (event: PointerEvent) => {\n if (event.button !== 0 || pointerId !== null) {\n return\n }\n // Video controls and anything else opted out keep their own gestures. The\n // backdrop hit area is deliberately not one of them — it covers the whole\n // slide, and excluding it would disable the gesture entirely.\n if (\n (event.target as HTMLElement | null)?.closest(\n '[data-a63-no-drag], video, a, button:not([tabindex=\"-1\"])'\n )\n ) {\n return\n }\n pointerId = event.pointerId\n claimed = null\n startX = event.clientX\n startY = event.clientY\n threshold = dismissDistance()\n velocity.reset(0, event.timeStamp)\n stage.style.transformOrigin = 'center'\n }\n\n const handlePointerMove = (event: PointerEvent) => {\n if (event.pointerId !== pointerId) {\n return\n }\n const dx = event.clientX - startX\n const dy = event.clientY - startY\n\n if (claimed === null) {\n if (Math.abs(dx) < 8 && Math.abs(dy) < 8) {\n return\n }\n // The horizontal swipe axis gets first refusal — a swipe is a swipe.\n claimed = Math.abs(dy) > Math.abs(dx)\n if (claimed) {\n track.style.userSelect = 'none'\n track.style.cursor = 'grabbing'\n }\n }\n if (!claimed) {\n return\n }\n\n if (event.cancelable) {\n event.preventDefault()\n }\n // Either direction dismisses. Everything downstream already reads the\n // distance rather than the sign.\n velocity.push(dy, event.timeStamp)\n paint(dy)\n }\n\n const endPointer = (event: PointerEvent) => {\n if (event.pointerId !== pointerId) {\n return\n }\n pointerId = null\n track.style.userSelect = ''\n track.style.cursor = ''\n if (claimed) {\n velocity.push(offset, event.timeStamp)\n suppressNextClick = true\n if (suppressTimer) {\n clearTimeout(suppressTimer)\n }\n suppressTimer = setTimeout(() => {\n suppressNextClick = false\n }, 0)\n settle(velocity.velocity())\n }\n claimed = null\n }\n\n const handleClickCapture = (event: MouseEvent) => {\n if (!suppressNextClick) {\n return\n }\n suppressNextClick = false\n event.stopPropagation()\n event.preventDefault()\n }\n\n const endWheelGesture = (velocityPxPerMs: number) => {\n if (wheelTimer) {\n clearTimeout(wheelTimer)\n wheelTimer = null\n }\n // The gesture keeps its slot until the events stop, so the coast that\n // follows cannot be read as a fresh swipe.\n wheelSpent = true\n if (settle(velocityPxPerMs)) {\n // The page underneath becomes scrollable the moment this lightbox\n // unmounts, and the trackpad is still coasting from the swipe that\n // closed it. Holding the lock is what stops that; swallowing the events\n // is only a belt, because after the unmount they are scrolled on the\n // compositor without the main thread being asked.\n holdBodyScrollThroughMomentum()\n swallowWheelMomentum()\n }\n }\n\n const handleWheel = (event: WheelEvent) => {\n // Sideways scrolling is the swipe axis's, not ours.\n if (Math.abs(event.deltaX) >= Math.abs(event.deltaY)) {\n return\n }\n // Guarded: whether a wheel sequence can be cancelled is latched at its\n // first event, so a later one may simply refuse.\n if (event.cancelable) {\n event.preventDefault()\n }\n\n // A quiet spell ends whatever came before, momentum included.\n const idle = !wheelOpen || event.timeStamp - wheelLastTime > WHEEL_SETTLE_MS\n wheelLastTime = event.timeStamp\n if (idle) {\n wheelOpen = true\n wheelSpent = false\n threshold = dismissDistance()\n velocity.reset(offset, event.timeStamp)\n wheelMomentum.reset()\n }\n\n const coasting = wheelMomentum.push(event.deltaY, event.timeStamp)\n if (wheelSpent) {\n return\n }\n if (coasting) {\n // The fingers are already off the trackpad. Letting the coast move the\n // media is what made the photo drift on after the hand had stopped, and\n // waiting for the coast to finish is what made the decision arrive half\n // a second late. Decide now, on the speed the gesture really ended at.\n endWheelGesture(velocity.velocity())\n return\n }\n\n stage.style.transformOrigin = 'center'\n const next = offset - event.deltaY\n velocity.push(next, event.timeStamp)\n paint(next)\n\n // Past the threshold the answer cannot change, so there is nothing to wait\n // for. Committing here is what keeps the close on the user's hand.\n if (Math.abs(next) > threshold) {\n endWheelGesture(velocity.velocity())\n return\n }\n\n if (wheelTimer) {\n clearTimeout(wheelTimer)\n }\n wheelTimer = setTimeout(() => {\n wheelTimer = null\n wheelOpen = false\n // Nothing decayed and nothing crossed: a device with no momentum at all,\n // whose gesture ended some milliseconds ago. Distance alone decides.\n settle(0)\n }, WHEEL_SETTLE_MS)\n }\n\n track.addEventListener('pointerdown', handlePointerDown, { passive: true })\n window.addEventListener('pointermove', handlePointerMove, { passive: false })\n window.addEventListener('pointerup', endPointer, { passive: true })\n window.addEventListener('pointercancel', endPointer, { passive: true })\n track.addEventListener('click', handleClickCapture, { capture: true })\n track.addEventListener('wheel', handleWheel, { passive: false })\n\n return () => {\n if (wheelTimer) {\n clearTimeout(wheelTimer)\n }\n if (suppressTimer) {\n clearTimeout(suppressTimer)\n }\n if (unwindTimer) {\n clearTimeout(unwindTimer)\n }\n track.removeEventListener('pointerdown', handlePointerDown)\n window.removeEventListener('pointermove', handlePointerMove)\n window.removeEventListener('pointerup', endPointer)\n window.removeEventListener('pointercancel', endPointer)\n track.removeEventListener('click', handleClickCapture, { capture: true })\n track.removeEventListener('wheel', handleWheel)\n reset()\n }\n }, [backdropRef, enabled, onDismiss, reducedMotion, rootRef, stageRef, trackRef])\n}\n","'use client'\n\nimport {\n createContext,\n createElement,\n useContext,\n type Dispatch,\n type ReactNode,\n type SetStateAction,\n} from 'react'\n\n/**\n * The tunable knobs for `useMediaZoom`, minus what the plumbing already\n * supplies (`enabled`, `index`, `reducedMotion`, `trackRef`, `zoomRef`).\n */\nexport interface LightboxZoomOptions {\n /** Fit to frame is 1; there is no point going below it. */\n minZoom?: number\n /** Omit to derive from naturalWidth, with 4 as a fallback. */\n maxZoom?: number\n /** Button and keyboard steps multiply rather than add, like every photos app. */\n zoomStep?: number\n doubleTapScale?: number\n keyboardPanDistance?: number\n wheelSensitivity?: number\n /** Plain wheel should not hijack page scroll unless a caller opts in. */\n scrollToZoom?: boolean\n onZoomChange?: (zoom: number) => void\n}\n\n/**\n * Internal wiring between `Content` and a descendant `Zoom` for the zoom\n * options channel.\n *\n * `Zoom` is a descendant of `Content` (inside `Slide`), so it cannot pass its\n * options as props to the single `useMediaZoom` call `Content` owns — it\n * registers them here instead. `Content` reads `null` to mean no `Zoom` has\n * registered, and passes no overrides to the hook, i.e. today's defaults.\n *\n * Do not re-export this module from the public parts barrel.\n */\nconst LightboxZoomOptionsRegistryContext = createContext<Dispatch<\n SetStateAction<LightboxZoomOptions | null>\n> | null>(null)\n\nexport function LightboxZoomOptionsRegistryProvider({\n children,\n value,\n}: {\n children: ReactNode\n value: Dispatch<SetStateAction<LightboxZoomOptions | null>>\n}) {\n return createElement(LightboxZoomOptionsRegistryContext.Provider, { value }, children)\n}\n\n/**\n * Called by `Zoom` to publish (or, on unmount/deactivation, clear) its\n * options. Omitting `Zoom` entirely is legal — nothing ever calls this, and\n * `Content` simply keeps reading `null`. What is not legal is calling it\n * without a `Content` ancestor to receive it, which throws.\n */\nexport function useLightboxZoomOptionsRegistry(): Dispatch<\n SetStateAction<LightboxZoomOptions | null>\n> {\n const register = useContext(LightboxZoomOptionsRegistryContext)\n if (register === null) {\n throw new Error('This lightbox part must be rendered inside Lightbox.Content.')\n }\n return register\n}\n","'use client'\n\nimport { mergeProps } from '@base-ui/react/merge-props'\nimport { useRender } from '@base-ui/react/use-render'\nimport { motion } from 'motion/react'\nimport { type CSSProperties, useEffect, useRef, useState } from 'react'\nimport type * as React from 'react'\nimport { cn } from '../../../lib/cn'\nimport { arrowIndexDelta, isRtlTrack } from '../direction'\nimport { BACKDROP_IN, BACKDROP_OUT } from '../motion'\nimport { lockBodyScroll } from '../scroll-lock'\nimport { useMediaZoom } from '../use-media-zoom'\nimport { usePullToDismiss } from '../use-pull-to-dismiss'\nimport { whenMediaViewTransitionSettles } from '../view-transition'\nimport { useLightboxConfig, useLightboxState } from './context'\nimport { useLightboxRefs } from './refs'\nimport { LightboxZoomOptionsRegistryProvider, type LightboxZoomOptions } from './zoom-options'\nimport { useLightboxZoomRegistry } from './zoom-registry'\n\nconst FOCUSABLE_SELECTOR =\n 'a[href], button:not([disabled]):not([tabindex=\"-1\"]), [tabindex]:not([tabindex=\"-1\"]), input, select, textarea'\n\nexport type LightboxContentProps = useRender.ComponentProps<'div'>\n\n/**\n * Hosts the modal dialog: focus trap and restore, body scroll lock, the\n * global keydown map, and the zoom/pull-to-dismiss gestures. Everything\n * cosmetic comes in via `className` from the caller; this only keeps the\n * mechanism styling that makes the overlay fill the viewport.\n */\nexport function LightboxContent({\n children,\n className,\n ref,\n render,\n ...props\n}: LightboxContentProps): React.ReactElement {\n const { rootRef, backdropRef, stageRef, trackRef, zoomRef } = useLightboxRefs()\n const { items, labels, reducedMotion, transition } = useLightboxConfig()\n const { close, goTo, index } = useLightboxState()\n const registerZoom = useLightboxZoomRegistry()\n\n const item = items[index]\n const position = labels.position(index, items.length)\n const viewTransition = transition === 'view-transition'\n\n const restoreFocusRef = useRef<HTMLElement | null>(null)\n\n // `Zoom` is a descendant of `Content` (inside `Slide`), so it cannot pass its\n // options as props to the single `useMediaZoom` call below — it publishes\n // them up through `LightboxZoomOptionsRegistryProvider` instead. `null`\n // means no `Zoom` has registered, so no overrides are passed and the hook\n // falls back to its own defaults.\n const [zoomOptions, setZoomOptions] = useState<LightboxZoomOptions | null>(null)\n\n const { handleKey, isZoomed, zoomIn, zoomOut } = useMediaZoom({\n enabled: true,\n index,\n reducedMotion,\n trackRef,\n zoomRef,\n ...zoomOptions,\n })\n\n // Registers the zoom state back into Root so parts outside Content (e.g. a\n // Zoom control) can read `isZoomed` / `zoomIn` / `zoomOut` from context.\n useEffect(() => {\n registerZoom({ isZoomed, zoomIn, zoomOut })\n }, [registerZoom, isZoomed, zoomIn, zoomOut])\n\n // A drag on zoomed media is a pan, not a dismissal.\n usePullToDismiss({\n backdropRef,\n enabled: !isZoomed,\n onDismiss: close,\n reducedMotion,\n rootRef,\n stageRef,\n trackRef,\n })\n\n // Focus moves into the lightbox on open and returns to the trigger on close.\n // Wait until the morph has released the thumbnail: restoring focus in the\n // same frame `scale`s it via `focus-within`, and the closing snapshot aims\n // at ~1.04×, then the tile's rounded clip shears off the extra.\n //\n // The dialog itself takes that focus, not its first control. Two reasons.\n // A screen reader entering here should hear the dialog's own name and role\n // before anything else, which is what lands it at the top rather than\n // part-way down on a button (the APG's dialog pattern). And a preset that\n // idles its chrome away — this repo's does — would otherwise leave a\n // genuinely focused control faded to invisible, since nothing ever blurs\n // that first button for someone who opens the lightbox and just looks.\n // `tabIndex={-1}` keeps the container reachable this way without adding a\n // tab stop; `FOCUSABLE_SELECTOR` excludes it for the same reason.\n useEffect(() => {\n restoreFocusRef.current = document.activeElement as HTMLElement | null\n rootRef.current?.focus({ preventScroll: true })\n\n return () => {\n const trigger = restoreFocusRef.current\n const restore = () => {\n trigger?.focus({ preventScroll: true })\n }\n if (document.documentElement.classList.contains('a63-media-lightbox-vt')) {\n void whenMediaViewTransitionSettles().then(restore)\n return\n }\n restore()\n }\n }, [rootRef])\n\n // Held past the overlay's own life when a trackpad dismisses it: the coast\n // that follows the swipe would otherwise scroll the page it uncovers.\n useEffect(() => lockBodyScroll(), [])\n\n useEffect(() => {\n const handleKeyDown = (event: KeyboardEvent) => {\n // Modified combos belong to the browser — notably page zoom, which WCAG\n // 1.4.4 requires to keep working while a dialog is open.\n if (!event.ctrlKey && !event.metaKey && !event.altKey && handleKey(event.key)) {\n event.preventDefault()\n return\n }\n if (event.key === 'Escape') {\n event.preventDefault()\n // One layer at a time. A viewer who has zoomed in and reaches for\n // Escape means \"give me the whole picture back\" far more often than\n // \"throw the gallery away\" — and closing outright costs them their\n // place in the gallery too, while `0` is the only other way back to\n // fit and nothing advertises it.\n if (isZoomed) {\n handleKey('0')\n return\n }\n close()\n return\n }\n if (!isZoomed) {\n // Mirrored in a right-to-left gallery: \"right\" only means \"onward\"\n // where the reading order says so.\n const delta = arrowIndexDelta(\n event.key,\n trackRef.current ? isRtlTrack(trackRef.current) : false\n )\n if (delta !== undefined) {\n event.preventDefault()\n goTo(index + delta)\n return\n }\n }\n if (event.key === 'Home' && !isZoomed) {\n event.preventDefault()\n goTo(0)\n return\n }\n if (event.key === 'End' && !isZoomed) {\n event.preventDefault()\n goTo(items.length - 1)\n return\n }\n if (event.key !== 'Tab') {\n return\n }\n\n const focusable = [\n ...(rootRef.current?.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR) ?? []),\n ]\n if (focusable.length === 0) {\n return\n }\n const first = focusable[0]\n const last = focusable.at(-1)\n if (!first || !last) {\n return\n }\n // The dialog itself holds focus right after opening, and it is not in\n // `focusable` — it is `tabIndex={-1}` precisely so it never becomes a\n // tab stop. Without this branch a backwards `Tab` from that state\n // falls through to the browser and walks straight out of the dialog,\n // because neither \"focus is on `first`\" nor \"focus is on `last`\" is\n // true yet. Forwards is handled for symmetry: the browser would reach\n // `first` on its own from here, but only because the container happens\n // to precede it in DOM order.\n if (document.activeElement === rootRef.current) {\n event.preventDefault()\n ;(event.shiftKey ? last : first).focus({ preventScroll: true })\n return\n }\n if (event.shiftKey && document.activeElement === first) {\n event.preventDefault()\n last.focus({ preventScroll: true })\n } else if (!event.shiftKey && document.activeElement === last) {\n event.preventDefault()\n first.focus({ preventScroll: true })\n }\n }\n\n document.addEventListener('keydown', handleKeyDown)\n return () => {\n document.removeEventListener('keydown', handleKeyDown)\n }\n }, [close, goTo, handleKey, index, isZoomed, items.length, rootRef, trackRef])\n\n const defaultProps = {\n 'aria-label': `${item.title} — ${position}`,\n 'aria-modal': 'true' as const,\n children: (\n <LightboxZoomOptionsRegistryProvider value={setZoomOptions}>\n {children}\n </LightboxZoomOptionsRegistryProvider>\n ),\n className: cn('fixed inset-0 z-50 flex flex-col', className),\n 'data-open': '',\n 'data-pulling': 'false',\n 'data-slot': 'media-lightbox',\n 'data-transition': viewTransition ? 'view-transition' : 'flip',\n 'data-zoomed': isZoomed ? 'true' : 'false',\n role: 'dialog',\n style: {\n '--a63-media-lightbox-media-h': '100%',\n } as CSSProperties,\n // Programmatically focusable on open, but never a tab stop of its own.\n tabIndex: -1,\n }\n\n return useRender({\n defaultTagName: 'div',\n props: mergeProps<'div'>(defaultProps, props),\n ref: [rootRef, ref ?? null],\n render,\n })\n}\n\nexport type LightboxBackdropProps = useRender.ComponentProps<'div'>\n\n/** The dimmed scrim behind the media. Pressing it closes the lightbox. */\nexport function LightboxBackdrop({\n className,\n ref,\n render,\n ...props\n}: LightboxBackdropProps): React.ReactElement {\n const { backdropRef } = useLightboxRefs()\n const { close } = useLightboxState()\n const { transition } = useLightboxConfig()\n const viewTransition = transition === 'view-transition'\n\n const defaultProps = {\n // Opaque, no backdrop-filter: the page behind can stop painting, which\n // a translucent blur would forbid. It portals next to `Content`, so it\n // needs `Content`'s fixed layer too: `absolute` left it under any\n // positioned page chrome with a z-index, such as a sticky header.\n className: cn('fixed inset-0 z-50 bg-[var(--a63-media-stage)]', className),\n 'data-slot': 'media-lightbox-backdrop',\n onClick: close,\n }\n\n return useRender({\n defaultTagName: 'div',\n props: mergeProps<'div'>(defaultProps, props),\n ref: [backdropRef, ref ?? null],\n render: render ?? (\n <motion.div\n // `startViewTransition` snapshots the whole document, so when the\n // browser owns the morph, a Motion-driven fade here would run on top\n // of the snapshot's own animation. Standing down avoids the double\n // animation.\n animate={viewTransition ? undefined : { opacity: 1 }}\n exit={viewTransition ? undefined : { opacity: 0, transition: BACKDROP_OUT }}\n initial={viewTransition ? undefined : { opacity: 0 }}\n transition={BACKDROP_IN}\n />\n ),\n })\n}\n\nexport type LightboxStatusProps = useRender.ComponentProps<'div'>\n\n/** Announces the active item to screen readers; swiping is a silent change without it. */\nexport function LightboxStatus({\n className,\n ref,\n render,\n ...props\n}: LightboxStatusProps): React.ReactElement {\n const { items, labels } = useLightboxConfig()\n const { index } = useLightboxState()\n const item = items[index]\n const position = labels.position(index, items.length)\n\n const defaultProps = {\n 'aria-atomic': true,\n 'aria-live': 'polite' as const,\n children: `${item.title}, ${position}`,\n className: cn('sr-only', className),\n 'data-slot': 'media-lightbox-status',\n }\n\n return useRender({\n defaultTagName: 'div',\n props: mergeProps<'div'>(defaultProps, props),\n ref: ref ?? null,\n render,\n })\n}\n","/**\n * The arithmetic of the paging track, kept apart from the DOM so every rule\n * can be tested on plain numbers.\n *\n * Positions are in slide units: `0` is the first slide at rest, `1` the second,\n * and `1.25` a quarter of the way from the second to the third. One unit is\n * one slide plus the gap after it, so a position maps to a transform without\n * knowing the viewport width, and a spring animating it stays correct across a\n * resize. Positions run in reading order: a higher position is always \"onward\",\n * in right-to-left galleries too; only the transform flips the sign.\n */\n\n/**\n * How far the pointer must travel before an axis is picked at all.\n *\n * Below this a press is still deciding whether it is a swipe, a pull, or a\n * shaky tap. Matches `usePullToDismiss`'s own dead zone, so the vertical and\n * horizontal gestures split the same circle between them.\n */\nexport const AXIS_LOCK_THRESHOLD = 8\n\n/**\n * Proportion of the viewport width a slow drag must cross to turn the page,\n * capped so a wide desktop window does not ask for an unreasonably long drag.\n */\nexport const SWIPE_DISTANCE_RATIO = 0.2\n/** The ratio's ceiling; see `SWIPE_DISTANCE_RATIO`. */\nexport const SWIPE_DISTANCE_CAP = 120\n/**\n * A release faster than this (px/ms) pages in the direction the pointer was\n * moving, however short the drag. Also decides a flick that reversed: the\n * direction of the last movement wins, not the direction of the whole drag.\n */\nexport const SWIPE_VELOCITY = 0.5\n\n/**\n * How hard the edges resist. UIKit's constant: the first pixels past the end\n * move almost 1:1 and the band stiffens smoothly, so the edge is felt rather\n * than hit.\n */\nconst RUBBER_BAND_COEFFICIENT = 0.55\n\nexport function swipeDistanceThreshold(viewportWidth: number): number {\n return Math.min(SWIPE_DISTANCE_CAP, (viewportWidth || SWIPE_DISTANCE_CAP) * SWIPE_DISTANCE_RATIO)\n}\n\n/** How far a pull of `overshoot` pixels past an edge actually moves, in pixels. */\nexport function rubberBand(overshoot: number, dimension: number): number {\n if (overshoot <= 0 || dimension <= 0) {\n return 0\n }\n return (1 - 1 / ((overshoot * RUBBER_BAND_COEFFICIENT) / dimension + 1)) * dimension\n}\n\n/**\n * Applies edge resistance to a raw position: inside `[0, lastIndex]` the\n * track follows the pointer exactly, and past either end it stretches.\n */\nexport function resistEdges(position: number, lastIndex: number, step: number): number {\n if (position < 0) {\n return -rubberBand(-position * step, step) / step\n }\n if (position > lastIndex) {\n return lastIndex + rubberBand((position - lastIndex) * step, step) / step\n }\n return position\n}\n\nexport interface ReleaseInput {\n /** Where the track is drawn as the pointer lets go. */\n position: number\n /** Where it was drawn when the gesture began (mid-settle if it was caught). */\n startPosition: number\n /** The index the gallery currently reports. */\n index: number\n lastIndex: number\n /** Trailing speed in px/ms, positive toward higher indices. */\n velocity: number\n /** Pixels in one slide unit. */\n step: number\n /** Pixels a slow drag must cover to page; see `swipeDistanceThreshold`. */\n distanceThreshold: number\n}\n\n/**\n * The slide a released gesture settles on.\n *\n * A fast release pages the way the pointer was last moving: `ceil` going\n * onward and `floor` going back. That rule also catches a flick that reversed\n * mid-way. A drag that went a third of a page onward and then flicked back\n * floors to where it started instead of paging on.\n *\n * A slow release pages once the drag has covered the distance threshold, and\n * otherwise returns to the nearest slide. The nearest slide is the one it\n * started on for an ordinary drag, and the one a caught settle was heading to\n * when a tap interrupted it past the halfway point.\n *\n * Never more than one slide from `index`, and never past either end.\n */\nexport function releaseTarget({\n distanceThreshold,\n index,\n lastIndex,\n position,\n startPosition,\n step,\n velocity,\n}: ReleaseInput): number {\n let target: number\n if (Math.abs(velocity) > SWIPE_VELOCITY) {\n target = velocity > 0 ? Math.ceil(position) : Math.floor(position)\n } else {\n const moved = (position - startPosition) * step\n if (Math.abs(moved) > distanceThreshold) {\n target = moved > 0 ? Math.ceil(position) : Math.floor(position)\n } else {\n target = Math.round(position)\n }\n }\n const nearest = Math.min(Math.max(target, index - 1), index + 1)\n return Math.min(Math.max(nearest, 0), Math.max(lastIndex, 0))\n}\n\n/**\n * The track's transform for a position.\n *\n * Written in CSS units rather than pixels so the resting position the first\n * render commits needs no measurement: the open morph measures the active\n * frame in the same commit, before any effect could have positioned the track.\n * `100%` is the strip's own width, which is the width of one slide.\n */\nexport function trackTransform(position: number): string {\n // Five decimals is a hundredth of a pixel on a 1000px slide, and it keeps\n // the resting string identical to the one a settle writes on its last frame.\n const offset = Number((-position).toFixed(5)) || 0\n return `translate3d(calc(${offset} * (100% + var(--a63-media-lightbox-gap, var(--a63-space-4))) * var(--a63-media-lightbox-track-sign, 1)), 0, 0)`\n}\n","'use client'\n\nimport { animate, motionValue, type AnimationPlaybackControls } from 'motion/react'\nimport { type RefObject, useEffect, useLayoutEffect, useRef, useState } from 'react'\nimport { isRtlTrack } from './direction'\nimport { PAGE_SPRING } from './motion'\nimport {\n AXIS_LOCK_THRESHOLD,\n releaseTarget,\n resistEdges,\n swipeDistanceThreshold,\n trackTransform,\n} from './track-physics'\nimport { createVelocityTracker } from './velocity'\n\n/** Elements that own their own drag and click behaviour and must not lose it to a page drag. */\nconst NO_DRAG_SELECTOR = '[data-a63-no-drag], video, a, button:not([tabindex=\"-1\"])'\n\n/**\n * Accumulated `deltaX` a two-finger swipe must cover before its coast is\n * looked for at all.\n *\n * A swipe starts with a few tiny, noisy deltas (1, 4, 1, 5 in the captures),\n * and reading that noise against its own peak would call the coast before the\n * swipe has begun. Past this the peak is real.\n */\nconst WHEEL_DRIVE_THRESHOLD = 60\n\n/**\n * How long the wheel must go quiet before the gesture is treated as over.\n *\n * For a device with no momentum at all this is what settles the track. Taken\n * from a real trackpad, the largest gap inside three seconds of continuous\n * swiping is 66ms, so silence this long only arrives once the hand has\n * stopped.\n */\nconst WHEEL_QUIET_MS = 160\n\n/**\n * How far `|deltaX|` must fall from a gesture's peak before the coast that\n * follows is considered to have begun.\n *\n * A drive is noisy enough to dip and climb again inside one swipe (one capture\n * went 42 → 24 → 66), while a real gesture boundary drops to between 2% and 39%\n * of the preceding peak because the fingers leave the surface. The worst\n * in-drive dip only reached 57%. Anything from 0.30 to 0.50 separates them in\n * the recorded traces; this sits in the middle.\n */\nconst WHEEL_DECAY_RATIO = 0.4\n\n/**\n * How far `|deltaX|` must climb back above a coast's floor to count as a new\n * gesture. Inside a real coast the largest rise above its running minimum is\n * 1px; a new swipe climbs tens of pixels within a few events.\n */\nconst WHEEL_RISE_MARGIN = 12\n\nexport type SlideSpan = readonly [number, number]\n\ninterface SlideTrackOptions {\n /** Off while zoomed: a drag there pans the photo, it does not turn the page. */\n enabled: boolean\n index: number\n itemCount: number\n goTo: (index: number) => void\n /**\n * How many neighbours either side are mounted anyway. A drag only asks for\n * its neighbours to be force-mounted when this does not already cover them.\n */\n mountRadius: number\n reducedMotion: boolean\n /** Receives `data-paging` while the track moves, so chrome can react in CSS. */\n rootRef: RefObject<HTMLElement | null>\n /** The element that moves: one `translate3d`, nothing else. */\n stripRef: RefObject<HTMLElement | null>\n /** The clipping frame around it, which also takes the pointer and wheel listeners. */\n trackRef: RefObject<HTMLElement | null>\n}\n\nexport interface SlideTrack {\n /**\n * Slides a settle is passing over or a drag can reveal, which must stay\n * mounted until the track comes to rest. `null` at rest.\n */\n span: SlideSpan | null\n}\n\nfunction measureStep(strip: HTMLElement): number {\n // Layout width, not the bounding box: a pull-to-dismiss scales the stage,\n // and a slide should be one slide wide whatever that scale is.\n const gap = Number.parseFloat(getComputedStyle(strip).columnGap)\n const step = strip.offsetWidth + (Number.isFinite(gap) ? gap : 0)\n if (step > 0) {\n return step\n }\n return typeof window === 'undefined' ? 1 : window.innerWidth || 1\n}\n\nfunction union(span: SlideSpan | null, from: number, to: number): SlideSpan {\n const lo = Math.min(from, to, span?.[0] ?? Number.POSITIVE_INFINITY)\n const hi = Math.max(from, to, span?.[1] ?? Number.NEGATIVE_INFINITY)\n return [lo, hi]\n}\n\n/**\n * Pages the gallery by moving one strip of slides, the way a native pager does.\n *\n * - **Pointer.** Once a drag locks horizontal, the strip follows it 1:1, with\n * rubber-band resistance past the first and last slide. On release it pages\n * by distance or by velocity (see `releaseTarget`) and settles on a spring\n * that starts at the speed the pointer let go at. A press during a settle\n * catches the strip where it is.\n * - **Index changes.** Arrow keys, the previous and next buttons and a\n * thumbnail next door all animate the same strip from wherever it is drawn.\n * A jump of more than one slide cuts. Animating it would sweep past slides\n * whose media is not mounted, a row of empty frames flying by; mounting\n * them all to avoid that would decode every wallpaper in between for a\n * fraction of a second on screen.\n * - **Trackpad.** A two-finger swipe moves the strip 1:1 as well, but at most\n * one slide per gesture. It settles as soon as the fingers lift, which is\n * when the coast starts, or when it reaches the next slide, and the rest of\n * the coast is swallowed. The coast and new-gesture rules are the ones the\n * captured trackpad traces validated for the old one-page lock.\n * - **Reduced motion.** Dragging still tracks, since it is direct\n * manipulation, but every settle and every index change lands instantly.\n *\n * The strip is written imperatively, as `usePullToDismiss` does: this runs on\n * every pointer sample, and re-rendering a gallery per frame is how direct\n * manipulation stops feeling direct. React owns only the resting transform,\n * which is what makes the first commit measurable by the open morph.\n * `will-change` is set only while the strip moves.\n */\nexport function useSlideTrack({\n enabled,\n goTo,\n index,\n itemCount,\n mountRadius,\n reducedMotion,\n rootRef,\n stripRef,\n trackRef,\n}: SlideTrackOptions): SlideTrack {\n const [position] = useState(() => motionValue(index))\n const [span, setSpan] = useState<SlideSpan | null>(null)\n const [spanIndex, setSpanIndex] = useState(index)\n\n // An animated index change passes over the slides between where the strip\n // is and where it is going. Recorded during render rather than in an\n // effect, so the commit that changes the index already keeps them mounted.\n if (spanIndex !== index) {\n setSpanIndex(index)\n const animates = !reducedMotion && Math.abs(index - spanIndex) === 1\n setSpan(animates ? union(span, spanIndex, index) : null)\n }\n\n const indexRef = useRef(index)\n indexRef.current = index\n const goToRef = useRef(goTo)\n goToRef.current = goTo\n const lastIndexRef = useRef(itemCount - 1)\n lastIndexRef.current = itemCount - 1\n const reducedMotionRef = useRef(reducedMotion)\n reducedMotionRef.current = reducedMotion\n const mountRadiusRef = useRef(mountRadius)\n mountRadiusRef.current = mountRadius\n\n /** The running settle, if any, and the index it is heading to. */\n const animationRef = useRef<AnimationPlaybackControls | null>(null)\n const targetRef = useRef<number | null>(null)\n /** The index the strip was last told about, for telling a new index from a re-render. */\n const committedIndexRef = useRef(index)\n const controlRef = useRef<{\n /** Stops any settle and holds the strip where it is drawn, ready to be dragged. */\n halt: () => void\n /** Writes the drawn position back over the resting one React just committed. */\n redraw: () => void\n /** Puts the strip on the current index at once and ends the movement. */\n rest: () => void\n /** Springs the strip to `target`, starting at `velocity` slide units per second. */\n settle: (target: number, velocity?: number) => void\n } | null>(null)\n\n // The strip, the position value and the settle machinery. Everything that\n // writes to the DOM lives here, so it is wired before any gesture or index\n // change can call into it.\n useLayoutEffect(() => {\n const strip = stripRef.current\n if (!strip) {\n return\n }\n\n let moving = false\n /**\n * The root that carries `data-paging`. Read when the movement starts, not\n * here: `Content` attaches its ref after its children's layout effects.\n */\n let pagingRoot: HTMLElement | null = null\n const setMoving = (next: boolean) => {\n if (next === moving) {\n return\n }\n moving = next\n // Promote only for the duration of the movement. A permanent layer on a\n // strip of full-viewport slides is memory nobody is using at rest.\n strip.style.willChange = next ? 'transform' : ''\n if (next) {\n pagingRoot = rootRef.current\n }\n pagingRoot?.toggleAttribute('data-paging', next)\n }\n\n const unsubscribe = position.on('change', value => {\n strip.style.transform = trackTransform(value)\n })\n\n const stop = () => {\n animationRef.current?.stop()\n animationRef.current = null\n targetRef.current = null\n position.stop()\n }\n\n const rest = () => {\n setMoving(false)\n const current = indexRef.current\n position.jump(current)\n strip.style.transform = trackTransform(current)\n setSpan(value => (value === null ? value : null))\n }\n\n const settle = (target: number, velocity?: number) => {\n stop()\n if (reducedMotionRef.current) {\n position.jump(target)\n if (target === indexRef.current) {\n rest()\n return\n }\n // The index change that follows lands the strip; a consumer that\n // ignores it gets the strip back on the slide it still reports.\n requestAnimationFrame(() => {\n if (targetRef.current === null && !animationRef.current) {\n rest()\n }\n })\n return\n }\n setMoving(true)\n targetRef.current = target\n const controls = animate(position, target, {\n ...PAGE_SPRING,\n ...(velocity === undefined ? {} : { velocity }),\n onComplete: () => {\n if (animationRef.current !== controls) {\n return\n }\n animationRef.current = null\n targetRef.current = null\n // A controlled consumer may have declined the page turn. Then the\n // strip goes back to the slide the gallery still reports.\n if (Math.abs(position.get() - indexRef.current) > 0.001) {\n settle(indexRef.current)\n return\n }\n rest()\n },\n })\n animationRef.current = controls\n }\n\n controlRef.current = {\n halt: () => {\n stop()\n setMoving(true)\n },\n redraw: () => {\n strip.style.transform = trackTransform(position.get())\n },\n rest: () => {\n stop()\n rest()\n },\n settle,\n }\n\n return () => {\n controlRef.current = null\n stop()\n unsubscribe()\n setMoving(false)\n }\n }, [position, rootRef, stripRef])\n\n // Keys, buttons and thumbnails change the index directly. React has already\n // committed the new resting transform by now; this puts the strip back where\n // it is drawn, before the browser paints, and settles it from there.\n useLayoutEffect(() => {\n const previous = committedIndexRef.current\n if (previous === index) {\n return\n }\n committedIndexRef.current = index\n const control = controlRef.current\n if (!control) {\n return\n }\n // A release already started this settle and asked for this index.\n if (targetRef.current === index && animationRef.current) {\n control.redraw()\n return\n }\n if (reducedMotion || Math.abs(index - previous) !== 1) {\n control.rest()\n return\n }\n control.redraw()\n control.settle(index)\n }, [index, reducedMotion])\n\n // Pointer and trackpad input.\n useEffect(() => {\n const track = trackRef.current\n const strip = stripRef.current\n if (!enabled || !track || !strip) {\n return\n }\n\n const settle = (target: number, velocityPxPerMs: number, step: number) => {\n const control = controlRef.current\n if (!control) {\n return\n }\n // Pixels per millisecond to slide units per second, the unit the\n // spring runs in.\n control.settle(target, (velocityPxPerMs / step) * 1000)\n if (target !== indexRef.current) {\n goToRef.current(target)\n }\n }\n\n const release = (startPosition: number, velocity: number, step: number) => {\n const target = releaseTarget({\n distanceThreshold: swipeDistanceThreshold(window.innerWidth),\n index: indexRef.current,\n lastIndex: lastIndexRef.current,\n position: position.get(),\n startPosition,\n step,\n velocity,\n })\n settle(target, velocity, step)\n }\n\n /** Catches the strip where it is, if a settle is moving it. */\n const catchStrip = (): boolean => {\n if (!animationRef.current) {\n return false\n }\n controlRef.current?.halt()\n return true\n }\n\n /** A drag can reveal a neighbour the preload radius does not mount. */\n const mountNeighbours = () => {\n if (mountRadiusRef.current >= 1) {\n return\n }\n const current = indexRef.current\n setSpan(value => union(value, current - 1, current + 1))\n }\n\n // --- Pointer ---------------------------------------------------------\n\n let pointerId: number | null = null\n let startX = 0\n let startY = 0\n let startPosition = 0\n let step = 1\n let rtl = false\n /** Locked once the pointer has moved enough to pick an axis; `null` while undecided. */\n let axis: 'horizontal' | 'vertical' | null = null\n /** The press stopped a settle, so the strip must be settled again whatever the gesture becomes. */\n let caught = false\n const velocity = createVelocityTracker()\n /**\n * A horizontal drag that ends over `SlideCloseArea` is followed by a\n * synthetic `click`, and acting on it would close the lightbox the drag\n * just paged.\n */\n let suppressNextClick = false\n let suppressTimer: ReturnType<typeof setTimeout> | null = null\n\n const forwardOf = (clientX: number) => (rtl ? clientX - startX : startX - clientX)\n\n const handlePointerDown = (event: PointerEvent) => {\n if (event.button !== 0) {\n return\n }\n if (pointerId !== null) {\n // A second finger is a pinch, never a page turn. Put the strip back.\n if (axis === 'horizontal' || caught) {\n controlRef.current?.settle(indexRef.current)\n }\n pointerId = null\n axis = null\n caught = false\n return\n }\n if ((event.target as HTMLElement | null)?.closest(NO_DRAG_SELECTOR)) {\n return\n }\n pointerId = event.pointerId\n startX = event.clientX\n startY = event.clientY\n axis = null\n caught = catchStrip()\n startPosition = position.get()\n step = measureStep(strip)\n rtl = isRtlTrack(track)\n velocity.reset(0, event.timeStamp)\n }\n\n const handlePointerMove = (event: PointerEvent) => {\n if (event.pointerId !== pointerId) {\n return\n }\n const dx = event.clientX - startX\n const dy = event.clientY - startY\n\n if (axis === null) {\n if (Math.abs(dx) < AXIS_LOCK_THRESHOLD && Math.abs(dy) < AXIS_LOCK_THRESHOLD) {\n return\n }\n // Pull-to-dismiss gets the vertical half; abandon rather than race it.\n axis = Math.abs(dx) > Math.abs(dy) ? 'horizontal' : 'vertical'\n if (axis === 'vertical') {\n pointerId = null\n if (caught) {\n caught = false\n controlRef.current?.settle(Math.round(position.get()))\n }\n return\n }\n controlRef.current?.halt()\n mountNeighbours()\n track.style.userSelect = 'none'\n }\n\n if (event.cancelable) {\n event.preventDefault()\n }\n const forward = forwardOf(event.clientX)\n velocity.push(forward, event.timeStamp)\n position.set(resistEdges(startPosition + forward / step, lastIndexRef.current, step))\n }\n\n const endGesture = (event: PointerEvent, cancelled: boolean) => {\n if (event.pointerId !== pointerId) {\n return\n }\n const wasHorizontal = axis === 'horizontal'\n const wasCaught = caught\n pointerId = null\n axis = null\n caught = false\n track.style.userSelect = ''\n\n if (wasHorizontal) {\n suppressNextClick = true\n if (suppressTimer) {\n clearTimeout(suppressTimer)\n }\n // Not every drag is followed by a click; the flag must not outlive this one.\n suppressTimer = setTimeout(() => {\n suppressNextClick = false\n }, 0)\n }\n if (!wasHorizontal && !wasCaught) {\n return\n }\n if (cancelled) {\n release(startPosition, 0, step)\n return\n }\n velocity.push(forwardOf(event.clientX), event.timeStamp)\n // Trailing speed, not the whole drag's average: a flick is judged on\n // how fast the pointer was moving as it let go.\n release(startPosition, velocity.velocity(), step)\n }\n\n const handlePointerUp = (event: PointerEvent) => {\n endGesture(event, false)\n }\n const handlePointerCancel = (event: PointerEvent) => {\n endGesture(event, true)\n }\n\n /** Capture phase, so it runs before the close area's own `onClick`. */\n const handleClickCapture = (event: MouseEvent) => {\n if (!suppressNextClick) {\n return\n }\n suppressNextClick = false\n if (suppressTimer) {\n clearTimeout(suppressTimer)\n suppressTimer = null\n }\n event.preventDefault()\n event.stopPropagation()\n }\n\n // --- Trackpad --------------------------------------------------------\n\n /** `tracking` follows the fingers; `spent` swallows the coast after a settle. */\n let wheelMode: 'idle' | 'tracking' | 'spent' = 'idle'\n let wheelStart = 0\n let wheelForward = 0\n let wheelStep = 1\n let wheelRtl = false\n let wheelPeak = 0\n let wheelCoasting = false\n let wheelFloor = Number.POSITIVE_INFINITY\n const wheelVelocity = createVelocityTracker()\n let wheelQuietTimer: ReturnType<typeof setTimeout> | null = null\n\n const finishWheel = (useVelocity: boolean) => {\n release(wheelStart, useVelocity ? wheelVelocity.velocity() : 0, wheelStep)\n }\n\n const armWheelQuietTimer = () => {\n if (wheelQuietTimer) {\n clearTimeout(wheelQuietTimer)\n }\n wheelQuietTimer = setTimeout(() => {\n wheelQuietTimer = null\n if (wheelMode === 'tracking') {\n // Nothing coasted and nothing reached the next slide: a device with\n // no momentum, whose gesture ended a moment ago. Distance decides.\n finishWheel(false)\n }\n wheelMode = 'idle'\n }, WHEEL_QUIET_MS)\n }\n\n const handleWheel = (event: WheelEvent) => {\n // A trackpad pinch arrives as ctrl + wheel and belongs to zoom; up and\n // down belong to pull-to-dismiss.\n if (event.ctrlKey || Math.abs(event.deltaX) <= Math.abs(event.deltaY)) {\n return\n }\n // Stops the browser's own edge-swipe navigation from fighting the page\n // turn. Guarded because whether a wheel sequence can be cancelled is\n // latched at its first event.\n if (event.cancelable) {\n event.preventDefault()\n }\n armWheelQuietTimer()\n const magnitude = Math.abs(event.deltaX)\n\n if (wheelMode === 'spent') {\n if (!wheelCoasting) {\n // Still driving past the settle. The same swipe may keep\n // accelerating, and dip and climb on the way to its peak, without\n // any of that counting as a second gesture.\n if (magnitude > wheelPeak) {\n wheelPeak = magnitude\n return\n }\n if (magnitude >= wheelPeak * WHEEL_DECAY_RATIO) {\n return\n }\n wheelCoasting = true\n wheelFloor = magnitude\n return\n }\n if (magnitude < wheelFloor) {\n wheelFloor = magnitude\n return\n }\n if (magnitude - wheelFloor <= WHEEL_RISE_MARGIN) {\n return\n }\n // Climbing back out of the coast: the fingers are down again, and this\n // is a new gesture. Momentum only ever decays, so it cannot get here.\n wheelMode = 'idle'\n }\n\n if (wheelMode === 'idle') {\n controlRef.current?.halt()\n mountNeighbours()\n wheelMode = 'tracking'\n wheelStart = position.get()\n wheelForward = 0\n wheelPeak = 0\n wheelCoasting = false\n wheelFloor = Number.POSITIVE_INFINITY\n wheelStep = measureStep(strip)\n wheelRtl = isRtlTrack(track)\n wheelVelocity.reset(0, event.timeStamp)\n }\n\n const driven = Math.abs(wheelForward) > WHEEL_DRIVE_THRESHOLD\n if (driven && magnitude > wheelPeak) {\n wheelPeak = magnitude\n } else if (driven && magnitude < wheelPeak * WHEEL_DECAY_RATIO) {\n // The fingers have left the trackpad. Decide now, on the speed the\n // gesture ended at, and swallow the rest of the coast.\n finishWheel(true)\n wheelMode = 'spent'\n wheelCoasting = true\n wheelFloor = magnitude\n return\n }\n\n // Positive `deltaX` scrolls content leftward, which is onward in a\n // left-to-right gallery and back in a right-to-left one.\n wheelForward += wheelRtl ? -event.deltaX : event.deltaX\n wheelVelocity.push(wheelForward, event.timeStamp)\n const anchor = Math.round(wheelStart)\n const raw = wheelStart + wheelForward / wheelStep\n const bounded = Math.min(Math.max(raw, anchor - 1), anchor + 1)\n position.set(resistEdges(bounded, lastIndexRef.current, wheelStep))\n if (bounded !== raw) {\n // A whole slide in one gesture is the most it may turn.\n finishWheel(true)\n wheelMode = 'spent'\n wheelCoasting = false\n wheelPeak = Math.max(wheelPeak, magnitude)\n }\n }\n\n track.addEventListener('pointerdown', handlePointerDown)\n window.addEventListener('pointermove', handlePointerMove, { passive: false })\n window.addEventListener('pointerup', handlePointerUp)\n window.addEventListener('pointercancel', handlePointerCancel)\n track.addEventListener('click', handleClickCapture, true)\n // Not passive: a horizontal event's default is conditionally prevented\n // above, and a listener's passive-ness is fixed at registration.\n track.addEventListener('wheel', handleWheel, { passive: false })\n\n return () => {\n if (wheelQuietTimer) {\n clearTimeout(wheelQuietTimer)\n }\n if (suppressTimer) {\n clearTimeout(suppressTimer)\n }\n // Zoom switched the gesture off mid-drag: put the strip back.\n if (axis === 'horizontal' || caught || wheelMode === 'tracking') {\n controlRef.current?.settle(indexRef.current)\n }\n track.style.userSelect = ''\n track.removeEventListener('pointerdown', handlePointerDown)\n window.removeEventListener('pointermove', handlePointerMove)\n window.removeEventListener('pointerup', handlePointerUp)\n window.removeEventListener('pointercancel', handlePointerCancel)\n track.removeEventListener('click', handleClickCapture, true)\n track.removeEventListener('wheel', handleWheel)\n }\n }, [enabled, position, stripRef, trackRef])\n\n return { span }\n}\n","'use client'\n\nimport { mergeProps } from '@base-ui/react/merge-props'\nimport { useRender } from '@base-ui/react/use-render'\nimport { useEffect, useLayoutEffect, useRef, useState, type ReactNode } from 'react'\nimport type * as React from 'react'\nimport { cn } from '../../../lib/cn'\nimport { isRtlTrack } from '../direction'\nimport { trackTransform } from '../track-physics'\nimport { useSlideTrack } from '../use-slide-track'\nimport {\n LightboxSlideContext,\n useLightboxConfig,\n useLightboxSlide,\n useLightboxState,\n} from './context'\nimport { useLightboxRefs } from './refs'\nimport { useLightboxThumbnailsPresence } from './thumbnails-registry'\nimport type { LightboxSlide as LightboxSlideValue } from './context'\n\nexport type LightboxViewportProps = useRender.ComponentProps<'div'>\n\n/** The frame the track sits inside of. */\nexport function LightboxViewport({\n className,\n ref,\n render,\n ...props\n}: LightboxViewportProps): React.ReactElement {\n const { stageRef } = useLightboxRefs()\n\n const defaultProps = {\n className: cn('relative z-10 min-h-0 flex-1', className),\n 'data-slot': 'media-lightbox-viewport',\n }\n\n return useRender({\n defaultTagName: 'div',\n props: mergeProps<'div'>(defaultProps, props),\n ref: [stageRef, ref ?? null],\n render,\n })\n}\n\nexport type LightboxSlidesProps = Omit<useRender.ComponentProps<'div'>, 'children'> & {\n /** The number and identity of slides comes from `items`, not from markup the caller lays out. */\n children: (slide: LightboxSlideValue) => ReactNode\n}\n\n/**\n * A track, like a native pager: the slides sit side by side in one strip, a gap\n * apart, and a page turn moves that strip. The strip is the only thing that\n * moves, with a single `translate3d`, so a turn costs the compositor one layer\n * and re-rasters nothing on the way. See `useSlideTrack` for the gestures and\n * springs.\n *\n * This element is the clipping frame and the carousel's accessible group; the\n * strip inside it is plain layout. The gap is `--a63-media-lightbox-gap`\n * (`--a63-space-4` by default), and in a right-to-left gallery the strip runs\n * the other way.\n *\n * A turn used to be a crossfade in a stack of slides, chosen when a full-width\n * `backdrop-filter` over the moving photo made sliding judder. That blur is\n * gone, and nothing blurred sits over the strip while it moves: the only\n * blurred surfaces are the small on-media controls, and they drop the blur for\n * as long as the root carries `data-paging`.\n */\nexport function LightboxSlides({\n children,\n className,\n ref,\n render,\n ...props\n}: LightboxSlidesProps): React.ReactElement {\n const { rootRef, trackRef } = useLightboxRefs()\n const { goTo, index, isZoomed, itemCount } = useLightboxState()\n const { items, labels, preload, reducedMotion } = useLightboxConfig()\n const stripRef = useRef<HTMLDivElement>(null)\n\n // Decode only the active slide on the opening frame; neighbours wait a paint\n // so open is not paying for three wallpaper bitmaps at once.\n const [livePreload, setLivePreload] = useState(0)\n const [trackDirection, setTrackDirection] = useState<'ltr' | 'rtl'>('ltr')\n\n const { span } = useSlideTrack({\n // A drag on zoomed media is a pan, not a page turn.\n enabled: !isZoomed,\n goTo,\n index,\n itemCount,\n mountRadius: livePreload,\n reducedMotion,\n rootRef,\n stripRef,\n trackRef,\n })\n\n useEffect(() => {\n if (preload <= 0) {\n return\n }\n let inner = 0\n const outer = requestAnimationFrame(() => {\n inner = requestAnimationFrame(() => {\n setLivePreload(preload)\n })\n })\n return () => {\n cancelAnimationFrame(outer)\n cancelAnimationFrame(inner)\n }\n }, [preload])\n\n useLayoutEffect(() => {\n const track = trackRef.current\n if (track) {\n setTrackDirection(isRtlTrack(track) ? 'rtl' : 'ltr')\n }\n }, [trackRef])\n\n const strip = (\n <div\n className={cn(\n 'flex h-full w-full',\n 'gap-[var(--a63-media-lightbox-gap,var(--a63-space-4))]',\n // The transform is physical; this flips it for a strip that runs\n // right to left, so the position arithmetic stays in reading order.\n '[--a63-media-lightbox-track-sign:1] rtl:[--a63-media-lightbox-track-sign:-1]'\n )}\n data-slot=\"media-lightbox-strip\"\n ref={stripRef}\n // The resting position only. While the strip moves, `useSlideTrack`\n // writes this property itself. React writes it again only when the index\n // changes, and the track puts it back before that frame paints.\n style={{ transform: trackTransform(index) }}\n >\n {items.map((item, slideIndex) => {\n const isActive = slideIndex === index\n // Decoded bitmaps are the expensive part of a gallery: a 2880x1920\n // frame is ~22MB resident, so only the preload neighbourhood, plus\n // whatever a moving strip is passing over, stays mounted.\n const isNear =\n isActive ||\n Math.abs(slideIndex - index) <= livePreload ||\n (span !== null && slideIndex >= span[0] && slideIndex <= span[1])\n const slide: LightboxSlideValue = { isActive, isNear, item, slideIndex }\n return (\n <LightboxSlideContext.Provider key={item.id} value={slide}>\n {children(slide)}\n </LightboxSlideContext.Provider>\n )\n })}\n </div>\n )\n\n const defaultProps = {\n 'aria-label': labels.gallery,\n 'aria-roledescription': labels.carousel,\n children: strip,\n // `touch-none`: the browser must not start a pan of its own under a drag\n // that is paging, pulling or pinching the photo. Each of those is handled\n // here, and a browser pan would cancel the pointer mid-gesture.\n className: cn('relative h-full w-full touch-none overflow-hidden', className),\n 'data-active-index': index,\n 'data-direction': trackDirection,\n 'data-slot': 'media-lightbox-track',\n role: 'group' as const,\n }\n\n return useRender({\n defaultTagName: 'div',\n props: mergeProps<'div'>(defaultProps, props),\n ref: [trackRef, ref ?? null],\n render,\n })\n}\n\nexport type LightboxSlideProps = useRender.ComponentProps<'div'>\n\n/**\n * A single slide's wrapper: identity, `inert` and roving `role`/`aria-*` are\n * all derived from `LightboxSlideContext`. It is exactly one slide wide, so the\n * track's position arithmetic can count in slides. What goes inside is the\n * caller's.\n */\nexport function LightboxSlide({\n children,\n className,\n ref,\n render,\n ...props\n}: LightboxSlideProps): React.ReactElement {\n const slide = useLightboxSlide()\n if (slide === null) {\n throw new Error('Lightbox.Slide must be rendered inside Lightbox.Slides.')\n }\n const { isActive, item, slideIndex } = slide\n const { items, labels } = useLightboxConfig()\n const hasThumbnails = useLightboxThumbnailsPresence()\n // With a strip each slide is the panel its thumbnail tab names; without one\n // it is a standalone carousel slide.\n const showThumbnails = hasThumbnails && items.length > 1\n\n const defaultProps = {\n 'aria-label': showThumbnails\n ? undefined\n : `${item.title} — ${labels.position(slideIndex, items.length)}`,\n 'aria-labelledby': showThumbnails ? `a63-media-lightbox-thumb-${item.id}` : undefined,\n 'aria-roledescription': labels.slide,\n children,\n className: cn(\n 'relative flex h-full w-full shrink-0 items-center justify-center',\n // A size container, so the frame can size itself against the slide in\n // *both* axes at once. Pinning one axis and letting the aspect ratio\n // drive the other only fits one orientation: pin the height and a photo\n // wider than the screen overflows and gets clamped back to the screen's\n // shape, pin the width and a taller one does the same. `cqw`/`cqh` give\n // the frame both of the slide's dimensions, so it can take the smaller\n // of the two fits and land on the photo's shape either way.\n '[container-type:size]',\n // Only the active slide is ever hit-tested. A neighbour a drag has half\n // revealed is still only a neighbour; a press on it lands on the track,\n // which is where catching a moving strip belongs.\n !isActive && 'pointer-events-none',\n className\n ),\n ...(isActive ? { 'data-active': '' } : {}),\n 'data-index': slideIndex,\n 'data-slot': 'media-lightbox-slide',\n id: `a63-media-lightbox-slide-${item.id}`,\n // `inert` also drops the slide out of the tab order and out of\n // find-in-page, which `aria-hidden` alone does not.\n inert: !isActive,\n role: showThumbnails ? ('tabpanel' as const) : ('group' as const),\n }\n\n return useRender({\n defaultTagName: 'div',\n props: mergeProps<'div'>(defaultProps, props),\n ref: ref ?? null,\n render,\n })\n}\n","/**\n * Geometry for the measured FLIP that grows the enlarged media out of its\n * thumbnail.\n *\n * The thumbnail is a `cover` crop of the photo; the enlarged media is the whole\n * photo, `contain`ed. Mapping one onto the other with a single scale — the\n * ratio of their widths — only lines the two boxes up when they happen to share\n * an aspect ratio. They rarely do, so the first frame of the open showed a\n * smaller, uncropped photo sitting inside where the tile had been, which reads\n * as a jump.\n *\n * So the morph reproduces the crop instead: at rest the media is scaled to\n * *cover* the tile's rect and clipped to it, with the tile's corner radius, and\n * the clip opens up as the scale unwinds. The first frame is then the same\n * pixels the tile was already showing. This is what the View Transitions path\n * gets from the browser for free via `object-fit`; here it is done by hand.\n */\n\nexport interface Box {\n height: number\n left: number\n top: number\n width: number\n}\n\nexport interface OriginMorph {\n /** The media's own layout size, before any ancestor transform. */\n mediaHeight: number\n mediaWidth: number\n /** The thumbnail's box, the state the morph starts and ends at. */\n originHeight: number\n originWidth: number\n /** Translation onto the thumbnail's centre, in the media's local pixels. */\n dx: number\n dy: number\n /** Scale at which the media covers the thumbnail's box. */\n scale: number\n mediaRadius: number\n originRadius: number\n /**\n * Uniform scale the media inherits from its ancestors.\n *\n * A pull-to-dismiss leaves the stage translated and scaled, and the morph\n * runs on an element inside it. Anything written to that element lands in its\n * own coordinate system, so a distance measured in viewport pixels has to be\n * divided back through this to travel as far as it was meant to.\n */\n ancestorScale: number\n}\n\n/** Is the thumbnail still somewhere the user can see it? */\nfunction isOnScreen(rect: DOMRect): boolean {\n return (\n rect.width > 0 &&\n rect.bottom > 0 &&\n rect.right > 0 &&\n rect.top < window.innerHeight &&\n rect.left < window.innerWidth\n )\n}\n\nfunction readRadius(element: Element): number {\n const value = Number.parseFloat(getComputedStyle(element).borderTopLeftRadius)\n return Number.isFinite(value) ? value : 0\n}\n\nfunction lerp(from: number, to: number, progress: number): number {\n return from + (to - from) * progress\n}\n\n/**\n * Destination box before the image has decoded — contain the tile's aspect in\n * the stage, which is the best guess available while the media has no box.\n */\nexport function guessedMediaBox(media: HTMLElement, origin: HTMLElement): Box | null {\n const originRect = origin.getBoundingClientRect()\n const stage = media.parentElement\n if (!stage || originRect.width === 0 || originRect.height === 0) {\n return null\n }\n const stageRect = stage.getBoundingClientRect()\n if (stageRect.width <= 0 || stageRect.height <= 0) {\n return null\n }\n const aspect = originRect.width / originRect.height\n let width = stageRect.width\n let height = width / aspect\n if (height > stageRect.height) {\n height = stageRect.height\n width = height * aspect\n }\n return {\n height,\n left: stageRect.left + (stageRect.width - width) / 2,\n top: stageRect.top + (stageRect.height - height) / 2,\n width,\n }\n}\n\n/**\n * `null` when there is nothing to grow from, or the thumbnail has scrolled off\n * screen — the caller falls back to a cross-fade.\n */\nexport function measureOriginMorph(\n media: HTMLElement,\n mediaBox: Box,\n origin: HTMLElement | null\n): OriginMorph | null {\n if (!origin || mediaBox.width <= 0 || mediaBox.height <= 0) {\n return null\n }\n\n const originRect = origin.getBoundingClientRect()\n if (!isOnScreen(originRect)) {\n return null\n }\n\n // `offsetWidth` is the layout box, which no ancestor transform touches;\n // `mediaBox` is what that box currently looks like on screen. Their ratio is\n // everything the ancestors are doing to this element.\n const layoutWidth = media.offsetWidth\n const layoutHeight = media.offsetHeight\n const measured = layoutWidth > 0 ? mediaBox.width / layoutWidth : 1\n // `offsetWidth` is an integer, so an untransformed element reports a scale a\n // hair off 1. Treating that as real would put sub-pixel drift into the common\n // case, which has nothing to correct.\n const ancestorScale = Math.abs(measured - 1) < 0.01 ? 1 : measured\n const mediaWidth = ancestorScale === 1 ? mediaBox.width : layoutWidth\n const mediaHeight = ancestorScale === 1 ? mediaBox.height : layoutHeight\n if (mediaWidth <= 0 || mediaHeight <= 0) {\n return null\n }\n\n return {\n ancestorScale,\n dx:\n (originRect.left + originRect.width / 2 - (mediaBox.left + mediaBox.width / 2)) /\n ancestorScale,\n dy:\n (originRect.top + originRect.height / 2 - (mediaBox.top + mediaBox.height / 2)) /\n ancestorScale,\n mediaHeight,\n mediaRadius: readRadius(media),\n mediaWidth,\n originHeight: originRect.height,\n originRadius: readRadius(origin),\n originWidth: originRect.width,\n scale: Math.max(originRect.width / mediaBox.width, originRect.height / mediaBox.height),\n }\n}\n\n/**\n * Paints the morph at `progress`: 0 is the thumbnail, 1 is the enlarged media.\n *\n * Sizes are decided in viewport pixels — that is where the thumbnail is — and\n * then converted into the media's own coordinates, because the clip and the\n * radius are written there and every ancestor transform sits between the two.\n */\nexport function paintOriginMorph(media: HTMLElement, morph: OriginMorph, progress: number): void {\n const scale = lerp(morph.scale, 1, progress)\n const x = lerp(morph.dx, 0, progress)\n const y = lerp(morph.dy, 0, progress)\n const toLocal = morph.ancestorScale * scale\n const visibleWidth = lerp(morph.originWidth, morph.mediaWidth * morph.ancestorScale, progress)\n const visibleHeight = lerp(morph.originHeight, morph.mediaHeight * morph.ancestorScale, progress)\n const insetX = Math.max((morph.mediaWidth - visibleWidth / toLocal) / 2, 0)\n const insetY = Math.max((morph.mediaHeight - visibleHeight / toLocal) / 2, 0)\n const radius =\n lerp(morph.originRadius, morph.mediaRadius * morph.ancestorScale, progress) / toLocal\n\n media.style.transform = `translate3d(${x}px, ${y}px, 0) scale(${scale})`\n media.style.clipPath = `inset(${insetY}px ${insetX}px round ${radius}px)`\n}\n\n/** Hands the element back to its stylesheet. */\nexport function clearOriginMorph(media: HTMLElement): void {\n media.style.transform = ''\n media.style.clipPath = ''\n media.style.transformOrigin = ''\n media.style.willChange = ''\n}\n","import type { ReactElement } from 'react'\nimport { cn } from '../../lib/cn'\nimport type { MediaLightboxItem } from './types'\n\n/**\n * The media's own box. Height comes from a variable the lightbox sets so the\n * picture fills the stage above the dock rather than a guessed viewport share.\n */\nconst MEDIA_BOX =\n 'max-h-[var(--a63-media-lightbox-media-h,100%)] max-w-[min(92vw,1400px)] object-contain'\n\n/** Matches the media box so a `srcSet` can pick a width instead of the wallpaper's native pixels. */\nexport const LIGHTBOX_IMAGE_SIZES = 'min(92vw, 1400px)'\n\n/**\n * Resolves the source the lightbox should show for the caller's appearance map.\n */\nexport function resolveMediaSrc(\n item: MediaLightboxItem,\n appearance: 'light' | 'dark' | undefined\n): string | undefined {\n if (item.lightSrc && item.darkSrc) {\n return appearance === 'light' ? item.lightSrc : item.darkSrc\n }\n return item.src ?? item.lightSrc ?? item.darkSrc\n}\n\n/**\n * The small stand-in for the same picture, if the caller supplied one.\n *\n * Mirrors `resolveMediaSrc` so a light/dark pair stays a light/dark pair at\n * thumbnail size — a strip that keeps showing the dark variant after the photo\n * has been switched to light is worse than no thumbnail at all.\n */\nexport function resolveThumbSrc(\n item: MediaLightboxItem,\n appearance: 'light' | 'dark' | undefined\n): string | undefined {\n if (item.thumbLightSrc && item.thumbDarkSrc) {\n return appearance === 'light' ? item.thumbLightSrc : item.thumbDarkSrc\n }\n return item.thumbSrc ?? item.thumbLightSrc ?? item.thumbDarkSrc\n}\n\n/** Is there anything to show for this item at all? */\nexport function hasMedia(item: MediaLightboxItem, src: string | undefined): boolean {\n if (item.render) {\n return true\n }\n if (item.kind === 'video') {\n return Boolean(item.sources?.length)\n }\n return Boolean(src)\n}\n\n/**\n * The media itself: an image, a video, or whatever the caller handed over.\n *\n * The lightbox has no opinion about `render` content beyond boxing it, which is\n * what makes a 3D viewer or an embed as ordinary here as a photo.\n */\nexport function SlideMedia({\n active,\n filled,\n item,\n src,\n thumbSrc,\n}: {\n active: boolean\n /** The frame knows its own shape, so the media can simply fill it. */\n filled?: boolean\n item: MediaLightboxItem\n src: string | undefined\n thumbSrc?: string\n}): ReactElement | null {\n if (item.render) {\n return (\n <div className={cn(MEDIA_BOX, 'overflow-auto')} data-slot=\"media-lightbox-custom\">\n {item.render}\n </div>\n )\n }\n\n if (item.kind === 'video') {\n if (!item.sources?.length) {\n return null\n }\n return (\n // eslint-disable-next-line jsx-a11y/media-has-caption -- captions are the caller's to supply through `tracks`; nothing here can invent them.\n <video\n aria-label={item.alt}\n className={MEDIA_BOX}\n controls\n data-slot=\"media-lightbox-video\"\n // Controls are the point of a video; the gallery's own drag and pull\n // gestures stand down over it.\n data-a63-no-drag=\"\"\n playsInline\n poster={item.poster}\n preload={active ? 'metadata' : 'none'}\n >\n {item.sources.map(source => (\n <source key={source.src} src={source.src} type={source.type} />\n ))}\n </video>\n )\n }\n\n if (!src) {\n return null\n }\n\n const photo = (\n <img\n alt={item.alt}\n // Positioned when it shares the box with a placeholder: a positioned\n // element paints above unpositioned content in the same stacking context\n // whatever the DOM order, so leaving this one static buried the real\n // photograph under its own thumbnail.\n className={filled ? 'absolute inset-0 size-full object-contain' : MEDIA_BOX}\n data-slot=\"media-lightbox-image\"\n decoding=\"async\"\n draggable={false}\n fetchPriority={active ? 'high' : 'low'}\n loading={active ? 'eager' : 'lazy'}\n sizes={item.sizes ?? LIGHTBOX_IMAGE_SIZES}\n src={src}\n srcSet={item.srcSet}\n />\n )\n\n if (!filled || !thumbSrc || thumbSrc === src) {\n return photo\n }\n\n return (\n <>\n {/*\n The same picture at a couple of kilobytes, filling the frame the photo\n is about to fill. It needs no fading out: the photo lands on exactly\n this rect and covers it, so the only thing the eye catches is the\n picture getting sharper.\n */}\n <img\n alt=\"\"\n aria-hidden\n className=\"absolute inset-0 size-full object-contain\"\n data-slot=\"media-lightbox-placeholder\"\n decoding=\"async\"\n draggable={false}\n src={thumbSrc}\n />\n {photo}\n </>\n )\n}\n","import { useEffect, useState } from 'react'\n\n/**\n * The aspect ratio of a picture, as early as anything can know it.\n *\n * Nothing in the lightbox can lay out a placeholder without this. The media box\n * is sized by the photo itself, so before the file arrives there is no box — a\n * stand-in told to fill its container collapses it to nothing, because the\n * container was waiting on the stand-in. Something outside that loop has to\n * supply the shape.\n *\n * The thumbnail is that something. It is the same picture, so it has the same\n * ratio, and at a couple of kilobytes it is usually already decoded — the strip\n * fetched it — which makes `complete` true on the first effect and the shape\n * known before the first paint. The full-size file then refines it, because a\n * thumbnail's integer dimensions round the ratio by a fraction of a percent.\n */\nexport function useMediaAspect(\n thumbSrc: string | undefined,\n src: string | undefined\n): number | undefined {\n const [aspect, setAspect] = useState<number | undefined>(undefined)\n\n useEffect(() => {\n if (typeof Image === 'undefined' || (!thumbSrc && !src)) {\n setAspect(undefined)\n return\n }\n\n let cancelled = false\n const detachers: (() => void)[] = []\n\n // The thumbnail answers first and the photo answers better, so let both run\n // and keep whichever is more authoritative.\n const watch = (candidate: string | undefined, authoritative: boolean) => {\n if (!candidate) {\n return\n }\n const probe = new Image()\n const read = () => {\n if (cancelled || probe.naturalWidth <= 0 || probe.naturalHeight <= 0) {\n return\n }\n const ratio = probe.naturalWidth / probe.naturalHeight\n setAspect(current => (current === undefined || authoritative ? ratio : current))\n }\n probe.addEventListener('load', read)\n detachers.push(() => {\n probe.removeEventListener('load', read)\n })\n probe.src = candidate\n if (probe.complete) {\n read()\n }\n }\n\n watch(thumbSrc, false)\n watch(src, true)\n\n return () => {\n cancelled = true\n for (const detach of detachers) {\n detach()\n }\n }\n }, [src, thumbSrc])\n\n return aspect\n}\n","'use client'\n\nimport { mergeProps } from '@base-ui/react/merge-props'\nimport { useRender } from '@base-ui/react/use-render'\nimport { animate, motion, usePresence } from 'motion/react'\nimport { useEffect, useLayoutEffect, useRef } from 'react'\nimport type { CSSProperties } from 'react'\nimport type * as React from 'react'\nimport { cn } from '../../../lib/cn'\nimport { MEDIA_FADE, MEDIA_SPRING } from '../motion'\nimport {\n clearOriginMorph,\n guessedMediaBox,\n measureOriginMorph,\n paintOriginMorph,\n} from '../origin-morph'\nimport { revealReturnTarget } from '../reveal-origin'\nimport { hasMedia, resolveMediaSrc, resolveThumbSrc, SlideMedia } from '../slide-media'\nimport { useMediaAspect } from '../use-media-aspect'\nimport { MEDIA_VIEW_TRANSITION_NAME, MORPH_TARGET_ATTRIBUTE } from '../view-transition'\nimport { useLightboxConfig, useLightboxSlide, useLightboxState } from './context'\nimport { useLightboxRefs } from './refs'\nimport { useLightboxZoomOptionsRegistry, type LightboxZoomOptions } from './zoom-options'\n\n/**\n * Grows the media out of `origin` and shrinks it back on the way out.\n *\n * This is a measured FLIP rather than a `layoutId` shared layout: the lightbox\n * is `position: fixed` inside a portal, and motion's projection maths resolves\n * against DOM ancestry, so a shared layout pairs the two elements but never\n * animates between them.\n *\n * A single spring drives a 0→1 progress that `paintOriginMorph` turns into a\n * transform, a clip, and a corner radius at once. Three properties on one\n * driver stay in lockstep by construction, and a spring can be re-targeted\n * mid-flight, so closing something that is still opening reverses from where it\n * actually is.\n */\nfunction useOriginZoom(\n origin: HTMLElement | null | undefined,\n enabled: boolean,\n isActive: boolean\n): React.RefObject<HTMLDivElement | null> {\n const mediaRef = useRef<HTMLDivElement>(null)\n const [isPresent, safeToRemove] = usePresence()\n // Every mounted slide owns a frame and calls this hook; only the slide on\n // screen may morph. Read through a ref so a page turn does not re-run the\n // opening effect on the slide that just became active.\n const isActiveRef = useRef(isActive)\n isActiveRef.current = isActive\n // The opening zoom plays once, on the slide that was on screen when the\n // lightbox opened. `enabled` can turn true later (a slide paged to before its\n // shape was known, or a light/dark switch), and replaying the zoom then would\n // fly the photo out of the tile the gallery opened from mid-browse.\n const openingZoomRef = useRef(isActive)\n\n useLayoutEffect(() => {\n const media = mediaRef.current\n // Closing sets a new origin (the tile for the photo on screen), which\n // would otherwise re-run this opening zoom on top of the closing one; its\n // last frame drew the photo full size just before the overlay left.\n if (!media || !enabled || !isPresent || !isActiveRef.current || !openingZoomRef.current) {\n return\n }\n\n // The media box is sized by an image that may not have decoded yet, so the\n // first measurement can legitimately be zero. Hold it hidden until it has a\n // box worth animating from.\n media.style.opacity = '0'\n let cancelled = false\n\n const startZoom = (): boolean => {\n if (cancelled) {\n return true\n }\n // Measure the untransformed box. React re-runs layout effects in\n // StrictMode, and a second measurement taken through the transform the\n // first pass applied reports the thumbnail's box, which collapses the\n // zoom to a no-op.\n clearOriginMorph(media)\n const measured = media.getBoundingClientRect()\n const box = measured.width > 0 ? measured : origin ? guessedMediaBox(media, origin) : null\n if (!box) {\n return false\n }\n\n const morph = measureOriginMorph(media, box, origin ?? null)\n media.style.opacity = '1'\n // Spent only once it has really started: a StrictMode re-run, or a\n // cleanup while waiting for a box, must still be able to start it.\n openingZoomRef.current = false\n\n if (morph) {\n media.style.transformOrigin = 'center'\n media.style.willChange = 'transform'\n paintOriginMorph(media, morph, 0)\n void animate(0, 1, {\n ...MEDIA_SPRING,\n onComplete: () => {\n clearOriginMorph(media)\n },\n onUpdate: progress => {\n paintOriginMorph(media, morph, progress)\n },\n })\n } else {\n void animate(media, { opacity: [0, 1] }, MEDIA_FADE)\n }\n return true\n }\n\n // Without a ResizeObserver there is no way to know when the media has a box,\n // so settle for the cross-fade rather than leaving it invisible.\n if (startZoom() || typeof ResizeObserver === 'undefined') {\n if (media.style.opacity === '0') {\n media.style.opacity = '1'\n void animate(media, { opacity: [0, 1] }, MEDIA_FADE)\n }\n return () => {\n cancelled = true\n }\n }\n\n const observer = new ResizeObserver(() => {\n if (startZoom()) {\n observer.disconnect()\n }\n })\n observer.observe(media)\n\n return () => {\n cancelled = true\n observer.disconnect()\n }\n }, [enabled, isPresent, origin])\n\n useEffect(() => {\n const media = mediaRef.current\n if (isPresent) {\n return\n }\n if (!media || !enabled || !isActiveRef.current) {\n safeToRemove?.()\n return\n }\n\n // Re-measure rather than reuse the opening geometry: the gallery may have\n // been swiped, the viewport resized, or the image finally decoded since.\n clearOriginMorph(media)\n // Bring the tile back into its row before measuring it: the gallery may\n // have been paged far past the one on screen when it opened.\n const target = revealReturnTarget(origin)\n const box = media.getBoundingClientRect()\n const morph = box.width > 0 ? measureOriginMorph(media, box, target) : null\n\n const animation = morph\n ? (() => {\n media.style.transformOrigin = 'center'\n media.style.willChange = 'transform'\n return animate(1, 0, {\n ...MEDIA_SPRING,\n onUpdate: progress => {\n paintOriginMorph(media, morph, progress)\n },\n })\n })()\n : animate(media, { opacity: 0 }, MEDIA_FADE)\n\n void animation.then(() => {\n safeToRemove?.()\n })\n }, [enabled, isPresent, origin, safeToRemove])\n\n return mediaRef\n}\n\nexport type LightboxFrameProps = useRender.ComponentProps<'div'>\n\n/**\n * The morph target: the box that grows out of the thumbnail (or the browser's\n * own View Transition) and back. Only the active slide's frame ever\n * registers into the shared `mediaRef` slot or claims the morph attributes —\n * the others sit inert, waiting their turn.\n */\nexport function LightboxFrame({\n children,\n className,\n ref,\n render,\n ...props\n}: LightboxFrameProps): React.ReactElement {\n const slide = useLightboxSlide()\n if (slide === null) {\n throw new Error('Lightbox.Frame must be rendered inside Lightbox.Slide.')\n }\n const { isActive, isNear, item } = slide\n const { appearance, origin, reducedMotion, transition } = useLightboxConfig()\n const { isZoomed } = useLightboxState()\n const { mediaRef } = useLightboxRefs()\n const viewTransition = transition === 'view-transition'\n\n // The morph measures the media in viewport coordinates. The track's resting\n // transform is part of the same render that mounts this frame, so the\n // active frame already sits on screen when this measures it; unlike the\n // scroll-snap track before it, there is no scroll position to park first\n // and no ordering to race.\n\n // Every slide the preload neighbourhood mounts, not only the active one.\n // Gated on `isActive` instead, a slide had no shape until it became the\n // active one and then gained one — two different sizing paths for the same\n // element, so it visibly resized mid-turn while both slides were on\n // screen. `isNear` is already the set whose media is mounted, so this\n // starts no fetch that was not happening anyway.\n const itemThumb = isNear ? resolveThumbSrc(item, appearance?.[item.id]) : undefined\n const itemSrc = isNear ? resolveMediaSrc(item, appearance?.[item.id]) : undefined\n // The shape of this slide's photo, known before it arrives.\n const activeAspect = useMediaAspect(itemThumb, itemSrc)\n // The photo's own resolution: the honest ceiling on how large it should\n // ever be drawn. Upscaling past it only magnifies compression.\n // Held back until the frame has settled on a size: a frame that resizes under\n // a running morph drags the photo away from where the morph is aiming it.\n const frameRef = useOriginZoom(\n origin,\n !reducedMotion && !viewTransition && (!itemThumb || activeAspect !== undefined),\n isActive\n )\n const slideAspect = activeAspect\n\n const defaultProps = {\n children,\n className: cn(\n 'relative flex max-h-full min-h-0',\n 'items-center justify-center',\n // `overflow-hidden` is mechanism, not decoration: it is what clips the\n // media to the frame during the morph. The corner radius that clip\n // follows is the caller's — `origin-morph` reads it off this element, so\n // it has to land here via `className` rather than on a child.\n //\n // It lifts while zoomed. The frame is photo-shaped, so clipping to it\n // would mean magnifying a picture inside a fixed window: the part of the\n // photo you zoomed towards leaves the frame and simply disappears.\n // Released, the enlarged photo runs to the edges of the track, which\n // clips at the viewport — which is the whole screen, and the only\n // boundary a zoom should answer to.\n !isZoomed && 'overflow-hidden',\n // With the shape known the frame can size itself from the slide, which\n // is the only definite box in the chain. Without it the frame has to\n // wait for the photo, and a placeholder inside would be sizing itself\n // against a box that is sizing itself against the placeholder.\n //\n // Both of the slide's axes, via its size container: width follows the\n // slide, and the ceiling on that width is the width this aspect ratio\n // would reach at the slide's full height. Whichever runs out first\n // wins, which is exactly `object-contain`'s rule — but applied to the\n // frame, so the frame *is* the picture rather than a box the picture is\n // letterboxed inside. That matters beyond neatness: everything the\n // frame owns is addressed to its own edges. The morph flies the\n // thumbnail to them, the corner radius is drawn on them, and the\n // full-bleed close area begins outside them — so a frame larger than\n // the photo overshoots the morph, rounds corners nobody can see, and\n // covers taps meant for the close area with bands that look exactly\n // like backdrop.\n slideAspect !== undefined &&\n 'h-auto max-h-[100cqh] w-[100cqw] max-w-[calc(100cqh*var(--a63-lightbox-aspect))]',\n className\n ),\n // Only carried by the active slide, and only when the browser itself owns\n // the transition: a second element sharing the morph's name would strand\n // the browser's snapshot pairing (see `view-transition.ts`'s \"name\n // isolation\").\n ...(isActive && viewTransition ? { [MORPH_TARGET_ATTRIBUTE]: '' } : {}),\n 'data-slot': 'media-lightbox-frame',\n style: {\n ...(slideAspect === undefined\n ? {}\n : { '--a63-lightbox-aspect': slideAspect, aspectRatio: slideAspect }),\n ...(isActive && viewTransition ? { viewTransitionName: MEDIA_VIEW_TRANSITION_NAME } : {}),\n } as CSSProperties,\n }\n\n return useRender({\n defaultTagName: 'div',\n props: mergeProps<'div'>(defaultProps, props),\n ref: [isActive ? mediaRef : null, frameRef, ref ?? null],\n render: render ?? (\n <motion.div\n animate={reducedMotion && isActive ? { opacity: 1 } : undefined}\n initial={reducedMotion && isActive ? { opacity: 0 } : undefined}\n transition={MEDIA_FADE}\n />\n ),\n })\n}\n\nexport type LightboxZoomProps = LightboxZoomOptions & useRender.ComponentProps<'div'>\n\n/**\n * A dedicated layer for the zoom transform: `Frame` above it is the morph\n * target and the FLIP target, and three engines cannot share one `transform`.\n *\n * Its zoom options (`minZoom`, `maxZoom`, ...) are published up to `Content`,\n * which owns the single `useMediaZoom` call the whole gallery shares. Omitting\n * `Zoom` entirely is legal — zoom simply never engages, exactly as omitting\n * `Slides` leaves the swipe gesture unattached.\n */\nexport function LightboxZoom({\n children,\n className,\n doubleTapScale,\n keyboardPanDistance,\n maxZoom,\n minZoom,\n onZoomChange,\n ref,\n render,\n scrollToZoom,\n wheelSensitivity,\n zoomStep,\n ...props\n}: LightboxZoomProps): React.ReactElement {\n const slide = useLightboxSlide()\n if (slide === null) {\n throw new Error('Lightbox.Zoom must be rendered inside Lightbox.Slide.')\n }\n const { isActive, isNear, item } = slide\n const { appearance } = useLightboxConfig()\n const { zoomRef } = useLightboxRefs()\n const registerOptions = useLightboxZoomOptionsRegistry()\n\n // Same gate as `Frame`'s: every mounted slide resolves its own shape, so a\n // slide does not change size at the moment it becomes the active one.\n const itemThumb = isNear ? resolveThumbSrc(item, appearance?.[item.id]) : undefined\n const itemSrc = isNear ? resolveMediaSrc(item, appearance?.[item.id]) : undefined\n const slideAspect = useMediaAspect(itemThumb, itemSrc)\n\n useEffect(() => {\n if (!isActive) {\n return\n }\n registerOptions({\n doubleTapScale,\n keyboardPanDistance,\n maxZoom,\n minZoom,\n onZoomChange,\n scrollToZoom,\n wheelSensitivity,\n zoomStep,\n })\n return () => {\n registerOptions(null)\n }\n }, [\n doubleTapScale,\n isActive,\n keyboardPanDistance,\n maxZoom,\n minZoom,\n onZoomChange,\n registerOptions,\n scrollToZoom,\n wheelSensitivity,\n zoomStep,\n ])\n\n const defaultProps = {\n children,\n className: cn(\n 'relative',\n isActive && 'transform-gpu will-change-transform',\n // Mirrors `Frame`'s own `h-full`: without an explicit size, an\n // absolutely positioned `filled` photo (see `Media`) has nothing to\n // size itself against and collapses this box to zero height.\n slideAspect !== undefined && 'size-full',\n className\n ),\n 'data-slot': 'media-lightbox-zoom',\n }\n\n return useRender({\n defaultTagName: 'div',\n props: mergeProps<'div'>(defaultProps, props),\n ref: [isActive ? zoomRef : null, ref ?? null],\n render,\n })\n}\n\n/**\n * The media itself: an image, a video, or whatever the caller handed over.\n * Mounted only for slides in the preload neighbourhood — a 2880x1920 photo is\n * ~22MB decoded, so a long gallery cannot keep the whole track resident.\n */\nexport function LightboxMedia(): React.ReactElement | null {\n const slide = useLightboxSlide()\n if (slide === null) {\n throw new Error('Lightbox.Media must be rendered inside Lightbox.Slide.')\n }\n const { isActive, isNear, item } = slide\n const { appearance } = useLightboxConfig()\n\n const src = resolveMediaSrc(item, appearance?.[item.id])\n const thumbSrc = resolveThumbSrc(item, appearance?.[item.id])\n // Every mounted slide, not only the active one. `filled` switches the\n // media between filling its frame and sizing itself, and a slide that\n // flipped between the two at the moment it became active resized on\n // screen mid-turn, while both it and the slide it replaced were in view.\n // Slides outside the preload neighbourhood still probe\n // nothing — they render no media at all.\n const aspect = useMediaAspect(isNear ? thumbSrc : undefined, isNear ? src : undefined)\n const filled = aspect !== undefined\n\n if (!isNear || !hasMedia(item, src)) {\n return null\n }\n\n return <SlideMedia active={isActive} filled={filled} item={item} src={src} thumbSrc={thumbSrc} />\n}\n","'use client'\n\nimport { mergeProps } from '@base-ui/react/merge-props'\nimport { useRender } from '@base-ui/react/use-render'\nimport type { ReactNode } from 'react'\nimport type * as React from 'react'\nimport { useLightboxConfig, useLightboxState } from './context'\n\nexport type LightboxCloseProps = useRender.ComponentProps<'button'>\n\n/** Closes the lightbox. */\nexport function LightboxClose({\n className,\n render,\n ...props\n}: LightboxCloseProps): React.ReactElement {\n const { labels } = useLightboxConfig()\n const { close } = useLightboxState()\n\n const defaultProps = {\n 'aria-label': labels.close,\n className,\n 'data-slot': 'media-lightbox-close',\n onClick: close,\n type: 'button' as const,\n }\n\n return useRender({\n defaultTagName: 'button',\n props: mergeProps<'button'>(defaultProps, props),\n render,\n })\n}\n\nexport type LightboxPreviousProps = useRender.ComponentProps<'button'>\n\n/** Steps to the previous slide; disabled on the first item. */\nexport function LightboxPrevious({\n className,\n render,\n ...props\n}: LightboxPreviousProps): React.ReactElement {\n const { labels } = useLightboxConfig()\n const { goTo, index } = useLightboxState()\n const disabled = index <= 0\n\n const defaultProps = {\n 'aria-label': labels.previous,\n className,\n 'data-slot': 'media-lightbox-previous',\n disabled,\n onClick: () => {\n goTo(index - 1)\n },\n type: 'button' as const,\n ...(disabled ? { 'data-disabled': '' } : {}),\n }\n\n return useRender({\n defaultTagName: 'button',\n props: mergeProps<'button'>(defaultProps, props),\n render,\n })\n}\n\nexport type LightboxNextProps = useRender.ComponentProps<'button'>\n\n/** Steps to the next slide; disabled on the last item. */\nexport function LightboxNext({\n className,\n render,\n ...props\n}: LightboxNextProps): React.ReactElement {\n const { labels } = useLightboxConfig()\n const { goTo, index, itemCount } = useLightboxState()\n const disabled = index >= itemCount - 1\n\n const defaultProps = {\n 'aria-label': labels.next,\n className,\n 'data-slot': 'media-lightbox-next',\n disabled,\n onClick: () => {\n goTo(index + 1)\n },\n type: 'button' as const,\n ...(disabled ? { 'data-disabled': '' } : {}),\n }\n\n return useRender({\n defaultTagName: 'button',\n props: mergeProps<'button'>(defaultProps, props),\n render,\n })\n}\n\nexport type LightboxCounterProps = Omit<useRender.ComponentProps<'p'>, 'children'> & {\n children?: (current: number, total: number) => ReactNode\n}\n\n/** The active item's position, e.g. \"3 of 7\". Pass `children` to re-shape it. */\nexport function LightboxCounter({\n children,\n className,\n render,\n ...props\n}: LightboxCounterProps): React.ReactElement {\n const { items, labels } = useLightboxConfig()\n const { index } = useLightboxState()\n const total = items.length\n const current = index + 1\n\n const defaultProps = {\n // \"3 of 7\" is a run of digits either side of a word, which a\n // right-to-left paragraph reorders into \"of 7 3\"; taking the direction\n // from the text itself keeps an English counter readable inside an RTL\n // gallery and lets a translated one read right to left.\n children: children ? children(current, total) : labels.position(index, total),\n className,\n 'data-slot': 'media-lightbox-counter',\n dir: 'auto',\n }\n\n return useRender({\n defaultTagName: 'p',\n props: mergeProps<'p'>(defaultProps, props),\n render,\n })\n}\n\nexport type LightboxCaptionProps = useRender.ComponentProps<'p'>\n\n/** The active item's caption; renders nothing when the item has none. */\nexport function LightboxCaption({\n className,\n render,\n ...props\n}: LightboxCaptionProps): React.ReactElement | null {\n const { items } = useLightboxConfig()\n const { index } = useLightboxState()\n const item = items[index]\n\n const defaultProps = {\n children: item?.caption ?? '',\n className,\n 'data-slot': 'media-lightbox-caption',\n }\n\n // `useRender` is called unconditionally to satisfy the rules of hooks; the\n // element it produces is only returned once the active item has a caption.\n const element = useRender({\n defaultTagName: 'p',\n props: mergeProps<'p'>(defaultProps, props),\n render,\n })\n\n return item?.caption ? element : null\n}\n","'use client'\n\nimport { mergeProps } from '@base-ui/react/merge-props'\nimport { useRender } from '@base-ui/react/use-render'\nimport type * as React from 'react'\nimport { useLightboxConfig, useLightboxState } from './context'\n\nexport type LightboxZoomInProps = useRender.ComponentProps<'button'>\n\n/** Zooms into the active item's media. */\nexport function LightboxZoomIn({\n className,\n render,\n ...props\n}: LightboxZoomInProps): React.ReactElement {\n const { items, labels } = useLightboxConfig()\n const { index, zoomIn } = useLightboxState()\n const item = items[index]\n\n const defaultProps = {\n 'aria-label': item ? labels.zoomIn(item.title) : undefined,\n className,\n 'data-slot': 'media-lightbox-zoom-in',\n onClick: zoomIn,\n type: 'button' as const,\n }\n\n return useRender({\n defaultTagName: 'button',\n props: mergeProps<'button'>(defaultProps, props),\n render,\n })\n}\n\nexport type LightboxZoomOutProps = useRender.ComponentProps<'button'>\n\n/** Zooms back out of the active item's media; disabled while not zoomed. */\nexport function LightboxZoomOut({\n className,\n render,\n ...props\n}: LightboxZoomOutProps): React.ReactElement {\n const { items, labels } = useLightboxConfig()\n const { index, isZoomed, zoomOut } = useLightboxState()\n const item = items[index]\n const disabled = !isZoomed\n\n const defaultProps = {\n 'aria-label': item ? labels.zoomOut(item.title) : undefined,\n className,\n 'data-slot': 'media-lightbox-zoom-out',\n disabled,\n onClick: zoomOut,\n type: 'button' as const,\n ...(disabled ? { 'data-disabled': '' } : {}),\n }\n\n return useRender({\n defaultTagName: 'button',\n props: mergeProps<'button'>(defaultProps, props),\n render,\n })\n}\n","'use client'\n\nimport { mergeProps } from '@base-ui/react/merge-props'\nimport { useRender } from '@base-ui/react/use-render'\nimport { createContext, useContext, useEffect, useRef } from 'react'\nimport type { KeyboardEvent, ReactNode } from 'react'\nimport type * as React from 'react'\nimport { cn } from '../../../lib/cn'\nimport { resolveMediaSrc, resolveThumbSrc } from '../slide-media'\nimport type { MediaLightboxItem } from '../types'\nimport { useLightboxConfig, useLightboxState } from './context'\nimport { useLightboxThumbnailsRegistry } from './thumbnails-registry'\n\nexport interface LightboxThumbnailContextValue {\n item: MediaLightboxItem\n index: number\n isActive: boolean\n}\n\nconst LightboxThumbnailContext = createContext<LightboxThumbnailContextValue | null>(null)\n\nfunction useLightboxThumbnail(): LightboxThumbnailContextValue {\n const value = useContext(LightboxThumbnailContext)\n if (value === null) {\n throw new Error('Lightbox.Thumbnail must be rendered inside Lightbox.Thumbnails.')\n }\n return value\n}\n\nexport type LightboxThumbnailsProps = Omit<useRender.ComponentProps<'div'>, 'children'> & {\n /** Omit to render a default `LightboxThumbnail` per item. */\n children?: (thumbnail: LightboxThumbnailContextValue) => ReactNode\n}\n\n/**\n * A tablist that hosts a `LightboxThumbnail` for every item, reproducing\n * `ThumbnailStrip`'s roving tabindex: arrow keys move within the strip,\n * `Home`/`End` jump to its ends, only the active thumb is tabbable, and it\n * scrolls into view as the gallery turns pages.\n *\n * Registers its presence into the thumbnails registry so `Slide` can point\n * its `aria-labelledby` at the matching thumb.\n */\nexport function LightboxThumbnails({\n children,\n className,\n ref,\n render,\n ...props\n}: LightboxThumbnailsProps): React.ReactElement {\n const { items, labels, reducedMotion } = useLightboxConfig()\n const { goTo, index } = useLightboxState()\n const register = useLightboxThumbnailsRegistry()\n const listRef = useRef<HTMLDivElement>(null)\n\n useEffect(() => {\n register(true)\n return () => {\n register(false)\n }\n }, [register])\n\n // A second read-out of the same page turn the photo is animating, so a\n // hard cut next to a moving photo would read as a glitch.\n useEffect(() => {\n const active = listRef.current?.querySelector<HTMLElement>('[aria-selected=\"true\"]')\n active?.scrollIntoView?.({\n behavior: reducedMotion ? 'auto' : 'smooth',\n block: 'nearest',\n inline: 'center',\n })\n }, [index, reducedMotion])\n\n const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n const moves: Record<string, number> = {\n ArrowLeft: index - 1,\n ArrowRight: index + 1,\n End: items.length - 1,\n Home: 0,\n }\n const next = moves[event.key]\n if (next === undefined) {\n return\n }\n event.preventDefault()\n event.stopPropagation()\n const clamped = Math.min(Math.max(next, 0), items.length - 1)\n goTo(clamped)\n listRef.current?.querySelectorAll<HTMLElement>('[role=\"tab\"]')[clamped]?.focus()\n }\n\n const defaultProps = {\n 'aria-label': labels.thumbnails,\n children: items.map((item, itemIndex) => {\n const value: LightboxThumbnailContextValue = {\n index: itemIndex,\n isActive: itemIndex === index,\n item,\n }\n return (\n <LightboxThumbnailContext.Provider key={item.id} value={value}>\n {children ? children(value) : <LightboxThumbnail />}\n </LightboxThumbnailContext.Provider>\n )\n }),\n className: cn(\n 'flex max-w-full [scrollbar-width:none] gap-1.5 overflow-x-auto snap-x',\n '[&::-webkit-scrollbar]:hidden',\n className\n ),\n 'data-slot': 'media-lightbox-thumbnails',\n onKeyDown: handleKeyDown,\n role: 'tablist' as const,\n }\n\n return useRender({\n defaultTagName: 'div',\n props: mergeProps<'div'>(defaultProps, props),\n ref: [listRef, ref ?? null],\n render,\n })\n}\n\nexport type LightboxThumbnailProps = useRender.ComponentProps<'button'>\n\n/** A single thumbnail tab; identity comes from `LightboxThumbnails` via context. */\nexport function LightboxThumbnail({\n children,\n className,\n render,\n ...props\n}: LightboxThumbnailProps): React.ReactElement {\n const { index: itemIndex, isActive, item } = useLightboxThumbnail()\n const { appearance, labels } = useLightboxConfig()\n const { goTo, itemCount } = useLightboxState()\n\n // A thumbnail-sized file first: this strip draws into a box a few dozen\n // pixels wide, where decoding a wallpaper costs millions of pixels for\n // thousands of pixels of result.\n const appearanceFor = appearance?.[item.id]\n const src =\n resolveThumbSrc(item, appearanceFor) ?? item.poster ?? resolveMediaSrc(item, appearanceFor)\n\n const defaultProps = {\n 'aria-controls': `a63-media-lightbox-slide-${item.id}`,\n 'aria-label': `${item.title} — ${labels.position(itemIndex, itemCount)}`,\n 'aria-selected': isActive,\n children:\n children ??\n (src ? (\n <img\n alt=\"\"\n className=\"size-full object-cover\"\n decoding=\"async\"\n draggable={false}\n loading=\"lazy\"\n src={src}\n />\n ) : null),\n className,\n ...(isActive ? { 'data-active': '' } : {}),\n 'data-index': itemIndex,\n 'data-slot': 'media-lightbox-thumbnail',\n id: `a63-media-lightbox-thumb-${item.id}`,\n onClick: () => {\n goTo(itemIndex)\n },\n role: 'tab' as const,\n tabIndex: isActive ? 0 : -1,\n type: 'button' as const,\n }\n\n return useRender({\n defaultTagName: 'button',\n props: mergeProps<'button'>(defaultProps, props),\n render,\n })\n}\n","'use client'\n\nimport { mergeProps } from '@base-ui/react/merge-props'\nimport { useRender } from '@base-ui/react/use-render'\nimport { Moon, Sun } from 'lucide-react'\nimport type * as React from 'react'\nimport { DestinationIndicator, DestinationLink } from '../../../components/destination-link'\nimport { useLightboxConfig, useLightboxState } from './context'\n\nfunction isExternalHref(href: string): boolean {\n return /^https?:\\/\\//i.test(href)\n}\n\nexport type LightboxAppearanceToggleProps = useRender.ComponentProps<'button'>\n\n/**\n * Switches the active item between its light and dark source. Renders\n * nothing unless the item has both variants and the caller wired\n * `onAppearanceChange`.\n */\nexport function LightboxAppearanceToggle({\n className,\n render,\n ...props\n}: LightboxAppearanceToggleProps): React.ReactElement | null {\n const { appearance, items, labels, onAppearanceChange } = useLightboxConfig()\n const { index } = useLightboxState()\n const item = items[index]\n const canToggle = Boolean(item?.lightSrc && item.darkSrc && onAppearanceChange)\n\n const isDark = (appearance?.[item?.id ?? ''] ?? 'dark') !== 'light'\n const target = isDark ? 'light' : 'dark'\n\n const defaultProps = {\n 'aria-label': item ? labels.appearance(item.title, target) : undefined,\n children: isDark ? (\n <Sun aria-hidden className=\"size-5\" />\n ) : (\n <Moon aria-hidden className=\"size-5\" />\n ),\n className,\n 'data-slot': 'media-lightbox-appearance-toggle',\n onClick: () => {\n if (item) {\n onAppearanceChange?.(item.id, target)\n }\n },\n type: 'button' as const,\n }\n\n // `useRender` is called unconditionally to satisfy the rules of hooks; the\n // element it produces is only returned once the active item has both\n // variants and the caller wired `onAppearanceChange`.\n const element = useRender({\n defaultTagName: 'button',\n props: mergeProps<'button'>(defaultProps, props),\n render,\n })\n\n return canToggle ? element : null\n}\n\nexport type LightboxDestinationProps = Omit<\n React.ComponentProps<typeof DestinationLink>,\n 'href' | 'kind'\n>\n\n/**\n * A secondary destination link for the active item; renders nothing when it\n * has no `href`.\n */\nexport function LightboxDestination({\n children,\n className,\n // Internal links always render through `item.renderHref`; a caller-supplied\n // `render` would silently be dropped by `DestinationLink` for external\n // links anyway, so it is deliberately not accepted here.\n render: _render,\n ...props\n}: LightboxDestinationProps): React.ReactElement | null {\n const { items, labels } = useLightboxConfig()\n const { index } = useLightboxState()\n const item = items[index]\n\n if (!item?.href) {\n return null\n }\n\n const external = isExternalHref(item.href)\n\n // `DestinationLink` owns `data-slot=\"destination-link\"` from its own\n // contract (see `mergeProps` order in `destination-link.tsx`, where its\n // internal slot always wins), so this wrapper does not fight it with a\n // second one.\n return (\n <DestinationLink\n aria-label={labels.openDestination(item.title)}\n className={className}\n href={item.href}\n kind={external ? 'external' : 'internal'}\n render={external ? undefined : item.renderHref}\n {...props}\n >\n {children ?? (\n <DestinationIndicator className=\"size-5\" kind={external ? 'external' : 'internal'} />\n )}\n </DestinationLink>\n )\n}\n","'use client'\n\n/**\n * The public surface of the headless lightbox parts.\n *\n * `zoom-registry.ts`, `thumbnails-registry.ts`, and `zoom-options.ts` are\n * internal wiring between parts and are deliberately not re-exported here —\n * see their own file headers.\n */\nexport type { LightboxConfig, LightboxSlide as LightboxSlideValue, LightboxState } from './context'\nexport {\n useLightboxConfig,\n useLightboxSlide,\n useLightboxState,\n useOptionalLightboxConfig,\n} from './context'\nexport type { LightboxRefs } from './refs'\nexport { useLightboxRefs } from './refs'\nexport type { LightboxPortalProps, LightboxRootProps } from './root'\nexport { LightboxPortal, LightboxRoot } from './root'\nexport type { LightboxBackdropProps, LightboxContentProps, LightboxStatusProps } from './content'\nexport { LightboxBackdrop, LightboxContent, LightboxStatus } from './content'\nexport type { LightboxSlideProps, LightboxSlidesProps, LightboxViewportProps } from './slides'\nexport { LightboxSlide, LightboxSlides, LightboxViewport } from './slides'\nexport type { LightboxFrameProps, LightboxZoomProps } from './frame'\nexport { LightboxFrame, LightboxMedia, LightboxZoom } from './frame'\nexport type {\n LightboxCaptionProps,\n LightboxCloseProps,\n LightboxCounterProps,\n LightboxNextProps,\n LightboxPreviousProps,\n} from './chrome'\nexport {\n LightboxCaption,\n LightboxClose,\n LightboxCounter,\n LightboxNext,\n LightboxPrevious,\n} from './chrome'\nexport type { LightboxZoomInProps, LightboxZoomOutProps } from './zoom-controls'\nexport { LightboxZoomIn, LightboxZoomOut } from './zoom-controls'\nexport type {\n LightboxThumbnailContextValue,\n LightboxThumbnailProps,\n LightboxThumbnailsProps,\n} from './thumbnails'\nexport { LightboxThumbnail, LightboxThumbnails } from './thumbnails'\nexport type { LightboxAppearanceToggleProps, LightboxDestinationProps } from './extras'\nexport { LightboxAppearanceToggle, LightboxDestination } from './extras'\n\nimport {\n LightboxCaption,\n LightboxClose,\n LightboxCounter,\n LightboxNext,\n LightboxPrevious,\n} from './chrome'\nimport { LightboxBackdrop, LightboxContent, LightboxStatus } from './content'\nimport { LightboxAppearanceToggle, LightboxDestination } from './extras'\nimport { LightboxFrame, LightboxMedia, LightboxZoom } from './frame'\nimport { LightboxPortal, LightboxRoot } from './root'\nimport { LightboxSlide, LightboxSlides, LightboxViewport } from './slides'\nimport { LightboxThumbnail, LightboxThumbnails } from './thumbnails'\nimport { LightboxZoomIn, LightboxZoomOut } from './zoom-controls'\n\n/**\n * Every headless lightbox part, namespaced the way `Dialog.Root` /\n * `Dialog.Trigger` are in Radix / Base UI. The next task composes exactly\n * this set to rebuild the monolith's default appearance.\n */\nexport const Lightbox = {\n AppearanceToggle: LightboxAppearanceToggle,\n Backdrop: LightboxBackdrop,\n Caption: LightboxCaption,\n Close: LightboxClose,\n Content: LightboxContent,\n Counter: LightboxCounter,\n Destination: LightboxDestination,\n Frame: LightboxFrame,\n Media: LightboxMedia,\n Next: LightboxNext,\n Portal: LightboxPortal,\n Previous: LightboxPrevious,\n Root: LightboxRoot,\n Slide: LightboxSlide,\n Slides: LightboxSlides,\n Status: LightboxStatus,\n Thumbnail: LightboxThumbnail,\n Thumbnails: LightboxThumbnails,\n Viewport: LightboxViewport,\n Zoom: LightboxZoom,\n ZoomIn: LightboxZoomIn,\n ZoomOut: LightboxZoomOut,\n} as const\n// Types that appear in the parts' public props. Only the types leave these\n// modules; the registries and option plumbing stay internal.\nexport type { LightboxTiming } from '../timing'\nexport type {\n MediaLightboxAppearance,\n MediaLightboxItem,\n MediaLightboxItemKind,\n MediaLightboxLabels,\n MediaLightboxTransition,\n MediaLightboxVideoSource,\n MediaLightboxVideoTrack,\n} from '../types'\nexport type { LightboxZoomOptions } from './zoom-options'\n"]}