@inkorange/space-ui 1.3.0 → 1.5.0

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.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/components/propShared.ts","../src/components/Text.tsx","../src/components/Heading.tsx","../src/components/Link.tsx","../src/components/Flex.tsx","../src/components/Box.tsx","../src/components/Grid.tsx","../src/components/Badge.tsx","../src/components/Separator.tsx","../src/components/Card.tsx","../src/internal/seededRandom.ts","../src/components/Button.tsx","../src/components/Loader.tsx","../src/components/Tooltip.tsx","../src/components/IconToggle.tsx","../src/styles/spaceControls.ts","../src/components/Select.tsx","../src/components/TextField.tsx","../src/components/TextArea.tsx","../src/components/Autocomplete.tsx","../src/components/Slider.tsx","../src/components/RadioGroup.tsx","../src/components/Progress.tsx","../src/components/icons.tsx","../src/components/Message.tsx","../src/components/Dialog.tsx","../src/components/AlertDialog.tsx","../src/components/DropdownMenu.tsx","../src/components/Tabs.tsx"],"sourcesContent":["// Shared prop plumbing for the design-system primitives. The spacing map is\n// the single place Radix's numeric steps meet our t-shirt tokens; \"3\" (12px)\n// rounds UP to md per the spec's when-in-doubt-go-up rule.\nimport type { CSSProperties } from \"react\";\n\nexport type SpaceStep = \"0\" | \"1\" | \"2\" | \"3\" | \"4\" | \"5\" | \"6\";\n\nexport interface SpacingProps {\n m?: SpaceStep;\n mt?: SpaceStep;\n mb?: SpaceStep;\n p?: SpaceStep;\n pb?: SpaceStep;\n}\n\nconst SPACE: Record<SpaceStep, string> = {\n \"0\": \"0\",\n \"1\": \"var(--spacing-xs)\",\n \"2\": \"var(--spacing-sm)\",\n \"3\": \"var(--spacing-md)\",\n \"4\": \"var(--spacing-md)\",\n \"5\": \"var(--spacing-lg)\",\n \"6\": \"var(--spacing-xl)\",\n};\n\nexport function spacingStyle(\n { m, mt, mb, p, pb }: SpacingProps,\n style?: CSSProperties,\n): CSSProperties | undefined {\n const out: CSSProperties = {\n ...(m !== undefined && { margin: SPACE[m] }),\n ...(mt !== undefined && { marginTop: SPACE[mt] }),\n ...(mb !== undefined && { marginBottom: SPACE[mb] }),\n ...(p !== undefined && { padding: SPACE[p] }),\n ...(pb !== undefined && { paddingBottom: SPACE[pb] }),\n ...style,\n };\n return Object.keys(out).length > 0 ? out : undefined;\n}\n\nexport function cx(...parts: Array<string | false | undefined>): string {\n return parts.filter(Boolean).join(\" \");\n}\n","import type * as React from \"react\";\nimport { createElement, forwardRef, type ReactNode } from \"react\";\nimport { cx, spacingStyle, type SpacingProps } from \"./propShared\";\nimport styles from \"./Text.module.scss\";\n\nexport interface TextProps\n extends SpacingProps,\n Omit<React.HTMLAttributes<HTMLElement>, \"color\"> {\n /** Element to render. Default `span`. Use `p` for prose and `label`\n * (with `htmlFor`) for form labels — size is presentational, so the\n * element stays free to be the semantically correct one. */\n as?: \"span\" | \"div\" | \"p\" | \"label\";\n /** Font size step: 1=12px, 2=14px, 3=16px, 4=18px, 5=20px, 6=24px.\n * Line height and letter spacing move with it. Omit to inherit. */\n size?: \"1\" | \"2\" | \"3\" | \"4\" | \"5\" | \"6\";\n /** 500 or 700. Omit for the inherited weight. */\n weight?: \"medium\" | \"bold\";\n /** Semantic colour role. `gray` is the standard secondary-text token;\n * the rest carry meaning, so avoid them for emphasis alone. Omit for\n * primary text. */\n /** Semantic colour role. `muted` is the standard secondary-text token;\n * the rest carry meaning, so avoid them for emphasis alone. Omit for\n * primary text. */\n color?: \"muted\" | \"danger\" | \"success\" | \"warning\";\n /** Id of the control this labels. Only meaningful with `as=\"label\"`. */\n htmlFor?: string;\n /** The text. */\n children?: ReactNode;\n}\n\n/**\n * Body copy. Size, weight and colour are presentational and independent of\n * the element, so `as` stays free to be whatever the document actually needs\n * — a `p` for prose, a `label` for a field, a `span` inline.\n *\n * Colour is a role, not a hue: use `muted` for secondary copy and reserve the\n * status roles for text that genuinely carries that meaning.\n */\nexport const Text = forwardRef<HTMLElement, TextProps>(function Text(\n { as = \"span\", size, weight, color, className, style, m, mt, mb, p, pb, ...rest },\n ref,\n) {\n return createElement(as, {\n ...rest,\n ref,\n className: cx(\n styles.text,\n size && styles[`size${size}`],\n weight && styles[weight],\n color && styles[`color${color[0].toUpperCase()}${color.slice(1)}`],\n className,\n ),\n style: spacingStyle({ m, mt, mb, p, pb }, style),\n });\n});\n","import type * as React from \"react\";\nimport { createElement, forwardRef, type ReactNode } from \"react\";\nimport { cx, spacingStyle, type SpacingProps } from \"./propShared\";\nimport styles from \"./Heading.module.scss\";\n\nexport interface HeadingProps\n extends SpacingProps,\n Omit<React.HTMLAttributes<HTMLHeadingElement>, \"color\"> {\n /** Heading level to render. Default `h2`. Independent of `size`, so\n * document outline stays correct without dictating appearance. */\n as?: \"h1\" | \"h2\" | \"h3\" | \"h4\";\n /** Font size step: 4=18px, 5=20px, 6=24px, 7=28px, 8=35px, 9=60px.\n * Shares steps 4–6 with Text, so a Heading and Text can sit on the\n * same line and match. */\n size?: \"4\" | \"5\" | \"6\" | \"7\" | \"8\" | \"9\";\n /** Semantic colour role. Omit for primary heading colour. */\n color?: \"muted\" | \"danger\";\n /** Centres the text. There is no `left`/`right` — headings are\n * start-aligned unless deliberately centred. */\n align?: \"center\";\n /** The heading text. */\n children?: ReactNode;\n}\n\n/**\n * A section heading. `as` sets the heading level and `size` sets the\n * appearance, deliberately apart — so a visually small heading can still be\n * an h2 where the document structure calls for one.\n *\n * Shares size steps 4-6 with Text, so a heading and body copy on the same\n * line align.\n */\nexport const Heading = forwardRef<HTMLHeadingElement, HeadingProps>(function Heading(\n { as = \"h2\", size, color, align, className, style, m, mt, mb, p, pb, ...rest },\n ref,\n) {\n return createElement(as, {\n ...rest,\n ref,\n className: cx(\n styles.heading,\n size && styles[`size${size}`],\n color === \"muted\" && styles.colorMuted,\n color === \"danger\" && styles.colorDanger,\n align === \"center\" && styles.alignCenter,\n className,\n ),\n style: spacingStyle({ m, mt, mb, p, pb }, style),\n });\n});\n","import type * as React from \"react\";\nimport { cloneElement, forwardRef, isValidElement, type ReactNode } from \"react\";\nimport { cx, spacingStyle, type SpacingProps } from \"./propShared\";\nimport styles from \"./Link.module.scss\";\n\nexport interface LinkProps\n extends SpacingProps,\n Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, \"color\"> {\n /** Render the single child element instead of an `<a>`, merging link\n * styling onto it. For wrapping a router's own Link component without\n * nesting two anchors. */\n asChild?: boolean;\n /** Font size step: 1=12px, 2=14px, 3=16px. Matches Text's first three\n * steps so inline links sit flush with surrounding copy. */\n size?: \"1\" | \"2\" | \"3\";\n /** Link text. With `asChild`, the single element to style as a link. */\n children?: ReactNode;\n}\n\n/**\n * An inline anchor, styled to sit inside running text without disturbing its\n * rhythm. Sizes match Text's first three steps.\n *\n * Use `asChild` to wrap a router's own link component rather than nesting two\n * anchors, which is invalid and breaks keyboard navigation.\n */\nexport const Link = forwardRef<HTMLAnchorElement, LinkProps>(function Link(\n { asChild, size, className, style, m, mt, mb, p, pb, children, ...rest },\n ref,\n) {\n const cls = cx(styles.link, size && styles[`size${size}`], className);\n const merged = spacingStyle({ m, mt, mb, p, pb }, style);\n if (asChild && isValidElement(children)) {\n const child = children as React.ReactElement<{ className?: string; style?: React.CSSProperties }>;\n return cloneElement(child, {\n ...rest,\n className: cx(cls, child.props.className),\n style: { ...merged, ...child.props.style },\n });\n }\n return (\n <a {...rest} ref={ref} className={cls} style={merged}>\n {children}\n </a>\n );\n});\n","import type * as React from \"react\";\nimport { cloneElement, forwardRef, isValidElement, type ReactNode } from \"react\";\nimport { cx, spacingStyle, type SpacingProps } from \"./propShared\";\nimport styles from \"./Flex.module.scss\";\n\nexport interface FlexProps extends SpacingProps, React.HTMLAttributes<HTMLDivElement> {\n /** Render the single child element instead of a wrapper div, merging\n * the flex styling onto it. Avoids a redundant layer in the DOM. */\n asChild?: boolean;\n /** Gap step: 1=4px, 2=8px, 3=12px, 4=16px, 5=24px, 6=32px. Note step 3\n * is 12px — off the 8pt grid, kept for parity with the shipped app. */\n gap?: \"1\" | \"2\" | \"3\" | \"4\" | \"5\" | \"6\";\n /** Main axis. Default `row`. */\n direction?: \"row\" | \"column\";\n /** Cross-axis alignment (`align-items`). */\n align?: \"start\" | \"center\" | \"end\" | \"baseline\" | \"stretch\";\n /** Main-axis distribution (`justify-content`). */\n justify?: \"start\" | \"center\" | \"end\" | \"between\";\n /** Wrapping behaviour. Default is the browser's `nowrap`. */\n wrap?: \"wrap\" | \"nowrap\";\n /** The items to lay out. */\n children?: ReactNode;\n}\n\nconst cap = (s: string) => s[0].toUpperCase() + s.slice(1);\n\n/**\n * A flex row or column whose gap comes from the spacing scale, so layouts\n * inherit the 8pt grid instead of restating it in pixels.\n *\n * `asChild` merges the layout onto its only child rather than adding a\n * wrapper, for when an extra div would break a grid or a selector.\n */\nexport const Flex = forwardRef<HTMLDivElement, FlexProps>(function Flex(\n { asChild, gap, direction, align, justify, wrap, className, style, m, mt, mb, p, pb, children, ...rest },\n ref,\n) {\n const cls = cx(\n styles.flex,\n gap && styles[`gap${gap}`],\n direction && styles[`direction${cap(direction)}`],\n align && styles[`align${cap(align)}`],\n justify && styles[`justify${cap(justify)}`],\n wrap && styles[`wrap${cap(wrap)}`],\n className,\n );\n const merged = spacingStyle({ m, mt, mb, p, pb }, style);\n if (asChild && isValidElement(children)) {\n const child = children as React.ReactElement<{ className?: string; style?: React.CSSProperties }>;\n return cloneElement(child, {\n ...rest,\n className: cx(cls, child.props.className),\n style: { ...merged, ...child.props.style },\n });\n }\n return (\n <div {...rest} ref={ref} className={cls} style={merged}>\n {children}\n </div>\n );\n});\n","import type * as React from \"react\";\nimport { forwardRef, type ReactNode } from \"react\";\nimport { spacingStyle, type SpacingProps } from \"./propShared\";\n\nexport interface BoxProps extends SpacingProps, React.HTMLAttributes<HTMLDivElement> {\n /** Anything. Box adds no styling of its own. */\n children?: ReactNode;\n}\n\n// Radix Box at our call sites is a plain div carrying className/style/ref —\n// no layout props anywhere (verified by inventory). Keep it exactly that.\n\n/**\n * A plain div that understands the spacing scale. The escape hatch for when\n * you need margin or padding on the grid but no layout behaviour with it.\n *\n * Renders nothing of its own — no class, no styling — so it never interferes\n * with whatever you put inside.\n */\nexport const Box = forwardRef<HTMLDivElement, BoxProps>(function Box(\n { style, m, mt, mb, p, pb, ...rest },\n ref,\n) {\n return <div {...rest} ref={ref} style={spacingStyle({ m, mt, mb, p, pb }, style)} />;\n});\n","import type * as React from \"react\";\nimport { forwardRef, type ReactNode } from \"react\";\nimport { cx, spacingStyle, type SpacingProps } from \"./propShared\";\nimport styles from \"./Grid.module.scss\";\n\ntype Cols = \"1\" | \"2\" | \"3\";\nexport interface GridProps extends SpacingProps, React.HTMLAttributes<HTMLDivElement> {\n /** Column count, 1–3. Pass an object for responsive counts:\n * `{ initial: \"1\", sm: \"2\", md: \"3\" }` — `initial` applies below the\n * first breakpoint. */\n columns?: Cols | { initial?: Cols; sm?: Cols; md?: Cols };\n /** Gap step: 1=4px, 2=8px, 3=12px, 4=16px, 5=24px, 6=32px. Same scale\n * as Flex. */\n gap?: \"1\" | \"2\" | \"3\" | \"4\" | \"5\" | \"6\";\n /** The cells. */\n children?: ReactNode;\n}\n\n/**\n * A simple column grid, 1-3 wide, with the same gap scale as Flex. Pass an\n * object to `columns` for responsive counts.\n *\n * Deliberately narrow: anything more elaborate is a job for CSS grid directly\n * rather than a prop API that would end up reinventing it.\n */\nexport const Grid = forwardRef<HTMLDivElement, GridProps>(function Grid(\n { columns, gap, className, style, m, mt, mb, p, pb, ...rest },\n ref,\n) {\n const colCls =\n typeof columns === \"string\"\n ? [styles[`cols${columns}`]]\n : columns\n ? [\n columns.initial && styles[`cols${columns.initial}`],\n columns.sm && styles[`smCols${columns.sm}`],\n columns.md && styles[`mdCols${columns.md}`],\n ]\n : [];\n return (\n <div\n {...rest}\n ref={ref}\n className={cx(styles.grid, ...(colCls as string[]), gap && styles[`gap${gap}`], className)}\n style={spacingStyle({ m, mt, mb, p, pb }, style)}\n />\n );\n});\n","import type * as React from \"react\";\nimport { forwardRef, type ReactNode } from \"react\";\nimport { cx, spacingStyle, type SpacingProps } from \"./propShared\";\nimport styles from \"./Badge.module.scss\";\n\n/**\n * Roles whose colour carries meaning — status and emphasis.\n */\nexport type BadgeSemanticColor =\n | \"muted\"\n | \"primary\"\n | \"success\"\n | \"warning\"\n | \"danger\";\n\n/**\n * Categorical hues for telling data apart — star classes, planet types — where\n * the colour distinguishes rather than signals. These deliberately keep hue\n * names: for a categorical scale the hue IS the identity, and calling one\n * \"tertiary\" would imply a ranking that does not exist.\n */\nexport type BadgeCategoricalColor =\n | \"cyan\"\n | \"purple\"\n | \"orange\"\n | \"yellow\"\n | \"accent\";\n\nexport type BadgeColor = BadgeSemanticColor | BadgeCategoricalColor;\n\nexport interface BadgeProps\n extends SpacingProps,\n Omit<React.HTMLAttributes<HTMLSpanElement>, \"color\"> {\n /** Semantic role or categorical hue. Roles carry meaning — pick one\n * that matches the state, not the look you want.\n */\n color?: BadgeColor;\n /** `soft` is a tinted wash for dense lists; `solid` is a filled chip\n * for a badge that must win attention.\n */\n variant?: \"soft\" | \"solid\";\n /** 1 is the default chip; 2 is for standalone use away from body text. */\n size?: \"1\" | \"2\";\n /** Badges are single-line by default (Radix parity). Long free-text\n * content — e.g. user-named star systems on planet cards — opts into\n * wrapping so it can't overflow its card. */\n wrap?: boolean;\n /** Label text. Keep it short — a badge that wraps stops reading as one. */\n children?: ReactNode;\n}\n\nconst cap = (s: string) => s[0].toUpperCase() + s.slice(1);\n\n// Default color is \"blue\" (not \"gray\") to match Radix's behavior: Badge's\n// `color` prop had no hardcoded default there either — it inherited the\n// surrounding Theme's `accentColor`, which this app sets to \"blue\" (see the\n// single <Theme accentColor> in the host app). A caller that wants a\n// neutral badge should pass color=\"muted\" explicitly.\n/**\n * A compact status label. Colour is the message, so choose it for meaning:\n * the semantic roles say safe, pending or destructive, while the categorical\n * hues only tell one kind of thing from another and carry no judgement.\n *\n * Single-line by default, since a badge that wraps stops reading as a badge.\n * Opt into `wrap` for free text you do not control.\n */\nexport const Badge = forwardRef<HTMLSpanElement, BadgeProps>(function Badge(\n { color = \"primary\", variant = \"soft\", size = \"1\", wrap, className, style, m, mt, mb, p, pb, ...rest },\n ref,\n) {\n return (\n <span\n {...rest}\n ref={ref}\n className={cx(\n styles.badge,\n styles[`color${cap(color)}`],\n variant === \"solid\" && styles.solid,\n styles[`size${size}`],\n wrap && styles.wrap,\n className,\n )}\n style={spacingStyle({ m, mt, mb, p, pb }, style)}\n />\n );\n});\n","import type * as React from \"react\";\nimport { forwardRef } from \"react\";\nimport { cx } from \"./propShared\";\nimport styles from \"./Separator.module.scss\";\n\nexport interface SeparatorProps extends React.HTMLAttributes<HTMLSpanElement> {\n /** Length of the rule, 1 (shortest) to 4 (full width of its container). */\n size?: \"1\" | \"2\" | \"3\" | \"4\";\n}\n\n/**\n * A hairline rule for dividing content within a surface, where a full panel\n * boundary would be too heavy. Exposed as `role=\"separator\"`, so assistive\n * technology hears the division too.\n */\nexport const Separator = forwardRef<HTMLSpanElement, SeparatorProps>(function Separator(\n { size = \"4\", className, ...rest },\n ref,\n) {\n return (\n <span\n {...rest}\n ref={ref}\n role=\"separator\"\n className={cx(styles.separator, size === \"4\" && styles.full, className)}\n />\n );\n});\n","import type * as React from \"react\";\nimport { forwardRef, type ReactNode } from \"react\";\nimport { cx, spacingStyle, type SpacingProps } from \"./propShared\";\nimport styles from \"./Card.module.scss\";\n\nexport interface CardProps extends SpacingProps, React.HTMLAttributes<HTMLDivElement> {\n /** A media element to sit at the top of the card, full-bleed to its edges.\n * Pass whatever your framework renders — a plain `<img>`, a `next/image`,\n * a `<video>` — and the card frames it: cropped to fill, top corners\n * matched to its own radius, and a reserved box so the layout does not\n * jump when it loads.\n *\n * The reserved box is `--sp-card-image-ratio` (default `16 / 10`). Set it\n * per card for a different crop. */\n image?: ReactNode;\n /** The card's contents. */\n children?: ReactNode;\n}\n\n/**\n * A translucent panel for grouping related content, one step above the page\n * surface. Its 12px inset is a deliberate exception to the 8pt grid, kept for\n * parity with the app this was extracted from.\n *\n * Pass `image` for a media card. The image is framed by the card rather than\n * being an ordinary child, so every card in a row reserves the same box\n * before its image loads and none of them reflow when it does.\n */\nexport const Card = forwardRef<HTMLDivElement, CardProps>(function Card(\n { className, style, image, children, m, mt, mb, p, pb, ...rest },\n ref,\n) {\n return (\n <div\n {...rest}\n ref={ref}\n className={cx(styles.card, image != null && styles.hasImage, className)}\n style={spacingStyle({ m, mt, mb, p, pb }, style)}\n >\n {image != null && <div className={styles.image}>{image}</div>}\n {children}\n </div>\n );\n});\n","/** Deterministic RNG + string hash, vendored from the source application (the only\n * consumer inside the library is SpaceButton's star speckle). Pure,\n * dependency-free, and part of no public API. */\nexport function mulberry32(a: number): () => number {\n return function () {\n a |= 0;\n a = (a + 0x6d2b79f5) | 0;\n let t = Math.imul(a ^ (a >>> 15), 1 | a);\n t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;\n return ((t ^ (t >>> 14)) >>> 0) / 4294967296;\n };\n}\n\n/** FNV-1a 32-bit string hash, for turning stable strings into seeds. */\nexport function hashString(s: string): number {\n let h = 0x811c9dc5;\n for (let i = 0; i < s.length; i++) {\n h ^= s.charCodeAt(i);\n h = Math.imul(h, 0x01000193);\n }\n return h >>> 0;\n}\n","\"use client\";\n\nimport { forwardRef, useId, useMemo } from \"react\";\nimport styles from \"./Button.module.scss\";\nimport { mulberry32, hashString } from \"../internal/seededRandom\";\n\nexport interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** Circular, icon-only sizing (e.g. the share glyph). */\n iconOnly?: boolean;\n /** Warm red-dwarf rim for destructive-ish actions (e.g. Clear). */\n ember?: boolean;\n /** md = default. lg = hero CTAs. sm = compact dialog actions. micro = tiny steppers (no stars/glint). */\n size?: \"sm\" | \"md\" | \"lg\" | \"micro\";\n /** Stretch to the container width (sticky footers). */\n fullWidth?: boolean;\n /** Ambient motion: the orbiting rim, the glint sweep, and the twinkling\n * stars. Set false for dense UI or long lists where the movement\n * distracts. The glass look itself is not optional. Default true. */\n animated?: boolean;\n}\n\n\n/**\n * \"Limb-lit glass\" button: cosmic glass capsule whose rim glows like a planet's\n * sunlit atmosphere limb, with twinkling stars inside and a periodic glint\n * sweep. Plain <button>, so it composes with Radix Dialog.Trigger (Slot).\n */\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n function Button({ iconOnly, ember, size = \"md\", fullWidth, animated = true, className, children, ...rest }, ref) {\n const id = useId();\n\n // Unique-per-instance star field: positions and timing vary button to\n // button so the sparkles don't read as a repeated stamp.\n const starStyles = useMemo(() => {\n // Deterministic PRNG seeded from useId, so each button instance gets its\n // own star arrangement while server and client render identically (no\n // hydration mismatch, unlike Math.random in render).\n const rand = mulberry32(hashString(id));\n return Array.from({ length: 3 }, () => ({\n top: `${12 + rand() * 58}%`,\n left: `${8 + rand() * 80}%`,\n animationDelay: `${(rand() * 3.2).toFixed(2)}s`,\n animationDuration: `${(2.8 + rand() * 1.8).toFixed(2)}s`,\n }));\n }, [id]);\n\n const classes = [\n styles.spaceButton,\n iconOnly ? styles.iconOnly : \"\",\n ember ? styles.ember : \"\",\n size !== \"md\" ? styles[size] : \"\",\n fullWidth ? styles.fullWidth : \"\",\n className ?? \"\",\n ]\n .filter(Boolean)\n .join(\" \");\n\n return (\n <button\n ref={ref}\n className={classes}\n data-animated={animated ? undefined : \"false\"}\n {...rest}\n >\n {size !== \"micro\" && (\n <span className={styles.stars} aria-hidden>\n {starStyles.map((style, i) => (\n <i key={i} className={styles.star} style={style} />\n ))}\n </span>\n )}\n <span className={styles.label}>{children}</span>\n </button>\n );\n }\n);\n","\"use client\";\n\nimport { cx } from \"./propShared\";\nimport styles from \"./Loader.module.scss\";\n\nexport interface LoaderProps {\n /** sm = inline/compact spots. md = default. lg = full-panel takeovers. */\n size?: \"sm\" | \"md\" | \"lg\";\n /** Visible caption under the spinner; also doubles as the accessible name. */\n label?: string;\n /** Merged onto the wrapper. */\n className?: string;\n}\n\n/**\n * Orbital spinner: a small pulsing \"planet\" disc at the center of a static\n * ring, with a \"moon\" dot traveling the ring. Dependency-free CSS animation\n * so it composes cleanly wherever a lazy chunk or async panel needs a\n * space-themed loading state (see SurfaceView's dynamic-import loader).\n */\nexport function Loader({ size = \"md\", label, className }: LoaderProps) {\n return (\n <div\n className={cx(styles.wrap, styles[size], className)}\n role=\"status\"\n aria-live=\"polite\"\n aria-label={label ?? \"Loading\"}\n >\n <span className={styles.orbit}>\n <span className={styles.planet} />\n <span className={styles.moon} />\n </span>\n {label && <span className={styles.label}>{label}</span>}\n </div>\n );\n}\n","\"use client\";\n\n// Generic hover/focus tooltip for icon-only controls. Built on the same\n// native popover=\"auto\" top-layer pattern as ElementTooltip (and\n// DropdownMenu) rather than a library: Radix is gone from this app, and the\n// platform gives Escape/click-outside dismissal and top-layer stacking for\n// free — which matters here because these triggers sit over WebGL canvases\n// and inside their own stacking contexts.\n//\n// Deliberately NOT the native `title` attribute, which these controls used\n// before: the browser's own tooltip waits about a second, cannot be styled\n// to match the app, and never appears for keyboard users at all.\n\nimport {\n cloneElement, isValidElement, useEffect, useId, useLayoutEffect, useRef, useState,\n} from \"react\";\nimport styles from \"./Tooltip.module.scss\";\n\ninterface TooltipProps {\n /** The text to show. Nothing renders when this is empty. */\n label: string;\n /** Preferred side; flips to the opposite one when there isn't room.\n * `left`/`right` are for a control in a vertical stack, where a tooltip\n * above or below would land on the neighbouring item. */\n side?: \"top\" | \"bottom\" | \"left\" | \"right\";\n /** The element the tooltip describes. Receives the hover and focus\n * handlers, so it must accept a ref. */\n children: React.ReactElement;\n}\n\nconst SHOW_DELAY = 350;\nconst HIDE_DELAY = 80;\nconst SIDE_OFFSET = 8;\nconst COLLISION_PADDING = 8;\n\n// The clone lives in its own component so this scope never dereferences\n// triggerRef itself — the React Compiler flags a ref that is BOTH passed\n// into cloneElement's props and read in the same scope. Same split, and the\n// same reason, as ElementTooltip's TooltipTrigger.\ninterface TriggerProps {\n triggerRef: React.RefObject<HTMLElement | null>;\n tooltipId: string;\n show: (immediate?: boolean) => void;\n hide: () => void;\n children: React.ReactElement<Record<string, unknown>>;\n}\nfunction TooltipTrigger({ triggerRef, tooltipId, show, hide, children }: TriggerProps) {\n const p = children.props;\n return cloneElement(children, {\n ref: triggerRef,\n // Always present, so the id it points at never dangles: the content\n // element stays mounted and only toggles its popover state.\n \"aria-describedby\": tooltipId,\n onPointerEnter: (e: React.PointerEvent) => {\n (p.onPointerEnter as ((e: React.PointerEvent) => void) | undefined)?.(e);\n // Mouse only. A touch \"hover\" fires on tap, which would pop a tooltip\n // over the very control the user just pressed.\n if (e.pointerType === \"mouse\") show();\n },\n onPointerLeave: (e: React.PointerEvent) => {\n (p.onPointerLeave as ((e: React.PointerEvent) => void) | undefined)?.(e);\n hide();\n },\n // Keyboard focus shows it immediately — no hover delay to wait out.\n onFocus: (e: React.FocusEvent) => {\n (p.onFocus as ((e: React.FocusEvent) => void) | undefined)?.(e);\n show(true);\n },\n onBlur: (e: React.FocusEvent) => {\n (p.onBlur as ((e: React.FocusEvent) => void) | undefined)?.(e);\n hide();\n },\n // A tooltip must never outlive the action it describes: clicking the\n // control (expand, switch view) leaves it stranded over the new layout.\n onClick: (e: React.MouseEvent) => {\n (p.onClick as ((e: React.MouseEvent) => void) | undefined)?.(e);\n hide();\n },\n });\n}\n\n/**\n * A short label revealed on hover or focus, for naming a control whose icon\n * is not self-evident.\n *\n * Never put information here that a reader needs: a tooltip is unreachable on\n * touch and easy to miss. If it must be read, put it on the page.\n */\nexport function Tooltip({ label, side = \"bottom\", children }: TooltipProps) {\n const tooltipId = useId();\n const [open, setOpen] = useState(false);\n const [pos, setPos] = useState<{ top: number; left: number } | null>(null);\n const triggerRef = useRef<HTMLElement | null>(null);\n const contentRef = useRef<HTMLDivElement | null>(null);\n const showTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n const hideTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const clearTimers = () => {\n if (showTimer.current) { clearTimeout(showTimer.current); showTimer.current = null; }\n if (hideTimer.current) { clearTimeout(hideTimer.current); hideTimer.current = null; }\n };\n const show = (immediate = false) => {\n clearTimers();\n if (immediate) { setOpen(true); return; }\n showTimer.current = setTimeout(() => setOpen(true), SHOW_DELAY);\n };\n const hide = () => {\n clearTimers();\n hideTimer.current = setTimeout(() => setOpen(false), HIDE_DELAY);\n };\n\n useEffect(() => clearTimers, []);\n\n useLayoutEffect(() => {\n const content = contentRef.current;\n if (!content) return;\n if (!open) {\n if (content.matches(\":popover-open\")) content.hidePopover();\n return;\n }\n // Show before measuring: while display:none the offset sizes read 0 and\n // every clamp below would be computed against nothing.\n if (!content.matches(\":popover-open\")) content.showPopover();\n const trigger = triggerRef.current;\n if (!trigger) return;\n const r = trigger.getBoundingClientRect();\n const w = content.offsetWidth;\n const h = content.offsetHeight;\n\n // Centre on the trigger along the free axis, clamped inside the viewport.\n const centre = (start: number, size: number, extent: number, viewport: number) =>\n Math.min(\n Math.max(start + size / 2 - extent / 2, COLLISION_PADDING),\n Math.max(viewport - extent - COLLISION_PADDING, COLLISION_PADDING),\n );\n\n // Flip to the opposite side when the preferred one has no room — these\n // controls sit in the top row, the bottom action bar, and now a rail down\n // the edge, so any of the four can be the side without space.\n const pick = (near: number, far: number, size: number, viewport: number) => {\n const fitsFar = far + size <= viewport - COLLISION_PADDING;\n const fitsNear = near >= COLLISION_PADDING;\n return { fitsNear, fitsFar };\n };\n\n if (side === \"left\" || side === \"right\") {\n const after = r.right + SIDE_OFFSET;\n const before = r.left - w - SIDE_OFFSET;\n const { fitsNear: fitsBefore, fitsFar: fitsAfter } =\n pick(before, after, w, window.innerWidth);\n const left = side === \"right\"\n ? (fitsAfter || !fitsBefore ? after : before)\n : (fitsBefore || !fitsAfter ? before : after);\n setPos({ top: centre(r.top, r.height, h, window.innerHeight), left });\n return;\n }\n\n const below = r.bottom + SIDE_OFFSET;\n const above = r.top - h - SIDE_OFFSET;\n const { fitsNear: fitsAbove, fitsFar: fitsBelow } =\n pick(above, below, h, window.innerHeight);\n const top = side === \"bottom\"\n ? (fitsBelow || !fitsAbove ? below : above)\n : (fitsAbove || !fitsBelow ? above : below);\n setPos({ top, left: centre(r.left, r.width, w, window.innerWidth) });\n }, [open, side, label]);\n\n if (!label || !isValidElement(children)) return <>{children}</>;\n\n return (\n <>\n <TooltipTrigger\n triggerRef={triggerRef}\n tooltipId={tooltipId}\n show={show}\n hide={hide}\n >\n {children as React.ReactElement<Record<string, unknown>>}\n </TooltipTrigger>\n <div\n ref={contentRef}\n id={tooltipId}\n popover=\"auto\"\n role=\"tooltip\"\n className={styles.content}\n style={pos ? { top: pos.top, left: pos.left } : undefined}\n onToggle={(e: React.SyntheticEvent<HTMLDivElement>) => {\n if ((e.nativeEvent as ToggleEvent).newState === \"closed\" && open) setOpen(false);\n }}\n >\n {label}\n </div>\n </>\n );\n}\n","\"use client\";\n\nimport type { ReactNode } from \"react\";\nimport { Tooltip } from \"./Tooltip\";\nimport styles from \"./IconToggle.module.scss\";\n\nexport interface IconToggleOption<V extends string> {\n value: V;\n icon: ReactNode;\n /** Used for aria-label and the hover tooltip. */\n label: string;\n}\n\n/**\n * A segmented icon toggle: every option is always visible in one pill, the\n * selected one reads as active, clicking any option selects it. Built for the\n * scene view switcher (planet / orrery / surface), where the old pattern —\n * showing only the views you are NOT on and swapping icons on click — made\n * the control's meaning flip under the cursor (owner: both icons should be\n * \"always visible, the selected one is the active one\"). Generic over the\n * option set so other icon-mode switchers can reuse it.\n */\nexport function IconToggle<V extends string>({\n options,\n value,\n onValueChange,\n orientation = \"horizontal\",\n className = \"\",\n}: {\n /** The segments, in display order. Every option is always visible —\n * this is a segmented control, not a menu.\n */\n options: IconToggleOption<V>[];\n /** The selected option's value. Fully controlled.\n *\n * NoInfer so V is derived from `options` alone. Without it a value that is\n * not among the options simply widened V to include itself, which made the\n * generic silently accept the one mistake it looks like it should catch. */\n value: NoInfer<V>;\n /** Called with the newly selected value. Not called when the already\n * selected option is clicked. */\n onValueChange(next: V): void;\n /** Which way the pill runs. `vertical` for a rail down the edge of a\n * viewport, where a horizontal strip would eat the width. Default\n * `horizontal`. */\n orientation?: \"horizontal\" | \"vertical\";\n /** Merged onto the group wrapper. */\n className?: string;\n}) {\n const vertical = orientation === \"vertical\";\n return (\n <div\n className={`${styles.group} ${vertical ? styles.vertical : \"\"} ${className}`}\n role=\"group\"\n >\n {options.map((opt) => (\n // A horizontal pill sits at the top of the scene, so its tooltips hang\n // below it. A vertical one has a segment directly below every segment,\n // so they go to the side instead — otherwise each tooltip covers the\n // next option along.\n <Tooltip key={opt.value} label={opt.label} side={vertical ? \"right\" : \"bottom\"}>\n <button\n type=\"button\"\n className={`${styles.segment} ${opt.value === value ? styles.active : \"\"}`}\n aria-label={opt.label}\n aria-pressed={opt.value === value}\n onClick={() => {\n if (opt.value !== value) onValueChange(opt.value);\n }}\n >\n {opt.icon}\n </button>\n </Tooltip>\n ))}\n </div>\n );\n}\n","// The shared control-chrome class map — INTERNAL. Components apply this skin\n// themselves, so a consumer never composes it; it was a public subpath until\n// the skin became unconditional, which made every call site a no-op.\n//\n// Kept as a typed module rather than importing the SCSS directly, so a typo in\n// ctl.spaceInput is a compile error here rather than undefined at runtime.\nimport ctlModule from \"./spaceControls.module.scss\";\n\n/** Declared explicitly rather than inferred from the SCSS module, so the\n * emitted .d.ts stands alone: the .module.scss is not published, and a\n * consumer importing this subpath must not need it. Naming the keys also\n * means a typo at a call site is a type error instead of `undefined`. */\nexport interface SpaceControlClasses {\n spaceControl: string;\n spaceInput: string;\n spacePanel: string;\n spaceSlider: string;\n spaceTextArea: string;\n rimRotate: string;\n}\n\n// Through `unknown` because Vite types a CSS module as CSSModuleClasses —\n// an index signature, which TypeScript will not narrow straight to a named\n// interface. The names are checked against the SCSS by a test instead.\nconst ctl = ctlModule as unknown as SpaceControlClasses;\nexport default ctl;\n","// A single-choice menu. One component and one child type:\n//\n// <Select value={v} onValueChange={setV}>\n// <Select.Item value=\"a\">A</Select.Item>\n// </Select>\n//\n// It used to be Root/Trigger/Content/Item, mirroring the JSX shape of the\n// library this was migrated from. Three of those four were ceremony: the\n// trigger was mandatory and identical at every call site, and Content only\n// ever wrapped Items. They are now built in, which is why `Select` is the\n// component itself rather than a namespace.\n//\n// Native engine: a <button> trigger plus an always-mounted hidden listbox,\n// absolutely positioned under it. No portal — that keeps a Select inside a\n// dialog within the dialog's stacking context.\n\"use client\";\nimport type * as React from \"react\";\nimport {\n Children, createContext, isValidElement, useCallback, useContext,\n useEffect, useId, useLayoutEffect, useMemo, useRef, useState, type ReactNode,\n} from \"react\";\nimport { cx } from \"./propShared\";\nimport styles from \"./Select.module.scss\";\nimport ctl from \"../styles/spaceControls\";\n\ninterface RootCtx {\n value: string;\n onValueChange: (v: string) => void;\n disabled?: boolean;\n open: boolean;\n setOpen: (o: boolean) => void;\n highlighted: string | null;\n setHighlighted: (v: string | null) => void;\n listboxId: string;\n values: string[];\n labelFor: (v: string) => ReactNode;\n /** Previously carried in its own context, because with Trigger and Content\n * as separate components a ref sitting beside plain state made every read\n * of the OTHER fields look like a render-time ref access to\n * react-hooks/refs. Only Item reads it now, and only inside an event\n * handler, so the split bought nothing. Keep it that way: read `.current`\n * in handlers and effects, never during render. */\n triggerRef: React.RefObject<HTMLButtonElement | null>;\n}\nconst Ctx = createContext<RootCtx | null>(null);\nconst useSelect = () => {\n const ctx = useContext(Ctx);\n if (!ctx) throw new Error(\"Select.Item must be inside a Select\");\n return ctx;\n};\n\n// Shared id contract between the listbox's aria-activedescendant and each\n// Item's id. encodeURIComponent guards against values containing spaces or\n// other characters that aren't legal in an HTML id.\nconst optionId = (listboxId: string, value: string) => `${listboxId}-${encodeURIComponent(value)}`;\n\n/** Pure render-time walk of the children collecting Item values and labels —\n * no effects, so the trigger label is correct on first paint, under SSR, and\n * in renderToStaticMarkup tests. Recurses, so Items may be wrapped (a\n * fragment, a `.map`, a grouping element) rather than being direct children. */\nfunction collectItems(children: ReactNode): Array<{ value: string; label: ReactNode; disabled?: boolean }> {\n const out: Array<{ value: string; label: ReactNode; disabled?: boolean }> = [];\n const walk = (nodes: ReactNode) => {\n Children.forEach(nodes, (child) => {\n if (!isValidElement(child)) return;\n const props = child.props as { value?: string; children?: ReactNode; disabled?: boolean };\n if (child.type === Item && typeof props.value === \"string\") {\n out.push({ value: props.value, label: props.children, disabled: props.disabled });\n } else if (props.children) {\n walk(props.children);\n }\n });\n };\n walk(children);\n return out;\n}\n\nexport interface SelectProps\n extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"value\" | \"children\" | \"onChange\"> {\n /** The selected item's value. Fully controlled. */\n value: string;\n /** Called with the newly selected value. */\n onValueChange: (v: string) => void;\n /** Blocks the trigger and removes it from the tab order. */\n disabled?: boolean;\n /** Shown when nothing is selected. Counts toward the control's width, so\n * selecting an option never resizes it. */\n placeholder?: string;\n /** Ambient motion: the lit arc orbiting the rim. The glass skin itself is\n * always applied. Default true. */\n animated?: boolean;\n /** One or more `Select.Item`. Anything else is ignored for selection but\n * still rendered in the panel. */\n children?: ReactNode;\n}\n\n/**\n * A single-choice menu for lists too long to show inline. Fully controlled.\n *\n * The control sizes itself to its widest option, so it never changes width as\n * you select — capped by `--sp-select-trigger-max-width`, past which the label\n * ellipsizes.\n *\n * Reads its options at render time rather than through effects, so the right\n * label shows on first paint and under SSR.\n *\n * Every prop other than the ones listed lands on the trigger button, which is\n * the focusable control — so `aria-label`, `id`, `name` and `onBlur` go where\n * you would expect.\n */\nfunction SelectRoot({\n value,\n onValueChange,\n disabled,\n placeholder,\n animated = true,\n className,\n children,\n ...rest\n}: SelectProps) {\n const [open, setOpen] = useState(false);\n const [highlighted, setHighlighted] = useState<string | null>(null);\n const listboxId = useId();\n const triggerRef = useRef<HTMLButtonElement | null>(null);\n const rootRef = useRef<HTMLDivElement | null>(null);\n const listRef = useRef<HTMLDivElement | null>(null);\n const [triggerWidth, setTriggerWidth] = useState<number | null>(null);\n const [maxHeight, setMaxHeight] = useState<number | null>(null);\n\n const items = useMemo(() => collectItems(children), [children]);\n const values = useMemo(() => items.filter((i) => !i.disabled).map((i) => i.value), [items]);\n const itemLabels = useMemo(() => items.map((i) => i.label), [items]);\n const labelFor = useCallback(\n (v: string) => items.find((i) => i.value === v)?.label ?? null,\n [items],\n );\n\n // Light-dismiss: click outside closes.\n useEffect(() => {\n if (!open) return;\n const onDown = (e: MouseEvent) => {\n if (rootRef.current && !rootRef.current.contains(e.target as Node)) setOpen(false);\n };\n document.addEventListener(\"mousedown\", onDown);\n return () => document.removeEventListener(\"mousedown\", onDown);\n }, [open]);\n\n // Measures the trigger's rendered width (and the space below it) to size the\n // listbox. useLayoutEffect so it lands before the browser paints the first\n // open frame — a plain useEffect flashes one frame with the width unset.\n useLayoutEffect(() => {\n if (!open) return;\n const el = triggerRef.current;\n if (!el) return;\n const rect = el.getBoundingClientRect();\n setTriggerWidth(el.offsetWidth);\n // Clamp to the space between the trigger and the viewport bottom, so a\n // long list does not force extra scroll inside a scrollable ancestor.\n const available = window.innerHeight - rect.bottom - 16;\n setMaxHeight(Math.min(380, Math.max(120, available)));\n }, [open]);\n\n // Focus the listbox on open so arrow keys work immediately.\n useEffect(() => {\n if (open) listRef.current?.focus();\n }, [open]);\n\n const openWith = (highlight: string | null) => {\n setHighlighted(highlight ?? values[0] ?? null);\n setOpen(true);\n };\n\n const move = (delta: number) => {\n const idx = highlighted ? values.indexOf(highlighted) : -1;\n const next = Math.min(Math.max(idx + delta, 0), values.length - 1);\n setHighlighted(values[next] ?? null);\n };\n\n const label = value ? labelFor(value) : null;\n\n return (\n <Ctx.Provider\n value={{\n value, onValueChange, disabled, open, setOpen, highlighted,\n setHighlighted, listboxId, values, labelFor, triggerRef,\n }}\n >\n <div ref={rootRef} className={styles.root}>\n <button\n type=\"button\"\n {...rest}\n ref={triggerRef}\n disabled={disabled}\n className={cx(styles.trigger, ctl.spaceControl, \"spSelectTrigger\", className)}\n data-animated={animated ? undefined : \"false\"}\n data-state={open ? \"open\" : \"closed\"}\n aria-haspopup=\"listbox\"\n aria-expanded={open}\n aria-controls={listboxId}\n onClick={() => (open ? setOpen(false) : openWith(value || null))}\n onKeyDown={(e) => {\n if (e.key === \"ArrowDown\" || e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n openWith(value || null);\n }\n }}\n >\n {/* The visible label and a hidden copy of every option share one\n grid cell, so the button is as wide as its widest choice and\n never jumps width when the selection changes. Capped by\n --sp-select-trigger-max-width, past which the label ellipsizes. */}\n <span className={styles.labelWrap}>\n <span className={styles.sizer} data-sizer=\"\" aria-hidden=\"true\">\n {itemLabels.map((l, i) => (\n // eslint-disable-next-line react/no-array-index-key\n <span key={i}>{l}</span>\n ))}\n {placeholder && <span>{placeholder}</span>}\n </span>\n <span className={styles.triggerLabel}>{label ?? placeholder ?? \"\"}</span>\n </span>\n <svg className={styles.chevron} width=\"9\" height=\"9\" viewBox=\"0 0 9 9\" aria-hidden=\"true\">\n <path d=\"M0.5 3 L4.5 7 L8.5 3\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.2\" />\n </svg>\n </button>\n\n {/* Always mounted but hidden while closed, so the trigger can read the\n item labels for sizing before the panel has ever been opened. */}\n <div\n ref={listRef}\n id={listboxId}\n role=\"listbox\"\n tabIndex={-1}\n hidden={!open}\n aria-activedescendant={highlighted ? optionId(listboxId, highlighted) : undefined}\n className={cx(styles.listbox, ctl.spacePanel)}\n data-animated={animated ? undefined : \"false\"}\n style={\n triggerWidth != null || maxHeight != null\n ? ({\n ...(triggerWidth != null ? { \"--_select-trigger-width\": `${triggerWidth}px` } : {}),\n ...(maxHeight != null ? { maxHeight: `${maxHeight}px` } : {}),\n } as React.CSSProperties)\n : undefined\n }\n onKeyDown={(e) => {\n if (e.key === \"Escape\") {\n e.stopPropagation(); // don't let an ancestor Dialog close too\n setOpen(false);\n triggerRef.current?.focus();\n } else if (e.key === \"ArrowDown\") { e.preventDefault(); move(1); }\n else if (e.key === \"ArrowUp\") { e.preventDefault(); move(-1); }\n else if (e.key === \"Home\") { e.preventDefault(); setHighlighted(values[0] ?? null); }\n else if (e.key === \"End\") { e.preventDefault(); setHighlighted(values[values.length - 1] ?? null); }\n else if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n if (highlighted) {\n onValueChange(highlighted);\n setOpen(false);\n triggerRef.current?.focus();\n }\n } else if (e.key === \"Tab\") {\n setOpen(false);\n }\n }}\n >\n {children}\n </div>\n </div>\n </Ctx.Provider>\n );\n}\n\nexport interface SelectItemProps {\n /** Reported to onValueChange when chosen. */\n value: string;\n /** Skipped by keyboard navigation and not selectable. Still contributes its\n * width to the control's sizing. */\n disabled?: boolean;\n /** Shown in the panel and, once selected, in the closed control — so it has\n * to read correctly in both places. */\n children?: ReactNode;\n}\n\n/**\n * One option. Its children are what the closed control displays once\n * selected, so anything rendered here has to read correctly in both places.\n */\nfunction Item({ value, disabled, children }: SelectItemProps) {\n const s = useSelect();\n const selected = s.value === value;\n const highlighted = s.highlighted === value;\n return (\n <div\n id={optionId(s.listboxId, value)}\n role=\"option\"\n aria-selected={selected}\n aria-disabled={disabled || undefined}\n data-highlighted={highlighted ? \"\" : undefined}\n className={cx(styles.item, \"spSelectItem\")}\n onMouseEnter={() => !disabled && s.setHighlighted(value)}\n onClick={() => {\n if (disabled) return;\n s.onValueChange(value);\n s.setOpen(false);\n s.triggerRef.current?.focus();\n }}\n >\n {children}\n </div>\n );\n}\n\n// Item hangs off the component rather than being a separate export, so the\n// whole API is reachable from the one name a consumer already imported.\nexport const Select = Object.assign(SelectRoot, { Item });\n","\"use client\";\nimport type * as React from \"react\";\nimport { forwardRef, type ReactNode } from \"react\";\nimport { cx } from \"./propShared\";\nimport styles from \"./TextField.module.scss\";\nimport ctl from \"../styles/spaceControls\";\n\nexport interface TextFieldProps\n extends Omit<React.InputHTMLAttributes<HTMLInputElement>, \"className\" | \"style\"> {\n /** Merged onto the field wrapper, not the inner input. */\n className?: string;\n /** Ambient motion on the rim. The glass skin is always applied.\n * Default true. */\n animated?: boolean;\n /** Applied to the field wrapper — set width here. */\n style?: React.CSSProperties;\n /** Slots rendered inside the field, alongside the input. */\n children?: ReactNode; // Slot(s)\n}\n\n/**\n * Single-line text entry. The field surface is a wrapper around the input so\n * `TextField.Slot` can sit alongside it inside the same surface — that\n * wrapper is built in rather than being something you compose.\n *\n * Props land on the inner input, so `value`, `onChange` and the rest behave\n * as they would on a bare input. `className` and `style` land on the field\n * surface instead, which is where width belongs.\n *\n * The ref forwards to the input, not the wrapper.\n */\nconst TextFieldRoot = forwardRef<HTMLInputElement, TextFieldProps>(function TextField(\n { className, style, animated = true, children, ...inputProps },\n ref,\n) {\n return (\n <div\n className={cx(styles.root, ctl.spaceInput, \"spTextFieldRoot\", className)}\n data-animated={animated ? undefined : \"false\"}\n style={style}\n >\n {children}\n <input {...inputProps} ref={ref} className={cx(styles.input, \"spTextFieldInput\")} />\n </div>\n );\n});\n\n/**\n * A fixed element inside the field, before or after the input — an icon, a\n * unit, a short affordance. Sits within the field's surface rather than\n * beside it, and does not shrink as the input fills.\n */\nfunction Slot({\n children,\n}: {\n /** The slot's contents — an icon, a unit, a short affordance. */\n children?: ReactNode;\n}) {\n return <span className={styles.slot}>{children}</span>;\n}\n\n// Slot hangs off the component rather than being a separate export, so the\n// whole API is reachable from the one name a consumer already imported.\nexport const TextField = Object.assign(TextFieldRoot, { Slot });\n","\"use client\";\nimport type * as React from \"react\";\nimport { forwardRef } from \"react\";\nimport { cx } from \"./propShared\";\nimport styles from \"./TextArea.module.scss\";\nimport ctl from \"../styles/spaceControls\";\n\nexport interface TextAreaProps\n extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, \"className\" | \"style\"> {\n /** Merged onto the field wrapper, not the inner textarea. */\n className?: string;\n /** Ambient motion on the rim. The glass skin is always applied.\n * Default true. */\n animated?: boolean;\n /** Applied to the field wrapper — set width here. */\n style?: React.CSSProperties;\n}\n\n/**\n * Multi-line text entry. `rows` sets the initial height; it grows with its\n * container's width and resizes vertically only, since horizontal drag would\n * break the surrounding layout.\n */\nexport const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(function TextArea(\n { className, style, animated = true, ...rest },\n ref,\n) {\n return (\n <div\n className={cx(styles.root, ctl.spaceInput, ctl.spaceTextArea, \"spTextFieldRoot\", className)}\n data-animated={animated ? undefined : \"false\"}\n style={style}\n >\n <textarea {...rest} ref={ref} className={cx(styles.textarea, \"spTextAreaInput\")} />\n </div>\n );\n});\n","// A text field with a result list hanging under it.\n//\n// It never fetches and never ranks: the consumer hands it the candidate rows,\n// from memory or from an API, in whatever order that domain considers best.\n// What it does own is the narrowing — matching the typed text against those\n// rows — plus the popover, the keyboard model and the aria wiring. Those are\n// the parts every autocomplete needs and nobody enjoys writing twice.\n//\n// A caller whose rows were already matched server-side passes `preFiltered`\n// and the narrowing is skipped, so a fuzzy or synonym match made elsewhere is\n// not undone by a plain substring test here.\n\"use client\";\nimport type * as React from \"react\";\nimport {\n useCallback, useEffect, useId, useMemo, useRef, useState, type ReactNode,\n} from \"react\";\nimport { cx } from \"./propShared\";\nimport { TextField } from \"./TextField\";\nimport styles from \"./Autocomplete.module.scss\";\nimport ctl from \"../styles/spaceControls\";\n\nexport interface AutocompleteOption {\n /** Handed back to `onSelect` when this row is chosen. */\n value: string;\n /** The row's main text. */\n label: ReactNode;\n /** Optional secondary text, set against the trailing edge — a category, a\n * score, a date. Kept out of `label` so it stays visually subordinate and\n * does not affect which row a reader scans for. */\n meta?: ReactNode;\n /** Shown, but skipped by the keyboard and unselectable. */\n disabled?: boolean;\n /** The text the typed query is matched against, when `label` is not a plain\n * string. Falls back to `label` if it is one, and to `value` otherwise —\n * and `value` is usually a slug, which is rarely what someone is typing. */\n search?: string;\n}\n\nexport interface AutocompleteProps\n extends Omit<\n React.InputHTMLAttributes<HTMLInputElement>,\n \"value\" | \"onChange\" | \"onSelect\" | \"className\" | \"style\"\n > {\n /** The text in the field. Fully controlled. */\n value: string;\n /** Called on every keystroke. */\n onValueChange: (value: string) => void;\n /** The candidate rows, in the order you want them shown. They are narrowed\n * against what has been typed unless `preFiltered` is set; the order you\n * give is always preserved, so ranking stays yours. An empty array with no\n * `loading` and no `emptyMessage` shows nothing at all, which is how you\n * keep the panel shut until a query is worth answering. */\n options: AutocompleteOption[];\n /** Called when a row is chosen by click or Enter. */\n onSelect: (value: string, option: AutocompleteOption) => void;\n /** Renders a leading glyph inside the field — a magnifier, usually. */\n icon?: ReactNode;\n /** Match exactly as typed, so `trappist` no longer finds `TRAPPIST`.\n * Default off, which is what nearly every search wants. */\n caseSensitive?: boolean;\n /** The rows were already matched — by a server, a fuzzy search, a synonym\n * table — so render them as given. Without this a substring test here\n * would silently drop rows a smarter match upstream had found. */\n preFiltered?: boolean;\n /** Replaces the list with a waiting message while results are on their way. */\n loading?: boolean;\n /** What that waiting message says. Name the thing being fetched — \"Loading\n * the catalogue…\" tells a reader more than a spinner's worth of nothing.\n * Default \"Loading…\". */\n loadingMessage?: ReactNode;\n /** Shown when there are no options and nothing is loading. Leave it out to\n * show no panel at all rather than an empty one. */\n emptyMessage?: ReactNode;\n /** A line under the list, outside its scroll area — \"showing 50 of 2,700\",\n * a hint, a keyboard legend. */\n footer?: ReactNode;\n /** Ambient motion on the field's rim. The glass skin is always applied.\n * Default true. */\n animated?: boolean;\n /** Merged onto the wrapper, which is what you size. */\n className?: string;\n /** Applied to the wrapper — set width here. */\n style?: React.CSSProperties;\n}\n\n/**\n * A text field that offers matching rows as you type.\n *\n * It holds no data of its own. Give it `options` and it renders them,\n * highlights one, moves that highlight with the arrow keys, and calls\n * `onSelect` when a row is chosen — however those options were produced.\n *\n * The list is a popover rather than a block in the flow: results that appear\n * mid-keystroke and push the page down under the cursor are disorienting, and\n * whatever is being searched usually sits directly below the field.\n */\nexport function Autocomplete({\n value,\n onValueChange,\n options,\n onSelect,\n icon,\n caseSensitive = false,\n preFiltered = false,\n loading = false,\n loadingMessage = \"Loading…\",\n emptyMessage,\n footer,\n animated = true,\n className,\n style,\n ...inputProps\n}: AutocompleteProps) {\n const [open, setOpen] = useState(false);\n const [active, setActive] = useState(0);\n const wrapRef = useRef<HTMLDivElement>(null);\n const listRef = useRef<HTMLUListElement>(null);\n const listId = useId();\n\n // What a row is matched on: its label when that is plain text, an explicit\n // `search` when the label is markup, and the value as a last resort.\n const haystack = (o: AutocompleteOption) =>\n typeof o.label === \"string\" ? o.label : (o.search ?? o.value);\n\n const shown = useMemo(() => {\n if (preFiltered) return options;\n const needle = caseSensitive ? value : value.toLowerCase();\n if (needle === \"\") return options;\n return options.filter((o) => {\n const text = caseSensitive ? haystack(o) : haystack(o).toLowerCase();\n return text.includes(needle);\n });\n }, [options, value, caseSensitive, preFiltered]);\n\n const selectable = useMemo(() => shown.filter((o) => !o.disabled), [shown]);\n\n // Nothing to say, no panel. This is what lets a consumer keep the popover\n // shut below its minimum query length without managing open state: send no\n // options, no loading and no message, and there is nothing to show.\n const hasContent = shown.length > 0 || loading || emptyMessage != null;\n const showPanel = open && hasContent;\n\n // A changed result set invalidates the highlight — it pointed at a row that\n // may no longer exist, let alone be the best match.\n useEffect(() => setActive(0), [shown]);\n\n // \"nearest\" scrolls only when the row is actually out of view, so walking a\n // visible list does not jump the container under the cursor.\n useEffect(() => {\n if (!showPanel) return;\n const el = listRef.current?.querySelector<HTMLElement>(`[data-index=\"${active}\"]`);\n el?.scrollIntoView({ block: \"nearest\" });\n }, [active, showPanel]);\n\n // pointerdown, not click: a drag that starts inside the panel and ends\n // outside it is not an outside click, and the dismissal should land before\n // whatever sits underneath can fire.\n const close = useCallback(() => setOpen(false), []);\n useEffect(() => {\n if (!showPanel) return;\n const onDown = (e: PointerEvent) => {\n const node = wrapRef.current;\n if (node && e.target instanceof Node && !node.contains(e.target)) close();\n };\n document.addEventListener(\"pointerdown\", onDown);\n return () => document.removeEventListener(\"pointerdown\", onDown);\n }, [showPanel, close]);\n\n const choose = (option: AutocompleteOption) => {\n if (option.disabled) return;\n onSelect(option.value, option);\n setOpen(false);\n };\n\n const move = (delta: number) => {\n if (selectable.length === 0) return;\n const current = shown[active];\n const from = current && !current.disabled ? selectable.indexOf(current) : -1;\n const next = (from + delta + selectable.length) % selectable.length;\n const target = selectable[next];\n if (target) setActive(shown.indexOf(target));\n };\n\n const onKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (e.key === \"Escape\") {\n // Stop here: an ancestor Dialog must not close because a suggestion\n // list did.\n if (showPanel) e.stopPropagation();\n setOpen(false);\n return;\n }\n if (e.key === \"Tab\") {\n setOpen(false);\n return;\n }\n if (!showPanel) {\n if (e.key === \"ArrowDown\") setOpen(true);\n return;\n }\n if (e.key === \"ArrowDown\") { e.preventDefault(); move(1); }\n else if (e.key === \"ArrowUp\") { e.preventDefault(); move(-1); }\n else if (e.key === \"Home\") {\n e.preventDefault();\n const first = selectable[0];\n if (first) setActive(shown.indexOf(first));\n } else if (e.key === \"End\") {\n e.preventDefault();\n const last = selectable[selectable.length - 1];\n if (last) setActive(shown.indexOf(last));\n } else if (e.key === \"Enter\") {\n const chosen = shown[active];\n if (chosen && !chosen.disabled) {\n e.preventDefault();\n choose(chosen);\n }\n }\n };\n\n const activeOption = showPanel ? shown[active] : undefined;\n\n return (\n <div ref={wrapRef} className={cx(styles.wrap, className)} style={style}>\n <TextField\n {...inputProps}\n type={inputProps.type ?? \"text\"}\n role=\"combobox\"\n animated={animated}\n className={styles.field}\n autoComplete=\"off\"\n aria-expanded={showPanel}\n aria-controls={listId}\n aria-autocomplete=\"list\"\n aria-activedescendant={\n activeOption && !activeOption.disabled ? `${listId}-${active}` : undefined\n }\n value={value}\n onFocus={(e) => {\n inputProps.onFocus?.(e);\n setOpen(true);\n }}\n // Focus alone is not enough. After a selection the panel shuts but\n // focus stays in the field, so onFocus never fires again and clicking\n // back into it did nothing — a combobox you cannot reopen by clicking\n // reads as broken.\n onClick={(e) => {\n inputProps.onClick?.(e);\n setOpen(true);\n }}\n onKeyDown={(e) => {\n inputProps.onKeyDown?.(e);\n onKeyDown(e);\n }}\n onChange={(e) => {\n onValueChange(e.target.value);\n setOpen(true);\n }}\n >\n {icon != null && <TextField.Slot>{icon}</TextField.Slot>}\n </TextField>\n\n {/* Always mounted, hidden while shut. aria-controls above points at the\n listbox by id, and an id that resolves to nothing is a promise the\n markup does not keep — same reason Select keeps its listbox in the\n tree. */}\n <div\n className={cx(styles.panel, ctl.spacePanel)}\n hidden={!showPanel}\n data-animated={animated ? undefined : \"false\"}\n >\n {loading && <p className={styles.status}>{loadingMessage}</p>}\n\n {!loading && shown.length === 0 && emptyMessage != null && (\n <p className={styles.status}>{emptyMessage}</p>\n )}\n\n <ul\n ref={listRef}\n id={listId}\n role=\"listbox\"\n className={styles.list}\n hidden={loading || shown.length === 0}\n >\n {shown.map((option, i) => (\n <li\n key={option.value}\n id={`${listId}-${i}`}\n data-index={i}\n role=\"option\"\n aria-selected={i === active}\n aria-disabled={option.disabled || undefined}\n className={cx(\n styles.option,\n i === active && !option.disabled && styles.active,\n \"spAutocompleteOption\",\n )}\n // One highlight for pointer and keyboard both: hovering moves the\n // active row, so there is never a mouse highlight and a keyboard\n // highlight disagreeing about what Enter would do.\n onMouseEnter={() => !option.disabled && setActive(i)}\n onPointerDown={(e) => {\n // Before blur, or the panel closes and the click lands on\n // whatever the layout collapses into its place.\n e.preventDefault();\n choose(option);\n }}\n >\n <span className={styles.label}>{option.label}</span>\n {option.meta != null && <span className={styles.meta}>{option.meta}</span>}\n </li>\n ))}\n </ul>\n\n {/* Outside the scroll area, so a count stays put while the list moves. */}\n {footer != null && <div className={styles.footer}>{footer}</div>}\n </div>\n </div>\n );\n}\n","\"use client\";\nimport type * as React from \"react\";\nimport { forwardRef } from \"react\";\nimport { cx } from \"./propShared\";\nimport styles from \"./Slider.module.scss\";\nimport ctl from \"../styles/spaceControls\";\n\nexport interface SliderProps {\n /** Current value, as a single-element array. Fully controlled. */\n value: number[];\n /** Called with the new value array as the thumb moves. */\n onValueChange: (v: number[]) => void;\n /** Lower bound. */\n min: number;\n /** Upper bound. */\n max: number;\n /** Smallest increment the thumb can move by. */\n step: number;\n /** Blocks interaction and removes it from the tab order. */\n disabled?: boolean;\n /** Merged onto the wrapper. */\n className?: string;\n /** Accessible name. Required unless a visible label references it,\n * since a slider has no text of its own.\n */\n \"aria-label\"?: string;\n}\n\n/**\n * A range control for a continuous value.\n *\n * Takes and returns an array so multiple thumbs can be added later without a\n * breaking change, even though it renders one today.\n */\nexport const Slider = forwardRef<HTMLInputElement, SliderProps>(function Slider(\n { value, onValueChange, min, max, step, disabled, className, \"aria-label\": ariaLabel },\n ref,\n) {\n const v = value[0] ?? min;\n const pct = max === min ? 0 : ((v - min) / (max - min)) * 100;\n return (\n <span className={cx(styles.root, ctl.spaceSlider, className)} data-disabled={disabled || undefined}>\n <span className={cx(styles.track, \"spSliderTrack\")}>\n <span className={cx(styles.range, \"spSliderRange\")} style={{ width: `${pct}%` }} />\n </span>\n <span className={cx(styles.thumb, \"spSliderThumb\")} style={{ left: `${pct}%` }} />\n <input\n ref={ref}\n type=\"range\"\n className={cx(styles.input, \"spSliderInput\")}\n value={v}\n min={min}\n max={max}\n step={step}\n disabled={disabled}\n aria-label={ariaLabel}\n onChange={(e) => onValueChange([Number(e.target.value)])}\n />\n </span>\n );\n});\n","\"use client\";\nimport type * as React from \"react\";\nimport { createContext, useContext, useId, type ReactNode } from \"react\";\nimport { cx } from \"./propShared\";\nimport styles from \"./RadioGroup.module.scss\";\n\ninterface GroupCtx {\n value: string;\n onValueChange: (v: string) => void;\n disabled?: boolean;\n name: string;\n}\nconst Ctx = createContext<GroupCtx | null>(null);\n\nexport interface RadioGroupProps {\n /** The selected item's value. Fully controlled. */\n value: string;\n /** Called with the newly selected value. */\n onValueChange: (v: string) => void;\n /** Disables every item at once. */\n disabled?: boolean;\n /** Merged onto the group wrapper. */\n className?: string;\n /** One or more `RadioGroup.Item`. */\n children?: ReactNode;\n}\n\n/**\n * A single-choice control for short lists, where seeing every option at once\n * matters more than saving space. Reach for Select when it does not.\n */\nfunction RadioGroupRoot({ value, onValueChange, disabled, className, children }: RadioGroupProps) {\n const name = useId();\n return (\n <Ctx.Provider value={{ value, onValueChange, disabled, name }}>\n <div role=\"radiogroup\" className={cx(styles.root, className)}>\n {children}\n </div>\n </Ctx.Provider>\n );\n}\n\nexport interface RadioGroupItemProps {\n /** Reported to the group's onValueChange when chosen. */\n value: string;\n /** Disables this option only. */\n disabled?: boolean;\n /** The option's label. Part of the click target, not merely beside it. */\n children?: ReactNode;\n}\n\n/**\n * One option.\n *\n * With children it labels itself: a <label> wraps the input, the orb and the\n * children, so the text is part of the click target. Without children it\n * emits a bare span instead, so an OUTER label can own the association —\n * nesting one label inside another is invalid HTML.\n */\nfunction Item({ value, disabled, children }: RadioGroupItemProps) {\n const g = useContext(Ctx);\n if (!g) throw new Error(\"RadioGroup.Item must be inside a RadioGroup\");\n const isDisabled = disabled || g.disabled;\n const control = (\n <>\n <input\n type=\"radio\"\n className={styles.input}\n name={g.name}\n value={value}\n checked={g.value === value}\n disabled={isDisabled}\n onChange={() => g.onValueChange(value)}\n />\n <span className={cx(styles.orb, \"spRadioOrb\")} aria-hidden=\"true\" />\n </>\n );\n if (children === undefined || children === null) {\n return <span className={styles.item}>{control}</span>;\n }\n return (\n <label className={cx(styles.item, styles.selfLabeled)}>\n {control}\n {children}\n </label>\n );\n}\n\n// Item hangs off the component rather than being a separate export, so the\n// whole API is reachable from the one name a consumer already imported.\nexport const RadioGroup = Object.assign(RadioGroupRoot, { Item });\n","\"use client\";\nimport type * as React from \"react\";\nimport { cx } from \"./propShared\";\nimport styles from \"./Progress.module.scss\";\n\nexport interface ProgressProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Current progress, clamped between 0 and `max`. */\n value: number;\n /** The value representing complete. */\n max?: number;\n}\n\n/**\n * A determinate bar for work you can measure — use Loader when you cannot.\n *\n * Speaks the same visual language as Slider, because a progress bar and a\n * slider track are the same object: one you watch, one you drag.\n */\nexport function Progress({ value, max = 100, className, style, ...rest }: ProgressProps) {\n const pct = max > 0 ? Math.min(Math.max((value / max) * 100, 0), 100) : 0;\n return (\n <div\n {...rest}\n role=\"progressbar\"\n aria-valuenow={value}\n aria-valuemin={0}\n aria-valuemax={max}\n className={cx(styles.progress, className)}\n style={style}\n >\n {/* Unclassed on purpose: a consumer can target `.progress > div`\n without knowing the hashed module class. */}\n <div style={{ width: `${pct}%`, height: \"100%\" }} />\n </div>\n );\n}\n","// 23 icons, ported verbatim from @radix-ui/react-icons\n// (MIT License — Copyright (c) 2022 WorkOS; https://github.com/radix-ui/icons).\n// Uniform 15x15 viewBox, currentColor, decorative by default (aria-hidden) —\n// pass aria-label + aria-hidden={undefined} for semantic uses.\nimport type * as React from \"react\";\n\nexport type IconProps = React.SVGAttributes<SVGSVGElement>;\n\nconst base = {\n width: 15,\n height: 15,\n viewBox: \"0 0 15 15\",\n fill: \"none\",\n xmlns: \"http://www.w3.org/2000/svg\",\n \"aria-hidden\": true,\n} as const;\n\nexport function Share2Icon(props: IconProps) {\n return (\n <svg {...base} {...props}>\n <path\n d=\"M3.5 5.00006C3.22386 5.00006 3 5.22392 3 5.50006L3 11.5001C3 11.7762 3.22386 12.0001 3.5 12.0001L11.5 12.0001C11.7761 12.0001 12 11.7762 12 11.5001L12 5.50006C12 5.22392 11.7761 5.00006 11.5 5.00006L10.25 5.00006C9.97386 5.00006 9.75 4.7762 9.75 4.50006C9.75 4.22392 9.97386 4.00006 10.25 4.00006L11.5 4.00006C12.3284 4.00006 13 4.67163 13 5.50006L13 11.5001C13 12.3285 12.3284 13.0001 11.5 13.0001L3.5 13.0001C2.67157 13.0001 2 12.3285 2 11.5001L2 5.50006C2 4.67163 2.67157 4.00006 3.5 4.00006L4.75 4.00006C5.02614 4.00006 5.25 4.22392 5.25 4.50006C5.25 4.7762 5.02614 5.00006 4.75 5.00006L3.5 5.00006ZM7 1.6364L5.5682 3.0682C5.39246 3.24393 5.10754 3.24393 4.9318 3.0682C4.75607 2.89246 4.75607 2.60754 4.9318 2.4318L7.1818 0.181802C7.26619 0.09741 7.38065 0.049999 7.5 0.049999C7.61935 0.049999 7.73381 0.09741 7.8182 0.181802L10.0682 2.4318C10.2439 2.60754 10.2439 2.89246 10.0682 3.0682C9.89246 3.24393 9.60754 3.24393 9.4318 3.0682L8 1.6364L8 8.5C8 8.77614 7.77614 9 7.5 9C7.22386 9 7 8.77614 7 8.5L7 1.6364Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\nexport function ChatBubbleIcon(props: IconProps) {\n return (\n <svg {...base} {...props}>\n <path\n d=\"M12.5 3L2.5 3.00002C1.67157 3.00002 1 3.6716 1 4.50002V9.50003C1 10.3285 1.67157 11 2.5 11H7.50003C7.63264 11 7.75982 11.0527 7.85358 11.1465L10 13.2929V11.5C10 11.2239 10.2239 11 10.5 11H12.5C13.3284 11 14 10.3285 14 9.50003V4.5C14 3.67157 13.3284 3 12.5 3ZM2.49999 2.00002L12.5 2C13.8807 2 15 3.11929 15 4.5V9.50003C15 10.8807 13.8807 12 12.5 12H11V14.5C11 14.7022 10.8782 14.8845 10.6913 14.9619C10.5045 15.0393 10.2894 14.9965 10.1464 14.8536L7.29292 12H2.5C1.11929 12 0 10.8807 0 9.50003V4.50002C0 3.11931 1.11928 2.00003 2.49999 2.00002Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\nexport function PlusIcon(props: IconProps) {\n return (\n <svg {...base} {...props}>\n <path\n d=\"M8 2.75C8 2.47386 7.77614 2.25 7.5 2.25C7.22386 2.25 7 2.47386 7 2.75V7H2.75C2.47386 7 2.25 7.22386 2.25 7.5C2.25 7.77614 2.47386 8 2.75 8H7V12.25C7 12.5261 7.22386 12.75 7.5 12.75C7.77614 12.75 8 12.5261 8 12.25V8H12.25C12.5261 8 12.75 7.77614 12.75 7.5C12.75 7.22386 12.5261 7 12.25 7H8V2.75Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\nexport function Pencil1Icon(props: IconProps) {\n return (\n <svg {...base} {...props}>\n <path\n d=\"M11.8536 1.14645C11.6583 0.951184 11.3417 0.951184 11.1465 1.14645L3.71455 8.57836C3.62459 8.66832 3.55263 8.77461 3.50251 8.89155L2.04044 12.303C1.9599 12.491 2.00189 12.709 2.14646 12.8536C2.29103 12.9981 2.50905 13.0401 2.69697 12.9596L6.10847 11.4975C6.2254 11.4474 6.3317 11.3754 6.42166 11.2855L13.8536 3.85355C14.0488 3.65829 14.0488 3.34171 13.8536 3.14645L11.8536 1.14645ZM4.42166 9.28547L11.5 2.20711L12.7929 3.5L5.71455 10.5784L4.21924 11.2192L3.78081 10.7808L4.42166 9.28547Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\nexport function HeartFilledIcon(props: IconProps) {\n return (\n <svg {...base} {...props}>\n <path\n d=\"M1.35248 4.90532C1.35248 2.94498 2.936 1.35248 4.89346 1.35248C6.25769 1.35248 6.86058 1.92336 7.50002 2.93545C8.13946 1.92336 8.74235 1.35248 10.1066 1.35248C12.064 1.35248 13.6476 2.94498 13.6476 4.90532C13.6476 6.74041 12.6013 8.50508 11.4008 9.96927C10.2636 11.3562 8.92194 12.5508 8.00601 13.3664C7.94645 13.4194 7.88869 13.4709 7.83291 13.5206C7.64324 13.6899 7.3568 13.6899 7.16713 13.5206C7.11135 13.4709 7.05359 13.4194 6.99403 13.3664C6.0781 12.5508 4.73641 11.3562 3.59926 9.96927C2.39872 8.50508 1.35248 6.74041 1.35248 4.90532Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\nexport function ExitFullScreenIcon(props: IconProps) {\n return (\n <svg {...base} {...props}>\n <path\n d=\"M5.5 2C5.77614 2 6 2.22386 6 2.5V5.5C6 5.77614 5.77614 6 5.5 6H2.5C2.22386 6 2 5.77614 2 5.5C2 5.22386 2.22386 5 2.5 5H5V2.5C5 2.22386 5.22386 2 5.5 2ZM9.5 2C9.77614 2 10 2.22386 10 2.5V5H12.5C12.7761 5 13 5.22386 13 5.5C13 5.77614 12.7761 6 12.5 6H9.5C9.22386 6 9 5.77614 9 5.5V2.5C9 2.22386 9.22386 2 9.5 2ZM2 9.5C2 9.22386 2.22386 9 2.5 9H5.5C5.77614 9 6 9.22386 6 9.5V12.5C6 12.7761 5.77614 13 5.5 13C5.22386 13 5 12.7761 5 12.5V10H2.5C2.22386 10 2 9.77614 2 9.5ZM9 9.5C9 9.22386 9.22386 9 9.5 9H12.5C12.7761 9 13 9.22386 13 9.5C13 9.77614 12.7761 10 12.5 10H10V12.5C10 12.7761 9.77614 13 9.5 13C9.22386 13 9 12.7761 9 12.5V9.5Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\nexport function EnterFullScreenIcon(props: IconProps) {\n return (\n <svg {...base} {...props}>\n <path\n d=\"M2 2.5C2 2.22386 2.22386 2 2.5 2H5.5C5.77614 2 6 2.22386 6 2.5C6 2.77614 5.77614 3 5.5 3H3V5.5C3 5.77614 2.77614 6 2.5 6C2.22386 6 2 5.77614 2 5.5V2.5ZM9 2.5C9 2.22386 9.22386 2 9.5 2H12.5C12.7761 2 13 2.22386 13 2.5V5.5C13 5.77614 12.7761 6 12.5 6C12.2239 6 12 5.77614 12 5.5V3H9.5C9.22386 3 9 2.77614 9 2.5ZM2.5 9C2.77614 9 3 9.22386 3 9.5V12H5.5C5.77614 12 6 12.2239 6 12.5C6 12.7761 5.77614 13 5.5 13H2.5C2.22386 13 2 12.7761 2 12.5V9.5C2 9.22386 2.22386 9 2.5 9ZM12.5 9C12.7761 9 13 9.22386 13 9.5V12.5C13 12.7761 12.7761 13 12.5 13H9.5C9.22386 13 9 12.7761 9 12.5C9 12.2239 9.22386 12 9.5 12H12V9.5C12 9.22386 12.2239 9 12.5 9Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\nexport function CheckIcon(props: IconProps) {\n return (\n <svg {...base} {...props}>\n <path\n d=\"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\nexport function TrashIcon(props: IconProps) {\n return (\n <svg {...base} {...props}>\n <path\n d=\"M5.5 1C5.22386 1 5 1.22386 5 1.5C5 1.77614 5.22386 2 5.5 2H9.5C9.77614 2 10 1.77614 10 1.5C10 1.22386 9.77614 1 9.5 1H5.5ZM3 3.5C3 3.22386 3.22386 3 3.5 3H5H10H11.5C11.7761 3 12 3.22386 12 3.5C12 3.77614 11.7761 4 11.5 4H11V12C11 12.5523 10.5523 13 10 13H5C4.44772 13 4 12.5523 4 12V4L3.5 4C3.22386 4 3 3.77614 3 3.5ZM5 4H10V12H5V4Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\nexport function QuestionMarkCircledIcon(props: IconProps) {\n return (\n <svg {...base} {...props}>\n <path\n d=\"M0.877075 7.49972C0.877075 3.84204 3.84222 0.876892 7.49991 0.876892C11.1576 0.876892 14.1227 3.84204 14.1227 7.49972C14.1227 11.1574 11.1576 14.1226 7.49991 14.1226C3.84222 14.1226 0.877075 11.1574 0.877075 7.49972ZM7.49991 1.82689C4.36689 1.82689 1.82708 4.36671 1.82708 7.49972C1.82708 10.6327 4.36689 13.1726 7.49991 13.1726C10.6329 13.1726 13.1727 10.6327 13.1727 7.49972C13.1727 4.36671 10.6329 1.82689 7.49991 1.82689ZM8.24993 10.5C8.24993 10.9142 7.91414 11.25 7.49993 11.25C7.08571 11.25 6.74993 10.9142 6.74993 10.5C6.74993 10.0858 7.08571 9.75 7.49993 9.75C7.91414 9.75 8.24993 10.0858 8.24993 10.5ZM6.05003 6.25C6.05003 5.57211 6.63511 4.925 7.50003 4.925C8.36496 4.925 8.95003 5.57211 8.95003 6.25C8.95003 6.74118 8.68002 6.99212 8.21447 7.27494C8.16251 7.30651 8.10258 7.34131 8.03847 7.37854L8.03841 7.37858C7.85521 7.48497 7.63788 7.61119 7.47449 7.73849C7.23214 7.92732 6.95003 8.23198 6.95003 8.7C6.95004 9.00376 7.19628 9.25 7.50004 9.25C7.8024 9.25 8.04778 9.00601 8.05002 8.70417L8.05056 8.7033C8.05924 8.6896 8.08493 8.65735 8.15058 8.6062C8.25207 8.52712 8.36508 8.46163 8.51567 8.37436L8.51571 8.37433C8.59422 8.32883 8.68296 8.27741 8.78559 8.21506C9.32004 7.89038 10.05 7.35382 10.05 6.25C10.05 4.92789 8.93511 3.825 7.50003 3.825C6.06496 3.825 4.95003 4.92789 4.95003 6.25C4.95003 6.55376 5.19628 6.8 5.50003 6.8C5.80379 6.8 6.05003 6.55376 6.05003 6.25Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\nexport function PersonIcon(props: IconProps) {\n return (\n <svg {...base} {...props}>\n <path\n d=\"M7.5 0.875C5.49797 0.875 3.875 2.49797 3.875 4.5C3.875 6.15288 4.98124 7.54738 6.49373 7.98351C5.2997 8.12901 4.27557 8.55134 3.50407 9.31167C2.52216 10.2794 2.02502 11.72 2.02502 13.5999C2.02502 13.8623 2.23769 14.0749 2.50002 14.0749C2.76236 14.0749 2.97502 13.8623 2.97502 13.5999C2.97502 11.8799 3.42786 10.7206 4.17091 9.9883C4.91536 9.25463 6.02674 8.87499 7.49995 8.87499C8.97317 8.87499 10.0846 9.25463 10.8291 9.98831C11.5721 10.7206 12.025 11.8799 12.025 13.5999C12.025 13.8623 12.2376 14.0749 12.5 14.0749C12.7623 14.075 12.975 13.8623 12.975 13.6C12.975 11.72 12.4778 10.2794 11.4959 9.31166C10.7244 8.55135 9.70025 8.12903 8.50625 7.98352C10.0187 7.5474 11.125 6.15289 11.125 4.5C11.125 2.49797 9.50203 0.875 7.5 0.875ZM4.825 4.5C4.825 3.02264 6.02264 1.825 7.5 1.825C8.97736 1.825 10.175 3.02264 10.175 4.5C10.175 5.97736 8.97736 7.175 7.5 7.175C6.02264 7.175 4.825 5.97736 4.825 4.5Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\nexport function MinusIcon(props: IconProps) {\n return (\n <svg {...base} {...props}>\n <path\n d=\"M2.25 7.5C2.25 7.22386 2.47386 7 2.75 7H12.25C12.5261 7 12.75 7.22386 12.75 7.5C12.75 7.77614 12.5261 8 12.25 8H2.75C2.47386 8 2.25 7.77614 2.25 7.5Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\nexport function MagnifyingGlassIcon(props: IconProps) {\n return (\n <svg {...base} {...props}>\n <path\n d=\"M10 6.5C10 8.433 8.433 10 6.5 10C4.567 10 3 8.433 3 6.5C3 4.567 4.567 3 6.5 3C8.433 3 10 4.567 10 6.5ZM9.30884 10.0159C8.53901 10.6318 7.56251 11 6.5 11C4.01472 11 2 8.98528 2 6.5C2 4.01472 4.01472 2 6.5 2C8.98528 2 11 4.01472 11 6.5C11 7.56251 10.6318 8.53901 10.0159 9.30884L12.8536 12.1464C13.0488 12.3417 13.0488 12.6583 12.8536 12.8536C12.6583 13.0488 12.3417 13.0488 12.1464 12.8536L9.30884 10.0159Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\nexport function HeartIcon(props: IconProps) {\n return (\n <svg {...base} {...props}>\n <path\n d=\"M4.89346 2.35248C3.49195 2.35248 2.35248 3.49359 2.35248 4.90532C2.35248 6.38164 3.20954 7.9168 4.37255 9.33522C5.39396 10.581 6.59464 11.6702 7.50002 12.4778C8.4054 11.6702 9.60608 10.581 10.6275 9.33522C11.7905 7.9168 12.6476 6.38164 12.6476 4.90532C12.6476 3.49359 11.5081 2.35248 10.1066 2.35248C9.27059 2.35248 8.81894 2.64323 8.5397 2.95843C8.27877 3.25295 8.14623 3.58566 8.02501 3.88993C8.00391 3.9429 7.98315 3.99501 7.96211 4.04591C7.88482 4.23294 7.7024 4.35494 7.50002 4.35494C7.29765 4.35494 7.11523 4.23295 7.03793 4.04592C7.01689 3.99501 6.99612 3.94289 6.97502 3.8899C6.8538 3.58564 6.72126 3.25294 6.46034 2.95843C6.18109 2.64323 5.72945 2.35248 4.89346 2.35248ZM1.35248 4.90532C1.35248 2.94498 2.936 1.35248 4.89346 1.35248C6.0084 1.35248 6.73504 1.76049 7.20884 2.2953C7.32062 2.42147 7.41686 2.55382 7.50002 2.68545C7.58318 2.55382 7.67941 2.42147 7.79119 2.2953C8.265 1.76049 8.99164 1.35248 10.1066 1.35248C12.064 1.35248 13.6476 2.94498 13.6476 4.90532C13.6476 6.74041 12.6013 8.50508 11.4008 9.96927C10.2636 11.3562 8.92194 12.5508 8.00601 13.3664C7.94645 13.4194 7.88869 13.4709 7.83291 13.5206C7.64324 13.6899 7.3568 13.6899 7.16713 13.5206C7.11135 13.4709 7.05359 13.4194 6.99403 13.3664C6.0781 12.5508 4.73641 11.3562 3.59926 9.96927C2.39872 8.50508 1.35248 6.74041 1.35248 4.90532Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\nexport function ChevronUpIcon(props: IconProps) {\n return (\n <svg {...base} {...props}>\n <path\n d=\"M3.13523 8.84197C3.3241 9.04343 3.64052 9.05363 3.84197 8.86477L7.5 5.43536L11.158 8.86477C11.3595 9.05363 11.6759 9.04343 11.8648 8.84197C12.0536 8.64051 12.0434 8.32409 11.842 8.13523L7.84197 4.38523C7.64964 4.20492 7.35036 4.20492 7.15803 4.38523L3.15803 8.13523C2.95657 8.32409 2.94637 8.64051 3.13523 8.84197Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\nexport function ChevronDownIcon(props: IconProps) {\n return (\n <svg {...base} {...props}>\n <path\n d=\"M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\n/** The house directional chevrons (Radix geometry, matching Up/Down above).\n * These replaced the typographic arrows: a text glyph's shape is whatever the\n * viewer's font decides, and the owner called the result poorly shaped. Used\n * by every \"onward\" CTA and \"back\" button. */\nexport function ChevronRightIcon(props: IconProps) {\n return (\n <svg {...base} {...props}>\n <path\n d=\"M6.1584 3.13508C5.95694 3.32394 5.94673 3.64036 6.13559 3.84182L9.56499 7.49991L6.13559 11.158C5.94673 11.3595 5.95694 11.6759 6.1584 11.8647C6.35986 12.0536 6.67628 12.0434 6.86514 11.8419L10.6151 7.84182C10.7954 7.64946 10.7954 7.35036 10.6151 7.158L6.86514 3.15801C6.67628 2.95655 6.35986 2.94634 6.1584 3.13508Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\nexport function ChevronLeftIcon(props: IconProps) {\n return (\n <svg {...base} {...props}>\n <path\n d=\"M8.84182 3.13508C9.04328 3.32394 9.05348 3.64036 8.86462 3.84182L5.43523 7.49991L8.86462 11.158C9.05348 11.3595 9.04328 11.6759 8.84182 11.8647C8.64036 12.0536 8.32394 12.0434 8.13508 11.8419L4.38508 7.84182C4.20477 7.64946 4.20477 7.35036 4.38508 7.158L8.13508 3.15801C8.32394 2.95655 8.64036 2.94634 8.84182 3.13508Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\nexport function BookmarkIcon(props: IconProps) {\n return (\n <svg {...base} {...props}>\n <path\n d=\"M3 2.5C3 2.22386 3.22386 2 3.5 2H11.5C11.7761 2 12 2.22386 12 2.5V13.5C12 13.6818 11.9014 13.8492 11.7424 13.9373C11.5834 14.0254 11.3891 14.0203 11.235 13.924L7.5 11.5896L3.765 13.924C3.61087 14.0203 3.41659 14.0254 3.25762 13.9373C3.09864 13.8492 3 13.6818 3 13.5V2.5ZM4 3V12.5979L6.97 10.7416C7.29427 10.539 7.70573 10.539 8.03 10.7416L11 12.5979V3H4Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\n/** Dialog dismiss glyph — a plain X, used by Dialog.Content's corner button. */\nexport function XIcon(props: IconProps) {\n return (\n <svg viewBox=\"0 0 15 15\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" width=\"15\" height=\"15\" {...props}>\n <path\n d=\"M11.8 3.2a.6.6 0 0 0-.85 0L7.5 6.65 4.05 3.2a.6.6 0 1 0-.85.85L6.65 7.5 3.2 10.95a.6.6 0 1 0 .85.85L7.5 8.35l3.45 3.45a.6.6 0 0 0 .85-.85L8.35 7.5l3.45-3.45a.6.6 0 0 0 0-.85Z\"\n fill=\"currentColor\"\n />\n </svg>\n );\n}\n\nexport function InfoCircledIcon(props: IconProps) {\n return (\n <svg {...base} {...props}>\n <path\n d=\"M7.49991 0.876892C3.84222 0.876892 0.877075 3.84204 0.877075 7.49972C0.877075 11.1574 3.84222 14.1226 7.49991 14.1226C11.1576 14.1226 14.1227 11.1574 14.1227 7.49972C14.1227 3.84204 11.1576 0.876892 7.49991 0.876892ZM1.82707 7.49972C1.82707 4.36671 4.36689 1.82689 7.49991 1.82689C10.6329 1.82689 13.1727 4.36671 13.1727 7.49972C13.1727 10.6327 10.6329 13.1726 7.49991 13.1726C4.36689 13.1726 1.82707 10.6327 1.82707 7.49972ZM8.24992 4.49999C8.24992 4.9142 7.91413 5.24999 7.49992 5.24999C7.08571 5.24999 6.74992 4.9142 6.74992 4.49999C6.74992 4.08577 7.08571 3.74999 7.49992 3.74999C7.91413 3.74999 8.24992 4.08577 8.24992 4.49999ZM6.00003 5.99999H6.50003H7.50003C7.77618 5.99999 8.00003 6.22384 8.00003 6.49999V9.99999H8.50003H9.00003V11H8.50003H7.50003H6.50003H6.00003V9.99999H6.50003H7.00003V6.99999H6.50003H6.00003V5.99999Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\nexport function ExclamationTriangleIcon(props: IconProps) {\n return (\n <svg {...base} {...props}>\n <path\n d=\"M8.4449 0.608765C8.0183 -0.107015 6.9817 -0.107015 6.55509 0.608766L0.161178 11.3368C-0.275824 12.07 0.252503 13 1.10608 13H13.8939C14.7475 13 15.2758 12.07 14.8388 11.3368L8.4449 0.608765ZM7.4141 1.12073C7.45288 1.05566 7.54712 1.05566 7.5859 1.12073L13.9798 11.8488C14.0196 11.9154 13.9715 12 13.8939 12H1.10608C1.02849 12 0.980454 11.9154 1.02018 11.8488L7.4141 1.12073ZM6.8269 4.48611C6.81221 4.10423 7.11783 3.78663 7.5 3.78663C7.88217 3.78663 8.18778 4.10423 8.1731 4.48612L8.01921 8.48701C8.00848 8.766 7.7792 8.98664 7.5 8.98664C7.2208 8.98664 6.99151 8.766 6.98078 8.48701L6.8269 4.48611ZM8.24989 10.476C8.24989 10.8902 7.9141 11.226 7.49989 11.226C7.08567 11.226 6.74989 10.8902 6.74989 10.476C6.74989 10.0618 7.08567 9.72599 7.49989 9.72599C7.9141 9.72599 8.24989 10.0618 8.24989 10.476Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\nexport function CrossCircledIcon(props: IconProps) {\n return (\n <svg {...base} {...props}>\n <path\n d=\"M0.877075 7.49988C0.877075 3.84219 3.84222 0.877045 7.49991 0.877045C11.1576 0.877045 14.1227 3.84219 14.1227 7.49988C14.1227 11.1575 11.1576 14.1227 7.49991 14.1227C3.84222 14.1227 0.877075 11.1575 0.877075 7.49988ZM7.49991 1.82704C4.36689 1.82704 1.82708 4.36686 1.82708 7.49988C1.82708 10.6329 4.36689 13.1727 7.49991 13.1727C10.6329 13.1727 13.1727 10.6329 13.1727 7.49988C13.1727 4.36686 10.6329 1.82704 7.49991 1.82704ZM9.85358 5.14644C10.0488 5.3417 10.0488 5.65829 9.85358 5.85355L8.20713 7.49999L9.85358 9.14644C10.0488 9.3417 10.0488 9.65829 9.85358 9.85355C9.65832 10.0488 9.34173 10.0488 9.14647 9.85355L7.50002 8.2071L5.85358 9.85355C5.65832 10.0488 5.34173 10.0488 5.14647 9.85355C4.95121 9.65829 4.95121 9.3417 5.14647 9.14644L6.79292 7.49999L5.14647 5.85355C4.95121 5.65829 4.95121 5.3417 5.14647 5.14644C5.34173 4.95118 5.65832 4.95118 5.85358 5.14644L7.50002 6.79289L9.14647 5.14644C9.34173 4.95118 9.65832 4.95118 9.85358 5.14644Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n","\"use client\";\nimport type * as React from \"react\";\nimport { forwardRef, type ReactNode } from \"react\";\nimport { cx } from \"./propShared\";\nimport { InfoCircledIcon, ExclamationTriangleIcon, CrossCircledIcon } from \"./icons\";\nimport styles from \"./Message.module.scss\";\n\nexport type MessageVariant = \"info\" | \"warning\" | \"alert\";\n\n/** Each variant carries its own glyph, so the message reads at a glance\n * before any of its words do. Overridable per instance via `icon`. */\nconst ICONS: Record<MessageVariant, ReactNode> = {\n info: <InfoCircledIcon />,\n warning: <ExclamationTriangleIcon />,\n alert: <CrossCircledIcon />,\n};\n\n/**\n * How loudly each variant announces itself.\n *\n * `alert` uses role=\"alert\", which is assertive: it interrupts whatever a\n * screen reader is saying. That is right for something gone wrong and wrong\n * for everything else, so info and warning are polite status regions that\n * wait their turn.\n */\nconst ROLES: Record<MessageVariant, { role: string; live?: \"polite\" }> = {\n info: { role: \"status\", live: \"polite\" },\n warning: { role: \"status\", live: \"polite\" },\n alert: { role: \"alert\" },\n};\n\nexport interface MessageProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> {\n /** Which message this is. `info` states something, `warning` flags a risk\n * worth acting on, `alert` reports something already wrong. Default\n * `info`. */\n variant?: MessageVariant;\n /** An optional bold line above the body. Omit for a single-line message —\n * a title that merely restates the body is noise.\n *\n * This shadows the HTML `title` attribute, which took a string and showed\n * a browser tooltip. A tooltip on a banner nobody hovers was never the\n * useful reading of the name. */\n title?: ReactNode;\n /** Replaces the variant's own glyph. Pass `null` for no icon at all. */\n icon?: ReactNode;\n /** The message. */\n children?: ReactNode;\n}\n\n/**\n * A banner that tells the reader something about the state of the page — a\n * risk, a result, a failure.\n *\n * The three variants do not merely change hue. `info` is lit like the rest of\n * the system, cool and calm; `warning` warms the rim to amber; `alert` uses\n * the ember treatment, the same warm limb the destructive Button wears. Each\n * carries its own glyph so the kind of message reads before the words do.\n *\n * For a decision the reader must make, reach for `AlertDialog` instead — a\n * message states, it does not ask.\n */\nexport const Message = forwardRef<HTMLDivElement, MessageProps>(function Message(\n { variant = \"info\", title, icon, className, children, ...rest },\n ref,\n) {\n const glyph = icon === undefined ? ICONS[variant] : icon;\n const { role, live } = ROLES[variant];\n\n return (\n <div\n {...rest}\n ref={ref}\n role={role}\n aria-live={live}\n className={cx(styles.message, styles[variant], className)}\n >\n {glyph != null && (\n <span className={styles.icon} aria-hidden=\"true\">\n {glyph}\n </span>\n )}\n <div className={styles.body}>\n {title != null && <p className={styles.title}>{title}</p>}\n {children != null && <div className={styles.text}>{children}</div>}\n </div>\n </div>\n );\n});\n","// src/components/ui/Dialog.tsx\n// Compound Dialog matching the Radix JSX shape on a native <dialog>:\n// top-layer stacking (nested/stacked dialogs work), built-in focus trap and\n// focus return, Esc via the `cancel` event. Both controlled (open/\n// onOpenChange) and Trigger-driven uncontrolled sites are supported — the\n// inventory has both. Esc handoff with the in-house Select: a capture-phase\n// keydown checks for an open listbox inside the dialog and flags the next\n// `cancel` to be swallowed, so one Esc closes the Select, the next closes\n// the dialog (matching the Radix-era behavior sites were built against).\n\"use client\";\nimport type * as React from \"react\";\nimport { XIcon } from \"./icons\";\nimport {\n cloneElement, createContext, isValidElement, useContext, useEffect,\n useId, useLayoutEffect, useRef, useState, type ReactNode,\n} from \"react\";\nimport { cx } from \"./propShared\";\nimport { Heading, type HeadingProps } from \"./Heading\";\nimport { Text, type TextProps } from \"./Text\";\nimport styles from \"./Dialog.module.scss\";\n\n// Body scroll-lock reference count, shared across every mounted Content\n// instance (module scope, not per-instance state) — Dialog and AlertDialog\n// stack on top of one another, and per-instance prev-capture couldn't tell\n// \"I'm the last one closing\" from \"another instance is still open\" when\n// unmounts land out of open-order. A plain 0→1 / 1→0 edge count is\n// order-proof: overflow is locked exactly while count > 0, regardless of\n// which instance opened or closed first.\nlet lockCount = 0;\n\nexport interface DialogCtx {\n open: boolean;\n setOpen: (o: boolean) => void;\n titleId: string;\n descId: string;\n /** alert dialogs: no backdrop light-dismiss */\n alert?: boolean;\n /** whether a Description is currently mounted (drives aria-describedby) */\n hasDesc: boolean;\n setHasDesc: (v: boolean) => void;\n}\nconst Ctx = createContext<DialogCtx | null>(null);\nexport const useDialog = () => {\n const ctx = useContext(Ctx);\n if (!ctx) throw new Error(\"Dialog parts must be inside a Dialog\");\n return ctx;\n};\n\nexport interface DialogProps {\n /** Controls the dialog. Omit both this and onOpenChange to let the dialog\n * manage its own state. */\n open?: boolean;\n /** Called whenever the dialog opens or closes, including via Escape or a\n * backdrop click. */\n onOpenChange?: (o: boolean) => void;\n /** A `Trigger` and a `Content`, in any arrangement — this renders\n * nothing itself, so they can sit anywhere beneath it. */\n children?: ReactNode;\n}\n\n/** Shared by Dialog and AlertDialog; only the alert flag differs. */\nexport function makeRoot(alert: boolean) {\n return function DialogRoot({ open, onOpenChange, children }: DialogProps) {\n const [internal, setInternal] = useState(false);\n const isControlled = open !== undefined;\n const actual = isControlled ? open : internal;\n const setOpen = (o: boolean) => {\n if (!isControlled) setInternal(o);\n onOpenChange?.(o);\n };\n const titleId = useId();\n const descId = useId();\n const [hasDesc, setHasDesc] = useState(false);\n return (\n <Ctx.Provider value={{ open: actual, setOpen, titleId, descId, alert, hasDesc, setHasDesc }}>\n {children}\n </Ctx.Provider>\n );\n };\n}\n/**\n * Owns a dialog's open state. Works controlled via `open`/`onOpenChange`, or\n * uncontrolled if you pass neither.\n *\n * Renders nothing itself — it only provides context, so Trigger and Content\n * can sit anywhere beneath it in the tree.\n */\nconst Root = makeRoot(false);\n\ntype Clickable = React.ReactElement<{ onClick?: (e: React.MouseEvent) => void }>;\nconst chainOpen = (child: ReactNode, fn: () => void): ReactNode => {\n if (!isValidElement(child)) return child;\n const c = child as Clickable;\n return cloneElement(c, {\n onClick: (e: React.MouseEvent) => { c.props.onClick?.(e); fn(); },\n });\n};\n\n/**\n * Opens the dialog. Chains onto its child's existing click handler rather\n * than replacing it, and renders no element of its own — so the child stays\n * whatever it already was, button or otherwise.\n */\nexport function Trigger({\n children,\n}: {\n /** The control that opens the dialog. Its own onClick still fires. */\n children?: ReactNode;\n}) {\n const d = useDialog();\n return <>{chainOpen(children, () => d.setOpen(true))}</>;\n}\n\n/**\n * Closes the dialog. Same shape as Trigger: wraps its child, adds a close on\n * click, and adds no markup.\n */\nexport function Close({\n children,\n}: {\n /** The control that closes the dialog. Its own onClick still fires. */\n children?: ReactNode;\n}) {\n const d = useDialog();\n return <>{chainOpen(children, () => d.setOpen(false))}</>;\n}\n\nexport interface ContentProps extends React.HTMLAttributes<HTMLDialogElement> {\n /** Padding and radius step. 4 is roomier, for dialogs carrying a form. */\n size?: \"3\" | \"4\";\n /** Caps the dialog's width, e.g. \"480px\". Without it the dialog uses its\n * own default and grows with its content. */\n maxWidth?: string;\n /** Dialog contents. Include a Title — it is the accessible name. */\n children?: ReactNode;\n}\n\n/**\n * The dialog surface. Built on the native `<dialog>` element, so the browser\n * supplies the top layer, focus trapping and Escape handling rather than the\n * library reimplementing them.\n *\n * Dismissible by Escape or a click on the backdrop; AlertDialog's Content\n * deliberately is not.\n */\nexport function Content({ size = \"3\", maxWidth, className, style, children, ...rest }: ContentProps) {\n const d = useDialog();\n const ref = useRef<HTMLDialogElement | null>(null);\n const swallowCancel = useRef(false);\n // Backdrop dismissal must require BOTH the mousedown/pointerdown AND the\n // click to land on the backdrop (the <dialog> element itself, not the\n // inner content wrapper) — otherwise a text-selection drag that starts in\n // the content and ends up released over the backdrop would close the\n // dialog on mouseup even though the gesture began inside it.\n const pointerDownOnBackdrop = useRef(false);\n\n // Imperative <dialog> API follows the declarative open prop (handles the\n // delayed first open of AccountsIntroModal's 900ms timer too).\n useEffect(() => {\n const el = ref.current;\n if (!el) return;\n if (d.open && !el.open) el.showModal();\n else if (!d.open && el.open) el.close();\n }, [d.open]);\n\n // Body scroll lock while open (Radix did this; panels behind rely on it).\n // Module-level counter (see `lockCount` above) so stacked dialogs compose:\n // only the 0→1 transition locks, only the 1→0 transition unlocks.\n useEffect(() => {\n if (!d.open) return;\n lockCount += 1;\n if (lockCount === 1) document.body.style.overflow = \"hidden\";\n return () => {\n lockCount -= 1;\n if (lockCount === 0) document.body.style.overflow = \"\";\n };\n }, [d.open]);\n\n return (\n <dialog\n {...rest}\n ref={ref}\n role={d.alert ? \"alertdialog\" : undefined}\n aria-labelledby={d.titleId}\n aria-describedby={d.hasDesc ? d.descId : undefined}\n className={cx(styles.dialog, \"spDialog\", size === \"4\" && styles.size4, className)}\n style={{ ...(maxWidth ? { maxWidth } : null), ...style }}\n onKeyDownCapture={(e) => {\n if (e.key !== \"Escape\") return;\n // A nested dialog is open inside this one (e.g. an AlertDialog\n // launched from this dialog's content) — that inner dialog owns\n // this Esc; don't let the outer one arm its own swallow logic on\n // an event that's about to close a dialog it isn't itself.\n if (ref.current?.querySelector(\"dialog[open]\")) return;\n // Esc while an in-house Select's listbox is open inside this dialog:\n // the Select closes itself; swallow the dialog's own cancel.\n if (ref.current?.querySelector('[role=\"listbox\"]:not([hidden])')) {\n swallowCancel.current = true;\n }\n }}\n onCancel={(e) => {\n e.preventDefault(); // we route ALL closes through React state\n if (swallowCancel.current) { swallowCancel.current = false; return; }\n d.setOpen(false);\n }}\n onClose={() => {\n // Belt-and-suspenders: any UA-initiated close we didn't route\n // through onCancel (a non-cancelable close request, or a future\n // method=\"dialog\" form submission inside the content) still fires\n // `close`. Resync React state so `open` doesn't get stranded true\n // while the native element is actually closed.\n if (d.open) d.setOpen(false);\n }}\n onPointerDown={(e) => {\n pointerDownOnBackdrop.current = e.target === ref.current;\n }}\n onClick={(e) => {\n // Backdrop click = clicking the <dialog> element itself (the inner\n // wrapper covers the content area). Alert dialogs don't light-dismiss.\n // Require the pointerdown that started this click to have also\n // landed on the backdrop, so a text-selection drag from the content\n // out to the backdrop doesn't close the dialog on release.\n if (!d.alert && e.target === ref.current && pointerDownOnBackdrop.current) d.setOpen(false);\n }}\n >\n <div className={styles.inner}>\n {/* Every dialog gets the same dismiss affordance in the same place.\n Alert dialogs are excluded on purpose: they ask a question that\n wants an explicit answer, and a corner X is an ambiguous one. */}\n {!d.alert && (\n <button\n type=\"button\"\n className={styles.closeX}\n aria-label=\"Close\"\n onClick={() => d.setOpen(false)}\n >\n <XIcon width={16} height={16} />\n </button>\n )}\n {children}\n </div>\n </dialog>\n );\n}\n\n/**\n * The dialog's accessible name. Wire one up for every dialog — it is what a\n * screen reader announces when the dialog opens.\n */\nexport function Title({ className, ...rest }: HeadingProps) {\n const d = useDialog();\n return <Heading as=\"h2\" size=\"5\" {...rest} id={d.titleId} className={cx(styles.title, className)} />;\n}\n\n/**\n * Supporting copy beneath the title, registered as the dialog's accessible\n * description. Optional, and only announced when present.\n */\nexport function Description(props: TextProps) {\n const d = useDialog();\n // aria-describedby on Content is conditional on a Description actually\n // being mounted (some dialogs render none), so Content can't just point\n // at descId unconditionally. Register/unregister via a layout effect —\n // runs before paint, and Description mounts synchronously with the\n // dialog's content, so there's no visible flash of a missing attribute.\n // Depend on setHasDesc alone (a stable useState setter), not the whole\n // `d` context object — that object is a fresh literal every Root render,\n // so depending on it would re-fire this effect (and its cleanup) on\n // every render instead of just mount/unmount.\n const { setHasDesc } = d;\n useLayoutEffect(() => {\n setHasDesc(true);\n return () => setHasDesc(false);\n }, [setHasDesc]);\n return <Text as=\"p\" {...props} id={d.descId} />;\n}\n\n// The parts hang off the component rather than being separate exports, so the\n// whole API is reachable from the one name a consumer already imported. They\n// stay exported above too, because AlertDialog is assembled from them.\nexport const Dialog = Object.assign(Root, {\n Trigger,\n Close,\n Content,\n Title,\n Description,\n});\n","// The same native-<dialog> engine as Dialog, with alertdialog semantics:\n// role=\"alertdialog\", and NO backdrop light-dismiss — an alert is a decision,\n// so it does not go away because you clicked beside it. Render Cancel before\n// Action so showModal()'s initial focus lands on the safe choice.\n\"use client\";\nimport {\n makeRoot, Trigger, Close,\n Content, Title, Description,\n type DialogProps,\n} from \"./Dialog\";\n\nexport type { DialogProps as AlertDialogProps };\n\n// Cancel and Action are the same component under two names. The name is the\n// point: it says which one is destructive at the call site, and it makes the\n// ordering rule above readable rather than positional trivia. Close chains\n// the child's own onClick before closing, so an Action's handler runs first.\nconst Cancel = Close;\nconst Action = Close;\n\n/**\n * A modal that interrupts to confirm something consequential.\n *\n * Unlike a Dialog it has no backdrop dismissal, because dismissing an alert\n * by missing it is not a decision. Put `Cancel` before `Action` so the safe\n * choice takes focus when it opens.\n */\nexport const AlertDialog = Object.assign(makeRoot(true), {\n Trigger,\n Content,\n Title,\n Description,\n Cancel,\n Action,\n});\n","// src/components/ui/DropdownMenu.tsx\n// role=\"menu\" on a popover=\"auto\" div: top-layer + click-outside dismissal\n// come from the platform. Anchor positioning is manual (align=\"end\" is the\n// only inventoried mode). Roving tabindex arrows per the spec.\n\"use client\";\nimport type * as React from \"react\";\nimport {\n createContext, createElement, isValidElement, useContext,\n useEffect, useId, useLayoutEffect, useRef, useState, type ReactNode,\n} from \"react\";\nimport { cx } from \"./propShared\";\nimport styles from \"./DropdownMenu.module.scss\";\nimport { Button, type ButtonProps } from \"./Button\";\n\ninterface MenuCtx {\n open: boolean;\n setOpen: (o: boolean) => void;\n menuId: string;\n}\nconst Ctx = createContext<MenuCtx | null>(null);\nconst useMenu = () => {\n const ctx = useContext(Ctx);\n if (!ctx) throw new Error(\"DropdownMenu parts must be inside a DropdownMenu\");\n return ctx;\n};\n\n\n\n// Whether the popover's current \"closed\" toggle was initiated by an Item\n// activating rather than a platform light-dismiss (click outside / Esc).\n// Item arms this just before it calls setOpen(false); the root's onToggle\n// reads-and-clears it to decide whether to arm the light-dismiss race guard.\n// It stays in its own context because a mutable ref must not sit on a value\n// object that is also read during render — a ref write would not trigger the\n// re-render that consumers of Ctx expect.\nconst ItemClosedRefCtx = createContext<React.RefObject<boolean> | null>(null);\nconst useItemClosedRef = () => {\n const ref = useContext(ItemClosedRefCtx);\n if (!ref) throw new Error(\"DropdownMenu parts must be inside a DropdownMenu\");\n return ref;\n};\n\n// Plain helper that reads-and-clears the flag, kept out of the click handler\n// so the `.current` access is not mistaken for a ref read during render.\nfunction consumeLightDismissFlag(ref: React.RefObject<boolean>): boolean {\n if (!ref.current) return false;\n ref.current = false;\n return true;\n}\n\n// Same reasoning: Item's asChild onClick is built inside the props object\n// passed to createElement rather than as a literal JSX attribute, so a direct\n// `.current` write there trips the same ref-during-render check.\nfunction markItemInitiatedClose(ref: React.RefObject<boolean>): void {\n ref.current = true;\n}\n\nexport interface DropdownMenuProps extends Omit<ButtonProps, \"children\"> {\n /** The trigger's content. The trigger is always a Button, so this is what\n * goes inside it — text, or an icon with `iconOnly`. */\n label: ReactNode;\n /** Which edge of the trigger the menu lines up with. Use `end` when the\n * trigger sits near the right edge and the menu would overflow. */\n align?: \"start\" | \"end\";\n /** `DropdownMenu.Item`, `.Separator` and `.Label`, in any order. */\n children?: ReactNode;\n}\n\n/**\n * A menu of actions hung off a button.\n *\n * The trigger is built in and is always a Button — a dropdown whose trigger\n * looked like anything else was never a shape worth supporting, and making it\n * arbitrary cost a `cloneElement` that had to graft aria wiring and a click\n * handler onto someone else's element.\n *\n * The menu rides the platform's top layer via `popover`, so click-outside\n * dismissal and stacking come from the browser rather than an approximation.\n * Arrows move between items, Escape closes and returns focus to the trigger.\n */\nfunction DropdownMenuRoot({ label, align = \"start\", children, ...buttonProps }: DropdownMenuProps) {\n const [open, setOpen] = useState(false);\n const menuId = useId();\n const triggerRef = useRef<HTMLButtonElement | null>(null);\n const menuRef = useRef<HTMLDivElement | null>(null);\n const lightDismissedRef = useRef(false);\n const itemClosedRef = useRef(false);\n const [pos, setPos] = useState<{ top: number; left: number | \"auto\"; right: number | \"auto\" } | null>(null);\n\n // useLayoutEffect (not useEffect) so the position is measured and applied\n // synchronously before paint — matches Select's trigger measurement and\n // avoids a one-frame flash at the wrong coordinates.\n useLayoutEffect(() => {\n const el = menuRef.current;\n if (!el) return;\n if (open) {\n // Position under the trigger before entering the top layer.\n const trigger = triggerRef.current;\n if (trigger) {\n const r = trigger.getBoundingClientRect();\n const left = align === \"end\" ? \"auto\" : r.left;\n const right = align === \"end\" ? window.innerWidth - r.right : \"auto\";\n setPos({ top: r.bottom + 6, left, right });\n }\n el.showPopover();\n // Focus the first item for keyboard users.\n el.querySelector<HTMLElement>('[role=\"menuitem\"]')?.focus();\n } else if (el.matches(\":popover-open\")) {\n el.hidePopover();\n }\n }, [open, align]);\n\n // A resize invalidates the anchored position (measured once, at open) —\n // rather than re-measuring on every tick, close the menu, as a light\n // dismiss would.\n useEffect(() => {\n if (!open) return;\n const onResize = () => setOpen(false);\n window.addEventListener(\"resize\", onResize);\n return () => window.removeEventListener(\"resize\", onResize);\n }, [open]);\n\n return (\n <Ctx.Provider value={{ open, setOpen, menuId }}>\n <ItemClosedRefCtx.Provider value={itemClosedRef}>\n <Button\n {...buttonProps}\n ref={triggerRef}\n aria-haspopup=\"menu\"\n aria-expanded={open}\n aria-controls={menuId}\n onClick={(e) => {\n buttonProps.onClick?.(e);\n // Race: clicking the trigger while the menu is open first fires a\n // pointerdown, which the popover API treats as an outside\n // interaction and light-dismisses the popover. The click that\n // completes right after would read the now-stale open===false and\n // immediately reopen the menu it was meant to close. Skip this\n // click's toggle if a light-dismiss just landed in the same\n // gesture.\n if (consumeLightDismissFlag(lightDismissedRef)) return;\n setOpen(!open);\n }}\n >\n {label}\n </Button>\n\n <div\n ref={menuRef}\n id={menuId}\n role=\"menu\"\n popover=\"auto\"\n className={styles.menu}\n style={\n pos\n ? {\n top: pos.top,\n left: pos.left === \"auto\" ? \"auto\" : pos.left,\n right: pos.right === \"auto\" ? \"auto\" : pos.right,\n }\n : undefined\n }\n onToggle={(e: React.SyntheticEvent<HTMLDivElement>) => {\n // Platform light-dismiss (click outside / Esc) → sync React state.\n if ((e.nativeEvent as ToggleEvent).newState === \"closed\") {\n // An Item activating also drives this closed (setOpen(false) →\n // hidePopover() → this same toggle event) — that is not a light\n // dismiss and must not arm the race guard below. Read-and-clear\n // the item's flag to tell the two apart.\n const itemInitiated = itemClosedRef.current;\n itemClosedRef.current = false;\n if (!itemInitiated) {\n // Flag the race window for the trigger's onClick and clear it\n // shortly after — it only needs to survive the current click\n // gesture, not linger.\n lightDismissedRef.current = true;\n setTimeout(() => { lightDismissedRef.current = false; }, 300);\n }\n if (open) setOpen(false);\n }\n }}\n onKeyDown={(e) => {\n const items = Array.from(\n menuRef.current?.querySelectorAll<HTMLElement>('[role=\"menuitem\"]') ?? []\n );\n const idx = items.indexOf(document.activeElement as HTMLElement);\n if (e.key === \"ArrowDown\") { e.preventDefault(); items[Math.min(idx + 1, items.length - 1)]?.focus(); }\n else if (e.key === \"ArrowUp\") { e.preventDefault(); items[Math.max(idx - 1, 0)]?.focus(); }\n else if (e.key === \"Home\") { e.preventDefault(); items[0]?.focus(); }\n else if (e.key === \"End\") { e.preventDefault(); items[items.length - 1]?.focus(); }\n else if (e.key === \"Escape\") { setOpen(false); triggerRef.current?.focus(); }\n }}\n >\n {children}\n </div>\n </ItemClosedRefCtx.Provider>\n </Ctx.Provider>\n );\n}\n\n/**\n * A non-interactive heading for a group of items. Skipped by arrow-key\n * navigation, since there is nothing to activate.\n */\nfunction Label({\n children,\n}: {\n /** Heading text for the group beneath it. Not focusable. */\n children?: ReactNode;\n}) {\n return <div className={styles.label}>{children}</div>;\n}\n\nexport interface DropdownMenuItemProps {\n /** Render the child element instead of the default item — for a link that\n * should stay an anchor rather than becoming a button. */\n asChild?: boolean;\n /** Marks a destructive action, so it reads differently before it is\n * chosen rather than after. */\n color?: \"danger\";\n /** Runs when the item is chosen; the menu closes either way. */\n onSelect?: () => void | Promise<void>;\n /** The item's label. */\n children?: ReactNode;\n}\n\n/**\n * One menu action. `onSelect` fires and the menu closes.\n *\n * Pass `color=\"danger\"` for a destructive action so it reads differently from\n * its neighbours before it is chosen, not after.\n */\nfunction Item({ asChild, color, onSelect, children }: DropdownMenuItemProps) {\n const m = useMenu();\n const itemClosedRef = useItemClosedRef();\n const cls = cx(styles.item, color === \"danger\" && styles.danger);\n const activate = () => {\n markItemInitiatedClose(itemClosedRef);\n m.setOpen(false);\n void onSelect?.();\n };\n if (asChild && isValidElement(children)) {\n const child = children as React.ReactElement<Record<string, unknown>>;\n // Rebuild (rather than cloneElement) so role/tabIndex land BEFORE the\n // child's own attributes (e.g. href) in the emitted markup — cloneElement\n // always keeps pre-existing keys in their original position. Also drop\n // the child's own role/tabIndex (if any) from restProps entirely — a\n // spread landing after the forced menuitem/-1 values would otherwise\n // silently win and undo the forced semantics.\n const {\n className: childClassName, onClick: childOnClick, children: childChildren,\n role: childRole, tabIndex: childTabIndex, ...restProps\n } = child.props;\n // Discarded — pulled out of restProps only so the forced role/tabIndex\n // below can't be silently overwritten by the child's own values.\n void childRole;\n void childTabIndex;\n const originalRef = (child as unknown as { ref?: React.Ref<unknown> }).ref;\n return createElement(\n child.type as React.ElementType,\n {\n key: child.key,\n ref: originalRef,\n role: \"menuitem\",\n tabIndex: -1,\n ...restProps,\n className: cx(cls, childClassName as string | undefined),\n onClick: (e: React.MouseEvent) => {\n (childOnClick as ((e: React.MouseEvent) => void) | undefined)?.(e);\n markItemInitiatedClose(itemClosedRef);\n m.setOpen(false); // real navigation proceeds; menu closes\n },\n },\n childChildren as ReactNode,\n );\n }\n return (\n <button type=\"button\" role=\"menuitem\" tabIndex={-1} className={cls} onClick={activate}>\n {children}\n </button>\n );\n}\n\n/**\n * A rule between groups of items — for separating a destructive action from\n * routine ones, so the two are not adjacent to a moving cursor.\n */\nfunction Separator() {\n return <div role=\"separator\" className={styles.separator} />;\n}\n\n// The parts hang off the component rather than being separate exports, so the\n// whole API is reachable from the one name a consumer already imported.\nexport const DropdownMenu = Object.assign(DropdownMenuRoot, { Item, Separator, Label });\n","// ARIA tabs. Inactive Content unmounts, matching Radix's default.\n\"use client\";\nimport type * as React from \"react\";\nimport { createContext, useContext, useId, type ReactNode } from \"react\";\nimport { cx } from \"./propShared\";\nimport styles from \"./Tabs.module.scss\";\n\ninterface TabsCtx {\n value: string;\n onValueChange: (v: string) => void;\n /** useId()-derived base, shared by Trigger/Content so a trigger's\n * aria-controls always matches its panel's id (and vice versa via\n * aria-labelledby) without either side guessing the other's id. */\n id: string;\n}\nconst Ctx = createContext<TabsCtx | null>(null);\nconst useTabs = () => {\n const ctx = useContext(Ctx);\n if (!ctx) throw new Error(\"Tabs parts must be inside a Tabs\");\n return ctx;\n};\n\nexport interface TabsProps {\n /** The selected tab's value. Fully controlled — there is no default. */\n value: string;\n /** Called with the newly selected tab's value. */\n onValueChange: (v: string) => void;\n /** Merged onto the wrapper div, which is otherwise unstyled. */\n className?: string;\n /** A `Tabs.List` and the `Tabs.Content`s it switches between. */\n children?: ReactNode;\n}\n\n/**\n * Wraps a tab set and owns which tab is showing. Fully controlled — pass\n * `value` and `onValueChange`; there is no uncontrolled mode.\n *\n * Renders a plain div, so it imposes no layout of its own. It also mints the\n * id that pairs each Trigger with its Content, which is why every part has to\n * sit inside it rather than being usable on its own.\n */\nfunction TabsRoot({ value, onValueChange, className, children }: TabsProps) {\n const id = useId();\n return (\n <Ctx.Provider value={{ value, onValueChange, id }}>\n <div className={className}>{children}</div>\n </Ctx.Provider>\n );\n}\n\n/**\n * The row of triggers, and the keyboard model for the set: arrow keys move\n * between tabs, Home and End jump to the ends, each moving focus and\n * selection together as the ARIA tabs pattern expects.\n *\n * Bottom-aligns its children, so an active tab that grows taller rises above\n * its neighbours instead of pushing the row down — the folder-tab effect.\n */\nfunction List({\n children,\n}: {\n /** The Triggers. Their order is the tab order. */\n children?: ReactNode;\n}) {\n return (\n <div\n role=\"tablist\"\n className={cx(styles.list, \"spTabsList\")}\n onKeyDown={(e) => {\n const tabs = Array.from(\n (e.currentTarget as HTMLElement).querySelectorAll<HTMLElement>('[role=\"tab\"]')\n );\n const idx = tabs.indexOf(document.activeElement as HTMLElement);\n if (idx === -1) return;\n if (e.key === \"ArrowRight\") { e.preventDefault(); const t = tabs[(idx + 1) % tabs.length]; t.focus(); t.click(); }\n else if (e.key === \"ArrowLeft\") { e.preventDefault(); const t = tabs[(idx - 1 + tabs.length) % tabs.length]; t.focus(); t.click(); }\n else if (e.key === \"Home\") { e.preventDefault(); const t = tabs[0]; t.focus(); t.click(); }\n else if (e.key === \"End\") { e.preventDefault(); const t = tabs[tabs.length - 1]; t.focus(); t.click(); }\n }}\n >\n {children}\n </div>\n );\n}\n\n/**\n * One tab. Selects its `value` on click and carries the ARIA wiring that ties\n * it to the matching Content.\n *\n * Emits `data-state=\"active\" | \"inactive\"`, which is the hook the active\n * styling keys off — useful if you are restyling tabs from outside.\n */\nfunction Trigger({ value, className, children, ...rest }: {\n /** Selects this value. Must match the Content it reveals. */\n value: string;\n /** Merged with the tab's own classes rather than replacing them. */\n className?: string;\n /** The tab's label. */\n children?: ReactNode;\n} & React.ButtonHTMLAttributes<HTMLButtonElement>) {\n const t = useTabs();\n const active = t.value === value;\n return (\n <button\n {...rest}\n type=\"button\"\n role=\"tab\"\n id={`${t.id}-tab-${value}`}\n aria-selected={active}\n aria-controls={`${t.id}-panel-${value}`}\n tabIndex={active ? 0 : -1}\n data-state={active ? \"active\" : \"inactive\"}\n className={cx(styles.trigger, \"spTabsTrigger\", className)}\n onClick={() => t.onValueChange(value)}\n >\n {children}\n </button>\n );\n}\n\n/**\n * The panel for one tab. Renders only while its `value` is the selected one —\n * inactive panels unmount rather than hide, so their contents do not run,\n * hold state, or appear to a screen reader.\n *\n * Carries no styling: the surface a tab set seats onto is the consumer's, and\n * should match `--sp-tabs-surface-color` so the active tab connects to it.\n */\nfunction Content({\n value,\n children,\n}: {\n /** Shown while this matches the Root's value. Must match a Trigger. */\n value: string;\n /** Panel contents. Unmounted while another tab is selected. */\n children?: ReactNode;\n}) {\n const t = useTabs();\n if (t.value !== value) return null;\n return (\n <div role=\"tabpanel\" id={`${t.id}-panel-${value}`} aria-labelledby={`${t.id}-tab-${value}`}>\n {children}\n </div>\n );\n}\n\n// The parts hang off the component rather than being separate exports, so the\n// whole API is reachable from the one name a consumer already imported.\nexport const Tabs = Object.assign(TabsRoot, { List, Trigger, Content });\n"],"names":["SPACE","spacingStyle","m","mt","mb","p","pb","style","out","cx","parts","Text","forwardRef","as","size","weight","color","className","rest","ref","createElement","styles","Heading","align","Link","asChild","children","cls","merged","isValidElement","child","cloneElement","jsx","cap","s","Flex","gap","direction","justify","wrap","Box","Grid","columns","colCls","Badge","variant","Separator","Card","image","jsxs","mulberry32","a","hashString","h","i","Button","iconOnly","ember","fullWidth","animated","id","useId","starStyles","useMemo","rand","classes","Loader","label","SHOW_DELAY","HIDE_DELAY","SIDE_OFFSET","COLLISION_PADDING","TooltipTrigger","triggerRef","tooltipId","show","hide","e","_a","Tooltip","side","open","setOpen","useState","pos","setPos","useRef","contentRef","showTimer","hideTimer","clearTimers","immediate","useEffect","useLayoutEffect","content","trigger","r","w","centre","start","extent","viewport","pick","near","far","fitsFar","after","before","fitsBefore","fitsAfter","left","below","above","fitsAbove","fitsBelow","Fragment","IconToggle","options","value","onValueChange","orientation","vertical","opt","ctl","ctlModule","Ctx","createContext","useSelect","ctx","useContext","optionId","listboxId","collectItems","walk","nodes","Children","props","Item","SelectRoot","disabled","placeholder","highlighted","setHighlighted","rootRef","listRef","triggerWidth","setTriggerWidth","maxHeight","setMaxHeight","items","values","itemLabels","labelFor","useCallback","v","onDown","el","rect","available","openWith","highlight","move","delta","idx","next","l","_b","selected","Select","TextFieldRoot","inputProps","Slot","TextField","TextArea","Autocomplete","onSelect","icon","caseSensitive","preFiltered","loading","loadingMessage","emptyMessage","footer","active","setActive","wrapRef","listId","haystack","o","shown","needle","selectable","hasContent","showPanel","close","node","choose","option","current","target","onKeyDown","first","last","chosen","activeOption","Slider","min","max","step","ariaLabel","pct","RadioGroupRoot","name","g","isDisabled","control","RadioGroup","Progress","base","Share2Icon","ChatBubbleIcon","PlusIcon","Pencil1Icon","HeartFilledIcon","ExitFullScreenIcon","EnterFullScreenIcon","CheckIcon","TrashIcon","QuestionMarkCircledIcon","PersonIcon","MinusIcon","MagnifyingGlassIcon","HeartIcon","ChevronUpIcon","ChevronDownIcon","ChevronRightIcon","ChevronLeftIcon","BookmarkIcon","XIcon","InfoCircledIcon","ExclamationTriangleIcon","CrossCircledIcon","ICONS","ROLES","Message","title","glyph","role","live","lockCount","useDialog","makeRoot","alert","onOpenChange","internal","setInternal","isControlled","actual","titleId","descId","hasDesc","setHasDesc","Root","chainOpen","fn","c","Trigger","d","Close","Content","maxWidth","swallowCancel","pointerDownOnBackdrop","Title","Description","Dialog","Cancel","Action","AlertDialog","useMenu","ItemClosedRefCtx","useItemClosedRef","consumeLightDismissFlag","markItemInitiatedClose","DropdownMenuRoot","buttonProps","menuId","menuRef","lightDismissedRef","itemClosedRef","right","onResize","itemInitiated","_c","_d","_e","_f","Label","activate","childClassName","childOnClick","childChildren","childRole","childTabIndex","restProps","originalRef","DropdownMenu","useTabs","TabsRoot","List","tabs","t","Tabs"],"mappings":";;;AAeA,MAAMA,KAAmC;AAAA,EACvC,GAAK;AAAA,EACL,GAAK;AAAA,EACL,GAAK;AAAA,EACL,GAAK;AAAA,EACL,GAAK;AAAA,EACL,GAAK;AAAA,EACL,GAAK;AACP;AAEO,SAASC,EACd,EAAE,GAAAC,GAAG,IAAAC,GAAI,IAAAC,GAAI,GAAAC,GAAG,IAAAC,EAAA,GAChBC,GAC2B;AAC3B,QAAMC,IAAqB;AAAA,IACzB,GAAIN,MAAM,UAAa,EAAE,QAAQF,GAAME,CAAC,EAAA;AAAA,IACxC,GAAIC,MAAO,UAAa,EAAE,WAAWH,GAAMG,CAAE,EAAA;AAAA,IAC7C,GAAIC,MAAO,UAAa,EAAE,cAAcJ,GAAMI,CAAE,EAAA;AAAA,IAChD,GAAIC,MAAM,UAAa,EAAE,SAASL,GAAMK,CAAC,EAAA;AAAA,IACzC,GAAIC,MAAO,UAAa,EAAE,eAAeN,GAAMM,CAAE,EAAA;AAAA,IACjD,GAAGC;AAAA,EAAA;AAEL,SAAO,OAAO,KAAKC,CAAG,EAAE,SAAS,IAAIA,IAAM;AAC7C;AAEO,SAASC,KAAMC,GAAkD;AACtE,SAAOA,EAAM,OAAO,OAAO,EAAE,KAAK,GAAG;AACvC;;;;;;;;;;;;;;;GCJaC,KAAOC,EAAmC,SACrD,EAAE,IAAAC,IAAK,QAAQ,MAAAC,GAAM,QAAAC,GAAQ,OAAAC,GAAO,WAAAC,GAAW,OAAAV,GAAO,GAAAL,GAAG,IAAAC,GAAI,IAAAC,GAAI,GAAAC,GAAG,IAAAC,GAAI,GAA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R,KAAO,OAAO,OAAOJ,IAAU,EAAE,MAAAC,IAAM,SAAA3C,IAAS,SAAAG,IAAS;"}
1
+ {"version":3,"file":"index.js","sources":["../src/components/propShared.ts","../src/components/Text.tsx","../src/components/Heading.tsx","../src/components/Link.tsx","../src/components/Flex.tsx","../src/components/Box.tsx","../src/components/Grid.tsx","../src/components/Badge.tsx","../src/components/Separator.tsx","../src/components/Card.tsx","../src/components/icons.tsx","../src/styles/spaceControls.ts","../src/components/Pagination.tsx","../src/internal/seededRandom.ts","../src/components/Button.tsx","../src/components/Loader.tsx","../src/internal/showMeasured.ts","../src/components/Tooltip.tsx","../src/components/IconToggle.tsx","../src/components/Select.tsx","../src/components/TextField.tsx","../src/components/TextArea.tsx","../src/components/Autocomplete.tsx","../src/components/Slider.tsx","../src/components/RadioGroup.tsx","../src/components/Progress.tsx","../src/components/Message.tsx","../src/components/Dialog.tsx","../src/components/AlertDialog.tsx","../src/components/DropdownMenu.tsx","../src/components/Tabs.tsx","../src/components/Popover.tsx"],"sourcesContent":["// Shared prop plumbing for the design-system primitives. The spacing map is\n// the single place Radix's numeric steps meet our t-shirt tokens; \"3\" (12px)\n// rounds UP to md per the spec's when-in-doubt-go-up rule.\nimport type { CSSProperties } from \"react\";\n\nexport type SpaceStep = \"0\" | \"1\" | \"2\" | \"3\" | \"4\" | \"5\" | \"6\";\n\nexport interface SpacingProps {\n m?: SpaceStep;\n mt?: SpaceStep;\n mb?: SpaceStep;\n p?: SpaceStep;\n pb?: SpaceStep;\n}\n\nconst SPACE: Record<SpaceStep, string> = {\n \"0\": \"0\",\n \"1\": \"var(--spacing-xs)\",\n \"2\": \"var(--spacing-sm)\",\n \"3\": \"var(--spacing-md)\",\n \"4\": \"var(--spacing-md)\",\n \"5\": \"var(--spacing-lg)\",\n \"6\": \"var(--spacing-xl)\",\n};\n\nexport function spacingStyle(\n { m, mt, mb, p, pb }: SpacingProps,\n style?: CSSProperties,\n): CSSProperties | undefined {\n const out: CSSProperties = {\n ...(m !== undefined && { margin: SPACE[m] }),\n ...(mt !== undefined && { marginTop: SPACE[mt] }),\n ...(mb !== undefined && { marginBottom: SPACE[mb] }),\n ...(p !== undefined && { padding: SPACE[p] }),\n ...(pb !== undefined && { paddingBottom: SPACE[pb] }),\n ...style,\n };\n return Object.keys(out).length > 0 ? out : undefined;\n}\n\nexport function cx(...parts: Array<string | false | undefined>): string {\n return parts.filter(Boolean).join(\" \");\n}\n","import type * as React from \"react\";\nimport { createElement, forwardRef, type ReactNode } from \"react\";\nimport { cx, spacingStyle, type SpacingProps } from \"./propShared\";\nimport styles from \"./Text.module.scss\";\n\nexport interface TextProps\n extends SpacingProps,\n Omit<React.HTMLAttributes<HTMLElement>, \"color\"> {\n /** Element to render. Default `span`. Use `p` for prose and `label`\n * (with `htmlFor`) for form labels — size is presentational, so the\n * element stays free to be the semantically correct one. */\n as?: \"span\" | \"div\" | \"p\" | \"label\";\n /** Font size step: 1=12px, 2=14px, 3=16px, 4=18px, 5=20px, 6=24px.\n * Line height and letter spacing move with it. Omit to inherit. */\n size?: \"1\" | \"2\" | \"3\" | \"4\" | \"5\" | \"6\";\n /** 500 or 700. Omit for the inherited weight. */\n weight?: \"medium\" | \"bold\";\n /** Semantic colour role. `gray` is the standard secondary-text token;\n * the rest carry meaning, so avoid them for emphasis alone. Omit for\n * primary text. */\n /** Semantic colour role. `muted` is the standard secondary-text token;\n * the rest carry meaning, so avoid them for emphasis alone. Omit for\n * primary text. */\n color?: \"muted\" | \"danger\" | \"success\" | \"warning\";\n /** Id of the control this labels. Only meaningful with `as=\"label\"`. */\n htmlFor?: string;\n /** The text. */\n children?: ReactNode;\n}\n\n/**\n * Body copy. Size, weight and colour are presentational and independent of\n * the element, so `as` stays free to be whatever the document actually needs\n * — a `p` for prose, a `label` for a field, a `span` inline.\n *\n * Colour is a role, not a hue: use `muted` for secondary copy and reserve the\n * status roles for text that genuinely carries that meaning.\n */\nexport const Text = forwardRef<HTMLElement, TextProps>(function Text(\n { as = \"span\", size, weight, color, className, style, m, mt, mb, p, pb, ...rest },\n ref,\n) {\n return createElement(as, {\n ...rest,\n ref,\n className: cx(\n styles.text,\n size && styles[`size${size}`],\n weight && styles[weight],\n color && styles[`color${color[0].toUpperCase()}${color.slice(1)}`],\n className,\n ),\n style: spacingStyle({ m, mt, mb, p, pb }, style),\n });\n});\n","import type * as React from \"react\";\nimport { createElement, forwardRef, type ReactNode } from \"react\";\nimport { cx, spacingStyle, type SpacingProps } from \"./propShared\";\nimport styles from \"./Heading.module.scss\";\n\nexport interface HeadingProps\n extends SpacingProps,\n Omit<React.HTMLAttributes<HTMLHeadingElement>, \"color\"> {\n /** Heading level to render. Default `h2`. Independent of `size`, so\n * document outline stays correct without dictating appearance. */\n as?: \"h1\" | \"h2\" | \"h3\" | \"h4\";\n /** Font size step: 4=18px, 5=20px, 6=24px, 7=28px, 8=35px, 9=60px.\n * Shares steps 4–6 with Text, so a Heading and Text can sit on the\n * same line and match. */\n size?: \"4\" | \"5\" | \"6\" | \"7\" | \"8\" | \"9\";\n /** Semantic colour role. Omit for primary heading colour. */\n color?: \"muted\" | \"danger\";\n /** Centres the text. There is no `left`/`right` — headings are\n * start-aligned unless deliberately centred. */\n align?: \"center\";\n /** The heading text. */\n children?: ReactNode;\n}\n\n/**\n * A section heading. `as` sets the heading level and `size` sets the\n * appearance, deliberately apart — so a visually small heading can still be\n * an h2 where the document structure calls for one.\n *\n * Shares size steps 4-6 with Text, so a heading and body copy on the same\n * line align.\n */\nexport const Heading = forwardRef<HTMLHeadingElement, HeadingProps>(function Heading(\n { as = \"h2\", size, color, align, className, style, m, mt, mb, p, pb, ...rest },\n ref,\n) {\n return createElement(as, {\n ...rest,\n ref,\n className: cx(\n styles.heading,\n size && styles[`size${size}`],\n color === \"muted\" && styles.colorMuted,\n color === \"danger\" && styles.colorDanger,\n align === \"center\" && styles.alignCenter,\n className,\n ),\n style: spacingStyle({ m, mt, mb, p, pb }, style),\n });\n});\n","import type * as React from \"react\";\nimport { cloneElement, forwardRef, isValidElement, type ReactNode } from \"react\";\nimport { cx, spacingStyle, type SpacingProps } from \"./propShared\";\nimport styles from \"./Link.module.scss\";\n\nexport interface LinkProps\n extends SpacingProps,\n Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, \"color\"> {\n /** Render the single child element instead of an `<a>`, merging link\n * styling onto it. For wrapping a router's own Link component without\n * nesting two anchors. */\n asChild?: boolean;\n /** Font size step: 1=12px, 2=14px, 3=16px. Matches Text's first three\n * steps so inline links sit flush with surrounding copy. */\n size?: \"1\" | \"2\" | \"3\";\n /** Link text. With `asChild`, the single element to style as a link. */\n children?: ReactNode;\n}\n\n/**\n * An inline anchor, styled to sit inside running text without disturbing its\n * rhythm. Sizes match Text's first three steps.\n *\n * Use `asChild` to wrap a router's own link component rather than nesting two\n * anchors, which is invalid and breaks keyboard navigation.\n */\nexport const Link = forwardRef<HTMLAnchorElement, LinkProps>(function Link(\n { asChild, size, className, style, m, mt, mb, p, pb, children, ...rest },\n ref,\n) {\n const cls = cx(styles.link, size && styles[`size${size}`], className);\n const merged = spacingStyle({ m, mt, mb, p, pb }, style);\n if (asChild && isValidElement(children)) {\n const child = children as React.ReactElement<{ className?: string; style?: React.CSSProperties }>;\n return cloneElement(child, {\n ...rest,\n className: cx(cls, child.props.className),\n style: { ...merged, ...child.props.style },\n });\n }\n return (\n <a {...rest} ref={ref} className={cls} style={merged}>\n {children}\n </a>\n );\n});\n","import type * as React from \"react\";\nimport { cloneElement, forwardRef, isValidElement, type ReactNode } from \"react\";\nimport { cx, spacingStyle, type SpacingProps } from \"./propShared\";\nimport styles from \"./Flex.module.scss\";\n\nexport interface FlexProps extends SpacingProps, React.HTMLAttributes<HTMLDivElement> {\n /** Render the single child element instead of a wrapper div, merging\n * the flex styling onto it. Avoids a redundant layer in the DOM. */\n asChild?: boolean;\n /** Gap step: 1=4px, 2=8px, 3=12px, 4=16px, 5=24px, 6=32px. Note step 3\n * is 12px — off the 8pt grid, kept for parity with the shipped app. */\n gap?: \"1\" | \"2\" | \"3\" | \"4\" | \"5\" | \"6\";\n /** Main axis. Default `row`. */\n direction?: \"row\" | \"column\";\n /** Cross-axis alignment (`align-items`). */\n align?: \"start\" | \"center\" | \"end\" | \"baseline\" | \"stretch\";\n /** Main-axis distribution (`justify-content`). */\n justify?: \"start\" | \"center\" | \"end\" | \"between\";\n /** Wrapping behaviour. Default is the browser's `nowrap`. */\n wrap?: \"wrap\" | \"nowrap\";\n /** The items to lay out. */\n children?: ReactNode;\n}\n\nconst cap = (s: string) => s[0].toUpperCase() + s.slice(1);\n\n/**\n * A flex row or column whose gap comes from the spacing scale, so layouts\n * inherit the 8pt grid instead of restating it in pixels.\n *\n * `asChild` merges the layout onto its only child rather than adding a\n * wrapper, for when an extra div would break a grid or a selector.\n */\nexport const Flex = forwardRef<HTMLDivElement, FlexProps>(function Flex(\n { asChild, gap, direction, align, justify, wrap, className, style, m, mt, mb, p, pb, children, ...rest },\n ref,\n) {\n const cls = cx(\n styles.flex,\n gap && styles[`gap${gap}`],\n direction && styles[`direction${cap(direction)}`],\n align && styles[`align${cap(align)}`],\n justify && styles[`justify${cap(justify)}`],\n wrap && styles[`wrap${cap(wrap)}`],\n className,\n );\n const merged = spacingStyle({ m, mt, mb, p, pb }, style);\n if (asChild && isValidElement(children)) {\n const child = children as React.ReactElement<{ className?: string; style?: React.CSSProperties }>;\n return cloneElement(child, {\n ...rest,\n className: cx(cls, child.props.className),\n style: { ...merged, ...child.props.style },\n });\n }\n return (\n <div {...rest} ref={ref} className={cls} style={merged}>\n {children}\n </div>\n );\n});\n","import type * as React from \"react\";\nimport { forwardRef, type ReactNode } from \"react\";\nimport { spacingStyle, type SpacingProps } from \"./propShared\";\n\nexport interface BoxProps extends SpacingProps, React.HTMLAttributes<HTMLDivElement> {\n /** Anything. Box adds no styling of its own. */\n children?: ReactNode;\n}\n\n// Radix Box at our call sites is a plain div carrying className/style/ref —\n// no layout props anywhere (verified by inventory). Keep it exactly that.\n\n/**\n * A plain div that understands the spacing scale. The escape hatch for when\n * you need margin or padding on the grid but no layout behaviour with it.\n *\n * Renders nothing of its own — no class, no styling — so it never interferes\n * with whatever you put inside.\n */\nexport const Box = forwardRef<HTMLDivElement, BoxProps>(function Box(\n { style, m, mt, mb, p, pb, ...rest },\n ref,\n) {\n return <div {...rest} ref={ref} style={spacingStyle({ m, mt, mb, p, pb }, style)} />;\n});\n","import type * as React from \"react\";\nimport { forwardRef, type ReactNode } from \"react\";\nimport { cx, spacingStyle, type SpacingProps } from \"./propShared\";\nimport styles from \"./Grid.module.scss\";\n\ntype Cols = \"1\" | \"2\" | \"3\";\nexport interface GridProps extends SpacingProps, React.HTMLAttributes<HTMLDivElement> {\n /** Column count, 1–3. Pass an object for responsive counts:\n * `{ initial: \"1\", sm: \"2\", md: \"3\" }` — `initial` applies below the\n * first breakpoint. */\n columns?: Cols | { initial?: Cols; sm?: Cols; md?: Cols };\n /** Gap step: 1=4px, 2=8px, 3=12px, 4=16px, 5=24px, 6=32px. Same scale\n * as Flex. */\n gap?: \"1\" | \"2\" | \"3\" | \"4\" | \"5\" | \"6\";\n /** The cells. */\n children?: ReactNode;\n}\n\n/**\n * A simple column grid, 1-3 wide, with the same gap scale as Flex. Pass an\n * object to `columns` for responsive counts.\n *\n * Deliberately narrow: anything more elaborate is a job for CSS grid directly\n * rather than a prop API that would end up reinventing it.\n */\nexport const Grid = forwardRef<HTMLDivElement, GridProps>(function Grid(\n { columns, gap, className, style, m, mt, mb, p, pb, ...rest },\n ref,\n) {\n const colCls =\n typeof columns === \"string\"\n ? [styles[`cols${columns}`]]\n : columns\n ? [\n columns.initial && styles[`cols${columns.initial}`],\n columns.sm && styles[`smCols${columns.sm}`],\n columns.md && styles[`mdCols${columns.md}`],\n ]\n : [];\n return (\n <div\n {...rest}\n ref={ref}\n className={cx(styles.grid, ...(colCls as string[]), gap && styles[`gap${gap}`], className)}\n style={spacingStyle({ m, mt, mb, p, pb }, style)}\n />\n );\n});\n","import type * as React from \"react\";\nimport { forwardRef, type ReactNode } from \"react\";\nimport { cx, spacingStyle, type SpacingProps } from \"./propShared\";\nimport styles from \"./Badge.module.scss\";\n\n/**\n * Roles whose colour carries meaning — status and emphasis.\n */\nexport type BadgeSemanticColor =\n | \"muted\"\n | \"primary\"\n | \"success\"\n | \"warning\"\n | \"danger\";\n\n/**\n * Categorical hues for telling data apart — star classes, planet types — where\n * the colour distinguishes rather than signals. These deliberately keep hue\n * names: for a categorical scale the hue IS the identity, and calling one\n * \"tertiary\" would imply a ranking that does not exist.\n */\nexport type BadgeCategoricalColor =\n | \"cyan\"\n | \"purple\"\n | \"orange\"\n | \"yellow\"\n | \"accent\";\n\nexport type BadgeColor = BadgeSemanticColor | BadgeCategoricalColor;\n\nexport interface BadgeProps\n extends SpacingProps,\n Omit<React.HTMLAttributes<HTMLSpanElement>, \"color\"> {\n /** Semantic role or categorical hue. Roles carry meaning — pick one\n * that matches the state, not the look you want.\n */\n color?: BadgeColor;\n /** `soft` is a tinted wash for dense lists; `solid` is a filled chip\n * for a badge that must win attention.\n */\n variant?: \"soft\" | \"solid\";\n /** 1 is the default chip; 2 is for standalone use away from body text. */\n size?: \"1\" | \"2\";\n /** Badges are single-line by default (Radix parity). Long free-text\n * content — e.g. user-named star systems on planet cards — opts into\n * wrapping so it can't overflow its card. */\n wrap?: boolean;\n /** Label text. Keep it short — a badge that wraps stops reading as one. */\n children?: ReactNode;\n}\n\nconst cap = (s: string) => s[0].toUpperCase() + s.slice(1);\n\n// Default color is \"blue\" (not \"gray\") to match Radix's behavior: Badge's\n// `color` prop had no hardcoded default there either — it inherited the\n// surrounding Theme's `accentColor`, which this app sets to \"blue\" (see the\n// single <Theme accentColor> in the host app). A caller that wants a\n// neutral badge should pass color=\"muted\" explicitly.\n/**\n * A compact status label. Colour is the message, so choose it for meaning:\n * the semantic roles say safe, pending or destructive, while the categorical\n * hues only tell one kind of thing from another and carry no judgement.\n *\n * Single-line by default, since a badge that wraps stops reading as a badge.\n * Opt into `wrap` for free text you do not control.\n */\nexport const Badge = forwardRef<HTMLSpanElement, BadgeProps>(function Badge(\n { color = \"primary\", variant = \"soft\", size = \"1\", wrap, className, style, m, mt, mb, p, pb, ...rest },\n ref,\n) {\n return (\n <span\n {...rest}\n ref={ref}\n className={cx(\n styles.badge,\n styles[`color${cap(color)}`],\n variant === \"solid\" && styles.solid,\n styles[`size${size}`],\n wrap && styles.wrap,\n className,\n )}\n style={spacingStyle({ m, mt, mb, p, pb }, style)}\n />\n );\n});\n","import type * as React from \"react\";\nimport { forwardRef } from \"react\";\nimport { cx } from \"./propShared\";\nimport styles from \"./Separator.module.scss\";\n\nexport interface SeparatorProps extends React.HTMLAttributes<HTMLSpanElement> {\n /** Length of the rule, 1 (shortest) to 4 (full width of its container). */\n size?: \"1\" | \"2\" | \"3\" | \"4\";\n}\n\n/**\n * A hairline rule for dividing content within a surface, where a full panel\n * boundary would be too heavy. Exposed as `role=\"separator\"`, so assistive\n * technology hears the division too.\n */\nexport const Separator = forwardRef<HTMLSpanElement, SeparatorProps>(function Separator(\n { size = \"4\", className, ...rest },\n ref,\n) {\n return (\n <span\n {...rest}\n ref={ref}\n role=\"separator\"\n className={cx(styles.separator, size === \"4\" && styles.full, className)}\n />\n );\n});\n","import type * as React from \"react\";\nimport { forwardRef, type ReactNode } from \"react\";\nimport { cx, spacingStyle, type SpacingProps } from \"./propShared\";\nimport styles from \"./Card.module.scss\";\n\nexport interface CardProps extends SpacingProps, React.HTMLAttributes<HTMLDivElement> {\n /** A media element to sit at the top of the card, full-bleed to its edges.\n * Pass whatever your framework renders — a plain `<img>`, a `next/image`,\n * a `<video>` — and the card frames it: cropped to fill, top corners\n * matched to its own radius, and a reserved box so the layout does not\n * jump when it loads.\n *\n * The reserved box is `--sp-card-image-ratio` (default `16 / 10`). Set it\n * per card for a different crop. */\n image?: ReactNode;\n /** The card's contents. */\n children?: ReactNode;\n}\n\n/**\n * A translucent panel for grouping related content, one step above the page\n * surface. Its 12px inset is a deliberate exception to the 8pt grid, kept for\n * parity with the app this was extracted from.\n *\n * Pass `image` for a media card. The image is framed by the card rather than\n * being an ordinary child, so every card in a row reserves the same box\n * before its image loads and none of them reflow when it does.\n */\nexport const Card = forwardRef<HTMLDivElement, CardProps>(function Card(\n { className, style, image, children, m, mt, mb, p, pb, ...rest },\n ref,\n) {\n return (\n <div\n {...rest}\n ref={ref}\n className={cx(styles.card, image != null && styles.hasImage, className)}\n style={spacingStyle({ m, mt, mb, p, pb }, style)}\n >\n {image != null && <div className={styles.image}>{image}</div>}\n {children}\n </div>\n );\n});\n","// 23 icons, ported verbatim from @radix-ui/react-icons\n// (MIT License — Copyright (c) 2022 WorkOS; https://github.com/radix-ui/icons).\n// Uniform 15x15 viewBox, currentColor, decorative by default (aria-hidden) —\n// pass aria-label + aria-hidden={undefined} for semantic uses.\nimport type * as React from \"react\";\n\nexport type IconProps = React.SVGAttributes<SVGSVGElement>;\n\nconst base = {\n width: 15,\n height: 15,\n viewBox: \"0 0 15 15\",\n fill: \"none\",\n xmlns: \"http://www.w3.org/2000/svg\",\n \"aria-hidden\": true,\n} as const;\n\nexport function Share2Icon(props: IconProps) {\n return (\n <svg {...base} {...props}>\n <path\n d=\"M3.5 5.00006C3.22386 5.00006 3 5.22392 3 5.50006L3 11.5001C3 11.7762 3.22386 12.0001 3.5 12.0001L11.5 12.0001C11.7761 12.0001 12 11.7762 12 11.5001L12 5.50006C12 5.22392 11.7761 5.00006 11.5 5.00006L10.25 5.00006C9.97386 5.00006 9.75 4.7762 9.75 4.50006C9.75 4.22392 9.97386 4.00006 10.25 4.00006L11.5 4.00006C12.3284 4.00006 13 4.67163 13 5.50006L13 11.5001C13 12.3285 12.3284 13.0001 11.5 13.0001L3.5 13.0001C2.67157 13.0001 2 12.3285 2 11.5001L2 5.50006C2 4.67163 2.67157 4.00006 3.5 4.00006L4.75 4.00006C5.02614 4.00006 5.25 4.22392 5.25 4.50006C5.25 4.7762 5.02614 5.00006 4.75 5.00006L3.5 5.00006ZM7 1.6364L5.5682 3.0682C5.39246 3.24393 5.10754 3.24393 4.9318 3.0682C4.75607 2.89246 4.75607 2.60754 4.9318 2.4318L7.1818 0.181802C7.26619 0.09741 7.38065 0.049999 7.5 0.049999C7.61935 0.049999 7.73381 0.09741 7.8182 0.181802L10.0682 2.4318C10.2439 2.60754 10.2439 2.89246 10.0682 3.0682C9.89246 3.24393 9.60754 3.24393 9.4318 3.0682L8 1.6364L8 8.5C8 8.77614 7.77614 9 7.5 9C7.22386 9 7 8.77614 7 8.5L7 1.6364Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\nexport function ChatBubbleIcon(props: IconProps) {\n return (\n <svg {...base} {...props}>\n <path\n d=\"M12.5 3L2.5 3.00002C1.67157 3.00002 1 3.6716 1 4.50002V9.50003C1 10.3285 1.67157 11 2.5 11H7.50003C7.63264 11 7.75982 11.0527 7.85358 11.1465L10 13.2929V11.5C10 11.2239 10.2239 11 10.5 11H12.5C13.3284 11 14 10.3285 14 9.50003V4.5C14 3.67157 13.3284 3 12.5 3ZM2.49999 2.00002L12.5 2C13.8807 2 15 3.11929 15 4.5V9.50003C15 10.8807 13.8807 12 12.5 12H11V14.5C11 14.7022 10.8782 14.8845 10.6913 14.9619C10.5045 15.0393 10.2894 14.9965 10.1464 14.8536L7.29292 12H2.5C1.11929 12 0 10.8807 0 9.50003V4.50002C0 3.11931 1.11928 2.00003 2.49999 2.00002Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\nexport function PlusIcon(props: IconProps) {\n return (\n <svg {...base} {...props}>\n <path\n d=\"M8 2.75C8 2.47386 7.77614 2.25 7.5 2.25C7.22386 2.25 7 2.47386 7 2.75V7H2.75C2.47386 7 2.25 7.22386 2.25 7.5C2.25 7.77614 2.47386 8 2.75 8H7V12.25C7 12.5261 7.22386 12.75 7.5 12.75C7.77614 12.75 8 12.5261 8 12.25V8H12.25C12.5261 8 12.75 7.77614 12.75 7.5C12.75 7.22386 12.5261 7 12.25 7H8V2.75Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\nexport function Pencil1Icon(props: IconProps) {\n return (\n <svg {...base} {...props}>\n <path\n d=\"M11.8536 1.14645C11.6583 0.951184 11.3417 0.951184 11.1465 1.14645L3.71455 8.57836C3.62459 8.66832 3.55263 8.77461 3.50251 8.89155L2.04044 12.303C1.9599 12.491 2.00189 12.709 2.14646 12.8536C2.29103 12.9981 2.50905 13.0401 2.69697 12.9596L6.10847 11.4975C6.2254 11.4474 6.3317 11.3754 6.42166 11.2855L13.8536 3.85355C14.0488 3.65829 14.0488 3.34171 13.8536 3.14645L11.8536 1.14645ZM4.42166 9.28547L11.5 2.20711L12.7929 3.5L5.71455 10.5784L4.21924 11.2192L3.78081 10.7808L4.42166 9.28547Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\nexport function HeartFilledIcon(props: IconProps) {\n return (\n <svg {...base} {...props}>\n <path\n d=\"M1.35248 4.90532C1.35248 2.94498 2.936 1.35248 4.89346 1.35248C6.25769 1.35248 6.86058 1.92336 7.50002 2.93545C8.13946 1.92336 8.74235 1.35248 10.1066 1.35248C12.064 1.35248 13.6476 2.94498 13.6476 4.90532C13.6476 6.74041 12.6013 8.50508 11.4008 9.96927C10.2636 11.3562 8.92194 12.5508 8.00601 13.3664C7.94645 13.4194 7.88869 13.4709 7.83291 13.5206C7.64324 13.6899 7.3568 13.6899 7.16713 13.5206C7.11135 13.4709 7.05359 13.4194 6.99403 13.3664C6.0781 12.5508 4.73641 11.3562 3.59926 9.96927C2.39872 8.50508 1.35248 6.74041 1.35248 4.90532Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\nexport function ExitFullScreenIcon(props: IconProps) {\n return (\n <svg {...base} {...props}>\n <path\n d=\"M5.5 2C5.77614 2 6 2.22386 6 2.5V5.5C6 5.77614 5.77614 6 5.5 6H2.5C2.22386 6 2 5.77614 2 5.5C2 5.22386 2.22386 5 2.5 5H5V2.5C5 2.22386 5.22386 2 5.5 2ZM9.5 2C9.77614 2 10 2.22386 10 2.5V5H12.5C12.7761 5 13 5.22386 13 5.5C13 5.77614 12.7761 6 12.5 6H9.5C9.22386 6 9 5.77614 9 5.5V2.5C9 2.22386 9.22386 2 9.5 2ZM2 9.5C2 9.22386 2.22386 9 2.5 9H5.5C5.77614 9 6 9.22386 6 9.5V12.5C6 12.7761 5.77614 13 5.5 13C5.22386 13 5 12.7761 5 12.5V10H2.5C2.22386 10 2 9.77614 2 9.5ZM9 9.5C9 9.22386 9.22386 9 9.5 9H12.5C12.7761 9 13 9.22386 13 9.5C13 9.77614 12.7761 10 12.5 10H10V12.5C10 12.7761 9.77614 13 9.5 13C9.22386 13 9 12.7761 9 12.5V9.5Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\nexport function EnterFullScreenIcon(props: IconProps) {\n return (\n <svg {...base} {...props}>\n <path\n d=\"M2 2.5C2 2.22386 2.22386 2 2.5 2H5.5C5.77614 2 6 2.22386 6 2.5C6 2.77614 5.77614 3 5.5 3H3V5.5C3 5.77614 2.77614 6 2.5 6C2.22386 6 2 5.77614 2 5.5V2.5ZM9 2.5C9 2.22386 9.22386 2 9.5 2H12.5C12.7761 2 13 2.22386 13 2.5V5.5C13 5.77614 12.7761 6 12.5 6C12.2239 6 12 5.77614 12 5.5V3H9.5C9.22386 3 9 2.77614 9 2.5ZM2.5 9C2.77614 9 3 9.22386 3 9.5V12H5.5C5.77614 12 6 12.2239 6 12.5C6 12.7761 5.77614 13 5.5 13H2.5C2.22386 13 2 12.7761 2 12.5V9.5C2 9.22386 2.22386 9 2.5 9ZM12.5 9C12.7761 9 13 9.22386 13 9.5V12.5C13 12.7761 12.7761 13 12.5 13H9.5C9.22386 13 9 12.7761 9 12.5C9 12.2239 9.22386 12 9.5 12H12V9.5C12 9.22386 12.2239 9 12.5 9Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\nexport function CheckIcon(props: IconProps) {\n return (\n <svg {...base} {...props}>\n <path\n d=\"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\nexport function TrashIcon(props: IconProps) {\n return (\n <svg {...base} {...props}>\n <path\n d=\"M5.5 1C5.22386 1 5 1.22386 5 1.5C5 1.77614 5.22386 2 5.5 2H9.5C9.77614 2 10 1.77614 10 1.5C10 1.22386 9.77614 1 9.5 1H5.5ZM3 3.5C3 3.22386 3.22386 3 3.5 3H5H10H11.5C11.7761 3 12 3.22386 12 3.5C12 3.77614 11.7761 4 11.5 4H11V12C11 12.5523 10.5523 13 10 13H5C4.44772 13 4 12.5523 4 12V4L3.5 4C3.22386 4 3 3.77614 3 3.5ZM5 4H10V12H5V4Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\nexport function QuestionMarkCircledIcon(props: IconProps) {\n return (\n <svg {...base} {...props}>\n <path\n d=\"M0.877075 7.49972C0.877075 3.84204 3.84222 0.876892 7.49991 0.876892C11.1576 0.876892 14.1227 3.84204 14.1227 7.49972C14.1227 11.1574 11.1576 14.1226 7.49991 14.1226C3.84222 14.1226 0.877075 11.1574 0.877075 7.49972ZM7.49991 1.82689C4.36689 1.82689 1.82708 4.36671 1.82708 7.49972C1.82708 10.6327 4.36689 13.1726 7.49991 13.1726C10.6329 13.1726 13.1727 10.6327 13.1727 7.49972C13.1727 4.36671 10.6329 1.82689 7.49991 1.82689ZM8.24993 10.5C8.24993 10.9142 7.91414 11.25 7.49993 11.25C7.08571 11.25 6.74993 10.9142 6.74993 10.5C6.74993 10.0858 7.08571 9.75 7.49993 9.75C7.91414 9.75 8.24993 10.0858 8.24993 10.5ZM6.05003 6.25C6.05003 5.57211 6.63511 4.925 7.50003 4.925C8.36496 4.925 8.95003 5.57211 8.95003 6.25C8.95003 6.74118 8.68002 6.99212 8.21447 7.27494C8.16251 7.30651 8.10258 7.34131 8.03847 7.37854L8.03841 7.37858C7.85521 7.48497 7.63788 7.61119 7.47449 7.73849C7.23214 7.92732 6.95003 8.23198 6.95003 8.7C6.95004 9.00376 7.19628 9.25 7.50004 9.25C7.8024 9.25 8.04778 9.00601 8.05002 8.70417L8.05056 8.7033C8.05924 8.6896 8.08493 8.65735 8.15058 8.6062C8.25207 8.52712 8.36508 8.46163 8.51567 8.37436L8.51571 8.37433C8.59422 8.32883 8.68296 8.27741 8.78559 8.21506C9.32004 7.89038 10.05 7.35382 10.05 6.25C10.05 4.92789 8.93511 3.825 7.50003 3.825C6.06496 3.825 4.95003 4.92789 4.95003 6.25C4.95003 6.55376 5.19628 6.8 5.50003 6.8C5.80379 6.8 6.05003 6.55376 6.05003 6.25Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\nexport function PersonIcon(props: IconProps) {\n return (\n <svg {...base} {...props}>\n <path\n d=\"M7.5 0.875C5.49797 0.875 3.875 2.49797 3.875 4.5C3.875 6.15288 4.98124 7.54738 6.49373 7.98351C5.2997 8.12901 4.27557 8.55134 3.50407 9.31167C2.52216 10.2794 2.02502 11.72 2.02502 13.5999C2.02502 13.8623 2.23769 14.0749 2.50002 14.0749C2.76236 14.0749 2.97502 13.8623 2.97502 13.5999C2.97502 11.8799 3.42786 10.7206 4.17091 9.9883C4.91536 9.25463 6.02674 8.87499 7.49995 8.87499C8.97317 8.87499 10.0846 9.25463 10.8291 9.98831C11.5721 10.7206 12.025 11.8799 12.025 13.5999C12.025 13.8623 12.2376 14.0749 12.5 14.0749C12.7623 14.075 12.975 13.8623 12.975 13.6C12.975 11.72 12.4778 10.2794 11.4959 9.31166C10.7244 8.55135 9.70025 8.12903 8.50625 7.98352C10.0187 7.5474 11.125 6.15289 11.125 4.5C11.125 2.49797 9.50203 0.875 7.5 0.875ZM4.825 4.5C4.825 3.02264 6.02264 1.825 7.5 1.825C8.97736 1.825 10.175 3.02264 10.175 4.5C10.175 5.97736 8.97736 7.175 7.5 7.175C6.02264 7.175 4.825 5.97736 4.825 4.5Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\nexport function MinusIcon(props: IconProps) {\n return (\n <svg {...base} {...props}>\n <path\n d=\"M2.25 7.5C2.25 7.22386 2.47386 7 2.75 7H12.25C12.5261 7 12.75 7.22386 12.75 7.5C12.75 7.77614 12.5261 8 12.25 8H2.75C2.47386 8 2.25 7.77614 2.25 7.5Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\nexport function MagnifyingGlassIcon(props: IconProps) {\n return (\n <svg {...base} {...props}>\n <path\n d=\"M10 6.5C10 8.433 8.433 10 6.5 10C4.567 10 3 8.433 3 6.5C3 4.567 4.567 3 6.5 3C8.433 3 10 4.567 10 6.5ZM9.30884 10.0159C8.53901 10.6318 7.56251 11 6.5 11C4.01472 11 2 8.98528 2 6.5C2 4.01472 4.01472 2 6.5 2C8.98528 2 11 4.01472 11 6.5C11 7.56251 10.6318 8.53901 10.0159 9.30884L12.8536 12.1464C13.0488 12.3417 13.0488 12.6583 12.8536 12.8536C12.6583 13.0488 12.3417 13.0488 12.1464 12.8536L9.30884 10.0159Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\nexport function HeartIcon(props: IconProps) {\n return (\n <svg {...base} {...props}>\n <path\n d=\"M4.89346 2.35248C3.49195 2.35248 2.35248 3.49359 2.35248 4.90532C2.35248 6.38164 3.20954 7.9168 4.37255 9.33522C5.39396 10.581 6.59464 11.6702 7.50002 12.4778C8.4054 11.6702 9.60608 10.581 10.6275 9.33522C11.7905 7.9168 12.6476 6.38164 12.6476 4.90532C12.6476 3.49359 11.5081 2.35248 10.1066 2.35248C9.27059 2.35248 8.81894 2.64323 8.5397 2.95843C8.27877 3.25295 8.14623 3.58566 8.02501 3.88993C8.00391 3.9429 7.98315 3.99501 7.96211 4.04591C7.88482 4.23294 7.7024 4.35494 7.50002 4.35494C7.29765 4.35494 7.11523 4.23295 7.03793 4.04592C7.01689 3.99501 6.99612 3.94289 6.97502 3.8899C6.8538 3.58564 6.72126 3.25294 6.46034 2.95843C6.18109 2.64323 5.72945 2.35248 4.89346 2.35248ZM1.35248 4.90532C1.35248 2.94498 2.936 1.35248 4.89346 1.35248C6.0084 1.35248 6.73504 1.76049 7.20884 2.2953C7.32062 2.42147 7.41686 2.55382 7.50002 2.68545C7.58318 2.55382 7.67941 2.42147 7.79119 2.2953C8.265 1.76049 8.99164 1.35248 10.1066 1.35248C12.064 1.35248 13.6476 2.94498 13.6476 4.90532C13.6476 6.74041 12.6013 8.50508 11.4008 9.96927C10.2636 11.3562 8.92194 12.5508 8.00601 13.3664C7.94645 13.4194 7.88869 13.4709 7.83291 13.5206C7.64324 13.6899 7.3568 13.6899 7.16713 13.5206C7.11135 13.4709 7.05359 13.4194 6.99403 13.3664C6.0781 12.5508 4.73641 11.3562 3.59926 9.96927C2.39872 8.50508 1.35248 6.74041 1.35248 4.90532Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\nexport function ChevronUpIcon(props: IconProps) {\n return (\n <svg {...base} {...props}>\n <path\n d=\"M3.13523 8.84197C3.3241 9.04343 3.64052 9.05363 3.84197 8.86477L7.5 5.43536L11.158 8.86477C11.3595 9.05363 11.6759 9.04343 11.8648 8.84197C12.0536 8.64051 12.0434 8.32409 11.842 8.13523L7.84197 4.38523C7.64964 4.20492 7.35036 4.20492 7.15803 4.38523L3.15803 8.13523C2.95657 8.32409 2.94637 8.64051 3.13523 8.84197Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\nexport function ChevronDownIcon(props: IconProps) {\n return (\n <svg {...base} {...props}>\n <path\n d=\"M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\n/** The house directional chevrons (Radix geometry, matching Up/Down above).\n * These replaced the typographic arrows: a text glyph's shape is whatever the\n * viewer's font decides, and the owner called the result poorly shaped. Used\n * by every \"onward\" CTA and \"back\" button. */\nexport function ChevronRightIcon(props: IconProps) {\n return (\n <svg {...base} {...props}>\n <path\n d=\"M6.1584 3.13508C5.95694 3.32394 5.94673 3.64036 6.13559 3.84182L9.56499 7.49991L6.13559 11.158C5.94673 11.3595 5.95694 11.6759 6.1584 11.8647C6.35986 12.0536 6.67628 12.0434 6.86514 11.8419L10.6151 7.84182C10.7954 7.64946 10.7954 7.35036 10.6151 7.158L6.86514 3.15801C6.67628 2.95655 6.35986 2.94634 6.1584 3.13508Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\nexport function ChevronLeftIcon(props: IconProps) {\n return (\n <svg {...base} {...props}>\n <path\n d=\"M8.84182 3.13508C9.04328 3.32394 9.05348 3.64036 8.86462 3.84182L5.43523 7.49991L8.86462 11.158C9.05348 11.3595 9.04328 11.6759 8.84182 11.8647C8.64036 12.0536 8.32394 12.0434 8.13508 11.8419L4.38508 7.84182C4.20477 7.64946 4.20477 7.35036 4.38508 7.158L8.13508 3.15801C8.32394 2.95655 8.64036 2.94634 8.84182 3.13508Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\nexport function BookmarkIcon(props: IconProps) {\n return (\n <svg {...base} {...props}>\n <path\n d=\"M3 2.5C3 2.22386 3.22386 2 3.5 2H11.5C11.7761 2 12 2.22386 12 2.5V13.5C12 13.6818 11.9014 13.8492 11.7424 13.9373C11.5834 14.0254 11.3891 14.0203 11.235 13.924L7.5 11.5896L3.765 13.924C3.61087 14.0203 3.41659 14.0254 3.25762 13.9373C3.09864 13.8492 3 13.6818 3 13.5V2.5ZM4 3V12.5979L6.97 10.7416C7.29427 10.539 7.70573 10.539 8.03 10.7416L11 12.5979V3H4Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\n/** Dialog dismiss glyph — a plain X, used by Dialog.Content's corner button. */\nexport function XIcon(props: IconProps) {\n return (\n <svg viewBox=\"0 0 15 15\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" width=\"15\" height=\"15\" {...props}>\n <path\n d=\"M11.8 3.2a.6.6 0 0 0-.85 0L7.5 6.65 4.05 3.2a.6.6 0 1 0-.85.85L6.65 7.5 3.2 10.95a.6.6 0 1 0 .85.85L7.5 8.35l3.45 3.45a.6.6 0 0 0 .85-.85L8.35 7.5l3.45-3.45a.6.6 0 0 0 0-.85Z\"\n fill=\"currentColor\"\n />\n </svg>\n );\n}\n\nexport function InfoCircledIcon(props: IconProps) {\n return (\n <svg {...base} {...props}>\n <path\n d=\"M7.49991 0.876892C3.84222 0.876892 0.877075 3.84204 0.877075 7.49972C0.877075 11.1574 3.84222 14.1226 7.49991 14.1226C11.1576 14.1226 14.1227 11.1574 14.1227 7.49972C14.1227 3.84204 11.1576 0.876892 7.49991 0.876892ZM1.82707 7.49972C1.82707 4.36671 4.36689 1.82689 7.49991 1.82689C10.6329 1.82689 13.1727 4.36671 13.1727 7.49972C13.1727 10.6327 10.6329 13.1726 7.49991 13.1726C4.36689 13.1726 1.82707 10.6327 1.82707 7.49972ZM8.24992 4.49999C8.24992 4.9142 7.91413 5.24999 7.49992 5.24999C7.08571 5.24999 6.74992 4.9142 6.74992 4.49999C6.74992 4.08577 7.08571 3.74999 7.49992 3.74999C7.91413 3.74999 8.24992 4.08577 8.24992 4.49999ZM6.00003 5.99999H6.50003H7.50003C7.77618 5.99999 8.00003 6.22384 8.00003 6.49999V9.99999H8.50003H9.00003V11H8.50003H7.50003H6.50003H6.00003V9.99999H6.50003H7.00003V6.99999H6.50003H6.00003V5.99999Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\nexport function ExclamationTriangleIcon(props: IconProps) {\n return (\n <svg {...base} {...props}>\n <path\n d=\"M8.4449 0.608765C8.0183 -0.107015 6.9817 -0.107015 6.55509 0.608766L0.161178 11.3368C-0.275824 12.07 0.252503 13 1.10608 13H13.8939C14.7475 13 15.2758 12.07 14.8388 11.3368L8.4449 0.608765ZM7.4141 1.12073C7.45288 1.05566 7.54712 1.05566 7.5859 1.12073L13.9798 11.8488C14.0196 11.9154 13.9715 12 13.8939 12H1.10608C1.02849 12 0.980454 11.9154 1.02018 11.8488L7.4141 1.12073ZM6.8269 4.48611C6.81221 4.10423 7.11783 3.78663 7.5 3.78663C7.88217 3.78663 8.18778 4.10423 8.1731 4.48612L8.01921 8.48701C8.00848 8.766 7.7792 8.98664 7.5 8.98664C7.2208 8.98664 6.99151 8.766 6.98078 8.48701L6.8269 4.48611ZM8.24989 10.476C8.24989 10.8902 7.9141 11.226 7.49989 11.226C7.08567 11.226 6.74989 10.8902 6.74989 10.476C6.74989 10.0618 7.08567 9.72599 7.49989 9.72599C7.9141 9.72599 8.24989 10.0618 8.24989 10.476Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\nexport function CrossCircledIcon(props: IconProps) {\n return (\n <svg {...base} {...props}>\n <path\n d=\"M0.877075 7.49988C0.877075 3.84219 3.84222 0.877045 7.49991 0.877045C11.1576 0.877045 14.1227 3.84219 14.1227 7.49988C14.1227 11.1575 11.1576 14.1227 7.49991 14.1227C3.84222 14.1227 0.877075 11.1575 0.877075 7.49988ZM7.49991 1.82704C4.36689 1.82704 1.82708 4.36686 1.82708 7.49988C1.82708 10.6329 4.36689 13.1727 7.49991 13.1727C10.6329 13.1727 13.1727 10.6329 13.1727 7.49988C13.1727 4.36686 10.6329 1.82704 7.49991 1.82704ZM9.85358 5.14644C10.0488 5.3417 10.0488 5.65829 9.85358 5.85355L8.20713 7.49999L9.85358 9.14644C10.0488 9.3417 10.0488 9.65829 9.85358 9.85355C9.65832 10.0488 9.34173 10.0488 9.14647 9.85355L7.50002 8.2071L5.85358 9.85355C5.65832 10.0488 5.34173 10.0488 5.14647 9.85355C4.95121 9.65829 4.95121 9.3417 5.14647 9.14644L6.79292 7.49999L5.14647 5.85355C4.95121 5.65829 4.95121 5.3417 5.14647 5.14644C5.34173 4.95118 5.65832 4.95118 5.85358 5.14644L7.50002 6.79289L9.14647 5.14644C9.34173 4.95118 9.65832 4.95118 9.85358 5.14644Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n","// The shared control-chrome class map — INTERNAL. Components apply this skin\n// themselves, so a consumer never composes it; it was a public subpath until\n// the skin became unconditional, which made every call site a no-op.\n//\n// Kept as a typed module rather than importing the SCSS directly, so a typo in\n// ctl.spaceInput is a compile error here rather than undefined at runtime.\nimport ctlModule from \"./spaceControls.module.scss\";\n\n/** Declared explicitly rather than inferred from the SCSS module, so the\n * emitted .d.ts stands alone: the .module.scss is not published, and a\n * consumer importing this subpath must not need it. Naming the keys also\n * means a typo at a call site is a type error instead of `undefined`. */\nexport interface SpaceControlClasses {\n spaceControl: string;\n spaceInput: string;\n spacePanel: string;\n spaceSlider: string;\n spaceTextArea: string;\n rimRotate: string;\n}\n\n// Through `unknown` because Vite types a CSS module as CSSModuleClasses —\n// an index signature, which TypeScript will not narrow straight to a named\n// interface. The names are checked against the SCSS by a test instead.\nconst ctl = ctlModule as unknown as SpaceControlClasses;\nexport default ctl;\n","\"use client\";\nimport type * as React from \"react\";\nimport { cx } from \"./propShared\";\nimport { ChevronLeftIcon, ChevronRightIcon } from \"./icons\";\nimport styles from \"./Pagination.module.scss\";\nimport ctl from \"../styles/spaceControls\";\n\n/**\n * The data Pagination needs, in the shape most APIs return beside a page of\n * results. Pass it as `pagination`. When `onPageClick` reports a page, hand\n * back a copy with only `page` changed — the component works out everything\n * else, including how many pages there are, from these three numbers. With\n * `totalItems` at or below `pageSize` there is only one page, and the\n * component renders nothing.\n */\nexport interface PaginationState {\n /** The page being shown, counting from 1. If your API counts from 0, add\n * one before passing it in. A page past either end is clamped to the first\n * or last rather than rejected. */\n page: number;\n /** How many items one page holds — the size you requested, not how many\n * came back on the final page. Must be above zero. */\n pageSize: number;\n /** How many items exist across every page: the full result count, not the\n * length of the page you are showing. Usually the `total` or `count` field\n * of the response. */\n totalItems: number;\n}\n\n/** How many pages a pagination object describes — never fewer than one. */\nexport function pageCount({ pageSize, totalItems }: PaginationState): number {\n if (pageSize <= 0) return 1;\n return Math.max(1, Math.ceil(totalItems / pageSize));\n}\n\n/**\n * The page numbers to offer, with `null` marking a gap to draw as an ellipsis.\n *\n * Always the same length once there are enough pages to need gaps — first,\n * last, `siblings` either side of the current page, and two slots that are\n * either a gap or the single page a gap would have hidden. A window that grew\n * and shrank as you paged would change the control's width under the cursor,\n * so the next click would land on a different number than the last one did.\n *\n * Exported so a caller rendering its own markup can reuse the arithmetic.\n */\nexport function pageWindow(page: number, total: number, siblings = 1): (number | null)[] {\n const range = (from: number, to: number) =>\n Array.from({ length: Math.max(0, to - from + 1) }, (_, i) => from + i);\n\n // first + last + current + siblings either side + two gap slots\n const slots = siblings * 2 + 5;\n if (total <= slots) return range(1, total);\n\n const current = Math.min(Math.max(page, 1), total);\n const left = Math.max(current - siblings, 1);\n const right = Math.min(current + siblings, total);\n // A gap only earns its ellipsis when it hides two or more pages. Hiding one\n // page behind \"…\" costs the same space as just showing it.\n const gapLeft = left > 3;\n const gapRight = right < total - 2;\n const edge = siblings * 2 + 3;\n\n if (!gapLeft) return [...range(1, edge), null, total];\n if (!gapRight) return [1, null, ...range(total - edge + 1, total)];\n return [1, null, ...range(left, right), null, total];\n}\n\nexport interface PaginationProps\n extends Omit<React.HTMLAttributes<HTMLElement>, \"children\"> {\n /** Where the list stands: the current page, the page size, and the total\n * item count. Pass the object your API returns; the page count is derived\n * from it. With one page or fewer nothing renders. */\n pagination: PaginationState;\n /** Called with the page the reader chose — a number, Previous or Next.\n * Not called for the page already showing. Fetch or slice, then hand back\n * an updated `pagination`. */\n onPageClick: (page: number) => void;\n /** Page numbers shown either side of the current one. Default 1. */\n siblings?: number;\n /** Ambient motion: the lit arc orbiting the current page's rim. The glass\n * skin is always applied — only its motion is optional. Default true. */\n animated?: boolean;\n}\n\n/**\n * Page-by-page navigation for a long list.\n *\n * Holds no state: give it the pagination object you already have and it\n * reports which page was clicked.\n *\n * Every control is the same limb-lit glass as Select and Button, but only the\n * current page's rim orbits. Nine arcs turning in one row would be noise; one\n * turning is where you are. Previous and Next stay in place when they\n * cannot be used, so the numbers never slide sideways on the first and last\n * page.\n */\nexport function Pagination({\n pagination,\n onPageClick,\n siblings = 1,\n animated = true,\n className,\n \"aria-label\": ariaLabel = \"Pagination\",\n ...rest\n}: PaginationProps) {\n const total = pageCount(pagination);\n if (total <= 1) return null;\n\n const current = Math.min(Math.max(pagination.page, 1), total);\n\n const go = (target: number) => {\n if (target !== current && target >= 1 && target <= total) onPageClick(target);\n };\n\n return (\n <nav {...rest} aria-label={ariaLabel} className={cx(styles.nav, className)}>\n <button\n type=\"button\"\n className={cx(ctl.spaceControl, styles.item, styles.step)}\n disabled={current <= 1}\n aria-label=\"Previous page\"\n onClick={() => go(current - 1)}\n >\n <ChevronLeftIcon aria-hidden=\"true\" />\n <span className={styles.stepText}>Previous</span>\n </button>\n\n <ol className={styles.pages}>\n {pageWindow(current, total, siblings).map((p, i) =>\n p === null ? (\n // Presentational: \"ellipsis\" read aloud between page numbers tells\n // nobody anything.\n // eslint-disable-next-line react/no-array-index-key\n <li key={`gap-${i}`} className={styles.gap} aria-hidden=\"true\">\n …\n </li>\n ) : (\n <li key={p}>\n <button\n type=\"button\"\n className={cx(\n ctl.spaceControl,\n styles.item,\n styles.page,\n p === current && styles.current,\n )}\n data-animated={p === current && !animated ? \"false\" : undefined}\n aria-label={`Page ${p}`}\n aria-current={p === current ? \"page\" : undefined}\n onClick={() => go(p)}\n >\n {p}\n </button>\n </li>\n ),\n )}\n </ol>\n\n <button\n type=\"button\"\n className={cx(ctl.spaceControl, styles.item, styles.step)}\n disabled={current >= total}\n aria-label=\"Next page\"\n onClick={() => go(current + 1)}\n >\n <span className={styles.stepText}>Next</span>\n <ChevronRightIcon aria-hidden=\"true\" />\n </button>\n </nav>\n );\n}\n","/** Deterministic RNG + string hash, vendored from the source application (the only\n * consumer inside the library is SpaceButton's star speckle). Pure,\n * dependency-free, and part of no public API. */\nexport function mulberry32(a: number): () => number {\n return function () {\n a |= 0;\n a = (a + 0x6d2b79f5) | 0;\n let t = Math.imul(a ^ (a >>> 15), 1 | a);\n t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;\n return ((t ^ (t >>> 14)) >>> 0) / 4294967296;\n };\n}\n\n/** FNV-1a 32-bit string hash, for turning stable strings into seeds. */\nexport function hashString(s: string): number {\n let h = 0x811c9dc5;\n for (let i = 0; i < s.length; i++) {\n h ^= s.charCodeAt(i);\n h = Math.imul(h, 0x01000193);\n }\n return h >>> 0;\n}\n","\"use client\";\n\nimport { forwardRef, useId, useMemo } from \"react\";\nimport styles from \"./Button.module.scss\";\nimport { mulberry32, hashString } from \"../internal/seededRandom\";\n\nexport interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** Circular, icon-only sizing (e.g. the share glyph). */\n iconOnly?: boolean;\n /** Warm red-dwarf rim for destructive-ish actions (e.g. Clear). */\n ember?: boolean;\n /** md = default. lg = hero CTAs. sm = compact dialog actions. micro = tiny steppers (no stars/glint). */\n size?: \"sm\" | \"md\" | \"lg\" | \"micro\";\n /** Stretch to the container width (sticky footers). */\n fullWidth?: boolean;\n /** Ambient motion: the orbiting rim, the glint sweep, and the twinkling\n * stars. Set false for dense UI or long lists where the movement\n * distracts. The glass look itself is not optional. Default true. */\n animated?: boolean;\n}\n\n\n/**\n * \"Limb-lit glass\" button: cosmic glass capsule whose rim glows like a planet's\n * sunlit atmosphere limb, with twinkling stars inside and a periodic glint\n * sweep. Plain <button>, so it composes with Radix Dialog.Trigger (Slot).\n */\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n function Button({ iconOnly, ember, size = \"md\", fullWidth, animated = true, className, children, ...rest }, ref) {\n const id = useId();\n\n // Unique-per-instance star field: positions and timing vary button to\n // button so the sparkles don't read as a repeated stamp.\n const starStyles = useMemo(() => {\n // Deterministic PRNG seeded from useId, so each button instance gets its\n // own star arrangement while server and client render identically (no\n // hydration mismatch, unlike Math.random in render).\n const rand = mulberry32(hashString(id));\n return Array.from({ length: 3 }, () => ({\n top: `${12 + rand() * 58}%`,\n left: `${8 + rand() * 80}%`,\n animationDelay: `${(rand() * 3.2).toFixed(2)}s`,\n animationDuration: `${(2.8 + rand() * 1.8).toFixed(2)}s`,\n }));\n }, [id]);\n\n const classes = [\n styles.spaceButton,\n iconOnly ? styles.iconOnly : \"\",\n ember ? styles.ember : \"\",\n size !== \"md\" ? styles[size] : \"\",\n fullWidth ? styles.fullWidth : \"\",\n className ?? \"\",\n ]\n .filter(Boolean)\n .join(\" \");\n\n return (\n <button\n ref={ref}\n className={classes}\n data-animated={animated ? undefined : \"false\"}\n {...rest}\n >\n {size !== \"micro\" && (\n <span className={styles.stars} aria-hidden>\n {starStyles.map((style, i) => (\n <i key={i} className={styles.star} style={style} />\n ))}\n </span>\n )}\n <span className={styles.label}>{children}</span>\n </button>\n );\n }\n);\n","\"use client\";\n\nimport { cx } from \"./propShared\";\nimport styles from \"./Loader.module.scss\";\n\nexport interface LoaderProps {\n /** sm = inline/compact spots. md = default. lg = full-panel takeovers. */\n size?: \"sm\" | \"md\" | \"lg\";\n /** Visible caption under the spinner; also doubles as the accessible name. */\n label?: string;\n /** Merged onto the wrapper. */\n className?: string;\n}\n\n/**\n * Orbital spinner: a small pulsing \"planet\" disc at the center of a static\n * ring, with a \"moon\" dot traveling the ring. Dependency-free CSS animation\n * so it composes cleanly wherever a lazy chunk or async panel needs a\n * space-themed loading state (see SurfaceView's dynamic-import loader).\n */\nexport function Loader({ size = \"md\", label, className }: LoaderProps) {\n return (\n <div\n className={cx(styles.wrap, styles[size], className)}\n role=\"status\"\n aria-live=\"polite\"\n aria-label={label ?? \"Loading\"}\n >\n <span className={styles.orbit}>\n <span className={styles.planet} />\n <span className={styles.moon} />\n </span>\n {label && <span className={styles.label}>{label}</span>}\n </div>\n );\n}\n","/**\n * Shows a popover-API element after it has been placed, so its reveal starts\n * from the right side.\n *\n * The reveal's starting offset is captured the instant the element first\n * renders, and which way it should travel depends on where it lands — which\n * can flip when there is no room — which needs its size, which needs it\n * rendered. Showing first and measuring after locks a flipped surface into\n * travelling towards its own trigger.\n *\n * So `place` runs while the element is laid out but invisible, with every\n * transition off, and must write the side it chose to `data-side`. The\n * element then returns to unrendered and that state is committed before it is\n * shown, so the real reveal begins fresh from its starting style. Transitions\n * stay off until then: leaving the measurement with them on counts as a\n * dismissal, which keeps the element rendered animating its offset, and the\n * reveal would start from that live value instead.\n *\n * Pairs with the `reveal` mixin, which supplies the `data-measuring` and\n * `data-instant` states this relies on.\n */\nexport function showMeasured(element: HTMLElement, place: () => void): void {\n if (element.matches(\":popover-open\")) return;\n element.dataset.instant = \"\";\n element.dataset.measuring = \"\";\n place();\n delete element.dataset.measuring;\n void element.offsetWidth;\n delete element.dataset.instant;\n void element.offsetWidth;\n element.showPopover();\n}\n","\"use client\";\n\n// Generic hover/focus tooltip for icon-only controls. Built on the same\n// native popover=\"auto\" top-layer pattern as ElementTooltip (and\n// DropdownMenu) rather than a library: Radix is gone from this app, and the\n// platform gives Escape/click-outside dismissal and top-layer stacking for\n// free — which matters here because these triggers sit over WebGL canvases\n// and inside their own stacking contexts.\n//\n// Deliberately NOT the native `title` attribute, which these controls used\n// before: the browser's own tooltip waits about a second, cannot be styled\n// to match the app, and never appears for keyboard users at all.\n\nimport {\n cloneElement, isValidElement, useEffect, useId, useLayoutEffect, useRef, useState,\n} from \"react\";\nimport styles from \"./Tooltip.module.scss\";\nimport { showMeasured } from \"../internal/showMeasured\";\n\ninterface TooltipProps {\n /** The text to show. Nothing renders when this is empty. */\n label: string;\n /** Preferred side; flips to the opposite one when there isn't room.\n * `left`/`right` are for a control in a vertical stack, where a tooltip\n * above or below would land on the neighbouring item. */\n side?: \"top\" | \"bottom\" | \"left\" | \"right\";\n /** The element the tooltip describes. Receives the hover and focus\n * handlers, so it must accept a ref. */\n children: React.ReactElement;\n}\n\nconst SHOW_DELAY = 350;\nconst HIDE_DELAY = 80;\nconst SIDE_OFFSET = 8;\nconst COLLISION_PADDING = 8;\n\n// The clone lives in its own component so this scope never dereferences\n// triggerRef itself — the React Compiler flags a ref that is BOTH passed\n// into cloneElement's props and read in the same scope. Same split, and the\n// same reason, as ElementTooltip's TooltipTrigger.\ninterface TriggerProps {\n triggerRef: React.RefObject<HTMLElement | null>;\n tooltipId: string;\n show: (immediate?: boolean) => void;\n hide: () => void;\n children: React.ReactElement<Record<string, unknown>>;\n}\nfunction TooltipTrigger({ triggerRef, tooltipId, show, hide, children }: TriggerProps) {\n const p = children.props;\n return cloneElement(children, {\n ref: triggerRef,\n // Always present, so the id it points at never dangles: the content\n // element stays mounted and only toggles its popover state.\n \"aria-describedby\": tooltipId,\n onPointerEnter: (e: React.PointerEvent) => {\n (p.onPointerEnter as ((e: React.PointerEvent) => void) | undefined)?.(e);\n // Mouse only. A touch \"hover\" fires on tap, which would pop a tooltip\n // over the very control the user just pressed.\n if (e.pointerType === \"mouse\") show();\n },\n onPointerLeave: (e: React.PointerEvent) => {\n (p.onPointerLeave as ((e: React.PointerEvent) => void) | undefined)?.(e);\n hide();\n },\n // Keyboard focus shows it immediately — no hover delay to wait out.\n onFocus: (e: React.FocusEvent) => {\n (p.onFocus as ((e: React.FocusEvent) => void) | undefined)?.(e);\n show(true);\n },\n onBlur: (e: React.FocusEvent) => {\n (p.onBlur as ((e: React.FocusEvent) => void) | undefined)?.(e);\n hide();\n },\n // A tooltip must never outlive the action it describes: clicking the\n // control (expand, switch view) leaves it stranded over the new layout.\n onClick: (e: React.MouseEvent) => {\n (p.onClick as ((e: React.MouseEvent) => void) | undefined)?.(e);\n hide();\n },\n });\n}\n\n/**\n * A short label revealed on hover or focus, for naming a control whose icon\n * is not self-evident.\n *\n * Never put information here that a reader needs: a tooltip is unreachable on\n * touch and easy to miss. If it must be read, put it on the page.\n */\nexport function Tooltip({ label, side = \"bottom\", children }: TooltipProps) {\n const tooltipId = useId();\n const [open, setOpen] = useState(false);\n const [pos, setPos] = useState<{ top: number; left: number } | null>(null);\n const triggerRef = useRef<HTMLElement | null>(null);\n const contentRef = useRef<HTMLDivElement | null>(null);\n const showTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n const hideTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const clearTimers = () => {\n if (showTimer.current) { clearTimeout(showTimer.current); showTimer.current = null; }\n if (hideTimer.current) { clearTimeout(hideTimer.current); hideTimer.current = null; }\n };\n const show = (immediate = false) => {\n clearTimers();\n if (immediate) { setOpen(true); return; }\n showTimer.current = setTimeout(() => setOpen(true), SHOW_DELAY);\n };\n const hide = () => {\n clearTimers();\n hideTimer.current = setTimeout(() => setOpen(false), HIDE_DELAY);\n };\n\n useEffect(() => clearTimers, []);\n\n useLayoutEffect(() => {\n const content = contentRef.current;\n if (!content) return;\n if (!open) {\n if (content.matches(\":popover-open\")) content.hidePopover();\n return;\n }\n const trigger = triggerRef.current;\n if (!trigger) return;\n\n // Measured while laid out — its size reads 0 while display:none — and\n // records the side it lands on, so the reveal can travel away from the\n // trigger. Run once before it is shown (see showMeasured) and again on a\n // label change while already open.\n const place = () => {\n const r = trigger.getBoundingClientRect();\n const w = content.offsetWidth;\n const h = content.offsetHeight;\n\n // Centre on the trigger along the free axis, clamped inside the viewport.\n const centre = (start: number, size: number, extent: number, viewport: number) =>\n Math.min(\n Math.max(start + size / 2 - extent / 2, COLLISION_PADDING),\n Math.max(viewport - extent - COLLISION_PADDING, COLLISION_PADDING),\n );\n\n // Flip to the opposite side when the preferred one has no room — these\n // controls sit in the top row, the bottom action bar, and a rail down\n // the edge, so any of the four can be the side without space.\n const fits = (near: number, far: number, size: number, viewport: number) => ({\n fitsNear: near >= COLLISION_PADDING,\n fitsFar: far + size <= viewport - COLLISION_PADDING,\n });\n\n if (side === \"left\" || side === \"right\") {\n const after = r.right + SIDE_OFFSET;\n const before = r.left - w - SIDE_OFFSET;\n const { fitsNear: fitsBefore, fitsFar: fitsAfter } =\n fits(before, after, w, window.innerWidth);\n const left = side === \"right\"\n ? (fitsAfter || !fitsBefore ? after : before)\n : (fitsBefore || !fitsAfter ? before : after);\n content.dataset.side = left === after ? \"right\" : \"left\";\n setPos({ top: centre(r.top, r.height, h, window.innerHeight), left });\n return;\n }\n\n const below = r.bottom + SIDE_OFFSET;\n const above = r.top - h - SIDE_OFFSET;\n const { fitsNear: fitsAbove, fitsFar: fitsBelow } =\n fits(above, below, h, window.innerHeight);\n const top = side === \"bottom\"\n ? (fitsBelow || !fitsAbove ? below : above)\n : (fitsAbove || !fitsBelow ? above : below);\n content.dataset.side = top === below ? \"bottom\" : \"top\";\n setPos({ top, left: centre(r.left, r.width, w, window.innerWidth) });\n };\n\n if (content.matches(\":popover-open\")) place();\n else showMeasured(content, place);\n }, [open, side, label]);\n\n if (!label || !isValidElement(children)) return <>{children}</>;\n\n return (\n <>\n <TooltipTrigger\n triggerRef={triggerRef}\n tooltipId={tooltipId}\n show={show}\n hide={hide}\n >\n {children as React.ReactElement<Record<string, unknown>>}\n </TooltipTrigger>\n <div\n ref={contentRef}\n id={tooltipId}\n popover=\"auto\"\n role=\"tooltip\"\n className={styles.content}\n style={pos ? { top: pos.top, left: pos.left } : undefined}\n onToggle={(e: React.SyntheticEvent<HTMLDivElement>) => {\n if ((e.nativeEvent as ToggleEvent).newState === \"closed\" && open) setOpen(false);\n }}\n >\n {label}\n </div>\n </>\n );\n}\n","\"use client\";\n\nimport type { ReactNode } from \"react\";\nimport { Tooltip } from \"./Tooltip\";\nimport styles from \"./IconToggle.module.scss\";\n\nexport interface IconToggleOption<V extends string> {\n value: V;\n icon: ReactNode;\n /** Used for aria-label and the hover tooltip. */\n label: string;\n}\n\n/**\n * A segmented icon toggle: every option is always visible in one pill, the\n * selected one reads as active, clicking any option selects it. Built for the\n * scene view switcher (planet / orrery / surface), where the old pattern —\n * showing only the views you are NOT on and swapping icons on click — made\n * the control's meaning flip under the cursor (owner: both icons should be\n * \"always visible, the selected one is the active one\"). Generic over the\n * option set so other icon-mode switchers can reuse it.\n */\nexport function IconToggle<V extends string>({\n options,\n value,\n onValueChange,\n orientation = \"horizontal\",\n className = \"\",\n}: {\n /** The segments, in display order. Every option is always visible —\n * this is a segmented control, not a menu.\n */\n options: IconToggleOption<V>[];\n /** The selected option's value. Fully controlled.\n *\n * NoInfer so V is derived from `options` alone. Without it a value that is\n * not among the options simply widened V to include itself, which made the\n * generic silently accept the one mistake it looks like it should catch. */\n value: NoInfer<V>;\n /** Called with the newly selected value. Not called when the already\n * selected option is clicked. */\n onValueChange(next: V): void;\n /** Which way the pill runs. `vertical` for a rail down the edge of a\n * viewport, where a horizontal strip would eat the width. Default\n * `horizontal`. */\n orientation?: \"horizontal\" | \"vertical\";\n /** Merged onto the group wrapper. */\n className?: string;\n}) {\n const vertical = orientation === \"vertical\";\n return (\n <div\n className={`${styles.group} ${vertical ? styles.vertical : \"\"} ${className}`}\n role=\"group\"\n >\n {options.map((opt) => (\n // A horizontal pill sits at the top of the scene, so its tooltips hang\n // below it. A vertical one has a segment directly below every segment,\n // so they go to the side instead — otherwise each tooltip covers the\n // next option along.\n <Tooltip key={opt.value} label={opt.label} side={vertical ? \"right\" : \"bottom\"}>\n <button\n type=\"button\"\n className={`${styles.segment} ${opt.value === value ? styles.active : \"\"}`}\n aria-label={opt.label}\n aria-pressed={opt.value === value}\n onClick={() => {\n if (opt.value !== value) onValueChange(opt.value);\n }}\n >\n {opt.icon}\n </button>\n </Tooltip>\n ))}\n </div>\n );\n}\n","// A single-choice menu. One component and one child type:\n//\n// <Select value={v} onValueChange={setV}>\n// <Select.Item value=\"a\">A</Select.Item>\n// </Select>\n//\n// It used to be Root/Trigger/Content/Item, mirroring the JSX shape of the\n// library this was migrated from. Three of those four were ceremony: the\n// trigger was mandatory and identical at every call site, and Content only\n// ever wrapped Items. They are now built in, which is why `Select` is the\n// component itself rather than a namespace.\n//\n// Native engine: a <button> trigger plus an always-mounted hidden listbox,\n// absolutely positioned under it. No portal — that keeps a Select inside a\n// dialog within the dialog's stacking context.\n\"use client\";\nimport type * as React from \"react\";\nimport {\n Children, createContext, isValidElement, useCallback, useContext,\n useEffect, useId, useLayoutEffect, useMemo, useRef, useState, type ReactNode,\n} from \"react\";\nimport { cx } from \"./propShared\";\nimport styles from \"./Select.module.scss\";\nimport ctl from \"../styles/spaceControls\";\n\ninterface RootCtx {\n value: string;\n onValueChange: (v: string) => void;\n disabled?: boolean;\n open: boolean;\n setOpen: (o: boolean) => void;\n highlighted: string | null;\n setHighlighted: (v: string | null) => void;\n listboxId: string;\n values: string[];\n labelFor: (v: string) => ReactNode;\n /** Previously carried in its own context, because with Trigger and Content\n * as separate components a ref sitting beside plain state made every read\n * of the OTHER fields look like a render-time ref access to\n * react-hooks/refs. Only Item reads it now, and only inside an event\n * handler, so the split bought nothing. Keep it that way: read `.current`\n * in handlers and effects, never during render. */\n triggerRef: React.RefObject<HTMLButtonElement | null>;\n}\nconst Ctx = createContext<RootCtx | null>(null);\nconst useSelect = () => {\n const ctx = useContext(Ctx);\n if (!ctx) throw new Error(\"Select.Item must be inside a Select\");\n return ctx;\n};\n\n// Shared id contract between the listbox's aria-activedescendant and each\n// Item's id. encodeURIComponent guards against values containing spaces or\n// other characters that aren't legal in an HTML id.\nconst optionId = (listboxId: string, value: string) => `${listboxId}-${encodeURIComponent(value)}`;\n\n/** Pure render-time walk of the children collecting Item values and labels —\n * no effects, so the trigger label is correct on first paint, under SSR, and\n * in renderToStaticMarkup tests. Recurses, so Items may be wrapped (a\n * fragment, a `.map`, a grouping element) rather than being direct children. */\nfunction collectItems(children: ReactNode): Array<{ value: string; label: ReactNode; disabled?: boolean }> {\n const out: Array<{ value: string; label: ReactNode; disabled?: boolean }> = [];\n const walk = (nodes: ReactNode) => {\n Children.forEach(nodes, (child) => {\n if (!isValidElement(child)) return;\n const props = child.props as { value?: string; children?: ReactNode; disabled?: boolean };\n if (child.type === Item && typeof props.value === \"string\") {\n out.push({ value: props.value, label: props.children, disabled: props.disabled });\n } else if (props.children) {\n walk(props.children);\n }\n });\n };\n walk(children);\n return out;\n}\n\nexport interface SelectProps\n extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"value\" | \"children\" | \"onChange\"> {\n /** The selected item's value. Fully controlled. */\n value: string;\n /** Called with the newly selected value. */\n onValueChange: (v: string) => void;\n /** Blocks the trigger and removes it from the tab order. */\n disabled?: boolean;\n /** Shown when nothing is selected. Counts toward the control's width, so\n * selecting an option never resizes it. */\n placeholder?: string;\n /** Ambient motion: the lit arc orbiting the rim. The glass skin itself is\n * always applied. Default true. */\n animated?: boolean;\n /** One or more `Select.Item`. Anything else is ignored for selection but\n * still rendered in the panel. */\n children?: ReactNode;\n}\n\n/**\n * A single-choice menu for lists too long to show inline. Fully controlled.\n *\n * The control sizes itself to its widest option, so it never changes width as\n * you select — capped by `--sp-select-trigger-max-width`, past which the label\n * ellipsizes.\n *\n * Reads its options at render time rather than through effects, so the right\n * label shows on first paint and under SSR.\n *\n * Every prop other than the ones listed lands on the trigger button, which is\n * the focusable control — so `aria-label`, `id`, `name` and `onBlur` go where\n * you would expect.\n */\nfunction SelectRoot({\n value,\n onValueChange,\n disabled,\n placeholder,\n animated = true,\n className,\n children,\n ...rest\n}: SelectProps) {\n const [open, setOpen] = useState(false);\n const [highlighted, setHighlighted] = useState<string | null>(null);\n const listboxId = useId();\n const triggerRef = useRef<HTMLButtonElement | null>(null);\n const rootRef = useRef<HTMLDivElement | null>(null);\n const listRef = useRef<HTMLDivElement | null>(null);\n const [triggerWidth, setTriggerWidth] = useState<number | null>(null);\n const [maxHeight, setMaxHeight] = useState<number | null>(null);\n\n const items = useMemo(() => collectItems(children), [children]);\n const values = useMemo(() => items.filter((i) => !i.disabled).map((i) => i.value), [items]);\n const itemLabels = useMemo(() => items.map((i) => i.label), [items]);\n const labelFor = useCallback(\n (v: string) => items.find((i) => i.value === v)?.label ?? null,\n [items],\n );\n\n // Light-dismiss: click outside closes.\n useEffect(() => {\n if (!open) return;\n const onDown = (e: MouseEvent) => {\n if (rootRef.current && !rootRef.current.contains(e.target as Node)) setOpen(false);\n };\n document.addEventListener(\"mousedown\", onDown);\n return () => document.removeEventListener(\"mousedown\", onDown);\n }, [open]);\n\n // Measures the trigger's rendered width (and the space below it) to size the\n // listbox. useLayoutEffect so it lands before the browser paints the first\n // open frame — a plain useEffect flashes one frame with the width unset.\n useLayoutEffect(() => {\n if (!open) return;\n const el = triggerRef.current;\n if (!el) return;\n const rect = el.getBoundingClientRect();\n setTriggerWidth(el.offsetWidth);\n // Clamp to the space between the trigger and the viewport bottom, so a\n // long list does not force extra scroll inside a scrollable ancestor.\n const available = window.innerHeight - rect.bottom - 16;\n setMaxHeight(Math.min(380, Math.max(120, available)));\n }, [open]);\n\n // Focus the listbox on open so arrow keys work immediately.\n useEffect(() => {\n if (open) listRef.current?.focus();\n }, [open]);\n\n const openWith = (highlight: string | null) => {\n setHighlighted(highlight ?? values[0] ?? null);\n setOpen(true);\n };\n\n const move = (delta: number) => {\n const idx = highlighted ? values.indexOf(highlighted) : -1;\n const next = Math.min(Math.max(idx + delta, 0), values.length - 1);\n setHighlighted(values[next] ?? null);\n };\n\n const label = value ? labelFor(value) : null;\n\n return (\n <Ctx.Provider\n value={{\n value, onValueChange, disabled, open, setOpen, highlighted,\n setHighlighted, listboxId, values, labelFor, triggerRef,\n }}\n >\n <div ref={rootRef} className={styles.root}>\n <button\n type=\"button\"\n {...rest}\n ref={triggerRef}\n disabled={disabled}\n className={cx(styles.trigger, ctl.spaceControl, \"spSelectTrigger\", className)}\n data-animated={animated ? undefined : \"false\"}\n data-state={open ? \"open\" : \"closed\"}\n aria-haspopup=\"listbox\"\n aria-expanded={open}\n aria-controls={listboxId}\n onClick={() => (open ? setOpen(false) : openWith(value || null))}\n onKeyDown={(e) => {\n if (e.key === \"ArrowDown\" || e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n openWith(value || null);\n }\n }}\n >\n {/* The visible label and a hidden copy of every option share one\n grid cell, so the button is as wide as its widest choice and\n never jumps width when the selection changes. Capped by\n --sp-select-trigger-max-width, past which the label ellipsizes. */}\n <span className={styles.labelWrap}>\n <span className={styles.sizer} data-sizer=\"\" aria-hidden=\"true\">\n {itemLabels.map((l, i) => (\n // eslint-disable-next-line react/no-array-index-key\n <span key={i}>{l}</span>\n ))}\n {placeholder && <span>{placeholder}</span>}\n </span>\n <span className={styles.triggerLabel}>{label ?? placeholder ?? \"\"}</span>\n </span>\n <svg className={styles.chevron} width=\"9\" height=\"9\" viewBox=\"0 0 9 9\" aria-hidden=\"true\">\n <path d=\"M0.5 3 L4.5 7 L8.5 3\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.2\" />\n </svg>\n </button>\n\n {/* Always mounted but hidden while closed, so the trigger can read the\n item labels for sizing before the panel has ever been opened. */}\n <div\n ref={listRef}\n id={listboxId}\n role=\"listbox\"\n tabIndex={-1}\n hidden={!open}\n aria-activedescendant={highlighted ? optionId(listboxId, highlighted) : undefined}\n className={cx(styles.listbox, ctl.spacePanel)}\n data-animated={animated ? undefined : \"false\"}\n style={\n triggerWidth != null || maxHeight != null\n ? ({\n ...(triggerWidth != null ? { \"--_select-trigger-width\": `${triggerWidth}px` } : {}),\n ...(maxHeight != null ? { maxHeight: `${maxHeight}px` } : {}),\n } as React.CSSProperties)\n : undefined\n }\n onKeyDown={(e) => {\n if (e.key === \"Escape\") {\n e.stopPropagation(); // don't let an ancestor Dialog close too\n setOpen(false);\n triggerRef.current?.focus();\n } else if (e.key === \"ArrowDown\") { e.preventDefault(); move(1); }\n else if (e.key === \"ArrowUp\") { e.preventDefault(); move(-1); }\n else if (e.key === \"Home\") { e.preventDefault(); setHighlighted(values[0] ?? null); }\n else if (e.key === \"End\") { e.preventDefault(); setHighlighted(values[values.length - 1] ?? null); }\n else if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n if (highlighted) {\n onValueChange(highlighted);\n setOpen(false);\n triggerRef.current?.focus();\n }\n } else if (e.key === \"Tab\") {\n setOpen(false);\n }\n }}\n >\n {children}\n </div>\n </div>\n </Ctx.Provider>\n );\n}\n\nexport interface SelectItemProps {\n /** Reported to onValueChange when chosen. */\n value: string;\n /** Skipped by keyboard navigation and not selectable. Still contributes its\n * width to the control's sizing. */\n disabled?: boolean;\n /** Shown in the panel and, once selected, in the closed control — so it has\n * to read correctly in both places. */\n children?: ReactNode;\n}\n\n/**\n * One option. Its children are what the closed control displays once\n * selected, so anything rendered here has to read correctly in both places.\n */\nfunction Item({ value, disabled, children }: SelectItemProps) {\n const s = useSelect();\n const selected = s.value === value;\n const highlighted = s.highlighted === value;\n return (\n <div\n id={optionId(s.listboxId, value)}\n role=\"option\"\n aria-selected={selected}\n aria-disabled={disabled || undefined}\n data-highlighted={highlighted ? \"\" : undefined}\n className={cx(styles.item, \"spSelectItem\")}\n onMouseEnter={() => !disabled && s.setHighlighted(value)}\n onClick={() => {\n if (disabled) return;\n s.onValueChange(value);\n s.setOpen(false);\n s.triggerRef.current?.focus();\n }}\n >\n {children}\n </div>\n );\n}\n\n// Item hangs off the component rather than being a separate export, so the\n// whole API is reachable from the one name a consumer already imported.\nexport const Select = Object.assign(SelectRoot, { Item });\n","\"use client\";\nimport type * as React from \"react\";\nimport { forwardRef, type ReactNode } from \"react\";\nimport { cx } from \"./propShared\";\nimport styles from \"./TextField.module.scss\";\nimport ctl from \"../styles/spaceControls\";\n\nexport interface TextFieldProps\n extends Omit<React.InputHTMLAttributes<HTMLInputElement>, \"className\" | \"style\"> {\n /** Merged onto the field wrapper, not the inner input. */\n className?: string;\n /** Ambient motion on the rim. The glass skin is always applied.\n * Default true. */\n animated?: boolean;\n /** Applied to the field wrapper — set width here. */\n style?: React.CSSProperties;\n /** Slots rendered inside the field, alongside the input. */\n children?: ReactNode; // Slot(s)\n}\n\n/**\n * Single-line text entry. The field surface is a wrapper around the input so\n * `TextField.Slot` can sit alongside it inside the same surface — that\n * wrapper is built in rather than being something you compose.\n *\n * Props land on the inner input, so `value`, `onChange` and the rest behave\n * as they would on a bare input. `className` and `style` land on the field\n * surface instead, which is where width belongs.\n *\n * The ref forwards to the input, not the wrapper.\n */\nconst TextFieldRoot = forwardRef<HTMLInputElement, TextFieldProps>(function TextField(\n { className, style, animated = true, children, ...inputProps },\n ref,\n) {\n return (\n <div\n className={cx(styles.root, ctl.spaceInput, \"spTextFieldRoot\", className)}\n data-animated={animated ? undefined : \"false\"}\n style={style}\n >\n {children}\n <input {...inputProps} ref={ref} className={cx(styles.input, \"spTextFieldInput\")} />\n </div>\n );\n});\n\n/**\n * A fixed element inside the field, before or after the input — an icon, a\n * unit, a short affordance. Sits within the field's surface rather than\n * beside it, and does not shrink as the input fills.\n */\nfunction Slot({\n children,\n}: {\n /** The slot's contents — an icon, a unit, a short affordance. */\n children?: ReactNode;\n}) {\n return <span className={styles.slot}>{children}</span>;\n}\n\n// Slot hangs off the component rather than being a separate export, so the\n// whole API is reachable from the one name a consumer already imported.\nexport const TextField = Object.assign(TextFieldRoot, { Slot });\n","\"use client\";\nimport type * as React from \"react\";\nimport { forwardRef } from \"react\";\nimport { cx } from \"./propShared\";\nimport styles from \"./TextArea.module.scss\";\nimport ctl from \"../styles/spaceControls\";\n\nexport interface TextAreaProps\n extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, \"className\" | \"style\"> {\n /** Merged onto the field wrapper, not the inner textarea. */\n className?: string;\n /** Ambient motion on the rim. The glass skin is always applied.\n * Default true. */\n animated?: boolean;\n /** Applied to the field wrapper — set width here. */\n style?: React.CSSProperties;\n}\n\n/**\n * Multi-line text entry. `rows` sets the initial height; it grows with its\n * container's width and resizes vertically only, since horizontal drag would\n * break the surrounding layout.\n */\nexport const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(function TextArea(\n { className, style, animated = true, ...rest },\n ref,\n) {\n return (\n <div\n className={cx(styles.root, ctl.spaceInput, ctl.spaceTextArea, \"spTextFieldRoot\", className)}\n data-animated={animated ? undefined : \"false\"}\n style={style}\n >\n <textarea {...rest} ref={ref} className={cx(styles.textarea, \"spTextAreaInput\")} />\n </div>\n );\n});\n","// A text field with a result list hanging under it.\n//\n// It never fetches and never ranks: the consumer hands it the candidate rows,\n// from memory or from an API, in whatever order that domain considers best.\n// What it does own is the narrowing — matching the typed text against those\n// rows — plus the popover, the keyboard model and the aria wiring. Those are\n// the parts every autocomplete needs and nobody enjoys writing twice.\n//\n// A caller whose rows were already matched server-side passes `preFiltered`\n// and the narrowing is skipped, so a fuzzy or synonym match made elsewhere is\n// not undone by a plain substring test here.\n\"use client\";\nimport type * as React from \"react\";\nimport {\n useCallback, useEffect, useId, useMemo, useRef, useState, type ReactNode,\n} from \"react\";\nimport { cx } from \"./propShared\";\nimport { TextField } from \"./TextField\";\nimport styles from \"./Autocomplete.module.scss\";\nimport ctl from \"../styles/spaceControls\";\n\nexport interface AutocompleteOption {\n /** Handed back to `onSelect` when this row is chosen. */\n value: string;\n /** The row's main text. */\n label: ReactNode;\n /** Optional secondary text, set against the trailing edge — a category, a\n * score, a date. Kept out of `label` so it stays visually subordinate and\n * does not affect which row a reader scans for. */\n meta?: ReactNode;\n /** Shown, but skipped by the keyboard and unselectable. */\n disabled?: boolean;\n /** The text the typed query is matched against, when `label` is not a plain\n * string. Falls back to `label` if it is one, and to `value` otherwise —\n * and `value` is usually a slug, which is rarely what someone is typing. */\n search?: string;\n}\n\nexport interface AutocompleteProps\n extends Omit<\n React.InputHTMLAttributes<HTMLInputElement>,\n \"value\" | \"onChange\" | \"onSelect\" | \"className\" | \"style\"\n > {\n /** The text in the field. Fully controlled. */\n value: string;\n /** Called on every keystroke. */\n onValueChange: (value: string) => void;\n /** The candidate rows, in the order you want them shown. They are narrowed\n * against what has been typed unless `preFiltered` is set; the order you\n * give is always preserved, so ranking stays yours. Nothing is offered\n * until something has been typed. Past that, an empty array with no\n * `loading` and no `emptyMessage` still shows no panel, which is how you\n * hold it shut below a minimum query length. */\n options: AutocompleteOption[];\n /** Called when a row is chosen by click or Enter. */\n onSelect: (value: string, option: AutocompleteOption) => void;\n /** Renders a leading glyph inside the field — a magnifier, usually. */\n icon?: ReactNode;\n /** Match exactly as typed, so `trappist` no longer finds `TRAPPIST`.\n * Default off, which is what nearly every search wants. */\n caseSensitive?: boolean;\n /** The rows were already matched — by a server, a fuzzy search, a synonym\n * table — so render them as given. Without this a substring test here\n * would silently drop rows a smarter match upstream had found. */\n preFiltered?: boolean;\n /** Replaces the list with a waiting message while results are on their way. */\n loading?: boolean;\n /** What that waiting message says. Name the thing being fetched — \"Loading\n * the catalogue…\" tells a reader more than a spinner's worth of nothing.\n * Default \"Loading…\". */\n loadingMessage?: ReactNode;\n /** Shown when there are no options and nothing is loading. Leave it out to\n * show no panel at all rather than an empty one. */\n emptyMessage?: ReactNode;\n /** A line under the list, outside its scroll area — \"showing 50 of 2,700\",\n * a hint, a keyboard legend. */\n footer?: ReactNode;\n /** Ambient motion on the field's rim. The glass skin is always applied.\n * Default true. */\n animated?: boolean;\n /** Merged onto the wrapper, which is what you size. */\n className?: string;\n /** Applied to the wrapper — set width here. */\n style?: React.CSSProperties;\n}\n\n/**\n * A text field that offers matching rows as you type.\n *\n * It holds no data of its own. Give it `options` and it renders them,\n * highlights one, moves that highlight with the arrow keys, and calls\n * `onSelect` when a row is chosen — however those options were produced.\n *\n * The list is a popover rather than a block in the flow: results that appear\n * mid-keystroke and push the page down under the cursor are disorienting, and\n * whatever is being searched usually sits directly below the field.\n */\nexport function Autocomplete({\n value,\n onValueChange,\n options,\n onSelect,\n icon,\n caseSensitive = false,\n preFiltered = false,\n loading = false,\n loadingMessage = \"Loading…\",\n emptyMessage,\n footer,\n animated = true,\n className,\n style,\n ...inputProps\n}: AutocompleteProps) {\n const [open, setOpen] = useState(false);\n const [active, setActive] = useState(0);\n const wrapRef = useRef<HTMLDivElement>(null);\n const listRef = useRef<HTMLUListElement>(null);\n const listId = useId();\n\n // What a row is matched on: its label when that is plain text, an explicit\n // `search` when the label is markup, and the value as a last resort.\n const haystack = (o: AutocompleteOption) =>\n typeof o.label === \"string\" ? o.label : (o.search ?? o.value);\n\n // Nothing typed, nothing offered. An empty query used to let every option\n // through, so focusing the field dropped the whole dataset open before the\n // reader had asked for anything. Whitespace counts as empty.\n const hasQuery = value.trim() !== \"\";\n\n const shown = useMemo(() => {\n if (!hasQuery) return [];\n if (preFiltered) return options;\n const needle = caseSensitive ? value : value.toLowerCase();\n return options.filter((o) => {\n const text = caseSensitive ? haystack(o) : haystack(o).toLowerCase();\n return text.includes(needle);\n });\n }, [options, value, caseSensitive, preFiltered, hasQuery]);\n\n const selectable = useMemo(() => shown.filter((o) => !o.disabled), [shown]);\n\n // Nothing to say, no panel. With no query there is never anything to say —\n // not the rows, not a loading line, and not an empty message that would\n // report \"nothing matching\" for a search nobody has typed. Past that, a\n // consumer can still keep the panel shut below a minimum length by sending\n // no options, no loading and no message.\n const hasContent = hasQuery && (shown.length > 0 || loading || emptyMessage != null);\n const showPanel = open && hasContent;\n\n // A changed result set invalidates the highlight — it pointed at a row that\n // may no longer exist, let alone be the best match.\n useEffect(() => setActive(0), [shown]);\n\n // \"nearest\" scrolls only when the row is actually out of view, so walking a\n // visible list does not jump the container under the cursor.\n useEffect(() => {\n if (!showPanel) return;\n const el = listRef.current?.querySelector<HTMLElement>(`[data-index=\"${active}\"]`);\n el?.scrollIntoView({ block: \"nearest\" });\n }, [active, showPanel]);\n\n // pointerdown, not click: a drag that starts inside the panel and ends\n // outside it is not an outside click, and the dismissal should land before\n // whatever sits underneath can fire.\n const close = useCallback(() => setOpen(false), []);\n useEffect(() => {\n if (!showPanel) return;\n const onDown = (e: PointerEvent) => {\n const node = wrapRef.current;\n if (node && e.target instanceof Node && !node.contains(e.target)) close();\n };\n document.addEventListener(\"pointerdown\", onDown);\n return () => document.removeEventListener(\"pointerdown\", onDown);\n }, [showPanel, close]);\n\n // Whether the reader has moved the highlight with the keyboard since they\n // last typed. Space selects only then: the first row is highlighted the\n // moment results appear, so a Space that always selected would make it\n // impossible to type \"trappist-1 b\" — the space after the 1 would choose a\n // row instead.\n const navigated = useRef(false);\n\n const choose = (option: AutocompleteOption) => {\n if (option.disabled) return;\n // The chosen row's text goes into the field — the same text it was matched\n // on, not its value, which is usually a slug nobody typed.\n onValueChange(haystack(option));\n onSelect(option.value, option);\n navigated.current = false;\n setOpen(false);\n };\n\n const move = (delta: number) => {\n if (selectable.length === 0) return;\n const current = shown[active];\n const from = current && !current.disabled ? selectable.indexOf(current) : -1;\n const next = (from + delta + selectable.length) % selectable.length;\n const target = selectable[next];\n if (target) setActive(shown.indexOf(target));\n };\n\n const onKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (e.key === \"Escape\") {\n // Stop here: an ancestor Dialog must not close because a suggestion\n // list did.\n if (showPanel) e.stopPropagation();\n setOpen(false);\n return;\n }\n if (e.key === \"Tab\") {\n setOpen(false);\n return;\n }\n if (!showPanel) {\n if (e.key === \"ArrowDown\") setOpen(true);\n return;\n }\n if (e.key === \"ArrowDown\") { e.preventDefault(); navigated.current = true; move(1); }\n else if (e.key === \"ArrowUp\") { e.preventDefault(); navigated.current = true; move(-1); }\n else if (e.key === \"Home\") {\n e.preventDefault();\n navigated.current = true;\n const first = selectable[0];\n if (first) setActive(shown.indexOf(first));\n } else if (e.key === \"End\") {\n e.preventDefault();\n navigated.current = true;\n const last = selectable[selectable.length - 1];\n if (last) setActive(shown.indexOf(last));\n } else if (e.key === \"Enter\" || (e.key === \" \" && navigated.current)) {\n const chosen = shown[active];\n if (chosen && !chosen.disabled) {\n e.preventDefault();\n choose(chosen);\n }\n }\n };\n\n const activeOption = showPanel ? shown[active] : undefined;\n\n return (\n <div ref={wrapRef} className={cx(styles.wrap, className)} style={style}>\n <TextField\n {...inputProps}\n type={inputProps.type ?? \"text\"}\n role=\"combobox\"\n animated={animated}\n className={styles.field}\n autoComplete=\"off\"\n aria-expanded={showPanel}\n aria-controls={listId}\n aria-autocomplete=\"list\"\n aria-activedescendant={\n activeOption && !activeOption.disabled ? `${listId}-${active}` : undefined\n }\n value={value}\n onFocus={(e) => {\n inputProps.onFocus?.(e);\n setOpen(true);\n }}\n // Focus alone is not enough. After a selection the panel shuts but\n // focus stays in the field, so onFocus never fires again and clicking\n // back into it did nothing — a combobox you cannot reopen by clicking\n // reads as broken.\n onClick={(e) => {\n inputProps.onClick?.(e);\n setOpen(true);\n }}\n onKeyDown={(e) => {\n inputProps.onKeyDown?.(e);\n onKeyDown(e);\n }}\n onChange={(e) => {\n // Typing again hands Space back to the text.\n navigated.current = false;\n onValueChange(e.target.value);\n setOpen(true);\n }}\n >\n {icon != null && <TextField.Slot>{icon}</TextField.Slot>}\n </TextField>\n\n {/* Always mounted, hidden while shut. aria-controls above points at the\n listbox by id, and an id that resolves to nothing is a promise the\n markup does not keep — same reason Select keeps its listbox in the\n tree. */}\n <div\n className={cx(styles.panel, ctl.spacePanel)}\n hidden={!showPanel}\n data-animated={animated ? undefined : \"false\"}\n >\n {hasQuery && loading && <p className={styles.status}>{loadingMessage}</p>}\n\n {hasQuery && !loading && shown.length === 0 && emptyMessage != null && (\n <p className={styles.status}>{emptyMessage}</p>\n )}\n\n <ul\n ref={listRef}\n id={listId}\n role=\"listbox\"\n className={styles.list}\n hidden={loading || shown.length === 0}\n >\n {shown.map((option, i) => (\n <li\n key={option.value}\n id={`${listId}-${i}`}\n data-index={i}\n role=\"option\"\n aria-selected={i === active}\n aria-disabled={option.disabled || undefined}\n className={cx(\n styles.option,\n i === active && !option.disabled && styles.active,\n \"spAutocompleteOption\",\n )}\n // One highlight for pointer and keyboard both: hovering moves the\n // active row, so there is never a mouse highlight and a keyboard\n // highlight disagreeing about what Enter would do.\n onMouseEnter={() => !option.disabled && setActive(i)}\n onPointerDown={(e) => {\n // Before blur, or the panel closes and the click lands on\n // whatever the layout collapses into its place.\n e.preventDefault();\n choose(option);\n }}\n >\n <span className={styles.label}>{option.label}</span>\n {option.meta != null && <span className={styles.meta}>{option.meta}</span>}\n </li>\n ))}\n </ul>\n\n {/* Outside the scroll area, so a count stays put while the list moves. */}\n {footer != null && <div className={styles.footer}>{footer}</div>}\n </div>\n </div>\n );\n}\n","\"use client\";\nimport type * as React from \"react\";\nimport { forwardRef } from \"react\";\nimport { cx } from \"./propShared\";\nimport styles from \"./Slider.module.scss\";\nimport ctl from \"../styles/spaceControls\";\n\nexport interface SliderProps {\n /** Current value, as a single-element array. Fully controlled. */\n value: number[];\n /** Called with the new value array as the thumb moves. */\n onValueChange: (v: number[]) => void;\n /** Lower bound. */\n min: number;\n /** Upper bound. */\n max: number;\n /** Smallest increment the thumb can move by. */\n step: number;\n /** Blocks interaction and removes it from the tab order. */\n disabled?: boolean;\n /** Merged onto the wrapper. */\n className?: string;\n /** Accessible name. Required unless a visible label references it,\n * since a slider has no text of its own.\n */\n \"aria-label\"?: string;\n}\n\n/**\n * A range control for a continuous value.\n *\n * Takes and returns an array so multiple thumbs can be added later without a\n * breaking change, even though it renders one today.\n */\nexport const Slider = forwardRef<HTMLInputElement, SliderProps>(function Slider(\n { value, onValueChange, min, max, step, disabled, className, \"aria-label\": ariaLabel },\n ref,\n) {\n const v = value[0] ?? min;\n const pct = max === min ? 0 : ((v - min) / (max - min)) * 100;\n return (\n <span className={cx(styles.root, ctl.spaceSlider, className)} data-disabled={disabled || undefined}>\n <span className={cx(styles.track, \"spSliderTrack\")}>\n <span className={cx(styles.range, \"spSliderRange\")} style={{ width: `${pct}%` }} />\n </span>\n <span className={cx(styles.thumb, \"spSliderThumb\")} style={{ left: `${pct}%` }} />\n <input\n ref={ref}\n type=\"range\"\n className={cx(styles.input, \"spSliderInput\")}\n value={v}\n min={min}\n max={max}\n step={step}\n disabled={disabled}\n aria-label={ariaLabel}\n onChange={(e) => onValueChange([Number(e.target.value)])}\n />\n </span>\n );\n});\n","\"use client\";\nimport type * as React from \"react\";\nimport { createContext, useContext, useId, type ReactNode } from \"react\";\nimport { cx } from \"./propShared\";\nimport styles from \"./RadioGroup.module.scss\";\n\ninterface GroupCtx {\n value: string;\n onValueChange: (v: string) => void;\n disabled?: boolean;\n name: string;\n}\nconst Ctx = createContext<GroupCtx | null>(null);\n\nexport interface RadioGroupProps {\n /** The selected item's value. Fully controlled. */\n value: string;\n /** Called with the newly selected value. */\n onValueChange: (v: string) => void;\n /** Disables every item at once. */\n disabled?: boolean;\n /** Merged onto the group wrapper. */\n className?: string;\n /** One or more `RadioGroup.Item`. */\n children?: ReactNode;\n}\n\n/**\n * A single-choice control for short lists, where seeing every option at once\n * matters more than saving space. Reach for Select when it does not.\n */\nfunction RadioGroupRoot({ value, onValueChange, disabled, className, children }: RadioGroupProps) {\n const name = useId();\n return (\n <Ctx.Provider value={{ value, onValueChange, disabled, name }}>\n <div role=\"radiogroup\" className={cx(styles.root, className)}>\n {children}\n </div>\n </Ctx.Provider>\n );\n}\n\nexport interface RadioGroupItemProps {\n /** Reported to the group's onValueChange when chosen. */\n value: string;\n /** Disables this option only. */\n disabled?: boolean;\n /** The option's label. Part of the click target, not merely beside it. */\n children?: ReactNode;\n}\n\n/**\n * One option.\n *\n * With children it labels itself: a <label> wraps the input, the orb and the\n * children, so the text is part of the click target. Without children it\n * emits a bare span instead, so an OUTER label can own the association —\n * nesting one label inside another is invalid HTML.\n */\nfunction Item({ value, disabled, children }: RadioGroupItemProps) {\n const g = useContext(Ctx);\n if (!g) throw new Error(\"RadioGroup.Item must be inside a RadioGroup\");\n const isDisabled = disabled || g.disabled;\n const control = (\n <>\n <input\n type=\"radio\"\n className={styles.input}\n name={g.name}\n value={value}\n checked={g.value === value}\n disabled={isDisabled}\n onChange={() => g.onValueChange(value)}\n />\n <span className={cx(styles.orb, \"spRadioOrb\")} aria-hidden=\"true\" />\n </>\n );\n if (children === undefined || children === null) {\n return <span className={styles.item}>{control}</span>;\n }\n return (\n <label className={cx(styles.item, styles.selfLabeled)}>\n {control}\n {children}\n </label>\n );\n}\n\n// Item hangs off the component rather than being a separate export, so the\n// whole API is reachable from the one name a consumer already imported.\nexport const RadioGroup = Object.assign(RadioGroupRoot, { Item });\n","\"use client\";\nimport type * as React from \"react\";\nimport { cx } from \"./propShared\";\nimport styles from \"./Progress.module.scss\";\n\nexport interface ProgressProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Current progress, clamped between 0 and `max`. */\n value: number;\n /** The value representing complete. */\n max?: number;\n}\n\n/**\n * A determinate bar for work you can measure — use Loader when you cannot.\n *\n * Speaks the same visual language as Slider, because a progress bar and a\n * slider track are the same object: one you watch, one you drag.\n */\nexport function Progress({ value, max = 100, className, style, ...rest }: ProgressProps) {\n const pct = max > 0 ? Math.min(Math.max((value / max) * 100, 0), 100) : 0;\n return (\n <div\n {...rest}\n role=\"progressbar\"\n aria-valuenow={value}\n aria-valuemin={0}\n aria-valuemax={max}\n className={cx(styles.progress, className)}\n style={style}\n >\n {/* Unclassed on purpose: a consumer can target `.progress > div`\n without knowing the hashed module class. */}\n <div style={{ width: `${pct}%`, height: \"100%\" }} />\n </div>\n );\n}\n","\"use client\";\nimport type * as React from \"react\";\nimport { forwardRef, type ReactNode } from \"react\";\nimport { cx } from \"./propShared\";\nimport { InfoCircledIcon, ExclamationTriangleIcon, CrossCircledIcon } from \"./icons\";\nimport styles from \"./Message.module.scss\";\n\nexport type MessageVariant = \"info\" | \"warning\" | \"alert\";\n\n/** Each variant carries its own glyph, so the message reads at a glance\n * before any of its words do. Overridable per instance via `icon`. */\nconst ICONS: Record<MessageVariant, ReactNode> = {\n info: <InfoCircledIcon />,\n warning: <ExclamationTriangleIcon />,\n alert: <CrossCircledIcon />,\n};\n\n/**\n * How loudly each variant announces itself.\n *\n * `alert` uses role=\"alert\", which is assertive: it interrupts whatever a\n * screen reader is saying. That is right for something gone wrong and wrong\n * for everything else, so info and warning are polite status regions that\n * wait their turn.\n */\nconst ROLES: Record<MessageVariant, { role: string; live?: \"polite\" }> = {\n info: { role: \"status\", live: \"polite\" },\n warning: { role: \"status\", live: \"polite\" },\n alert: { role: \"alert\" },\n};\n\nexport interface MessageProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> {\n /** Which message this is. `info` states something, `warning` flags a risk\n * worth acting on, `alert` reports something already wrong. Default\n * `info`. */\n variant?: MessageVariant;\n /** An optional bold line above the body. Omit for a single-line message —\n * a title that merely restates the body is noise.\n *\n * This shadows the HTML `title` attribute, which took a string and showed\n * a browser tooltip. A tooltip on a banner nobody hovers was never the\n * useful reading of the name. */\n title?: ReactNode;\n /** Replaces the variant's own glyph. Pass `null` for no icon at all. */\n icon?: ReactNode;\n /** The message. */\n children?: ReactNode;\n}\n\n/**\n * A banner that tells the reader something about the state of the page — a\n * risk, a result, a failure.\n *\n * The three variants do not merely change hue. `info` is lit like the rest of\n * the system, cool and calm; `warning` warms the rim to amber; `alert` uses\n * the ember treatment, the same warm limb the destructive Button wears. Each\n * carries its own glyph so the kind of message reads before the words do.\n *\n * For a decision the reader must make, reach for `AlertDialog` instead — a\n * message states, it does not ask.\n */\nexport const Message = forwardRef<HTMLDivElement, MessageProps>(function Message(\n { variant = \"info\", title, icon, className, children, ...rest },\n ref,\n) {\n const glyph = icon === undefined ? ICONS[variant] : icon;\n const { role, live } = ROLES[variant];\n\n return (\n <div\n {...rest}\n ref={ref}\n role={role}\n aria-live={live}\n className={cx(styles.message, styles[variant], className)}\n >\n {glyph != null && (\n <span className={styles.icon} aria-hidden=\"true\">\n {glyph}\n </span>\n )}\n <div className={styles.body}>\n {title != null && <p className={styles.title}>{title}</p>}\n {children != null && <div className={styles.text}>{children}</div>}\n </div>\n </div>\n );\n});\n","// src/components/ui/Dialog.tsx\n// Compound Dialog matching the Radix JSX shape on a native <dialog>:\n// top-layer stacking (nested/stacked dialogs work), built-in focus trap and\n// focus return, Esc via the `cancel` event. Both controlled (open/\n// onOpenChange) and Trigger-driven uncontrolled sites are supported — the\n// inventory has both. Esc handoff with the in-house Select: a capture-phase\n// keydown checks for an open listbox inside the dialog and flags the next\n// `cancel` to be swallowed, so one Esc closes the Select, the next closes\n// the dialog (matching the Radix-era behavior sites were built against).\n\"use client\";\nimport type * as React from \"react\";\nimport { XIcon } from \"./icons\";\nimport {\n cloneElement, createContext, isValidElement, useContext, useEffect,\n useId, useLayoutEffect, useRef, useState, type ReactNode,\n} from \"react\";\nimport { cx } from \"./propShared\";\nimport { Heading, type HeadingProps } from \"./Heading\";\nimport { Text, type TextProps } from \"./Text\";\nimport styles from \"./Dialog.module.scss\";\n\n// Body scroll-lock reference count, shared across every mounted Content\n// instance (module scope, not per-instance state) — Dialog and AlertDialog\n// stack on top of one another, and per-instance prev-capture couldn't tell\n// \"I'm the last one closing\" from \"another instance is still open\" when\n// unmounts land out of open-order. A plain 0→1 / 1→0 edge count is\n// order-proof: overflow is locked exactly while count > 0, regardless of\n// which instance opened or closed first.\nlet lockCount = 0;\n\nexport interface DialogCtx {\n open: boolean;\n setOpen: (o: boolean) => void;\n titleId: string;\n descId: string;\n /** alert dialogs: no backdrop light-dismiss */\n alert?: boolean;\n /** whether a Description is currently mounted (drives aria-describedby) */\n hasDesc: boolean;\n setHasDesc: (v: boolean) => void;\n}\nconst Ctx = createContext<DialogCtx | null>(null);\nexport const useDialog = () => {\n const ctx = useContext(Ctx);\n if (!ctx) throw new Error(\"Dialog parts must be inside a Dialog\");\n return ctx;\n};\n\nexport interface DialogProps {\n /** Controls the dialog. Omit both this and onOpenChange to let the dialog\n * manage its own state. */\n open?: boolean;\n /** Called whenever the dialog opens or closes, including via Escape or a\n * backdrop click. */\n onOpenChange?: (o: boolean) => void;\n /** A `Trigger` and a `Content`, in any arrangement — this renders\n * nothing itself, so they can sit anywhere beneath it. */\n children?: ReactNode;\n}\n\n/** Shared by Dialog and AlertDialog; only the alert flag differs. */\nexport function makeRoot(alert: boolean) {\n return function DialogRoot({ open, onOpenChange, children }: DialogProps) {\n const [internal, setInternal] = useState(false);\n const isControlled = open !== undefined;\n const actual = isControlled ? open : internal;\n const setOpen = (o: boolean) => {\n if (!isControlled) setInternal(o);\n onOpenChange?.(o);\n };\n const titleId = useId();\n const descId = useId();\n const [hasDesc, setHasDesc] = useState(false);\n return (\n <Ctx.Provider value={{ open: actual, setOpen, titleId, descId, alert, hasDesc, setHasDesc }}>\n {children}\n </Ctx.Provider>\n );\n };\n}\n/**\n * Owns a dialog's open state. Works controlled via `open`/`onOpenChange`, or\n * uncontrolled if you pass neither.\n *\n * Renders nothing itself — it only provides context, so Trigger and Content\n * can sit anywhere beneath it in the tree.\n */\nconst Root = makeRoot(false);\n\ntype Clickable = React.ReactElement<{ onClick?: (e: React.MouseEvent) => void }>;\nconst chainOpen = (child: ReactNode, fn: () => void): ReactNode => {\n if (!isValidElement(child)) return child;\n const c = child as Clickable;\n return cloneElement(c, {\n onClick: (e: React.MouseEvent) => { c.props.onClick?.(e); fn(); },\n });\n};\n\n/**\n * Opens the dialog. Chains onto its child's existing click handler rather\n * than replacing it, and renders no element of its own — so the child stays\n * whatever it already was, button or otherwise.\n */\nexport function Trigger({\n children,\n}: {\n /** The control that opens the dialog. Its own onClick still fires. */\n children?: ReactNode;\n}) {\n const d = useDialog();\n return <>{chainOpen(children, () => d.setOpen(true))}</>;\n}\n\n/**\n * Closes the dialog. Same shape as Trigger: wraps its child, adds a close on\n * click, and adds no markup.\n */\nexport function Close({\n children,\n}: {\n /** The control that closes the dialog. Its own onClick still fires. */\n children?: ReactNode;\n}) {\n const d = useDialog();\n return <>{chainOpen(children, () => d.setOpen(false))}</>;\n}\n\nexport interface ContentProps extends React.HTMLAttributes<HTMLDialogElement> {\n /** Padding and radius step. 4 is roomier, for dialogs carrying a form. */\n size?: \"3\" | \"4\";\n /** Caps the dialog's width, e.g. \"480px\". Without it the dialog uses its\n * own default and grows with its content. */\n maxWidth?: string;\n /** Dialog contents. Include a Title — it is the accessible name. */\n children?: ReactNode;\n}\n\n/**\n * The dialog surface. Built on the native `<dialog>` element, so the browser\n * supplies the top layer, focus trapping and Escape handling rather than the\n * library reimplementing them.\n *\n * Dismissible by Escape or a click on the backdrop; AlertDialog's Content\n * deliberately is not.\n */\nexport function Content({ size = \"3\", maxWidth, className, style, children, ...rest }: ContentProps) {\n const d = useDialog();\n const ref = useRef<HTMLDialogElement | null>(null);\n const swallowCancel = useRef(false);\n // Backdrop dismissal must require BOTH the mousedown/pointerdown AND the\n // click to land on the backdrop (the <dialog> element itself, not the\n // inner content wrapper) — otherwise a text-selection drag that starts in\n // the content and ends up released over the backdrop would close the\n // dialog on mouseup even though the gesture began inside it.\n const pointerDownOnBackdrop = useRef(false);\n\n // Imperative <dialog> API follows the declarative open prop (handles the\n // delayed first open of AccountsIntroModal's 900ms timer too).\n useEffect(() => {\n const el = ref.current;\n if (!el) return;\n if (d.open && !el.open) el.showModal();\n else if (!d.open && el.open) el.close();\n }, [d.open]);\n\n // Body scroll lock while open (Radix did this; panels behind rely on it).\n // Module-level counter (see `lockCount` above) so stacked dialogs compose:\n // only the 0→1 transition locks, only the 1→0 transition unlocks.\n useEffect(() => {\n if (!d.open) return;\n lockCount += 1;\n if (lockCount === 1) document.body.style.overflow = \"hidden\";\n return () => {\n lockCount -= 1;\n if (lockCount === 0) document.body.style.overflow = \"\";\n };\n }, [d.open]);\n\n return (\n <dialog\n {...rest}\n ref={ref}\n role={d.alert ? \"alertdialog\" : undefined}\n aria-labelledby={d.titleId}\n aria-describedby={d.hasDesc ? d.descId : undefined}\n className={cx(styles.dialog, \"spDialog\", size === \"4\" && styles.size4, className)}\n style={{ ...(maxWidth ? { maxWidth } : null), ...style }}\n onKeyDownCapture={(e) => {\n if (e.key !== \"Escape\") return;\n // A nested dialog is open inside this one (e.g. an AlertDialog\n // launched from this dialog's content) — that inner dialog owns\n // this Esc; don't let the outer one arm its own swallow logic on\n // an event that's about to close a dialog it isn't itself.\n if (ref.current?.querySelector(\"dialog[open]\")) return;\n // Esc while an in-house Select's listbox is open inside this dialog:\n // the Select closes itself; swallow the dialog's own cancel.\n if (ref.current?.querySelector('[role=\"listbox\"]:not([hidden])')) {\n swallowCancel.current = true;\n }\n }}\n onCancel={(e) => {\n e.preventDefault(); // we route ALL closes through React state\n if (swallowCancel.current) { swallowCancel.current = false; return; }\n d.setOpen(false);\n }}\n onClose={() => {\n // Belt-and-suspenders: any UA-initiated close we didn't route\n // through onCancel (a non-cancelable close request, or a future\n // method=\"dialog\" form submission inside the content) still fires\n // `close`. Resync React state so `open` doesn't get stranded true\n // while the native element is actually closed.\n if (d.open) d.setOpen(false);\n }}\n onPointerDown={(e) => {\n pointerDownOnBackdrop.current = e.target === ref.current;\n }}\n onClick={(e) => {\n // Backdrop click = clicking the <dialog> element itself (the inner\n // wrapper covers the content area). Alert dialogs don't light-dismiss.\n // Require the pointerdown that started this click to have also\n // landed on the backdrop, so a text-selection drag from the content\n // out to the backdrop doesn't close the dialog on release.\n if (!d.alert && e.target === ref.current && pointerDownOnBackdrop.current) d.setOpen(false);\n }}\n >\n <div className={styles.inner}>\n {/* Every dialog gets the same dismiss affordance in the same place.\n Alert dialogs are excluded on purpose: they ask a question that\n wants an explicit answer, and a corner X is an ambiguous one. */}\n {!d.alert && (\n <button\n type=\"button\"\n className={styles.closeX}\n aria-label=\"Close\"\n onClick={() => d.setOpen(false)}\n >\n <XIcon width={16} height={16} />\n </button>\n )}\n {children}\n </div>\n </dialog>\n );\n}\n\n/**\n * The dialog's accessible name. Wire one up for every dialog — it is what a\n * screen reader announces when the dialog opens.\n */\nexport function Title({ className, ...rest }: HeadingProps) {\n const d = useDialog();\n return <Heading as=\"h2\" size=\"5\" {...rest} id={d.titleId} className={cx(styles.title, className)} />;\n}\n\n/**\n * Supporting copy beneath the title, registered as the dialog's accessible\n * description. Optional, and only announced when present.\n */\nexport function Description(props: TextProps) {\n const d = useDialog();\n // aria-describedby on Content is conditional on a Description actually\n // being mounted (some dialogs render none), so Content can't just point\n // at descId unconditionally. Register/unregister via a layout effect —\n // runs before paint, and Description mounts synchronously with the\n // dialog's content, so there's no visible flash of a missing attribute.\n // Depend on setHasDesc alone (a stable useState setter), not the whole\n // `d` context object — that object is a fresh literal every Root render,\n // so depending on it would re-fire this effect (and its cleanup) on\n // every render instead of just mount/unmount.\n const { setHasDesc } = d;\n useLayoutEffect(() => {\n setHasDesc(true);\n return () => setHasDesc(false);\n }, [setHasDesc]);\n return <Text as=\"p\" {...props} id={d.descId} />;\n}\n\n// The parts hang off the component rather than being separate exports, so the\n// whole API is reachable from the one name a consumer already imported. They\n// stay exported above too, because AlertDialog is assembled from them.\nexport const Dialog = Object.assign(Root, {\n Trigger,\n Close,\n Content,\n Title,\n Description,\n});\n","// The same native-<dialog> engine as Dialog, with alertdialog semantics:\n// role=\"alertdialog\", and NO backdrop light-dismiss — an alert is a decision,\n// so it does not go away because you clicked beside it. Render Cancel before\n// Action so showModal()'s initial focus lands on the safe choice.\n\"use client\";\nimport {\n makeRoot, Trigger, Close,\n Content, Title, Description,\n type DialogProps,\n} from \"./Dialog\";\n\nexport type { DialogProps as AlertDialogProps };\n\n// Cancel and Action are the same component under two names. The name is the\n// point: it says which one is destructive at the call site, and it makes the\n// ordering rule above readable rather than positional trivia. Close chains\n// the child's own onClick before closing, so an Action's handler runs first.\nconst Cancel = Close;\nconst Action = Close;\n\n/**\n * A modal that interrupts to confirm something consequential.\n *\n * Unlike a Dialog it has no backdrop dismissal, because dismissing an alert\n * by missing it is not a decision. Put `Cancel` before `Action` so the safe\n * choice takes focus when it opens.\n */\nexport const AlertDialog = Object.assign(makeRoot(true), {\n Trigger,\n Content,\n Title,\n Description,\n Cancel,\n Action,\n});\n","// src/components/ui/DropdownMenu.tsx\n// role=\"menu\" on a popover=\"auto\" div: top-layer + click-outside dismissal\n// come from the platform. Anchor positioning is manual (align=\"end\" is the\n// only inventoried mode). Roving tabindex arrows per the spec.\n\"use client\";\nimport type * as React from \"react\";\nimport {\n createContext, createElement, isValidElement, useContext,\n useEffect, useId, useLayoutEffect, useRef, useState, type ReactNode,\n} from \"react\";\nimport { cx } from \"./propShared\";\nimport styles from \"./DropdownMenu.module.scss\";\nimport { Button, type ButtonProps } from \"./Button\";\n\ninterface MenuCtx {\n open: boolean;\n setOpen: (o: boolean) => void;\n menuId: string;\n}\nconst Ctx = createContext<MenuCtx | null>(null);\nconst useMenu = () => {\n const ctx = useContext(Ctx);\n if (!ctx) throw new Error(\"DropdownMenu parts must be inside a DropdownMenu\");\n return ctx;\n};\n\n\n\n// Whether the popover's current \"closed\" toggle was initiated by an Item\n// activating rather than a platform light-dismiss (click outside / Esc).\n// Item arms this just before it calls setOpen(false); the root's onToggle\n// reads-and-clears it to decide whether to arm the light-dismiss race guard.\n// It stays in its own context because a mutable ref must not sit on a value\n// object that is also read during render — a ref write would not trigger the\n// re-render that consumers of Ctx expect.\nconst ItemClosedRefCtx = createContext<React.RefObject<boolean> | null>(null);\nconst useItemClosedRef = () => {\n const ref = useContext(ItemClosedRefCtx);\n if (!ref) throw new Error(\"DropdownMenu parts must be inside a DropdownMenu\");\n return ref;\n};\n\n// Plain helper that reads-and-clears the flag, kept out of the click handler\n// so the `.current` access is not mistaken for a ref read during render.\nfunction consumeLightDismissFlag(ref: React.RefObject<boolean>): boolean {\n if (!ref.current) return false;\n ref.current = false;\n return true;\n}\n\n// Same reasoning: Item's asChild onClick is built inside the props object\n// passed to createElement rather than as a literal JSX attribute, so a direct\n// `.current` write there trips the same ref-during-render check.\nfunction markItemInitiatedClose(ref: React.RefObject<boolean>): void {\n ref.current = true;\n}\n\nexport interface DropdownMenuProps extends Omit<ButtonProps, \"children\"> {\n /** The trigger's content. The trigger is always a Button, so this is what\n * goes inside it — text, or an icon with `iconOnly`. */\n label: ReactNode;\n /** Which edge of the trigger the menu lines up with. Use `end` when the\n * trigger sits near the right edge and the menu would overflow. */\n align?: \"start\" | \"end\";\n /** `DropdownMenu.Item`, `.Separator` and `.Label`, in any order. */\n children?: ReactNode;\n}\n\n/**\n * A menu of actions hung off a button.\n *\n * The trigger is built in and is always a Button — a dropdown whose trigger\n * looked like anything else was never a shape worth supporting, and making it\n * arbitrary cost a `cloneElement` that had to graft aria wiring and a click\n * handler onto someone else's element.\n *\n * The menu rides the platform's top layer via `popover`, so click-outside\n * dismissal and stacking come from the browser rather than an approximation.\n * Arrows move between items, Escape closes and returns focus to the trigger.\n */\nfunction DropdownMenuRoot({ label, align = \"start\", children, ...buttonProps }: DropdownMenuProps) {\n const [open, setOpen] = useState(false);\n const menuId = useId();\n const triggerRef = useRef<HTMLButtonElement | null>(null);\n const menuRef = useRef<HTMLDivElement | null>(null);\n const lightDismissedRef = useRef(false);\n const itemClosedRef = useRef(false);\n const [pos, setPos] = useState<{ top: number; left: number | \"auto\"; right: number | \"auto\" } | null>(null);\n\n // useLayoutEffect (not useEffect) so the position is measured and applied\n // synchronously before paint — matches Select's trigger measurement and\n // avoids a one-frame flash at the wrong coordinates.\n useLayoutEffect(() => {\n const el = menuRef.current;\n if (!el) return;\n if (open) {\n // Position under the trigger before entering the top layer.\n const trigger = triggerRef.current;\n if (trigger) {\n const r = trigger.getBoundingClientRect();\n const left = align === \"end\" ? \"auto\" : r.left;\n const right = align === \"end\" ? window.innerWidth - r.right : \"auto\";\n setPos({ top: r.bottom + 6, left, right });\n }\n el.showPopover();\n // Focus the first item for keyboard users.\n el.querySelector<HTMLElement>('[role=\"menuitem\"]')?.focus();\n } else if (el.matches(\":popover-open\")) {\n el.hidePopover();\n }\n }, [open, align]);\n\n // A resize invalidates the anchored position (measured once, at open) —\n // rather than re-measuring on every tick, close the menu, as a light\n // dismiss would.\n useEffect(() => {\n if (!open) return;\n const onResize = () => setOpen(false);\n window.addEventListener(\"resize\", onResize);\n return () => window.removeEventListener(\"resize\", onResize);\n }, [open]);\n\n return (\n <Ctx.Provider value={{ open, setOpen, menuId }}>\n <ItemClosedRefCtx.Provider value={itemClosedRef}>\n <Button\n {...buttonProps}\n ref={triggerRef}\n aria-haspopup=\"menu\"\n aria-expanded={open}\n aria-controls={menuId}\n onClick={(e) => {\n buttonProps.onClick?.(e);\n // Race: clicking the trigger while the menu is open first fires a\n // pointerdown, which the popover API treats as an outside\n // interaction and light-dismisses the popover. The click that\n // completes right after would read the now-stale open===false and\n // immediately reopen the menu it was meant to close. Skip this\n // click's toggle if a light-dismiss just landed in the same\n // gesture.\n if (consumeLightDismissFlag(lightDismissedRef)) return;\n setOpen(!open);\n }}\n >\n {label}\n </Button>\n\n <div\n ref={menuRef}\n id={menuId}\n role=\"menu\"\n popover=\"auto\"\n className={styles.menu}\n style={\n pos\n ? {\n top: pos.top,\n left: pos.left === \"auto\" ? \"auto\" : pos.left,\n right: pos.right === \"auto\" ? \"auto\" : pos.right,\n }\n : undefined\n }\n onToggle={(e: React.SyntheticEvent<HTMLDivElement>) => {\n // Platform light-dismiss (click outside / Esc) → sync React state.\n if ((e.nativeEvent as ToggleEvent).newState === \"closed\") {\n // An Item activating also drives this closed (setOpen(false) →\n // hidePopover() → this same toggle event) — that is not a light\n // dismiss and must not arm the race guard below. Read-and-clear\n // the item's flag to tell the two apart.\n const itemInitiated = itemClosedRef.current;\n itemClosedRef.current = false;\n if (!itemInitiated) {\n // Flag the race window for the trigger's onClick and clear it\n // shortly after — it only needs to survive the current click\n // gesture, not linger.\n lightDismissedRef.current = true;\n setTimeout(() => { lightDismissedRef.current = false; }, 300);\n }\n if (open) setOpen(false);\n }\n }}\n onKeyDown={(e) => {\n const items = Array.from(\n menuRef.current?.querySelectorAll<HTMLElement>('[role=\"menuitem\"]') ?? []\n );\n const idx = items.indexOf(document.activeElement as HTMLElement);\n if (e.key === \"ArrowDown\") { e.preventDefault(); items[Math.min(idx + 1, items.length - 1)]?.focus(); }\n else if (e.key === \"ArrowUp\") { e.preventDefault(); items[Math.max(idx - 1, 0)]?.focus(); }\n else if (e.key === \"Home\") { e.preventDefault(); items[0]?.focus(); }\n else if (e.key === \"End\") { e.preventDefault(); items[items.length - 1]?.focus(); }\n else if (e.key === \"Escape\") { setOpen(false); triggerRef.current?.focus(); }\n }}\n >\n {children}\n </div>\n </ItemClosedRefCtx.Provider>\n </Ctx.Provider>\n );\n}\n\n/**\n * A non-interactive heading for a group of items. Skipped by arrow-key\n * navigation, since there is nothing to activate.\n */\nfunction Label({\n children,\n}: {\n /** Heading text for the group beneath it. Not focusable. */\n children?: ReactNode;\n}) {\n return <div className={styles.label}>{children}</div>;\n}\n\nexport interface DropdownMenuItemProps {\n /** Render the child element instead of the default item — for a link that\n * should stay an anchor rather than becoming a button. */\n asChild?: boolean;\n /** Marks a destructive action, so it reads differently before it is\n * chosen rather than after. */\n color?: \"danger\";\n /** Runs when the item is chosen; the menu closes either way. */\n onSelect?: () => void | Promise<void>;\n /** The item's label. */\n children?: ReactNode;\n}\n\n/**\n * One menu action. `onSelect` fires and the menu closes.\n *\n * Pass `color=\"danger\"` for a destructive action so it reads differently from\n * its neighbours before it is chosen, not after.\n */\nfunction Item({ asChild, color, onSelect, children }: DropdownMenuItemProps) {\n const m = useMenu();\n const itemClosedRef = useItemClosedRef();\n const cls = cx(styles.item, color === \"danger\" && styles.danger);\n const activate = () => {\n markItemInitiatedClose(itemClosedRef);\n m.setOpen(false);\n void onSelect?.();\n };\n if (asChild && isValidElement(children)) {\n const child = children as React.ReactElement<Record<string, unknown>>;\n // Rebuild (rather than cloneElement) so role/tabIndex land BEFORE the\n // child's own attributes (e.g. href) in the emitted markup — cloneElement\n // always keeps pre-existing keys in their original position. Also drop\n // the child's own role/tabIndex (if any) from restProps entirely — a\n // spread landing after the forced menuitem/-1 values would otherwise\n // silently win and undo the forced semantics.\n const {\n className: childClassName, onClick: childOnClick, children: childChildren,\n role: childRole, tabIndex: childTabIndex, ...restProps\n } = child.props;\n // Discarded — pulled out of restProps only so the forced role/tabIndex\n // below can't be silently overwritten by the child's own values.\n void childRole;\n void childTabIndex;\n const originalRef = (child as unknown as { ref?: React.Ref<unknown> }).ref;\n return createElement(\n child.type as React.ElementType,\n {\n key: child.key,\n ref: originalRef,\n role: \"menuitem\",\n tabIndex: -1,\n ...restProps,\n className: cx(cls, childClassName as string | undefined),\n onClick: (e: React.MouseEvent) => {\n (childOnClick as ((e: React.MouseEvent) => void) | undefined)?.(e);\n markItemInitiatedClose(itemClosedRef);\n m.setOpen(false); // real navigation proceeds; menu closes\n },\n },\n childChildren as ReactNode,\n );\n }\n return (\n <button type=\"button\" role=\"menuitem\" tabIndex={-1} className={cls} onClick={activate}>\n {children}\n </button>\n );\n}\n\n/**\n * A rule between groups of items — for separating a destructive action from\n * routine ones, so the two are not adjacent to a moving cursor.\n */\nfunction Separator() {\n return <div role=\"separator\" className={styles.separator} />;\n}\n\n// The parts hang off the component rather than being separate exports, so the\n// whole API is reachable from the one name a consumer already imported.\nexport const DropdownMenu = Object.assign(DropdownMenuRoot, { Item, Separator, Label });\n","// ARIA tabs. Inactive Content unmounts, matching Radix's default.\n\"use client\";\nimport type * as React from \"react\";\nimport { createContext, useContext, useId, type ReactNode } from \"react\";\nimport { cx } from \"./propShared\";\nimport styles from \"./Tabs.module.scss\";\n\ninterface TabsCtx {\n value: string;\n onValueChange: (v: string) => void;\n /** useId()-derived base, shared by Trigger/Content so a trigger's\n * aria-controls always matches its panel's id (and vice versa via\n * aria-labelledby) without either side guessing the other's id. */\n id: string;\n}\nconst Ctx = createContext<TabsCtx | null>(null);\nconst useTabs = () => {\n const ctx = useContext(Ctx);\n if (!ctx) throw new Error(\"Tabs parts must be inside a Tabs\");\n return ctx;\n};\n\nexport interface TabsProps {\n /** The selected tab's value. Fully controlled — there is no default. */\n value: string;\n /** Called with the newly selected tab's value. */\n onValueChange: (v: string) => void;\n /** Merged onto the wrapper div, which is otherwise unstyled. */\n className?: string;\n /** A `Tabs.List` and the `Tabs.Content`s it switches between. */\n children?: ReactNode;\n}\n\n/**\n * Wraps a tab set and owns which tab is showing. Fully controlled — pass\n * `value` and `onValueChange`; there is no uncontrolled mode.\n *\n * Renders a plain div, so it imposes no layout of its own. It also mints the\n * id that pairs each Trigger with its Content, which is why every part has to\n * sit inside it rather than being usable on its own.\n */\nfunction TabsRoot({ value, onValueChange, className, children }: TabsProps) {\n const id = useId();\n return (\n <Ctx.Provider value={{ value, onValueChange, id }}>\n <div className={className}>{children}</div>\n </Ctx.Provider>\n );\n}\n\n/**\n * The row of triggers, and the keyboard model for the set: arrow keys move\n * between tabs, Home and End jump to the ends, each moving focus and\n * selection together as the ARIA tabs pattern expects.\n *\n * Bottom-aligns its children, so an active tab that grows taller rises above\n * its neighbours instead of pushing the row down — the folder-tab effect.\n */\nfunction List({\n children,\n}: {\n /** The Triggers. Their order is the tab order. */\n children?: ReactNode;\n}) {\n return (\n <div\n role=\"tablist\"\n className={cx(styles.list, \"spTabsList\")}\n onKeyDown={(e) => {\n const tabs = Array.from(\n (e.currentTarget as HTMLElement).querySelectorAll<HTMLElement>('[role=\"tab\"]')\n );\n const idx = tabs.indexOf(document.activeElement as HTMLElement);\n if (idx === -1) return;\n if (e.key === \"ArrowRight\") { e.preventDefault(); const t = tabs[(idx + 1) % tabs.length]; t.focus(); t.click(); }\n else if (e.key === \"ArrowLeft\") { e.preventDefault(); const t = tabs[(idx - 1 + tabs.length) % tabs.length]; t.focus(); t.click(); }\n else if (e.key === \"Home\") { e.preventDefault(); const t = tabs[0]; t.focus(); t.click(); }\n else if (e.key === \"End\") { e.preventDefault(); const t = tabs[tabs.length - 1]; t.focus(); t.click(); }\n }}\n >\n {children}\n </div>\n );\n}\n\n/**\n * One tab. Selects its `value` on click and carries the ARIA wiring that ties\n * it to the matching Content.\n *\n * Emits `data-state=\"active\" | \"inactive\"`, which is the hook the active\n * styling keys off — useful if you are restyling tabs from outside.\n */\nfunction Trigger({ value, className, children, ...rest }: {\n /** Selects this value. Must match the Content it reveals. */\n value: string;\n /** Merged with the tab's own classes rather than replacing them. */\n className?: string;\n /** The tab's label. */\n children?: ReactNode;\n} & React.ButtonHTMLAttributes<HTMLButtonElement>) {\n const t = useTabs();\n const active = t.value === value;\n return (\n <button\n {...rest}\n type=\"button\"\n role=\"tab\"\n id={`${t.id}-tab-${value}`}\n aria-selected={active}\n aria-controls={`${t.id}-panel-${value}`}\n tabIndex={active ? 0 : -1}\n data-state={active ? \"active\" : \"inactive\"}\n className={cx(styles.trigger, \"spTabsTrigger\", className)}\n onClick={() => t.onValueChange(value)}\n >\n {children}\n </button>\n );\n}\n\n/**\n * The panel for one tab. Renders only while its `value` is the selected one —\n * inactive panels unmount rather than hide, so their contents do not run,\n * hold state, or appear to a screen reader.\n *\n * Carries no styling: the surface a tab set seats onto is the consumer's, and\n * should match `--sp-tabs-surface-color` so the active tab connects to it.\n */\nfunction Content({\n value,\n children,\n}: {\n /** Shown while this matches the Root's value. Must match a Trigger. */\n value: string;\n /** Panel contents. Unmounted while another tab is selected. */\n children?: ReactNode;\n}) {\n const t = useTabs();\n if (t.value !== value) return null;\n return (\n <div role=\"tabpanel\" id={`${t.id}-panel-${value}`} aria-labelledby={`${t.id}-tab-${value}`}>\n {children}\n </div>\n );\n}\n\n// The parts hang off the component rather than being separate exports, so the\n// whole API is reachable from the one name a consumer already imported.\nexport const Tabs = Object.assign(TabsRoot, { List, Trigger, Content });\n","\"use client\";\nimport type * as React from \"react\";\nimport {\n useCallback, useEffect, useId, useLayoutEffect, useRef, useState, type ReactNode,\n} from \"react\";\nimport { cx } from \"./propShared\";\nimport { Button, type ButtonProps } from \"./Button\";\nimport styles from \"./Popover.module.scss\";\nimport { showMeasured } from \"../internal/showMeasured\";\nimport ctl from \"../styles/spaceControls\";\n\nconst OFFSET = 8;\nconst EDGE_PADDING = 8;\n\nconst FOCUSABLE =\n 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])';\n\nexport interface PopoverProps extends Omit<ButtonProps, \"children\"> {\n /** What the trigger shows. The trigger is always a Button, so this is its\n * content — text, or an icon with `iconOnly` and an `aria-label`. */\n label: ReactNode;\n /** The panel's contents. Anything: a form, a filter set, a prompt. For a\n * list of actions reach for DropdownMenu; for a line of text, Tooltip. */\n children?: ReactNode;\n /** Controls the panel. Omit both this and `onOpenChange` to let the popover\n * manage itself. */\n open?: boolean;\n /** Called whenever the panel opens or closes, including by Escape or a\n * click elsewhere. */\n onOpenChange?: (open: boolean) => void;\n /** Open on first render when uncontrolled. Focus is left where it is, so a\n * popover shown on arrival never steals the page's focus. */\n defaultOpen?: boolean;\n /** Which side of the trigger the panel prefers. It flips to the other side\n * when there is no room. Default `bottom`. */\n side?: \"top\" | \"bottom\";\n /** Which edge of the trigger the panel lines up with. Use `end` for a\n * trigger near the right of the viewport. Default `start`. */\n align?: \"start\" | \"center\" | \"end\";\n /** Merged onto the panel. */\n panelClassName?: string;\n}\n\n/**\n * A button that opens a floating panel of anything — a small form, a set of\n * filters, a prompt — without leaving the page.\n *\n * It rides the browser's own popover layer, so the panel stacks above\n * everything without a z-index arms race and closes on Escape or a click\n * elsewhere by the platform's rules rather than an approximation of them. It\n * sits next to its trigger, flips above it when there is no room below, and\n * stays attached to it if the page scrolls or the layout around it shifts.\n *\n * Opening moves focus into the panel so a keyboard user lands on its first\n * control; closing with Escape hands focus back to the trigger. The panel is\n * labelled by the trigger, so it announces as what the button said it was.\n */\nexport function Popover({\n label,\n children,\n open: openProp,\n onOpenChange,\n defaultOpen = false,\n side = \"bottom\",\n align = \"start\",\n panelClassName,\n onClick,\n ...buttonProps\n}: PopoverProps) {\n const [internal, setInternal] = useState(defaultOpen);\n const controlled = openProp !== undefined;\n const open = controlled ? openProp : internal;\n\n const triggerId = useId();\n const panelId = useId();\n const triggerRef = useRef<HTMLButtonElement | null>(null);\n const panelRef = useRef<HTMLDivElement | null>(null);\n const [pos, setPos] = useState<{ top: number; left: number; placed: \"top\" | \"bottom\" } | null>(null);\n\n // Whether the next open came from the reader, as opposed to defaultOpen on\n // mount. Only a reader's open moves focus.\n const openedByReader = useRef(false);\n // Set by Escape inside the panel, so the close that follows returns focus.\n const closingByEscape = useRef(false);\n // What a pointer press on the trigger meant, decided at pointerdown — before\n // the platform has had a chance to light-dismiss. See the trigger below.\n const pressIntent = useRef<boolean | null>(null);\n // The latest open state, including one requested this tick but not yet\n // rendered. Both the trigger's click and the panel's toggle can report the\n // same close in one gesture; this is what stops onOpenChange hearing twice.\n const openNow = useRef(open);\n openNow.current = open;\n\n const setOpen = useCallback(\n (next: boolean) => {\n if (openNow.current === next) return;\n openNow.current = next;\n if (!controlled) setInternal(next);\n onOpenChange?.(next);\n },\n [controlled, onOpenChange],\n );\n\n const place = useCallback(() => {\n const trigger = triggerRef.current;\n const panel = panelRef.current;\n if (!trigger || !panel) return;\n const r = trigger.getBoundingClientRect();\n const w = panel.offsetWidth;\n const h = panel.offsetHeight;\n\n const below = r.bottom + OFFSET;\n const above = r.top - h - OFFSET;\n const fitsBelow = below + h <= window.innerHeight - EDGE_PADDING;\n const fitsAbove = above >= EDGE_PADDING;\n const top = side === \"bottom\"\n ? (fitsBelow || !fitsAbove ? below : above)\n : (fitsAbove || !fitsBelow ? above : below);\n // Where it actually landed after any flip, so the reveal can travel away\n // from the trigger rather than towards it. Written to the element as well\n // as to state: the reveal reads it before React has re-rendered.\n const placed = top === below ? \"bottom\" : \"top\";\n panel.dataset.side = placed;\n\n const wanted =\n align === \"start\" ? r.left : align === \"end\" ? r.right - w : r.left + r.width / 2 - w / 2;\n const left = Math.min(\n Math.max(wanted, EDGE_PADDING),\n Math.max(window.innerWidth - w - EDGE_PADDING, EDGE_PADDING),\n );\n setPos((prev) =>\n prev && prev.top === top && prev.left === left && prev.placed === placed\n ? prev\n : { top, left, placed },\n );\n }, [side, align]);\n\n // Show before measuring: while the panel is display:none its size reads 0\n // and every clamp above would be computed against nothing. Layout effect,\n // so the corrected position lands before the first frame is painted.\n useLayoutEffect(() => {\n const panel = panelRef.current;\n if (!panel) return;\n if (open) {\n // Placed before it is shown, so the reveal travels away from the trigger\n // on whichever side it lands.\n showMeasured(panel, place);\n place();\n if (openedByReader.current) {\n openedByReader.current = false;\n const first = panel.querySelector<HTMLElement>(FOCUSABLE);\n (first ?? panel).focus({ preventScroll: true });\n }\n } else if (panel.matches(\":popover-open\")) {\n panel.hidePopover();\n }\n }, [open, place]);\n\n // Follow the trigger for as long as the panel is open. Scroll and resize\n // listeners were not enough: anything that moves the trigger without\n // scrolling — an image loading above it, a font swapping in, a sibling\n // growing — left the panel where it opened, detached from its button and\n // sometimes sitting on top of it. So each frame compares where the trigger\n // is now with where it was, and re-places only on a change. One layout read\n // a frame, and only while open.\n useEffect(() => {\n if (!open) return;\n let frame = 0;\n let last = \"\";\n const track = () => {\n const trigger = triggerRef.current;\n const panel = panelRef.current;\n if (trigger && panel) {\n const r = trigger.getBoundingClientRect();\n const key = `${r.top}|${r.left}|${r.width}|${r.height}|${panel.offsetWidth}|${panel.offsetHeight}|${window.innerWidth}|${window.innerHeight}`;\n if (key !== last) {\n last = key;\n place();\n }\n }\n frame = requestAnimationFrame(track);\n };\n frame = requestAnimationFrame(track);\n return () => cancelAnimationFrame(frame);\n }, [open, place]);\n\n return (\n <>\n <Button\n {...buttonProps}\n ref={triggerRef}\n id={triggerId}\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n aria-controls={panelId}\n onPointerDown={(e) => {\n buttonProps.onPointerDown?.(e);\n // Decide here, not on click. Pressing the trigger while the panel is\n // open is an outside press to the platform, which closes the panel\n // during pointerdown — so by the time click runs, the panel already\n // reads as shut and a plain toggle would reopen it. The platform's\n // toggle event cannot settle it either: it fires after click. What\n // the reader meant is knowable only at the moment they pressed.\n pressIntent.current = !openNow.current;\n }}\n onKeyDown={(e) => {\n buttonProps.onKeyDown?.(e);\n // A press dragged off the button never clicks, which would leave its\n // intent behind to hijack the next Enter or Space. Keys decide fresh.\n if (e.key === \"Enter\" || e.key === \" \") pressIntent.current = null;\n }}\n onClick={(e) => {\n onClick?.(e);\n // Keyboard activation has no pointerdown, so it falls back to a\n // straight toggle, which is right: Enter and Space never light-dismiss.\n const next = pressIntent.current ?? !openNow.current;\n pressIntent.current = null;\n if (next) openedByReader.current = true;\n setOpen(next);\n }}\n >\n {label}\n </Button>\n\n <div\n ref={panelRef}\n id={panelId}\n popover=\"auto\"\n role=\"dialog\"\n aria-labelledby={triggerId}\n tabIndex={-1}\n className={cx(styles.panel, ctl.spacePanel, panelClassName)}\n data-animated={buttonProps.animated === false ? \"false\" : undefined}\n data-side={pos?.placed ?? side}\n style={pos ? { top: pos.top, left: pos.left } : undefined}\n onKeyDown={(e) => {\n if (e.key === \"Escape\") {\n closingByEscape.current = true;\n // Only this popover. An enclosing Dialog must not close with it.\n e.stopPropagation();\n }\n }}\n onToggle={(e: React.SyntheticEvent<HTMLDivElement>) => {\n if ((e.nativeEvent as ToggleEvent).newState !== \"closed\") return;\n if (closingByEscape.current) {\n closingByEscape.current = false;\n triggerRef.current?.focus();\n }\n // The platform closed it — a press elsewhere or Escape. setOpen\n // ignores a close this component has already recorded.\n setOpen(false);\n }}\n >\n {children}\n </div>\n </>\n );\n}\n"],"names":["SPACE","spacingStyle","m","mt","mb","p","pb","style","out","cx","parts","Text","forwardRef","as","size","weight","color","className","rest","ref","createElement","styles","Heading","align","Link","asChild","children","cls","merged","isValidElement","child","cloneElement","jsx","cap","s","Flex","gap","direction","justify","wrap","Box","Grid","columns","colCls","Badge","variant","Separator","Card","image","jsxs","base","Share2Icon","props","ChatBubbleIcon","PlusIcon","Pencil1Icon","HeartFilledIcon","ExitFullScreenIcon","EnterFullScreenIcon","CheckIcon","TrashIcon","QuestionMarkCircledIcon","PersonIcon","MinusIcon","MagnifyingGlassIcon","HeartIcon","ChevronUpIcon","ChevronDownIcon","ChevronRightIcon","ChevronLeftIcon","BookmarkIcon","XIcon","InfoCircledIcon","ExclamationTriangleIcon","CrossCircledIcon","ctl","ctlModule","pageCount","pageSize","totalItems","pageWindow","page","total","siblings","range","from","to","_","i","slots","current","left","right","gapLeft","gapRight","edge","Pagination","pagination","onPageClick","animated","ariaLabel","go","target","mulberry32","a","hashString","h","Button","iconOnly","ember","fullWidth","id","useId","starStyles","useMemo","rand","classes","Loader","label","showMeasured","element","place","SHOW_DELAY","HIDE_DELAY","SIDE_OFFSET","COLLISION_PADDING","TooltipTrigger","triggerRef","tooltipId","show","hide","e","_a","Tooltip","side","open","setOpen","useState","pos","setPos","useRef","contentRef","showTimer","hideTimer","clearTimers","immediate","useEffect","useLayoutEffect","content","trigger","r","w","centre","start","extent","viewport","fits","near","far","after","before","fitsBefore","fitsAfter","below","above","fitsAbove","fitsBelow","top","Fragment","IconToggle","options","value","onValueChange","orientation","vertical","opt","Ctx","createContext","useSelect","ctx","useContext","optionId","listboxId","collectItems","walk","nodes","Children","Item","SelectRoot","disabled","placeholder","highlighted","setHighlighted","rootRef","listRef","triggerWidth","setTriggerWidth","maxHeight","setMaxHeight","items","values","itemLabels","labelFor","useCallback","v","onDown","el","rect","available","openWith","highlight","move","delta","idx","next","l","_b","selected","Select","TextFieldRoot","inputProps","Slot","TextField","TextArea","Autocomplete","onSelect","icon","caseSensitive","preFiltered","loading","loadingMessage","emptyMessage","footer","active","setActive","wrapRef","listId","haystack","o","hasQuery","shown","needle","selectable","hasContent","showPanel","close","node","navigated","choose","option","onKeyDown","first","last","chosen","activeOption","Slider","min","max","step","pct","RadioGroupRoot","name","g","isDisabled","control","RadioGroup","Progress","ICONS","ROLES","Message","title","glyph","role","live","lockCount","useDialog","makeRoot","alert","onOpenChange","internal","setInternal","isControlled","actual","titleId","descId","hasDesc","setHasDesc","Root","chainOpen","fn","c","Trigger","d","Close","Content","maxWidth","swallowCancel","pointerDownOnBackdrop","Title","Description","Dialog","Cancel","Action","AlertDialog","useMenu","ItemClosedRefCtx","useItemClosedRef","consumeLightDismissFlag","markItemInitiatedClose","DropdownMenuRoot","buttonProps","menuId","menuRef","lightDismissedRef","itemClosedRef","onResize","itemInitiated","_c","_d","_e","_f","Label","activate","childClassName","childOnClick","childChildren","childRole","childTabIndex","restProps","originalRef","DropdownMenu","useTabs","TabsRoot","List","tabs","t","Tabs","OFFSET","EDGE_PADDING","FOCUSABLE","Popover","openProp","defaultOpen","panelClassName","onClick","controlled","triggerId","panelId","panelRef","openedByReader","closingByEscape","pressIntent","openNow","panel","placed","wanted","prev","frame","track","key"],"mappings":";;;AAeA,MAAMA,KAAmC;AAAA,EACvC,GAAK;AAAA,EACL,GAAK;AAAA,EACL,GAAK;AAAA,EACL,GAAK;AAAA,EACL,GAAK;AAAA,EACL,GAAK;AAAA,EACL,GAAK;AACP;AAEO,SAASC,EACd,EAAE,GAAAC,GAAG,IAAAC,GAAI,IAAAC,GAAI,GAAAC,GAAG,IAAAC,EAAA,GAChBC,GAC2B;AAC3B,QAAMC,IAAqB;AAAA,IACzB,GAAIN,MAAM,UAAa,EAAE,QAAQF,GAAME,CAAC,EAAA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