{"version":3,"file":"styloviz-core-a11y.mjs","names":[],"sources":["../../../../projects/core/a11y/reduced-motion.ts","../../../../projects/core/a11y/coarse-pointer.ts","../../../../projects/core/a11y/high-contrast.ts","../../../../projects/core/a11y/readable-ink.ts","../../../../projects/core/a11y/direction.ts","../../../../projects/core/a11y/live-announcer.ts","../../../../projects/core/a11y/unique-id.ts","../../../../projects/core/a11y/roving.ts","../../../../projects/core/a11y/reveal-focus.ts","../../../../projects/core/a11y/shortcut.ts","../../../../projects/core/a11y/collection-keys.ts","../../../../projects/core/a11y/contrast.ts","../../../../projects/core/a11y/data-summary-table.component.ts","../../../../projects/core/a11y/data-summary-table.component.html","../../../../projects/core/a11y/data-summary.ts","../../../../projects/core/a11y/chart-a11y.ts","../../../../projects/core/a11y/shortcut-registry.ts"],"sourcesContent":["/**\n * `prefers-reduced-motion` helpers.\n *\n * Premium components must honour the user's motion preference. Use\n * `prefersReducedMotion()` for one-shot checks (e.g. deciding whether to\n * animate) and `onReducedMotionChange()` to react to live OS-level changes.\n *\n * All helpers are SSR-safe — they no-op / return `false` without `window`.\n */\n\nconst QUERY = '(prefers-reduced-motion: reduce)';\n\n/** Returns `true` when the user has requested reduced motion. */\nexport function prefersReducedMotion(): boolean {\n  if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') {\n    return false;\n  }\n  return window.matchMedia(QUERY).matches;\n}\n\n/**\n * Subscribes to changes in the reduced-motion preference.\n * @returns an unsubscribe function. No-op (returns a no-op) without `window`.\n */\nexport function onReducedMotionChange(cb: (reduced: boolean) => void): () => void {\n  if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') {\n    return () => {\n      /* intentionally empty */\n    };\n  }\n  const mql = window.matchMedia(QUERY);\n  const handler = (e: MediaQueryListEvent): void => cb(e.matches);\n  mql.addEventListener('change', handler);\n  return () => mql.removeEventListener('change', handler);\n}\n","/**\n * \"Is the primary pointer a finger?\"\n *\n * ── The defect this exists for (`FI-03-I1`) ────────────────────────────────\n *\n * ★★★ A HOVER-TRIGGERED PANEL ON A TOUCHSCREEN IS NOT MERELY UNREACHABLE — IT\n *     IS WORSE THAN THAT. Mobile browsers fire a synthetic `mouseenter` on tap,\n *     so hover expansion half-works: the tap that was meant to *choose* a branch\n *     opens it instead, and a drag across the panel opens whatever the finger\n *     passed over. \"Unreachable\" would at least be obvious.\n *\n * ★★ THE HOST CANNOT DECIDE THIS AT TEMPLATE TIME. `expandTrigger=\"hover\"` is a\n *    reasonable thing to write for a desktop app, and the same build runs on a\n *    tablet. The component is the only party that knows what the pointer is —\n *    and on a hybrid device it can change mid-session, which is why this is a\n *    subscription and not a one-shot read.\n *\n * `(hover: none)` rather than `(pointer: coarse)`: a stylus is coarse and hovers\n * perfectly well, and a laptop with a touchscreen reports `coarse` for its\n * *secondary* pointer while the trackpad hovers fine. The question here is\n * literally whether hovering exists.\n *\n * SSR-safe: `false` without `window`, which is the desktop assumption and the\n * one that renders the same markup the client will.\n */\nconst QUERY = '(hover: none)';\n\nexport function svHoverUnavailable(): boolean {\n  if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') return false;\n  return window.matchMedia(QUERY).matches;\n}\n\n/**\n * Subscribe to changes. Returns an unsubscribe function; a no-op without\n * `window`.\n */\nexport function svOnHoverAvailabilityChange(cb: (unavailable: boolean) => void): () => void {\n  if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') {\n    return () => { /* intentionally empty */ };\n  }\n  const mql = window.matchMedia(QUERY);\n  const handler = (e: MediaQueryListEvent): void => cb(e.matches);\n  mql.addEventListener('change', handler);\n  return () => mql.removeEventListener('change', handler);\n}\n","/**\n * \"The user wants more contrast, or has taken the palette over.\"\n *\n * ★★★ TWO QUERIES, ONE ANSWER, AND THAT IS THE DESIGN. `(prefers-contrast:\n *     more)` is a request — macOS \"Increase contrast\", Windows' contrast\n *     slider — and `(forced-colors: active)` is a seizure: Windows High\n *     Contrast replaces the page's colours with the user's own. A component\n *     that honours one and not the other has a decorative glow left over in\n *     exactly the mode that cannot render it, so both resolve to the same\n *     fallback here rather than at every call site.\n *\n * ★★ WHAT IT IS FOR IS DROPPING DECORATION, NOT RE-COLOURING. A glow, a\n *    gradient and a translucent tint are all ways of saying something with\n *    colour alone; under either query they lose the contrast that made them\n *    legible (1.4.11 asks for 3:1 against what is adjacent, and a blurred edge\n *    has no one contrast to measure). The answer is to fall back to a solid\n *    treatment — not to pick different custom colours, which forced-colors\n *    will override anyway.\n *\n * SSR-safe: `false` without `window`, which is the assumption that renders the\n * markup the client will hydrate.\n */\n\nconst QUERIES = ['(prefers-contrast: more)', '(forced-colors: active)'] as const;\n\n/** Returns `true` when the user has asked for more contrast, or forced colors. */\nexport function svHighContrast(): boolean {\n  if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') return false;\n  return QUERIES.some(q => window.matchMedia(q).matches);\n}\n\n/**\n * Subscribe to changes in either preference.\n *\n * ★ Both lists are watched and the callback receives the OR, so a component\n *   holds one signal rather than two and cannot get the combination wrong.\n *\n * @returns an unsubscribe function; a no-op without `window`.\n */\nexport function svOnHighContrastChange(cb: (high: boolean) => void): () => void {\n  if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') {\n    return () => { /* intentionally empty */ };\n  }\n  const lists = QUERIES.map(q => window.matchMedia(q));\n  const handler = (): void => cb(lists.some(l => l.matches));\n  for (const l of lists) l.addEventListener('change', handler);\n  return () => { for (const l of lists) l.removeEventListener('change', handler); };\n}\n","/**\n * Black or white, whichever reads better on `fill`.\n *\n * For the case a static contrast checker cannot reach: a chip whose background\n * arrives at runtime, from data. `check-contrast-pairs.mjs` names this exact\n * situation in its `BG_UNKNOWABLE` list, because `[style.background]=\"lbl.color\"`\n * is an expression and no scanner can evaluate it. The answer is not to check\n * it harder but to derive an ink that cannot be wrong.\n *\n * The two candidates are pure black and pure white on purpose. The worst\n * possible fill sits at relative luminance 0.1791, where both land at 4.58:1 —\n * so this clears WCAG AA (4.5:1) for **any** colour a caller can pass. A softer\n * dark than `#000000` drops that floor below 4.5 and takes the guarantee with\n * it, which is the whole value of the function.\n *\n * Accepts `#rgb` and `#rrggbb`. Anything else — `rgb(…)`, a named colour, a\n * `var()` — cannot be measured without a live element, so it gets white; pass a\n * hex if the fill is light. Callers whose fallback fill is a token should point\n * it at a dark stop (700 or above) so that default is right.\n *\n * @example\n * ```html\n * <span [style.background]=\"label.color\" [style.color]=\"svReadableInk(label.color)\">\n * ```\n */\nexport function svReadableInk(fill: string | null | undefined): '#000000' | '#ffffff' {\n  const hex = expandHex(fill?.trim() ?? '');\n  if (!hex) return '#ffffff';\n\n  // sRGB relative luminance, WCAG 2.x §Relative luminance.\n  const channel = (i: number): number => {\n    const c = parseInt(hex.slice(i * 2, i * 2 + 2), 16) / 255;\n    return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;\n  };\n  const luminance = 0.2126 * channel(0) + 0.7152 * channel(1) + 0.0722 * channel(2);\n\n  return luminance > 0.1791 ? '#000000' : '#ffffff';\n}\n\n/** The six hex digits of `#rgb` or `#rrggbb`, or `null` if it is neither. */\nfunction expandHex(value: string): string | null {\n  if (/^#[0-9a-fA-F]{6}$/.test(value)) return value.slice(1);\n  if (/^#[0-9a-fA-F]{3}$/.test(value)) {\n    return value\n      .slice(1)\n      .split('')\n      .map((d) => d + d)\n      .join('');\n  }\n  return null;\n}\n","/**\n * Which way the text runs, for the code that has to care.\n *\n * ── The defect this exists for (`FI-24-I2`) ─────────────────────────────────\n *\n * ★★ THE BACKLOG ASKED A QUESTION — \"in an RTL layout, does the right arrow\n *    increase or decrease?\" — and the answer turned out to be the least\n *    interesting part. `sv-slider` is built on a native `<input type=\"range\">`,\n *    and the browser already flips both the thumb and the arrow keys in an RTL\n *    context. **The keyboard was never broken.** What was broken is everything\n *    the component draws and measures AROUND that input:\n *\n *      • the fill bar is `left-0` + `width: N%` — a PHYSICAL left, so it grows\n *        left-to-right while the thumb it is supposed to follow grows\n *        right-to-left. They point at each other.\n *      • the range fill binds `[style.left]` and `[style.right]`, same problem.\n *      • `(clientX - rect.left) / rect.width` reads a fraction from the\n *        physical left edge, so in RTL it reports `0` where the value is `max`.\n *        That fraction picks WHICH HANDLE a click grabs, so the wrong one moves.\n *\n * ★★★ TWO OF THE THREE ARE FIXED BY CSS AND NOT BY THIS FILE.\n *     `inset-inline-start` already means \"the edge text starts at\", and the\n *     browser resolves it. A component that computes its own left/right from a\n *     direction flag is reimplementing something CSS does correctly, and it\n *     will disagree with CSS the moment a parent sets `direction` in a way the\n *     flag does not see.\n *\n *     This helper exists ONLY for the third case — arithmetic on a\n *     `clientX`, which is a physical coordinate with no logical equivalent.\n */\n\n/**\n * `true` when `el` is laid out right-to-left.\n *\n * ★ `getComputedStyle().direction` FIRST, because that is the actual answer:\n *   `direction` inherits and can be set by a stylesheet with no `dir`\n *   attribute anywhere, which an attribute walk would miss entirely.\n *\n * ⚠️ AND THE `dir` ATTRIBUTE WALK AS A FALLBACK, because jsdom's\n *    `getComputedStyle` does not inherit `direction` — it reports `'ltr'` for\n *    an element inside `<div dir=\"rtl\">`. Without the fallback every test of\n *    this is a test of jsdom rather than of the component, and the behaviour\n *    would only ever be exercised in a browser nobody runs in CI.\n *\n * ⚠️ Returns `false` with no element, on the server, and on anything it cannot\n *    read. LTR is the safer wrong answer: it is what the component did before.\n */\nexport function svIsRtl(el: Element | null | undefined): boolean {\n  if (!el || typeof window === 'undefined') return false;\n\n  try {\n    const computed = window.getComputedStyle(el).direction;\n    if (computed === 'rtl') return true;\n  } catch {\n    // A detached node, or a runtime without layout. Fall through to the walk.\n  }\n\n  // `closest` rather than a manual parent loop: it crosses shadow boundaries no\n  // better, but it is the same traversal in one call and it handles the element\n  // itself carrying the attribute.\n  const marked = el.closest?.('[dir]');\n  const dir = marked?.getAttribute('dir')?.toLowerCase();\n  if (dir === 'rtl') return true;\n  if (dir === 'ltr') return false;\n\n  return (\n    document?.documentElement?.getAttribute('dir')?.toLowerCase() === 'rtl' ||\n    document?.dir?.toLowerCase() === 'rtl'\n  );\n}\n\n/**\n * A pointer's position along an element, as `0`…`1` from the LOGICAL start.\n *\n * ★★★ THIS IS THE ONE THING CSS CANNOT DO FOR US. `clientX` is physical and\n *     `getBoundingClientRect().left` is physical; the fraction a slider needs\n *     is logical. In LTR they coincide, which is why `(clientX - rect.left) /\n *     rect.width` looks like it has no direction in it — it has, and the\n *     direction it has is LTR.\n *\n * ⚠️ RETURNS `0` FOR A ZERO-WIDTH ELEMENT rather than `NaN`. A slider measured\n *    before layout, or while `display: none`, would otherwise propagate `NaN`\n *    into a value and out through the form.\n */\nexport function svPointerFraction(clientX: number, el: Element): number {\n  const rect = el.getBoundingClientRect();\n  if (!rect.width) return 0;\n  const fromLeft = (clientX - rect.left) / rect.width;\n  const clamped = Math.max(0, Math.min(1, fromLeft));\n  return svIsRtl(el) ? 1 - clamped : clamped;\n}\n\n/**\n * A horizontal arrow key in reading order: under RTL, ArrowLeft and ArrowRight\n * swap, so code that means \"toward the next column / item\" can switch on\n * `ArrowRight` and still move toward what the eye sees as next. Every other key\n * comes back unchanged.\n *\n * ★ For arrows that walk a sequence laid out in the inline direction (grid\n *   cells, a column order). A native `<input type=\"range\">` flips its own keys\n *   — do not pass those through here.\n */\nexport function svLogicalArrowKey(key: string, rtl: boolean): string {\n  if (!rtl) return key;\n  return key === 'ArrowLeft' ? 'ArrowRight' : key === 'ArrowRight' ? 'ArrowLeft' : key;\n}\n","import { Injectable, inject, DestroyRef, PLATFORM_ID } from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\n\n/**\n * How loudly a message is announced.\n *\n * - `polite` — waits for the screen reader to finish what it is saying.\n * - `assertive` — interrupts mid-sentence.\n */\nexport type SvAnnouncePriority = 'polite' | 'assertive';\n\nexport interface SvAnnounceOptions {\n  /** @default 'polite' */\n  readonly priority?: SvAnnouncePriority;\n  /**\n   * Groups messages that supersede one another.\n   *\n   * ★★ THIS IS WHAT \"PROGRESS SUPERSEDES ITS OWN LAST VALUE\" MEANS in code. A\n   *    progress bar moving 41% → 42% → 43% inside one throttle window should\n   *    announce \"43%\" once, not three values the user has already passed.\n   *    Messages sharing a key replace each other while pending; those without\n   *    one are independent and all get through.\n   */\n  readonly key?: string;\n  /**\n   * Minimum gap between two announcements sharing this key. @default 0\n   *\n   * With a key, a message arriving inside the window is held and replaces\n   * whatever was already waiting, so the user hears the LATEST value once the\n   * window closes — never a backlog of stale ones.\n   */\n  readonly throttleMs?: number;\n  /**\n   * Say it even if it is identical to the last message on this region.\n   * @default false\n   *\n   * ★ The default suppression is `OF-01-I4`: a banner re-rendered on every\n   *   change re-announced the same sentence each time. But a REPEAT is\n   *   sometimes the information — \"no results\" after a second failed search\n   *   has to be heard again — so it is one flag away.\n   */\n  readonly force?: boolean;\n}\n\n/** How long two identical messages count as the same announcement. */\nconst DEDUPE_WINDOW_MS = 1_000;\n\n/**\n * One message that actually reached a region — the record `history()` keeps.\n */\nexport interface SvAnnouncement {\n  readonly message: string;\n  readonly priority: SvAnnouncePriority;\n  /** `Date.now()` at the moment it was written. */\n  readonly at: number;\n}\n\n/** How many written messages `history()` remembers. Oldest drop first. */\nconst HISTORY_LIMIT = 50;\n\n/**\n * How long the first write into a region created in the same task waits. An\n * AT only watches a region it has already seen in the accessibility tree; text\n * that lands in the task that inserted the region is the \"arrives with its\n * content\" case this service exists to avoid.\n */\nconst FIRST_WRITE_DELAY_MS = 100;\n\n/**\n * ★★★ SEMANTIC VARIANT → POLITENESS, IN ONE PLACE, because the kit had two\n *     answers. Toast announced `warning` ASSERTIVELY and Alert Banner\n *     announced it POLITELY — the same severity, the same word, interrupting\n *     the user in one component and not the other. Measured, not assumed:\n *     `toast-host.component.ts` and `alert-banner.component.ts` each carried\n *     their own two-line mapping.\n *\n * ★★ ASSERTIVE IS FOR ERRORS, AND WARNING IS NOT ONE. `assertive` cuts the\n *    screen reader off mid-word, so it is reserved for the cases where\n *    carrying on would cost the user something: a failure, a timeout, a\n *    destructive result. A warning the user is not blocked by does not earn\n *    an interruption. Where the two families disagreed, the quieter answer is\n *    also the correct one.\n */\nexport function svAnnouncePriorityFor(variant: string | null | undefined): SvAnnouncePriority {\n  switch (variant) {\n    case 'error':\n    case 'danger':\n    case 'critical':\n      return 'assertive';\n    default:\n      return 'polite';\n  }\n}\n\ninterface Pending {\n  /** Mutable: a later message for the same key overwrites it in place. */\n  message: string;\n  priority: SvAnnouncePriority;\n  /** Owned by the FIRST held message for this key, and never replaced. */\n  readonly timer: ReturnType<typeof setTimeout>;\n}\n\n/**\n * The one place that speaks to a screen reader.\n *\n * ★★★ THE REGION HAS TO EXIST BEFORE THE TEXT DOES, and that is the defect\n *     this service is built around. Toast and Alert Banner both INSERTED a\n *     node that already carried `aria-live` and its own message — each toast\n *     *was* its own live region, created with the text already inside it.\n *     Assistive technology watches an existing region for changes; a region\n *     that arrives with its content is at the mercy of when the AT happened\n *     to scan, which is why it is the least reliable announcement pattern\n *     there is. Two regions created once, mutated forever, is the pattern\n *     that works. `X-9` / `OF-19-I8`.\n *\n * ★★ AND IT HAS TO OUTLIVE THE COMPONENT. A toast that auto-dismisses after\n *    four seconds takes its own region with it, mid-sentence. These regions\n *    belong to the service, which belongs to the application.\n *\n * ★ Six capabilities, because `X-9` names six: priority (two regions),\n *   deduplication (`DEDUPE_WINDOW_MS`), throttling and replacement (`key` +\n *   `throttleMs`), cancellation (`cancel`, and automatic on the caller's\n *   destruction via `scoped()`), and ownership — which is a RULE, not code:\n *   exactly one owner speaks per event. See `T0-8`: two voices for one wait\n *   is worse than one, because the user hears the same thing twice and\n *   neither says when it ended.\n */\n@Injectable({ providedIn: 'root' })\nexport class SvLiveAnnouncer {\n  private _regions: Record<SvAnnouncePriority, HTMLElement> | null = null;\n  /** Which of a region's two slots holds the current message. */\n  private readonly _slot: Record<SvAnnouncePriority, 0 | 1> = { polite: 0, assertive: 0 };\n  private readonly _last: Record<SvAnnouncePriority, { message: string; at: number }> = {\n    polite: { message: '', at: 0 },\n    assertive: { message: '', at: 0 },\n  };\n  private readonly _pending = new Map<string, Pending>();\n  private readonly _lastKeyed = new Map<string, number>();\n  private readonly _history: SvAnnouncement[] = [];\n  /** True while regions created inside `_write` are too new to be watched. */\n  private _fresh = false;\n  private readonly _browser = isPlatformBrowser(inject(PLATFORM_ID));\n\n  constructor() {\n    // ★★ THE REGIONS EXIST BEFORE THE FIRST MESSAGE. Created lazily on the\n    //    first announce, the page's first message was written in the same task\n    //    that inserted its region, and no screen reader spoke it — the e2e\n    //    screen-reader pass (`feedback-announcements.spec.ts`) caught the\n    //    first toast of a burst going unheard. The service is injected when a\n    //    host component is constructed, long before anything is said. Never on\n    //    the server: regions in the prerendered HTML would be a second pair.\n    if (this._browser) this._ensureRegions();\n  }\n\n  /**\n   * Say something.\n   *\n   * Returns `true` when the message reached a region now, `false` when it was\n   * suppressed as a duplicate or held for a throttle window. Tests assert on\n   * this; callers can ignore it.\n   */\n  announce(message: string, options: SvAnnounceOptions = {}): boolean {\n    const text = message.trim();\n    if (!text) return false;\n\n    const priority = options.priority ?? 'polite';\n    const key = options.key;\n    const throttleMs = options.throttleMs ?? 0;\n\n    if (key && throttleMs > 0) {\n      const now = Date.now();\n      const last = this._lastKeyed.get(key) ?? 0;\n      const wait = last + throttleMs - now;\n      if (wait > 0) {\n        // ★★ REPLACE, DO NOT QUEUE — and one timer per key, not one per\n        //    message. The first held message owns the timer, because the\n        //    window started when the message before it was spoken; each later\n        //    one only overwrites the TEXT that timer will read. Writing a new\n        //    timer each time and cancelling the old one behaves identically\n        //    and I had it that way first — the mutation test could not tell\n        //    the two apart, which is how I noticed that the cancel was doing\n        //    nothing the map overwrite was not already doing. One timer is\n        //    the version with no stray timers to reason about.\n        const existing = this._pending.get(key);\n        if (existing) {\n          existing.message = text;\n          existing.priority = priority;\n          return false;\n        }\n        this._pending.set(key, {\n          message: text,\n          priority,\n          timer: setTimeout(() => {\n            const held = this._pending.get(key);\n            this._pending.delete(key);\n            if (held) this._write(held.message, held.priority, true);\n            this._lastKeyed.set(key, Date.now());\n          }, wait),\n        });\n        return false;\n      }\n      this._lastKeyed.set(key, now);\n    }\n\n    return this._write(text, priority, options.force ?? false);\n  }\n\n  /** Drop a keyed message that has not been spoken yet. Idempotent. */\n  cancel(key: string): void {\n    const pending = this._pending.get(key);\n    if (!pending) return;\n    clearTimeout(pending.timer);\n    this._pending.delete(key);\n  }\n\n  /**\n   * An announcer bound to the caller's lifetime.\n   *\n   * ★★ CANCELLATION IS THE CAPABILITY PEOPLE FORGET, and a throttled message\n   *    is exactly where it bites: a progress bar destroyed 200 ms into its\n   *    500 ms window would otherwise announce a percentage for a component\n   *    that no longer exists, about an operation the user has navigated away\n   *    from. Everything this handle holds back is dropped on destroy.\n   *\n   * Must be called in an injection context (a field initializer is ideal).\n   */\n  scoped(): SvScopedAnnouncer {\n    const keys = new Set<string>();\n    inject(DestroyRef).onDestroy(() => {\n      for (const key of keys) this.cancel(key);\n      keys.clear();\n    });\n    return {\n      announce: (message, options = {}) => {\n        if (options.key) keys.add(options.key);\n        return this.announce(message, options);\n      },\n      cancel: (key) => { keys.delete(key); this.cancel(key); },\n    };\n  }\n\n  /** Clear both regions and forget every pending message. Tests and teardown. */\n  reset(): void {\n    for (const [, pending] of this._pending) clearTimeout(pending.timer);\n    this._pending.clear();\n    this._lastKeyed.clear();\n    this._history.length = 0;\n    this._last.polite = { message: '', at: 0 };\n    this._last.assertive = { message: '', at: 0 };\n    if (this._regions) {\n      for (const region of Object.values(this._regions)) region.remove();\n      this._regions = null;\n    }\n    // A fresh, empty pair at once — the next message must not be the one that\n    // creates its region (see the constructor).\n    if (this._browser) this._ensureRegions();\n  }\n\n  /**\n   * Every message that actually reached a region, oldest first (`N-2`'s test\n   * hook).\n   *\n   * ★★★ \"WHAT DID THE SCREEN READER HEAR\" WAS UNASSERTABLE. `regionFor()`\n   *     shows only the region's CURRENT text, so a burst — three toasts, a\n   *     progress update and an error in one tick — could only ever be checked\n   *     for its last word. Dedupe, throttling and replacement are all claims\n   *     about what was NOT spoken, and a claim about absence needs the whole\n   *     record. This is that record: a dropped duplicate, a throttled value\n   *     that was superseded, and a cancelled held message never appear in it.\n   *\n   * Bounded (the last 50) so a long-lived app does not grow it forever.\n   */\n  history(): readonly SvAnnouncement[] {\n    return this._history.slice();\n  }\n\n  /** Forget the record `history()` keeps, leaving the regions in place. */\n  clearHistory(): void {\n    this._history.length = 0;\n  }\n\n  /** The live region for a priority, for tests. `null` only on the server. */\n  regionFor(priority: SvAnnouncePriority): HTMLElement | null {\n    return this._regions?.[priority] ?? null;\n  }\n\n  private _write(text: string, priority: SvAnnouncePriority, force: boolean): boolean {\n    if (!this._regions) {\n      // No body when the service was constructed (a script in <head>): the\n      // regions are born now, so this first write waits until they are seen.\n      if (!this._ensureRegions()) return false;\n      this._fresh = true;\n      setTimeout(() => (this._fresh = false), FIRST_WRITE_DELAY_MS);\n    }\n    const regions = this._regions!;\n\n    const last = this._last[priority];\n    const now = Date.now();\n    if (!force && last.message === text && now - last.at < DEDUPE_WINDOW_MS) return false;\n\n    const region = regions[priority];\n    // ★★ ALTERNATING SLOTS, and the reason is not tidiness. Writing the SAME\n    //    string over a region's text is not a DOM change, so an AT has nothing\n    //    to react to and a deliberate repeat is silently swallowed. Moving the\n    //    text between two child nodes is always a mutation, and `aria-atomic`\n    //    makes the region re-read as a whole either way.\n    //\n    // ⚠️ That the AT then speaks is the one thing no test here can prove —\n    //    jsdom has no accessibility tree. The tests assert the mechanism (the\n    //    text is in the region, the mutation happened, the right region got\n    //    it); the behaviour above is why the mechanism is shaped like this.\n    const next = this._slot[priority] === 0 ? 1 : 0;\n    const previous = this._slot[priority];\n    const paint = () => {\n      region.children[next].textContent = text;\n      region.children[previous].textContent = '';\n    };\n    if (this._fresh) setTimeout(paint, FIRST_WRITE_DELAY_MS);\n    else paint();\n    this._slot[priority] = next;\n\n    this._last[priority] = { message: text, at: now };\n    this._history.push({ message: text, priority, at: now });\n    if (this._history.length > HISTORY_LIMIT) this._history.shift();\n    return true;\n  }\n\n  private _ensureRegions(): Record<SvAnnouncePriority, HTMLElement> | null {\n    if (this._regions) return this._regions;\n    if (typeof document === 'undefined' || !document.body) return null;   // SSR\n\n    const make = (priority: SvAnnouncePriority): HTMLElement => {\n      const el = document.createElement('div');\n      el.setAttribute('aria-live', priority);\n      el.setAttribute('aria-atomic', 'true');\n      el.setAttribute('data-sv-live-region', priority);\n      // ★ Not `display: none` and not `visibility: hidden` — both remove the\n      //   element from the accessibility tree, which would make the region\n      //   silent. This is the standard visually-hidden clip.\n      el.style.cssText =\n        'position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;' +\n        'clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0;'; // sv-i18n-ignore: inline CSS\n      el.appendChild(document.createElement('span'));\n      el.appendChild(document.createElement('span'));\n      document.body.appendChild(el);\n      return el;\n    };\n\n    this._regions = { polite: make('polite'), assertive: make('assertive') };\n    return this._regions;\n  }\n}\n\n/** An announcer that forgets its pending messages when its owner is destroyed. */\nexport interface SvScopedAnnouncer {\n  announce(message: string, options?: SvAnnounceOptions): boolean;\n  cancel(key: string): void;\n}\n","import { APP_ID, Injectable, inject } from '@angular/core';\n\n/**\n * ============================================================================\n *  Per-application element ids — `X-10`'s SSR half, `T0-2`\n * ============================================================================\n *\n * ── The defect, reproduced rather than assumed ──────────────────────────────\n * Seven navigation packages minted their DOM ids from a **module-level\n * counter** — `let _svTabsUid = 0` and `++_svTabsUid` in a field. Within one\n * instance the two halves of each `aria-controls` / `id` pair always agree, so\n * this was never a live accessibility bug, and `T0-2` was careful to say the SSR\n * exposure was *unproven either way*.\n *\n * It is proven now, and `unique-id.spec.ts` holds the reproduction:\n *\n * ```\n * same module, two renders: sv-tabs-1-tab-x   sv-tabs-2-tab-x\n * fresh module:             sv-tabs-1-tab-x\n * ```\n *\n * A long-lived server process shares that counter across requests, so the second\n * page it renders emits `sv-tabs-2-…` while the browser — which just loaded the\n * module for the first time — emits `sv-tabs-1-…`. Server HTML and first client\n * render disagree, which is a hydration mismatch: Angular discards the\n * prerendered DOM and re-renders, and any `aria-controls` an assistive\n * technology read in between pointed at an element that no longer exists.\n *\n * ── The fix, and why it is a counter per INJECTOR ───────────────────────────\n * ★ The instinct is a random id, and it is wrong: random is different on the\n * server and the client **by construction**, which is the very mismatch being\n * fixed. The id has to be *deterministic per render pass* and *independent\n * between passes* — which is exactly what a counter owned by the root injector\n * gives, because Angular SSR bootstraps a fresh application per request. Both\n * sides start at 1 and agree, and two components in one app still differ.\n */\n\n/** The counter itself. Root-provided, so its lifetime is one application. */\n@Injectable({ providedIn: 'root' })\nexport class SvIdSequence {\n  private n = 0;\n\n  /** The next number in this application's sequence. */\n  next(): number {\n    return ++this.n;\n  }\n}\n\n/**\n * A DOM id prefix unique within this application and stable across hydration.\n *\n * Call it in a field initializer, inside an injection context:\n *\n * ```ts\n * private readonly uid = svUniqueId('sv-tabs');\n * tabDomId = (id: string) => `${this.uid}-tab-${id}`;\n * ```\n *\n * ★★ **`APP_ID` is always folded in, and that is not belt-and-braces — it repairs\n * a regression this very change would otherwise introduce.** The module counter\n * had one virtue: two Angular applications on one page *shared* it, so their ids\n * could not collide. A counter per injector gives each application its own, both\n * restart at 1, and suddenly two `sv-tabs-1-tab-x` elements exist and\n * `aria-controls` resolves into the wrong app — the same defect this repo has\n * already fixed twice for two tab strips and two speed dials.\n *\n * `APP_ID` is the right discriminator because Angular *already* requires distinct\n * values there for hydration and styles when two apps share a page, so nothing\n * new has to be configured. It costs `-ng-` in the common single-app case, which\n * is a few bytes in an attribute nobody reads by hand.\n *\n * ⚠️ Do not \"tidy\" this by skipping Angular's default: the first draft did, and\n * the default is `'ng'` when bootstrapping and `'a'` under `TestBed`, so the\n * special case was both magic and wrong.\n */\nexport function svUniqueId(prefix: string): string {\n  const appId = inject(APP_ID);\n  const n = inject(SvIdSequence).next();\n  return `${prefix}-${appId}-${n}`;\n}\n","/**\n * Where the arrow keys should move inside a composite widget.\n *\n * ── Why this is a function and not a directive ───────────────────────────────\n *\n * It answers one question — \"given this key and this position, which item is\n * next?\" — and answers it with arithmetic. It does not touch the DOM, does not\n * know how a caller finds its elements, and above all does not decide whether\n * moving focus should also SELECT the thing focused.\n *\n * That last part is the reason the split matters. In a `radiogroup` selection\n * follows focus: arrowing to an option chooses it, and that is the APG pattern.\n * In a multi-select set of filter chips it must not — arrowing past a chip that\n * silently turns itself on is a data-loss bug wearing a keyboard shortcut. Both\n * want identical movement and opposite consequences, so the movement is what is\n * shared and the consequence stays with the caller.\n *\n * ── The duplication it replaces ──────────────────────────────────────────────\n *\n * `sv-segmented-control` and `sv-radio-group` had this switch written out\n * twice, character for character apart from the attribute each uses to find its\n * buttons — same modulo wrap, same Home/End, same enabled-only filtering. A\n * chip group would have been the third copy, and the third copy is where the\n * kit usually discovers the first two had quietly drifted.\n *\n * @example\n * ```ts\n * const next = svRovingTarget(event.key, enabledOptions.length, currentIndex);\n * if (next === null) return;          // not a navigation key — let it through\n * event.preventDefault();\n * this.focusOptionAt(next);           // and select, or not, as the role requires\n * ```\n */\nexport function svRovingTarget(\n  key: string,\n  count: number,\n  current: number,\n): number | null {\n  if (count <= 0) return null;\n\n  // A `current` that is not in the list — nothing focused yet, or an item that\n  // has just been disabled out from under the cursor. Both arrow directions\n  // should still land somewhere sensible rather than computing from -1.\n  const from = current >= 0 && current < count ? current : 0;\n\n  switch (key) {\n    // Both axes, deliberately. A composite widget that is horizontal today is\n    // vertical at 400px, and a user pressing Down on a wrapped row is not\n    // making a mistake the widget should punish them for.\n    case 'ArrowRight':\n    case 'ArrowDown':\n      return (from + 1) % count;\n    case 'ArrowLeft':\n    case 'ArrowUp':\n      return (from - 1 + count) % count;\n    case 'Home':\n      return 0;\n    case 'End':\n      return count - 1;\n    default:\n      // ★ `null`, not `current`. \"No opinion\" and \"stay where you are\" are\n      //   different answers: the first lets Tab, Escape and typeahead reach the\n      //   host untouched, and the second would have the caller call\n      //   `preventDefault()` on every key it does not handle.\n      return null;\n  }\n}\n","import { Directive, ElementRef, inject } from '@angular/core';\n\n/** Which edge of its scroller a sticky band holds. `start`/`end` follow the writing direction. */\nexport type SvStickySide = 'top' | 'bottom' | 'start' | 'end';\n\n/** A box in viewport coordinates — the parts of a `DOMRect` this needs. */\nexport interface SvBox {\n  readonly top: number;\n  readonly right: number;\n  readonly bottom: number;\n  readonly left: number;\n}\n\n/** One sticky band over the scroller, with the edge it holds. */\nexport interface SvStickyBand {\n  readonly side: SvStickySide;\n  readonly box: SvBox;\n}\n\nconst SIDES: ReadonlySet<string> = new Set(['top', 'bottom', 'start', 'end']);\n\n/**\n * How far to scroll so `target` clears every band that covers it (WCAG 2.2\n * SC 2.4.11, Focus Not Obscured).\n *\n * A band only counts when it actually overlaps the target on the other axis —\n * a pinned first column does not hide a cell three columns over. A negative\n * `dy` scrolls up (the target is under a top band), a positive one down; `dx`\n * likewise in physical pixels, so `start`/`end` are resolved with `rtl`.\n */\nexport function svUnobscuredDelta(target: SvBox, bands: readonly SvStickyBand[], rtl = false): { dx: number; dy: number } {\n  let dx = 0;\n  let dy = 0;\n  for (const { side, box } of bands) {\n    const crossesX = box.left < target.right && box.right > target.left;\n    const crossesY = box.top < target.bottom && box.bottom > target.top;\n    const physical = side === 'start' ? (rtl ? 'right' : 'left') : side === 'end' ? (rtl ? 'left' : 'right') : side;\n    if (physical === 'top' && crossesX && target.top < box.bottom) dy = Math.min(dy, target.top - box.bottom);\n    else if (physical === 'bottom' && crossesX && target.bottom > box.top) dy = Math.max(dy, target.bottom - box.top);\n    else if (physical === 'left' && crossesY && target.left < box.right) dx = Math.min(dx, target.left - box.right);\n    else if (physical === 'right' && crossesY && target.right > box.left) dx = Math.max(dx, target.right - box.left);\n  }\n  return { dx, dy };\n}\n\n/**\n * Keeps keyboard focus out from under the sticky bands of a scroll container\n * (WCAG 2.2 SC 2.4.11).\n *\n * ★★ A browser scrolls a focused element only as far as the scroller's edge —\n *    and a sticky header, footer or pinned column sits exactly there, so the\n *    row or cell that just took focus is drawn underneath it. `scroll-padding`\n *    fixes that only when the band's size is known in CSS; a table header's\n *    height depends on its content and a pinned column's width on its data.\n *    This measures the bands instead.\n *\n * Put it on the scroller and mark each band with `data-sv-sticky=\"top|bottom|\n * start|end\"`. After every focus change inside, on the next frame (the\n * browser's own scroll-into-view runs after the focus events), it scrolls by\n * exactly the overlap. A band that contains the focused element is skipped —\n * focus inside the header is not hidden by the header. Nested scrollers each\n * handle only their own bands.\n *\n * ```html\n * <div class=\"overflow-auto\" svRevealFocus>\n *   <table><thead class=\"sticky top-0\" data-sv-sticky=\"top\">…</thead>…</table>\n * </div>\n * ```\n */\n@Directive({\n  selector: '[svRevealFocus]',\n  standalone: true,\n  host: { '(focusin)': 'onFocusIn($event)' },\n})\nexport class SvRevealFocusDirective {\n  private readonly host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n\n  protected onFocusIn(event: FocusEvent): void {\n    const target = event.target;\n    if (!(target instanceof HTMLElement) || typeof requestAnimationFrame === 'undefined') return;\n    requestAnimationFrame(() => this.reveal(target));\n  }\n\n  /** Scroll `target` clear of this scroller's bands. @internal — public for tests. */\n  reveal(target: HTMLElement): void {\n    if (!target.isConnected || !this.host.contains(target)) return;\n    const bands: SvStickyBand[] = [];\n    for (const el of this.host.querySelectorAll<HTMLElement>('[data-sv-sticky]')) {\n      const side = el.dataset['svSticky'] ?? '';\n      if (!SIDES.has(side) || el.contains(target) || el.closest('[svRevealFocus]') !== this.host) continue;\n      bands.push({ side: side as SvStickySide, box: el.getBoundingClientRect() });\n    }\n    if (!bands.length) return;\n    const rtl = getComputedStyle(this.host).direction === 'rtl';\n    const { dx, dy } = svUnobscuredDelta(target.getBoundingClientRect(), bands, rtl);\n    if (dx || dy) this.host.scrollBy({ left: dx, top: dy });\n  }\n}\n","/**\n * shortcut.ts — parsing, matching and rendering a keyboard shortcut (`X-15`).\n *\n * ★★★ THREE FAMILIES DISPLAYED SHORTCUTS AND ONE BOUND THEM, so the kit had a\n *     display vocabulary and a matching rule that could not disagree visibly\n *     and disagreed anyway: Command Palette bound `mod+k` with a hand-written\n *     matcher, Menubar and Dropdown Menu rendered `['⌘','K']` strings the host\n *     typed out by hand, and nothing checked that the thing shown was the thing\n *     bound. One parser, one matcher, one renderer.\n *\n * Pure functions, no Angular and no DOM beyond the event object, so the whole\n * matching table can be tested without a browser.\n */\n\n/** A modifier as written in a binding string. */\nexport type SvShortcutModifier = 'mod' | 'ctrl' | 'meta' | 'alt' | 'shift';\n\n/** A parsed binding. */\nexport interface SvShortcut {\n  /** Lower-cased key, e.g. `'k'`, `'enter'`, `'/'`, `'arrowdown'`. */\n  readonly key: string;\n  readonly mod: boolean;\n  readonly ctrl: boolean;\n  readonly meta: boolean;\n  readonly alt: boolean;\n  readonly shift: boolean;\n}\n\nconst MODIFIERS: readonly SvShortcutModifier[] = ['mod', 'ctrl', 'meta', 'alt', 'shift'];\n\n/**\n * Parse `'mod+shift+p'`, `'ctrl+alt+delete'`, `'?'`.\n *\n * ★★ `mod` IS THE ONLY MODIFIER WORTH WRITING for an app shortcut: ⌘ on macOS\n *    and Ctrl everywhere else. Spelling it `ctrl` ships a Windows binding to\n *    Mac users, where Ctrl+K is a system text shortcut; spelling it `meta`\n *    ships a Mac binding to Windows, where the Meta key opens the Start menu.\n *    `ctrl` and `meta` are still available for the rare binding that genuinely\n *    means one physical key on both platforms.\n *\n * Returns `null` for anything unparseable, rather than a shortcut that will\n * never fire: a binding nobody can press is a bug the registry should report,\n * not silently hold.\n */\nexport function svParseShortcut(binding: string): SvShortcut | null {\n  const raw = binding.trim().toLowerCase();\n  if (!raw) return null;\n  // A space separates the steps of a SEQUENCE (`'g d'`) — that is not one\n  // shortcut. See `svParseShortcutSequence`.\n  if (/\\s/.test(raw)) return null;\n\n  // ★ Split on '+' but keep a trailing '+' as the KEY: `'mod++'` is a real\n  //   binding (zoom in), and a naive split loses it as an empty segment.\n  const parts: string[] = [];\n  let buffer = '';\n  for (const ch of raw) {\n    if (ch === '+' && buffer !== '') {\n      parts.push(buffer);\n      buffer = '';\n    } else {\n      buffer += ch;\n    }\n  }\n  if (buffer !== '') parts.push(buffer);\n\n  const flags = { mod: false, ctrl: false, meta: false, alt: false, shift: false };\n  let key = '';\n  for (const part of parts) {\n    const asModifier = MODIFIERS.find((m) => m === part || ALIASES[part] === m);\n    if (asModifier) {\n      // ★ A modifier written twice is a typo, not an intent: `'mod+mod+k'`\n      //   would otherwise parse the second `mod` as the key and produce a\n      //   binding that can never fire.\n      if (flags[asModifier]) return null;\n      flags[asModifier] = true;\n      continue;\n    }\n    if (key !== '') return null; // two keys is not a shortcut\n    key = part;\n  }\n  if (key === '') return null;\n  return { key, ...flags };\n}\n\n/**\n * Parse a key SEQUENCE — `'g d'`, `'g then i'` is not accepted, steps are\n * separated by spaces only. A single binding (`'mod+k'`) is a sequence of one.\n *\n * ★★ CHORDS ARE HOW A KEYBOARD-FIRST APP AVOIDS MODIFIER SOUP. `g d` for \"go to\n *    dashboard\", `g i` for \"go to inbox\" (Gmail, Linear, GitHub) gives every\n *    destination a two-letter mnemonic without spending a single ⌘ binding the\n *    browser or the OS might already own.\n *\n * Returns `null` when any step does not parse — a sequence with a step nobody\n * can press is a sequence nobody can finish.\n */\nexport function svParseShortcutSequence(binding: string): readonly SvShortcut[] | null {\n  const steps = binding.trim().split(/\\s+/).filter((s) => s.length > 0);\n  if (steps.length === 0) return null;\n  const parsed = steps.map((s) => svParseShortcut(s));\n  return parsed.every((p): p is SvShortcut => p !== null) ? parsed : null;\n}\n\n/** Accepted spellings for the modifiers. */\nconst ALIASES: Record<string, SvShortcutModifier> = {\n  cmd: 'meta',\n  command: 'meta',\n  control: 'ctrl',\n  option: 'alt',\n  opt: 'alt',\n  super: 'meta',\n  win: 'meta',\n};\n\n/** Does this keyboard event press this shortcut? */\nexport function svMatchesShortcut(\n  event: Pick<KeyboardEvent, 'key' | 'ctrlKey' | 'metaKey' | 'altKey' | 'shiftKey'>,\n  shortcut: SvShortcut,\n  isMac: boolean,\n): boolean {\n  if (event.key.toLowerCase() !== shortcut.key) return false;\n\n  const wantCtrl  = shortcut.ctrl || (shortcut.mod && !isMac);\n  const wantMeta  = shortcut.meta || (shortcut.mod && isMac);\n\n  if (event.ctrlKey  !== wantCtrl)  return false;\n  if (event.metaKey  !== wantMeta)  return false;\n  if (event.altKey   !== shortcut.alt) return false;\n  if (event.shiftKey !== shortcut.shift) return false;\n\n  // ★★★ ALTGR IS REPORTED AS CTRL+ALT, and on Windows and Linux it is the key\n  //     German, Polish, Turkish and Nordic layouts use for @ [ ] { } \\ € and\n  //     a great many letters. A `mod`-based binding must never fire for it:\n  //     the palette used to open while `preventDefault()` swallowed the\n  //     character the user was typing.\n  //\n  // ★★ MOST OF THAT PROTECTION IS THE EXACT MODIFIER COMPARISON ABOVE, not\n  //    this line: `mod+k` asks for altKey false, and AltGr sets it, so it\n  //    already does not match. What this line adds is the ONE case exact\n  //    matching cannot see — `mod+alt+X`, which on Windows IS AltGr+X. Such a\n  //    binding can only ever fire by intercepting a character key, so on\n  //    those platforms it does not fire at all.\n  //\n  // ★ `ctrl+alt+X` spelled out explicitly is exempt, and that is the escape\n  //   hatch: the host named both physical modifiers rather than asking for\n  //   \"the platform key\", so it means them.\n  if (!isMac && shortcut.mod && shortcut.alt) return false;\n\n  return true;\n}\n\n/** Elements whose keystrokes belong to the user's text, not to a shortcut. */\nconst TEXT_ENTRY = /^(input|textarea|select)$/i;\n\n/**\n * Is this event coming from somewhere the user is typing?\n *\n * ★★ A BARE-KEY SHORTCUT IS UNUSABLE WITHOUT THIS. `?` for help and `/` for\n *    search are the two commonest app shortcuts there are, and without this\n *    check they fire while the user types a question mark into a comment box —\n *    swallowing the character and opening a dialog over what they were\n *    writing. A modifier-based binding is mostly safe by construction, which\n *    is why this is only consulted for bindings that ask for it.\n */\nexport function svIsTextEntryTarget(target: EventTarget | null): boolean {\n  if (!target || !(target as Partial<HTMLElement>).tagName) return false;\n  const el = target as HTMLElement;\n  if (TEXT_ENTRY.test(el.tagName)) {\n    // A disabled or readonly field is not somewhere the user is typing.\n    const field = el as HTMLInputElement;\n    return !field.disabled && !field.readOnly;\n  }\n  return el.isContentEditable === true;\n}\n\n/** How a shortcut is written out for a reader. */\nexport interface SvShortcutTokensOptions {\n  /** Render ⌘ / ⌥ / ⌃ instead of Ctrl / Alt. */\n  readonly isMac: boolean;\n}\n\nconst MAC_SYMBOLS: Record<string, string> = {\n  mod: '⌘', meta: '⌘', ctrl: '⌃', alt: '⌥', shift: '⇧',\n};\nconst PC_LABELS: Record<string, string> = {\n  mod: 'Ctrl', meta: 'Win', ctrl: 'Ctrl', alt: 'Alt', shift: 'Shift',\n};\n\n/** Keys whose names are read as words rather than as their character. */\nconst KEY_LABELS: Record<string, string> = {\n  arrowup: '↑', arrowdown: '↓', arrowleft: '←', arrowright: '→',\n  enter: 'Enter', escape: 'Esc', backspace: 'Backspace', delete: 'Del',\n  tab: 'Tab', ' ': 'Space', space: 'Space',\n};\n\n/**\n * Render a binding as display tokens: `['⌘', 'K']` or `['Ctrl', 'K']`.\n *\n * ★★ ORDER IS FIXED AND IT IS THE PLATFORM'S ORDER, not the order the binding\n *    was written in. `'shift+mod+p'` and `'mod+shift+p'` are one shortcut, and\n *    a reader who sees ⇧⌘P in one menu and ⌘⇧P in another has to work out that\n *    they are the same thing.\n *\n * ★ Returns tokens rather than a string so a caller can render each in its own\n *   `<kbd>`, which is what makes a shortcut readable at a glance — and\n *   joining them is one `.join('')` away for the callers that want text.\n */\nexport function svShortcutTokens(\n  binding: string,\n  options: SvShortcutTokensOptions,\n): readonly string[] {\n  // A sequence renders every step, in order. `svShortcutSequenceTokens` keeps\n  // the steps apart, for a caller that draws \"then\" between them.\n  if (/\\s/.test(binding.trim())) return svShortcutSequenceTokens(binding, options).flat();\n  const parsed = svParseShortcut(binding);\n  if (!parsed) return [];\n  const symbols = options.isMac ? MAC_SYMBOLS : PC_LABELS;\n  const tokens: string[] = [];\n  // macOS convention: ⌃⌥⇧⌘ then the key. Windows: Ctrl, Alt, Shift, then key.\n  if (options.isMac) {\n    if (parsed.ctrl) tokens.push(symbols['ctrl']);\n    if (parsed.alt) tokens.push(symbols['alt']);\n    if (parsed.shift) tokens.push(symbols['shift']);\n    if (parsed.mod || parsed.meta) tokens.push(symbols['mod']);\n  } else {\n    if (parsed.mod || parsed.ctrl) tokens.push(symbols['ctrl']);\n    if (parsed.meta && !parsed.mod) tokens.push(symbols['meta']);\n    if (parsed.alt) tokens.push(symbols['alt']);\n    if (parsed.shift) tokens.push(symbols['shift']);\n  }\n  tokens.push(KEY_LABELS[parsed.key] ?? (parsed.key.length === 1 ? parsed.key.toUpperCase() : titleCase(parsed.key)));\n  return tokens;\n}\n\n/**\n * Render a sequence as one token list per step: `'g d'` → `[['G'], ['D']]`,\n * `'mod+k mod+s'` → `[['⌘', 'K'], ['⌘', 'S']]`. Empty when it does not parse.\n */\nexport function svShortcutSequenceTokens(\n  binding: string,\n  options: SvShortcutTokensOptions,\n): readonly (readonly string[])[] {\n  const steps = binding.trim().split(/\\s+/).filter((s) => s.length > 0);\n  if (svParseShortcutSequence(binding) === null) return [];\n  return steps.map((step) => svShortcutTokens(step, options));\n}\n\nfunction titleCase(value: string): string {\n  return value.charAt(0).toUpperCase() + value.slice(1);\n}\n\n/**\n * The canonical form of a binding, for comparing two of them.\n *\n * ★ `'shift+mod+p'` and `'mod+shift+p'` are the same shortcut, so conflict\n *   detection cannot compare the strings a host wrote — it compares these.\n */\nexport function svShortcutId(binding: string): string | null {\n  // A sequence's id is its steps' ids, space-separated: `'g d'`.\n  if (/\\s/.test(binding.trim())) {\n    if (svParseShortcutSequence(binding) === null) return null;\n    const ids = binding.trim().split(/\\s+/).map((step) => svShortcutId(step));\n    return ids.every((id) => id !== null) ? ids.join(' ') : null;\n  }\n  const parsed = svParseShortcut(binding);\n  if (!parsed) return null;\n  const flags = MODIFIERS.filter((m) => parsed[m]).join('+');\n  return flags ? `${flags}+${parsed.key}` : parsed.key;\n}\n","/**\n * ============================================================================\n *  Keyboard at scale — the one contract for long collections (`X-10`)\n * ============================================================================\n *\n * A virtual list with 50,000 rows cannot have 50,000 tab stops. Every\n * collection family in the kit (List View, Tree, Data Table, Transfer, Kanban)\n * answers the same four questions the same way:\n *\n * 1. **One tab stop per collection.** Roving tabindex: the active item carries\n *    `tabindex=\"0\"`, every other item `-1`. Tab enters the collection once and\n *    leaves it once, however many rows it holds. A container that wraps roving\n *    items is NOT itself a second tab stop.\n * 2. **Arrows, Home/End** move one item / to the ends — {@link svRovingTarget}\n *    semantics, except that arrows **clamp** at the ends by default (the APG\n *    listbox, tree and grid patterns do not wrap, and every collection in the\n *    kit already clamped — wrapping would be a behaviour change). A widget that\n *    wants wrapping passes `wrap: true`.\n * 3. **PageUp/PageDown** jump by a page and **clamp** at the ends — they never\n *    wrap. A page jump that wrapped from row 49,990 to row 8 would throw the\n *    reader to the other end of the data without telling them.\n * 4. **Typeahead**: printable characters typed within a short window form a\n *    prefix; focus moves to the next item whose label starts with it\n *    ({@link createTypeahead}).\n *\n * ── The documented ceiling ──────────────────────────────────────────────────\n * A collection that renders every row (not virtualized) keeps one tab stop, but\n * its DOM still grows with the data. {@link SV_UNVIRTUALIZED_ROW_CEILING} is the\n * number of rendered rows past which a family either virtualizes, paginates, or\n * warns in development mode. It is a documented limit, not a hard cap: nothing\n * is truncated, the host is told.\n *\n * Movement only. Whether moving focus also selects is the caller's decision —\n * see `roving.ts` for why that split matters.\n */\nimport { svWarnOnce } from '@styloviz/core/dev';\nimport { svRovingTarget } from './roving';\nimport { svIsTextEntryTarget } from './shortcut';\n\n/**\n * The number of rows an un-virtualized collection renders before the kit\n * considers it past its keyboard/DOM budget. Above it a family virtualizes, is\n * paginated (the page size is then the ceiling), or warns once in dev mode.\n */\nexport const SV_UNVIRTUALIZED_ROW_CEILING = 2000;\n\n/** Options for {@link svCollectionTarget}. */\nexport interface SvCollectionTargetOptions {\n  /**\n   * How many items PageUp/PageDown move. Usually the number of rows visible in\n   * the viewport. Values below 1 are treated as 1. @default 10\n   */\n  readonly pageSize?: number;\n  /**\n   * Whether ArrowUp/ArrowDown (and Left/Right) wrap from one end to the other,\n   * as {@link svRovingTarget} does. Page keys never wrap. @default false\n   */\n  readonly wrap?: boolean;\n}\n\n/**\n * Where a key should move focus inside a long collection.\n *\n * Arrows move one item (clamped, or wrapping with `wrap: true`), Home and End\n * go to the ends. PageUp/PageDown move by `pageSize` and clamp at the first /\n * last item — always.\n *\n * @returns the target index, or `null` when the key is not a navigation key —\n * let it through untouched.\n */\nexport function svCollectionTarget(\n  key: string,\n  count: number,\n  current: number,\n  options: SvCollectionTargetOptions = {},\n): number | null {\n  if (count <= 0) return null;\n  const from = current >= 0 && current < count ? current : 0;\n  const page = Math.max(1, Math.floor(options.pageSize ?? 10));\n  switch (key) {\n    case 'PageDown':\n      return Math.min(count - 1, from + page);\n    case 'PageUp':\n      return Math.max(0, from - page);\n    case 'ArrowDown':\n    case 'ArrowRight':\n      if (!options.wrap) return current >= 0 && current < count ? Math.min(count - 1, from + 1) : 0;\n      return svRovingTarget(key, count, current);\n    case 'ArrowUp':\n    case 'ArrowLeft':\n      if (!options.wrap) return current >= 0 && current < count ? Math.max(0, from - 1) : count - 1;\n      return svRovingTarget(key, count, current);\n    default:\n      return svRovingTarget(key, count, current);\n  }\n}\n\n/** Options for {@link createTypeahead}. */\nexport interface SvTypeaheadOptions<T> {\n  /** The text an item is matched by — usually its visible label. */\n  readonly labelOf: (item: T) => string;\n  /** How long a pause resets the typed prefix, in ms. @default 500 */\n  readonly timeoutMs?: number;\n  /** Clock seam for tests. @default Date.now */\n  readonly now?: () => number;\n}\n\n/** A typeahead buffer; see {@link createTypeahead}. */\nexport interface SvTypeahead<T> {\n  /**\n   * Feed one key. Returns the index of the item to focus, or `null` when the\n   * key is not a typeahead character or nothing matches.\n   */\n  handle(key: string, items: readonly T[], current: number): number | null;\n  /** Forget the typed prefix. */\n  reset(): void;\n}\n\n/**\n * True for a single printable character with no modifier, typed somewhere that\n * is not a text field — the keys typeahead listens to.\n */\nexport function svIsTypeaheadKey(\n  event: Pick<KeyboardEvent, 'key' | 'ctrlKey' | 'metaKey' | 'altKey'> & { readonly target?: EventTarget | null },\n): boolean {\n  if (event.key.length !== 1 || event.key === ' ' || event.ctrlKey || event.metaKey || event.altKey) return false;\n  const target = event.target ?? null;\n  // A checkbox or radio is an `<input>`, but nothing is typed into it — a\n  // transfer pane of checkboxes is exactly where typeahead is wanted.\n  const input = target as Partial<HTMLInputElement> | null;\n  if (input?.tagName === 'INPUT' && NON_TEXT_INPUTS.has(String(input.type))) return true;\n  return !svIsTextEntryTarget(target);\n}\n\nconst NON_TEXT_INPUTS = new Set(['checkbox', 'radio', 'button', 'submit', 'reset', 'range', 'color', 'file', 'image']);\n\n/**\n * Typeahead for a collection: type \"ma\" quickly to reach \"Marketing\".\n *\n * - Matching is case-insensitive and prefix-based.\n * - The search starts AFTER the current item and wraps, so typing the same\n *   letter repeatedly cycles through every item starting with it.\n * - A pause longer than `timeoutMs` starts a new prefix.\n *\n * Pure: no timers, no DOM. The caller decides whether the key was eligible\n * (see {@link svIsTypeaheadKey}) and what \"focus index\" means.\n */\nexport function createTypeahead<T>(options: SvTypeaheadOptions<T>): SvTypeahead<T> {\n  const timeout = options.timeoutMs ?? 500;\n  const now = options.now ?? Date.now;\n  let buffer = '';\n  let last = 0;\n\n  return {\n    handle(key, items, current) {\n      if (key.length !== 1 || items.length === 0) return null;\n      const t = now();\n      if (t - last > timeout) buffer = '';\n      last = t;\n      const char = key.toLowerCase();\n      // Repeating one letter cycles; a longer prefix refines.\n      const repeating = buffer.length > 0 && [...buffer].every((c) => c === char);\n      buffer = repeating ? char : buffer + char;\n      const prefix = buffer;\n      const count = items.length;\n      const start = repeating || prefix.length === 1 ? current + 1 : current;\n      for (let i = 0; i < count; i++) {\n        const index = (((start + i) % count) + count) % count;\n        if (options.labelOf(items[index]).trim().toLowerCase().startsWith(prefix)) return index;\n      }\n      return null;\n    },\n    reset() {\n      buffer = '';\n      last = 0;\n    },\n  };\n}\n\n/**\n * Dev-mode warning, once per `family`, when a collection renders more than\n * {@link SV_UNVIRTUALIZED_ROW_CEILING} rows without virtualization. Silent in\n * production and when `virtualized` is true.\n *\n * @returns whether the collection is past the ceiling (useful in tests).\n */\nexport function svWarnUnvirtualizedCeiling(family: string, rendered: number, virtualized: boolean): boolean {\n  if (virtualized || rendered <= SV_UNVIRTUALIZED_ROW_CEILING) return false;\n  svWarnOnce(\n    `collection-ceiling:${family}`,\n    `${family} renders ${rendered} rows without virtualization — past the documented ceiling of ` +\n      `${SV_UNVIRTUALIZED_ROW_CEILING}. Turn virtualization on, or paginate, to keep the keyboard ` +\n      `and DOM budget. Keyboard navigation still has one tab stop.`,\n  );\n  return true;\n}\n","/**\n * WCAG 2.x contrast, and saying a colour out loud.\n *\n * ── Why this is in `core` and not in the component that needed it ───────────\n *\n * ★★★ THE KIT ALREADY HAD THIS LOGIC, IN THE APP. `theme-builder.color.ts`\n *     carries a complete, tested WCAG audit — and it lives in\n *     `src/app/pages/theme-builder/`, which no library can import. So the colour\n *     picker's own contrast item (`FI-08-M1`) was one `Ctrl-C` away from\n *     becoming the kit's second contrast checker, which is exactly how two\n *     implementations drift until a designer's audit and a component's badge\n *     disagree about the same pair of colours.\n *\n *     The functions moved here and the theme builder re-exports them. One\n *     definition, two callers, and the app's existing specs cover it.\n *\n * ── Scope: WCAG 2.x, not APCA ───────────────────────────────────────────────\n *\n * ⚠️ The 4.5:1 / 3:1 ratios are the thresholds an auditor, a procurement\n *    questionnaire and a lawsuit will use, so this reports those. APCA is better\n *    perceptual science and is not what anyone is measured against yet; when it\n *    is, it belongs beside this rather than replacing it silently.\n */\n\nimport { svFormatLabel } from '@styloviz/core/i18n';\nimport { injectSvLabels } from '@styloviz/core/i18n';\nimport { SV_CORE_LABELS, type SvCoreLabels } from '@styloviz/core/i18n';\n\n/** The `core` labels `svColorName` builds a colour's name from. */\nexport type SvColorNameLabels = Pick<\n  SvCoreLabels,\n  | 'colorName'\n  | 'colorBlack' | 'colorWhite' | 'colorDarkGrey' | 'colorLightGrey' | 'colorGrey'\n  | 'colorRed' | 'colorOrange' | 'colorYellow' | 'colorLime' | 'colorGreen' | 'colorTeal'\n  | 'colorCyan' | 'colorBlue' | 'colorIndigo' | 'colorPurple' | 'colorMagenta'\n  | 'colorVeryDark' | 'colorDark' | 'colorVeryPale' | 'colorPale' | 'colorMuted' | 'colorVivid'\n>;\n\n/** Red, green, blue — each 0–255. */\nexport interface SvRgb {\n  readonly r: number;\n  readonly g: number;\n  readonly b: number;\n}\n\nconst srgbToLinear = (c: number): number =>\n  c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;\n\n/** True for `#abc`, `#aabbcc`, with or without the leading `#`, any case. */\nexport function svIsValidHex(value: string): boolean {\n  return /^#?[0-9a-f]{3}([0-9a-f]{3})?$/i.test(value.trim());\n}\n\n/** Expands a 3-digit shorthand to 6 digits and ensures a leading `#`, lowercased. */\nexport function svNormalizeHex(value: string): string {\n  let v = value.trim().toLowerCase();\n  if (!v.startsWith('#')) v = `#${v}`;\n  if (v.length === 4) v = `#${v[1]}${v[1]}${v[2]}${v[2]}${v[3]}${v[3]}`;\n  return v;\n}\n\nexport function svHexToRgb(hex: string): SvRgb {\n  const h = svNormalizeHex(hex);\n  return {\n    r: parseInt(h.slice(1, 3), 16),\n    g: parseInt(h.slice(3, 5), 16),\n    b: parseInt(h.slice(5, 7), 16),\n  };\n}\n\nexport function svRelativeLuminance({ r, g, b }: SvRgb): number {\n  const [lr, lg, lb] = [r, g, b].map((v) => srgbToLinear(v / 255));\n  return 0.2126 * lr + 0.7152 * lg + 0.0722 * lb;\n}\n\n/** WCAG contrast ratio between two hex colours — 1 (identical) to 21 (black on white). */\nexport function svContrastRatio(foregroundHex: string, backgroundHex: string): number {\n  const a = svRelativeLuminance(svHexToRgb(foregroundHex));\n  const b = svRelativeLuminance(svHexToRgb(backgroundHex));\n  const [hi, lo] = a > b ? [a, b] : [b, a];\n  return (hi + 0.05) / (lo + 0.05);\n}\n\nexport type SvWcagGrade = 'AAA' | 'AA' | 'AA Large' | 'Fail'; // sv-i18n-ignore: WCAG grade identifier\n\n/**\n * The strongest grade a ratio earns for normal-size text, or `AA Large` when it\n * only clears the 3:1 bar that applies to ≥18.66px bold / ≥24px text and to\n * non-text UI boundaries.\n */\nexport function svWcagGrade(ratio: number): SvWcagGrade {\n  if (ratio >= 7) return 'AAA';\n  if (ratio >= 4.5) return 'AA';\n  if (ratio >= 3) return 'AA Large'; // sv-i18n-ignore: WCAG grade identifier\n  return 'Fail';\n}\n\n/**\n * Rounded the way an audit tool prints it.\n *\n * ★★ FLOORED, NEVER ROUNDED UP PAST A THRESHOLD. `4.47` printed as \"4.5:1\" next\n *    to a green \"AA\" badge is a component telling a designer their text passes\n *    when it does not, and the error is invisible precisely because the number\n *    looks like the threshold.\n */\nexport function svFormatRatio(ratio: number): string {\n  return `${(Math.floor(ratio * 10) / 10).toFixed(1)}:1`;\n}\n\n// ── Saying a colour out loud (FI-08-M2) ───────────────────────────────────────\n\n/**\n * A plain-English name for a colour.\n *\n * ★★★ `#3B82F6` IS NOT AN ANNOUNCEMENT. A screen reader reads a hex value one\n *     character at a time — \"number three B eight two F six\" — which tells a\n *     user nothing about what they just picked. \"Medium blue\" does.\n *\n * ★★ DERIVED, NOT LOOKED UP. A table of the 148 CSS colour names sounds more\n *    precise and announces worse: the nearest entry to a muted blue-grey is\n *    \"LightSlateGray\", which is a name for a hex code rather than a description\n *    of a colour. Hue bucket plus lightness and saturation qualifiers produces\n *    something a person can picture, and has no table to keep in step.\n *\n * The words come from `labels` (the `core` namespace — `SV_CORE_LABELS` for\n * English), and `colorName` orders them, so a language that puts the hue first\n * reorders the template rather than the code.\n */\nexport function svColorName(hex: string, labels: SvColorNameLabels): string {\n  const { r, g, b } = svHexToRgb(hex);\n  const max = Math.max(r, g, b) / 255;\n  const min = Math.min(r, g, b) / 255;\n  const l = (max + min) / 2;\n  const d = max - min;\n  const s = d === 0 ? 0 : d / (1 - Math.abs(2 * l - 1));\n\n  // Achromatic: no hue worth naming, so lightness is the whole description.\n  if (s < 0.08 || d < 0.02) {\n    if (l < 0.06) return labels.colorBlack;\n    if (l > 0.95) return labels.colorWhite;\n    if (l < 0.3) return labels.colorDarkGrey;\n    if (l > 0.75) return labels.colorLightGrey;\n    return labels.colorGrey;\n  }\n\n  const rn = r / 255, gn = g / 255, bn = b / 255;\n  let h: number;\n  if (max === rn)      h = ((gn - bn) / d) % 6;\n  else if (max === gn) h = (bn - rn) / d + 2;\n  else                 h = (rn - gn) / d + 4;\n  h = (h * 60 + 360) % 360;\n\n  const hue =\n    h < 15  ? labels.colorRed    : h < 45  ? labels.colorOrange  : h < 70  ? labels.colorYellow :\n    h < 90  ? labels.colorLime   : h < 160 ? labels.colorGreen   : h < 190 ? labels.colorTeal   :\n    h < 210 ? labels.colorCyan   : h < 250 ? labels.colorBlue    : h < 280 ? labels.colorIndigo :\n    h < 310 ? labels.colorPurple : h < 340 ? labels.colorMagenta : labels.colorRed;\n\n  // ★ Lightness first, then saturation, because that is the order people say\n  //   them: \"pale dusty blue\", never \"dusty pale blue\".\n  const lightness =\n    l < 0.2  ? labels.colorVeryDark : l < 0.38 ? labels.colorDark :\n    l > 0.88 ? labels.colorVeryPale : l > 0.72 ? labels.colorPale : '';\n  const saturation = s < 0.25 ? labels.colorMuted : s > 0.85 ? labels.colorVivid : '';\n\n  // An empty qualifier leaves a double space; collapse it.\n  return svFormatLabel(labels.colorName, { lightness, saturation, hue }).replace(/\\s+/g, ' ').trim();\n}\n\n/**\n * `svColorName` in the app's words — the `core` labels after every\n * `provideSvLabels()`. Call in an injection context (a field initializer).\n */\nexport function injectSvColorNamer(): (hex: string) => string {\n  const labels = injectSvLabels('core', SV_CORE_LABELS);\n  return (hex) => svColorName(hex, labels);\n}\n","import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';\nimport type { SvDataSummary } from './data-summary';\nimport { svWarn } from '@styloviz/core/dev';\n\ndeclare const ngDevMode: boolean | undefined;\n\n/**\n * DataSummaryTable — the semantic equivalent of a visual surface, in one place.\n *\n * Gantt, Kanban, Widget Grid, Heatmap Calendar, Pivot, Tree, Timeline, Image\n * Gallery and nine chart families all need the same thing: a table saying what\n * the picture says. Written per family it was written four times and skipped\n * eight, and each copy re-learned the same CSS lesson the hard way (see the\n * stylesheet). Written once it is one component, one set of rules, one place to\n * fix.\n *\n * The surface computes the rows, because only it knows what a row means:\n *\n * ```html\n * <sv-data-summary-table [summary]=\"a11ySummary()\" />\n * ```\n *\n * ```ts\n * protected readonly a11ySummary = computed<SvDataSummary>(() => ({\n *   caption: `Tasks in ${this.projectName()}`,\n *   columns: ['Task', 'Start', 'End', 'Progress'],\n *   rows: this.visibleTasks().map((t) => ({\n *     key: t.id,\n *     header: t.title,\n *     cells: [this.fmtDate(t.start), this.fmtDate(t.end), `${t.progress ?? 0}%`],\n *   })),\n * }));\n * ```\n *\n * It renders nothing when there are no rows: an empty table announces a table\n * and then nothing, which is worse than the surface's own empty state.\n */\n@Component({\n  selector: 'sv-data-summary-table',\n  standalone: true,\n  templateUrl: './data-summary-table.component.html',\n  styleUrl: './data-summary-table.component.css',\n  changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SvDataSummaryTableComponent {\n  /** Caption, column labels and rows — see `SvDataSummary`. */\n  readonly summary = input.required<SvDataSummary>();\n\n  /**\n   * Show the table on screen instead of to assistive technology only — the\n   * chart a11y module's \"Show data table\". Visible, it scrolls in its own\n   * named, focusable box. @default false\n   */\n  readonly visible = input<boolean>(false);\n\n  protected readonly rows = computed(() => this.summary().rows);\n\n  /**\n   * A caption is not decoration: it is how a listener knows which of a\n   * dashboard's tables they have landed in. Missing, this component quietly\n   * publishes an anonymous one — so say so where it can be fixed, in dev only.\n   */\n  protected readonly caption = computed(() => {\n    const { caption, rows } = this.summary();\n    const trimmed = caption.trim();\n    if (typeof ngDevMode !== 'undefined' && ngDevMode && rows.length && !trimmed) {\n      svWarn('[sv-data-summary-table] rows with no caption — a listener cannot tell this table from any other on the page.');\n    }\n    // Trimmed, so a whitespace caption is no caption. An empty `<caption>`\n    // element announces the table as having a name and then reads nothing.\n    return trimmed;\n  });\n}\n","@if (rows().length) {\n  @if (visible()) {\n    <!-- On screen (the chart a11y module's toggle). A scrolling box with its\n         own name and a tab stop: a long table is scrolled from the keyboard,\n         and axe's scrollable-region-focusable asks exactly that. -->\n    <div\n      class=\"mt-3 max-h-72 overflow-auto rounded-lg border border-gray-200 dark:border-gray-700 focus:outline-none focus-visible:ring-2 focus-visible:ring-primary-500\"\n      role=\"region\"\n      tabindex=\"0\"\n      data-sv-summary-visible\n      [attr.aria-label]=\"caption() || null\"\n    >\n      @if (summary().overview) {\n        <p class=\"px-3 pt-2 text-xs text-gray-600 dark:text-gray-300\">{{ summary().overview }}</p>\n      }\n      <table class=\"w-full border-collapse text-start text-xs\">\n        @if (caption()) {\n          <caption class=\"px-3 py-2 text-start text-xs font-medium text-gray-900 dark:text-gray-100\">{{ caption() }}</caption>\n        }\n        <thead>\n          <tr>\n            @for (label of summary().columns; track $index) {\n              <th scope=\"col\" class=\"bg-gray-50 dark:bg-gray-800 px-3 py-2 text-start font-semibold text-gray-700 dark:text-gray-200\">{{ label }}</th>\n            }\n          </tr>\n        </thead>\n        <tbody>\n          @for (row of rows(); track row.key) {\n            <tr class=\"border-t border-gray-100 dark:border-gray-800\">\n              <th scope=\"row\" class=\"px-3 py-1.5 text-start font-medium text-gray-900 dark:text-gray-100\">{{ row.header }}</th>\n              @for (cell of row.cells; track $index) {\n                <td class=\"px-3 py-1.5 tabular-nums text-gray-700 dark:text-gray-300\">{{ cell }}</td>\n              }\n            </tr>\n          }\n        </tbody>\n      </table>\n    </div>\n  } @else {\n    <div class=\"sv-summary\">\n      @if (summary().overview) {\n        <p>{{ summary().overview }}</p>\n      }\n      <table>\n        @if (caption()) {\n          <caption>{{ caption() }}</caption>\n        }\n        <thead>\n          <tr>\n            <!-- `track $index`: a pivot's column labels repeat across groups. -->\n            @for (label of summary().columns; track $index) {\n              <th scope=\"col\">{{ label }}</th>\n            }\n          </tr>\n        </thead>\n        <tbody>\n          @for (row of rows(); track row.key) {\n            <tr>\n              <th scope=\"row\">{{ row.header }}</th>\n              @for (cell of row.cells; track $index) {\n                <td>{{ cell }}</td>\n              }\n            </tr>\n          }\n        </tbody>\n      </table>\n    </div>\n  }\n}\n","/**\n * The tabular equivalent of a visual surface.\n *\n * A Gantt chart, a Kanban board, a heatmap calendar and a treemap have one\n * problem in common: the information is in the geometry. Marking up every bar,\n * card and cell with a role describes the drawing, not the data — a listener\n * gets four hundred announcements and no answer to \"which tasks slip past\n * Friday?\". What works is one semantic table alongside the picture, saying the\n * same thing in rows.\n *\n * The surface owns the mapping, because only it knows what a row means and how\n * to format a value. This module owns the shape they all map into.\n */\n\n/**\n * One row of the summary: a header cell that names the item, then a value per\n * data column.\n *\n * `cells` are strings, already formatted. Dates, durations, currencies and\n * percentages belong to the surface — it has the locale, the format inputs and\n * the domain — and a formatting layer here would end up a second, worse copy of\n * each family's own.\n */\nexport interface SvSummaryRow {\n  /** Stable identity for `track`. The item's own id, not its index. */\n  readonly key: string;\n  /** What the row is: a task title, a card title, a date. Rendered as `<th scope=\"row\">`. */\n  readonly header: string;\n  /** One formatted value per data column, in `columns` order after the first. */\n  readonly cells: readonly string[];\n}\n\n/**\n * A whole summary: what the table is called, its column labels, and its rows.\n *\n * Grouped into one object rather than three inputs because a surface computes\n * all three together from the same state, and a caption that disagrees with the\n * rows it labels is worse than none.\n */\nexport interface SvDataSummary {\n  /**\n   * What this table is, as a sentence fragment — `'Tasks in Website relaunch'`.\n   * Rendered as the `<caption>`, which is how a listener knows what they have\n   * landed in before reading any of it.\n   */\n  readonly caption: string;\n  /**\n   * Column labels, including the first one, which labels the row headers —\n   * `['Task', 'Start', 'End', 'Progress']`.\n   */\n  readonly columns: readonly string[];\n  /** The rows, in the order a reader should meet them. */\n  readonly rows: readonly SvSummaryRow[];\n  /**\n   * One line of prose read before the table: `'18 tasks, 3 finishing late.'`\n   *\n   * Optional, and worth writing when the picture makes a point that the rows\n   * only imply. An overview that just counts the rows is noise.\n   */\n  readonly overview?: string;\n}\n\n/** An empty summary — nothing to describe, so nothing is rendered. */\nexport const SV_EMPTY_SUMMARY: SvDataSummary = { caption: '', columns: [], rows: [] };\n","import { Directive, InjectionToken, input, type Provider } from '@angular/core';\n\n/**\n * The chart accessibility module — how a chart's data table is offered.\n *\n * Every chart already publishes its data as a table for assistive technology\n * (`SvDataSummary`, rendered by `sv-chart-frame`). What this adds is the same\n * table for EVERYONE: a \"Show data table\" button under the plot, the way\n * Highcharts and Datawrapper offer one. A sighted reader who wants the exact\n * figure, a low-vision reader zoomed past the axis, a reader on a printout —\n * none of them can use a table that only a screen reader reaches.\n *\n *   - `'hidden'` — the table is there for assistive technology only (the\n *     default, and how every chart rendered before this existed).\n *   - `'toggle'` — a button under the plot shows and hides the table on screen.\n *\n * App-wide with `provideSvChartA11y({ dataTable: 'toggle' })`, or per chart with\n * the `svChartDataTable` attribute on the chart's own element.\n */\nexport type SvChartDataTableMode = 'hidden' | 'toggle';\n\nexport interface SvChartA11yConfig {\n  /** How each chart's data table is offered. @default 'hidden' */\n  readonly dataTable: SvChartDataTableMode;\n}\n\nconst DEFAULTS: SvChartA11yConfig = { dataTable: 'hidden' };\n\nexport const SV_CHART_A11Y = new InjectionToken<SvChartA11yConfig>('SV_CHART_A11Y', {\n  providedIn: 'root',\n  factory: () => DEFAULTS,\n});\n\n/**\n * Set the chart accessibility module for an app, a route or one component's\n * subtree: `providers: [provideSvChartA11y({ dataTable: 'toggle' })]`.\n */\nexport function provideSvChartA11y(config: Partial<SvChartA11yConfig>): Provider {\n  return { provide: SV_CHART_A11Y, useValue: { ...DEFAULTS, ...config } };\n}\n\n/**\n * One chart's data-table mode, on the chart's own element:\n *\n * ```html\n * <sv-bar-chart svChartDataTable [datasets]=\"…\" />            <!-- toggle -->\n * <sv-bar-chart svChartDataTable=\"hidden\" [datasets]=\"…\" />   <!-- opt out -->\n * ```\n *\n * ★ It works on every chart without each one declaring an input, because the\n *   chart's `sv-chart-frame` sits inside the chart's view and injects this from\n *   the chart's host element. A chart a buyer writes on `sv-chart-frame` gets it\n *   the same way.\n */\n@Directive({ selector: '[svChartDataTable]', standalone: true })\nexport class SvChartDataTableDirective {\n  /** `'toggle'` (or the bare attribute) shows the button; `'hidden'` opts this chart out. @default 'toggle' */\n  readonly svChartDataTable = input<SvChartDataTableMode | ''>('toggle');\n}\n","import { Injectable, computed, inject, signal, DOCUMENT } from '@angular/core';\nimport { svWarnOnce } from '@styloviz/core/dev';\nimport {\n  svIsTextEntryTarget,\n  svMatchesShortcut,\n  svParseShortcutSequence,\n  svShortcutId,\n  type SvShortcut,\n} from './shortcut';\n\n/**\n * Which context a shortcut belongs to — a PRECEDENCE BAND, not a lifecycle.\n *\n * ★★ THE REGISTRY CANNOT KNOW ABOUT ROUTES, and does not try to. A binding is\n *    live from `register()` to `release()`, which for a route-scoped one means\n *    \"while the page component exists\" and for an overlay-scoped one means\n *    \"while the overlay is open\" — the owner's own lifetime does the work. The\n *    scope says who WINS when two bindings want the same keystroke.\n *\n * `overlay` > `route` > `global`, because the innermost context owns the\n * keystroke. That is the same rule the overlay stack already applies to\n * Escape, and having two different answers to \"who owns this key\" in one kit\n * is how a dialog ends up unable to close.\n */\nexport type SvShortcutScope = 'global' | 'route' | 'overlay';\n\n/** What a caller registers. */\nexport interface SvShortcutBinding {\n  /** `'mod+k'`, `'mod+shift+p'`, `'?'`. See `svParseShortcut`. */\n  readonly keys: string;\n  /** Precedence band. @default 'global' */\n  readonly scope?: SvShortcutScope;\n  /** What it does, for a shortcut list or a palette row. */\n  readonly label?: string;\n  /** Run it. `preventDefault()` is called for you when this returns. */\n  readonly run: (event: KeyboardEvent) => void;\n  /** Consulted on every keystroke, so a binding can go quiet without releasing. */\n  readonly enabled?: () => boolean;\n  /**\n   * Fire even while the user is typing in a field. @default false\n   *\n   * ★ `?` and `/` are the commonest app shortcuts there are, and both are\n   *   characters people type. A bare-key binding that fires inside a comment\n   *   box swallows the character and opens a dialog over what was being\n   *   written.\n   */\n  readonly whileTyping?: boolean;\n}\n\n/** A live registration. */\nexport interface SvShortcutHandle {\n  /**\n   * False when another binding in the same scope already owns these keys.\n   *\n   * ★ A refused registration is INERT, not an exception: a palette that\n   *   cannot bind ⌘K still has to open from its button.\n   */\n  readonly active: boolean;\n  /** Stop listening. Idempotent. */\n  release(): void;\n}\n\n/** A duplicate registration, for a host that wants to show or log it. */\nexport interface SvShortcutConflict {\n  /** Canonical binding, e.g. `'mod+shift+p'`. */\n  readonly id: string;\n  readonly scope: SvShortcutScope;\n  /** The label that holds the binding. */\n  readonly heldBy: string;\n  /** The label that asked for it and was refused. */\n  readonly refused: string;\n}\n\ninterface Entry {\n  readonly seq: number;\n  readonly binding: SvShortcutBinding;\n  /** The first step — the whole binding, unless it is a sequence. */\n  readonly parsed: SvShortcut;\n  /** Every step. Length 1 for an ordinary binding. */\n  readonly steps: readonly SvShortcut[];\n  readonly id: string;\n  readonly scope: SvShortcutScope;\n}\n\nconst SCOPE_RANK: Record<SvShortcutScope, number> = { global: 0, route: 1, overlay: 2 };\n\n/**\n * How long a sequence waits for its next key, in ms. Gmail and Linear use\n * about a second: long enough for a deliberate second key, short enough that a\n * stray `g` does not hijack the next key pressed a minute later.\n */\nexport const SV_SHORTCUT_SEQUENCE_TIMEOUT_MS = 1000;\n\nlet _seq = 0;\n\n/**\n * SvShortcutRegistryService — one owner for every app keystroke (`X-15`).\n *\n * ── The finding ─────────────────────────────────────────────────────────────\n *\n * ★★★ **NOTHING OWNED THEM.** Command Palette bound its own global key with a\n *     hand-written matcher on `document`; Menubar and Dropdown Menu DISPLAYED\n *     shortcuts they never registered, so what was drawn and what was bound\n *     could not be checked against each other. Two components binding ⌘K both\n *     fired. A shortcut colliding with the browser, the OS, an embedding\n *     editor or a screen reader was nobody's business to notice.\n *\n * ── Why one listener ────────────────────────────────────────────────────────\n *\n * ★★ ONE `keydown` LISTENER, NOT ONE PER BINDING. Fifty bindings mean fifty\n *    handlers on `document`, fifty chances for one of them to\n *    `preventDefault()` a key another was waiting for, and no way to say which\n *    won. With one listener the arbitration is a sort, and it is visible.\n */\n@Injectable({ providedIn: 'root' })\nexport class SvShortcutRegistryService {\n  private readonly _document = inject(DOCUMENT, { optional: true });\n  private readonly _entries = signal<readonly Entry[]>([]);\n  private readonly _conflicts = signal<readonly SvShortcutConflict[]>([]);\n  private _listening = false;\n  private readonly _handler = (event: KeyboardEvent) => this._dispatch(event);\n\n  /**\n   * ★ Platform read once, from the same `navigator.platform` test the palette\n   *   used, so `mod` means the same key everywhere in the kit.\n   */\n  private readonly _isMac =\n    typeof navigator !== 'undefined' && /Mac|iPhone|iPad|iPod/.test(navigator.platform);\n\n  /** Duplicate registrations, in the order they were refused. */\n  readonly conflicts = computed(() => this._conflicts());\n\n  /** Every live binding, for a \"keyboard shortcuts\" panel to render. */\n  readonly bindings = computed<readonly { id: string; scope: SvShortcutScope; label: string }[]>(\n    () =>\n      this._entries().map((e) => ({\n        id: e.id,\n        scope: e.scope,\n        label: e.binding.label ?? '',\n      })),\n  );\n\n  register(binding: SvShortcutBinding): SvShortcutHandle {\n    const steps = svParseShortcutSequence(binding.keys);\n    const parsed = steps?.[0] ?? null;\n    const id = svShortcutId(binding.keys);\n    if (!steps || !parsed || !id) {\n      // ★ A binding nobody can press is a bug to report, not state to hold:\n      //   holding it would make it show up in a shortcuts panel as though it\n      //   worked.\n      svWarnOnce(\n        `shortcut-unparseable:${binding.keys}`,\n        `<sv-*> could not parse the shortcut \"${binding.keys}\". Use modifiers ` +\n          `mod, ctrl, meta, alt, shift and one key, e.g. \"mod+shift+p\" — or ` +\n          `space-separated steps for a sequence, e.g. \"g d\".`,\n      );\n      // ★ A null-object handle, not a forgotten body: registration was\n      //   REFUSED, so there is nothing to release. Returning one anyway means a\n      //   caller can `release()` unconditionally without first asking whether\n      //   its own registration worked.\n      return { active: false, release: () => { /* nothing was held */ } };\n    }\n\n    const scope = binding.scope ?? 'global';\n    const held = this._entries().find((e) => e.id === id && e.scope === scope);\n\n    // ★★★ WITHIN A SCOPE, THE FIRST REGISTRATION KEEPS THE KEYSTROKE, and this\n    //     is the arbitration the audit asked for. \"Last wins\" reads as\n    //     tempting — the newest thing is usually the innermost — but between\n    //     two `global` bindings there IS no inner and outer, so last-wins\n    //     makes the behaviour depend on component construction order, which\n    //     changes when a lazy route loads. Deterministic and reported beats\n    //     plausible and silent.\n    //\n    // ★★ The nesting case is handled by SCOPE instead: an overlay-scoped\n    //    binding outranks a route-scoped one, which outranks a global one, so\n    //    a dialog's ⌘K takes precedence over the app's while it is open and\n    //    hands it back when it closes. That is the overlay stack's rule, and\n    //    the kit should not have two answers to \"who owns this key\".\n    if (held) {\n      const conflict: SvShortcutConflict = {\n        id,\n        scope,\n        heldBy: held.binding.label ?? '(unlabelled)',\n        refused: binding.label ?? '(unlabelled)',\n      };\n      this._conflicts.update((list) => [...list, conflict]);\n      svWarnOnce(\n        `shortcut-conflict:${scope}:${id}`,\n        `Two ${scope} shortcuts want \"${id}\": \"${conflict.heldBy}\" holds it and ` +\n          `\"${conflict.refused}\" was refused. Give one of them a different binding, ` +\n          `or a narrower scope.`,\n      );\n      // Same null-object as the unparseable case above: the conflict means\n      // this binding never entered the registry, so releasing it is a no-op.\n      return { active: false, release: () => { /* nothing was held */ } };\n    }\n\n    const entry: Entry = { seq: ++_seq, binding, parsed, steps, id, scope };\n    this._entries.update((list) => [...list, entry]);\n    this._listen();\n\n    return {\n      active: true,\n      release: () => {\n        this._entries.update((list) => list.filter((e) => e.seq !== entry.seq));\n        this._conflicts.update((list) => list.filter((c) => !(c.id === id && c.scope === scope)));\n        if (this._entries().length === 0) this._unlisten();\n      },\n    };\n  }\n\n  /**\n   * Test seam and diagnostic: what would run for this event.\n   *\n   * Exposed because the arbitration is the whole point of this service, and a\n   * test that has to synthesise a real `keydown` to see it is a test of jsdom.\n   */\n  resolve(\n    event: Pick<KeyboardEvent, 'key' | 'ctrlKey' | 'metaKey' | 'altKey' | 'shiftKey'> & {\n      readonly target?: EventTarget | null;\n      readonly isComposing?: boolean;\n      readonly keyCode?: number;\n    },\n  ): { id: string; scope: SvShortcutScope; label: string } | null {\n    const entry = this._match(event);\n    return entry ? { id: entry.id, scope: entry.scope, label: entry.binding.label ?? '' } : null;\n  }\n\n  private _match(\n    event: Pick<KeyboardEvent, 'key' | 'ctrlKey' | 'metaKey' | 'altKey' | 'shiftKey'> & {\n      readonly target?: EventTarget | null;\n      readonly isComposing?: boolean;\n      readonly keyCode?: number;\n    },\n  ): Entry | null {\n    // ★★★ AN IME OWNS THE KEYBOARD WHILE IT IS COMPOSING. A Japanese, Chinese\n    //     or Korean user confirming a candidate with a modifier chord, or a\n    //     dead-key sequence on a European layout, produces keydowns that are\n    //     part of TEXT, not commands — and `whileTyping` bindings (the\n    //     palette's ⌘K) would otherwise fire in the middle of a word and steal\n    //     the composition. `isComposing` is the standard signal; `keyCode`\n    //     229 is what Safari and older Chromium report for the same keydowns\n    //     instead. Neither ever triggers a binding, whatever its scope.\n    if (event.isComposing === true || event.keyCode === 229) return null;\n    const typing = svIsTextEntryTarget(event.target ?? null);\n    const candidates = this._entries().filter((entry) => {\n      // A sequence is never ONE keystroke; `_dispatch` walks it step by step.\n      if (entry.steps.length > 1) return false;\n      if (!this._eligible(entry, typing)) return false;\n      return svMatchesShortcut(event, entry.parsed, this._isMac);\n    });\n    if (candidates.length === 0) return null;\n    // ★ Highest scope wins; within a scope there is at most one, so the\n    //   `seq` tiebreak only ever settles cross-scope ties that cannot happen\n    //   — it is there so the sort is total rather than accidentally stable.\n    return [...candidates].sort(\n      (a, b) => SCOPE_RANK[b.scope] - SCOPE_RANK[a.scope] || b.seq - a.seq,\n    )[0];\n  }\n\n  private _eligible(entry: Entry, typing: boolean): boolean {\n    if (entry.binding.enabled && !entry.binding.enabled()) return false;\n    return !(typing && entry.binding.whileTyping !== true);\n  }\n\n  /** A sequence part-way through: who is still in the running, at which step, since when. */\n  private _pending: { readonly entries: readonly Entry[]; readonly step: number; readonly at: number } | null = null;\n\n  /**\n   * Feed one keydown to the sequences. Returns the entry to run when this key\n   * completes one, `'pending'` when it advanced one, or `null` when no\n   * sequence wants it (the pending state is then forgotten).\n   *\n   * ★★ A COMPLETED SEQUENCE BEATS A SINGLE KEY. `g d` and `d` can both exist;\n   *    after `g`, the `d` belongs to the sequence the user is in the middle of.\n   *    Outside a sequence, a single-key binding keeps its key — a sequence only\n   *    STARTS on a key nothing else claims.\n   */\n  private _advance(event: KeyboardEvent, now: number): Entry | 'pending' | null {\n    const typing = svIsTextEntryTarget(event.target ?? null);\n    const pending = this._pending;\n    if (pending !== null && now - pending.at <= SV_SHORTCUT_SEQUENCE_TIMEOUT_MS) {\n      const live = this._entries();\n      const still = pending.entries.filter(\n        (e) => live.includes(e) && this._eligible(e, typing) && svMatchesShortcut(event, e.steps[pending.step], this._isMac),\n      );\n      const done = still.filter((e) => e.steps.length === pending.step + 1);\n      if (done.length > 0) {\n        this._pending = null;\n        return [...done].sort((a, b) => SCOPE_RANK[b.scope] - SCOPE_RANK[a.scope] || b.seq - a.seq)[0];\n      }\n      if (still.length > 0) {\n        this._pending = { entries: still, step: pending.step + 1, at: now };\n        return 'pending';\n      }\n    }\n    this._pending = null;\n    return null;\n  }\n\n  /** Start a sequence on a key no single binding claimed. */\n  private _start(event: KeyboardEvent, now: number): boolean {\n    const typing = svIsTextEntryTarget(event.target ?? null);\n    const starting = this._entries().filter(\n      (e) => e.steps.length > 1 && this._eligible(e, typing) && svMatchesShortcut(event, e.steps[0], this._isMac),\n    );\n    if (starting.length === 0) return false;\n    this._pending = { entries: starting, step: 1, at: now };\n    return true;\n  }\n\n  private _dispatch(event: KeyboardEvent): void {\n    // Composition owns the keyboard — same rule as `_match`.\n    if (event.isComposing === true || event.keyCode === 229) return;\n    const now = Date.now();\n    const sequence = this._advance(event, now);\n    if (sequence === 'pending') {\n      event.preventDefault();\n      return;\n    }\n    if (sequence !== null) {\n      event.preventDefault();\n      sequence.binding.run(event);\n      return;\n    }\n    const entry = this._match(event);\n    if (!entry) {\n      if (this._start(event, now)) event.preventDefault();\n      return;\n    }\n    // ★ `preventDefault()` only when something actually ran. Calling it for a\n    //   keystroke nothing claimed is how a registry breaks the browser's own\n    //   shortcuts, which is one of the things it exists to prevent.\n    event.preventDefault();\n    entry.binding.run(event);\n  }\n\n  private _listen(): void {\n    // ★ SSR: no document, no keyboard. The registry still holds bindings so a\n    //   prerendered shortcuts panel renders, and starts listening when a\n    //   browser picks it up.\n    if (this._listening || !this._document) return;\n    this._document.addEventListener('keydown', this._handler);\n    this._listening = true;\n  }\n\n  private _unlisten(): void {\n    if (!this._listening || !this._document) return;\n    this._document.removeEventListener('keydown', this._handler);\n    this._listening = false;\n  }\n}\n"],"mappings":";;;;;AAUA,MAAM,UAAQ;AAGd,SAAgB,uBAAoB;CAClC,IAAI,OAAO,WAAW,eAAe,OAAO,OAAO,eAAe,YAChE,OAAO;CAET,OAAO,OAAO,WAAW,OAAK,CAAC,CAAC;AAClC;AAMA,SAAgB,sBAAsB,IAA8B;CAClE,IAAI,OAAO,WAAW,eAAe,OAAO,OAAO,eAAe,YAChE,aAAY,CAEZ;CAEF,MAAM,MAAM,OAAO,WAAW,OAAK;CACnC,MAAM,WAAW,MAAiC,GAAG,EAAE,OAAO;CAC9D,IAAI,iBAAiB,UAAU,OAAO;CACtC,aAAa,IAAI,oBAAoB,UAAU,OAAO;AACxD;ACTA,MAAM,QAAQ;AAEd,SAAgB,qBAAkB;CAChC,IAAI,OAAO,WAAW,eAAe,OAAO,OAAO,eAAe,YAAY,OAAO;CACrF,OAAO,OAAO,WAAW,KAAK,CAAC,CAAC;AAClC;AAMA,SAAgB,4BAA4B,IAAkC;CAC5E,IAAI,OAAO,WAAW,eAAe,OAAO,OAAO,eAAe,YAChE,aAAY,CAA6B;CAE3C,MAAM,MAAM,OAAO,WAAW,KAAK;CACnC,MAAM,WAAW,MAAiC,GAAG,EAAE,OAAO;CAC9D,IAAI,iBAAiB,UAAU,OAAO;CACtC,aAAa,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