{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "dome-photo-sphere",
  "title": "Dome Photo Sphere",
  "description": "An immersive photo dome you look around from the inside: drag with inertia, an idle spin, tiles that brighten toward the centre of view, a ticking compass readout, and a lightbox that flies out of the tile you tap.",
  "dependencies": [
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/dome-photo-sphere/dome-photo-sphere.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nfunction cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs));\n}\n\nexport interface DomePhoto {\n  src: string;\n  alt?: string;\n}\n\nexport type DomePhotoSphereTheme = \"dark\" | \"light\";\n\nexport interface DomePhotoSphereProps extends Omit<React.ComponentPropsWithoutRef<\"div\">, \"children\"> {\n  photos?: DomePhoto[];\n  theme?: DomePhotoSphereTheme;\n  /** Height of the viewport in px. */\n  height?: number;\n  /** Sphere radius in px on wide screens; it shrinks with narrow containers. */\n  radius?: number;\n  /** Angular size of one tile in degrees. */\n  tileAngle?: number;\n  /** How far up and down the view can tilt, in degrees. */\n  maxPitch?: number;\n  /** Idle spin in degrees per second; 0 turns it off. */\n  autoRotate?: number;\n  dragSensitivity?: number;\n  /** 0–1, how quickly the view catches up with the pointer. */\n  smoothing?: number;\n  borderRadius?: number;\n  /** Opacity of tiles toward the edge of the view. */\n  dimOpacity?: number;\n  showCompass?: boolean;\n  enableLightbox?: boolean;\n}\n\nconst PALETTES = {\n  dark: {\n    background: \"#080808\",\n    vignette: \"radial-gradient(ellipse 70% 75% at 50% 50%, rgba(8,8,8,0) 45%, rgba(8,8,8,0.92) 100%)\",\n    tile: \"#141414\",\n    tickColor: \"rgba(255,255,255,0.25)\",\n    activeTick: \"#FFFFFF\",\n    text: \"rgba(255,255,255,0.55)\",\n    hoverRing: \"rgba(255,255,255,0.85)\",\n    lightboxBackground: \"rgba(8,8,8,0.95)\",\n    controlColor: \"rgba(255,255,255,0.8)\",\n    emptyText: \"rgba(255,255,255,0.4)\",\n    emptyBorder: \"1.5px dashed rgba(255,255,255,0.15)\",\n  },\n  light: {\n    background: \"#F5F5F3\",\n    vignette: \"radial-gradient(ellipse 70% 75% at 50% 50%, rgba(245,245,243,0) 45%, rgba(245,245,243,0.92) 100%)\",\n    tile: \"#E6E6E3\",\n    tickColor: \"rgba(0,0,0,0.2)\",\n    activeTick: \"#000000\",\n    text: \"rgba(0,0,0,0.5)\",\n    hoverRing: \"rgba(0,0,0,0.8)\",\n    lightboxBackground: \"rgba(255,255,255,0.96)\",\n    controlColor: \"rgba(0,0,0,0.75)\",\n    emptyText: \"rgba(0,0,0,0.4)\",\n    emptyBorder: \"1.5px dashed rgba(0,0,0,0.15)\",\n  },\n} as const;\n\nconst DEFAULT_PHOTOS: DomePhoto[] = [\"23\", \"35\", \"26\", \"36\", \"29\", \"21\", \"24\", \"37\", \"31\", \"12\", \"47\", \"28\", \"22\", \"33\", \"38\", \"48\", \"30\", \"27\", \"34\", \"32\"].map((n) => ({ src: `/demo/${n}.webp` }));\n\nconst DEG = Math.PI / 180;\nconst clamp = (v: number, min: number, max: number) => Math.min(Math.max(v, min), max);\n\ninterface Tile {\n  lon: number;\n  lat: number;\n  w: number;\n  h: number;\n  photo: number;\n  transform: string;\n}\n\n/** Rows of tiles on the inside of the sphere; rows nearer the poles hold fewer, so every tile stays roughly square. */\nfunction buildTiles(count: number, radius: number, tileAngle: number, maxPitch: number): Tile[] {\n  const tiles: Tile[] = [];\n  const rowsEachWay = Math.ceil((maxPitch + 34) / tileAngle);\n  const h = 2 * radius * Math.sin((tileAngle * DEG) / 2) * 0.9;\n  for (let r = -rowsEachWay; r <= rowsEachWay; r++) {\n    const lat = r * tileAngle;\n    if (Math.abs(lat) > 80) continue;\n    const cols = Math.max(6, Math.round((360 / tileAngle) * Math.cos(lat * DEG)));\n    const step = 360 / cols;\n    const w = 2 * radius * Math.sin((step * DEG) / 2) * Math.cos(lat * DEG) * 0.9;\n    for (let c = 0; c < cols; c++) {\n      const lon = c * step + (r % 2 ? step / 2 : 0);\n      tiles.push({\n        lon,\n        lat,\n        w,\n        h,\n        // Pick by longitude bin and row with co-prime strides, so side, vertical and diagonal neighbours differ.\n        photo: (((Math.floor((lon + 0.001) / tileAngle) * 7 + (r + 50) * 9) % Math.max(count, 1)) + Math.max(count, 1)) % Math.max(count, 1),\n        // Fixed precision so the server and browser print the same string.\n        transform: `rotateY(${lon.toFixed(3)}deg) rotateX(${lat.toFixed(3)}deg) translateZ(${(-radius).toFixed(2)}px)`,\n      });\n    }\n  }\n  return tiles;\n}\n\n/** Where a tile's centre points once the view is turned: f is how far it faces the viewer (1 = dead ahead). */\nfunction project(tile: Tile, yaw: number, pitch: number) {\n  const phi = (tile.lon + yaw) * DEG;\n  const lat = tile.lat * DEG;\n  const p = pitch * DEG;\n  const x = -Math.sin(phi) * Math.cos(lat);\n  const y0 = Math.sin(lat);\n  const z0 = -Math.cos(phi) * Math.cos(lat);\n  const y = Math.cos(p) * y0 - Math.sin(p) * z0;\n  const f = -(Math.sin(p) * y0 + Math.cos(p) * z0);\n  return { x, y, f };\n}\n\nfunction tileOpacity(f: number, dim: number) {\n  const t = clamp((f - 0.72) / 0.24, 0, 1);\n  return dim + (1 - dim) * t * t * (3 - 2 * t);\n}\n\nfunction sphereTransform(radius: number, yaw: number, pitch: number) {\n  return `translateZ(${radius.toFixed(2)}px) rotateX(${pitch.toFixed(3)}deg) rotateY(${yaw.toFixed(3)}deg)`;\n}\n\nconst wrap360 = (deg: number) => ((deg % 360) + 360) % 360;\n\nexport function DomePhotoSphere({\n  photos = DEFAULT_PHOTOS,\n  theme = \"dark\",\n  height = 560,\n  radius = 640,\n  tileAngle = 15,\n  maxPitch = 18,\n  autoRotate = 4,\n  dragSensitivity = 1,\n  smoothing = 0.09,\n  borderRadius = 3,\n  dimOpacity = 0.3,\n  showCompass = true,\n  enableLightbox = true,\n  className,\n  ...props\n}: DomePhotoSphereProps) {\n  const palette = PALETTES[theme];\n  const rootRef = React.useRef<HTMLDivElement>(null);\n  const stageRef = React.useRef<HTMLDivElement>(null);\n  const tileRefs = React.useRef<(HTMLDivElement | null)[]>([]);\n  const compassRef = React.useRef<HTMLDivElement>(null);\n  const readoutRef = React.useRef<HTMLSpanElement>(null);\n\n  const [r, setR] = React.useState(radius);\n  const tiles = React.useMemo(() => buildTiles(photos.length, r, tileAngle, maxPitch), [photos.length, r, tileAngle, maxPitch]);\n\n  const view = React.useRef({ yaw: 0, pitch: 0, tYaw: 0, tPitch: 0, vYaw: 0, vPitch: 0 });\n  const drag = React.useRef({ active: false, moved: false, x: 0, y: 0, lastT: 0, tile: null as number | null });\n  const idleSince = React.useRef(0);\n  const hovered = React.useRef<number | null>(null);\n  const halfView = React.useRef({ w: 0.9, h: 0.5 });\n  const wakeRef = React.useRef<() => void>(() => {});\n  const optsRef = React.useRef({ autoRotate, dragSensitivity, smoothing, maxPitch, dimOpacity, r, tiles, ring: palette.hoverRing as string });\n  React.useEffect(() => {\n    optsRef.current = { autoRotate, dragSensitivity, smoothing, maxPitch, dimOpacity, r, tiles, ring: palette.hoverRing };\n    wakeRef.current();\n  }, [autoRotate, dragSensitivity, smoothing, maxPitch, dimOpacity, r, tiles, palette.hoverRing]);\n\n  const [lightbox, setLightbox] = React.useState<{ index: number; from: DOMRect; ratio: number } | null>(null);\n  const [opened, setOpened] = React.useState(false);\n  const dialogRef = React.useRef<HTMLDivElement>(null);\n  const closeButtonRef = React.useRef<HTMLButtonElement>(null);\n  const lastFocusedRef = React.useRef<HTMLElement | null>(null);\n\n  // The radius follows the container so a phone still sees three or four tiles across.\n  React.useEffect(() => {\n    const el = stageRef.current;\n    if (!el) return;\n    const update = () => {\n      const next = Math.round(clamp(el.clientWidth * 0.62, 340, radius));\n      setR(next);\n      halfView.current = { w: el.clientWidth / 2 / next, h: el.clientHeight / 2 / next };\n    };\n    update();\n    const observer = new ResizeObserver(update);\n    observer.observe(el);\n    return () => observer.disconnect();\n  }, [radius]);\n\n  React.useEffect(() => {\n    let raf: number | null = null;\n    let last = 0;\n    let inView = true;\n\n    const paint = () => {\n      const { r, tiles, dimOpacity } = optsRef.current;\n      const v = view.current;\n      // Each tile carries the whole chain (view turn + its own spot), so no nested preserve-3d is needed:\n      // WebKit flattens a zero-size preserve-3d sphere, which tore the dome apart on iPhone.\n      const view3d = sphereTransform(r, v.yaw, v.pitch);\n      const { w, h } = halfView.current;\n      tiles.forEach((tile, i) => {\n        const el = tileRefs.current[i];\n        if (!el) return;\n        const { x, y, f } = project(tile, v.yaw, v.pitch);\n        // Cull anything behind or well outside the view: it would only cost paint (and can glitch near the eye plane).\n        const off = f < 0.2 || Math.abs(x) / f > w + 0.45 || Math.abs(y) / f > h + 0.45;\n        el.style.visibility = off ? \"hidden\" : \"visible\";\n        if (!off) el.style.transform = `${view3d} ${tile.transform}`;\n        if (!off) el.style.opacity = (hovered.current === i ? 1 : tileOpacity(f, dimOpacity)).toFixed(3);\n        const face = el.firstElementChild as HTMLElement | null;\n        if (face) face.style.boxShadow = hovered.current === i ? `0 0 0 1px ${optsRef.current.ring}` : \"\";\n      });\n      const heading = wrap360(v.yaw);\n      // 8px per 5° tick, a long tick every 15°: shifting by heading mod 15 keeps the pattern seamless.\n      if (compassRef.current) compassRef.current.style.transform = `translateX(${(-(heading % 15) * 1.6).toFixed(2)}px)`;\n      if (readoutRef.current) readoutRef.current.textContent = `${String(Math.round(heading) % 360).padStart(3, \"0\")}°`;\n    };\n\n    const tick = (now: number) => {\n      const dt = last ? Math.min((now - last) / 1000, 0.05) : 1 / 60;\n      last = now;\n      const { autoRotate, smoothing, maxPitch } = optsRef.current;\n      const v = view.current;\n      const d = drag.current;\n      if (!d.active) {\n        // Inertia after a flick, then the idle spin takes over again.\n        v.tYaw += v.vYaw * dt;\n        v.tPitch = clamp(v.tPitch + v.vPitch * dt, -maxPitch, maxPitch);\n        const decay = Math.pow(0.04, dt);\n        v.vYaw *= decay;\n        v.vPitch *= decay;\n        if (autoRotate && now - idleSince.current > 1600) v.tYaw -= autoRotate * dt;\n      }\n      const k = 1 - Math.pow(1 - smoothing, dt * 60);\n      v.yaw += (v.tYaw - v.yaw) * k;\n      v.pitch += (v.tPitch - v.pitch) * k;\n      paint();\n      const settled = !d.active && !autoRotate && Math.abs(v.tYaw - v.yaw) < 0.01 && Math.abs(v.tPitch - v.pitch) < 0.01 && Math.abs(v.vYaw) < 0.01;\n      raf = inView && !settled ? requestAnimationFrame(tick) : null;\n      if (raf === null) last = 0;\n    };\n\n    wakeRef.current = () => {\n      if (raf === null && inView) raf = requestAnimationFrame(tick);\n    };\n    paint();\n    raf = requestAnimationFrame(tick);\n\n    const observer = new IntersectionObserver(([entry]) => {\n      inView = entry.isIntersecting;\n      if (inView) wakeRef.current();\n    });\n    if (rootRef.current) observer.observe(rootRef.current);\n    return () => {\n      if (raf) cancelAnimationFrame(raf);\n      observer.disconnect();\n    };\n  }, []);\n\n  // Drag to look around; a tap without movement opens the tile under the pointer.\n  React.useEffect(() => {\n    const el = stageRef.current;\n    if (!el) return;\n    const onDown = (e: PointerEvent) => {\n      if (e.button !== 0) return;\n      const tileEl = (e.target as HTMLElement).closest<HTMLElement>(\"[data-tile]\");\n      drag.current = { active: true, moved: false, x: e.clientX, y: e.clientY, lastT: e.timeStamp, tile: tileEl ? Number(tileEl.dataset.tile) : null };\n      view.current.vYaw = 0;\n      view.current.vPitch = 0;\n      el.setPointerCapture(e.pointerId);\n      wakeRef.current();\n    };\n    const onMove = (e: PointerEvent) => {\n      const d = drag.current;\n      if (!d.active) {\n        if (e.pointerType !== \"mouse\") return;\n        const tileEl = (e.target as HTMLElement).closest<HTMLElement>(\"[data-tile]\");\n        const next = tileEl ? Number(tileEl.dataset.tile) : null;\n        if (next !== hovered.current) {\n          hovered.current = next;\n          wakeRef.current();\n        }\n        return;\n      }\n      const dx = e.clientX - d.x;\n      const dy = e.clientY - d.y;\n      if (!d.moved && Math.hypot(dx, dy) < 5) return;\n      if (!d.moved) {\n        d.moved = true;\n        el.style.cursor = \"grabbing\";\n        hovered.current = null;\n      }\n      const { dragSensitivity, maxPitch, r } = optsRef.current;\n      // One pixel of drag turns the view by the angle a pixel spans at the centre.\n      const perPx = (57.3 / r) * dragSensitivity;\n      const v = view.current;\n      // Grab-and-pull: the photos follow the pointer.\n      v.tYaw -= dx * perPx;\n      v.tPitch = clamp(v.tPitch + dy * perPx, -maxPitch, maxPitch);\n      const dt = Math.max((e.timeStamp - d.lastT) / 1000, 0.008);\n      v.vYaw = v.vYaw * 0.5 + ((-dx * perPx) / dt) * 0.5;\n      v.vPitch = v.vPitch * 0.5 + ((dy * perPx) / dt) * 0.5;\n      d.x = e.clientX;\n      d.y = e.clientY;\n      d.lastT = e.timeStamp;\n      wakeRef.current();\n    };\n    const onUp = (e: PointerEvent) => {\n      const d = drag.current;\n      if (!d.active) return;\n      d.active = false;\n      el.style.cursor = \"\";\n      idleSince.current = performance.now();\n      if (e.timeStamp - d.lastT > 80) {\n        view.current.vYaw = 0;\n        view.current.vPitch = 0;\n      }\n      if (!d.moved && d.tile !== null) open(d.tile);\n      wakeRef.current();\n    };\n    const onLeave = () => {\n      if (hovered.current !== null) {\n        hovered.current = null;\n        wakeRef.current();\n      }\n    };\n    el.addEventListener(\"pointerdown\", onDown);\n    el.addEventListener(\"pointermove\", onMove);\n    el.addEventListener(\"pointerup\", onUp);\n    el.addEventListener(\"pointercancel\", onUp);\n    el.addEventListener(\"pointerleave\", onLeave);\n    return () => {\n      el.removeEventListener(\"pointerdown\", onDown);\n      el.removeEventListener(\"pointermove\", onMove);\n      el.removeEventListener(\"pointerup\", onUp);\n      el.removeEventListener(\"pointercancel\", onUp);\n      el.removeEventListener(\"pointerleave\", onLeave);\n    };\n    // open is stable enough: it only reads refs and props through optsRef/tileRefs.\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, [enableLightbox]);\n\n  function open(i: number) {\n    if (!enableLightbox) return;\n    const el = tileRefs.current[i];\n    const img = el?.querySelector(\"img\");\n    if (!el || !img) return;\n    const ratio = img.naturalWidth && img.naturalHeight ? img.naturalWidth / img.naturalHeight : 1;\n    setOpened(false);\n    setLightbox({ index: optsRef.current.tiles[i].photo, from: el.getBoundingClientRect(), ratio });\n  }\n\n  // Let the flying image render at the tile's rect for one frame, then move it to the centre.\n  React.useEffect(() => {\n    if (!lightbox || opened) return;\n    const id = requestAnimationFrame(() => requestAnimationFrame(() => setOpened(true)));\n    return () => cancelAnimationFrame(id);\n  }, [lightbox, opened]);\n\n  React.useEffect(() => {\n    if (!lightbox) {\n      lastFocusedRef.current?.focus();\n      lastFocusedRef.current = null;\n      return;\n    }\n    if (!lastFocusedRef.current) lastFocusedRef.current = document.activeElement as HTMLElement | null;\n    closeButtonRef.current?.focus();\n  }, [lightbox]);\n\n  const stepLightbox = React.useCallback(\n    (dir: 1 | -1) => setLightbox((cur) => (cur ? { ...cur, index: (cur.index + dir + photos.length) % photos.length, from: new DOMRect(0, 0, 0, 0) } : cur)),\n    [photos.length],\n  );\n\n  React.useEffect(() => {\n    if (!lightbox) return;\n    const onKey = (e: KeyboardEvent) => {\n      if (e.key === \"Escape\") setLightbox(null);\n      else if (e.key === \"ArrowRight\") stepLightbox(1);\n      else if (e.key === \"ArrowLeft\") stepLightbox(-1);\n      else if (e.key === \"Tab\") {\n        const focusables = Array.from(dialogRef.current?.querySelectorAll<HTMLElement>(\"button\") ?? []);\n        if (focusables.length === 0) return;\n        const first = focusables[0];\n        const last = focusables[focusables.length - 1];\n        if (e.shiftKey && document.activeElement === first) {\n          e.preventDefault();\n          last.focus();\n        } else if (!e.shiftKey && document.activeElement === last) {\n          e.preventDefault();\n          first.focus();\n        }\n      }\n    };\n    window.addEventListener(\"keydown\", onKey);\n    return () => window.removeEventListener(\"keydown\", onKey);\n  }, [lightbox, stepLightbox]);\n\n  const onKeyDown = (e: React.KeyboardEvent) => {\n    if (lightbox) return;\n    const v = view.current;\n    if (e.key === \"ArrowLeft\") v.tYaw -= tileAngle;\n    else if (e.key === \"ArrowRight\") v.tYaw += tileAngle;\n    else if (e.key === \"ArrowUp\") v.tPitch = clamp(v.tPitch + tileAngle * 0.7, -maxPitch, maxPitch);\n    else if (e.key === \"ArrowDown\") v.tPitch = clamp(v.tPitch - tileAngle * 0.7, -maxPitch, maxPitch);\n    else if (e.key === \"Enter\" || e.key === \" \") {\n      // Open whichever tile sits closest to the middle of the view.\n      let best = -1;\n      let bestF = -2;\n      tiles.forEach((t, i) => {\n        const { f } = project(t, v.yaw, v.pitch);\n        if (f > bestF) {\n          bestF = f;\n          best = i;\n        }\n      });\n      if (best >= 0) open(best);\n    } else return;\n    e.preventDefault();\n    idleSince.current = performance.now();\n    wakeRef.current();\n  };\n\n  if (photos.length === 0) {\n    return (\n      <div className={cn(\"flex h-full w-full items-center justify-center rounded-xl\", className)} style={{ minHeight: 300, background: palette.background, border: palette.emptyBorder }} {...props}>\n        <span className=\"text-center text-sm leading-[1.6]\" style={{ color: palette.emptyText }}>\n          Add photos\n        </span>\n      </div>\n    );\n  }\n\n  // Final lightbox rect: the photo contained in 82% x 78% of the window.\n  const target = (() => {\n    if (!lightbox || typeof window === \"undefined\") return null;\n    const maxW = window.innerWidth * 0.82;\n    const maxH = window.innerHeight * 0.78;\n    const w = Math.min(maxW, maxH * lightbox.ratio);\n    const h = w / lightbox.ratio;\n    return { left: (window.innerWidth - w) / 2, top: (window.innerHeight - h) / 2 - 12, width: w, height: h };\n  })();\n  const from = lightbox && lightbox.from.width > 0 ? lightbox.from : null;\n  const flying = lightbox && target ? (opened || !from ? target : { left: from.left, top: from.top, width: from.width, height: from.height }) : null;\n  const ticks = Array.from({ length: 24 }, (_, i) => i);\n\n  return (\n    <div\n      ref={rootRef}\n      className={cn(\"relative w-full overflow-hidden outline-none select-none\", className)}\n      style={{ height, background: palette.background }}\n      tabIndex={0}\n      role=\"region\"\n      aria-roledescription=\"photo sphere\"\n      aria-label=\"Photo sphere. Drag or use the arrow keys to look around, Enter to open the photo in the middle.\"\n      onKeyDown={onKeyDown}\n      {...props}\n    >\n      <div ref={stageRef} className=\"absolute inset-0 cursor-grab touch-none\" style={{ perspective: `${r}px`, perspectiveOrigin: \"50% 50%\" }}>\n        {tiles.map((tile, i) => {\n          const { x, y, f } = project(tile, 0, 0);\n          const off = f < 0.2 || Math.abs(x) / f > 1.4 || Math.abs(y) / f > 1;\n          return (\n            <div\n              key={i}\n              ref={(el) => {\n                tileRefs.current[i] = el;\n              }}\n              data-tile={i}\n              className=\"absolute top-1/2 left-1/2\"\n              style={{\n                width: tile.w,\n                height: tile.h,\n                marginLeft: -tile.w / 2,\n                marginTop: -tile.h / 2,\n                transform: `${sphereTransform(r, 0, 0)} ${tile.transform}`,\n                visibility: off ? \"hidden\" : \"visible\",\n                opacity: off ? 0 : Number(tileOpacity(f, dimOpacity).toFixed(3)),\n                cursor: enableLightbox ? \"pointer\" : undefined,\n              }}\n            >\n              <div className=\"h-full w-full overflow-hidden\" style={{ borderRadius, background: palette.tile }}>\n                <img src={photos[tile.photo].src} alt={photos[tile.photo].alt || \"\"} draggable={false} decoding=\"async\" className=\"pointer-events-none block h-full w-full object-cover\" />\n              </div>\n            </div>\n          );\n        })}\n      </div>\n\n      <div className=\"pointer-events-none absolute inset-0\" style={{ background: palette.vignette }} />\n\n      {showCompass && (\n        <div className=\"pointer-events-none absolute inset-x-0 bottom-5 flex flex-col items-center gap-2\">\n          <div\n            className=\"relative h-5 w-[168px] overflow-hidden\"\n            style={{ maskImage: \"linear-gradient(90deg, transparent, #000 30%, #000 70%, transparent)\", WebkitMaskImage: \"linear-gradient(90deg, transparent, #000 30%, #000 70%, transparent)\" }}\n          >\n            <div ref={compassRef} className=\"absolute top-0 flex h-full items-end\" style={{ left: 3 }}>\n              {ticks.map((i) => (\n                <span key={i} className=\"block shrink-0\" style={{ width: 1, marginRight: 7, height: i % 3 === 0 ? 12 : 7, background: palette.tickColor }} />\n              ))}\n            </div>\n            <span className=\"absolute bottom-0 left-1/2 block\" style={{ width: 1, height: 20, background: palette.activeTick, transform: \"translateX(-0.5px)\" }} />\n          </div>\n          <span ref={readoutRef} className=\"text-[10px] tracking-[0.18em] tabular-nums\" style={{ color: palette.text }}>\n            000°\n          </span>\n        </div>\n      )}\n\n      {enableLightbox &&\n        lightbox &&\n        flying &&\n        createPortal(\n          <div\n            ref={dialogRef}\n            onClick={() => setLightbox(null)}\n            role=\"dialog\"\n            aria-modal=\"true\"\n            aria-label=\"Photo preview\"\n            className=\"fixed inset-0 z-[999999] transition-[background-color] duration-500\"\n            style={{ backgroundColor: opened || !from ? palette.lightboxBackground : \"rgba(0,0,0,0)\" }}\n          >\n            {from ? (\n              <img\n                src={photos[lightbox.index].src}\n                alt={photos[lightbox.index].alt || \"\"}\n                onClick={(e) => e.stopPropagation()}\n                draggable={false}\n                className=\"fixed object-cover\"\n                style={{\n                  ...flying,\n                  borderRadius: opened ? 4 : borderRadius,\n                  boxShadow: \"0 20px 60px rgba(0,0,0,0.6)\",\n                  transition:\n                    \"left 0.55s cubic-bezier(0.22,1,0.36,1), top 0.55s cubic-bezier(0.22,1,0.36,1), width 0.55s cubic-bezier(0.22,1,0.36,1), height 0.55s cubic-bezier(0.22,1,0.36,1), border-radius 0.55s\",\n                }}\n              />\n            ) : (\n              <div className=\"pointer-events-none absolute inset-0 flex items-center justify-center pb-6\">\n                <img\n                  src={photos[lightbox.index].src}\n                  alt={photos[lightbox.index].alt || \"\"}\n                  onClick={(e) => e.stopPropagation()}\n                  draggable={false}\n                  className=\"pointer-events-auto max-w-[82%] object-contain\"\n                  style={{ maxHeight: \"78%\", borderRadius: 4, boxShadow: \"0 20px 60px rgba(0,0,0,0.6)\" }}\n                />\n              </div>\n            )}\n            <div className=\"transition-opacity duration-300\" style={{ opacity: opened || !from ? 1 : 0 }}>\n              <button\n                ref={closeButtonRef}\n                onClick={(e) => {\n                  e.stopPropagation();\n                  setLightbox(null);\n                }}\n                aria-label=\"Close\"\n                className=\"absolute top-6 right-8 h-10 w-10 cursor-pointer border-0 bg-transparent text-[28px] leading-none\"\n                style={{ color: palette.controlColor }}\n              >\n                ×\n              </button>\n              {photos.length > 1 && (\n                <>\n                  <button\n                    onClick={(e) => {\n                      e.stopPropagation();\n                      stepLightbox(-1);\n                    }}\n                    aria-label=\"Previous\"\n                    className=\"absolute top-1/2 left-6 h-11 w-11 -translate-y-1/2 cursor-pointer border-0 bg-transparent text-[32px]\"\n                    style={{ color: palette.controlColor }}\n                  >\n                    ‹\n                  </button>\n                  <button\n                    onClick={(e) => {\n                      e.stopPropagation();\n                      stepLightbox(1);\n                    }}\n                    aria-label=\"Next\"\n                    className=\"absolute top-1/2 right-6 h-11 w-11 -translate-y-1/2 cursor-pointer border-0 bg-transparent text-[32px]\"\n                    style={{ color: palette.controlColor }}\n                  >\n                    ›\n                  </button>\n                </>\n              )}\n              <span className=\"absolute inset-x-0 bottom-6 text-center text-[11px] tracking-[0.16em] tabular-nums\" style={{ color: palette.controlColor, opacity: 0.6 }}>\n                {String(lightbox.index + 1).padStart(2, \"0\")} / {String(photos.length).padStart(2, \"0\")}\n              </span>\n            </div>\n          </div>,\n          document.body,\n        )}\n    </div>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}