{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "snap-pip",
  "title": "SnapPiP",
  "description": "A floating picture inside a container, such as the person's own camera in a call, that they drag and throw into a corner, where it comes to rest, as a phone's picture in picture does.",
  "registryDependencies": [
    "@ouro/ax-component",
    "@ouro/lib-announce",
    "@ouro/lib-class-name-check",
    "@ouro/lib-cn",
    "@ouro/lib-env",
    "@ouro/lib-refs",
    "@ouro/lib-spring",
    "@ouro/lib-use-dev-messages",
    "@ouro/lib-use-drag",
    "@ouro/lib-use-reduced-motion"
  ],
  "files": [
    {
      "path": "registry/ouro/components/ouro/snap-pip/snap-pip-styles.ts",
      "content": "import type { RefObject } from \"react\";\nimport { defineComponentAx } from \"@/registry/ouro/ax/component\";\n\n/** A corner a `SnapPiP` rests in: the screen's corners, the same in either reading direction. */\nexport type SnapPiPCorner = \"top-left\" | \"top-right\" | \"bottom-left\" | \"bottom-right\";\n\n/** The sizes a `SnapPiP` toggles between. */\nexport type SnapPiPSize = \"small\" | \"large\";\n\n/** A rectangle in the container, in px from its top-left corner (inside its border). */\nexport interface SnapPiPRect {\n  x: number;\n  y: number;\n  width: number;\n  height: number;\n}\n\n/** Something the corners keep clear of: a rectangle in the container, or a ref to an element whose box is measured. */\nexport type SnapPiPKeepOut = SnapPiPRect | RefObject<Element | null>;\n\n/** The words screen readers hear for a corner when the picture settles in it. */\nexport type SnapPiPCornerLabels = Record<SnapPiPCorner, string>;\n\n/** The corners. */\nexport const corners: readonly SnapPiPCorner[] = [\"top-left\", \"top-right\", \"bottom-left\", \"bottom-right\"];\n\n/** The sizes. */\nexport const sizes: readonly SnapPiPSize[] = [\"small\", \"large\"];\n\n/** The corner words before an app translates them. */\nexport const defaultCornerLabels: SnapPiPCornerLabels = {\n  \"top-left\": \"Top left\",\n  \"top-right\": \"Top right\",\n  \"bottom-left\": \"Bottom left\",\n  \"bottom-right\": \"Bottom right\",\n};\n\n/** How far a flick coasts: scrolling's deceleration, as `project` takes it. */\nexport const DECELERATION = 0.998;\n/** The spring's response, in seconds. */\nexport const RESPONSE = 0.3;\n/** The spring's damping after a flick: it overshoots a little and settles. */\nexport const FLICK_DAMPING = 0.8;\n\n/**\n * The picture's width in px for a container `stage` px wide: under 900, 160 small and 240 large;\n * from 900, a sixth of the stage between 160 and 320, and twice that up to a third of the stage;\n * from 1800, 288 and 480. Never wider than the stage less `inset` on each side.\n * @claim \"The picture's width in px for\" registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx verify:testExists(registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx::SnapPiP > sizes itself from the container's width, small and large)\n * @claim \"Never wider than the stage less\" registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx verify:testExists(registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx::SnapPiP > sizes itself from the container's width, small and large)\n */\nexport function widthFor(stage: number, size: SnapPiPSize, inset: number): number {\n  let small = 160;\n  let large = 240;\n  if (stage >= 1800) {\n    small = 288;\n    large = 480;\n  } else if (stage >= 900) {\n    small = Math.min(Math.max(stage / 6, 160), 320);\n    large = Math.min(small * 2, stage / 3);\n  }\n  return Math.round(Math.max(Math.min(size === \"large\" ? large : small, stage - inset * 2), 0));\n}\n\nconst overlaps = (x: number, y: number, width: number, height: number, rect: SnapPiPRect) =>\n  x < rect.x + rect.width && x + width > rect.x && y < rect.y + rect.height && y + height > rect.y;\n\n/**\n * Where a picture `pip` big rests in `corner` of a `stage`: `inset` in from both edges, or, when\n * that overlaps a keep-out, the nearest place that clears every keep-out by `inset`, moving only\n * away from the corner's own edges and staying inside the stage. When nothing clears them all,\n * the corner itself.\n * @claim \"Where a picture `pip` big rests\" registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx verify:testExists(registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx::SnapPiP > finds each corner's place clear of every keep-out, toward the middle, or keeps the corner when nothing clears)\n * @claim \"When nothing clears them all, the\" registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx verify:testExists(registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx::SnapPiP > finds each corner's place clear of every keep-out, toward the middle, or keeps the corner when nothing clears)\n */\nexport function anchorFor(\n  corner: SnapPiPCorner,\n  stage: { width: number; height: number },\n  pip: { width: number; height: number },\n  inset: number,\n  keepOut: readonly SnapPiPRect[],\n): { x: number; y: number } {\n  const right = corner.endsWith(\"right\");\n  const bottom = corner.startsWith(\"bottom\");\n  const x = right ? stage.width - pip.width - inset : inset;\n  const y = bottom ? stage.height - pip.height - inset : inset;\n  // Each place that clears one keep-out on one axis, toward the middle of the stage.\n  const xs = [x, ...keepOut.map((rect) => (right ? rect.x - inset - pip.width : rect.x + rect.width + inset))].filter(\n    (at) => (right ? at <= x : at >= x) && at >= 0 && at <= stage.width - pip.width,\n  );\n  const ys = [y, ...keepOut.map((rect) => (bottom ? rect.y - inset - pip.height : rect.y + rect.height + inset))].filter(\n    (at) => (bottom ? at <= y : at >= y) && at >= 0 && at <= stage.height - pip.height,\n  );\n  let best = { x, y };\n  let distance = Infinity;\n  for (const atY of ys) {\n    for (const atX of xs) {\n      const moved = Math.hypot(atX - x, atY - y);\n      if (moved < distance && !keepOut.some((rect) => overlaps(atX, atY, pip.width, pip.height, rect))) {\n        best = { x: atX, y: atY };\n        distance = moved;\n      }\n    }\n  }\n  return best;\n}\n\n/** The arrow keys that move the picture with Option. */\nexport type ArrowKey = \"ArrowLeft\" | \"ArrowRight\" | \"ArrowUp\" | \"ArrowDown\";\n\n/** The corner an Option-arrow key moves to from `corner`: the same corner when it is already on that side. */\nexport function cornerToward(corner: SnapPiPCorner, key: ArrowKey): SnapPiPCorner {\n  const [vertical, horizontal] = corner.split(\"-\") as [\"top\" | \"bottom\", \"left\" | \"right\"];\n  if (key === \"ArrowLeft\") return `${vertical}-left`;\n  if (key === \"ArrowRight\") return `${vertical}-right`;\n  if (key === \"ArrowUp\") return `top-${horizontal}`;\n  return `bottom-${horizontal}`;\n}\n\n/**\n * The corner whose place is nearest `point`, a place the picture could be in: each corner's place\n * as `anchorFor` finds it, clear of the keep-outs, so the line between two corners falls halfway\n * between where the picture would rest in each.\n * @claim \"The corner whose place is nearest\" registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx verify:testExists(registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx::SnapPiP > picks the corner whose place, clear of the keep-outs, is nearest)\n */\nexport function nearestCorner(\n  point: { x: number; y: number },\n  stage: { width: number; height: number },\n  pip: { width: number; height: number },\n  inset: number,\n  keepOut: readonly SnapPiPRect[],\n): SnapPiPCorner {\n  const away = (corner: SnapPiPCorner) => {\n    const place = anchorFor(corner, stage, pip, inset, keepOut);\n    return Math.hypot(place.x - point.x, place.y - point.y);\n  };\n  return corners.reduce((best, corner) => (away(corner) < away(best) ? corner : best));\n}\n\n/**\n * The picture's classes: a raised surface with a faint light hairline for a dark stage, which\n * lifts while dragged and has no motion of its own under reduced motion. Its place is a\n * `translate` it sets itself from what it measures.\n * @claim \"The picture's classes: a raised surface\" registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx verify:testExists(registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx::SnapPiP > follows the pointer from the first pixel and lifts while dragged)\n * @claim \"The picture's classes: a raised surface\" registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx verify:testExists(registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx::SnapPiP > jumps to its corner with reduced motion, with no lift and no rubberband)\n */\nexport const pipClass = [\n  \"absolute isolate box-border touch-none rounded-ouro-xl bg-muted text-foreground select-none data-dragging:cursor-grabbing\",\n  \"shadow-(--shadow-lg) ring-1 ring-white/10 data-dragging:shadow-(--shadow-2xl)\",\n  \"motion-safe:transition-[scale,box-shadow] motion-safe:duration-(--ouro-duration-fast) motion-safe:ease-(--ouro-ease-out) motion-safe:data-dragging:scale-[1.04]\",\n  \"outline-ring outline-offset-2 focus-visible:outline-2 focus-visible:outline-solid\",\n  \"forced-colors:border forced-colors:border-solid\",\n  \"[&_img]:pointer-events-none [&_video]:pointer-events-none\",\n].join(\" \");\n\n/** The frame that clips the app's content to the picture's rounded corners. */\nexport const frameClass = \"block size-full overflow-hidden rounded-[inherit]\";\n\n/**\n * The hint's place beside the picture: above it in a bottom corner and below it in a top one,\n * clear of the picture. Its padding bridges the gap, so the pointer can move onto it\n * without it closing. The component lines it up with the picture's outer edge.\n */\nexport const hintClass = [\n  \"pointer-events-none absolute z-10 w-max max-w-80 opacity-0\",\n  \"motion-safe:transition-opacity motion-safe:duration-(--ouro-duration-fast) motion-safe:ease-(--ouro-ease-out)\",\n  \"data-[side=bottom]:top-full data-[side=bottom]:pt-2 data-[side=top]:bottom-full data-[side=top]:pb-2\",\n  \"data-open:pointer-events-auto data-open:opacity-100\",\n].join(\" \");\n\n/** The hint itself: one quiet line, as a tooltip is. */\nexport const hintTextClass =\n  \"block rounded-ouro-md bg-foreground px-2 py-1 text-xs leading-4 text-balance text-background forced-colors:border forced-colors:border-solid\";\n\n/** How long the pointer rests on the picture before the hint shows, in ms: a tooltip's delay. */\nexport const HINT_DELAY = 600;\n\n/**\n * SnapPiP's agent side, declared with Ouro AX's `defineComponentAx`. It declares no reads, and one\n * action, `move`, which only the person takes: where their own picture sits is theirs. The picture\n * carries `data-ax-action=\"move\"`.\n *\n * @example\n * snapPipAx.actions[0].id; // \"move\"\n * @claim \"It declares no reads, and one\" registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx verify:testExists(registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx::SnapPiP > declares no agent reads and one move only the person makes, on the picture)\n */\nexport const snapPipAx = defineComponentAx({\n  component: \"SnapPiP\",\n  reads: [],\n  actions: [\n    {\n      id: \"move\",\n      summary: \"Move the person's own picture to another corner.\",\n      effect: \"private\",\n      personOnly: \"You can't move the person's own picture; only they can.\",\n    },\n  ],\n});\n",
      "type": "registry:ui",
      "target": "@components/ouro/snap-pip/snap-pip-styles.ts"
    },
    {
      "path": "registry/ouro/components/ouro/snap-pip/snap-pip.tsx",
      "content": "\"use client\";\n\nimport {\n  useCallback,\n  useEffect,\n  useId,\n  useLayoutEffect,\n  useRef,\n  useState,\n  type CSSProperties,\n  type JSX,\n  type FocusEvent as ReactFocusEvent,\n  type KeyboardEvent as ReactKeyboardEvent,\n  type PointerEvent as ReactPointerEvent,\n  type ReactNode,\n  type Ref,\n} from \"react\";\nimport { flushSync } from \"react-dom\";\nimport {\n  anchorFor,\n  corners,\n  cornerToward,\n  DECELERATION,\n  defaultCornerLabels,\n  FLICK_DAMPING,\n  frameClass,\n  HINT_DELAY,\n  hintClass,\n  hintTextClass,\n  nearestCorner,\n  pipClass,\n  RESPONSE,\n  sizes,\n  widthFor,\n  type ArrowKey,\n  type SnapPiPCorner,\n  type SnapPiPCornerLabels,\n  type SnapPiPKeepOut,\n  type SnapPiPRect,\n  type SnapPiPSize,\n} from \"@/registry/ouro/components/ouro/snap-pip/snap-pip-styles\";\nimport { announce } from \"@/registry/ouro/lib/ouro/announce\";\nimport { useAppearanceClassNameCheck } from \"@/registry/ouro/lib/ouro/class-name-check\";\nimport { cn } from \"@/registry/ouro/lib/ouro/cn\";\nimport { attachRef } from \"@/registry/ouro/lib/ouro/refs\";\nimport { project, rubberband, spring, type SpringHandle } from \"@/registry/ouro/lib/ouro/spring\";\nimport { useDevWarnings } from \"@/registry/ouro/lib/ouro/use-dev-messages\";\nimport { FLICK_VELOCITY, useDrag } from \"@/registry/ouro/lib/ouro/use-drag\";\nimport { useReducedMotion } from \"@/registry/ouro/lib/ouro/use-reduced-motion\";\n\nexport type { SnapPiPCorner, SnapPiPCornerLabels, SnapPiPKeepOut, SnapPiPRect, SnapPiPSize };\n\n/** Props for {@link SnapPiP}. */\nexport interface SnapPiPProps {\n  /** What the picture is: \"Your camera\". It names it for screen readers, before its corner and the hint. */\n  label: string;\n  /** The app's content, such as a `<video>` with `className=\"size-full object-cover\"`, which the app renders itself. */\n  children?: ReactNode;\n  /**\n   * The corner it rests in, controlled. Pass `onCornerChange` too, or a throw comes back to this corner.\n   * @claim \"Pass `onCornerChange` too, or a throw\" registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx verify:testExists(registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx::SnapPiP > follows a controlled corner with the spring, and goes back to it when the app keeps it)\n   */\n  corner?: SnapPiPCorner | (string & { 'Use \"top-left\", \"top-right\", \"bottom-left\" or \"bottom-right\"': never }) | undefined;\n  /**\n   * The corner it starts in, uncontrolled.\n   * @default \"bottom-right\"\n   */\n  defaultCorner?: SnapPiPCorner | (string & { 'Use \"top-left\", \"top-right\", \"bottom-left\" or \"bottom-right\"': never }) | undefined;\n  /**\n   * Called with the new corner when the person throws or moves it there, so the app can remember it.\n   * @claim \"Called with the new corner when\" registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx verify:testExists(registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx::SnapPiP > moves to the next corner that way with Option and an arrow, and announces it once it settles)\n   */\n  onCornerChange?: ((corner: SnapPiPCorner) => void) | undefined;\n  /**\n   * Its size, controlled. Small and large widths follow the container's width: under 900px, 160\n   * and 240; from 900px, a sixth of it (160 to 320) and twice that, up to a third; from 1800px, 288\n   * and 480.\n   * @claim \"Small and large widths follow the\" registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx verify:testExists(registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx::SnapPiP > sizes itself from the container's width, small and large)\n   */\n  size?: SnapPiPSize | (string & { 'Use \"small\" or \"large\"': never }) | undefined;\n  /**\n   * The size it starts at, uncontrolled.\n   * @default \"small\"\n   */\n  defaultSize?: SnapPiPSize | (string & { 'Use \"small\" or \"large\"': never }) | undefined;\n  /**\n   * Called with the new size when the person double-clicks it or presses Option-Return on it.\n   * @claim \"Called with the new size when\" registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx verify:testExists(registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx::SnapPiP > toggles small and large on a double-click or Option-Return, controlled or not)\n   */\n  onSizeChange?: ((size: SnapPiPSize) => void) | undefined;\n  /**\n   * How far the corners sit in from the container's edges, and from a keep-out, in px.\n   * @default 16\n   */\n  inset?: number | undefined;\n  /**\n   * What the corners keep clear of: rectangles in the container (`{ x, y, width, height }`, px from\n   * its top-left corner), or refs to elements, such as a toolbar's band, a captions band or another\n   * SnapPiP, measured whenever they or the container resize. A ref is read again after each render\n   * and whenever the container's content changes, so an element the app shows or takes away\n   * behind the same ref, such as a captions band, counts as soon as it comes or goes. A corner\n   * that would overlap one moves just clear of it, toward the middle. When they change, the\n   * picture follows its corner with the spring.\n   * @claim \"A corner that would overlap one\" registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx verify:testExists(registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx::SnapPiP > keeps its corners clear of keep-outs, rectangles or elements, and follows them with the spring when they change)\n   * @claim \"A ref is read again after\" registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx verify:testExists(registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx::SnapPiP > goes back to its corner when a keep-out element behind the same ref goes away, and clears it when it comes back)\n   */\n  keepOut?: readonly SnapPiPKeepOut[] | undefined;\n  /**\n   * Width over height, such as a camera's: 1.6 (16:10), or 0.5625 (9:16) for a phone held upright.\n   * @default 1.6\n   * @claim \"Width over height, such as a\" registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx verify:testExists(registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx::SnapPiP > sizes itself from the container's width, small and large)\n   */\n  aspectRatio?: number | undefined;\n  /**\n   * How to move it from the keyboard, read after its name and corner, and shown beside it as a\n   * tooltip. Translate it with the rest of your interface.\n   * @default \"Option-arrow keys to move it\"\n   */\n  hint?: string | undefined;\n  /**\n   * The words for each corner, read after its name and announced when it settles in a new one.\n   * @claim \"The words for each corner, read\" registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx verify:testExists(registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx::SnapPiP > reads translated corners and hint)\n   * @claim \"The words for each corner, read\" registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx verify:testExists(registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx::SnapPiP > moves to the next corner that way with Option and an arrow, and announces it once it settles)\n   * @default { \"top-left\": \"Top left\", \"top-right\": \"Top right\", \"bottom-left\": \"Bottom left\", \"bottom-right\": \"Bottom right\" }\n   */\n  cornerLabels?: SnapPiPCornerLabels | undefined;\n  /** Layout only. Appearance classes warn in development; style what you put inside it instead. */\n  className?: string | undefined;\n  /** The picture's id. */\n  id?: string | undefined;\n  ref?: Ref<HTMLDivElement> | undefined;\n\n  /** Not a prop. It rests in a corner: `<SnapPiP corner=\"bottom-right\">`. */\n  position?: { 'It rests in a corner: <SnapPiP corner=\"bottom-right\">': never };\n  /** Not a prop. Ouro UI uses `inset`: `<SnapPiP inset={16}>`. */\n  offset?: { \"Use <SnapPiP inset={16}>\": never };\n  /** Not a prop. Ouro UI uses `keepOut`: `<SnapPiP keepOut={[toolbarRef]}>`. */\n  avoid?: { \"Use <SnapPiP keepOut={[toolbarRef]}>\": never };\n}\n\nconst zero = { x: 0, y: 0 };\nconst isCorner = (value: unknown): value is SnapPiPCorner => corners.includes(value as SnapPiPCorner);\nconst isSize = (value: unknown): value is SnapPiPSize => sizes.includes(value as SnapPiPSize);\nconst arrows: readonly string[] = [\"ArrowLeft\", \"ArrowRight\", \"ArrowUp\", \"ArrowDown\"];\n\n/**\n * A floating picture inside a container, such as the person's own camera in a call, that they drag\n * and throw into a corner, where it comes to rest, as a phone's picture in picture does. Put it in a positioned container (`relative`); it moves within that\n * container's box.\n *\n * It follows the pointer from the first pixel and lifts while dragged. On release it works out where\n * the throw would coast to (`project`, at scrolling's deceleration of 0.998), picks the corner\n * whose place, clear of the keep-outs, is nearest that point, and springs there from the release speed (response 0.3s; damping 0.8 after\n * a flick, so it overshoots a little, and 1 after a slow drop). Pressing it in flight catches it.\n * While a pointer holds it, a keep-out or the container changing waits for the release, so it\n * never slides out from under the finger.\n * Dragged past the container's edge, it resists more and more (`rubberband`).\n *\n * The corners sit `inset` in from the edges and keep clear of `keepOut`. It keeps its corner, not\n * its position: when the keep-outs change it follows its corner with the spring, and while the\n * container resizes it stays in its corner without one, placed in the same frame as the resize.\n * While it springs it carries `data-ouro-settling`.\n *\n * It is focusable: Option and an arrow key move it to the next corner that way, with the same\n * spring, and the new corner is announced politely once it settles, never during the move; a key\n * toward the side it is already on says the corner again. Its name, corner and `hint` are what\n * screen readers read. The hint also shows beside it, toward the middle of the stage and never over\n * it, when it gets keyboard focus or the pointer rests on it, and stays while the pointer is on\n * either. Escape, a move or a press puts it away until focus and the pointer have both left.\n * Double-click it, or press Option-Return, to toggle small and large.\n *\n * With reduced motion it jumps straight to its corner: no spring, no lift and no rubberband.\n *\n * Its agent side, `snapPipAx` in `snap-pip-styles.ts`, declares no reads and one action, `move`,\n * which only the person takes: where their own picture sits is theirs. Hiding the picture is the\n * app's, from its own menu, so the app declares that `hide` action, not SnapPiP.\n *\n * Use `Popover` or `HoverCard` instead for an overlay anchored to a control, `Resizable` for a\n * split layout the person sizes, and `Sheet` for a side panel.\n *\n * @claim \"It follows the pointer from the\" registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx verify:testExists(registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx::SnapPiP > follows the pointer from the first pixel and lifts while dragged)\n * @claim \"picks the corner whose place, clear\" registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx verify:testExists(registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx::SnapPiP > drops slowly into the corner whose place is nearest beside a side panel, and flicks across it)\n * @claim \"On release it works out where\" registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx verify:testExists(registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx::SnapPiP > goes to the corner a flick points at, across the stage, with a little overshoot)\n * @claim \"On release it works out where\" registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx verify:testExists(registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx::SnapPiP > goes to the nearest corner after a slow drop, with no overshoot)\n * @claim \"Pressing it in flight catches it.\" registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx verify:testExists(registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx::SnapPiP > catches it in flight, holds it under the pointer, and lets it go on when only pressed)\n * @claim \"While a pointer holds it, a keep-out\" registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx verify:testExists(registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx::SnapPiP > stays under a pointer that holds it while a keep-out changes, and takes the new place on release)\n * @claim \"Dragged past the container's edge, it\" registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx verify:testExists(registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx::SnapPiP > resists past the container's edges, more the further it goes)\n * @claim \"The corners sit `inset` in from\" registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx verify:testExists(registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx::SnapPiP > keeps its corners clear of keep-outs, rectangles or elements, and follows them with the spring when they change)\n * @claim \"while the container resizes it stays\" registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx verify:testExists(registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx::SnapPiP > stays in its corner without a spring while the container resizes, in the same frame)\n * @claim \"Option and an arrow key move\" registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx verify:testExists(registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx::SnapPiP > moves to the next corner that way with Option and an arrow, and announces it once it settles)\n * @claim \"a key toward the side it\" registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx verify:testExists(registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx::SnapPiP > moves to the next corner that way with Option and an arrow, and announces it once it settles)\n * @claim \"Its name, corner and `hint` are\" registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx verify:testExists(registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx::SnapPiP > is a focusable group named by its label, described by its corner and hint, which shows beside it on keyboard focus)\n * @claim \"The hint also shows beside it,\" registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx verify:testExists(registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx::SnapPiP > is a focusable group named by its label, described by its corner and hint, which shows beside it on keyboard focus)\n * @claim \"The hint also shows beside it,\" registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx verify:testExists(registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx::SnapPiP > shows the hint when the pointer rests on it, keeps it while the pointer moves onto it, and never on touch)\n * @claim \"Escape, a move or a press\" registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx verify:testExists(registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx::SnapPiP > puts the hint away on Escape, a move or a press, until focus and the pointer have left)\n * @claim \"Double-click it, or press Option-Return,\" registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx verify:testExists(registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx::SnapPiP > toggles small and large on a double-click or Option-Return, controlled or not)\n * @claim \"With reduced motion it jumps straight\" registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx verify:testExists(registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx::SnapPiP > jumps to its corner with reduced motion, with no lift and no rubberband)\n * @claim \"Its agent side, `snapPipAx` in `snap-pip-styles.ts`,\" registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx verify:testExists(registry/ouro/components/ouro/snap-pip/snap-pip.test.tsx::SnapPiP > declares no agent reads and one move only the person makes, on the picture)\n * @group Layout\n * @see https://ui.ouroboros.bot/docs/snap-pip\n *\n * @example\n * <div className=\"relative h-dvh\">\n *   <SpeakerStage />\n *   <SnapPiP label=\"Your camera\" corner={corner} onCornerChange={setCorner} keepOut={[toolbarRef]}>\n *     <video ref={selfView} autoPlay muted playsInline className=\"size-full -scale-x-100 object-cover\" />\n *   </SnapPiP>\n * </div>\n */\nexport function SnapPiP(props: SnapPiPProps): JSX.Element {\n  const {\n    label,\n    children,\n    corner: cornerProp,\n    defaultCorner = \"bottom-right\",\n    onCornerChange,\n    size: sizeProp,\n    defaultSize = \"small\",\n    onSizeChange,\n    inset = 16,\n    keepOut,\n    aspectRatio = 16 / 10,\n    hint = \"Option-arrow keys to move it\",\n    cornerLabels = defaultCornerLabels,\n    className,\n    id,\n    ref,\n    // Guard props (hint types), dropped here so they never reach the DOM.\n    position: positionProp,\n    offset,\n    avoid,\n  } = props;\n  const reduced = useReducedMotion();\n  const [ownCorner, setOwnCorner] = useState<SnapPiPCorner>(isCorner(defaultCorner) ? defaultCorner : \"bottom-right\");\n  const corner = cornerProp === undefined ? ownCorner : isCorner(cornerProp) ? cornerProp : \"bottom-right\";\n  const [ownSize, setOwnSize] = useState<SnapPiPSize>(isSize(defaultSize) ? defaultSize : \"small\");\n  const size = sizeProp === undefined ? ownSize : isSize(sizeProp) ? sizeProp : \"small\";\n  // The container's size once measured; until then CSS places it, as on the server.\n  const [stage, setStage] = useState<{ width: number; height: number } | undefined>(undefined);\n  // A new object on each release, so a controlled corner the app kept is gone back to.\n  const [release, setRelease] = useState({});\n  const descriptionId = `${useId()}-description`;\n  // What shows the hint: keyboard focus, the pointer resting on it; and whether the person put it\n  // away, which lasts until both have left.\n  // Stryker disable next-line ObjectLiteral,BooleanLiteral: nothing reads dismissed before the first show, which sets it from focus and pointer, and both start falsy.\n  const [hintBy, setHintBy] = useState({ focus: false, pointer: false, dismissed: false });\n  const hintOpen = (hintBy.focus || hintBy.pointer) && !hintBy.dismissed;\n  const hintTimer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n  const showHint = (by: \"focus\" | \"pointer\") =>\n    setHintBy((now) => ({ ...now, [by]: true, dismissed: now.focus || now.pointer ? now.dismissed : false }));\n  const hideHint = (by: \"focus\" | \"pointer\") => setHintBy((now) => ({ ...now, [by]: false }));\n  const dismissHint = () => {\n    clearTimeout(hintTimer.current);\n    setHintBy((now) => (now.dismissed ? now : { ...now, dismissed: true }));\n  };\n\n  useAppearanceClassNameCheck(\n    \"SnapPiP\",\n    className,\n    process.env.NODE_ENV !== \"production\"\n      ? (token: string) => `remove \"${token}\"; style what you put inside it`\n      : // Stryker disable next-line StringLiteral: production only; the check never runs there.\n        /* istanbul ignore next @preserve -- production only */ \"\",\n  );\n  useDevWarnings(\n    \"SnapPiP\",\n    process.env.NODE_ENV !== \"production\"\n      ? () => [\n            !label && [\"label is required; it names the picture for screen readers\", '<SnapPiP label=\"Your camera\">'],\n            cornerProp !== undefined && !isCorner(cornerProp) && [`corner=\"${String(cornerProp)}\" is not a corner; use \"top-left\", \"top-right\", \"bottom-left\", \"bottom-right\"`, '<SnapPiP corner=\"bottom-right\">'],\n            !isCorner(defaultCorner) && [`defaultCorner=\"${String(defaultCorner)}\" is not a corner; use \"top-left\", \"top-right\", \"bottom-left\", \"bottom-right\"`, '<SnapPiP defaultCorner=\"bottom-right\">'],\n            sizeProp !== undefined && !isSize(sizeProp) && [`size=\"${String(sizeProp)}\" is not a size; use \"small\", \"large\"`, '<SnapPiP size=\"small\">'],\n            !isSize(defaultSize) && [`defaultSize=\"${String(defaultSize)}\" is not a size; use \"small\", \"large\"`, '<SnapPiP defaultSize=\"small\">'],\n            cornerProp !== undefined && !onCornerChange && [\"corner is controlled without onCornerChange, so a throw comes back to it\", \"<SnapPiP corner={corner} onCornerChange={setCorner}>\"],\n            positionProp !== undefined && [\"position is not a prop; it rests in a corner\", '<SnapPiP corner=\"bottom-right\">'],\n            offset !== undefined && [\"offset is not a prop\", `<SnapPiP inset={${typeof offset === \"number\" ? offset : 16}}>`],\n            avoid !== undefined && [\"avoid is not a prop\", \"<SnapPiP keepOut={[toolbarRef]}>\"],\n          ]\n      : /* istanbul ignore next @preserve -- production only */ undefined,\n  );\n\n  const element = useRef<HTMLDivElement | null>(null);\n  // Where it is, in px from the container's top-left corner, and the springs carrying it.\n  const at = useRef(zero);\n  const springs = useRef<{ x: SpringHandle; y: SpringHandle; to: { x: number; y: number } } | undefined>(undefined);\n  // The corner it rests in or is on its way to, and the last one it settled in.\n  const target = useRef<SnapPiPCorner>(corner);\n  const settled = useRef<SnapPiPCorner>(corner);\n  // Whether the person moved it, so the corner it settles in is announced.\n  // Stryker disable next-line BooleanLiteral: the first placement rests at once, which sets it false before anything moves.\n  const moved = useRef(false);\n  // A drag under way: where it was when the pointer took it.\n  const drag = useRef<{ x: number; y: number } | undefined>(undefined);\n  // Whether a pointer holds it, dragged or not: a change around it waits for the release.\n  const pressed = useRef(false);\n  const stageRef = useRef(stage);\n  // The latest props and measurements, for the callbacks that outlive a render.\n  // Stryker disable next-line ObjectLiteral: the layout effect below fills it before anything reads it.\n  const latest = useRef({ inset, keepOut, reduced, cornerLabels });\n  useLayoutEffect(() => {\n    stageRef.current = stage;\n    latest.current = { inset, keepOut, reduced, cornerLabels };\n  });\n\n  const place = useCallback(\n    (x: number, y: number) => {\n      at.current = { x, y };\n      element.current!.style.translate = `${x}px ${y}px`;\n    },\n    // Stryker disable next-line ArrayDeclaration: place reads only refs, so any constant list keeps it as this one does.\n    [],\n  );\n\n  /** The keep-outs as rectangles in the container, elements measured now. */\n  const keepRects = useCallback((): SnapPiPRect[] => {\n    const container = element.current!.parentElement!;\n    const box = container.getBoundingClientRect();\n    return (latest.current.keepOut ?? []).flatMap((item): SnapPiPRect[] => {\n      if (!(\"current\" in item)) return [item];\n      const target = item.current;\n      // Stryker disable next-line ArrayDeclaration: anything else in the list has no x or y, so every comparison with it is false and no place counts it.\n      if (!target) return [];\n      const rect = target.getBoundingClientRect();\n      return [{ x: rect.left - box.left - container.clientLeft, y: rect.top - box.top - container.clientTop, width: rect.width, height: rect.height }];\n    });\n  },\n  // Stryker disable next-line ArrayDeclaration: keepRects reads only refs, so any constant list keeps it as this one does.\n  []);\n\n  const anchor = useCallback(\n    (to: SnapPiPCorner) => {\n      const pip = element.current!;\n      return anchorFor(to, stageRef.current!, { width: pip.offsetWidth, height: pip.offsetHeight }, latest.current.inset, keepRects());\n    },\n    [keepRects],\n  );\n\n  /** Stops the springs where they are, and says how fast it was moving. */\n  const halt = useCallback(() => {\n    const running = springs.current;\n    if (!running) return zero;\n    springs.current = undefined;\n    element.current!.removeAttribute(\"data-ouro-settling\");\n    return { x: running.x.stop().velocity, y: running.y.stop().velocity };\n  },\n  // Stryker disable next-line ArrayDeclaration: halt reads only refs, so any constant list keeps it as this one does.\n  []);\n\n  const rested = useCallback(() => {\n    const now = target.current;\n    if (moved.current && now !== settled.current) announce(latest.current.cornerLabels[now]);\n    moved.current = false;\n    settled.current = now;\n  },\n  // Stryker disable next-line ArrayDeclaration: any constant dependency list keeps rested the same for the component's life, as this one does.\n  []);\n\n  /**\n   * Takes it to `to`'s place: with the spring from where it is, at `velocity` (or the speed it was\n   * moving at), or at once with `jump` and with reduced motion.\n   */\n  const go = useCallback(\n    (to: SnapPiPCorner, { velocity, flick = false, jump = false }: { velocity?: { x: number; y: number }; flick?: boolean; jump?: boolean } = {}) => {\n      const speed = halt();\n      target.current = to;\n      const { x, y } = anchor(to);\n      const from = at.current;\n      const { x: vx, y: vy } = velocity ?? speed;\n      if (jump || latest.current.reduced || (x === from.x && y === from.y && vx === 0 && vy === 0)) {\n        place(x, y);\n        return rested();\n      }\n      let moving = 2;\n      const done = () => {\n        if (--moving > 0) return;\n        springs.current = undefined;\n        element.current!.removeAttribute(\"data-ouro-settling\");\n        rested();\n      };\n      const options = { response: RESPONSE, damping: flick ? FLICK_DAMPING : 1, reduced: false, onRest: done };\n      springs.current = {\n        x: spring({ ...options, from: from.x, to: x, velocity: vx, onUpdate: (value) => place(value, at.current.y) }),\n        y: spring({ ...options, from: from.y, to: y, velocity: vy, onUpdate: (value) => place(at.current.x, value) }),\n        to: { x, y },\n      };\n      element.current!.setAttribute(\"data-ouro-settling\", \"\");\n    },\n    // Stryker disable next-line ArrayDeclaration: anchor, halt, place and rested keep their identity for the component's life, so any constant list keeps go the same.\n    [anchor, halt, place, rested],\n  );\n\n  /** Puts it back in its corner's place after a change around it: with the spring, or at once (`jump`). */\n  const reflow = useCallback(\n    (jump: boolean) => {\n      if (!stageRef.current || pressed.current) return;\n      const { x, y } = anchor(target.current);\n      // Already there, or on its way there.\n      const goal = springs.current ? springs.current.to : at.current;\n      if (x === goal.x && y === goal.y) return;\n      go(target.current, { jump });\n    },\n    // Stryker disable next-line ArrayDeclaration: anchor and go keep their identity for the component's life, so any constant list keeps reflow the same.\n    [anchor, go],\n  );\n\n  const observer = useRef<ResizeObserver | undefined>(undefined);\n  const watched = useRef<Element[]>([]);\n  /**\n   * Watches the elements the keep-out refs hold now. When one came or went, even behind the same\n   * ref, its corner's place changed: it follows with the spring.\n   */\n  const rewatch = useCallback(() => {\n    const watching = observer.current!;\n    const before = watched.current;\n    const now = (latest.current.keepOut ?? []).flatMap((item) => (\"current\" in item && item.current ? [item.current] : []));\n    watched.current = now;\n    // Stryker disable next-line BooleanLiteral: a reflow when nothing came or went finds the picture already at its place, and does nothing.\n    let changed = false;\n    for (const gone of before) {\n      if (!now.includes(gone)) {\n        watching.unobserve(gone);\n        changed = true;\n      }\n    }\n    for (const added of now) {\n      // Stryker disable next-line ConditionalExpression: observing an element again only brings a fresh size report, whose reflow finds nothing to do.\n      if (!before.includes(added)) {\n        watching.observe(added);\n        changed = true;\n      }\n    }\n    // Stryker disable next-line ConditionalExpression: a reflow when nothing came or went finds the picture already at its place, and does nothing.\n    if (changed) reflow(false);\n  },\n  // Stryker disable next-line ArrayDeclaration: reflow keeps its identity for the component's life, so any constant list keeps rewatch the same.\n  [reflow]);\n\n  // Measures the container, then follows it and its keep-outs as they resize, and its content as\n  // it changes, for a keep-out element another part of the app shows or takes away. A container\n  // that changed size is a window being resized: the picture keeps to its corner, with no spring,\n  // in the same frame.\n  useLayoutEffect(() => {\n    const container = element.current!.parentElement!;\n    const measure = () => ({ width: container.clientWidth, height: container.clientHeight });\n    setStage(measure());\n    const watching = new ResizeObserver(() => {\n      const next = measure();\n      const last = stageRef.current!;\n      if (next.width !== last.width || next.height !== last.height) flushSync(() => setStage(next));\n      else reflow(false);\n    });\n    watching.observe(container);\n    observer.current = watching;\n    const changes = new MutationObserver(rewatch);\n    changes.observe(container, { childList: true, subtree: true });\n    return () => {\n      changes.disconnect();\n      watching.disconnect();\n      watched.current = [];\n    };\n  },\n  // Stryker disable next-line ArrayDeclaration: reflow and rewatch keep their identity for the component's life, so any constant list runs it as this one does.\n  [reflow, rewatch]);\n\n  // A new size, shape or container size: it stays in its corner, at once.\n  useLayoutEffect(() => reflow(true), [stage, size, aspectRatio, reflow]);\n  // New keep-out rectangles or a new inset: it follows its corner's new place with the spring.\n  const keepKey = JSON.stringify((keepOut ?? []).map((item) => (\"current\" in item ? null : item)));\n  useLayoutEffect(() => reflow(false), [keepKey, inset, reflow]);\n  // The keep-out elements, after each render.\n  useLayoutEffect(rewatch);\n  // A corner the app sets, or keeps after a throw: it goes there with the spring.\n  useLayoutEffect(() => {\n    if (!drag.current && corner !== target.current) go(corner);\n  }, [corner, release, go]);\n  // Unmounted while it springs, it stops.\n  // Stryker disable next-line ArrayDeclaration: halt keeps its identity for the component's life, so any constant list stops it only on unmount, as this one does.\n  useEffect(() => () => void halt(), [halt]);\n\n  const choose = (next: SnapPiPCorner) => {\n    if (next !== corner) {\n      setOwnCorner(next);\n      onCornerChange?.(next);\n    }\n    setRelease({});\n  };\n\n  const dragProps = useDrag({\n    axis: \"x\",\n    crossAxis: \"follow\",\n    threshold: 1,\n    onPress: () => {\n      // Caught in flight, it holds still under the pointer.\n      pressed.current = true;\n      halt();\n      dismissHint();\n    },\n    onPressEnd: () => {\n      // Only pressed: it goes on to its corner's place now, if a press caught it on its way or that place moved.\n      pressed.current = false;\n      go(target.current);\n    },\n    onStart: () => {\n      // A key pressed while the pointer held it set it moving: the pointer has it now.\n      halt();\n      drag.current = at.current;\n      // It lifts once it moves, so a double-click doesn't pulse it.\n      if (!latest.current.reduced) element.current!.setAttribute(\"data-dragging\", \"\");\n    },\n    onMove: ({ delta, crossDelta }) => {\n      const pip = element.current!;\n      const { width, height } = stageRef.current!;\n      // Inside the container 1:1; past an edge, held there with reduced motion, or resisting.\n      const follow = (value: number, max: number, dimension: number) => {\n        const inside = Math.min(Math.max(value, 0), max);\n        return inside + (latest.current.reduced ? 0 : rubberband(value - inside, dimension));\n      };\n      place(follow(drag.current!.x + delta, width - pip.offsetWidth, pip.offsetWidth), follow(drag.current!.y + crossDelta, height - pip.offsetHeight, pip.offsetHeight));\n    },\n    onEnd: ({ velocity, crossVelocity, cancelled }) => {\n      pressed.current = false;\n      drag.current = undefined;\n      element.current!.removeAttribute(\"data-dragging\");\n      if (cancelled) return go(target.current);\n      // Where the throw would coast to, and the corner whose place, clear of the keep-outs, is nearest that.\n      const pip = element.current!;\n      const coast = { x: project(at.current.x, velocity, DECELERATION), y: project(at.current.y, crossVelocity, DECELERATION) };\n      const next = nearestCorner(coast, stageRef.current!, { width: pip.offsetWidth, height: pip.offsetHeight }, latest.current.inset, keepRects());\n      moved.current = true;\n      go(next, { velocity: { x: velocity, y: crossVelocity }, flick: Math.hypot(velocity, crossVelocity) >= FLICK_VELOCITY });\n      choose(next);\n    },\n  });\n\n  const toggleSize = () => {\n    const next = size === \"small\" ? \"large\" : \"small\";\n    setOwnSize(next);\n    onSizeChange?.(next);\n  };\n\n  const onKeyDown = (event: ReactKeyboardEvent<HTMLDivElement>) => {\n    // Escape puts the hint away, and goes no further: it was for the hint.\n    if (event.key === \"Escape\" && hintOpen) {\n      event.stopPropagation();\n      return dismissHint();\n    }\n    if (!event.altKey || event.ctrlKey || event.metaKey) return;\n    if (event.key === \"Enter\") {\n      event.preventDefault();\n      dismissHint();\n      return toggleSize();\n    }\n    if (!arrows.includes(event.key)) return;\n    // Option-arrow is the browser's back and forward in some places: here it moves the picture.\n    event.preventDefault();\n    // The pointer has it.\n    if (drag.current) return;\n    dismissHint();\n    const next = cornerToward(target.current, event.key as ArrowKey);\n    // Already on that side: at rest, it says where it is, so the key isn't met with silence.\n    if (next === target.current) {\n      if (!springs.current) announce(cornerLabels[next]);\n      return;\n    }\n    moved.current = true;\n    go(next);\n    choose(next);\n  };\n\n  const onFocus = (event: ReactFocusEvent<HTMLDivElement>) => {\n    if (event.currentTarget.matches(\":focus-visible\")) showHint(\"focus\");\n  };\n  const onPointerEnter = (event: ReactPointerEvent<HTMLDivElement>) => {\n    // A finger can't hover it away again, so a touch never shows it.\n    if (event.pointerType !== \"touch\") hintTimer.current = setTimeout(() => showHint(\"pointer\"), HINT_DELAY);\n  };\n  const onPointerLeave = () => {\n    clearTimeout(hintTimer.current);\n    hideHint(\"pointer\");\n  };\n\n  const dragRef = dragProps.ref;\n  const setRef = useCallback(\n    (node: HTMLDivElement) => {\n      element.current = node;\n      const undoDrag = dragRef(node);\n      const undoApp = attachRef(ref, node);\n      // The element stays known after it goes, so an effect cleaning up after it can still reach it.\n      return () => {\n        undoDrag!();\n        undoApp();\n      };\n    },\n    [dragRef, ref],\n  );\n\n  const right = corner.endsWith(\"right\");\n  const bottom = corner.startsWith(\"bottom\");\n  // Until it has measured its container, as on the server, CSS puts it in its corner.\n  const style: CSSProperties = stage\n    ? { left: 0, top: 0, width: widthFor(stage.width, size, inset), aspectRatio }\n    : {\n        [right ? \"right\" : \"left\"]: inset,\n        [bottom ? \"bottom\" : \"top\"]: inset,\n        width: size === \"large\" ? \"clamp(160px, calc(100% / 3), 480px)\" : \"clamp(160px, calc(100% / 6), 320px)\",\n        aspectRatio,\n      };\n\n  return (\n    <div\n      ref={setRef}\n      id={id}\n      role=\"group\"\n      tabIndex={0}\n      aria-label={label}\n      aria-describedby={descriptionId}\n      data-ouro=\"snap-pip\"\n      data-ouro-control=\"snap-pip\"\n      data-ouro-part=\"pip\"\n      data-ax-action=\"move\"\n      data-corner={corner}\n      data-size={size}\n      className={cn(pipClass, className)}\n      style={style}\n      onPointerDown={dragProps.onPointerDown}\n      onPointerMove={dragProps.onPointerMove}\n      onPointerUp={dragProps.onPointerUp}\n      onPointerCancel={dragProps.onPointerCancel}\n      onPointerEnter={onPointerEnter}\n      onPointerLeave={onPointerLeave}\n      onDoubleClick={toggleSize}\n      onDragStart={(event) => event.preventDefault()}\n      onKeyDown={onKeyDown}\n      onFocus={onFocus}\n      onBlur={() => hideHint(\"focus\")}\n    >\n      <div data-ouro=\"snap-pip-frame\" className={frameClass}>\n        {children}\n      </div>\n      <span id={descriptionId} className=\"sr-only\">\n        {`${cornerLabels[corner]}. ${hint}`}\n      </span>\n      {/* The hint beside it, toward the middle of the stage. Pressing it leaves the picture be. */}\n      <span\n        aria-hidden=\"true\"\n        data-ouro=\"snap-pip-hint\"\n        data-side={bottom ? \"top\" : \"bottom\"}\n        data-open={hintOpen ? \"\" : undefined}\n        className={hintClass}\n        style={{ [right ? \"right\" : \"left\"]: 0 }}\n        onPointerDown={(event) => event.stopPropagation()}\n        onDoubleClick={(event) => event.stopPropagation()}\n      >\n        <span className={hintTextClass}>{hint}</span>\n      </span>\n    </div>\n  );\n}\n",
      "type": "registry:ui",
      "target": "@components/ouro/snap-pip/snap-pip.tsx"
    }
  ],
  "docs": "A floating picture inside a container, such as the person's own camera in a call, that they drag and throw into a corner, where it comes to rest, as a phone's picture in picture does. Import: import { SnapPiP } from \"@/components/ouro/snap-pip/snap-pip\", with @/components replaced by your components alias (aliases.components in components.json, such as ~/components). Also installed: ax-component, ax-effects, the helpers they import in lib/ouro. Needs ouro-base in your stylesheet: add that item once per app, from the same place as this one, if you have not. Docs: https://ui.ouroboros.bot/docs/snap-pip.md Ouro UI v1.3.257.",
  "type": "registry:ui"
}