efficient-shell 4.127.0 → 4.132.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/README.md +938 -5
  2. package/dist/{Browser-F5TKMP4K.js → Browser-XPVJ2K7B.js} +13 -10
  3. package/dist/Browser-XPVJ2K7B.js.map +1 -0
  4. package/dist/{Calculator-T3XG7S73.js → Calculator-ZXJPXG7F.js} +12 -9
  5. package/dist/Calculator-ZXJPXG7F.js.map +1 -0
  6. package/dist/ConfirmDialog-MTC7QMUJ.js +4 -0
  7. package/dist/{ConfirmDialog-LJXMB45A.js.map → ConfirmDialog-MTC7QMUJ.js.map} +1 -1
  8. package/dist/{CurrencyConverter-CASQMKLO.js → CurrencyConverter-WSJ2BBSX.js} +12 -9
  9. package/dist/CurrencyConverter-WSJ2BBSX.js.map +1 -0
  10. package/dist/{Documents-YX67YTZS.js → Documents-ONGSXUJI.js} +14 -11
  11. package/dist/Documents-ONGSXUJI.js.map +1 -0
  12. package/dist/{Files-QB63GO6J.js → Files-GQZMFWXQ.js} +17 -14
  13. package/dist/Files-GQZMFWXQ.js.map +1 -0
  14. package/dist/{Notepad-3SUD5XUE.js → Notepad-HM73XAM4.js} +15 -12
  15. package/dist/Notepad-HM73XAM4.js.map +1 -0
  16. package/dist/PdfViewer-M2YGZIYX.js +5 -0
  17. package/dist/{PdfViewer-LSP3YNFC.js.map → PdfViewer-M2YGZIYX.js.map} +1 -1
  18. package/dist/{PomodoroTimer-4EHD2QC4.js → PomodoroTimer-DG3LI5CX.js} +14 -11
  19. package/dist/PomodoroTimer-DG3LI5CX.js.map +1 -0
  20. package/dist/{Preview-4ZHR4SKP.js → Preview-TUSV4UMO.js} +16 -13
  21. package/dist/Preview-TUSV4UMO.js.map +1 -0
  22. package/dist/{Sidebar-J76PV4QF.js → Sidebar-BPU7RCZP.js} +5 -4
  23. package/dist/Sidebar-BPU7RCZP.js.map +1 -0
  24. package/dist/{Spreadsheet-G3SC7XJ5.js → Spreadsheet-3WTXCHYQ.js} +14 -11
  25. package/dist/Spreadsheet-3WTXCHYQ.js.map +1 -0
  26. package/dist/{Stock-TLT4VN2R.js → Stock-YMPOMUAW.js} +12 -9
  27. package/dist/Stock-YMPOMUAW.js.map +1 -0
  28. package/dist/{Weather-FRKX3DAK.js → Weather-NZO3CWLH.js} +12 -9
  29. package/dist/Weather-NZO3CWLH.js.map +1 -0
  30. package/dist/{WorldClock-GKCITO3M.js → WorldClock-HUC6D3AD.js} +12 -9
  31. package/dist/WorldClock-HUC6D3AD.js.map +1 -0
  32. package/dist/apps/index.js +26 -22
  33. package/dist/apps/index.js.map +1 -1
  34. package/dist/brand.css +1 -1
  35. package/dist/chunk-7IN7YZAL.js +547 -0
  36. package/dist/chunk-7IN7YZAL.js.map +1 -0
  37. package/dist/{chunk-YNGPTOL6.js → chunk-7MA5XBWD.js} +3 -3
  38. package/dist/{chunk-YNGPTOL6.js.map → chunk-7MA5XBWD.js.map} +1 -1
  39. package/dist/{chunk-WK7FV7VV.js → chunk-BJ34QOR3.js} +827 -625
  40. package/dist/chunk-BJ34QOR3.js.map +1 -0
  41. package/dist/{chunk-HNH7FOYB.js → chunk-CGXMWHQW.js} +7 -6
  42. package/dist/chunk-CGXMWHQW.js.map +1 -0
  43. package/dist/{chunk-XUCIYMN7.js → chunk-CJYO4RVV.js} +4 -4
  44. package/dist/{chunk-XUCIYMN7.js.map → chunk-CJYO4RVV.js.map} +1 -1
  45. package/dist/{chunk-N3CG5HG5.js → chunk-CLGNTGC5.js} +12 -11
  46. package/dist/chunk-CLGNTGC5.js.map +1 -0
  47. package/dist/chunk-D276EMXS.js +57 -0
  48. package/dist/chunk-D276EMXS.js.map +1 -0
  49. package/dist/{chunk-7KIOEKHS.js → chunk-E3TWIN7Z.js} +21 -135
  50. package/dist/chunk-E3TWIN7Z.js.map +1 -0
  51. package/dist/{chunk-2VM2FRZJ.js → chunk-EENVXIVU.js} +47 -67
  52. package/dist/chunk-EENVXIVU.js.map +1 -0
  53. package/dist/{chunk-YG45DAUT.js → chunk-FONEQRBH.js} +17 -11
  54. package/dist/chunk-FONEQRBH.js.map +1 -0
  55. package/dist/chunk-IPXN646P.js +14 -0
  56. package/dist/chunk-IPXN646P.js.map +1 -0
  57. package/dist/chunk-IRWSRJ4K.js +48 -0
  58. package/dist/chunk-IRWSRJ4K.js.map +1 -0
  59. package/dist/chunk-JMKYYPOF.js +7 -0
  60. package/dist/{chunk-CJZXR7MG.js.map → chunk-JMKYYPOF.js.map} +1 -1
  61. package/dist/{chunk-JFQGPY7W.js → chunk-KWEX4ZAF.js} +20 -17
  62. package/dist/chunk-KWEX4ZAF.js.map +1 -0
  63. package/dist/{chunk-OKEFO6TI.js → chunk-LQTVTOSY.js} +10 -10
  64. package/dist/chunk-LQTVTOSY.js.map +1 -0
  65. package/dist/{chunk-G4KA3SAX.js → chunk-MQPX6ERJ.js} +4 -4
  66. package/dist/{chunk-G4KA3SAX.js.map → chunk-MQPX6ERJ.js.map} +1 -1
  67. package/dist/{chunk-FQB24B42.js → chunk-SEWF4O3H.js} +3 -3
  68. package/dist/{chunk-FQB24B42.js.map → chunk-SEWF4O3H.js.map} +1 -1
  69. package/dist/{chunk-AXWC3332.js → chunk-TFXJRHJV.js} +3 -3
  70. package/dist/{chunk-AXWC3332.js.map → chunk-TFXJRHJV.js.map} +1 -1
  71. package/dist/{chunk-G3HQLQYZ.js → chunk-TQURTLK2.js} +59 -34
  72. package/dist/chunk-TQURTLK2.js.map +1 -0
  73. package/dist/{chunk-6XQHH7D2.js → chunk-TRCWINHF.js} +5 -5
  74. package/dist/{chunk-6XQHH7D2.js.map → chunk-TRCWINHF.js.map} +1 -1
  75. package/dist/{chunk-NPJCMM6V.js → chunk-VWZIGZFF.js} +4 -4
  76. package/dist/{chunk-NPJCMM6V.js.map → chunk-VWZIGZFF.js.map} +1 -1
  77. package/dist/{chunk-HYZ5QMVO.js → chunk-XH3ELPQZ.js} +22 -19
  78. package/dist/chunk-XH3ELPQZ.js.map +1 -0
  79. package/dist/{chunk-PPUZJFCI.js → chunk-ZKHD4J73.js} +8 -7
  80. package/dist/chunk-ZKHD4J73.js.map +1 -0
  81. package/dist/file-intake/index.js +3 -1
  82. package/dist/file-intake/index.js.map +1 -1
  83. package/dist/{index-dQia6NpB.d.ts → index-COwksV6G.d.ts} +699 -199
  84. package/dist/index.d.ts +2 -2
  85. package/dist/index.js +37 -32
  86. package/dist/index.js.map +1 -1
  87. package/dist/map/index.js +5 -3
  88. package/dist/map/index.js.map +1 -1
  89. package/dist/markdown/index.js +4 -3
  90. package/dist/markdown/index.js.map +1 -1
  91. package/dist/page-tabs/index.js +12 -8
  92. package/dist/page-tabs/index.js.map +1 -1
  93. package/dist/shell.css +17 -17
  94. package/dist/themes.css +15 -0
  95. package/dist/ui/index.d.ts +1 -1
  96. package/dist/ui/index.js +17 -13
  97. package/dist/ui/index.js.map +1 -1
  98. package/dist/ui.css +691 -283
  99. package/package.json +1 -1
  100. package/dist/Browser-F5TKMP4K.js.map +0 -1
  101. package/dist/Calculator-T3XG7S73.js.map +0 -1
  102. package/dist/ConfirmDialog-LJXMB45A.js +0 -3
  103. package/dist/CurrencyConverter-CASQMKLO.js.map +0 -1
  104. package/dist/Documents-YX67YTZS.js.map +0 -1
  105. package/dist/Files-QB63GO6J.js.map +0 -1
  106. package/dist/Notepad-3SUD5XUE.js.map +0 -1
  107. package/dist/PdfViewer-LSP3YNFC.js +0 -4
  108. package/dist/PomodoroTimer-4EHD2QC4.js.map +0 -1
  109. package/dist/Preview-4ZHR4SKP.js.map +0 -1
  110. package/dist/Sidebar-J76PV4QF.js.map +0 -1
  111. package/dist/Spreadsheet-G3SC7XJ5.js.map +0 -1
  112. package/dist/Stock-TLT4VN2R.js.map +0 -1
  113. package/dist/Weather-FRKX3DAK.js.map +0 -1
  114. package/dist/WorldClock-GKCITO3M.js.map +0 -1
  115. package/dist/chunk-2VM2FRZJ.js.map +0 -1
  116. package/dist/chunk-3CUSBZWG.js +0 -59
  117. package/dist/chunk-3CUSBZWG.js.map +0 -1
  118. package/dist/chunk-7KIOEKHS.js.map +0 -1
  119. package/dist/chunk-CJZXR7MG.js +0 -7
  120. package/dist/chunk-G3HQLQYZ.js.map +0 -1
  121. package/dist/chunk-HNH7FOYB.js.map +0 -1
  122. package/dist/chunk-HYZ5QMVO.js.map +0 -1
  123. package/dist/chunk-JFQGPY7W.js.map +0 -1
  124. package/dist/chunk-N3CG5HG5.js.map +0 -1
  125. package/dist/chunk-OKEFO6TI.js.map +0 -1
  126. package/dist/chunk-PPUZJFCI.js.map +0 -1
  127. package/dist/chunk-WK7FV7VV.js.map +0 -1
  128. package/dist/chunk-YG45DAUT.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/forms/IconButton.tsx","../src/forms/styles.ts","../src/forms/Input.tsx","../src/forms/Textarea.tsx","../src/forms/dropdownPosition.ts","../src/forms/selectNav.ts","../src/forms/Select.tsx","../src/forms/Checkbox.tsx","../src/forms/Radio.tsx","../src/forms/FormField.tsx","../src/forms/RadioGroup.tsx","../src/forms/FormErrorSummary.tsx","../src/forms/Label.tsx","../src/forms/mediaShared.tsx","../src/forms/MediaUploadField.tsx","../src/forms/BrandAssetEditor.tsx","../src/contexts/PortalBrandingProvider.tsx","../src/forms/MediaUploadGrid.tsx","../src/forms/Calendar.tsx","../src/forms/DateRangePicker.tsx","../src/forms/TimePicker.tsx","../src/forms/DatePicker.tsx","../src/forms/DateTimePicker.tsx","../src/shell/clipboard.ts","../src/forms/Snippet.tsx","../src/forms/keypadInput.ts","../src/forms/NumericKeypad.tsx","../src/forms/TileButton.tsx","../src/forms/Segmented.tsx","../src/forms/Switch.tsx","../src/forms/InputNumber.tsx","../src/forms/FilePicker.tsx","../src/forms/ComposerAttachments.tsx","../src/shell/SearchableSelect.tsx","../src/forms/TagInput.tsx","../src/shell/Card.tsx","../src/shell/Text.tsx","../src/shell/Stack.tsx","../src/shell/Divider.tsx","../src/shell/Skeleton.tsx","../src/shell/DescriptionList.tsx","../src/shell/SettingRow.tsx","../src/shell/CountBadge.tsx","../src/shell/Statistic.tsx","../src/shell/Avatar.tsx","../src/shell/Banner.tsx","../src/shell/Tabs.tsx","../src/shell/Stepper.tsx","../src/shell/Accordion.tsx","../src/shell/Tooltip.tsx","../src/shell/StatusBadge.tsx","../src/shell/ColoredBadge.tsx","../src/shell/EmptyState.tsx","../src/shell/PageHeader.tsx","../src/shell/severity.ts","../src/shell/MetricBar.tsx","../src/shell/BudgetBar.tsx","../src/utils/date.ts","../src/shell/timelineDates.ts","../src/charts/effects.tsx","../src/shell/timelineGlyphs.tsx","../src/shell/timelineGeometry.ts","../src/shell/timelinePlayback.ts","../src/shell/TimelineTrack.tsx","../src/shell/TimelineCard.tsx","../src/shell/MilestoneTimeline.tsx","../src/shell/ProductionTimeline.tsx","../src/shell/ContainerFillChart.tsx","../src/shell/Markdown.tsx","../src/shell/HelpCenter.tsx","../src/shell/SidebarActionButton.tsx","../src/shell/SidebarNav.tsx","../src/shell/TopNav.tsx","../src/shell/DropdownMenu.tsx","../src/shell/AppUpdateBanner.tsx","../src/shell/Drawer.tsx","../src/shell/GlobalSearch.tsx","../src/data/Kanban.tsx","../src/data/Pagination.tsx","../src/data/DataTable.tsx","../src/data/ListFooter.tsx","../src/data/ListLoadError.tsx","../src/charts/Sparkline.tsx","../src/charts/BarChart.tsx","../src/charts/DonutChart.tsx","../src/charts/LineChart.tsx","../src/templates/DashboardTemplate.tsx","../src/templates/DataTablePage.tsx","../src/templates/FormLayoutPage.tsx","../src/templates/CheckoutTemplate.tsx","../src/templates/EmailTemplate.tsx","../src/templates/ChatTemplate.tsx","../src/templates/GalleryTemplate.tsx","../src/templates/AuthScreen.tsx","../src/templates/ErrorPage.tsx","../src/templates/ErrorBoundary.tsx","../src/hooks/useTheme.ts","../src/hooks/useClickOutside.ts","../src/charts/palette.ts","../src/charts/scale.ts","../src/charts/curve.ts","../src/charts/treemapLayout.ts","../src/charts/highlight.tsx","../src/charts/usePlotWidth.ts","../src/charts/RankedBars.tsx","../src/charts/Meter.tsx","../src/charts/StatTile.tsx","../src/charts/ChartSkeleton.tsx","../src/charts/ChartFrame.tsx","../src/charts/ChartTooltip.tsx","../src/charts/ChartDot.tsx","../src/charts/ChartBrush.tsx","../src/charts/CartesianPlot.tsx","../src/charts/TimeSeriesChart.tsx","../src/charts/ColumnChart.tsx","../src/charts/ScatterChart.tsx","../src/charts/RangeChart.tsx","../src/charts/WaterfallChart.tsx","../src/charts/HistogramChart.tsx","../src/charts/BoxPlotChart.tsx","../src/charts/CandlestickChart.tsx","../src/charts/HeatmapChart.tsx","../src/charts/AccessibleTable.tsx","../src/charts/RadarChart.tsx","../src/charts/PieChart.tsx","../src/charts/RadialBarChart.tsx","../src/charts/FunnelChart.tsx","../src/charts/TreemapChart.tsx","../src/charts/SunburstChart.tsx","../src/charts/SankeyChart.tsx","../src/charts/ChordChart.tsx"],"names":["IconButton","forwardRef","Input","pad","jsx","Textarea","NativeSelect","jsxs","ListboxSelect","useState","useCallback","Select","Checkbox","useRef","useEffect","Radio","useId","Fragment","useMemo","createPortal","TimePicker","MONTH_NAMES","toInputValue","DatePicker","fromInputValue","DateTimePicker","SIZES","TileButton","Switch","InputNumber","FilePicker","useLayoutEffect","SIZE","COLS","TONE","Children","isValidElement","cloneElement","createContext","useContext","reading","format","clampPct","fmt","fixed","width","node","at","step","dressing","glyph","fillFor","VARIANTS","ALIGN","len","MONTHS","GROUPS","ITEMS","COPY","out","ring","isValue","top","angle"],"mappings":";;;;;;;;;;;;;;AA2DA,IAAM,MAAA,GAAqC;AAAA,EACzC,EAAA,EAAI,SAAA;AAAA,EACJ,EAAA,EAAI,SAAA;AAAA,EACJ,EAAA,EAAI,WAAA;AAAA,EACJ,UAAA,EAAY,WAAA;AAAA,EACZ,OAAA,EAAS,WAAA;AAAA,EACT,UAAA,EAAY,WAAA;AAAA,EACZ,UAAA,EAAY;AACd,CAAA;AAEA,IAAM,aAAa,UAAA,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IAAA,EAAM,CAAC,EAAE,GAAA,EAAK,SAAS,KAAA,EAAO,YAAA,EAAc,OAAO,kBAAA,CAAmB,KAAA,CAAM,IAAI,UAAU,CAAA,CAAG,IAAI,CAAA,EAAG,KAAA,EAAO,YAAY,MAAA,CAAO,UAAU,CAAC,CAAA,EAAG;AAAA;AAAA,KAC9I,EACF,CAAA;AAAA,IAED,iCACCA,GAAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,8BACb,QAAA,kBAAAA,GAAAA;AAAA,MAAC,YAAA;AAAA,MAAA;AAAA,QACC,KAAA,EAAO,CAAA,EAAG,MAAA,CAAO,aAAA,CAAc,IAAI,CAAC,CAAA,QAAA,EAAM,MAAA,CAAO,aAAA,CAAc,EAAE,CAAC,CAAA,CAAA;AAAA,QAClE,IAAA,EAAM,CAAC,EAAE,GAAA,EAAK,SAAS,KAAA,EAAO,MAAA,EAAQ,OAAO,kBAAA,CAAmB,KAAA,CAAM,IAAI,aAAA,CAAc,IAAI,EAAG,IAAI,CAAA,EAAG,OAAO,WAAA,CAAY,aAAA,CAAc,KAAK,CAAA,EAAG;AAAA;AAAA,KACjJ,EACF,CAAA;AAAA,oBAGFA,GAAAA;AAAA,MAAC,eAAA;AAAA,MAAA;AAAA,QACC,OAAA,EAAS,CAAA,cAAA,EAAiB,KAAA,CAAM,MAAM,CAAA,aAAA,CAAA;AAAA,QACtC,IAAA,EAAM,CAAC,MAAA,EAAQ,IAAA,EAAM,OAAO,CAAA;AAAA,QAC5B,MAAM,OAAA,CAAQ,GAAA,CAAI,CAAA,MAAA,KAAU,CAAC,OAAO,MAAA,CAAO,IAAI,CAAA,EAAG,MAAA,CAAO,OAAO,EAAE,CAAA,EAAG,YAAY,MAAA,CAAO,KAAK,CAAC,CAAC;AAAA;AAAA;AACjG,GAAA,EACF,CAAA;AAEJ","file":"chunk-WK7FV7VV.js","sourcesContent":["/**\n * IconButton — a button whose whole content is an icon.\n *\n * A separate component rather than a `Button` prop, for a reason that is\n * type-level and worth the file: an icon-only control has no accessible name\n * unless someone supplies one, and a REQUIRED `aria-label` in the props is the\n * only way to make forgetting it a compile error instead of a screen-reader\n * user's dead end. `Button` cannot require it — most buttons have text, which\n * names them for free.\n *\n * The size axis is square. `Button` sizes with horizontal padding, so it has no\n * icon-only form: a 32px button there is 32px tall and as wide as its content.\n * The rungs here match `Button`'s heights exactly (`md` is 32px in both), so a\n * row mixing the two lines up.\n *\n * It reuses `Button`'s base and variants — never its class string. Passing a\n * square size through `Button`'s `className` would put two competing padding\n * utilities in one attribute, and those resolve by compiled-stylesheet order\n * rather than by the order they were written, which is the trap documented at\n * length in forms/styles.ts. Composing here means only one size ever lands.\n */\nimport { forwardRef, type ButtonHTMLAttributes, type ReactNode } from 'react';\n\nimport { BUTTON_BASE, BUTTON_VARIANTS, type ButtonSize, type ButtonVariant } from './Button';\n\nexport interface IconButtonProps\n extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'className' | 'children'> {\n /** The icon. Sized by the caller — the kit does not resize what it is given. */\n children: ReactNode;\n /**\n * What the button does, in words. Required: there is no text to read, so\n * without this the control is unusable to anyone not looking at it.\n */\n 'aria-label': string;\n /**\n * Defaults to `ghost`, where `Button` defaults to `primary`. An icon with no\n * label is almost always a secondary action — a row's overflow menu, a copy\n * affordance, a close — and a grid of solid blue squares is not what any of\n * those want. Ask for `primary` on the rare icon-only main action.\n */\n /**\n * `link` is excluded: it exists to shed the box, and a square icon button is\n * nothing but the box. Asking for it would produce a bare coloured glyph\n * with a 40px hit area it no longer draws.\n */\n variant?: Exclude<ButtonVariant, 'link'>;\n size?: ButtonSize;\n className?: string;\n}\n\n/**\n * Square, and matching `Button`'s heights rung for rung: `sm` is 24px in both\n * (py-1 either side of a 16px line box), `md` 32px, and the touch rungs carry\n * the same explicit heights for the same reason — a hit target has to be a\n * guaranteed size, not one implied by the current font.\n *\n * A Record keyed by the union, so a new ButtonSize member without an entry here\n * is a compile error rather than a silent fall-through.\n */\nconst SQUARE: Record<ButtonSize, string> = {\n sm: 'h-6 w-6',\n md: 'h-8 w-8',\n lg: 'h-10 w-10',\n 'touch-sm': 'h-11 w-11',\n 'touch': 'h-14 w-14',\n 'touch-lg': 'h-16 w-16',\n 'touch-xl': 'h-20 w-20',\n};\n\nconst IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(function IconButton(\n { children, variant = 'ghost', size = 'md', type = 'button', className = '', ...rest },\n ref,\n) {\n return (\n <button\n ref={ref}\n type={type}\n className={[BUTTON_BASE, BUTTON_VARIANTS[variant], SQUARE[size], 'shrink-0 p-0', className]\n .filter(Boolean)\n .join(' ')}\n {...rest}\n >\n {children}\n </button>\n );\n});\n\nexport default IconButton;\n","/**\n * Shared form-control styling — the single source of truth for the kit's\n * text-input look. Promoted out of SearchableSelect so every form control\n * (Input, Textarea, Select, SearchableSelect) renders identically and picks\n * up the same `[data-theme=\"dark\"]` input remaps from styles.css.\n *\n * Keep this in the documented Tailwind vocabulary (see .design-sync/conventions.md)\n * so the classes survive both the dark-mode allow-list and the design-sync\n * compiled stylesheet.\n */\n\n/**\n * The size axis is SWAPPED into the class string, never appended to it.\n *\n * That distinction is the whole reason this constant is assembled from parts\n * rather than written as one literal. Two competing utilities in one class\n * attribute — `px-3` and `px-4`, say — are not resolved by their order in the\n * string; they are resolved by their order in the COMPILED stylesheet, which\n * neither this file nor the caller controls. Appending a touch size to a base\n * that already bakes in `px-3 py-1.5 text-sm` would therefore render one size\n * or the other essentially at random, and look fine in review either way.\n *\n * Composed below in the original order, so `INPUT_BASE` is byte-identical to\n * what it has always been — it and `inputClasses` are public exports, so their\n * exact values are contract. `tests/touchPrimitives.test.tsx` pins that.\n */\nconst INPUT_SHAPE_PRE = 'block w-full rounded-md border border-gray-300 bg-white';\nconst INPUT_SHAPE_POST =\n 'text-gray-800 placeholder:text-gray-400 shadow-sm ' +\n 'focus:border-blue-400 focus:outline-none focus:ring-2 focus:ring-blue-400/30';\n\n/** `sm`/`md`/`lg` are the desktop ladder; `touch` is a finger on glass. See\n * ButtonSize for why touch is a separate rung rather than the top of this\n * ladder — a till's idea of \"large\" is 56px, and one word cannot mean both. */\nexport type InputSize = 'sm' | 'md' | 'lg' | 'touch';\n\nexport const INPUT_SIZES: Record<InputSize, string> = {\n // The desktop rungs carry no explicit height: a text control's height should\n // follow its own font, or a long label wraps out of a box that was pinned.\n // The touch rung does carry one, for the same reason Button's does.\n sm: 'px-2.5 py-1 text-xs',\n md: 'px-3 py-1.5 text-sm',\n lg: 'px-3.5 py-2 text-base',\n // 56px, matching Button's `touch`. `text-base` is 16px BY AGREEMENT with the\n // rule in ui.css that forces `font-size: 16px !important` on every form\n // control under `(pointer: coarse)` — the rule that stops iOS zooming the\n // viewport on focus. Picking anything else here would render one size on a\n // desktop and 16px on the device the size was chosen for.\n touch: 'h-14 px-4 text-base',\n};\n\n/** Base look for a text-bearing form control. Native <input>/<select>/<textarea>\n * also receive dark styling for free via the global rule in styles.css. */\nexport const INPUT_BASE = `${INPUT_SHAPE_PRE} ${INPUT_SIZES.md} ${INPUT_SHAPE_POST}`;\n\n/** Error-state ring/border, layered on top of INPUT_BASE. */\nexport const INPUT_INVALID =\n 'border-red-300 focus:border-red-400 focus:ring-red-400/30';\n\n/** Disabled affordance — opacity-based so it stays correct in every theme. */\nexport const INPUT_DISABLED = 'disabled:cursor-not-allowed disabled:opacity-60';\n\n/** Compose the input classes for a control. Omitting `size` — or passing the\n * default `md` — yields exactly `INPUT_BASE`, so every existing caller is\n * unaffected. */\nexport function inputClasses(opts?: { invalid?: boolean; size?: InputSize; className?: string }): string {\n const shape = opts?.size && opts.size !== 'md'\n ? `${INPUT_SHAPE_PRE} ${INPUT_SIZES[opts.size]} ${INPUT_SHAPE_POST}`\n : INPUT_BASE;\n return [shape, opts?.invalid ? INPUT_INVALID : '', INPUT_DISABLED, opts?.className ?? '']\n .filter(Boolean)\n .join(' ');\n}\n","/**\n * Input — a styled text `<input>`. A thin wrapper over the shared INPUT_BASE\n * look; it forwards its ref and spreads every native prop, so it drops into\n * `react-hook-form` via `register()` and works as a controlled or uncontrolled\n * field unchanged. Native dark-mode input styling applies automatically.\n */\nimport { forwardRef, type InputHTMLAttributes, type ReactNode } from 'react';\nimport { inputClasses, type InputSize } from './styles';\n\nexport interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'className' | 'size'> {\n /** Error state — red border + ring. */\n invalid?: boolean;\n /** Icon rendered inside the field's left edge (e.g. a search glyph). */\n leftIcon?: ReactNode;\n /** Content pinned to the field's right edge (e.g. a unit, a small action). */\n rightAdornment?: ReactNode;\n /**\n * `touch` gives a 56px field for a finger. Defaults to the desktop size.\n *\n * This shadows the native `size` attribute (a character count), which is\n * omitted above rather than left to collide — the width of a `w-full` field\n * has never come from that attribute here, so nothing loses a capability it\n * was using. Set `style`/`className` for width instead.\n */\n size?: InputSize;\n className?: string;\n}\n\nconst Input = forwardRef<HTMLInputElement, InputProps>(function Input(\n { invalid, leftIcon, rightAdornment, size, className = '', ...rest },\n ref,\n) {\n const pad = `${leftIcon ? 'pl-9' : ''} ${rightAdornment ? 'pr-9' : ''}`.trim();\n const field = (\n // `inputMode` needs no plumbing — it rides the native spread onto the\n // <input>, which is how a till sets inputMode=\"none\" to keep the OS\n // keyboard off the screen while its own keypad drives the field.\n <input\n ref={ref}\n\n aria-invalid={invalid || undefined}\n className={inputClasses({ invalid, size, className: [pad, className].filter(Boolean).join(' ') })}\n {...rest}\n />\n );\n\n if (!leftIcon && !rightAdornment) return field;\n return (\n <div className=\"relative\">\n {leftIcon && (\n <span className=\"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-gray-400\">{leftIcon}</span>\n )}\n {field}\n {rightAdornment && (\n <span className=\"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400\">{rightAdornment}</span>\n )}\n </div>\n );\n});\n\nexport default Input;\n","/**\n * Textarea — a styled multi-line `<textarea>`, same INPUT_BASE look as Input.\n * Forwards its ref and spreads native props (react-hook-form friendly). With\n * `autoGrow`, the field resizes to fit its content as the user types.\n */\nimport { forwardRef, useCallback, type FormEvent, type TextareaHTMLAttributes } from 'react';\nimport { inputClasses, type InputSize } from './styles';\n\nexport interface TextareaProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'className'> {\n /** Error state — red border + ring. */\n invalid?: boolean;\n /** Grow the field to fit its content instead of scrolling. */\n autoGrow?: boolean;\n /** Desktop rung, or `touch`. Defaults to `md`. */\n size?: InputSize;\n className?: string;\n}\n\nconst Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(function Textarea(\n { invalid, autoGrow, className = '', onInput, rows = 3, size, ...rest },\n ref,\n) {\n const handleInput = useCallback((e: FormEvent<HTMLTextAreaElement>) => {\n if (autoGrow) {\n const el = e.currentTarget;\n el.style.height = 'auto';\n el.style.height = `${el.scrollHeight}px`;\n }\n onInput?.(e);\n }, [autoGrow, onInput]);\n\n return (\n <textarea\n ref={ref}\n\n aria-invalid={invalid || undefined}\n rows={rows}\n onInput={handleInput}\n className={inputClasses({ invalid, size, className: `${autoGrow ? 'resize-none overflow-hidden' : ''} ${className}`.trim() })}\n {...rest}\n />\n );\n});\n\nexport default Textarea;\n","/**\n * Fixed-viewport dropdown positioning, shared by the combobox-style form\n * controls (SearchableSelect, TagInput, Select, DatePicker, DateRangePicker).\n * Promoted out of SearchableSelect verbatim when TagInput needed the identical\n * logic — the flip/track/clamp behaviour is the kind of thing that drifts when\n * copied, and it did: Select carried its own copy and DateRangePicker a third,\n * so the same trigger placed its menu differently depending on which control\n * was under it.\n */\nimport { useLayoutEffect, useState, type RefObject } from 'react';\n\n/** `max-w-[28rem]` on the menu, as a number for the fit math. */\nexport const POPUP_MAX_WIDTH = 448;\n/** Menu's own max height (former `max-h-60` = 15rem). Capped smaller when the\n * space it is allowed is tight. */\nexport const MENU_MAX_HEIGHT = 240;\n/** Gap between the trigger and the menu, and the safety margin at every edge. */\nconst MENU_GAP = 4;\nconst VIEWPORT_MARGIN = 8;\n\nexport interface MenuPos {\n left?: number;\n right?: number;\n top?: number;\n bottom?: number;\n minWidth: number;\n /** Cap for a menu that grows to its content — never wider than it may go. */\n maxWidth: number;\n /** Set only for `matchTriggerWidth`: the menu is exactly this wide. */\n width?: number;\n maxHeight: number;\n}\n\nexport interface DropdownPositionOptions {\n /**\n * The menu takes the trigger's width rather than growing to its longest\n * option. What a native `<select>` does, and what `Select` needs.\n */\n matchTriggerWidth?: boolean;\n /**\n * How wide and tall this popup would LIKE to be, before the owning window\n * has its say. The defaults suit an option list; a calendar panel is a fixed\n * composition rather than a scrolling list, and capping it at a list's 240px\n * scrolls its Apply button out of a window with 700px to spare.\n */\n preferredMaxWidth?: number;\n preferredMaxHeight?: number;\n}\n\ninterface Bounds { left: number; right: number; top: number; bottom: number }\n\nconst viewportBounds = (): Bounds => ({\n left: 0, right: window.innerWidth, top: 0, bottom: window.innerHeight,\n});\n\n/**\n * The box an anchored popup has to stay inside (UI-11).\n *\n * A menu is portalled to `<body>` so an `overflow-hidden` ancestor cannot clip\n * it away. That escape is about clipping, not about ownership: the menu still\n * belongs to the shell window its trigger sits in, and a menu drawn over the\n * desktop beside that window belongs to nothing. So the bounds are the owning\n * window's panel — every shell window marks it `data-modal-panel` — intersected\n * with the viewport, because a window may itself be dragged half off screen.\n *\n * Falls back to the viewport when the trigger is not inside a window at all: a\n * routed page, a till, a login screen.\n *\n * A rect of zeros means the browser has not laid the panel out yet (and is all\n * jsdom ever reports), which says nothing about where the popup may go — so\n * treat it as \"no window\" rather than as a zero-sized one.\n */\nexport function popupBounds(trigger: Element | null | undefined): Bounds {\n const viewport = viewportBounds();\n const owner = trigger?.closest?.('[data-modal-panel]');\n if (!owner) return viewport;\n const rect = owner.getBoundingClientRect();\n if (rect.width <= 0 || rect.height <= 0) return viewport;\n return {\n left: Math.max(viewport.left, rect.left),\n right: Math.min(viewport.right, rect.right),\n top: Math.max(viewport.top, rect.top),\n bottom: Math.min(viewport.bottom, rect.bottom),\n };\n}\n\n/**\n * Compute the menu's fixed-viewport position from the trigger rect while the\n * dropdown is open, re-running on scroll (capture, so nested form-scroll\n * containers count), resize, and every animation frame the trigger moves so it\n * tracks a moving trigger. Anchors below the trigger by default, flips above\n * when below is cramped and above has more room, and flips to right-aligned\n * when the max width wouldn't fit to the right of the trigger's left edge.\n *\n * Every edge is measured against `popupBounds`, not the viewport, so the menu\n * stays inside the window that owns it.\n */\nexport function useDropdownPosition(\n triggerRef: RefObject<HTMLElement | null>,\n open: boolean,\n options: DropdownPositionOptions = {},\n): MenuPos | null {\n const {\n matchTriggerWidth = false,\n preferredMaxWidth = POPUP_MAX_WIDTH,\n preferredMaxHeight = MENU_MAX_HEIGHT,\n } = options;\n const [pos, setPos] = useState<MenuPos | null>(null);\n useLayoutEffect(() => {\n if (!open) { setPos(null); return; }\n // Remember the last trigger rect the rAF poll acted on, so the idle loop\n // recomputes only when the trigger has actually moved.\n let lastLeft = NaN, lastTop = NaN, lastRight = NaN, lastBottom = NaN;\n const compute = () => {\n const trigger = triggerRef.current;\n const rect = trigger?.getBoundingClientRect();\n if (!rect) return;\n lastLeft = rect.left; lastTop = rect.top; lastRight = rect.right; lastBottom = rect.bottom;\n const bounds = popupBounds(trigger);\n\n const spaceBelow = bounds.bottom - rect.bottom - MENU_GAP - VIEWPORT_MARGIN;\n const spaceAbove = rect.top - bounds.top - MENU_GAP - VIEWPORT_MARGIN;\n const placeAbove = spaceBelow < Math.min(preferredMaxHeight, 160) && spaceAbove > spaceBelow;\n const maxHeight = Math.max(96, Math.min(preferredMaxHeight, placeAbove ? spaceAbove : spaceBelow));\n\n // Room the popup is allowed at all, before any alignment decision.\n const roomWide = Math.max(0, bounds.right - bounds.left - 2 * VIEWPORT_MARGIN);\n const next: MenuPos = {\n minWidth: rect.width,\n maxWidth: Math.min(preferredMaxWidth, roomWide),\n maxHeight,\n };\n\n if (matchTriggerWidth) {\n // The menu is the WIDTH of the field, not a minimum for it.\n //\n // It was `minWidth` with nothing capping the other end, so the list\n // grew to its longest option: in a 512px dialog, a field of 464px\n // opened a menu of 583px that hung 95px past the dialog's edge. A\n // native <select> matches its field and truncates what does not fit,\n // and that is the shape people read a select as having.\n const width = Math.min(rect.width, roomWide);\n next.width = width;\n next.maxWidth = width;\n next.left = Math.min(\n Math.max(bounds.left + VIEWPORT_MARGIN, rect.left),\n bounds.right - VIEWPORT_MARGIN - width,\n );\n } else if (bounds.right - VIEWPORT_MARGIN - rect.left < next.maxWidth) {\n // No room to grow rightward from the trigger's left edge: hang the\n // menu off its right edge instead, pulled in far enough that the menu\n // ends inside the window rather than inside the viewport.\n const rightEdge = Math.min(rect.right, bounds.right - VIEWPORT_MARGIN);\n next.right = window.innerWidth - rightEdge;\n next.maxWidth = Math.min(\n next.maxWidth,\n Math.max(0, rightEdge - bounds.left - VIEWPORT_MARGIN),\n );\n } else {\n next.left = Math.max(bounds.left + VIEWPORT_MARGIN, rect.left);\n }\n\n if (placeAbove) next.bottom = window.innerHeight - rect.top + MENU_GAP;\n else next.top = rect.bottom + MENU_GAP;\n setPos(next);\n };\n compute();\n // Dragging a shell window moves the trigger via a CSS transform on an\n // ancestor — that fires neither scroll nor resize, so the listeners below\n // never see it and the menu would hang at its open-time spot while the\n // window slides out from under it. Poll the trigger rect each animation\n // frame and recompute when it shifts, so the menu tracks the window\n // through a drag (and any other transform-/animation-driven move). The\n // rect dirty-check keeps the idle loop cheap when nothing is moving.\n let raf = requestAnimationFrame(function tick() {\n const rect = triggerRef.current?.getBoundingClientRect();\n if (rect && (rect.left !== lastLeft || rect.top !== lastTop || rect.right !== lastRight || rect.bottom !== lastBottom)) {\n compute();\n }\n raf = requestAnimationFrame(tick);\n });\n window.addEventListener('scroll', compute, true);\n window.addEventListener('resize', compute);\n return () => {\n cancelAnimationFrame(raf);\n window.removeEventListener('scroll', compute, true);\n window.removeEventListener('resize', compute);\n };\n }, [open, triggerRef, matchTriggerWidth, preferredMaxWidth, preferredMaxHeight]);\n return pos;\n}\n","/**\n * Pure keyboard-navigation helpers for the custom-listbox `<Select>`. Kept free\n * of React and the DOM so the option-traversal rules (skip disabled options,\n * clamp without wrapping, Home/End, letter typeahead) are unit-testable under\n * the repo's server-only test runner (`npm test`), which never mounts a DOM.\n *\n * The helpers take the minimal shape they need (`label` for typeahead,\n * `disabled` to skip), so they stay decoupled from `SelectOption`.\n */\n\nexport interface NavOption {\n label: string;\n disabled?: boolean;\n}\n\n// The helpers are generic over the option shape (they read only `label` and\n// `disabled`) so they accept a `SelectOption[]` — which also carries `value` —\n// without an excess-property complaint on inline option literals.\n\n/** First selectable option, or -1 when every option is disabled/empty. */\nexport function firstEnabledIndex<T extends NavOption>(options: readonly T[]): number {\n for (let i = 0; i < options.length; i++) {\n if (!options[i].disabled) return i;\n }\n return -1;\n}\n\n/** Last selectable option, or -1 when every option is disabled/empty. */\nexport function lastEnabledIndex<T extends NavOption>(options: readonly T[]): number {\n for (let i = options.length - 1; i >= 0; i--) {\n if (!options[i].disabled) return i;\n }\n return -1;\n}\n\n/**\n * Step one selectable option in `dir` (+1 = ArrowDown, -1 = ArrowUp) from\n * `from`, skipping disabled options and clamping at the ends (no wrap — matches\n * a native `<select>`'s arrow-key behaviour). `from = -1` means \"nothing active\n * yet\": stepping down lands on the first option, stepping up on the last.\n */\nexport function nextEnabledIndex<T extends NavOption>(options: readonly T[], from: number, dir: 1 | -1): number {\n let i = from + dir;\n while (i >= 0 && i < options.length) {\n if (!options[i].disabled) return i;\n i += dir;\n }\n // Ran off the end without finding one — keep the current option if it is\n // itself selectable, otherwise fall back to the nearest end in `dir`.\n if (from >= 0 && from < options.length && !options[from].disabled) return from;\n return dir > 0 ? firstEnabledIndex(options) : lastEnabledIndex(options);\n}\n\n/**\n * Letter typeahead: find the next selectable option whose label starts with\n * `buffer` (case-insensitive), scanning forward from just after `fromIndex` and\n * wrapping around. Returns -1 when nothing matches (or the buffer is empty).\n * Passing `fromIndex = -1` starts the scan at the first option.\n */\nexport function matchTypeahead<T extends NavOption>(options: readonly T[], buffer: string, fromIndex: number): number {\n const q = buffer.toLowerCase();\n const n = options.length;\n if (!q || n === 0) return -1;\n for (let step = 1; step <= n; step++) {\n const i = (((fromIndex + step) % n) + n) % n;\n const o = options[i];\n if (!o.disabled && o.label.toLowerCase().startsWith(q)) return i;\n }\n return -1;\n}\n","/**\n * Select — a form control for short, fixed option lists. Follows the kit's\n * controlled idiom (`value` + `onChange(value)`, not the raw event, matching\n * SearchableSelect).\n *\n * On DESKTOP this renders a custom listbox: a trigger button plus a\n * body-portaled option list (same portal/positioning reasoning as\n * SearchableSelect and PopupMenu). A native `<select>` on desktop opens an OS\n * popup that grabs every key event while it is open — so page/window hotkeys\n * die until it closes (BG#00421). The custom listbox keeps key events flowing\n * to the app, so hotkeys keep working, and adds full keyboard support\n * (Arrow/Home/End/Enter/Space/typeahead) with combobox/listbox ARIA.\n *\n * On MOBILE (touch) this renders the native `<select>` — the OS wheel/sheet\n * picker is the better touch affordance and hotkeys are irrelevant there —\n * AT THE `touch` RUNG, not at whatever desktop rung the caller asked for. See\n * the Select doc-block below for why, and `touchSize` for how to override it.\n * The native element is also where the forwarded `HTMLSelectElement` ref and\n * any spread native attributes land, so `NativeSelect` is exported for callers\n * that need a raw native control on every viewport.\n *\n * Use SearchableSelect instead when the list is long or needs type-to-filter /\n * free-text entry; use Select for a handful of known options.\n */\nimport {\n forwardRef, useCallback, useEffect, useId, useRef, useState,\n type KeyboardEvent as ReactKeyboardEvent, type SelectHTMLAttributes,\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { inputClasses, type InputSize } from './styles';\nimport { firstEnabledIndex, lastEnabledIndex, matchTypeahead, nextEnabledIndex } from './selectNav';\nimport { MENU_MAX_HEIGHT, useDropdownPosition } from './dropdownPosition';\nimport { glassStyle } from '../utils/glass';\nimport { useIsMobile } from '../shell/useIsMobile';\nimport { registerModalEscapeInterceptor } from '../shell/escapeInterceptors';\nimport { onOverlayOpen } from '../shell/overlayEvents';\nimport { Z_LAYERS } from '../shell/zLayers';\n\nexport interface SelectOption {\n value: string;\n label: string;\n /**\n * A second, muted line under the label IN THE OPEN LIST — what choosing this\n * option means, where the label alone is a term the user has to already know\n * (\"Net 30\", \"FOB\", \"Partial shipment\").\n *\n * Deliberately absent from the closed trigger: the trigger is one line in a\n * form row, and a two-line trigger changes the height of every field beside\n * it the moment one option grows a description.\n *\n * `NativeSelect` — and so `Select` on touch — ignores it. An `<option>` can\n * hold text and nothing else, and there is no honest way to render a second\n * line inside an OS picker. Reach for `SearchableSelect` when the secondary\n * text has to survive on a phone.\n */\n description?: string;\n disabled?: boolean;\n}\n\nexport interface SelectProps extends Omit<SelectHTMLAttributes<HTMLSelectElement>, 'onChange' | 'value' | 'className' | 'size'> {\n value: string;\n onChange: (value: string) => void;\n /**\n * Desktop rung, or `touch`. Defaults to `md`.\n *\n * On `Select` this sizes the DESKTOP branch only: the touch branch takes\n * `touchSize` instead and ignores this entirely. `NativeSelect` and\n * `ListboxSelect` are literal and use it on every viewport.\n *\n * This shadows the native `size` attribute (the number of rows a select\n * shows when it is rendered as a list box), which is omitted above rather\n * than left to collide. Nothing here has ever rendered as a list box — the\n * kit's Select is a dropdown — so no capability is lost.\n */\n size?: InputSize;\n /**\n * Rung for `Select`'s TOUCH branch. Defaults to `touch` (56px), which is the\n * point of the branch — see the Select doc-block.\n *\n * It exists because the default is not right for everyone and the previous\n * escape hatch was too expensive. `NativeSelect` sizes a select freely, but\n * it is a native `<select>` on the desktop too, which is BG#00421: the OS\n * popup swallows every key event, so shell hotkeys die while it is open.\n * That is the whole reason the desktop listbox exists, and no one should\n * have to give it up to render a 40px select on a phone.\n *\n * The case it is really for is a row of mixed controls. `Input`, `Textarea`,\n * `DatePicker`, `TimePicker`, `InputNumber` and `TagInput` all render the\n * rung they are given on every viewport, and `SearchableSelect` is pinned to\n * `INPUT_BASE` (the `md` rung) with no size axis at all — so a phone form\n * that puts a Select beside an unsized one of those now steps 56px against a\n * control a little over half that. Pass `touchSize=\"md\"` on the Select to\n * line the row back up.\n *\n * Only `Select` reads it. `NativeSelect` and `ListboxSelect` accept it and\n * ignore it, so it never reaches the DOM as an unknown attribute.\n */\n touchSize?: InputSize;\n options: SelectOption[];\n /** Shown as a disabled first option when no value is selected. */\n placeholder?: string;\n invalid?: boolean;\n className?: string;\n}\n\n\n/**\n * Raw native `<select>` styled to match the kit's inputs. This is the original\n * Select — kept as the mobile rendering and exported for callers that need a\n * real `HTMLSelectElement` (form posts, native attribute spread, focus).\n *\n * Literal about `size`: it renders the rung it is handed on every viewport,\n * which is what makes it the opt-out from `Select`'s branch entirely. Prefer\n * `Select`'s `touchSize` when you only want a different touch rung — this one\n * costs you the desktop listbox, and with it BG#00421.\n *\n * `touchSize` is pulled out and dropped: it is `Select`'s prop, and letting it\n * through `rest` would put an unknown attribute on the `<select>`.\n */\nexport const NativeSelect = forwardRef<HTMLSelectElement, SelectProps>(function NativeSelect(\n { value, onChange, options, placeholder, invalid, className = '', size, touchSize: _touchSize, ...rest },\n ref,\n) {\n return (\n <select\n ref={ref}\n value={value}\n onChange={e => onChange(e.target.value)}\n aria-invalid={invalid || undefined}\n className={inputClasses({ invalid, size, className: `pr-8 ${className}`.trim() })}\n {...rest}\n >\n {placeholder !== undefined && (\n <option value=\"\" disabled>{placeholder}</option>\n )}\n {options.map(o => (\n <option key={o.value} value={o.value} disabled={o.disabled}>{o.label}</option>\n ))}\n </select>\n );\n});\n\n/** Desktop custom listbox. Keeps DOM focus on the trigger and tracks the active\n * option with `aria-activedescendant` (the standard combobox pattern). */\nconst ListboxSelect = forwardRef<HTMLSelectElement, SelectProps>(function ListboxSelect(\n // `touchSize` is pulled out and dropped for the same reason as NativeSelect:\n // it is Select's prop, and `rest` lands on the hidden native <select>.\n { value, onChange, options, placeholder, invalid, className = '', id, disabled, size,\n touchSize: _touchSize, title,\n 'aria-describedby': describedBy, 'aria-label': ariaLabel, 'aria-labelledby': labelledBy, ...rest },\n ref,\n) {\n const [open, setOpen] = useState(false);\n const [active, setActive] = useState(-1);\n const wrapRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const listRef = useRef<HTMLDivElement>(null);\n const openRef = useRef(open);\n openRef.current = open;\n const typeahead = useRef<{ buffer: string; timer: ReturnType<typeof setTimeout> | null }>({ buffer: '', timer: null });\n\n const baseId = useId();\n const listboxId = `${baseId}-listbox`;\n const optionId = (i: number) => `${baseId}-opt-${i}`;\n\n // One shared placement helper for every anchored popup in the kit (UI-11):\n // it keeps the menu inside the shell window that owns the trigger, and\n // `matchTriggerWidth` is what makes this one read as a native <select>.\n const menuPos = useDropdownPosition(triggerRef, open, { matchTriggerWidth: true });\n const selectedIndex = options.findIndex(o => o.value === value);\n const selectedLabel = selectedIndex >= 0 ? options[selectedIndex].label : undefined;\n\n const close = useCallback((refocus = true) => {\n setOpen(false);\n setActive(-1);\n if (refocus) triggerRef.current?.focus();\n }, []);\n\n const openList = useCallback(() => {\n if (disabled) return;\n setActive(selectedIndex >= 0 ? selectedIndex : firstEnabledIndex(options));\n setOpen(true);\n }, [disabled, options, selectedIndex]);\n\n const commit = useCallback((i: number) => {\n const o = options[i];\n if (!o || o.disabled) return;\n onChange(o.value);\n close();\n }, [options, onChange, close]);\n\n // Esc closes the listbox first, WITHOUT closing any parent modal/window.\n // Modal's Escape handler runs on window in the CAPTURE phase, so it beats the\n // trigger's own (bubble-phase) onKeyDown — the only way to close the listbox\n // ahead of the modal is the shell's own interceptor seam, which the modal\n // consults before closing. The local onKeyDown below still handles Esc when\n // there is no modal in play (a plain page).\n useEffect(() => {\n if (!open) return;\n const unregister = registerModalEscapeInterceptor(e => {\n if (e.key !== 'Escape' || !openRef.current) return false;\n close();\n return true;\n });\n return unregister;\n }, [open, close]);\n\n // Close on outside pointer-down. The list is portaled to <body> (outside\n // wrapRef), so a click inside EITHER the trigger wrap or the portaled list\n // counts as inside. An overlay opening closes it too — the list is layered\n // above the overlay layer (see `overlayEvents.ts`) — without taking focus\n // back, since the overlay is about to claim it.\n useEffect(() => {\n if (!open) return;\n const handler = (e: PointerEvent) => {\n const t = e.target as Node;\n if (wrapRef.current?.contains(t) || listRef.current?.contains(t)) return;\n close(false);\n };\n document.addEventListener('pointerdown', handler);\n const offOverlay = onOverlayOpen(() => close(false));\n return () => {\n document.removeEventListener('pointerdown', handler);\n offOverlay();\n };\n }, [open, close]);\n\n // Keep the active option scrolled into view as it moves.\n useEffect(() => {\n if (!open || active < 0) return;\n listRef.current?.querySelector<HTMLElement>(`#${CSS.escape(optionId(active))}`)?.scrollIntoView({ block: 'nearest' });\n });\n\n const runTypeahead = useCallback((char: string) => {\n const ta = typeahead.current;\n if (ta.timer) clearTimeout(ta.timer);\n ta.buffer += char;\n ta.timer = setTimeout(() => { ta.buffer = ''; ta.timer = null; }, 500);\n const from = open ? active : selectedIndex;\n const hit = matchTypeahead(options, ta.buffer, from);\n if (hit < 0) return;\n if (open) setActive(hit);\n else commit(hit);\n }, [open, active, selectedIndex, options, commit]);\n\n const onKeyDown = (e: ReactKeyboardEvent<HTMLButtonElement>) => {\n if (disabled) return;\n switch (e.key) {\n case 'ArrowDown':\n e.preventDefault();\n if (!open) openList();\n else setActive(a => nextEnabledIndex(options, a, 1));\n return;\n case 'ArrowUp':\n e.preventDefault();\n if (!open) openList();\n else setActive(a => nextEnabledIndex(options, a, -1));\n return;\n case 'Home':\n if (open) { e.preventDefault(); setActive(firstEnabledIndex(options)); }\n return;\n case 'End':\n if (open) { e.preventDefault(); setActive(lastEnabledIndex(options)); }\n return;\n case 'Enter':\n if (open) { e.preventDefault(); commit(active); }\n return;\n case ' ':\n // Space opens the list, or selects the active option once open.\n e.preventDefault();\n if (!open) openList();\n else commit(active);\n return;\n case 'Escape':\n if (open) { e.preventDefault(); e.stopPropagation(); close(); }\n return;\n case 'Tab':\n if (open) close(false); // no preventDefault — let focus advance\n return;\n default:\n if (e.key.length === 1 && !e.metaKey && !e.ctrlKey && !e.altKey) {\n e.preventDefault();\n runTypeahead(e.key);\n }\n }\n };\n\n return (\n <div ref={wrapRef} className=\"relative\">\n <button\n ref={triggerRef}\n id={id}\n type=\"button\"\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n aria-expanded={open}\n aria-controls={open ? listboxId : undefined}\n aria-activedescendant={open && active >= 0 ? optionId(active) : undefined}\n aria-invalid={invalid || undefined}\n // These describe the CONTROL, and the control the user focuses is this\n // button — not the sr-only <select> behind it, which is where the\n // spread was putting them. An error message pointed at by a hidden\n // element is announced to nobody.\n aria-describedby={describedBy}\n aria-label={ariaLabel}\n aria-labelledby={labelledBy}\n // Same reasoning, one layer out: a `title` is a tooltip, and a tooltip\n // needs a hover. The hidden <select> is `sr-only` — a 1px clipped box\n // nobody's pointer can reach — so `title` riding `rest` onto it meant\n // the caller's explanation of an abbreviated or ambiguous field was\n // rendered where it could never be seen. It is also a fallback\n // accessible name when nothing else names the control, and a name on\n // an `aria-hidden` element names nothing.\n title={title}\n disabled={disabled}\n onClick={() => (open ? close() : openList())}\n onKeyDown={onKeyDown}\n className={inputClasses({ invalid, size, className: `pr-8 text-left ${className}`.trim() })}\n >\n <span className={`block truncate ${selectedLabel === undefined ? 'text-gray-400' : ''}`}>\n {selectedLabel ?? placeholder ?? ' '}\n </span>\n </button>\n <svg\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute right-2.5 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400\"\n fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" strokeWidth={2}\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M8.25 9l3.75-3.75L15.75 9M8.25 15l3.75 3.75L15.75 15\" />\n </svg>\n\n {/* Hidden native <select> carries the forwarded HTMLSelectElement ref and\n any spread native attributes (name, required, form posts…) so the\n public API stays honoured; it is not a tab stop and is hidden from AT. */}\n <select\n ref={ref}\n value={value}\n onChange={e => onChange(e.target.value)}\n disabled={disabled}\n aria-hidden=\"true\"\n tabIndex={-1}\n className=\"sr-only\"\n {...rest}\n >\n {placeholder !== undefined && <option value=\"\" disabled>{placeholder}</option>}\n {options.map(o => (\n <option key={o.value} value={o.value} disabled={o.disabled}>{o.label}</option>\n ))}\n </select>\n\n {open && createPortal(\n <div\n ref={listRef}\n id={listboxId}\n role=\"listbox\"\n // The dropdown must sit ABOVE the modal layer, not below it.\n //\n // It was z-[400], under Dialog and Drawer at z-[9999] — so a Select\n // inside a dialog, which is where form controls usually are, opened\n // its menu behind the dialog that owns it. Nothing looked broken;\n // the list simply was not there.\n //\n // Above the toasts too, deliberately: a menu is open only while the\n // user is holding it open, and a notification arriving underneath it\n // is better than one that covers what they are choosing from.\n className=\"fixed overflow-y-auto rounded-2xl py-1\"\n style={{\n zIndex: Z_LAYERS.popup,\n left: menuPos?.left,\n top: menuPos?.top,\n bottom: menuPos?.bottom,\n width: menuPos?.width,\n maxHeight: menuPos?.maxHeight ?? MENU_MAX_HEIGHT,\n visibility: menuPos ? undefined : 'hidden',\n ...glassStyle(),\n }}\n >\n {options.map((o, i) => (\n <div\n key={o.value}\n id={optionId(i)}\n role=\"option\"\n aria-selected={value === o.value}\n aria-disabled={o.disabled || undefined}\n onPointerEnter={() => { if (!o.disabled) setActive(i); }}\n onClick={() => commit(i)}\n className={`mx-1 cursor-pointer truncate rounded-lg px-3 py-1.5 text-sm\n ${o.disabled ? 'cursor-not-allowed text-gray-400'\n : i === active ? 'bg-blue-50 text-blue-700'\n : value === o.value ? 'font-medium text-blue-600'\n : 'text-gray-700'}`}\n >\n {/* Without a description the option is the bare label it has\n always been — same element, same classes, same markup. The\n two-line form is opt-in per option, so a list where one\n option explains itself does not restyle the rest. */}\n {o.description ? (\n <>\n <span className=\"block truncate\">{o.label}</span>\n {/* Its own ink, not the row's: the row goes blue when it is\n active or selected, and a description that followed would\n read as a second label rather than as a note. */}\n <span className=\"mt-0.5 block truncate text-xs font-normal text-gray-500\">{o.description}</span>\n </>\n ) : o.label}\n </div>\n ))}\n </div>,\n document.body,\n )}\n </div>\n );\n});\n\n/**\n * Smart Select: native `<select>` on touch, custom listbox on desktop.\n *\n * The touch branch takes `touchSize`, default `touch`, and DISCARDS whatever\n * desktop rung the caller asked for. That is not the component second-guessing\n * the caller — `sm`/`md`/`lg` are the desktop ladder, and this branch only ever\n * renders when there is no desktop. A rung off that ladder has nothing to say\n * about how big an OS picker should be under a finger.\n *\n * It had to be said out loud because the omission was a real defect: this\n * component already decided \"this is touch, give it the native picker\" and then\n * passed the desktop rung straight through, handing a finger a target under the\n * 44px WCAG 2.5.5 floor that `touchPrimitives.test.tsx` holds every Button rung\n * above. `size=\"lg\"` was measured at 39px on a device; the default `md` is a\n * rung shorter again (`py-1.5 text-sm` against `py-2 text-base`, so 8px off the\n * box), which puts it around 31px. The dealer portal's order filters were\n * exactly that.\n *\n * Note this reads the same signal that already picks the branch\n * (`(max-width: 767px), (pointer: coarse)`), so a narrow desktop window has\n * been getting the native picker all along — it now gets a native picker at a\n * touch size rather than a desktop size, which is the smaller surprise of the\n * two.\n *\n * `Button`'s docblock says nothing picks a touch size automatically, and that\n * still holds: it is about a DESKTOP portal not growing finger-sized controls\n * by accident. This branch cannot run on a desktop pointer at a desktop width.\n *\n * ── Where this leaves a mixed row ───────────────────────────────────────────\n *\n * Select is, for now, the ONLY control in the kit that picks its own touch\n * rung. `Input`, `Textarea`, `DatePicker`, `TimePicker`, `DateTimePicker`,\n * `InputNumber` and `TagInput` all render what they are given on every\n * viewport, and `SearchableSelect` has no size axis at all — it is pinned to\n * `INPUT_BASE`. So a phone form that stacks a Select against an unsized one of\n * those steps 56px against a control a little over half that, and a field that\n * renders a Select or an Input depending on its data (a country with states\n * versus one without, say) changes height with the data.\n *\n * That is a real cost and it is not paid off here: whether the whole ladder\n * should follow a finger is a bigger question than one control's hit target,\n * and answering it in `inputClasses` would move every text field in every\n * consumer. `touchSize=\"md\"` is the seam until it is answered — it lines a\n * Select back up with its neighbours without giving up the desktop listbox.\n *\n * `NativeSelect` remains the way out of the branch ENTIRELY, for a caller who\n * wants one raw native control on every viewport. It is the heavier door:\n * native on the desktop is BG#00421, the OS popup that swallows every key\n * event. Reach for `touchSize` first.\n */\nconst Select = forwardRef<HTMLSelectElement, SelectProps>(function Select(\n { touchSize = 'touch', ...props },\n ref,\n) {\n const isMobile = useIsMobile();\n // `touchSize` is destructured off on BOTH branches, so the desktop listbox\n // never sees it either — it would otherwise ride `rest` onto the hidden\n // native <select>.\n return isMobile\n ? <NativeSelect ref={ref} {...props} size={touchSize} />\n : <ListboxSelect ref={ref} {...props} />;\n});\n\nexport default Select;\n","/**\n * Checkbox — a styled native checkbox. Controlled via `checked` +\n * `onChange(checked)` (boolean, not the event — the kit idiom). When `label`\n * or `description` is given it renders inside a clickable `<label>` row.\n *\n * Uses `accent-blue-600`, which the theme system points at the active accent,\n * so the check fill follows the user's accent in both light and dark mode.\n */\nimport { forwardRef, useCallback, useEffect, useRef, type InputHTMLAttributes, type ReactNode } from 'react';\n\nexport interface CheckboxProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'onChange' | 'checked' | 'className'> {\n checked: boolean;\n onChange: (checked: boolean) => void;\n /**\n * Neither checked nor unchecked — the \"some of the rows below are selected\"\n * state on a select-all box.\n *\n * It has to be a prop because it cannot be an attribute: `indeterminate`\n * exists only as a DOM property, so passing it through JSX sets a bogus\n * attribute, logs \"Received `true` for a non-boolean attribute\", and leaves\n * the box looking unchecked. Set here through a ref instead.\n *\n * A native checkbox in this state reports itself as `mixed` to assistive\n * technology on its own, so no `aria-checked` is added — writing one would\n * risk contradicting the element.\n */\n indeterminate?: boolean;\n label?: ReactNode;\n description?: ReactNode;\n className?: string;\n}\n\nconst BOX =\n 'h-4 w-4 shrink-0 rounded border-gray-300 accent-blue-600 focus:outline-none ' +\n 'focus:ring-2 focus:ring-blue-400/30 disabled:cursor-not-allowed disabled:opacity-60';\n\nconst Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(function Checkbox(\n { checked, onChange, indeterminate = false, label, description, disabled, className = '', ...rest },\n ref,\n) {\n const inner = useRef<HTMLInputElement | null>(null);\n\n // `checked` is in the deps as well: React writes it on every render, and a\n // browser clears `indeterminate` whenever the checked state is assigned. So\n // this has to run after that, not only when `indeterminate` itself changes.\n useEffect(() => {\n if (inner.current) inner.current.indeterminate = indeterminate;\n }, [indeterminate, checked]);\n\n // The caller's ref still has to work — it is how a form library focuses the\n // field — so both are set.\n //\n // Memoised on `ref`: React detaches and reattaches a callback ref whenever\n // its identity changes, so a fresh closure each render meant the caller's ref\n // was handed `null` and then the node again on EVERY render, unrelated to\n // anything it cares about. Stable identity means it is called when the\n // element actually changes and not otherwise.\n const attachRef = useCallback((node: HTMLInputElement | null) => {\n inner.current = node;\n if (typeof ref === 'function') ref(node);\n else if (ref) ref.current = node;\n }, [ref]);\n\n const input = (extra = '') => (\n <input\n ref={attachRef}\n type=\"checkbox\"\n checked={checked}\n disabled={disabled}\n onChange={e => onChange(e.target.checked)}\n className={`${BOX} ${extra}`.trim()}\n {...rest}\n />\n );\n\n if (!label && !description) {\n return input(className);\n }\n return (\n <label className={`flex items-start gap-2 ${disabled ? 'cursor-not-allowed opacity-60' : 'cursor-pointer'} ${className}`.trim()}>\n {input('mt-0.5')}\n <span className=\"text-sm leading-tight\">\n {label && <span className=\"font-medium text-gray-700\">{label}</span>}\n {description && <span className=\"mt-0.5 block text-xs text-gray-500\">{description}</span>}\n </span>\n </label>\n );\n});\n\nexport default Checkbox;\n","/**\n * Radio — a styled native radio button. Group several by sharing the same\n * `name`; each is controlled via `checked` + `onChange(checked)` (fires when\n * this option becomes selected). Mirrors Checkbox; uses the accent fill.\n */\nimport { forwardRef, type InputHTMLAttributes, type ReactNode } from 'react';\n\nexport interface RadioProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'onChange' | 'checked' | 'className'> {\n checked: boolean;\n onChange: (checked: boolean) => void;\n label?: ReactNode;\n description?: ReactNode;\n className?: string;\n}\n\nconst DOT =\n 'h-4 w-4 shrink-0 border-gray-300 accent-blue-600 focus:outline-none ' +\n 'focus:ring-2 focus:ring-blue-400/30 disabled:cursor-not-allowed disabled:opacity-60';\n\nconst Radio = forwardRef<HTMLInputElement, RadioProps>(function Radio(\n { checked, onChange, label, description, disabled, className = '', ...rest },\n ref,\n) {\n if (!label && !description) {\n return (\n <input\n ref={ref}\n type=\"radio\"\n checked={checked}\n disabled={disabled}\n onChange={e => onChange(e.target.checked)}\n className={`${DOT} ${className}`.trim()}\n {...rest}\n />\n );\n }\n return (\n <label className={`flex items-start gap-2 ${disabled ? 'cursor-not-allowed opacity-60' : 'cursor-pointer'} ${className}`.trim()}>\n <input\n ref={ref}\n type=\"radio\"\n checked={checked}\n disabled={disabled}\n onChange={e => onChange(e.target.checked)}\n className={`${DOT} mt-0.5`}\n {...rest}\n />\n <span className=\"min-w-0 flex-1 text-sm leading-tight\">\n {label && <span className=\"block min-w-0 font-medium text-gray-700\">{label}</span>}\n {description && <span className=\"mt-0.5 block min-w-0 text-xs text-gray-500\">{description}</span>}\n </span>\n </label>\n );\n});\n\nexport default Radio;\n","/**\n * FormField — label + control + hint/error wrapper. The standard row for every\n * form in the kit: pass a control as `children`, a `label` (wired to it via\n * `htmlFor`), and either a `hint` (greyed helper) or an `error` (red, takes\n * precedence). Promotes the `Field` helper the demos used inline.\n *\n * The hint and the error are POINTED AT by the control, not merely rendered\n * near it: a single element child is cloned with `aria-describedby`. Without\n * that the ids this component generates reference nothing, and a screen-reader\n * user who focuses a field that failed validation hears the label and\n * \"invalid\" and never the reason. `role=\"alert\"` announces the message the\n * moment it appears; `aria-describedby` is what re-reads it on focus, and only\n * the second survives tabbing back to fix the field.\n *\n * The same clone carries `aria-invalid` while `error` is set. Every input in\n * the kit takes an `invalid` prop, so a caller had to pass the error here and\n * `invalid` there and keep the two in step by hand — and a field that missed\n * one is announced as valid while a red message sits under it. `error` is\n * already the statement that the field failed; nothing is learnt by being told\n * twice. A control that sets its own `aria-invalid` keeps it, so\n * `Input invalid` and the rest stay authoritative over their own attribute.\n *\n * `MediaUploadField` and `MediaUploadGrid` already wire exactly this by hand,\n * which is where the id shape comes from.\n */\nimport { Children, cloneElement, isValidElement, type ReactNode } from 'react';\n\nexport interface FormFieldProps {\n label?: ReactNode;\n /** id of the control, for label-for wiring. */\n htmlFor?: string;\n /** id for the `<label>` element itself, so a non-labelable control (e.g. a\n * `role=\"group\"` wrapper) can name itself via `aria-labelledby`. */\n labelId?: string;\n /** Greyed helper text below the control. */\n hint?: ReactNode;\n /** Red error text below the control — overrides `hint` when present. */\n error?: ReactNode;\n /** Append a red asterisk to the label. */\n required?: boolean;\n className?: string;\n children: ReactNode;\n}\n\nexport default function FormField({\n label, htmlFor, labelId, hint, error, required, className = '', children,\n}: FormFieldProps) {\n const describedBy = htmlFor\n ? (error ? `${htmlFor}-error` : hint ? `${htmlFor}-hint` : undefined)\n : undefined;\n\n // Only a single element child can be pointed at, and an existing\n // `aria-describedby` is kept and appended to rather than replaced — a\n // control may already describe itself with something this component knows\n // nothing about. Anything else (a fragment, a string, several controls in a\n // group) is left exactly as it was, and the caller wires it by hand as the\n // media fields do.\n type Described = { 'aria-describedby'?: string; 'aria-invalid'?: boolean | 'true' | 'false' };\n const child = Children.count(children) === 1 ? Children.only(children) : null;\n const element = isValidElement<Described>(child) ? child : null;\n const patch: Described = {};\n if (element) {\n if (describedBy) {\n patch['aria-describedby'] = [element.props['aria-describedby'], describedBy]\n .filter(Boolean).join(' ');\n }\n // Only ADD it. A control that states its own — `Input invalid={false}` on a\n // field the caller means to show an error under without marking invalid —\n // is the authority on its own attribute.\n if (error && element.props['aria-invalid'] === undefined) patch['aria-invalid'] = true;\n }\n const described = element && Object.keys(patch).length > 0\n ? cloneElement(element, patch)\n : children;\n\n return (\n <div className={className}>\n {label && (\n <label id={labelId} htmlFor={htmlFor} className=\"mb-1 block text-xs font-medium text-gray-600\">\n {label}\n {/* Decoration. `required` on the control is what assistive\n technology reads; exposed here it becomes part of the label —\n \"Company name star\" — on every required field of every form. */}\n {required && <span aria-hidden=\"true\" className=\"ml-0.5 text-red-500\">*</span>}\n </label>\n )}\n {described}\n {error ? (\n // A validation message appears after the user submits, without focus\n // moving to it. Without a live region it reaches nobody — and this is\n // the one status message a form cannot afford to lose.\n <p\n id={htmlFor ? `${htmlFor}-error` : undefined}\n role=\"alert\"\n className=\"mt-1 text-[11px] text-red-600\"\n >\n {error}\n </p>\n ) : hint ? (\n <p id={htmlFor ? `${htmlFor}-hint` : undefined} className=\"mt-1 text-[11px] text-gray-400\">{hint}</p>\n ) : null}\n </div>\n );\n}\n","/**\n * RadioGroup — one choice from a short, visible list.\n *\n * `Radio` has always been the single button; grouping them was the caller's\n * job, and the job is bigger than it looks. Every settings panel that did it by\n * hand had to remember the shared `name` (without which the buttons are not one\n * group and the arrow keys do nothing), a `role=\"radiogroup\"` wrapper, a label\n * that names the GROUP rather than any one option, and a hint/error pair wired\n * to it. Most remembered the first and the last.\n *\n * ── What this does NOT do ──\n * Keyboard movement. The options are real `<input type=\"radio\">` sharing one\n * `name`, which is what makes Arrow/Home/End move between them, skip the\n * disabled ones, wrap at the ends, and take the whole group out of the tab\n * order behind its selected member — all of it in the user agent, none of it\n * here. A hand-rolled roving-tabindex loop would have to `preventDefault` the\n * browser's own handling to avoid stepping twice, and would then own every one\n * of those behaviours for the rest of the component's life. See the spec for\n * what is asserted in its place and why.\n *\n * ── Why it composes `FormField` ──\n * Label, hint, error, the required asterisk and the id plumbing that points the\n * control at its own hint are already one component. Reimplementing them here\n * would be a second copy to drift — and it is the copy that went wrong in the\n * panels this replaces.\n *\n * `labelId` + `aria-labelledby` rather than `htmlFor`: a `<label for>` pointing\n * at a `<div role=\"radiogroup\">` names nothing, because a div is not a\n * labelable element. `MediaUploadGrid` wires a group the same way, and that is\n * where the shape comes from.\n */\nimport { useId, type ReactNode } from 'react';\n\nimport FormField from './FormField';\nimport Radio from './Radio';\n\nexport type RadioGroupOrientation = 'vertical' | 'horizontal';\n\nexport interface RadioGroupOption {\n value: string;\n label: ReactNode;\n /** A second, quieter line under the label — what picking this one means. */\n description?: ReactNode;\n disabled?: boolean;\n}\n\nexport interface RadioGroupProps {\n /** Names the GROUP. Rendered by `FormField` and pointed at by the group's\n * `aria-labelledby`. */\n label?: ReactNode;\n /** Greyed helper text under the options. */\n hint?: ReactNode;\n /** Red error text under the options — overrides `hint`, exactly as on\n * `FormField`. */\n error?: ReactNode;\n required?: boolean;\n /**\n * The shared `name` every option's input carries. Required, and NOT derived\n * from a generated id: this is what a native form posts under, and it is what\n * makes the browser treat the buttons as one group.\n */\n name: string;\n /** The selected option's value, or `null` for \"nothing chosen yet\". */\n value: string | null;\n onChange: (value: string) => void;\n options: RadioGroupOption[];\n /** Defaults to `vertical`. `horizontal` is for two or three short labels on\n * one line; it wraps rather than compressing. */\n orientation?: RadioGroupOrientation;\n /** Disables every option. An individual option disables itself. */\n disabled?: boolean;\n className?: string;\n}\n\nconst LAYOUT: Record<RadioGroupOrientation, string> = {\n vertical: 'flex flex-col gap-2',\n horizontal: 'flex flex-wrap items-start gap-x-6 gap-y-2',\n};\n\nexport default function RadioGroup({\n label,\n hint,\n error,\n required,\n name,\n value,\n onChange,\n options,\n orientation = 'vertical',\n disabled = false,\n className = '',\n}: RadioGroupProps) {\n const groupId = useId();\n const labelId = label ? `${groupId}-label` : undefined;\n\n return (\n <FormField\n label={label}\n labelId={labelId}\n htmlFor={groupId}\n hint={hint}\n error={error}\n required={required}\n className={className}\n >\n {/* A single element child, so FormField's clone reaches it: it is what\n adds `aria-describedby` for the hint/error and `aria-invalid` while\n an error is showing. Nothing is wired twice here. */}\n <div\n id={groupId}\n role=\"radiogroup\"\n aria-labelledby={labelId}\n // The asterisk FormField draws is decoration; this is the half a\n // screen reader announces.\n aria-required={required || undefined}\n className={LAYOUT[orientation]}\n >\n {options.map(o => (\n <Radio\n key={o.value}\n name={name}\n value={o.value}\n checked={value === o.value}\n // Radio reports the checked state of the input that changed, and a\n // native radio only ever changes INTO checked — so there is no\n // \"unselected\" event to forward, and the group never emits null.\n onChange={checked => { if (checked) onChange(o.value); }}\n label={o.label}\n description={o.description}\n disabled={disabled || o.disabled}\n />\n ))}\n </div>\n </FormField>\n );\n}\n","/**\n * FormErrorSummary — the error list at the top of a failed form.\n *\n * `FormField` announces its own error, which is right for one field and\n * useless as a map: a long form that fails validation in three places gives\n * a keyboard or screen-reader user no way to know how many problems there\n * are or where. This is the WCAG 3.3.1 pattern (as GOV.UK ships it): a\n * summary box that takes focus when the errors appear, listing each message\n * as a link that focuses the offending control.\n *\n * The links target CONTROL IDS — the same `htmlFor`/`id` the caller already\n * wires into FormField — so adopting the summary costs a list of\n * `{ fieldId, message }`, not a rewire. Renders nothing while `errors` is\n * empty, so it can sit permanently above the form.\n */\nimport { useEffect, useRef, type ReactNode } from 'react';\n\nimport { useShellStrings } from '../shell/strings';\n\nexport interface FormError {\n /** id of the offending control — the link focuses and scrolls to it. */\n fieldId: string;\n message: ReactNode;\n}\n\nexport interface FormErrorSummaryProps {\n errors: FormError[];\n /** Heading above the list. Defaults to the catalog's \"There is a problem\". */\n title?: ReactNode;\n /**\n * Move focus to the box when errors appear. Default true — focus is what\n * makes the failed submit perceivable without a screen reader announcing\n * it, and what puts the keyboard where the fixing starts. Turn it off only\n * when something else owns post-submit focus.\n */\n autoFocus?: boolean;\n className?: string;\n}\n\nexport default function FormErrorSummary({ errors, title, autoFocus = true, className = '' }: FormErrorSummaryProps) {\n const strings = useShellStrings();\n const boxRef = useRef<HTMLDivElement>(null);\n const hadErrors = useRef(false);\n\n // Focus when the summary APPEARS — not on every re-render while the user\n // works through the list, which would yank them back to the top per fix.\n useEffect(() => {\n const has = errors.length > 0;\n if (has && !hadErrors.current && autoFocus) boxRef.current?.focus();\n hadErrors.current = has;\n }, [errors.length > 0, autoFocus]); // eslint-disable-line react-hooks/exhaustive-deps\n\n if (errors.length === 0) return null;\n\n const focusField = (fieldId: string) => {\n const el = document.getElementById(fieldId);\n if (!el) return;\n el.scrollIntoView({ block: 'center' });\n (el as HTMLElement).focus();\n };\n\n return (\n <div\n ref={boxRef}\n role=\"alert\"\n tabIndex={-1}\n className={`rounded-md border border-red-300 bg-red-50 px-4 py-3 focus:outline-none focus-visible:ring-2 focus-visible:ring-red-400 ${className}`.trim()}\n >\n <h2 className=\"text-sm font-semibold text-red-800\">{title ?? strings.form.errorSummaryTitle}</h2>\n <ul className=\"mt-1.5 space-y-1\">\n {errors.map((e, i) => (\n <li key={`${e.fieldId}-${i}`}>\n <a\n href={`#${e.fieldId}`}\n onClick={event => { event.preventDefault(); focusField(e.fieldId); }}\n className=\"text-sm text-red-700 underline hover:text-red-900\"\n >\n {e.message}\n </a>\n </li>\n ))}\n </ul>\n </div>\n );\n}\n","/**\n * Label — standalone field label in the kit's style, for the rare case where\n * FormField's all-in-one wrapper isn't wanted. Most forms should use FormField.\n */\nimport { type LabelHTMLAttributes } from 'react';\n\nexport interface LabelProps extends LabelHTMLAttributes<HTMLLabelElement> {\n /** Append a red asterisk. */\n required?: boolean;\n}\n\nexport default function Label({ required, children, className = '', ...rest }: LabelProps) {\n return (\n <label className={`mb-1 block text-xs font-medium text-gray-600 ${className}`.trim()} {...rest}>\n {children}\n {required && <span className=\"ml-0.5 text-red-500\">*</span>}\n </label>\n );\n}\n","/**\n * Internal helpers shared by the upload primitives (`FilePicker`,\n * `MediaUploadField` single slot, `MediaUploadGrid` gallery) so the filename\n * derivation, the image-vs-video test, the accept-kind wording, the dropzone\n * look, the busy overlay and the filename badge live in one place (DRY /\n * SSoT). Not part of the public API except `mediaFileName`, which the field\n * re-exports. File INTAKE — dialog, drop, paste, validation — is\n * `useFileIntake`.\n */\nimport type { ReactNode } from 'react';\n\n/** `data:image/svg+xml;base64,…` → captures the `image` type and `svg+xml` subtype. */\nconst DATA_URL_RE = /^data:([a-z0-9!#$&^_.+-]+)\\/([a-z0-9!#$&^_.+-]+)/i;\n\n/**\n * Name a `data:` URL from its media type alone, never its payload.\n *\n * A data URL carries no path, so the generic derivation below would slice at\n * the `/` inside the media type and hand back the whole base64 body as the\n * \"filename\" — hundreds of kilobytes, straight into an `alt` attribute.\n *\n * \"data:image/png;base64,iVBORw0KGgo…\" → \"image.png\"\n * \"data:image/svg+xml;base64,PHN2Zy…\" → \"image.svg\"\n * \"data:image/vnd.microsoft.icon;base64,…\" → \"image.icon\"\n * \"data:,hello\" (no media type) → \"media\"\n */\nfunction dataUrlName(url: string): string {\n const m = DATA_URL_RE.exec(url);\n if (!m) return 'media';\n const [, type, subtype] = m;\n // `svg+xml` → `svg` (drop the structured-syntax suffix), then take the last\n // dot-segment of a tree'd subtype (`vnd.microsoft.icon` → `icon`) and shed a\n // vendor/experimental `x-` prefix (`x-icon` → `icon`).\n const ext = subtype.split('+')[0].split('.').pop()!.replace(/^x-/i, '');\n return ext ? `${type.toLowerCase()}.${ext.toLowerCase()}` : 'media';\n}\n\n/**\n * Derive a human filename from a media URL: drop the query string, strip a\n * 32-hex upload prefix, and URL-decode.\n *\n * \"/media/uploads/9f3…a1_My Clip.mp4?v=2\" → \"My Clip.mp4\"\n *\n * `data:` URLs have no path, so they are named from their media type instead\n * — see `dataUrlName`.\n */\nexport function mediaFileName(url: string): string {\n if (/^data:/i.test(url || '')) return dataUrlName(url);\n const path = (url || '').split('?')[0].split('#')[0];\n const last = path.substring(path.lastIndexOf('/') + 1);\n try {\n return decodeURIComponent(last.replace(/^[0-9a-f]{32}_/i, '')) || last || 'media';\n } catch {\n return last || 'media';\n }\n}\n\nconst VIDEO_EXT_RE = /\\.(mp4|webm|ogg|ogv|mov|m4v)(\\?|#|$)/i;\n\n/**\n * What kind of thing an `accept` string asks for, as the word the empty-state\n * copy uses: `image`, `video`, or the neutral `file`.\n */\nexport function mediaKindWord(accept: string): 'image' | 'video' | 'file' {\n const acceptsVideo = accept.includes('video');\n const acceptsImage = accept.includes('image') || accept === '*' || accept === '';\n if (acceptsVideo && !acceptsImage) return 'video';\n if (acceptsImage && !acceptsVideo) return 'image';\n return 'file';\n}\n\n/** The default dim prompt line for an empty zone: \"Upload an image\" / \"Upload a video\" / \"Upload a file\". */\nexport function mediaPromptLine(accept: string): string {\n const kind = mediaKindWord(accept);\n return `Upload ${kind === 'image' ? 'an image' : `a ${kind}`}`;\n}\n\n/**\n * The one dashed dropzone every upload primitive draws. `dragOver` is the\n * file-drag highlight; `locked` is disabled-or-busy. The classes are in the\n * documented Tailwind vocabulary so the dark theme's remaps apply to them.\n */\nexport function dropzoneClass(dragOver: boolean, locked: boolean, extra = ''): string {\n return [\n 'flex w-full flex-col items-center justify-center gap-1.5 rounded-lg border-2 border-dashed text-center transition-colors',\n locked ? 'cursor-not-allowed opacity-60' : 'cursor-pointer',\n dragOver ? 'border-blue-500 bg-blue-50' : 'border-gray-300 bg-gray-50 hover:bg-gray-100',\n extra,\n ].filter(Boolean).join(' ');\n}\n\n/**\n * Focus ring drawn inline: the kit's shipped stylesheet doesn't include the\n * Tailwind `focus:ring` machinery, so `focus:ring-*` classes paint nothing. An\n * inline box-shadow on focus is the reliable, theme-safe way to keep a zone's\n * focus visible (WCAG 2.4.7).\n */\nexport const FOCUS_RING = '0 0 0 2px rgba(59,130,246,0.45)';\n\n/** Translucent \"Uploading…\" cover over a zone or preview while the caller's transport runs. */\nexport function BusyOverlay({ label, rounded = 'rounded-lg' }: { label: ReactNode; rounded?: string }) {\n return (\n <div\n role=\"status\"\n className={`absolute inset-0 flex items-center justify-center gap-2 bg-white/60 ${rounded}`}\n >\n <Spinner />\n <span className=\"text-xs font-medium text-gray-600\">{label}</span>\n </div>\n );\n}\n\n/** Filename (or caption) strip along the bottom edge of a preview. */\nexport function FilenameBadge({ children }: { children: ReactNode }) {\n return (\n <span\n className=\"absolute inset-x-1 bottom-1 truncate rounded px-1.5 py-0.5 text-xs text-white\"\n style={{ background: 'rgba(0,0,0,0.6)' }}\n >\n {children}\n </span>\n );\n}\n\n/**\n * Best-effort image-vs-video guess for a preview: media type for a `data:`\n * URL, then extension, then the `accept` string when it is video-only. Callers\n * that mint extensionless blob URLs (the native fallback) track the MIME\n * themselves and OR it in.\n */\nexport function isVideoUrl(url: string | null | undefined, accept = ''): boolean {\n if (!url) return false;\n // A data URL states its kind in the media type and never carries an\n // extension, so `VIDEO_EXT_RE` can't match one — `data:video/mp4;base64,…`\n // would previously fall through and preview as a broken `<img>`. When the\n // type is present it is authoritative: an `image/*` data URL is not a video\n // even in a video-only picker. A typeless `data:,…` has nothing to go on and\n // falls through to the guess below.\n const data = DATA_URL_RE.exec(url);\n if (data) return data[1].toLowerCase() === 'video';\n const acceptsVideo = accept.includes('video');\n const acceptsImage = accept.includes('image') || accept === '*' || accept === '';\n return VIDEO_EXT_RE.test(url) || (acceptsVideo && !acceptsImage);\n}\n\n/** Spinner matching the kit's Button spinner — muted grey, `currentColor` fill. */\nexport function Spinner({ className = 'h-5 w-5' }: { className?: string }) {\n return (\n <svg className={`${className} animate-spin text-gray-400`} viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <circle className=\"opacity-25\" cx=\"12\" cy=\"12\" r=\"10\" stroke=\"currentColor\" strokeWidth=\"4\" />\n <path className=\"opacity-75\" fill=\"currentColor\" d=\"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z\" />\n </svg>\n );\n}\n\n/** ✕ — the remove affordance on a chip, a row, a thumbnail. Inherits colour. */\nexport function CloseGlyph({ className = 'h-4 w-4' }: { className?: string }) {\n return (\n <svg className={className} viewBox=\"0 0 20 20\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" aria-hidden=\"true\">\n <path d=\"M6 6l8 8M14 6l-8 8\" />\n </svg>\n );\n}\n\n/** Upload-arrow glyph — inherits colour, matching the kit's line-icon style. */\nexport function UploadGlyph({ className = 'h-6 w-6' }: { className?: string }) {\n return (\n <svg\n viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={1.6}\n strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\" className={className}\n >\n <path d=\"M12 15V4\" />\n <path d=\"M8 8l4-4 4 4\" />\n <path d=\"M4 15v3a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-3\" />\n </svg>\n );\n}\n","/**\n * MediaUploadField — the kit's standard \"choose a media asset\" control, and the\n * server-wide pattern for image / video slots across the EFFICIENT portals.\n *\n * Empty state: a dashed dropzone with an upload glyph, a dim prompt line, and a\n * link-style CTA (\"Choose from library or upload\"). Filled state: a preview\n * (image or video) with an optional filename badge and Replace / Remove actions.\n * Both states accept a dragged file.\n *\n * Presentational and controlled the kit way (`value` URL + `onChange(url)`), it\n * owns NO picker modal and NO upload/fetch — each portal has its own media\n * library and upload endpoint. Inject that via `onPick`: it fires on click and\n * on drop (with the dropped File, so the consumer can seed an immediate upload),\n * and the consumer resolves the selection back through `onChange`. With `onFile`\n * instead, the field owns the gesture — click opens the native dialog, a drop\n * lands on the zone — and hands the consumer the chosen `File` to upload\n * however it uploads everything else (harness PAT-10). With neither, the field\n * falls back to emitting an object-URL — handy for demos and staged-then-submit\n * forms (the field owns that blob URL's lifetime and revokes it on replace /\n * remove / unmount).\n *\n * Every gesture goes through `useFileIntake`, so `accept` and `maxSizeBytes`\n * are enforced on a drop exactly as the dialog enforces `accept` on a pick, and\n * a rejected file is announced.\n *\n * This is deliberately the SINGLE-slot field. Thumbnail grids, reorderable\n * zones, and attachment lists change for different reasons (SRP) and belong to a\n * sibling gallery primitive, not here.\n */\nimport { useEffect, useId, useRef, useState, type ReactNode } from 'react';\nimport Button from './Button';\nimport FormField from './FormField';\nimport {\n BusyOverlay, FilenameBadge, FOCUS_RING, dropzoneClass, isVideoUrl, mediaFileName, mediaPromptLine, Spinner, UploadGlyph,\n} from './mediaShared';\nimport { FileIntakeAlert, useFileIntake } from './useFileIntake';\n\nexport interface MediaUploadFieldProps {\n /** The current media URL. Empty string (or null/undefined) = the CTA state. */\n value?: string | null;\n /** Controlled channel — the newly-chosen URL, or `''` when cleared (Remove). */\n onChange: (url: string) => void;\n /**\n * Open the consumer's library/upload picker. Fires on click and on drop; the\n * dropped File (if any) is passed so the consumer can seed an immediate\n * upload. The consumer resolves the selection back through `onChange`.\n * Omit to fall back to a hidden native `<input type=file>` that emits an\n * object-URL (demos, staged-then-submit forms).\n */\n onPick?: (droppedFile?: File) => void;\n /**\n * Receive the chosen or dropped File — the field owns the gesture (native\n * dialog on click, drop on the zone) and the consumer owns the upload. Ignored\n * when `onPick` is set.\n */\n onFile?: (file: File) => void;\n\n // ── Field chrome (delegates to the shell FormField) ──\n /** Label rendered above the control. */\n label?: ReactNode;\n /** Greyed helper line below the control. */\n hint?: ReactNode;\n /** Red error line — overrides `hint`. */\n error?: ReactNode;\n /** Append a red asterisk to the label. */\n required?: boolean;\n className?: string;\n\n // ── Media ──\n /**\n * Native `accept` string. Drives the preview kind (image vs video), the\n * fallback file dialog, and the default empty-state copy. Default `image/*`.\n */\n accept?: string;\n /** Rejected above this many bytes, with the reason announced. */\n maxSizeBytes?: number;\n /** `object-fit` for the preview. Default `cover`; use `contain` for logos/SVG. */\n fit?: 'cover' | 'contain';\n /** Preview / dropzone height in px (applied via inline style). Default 112. */\n height?: number;\n\n // ── Empty-state copy (the target design's three lines) ──\n /** Dim prompt line, e.g. \"Upload a background video\". Default derived from `accept`. */\n placeholder?: ReactNode;\n /** The link-style CTA line. Default \"Choose from library or upload\". */\n cta?: ReactNode;\n /** Small kind hint under the CTA, e.g. \"PNG · JPG · WEBP\". */\n acceptHint?: ReactNode;\n\n // ── Filled-state controls ──\n /** Overlay the derived filename on the preview. Default true. */\n showFilename?: boolean;\n /** Show the Replace button when filled. Default true. */\n allowReplace?: boolean;\n /** Show the Remove button when filled. Default true. */\n allowRemove?: boolean;\n /** Relabel Replace, e.g. \"Change\". Default \"Replace\". */\n replaceLabel?: ReactNode;\n /** Relabel Remove, e.g. \"Clear\". Default \"Remove\". */\n removeLabel?: ReactNode;\n\n // ── State ──\n /** Busy: disable controls and show a spinner while the caller's upload runs. */\n busy?: boolean;\n /** Busy label. Default \"Uploading…\". */\n busyLabel?: ReactNode;\n /** Fully disable the control (no click, no drop, no actions). */\n disabled?: boolean;\n}\n\n/** Re-exported from the shared media helpers so `import { mediaFileName }` from\n * this module (and the package root) keeps working. */\nexport { mediaFileName } from './mediaShared';\n\nexport default function MediaUploadField({\n value,\n onChange,\n onPick,\n onFile,\n label,\n hint,\n error,\n required,\n className,\n accept = 'image/*',\n maxSizeBytes,\n fit = 'cover',\n height = 112,\n placeholder,\n cta = 'Choose from library or upload',\n acceptHint,\n showFilename = true,\n allowReplace = true,\n allowRemove = true,\n replaceLabel = 'Replace',\n removeLabel = 'Remove',\n busy = false,\n busyLabel = 'Uploading…',\n disabled = false,\n}: MediaUploadFieldProps) {\n const [focused, setFocused] = useState(false);\n const fieldId = useId();\n\n // The blob URL the native fallback minted (if any) and whether it is a video.\n // We own its lifetime: revoke the previous one whenever we replace it, and on\n // unmount, so the fallback path doesn't leak object URLs.\n const objectUrlRef = useRef<string | null>(null);\n const [videoBlobUrl, setVideoBlobUrl] = useState<string | null>(null);\n useEffect(() => () => {\n if (objectUrlRef.current) URL.revokeObjectURL(objectUrlRef.current);\n }, []);\n\n const locked = disabled || busy;\n // Extension first; then the MIME captured for an extensionless blob; then the\n // accept-kind heuristic. The blob check is what makes video preview correct in\n // the native fallback where the URL carries no extension.\n const isVideo = !!value && (isVideoUrl(value, accept) || value === videoBlobUrl);\n const dimLine = placeholder ?? mediaPromptLine(accept);\n\n /** Mint an object URL for the fallback path, revoking the previous one. */\n const emitObjectUrl = (file: File) => {\n if (objectUrlRef.current) URL.revokeObjectURL(objectUrlRef.current);\n const url = URL.createObjectURL(file);\n objectUrlRef.current = url;\n setVideoBlobUrl(file.type.startsWith('video/') ? url : null);\n onChange(url);\n };\n\n const clearValue = () => {\n if (objectUrlRef.current) {\n URL.revokeObjectURL(objectUrlRef.current);\n objectUrlRef.current = null;\n }\n setVideoBlobUrl(null);\n onChange('');\n };\n\n /** A file that passed every check: the injected picker, the consumer's uploader, or the object-URL fallback. */\n const deliver = (file: File) => {\n if (onPick) onPick(file);\n else if (onFile) onFile(file);\n else emitObjectUrl(file);\n };\n\n // One intake for the dialog and the drop. The drop handlers are shared by the\n // empty dropzone AND the filled preview so drag-to-replace works; a drop\n // carrying no file (dragged text/URL) is a no-op and never opens the dialog.\n const intake = useFileIntake({\n accept, maxSizeBytes, acceptHint, multiple: false, disabled: locked,\n onAccept: ([file]) => deliver(file),\n });\n const { dragOver } = intake;\n\n /** Click: the injected picker, or the native dialog. */\n const pick = () => {\n if (locked) return;\n if (onPick) onPick();\n else intake.open();\n };\n\n const previewName = value ? mediaFileName(value) : '';\n\n const filled = (\n <div>\n <div\n {...intake.zoneProps}\n className={[\n 'relative overflow-hidden rounded-md border bg-gray-100 transition-colors',\n dragOver ? 'border-blue-500' : 'border-gray-200',\n ].join(' ')}\n style={{ height }}\n >\n {isVideo ? (\n <video\n src={value ?? undefined}\n muted\n playsInline\n preload=\"metadata\"\n aria-label={previewName || undefined}\n className=\"h-full w-full\"\n style={{ objectFit: fit }}\n />\n ) : (\n <img src={value ?? undefined} alt={previewName} className=\"h-full w-full\" style={{ objectFit: fit }} />\n )}\n {showFilename && value && <FilenameBadge>{previewName}</FilenameBadge>}\n {busy && <BusyOverlay label={busyLabel} rounded=\"rounded-md\" />}\n </div>\n {!disabled && (allowReplace || allowRemove) && (\n <div className=\"mt-2 flex gap-2\">\n {allowReplace && (\n <Button id={fieldId} variant=\"secondary\" size=\"sm\" onClick={() => pick()} disabled={busy}>\n {replaceLabel}\n </Button>\n )}\n {allowRemove && (\n <Button variant=\"ghost\" size=\"sm\" onClick={clearValue} disabled={busy}>\n {removeLabel}\n </Button>\n )}\n </div>\n )}\n </div>\n );\n\n const empty = (\n <button\n type=\"button\"\n id={fieldId}\n onClick={() => pick()}\n disabled={locked}\n aria-label={typeof dimLine === 'string' ? dimLine : 'Upload media'}\n aria-busy={busy || undefined}\n aria-invalid={error ? true : undefined}\n aria-required={required || undefined}\n aria-describedby={error ? `${fieldId}-error` : hint ? `${fieldId}-hint` : undefined}\n onFocus={() => setFocused(true)}\n onBlur={() => setFocused(false)}\n {...intake.zoneProps}\n className={dropzoneClass(dragOver, locked)}\n style={{\n minHeight: height,\n outline: 'none',\n boxShadow: focused && !locked ? FOCUS_RING : undefined,\n }}\n >\n {busy ? (\n <span role=\"status\" className=\"flex flex-col items-center gap-1.5\">\n <Spinner />\n <span className=\"text-xs font-medium text-gray-500\">{busyLabel}</span>\n </span>\n ) : (\n <>\n <span className=\"text-gray-400\">\n <UploadGlyph />\n </span>\n <span className=\"px-3 text-xs text-gray-500\">{dimLine}</span>\n <span className=\"text-sm font-medium text-blue-600\">{cta}</span>\n {acceptHint && <span className=\"text-xs text-gray-400\">{acceptHint}</span>}\n </>\n )}\n </button>\n );\n\n return (\n <FormField label={label} htmlFor={fieldId} hint={hint} error={error} required={required} className={className}>\n {value ? filled : empty}\n {!onPick && <input {...intake.inputProps} />}\n <FileIntakeAlert rejections={intake.rejections} />\n </FormField>\n );\n}\n","import { useEffect, useRef, useState } from 'react';\nimport Button from './Button';\nimport MediaUploadField from './MediaUploadField';\nimport BrandMark, { type BrandMarkSlot, type BrandMarkSurface } from './BrandMark';\n\nexport interface BrandAssetPreview {\n label: string;\n slot: BrandMarkSlot;\n surface?: BrandMarkSurface;\n kind?: 'brand-slot' | 'browser-tab' | 'search-result';\n title?: string;\n url?: string;\n description?: string;\n}\n\nexport interface BrandAssetEditorProps {\n committedUrl?: string | null;\n committedHasAlpha?: boolean | null;\n committedIsLight?: boolean | null;\n /** Read-only inherited asset shown until this surface saves an override. */\n fallbackUrl?: string | null;\n fallbackHasAlpha?: boolean | null;\n fallbackIsLight?: boolean | null;\n subjectName: string;\n assetName: string;\n onSave: (file: File) => void | Promise<void>;\n onRemove: () => void | Promise<void>;\n accept?: string;\n acceptHint?: string;\n maxBytes?: number;\n previews?: BrandAssetPreview[];\n disabled?: boolean;\n}\n\nfunction actionNoun(assetName: string) {\n const words = assetName.trim().toLocaleLowerCase().split(/\\s+/);\n return words.at(-1) || 'image';\n}\n\n/**\n * Shared staged-upload surface for portal branding. Network and persistence\n * remain consumer-owned through onSave/onRemove; the file contract (`accept`,\n * `maxBytes`) is enforced by the field's shared intake on every gesture, and\n * the preview and file lifecycle are identical everywhere.\n */\nexport default function BrandAssetEditor({\n committedUrl,\n committedHasAlpha = null,\n committedIsLight = null,\n fallbackUrl,\n fallbackHasAlpha = null,\n fallbackIsLight = null,\n subjectName,\n assetName,\n onSave,\n onRemove,\n // `image/x-icon` alone rejects most real .ico files: browsers report them as\n // `image/vnd.microsoft.icon`, and some report nothing at all — hence the\n // extension rule, which the intake's `acceptsFile` matches on the file name.\n accept = 'image/png,image/x-icon,image/vnd.microsoft.icon,.ico,image/svg+xml,image/jpeg,image/webp',\n acceptHint = 'PNG · ICO · SVG · JPG · WEBP',\n maxBytes = 5 * 1024 * 1024,\n previews = [],\n disabled = false,\n}: BrandAssetEditorProps) {\n const objectUrlRef = useRef<string | null>(null);\n const [stagedFile, setStagedFile] = useState<File | null>(null);\n const [stagedUrl, setStagedUrl] = useState('');\n const [error, setError] = useState('');\n const [saving, setSaving] = useState(false);\n const [removing, setRemoving] = useState(false);\n const noun = actionNoun(assetName);\n const visibleUrl = stagedUrl || committedUrl || fallbackUrl || '';\n const visibleHasAlpha = stagedFile\n ? null : committedUrl ? committedHasAlpha : fallbackHasAlpha;\n const visibleIsLight = stagedFile\n ? null : committedUrl ? committedIsLight : fallbackIsLight;\n\n useEffect(() => () => {\n if (objectUrlRef.current) URL.revokeObjectURL(objectUrlRef.current);\n }, []);\n\n const discardObjectUrl = () => {\n if (!objectUrlRef.current) return;\n URL.revokeObjectURL(objectUrlRef.current);\n objectUrlRef.current = null;\n };\n\n /** A file the field already checked against `accept` and `maxBytes`. */\n const stage = (file: File) => {\n if (disabled) return;\n discardObjectUrl();\n const nextUrl = URL.createObjectURL(file);\n objectUrlRef.current = nextUrl;\n setStagedFile(file);\n setStagedUrl(nextUrl);\n setError('');\n };\n\n const save = async () => {\n if (!stagedFile || disabled || saving) return;\n setSaving(true);\n setError('');\n try {\n await onSave(stagedFile);\n discardObjectUrl();\n setStagedFile(null);\n setStagedUrl('');\n } catch (cause) {\n setError(cause instanceof Error ? cause.message : `Could not save ${noun}.`);\n } finally {\n setSaving(false);\n }\n };\n\n const remove = async () => {\n if (disabled || removing) return;\n if (stagedFile) {\n discardObjectUrl();\n setStagedFile(null);\n setStagedUrl('');\n setError('');\n return;\n }\n if (!committedUrl) return;\n setRemoving(true);\n setError('');\n try {\n await onRemove();\n } catch (cause) {\n setError(cause instanceof Error ? cause.message : `Could not remove ${noun}.`);\n } finally {\n setRemoving(false);\n }\n };\n\n return (\n <section aria-label={`${assetName} for ${subjectName}`} className=\"grid gap-4 lg:grid-cols-2\">\n <div className=\"rounded-lg border border-gray-200 bg-white p-4\">\n <MediaUploadField\n value={visibleUrl}\n onChange={() => {}}\n onFile={stage}\n label={assetName}\n hint={error || `Used for ${subjectName}.`}\n error={error || undefined}\n accept={accept}\n acceptHint={acceptHint}\n maxSizeBytes={maxBytes}\n fit=\"contain\"\n height={180}\n allowRemove={false}\n busy={saving || removing}\n disabled={disabled}\n />\n <div className=\"mt-3 flex flex-wrap gap-2\">\n <Button onClick={save} disabled={!stagedFile || disabled} loading={saving}>\n Save {noun}\n </Button>\n {(stagedFile || committedUrl) && (\n <Button variant=\"ghost-danger\" onClick={remove} disabled={disabled} loading={removing}>\n {stagedFile ? 'Discard change' : `Remove ${noun}`}\n </Button>\n )}\n </div>\n </div>\n {previews.length > 0 && (\n <div className=\"rounded-lg border border-gray-200 bg-white p-4\" aria-label={`${assetName} previews`}>\n <h3 className=\"text-sm font-semibold text-gray-900\">Preview</h3>\n <div className=\"mt-3 grid gap-3\">\n {previews.map(preview => {\n const mark = (\n <BrandMark\n src={visibleUrl}\n alt={`${subjectName} ${assetName}`}\n slot={preview.slot}\n surface={preview.surface}\n adaptive\n hasAlpha={visibleHasAlpha}\n isLight={visibleIsLight}\n size={preview.kind === 'browser-tab' ? 16 : undefined}\n />\n );\n return (\n <div\n key={`${preview.label}-${preview.slot}-${preview.surface ?? 'light'}`}\n data-brand-preview\n className={preview.surface === 'dark' ? 'text-white' : 'text-gray-900'}\n >\n <div className=\"mb-2 text-xs font-medium text-gray-500\">{preview.label}</div>\n {preview.kind === 'browser-tab' ? (\n <div className=\"flex items-end gap-1 border-b border-gray-200\">\n <div className=\"flex max-w-[220px] items-center gap-2 rounded-t-lg border border-b-0 border-gray-200 bg-white px-3 py-2\">\n {mark}\n <span className=\"truncate text-xs text-gray-700\">{preview.title ?? subjectName}</span>\n <span className=\"text-gray-400\">×</span>\n </div>\n <span className=\"mb-1 ml-1 text-gray-400\">+</span>\n </div>\n ) : preview.kind === 'search-result' ? (\n <div className=\"rounded-lg border border-gray-200 bg-white p-3\">\n <div className=\"flex items-center gap-2\">\n <span className=\"flex h-7 w-7 shrink-0 items-center justify-center overflow-hidden rounded-full border border-gray-200 bg-gray-50\">{mark}</span>\n <div className=\"min-w-0 leading-tight\">\n <div className=\"truncate text-xs font-medium text-gray-700\">{preview.title ?? subjectName}</div>\n {preview.url && <div className=\"truncate text-xs text-gray-400\">{preview.url}</div>}\n </div>\n </div>\n <div className=\"mt-1.5 text-sm font-medium text-blue-700\">{preview.title ?? subjectName}</div>\n {preview.description && <div className=\"text-xs text-gray-500\">{preview.description}</div>}\n </div>\n ) : (\n <div className={[\n 'flex items-center gap-3 rounded-md border border-gray-200 p-3',\n preview.surface === 'dark' ? 'bg-gray-900 text-white' : 'bg-white text-gray-900',\n ].join(' ')}>\n {mark}\n <span className=\"text-sm\">{preview.title ?? preview.label}</span>\n </div>\n )}\n </div>\n );\n })}\n </div>\n </div>\n )}\n </section>\n );\n}\n","import {\n createContext,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from 'react';\n\nexport type PublicPortal = 'dealer' | 'customer' | 'supplier';\n\nexport interface PublicPortalBranding {\n portal: PublicPortal;\n company_name: string | null;\n logo_url: string | null;\n logo_on_dark_url: string | null;\n logo_square_url: string | null;\n favicon_url: string | null;\n logo_has_alpha: boolean | null;\n logo_is_light: boolean | null;\n logo_square_has_alpha: boolean | null;\n logo_square_is_light: boolean | null;\n}\n\nexport interface ResolvedPortalBrandAsset {\n src: string | null;\n hasAlpha: boolean | null;\n isLight: boolean | null;\n adaptive: boolean;\n}\n\n/**\n * Select one tenant-owned asset and its matching display metadata. Compact\n * hints must never be borrowed from the primary wordmark; a dedicated dark\n * variant is authoritative for that surface and therefore needs no treatment.\n */\nexport function resolvePortalBrandAsset(\n branding: PublicPortalBranding,\n options: { preferSquare?: boolean; surface?: 'light' | 'dark' } = {},\n): ResolvedPortalBrandAsset {\n if (options.preferSquare && branding.logo_square_url) {\n return {\n src: branding.logo_square_url,\n hasAlpha: branding.logo_square_has_alpha,\n isLight: branding.logo_square_is_light,\n adaptive: true,\n };\n }\n if (options.surface === 'dark' && branding.logo_on_dark_url) {\n return {\n src: branding.logo_on_dark_url,\n hasAlpha: null,\n isLight: null,\n adaptive: false,\n };\n }\n return {\n src: branding.logo_url,\n hasAlpha: branding.logo_has_alpha,\n isLight: branding.logo_is_light,\n adaptive: true,\n };\n}\n\nexport interface PortalBrandingContextValue {\n branding: PublicPortalBranding;\n loading: boolean;\n error: Error | null;\n}\n\nexport interface PortalBrandingProviderProps {\n load: (signal?: AbortSignal) => Promise<PublicPortalBranding>;\n fallback: PublicPortalBranding;\n /** Consistent browser title derived from the hostname-scoped public identity. */\n documentTitle?: (branding: PublicPortalBranding) => string;\n children: ReactNode;\n}\n\nconst PortalBrandingContext = createContext<PortalBrandingContextValue | null>(null);\n\nfunction applyFavicon(url: string | null) {\n const selector = 'link[data-portal-branding=\"favicon\"]';\n const existing = document.head.querySelector<HTMLLinkElement>(selector);\n if (!url) {\n existing?.remove();\n return;\n }\n const link = existing ?? document.createElement('link');\n link.rel = 'icon';\n link.href = url;\n link.dataset.portalBranding = 'favicon';\n if (!existing) document.head.appendChild(link);\n}\n\n/**\n * Loads pre-auth, hostname-scoped identity without reading or mutating the\n * signed-in session. Consumers inject the HTTP adapter; the shared lifecycle,\n * fallback and document favicon behaviour stay consistent across portals.\n */\nexport function PortalBrandingProvider({\n load,\n fallback,\n documentTitle,\n children,\n}: PortalBrandingProviderProps) {\n const [branding, setBranding] = useState(fallback);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n // Held in refs, not in the dependency list. `load` and `fallback` come from\n // the consumer, and the natural way to mount this provider passes an inline\n // arrow and an inline object literal — new identities on every render of the\n // app root. Depending on them made ANY unrelated ancestor render (a route\n // change, an auth refresh) abort the in-flight request and start another,\n // resetting `branding` to the fallback on the way: the tenant's title,\n // favicon and logo visibly reverted and re-resolved each time. Measured at\n // 4 loads and 3 aborts for 3 ancestor renders.\n const loadRef = useRef(load);\n const fallbackRef = useRef(fallback);\n loadRef.current = load;\n fallbackRef.current = fallback;\n\n useEffect(() => {\n const controller = new AbortController();\n let current = true;\n setBranding(fallbackRef.current);\n setLoading(true);\n setError(null);\n loadRef.current(controller.signal).then(\n result => {\n if (!current) return;\n setBranding(result);\n setLoading(false);\n },\n cause => {\n if (!current) return;\n setError(cause instanceof Error ? cause : new Error('Could not load portal branding.'));\n setLoading(false);\n },\n );\n return () => {\n current = false;\n controller.abort();\n };\n }, []);\n\n useEffect(() => {\n applyFavicon(branding.favicon_url);\n // Only the link this provider owns is removed — the host's own static\n // <link rel=\"icon\"> is never touched, so unmounting restores it.\n return () => applyFavicon(null);\n }, [branding.favicon_url]);\n\n useEffect(() => {\n if (documentTitle) document.title = documentTitle(branding);\n }, [branding, documentTitle]);\n\n const value = useMemo(() => ({ branding, loading, error }), [branding, loading, error]);\n return <PortalBrandingContext.Provider value={value}>{children}</PortalBrandingContext.Provider>;\n}\n\nexport function usePortalBranding() {\n const value = useContext(PortalBrandingContext);\n if (!value) throw new Error('usePortalBranding must be used inside PortalBrandingProvider.');\n return value;\n}\n","/**\n * MediaUploadGrid — the kit's standard MULTI-image / video gallery uploader, and\n * the sibling of {@link MediaUploadField}. Where the field owns one slot, the\n * grid owns a list: a thumbnail grid with an \"+ Add\" tile, per-thumb remove,\n * optional drag-to-reorder, and an optional \"cover\" badge on the first item.\n * Empty, it shows the same dashed dropzone as the single field.\n *\n * Presentational and controlled: it renders the `items` you pass and reports\n * intent through callbacks — it owns NO picker modal, NO upload, and NO ordering\n * logic. Adding is either INJECTED via `onPick(droppedFile?)` — the consumer\n * opens its own library picker on click — or OWNED here via `onFiles(files)`:\n * the grid opens the native dialog on click, takes a drop of any number of\n * files, and hands the consumer every file that passed `accept`, `maxSizeBytes`\n * and `maxFiles` (harness PAT-10). Removing is `onRemove(id)`; reordering is\n * `onReorder(from, to)`. The consumer resolves each into its own state / API.\n * Shares `mediaFileName`, the dropzone look and the intake path with\n * {@link MediaUploadField} (DRY / SSoT).\n */\nimport { useId, useState, type DragEvent, type FocusEvent, type KeyboardEvent, type ReactNode } from 'react';\nimport FormField from './FormField';\nimport {\n BusyOverlay, FilenameBadge, FOCUS_RING, dropzoneClass, isVideoUrl, mediaFileName, mediaPromptLine, UploadGlyph,\n} from './mediaShared';\nimport { FileIntakeAlert, useFileIntake } from './useFileIntake';\n\nexport interface MediaUploadGridItem {\n /** Stable key — used for React keys, remove, and reorder. */\n id: string;\n /** Preview URL. */\n url: string;\n /** `image` | `video`. Inferred from the URL when omitted. */\n kind?: 'image' | 'video';\n /** Optional label overlaid on the thumbnail (filename, dimensions, …). */\n caption?: ReactNode;\n /** Force the \"cover\" badge on this item (else `showCover` badges the first). */\n cover?: boolean;\n}\n\nexport interface MediaUploadGridProps {\n /** The gallery contents, in display order. */\n items: MediaUploadGridItem[];\n /**\n * Open the consumer's library/upload flow. Fires on click of the Add tile /\n * empty dropzone and on a file drop onto the zone (the dropped File is passed\n * so the consumer can seed an immediate upload). Without it the gallery is\n * read-only for additions (no Add tile, no drop).\n */\n onPick?: (droppedFile?: File) => void;\n /**\n * Receive every chosen or dropped File that passed the checks — the grid owns\n * the gesture (native dialog on the Add tile / empty zone, drop on the zone)\n * and the consumer owns the upload. With `onPick` also set, click goes to the\n * picker and a drop comes here.\n */\n onFiles?: (files: File[]) => void;\n /** Remove one item. The per-thumb ✕ shows only when this is provided. */\n onRemove?: (id: string) => void;\n /**\n * Reorder within the grid. Enables drag-to-reorder when provided; called with\n * the source and target indices on drop.\n */\n onReorder?: (fromIndex: number, toIndex: number) => void;\n\n // ── Field chrome (delegates to the shell FormField) ──\n label?: ReactNode;\n hint?: ReactNode;\n error?: ReactNode;\n required?: boolean;\n className?: string;\n\n // ── Media ──\n /** Native accept string — drives preview kind, the drop filter, and the copy. Default `image/*`. */\n accept?: string;\n /** Rejected above this many bytes, with the reason announced. */\n maxSizeBytes?: number;\n /** Rejected once the gallery holds this many items. */\n maxFiles?: number;\n /** `object-fit` for the thumbnails. Default `cover`. */\n fit?: 'cover' | 'contain';\n /** Thumbnail (and Add tile) square size in px. Default 96. */\n thumbSize?: number;\n\n // ── Empty-state copy (shared with MediaUploadField) ──\n /** Dim prompt line on the empty dropzone. Default derived from `accept`. */\n placeholder?: ReactNode;\n /** The link CTA on the empty dropzone. Default \"Choose from library or upload\". */\n cta?: ReactNode;\n /** Small kind hint under the CTA, e.g. \"PNG · JPG · WEBP\". */\n acceptHint?: ReactNode;\n\n // ── Cover badge ──\n /** Badge the first item (or the one with `cover`) as the gallery cover. Default false. */\n showCover?: boolean;\n /** Cover badge text. Default \"Cover\". */\n coverLabel?: ReactNode;\n\n // ── State ──\n /** Busy: dim the zone and show a spinner while the caller's upload runs. */\n busy?: boolean;\n /** Busy label. Default \"Uploading…\". */\n busyLabel?: ReactNode;\n /** Disable all interaction. */\n disabled?: boolean;\n /** View only — thumbnails without Add / remove / reorder affordances. */\n readOnly?: boolean;\n}\n\nconst REMOVE_ICON = (\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" aria-hidden=\"true\" className=\"h-3 w-3\">\n <path d=\"M6 6l12 12M18 6L6 18\" />\n </svg>\n);\n\nexport default function MediaUploadGrid({\n items,\n onPick,\n onFiles,\n onRemove,\n onReorder,\n label,\n hint,\n error,\n required,\n className,\n accept = 'image/*',\n maxSizeBytes,\n maxFiles,\n fit = 'cover',\n thumbSize = 96,\n placeholder,\n cta = 'Choose from library or upload',\n acceptHint,\n showCover = false,\n coverLabel = 'Cover',\n busy = false,\n busyLabel = 'Uploading…',\n disabled = false,\n readOnly = false,\n}: MediaUploadGridProps) {\n const gridId = useId();\n const [draggingIndex, setDraggingIndex] = useState<number | null>(null);\n // Which focusable control holds focus, so we can draw an inline focus ring —\n // the kit's shipped stylesheet has no Tailwind focus/ring machinery to fall\n // back on (see MediaUploadField). Keyed per control (zone/add/rm:<id>/thumb:<id>).\n const [focusedKey, setFocusedKey] = useState<string | null>(null);\n const ringStyle = (key: string) => ({\n outline: 'none' as const,\n ...(focusedKey === key && !locked ? { boxShadow: FOCUS_RING } : {}),\n });\n const blurKey = (key: string) => setFocusedKey(k => (k === key ? null : k));\n\n const locked = disabled || busy;\n const canAdd = (!!onPick || !!onFiles) && !locked && !readOnly;\n const canRemove = !!onRemove && !locked && !readOnly;\n const reorderEnabled = !!onReorder && !locked && !readOnly;\n\n const dimLine = placeholder ?? mediaPromptLine(accept);\n\n // Zone-level intake handles EXTERNAL file drops and the native dialog. Every\n // file that passes the checks is delivered — one `onFiles` call, or one\n // `onPick` per file for a consumer on the injected-picker contract. Internal\n // reorder drags carry no `Files` type, so the zone ignores them.\n const intake = useFileIntake({\n accept, maxSizeBytes, maxFiles, acceptHint, multiple: true, disabled: !canAdd,\n currentCount: items.length,\n onAccept: files => {\n if (onFiles) onFiles(files);\n else for (const file of files) onPick!(file);\n },\n });\n const zoneDragOver = intake.dragOver;\n\n /** Click on the Add tile / empty zone: the injected picker, or the native dialog. */\n const pick = () => {\n if (!canAdd) return;\n if (onPick) onPick();\n else intake.open();\n };\n\n const square = { width: thumbSize, height: thumbSize } as const;\n\n const thumb = (item: MediaUploadGridItem, index: number) => {\n const video = item.kind ? item.kind === 'video' : isVideoUrl(item.url, accept);\n const name = mediaFileName(item.url);\n const isCover = showCover && (item.cover ?? index === 0);\n return (\n <div\n key={item.id}\n draggable={reorderEnabled || undefined}\n onDragStart={\n reorderEnabled\n ? (e: DragEvent) => {\n // setData is required for Firefox to start the drag; the payload\n // is unused (we track the source via `draggingIndex`).\n e.dataTransfer.effectAllowed = 'move';\n e.dataTransfer.setData('text/plain', String(index));\n setDraggingIndex(index);\n }\n : undefined\n }\n onDragEnd={reorderEnabled ? () => setDraggingIndex(null) : undefined}\n onDragOver={\n reorderEnabled\n ? (e: DragEvent) => {\n if (draggingIndex == null) return;\n e.preventDefault();\n e.stopPropagation();\n }\n : undefined\n }\n onDrop={\n reorderEnabled\n ? (e: DragEvent) => {\n if (draggingIndex == null) return;\n e.preventDefault();\n e.stopPropagation();\n if (draggingIndex !== index) onReorder!(draggingIndex, index);\n setDraggingIndex(null);\n }\n : undefined\n }\n tabIndex={reorderEnabled ? 0 : undefined}\n aria-label={reorderEnabled ? `${name}, item ${index + 1} of ${items.length}. Use arrow keys to reorder.` : undefined}\n onKeyDown={\n reorderEnabled\n ? (e: KeyboardEvent) => {\n if (e.key === 'ArrowLeft' || e.key === 'ArrowUp') {\n if (index > 0) { e.preventDefault(); onReorder!(index, index - 1); }\n } else if (e.key === 'ArrowRight' || e.key === 'ArrowDown') {\n if (index < items.length - 1) { e.preventDefault(); onReorder!(index, index + 1); }\n }\n }\n : undefined\n }\n onFocus={reorderEnabled ? (e: FocusEvent) => { if (e.target === e.currentTarget) setFocusedKey(`thumb:${item.id}`); } : undefined}\n onBlur={reorderEnabled ? (e: FocusEvent) => { if (e.target === e.currentTarget) blurKey(`thumb:${item.id}`); } : undefined}\n className={[\n 'relative shrink-0 overflow-hidden rounded-md border border-gray-200 bg-gray-100',\n draggingIndex === index ? 'opacity-50' : '',\n ].join(' ')}\n style={{ ...square, cursor: reorderEnabled ? 'move' : undefined, ...ringStyle(`thumb:${item.id}`) }}\n >\n {video ? (\n <video src={item.url} muted playsInline preload=\"metadata\" aria-label={name} className=\"h-full w-full\" style={{ objectFit: fit }} />\n ) : (\n <img src={item.url} alt={name} className=\"h-full w-full\" style={{ objectFit: fit }} />\n )}\n\n {isCover && (\n <span className=\"absolute left-1 top-1 rounded bg-blue-600 px-1.5 py-0.5 text-xs font-medium text-white\">\n {coverLabel}\n </span>\n )}\n\n {item.caption != null && <FilenameBadge>{item.caption}</FilenameBadge>}\n\n {canRemove && (\n <button\n type=\"button\"\n onClick={() => onRemove!(item.id)}\n aria-label={`Remove ${name}`}\n onFocus={() => setFocusedKey(`rm:${item.id}`)}\n onBlur={() => blurKey(`rm:${item.id}`)}\n className=\"absolute right-1 top-1 flex h-5 w-5 items-center justify-center rounded-full text-white\"\n style={{ background: 'rgba(0,0,0,0.55)', ...ringStyle(`rm:${item.id}`) }}\n >\n {REMOVE_ICON}\n </button>\n )}\n </div>\n );\n };\n\n const addTile = canAdd && (\n <button\n type=\"button\"\n onClick={() => pick()}\n aria-label=\"Add media\"\n onFocus={() => setFocusedKey('add')}\n onBlur={() => blurKey('add')}\n className=\"flex shrink-0 flex-col items-center justify-center gap-1 rounded-md border-2 border-dashed border-gray-300 bg-gray-50 text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-500\"\n style={{ ...square, ...ringStyle('add') }}\n >\n <UploadGlyph className=\"h-5 w-5\" />\n <span className=\"text-xs font-medium text-gray-500\">Add</span>\n </button>\n );\n\n // Empty state: the shared dashed dropzone (only when the caller can add).\n const emptyDropzone = canAdd ? (\n <button\n type=\"button\"\n onClick={() => pick()}\n aria-label={typeof dimLine === 'string' ? dimLine : 'Upload media'}\n onFocus={() => setFocusedKey('zone')}\n onBlur={() => blurKey('zone')}\n className={dropzoneClass(zoneDragOver, false)}\n style={{ minHeight: thumbSize + 32, ...ringStyle('zone') }}\n >\n <span className=\"text-gray-400\"><UploadGlyph /></span>\n <span className=\"px-3 text-xs text-gray-500\">{dimLine}</span>\n <span className=\"text-sm font-medium text-blue-600\">{cta}</span>\n {acceptHint && <span className=\"text-xs text-gray-400\">{acceptHint}</span>}\n </button>\n ) : (\n <div\n className=\"flex w-full items-center justify-center rounded-lg border border-gray-200 bg-gray-50 px-3 text-xs text-gray-400\"\n style={{ minHeight: thumbSize + 32 }}\n >\n No media.\n </div>\n );\n\n return (\n <FormField label={label} labelId={label ? `${gridId}-label` : undefined} htmlFor={gridId} hint={hint} error={error} required={required} className={className}>\n <div\n id={gridId}\n role=\"group\"\n aria-labelledby={label ? `${gridId}-label` : undefined}\n aria-describedby={error ? `${gridId}-error` : hint ? `${gridId}-hint` : undefined}\n aria-busy={busy || undefined}\n {...intake.zoneProps}\n className=\"relative rounded-lg transition-colors\"\n style={{\n ...(locked ? { opacity: 0.6 } : {}),\n // Inline box-shadow, not `ring-*` — the kit's shipped stylesheet has no\n // Tailwind ring machinery (see MediaUploadField's focus ring).\n ...(zoneDragOver ? { boxShadow: '0 0 0 2px rgba(59,130,246,0.5)' } : {}),\n }}\n >\n {items.length === 0 ? (\n emptyDropzone\n ) : (\n <div className=\"flex flex-wrap gap-2\">\n {items.map(thumb)}\n {addTile}\n </div>\n )}\n\n {busy && <BusyOverlay label={busyLabel} />}\n </div>\n {!onPick && onFiles && <input {...intake.inputProps} />}\n <FileIntakeAlert rejections={intake.rejections} />\n </FormField>\n );\n}\n","/**\n * Calendar — a month grid you can actually drive from the keyboard.\n *\n * Written because `DateRangePicker` had one inline and it was a `<div>` of 42\n * unlabelled buttons. Concretely, what that cost:\n *\n * - No arrow keys. Reaching the 20th meant twenty presses of Tab, and Tab out\n * of the calendar meant twenty more to get back.\n * - Each cell's accessible name was its number. \"15\" — of which month, of\n * which year? The heading was elsewhere and not associated with the grid.\n * - No grid semantics, so a screen reader announced a list of buttons rather\n * than a date table, and there was no way to know which one was chosen.\n *\n * It is one component rather than one per picker because the grid is the same\n * grid whether the caller wants one date or two: `DatePicker`, `DateRangePicker`\n * and anything a portal writes later all get the keyboard model and the ARIA\n * from here, once.\n *\n * ── Dates are local, never UTC ──\n * Same rule the rest of the kit follows: `new Date('2026-08-11')` is UTC\n * midnight and therefore the 10th anywhere west of Greenwich. Nothing here\n * parses a date string with the Date constructor; a `YYYY-MM-DD` is split into\n * three integers and rebuilt with the local constructor, and serialised back by\n * reading local calendar fields.\n */\nimport { useEffect, useMemo, useRef, useState, type KeyboardEvent } from 'react';\n\nexport type CalendarMode = 'single' | 'range';\n\nexport interface CalendarProps {\n /** `YYYY-MM-DD`, or null. In range mode this is the start. */\n value?: string | null;\n /** Range end. Ignored when `mode` is `single`. */\n endValue?: string | null;\n mode?: CalendarMode;\n onSelect: (date: string) => void;\n /** Earliest selectable day, `YYYY-MM-DD`. */\n min?: string | null;\n /** Latest selectable day, `YYYY-MM-DD`. */\n max?: string | null;\n /**\n * Which month is shown, `YYYY-MM`. Supplying it makes the view CONTROLLED:\n * paging reports through `onMonthChange` and the grid stays put until the\n * caller moves it. Use {@link defaultMonth} to only set where it opens.\n */\n month?: string;\n /** Where an uncontrolled grid opens. Falls back to the selected date's month, then today's. */\n defaultMonth?: string;\n onMonthChange?: (month: string) => void;\n /**\n * 0 = Sunday, 1 = Monday. Defaults to Sunday, matching what the kit's pickers\n * showed before this existed; a consumer outside the US will want 1.\n */\n weekStartsOn?: 0 | 1;\n /**\n * Offer the month and year panels behind the heading, so a date years away is\n * two clicks rather than a hundred presses of PageUp. On by default.\n */\n quickJump?: boolean;\n /** Names the grid. Defaults to the month and year on show. */\n 'aria-label'?: string;\n className?: string;\n}\n\nconst MONTH_NAMES = [\n 'January', 'February', 'March', 'April', 'May', 'June',\n 'July', 'August', 'September', 'October', 'November', 'December',\n];\nconst DAY_NAMES = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];\nconst DAY_SHORT = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'];\n\nconst pad = (n: number) => String(n).padStart(2, '0');\n\n/** `YYYY-MM-DD` from local calendar fields — never `toISOString()`. */\nexport function toKey(d: Date): string {\n return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;\n}\n\n/** The local Date for a `YYYY-MM-DD`, or null. Never `new Date(string)`. */\nexport function fromKey(key: string | null | undefined): Date | null {\n if (!key) return null;\n const m = /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(key);\n if (!m) return null;\n const d = new Date(Number(m[1]), Number(m[2]) - 1, Number(m[3]));\n return Number.isNaN(d.getTime()) ? null : d;\n}\n\nconst monthKey = (d: Date) => `${d.getFullYear()}-${pad(d.getMonth() + 1)}`;\n\nconst YEARS_PER_PAGE = 12;\nconst yearPageStart = (y: number) => Math.floor(y / YEARS_PER_PAGE) * YEARS_PER_PAGE;\n\nfunction monthStart(key: string): Date {\n const m = /^(\\d{4})-(\\d{2})$/.exec(key);\n return m ? new Date(Number(m[1]), Number(m[2]) - 1, 1) : new Date();\n}\n\n/**\n * The 42 cells of a month view: the month itself, padded to whole weeks with\n * the days either side. Always six rows, so the grid does not change height as\n * the user pages and push the controls under the cursor.\n */\nfunction buildCells(view: Date, weekStartsOn: 0 | 1): Date[] {\n const first = new Date(view.getFullYear(), view.getMonth(), 1);\n const lead = (first.getDay() - weekStartsOn + 7) % 7;\n const start = new Date(first.getFullYear(), first.getMonth(), 1 - lead);\n return Array.from({ length: 42 }, (_, i) =>\n new Date(start.getFullYear(), start.getMonth(), start.getDate() + i));\n}\n\n/** Day arithmetic through the local constructor, so DST never shifts a date. */\nconst addDays = (d: Date, n: number) => new Date(d.getFullYear(), d.getMonth(), d.getDate() + n);\nconst addMonths = (d: Date, n: number) => {\n const target = new Date(d.getFullYear(), d.getMonth() + n, 1);\n // Clamp: stepping from the 31st into a 30-day month must not roll into the\n // next one, which is what a naive setMonth does.\n const lastDay = new Date(target.getFullYear(), target.getMonth() + 1, 0).getDate();\n return new Date(target.getFullYear(), target.getMonth(), Math.min(d.getDate(), lastDay));\n};\n\nexport default function Calendar({\n value, endValue, mode = 'single', onSelect, min, max,\n month, defaultMonth, onMonthChange, weekStartsOn = 0, quickJump = true,\n 'aria-label': ariaLabel, className = '',\n}: CalendarProps) {\n const selected = fromKey(value);\n const today = new Date();\n const todayKey = toKey(today);\n\n const [innerMonth, setInnerMonth] = useState(() => {\n if (defaultMonth) return defaultMonth;\n if (selected) return monthKey(selected);\n // With no selection, open somewhere the user can actually pick. Today is\n // the obvious choice and the wrong one when the bounds are elsewhere: a\n // month later than `max` opens on a grid where every day is disabled, and\n // nothing on screen says which way to page.\n const here = monthKey(today);\n if (min && here < min.slice(0, 7)) return min.slice(0, 7);\n if (max && here > max.slice(0, 7)) return max.slice(0, 7);\n return here;\n });\n const viewMonth = month ?? innerMonth;\n const view = monthStart(viewMonth);\n\n // The cell the arrows are on. Distinct from the selection: a user moves\n // around before committing, and moving is not choosing.\n const [active, setActive] = useState<string>(() => value ?? todayKey);\n const gridRef = useRef<HTMLDivElement>(null);\n const shouldFocus = useRef(false);\n // 'days' is the grid; the other two are the quick-jump panels behind the\n // heading. They replace the grid rather than sitting beside it, so the popup\n // does not change size as the user drills in.\n const [panel, setPanel] = useState<'days' | 'months' | 'years'>('days');\n\n const cells = useMemo(() => buildCells(view, weekStartsOn), [viewMonth, weekStartsOn]);\n\n const outOfRange = (key: string) => (!!min && key < min) || (!!max && key > max);\n\n // The active day must exist in the grid, or there is no tab stop at all.\n const activeInView = cells.some(c => toKey(c) === active);\n const fallbackActive = toKey(cells.find(c => c.getMonth() === view.getMonth()) ?? cells[0]);\n const activeKey = activeInView ? active : fallbackActive;\n\n useEffect(() => {\n if (!shouldFocus.current) return;\n shouldFocus.current = false;\n gridRef.current?.querySelector<HTMLElement>('[data-active=\"true\"]')?.focus();\n }, [activeKey, viewMonth]);\n\n // The arrows step whatever is on show: a month in the grid, a year in the\n // month panel, a page of years in the year panel. An arrow that always\n // stepped one month would appear stuck while a year panel is open.\n const pageBy = (n: number) => {\n if (panel === 'years') return new Date(view.getFullYear() + n * YEARS_PER_PAGE, view.getMonth(), 1);\n if (panel === 'months') return new Date(view.getFullYear() + n, view.getMonth(), 1);\n return addMonths(view, n);\n };\n const pageBack = () => pageBy(-1);\n const pageForward = () => pageBy(1);\n\n const goToMonth = (next: Date) => {\n const key = monthKey(next);\n if (month === undefined) setInnerMonth(key);\n onMonthChange?.(key);\n };\n\n /** Move the cursor, paging the month when the target falls outside it. */\n const moveTo = (next: Date) => {\n shouldFocus.current = true;\n setActive(toKey(next));\n if (monthKey(next) !== viewMonth) goToMonth(next);\n };\n\n const onKeyDown = (e: KeyboardEvent<HTMLDivElement>) => {\n const current = fromKey(activeKey) ?? today;\n const step: Record<string, () => Date> = {\n ArrowLeft: () => addDays(current, -1),\n ArrowRight: () => addDays(current, 1),\n ArrowUp: () => addDays(current, -7),\n ArrowDown: () => addDays(current, 7),\n // Home and End are the week, not the month: the grid's rows are weeks, and\n // this is what the ARIA date-grid pattern asks for.\n Home: () => addDays(current, -((current.getDay() - weekStartsOn + 7) % 7)),\n End: () => addDays(current, 6 - ((current.getDay() - weekStartsOn + 7) % 7)),\n PageUp: () => addMonths(current, e.shiftKey ? -12 : -1),\n PageDown: () => addMonths(current, e.shiftKey ? 12 : 1),\n };\n\n if (step[e.key]) {\n e.preventDefault();\n moveTo(step[e.key]());\n return;\n }\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n if (!outOfRange(activeKey)) onSelect(activeKey);\n }\n };\n\n const inRange = (key: string) => {\n if (mode !== 'range' || !value || !endValue) return false;\n return key > value && key < endValue;\n };\n\n const label = ariaLabel ?? `${MONTH_NAMES[view.getMonth()]} ${view.getFullYear()}`;\n\n return (\n <div className={className}>\n <div className=\"mb-2 flex items-center justify-between px-1\">\n <button\n type=\"button\"\n aria-label={panel === 'years' ? 'Previous years' : panel === 'months' ? 'Previous year' : 'Previous month'}\n onClick={() => goToMonth(pageBack())}\n className=\"rounded-full p-1 text-gray-600 hover:bg-gray-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-400\"\n >\n <svg className=\"h-4 w-4\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M15 19l-7-7 7-7\" />\n </svg>\n </button>\n {/* A live region: paging with PageUp/PageDown changes the month without\n moving focus out of the grid, so nothing else would announce it. */}\n <div aria-live=\"polite\" className=\"flex items-center gap-1 text-sm font-semibold text-gray-800\">\n {quickJump ? (\n <>\n {/* Month and year are separately clickable, so jumping to a far\n year is one click rather than drilling month -> year. */}\n {panel !== 'years' && (\n <button\n type=\"button\"\n aria-label={`Choose a month, currently ${MONTH_NAMES[view.getMonth()]}`}\n onClick={() => setPanel(p => (p === 'months' ? 'days' : 'months'))}\n className=\"rounded-md px-1.5 py-0.5 transition-colors hover:bg-gray-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-400\"\n >\n {MONTH_NAMES[view.getMonth()]}\n </button>\n )}\n <button\n type=\"button\"\n aria-label={`Choose a year, currently ${view.getFullYear()}`}\n onClick={() => setPanel(p => (p === 'years' ? 'days' : 'years'))}\n className=\"rounded-md px-1.5 py-0.5 transition-colors hover:bg-gray-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-400\"\n >\n {view.getFullYear()}\n </button>\n </>\n ) : (\n <span>{MONTH_NAMES[view.getMonth()]} {view.getFullYear()}</span>\n )}\n </div>\n <button\n type=\"button\"\n aria-label={panel === 'years' ? 'Next years' : panel === 'months' ? 'Next year' : 'Next month'}\n onClick={() => goToMonth(pageForward())}\n className=\"rounded-full p-1 text-gray-600 hover:bg-gray-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-400\"\n >\n <svg className=\"h-4 w-4\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M9 5l7 7-7 7\" />\n </svg>\n </button>\n </div>\n\n {panel === 'months' && (\n <div role=\"group\" aria-label=\"Choose a month\" className=\"grid grid-cols-3 gap-1 text-center text-sm\">\n {MONTH_NAMES.map((name, m) => (\n <button\n key={name}\n type=\"button\"\n aria-pressed={m === view.getMonth()}\n onClick={() => { goToMonth(new Date(view.getFullYear(), m, 1)); setPanel('days'); }}\n className={[\n 'rounded-md py-4 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-400',\n m === view.getMonth() ? 'bg-blue-600 font-semibold text-white'\n : m === today.getMonth() && view.getFullYear() === today.getFullYear()\n ? 'font-medium text-blue-600 hover:bg-gray-100'\n : 'text-gray-700 hover:bg-gray-100',\n ].join(' ')}\n >\n {name.slice(0, 3)}\n </button>\n ))}\n </div>\n )}\n\n {panel === 'years' && (\n <div role=\"group\" aria-label=\"Choose a year\" className=\"grid grid-cols-3 gap-1 text-center text-sm\">\n {Array.from({ length: YEARS_PER_PAGE }, (_, i) => yearPageStart(view.getFullYear()) + i).map(y => (\n <button\n key={y}\n type=\"button\"\n aria-pressed={y === view.getFullYear()}\n onClick={() => { goToMonth(new Date(y, view.getMonth(), 1)); setPanel('months'); }}\n className={[\n 'rounded-md py-4 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-400',\n y === view.getFullYear() ? 'bg-blue-600 font-semibold text-white'\n : y === today.getFullYear() ? 'font-medium text-blue-600 hover:bg-gray-100'\n : 'text-gray-700 hover:bg-gray-100',\n ].join(' ')}\n >\n {y}\n </button>\n ))}\n </div>\n )}\n\n <div\n ref={gridRef}\n role=\"grid\"\n aria-label={label}\n onKeyDown={onKeyDown}\n // Hidden rather than unmounted: remounting would reset the cursor to\n // the selection every time the user glanced at the year panel.\n hidden={panel !== 'days'}\n >\n <div role=\"row\" className=\"grid grid-cols-7 text-center text-xs font-medium text-gray-500\">\n {Array.from({ length: 7 }, (_, i) => (i + weekStartsOn) % 7).map(d => (\n // abbr carries the full name: \"Su\" is read as a word otherwise.\n <div key={d} role=\"columnheader\" aria-label={DAY_NAMES[d]} className=\"py-1\">\n <abbr title={DAY_NAMES[d]} className=\"no-underline\">{DAY_SHORT[d]}</abbr>\n </div>\n ))}\n </div>\n\n {Array.from({ length: 6 }, (_, row) => (\n <div key={row} role=\"row\" className=\"grid grid-cols-7 text-center text-sm\">\n {cells.slice(row * 7, row * 7 + 7).map(cell => {\n const key = toKey(cell);\n const outside = cell.getMonth() !== view.getMonth();\n const isSelected = key === value || (mode === 'range' && key === endValue);\n const between = inRange(key);\n const disabled = outOfRange(key);\n return (\n <div key={key} role=\"gridcell\" aria-selected={isSelected}>\n <button\n type=\"button\"\n data-active={key === activeKey}\n // One tab stop for the whole grid; the arrows move within it.\n tabIndex={key === activeKey ? 0 : -1}\n disabled={disabled}\n // The full date, not the bare number: \"15\" alone does not\n // say which month a reader has landed in.\n aria-label={`${cell.getDate()} ${MONTH_NAMES[cell.getMonth()]} ${cell.getFullYear()}`}\n aria-current={key === todayKey ? 'date' : undefined}\n onClick={() => { setActive(key); onSelect(key); }}\n className={[\n // 44px below `sm`, compact above it. A 32px cell is under\n // every touch-target guideline there is, and a date grid\n // is seven of them side by side — the case where missing\n // by four pixels picks the wrong day rather than nothing.\n 'w-full rounded-md py-1.5 min-h-11 sm:min-h-0 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-400',\n disabled ? 'cursor-not-allowed text-gray-300'\n : isSelected ? 'bg-blue-600 font-semibold text-white'\n : between ? 'bg-blue-100 text-blue-800'\n : outside ? 'text-gray-300 hover:bg-gray-100'\n : 'text-gray-700 hover:bg-gray-100',\n key === todayKey && !isSelected ? 'font-semibold text-blue-600' : '',\n ].filter(Boolean).join(' ')}\n >\n {cell.getDate()}\n </button>\n </div>\n );\n })}\n </div>\n ))}\n </div>\n </div>\n );\n}\n","/**\n * DateRangePicker — a from/to calendar filter in a single popover trigger.\n *\n * Replaces the two-native-`<input type=\"date\">` pattern the portals had grown\n * independently: a pair of bare boxes states no relationship between the two\n * dates, offers no presets, and (on the platforms these tenants use) opens an\n * OS picker that is itself a month-at-a-time stepper.\n *\n * Navigation drills UP rather than stepping: the header's month and year are\n * separate buttons opening a 12-month and a 12-year grid, so a date years back\n * is a few clicks instead of one click per intervening month.\n *\n * The component is deliberately free of app-level dependencies — date DISPLAY\n * is injected via `formatDisplay` so each portal can honour its own user\n * date-format preference, and the value contract is the plain `YYYY-MM-DD` the\n * API filters on.\n *\n * The panel is portalled to <body> and placed by the kit's shared\n * `useDropdownPosition`, like every other anchored popup: it escapes the\n * `overflow-hidden` window body that would otherwise cut it in half, stays\n * inside the shell window that owns the trigger (UI-11), and — because it is no\n * longer a DOM descendant of the consumer's filter slot — cannot be resized by\n * a consumer's descendant selector (UI-12). It used to be an `absolute` child\n * aligned against whatever box clipped it, which solved the horizontal half of\n * that and none of the rest.\n */\nimport { useEffect, useState, useRef } from 'react';\nimport { createPortal } from 'react-dom';\n\nimport Calendar from './Calendar';\nimport { useDropdownPosition } from './dropdownPosition';\nimport { glassStyle } from '../utils/glass';\nimport { onOverlayOpen } from '../shell/overlayEvents';\nimport { Z_LAYERS } from '../shell/zLayers';\n\nexport interface DateRangePickerProps {\n /** Start of the range as `YYYY-MM-DD`, or '' when unset. */\n from: string;\n /** End of the range as `YYYY-MM-DD`, or '' when unset. */\n to: string;\n /** Called with the applied range. Both values are '' when cleared. */\n onChange: (from: string, to: string) => void;\n /**\n * Render a `YYYY-MM-DD` for display. Defaults to `DD/MM/YYYY`; portals pass\n * their own so the picker agrees with every other date on screen.\n */\n formatDisplay?: (iso: string) => string;\n /**\n * Offer the Clear affordances. Pass `false` where a range is REQUIRED — an\n * accounting report seeded with a period has nothing sensible to show for an\n * empty one, so it should not offer to empty it.\n */\n clearable?: boolean;\n /** Trigger text when no range is set. */\n placeholder?: string;\n /**\n * Fill the layout slot instead of shrink-wrapping the trigger label.\n *\n * The trigger is `inline-flex` by default, which is right in a toolbar row\n * and wrong in a filter GRID, where every other control is `block w-full` and\n * this one sat narrow in its column. Consumers were reaching for\n * `[&>div>div]:w-full` on a wrapper to fix that, which also reached the open\n * PANEL and sized a 460px calendar to a 280px field (UI-12).\n */\n fullWidth?: boolean;\n}\n\nconst PRESET_LABELS = ['Last 2 Weeks', 'Last Month', 'Last 3 Months', 'Last 6 Months', 'Last 12 Months'];\n\n\n/** The year grid pages in 12s so it reuses the month grid's 3x4 shape. */\n/** `YYYY-MM` for Calendar's controlled view. */\nconst monthKeyOf = (d: Date) => `${d.getFullYear()}-${pad(d.getMonth() + 1)}`;\n\nconst pad = (n: number) => String(n).padStart(2, '0');\n\n/**\n * Serialise a Date to `YYYY-MM-DD`, reading its LOCAL calendar fields.\n *\n * This must not go through `toISOString()`. Every Date this component builds is\n * constructed at local midnight — calendar cells, the preset boundaries, and\n * `new Date()` — and local midnight always falls in the *previous* UTC day for\n * any positive UTC offset. Serialising through UTC would shift the whole picker\n * back one day for every user east of Greenwich.\n */\nexport function toISODate(d: Date): string {\n return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;\n}\n\nfunction parseDate(s: string): Date {\n const [y, m, d] = s.split('-').map(Number);\n return new Date(y, m - 1, d);\n}\n\n/** Fallback display format. Portals override via `formatDisplay`. */\nfunction defaultFormatDisplay(s: string): string {\n const [y, m, d] = s.split('-');\n return y && m && d ? `${d}/${m}/${y}` : s;\n}\n\nexport default function DateRangePicker({\n from,\n to,\n onChange,\n formatDisplay = defaultFormatDisplay,\n clearable = true,\n placeholder = 'Date Range',\n fullWidth = false,\n}: DateRangePickerProps) {\n const [open, setOpen] = useState(false);\n const [tempFrom, setTempFrom] = useState(from);\n const [tempTo, setTempTo] = useState(to);\n const [activePreset, setActivePreset] = useState<string | null>(null);\n const ref = useRef<HTMLDivElement>(null);\n const panelRef = useRef<HTMLDivElement>(null);\n // A calendar plus its preset column is a fixed composition, not a scrolling\n // list: 520x560 is what it draws at the default font, and the window still\n // caps both. Left at an option list's 448x240 the presets wrapped and the\n // Apply button scrolled out of sight.\n const pos = useDropdownPosition(ref, open, {\n preferredMaxWidth: 520,\n preferredMaxHeight: 560,\n });\n\n const now = new Date();\n // The grid, the month/year panels, the paging and the keyboard all live in\n // `Calendar` now. What is left here is which month it is showing, so a preset\n // can move it — and the range state, which is this component's actual job.\n const [viewMonth, setViewMonth] = useState(() => monthKeyOf(from ? parseDate(from) : now));\n\n const displayDate = (s: string) => (s ? formatDisplay(s) : '');\n\n // BOTH refs, because the panel is portalled to <body> and is therefore not\n // inside the trigger wrapper. Checking the wrapper alone would make every\n // click on a DAY read as a click outside, closing the panel before the cell\n // could act on it.\n useEffect(() => {\n if (!open) return;\n const handler = (event: MouseEvent) => {\n const target = event.target as Node;\n if (ref.current?.contains(target) || panelRef.current?.contains(target)) return;\n setOpen(false);\n };\n document.addEventListener('mousedown', handler);\n // An overlay opening closes the panel: it is layered above the overlay\n // layer and would otherwise float over it (see `overlayEvents.ts`). The\n // pending range is discarded, as an outside press discards it.\n const offOverlay = onOverlayOpen(() => setOpen(false));\n return () => {\n document.removeEventListener('mousedown', handler);\n offOverlay();\n };\n }, [open]);\n\n const handleOpen = () => {\n setTempFrom(from);\n setTempTo(to);\n setActivePreset(null);\n setViewMonth(monthKeyOf(from ? parseDate(from) : now));\n setOpen(true);\n };\n\n const handlePreset = (label: string) => {\n let start: Date, end: Date;\n switch (label) {\n case 'Last 2 Weeks':\n end = new Date();\n start = new Date();\n start.setDate(start.getDate() - 14);\n break;\n case 'Last Month':\n start = new Date(now.getFullYear(), now.getMonth() - 1, 1);\n end = new Date(now.getFullYear(), now.getMonth(), 0);\n break;\n case 'Last 3 Months':\n start = new Date(now.getFullYear(), now.getMonth() - 3, 1);\n end = new Date(now.getFullYear(), now.getMonth(), 0);\n break;\n case 'Last 6 Months':\n start = new Date(now.getFullYear(), now.getMonth() - 6, 1);\n end = new Date(now.getFullYear(), now.getMonth(), 0);\n break;\n case 'Last 12 Months':\n start = new Date(now.getFullYear(), now.getMonth() - 12, 1);\n end = new Date(now.getFullYear(), now.getMonth(), 0);\n break;\n default: return;\n }\n setTempFrom(toISODate(start));\n setTempTo(toISODate(end));\n setActivePreset(label);\n setViewMonth(monthKeyOf(start));\n };\n\n const handleCalendarSelect = (date: string) => {\n setActivePreset('Custom');\n if (!tempFrom || (tempFrom && tempTo)) {\n setTempFrom(date);\n setTempTo('');\n } else {\n if (date < tempFrom) {\n setTempTo(tempFrom);\n setTempFrom(date);\n } else {\n setTempTo(date);\n }\n }\n };\n\n const handleApply = () => {\n onChange(tempFrom, tempTo);\n setOpen(false);\n };\n\n const handleClear = () => {\n onChange('', '');\n setOpen(false);\n };\n\n const displayText = from && to\n ? `${displayDate(from)} — ${displayDate(to)}`\n : from ? `From ${displayDate(from)}`\n : to ? `To ${displayDate(to)}`\n : '';\n\n return (\n <div className={`relative${fullWidth ? ' w-full' : ''}`} ref={ref}>\n {/* Trigger + clear are SIBLING buttons inside a shared bordered shell —\n a clear control nested inside the trigger button would be invalid\n nesting and unreachable by keyboard. */}\n <div\n className={`${fullWidth ? 'flex w-full' : 'inline-flex'} items-center gap-2 border rounded-lg px-2.5 py-1.5 text-sm focus-within:border-blue-500 focus-within:ring-1 focus-within:ring-blue-500 ${from || to ? 'border-blue-400 bg-blue-50 text-blue-700' : 'border-gray-300 text-gray-500'}`}>\n <button type=\"button\" onClick={handleOpen} aria-haspopup=\"dialog\" aria-expanded={open}\n className={`inline-flex items-center gap-2 focus:outline-none${fullWidth ? ' min-w-0 flex-1 justify-start' : ''}`}>\n <svg className=\"w-4 h-4 shrink-0\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" viewBox=\"0 0 24 24\">\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z\" />\n </svg>\n <span className=\"truncate\">{displayText || placeholder}</span>\n </button>\n {clearable && (from || to) && (\n <button type=\"button\" onClick={handleClear} aria-label=\"Clear date range\"\n className=\"text-blue-400 hover:text-red-500 focus:outline-none focus-visible:ring-1 focus-visible:ring-blue-500 rounded\">&times;</button>\n )}\n </div>\n\n {open && createPortal(\n <div\n ref={panelRef}\n role=\"dialog\"\n aria-label=\"Date range\"\n // Portalled, so this must clear Dialog's and Drawer's overlay layer:\n // a range filter inside a dialog is where this control usually lives.\n className=\"fixed rounded-2xl p-4\"\n style={{\n zIndex: Z_LAYERS.popup,\n left: pos?.left, right: pos?.right, top: pos?.top, bottom: pos?.bottom,\n // The panel states its own size. `max-content` is the calendar plus\n // the presets column at whatever font size the reader has, and the\n // cap is what the owning window allows.\n width: 'max-content',\n maxWidth: pos?.maxWidth,\n maxHeight: pos?.maxHeight,\n overflowY: 'auto',\n // Hidden for the first paint until the layout effect measures the\n // trigger, so the panel never flashes at (0,0).\n visibility: pos ? undefined : 'hidden',\n ...glassStyle(),\n }}\n >\n {/* From/To display */}\n <div className=\"flex items-center gap-3 mb-3\">\n <div className=\"flex items-center gap-2\">\n <span className=\"text-xs font-medium text-gray-500\">From</span>\n <span className={`text-sm px-2 py-1 rounded border min-w-[90px] ${tempFrom ? 'border-blue-300 bg-blue-50 text-blue-700' : 'border-gray-200 bg-gray-50 text-gray-400'}`}>\n {tempFrom ? displayDate(tempFrom) : 'Start'}\n </span>\n </div>\n <span className=\"text-gray-300\">—</span>\n <div className=\"flex items-center gap-2\">\n <span className=\"text-xs font-medium text-gray-500\">To</span>\n <span className={`text-sm px-2 py-1 rounded border min-w-[90px] ${tempTo ? 'border-blue-300 bg-blue-50 text-blue-700' : 'border-gray-200 bg-gray-50 text-gray-400'}`}>\n {tempTo ? displayDate(tempTo) : 'End'}\n </span>\n </div>\n </div>\n\n <div className=\"flex gap-4\">\n {/* The grid, its keyboard model and its ARIA all come from Calendar,\n which is also what DatePicker draws — so a range and a single\n date look and behave like the same control. This used to be 95\n lines of hand-built cells here with no arrow keys and a day\n whose accessible name was its number. */}\n <div className=\"w-64\">\n <Calendar\n mode=\"range\"\n value={tempFrom || null}\n endValue={tempTo || null}\n month={viewMonth}\n onMonthChange={setViewMonth}\n onSelect={handleCalendarSelect}\n aria-label=\"Date range\"\n />\n </div>\n\n\n {/* Presets */}\n <div className=\"border-l border-gray-200 pl-4 flex flex-col gap-1 min-w-[130px]\">\n {PRESET_LABELS.map(label => (\n <button key={label} type=\"button\" onClick={() => handlePreset(label)}\n className={`text-left px-3 py-1.5 text-sm rounded-md transition-colors ${activePreset === label ? 'bg-blue-50 text-blue-700 font-medium' : 'text-gray-700 hover:bg-gray-50'}`}>\n {label}\n </button>\n ))}\n <button type=\"button\" onClick={() => setActivePreset('Custom')}\n className={`text-left px-3 py-1.5 text-sm rounded-md transition-colors ${activePreset === 'Custom' ? 'bg-blue-50 text-blue-700 font-medium' : 'text-gray-700 hover:bg-gray-50'}`}>\n Custom\n </button>\n </div>\n </div>\n\n {/* Actions */}\n <div className=\"flex justify-end gap-2 mt-4 pt-3 border-t border-gray-200\">\n {clearable && (\n <button type=\"button\" onClick={handleClear} className=\"px-3 py-1.5 text-sm text-gray-500 hover:text-gray-700\">Clear</button>\n )}\n <button type=\"button\" onClick={() => setOpen(false)} className=\"px-3 py-1.5 text-sm text-gray-600 border border-gray-300 rounded-md hover:bg-gray-50\">Cancel</button>\n <button type=\"button\" onClick={handleApply} disabled={!tempFrom || !tempTo}\n className=\"px-4 py-1.5 text-sm font-medium text-white bg-blue-600 rounded-md hover:bg-blue-700 disabled:opacity-50\">\n Apply\n </button>\n </div>\n </div>,\n document.body,\n )}\n </div>\n );\n}\n","/**\n * TimePicker — one time of day, on the platform's own time input.\n *\n * The same bargain as DatePicker: a native `<input type=\"time\">` wearing the\n * kit's field styling, so the browser supplies the wheel, the locale's\n * 12/24-hour convention and the keyboard behaviour, and there is nothing here\n * to keep in step with any of them.\n *\n * The value is an `HH:MM` (or `HH:MM:SS`) wall-clock string, and `onChange`\n * hands back the same — never a Date. A time of day names no calendar day, so\n * building a Date from one means inventing a date, which is the same class of\n * bug DatePicker's header warns about, one step earlier. A caller who has a\n * Date may still pass it as `value`; its LOCAL hours and minutes are read\n * (never `toISOString`, which is UTC).\n */\nimport { forwardRef, type InputHTMLAttributes } from 'react';\n\nimport { inputClasses, type InputSize } from './styles';\n\n/** What a native time input speaks, and what this component stores. */\nconst TIME = /^\\d{2}:\\d{2}(:\\d{2})?$/;\n\nconst pad = (n: number) => String(n).padStart(2, '0');\n\nexport interface TimePickerProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, 'className' | 'size' | 'type' | 'value' | 'onChange' | 'min' | 'max'> {\n /** An `HH:MM` / `HH:MM:SS` string, a Date (local wall-clock time is read), or nothing. */\n value?: Date | string | null;\n /**\n * The chosen time as `HH:MM` (`HH:MM:SS` when `step` asks for seconds), or\n * `null` when the field is empty or mid-entry — same contract as DatePicker.\n */\n onChange?: (value: string | null) => void;\n /** Earliest selectable time. */\n min?: Date | string | null;\n /** Latest selectable time. */\n max?: Date | string | null;\n /** Error state — red border + ring, matching Input. */\n invalid?: boolean;\n /** `touch` gives a 56px field for a finger. Defaults to the desktop size. */\n size?: InputSize;\n className?: string;\n}\n\nfunction toInputValue(value: Date | string | null | undefined, withSeconds: boolean): string {\n if (value === null || value === undefined || value === '') return '';\n if (value instanceof Date) {\n if (Number.isNaN(value.getTime())) return '';\n const base = `${pad(value.getHours())}:${pad(value.getMinutes())}`;\n return withSeconds ? `${base}:${pad(value.getSeconds())}` : base;\n }\n return TIME.test(value) ? value : '';\n}\n\nconst TimePicker = forwardRef<HTMLInputElement, TimePickerProps>(function TimePicker(\n { value, onChange, min, max, invalid, size, className = '', step, ...rest },\n ref,\n) {\n // A sub-minute step makes the native control show (and report) seconds.\n const withSeconds = step != null && Number(step) < 60;\n return (\n <input\n ref={ref}\n type=\"time\"\n step={step}\n aria-invalid={invalid || undefined}\n value={toInputValue(value, withSeconds)}\n min={toInputValue(min, withSeconds) || undefined}\n max={toInputValue(max, withSeconds) || undefined}\n onChange={event => onChange?.(TIME.test(event.target.value) ? event.target.value : null)}\n className={inputClasses({ invalid, size, className })}\n {...rest}\n />\n );\n});\n\nexport default TimePicker;\n","/**\n * DatePicker — one calendar date.\n *\n * It used to be a native `<input type=\"date\">` wearing the kit's field styling,\n * on the reasoning that the browser supplies the calendar, the locale, the\n * keyboard behaviour and the mobile date wheel for free. All of that is true.\n * What it also supplies is its own widget: a Chrome date field renders one\n * thing, Safari another, and neither is the calendar `DateRangePicker` draws.\n * Two date fields on one row — the common case, a from and a to — looked like\n * two different products, which is the specific complaint that changed this.\n *\n * So the popover is the kit's own {@link Calendar} now, which is also where the\n * keyboard model and the ARIA live. The native control is still one prop away:\n * a phone gets a much better date entry from the platform than any popover, and\n * a consumer that is mostly mobile should say so with `native`.\n *\n * ── Every date bug in this file is the same bug ──\n * `new Date('2026-08-11')` is UTC midnight, which is the 10th anywhere west of\n * Greenwich; `toISOString()` on a locally-built Date is the previous day\n * anywhere east of it. So this component never crosses that boundary: a bare\n * `YYYY-MM-DD` string is passed through untouched, a Date is serialised through\n * `toISODate` (which reads local calendar fields, and says so at length), and\n * the Date handed back to `onChange` is built from the three integers with the\n * local constructor. `Calendar` and `DateRangePicker` follow the same rule.\n */\nimport { forwardRef, useEffect, useId, useRef, useState, type InputHTMLAttributes } from 'react';\nimport { createPortal } from 'react-dom';\n\nimport Calendar from './Calendar';\nimport { useDropdownPosition } from './dropdownPosition';\nimport { toISODate } from './DateRangePicker';\nimport { inputClasses, type InputSize } from './styles';\nimport { registerModalEscapeInterceptor } from '../shell/escapeInterceptors';\nimport { onOverlayOpen } from '../shell/overlayEvents';\nimport { Z_LAYERS } from '../shell/zLayers';\n\n/** What a native date input speaks, and what this component stores. */\nconst ISO_DATE = /^\\d{4}-\\d{2}-\\d{2}$/;\n\nconst MONTH_NAMES = [\n 'January', 'February', 'March', 'April', 'May', 'June',\n 'July', 'August', 'September', 'October', 'November', 'December',\n];\n\nexport interface DatePickerProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, 'className' | 'size' | 'type' | 'value' | 'onChange' | 'min' | 'max'> {\n /** A Date, a `YYYY-MM-DD` string, or nothing. */\n value?: Date | string | null;\n /**\n * The chosen date at local midnight, or `null` when the field is empty.\n *\n * A partly typed date is not yet a date, and a cleared field has none. Both\n * arrive here as `null`: \"no date yet\" and \"cleared\" are the same thing to a\n * caller storing a value.\n */\n onChange?: (value: Date | null) => void;\n /** Earliest selectable date. */\n min?: Date | string | null;\n /** Latest selectable date. */\n max?: Date | string | null;\n /** Error state — red border + ring, matching Input. */\n invalid?: boolean;\n /** `touch` gives a 56px field for a finger. Defaults to the desktop size. */\n size?: InputSize;\n /**\n * Use the platform's own date input instead of the kit's calendar. Worth it\n * on a mobile-first surface, where the OS date wheel beats any popover; the\n * cost is that the field then looks like the browser rather than the kit.\n */\n native?: boolean;\n /** 0 = Sunday, 1 = Monday. Passed through to the calendar. */\n weekStartsOn?: 0 | 1;\n className?: string;\n}\n\n/**\n * Normalise anything the caller holds into `YYYY-MM-DD`.\n *\n * The `ISO_DATE` short-circuit is load-bearing rather than an optimisation: it\n * is what stops a string that is already correct from being round-tripped\n * through `new Date(...)` and coming back a day early.\n */\nfunction toInputValue(value: Date | string | null | undefined): string {\n if (value === null || value === undefined || value === '') return '';\n if (value instanceof Date) return Number.isNaN(value.getTime()) ? '' : toISODate(value);\n if (ISO_DATE.test(value)) return value;\n const parsed = new Date(value);\n return Number.isNaN(parsed.getTime()) ? '' : toISODate(parsed);\n}\n\n/** `YYYY-MM-DD` → local midnight. Built from the parts, never parsed as a string. */\nfunction fromInputValue(raw: string): Date | null {\n if (!ISO_DATE.test(raw)) return null;\n const [year, month, day] = raw.split('-').map(Number);\n const date = new Date(year, month - 1, day);\n // Rejects 2026-02-31, which the constructor would happily roll into March.\n return date.getMonth() === month - 1 && date.getDate() === day ? date : null;\n}\n\n/** `2026-08-11` → `11 August 2026`. What the trigger shows. */\nfunction display(key: string): string {\n const d = fromInputValue(key);\n return d ? `${d.getDate()} ${MONTH_NAMES[d.getMonth()]} ${d.getFullYear()}` : '';\n}\n\nconst DatePicker = forwardRef<HTMLInputElement, DatePickerProps>(function DatePicker(\n { value, onChange, min, max, invalid, size, native, weekStartsOn, className = '',\n 'aria-label': ariaLabel, 'aria-describedby': describedBy, id, name, disabled, placeholder, ...rest },\n ref,\n) {\n const current = toInputValue(value);\n const lo = toInputValue(min);\n const hi = toInputValue(max);\n\n const [open, setOpen] = useState(false);\n const wrapRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const panelRef = useRef<HTMLDivElement>(null);\n const panelId = useId();\n // The kit's shared placement rather than a local `absolute left-0`: it flips\n // above when there is no room below, right-aligns when the panel would run\n // off the right edge, and tracks a trigger that moves. A calendar is 288px\n // wide and a date field is often the last control in a filter row, which is\n // exactly where a left-anchored popover leaves half the month off screen.\n const pos = useDropdownPosition(triggerRef, open);\n\n useEffect(() => {\n if (!open) return;\n const onPointerDown = (e: PointerEvent) => {\n // BOTH, because the panel is portalled to <body> and is therefore not\n // inside the wrapper. Checking the wrapper alone made every click on a\n // DAY read as a click outside: the panel closed on pointerdown and the\n // cell was gone before its own click event, so the calendar could be\n // opened and never used.\n const target = e.target as Node;\n if (wrapRef.current?.contains(target) || panelRef.current?.contains(target)) return;\n setOpen(false);\n };\n document.addEventListener('pointerdown', onPointerDown, true);\n // An overlay opening closes the calendar: it is layered above the overlay\n // layer and would otherwise float over it (see `overlayEvents.ts`).\n const offOverlay = onOverlayOpen(() => setOpen(false));\n return () => {\n document.removeEventListener('pointerdown', onPointerDown, true);\n offOverlay();\n };\n }, [open]);\n\n // Escape, on the shell's interceptor seam rather than a listener of our own.\n //\n // A `document` listener cannot win, in either phase. `Modal` listens on\n // `window` in the CAPTURE phase, and capture runs window BEFORE document —\n // so Modal took the key first, closed the whole window, and called\n // stopPropagation(). A user with a form open in a window who pressed Escape\n // to dismiss the calendar lost the window and their unsaved edits instead.\n //\n // The seam is the one place Modal consults before closing, and since 4.27.0\n // it drains itself where no shell is mounted, so a routed page and a till are\n // covered by the same registration. `Select` and `FilterBar` have always been\n // on it; `Tooltip` moved to it in 4.30.1 and `DropdownMenu` in 4.54.0 — this\n // is the same rule, and the focus-restore below is the one this file already\n // credited DropdownMenu for.\n useEffect(() => {\n if (!open) return;\n return registerModalEscapeInterceptor(event => {\n if (event.key !== 'Escape') return false;\n setOpen(false);\n // Focus goes back to the trigger. Closing without it unmounts the focused\n // cell, focus falls to <body>, and the next Tab restarts from the top of\n // the document.\n triggerRef.current?.focus();\n return true;\n });\n }, [open]);\n\n if (native) {\n return (\n <input\n ref={ref}\n type=\"date\"\n id={id}\n name={name}\n disabled={disabled}\n aria-label={ariaLabel}\n aria-describedby={describedBy}\n aria-invalid={invalid || undefined}\n value={current}\n min={lo || undefined}\n max={hi || undefined}\n onChange={event => onChange?.(fromInputValue(event.target.value))}\n className={inputClasses({ invalid, size, className })}\n {...rest}\n />\n );\n }\n\n return (\n <div ref={wrapRef} className=\"relative\">\n {/* The value also rides a hidden native input, so the control still posts\n in a plain <form> and is still found by `name` the way it was. */}\n <input ref={ref} type=\"hidden\" name={name} value={current} />\n <button\n ref={triggerRef}\n type=\"button\"\n id={id}\n disabled={disabled}\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n aria-controls={open ? panelId : undefined}\n aria-describedby={describedBy}\n aria-invalid={invalid || undefined}\n // The chosen date, spoken. A trigger reading \"11/08/2026\" is ambiguous\n // between two continents; \"11 August 2026\" is not.\n aria-label={ariaLabel ? `${ariaLabel}${current ? `, ${display(current)}` : ''}` : undefined}\n onClick={() => setOpen(o => !o)}\n className={`${inputClasses({ invalid, size, className })} flex items-center justify-between text-left`}\n >\n <span className={current ? 'text-gray-900' : 'text-gray-400'}>\n {current ? display(current) : (placeholder ?? 'Select a date')}\n </span>\n <svg className=\"h-4 w-4 shrink-0 text-gray-400\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.75\" viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M8 7V3m8 4V3M4 11h16M5 7h14a1 1 0 011 1v11a1 1 0 01-1 1H5a1 1 0 01-1-1V8a1 1 0 011-1z\" />\n </svg>\n </button>\n\n {open && createPortal(\n <div\n ref={panelRef}\n id={panelId}\n role=\"dialog\"\n aria-label={ariaLabel ?? 'Choose a date'}\n // Portalled to <body>, so this must clear Dialog's overlay layer.\n // Otherwise the calendar is visible only behind the dialog scrim.\n className=\"fixed w-72 rounded-xl border border-gray-200 bg-white p-3 shadow-lg\"\n style={{\n zIndex: Z_LAYERS.popup,\n left: pos?.left, right: pos?.right, top: pos?.top, bottom: pos?.bottom,\n // Hidden for the first paint until the layout effect measures the\n // trigger, so the panel never flashes at (0,0).\n visibility: pos ? undefined : 'hidden',\n }}\n >\n <Calendar\n value={current || null}\n min={lo || null}\n max={hi || null}\n weekStartsOn={weekStartsOn}\n onSelect={key => {\n setOpen(false);\n triggerRef.current?.focus();\n onChange?.(fromInputValue(key));\n }}\n />\n <div className=\"mt-2 flex justify-between border-t border-gray-100 pt-2\">\n <button\n type=\"button\"\n onClick={() => { setOpen(false); triggerRef.current?.focus(); onChange?.(null); }}\n className=\"rounded-md px-2 py-1 text-sm text-gray-500 hover:bg-gray-100 hover:text-gray-700\"\n >\n Clear\n </button>\n <button\n type=\"button\"\n onClick={() => { setOpen(false); triggerRef.current?.focus(); onChange?.(new Date()); }}\n className=\"rounded-md px-2 py-1 text-sm font-medium text-blue-600 hover:bg-blue-50\"\n >\n Today\n </button>\n </div>\n </div>,\n document.body,\n )}\n </div>\n );\n});\n\nexport default DatePicker;\n","/**\n * DateTimePicker — one calendar date plus a wall-clock time, on the platform's\n * own `datetime-local` input. DatePicker's sibling: the browser supplies the\n * calendar and the time wheel, the kit supplies the field styling.\n *\n * The DatePicker header's rule applies here with one more field to get wrong:\n * `datetime-local` speaks LOCAL `YYYY-MM-DDTHH:MM`, so nothing in this file\n * may pass through `toISOString()` or the string Date constructor — a Date is\n * serialised from its local calendar and clock fields, and the Date handed to\n * `onChange` is built from the parsed integers with the local constructor.\n */\nimport { forwardRef, type InputHTMLAttributes } from 'react';\n\nimport { inputClasses, type InputSize } from './styles';\n\n/** What a native datetime-local input speaks, and what this component stores. */\nconst ISO_LOCAL = /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(:\\d{2})?$/;\n\nconst pad = (n: number) => String(n).padStart(2, '0');\n\nexport interface DateTimePickerProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, 'className' | 'size' | 'type' | 'value' | 'onChange' | 'min' | 'max'> {\n /** A Date, a local `YYYY-MM-DDTHH:MM` string, or nothing. */\n value?: Date | string | null;\n /**\n * The chosen moment as a local Date, or `null` when the field is empty or\n * mid-entry — same contract as DatePicker.\n */\n onChange?: (value: Date | null) => void;\n /** Earliest selectable moment. */\n min?: Date | string | null;\n /** Latest selectable moment. */\n max?: Date | string | null;\n /** Error state — red border + ring, matching Input. */\n invalid?: boolean;\n /** `touch` gives a 56px field for a finger. Defaults to the desktop size. */\n size?: InputSize;\n className?: string;\n}\n\n/** Local calendar + clock fields, never toISOString — see the header. */\nfunction serialise(date: Date): string {\n return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}T${pad(date.getHours())}:${pad(date.getMinutes())}`;\n}\n\nfunction toInputValue(value: Date | string | null | undefined): string {\n if (value === null || value === undefined || value === '') return '';\n if (value instanceof Date) return Number.isNaN(value.getTime()) ? '' : serialise(value);\n if (ISO_LOCAL.test(value)) return value;\n return '';\n}\n\n/** Local `YYYY-MM-DDTHH:MM[:SS]` → a local Date, built from the parts. */\nfunction fromInputValue(raw: string): Date | null {\n if (!ISO_LOCAL.test(raw)) return null;\n const [datePart, timePart] = raw.split('T');\n const [year, month, day] = datePart.split('-').map(Number);\n const [hours, minutes, seconds = 0] = timePart.split(':').map(Number);\n if (hours > 23 || minutes > 59 || seconds > 59) return null;\n const date = new Date(year, month - 1, day, hours, minutes, seconds);\n // Rejects 2026-02-31T10:00, which the constructor would roll into March.\n return date.getMonth() === month - 1 && date.getDate() === day ? date : null;\n}\n\nconst DateTimePicker = forwardRef<HTMLInputElement, DateTimePickerProps>(function DateTimePicker(\n { value, onChange, min, max, invalid, size, className = '', ...rest },\n ref,\n) {\n return (\n <input\n ref={ref}\n type=\"datetime-local\"\n aria-invalid={invalid || undefined}\n value={toInputValue(value)}\n min={toInputValue(min) || undefined}\n max={toInputValue(max) || undefined}\n onChange={event => onChange?.(fromInputValue(event.target.value))}\n className={inputClasses({ invalid, size, className })}\n {...rest}\n />\n );\n});\n\nexport default DateTimePicker;\n","import toast from './toast';\n\n/**\n * Clipboard writes for the shell's menus.\n *\n * Lifted out of `ShellContextMenu` when `EntityList`'s row menu grew Copy items\n * of its own: two menus that copy should share the one fallback path, not each\n * keep a copy of it to drift apart.\n */\n\n/** The selection a right-click can offer to copy. `html` rides along with the\n * text so a copied table pastes into a spreadsheet as a table, the way the\n * browser's own Copy does. */\nexport interface SelectedText {\n text: string;\n html: string;\n}\n\n/**\n * What is selected — but only when the right-click landed on it. A browser\n * offers Copy for the selection under the pointer, not for one left behind in\n * another window, so neither do we.\n */\nexport function selectionAt(target: EventTarget | null): SelectedText | null {\n let sel: Selection | null = null;\n try { sel = window.getSelection(); } catch { return null; }\n if (!sel || sel.rangeCount === 0 || sel.isCollapsed) return null;\n // Asked of each Range rather than of the Selection: `Range.intersectsNode`\n // answers the same question consistently everywhere, where jsdom's\n // `Selection.containsNode` answers it backwards.\n const node = target as Node | null;\n if (node && typeof node.nodeType === 'number') {\n let underPointer = false;\n for (let i = 0; i < sel.rangeCount && !underPointer; i++) {\n underPointer = sel.getRangeAt(i).intersectsNode(node);\n }\n if (!underPointer) return null;\n }\n const text = sel.toString();\n if (!text.trim()) return null;\n const box = document.createElement('div');\n for (let i = 0; i < sel.rangeCount; i++) box.appendChild(sel.getRangeAt(i).cloneContents());\n return { text, html: box.innerHTML };\n}\n\n/**\n * Write to the clipboard, with HTML beside the text when there is some.\n *\n * `navigator.clipboard` first. Without it (file:// pages, an older WebView),\n * `execCommand('copy')` on a throwaway selection, with a one-shot `copy`\n * listener that supplies both flavours itself.\n */\nexport async function writeClipboard(text: string, html?: string): Promise<boolean> {\n try {\n if (html && typeof ClipboardItem !== 'undefined' && navigator.clipboard?.write) {\n await navigator.clipboard.write([new ClipboardItem({\n 'text/plain': new Blob([text], { type: 'text/plain' }),\n 'text/html': new Blob([html], { type: 'text/html' }),\n })]);\n return true;\n }\n if (navigator.clipboard?.writeText) {\n await navigator.clipboard.writeText(text);\n return true;\n }\n } catch { /* fall through */ }\n const onCopy = (e: ClipboardEvent) => {\n e.clipboardData?.setData('text/plain', text);\n if (html) e.clipboardData?.setData('text/html', html);\n e.preventDefault();\n };\n const ta = document.createElement('textarea');\n ta.value = text;\n ta.style.position = 'fixed';\n ta.style.opacity = '0';\n document.body.appendChild(ta);\n ta.select();\n document.addEventListener('copy', onCopy);\n try {\n return document.execCommand('copy');\n } catch {\n return false;\n } finally {\n document.removeEventListener('copy', onCopy);\n ta.remove();\n }\n}\n\n/**\n * Copy, then say so: `\"<label> copied\"`, or an error toast when the browser\n * refused. `label` names what was copied (\"Text\", \"Link address\", \"3 rows\",\n * a column heading) and is shown as written — the failure message leaves it\n * out, so a heading like \"PO #\" is never lower-cased into a sentence.\n */\nexport async function copyToClipboard(label: string, text: string, html?: string): Promise<boolean> {\n const ok = await writeClipboard(text, html);\n if (ok) toast.success(`${label} copied`);\n else toast.error('Could not copy to the clipboard');\n return ok;\n}\n","/**\n * Snippet — a value the user is meant to copy, not to read: an API base URL, a\n * webhook endpoint, a tenant id, a shell command.\n *\n * The kit already had `CopyButton`, which is the affordance ALONE. Every\n * settings panel that needed one therefore hand-rolled the half around it — a\n * bordered box, a monospace face, a truncation rule and a `title` — and no two\n * of them came out the same width or the same height. This is that box, with\n * the button inside it.\n *\n * ── Why not `Input readOnly` ──\n * A read-only text field is still a text field: it takes a tab stop, invites an\n * edit that will not take, and reads to a screen reader as a control the user\n * is expected to fill in. A value that can only be copied is not a control. So\n * the value is plain text and the only focusable thing in the row is the button\n * that copies it.\n *\n * ── The copy path ──\n * `writeClipboard` from `shell/clipboard`, which is the kit's one clipboard\n * path (`navigator.clipboard`, falling back to `execCommand` on a throwaway\n * selection for file:// pages and older WebViews). NOT `copyToClipboard`: that\n * one toasts on SUCCESS, and this component already answers in place with the\n * check icon and the live region — two confirmations of one copy is one too\n * many. Failure still toasts, with `copyToClipboard`'s own words, because a\n * copy that silently did nothing leaves the user pasting whatever was on the\n * clipboard before.\n */\nimport { useCallback, useEffect, useRef, useState, type ReactNode } from 'react';\n\nimport IconButton from './IconButton';\nimport { writeClipboard } from '../shell/clipboard';\nimport toast from '../shell/toast';\n\n/** How long the button stays in its copied state. HeroUI's Snippet timeout. */\nconst COPIED_MS = 2000;\n\nexport type SnippetSize = 'sm' | 'md';\n/** `bordered` sits in a form beside inputs; `flat` sits inside a card or a row\n * that already draws its own edges. */\nexport type SnippetVariant = 'bordered' | 'flat';\n\nexport interface SnippetProps {\n /** The text that reaches the clipboard. Also what is SHOWN, unless\n * `children` says otherwise. */\n value: string;\n /**\n * What is shown, when that differs from what is copied — a masked key, a\n * shortened URL, a command with its arguments marked up. The clipboard\n * always gets `value`.\n */\n children?: ReactNode;\n /**\n * A leading glyph, `aria-hidden` and never copied — `$` in front of a shell\n * command, `>` in front of a REPL line.\n *\n * There is NO default, where HeroUI defaults to `$`. A URL, a tenant id and\n * an account number are what a settings panel copies, and none of them has a\n * prompt in front of it; a component that renders one by default would put a\n * `$` on every one of them and make each caller opt out.\n */\n symbol?: ReactNode;\n /**\n * Names the value for the copy button: `\"Copy {label}\"`. Without it the\n * button is just \"Copy\", which is enough on a page with one snippet and\n * ambiguous on a page with six.\n */\n label?: string;\n /** Defaults to `md`, which is the height of an `Input` at the same rung. */\n size?: SnippetSize;\n variant?: SnippetVariant;\n /** Show the value without the affordance — for a panel that copies the whole\n * block from somewhere else. */\n hideCopyButton?: boolean;\n /** Called after the value actually reached the clipboard, never on failure. */\n onCopy?: (value: string) => void;\n /** Wrap instead of truncating. For a value with no useful prefix — a PEM\n * block, a multi-line command — where the first 40 characters say nothing. */\n multiline?: boolean;\n /**\n * Lands on the COPY BUTTON, not on the box — so a `FormField htmlFor` points\n * its `<label>` at something a click can focus, and the row behaves like the\n * fields above it. A `<button>` is labelable, so `for`/`id` is a real\n * association here and not a decoration.\n *\n * With `hideCopyButton` there is nothing focusable left, so it falls back to\n * the box itself: the id still has to resolve to an element, or the label\n * and the hint below point at nothing at all.\n */\n id?: string;\n /**\n * The hint or error a wrapping `FormField` generates — \"this is the URL your\n * webhook posts to\", \"rotate this if it leaks\".\n *\n * `FormField` clones its single element child with this prop, and a\n * component that does not accept it drops it on the floor: the `<p>` renders\n * under the snippet, looks wired, and is announced to nobody. It goes on the\n * same element as `id` and for the same reason — a description belongs on\n * what the user focuses.\n */\n 'aria-describedby'?: string;\n className?: string;\n}\n\nconst VARIANTS: Record<SnippetVariant, string> = {\n bordered: 'border border-gray-300 bg-white',\n flat: 'bg-gray-100',\n};\n\n/**\n * Padding per rung, plus the negative margin the button wears at that rung.\n *\n * The margin is what keeps the row the height of an `Input` at the same rung.\n * The button is 24px (`IconButton` `sm`) and the text line is 16px at `sm` /\n * 20px at `md`, so without it the button is what sets the height and a Snippet\n * stands 8px and 4px taller than the field beside it. Pulling the button back\n * into the padding it is already sitting in costs nothing — it still draws and\n * still takes the clicks over its full 24px.\n */\nconst SIZES: Record<SnippetSize, { box: string; button: string }> = {\n sm: { box: 'gap-1.5 px-2.5 py-1 text-xs', button: '-my-1' },\n md: { box: 'gap-2 px-3 py-1.5 text-sm', button: '-my-0.5' },\n};\n\nfunction CopyGlyph() {\n return (\n <svg className=\"h-4 w-4\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z\" />\n </svg>\n );\n}\n\nfunction CheckGlyph() {\n return (\n <svg className=\"h-4 w-4 text-green-600\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M5 13l4 4L19 7\" />\n </svg>\n );\n}\n\nexport default function Snippet({\n value,\n children,\n symbol,\n label,\n size = 'md',\n variant = 'bordered',\n hideCopyButton = false,\n onCopy,\n multiline = false,\n id,\n 'aria-describedby': describedBy,\n className = '',\n}: SnippetProps) {\n const [copied, setCopied] = useState(false);\n const timer = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n // A snippet unmounted inside the two seconds would otherwise set state on a\n // dead component — and in a settings panel that closes on save, that is the\n // common case rather than the edge one.\n useEffect(() => () => { if (timer.current) clearTimeout(timer.current); }, []);\n\n const copy = useCallback(async () => {\n const ok = await writeClipboard(value);\n if (!ok) {\n // Same words as `copyToClipboard`'s failure path — one message for one\n // failure, wherever in the kit the copy was attempted from.\n toast.error('Could not copy to the clipboard');\n return;\n }\n setCopied(true);\n if (timer.current) clearTimeout(timer.current);\n timer.current = setTimeout(() => { setCopied(false); timer.current = null; }, COPIED_MS);\n onCopy?.(value);\n }, [value, onCopy]);\n\n const { box, button } = SIZES[size];\n\n // The copy button is the focusable element, so it is where a label and a\n // description belong. Without one the box is all there is.\n const onButton = !hideCopyButton;\n\n return (\n <div\n id={onButton ? undefined : id}\n aria-describedby={onButton ? undefined : describedBy}\n className={['inline-flex max-w-full items-center rounded-md', VARIANTS[variant], box, className]\n .filter(Boolean)\n .join(' ')}\n >\n {symbol != null && symbol !== '' && (\n <span aria-hidden=\"true\" className=\"shrink-0 select-none font-mono text-gray-400\">{symbol}</span>\n )}\n <span\n className={`min-w-0 font-mono text-gray-800 ${multiline ? 'whitespace-pre-wrap break-all' : 'truncate'}`}\n // A truncated value has to be readable somehow; a wrapped one is\n // already fully on the screen, so a tooltip repeating it is noise.\n title={multiline ? undefined : value}\n >\n {children ?? value}\n </span>\n {!hideCopyButton && (\n <>\n <IconButton\n id={id}\n aria-label={label ? `Copy ${label}` : 'Copy'}\n aria-describedby={describedBy}\n onClick={copy}\n className={`${button} text-gray-400`}\n >\n {copied ? <CheckGlyph /> : <CopyGlyph />}\n </IconButton>\n {/* The icon swap is invisible to a screen reader — the button's name\n does not change, and nothing about it is announced. This is the\n half that says so. `aria-live` only fires on a CHANGE to the\n region, so the region is always present and only its text moves. */}\n <span aria-live=\"polite\" className=\"sr-only\">{copied ? 'Copied' : ''}</span>\n </>\n )}\n </div>\n );\n}\n","/**\n * The rules for typing a decimal amount on an on-screen keypad — pure string\n * functions, no React and no DOM.\n *\n * Split out for the same reason as `selectNav.ts`: these are the rules people\n * actually get wrong, and they are far easier to pin exhaustively as functions\n * than by rendering a keypad and firing clicks at it.\n *\n * A STRING, not a number, all the way through. `'1.'` and `'1.0'` are states a\n * user passes through while typing and neither survives a round trip through a\n * float — `'1.'` would become `1` and erase the decimal point the moment it was\n * pressed. The caller converts once, at the end, when it has a whole amount.\n */\n\n/** Digits after the point. Two, because these are money amounts. */\nexport const MAX_FRACTION_DIGITS = 2;\n\n/**\n * Apply one keypress. `key` is a digit `'0'`-`'9'` or `'.'`.\n * Returns the value unchanged when the press is not allowed, so a caller can\n * always assign the result — an ignored key is a no-op, never an error.\n */\nexport function appendKey(value: string, key: string): string {\n if (key === '.') {\n // A second point is meaningless, and a leading one is ambiguous — '.5'\n // reads as an error on a receipt where '0.5' does not.\n if (value.includes('.')) return value;\n return value === '' ? '0.' : `${value}.`;\n }\n\n if (key < '0' || key > '9') return value;\n\n const dot = value.indexOf('.');\n if (dot !== -1 && value.length - dot - 1 >= MAX_FRACTION_DIGITS) return value;\n\n // A leading zero is a placeholder, not a digit: pressing 5 at '0' means 5,\n // not 05. But '0.' is a real prefix and keeps accumulating.\n if (value === '0') return key;\n\n return value + key;\n}\n\n/** Remove the last character. Empty stays empty rather than underflowing. */\nexport function backspace(value: string): string {\n return value.slice(0, -1);\n}\n","/**\n * NumericKeypad — an on-screen number pad for amount entry.\n *\n * Exists because a touch device's own keyboard is the wrong tool for money: it\n * covers the bottom half of the screen (on a till, the cart), it offers letters\n * nobody wants, and its layout moves between OS versions. A field driven by\n * this sets `inputMode=\"none\"` so the OS keyboard never appears at all.\n *\n * Controlled, and its value is a STRING — see `./keypadInput` for why, and for\n * the press rules themselves, which live there as pure functions.\n *\n * Keys are `Button size=\"touch-xl\"` (80px). That is not a decorative choice:\n * this is the control a cashier hits most often, usually without looking, while\n * a queue watches.\n */\nimport { type ReactNode } from 'react';\nimport Button from './Button';\nimport { appendKey, backspace } from './keypadInput';\n\nexport interface NumericKeypadProps {\n value: string;\n onChange: (next: string) => void;\n /** Renders a full-width Enter key below the pad when provided. */\n onEnter?: () => void;\n /** Label for that key — name the action (\"Tender\", \"Add\"), not \"Enter\". */\n enterLabel?: ReactNode;\n enterDisabled?: boolean;\n className?: string;\n}\n\nconst KEYS = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '.', '0'] as const;\n\nexport default function NumericKeypad({\n value, onChange, onEnter, enterLabel = 'Enter', enterDisabled, className = '',\n}: NumericKeypadProps) {\n /**\n * A rejected press notifies NOBODY.\n *\n * `appendKey` returns the value unchanged when a press is not allowed — a\n * third decimal place, a second point — and firing `onChange` with that\n * unchanged value reports a change that did not happen. The displayed number\n * is identical either way, so this is invisible on screen; what it corrupts\n * is everything downstream that treats \"onChange fired\" as \"the user did\n * something\": a dirty flag, a cleared validation error, a reset idle timer.\n */\n const press = (next: string) => {\n if (next !== value) onChange(next);\n };\n\n return (\n <div className={`grid grid-cols-3 gap-3 ${className}`.trim()}>\n {KEYS.map(key => (\n <Button\n key={key}\n size=\"touch-xl\"\n variant=\"secondary\"\n onClick={() => press(appendKey(value, key))}\n >\n {key}\n </Button>\n ))}\n <Button\n size=\"touch-xl\"\n variant=\"secondary\"\n aria-label=\"Backspace\"\n onClick={() => press(backspace(value))}\n >\n ⌫\n </Button>\n {onEnter && (\n <Button\n size=\"touch-xl\"\n variant=\"primary\"\n className=\"col-span-3\"\n disabled={enterDisabled}\n onClick={onEnter}\n >\n {enterLabel}\n </Button>\n )}\n </div>\n );\n}\n","/**\n * TileButton — a large, self-labelling tile for a grid of choices: a product in\n * a catalogue, a payment method, a register.\n *\n * Distinct from `Button` rather than a size of it, because the content model\n * differs: a Button holds one label on one line, a tile holds a title and a\n * subtitle stacked and left-aligned, and stays a fixed height so a grid of them\n * lines up whether or not each has a subtitle.\n *\n * Text is left-aligned, not centred: in a grid the eye scans down the left edge\n * looking for a name, and centring makes every row start somewhere different.\n */\nimport { forwardRef, type ButtonHTMLAttributes, type ReactNode } from 'react';\n\nexport type TileSize = 'md' | 'lg';\n\nexport interface TileButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'className' | 'title'> {\n /** Primary line — the thing being chosen. */\n title: ReactNode;\n /** Secondary line: a price, a count, a reason it is unavailable. */\n subtitle?: ReactNode;\n size?: TileSize;\n /** Draw as chosen. Uses a ring rather than a fill so the label stays legible. */\n selected?: boolean;\n className?: string;\n}\n\nconst SIZES: Record<TileSize, string> = {\n md: 'h-24 p-3',\n lg: 'h-32 p-4',\n};\n\nconst TileButton = forwardRef<HTMLButtonElement, TileButtonProps>(function TileButton(\n { title, subtitle, size = 'lg', selected = false, disabled, type = 'button', className = '', ...rest },\n ref,\n) {\n return (\n <button\n ref={ref}\n type={type}\n disabled={disabled}\n aria-pressed={selected || undefined}\n className={[\n 'flex w-full flex-col justify-between rounded-xl border text-left transition-colors',\n 'focus:outline-none focus:ring-2 focus:ring-blue-400/40',\n 'disabled:cursor-not-allowed disabled:opacity-50',\n selected ? 'border-blue-600 bg-blue-50 ring-2 ring-blue-400/40' : 'border-gray-200 bg-white hover:bg-gray-50',\n SIZES[size],\n className,\n ].filter(Boolean).join(' ')}\n {...rest}\n >\n <span className=\"line-clamp-2 font-medium text-gray-900\">{title}</span>\n {subtitle != null && <span className=\"text-sm text-gray-500\">{subtitle}</span>}\n </button>\n );\n});\n\nexport default TileButton;\n","/**\n * Segmented — a row of mutually exclusive options, all visible at once.\n *\n * It covers two things that look identical and behave differently, and the\n * difference is `name`:\n *\n * without `name` — a button group. A view toggle, a filter. The choice is a\n * UI mode, not data, and nothing submits it.\n * with `name` — real `<input type=\"radio\">` elements in a `radiogroup`.\n * Use this inside a form: it submits, it restores on back,\n * a password manager and a screen reader both understand it,\n * and arrow keys move between options the way a radio group\n * is expected to.\n *\n * Shipping one component rather than two is deliberate — the pair are visually\n * identical, and having two of them is how a form ends up with a button group\n * in it that submits nothing.\n */\nimport { useId, type ReactNode } from 'react';\n\nexport type SegmentedSize = 'sm' | 'md' | 'touch';\n\nexport interface SegmentedOption<T extends string = string> {\n value: T;\n label: ReactNode;\n icon?: ReactNode;\n disabled?: boolean;\n}\n\nexport interface SegmentedProps<T extends string = string> {\n value: T;\n onChange: (value: T) => void;\n options: SegmentedOption<T>[];\n /** Present as a real radio group under this field name. See the docstring. */\n name?: string;\n size?: SegmentedSize;\n /** Stretch to fill the container, each option an equal share. */\n block?: boolean;\n /** Accessible name for the group. */\n label?: string;\n className?: string;\n}\n\nconst SIZE: Record<SegmentedSize, string> = {\n sm: 'h-7 px-2.5 text-xs',\n md: 'h-9 px-3 text-sm',\n touch: 'h-14 px-5 text-base',\n};\n\nconst SELECTED = 'bg-white text-gray-900 shadow-sm';\nconst UNSELECTED = 'text-gray-500 hover:text-gray-700';\n\nexport default function Segmented<T extends string = string>({\n value, onChange, options, name, size = 'md', block = false, label, className = '',\n}: SegmentedProps<T>) {\n const groupId = useId();\n // `max-w-full` + a scrolling track, and items that never wrap. Without both,\n // a two-word option on a phone broke the control visibly: the label wrapped\n // to a second line while the pill kept its fixed `h-9`, so the selected\n // segment was shorter than its own text and the track sat crooked around it.\n // Scrolling is the right failure for a segmented control — the alternative,\n // letting it grow, pushes whatever is beside it off the screen.\n // The scrollbar is hidden, not the overflow: a segmented control with a\n // scrollbar under it reads as broken, and the track rounds to a pixel or two\n // wider than its content often enough that one appears when nothing is\n // actually clipped. Scrolling still works by touch and by wheel.\n const track = `inline-flex max-w-full items-center gap-1 overflow-x-auto rounded-lg bg-gray-100 p-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden ${block ? 'w-full' : ''} ${className}`.trim();\n const itemBase = `inline-flex shrink-0 items-center justify-center gap-1.5 whitespace-nowrap rounded-md font-medium transition-colors ${block ? 'flex-1' : ''}`;\n\n if (name) {\n return (\n <div role=\"radiogroup\" aria-label={label} className={track}>\n {options.map(opt => {\n const id = `${groupId}-${opt.value}`;\n const on = opt.value === value;\n return (\n // The input is visually hidden rather than removed: it stays in the\n // tab order and keeps the label association, so the control behaves\n // like the radio group it actually is.\n <label\n key={opt.value}\n htmlFor={id}\n className={[\n itemBase, SIZE[size], on ? SELECTED : UNSELECTED,\n opt.disabled ? 'cursor-not-allowed opacity-40' : 'cursor-pointer',\n ].join(' ')}\n >\n <input\n id={id}\n type=\"radio\"\n name={name}\n value={opt.value}\n checked={on}\n disabled={opt.disabled}\n onChange={() => onChange(opt.value)}\n className=\"sr-only\"\n />\n {opt.icon}\n {opt.label}\n </label>\n );\n })}\n </div>\n );\n }\n\n return (\n <div role=\"group\" aria-label={label} className={track}>\n {options.map(opt => {\n const on = opt.value === value;\n return (\n <button\n key={opt.value}\n type=\"button\"\n aria-pressed={on}\n disabled={opt.disabled}\n onClick={() => onChange(opt.value)}\n className={[itemBase, SIZE[size], on ? SELECTED : UNSELECTED, 'disabled:cursor-not-allowed disabled:opacity-40'].join(' ')}\n >\n {opt.icon}\n {opt.label}\n </button>\n );\n })}\n </div>\n );\n}\n","/**\n * Switch — an on/off control that takes effect immediately.\n *\n * `Checkbox` is the one to use inside a form: it means \"this will be true when\n * you save\". A Switch means the change has already happened. Choosing the wrong\n * one tells the user the wrong thing about whether they still need to press\n * Save, so the distinction is worth keeping.\n *\n * Built on a real `<button role=\"switch\">` with `aria-checked` rather than a\n * styled checkbox, because that is what the state actually is and it keeps\n * keyboard and screen-reader behaviour without further work.\n */\nimport { forwardRef, useId, type ButtonHTMLAttributes, type ReactNode } from 'react';\n\nexport type SwitchSize = 'sm' | 'md' | 'touch';\n\nexport interface SwitchProps\n extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onChange' | 'type' | 'className'> {\n checked: boolean;\n onChange: (checked: boolean) => void;\n disabled?: boolean;\n size?: SwitchSize;\n /** Text beside the control. Clicking it toggles, as a label should. */\n label?: ReactNode;\n /** A line under the label for what the setting actually does. */\n hint?: ReactNode;\n /**\n * Why this switch is disabled, rendered as text BESIDE it — never as a\n * `title` tooltip. Same contract as `Button`'s, and for the same reason: a\n * tooltip needs a hover, a disabled control does not fire one on every\n * platform, and an operator facing a dead toggle with no explanation goes\n * looking for someone to ask.\n *\n * Only rendered while the switch is actually disabled; ignored otherwise, so\n * it is safe to pass unconditionally. Wired with `aria-describedby`, so the\n * reason is announced with the control rather than found by hunting.\n *\n * For a PANEL of controls that are all disabled for ONE reason, do not repeat\n * it eight times — write the sentence once and point every control at it with\n * `disabledReasonId`.\n */\n disabledReason?: ReactNode;\n /**\n * The id of an element elsewhere on the page that already explains why this\n * control is disabled — a panel-level note above a group of switches.\n *\n * Given this, the switch describes itself with that element and renders no\n * text of its own, which is what stops one sentence appearing under every\n * control in the group. Wins over `disabledReason`: pointing at a shared\n * explanation and printing a private one are two answers to the same\n * question, and the shared one is the reason this prop exists.\n *\n * Honoured only while the switch is disabled, exactly like `disabledReason`\n * — an enabled control has nothing to explain.\n */\n disabledReasonId?: string;\n id?: string;\n className?: string;\n}\n\nconst TRACK: Record<SwitchSize, string> = {\n sm: 'h-5 w-9',\n md: 'h-6 w-11',\n touch: 'h-8 w-14',\n};\n\nconst KNOB: Record<SwitchSize, string> = {\n sm: 'h-4 w-4',\n md: 'h-5 w-5',\n touch: 'h-7 w-7',\n};\n\n// Travel = track width − knob width − 2× the 2px inset.\nconst TRAVEL: Record<SwitchSize, string> = {\n sm: 'translate-x-4',\n md: 'translate-x-5',\n touch: 'translate-x-6',\n};\n\n/**\n * Forwards its ref, and spreads the rest onto the button.\n *\n * A form library hands a field three things: a change handler, a name, and a\n * ref it uses to move focus to the field when validation fails. The first was\n * here; the other two had nowhere to go, so this control could not be a form\n * field at all — which contradicts the kit's own guidance that its controls\n * drop into react-hook-form.\n */\nconst Switch = forwardRef<HTMLButtonElement, SwitchProps>(function Switch({\n checked, onChange, disabled = false, size = 'md', label, hint, id, className = '',\n disabledReason, disabledReasonId, ...rest\n}, ref) {\n const generated = useId();\n const switchId = id ?? generated;\n const hintId = hint ? `${switchId}-hint` : undefined;\n // A shared explanation outranks a private one; either is ignored unless the\n // control is actually disabled.\n const sharedId = disabled && disabledReasonId ? disabledReasonId : undefined;\n const showReason = disabled && !sharedId && disabledReason != null && disabledReason !== '';\n const reasonId = showReason ? `${switchId}-reason` : undefined;\n // Both, in reading order: what the setting does, then why it cannot be\n // touched. `aria-describedby` takes a list, so the reason does not have to\n // displace the hint the way a single id would.\n const describedBy = [hintId, sharedId ?? reasonId].filter(Boolean).join(' ') || undefined;\n\n const control = (\n <button\n ref={ref}\n id={switchId}\n type=\"button\"\n role=\"switch\"\n aria-checked={checked}\n aria-describedby={describedBy}\n disabled={disabled}\n onClick={() => onChange(!checked)}\n {...rest}\n className={[\n 'relative inline-flex shrink-0 items-center rounded-full p-0.5 transition-colors',\n 'focus:outline-none focus:ring-2 focus:ring-blue-400/40',\n 'disabled:cursor-not-allowed disabled:opacity-40',\n TRACK[size],\n checked ? 'bg-blue-600' : 'bg-gray-300',\n ].join(' ')}\n >\n <span\n className={[\n 'inline-block rounded-full bg-white shadow transition-transform',\n KNOB[size],\n checked ? TRAVEL[size] : 'translate-x-0',\n ].join(' ')}\n />\n </button>\n );\n\n // Nothing beside the control ⇒ the bare switch, byte-identical to every\n // release before these props existed. A shared reason adds no text here\n // either — the panel already carries it.\n if (!label && !hint && !showReason) return <span className={className}>{control}</span>;\n\n return (\n <span className={`flex items-start gap-3 ${className}`.trim()}>\n {control}\n <span className=\"min-w-0\">\n {label && (\n <label htmlFor={switchId} className=\"block text-sm font-medium text-gray-800\">\n {label}\n </label>\n )}\n {hint && <span id={hintId} className=\"mt-0.5 block text-xs text-gray-500\">{hint}</span>}\n {showReason && (\n <span id={reasonId} className=\"mt-0.5 block text-xs text-red-600\">{disabledReason}</span>\n )}\n </span>\n </span>\n );\n});\n\nexport default Switch;\n","/**\n * InputNumber — a numeric field that reports a `number | null`.\n *\n * The whole difficulty is that a number and the text of a number are not the\n * same thing while someone is typing one.\n *\n * A controlled field that stores `Number(e.target.value)` and renders it back\n * destroys every intermediate state: typing \"1.\" parses to 1, re-renders as\n * \"1\", and the decimal point the user just pressed disappears. So does the \"-\"\n * of a negative number, and so does a trailing zero in \"1.50\". It looks correct\n * in review, it looks correct in a test that types \"1.5\" in one go, and it is\n * infuriating in use.\n *\n * So this keeps the RAW TEXT in local state and reports the parsed value\n * upward. The text is re-synced from the prop only when the prop describes a\n * different number than the text already does — which means a parent resetting\n * the field works, while a parent echoing back what the user typed does not\n * fight them mid-keystroke.\n *\n * Clamping is applied on BLUR, not on change: clamping while typing means\n * someone entering 25 into a field with `min={10}` gets their \"2\" rewritten to\n * \"10\" before they can press \"5\".\n */\nimport { forwardRef, useEffect, useRef, useState, type KeyboardEvent, type ReactNode } from 'react';\nimport { inputClasses, type InputSize } from './styles';\n\nexport interface InputNumberProps {\n value: number | null;\n onChange: (value: number | null) => void;\n min?: number;\n max?: number;\n /** Decimal places enforced on blur. */\n precision?: number;\n step?: number;\n disabled?: boolean;\n invalid?: boolean;\n placeholder?: string;\n size?: InputSize;\n /** Inside the field's edges — a currency mark, a unit. */\n prefix?: ReactNode;\n suffix?: ReactNode;\n id?: string;\n name?: string;\n className?: string;\n onBlur?: () => void;\n}\n\nconst format = (v: number | null, precision?: number): string =>\n v == null ? '' : precision != null ? v.toFixed(precision) : String(v);\n\n/** Parses \"\", \"-\", \"1.\" and \"1.50\" the way a half-typed number should be read. */\nfunction parse(text: string): number | null {\n const t = text.trim();\n if (t === '' || t === '-' || t === '.' || t === '-.') return null;\n const n = Number(t);\n return Number.isFinite(n) ? n : null;\n}\n\nconst InputNumber = forwardRef<HTMLInputElement, InputNumberProps>(function InputNumber(\n { value, onChange, min, max, precision, step, disabled, invalid, placeholder,\n size, prefix, suffix, id, name, className = '', onBlur },\n ref,\n) {\n const [text, setText] = useState(() => format(value, precision));\n const textRef = useRef(text);\n textRef.current = text;\n\n useEffect(() => {\n // Re-sync only when the incoming value is genuinely different from what the\n // text already represents. Comparing PARSED values, not strings, is what\n // stops \"1.\" being overwritten while the user is still typing it.\n if (parse(textRef.current) !== value) setText(format(value, precision));\n }, [value, precision]);\n\n const handleChange = (next: string) => {\n // Digits, one optional leading minus, one optional point. Rejecting the\n // keystroke outright beats accepting it and silently dropping it later.\n if (next !== '' && !/^-?\\d*\\.?\\d*$/.test(next)) return;\n setText(next);\n onChange(parse(next));\n };\n\n // A `type=\"number\"` field gets arrow-key stepping from the browser. This one\n // does not, and dropping to `type=\"text\"` must not cost the user a way to\n // adjust a quantity without reaching for the keyboard's digits. PageUp and\n // PageDown move by ten steps, which is the native behaviour too.\n const bump = (by: number) => {\n const from = parse(textRef.current) ?? 0;\n let next = from + by;\n if (min != null && next < min) next = min;\n if (max != null && next > max) next = max;\n // Round to the precision so repeated 0.1 steps do not accumulate float\n // noise into 0.30000000000000004.\n const places = precision ?? String(step ?? 1).split('.')[1]?.length ?? 0;\n next = Number(next.toFixed(places));\n setText(format(next, precision));\n onChange(next);\n };\n\n const handleKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n const unit = step ?? 1;\n const by = event.key === 'ArrowUp' ? unit\n : event.key === 'ArrowDown' ? -unit\n : event.key === 'PageUp' ? unit * 10\n : event.key === 'PageDown' ? -unit * 10\n : null;\n if (by === null || disabled) return;\n // The browser would otherwise scroll the page on PageUp/PageDown and move\n // the caret on the arrows.\n event.preventDefault();\n bump(by);\n };\n\n const handleBlur = () => {\n const parsed = parse(text);\n if (parsed == null) {\n setText('');\n onChange(null);\n } else {\n let v = parsed;\n if (min != null && v < min) v = min;\n if (max != null && v > max) v = max;\n // Round to the field's precision BEFORE reporting it. `format` was\n // already rounding for display, so a precision-2 field given 12.345\n // showed \"12.35\" and left the consumer holding 12.345 — a price field\n // that posts a different number from the one on screen.\n if (precision != null) v = Number(v.toFixed(precision));\n setText(format(v, precision));\n if (v !== parsed) onChange(v);\n }\n onBlur?.();\n };\n\n const field = (\n <input\n ref={ref}\n id={id}\n name={name}\n // `type=\"text\"` with a numeric inputMode, not `type=\"number\"`: a number\n // input silently discards non-numeric text (so the buffer above could\n // never see \"1.\"), scrolls the value on a stray wheel event, and renders\n // spinners that are a 12px hit target.\n type=\"text\"\n inputMode={precision === 0 ? 'numeric' : 'decimal'}\n value={text}\n disabled={disabled}\n placeholder={placeholder}\n step={step}\n // The role is claimed only because the keys behind it are implemented —\n // an element that says spinbutton and ignores the arrows is worse than\n // one that says textbox and does the same.\n role=\"spinbutton\"\n aria-valuenow={value ?? undefined}\n aria-valuemin={min}\n aria-valuemax={max}\n // A spinbutton's value is announced from aria-valuenow, which is a bare\n // number. This carries the formatting the user can see — \"1,250.00\" and\n // the currency the prefix is showing — so the two agree.\n aria-valuetext={value == null ? undefined : format(value, precision)}\n aria-invalid={invalid || undefined}\n onChange={e => handleChange(e.target.value)}\n onKeyDown={handleKeyDown}\n onBlur={handleBlur}\n className={inputClasses({\n invalid,\n size,\n className: [prefix ? 'pl-7' : '', suffix ? 'pr-9' : '', 'text-right tabular-nums', className]\n .filter(Boolean).join(' '),\n })}\n />\n );\n\n if (!prefix && !suffix) return field;\n return (\n <div className=\"relative\">\n {prefix && <span className=\"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-sm text-gray-500\">{prefix}</span>}\n {field}\n {suffix && <span className=\"pointer-events-none absolute right-3 top-1/2 -translate-y-1/2 text-sm text-gray-500\">{suffix}</span>}\n </div>\n );\n});\n\nexport default InputNumber;\n","/**\n * FilePicker — choose files and list them. It does NOT upload.\n *\n * That is the entire design. An uploader that owns transport has to own retry,\n * progress, cancellation, auth and the endpoint, and every consumer ends up\n * fighting a piece of it. This hands the caller a `File[]` and stops; the form\n * submits them however it already submits everything else.\n *\n * Rejections are reported, never silent. A file dropped for being too large or\n * the wrong type is the case where a user is most certain they did the thing\n * and most confused that nothing happened — so the reasons are announced\n * (`role=\"alert\"`), and `accept` is enforced on a drop exactly as the native\n * dialog enforces it on a pick. Intake is `useFileIntake`, shared with every\n * other upload primitive in the kit.\n *\n * The zone is ONE control: a button that opens the dialog on click, Enter or\n * Space and takes a drop. The native input behind it is never a tab stop, so a\n * keyboard user meets the field once (harness UI-15).\n */\nimport { forwardRef, useId, useState, type ReactNode } from 'react';\nimport FormField from './FormField';\nimport { CloseGlyph, FOCUS_RING, dropzoneClass } from './mediaShared';\nimport { FileIntakeAlert, humanSize, useFileIntake } from './useFileIntake';\n\nexport interface FilePickerProps {\n files: File[];\n onChange: (files: File[]) => void;\n /** `accept` — enforced on the native picker AND on a drop, e.g. \"image/*,.pdf\". */\n accept?: string;\n /** Short kind hint, e.g. \"PDF · JPG\", shown under the CTA and in a type rejection. */\n acceptHint?: ReactNode;\n multiple?: boolean;\n /** Rejected above this, with the reason shown. */\n maxSizeBytes?: number;\n /** Rejected beyond this many files total. */\n maxFiles?: number;\n disabled?: boolean;\n label?: ReactNode;\n hint?: ReactNode;\n error?: ReactNode;\n required?: boolean;\n className?: string;\n}\n\nconst FilePicker = forwardRef<HTMLButtonElement, FilePickerProps>(function FilePicker({\n files, onChange, accept, acceptHint, multiple = true, maxSizeBytes, maxFiles,\n disabled = false, label, hint, error, required, className = '',\n}, ref) {\n const zoneId = useId();\n const [focused, setFocused] = useState(false);\n\n const intake = useFileIntake({\n accept, acceptHint, maxSizeBytes, maxFiles, multiple, disabled,\n currentCount: files.length,\n onAccept: accepted => onChange(multiple ? [...files, ...accepted] : accepted.slice(0, 1)),\n });\n\n const describedBy = error ? `${zoneId}-error` : hint ? `${zoneId}-hint` : undefined;\n\n return (\n <FormField label={label} htmlFor={zoneId} hint={hint} error={error} required={required} className={className}>\n <button\n ref={ref}\n type=\"button\"\n id={zoneId}\n disabled={disabled}\n onClick={intake.open}\n onFocus={() => setFocused(true)}\n onBlur={() => setFocused(false)}\n aria-invalid={error ? true : undefined}\n aria-required={required || undefined}\n aria-describedby={describedBy}\n {...intake.zoneProps}\n className={dropzoneClass(intake.dragOver, disabled, 'px-4 py-6')}\n style={{ outline: 'none', boxShadow: focused && !disabled ? FOCUS_RING : undefined }}\n >\n <span>\n <span className=\"text-sm font-medium text-blue-600\">Choose {multiple ? 'files' : 'a file'}</span>\n <span className=\"text-sm text-gray-500\"> or drag {multiple ? 'them' : 'it'} here</span>\n </span>\n {acceptHint && <span className=\"text-xs text-gray-400\">{acceptHint}</span>}\n </button>\n <input {...intake.inputProps} />\n\n {files.length > 0 && (\n <ul className=\"mt-2 flex flex-col gap-1\">\n {files.map((file, i) => (\n <li key={`${file.name}-${i}`} className=\"flex items-center justify-between gap-3 rounded-md bg-gray-50 px-3 py-2\">\n <span className=\"min-w-0 flex-1 truncate text-sm text-gray-800\" title={file.name}>{file.name}</span>\n <span className=\"shrink-0 text-xs tabular-nums text-gray-500\">{humanSize(file.size)}</span>\n <button\n type=\"button\"\n disabled={disabled}\n onClick={() => { intake.clearRejections(); onChange(files.filter((_, j) => j !== i)); }}\n aria-label={`Remove ${file.name}`}\n className=\"shrink-0 text-gray-400 hover:text-gray-600\"\n >\n <CloseGlyph />\n </button>\n </li>\n ))}\n </ul>\n )}\n\n <FileIntakeAlert rejections={intake.rejections} />\n </FormField>\n );\n});\n\nexport default FilePicker;\n","/**\n * ComposerAttachments — files attached to a message being written.\n *\n * A composer is a text area with a send action: a chat reply, a mail compose\n * form, a feedback thread. Files reach it three ways — the \"Attach files\"\n * button, a drop anywhere on the composer, and a paste into the text area —\n * and before this each portal composer wired those itself: five drop zones in\n * five highlight styles, four copies of the same 25 MB / 10-file guard, and\n * three composers that took a pasted screenshot but no dropped one. This is\n * the one primitive (harness UI-15 / PAT-10), built on `useFileIntake` so the\n * checks and the rejection sentences are the ones every other upload surface\n * uses.\n *\n * It holds pending `File[]` and stops. It never uploads — the composer's send\n * puts the files in the request however it sends everything else.\n *\n * Three parts, exported separately for a composer with a layout of its own\n * (an icon rail, a footer with its own send button):\n *\n * `AttachmentDropZone` — wraps the composer; the drop target, the paste\n * target (paste bubbles up from the text area inside it), the hidden native\n * input, and the \"Drop files to attach\" overlay.\n * `AttachmentList` — the pending files as chips: thumbnail for an image, a\n * glyph otherwise, name, size, and a remove ×.\n * `AttachButton` — the paperclip. A labelled secondary button, or icon-only\n * for a rail, with the pending count on it.\n *\n * `ComposerAttachments` assembles them in the standard order — text area,\n * chips, trigger row, rejections — for the composer that has no reason to\n * differ.\n */\nimport { useEffect, useRef, type ReactNode } from 'react';\nimport Button from './Button';\nimport IconButton from './IconButton';\nimport { CloseGlyph } from './mediaShared';\nimport {\n FileIntakeAlert, humanSize, useFileIntake,\n type FileIntakeLimits, type FileRejection,\n} from './useFileIntake';\n\n/** What `useFileIntake` hands back; the three parts take it as `intake`. */\nexport type FileIntake = ReturnType<typeof useFileIntake>;\n\n/** Paperclip, in the kit's line-icon style. */\nexport function PaperclipGlyph({ className = 'h-4 w-4' }: { className?: string }) {\n return (\n <svg\n viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={1.8}\n strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\" className={className}\n >\n <path d=\"M21 11.5l-8.5 8.5a5.5 5.5 0 0 1-7.8-7.8l9-9a3.5 3.5 0 0 1 5 5l-9 9a1.5 1.5 0 0 1-2.1-2.1l8-8\" />\n </svg>\n );\n}\n\n/** A generic document, for a chip whose file has no thumbnail. */\nfunction FileGlyph({ className = 'h-4 w-4' }: { className?: string }) {\n return (\n <svg\n viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={1.6}\n strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\" className={className}\n >\n <path d=\"M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z\" />\n <path d=\"M14 3v5h5\" />\n </svg>\n );\n}\n\n// ── AttachmentDropZone ──────────────────────────────────────────────────────\n\nexport interface AttachmentDropZoneProps {\n intake: FileIntake;\n /** The overlay's words while a file drag is over the composer. Default \"Drop files to attach\". */\n dropLabel?: ReactNode;\n className?: string;\n children: ReactNode;\n}\n\n/**\n * The composer's drop and paste target. Spread the intake's zone and paste\n * handlers on one wrapper: a paste in the text area bubbles up to it, so the\n * text area needs no wiring of its own, and a paste of text is left alone.\n */\nexport function AttachmentDropZone({ intake, dropLabel = 'Drop files to attach', className = '', children }: AttachmentDropZoneProps) {\n return (\n <div {...intake.zoneProps} {...intake.pasteProps} className={`relative ${className}`}>\n {children}\n <input {...intake.inputProps} />\n {intake.dragOver && (\n <div\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute inset-0 z-10 flex items-center justify-center rounded-lg border-2 border-dashed border-blue-500 bg-blue-50/80 text-sm font-medium text-blue-600\"\n >\n {dropLabel}\n </div>\n )}\n </div>\n );\n}\n\n// ── AttachmentList ──────────────────────────────────────────────────────────\n\nexport interface AttachmentListProps {\n files: File[];\n /** Remove the file at this index. Omit for a read-only list. */\n onRemove?: (index: number) => void;\n disabled?: boolean;\n className?: string;\n}\n\nconst canPreview = () => typeof URL !== 'undefined' && typeof URL.createObjectURL === 'function';\n\n/**\n * Pending files as chips. An image gets a thumbnail from an object URL the\n * list owns — minted once per File, revoked when the file leaves the list or\n * the list unmounts, so a long composing session does not leak them.\n */\nexport function AttachmentList({ files, onRemove, disabled = false, className = '' }: AttachmentListProps) {\n const urls = useRef(new Map<File, string>());\n\n useEffect(() => {\n const live = new Set(files);\n for (const [file, url] of urls.current) {\n if (!live.has(file)) {\n URL.revokeObjectURL(url);\n urls.current.delete(file);\n }\n }\n }, [files]);\n useEffect(() => () => {\n for (const url of urls.current.values()) URL.revokeObjectURL(url);\n urls.current.clear();\n }, []);\n\n const thumbFor = (file: File): string | null => {\n if (!file.type.startsWith('image/') || !canPreview()) return null;\n let url = urls.current.get(file);\n if (!url) {\n url = URL.createObjectURL(file);\n urls.current.set(file, url);\n }\n return url;\n };\n\n if (files.length === 0) return null;\n return (\n <ul className={`flex flex-wrap gap-1.5 ${className}`}>\n {files.map((file, i) => {\n const thumb = thumbFor(file);\n return (\n <li\n key={`${file.name}-${file.size}-${i}`}\n className=\"flex max-w-full items-center gap-1.5 rounded-md border border-gray-200 bg-gray-50 py-1 pl-1.5 pr-1 text-xs text-gray-700\"\n >\n {thumb ? (\n <img src={thumb} alt=\"\" className=\"h-6 w-6 shrink-0 rounded object-cover\" />\n ) : (\n <span className=\"text-gray-400\"><FileGlyph /></span>\n )}\n <span className=\"min-w-0 truncate\" title={file.name}>{file.name}</span>\n <span className=\"shrink-0 tabular-nums text-gray-400\">{humanSize(file.size)}</span>\n {onRemove && (\n <button\n type=\"button\"\n disabled={disabled}\n onClick={() => onRemove(i)}\n aria-label={`Remove ${file.name}`}\n className=\"shrink-0 rounded p-0.5 text-gray-400 hover:bg-gray-200 hover:text-gray-600 disabled:cursor-not-allowed\"\n >\n <CloseGlyph className=\"h-3.5 w-3.5\" />\n </button>\n )}\n </li>\n );\n })}\n </ul>\n );\n}\n\n// ── AttachButton ────────────────────────────────────────────────────────────\n\nexport interface AttachButtonProps {\n /** Open the dialog — `intake.open`. */\n onClick: () => void;\n /** Pending files, shown on the button so a rail with a hidden list still tells the count. */\n count?: number;\n /** `button` is the labelled secondary button; `icon` is the paperclip alone, for a rail. Default `button`. */\n variant?: 'button' | 'icon';\n /** Default \"Attach files\". */\n label?: string;\n disabled?: boolean;\n}\n\n/** The paperclip. One label everywhere: \"Attach files\". */\nexport function AttachButton({ onClick, count = 0, variant = 'button', label = 'Attach files', disabled = false }: AttachButtonProps) {\n const counted = count > 0 ? `${label} (${count})` : label;\n if (variant === 'icon') {\n return (\n <span className=\"relative inline-flex\">\n <IconButton aria-label={counted} onClick={onClick} disabled={disabled} size=\"sm\">\n <PaperclipGlyph />\n </IconButton>\n {count > 0 && (\n <span\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute -right-1 -top-1 min-w-[1rem] rounded-full bg-blue-600 px-1 text-center text-[10px] font-semibold leading-4 text-white\"\n >\n {count}\n </span>\n )}\n </span>\n );\n }\n return (\n <Button type=\"button\" variant=\"secondary\" size=\"sm\" onClick={onClick} disabled={disabled} leftIcon={<PaperclipGlyph />}>\n {counted}\n </Button>\n );\n}\n\n// ── ComposerAttachments ─────────────────────────────────────────────────────\n\nexport interface ComposerAttachmentsProps extends FileIntakeLimits {\n /** The pending files. */\n files: File[];\n onChange: (files: File[]) => void;\n /** Short kind hint, e.g. \"PNG · JPG · PDF\", used in a type rejection. */\n acceptHint?: ReactNode;\n disabled?: boolean;\n /** The overlay's words while a file drag is over the composer. */\n dropLabel?: ReactNode;\n /** The trigger's words. Default \"Attach files\". */\n attachLabel?: string;\n /** `button` (default) or `icon`. */\n trigger?: 'button' | 'icon';\n /** More controls on the trigger row — a screenshot capture, a voice note. */\n actions?: ReactNode;\n /** Called with every rejection batch, for a composer that toasts as well. */\n onReject?: (rejections: FileRejection[]) => void;\n className?: string;\n /** The text area (and anything else the message is written in). */\n children: ReactNode;\n}\n\n/**\n * The standard composer: text area, then the chips, then the trigger row, then\n * the rejections. Wrap it around the text area and hand it the pending list.\n */\nexport default function ComposerAttachments({\n files, onChange, accept, maxSizeBytes, maxFiles, acceptHint, disabled = false,\n dropLabel, attachLabel, trigger = 'button', actions, onReject, className = '', children,\n}: ComposerAttachmentsProps) {\n const intake = useFileIntake({\n accept, maxSizeBytes, maxFiles, acceptHint, disabled, multiple: true,\n currentCount: files.length,\n onAccept: added => onChange([...files, ...added]),\n });\n\n const rejectedRef = useRef<FileRejection[]>([]);\n useEffect(() => {\n if (onReject && intake.rejections.length > 0 && intake.rejections !== rejectedRef.current) {\n rejectedRef.current = intake.rejections;\n onReject(intake.rejections);\n }\n }, [intake.rejections, onReject]);\n\n return (\n <AttachmentDropZone intake={intake} dropLabel={dropLabel} className={className}>\n {children}\n <AttachmentList\n files={files}\n disabled={disabled}\n onRemove={i => { intake.clearRejections(); onChange(files.filter((_, j) => j !== i)); }}\n className=\"mt-2\"\n />\n <div className=\"mt-2 flex flex-wrap items-center gap-2\">\n <AttachButton onClick={intake.open} count={files.length} variant={trigger} label={attachLabel} disabled={disabled} />\n {actions}\n </div>\n <FileIntakeAlert rejections={intake.rejections} />\n </AttachmentDropZone>\n );\n}\n","/**\n * SearchableSelect — combobox-style form control. Looks like a normal form\n * `<input>` (so it drops in alongside other form fields), but typing filters\n * the options list in a frosted-glass dropdown. Promoted from the EFFICIENT\n * admin portal, where it fronts every entity picker.\n *\n * Use it when the option list is small enough to load all at once; for\n * server-backed lists, wire `onSearchChange` to a debounced query and keep\n * feeding the latest page through `options` — the component keeps working\n * as a dumb view over whatever options it's given.\n *\n * The dropdown is portaled to `document.body` and positioned `fixed` at the\n * trigger's viewport rect. Rendering it in place would let any scrolling /\n * `overflow-hidden` ancestor (every form's scroll container, a window panel)\n * clip it — the classic \"the list is cut off by the modal footer\" bug. See\n * `PopupMenu`'s `portal` prop for the same reasoning.\n */\nimport { useState, useRef, useMemo, useEffect, useLayoutEffect, type ReactNode } from 'react';\nimport { createPortal } from 'react-dom';\nimport { glassStyle } from '../utils/glass';\nimport { INPUT_BASE } from '../forms/styles';\nimport { useDropdownPosition, MENU_MAX_HEIGHT } from '../forms/dropdownPosition';\nimport { useShellStrings } from './strings';\nimport { registerModalEscapeInterceptor } from './escapeInterceptors';\nimport { onOverlayOpen } from './overlayEvents';\nimport { Z_LAYERS } from './zLayers';\n\nexport interface SearchableOption {\n value: string;\n label: string;\n /** Optional secondary text rendered greyed-out on the right of the\n * option (e.g. an order date next to a proforma number). */\n sublabel?: string;\n}\n\nexport interface SearchableSelectProps {\n value: string;\n onChange: (value: string) => void;\n options: SearchableOption[];\n /** Placeholder shown when no value is selected and the field is empty. */\n placeholder?: string;\n /** Fallback placeholder text when no `placeholder` is provided and\n * nothing is selected. Clearing the selection is done via the hover\n * \"×\" on the input itself. */\n emptyOptionLabel?: string;\n /** Extra Tailwind classes appended to the input (error rings, custom\n * widths…). The base form-input styling is built in. */\n className?: string;\n disabled?: boolean;\n /** Optional id for label-for wiring. */\n id?: string;\n /** When true, the user can submit a value that isn't in `options` —\n * pressing Enter or clicking outside with non-empty search text\n * fires `onChange` with the typed string. The trigger then displays\n * that free-text value as-is. Default false: only listed options\n * can be picked, typing only filters. */\n allowFreeText?: boolean;\n /** Optional notifier fired whenever the user-typed search text changes\n * (including resets to ''). Lets a parent debounce the value and feed\n * a server-side query, so this component can still front a list that\n * is too large to load up-front. */\n onSearchChange?: (text: string) => void;\n /** Optional content rendered inside the trigger's right edge — to the\n * left of the clear button — when the dropdown is closed. Use for\n * compact status pills that should read alongside the selected label.\n * Hidden while the user is typing so the search text stays legible. */\n rightAdornment?: ReactNode;\n}\n\n// Menu geometry + the positioning hook live in `src/forms/dropdownPosition`,\n// shared with TagInput.\n\n/** Hover-revealed × that clears the selection. The parent is `relative\n * group`, so the button fades in on field hover only. mousedown (not\n * click) so the input's focus/open handlers never fire. */\nfunction ClearButton({ onClear, ariaLabel }: { onClear: () => void; ariaLabel: string }) {\n return (\n <button\n type=\"button\"\n aria-label={ariaLabel}\n onMouseDown={(e) => { e.preventDefault(); e.stopPropagation(); onClear(); }}\n className=\"absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity text-base leading-none\"\n >\n &times;\n </button>\n );\n}\n\n// Trigger input styling is shared with the other form controls — see\n// `src/forms/styles.ts` (INPUT_BASE), which also picks up the dark-theme\n// input remaps from styles.css.\n\nexport default function SearchableSelect({\n value, onChange, options, placeholder, emptyOptionLabel, className = '',\n disabled, id, allowFreeText = false, onSearchChange, rightAdornment,\n}: SearchableSelectProps) {\n const [open, setOpen] = useState(false);\n const [search, setSearchState] = useState('');\n // Catalog defaults — a caller's own labels always win (see strings.tsx).\n const strings = useShellStrings();\n const noneLabel = emptyOptionLabel ?? strings.select.none;\n // Wrap setSearch so every change also notifies the parent (when wired up).\n // Keeps the in-memory filtering working while letting a parent that wants\n // server-side search debounce + react to the same value.\n const setSearch = (next: string) => {\n setSearchState(next);\n onSearchChange?.(next);\n };\n const wrapRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLInputElement>(null);\n const menuRef = useRef<HTMLDivElement>(null);\n const adornRef = useRef<HTMLDivElement>(null);\n // Read by the handlers that can run between a close and the re-render that\n // follows it — a blur the close itself caused, or an overlay opening in the\n // same commit — so a menu that has already closed is never closed twice\n // (and never commits free text on its way out after a pick).\n const openRef = useRef(open);\n openRef.current = open;\n // True for the length of a pointer press inside the portalled menu. Pressing\n // its padding, its \"no matches\" line or its scrollbar moves focus to <body>,\n // and that blur must not read as focus leaving the control.\n const menuPressRef = useRef(false);\n\n /** Close the menu. `commit` applies the free-text rule every \"the user\n * moved on\" path shares — outside press, Tab, focus leaving, an overlay\n * opening: typed text that is not the current value becomes the value. */\n const closeMenu = (commit: boolean) => {\n if (!openRef.current) return;\n openRef.current = false;\n const typed = search.trim();\n if (commit && allowFreeText && typed && typed !== value) onChange(typed);\n setOpen(false);\n setSearch('');\n };\n\n // Reserve input padding for the right adornment so long labels truncate\n // in front of it instead of running underneath. Measured (adornment width\n // varies — a pill, an icon row…) and re-checked per render; the state\n // setter bails when the number is unchanged.\n const [adornPad, setAdornPad] = useState<number | null>(null);\n useLayoutEffect(() => {\n if (!rightAdornment || open) { setAdornPad(null); return; }\n const w = adornRef.current?.offsetWidth ?? 0;\n // adornment width + its right offset (8px, or 32px when the clear ×\n // also reserves space) + a 6px gap to the text.\n setAdornPad(w ? w + (value && !disabled ? 32 : 8) + 6 : null);\n });\n\n const menuPos = useDropdownPosition(triggerRef, open, { matchTriggerWidth: true });\n\n // Cached lookup so the closed-state display can show the current\n // selection's label without scanning options on every keystroke. In\n // free-text mode, fall back to the raw `value` so user-typed entries\n // round-trip visibly.\n const selectedLabel = useMemo(() => {\n const match = options.find(o => o.value === value);\n if (match) return match.label;\n return allowFreeText ? value : '';\n }, [options, value, allowFreeText]);\n\n // Close on outside pointer-down. The menu is portaled to `document.body`\n // (outside `wrapRef`), so the check has to treat clicks inside EITHER the\n // trigger wrap or the portaled menu as \"inside\" — otherwise scrolling the\n // menu or clicking a wide option would dismiss it.\n //\n // An overlay opening (⌘K's search palette, a Dialog) closes it too: the menu\n // is layered above the overlay layer, so left open it floats crisp over the\n // overlay's backdrop — see `overlayEvents.ts`.\n useEffect(() => {\n if (!open) return;\n const handler = (e: MouseEvent) => {\n const t = e.target as Node;\n if (wrapRef.current?.contains(t) || menuRef.current?.contains(t)) return;\n closeMenu(true);\n };\n document.addEventListener('mousedown', handler);\n const offOverlay = onOverlayOpen(() => closeMenu(true));\n return () => {\n document.removeEventListener('mousedown', handler);\n offOverlay();\n };\n }, [open, allowFreeText, search, value, onChange]);\n\n // Esc closes the menu first, WITHOUT closing the window or dialog around it.\n // Modal's Escape handler runs on window in the CAPTURE phase, ahead of the\n // input's own onKeyDown, so the interceptor seam is the only way to get\n // there first — the same registration `Select` makes. The onKeyDown branch\n // below still covers a plain page, where the seam's own drain calls this.\n useEffect(() => {\n if (!open) return;\n return registerModalEscapeInterceptor(e => {\n if (e.key !== 'Escape' || !openRef.current) return false;\n closeMenu(false);\n triggerRef.current?.blur();\n return true;\n });\n }, [open]);\n\n // Dedupe by `value` — call sites occasionally feed option lists that\n // contain the same id twice (a server returning a row twice across pages,\n // two cache writers landing on the same key, …). First-wins keeps the\n // earliest entry so duplicate React keys never happen downstream.\n const dedupedOptions = useMemo(() => {\n const seen = new Set<string>();\n const out: SearchableOption[] = [];\n for (const o of options) {\n if (seen.has(o.value)) continue;\n seen.add(o.value);\n out.push(o);\n }\n return out;\n }, [options]);\n\n const filtered = useMemo(() => {\n // Server-search mode (parent wired `onSearchChange`): the options ARE the\n // server's results for the typed text, so show them verbatim. Re-filtering\n // here on label/sublabel would silently hide valid matches the server made\n // on other fields (e.g. a row matched by a field that isn't the label),\n // making the search look capped.\n if (onSearchChange) return dedupedOptions;\n const q = search.trim().toLowerCase();\n if (!q) return dedupedOptions;\n return dedupedOptions.filter(o =>\n o.label.toLowerCase().includes(q) ||\n (o.sublabel?.toLowerCase().includes(q) ?? false)\n );\n }, [dedupedOptions, search, onSearchChange]);\n\n return (\n <div\n ref={wrapRef}\n className=\"relative group\"\n // Focus leaving BOTH the field and the menu closes it — clicking into\n // another window's field, a script moving focus, anything the outside\n // press and the Tab key do not see. React's onBlur is `focusout`, and it\n // bubbles through the portal along the React tree, so a blur inside the\n // menu arrives here too.\n onBlur={e => {\n const next = e.relatedTarget as Node | null;\n if (next && (wrapRef.current?.contains(next) || menuRef.current?.contains(next))) return;\n if (menuPressRef.current) return;\n // The browser window lost focus, not the field: activeElement still\n // points at the input, and the menu should be there when the user\n // comes back.\n if (document.activeElement === triggerRef.current) return;\n closeMenu(true);\n }}\n >\n {/* Combobox-style trigger: shows the selected label when closed,\n and becomes the search field when focused — typing filters\n the option list directly, no separate search box. */}\n <input\n id={id}\n ref={triggerRef}\n type=\"text\"\n autoComplete=\"off\"\n role=\"combobox\"\n aria-expanded={open}\n value={open ? search : selectedLabel}\n onChange={e => { setSearch(e.target.value); setOpen(true); }}\n onFocus={() => { if (!disabled) { setSearch(''); setOpen(true); } }}\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n e.preventDefault();\n if (filtered.length === 1) {\n onChange(filtered[0].value);\n closeMenu(false);\n } else if (allowFreeText && search.trim()) {\n onChange(search.trim());\n closeMenu(false);\n triggerRef.current?.blur();\n }\n } else if (e.key === 'Escape') {\n closeMenu(false);\n triggerRef.current?.blur();\n } else if (e.key === 'Tab') {\n // Tab moves focus to the next field; close/clear the dropdown so the\n // body-portaled results don't linger over the neighbour (BG#00359).\n // No preventDefault — let Tab advance focus as usual (covers\n // Shift+Tab too). The free-text commit is the outside-press rule.\n closeMenu(true);\n }\n }}\n placeholder={placeholder || noneLabel}\n className={`${INPUT_BASE} ${className} ${value ? 'pr-8' : ''} ${disabled ? 'bg-gray-50 text-gray-400 cursor-not-allowed' : ''} truncate`}\n style={adornPad ? { paddingRight: adornPad } : undefined}\n disabled={disabled}\n />\n {value && !disabled && (\n <ClearButton ariaLabel={strings.select.clear} onClear={() => { onChange(''); closeMenu(false); }} />\n )}\n {rightAdornment && !open && (\n <div ref={adornRef} className={`absolute top-1/2 -translate-y-1/2 ${value && !disabled ? 'right-8' : 'right-2'} flex items-center gap-1 flex-nowrap justify-end pointer-events-none`}>\n {rightAdornment}\n </div>\n )}\n {open && createPortal(\n <div\n ref={menuRef}\n onMouseDownCapture={() => {\n menuPressRef.current = true;\n // Cleared after the press's default action (the focus move) has run.\n setTimeout(() => { menuPressRef.current = false; }, 0);\n }}\n // The dropdown must sit ABOVE the modal layer, not below it.\n //\n // It was z-[400], under Dialog and Drawer at z-[9999] — so a Select\n // inside a dialog, which is where form controls usually are, opened\n // its menu behind the dialog that owns it. Nothing looked broken;\n // the list simply was not there.\n //\n // Above the toasts too, deliberately: a menu is open only while the\n // user is holding it open, and a notification arriving underneath it\n // is better than one that covers what they are choosing from.\n className=\"fixed rounded-2xl overflow-hidden\"\n style={{\n zIndex: Z_LAYERS.popup,\n left: menuPos?.left,\n right: menuPos?.right,\n top: menuPos?.top,\n bottom: menuPos?.bottom,\n minWidth: menuPos?.minWidth,\n width: menuPos?.width,\n // Hidden for the first paint until the layout effect measures the\n // trigger, so the menu never flashes at (0,0).\n visibility: menuPos ? undefined : 'hidden',\n ...glassStyle(),\n }}\n >\n <div className=\"overflow-y-auto\" style={{ maxHeight: menuPos?.maxHeight ?? MENU_MAX_HEIGHT }}>\n {filtered.length === 0 ? (\n <p className=\"px-3 py-3 text-sm text-gray-400 text-center\">{strings.select.noMatches}</p>\n ) : (\n filtered.map(o => (\n <button\n key={o.value}\n type=\"button\"\n onMouseDown={() => { onChange(o.value); closeMenu(false); }}\n className={`w-full overflow-hidden text-left px-3 py-1.5 text-sm hover:bg-gray-50 flex items-center justify-between gap-2 whitespace-nowrap ${value === o.value ? 'text-blue-600 font-medium bg-blue-50/50' : 'text-gray-700'}`}\n >\n <span className=\"min-w-0 flex-1 truncate\">{o.label}</span>\n {o.sublabel && <span className=\"min-w-0 max-w-[45%] shrink-0 truncate text-xs text-gray-400\">{o.sublabel}</span>}\n </button>\n ))\n )}\n </div>\n </div>,\n document.body\n )}\n </div>\n );\n}\n","/**\n * TagInput — SearchableSelect's multi-value sibling. The field holds the\n * chosen values as removable chips with an inline text input after them;\n * typing filters the option list in the same portaled frosted dropdown, and\n * picking an option appends it. Assigning several categories, roles or\n * suppliers to a record is this shape, and each portal was one bad afternoon\n * away from hand-rolling it.\n *\n * Deliberate contracts, all matching SearchableSelect where the two overlap:\n * - Controlled: `value` is the array, `onChange` gets the whole next array.\n * - Values already chosen leave the option list; adding a value twice is a\n * no-op, so the array is always duplicate-free.\n * - `allowFreeText` commits the typed text on Enter / comma / Tab / outside\n * click. Off by default: only listed options can be picked.\n * - Backspace in an empty input removes the last chip — the convention every\n * tag field trains, and the keyboard path to removal.\n * - Picking from the list keeps the dropdown open (multi-add is the entire\n * point); Escape and outside clicks close it.\n */\nimport { useEffect, useMemo, useRef, useState } from 'react';\nimport { createPortal } from 'react-dom';\n\nimport { glassStyle } from '../utils/glass';\nimport { inputClasses } from './styles';\nimport { MENU_MAX_HEIGHT, POPUP_MAX_WIDTH, useDropdownPosition } from './dropdownPosition';\nimport { useShellStrings } from '../shell/strings';\nimport { onOverlayOpen } from '../shell/overlayEvents';\nimport { Z_LAYERS } from '../shell/zLayers';\n\nexport interface TagInputOption {\n value: string;\n label: string;\n}\n\nexport interface TagInputProps {\n value: string[];\n onChange: (value: string[]) => void;\n /** The pickable list. Omit it for a pure free-text tag field (with\n * `allowFreeText`), where the dropdown never renders. */\n options?: TagInputOption[];\n placeholder?: string;\n /** When true, Enter / comma / Tab / clicking away commits the typed text as\n * a tag of its own. Default false: only listed options can be picked. */\n allowFreeText?: boolean;\n /** Error state — red border + ring, matching Input. */\n invalid?: boolean;\n disabled?: boolean;\n /** Optional id for label-for wiring, applied to the inner text input. */\n id?: string;\n className?: string;\n}\n\nexport default function TagInput({\n value, onChange, options = [], placeholder, allowFreeText = false,\n invalid, disabled, id, className = '',\n}: TagInputProps) {\n const [open, setOpen] = useState(false);\n const [search, setSearch] = useState('');\n const strings = useShellStrings();\n const wrapRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n const menuRef = useRef<HTMLDivElement>(null);\n const menuPos = useDropdownPosition(wrapRef, open);\n\n const labelFor = (v: string) => options.find(o => o.value === v)?.label ?? v;\n\n // Chosen values leave the list; the remainder filters on the typed text.\n // Dedupe by value first for the same reason SearchableSelect does — a list\n // fed twice must not become duplicate React keys.\n const available = useMemo(() => {\n const seen = new Set<string>(value);\n const out: TagInputOption[] = [];\n const q = search.trim().toLowerCase();\n for (const o of options) {\n if (seen.has(o.value)) continue;\n seen.add(o.value);\n if (!q || o.label.toLowerCase().includes(q)) out.push(o);\n }\n return out;\n }, [options, value, search]);\n\n const add = (v: string) => {\n if (!v || value.includes(v)) { setSearch(''); return; }\n onChange([...value, v]);\n setSearch('');\n };\n const remove = (v: string) => onChange(value.filter(x => x !== v));\n const commitFreeText = () => {\n const t = search.trim();\n if (allowFreeText && t) add(t);\n else setSearch('');\n };\n\n // Close on outside pointer-down — the menu is portaled, so \"inside\" means\n // the field wrap OR the menu (see SearchableSelect). An overlay opening is\n // treated the same way (see `overlayEvents.ts`): the menu is layered above\n // the overlay layer and would otherwise float over it.\n //\n // The overlay path reads the handler through a ref, because an overlay can\n // open in the SAME commit as a pick (a parent opening a dialog from\n // `onChange`): the listener still subscribed then is the previous render's,\n // and its `value` and typed text are the ones from before the pick.\n const dismissRef = useRef<() => void>(() => {});\n dismissRef.current = () => { commitFreeText(); setOpen(false); };\n useEffect(() => {\n if (!open) return;\n const handler = (e: MouseEvent) => {\n const t = e.target as Node;\n if (wrapRef.current?.contains(t) || menuRef.current?.contains(t)) return;\n commitFreeText();\n setOpen(false);\n };\n document.addEventListener('mousedown', handler);\n const offOverlay = onOverlayOpen(() => dismissRef.current());\n return () => {\n document.removeEventListener('mousedown', handler);\n offOverlay();\n };\n });\n\n const hasMenu = options.length > 0;\n\n return (\n <div ref={wrapRef} className=\"relative\">\n {/* The field is the chips plus an inline input, wearing the shared form\n * styling. The focus ring is focus-within — the div itself never takes\n * focus, the inner input does (a click anywhere in the field lands it\n * there). */}\n <div\n onMouseDown={e => {\n if (disabled) return;\n // Let clicks on chip-remove buttons do their job; anything else\n // focuses the input, like clicking anywhere in a real text field.\n if ((e.target as HTMLElement).closest('button')) return;\n e.preventDefault();\n inputRef.current?.focus();\n }}\n className={inputClasses({\n invalid,\n className: `flex flex-wrap items-center gap-1 cursor-text focus-within:border-blue-400 focus-within:ring-2 focus-within:ring-blue-400/30 ${disabled ? 'bg-gray-50 cursor-not-allowed' : ''} ${className}`,\n })}\n >\n {value.map(v => (\n <span key={v} className=\"inline-flex max-w-full items-center gap-1 rounded bg-blue-50 px-1.5 py-0.5 text-xs font-medium text-blue-700\">\n <span className=\"truncate\">{labelFor(v)}</span>\n {!disabled && (\n <button\n type=\"button\"\n aria-label={`${strings.select.remove} ${labelFor(v)}`}\n onClick={() => remove(v)}\n className=\"text-blue-400 hover:text-red-500 focus:outline-none focus-visible:ring-1 focus-visible:ring-blue-500 rounded leading-none\"\n >\n &times;\n </button>\n )}\n </span>\n ))}\n <input\n id={id}\n ref={inputRef}\n type=\"text\"\n autoComplete=\"off\"\n role=\"combobox\"\n aria-expanded={open && hasMenu}\n aria-invalid={invalid || undefined}\n disabled={disabled}\n value={search}\n placeholder={value.length === 0 ? placeholder : undefined}\n onChange={e => { setSearch(e.target.value); setOpen(true); }}\n onFocus={() => { if (!disabled && hasMenu) setOpen(true); }}\n onKeyDown={e => {\n if (e.key === 'Enter' || (e.key === ',' && allowFreeText)) {\n e.preventDefault();\n const q = search.trim();\n const matches = q ? available.filter(o => o.label.toLowerCase().includes(q.toLowerCase())) : [];\n if (matches.length === 1) add(matches[0].value);\n else commitFreeText();\n } else if (e.key === 'Backspace' && search === '' && value.length > 0) {\n remove(value[value.length - 1]);\n } else if (e.key === 'Escape') {\n setOpen(false);\n setSearch('');\n inputRef.current?.blur();\n } else if (e.key === 'Tab') {\n // No preventDefault — Tab advances focus; commit like the\n // outside-click path so the two agree (see SearchableSelect).\n commitFreeText();\n setOpen(false);\n }\n }}\n className=\"min-w-[8ch] flex-1 border-none bg-transparent p-0 text-sm text-gray-800 placeholder:text-gray-400 focus:outline-none focus:ring-0 disabled:cursor-not-allowed\"\n />\n </div>\n {open && hasMenu && createPortal(\n <div\n ref={menuRef}\n // The dropdown must sit ABOVE the modal layer, not below it.\n //\n // It was z-[400], under Dialog and Drawer at z-[9999] — so a Select\n // inside a dialog, which is where form controls usually are, opened\n // its menu behind the dialog that owns it. Nothing looked broken;\n // the list simply was not there.\n //\n // Above the toasts too, deliberately: a menu is open only while the\n // user is holding it open, and a notification arriving underneath it\n // is better than one that covers what they are choosing from.\n className=\"fixed rounded-2xl overflow-hidden\"\n style={{\n zIndex: Z_LAYERS.popup,\n left: menuPos?.left,\n right: menuPos?.right,\n top: menuPos?.top,\n bottom: menuPos?.bottom,\n minWidth: menuPos?.minWidth,\n maxWidth: menuPos?.maxWidth ?? POPUP_MAX_WIDTH,\n width: 'max-content',\n // Hidden for the first paint until the layout effect measures the\n // trigger, so the menu never flashes at (0,0).\n visibility: menuPos ? undefined : 'hidden',\n ...glassStyle(),\n }}\n >\n <div className=\"overflow-y-auto\" style={{ maxHeight: menuPos?.maxHeight ?? MENU_MAX_HEIGHT }}>\n {available.length === 0 ? (\n <p className=\"px-3 py-3 text-sm text-gray-400 text-center\">\n {options.length > 0 && value.length >= options.length ? strings.select.allSelected : strings.select.noMatches}\n </p>\n ) : (\n available.map(o => (\n <button\n key={o.value}\n type=\"button\"\n // mousedown, not click: the field's own mousedown refocuses\n // the input, and by click time a re-render may have moved\n // this row. Same choice as SearchableSelect's options.\n onMouseDown={e => { e.preventDefault(); add(o.value); }}\n className=\"w-full text-left px-3 py-1.5 text-sm hover:bg-gray-50 text-gray-700 whitespace-nowrap\"\n >\n {o.label}\n </button>\n ))\n )}\n </div>\n </div>,\n document.body,\n )}\n </div>\n );\n}\n","/**\n * Card — the kit's standard surface: a rounded, bordered panel with optional\n * header and footer rows. StatCard is the dashboard variant (label + big value\n * + optional trend delta). Both are pure presentational components.\n */\nimport { useId, type CSSProperties, type ReactNode } from 'react';\n\n/** How much room the card gives its contents. `md` is the desktop default;\n * `lg` suits a touch layout, where the same density reads as cramped. */\nexport type CardPadding = 'none' | 'sm' | 'md' | 'lg';\n\nexport interface CardProps {\n children: ReactNode;\n /** Title row above the body, divided by a hairline. */\n header?: ReactNode;\n /** Row below the body, divided by a hairline. */\n footer?: ReactNode;\n /** Apply default padding to the body. Default true; set false to fill edge-to-edge. */\n /**\n * Render the header as a real heading at this level, and the card as a\n * region named by it.\n *\n * A card with a title IS a region of the page — the thing a screen-reader\n * user jumps between, and the thing a heading list is for. Without this the\n * title is a bold `<div>`: it looks like a heading to everyone who can see\n * it and is invisible to everyone navigating by structure.\n *\n * The level is the caller's because only the caller knows the page's\n * outline; a card inside a section that already has an `h2` needs an `h3`,\n * and guessing produces a jumbled outline rather than no outline.\n *\n * Omitted, nothing changes — the header stays a styled `div` and the card a\n * plain `div`, which is what every card shipping today is.\n */\n headingLevel?: 2 | 3 | 4 | 5 | 6;\n /**\n * Rendered at the far end of the header row, opposite the title — a count, a\n * filter, a \"View all\" link.\n *\n * It is a separate slot because it must stay OUT of the heading. Folded into\n * `header`, a card titled \"Team Members\" with a \"Team active\" chip beside it\n * announces itself as \"Team Members Team active\", and that is the string a\n * heading list shows and a voice command has to match.\n */\n headerActions?: ReactNode;\n /**\n * Names the card as a region when there is no header to name it — a card\n * whose title lives outside it, or which has none.\n *\n * Ignored when `headingLevel` is set: the heading is the better name, and\n * two names on one element is a contradiction rather than a belt and braces.\n */\n 'aria-label'?: string;\n padded?: boolean;\n /**\n * Padding scale. Takes precedence over `padded`, which remains supported and\n * is now the two-value shorthand for it (`true` → `md`, `false` → `none`).\n */\n padding?: CardPadding;\n className?: string;\n /**\n * Classes for the body, beside the padding this component supplies.\n *\n * The body is a wrapper this component owns, so `className` cannot reach it\n * — and a card whose contents are a column with a gap otherwise has to nest\n * a div inside the one already there just to say so.\n */\n bodyClassName?: string;\n /**\n * Inline style for the surface. For values that cannot be a class: an\n * animation delay computed per item, a measured height.\n */\n style?: CSSProperties;\n}\n\n// Header/footer padding scales WITH the body. A `p-6` body above a `px-4 py-3`\n// footer reads as a mistake, and the caller cannot fix it — those rows take no\n// className. `edge` is the horizontal/vertical pair for those rows.\nconst PADDING: Record<CardPadding, { body: string; edge: string }> = {\n none: { body: '', edge: 'px-4 py-3' },\n sm: { body: 'p-3', edge: 'px-3 py-2' },\n md: { body: 'p-4', edge: 'px-4 py-3' },\n lg: { body: 'p-6', edge: 'px-6 py-4' },\n};\n\nexport default function Card({\n children, header, footer, padded = true, padding, headingLevel, headerActions,\n 'aria-label': ariaLabel, className = '', bodyClassName = '', style,\n}: CardProps) {\n const p = PADDING[padding ?? (padded ? 'md' : 'none')];\n // Called unconditionally — it is a hook — and only used when the heading is.\n const headingId = useId();\n\n const titled = headingLevel != null && header != null;\n const Heading = (`h${headingLevel}` as 'h2');\n // A <section> is only a landmark once it has a name. Rendering one for every\n // card would turn a dashboard of twelve into twelve unnamed regions, which\n // is worse than none — so the element follows the name, not the other way.\n const named = titled || (ariaLabel != null && ariaLabel !== '');\n const Root = (named ? 'section' : 'div') as 'div';\n\n const surface = `rounded-lg border border-gray-200 bg-white shadow-sm ${className}`.trim();\n const headerCls = `border-b border-gray-100 ${p.edge} text-sm font-semibold text-gray-900`;\n\n return (\n <Root\n className={surface}\n style={style}\n {...(titled\n ? { 'aria-labelledby': headingId }\n : named\n ? { 'aria-label': ariaLabel }\n : {})}\n >\n {header != null && (\n headerActions != null ? (\n // With actions the row has to be a flex container, so the heading is\n // nested rather than being the row itself — and only the title is\n // inside it.\n <div className={`${headerCls} flex items-center justify-between gap-3`}>\n {titled ? <Heading id={headingId}>{header}</Heading> : <span>{header}</span>}\n {headerActions}\n </div>\n ) : titled ? (\n // Without them the heading carries the row's own styling rather than\n // nesting a second element, so the title is not two boxes deep.\n <Heading id={headingId} className={headerCls}>{header}</Heading>\n ) : (\n <div className={headerCls}>{header}</div>\n )\n )}\n <div className={[p.body, bodyClassName].filter(Boolean).join(' ')}>{children}</div>\n {footer && <div className={`border-t border-gray-100 ${p.edge}`}>{footer}</div>}\n </Root>\n );\n}\n\nexport interface StatCardProps {\n label: ReactNode;\n value: ReactNode;\n icon?: ReactNode;\n /** Trend pill, e.g. `{ value: '12%', direction: 'up' }`. */\n delta?: { value: ReactNode; direction: 'up' | 'down' | 'flat' };\n className?: string;\n}\n\nexport function StatCard({ label, value, icon, delta, className = '' }: StatCardProps) {\n const deltaColor =\n delta?.direction === 'up' ? 'text-green-600'\n : delta?.direction === 'down' ? 'text-red-600'\n : 'text-gray-500';\n const arrow = delta?.direction === 'up' ? '▲' : delta?.direction === 'down' ? '▼' : '→';\n return (\n <div className={`rounded-lg border border-gray-200 bg-white p-4 shadow-sm ${className}`.trim()}>\n <div className=\"flex items-center justify-between\">\n <span className=\"text-xs font-medium uppercase tracking-wide text-gray-500\">{label}</span>\n {icon && <span className=\"text-gray-400\">{icon}</span>}\n </div>\n <div className=\"mt-2 flex items-baseline gap-2\">\n <span className=\"text-2xl font-semibold text-gray-900\">{value}</span>\n {delta && <span className={`text-xs font-medium ${deltaColor}`}>{arrow} {delta.value}</span>}\n </div>\n </div>\n );\n}\n","/**\n * Text, Title, Paragraph — the typographic primitives.\n *\n * They exist so a page can say what a piece of text IS rather than which gray\n * it happens to be. That matters here more than it usually does: dark mode in\n * this package works by remapping utility CLASS NAMES, so text styled through a\n * token object or an inline colour is correct in light mode and permanently\n * wrong in dark. Every tone below resolves to a class the dark remaps know.\n *\n * `tone` is semantic, not decorative. `secondary` and `tertiary` are the two\n * steps of de-emphasis; `danger`/`success`/`warning` state what the text means,\n * never merely what colour it should be.\n */\nimport { type ElementType, type ReactNode } from 'react';\n\nexport type TextTone =\n | 'default' | 'secondary' | 'tertiary' | 'disabled'\n | 'danger' | 'success' | 'warning' | 'link' | 'inherit';\nexport type TextSize = 'xs' | 'sm' | 'md' | 'lg';\nexport type TextWeight = 'normal' | 'medium' | 'semibold';\n\nconst TONE: Record<TextTone, string> = {\n default: 'text-gray-900',\n secondary: 'text-gray-500',\n tertiary: 'text-gray-400',\n disabled: 'text-gray-300',\n danger: 'text-red-600',\n success: 'text-green-600',\n warning: 'text-amber-600',\n link: 'text-blue-600',\n // For text that must take the colour of whatever it sits inside — a solid\n // Banner, a coloured badge. Without this the only escape is a className,\n // which the dark remaps then fight.\n inherit: '',\n};\n\nconst SIZE: Record<TextSize, string> = {\n xs: 'text-xs',\n sm: 'text-sm',\n md: 'text-base',\n lg: 'text-lg',\n};\n\nconst WEIGHT: Record<TextWeight, string> = {\n normal: 'font-normal',\n medium: 'font-medium',\n semibold: 'font-semibold',\n};\n\nexport interface TextProps {\n children?: ReactNode;\n tone?: TextTone;\n size?: TextSize;\n weight?: TextWeight;\n /** Single-line ellipsis. Sets `title` so the full string stays readable. */\n truncate?: boolean;\n /** Render as something other than a span — `label`, `div`, `p`. */\n as?: ElementType;\n className?: string;\n htmlFor?: string;\n title?: string;\n}\n\nexport function Text({\n children, tone = 'default', size = 'sm', weight = 'normal', truncate = false,\n as: Tag = 'span', className = '', ...rest\n}: TextProps) {\n return (\n <Tag\n className={[TONE[tone], SIZE[size], WEIGHT[weight], truncate ? 'block truncate' : '', className]\n .filter(Boolean).join(' ')}\n // A truncated string is unreadable without this, and it is the one place\n // a title attribute is the right answer rather than a hidden affordance:\n // it restores text the layout removed, it does not hide anything new.\n title={rest.title ?? (truncate && typeof children === 'string' ? children : undefined)}\n htmlFor={rest.htmlFor}\n >\n {children}\n </Tag>\n );\n}\n\nexport type TitleLevel = 1 | 2 | 3 | 4 | 5;\n\nconst TITLE: Record<TitleLevel, string> = {\n 1: 'text-2xl font-semibold',\n 2: 'text-xl font-semibold',\n 3: 'text-lg font-semibold',\n 4: 'text-base font-semibold',\n 5: 'text-sm font-semibold',\n};\n\nexport interface TitleProps {\n children?: ReactNode;\n /** Heading level — drives BOTH the tag and the size, so the document\n * outline and the visual hierarchy cannot drift apart. */\n level?: TitleLevel;\n tone?: TextTone;\n className?: string;\n}\n\nexport function Title({ children, level = 2, tone = 'default', className = '' }: TitleProps) {\n const Tag = `h${level}` as ElementType;\n return (\n <Tag className={[TITLE[level], TONE[tone], className].filter(Boolean).join(' ')}>\n {children}\n </Tag>\n );\n}\n\nexport interface ParagraphProps {\n children?: ReactNode;\n tone?: TextTone;\n size?: TextSize;\n className?: string;\n}\n\n/** Body copy. Carries its own bottom margin so stacked paragraphs breathe;\n * the last one's margin is removed rather than left to collapse. */\nexport function Paragraph({ children, tone = 'secondary', size = 'sm', className = '' }: ParagraphProps) {\n return (\n <p className={[TONE[tone], SIZE[size], 'mb-2 last:mb-0', className].filter(Boolean).join(' ')}>\n {children}\n </p>\n );\n}\n","/**\n * Stack, Inline, Grid — layout without a class string at every call site.\n *\n * These replace the row/column/spacer components a page otherwise reaches for.\n * The whole value is in the `gap` prop being a CLOSED union mapped to literal\n * classes: Tailwind reads source text, so `gap-${n}` produces no style at all\n * and fails silently — everything simply sits flush and looks like a CSS bug.\n * A union means an unsupported gap is a compile error instead.\n *\n * Nothing here is a grid system. There are no 12ths and no `span` arithmetic;\n * `Grid` takes a column count and children occupy one cell each. A layout that\n * needs more than that should say so in its own classes rather than push this\n * toward a framework.\n */\nimport { type ReactNode } from 'react';\n\nexport type Gap = 0 | 1 | 2 | 3 | 4 | 6 | 8;\n\nconst GAP: Record<Gap, string> = {\n 0: 'gap-0', 1: 'gap-1', 2: 'gap-2', 3: 'gap-3', 4: 'gap-4', 6: 'gap-6', 8: 'gap-8',\n};\n\nexport type Align = 'start' | 'center' | 'end' | 'stretch' | 'baseline';\nconst ALIGN: Record<Align, string> = {\n start: 'items-start',\n center: 'items-center',\n end: 'items-end',\n stretch: 'items-stretch',\n baseline: 'items-baseline',\n};\n\nexport type Justify = 'start' | 'center' | 'end' | 'between' | 'around';\nconst JUSTIFY: Record<Justify, string> = {\n start: 'justify-start',\n center: 'justify-center',\n end: 'justify-end',\n between: 'justify-between',\n around: 'justify-around',\n};\n\nexport interface StackProps {\n children?: ReactNode;\n gap?: Gap;\n align?: Align;\n justify?: Justify;\n className?: string;\n}\n\n/** Vertical flow. */\nexport function Stack({ children, gap = 4, align, justify, className = '' }: StackProps) {\n return (\n <div className={['flex flex-col', GAP[gap], align ? ALIGN[align] : '', justify ? JUSTIFY[justify] : '', className]\n .filter(Boolean).join(' ')}>\n {children}\n </div>\n );\n}\n\nexport interface InlineProps extends StackProps {\n /** Wrap onto a second line rather than overflowing. Default true — an\n * unwrapped row is how a toolbar quietly breaks a narrow screen. */\n wrap?: boolean;\n}\n\n/** Horizontal flow. Defaults to vertically centred, which is what a row of\n * mixed-height controls almost always wants. */\nexport function Inline({ children, gap = 2, align = 'center', justify, wrap = true, className = '' }: InlineProps) {\n return (\n <div className={['flex', wrap ? 'flex-wrap' : '', GAP[gap], ALIGN[align], justify ? JUSTIFY[justify] : '', className]\n .filter(Boolean).join(' ')}>\n {children}\n </div>\n );\n}\n\nexport type GridCols = 1 | 2 | 3 | 4 | 6 | 12;\n\n// Written out rather than interpolated. See the module docstring.\nconst COLS: Record<GridCols, string> = {\n 1: 'grid-cols-1', 2: 'grid-cols-2', 3: 'grid-cols-3',\n 4: 'grid-cols-4', 6: 'grid-cols-6', 12: 'grid-cols-12',\n};\n\n// Responsive steps, also literal. `sm:` is the 640px breakpoint, `lg:` 1024px.\nconst SM_COLS: Record<GridCols, string> = {\n 1: 'sm:grid-cols-1', 2: 'sm:grid-cols-2', 3: 'sm:grid-cols-3',\n 4: 'sm:grid-cols-4', 6: 'sm:grid-cols-6', 12: 'sm:grid-cols-12',\n};\nconst LG_COLS: Record<GridCols, string> = {\n 1: 'lg:grid-cols-1', 2: 'lg:grid-cols-2', 3: 'lg:grid-cols-3',\n 4: 'lg:grid-cols-4', 6: 'lg:grid-cols-6', 12: 'lg:grid-cols-12',\n};\n\nexport interface GridProps {\n children?: ReactNode;\n /** Columns at the narrowest width, and optionally from `sm`/`lg` up. */\n cols?: GridCols;\n smCols?: GridCols;\n lgCols?: GridCols;\n gap?: Gap;\n className?: string;\n}\n\nexport function Grid({ children, cols = 1, smCols, lgCols, gap = 4, className = '' }: GridProps) {\n return (\n <div className={['grid', COLS[cols], smCols ? SM_COLS[smCols] : '', lgCols ? LG_COLS[lgCols] : '', GAP[gap], className]\n .filter(Boolean).join(' ')}>\n {children}\n </div>\n );\n}\n","/**\n * Divider — a rule between sections, optionally with a label sitting in it.\n *\n * The vertical variant is for separating controls inside a row (a toolbar), and\n * needs a parent that gives it a height — it stretches, it does not define. A\n * bare vertical divider in a block container renders as nothing, which is the\n * one way to get this wrong.\n */\nimport { useId, type ReactNode } from 'react';\n\nexport type DividerSpacing = 'sm' | 'md' | 'lg';\n\nconst SPACING: Record<DividerSpacing, string> = {\n sm: 'my-2',\n md: 'my-4',\n lg: 'my-6',\n};\n\nexport interface DividerProps {\n orientation?: 'horizontal' | 'vertical';\n /** Label set into the rule. Horizontal only. */\n children?: ReactNode;\n align?: 'left' | 'center' | 'right';\n spacing?: DividerSpacing;\n className?: string;\n}\n\nexport default function Divider({\n orientation = 'horizontal', children, align = 'center', spacing = 'md', className = '',\n}: DividerProps) {\n // Unconditional, above the early returns — only the labelled form uses it,\n // but a hook cannot be called conditionally.\n const labelId = useId();\n\n if (orientation === 'vertical') {\n return (\n <span\n // Presentational: a vertical rule between two controls is a visual\n // grouping cue, not a structural break in the document.\n role=\"presentation\"\n className={`inline-block h-full min-h-[1em] w-px shrink-0 self-stretch bg-gray-200 ${className}`.trim()}\n />\n );\n }\n\n if (!children) {\n return <hr className={`border-0 border-t border-gray-200 ${SPACING[spacing]} ${className}`.trim()} />;\n }\n\n // Flex rules either side rather than a background trick, so the label sits on\n // the container's own background whatever that is.\n const before = align === 'left' ? 'w-4 shrink-0' : 'flex-1';\n const after = align === 'right' ? 'w-4 shrink-0' : 'flex-1';\n return (\n // `role=\"separator\"` because the <hr> above cannot be used once there is a\n // label to place inside the rule — and losing the element must not mean\n // losing what it meant. The two rules either side are decoration.\n //\n // The name is pointed at explicitly. `separator` takes its name from the\n // AUTHOR only — it is not one of the roles that names itself from its\n // contents — so the label sitting inside the element did NOT become the\n // separator's accessible name, and the rule was announced unnamed with the\n // text loose beside it. `aria-labelledby` is what actually attaches it.\n <div\n role=\"separator\"\n aria-orientation=\"horizontal\"\n aria-labelledby={labelId}\n className={`flex items-center gap-3 ${SPACING[spacing]} ${className}`.trim()}\n >\n <span aria-hidden=\"true\" className={`${before} border-t border-gray-200`} />\n <span id={labelId} className=\"shrink-0 text-xs font-medium text-gray-500\">{children}</span>\n <span aria-hidden=\"true\" className={`${after} border-t border-gray-200`} />\n </div>\n );\n}\n","/**\n * Skeleton — a placeholder shaped like the content that is loading.\n *\n * Worth preferring over a spinner wherever the shape is known: it reserves the\n * space, so the page does not jump when data lands, and it tells the user what\n * is coming rather than only that something is.\n *\n * Sizes go through inline `style`, not classes. A skeleton's dimensions are\n * arbitrary by definition — they match whatever they stand in for — and\n * arbitrary Tailwind values (`w-[213px]`) produce NO style in the compiled\n * stylesheet the design-sync previews use. This is the escape hatch\n * `.design-sync/conventions.md` documents, and the same one `Avatar` uses.\n */\nimport { type CSSProperties } from 'react';\n\nexport type SkeletonVariant = 'text' | 'rect' | 'circle';\n\nexport interface SkeletonProps {\n variant?: SkeletonVariant;\n /** CSS length. Defaults to full width for text/rect, and to `height` for a circle. */\n width?: number | string;\n height?: number | string;\n /** For `text`: how many lines. The last is short, the way real prose ends. */\n lines?: number;\n className?: string;\n}\n\nconst SHAPE: Record<SkeletonVariant, string> = {\n text: 'rounded',\n rect: 'rounded-md',\n circle: 'rounded-full',\n};\n\nconst len = (v: number | string | undefined): string | undefined =>\n typeof v === 'number' ? `${v}px` : v;\n\nexport default function Skeleton({ variant = 'text', width, height, lines = 1, className = '' }: SkeletonProps) {\n const base = `animate-pulse bg-gray-200 ${SHAPE[variant]} ${className}`.trim();\n\n if (variant === 'circle') {\n const d = len(height ?? width) ?? '2.5rem';\n return <span className={`inline-block ${base}`} style={{ width: d, height: d }} aria-hidden=\"true\" />;\n }\n\n const style: CSSProperties = {\n width: len(width) ?? '100%',\n height: len(height) ?? (variant === 'text' ? '1rem' : '4rem'),\n };\n\n if (variant === 'text' && lines > 1) {\n return (\n <span className=\"flex flex-col gap-2\" aria-hidden=\"true\">\n {Array.from({ length: lines }, (_, i) => (\n <span\n key={i}\n className={`block ${base}`}\n // A block of identical full-width bars reads as a table, not prose.\n style={{ ...style, width: i === lines - 1 ? '60%' : style.width }}\n />\n ))}\n </span>\n );\n }\n\n return <span className={`block ${base}`} style={style} aria-hidden=\"true\" />;\n}\n","/**\n * DescriptionList — a grid of label/value pairs, for the detail panel of a\n * record: an invoice header, a shipment's dates and references.\n *\n * Renders `<dl>/<dt>/<dd>`, which is what this content actually is. A table\n * would claim a row/column relationship that does not exist between one\n * shipment's carrier and its ETA, and a stack of divs says nothing at all.\n *\n * `columns` accepts a responsive object because these lists are long — a\n * thirteen-item shipment header at three columns on a desktop has to fall back\n * to one on a phone, and a fixed count makes one of those two layouts wrong.\n */\nimport { type ReactNode } from 'react';\n\nexport type DescriptionColumns = 1 | 2 | 3;\n\nexport interface DescriptionItem {\n label: ReactNode;\n value: ReactNode;\n /** Occupy the full row — for an address or a note among short fields. */\n span?: boolean;\n key?: string;\n}\n\nexport interface DescriptionListProps {\n items: DescriptionItem[];\n /** A count, or per-breakpoint counts. `{ base: 1, sm: 2, lg: 3 }`. */\n columns?: DescriptionColumns | { base?: DescriptionColumns; sm?: DescriptionColumns; lg?: DescriptionColumns };\n /** Hairline-separated rows in a bordered panel. */\n bordered?: boolean;\n size?: 'sm' | 'md';\n /**\n * Shown in place of a value that is `null`, `undefined` or `''`. Defaults to\n * an em dash.\n *\n * A blank cell answers nothing — and inside `bordered`, where the cell has\n * an outline of its own, it reads as a rendering fault rather than as \"there\n * is no tracking number\". Pass `emptyText={null}` for the old behaviour.\n */\n emptyText?: ReactNode;\n title?: ReactNode;\n className?: string;\n}\n\n// Literal maps: Tailwind reads source text, so an interpolated `grid-cols-${n}`\n// generates nothing and every column count silently collapses to one.\nconst COLS: Record<DescriptionColumns, string> = { 1: 'grid-cols-1', 2: 'grid-cols-2', 3: 'grid-cols-3' };\nconst SM: Record<DescriptionColumns, string> = { 1: 'sm:grid-cols-1', 2: 'sm:grid-cols-2', 3: 'sm:grid-cols-3' };\nconst LG: Record<DescriptionColumns, string> = { 1: 'lg:grid-cols-1', 2: 'lg:grid-cols-2', 3: 'lg:grid-cols-3' };\nconst SPAN: Record<DescriptionColumns, string> = { 1: 'col-span-1', 2: 'col-span-2', 3: 'col-span-3' };\n\nexport default function DescriptionList({\n items, columns = 1, bordered = false, size = 'md', title, className = '',\n emptyText: empty = '—',\n}: DescriptionListProps) {\n const resolved = typeof columns === 'number' ? { base: columns } : columns;\n const base = resolved.base ?? 1;\n // The widest count in play decides how far a spanning item stretches, so it\n // still fills the row at the breakpoint where the grid is widest.\n const widest = Math.max(base, resolved.sm ?? 0, resolved.lg ?? 0) as DescriptionColumns;\n\n const pad = size === 'sm' ? 'px-3 py-2' : 'px-4 py-3';\n const text = size === 'sm' ? 'text-xs' : 'text-sm';\n\n return (\n <div className={[bordered ? 'rounded-lg border border-gray-200 bg-white' : '', className].filter(Boolean).join(' ')}>\n {title && (\n <div className={`${pad} ${bordered ? 'border-b border-gray-100' : ''} text-sm font-semibold text-gray-900`.trim()}>\n {title}\n </div>\n )}\n <dl className={[\n 'grid',\n COLS[base],\n resolved.sm ? SM[resolved.sm] : '',\n resolved.lg ? LG[resolved.lg] : '',\n bordered ? '' : 'gap-x-6 gap-y-3',\n bordered ? '' : pad === 'px-4 py-3' ? 'py-1' : '',\n ].filter(Boolean).join(' ')}>\n {items.map((item, i) => (\n <div\n key={item.key ?? i}\n className={[\n item.span ? SPAN[widest] : '',\n bordered ? `${pad} border-b border-gray-100 last:border-b-0` : '',\n ].filter(Boolean).join(' ')}\n >\n <dt className={`${text} text-gray-500`}>{item.label}</dt>\n {/* min-w-0 so a long unbroken value (a tracking number) wraps\n inside its cell instead of widening the whole grid. */}\n <dd className={`mt-0.5 min-w-0 break-words ${text} text-gray-900`}>\n {item.value === null || item.value === undefined || item.value === ''\n ? empty\n : item.value}\n </dd>\n </div>\n ))}\n </dl>\n </div>\n );\n}\n","/**\n * SettingRow — one setting: its name and its current value on one baseline,\n * with the explanation at full width beneath.\n *\n * ── Why this is not `DescriptionList` ──\n * `DescriptionList` is the detail panel of a RECORD — an invoice header, a\n * shipment's dates. It renders `<dl>/<dt>/<dd>`, which claims that the value\n * defines the label, and it stacks the value UNDER the label inside a column\n * of a responsive grid. Both are right there and wrong here.\n *\n * A settings panel is not a record. Its value is frequently a CONTROL, and a\n * `<dd>` holding a switch tells a screen reader that the switch is the\n * definition of the term above it. Its rows have a third part — the sentence\n * explaining what the setting does — that `DescriptionItem` has nowhere to put,\n * so consumers end up appending it to the value and it inherits the value's\n * ink and the value's column. And that column is the actual failure this\n * component replaces: a fixed narrow description column folds a short badge\n * onto three lines while the other half of the row sits empty.\n *\n * So the shape is inverted. The name and the value share ONE line and sit at\n * opposite ends of it, the value never shrinks (`shrink-0`) and wraps to its\n * own line rather than being crushed, and the explanation runs the full width\n * beneath both in a smaller, quieter voice. Nothing here is a grid, because a\n * grid is what forced the badge into three lines.\n *\n * Four kinds of value, because a settings panel has four:\n * a control pass it as `value`, and `controlId` so the name labels it\n * a read-only fact pass the text\n * not known pass `null` — rendered as an em dash in the faint ink,\n * never as an empty cell and never as \"off\"\n * nothing can write it yet `quiet` — the row is legible and inert\n */\nimport { type ReactNode } from 'react';\n\nexport interface SettingRowProps {\n /** What the setting is called. */\n name: ReactNode;\n /**\n * Its current value: a control, a read-only fact, or `null`/`undefined`/`''`\n * for a value nobody knows. The unknown case renders `unknownText` in the\n * faint ink — an absent value and a value of \"off\" are different answers and\n * must not look the same.\n */\n value?: ReactNode;\n /** What the setting does, at full width under the pair, in a smaller voice. */\n description?: ReactNode;\n /**\n * The id of the control passed as `value`. Given it, the name renders as a\n * `<label htmlFor>` so clicking the name reaches the control and a screen\n * reader announces the two together. Omit it for a read-only row — a label\n * pointing at nothing is worse than no label.\n */\n controlId?: string;\n /** Shown in place of a value that is `null`, `undefined` or `''`. */\n unknownText?: ReactNode;\n /**\n * The setting is real but nothing can write it yet — a capability the\n * backend has not shipped, a field this tenant does not own.\n *\n * Drops the name and value one step down the ink ramp rather than reaching\n * for `opacity`: opacity multiplies against whatever is behind the row, so a\n * measured contrast stops being a measured contrast the moment the row is\n * hovered. The row stays fully legible; it just stops asking to be read\n * first. It is not `disabled` — there is no control here to disable, and a\n * read-only row that announced itself as disabled would be a lie.\n */\n quiet?: boolean;\n className?: string;\n}\n\nexport default function SettingRow({\n name,\n value,\n description,\n controlId,\n unknownText = '—',\n quiet = false,\n className = '',\n}: SettingRowProps) {\n const unknown = value === null || value === undefined || value === '';\n const nameInk = quiet ? 'text-gray-500' : 'text-gray-800';\n // Three inks, three facts: a known value, a value nobody knows, and a row\n // nothing can write.\n const valueInk = unknown ? 'text-gray-400' : quiet ? 'text-gray-500' : 'text-gray-900';\n\n return (\n <div className={className}>\n {/* justify-between, not a grid: the value takes exactly the width it\n needs and the gap absorbs the rest. flex-wrap is the escape — a long\n name and a long value drop onto two lines instead of the value being\n squeezed into a column that folds a six-character badge. */}\n <div className=\"flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1\">\n {controlId ? (\n <label htmlFor={controlId} className={`min-w-0 text-sm font-medium ${nameInk}`}>\n {name}\n </label>\n ) : (\n <span className={`min-w-0 text-sm font-medium ${nameInk}`}>{name}</span>\n )}\n <span className={`shrink-0 text-sm ${valueInk}`}>{unknown ? unknownText : value}</span>\n </div>\n {description && (\n <p className=\"mt-1 text-xs leading-relaxed text-gray-500\">{description}</p>\n )}\n </div>\n );\n}\n","/**\n * CountBadge — a count pinned to the corner of something: a cart icon, a nav\n * item with unread messages.\n *\n * Not to be confused with `ColoredBadge`, which is a standalone pill you put\n * text in, or `StatusBadge`, which maps a status string to a semantic tone.\n * This one WRAPS a child and overlays a number on it, and it is the only one of\n * the three that means \"how many\".\n *\n * Zero renders nothing by default. A badge reading \"0\" is noise that has to be\n * read before it can be dismissed, and it trains people to stop looking.\n */\nimport { type ReactNode } from 'react';\n\nexport type CountBadgeTone = 'danger' | 'neutral' | 'accent';\n\nconst TONE: Record<CountBadgeTone, string> = {\n danger: 'bg-red-600 text-white',\n neutral: 'bg-gray-600 text-white',\n accent: 'bg-blue-600 text-white',\n};\n\nexport interface CountBadgeProps {\n count?: number;\n /** Cap the display: 100 with `max={99}` shows \"99+\". */\n max?: number;\n /** A plain dot with no number — \"something changed\" without a quantity. */\n dot?: boolean;\n tone?: CountBadgeTone;\n /** Render at zero. Off by default. */\n showZero?: boolean;\n /** The thing being badged. Without one the badge renders inline on its own. */\n children?: ReactNode;\n className?: string;\n}\n\nexport default function CountBadge({\n count = 0, max = 99, dot = false, tone = 'danger', showZero = false, children, className = '',\n}: CountBadgeProps) {\n const visible = dot || count > 0 || (count === 0 && showZero);\n const label = count > max ? `${max}+` : String(count);\n\n const badge = visible ? (\n dot ? (\n <span\n className={`block h-2.5 w-2.5 rounded-full ring-2 ring-white ${TONE[tone]}`}\n // The child already carries the meaning (\"Notifications\"); an unlabelled\n // dot repeating it adds a second announcement of the same thing.\n aria-hidden={children ? 'true' : undefined}\n />\n ) : (\n <span\n className={`flex h-5 min-w-[1.25rem] items-center justify-center rounded-full px-1 text-xs font-semibold tabular-nums ring-2 ring-white ${TONE[tone]}`}\n >\n {label}\n </span>\n )\n ) : null;\n\n if (!children) return badge;\n\n return (\n <span className={`relative inline-flex ${className}`.trim()}>\n {children}\n {badge && <span className=\"absolute -right-1.5 -top-1.5 flex\">{badge}</span>}\n </span>\n );\n}\n","/**\n * Statistic — one measured number with its label, for a summary strip.\n *\n * `StatCard` is the card-shaped sibling: this plus a surface, a border and an\n * optional trend pill. They are kept separate because a row of six figures\n * inside one panel should not be six bordered cards, and a dashboard tile\n * should not be a bare number floating on the page. Use this when something\n * else already provides the container.\n *\n * Figures are `tabular-nums` so a column of them aligns on the decimal point\n * and a changing value does not make the layout twitch.\n */\nimport { type ReactNode } from 'react';\n\nexport type StatisticSize = 'sm' | 'md' | 'lg';\nexport type StatisticTone = 'default' | 'success' | 'danger' | 'muted';\n\nconst VALUE_SIZE: Record<StatisticSize, string> = {\n sm: 'text-lg',\n md: 'text-2xl',\n lg: 'text-3xl',\n};\n\nconst TONE: Record<StatisticTone, string> = {\n default: 'text-gray-900',\n success: 'text-green-600',\n danger: 'text-red-600',\n muted: 'text-gray-500',\n};\n\nexport interface StatisticProps {\n title?: ReactNode;\n value: ReactNode;\n /** Fixed decimal places. Applied only to a numeric `value`. */\n precision?: number;\n /** Sits before/after the figure at a smaller size — a currency mark, a unit. */\n prefix?: ReactNode;\n suffix?: ReactNode;\n tone?: StatisticTone;\n size?: StatisticSize;\n className?: string;\n}\n\nexport default function Statistic({\n title, value, precision, prefix, suffix, tone = 'default', size = 'md', className = '',\n}: StatisticProps) {\n const shown = typeof value === 'number' && precision != null ? value.toFixed(precision) : value;\n return (\n <div className={className}>\n {title && <div className=\"text-xs font-medium uppercase tracking-wide text-gray-500\">{title}</div>}\n <div className={`mt-1 flex items-baseline gap-1 ${TONE[tone]}`}>\n {prefix && <span className=\"text-sm\">{prefix}</span>}\n <span className={`font-semibold tabular-nums ${VALUE_SIZE[size]}`}>{shown}</span>\n {suffix && <span className=\"text-sm\">{suffix}</span>}\n </div>\n </div>\n );\n}\n","/**\n * Avatar — a circular user image with an initials fallback and an optional\n * status dot. AvatarGroup overlaps several into a stack with a \"+N\" overflow\n * chip. Sizes are applied via inline `style` (fixed px) so they don't depend\n * on arbitrary Tailwind classes.\n */\nimport { Children, useEffect, useState, type ReactNode } from 'react';\n\nexport type AvatarSize = 'xs' | 'sm' | 'md' | 'lg';\nexport type AvatarStatus = 'online' | 'offline' | 'busy' | 'away';\n\nconst SIZE_PX: Record<AvatarSize, number> = { xs: 24, sm: 32, md: 40, lg: 56 };\nconst STATUS_COLOR: Record<AvatarStatus, string> = {\n online: 'bg-green-500',\n offline: 'bg-gray-400',\n busy: 'bg-red-500',\n away: 'bg-amber-500',\n};\n\nexport interface AvatarProps {\n src?: string;\n /**\n * Who this is. It names the avatar to assistive technology and supplies the\n * initials when there is no usable image.\n *\n * Without it the avatar is hidden from assistive technology rather than\n * announced as \"question mark\" — an avatar nobody can name carries nothing\n * a screen-reader user needs.\n */\n name?: string;\n size?: AvatarSize;\n status?: AvatarStatus;\n className?: string;\n}\n\nfunction initials(name?: string): string {\n if (!name) return '?';\n const parts = name.trim().split(/\\s+/).filter(Boolean);\n if (parts.length === 0) return '?';\n const first = parts[0][0] ?? '';\n const last = parts.length > 1 ? parts[parts.length - 1][0] : '';\n return (first + last).toUpperCase() || '?';\n}\n\nexport default function Avatar({ src, name, size = 'md', status, className = '' }: AvatarProps) {\n const px = SIZE_PX[size];\n const dot = Math.max(8, Math.round(px * 0.28));\n\n // An avatar URL is the least reliable thing on the page — an upload that was\n // deleted, a CDN link that expired, a host that is briefly down. Without this\n // the browser renders its broken-image glyph and keeps it there for the rest\n // of the session; the initials are the whole point of having a fallback.\n const [broken, setBroken] = useState(false);\n useEffect(() => { setBroken(false); }, [src]);\n const showImage = Boolean(src) && !broken;\n\n return (\n // The role and the name live on the wrapper rather than on the <img>, so\n // that an avatar showing initials is announced the same way as one showing\n // a photo. The inner image is then decoration and takes an empty alt.\n <span\n className={`relative inline-flex shrink-0 ${className}`.trim()}\n style={{ width: px, height: px }}\n {...(name ? { role: 'img', 'aria-label': name } : { 'aria-hidden': true })}\n >\n {showImage ? (\n <img\n src={src}\n alt=\"\"\n onError={() => setBroken(true)}\n className=\"h-full w-full rounded-full object-cover\"\n />\n ) : (\n <span\n className=\"flex h-full w-full items-center justify-center rounded-full bg-gray-100 font-medium text-gray-600\"\n style={{ fontSize: Math.round(px * 0.4) }}\n >\n {initials(name)}\n </span>\n )}\n {status && (\n <span\n className={`absolute bottom-0 right-0 rounded-full ring-2 ring-white ${STATUS_COLOR[status]}`}\n style={{ width: dot, height: dot }}\n />\n )}\n </span>\n );\n}\n\nexport interface AvatarGroupProps {\n children: ReactNode;\n /** Show at most this many avatars; the rest collapse into a +N chip. */\n max?: number;\n /** Size of the children — used for the overlap + overflow-chip geometry.\n * Give the child Avatars this same size. */\n size?: AvatarSize;\n className?: string;\n}\n\nexport function AvatarGroup({ children, max, size = 'md', className = '' }: AvatarGroupProps) {\n const items = Children.toArray(children);\n const shown = max ? items.slice(0, max) : items;\n const overflow = max ? items.length - shown.length : 0;\n const px = SIZE_PX[size];\n const overlap = Math.round(px * 0.3);\n return (\n <div className={`flex items-center ${className}`.trim()}>\n {shown.map((child, i) => (\n <span key={i} className=\"rounded-full ring-2 ring-white\" style={{ marginLeft: i === 0 ? 0 : -overlap }}>\n {child}\n </span>\n ))}\n {overflow > 0 && (\n <span\n className=\"flex items-center justify-center rounded-full bg-gray-200 font-medium text-gray-600 ring-2 ring-white\"\n style={{ width: px, height: px, marginLeft: -overlap, fontSize: Math.round(px * 0.36) }}\n >\n +{overflow}\n </span>\n )}\n </div>\n );\n}\n","/**\n * Banner — a static, in-flow alert (the counterpart to the imperative `toast`).\n * Use it for form errors, page-level notices, empty-state callouts. Tone drives\n * the background/border/icon color; the text stays neutral so it reads in dark\n * mode. All tone classes are in the dark-mode allow-list.\n */\nimport { type ReactNode } from 'react';\n\nexport type BannerTone = 'info' | 'success' | 'warning' | 'danger';\n\n/**\n * How loudly the banner speaks.\n *\n * `subtle` (the default, and what every existing caller renders) is a tinted\n * panel that sits politely in a form. `solid` is a saturated full-contrast bar\n * for a condition the user must not miss and cannot work around — a till that\n * has lost the server and cannot take payment. The subtle version of that\n * message is a bug: a cashier who misses it takes money for a sale that will\n * not complete.\n */\nexport type BannerEmphasis = 'subtle' | 'solid';\n\nexport interface BannerProps {\n tone?: BannerTone;\n emphasis?: BannerEmphasis;\n title?: ReactNode;\n children?: ReactNode;\n /** Override the default tone icon. */\n icon?: ReactNode;\n /**\n * What to do about it — at the right edge of the banner, after the text and\n * before the dismiss ×. A `Button size=\"sm\"`, a link, a pair of them.\n *\n * A banner that names a condition and leaves the fix somewhere else is the\n * common shape of a notice nobody acts on: \"Your card was declined\" with the\n * billing screen three menus away. Putting the control in the banner is the\n * whole point, and it goes beside the text rather than under it so the\n * banner keeps its one-row height in a form.\n *\n * Vertically centred against the whole box and `shrink-0`, so a two-line\n * message does not drag the button down with its last line and a long one\n * does not squeeze it — the text is what wraps.\n */\n action?: ReactNode;\n /** When provided, renders a dismiss × that calls this. */\n onDismiss?: () => void;\n /**\n * Pin to the top of the scroll container while its content scrolls past.\n *\n * `position: sticky`, so the banner still occupies layout — it pushes the\n * page down rather than covering the first row of it, which is what a\n * blocking notice needs. Defeated by any ancestor with `overflow: hidden`.\n */\n sticky?: boolean;\n className?: string;\n}\n\nconst TONE: Record<BannerTone, { box: string; icon: string }> = {\n info: { box: 'bg-blue-50 border-blue-200', icon: 'text-blue-600' },\n success: { box: 'bg-green-50 border-green-200', icon: 'text-green-600' },\n warning: { box: 'bg-amber-50 border-amber-200', icon: 'text-amber-600' },\n danger: { box: 'bg-red-50 border-red-200', icon: 'text-red-600' },\n};\n\n// Solid tones are saturated -700 backgrounds with white text, all inside the\n// dark-mode allow-list. Text colour is carried on the root here (rather than by\n// the neutral gray-900/gray-700 the subtle variant uses on its children) so the\n// title, body and dismiss control all inherit it.\nconst TONE_SOLID: Record<BannerTone, string> = {\n info: 'bg-blue-700 border-blue-700 text-white',\n success: 'bg-green-700 border-green-700 text-white',\n warning: 'bg-amber-700 border-amber-700 text-white',\n danger: 'bg-red-700 border-red-700 text-white',\n};\n\nfunction ToneIcon({ tone }: { tone: BannerTone }) {\n const common = { className: 'h-5 w-5', viewBox: '0 0 20 20', fill: 'currentColor', 'aria-hidden': true } as const;\n switch (tone) {\n case 'success':\n return <svg {...common}><path fillRule=\"evenodd\" d=\"M10 18a8 8 0 100-16 8 8 0 000 16zm3.7-9.3a1 1 0 00-1.4-1.4L9 10.6 7.7 9.3a1 1 0 00-1.4 1.4l2 2a1 1 0 001.4 0l4-4z\" clipRule=\"evenodd\" /></svg>;\n case 'warning':\n return <svg {...common}><path fillRule=\"evenodd\" d=\"M8.3 2.8a2 2 0 013.4 0l6 10A2 2 0 0116 16H4a2 2 0 01-1.7-3.2l6-10zM10 7a1 1 0 00-1 1v3a1 1 0 102 0V8a1 1 0 00-1-1zm0 7a1 1 0 100 2 1 1 0 000-2z\" clipRule=\"evenodd\" /></svg>;\n case 'danger':\n return <svg {...common}><path fillRule=\"evenodd\" d=\"M10 18a8 8 0 100-16 8 8 0 000 16zM8.7 7.3a1 1 0 00-1.4 1.4L8.6 10l-1.3 1.3a1 1 0 101.4 1.4L10 11.4l1.3 1.3a1 1 0 001.4-1.4L11.4 10l1.3-1.3a1 1 0 10-1.4-1.4L10 8.6 8.7 7.3z\" clipRule=\"evenodd\" /></svg>;\n default:\n return <svg {...common}><path fillRule=\"evenodd\" d=\"M10 18a8 8 0 100-16 8 8 0 000 16zM9 9a1 1 0 012 0v4a1 1 0 11-2 0V9zm1-4a1 1 0 100 2 1 1 0 000-2z\" clipRule=\"evenodd\" /></svg>;\n }\n}\n\nexport default function Banner({\n tone = 'info', emphasis = 'subtle', title, children, icon, action, onDismiss, sticky = false, className = '',\n}: BannerProps) {\n const t = TONE[tone];\n const solid = emphasis === 'solid';\n // Every branch below collapses to the original string when emphasis is\n // 'subtle' and sticky is false, so existing callers render byte-identically.\n const box = solid ? TONE_SOLID[tone] : t.box;\n const stick = sticky ? 'sticky top-0 z-30' : '';\n return (\n <div\n role={tone === 'danger' ? 'alert' : 'status'}\n className={`${stick} flex items-start gap-3 rounded-lg border px-4 py-3 ${box} ${className}`.trim()}\n >\n <span className={`mt-0.5 shrink-0 ${solid ? '' : t.icon}`.trim()}>{icon ?? <ToneIcon tone={tone} />}</span>\n <div className=\"min-w-0 flex-1 text-sm\">\n {title && <div className={`font-semibold ${solid ? '' : 'text-gray-900'}`.trim()}>{title}</div>}\n {children && (\n <div className={`${solid ? '' : 'text-gray-700'} ${title ? 'mt-0.5' : ''}`.trim()}>{children}</div>\n )}\n </div>\n {/* `self-center` against the row's `items-start`: the icon and the text\n hang from the top because that is where the first line is, and an\n action has no first line to align to. */}\n {action != null && <div className=\"shrink-0 self-center\">{action}</div>}\n {onDismiss && (\n <button\n type=\"button\"\n onClick={onDismiss}\n aria-label=\"Dismiss\"\n className={`shrink-0 ${solid ? 'opacity-80 hover:opacity-100' : 'text-gray-400 hover:text-gray-600'}`}\n >\n <svg className=\"h-4 w-4\" viewBox=\"0 0 20 20\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" aria-hidden=\"true\">\n <path d=\"M6 6l8 8M14 6l-8 8\" />\n </svg>\n </button>\n )}\n </div>\n );\n}\n","/**\n * Tabs — a controlled in-content tab strip. The consumer owns the active id\n * (`value` + `onChange`) and renders the body for the active tab itself; this\n * component is just the strip. For app-level navigation use TopNav instead.\n *\n * `underline` (default) is the classic bordered tab row; `pill` is a segmented\n * control whose active segment fills with the accent (dark-mode safe).\n *\n * Wiring a panel: pass `idPrefix` and build the panel's id with `tabPanelId`.\n * The strip then points each tab at its panel with `aria-controls`, and gives\n * the tab a matching id the panel names itself with — the two halves of the\n * association ARIA wants, from one prop, so they cannot drift apart.\n *\n * Keyboard: the strip is one tab stop, and the arrow keys move between tabs\n * inside it (Home / End jump to the ends, disabled tabs are skipped, and the\n * ends wrap). This is the roving-tabindex pattern ARIA specifies for a\n * tablist, and it is not optional — `tabIndex={-1}` on the inactive tabs is\n * what keeps the strip to a single stop, so without the arrow keys those tabs\n * cannot be reached by keyboard at all.\n */\nimport { useRef, type KeyboardEvent, type ReactNode } from 'react';\n\n/**\n * The DOM id of a tab and of the panel it controls, derived from the same\n * prefix so a consumer rendering the panel cannot mismatch them.\n *\n * Exported rather than inlined: the panel is rendered by the CONSUMER, so both\n * sides have to agree on the string, and agreeing by convention in a comment\n * is how these drift.\n */\nexport const tabButtonId = (prefix: string, id: string): string => `${prefix}-tab-${id}`;\nexport const tabPanelId = (prefix: string, id: string): string => `${prefix}-panel-${id}`;\n\nexport interface TabItem {\n id: string;\n label: ReactNode;\n icon?: ReactNode;\n disabled?: boolean;\n}\n\nexport interface TabsProps {\n items: TabItem[];\n value: string;\n onChange: (id: string) => void;\n variant?: 'underline' | 'pill';\n /**\n * Enables the tab/panel association. With it each tab gains a stable id and\n * an `aria-controls` pointing at `tabPanelId(idPrefix, item.id)`; the\n * consumer gives its panel that id and names it with\n * `aria-labelledby={tabButtonId(idPrefix, item.id)}`.\n *\n * Omitted, nothing is emitted. A tab strip used purely as a filter — no\n * panel to point at — should not claim to control an element that does not\n * exist, which is a dangling reference rather than a helpful one.\n */\n idPrefix?: string;\n /**\n * Names the strip. A page with more than one — order sections above, media\n * types below — gives a screen-reader user two \"tab list\"s with nothing to\n * tell them apart, and there was no way to pass a name at all.\n */\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n className?: string;\n}\n\nconst LIST_CLASS: Record<'underline' | 'pill', string> = {\n underline: 'flex items-center gap-1 border-b border-gray-200',\n pill: 'inline-flex items-center gap-1 rounded-lg bg-gray-100 p-1',\n};\n\nfunction tabClass(variant: 'underline' | 'pill', active: boolean): string {\n if (variant === 'pill') {\n return `inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-sm font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50 ${\n active ? 'bg-blue-600 text-white shadow-sm' : 'text-gray-600 hover:text-gray-900'\n }`;\n }\n return `-mb-px inline-flex items-center gap-1.5 border-b-2 px-3 py-2 text-sm font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50 ${\n active\n ? 'border-blue-600 text-blue-600'\n : 'border-transparent text-gray-600 hover:border-gray-300 hover:text-gray-900'\n }`;\n}\n\nexport default function Tabs({\n items, value, onChange, variant = 'underline', idPrefix, className = '',\n 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy,\n}: TabsProps) {\n const buttons = useRef<(HTMLButtonElement | null)[]>([]);\n\n // Walks in `step` direction from `from`, wrapping, until it finds a tab that\n // can take focus. Bounded by the item count so an all-disabled strip — which\n // is a legitimate empty state — returns rather than spinning.\n const step = (from: number, direction: 1 | -1): number | null => {\n for (let i = 1; i <= items.length; i += 1) {\n const at = (((from + direction * i) % items.length) + items.length) % items.length;\n if (!items[at]?.disabled) return at;\n }\n return null;\n };\n\n const edge = (direction: 1 | -1): number | null => {\n const order = direction === 1 ? items.map((_, i) => i) : items.map((_, i) => items.length - 1 - i);\n for (const i of order) if (!items[i]?.disabled) return i;\n return null;\n };\n\n const onKeyDown = (event: KeyboardEvent<HTMLDivElement>): void => {\n const current = items.findIndex(t => t.id === value);\n let next: number | null = null;\n if (event.key === 'ArrowRight' || event.key === 'ArrowDown') next = step(current, 1);\n else if (event.key === 'ArrowLeft' || event.key === 'ArrowUp') next = step(current, -1);\n else if (event.key === 'Home') next = edge(1);\n else if (event.key === 'End') next = edge(-1);\n else return;\n\n event.preventDefault();\n if (next === null || next === current) return;\n onChange(items[next].id);\n // Selection follows focus, which is the automatic-activation form of the\n // pattern — right here, where switching a tab is cheap and the panel is\n // already rendered by the consumer.\n buttons.current[next]?.focus();\n };\n\n return (\n <div\n role=\"tablist\"\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n onKeyDown={onKeyDown}\n className={`${LIST_CLASS[variant]} ${className}`.trim()}\n >\n {items.map((t, i) => {\n const active = t.id === value;\n return (\n <button\n key={t.id}\n ref={el => { buttons.current[i] = el; }}\n type=\"button\"\n role=\"tab\"\n id={idPrefix ? tabButtonId(idPrefix, t.id) : undefined}\n aria-controls={idPrefix ? tabPanelId(idPrefix, t.id) : undefined}\n aria-selected={active}\n tabIndex={active ? 0 : -1}\n disabled={t.disabled}\n onClick={() => onChange(t.id)}\n className={tabClass(variant, active)}\n >\n {/* Decoration, and hidden from assistive technology on purpose: a\n TabItem must have a label, so the icon is always supplementary.\n Left exposed, a text or emoji icon is read as part of the tab's\n name — \"# Lines\" rather than \"Lines\". */}\n {t.icon && <span aria-hidden=\"true\" className=\"inline-flex shrink-0\">{t.icon}</span>}\n {t.label}\n </button>\n );\n })}\n </div>\n );\n}\n","/**\n * Stepper — the progress strip of a linear wizard. Tabs' one-way sibling: the\n * consumer owns the current step (`value`) and renders the body; this is just\n * the strip of numbered circles, connectors and labels.\n *\n * The one-way part is deliberate. Steps BEFORE the current one are complete\n * and — when `onChange` is wired — clickable, because going back is always\n * safe. Steps AFTER it are never clickable: moving forward is the wizard's\n * own Continue button's job, behind whatever validation the current step\n * demands. A strip that lets the user jump to \"Payment\" from \"Contact\" has\n * silently promised that nothing in between matters.\n *\n * Semantically an <ol> (the order is the meaning) with `aria-current=\"step\"`\n * on the current item. The circles — number or check — are decoration and\n * hidden from assistive technology; the label names the step.\n */\nimport { type ReactNode } from 'react';\n\nexport interface StepItem {\n id: string;\n label: ReactNode;\n /** Short line under the label. */\n description?: ReactNode;\n}\n\nexport interface StepperProps {\n items: StepItem[];\n /** The current step's id. Controlled — the consumer owns the wizard state. */\n value: string;\n /**\n * Lets the user return to a COMPLETED step by clicking it. Omitted, the\n * strip is purely an indicator and renders no controls at all.\n */\n onChange?: (id: string) => void;\n /** Names the strip for assistive technology, e.g. \"Checkout steps\". */\n 'aria-label'?: string;\n className?: string;\n}\n\nconst Check = () => (\n <svg viewBox=\"0 0 12 12\" fill=\"none\" className=\"h-3.5 w-3.5\" aria-hidden=\"true\">\n <path d=\"M2.5 6.5L5 9l4.5-5\" stroke=\"currentColor\" strokeWidth=\"1.8\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n);\n\nexport default function Stepper({\n items, value, onChange, 'aria-label': ariaLabel, className = '',\n}: StepperProps) {\n const currentIndex = Math.max(0, items.findIndex(s => s.id === value));\n\n return (\n <ol\n aria-label={ariaLabel}\n className={`grid items-start ${className}`.trim()}\n style={{ gridTemplateColumns: `repeat(${Math.max(items.length, 1)}, minmax(0, 1fr))` }}\n >\n {items.map((step, i) => {\n const state = i < currentIndex ? 'complete' : i === currentIndex ? 'current' : 'upcoming';\n const clickable = state === 'complete' && !!onChange;\n\n const circle = (\n <span\n aria-hidden=\"true\"\n className={[\n 'flex h-7 w-7 shrink-0 items-center justify-center rounded-full text-xs font-semibold transition-colors',\n state === 'complete' ? 'bg-blue-600 text-white' : '',\n state === 'current' ? 'border-2 border-blue-600 bg-white text-blue-600' : '',\n state === 'upcoming' ? 'border-2 border-gray-300 bg-white text-gray-400' : '',\n ].filter(Boolean).join(' ')}\n >\n {state === 'complete' ? <Check /> : i + 1}\n </span>\n );\n const text = (\n <span className=\"min-w-0 text-center\">\n <span className={`block text-sm font-medium ${state === 'upcoming' ? 'text-gray-400' : 'text-gray-900'}`}>\n {step.label}\n </span>\n {step.description && (\n <span className=\"block text-xs text-gray-500\">{step.description}</span>\n )}\n </span>\n );\n\n return (\n <li\n key={step.id}\n aria-current={state === 'current' ? 'step' : undefined}\n className=\"relative flex min-w-0 justify-center\"\n >\n {/* Each stage owns the connector leading OUT of it. Anchoring the\n * line to equal-width column centres keeps every circle centred,\n * regardless of label length. */}\n {i < items.length - 1 && (\n <span\n aria-hidden=\"true\"\n className={`absolute top-3.5 h-0.5 rounded ${i < currentIndex ? 'bg-blue-600' : 'bg-gray-200'}`}\n style={{ left: 'calc(50% + 0.875rem)', right: 'calc(-50% + 0.875rem)' }}\n />\n )}\n {clickable ? (\n <button\n type=\"button\"\n onClick={() => onChange?.(step.id)}\n className=\"relative z-10 flex min-w-0 flex-col items-center gap-1.5 rounded px-2 text-center focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-400\"\n >\n {circle}\n {text}\n </button>\n ) : (\n <span className=\"relative z-10 flex min-w-0 flex-col items-center gap-1.5 px-2 text-center\">\n {circle}\n {text}\n </span>\n )}\n </li>\n );\n })}\n </ol>\n );\n}\n","/**\n * Accordion — collapsible sections. Uncontrolled by default (seed with\n * `defaultOpenIds`); pass `openIds` + `onOpenChange` to drive it. `allowMultiple`\n * lets more than one section stay open at once.\n */\nimport { useState, type ReactNode } from 'react';\n\nexport interface AccordionItem {\n id: string;\n title: ReactNode;\n content: ReactNode;\n disabled?: boolean;\n}\n\nexport interface AccordionProps {\n items: AccordionItem[];\n defaultOpenIds?: string[];\n /** Controlled open set — when provided, the component stops tracking its own. */\n openIds?: string[];\n onOpenChange?: (ids: string[]) => void;\n allowMultiple?: boolean;\n className?: string;\n}\n\nexport default function Accordion({\n items, defaultOpenIds = [], openIds, onOpenChange, allowMultiple = false, className = '',\n}: AccordionProps) {\n const [internal, setInternal] = useState<string[]>(defaultOpenIds);\n const open = openIds ?? internal;\n\n const toggle = (id: string) => {\n const isOpen = open.includes(id);\n const next = isOpen ? open.filter(x => x !== id) : allowMultiple ? [...open, id] : [id];\n if (openIds === undefined) setInternal(next);\n onOpenChange?.(next);\n };\n\n return (\n <div className={`divide-y divide-gray-100 overflow-hidden rounded-lg border border-gray-200 ${className}`.trim()}>\n {items.map(item => {\n const isOpen = open.includes(item.id);\n return (\n <div key={item.id}>\n <button\n type=\"button\"\n disabled={item.disabled}\n aria-expanded={isOpen}\n onClick={() => toggle(item.id)}\n className=\"flex w-full items-center justify-between gap-3 px-4 py-3 text-left text-sm font-medium text-gray-900 hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50\"\n >\n <span>{item.title}</span>\n <svg\n className={`h-4 w-4 shrink-0 text-gray-400 transition-transform ${isOpen ? 'rotate-180' : ''}`}\n viewBox=\"0 0 20 20\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" aria-hidden=\"true\"\n >\n <path d=\"M6 8l4 4 4-4\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n </button>\n {isOpen && <div className=\"px-4 pb-3 text-sm text-gray-600\">{item.content}</div>}\n </div>\n );\n })}\n </div>\n );\n}\n","/**\n * Tooltip — a frosted hover/focus bubble around its trigger, using the shared\n * glassStyle() so it matches the kit's menus and follows dark mode. Static\n * previews show only the trigger (the bubble appears on interaction), like\n * ShortcutHelp.\n */\nimport { cloneElement, isValidElement, useEffect, useId, useRef, useState, type ReactNode } from 'react';\nimport { glassStyle } from '../utils/glass';\nimport { registerModalEscapeInterceptor } from './escapeInterceptors';\n\nexport interface TooltipProps {\n content: ReactNode;\n side?: 'top' | 'bottom' | 'left' | 'right';\n /** Hover delay before showing, in ms. */\n delay?: number;\n children: ReactNode;\n}\n\nconst SIDE_POS: Record<NonNullable<TooltipProps['side']>, string> = {\n top: 'bottom-full left-1/2 -translate-x-1/2 mb-1.5',\n bottom: 'top-full left-1/2 -translate-x-1/2 mt-1.5',\n left: 'right-full top-1/2 -translate-y-1/2 mr-1.5',\n right: 'left-full top-1/2 -translate-y-1/2 ml-1.5',\n};\n\nexport default function Tooltip({ content, side = 'top', delay = 200, children }: TooltipProps) {\n const [show, setShow] = useState(false);\n const timer = useRef<number | undefined>(undefined);\n const id = useId();\n const open = () => { timer.current = window.setTimeout(() => setShow(true), delay); };\n const close = () => { window.clearTimeout(timer.current); setShow(false); };\n // Cancel a pending open if the trigger unmounts mid-delay.\n useEffect(() => () => window.clearTimeout(timer.current), []);\n\n // WCAG 1.4.13 — content shown on hover or focus has to be dismissible\n // without moving the pointer or the focus.\n //\n // Through the interceptor seam rather than a listener of this component's\n // own, for two reasons. A tooltip opened by HOVER holds no focus, so a\n // keydown never reaches the trigger — that rules out an `onKeyDown` here.\n // And a plain `document` listener loses inside a window: `Modal` listens on\n // `window` in the CAPTURE phase and calls `stopPropagation()` when it closes,\n // and capture runs window before document, so Escape closed the whole window\n // and this never ran. Three portals render tooltips inside windows, which is\n // where the rule matters most.\n //\n // The seam is the one place that gets both: `Modal` consults it before\n // closing, and since 4.27.0 the Set drains itself when no shell is mounted,\n // so a till and a routed page are covered by the same registration.\n //\n // Registration order is stacking order, walked most-recent-first, so a\n // tooltip opened inside a dialog consumes the first Escape and the dialog\n // takes the second — which is the order the user expects.\n useEffect(() => {\n if (!show) return;\n return registerModalEscapeInterceptor(event => {\n if (event.key !== 'Escape') return false;\n close();\n return true;\n });\n }, [show]);\n\n // `aria-describedby` belongs on the TRIGGER, not on this wrapper. A screen\n // reader announces the description of the element that has focus, and focus\n // lands on the trigger — a describedby on an ancestor is not inherited, so\n // the tooltip was being read by nobody. Cloning is the only way to reach an\n // element the caller passed in; a caller who passes a fragment or a string\n // still gets the wrapper form, which at least keeps the association in the\n // accessibility tree.\n //\n // Merged with whatever the trigger already had rather than assigned over it:\n // `cloneElement` overwrites, so a caller who describes their own control\n // (`<button aria-describedby=\"password-rules\">`) lost that description as\n // soon as a tooltip was wrapped around it — and lost it permanently, since\n // the clone writes `undefined` while the bubble is closed.\n const describedBy = show ? id : undefined;\n const trigger = isValidElement<{ 'aria-describedby'?: string }>(children)\n ? cloneElement(children, {\n 'aria-describedby':\n [children.props['aria-describedby'], describedBy].filter(Boolean).join(' ') || undefined,\n })\n : children;\n\n return (\n <span\n className=\"relative inline-flex\"\n aria-describedby={isValidElement(children) ? undefined : describedBy}\n onMouseEnter={open}\n onMouseLeave={close}\n onFocus={open}\n onBlur={close}\n >\n {trigger}\n {show && (\n <span\n id={id}\n role=\"tooltip\"\n className={`pointer-events-none absolute z-[300] whitespace-nowrap rounded-md px-2 py-1 text-xs text-gray-800 ${SIDE_POS[side]}`}\n style={glassStyle()}\n >\n {content}\n </span>\n )}\n </span>\n );\n}\n","/**\n * StatusBadge — unified status pill across the system.\n *\n * The shell defines 8 semantic groups so the same concept always looks the\n * same color, regardless of which entity the status came from. The mapping\n * from raw status strings → groups is consumer-supplied via\n * <StatusBadgeProvider groups={...}>; when no provider is present (or a\n * status isn't mapped), the badge falls back to the \"neutral\" group.\n *\n * Colour comes from the status tokens in ui.css, which carry both themes, so\n * there is no dark-mode rule to keep in step with this file.\n */\nimport { createContext, useContext, type ReactNode } from 'react';\n\nexport type SemanticGroup =\n | 'success' // finished, done, paid, approved, confirmed, received, active, production_ready, shipped\n | 'active' // in-progress, in production, in transit, posted, development\n | 'queued' // sent, arranged, loaded, submitted, pending_production\n | 'info' // initialized, delivered\n | 'pending' // pending, at_port (waiting / hold)\n | 'warning' // customs, partially_paid (needs attention)\n | 'danger' // overdue\n | 'draft' // draft (slightly more visible than neutral)\n | 'neutral'; // cancelled, inactive, rejected\n\n/**\n * How loudly the badge speaks. The same two words `Banner` uses, for the same\n * idea — one axis, one vocabulary, wherever the shell lets a caller choose.\n *\n * `subtle` (the default) is the quiet register: a wash of the group's hue that\n * composites over whatever it sits on, so a table of forty rows reads as a\n * table rather than as forty coloured chips. `solid` is the saturated fill for\n * the ONE place the same fact is the headline — a detail header, a risk tier on\n * an approval screen. Solid inside a dense list is the bug this axis exists to\n * make unnecessary: it turns every row into an alarm and none of them is read.\n */\nexport type StatusEmphasis = 'subtle' | 'solid';\n\n/**\n * The one table. `ColoredBadge` reads it too, through its `tone` prop, so a\n * badge given a tone directly and a badge given a status string that maps to\n * that tone are the same colour — which is the promise this component's\n * docblock makes and could not keep for anything that was not a status.\n *\n * The values are token-backed rather than palette steps (`bg-green-100\n * text-green-800`) for two reasons. An opaque tint is calibrated against ONE\n * backdrop — the flat surface — and reads as a patch on a raised panel or a\n * hovered row; the `-soft` tokens are a transparent wash, so one value is right\n * on all three. And a token carries its own dark value, so this table no longer\n * needs a matching `[data-theme=\"dark\"] .bg-green-100.text-green-800` rule in\n * ui.css that a new group could silently ship without. See the status-token\n * block in ui.css for the measured contrast the inks are set to.\n */\nexport const GROUP_COLORS: Record<SemanticGroup, string> = {\n success: 'bg-[var(--status-success-soft)] text-[color:var(--status-success-soft-ink)]',\n active: 'bg-[var(--status-active-soft)] text-[color:var(--status-active-soft-ink)]',\n queued: 'bg-[var(--status-queued-soft)] text-[color:var(--status-queued-soft-ink)]',\n info: 'bg-[var(--status-info-soft)] text-[color:var(--status-info-soft-ink)]',\n pending: 'bg-[var(--status-pending-soft)] text-[color:var(--status-pending-soft-ink)]',\n warning: 'bg-[var(--status-warning-soft)] text-[color:var(--status-warning-soft-ink)]',\n danger: 'bg-[var(--status-danger-soft)] text-[color:var(--status-danger-soft-ink)]',\n draft: 'bg-[var(--status-draft-soft)] text-[color:var(--status-draft-soft-ink)]',\n neutral: 'bg-[var(--status-neutral-soft)] text-[color:var(--status-neutral-soft-ink)]',\n};\n\n/** The loud register of the same nine groups — `emphasis=\"solid\"`. White on a\n * saturated fill, one value in both themes, because a solid badge is read\n * against itself rather than against the surface behind it. */\nexport const GROUP_COLORS_SOLID: Record<SemanticGroup, string> = {\n success: 'bg-[var(--status-success-solid)] text-[color:var(--status-on-solid)]',\n active: 'bg-[var(--status-active-solid)] text-[color:var(--status-on-solid)]',\n queued: 'bg-[var(--status-queued-solid)] text-[color:var(--status-on-solid)]',\n info: 'bg-[var(--status-info-solid)] text-[color:var(--status-on-solid)]',\n pending: 'bg-[var(--status-pending-solid)] text-[color:var(--status-on-solid)]',\n warning: 'bg-[var(--status-warning-solid)] text-[color:var(--status-on-solid)]',\n danger: 'bg-[var(--status-danger-solid)] text-[color:var(--status-on-solid)]',\n draft: 'bg-[var(--status-draft-solid)] text-[color:var(--status-on-solid)]',\n neutral: 'bg-[var(--status-neutral-solid)] text-[color:var(--status-on-solid)]',\n};\n\n/** Classes for one group at one emphasis. Exported so a surface that has to\n * build its own pill — a virtualised cell, a canvas legend — takes the same\n * colours instead of guessing at them. */\nexport function groupColors(group: SemanticGroup, emphasis: StatusEmphasis = 'subtle'): string {\n return emphasis === 'solid' ? GROUP_COLORS_SOLID[group] : GROUP_COLORS[group];\n}\n\nconst StatusGroupsContext = createContext<Record<string, SemanticGroup>>({});\n\nexport function StatusBadgeProvider({\n groups,\n children,\n}: { groups: Record<string, SemanticGroup>; children: ReactNode }) {\n return <StatusGroupsContext.Provider value={groups}>{children}</StatusGroupsContext.Provider>;\n}\n\ninterface StatusBadgeProps {\n status: string;\n /**\n * What to SHOW, when the raw status is not what a reader should see.\n *\n * The derived label — underscores to spaces, title case — is right for a\n * status this system named. It is wrong for one that arrived from somewhere\n * else: Stripe's `trialing` reads as \"Trialing\" rather than \"Trial\", and its\n * `canceled` puts an American spelling in front of a British-English tenant.\n *\n * Without this, a consumer that needs one word changed has to abandon the\n * badge and hand-roll the whole pill — and takes the colours with it, which\n * is precisely the drift `StatusBadge` exists to prevent. The tone still\n * comes from `status`, so the group mapping stays the single source of\n * truth for colour no matter what is written on the pill.\n */\n label?: ReactNode;\n /**\n * How loudly to say it. Same fact, same group, same mapping — only the\n * volume changes, so a risk tier can be quiet in a table row and loud in the\n * header of the record that row opens, with no second component and no call\n * site picking colours.\n */\n emphasis?: StatusEmphasis;\n}\n\nexport default function StatusBadge({ status, label, emphasis = 'subtle' }: StatusBadgeProps) {\n const groups = useContext(StatusGroupsContext);\n const group = groups[status] ?? 'neutral';\n const color = groupColors(group, emphasis);\n const text = label ?? status.replace(/_/g, ' ').replace(/\\b\\w/g, c => c.toUpperCase());\n\n return (\n <span className={`inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium ${color}`}>\n {text}\n </span>\n );\n}\n","import { GROUP_COLORS, type SemanticGroup } from './StatusBadge';\nimport type { ReactNode } from 'react';\n\nexport interface ColoredBadgeProps {\n /**\n * A semantic tone, resolved through the same table `StatusBadge` uses — so a\n * badge given `tone=\"success\"` and one given a status string that maps to\n * success are the same green.\n *\n * Prefer this to `colorClass`. Raw classes are the escape hatch for a colour\n * the system has no name for, and every consumer reaching for them is a\n * place the theme system cannot follow.\n */\n tone?: SemanticGroup;\n /** Tailwind classes for the badge color, e.g. `bg-green-100 text-green-800`.\n * Wins over `tone` when both are given. */\n colorClass?: string;\n children: ReactNode;\n /** `xs` = 10px (dense list cells), `sm` = 12px / px-2 (default), `md` =\n * 12px / px-2.5 (matches StatusBadge). */\n size?: 'xs' | 'sm' | 'md';\n /** Capitalize each word — useful for raw status strings like `in_progress`\n * (rendered as `In Progress`). Default false. */\n capitalize?: boolean;\n /**\n * Render a close control — a filter chip the user can drop.\n *\n * Its accessible name is derived from the badge's own text: \"Remove Winter\n * tyres\", not \"Remove\". A row of filter chips otherwise gives a screen-reader\n * user five identical buttons and no way to tell which one drops which\n * filter. `closeLabel` overrides it, and is required in practice whenever\n * the children are not plain text — there is nothing to derive from.\n */\n closable?: boolean;\n onClose?: () => void;\n closeLabel?: string;\n className?: string;\n}\n\n/**\n * ColoredBadge — a small rounded-full pill. Give it a `tone` from the shell's\n * semantic vocabulary, or raw Tailwind classes when the colour has no name.\n *\n * Counterpart to StatusBadge, which takes a domain status STRING and maps it\n * through a provider. Both read the same colour table, so the two never\n * disagree about what success looks like.\n */\nexport default function ColoredBadge({\n colorClass, tone, children, size = 'sm', capitalize = false,\n closable = false, onClose, closeLabel, className = '',\n}: ColoredBadgeProps) {\n // Explicit beats semantic: a caller who passed raw classes did so to say\n // something the tone vocabulary cannot. Neither given is neutral, which is\n // what an unlabelled pill has always looked like.\n const colour = colorClass ?? GROUP_COLORS[tone ?? 'neutral'];\n const sizeCls =\n size === 'xs' ? 'px-2 py-0.5 text-[10px]' :\n size === 'md' ? 'px-2.5 py-0.5 text-xs' :\n 'px-2 py-0.5 text-xs';\n const capCls = capitalize ? 'capitalize' : '';\n const closeName = closeLabel ?? (typeof children === 'string' ? `Remove ${children}` : 'Remove');\n const closeSize = size === 'xs' ? 'h-2.5 w-2.5' : 'h-3 w-3';\n return (\n <span className={['inline-flex items-center rounded-full font-medium', sizeCls, capCls, colour, className].filter(Boolean).join(' ')}>\n {children}\n {closable && (\n <button\n type=\"button\"\n onClick={onClose}\n aria-label={closeName}\n className=\"-mr-0.5 ml-1 inline-flex shrink-0 items-center justify-center rounded-full opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-blue-400/40\"\n >\n <svg className={closeSize} viewBox=\"0 0 20 20\" fill=\"currentColor\" aria-hidden=\"true\">\n <path d=\"M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z\" />\n </svg>\n </button>\n )}\n </span>\n );\n}\n","import type { ReactNode } from 'react';\n\nexport interface EmptyStateProps {\n /** Bold heading, e.g. \"No invoices yet\". */\n title?: string;\n /** Muted primary line. Defaults to \"Nothing here yet.\" when neither\n * `title` nor `message` is given. */\n message?: string;\n /** Secondary muted line. (`hint` is an accepted alias.) */\n description?: string;\n /** @deprecated alias for `description`. */\n hint?: string;\n /** Frame around the content: `dashed` (default), `card` (bordered surface),\n * or `none`. */\n variant?: 'dashed' | 'card' | 'none';\n /** @deprecated set `variant=\"none\"` instead. */\n frameless?: boolean;\n /**\n * `true`/omitted shows the placeholder inbox, `false` shows nothing, and an\n * element shows that instead.\n *\n * The boolean alone meant every empty state in every app was an inbox — an\n * empty catalogue, an empty invoice list and an empty inbox drawn\n * identically, when the icon is the fastest thing on the screen to read.\n * Defaults to the placeholder (to nothing for `variant=\"card\"`).\n */\n icon?: boolean | ReactNode;\n /** Action(s) rendered under the text. */\n children?: ReactNode;\n}\n\n/**\n * EmptyState — placeholder for empty lists/panes. Supersedes the per-portal\n * copies: accepts both the `title`/`description` and `message`/`hint`/`frameless`\n * prop shapes, with a single unified look.\n */\nexport default function EmptyState({\n title, message, description, hint, variant, frameless, icon, children,\n}: EmptyStateProps) {\n const v = frameless ? 'none' : (variant ?? 'dashed');\n // A boolean picks the placeholder; anything else IS the icon. Checked by\n // type rather than truthiness, so `icon={0}` or an empty fragment renders\n // what was passed instead of silently falling back to the inbox.\n const custom = typeof icon !== 'boolean' && icon != null ? icon : null;\n const showIcon = custom ? false : ((icon as boolean | undefined) ?? (v !== 'card'));\n const primary = message ?? (title ? undefined : 'Nothing here yet.');\n const secondary = description ?? hint;\n const frame =\n v === 'card' ? 'rounded-md border border-gray-200 bg-white px-6 py-12' :\n v === 'none' ? 'px-6 py-12' :\n 'rounded-lg border-2 border-dashed border-gray-300 px-6 py-12';\n return (\n <div className={`flex flex-col items-center justify-center text-center ${frame}`}>\n {/* The same 40px footprint the placeholder occupies, so a caller passing\n a 20px glyph gets it centred in that box rather than rendered at half\n the size the default draws at — and the heading below does not shift\n depending on which icon was used. */}\n {custom && (\n <div className=\"mb-3 flex h-10 w-10 items-center justify-center text-gray-300\" aria-hidden=\"true\">\n {custom}\n </div>\n )}\n {showIcon && (\n <svg className=\"h-10 w-10 text-gray-300 mb-3\" aria-hidden=\"true\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" strokeWidth={1}>\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4\" />\n </svg>\n )}\n {title && <h3 className=\"text-sm font-medium text-gray-900\">{title}</h3>}\n {primary && <p className={`text-sm text-gray-500 ${title ? 'mt-2' : ''}`}>{primary}</p>}\n {secondary && <p className=\"text-xs text-gray-400 mt-1\">{secondary}</p>}\n {children && <div className=\"mt-4\">{children}</div>}\n </div>\n );\n}\n","import type { ReactNode } from 'react';\nimport Breadcrumbs, { type BreadcrumbItem } from './Breadcrumbs';\n\nexport interface PageHeaderProps {\n title: string;\n /** Muted line under the title. (`subtitle` is an accepted alias.) */\n description?: string;\n /** @deprecated alias for `description`. */\n subtitle?: string;\n /** Right-aligned actions. (`children` is also accepted.) */\n actions?: ReactNode;\n children?: ReactNode;\n /**\n * Icon beside the title — a marker for the page, not a second headline.\n * Rendered muted and at the title's own size, so it labels the words rather\n * than competing with them.\n */\n icon?: ReactNode;\n /**\n * Trail above the title, root → current, rendered with the kit's own\n * `Breadcrumbs`. Not a second implementation: the collapsing behaviour, the\n * `aria-current=\"page\"` on the last crumb and the separator all come from\n * that component, so a trail in a header and a trail anywhere else stay the\n * same thing.\n */\n breadcrumbs?: BreadcrumbItem[];\n}\n\n/**\n * PageHeader — a page/section title with an optional muted description and a\n * right-aligned actions slot. Accepts both the `description`/`actions` and the\n * `subtitle`/`children` prop shapes the portals previously used locally.\n */\nexport default function PageHeader({\n title, description, subtitle, actions, children, icon, breadcrumbs,\n}: PageHeaderProps) {\n const desc = description ?? subtitle;\n const right = actions ?? children;\n return (\n <div className=\"mb-6\">\n {breadcrumbs && breadcrumbs.length > 0 && <Breadcrumbs items={breadcrumbs} className=\"mb-3\" />}\n <div className=\"flex items-start justify-between gap-4\">\n <div>\n <h1 className=\"flex items-center gap-2 text-xl font-semibold text-gray-900\">\n {icon && <span className=\"shrink-0 text-gray-400\">{icon}</span>}\n {title}\n </h1>\n {desc && <p className=\"mt-1 text-sm text-gray-500\">{desc}</p>}\n </div>\n {right && <div className=\"flex items-center gap-2\">{right}</div>}\n </div>\n </div>\n );\n}\n","/**\n * Severity — the health subset of the shell's status vocabulary.\n *\n * The shell already speaks `success | warning | danger` everywhere status has a\n * colour (`StatusBadge`'s `SemanticGroup`, `Banner`'s `BannerTone`,\n * `ConfirmDialog`'s `variant`). Health surfaces reuse those three words rather\n * than introducing an ok/warn/crit dialect that would mean the same thing in a\n * different language — a consumer mapping one to the other is a bug waiting to\n * happen. The type is deliberately narrower than `SemanticGroup`: an alarm\n * marker has exactly three things to say.\n *\n * \"No severity\" is expressed as the ABSENCE of a tone (`undefined`/`null`), not\n * as a fourth member. Two different facts collapse into it — no reading at all,\n * and a reading with nothing to judge it against — and both must render as\n * \"unknown\" rather than borrowing the calm green of a measured healthy value.\n * See `MetricBar`, which keeps them apart.\n *\n * A severity usually arrives from a backend rollup, so it crosses a JSON\n * boundary where the compiler cannot follow it. `resolveSeverity` is what the\n * components call: a token the shell does not recognise renders a LOUD unknown\n * marker and logs, it never renders nothing. An alarm surface that silently\n * stops alarming is the one failure these components exist to prevent, so it is\n * also the one failure they must not have themselves.\n */\n\n/** Health tone. Same three words the rest of the shell uses for status colour. */\nexport type SeverityTone = 'success' | 'warning' | 'danger';\n\n/** The tones as a runtime list. A `SeverityTone` annotation is erased at the\n * boundary the values actually cross (a fetch response), so the check that\n * matters has to exist at runtime. */\nexport const SEVERITY_TONES: readonly SeverityTone[] = ['success', 'warning', 'danger'];\n\n/** True when `value` is one of the three tones. Exported so a consumer can\n * validate a rollup at the fetch boundary — where a bad token can still be\n * reported against its payload — rather than discovering it as a wrong pixel. */\nexport function isSeverityTone(value: unknown): value is SeverityTone {\n return typeof value === 'string' && (SEVERITY_TONES as readonly string[]).includes(value);\n}\n\n/**\n * Severity of `value` against its bounds, or `null` when nothing can be said.\n *\n * Both bounds are INCLUSIVE (`>=`): a disk at exactly its `crit` number is\n * `danger`. Either bound may be omitted — a metric with only a `crit` still\n * judges — but with neither the answer is `null`, never `success`: no threshold\n * is hardcoded here, not even as a fallback, so with nothing to measure against\n * there is no verdict to report.\n *\n * A non-finite bound counts as omitted, not as a bound that nothing exceeds.\n * `NaN >= NaN` is false, so an unguarded `warn={NaN}` would have quietly\n * returned `success` — a verdict invented out of a missing threshold.\n */\nexport function severityOf(\n value: number | null | undefined,\n warn?: number | null,\n crit?: number | null,\n): SeverityTone | null {\n if (value == null || !Number.isFinite(value)) return null;\n const warnAt = boundOf(warn);\n const critAt = boundOf(crit);\n if (warnAt == null && critAt == null) return null;\n if (critAt != null && value >= critAt) return 'danger';\n if (warnAt != null && value >= warnAt) return 'warning';\n return 'success';\n}\n\n/** A threshold the component can actually compare against, or `null`. */\nexport function boundOf(value: number | null | undefined): number | null {\n return value != null && Number.isFinite(value) ? value : null;\n}\n\n/** Marker dot / bar fill. The vivid 500s are deliberately NOT dark-remapped in\n * `styles.css`: they carry meaning, and they read on the light (`bg-gray-200`)\n * and dark (#313244) track alike. */\nexport const SEVERITY_FILL: Record<SeverityTone, string> = {\n success: 'bg-green-500',\n warning: 'bg-amber-500',\n danger: 'bg-red-500',\n};\n\n/** Ink for a value the tone judges. `success` stays neutral on purpose —\n * colour on a metric row means \"look at me\", and a healthy number has nothing\n * to say. Write the 600s: `styles.css` remaps them to the lighter weights in\n * dark mode (`text-red-600` → #f87171); the 400s are not remapped. */\nexport const SEVERITY_INK: Record<SeverityTone, string> = {\n success: 'text-gray-900',\n warning: 'text-amber-600',\n danger: 'text-red-600',\n};\n\n/** Screen-reader / tooltip wording. The colour is the fast channel; this is the\n * one that survives a screen reader or a colour-blind operator. */\nexport const SEVERITY_WORD: Record<SeverityTone, string> = {\n success: 'ok',\n warning: 'warning',\n danger: 'critical',\n};\n\n/** Fill for a severity the shell does not recognise. Grey reads \"unknown\", the\n * red edge reads \"and that is a problem\" — deliberately unlike all three real\n * tones, and deliberately never empty: an unrecognised token used to produce\n * `class=\"… rounded-full undefined\"`, an invisible dot on the one surface whose\n * entire job is being visible. Both utilities are un-remapped in dark mode. */\nexport const SEVERITY_UNKNOWN_FILL = 'bg-gray-300 border border-red-500';\n\n/** Ink for a value carrying an unrecognised severity: the number is real, the\n * verdict on it is not, so it gets no tone colour. */\nexport const SEVERITY_UNKNOWN_INK = 'text-gray-900';\n\n/** How a `severity` prop resolved. `fill`, `ink` and `word` are ALWAYS\n * non-empty, which is what makes a bad token impossible to render as nothing;\n * `tone` is `null` when the token was not recognised, for the few places that\n * need to know whether there is a real verdict behind the marker. */\nexport interface SeverityStyle {\n /** The recognised tone, or `null` when the token was not one of the three. */\n tone: SeverityTone | null;\n /** Marker-dot / bar-fill background classes. Never empty. */\n fill: string;\n /** Ink classes for the value this severity judges. Never empty. */\n ink: string;\n /** Tooltip / screen-reader wording. Never empty. */\n word: string;\n}\n\nconst TONE_STYLES: Record<SeverityTone, SeverityStyle> = {\n success: { tone: 'success', fill: SEVERITY_FILL.success, ink: SEVERITY_INK.success, word: SEVERITY_WORD.success },\n warning: { tone: 'warning', fill: SEVERITY_FILL.warning, ink: SEVERITY_INK.warning, word: SEVERITY_WORD.warning },\n danger: { tone: 'danger', fill: SEVERITY_FILL.danger, ink: SEVERITY_INK.danger, word: SEVERITY_WORD.danger },\n};\n\n/** Presentation for a tone the shell already trusts, or `null` for \"no tone\".\n * Use this for a severity the component computed itself (via `severityOf`),\n * where there is no untrusted token to fall back from. */\nexport function styleForTone(tone: SeverityTone | null | undefined): SeverityStyle | null {\n return tone == null ? null : TONE_STYLES[tone];\n}\n\n/** Renderable description of whatever the caller passed, capped so a runaway\n * payload cannot become a 10 KB `title`. React escapes it on the way out. */\nfunction describeToken(value: unknown): string {\n const raw =\n typeof value === 'string'\n ? JSON.stringify(value)\n : typeof value === 'number' || typeof value === 'boolean' || typeof value === 'bigint'\n ? String(value)\n : Object.prototype.toString.call(value);\n return raw.length > 32 ? `${raw.slice(0, 31)}…` : raw;\n}\n\n/** One console line per distinct (component, token) pair — a sidebar with 200\n * items on one bad rollup should say this once, not 200 times. */\nconst reported = new Set<string>();\n\nfunction reportUnknownSeverity(component: string, described: string): void {\n const key = `${component}:${described}`;\n if (reported.has(key)) return;\n reported.add(key);\n // Not gated on NODE_ENV: a mis-typed severity is a production bug that\n // silences an alarm, and the library cannot assume a bundler define exists.\n console.error(\n `[react-os-shell] ${component}: severity ${described} is not one of ` +\n `${SEVERITY_TONES.join(' | ')}. Rendering an \"unknown severity\" marker — a health ` +\n 'marker must never silently disappear. If this came from a backend rollup, map it ' +\n \"to the shell's vocabulary at the fetch boundary (see isSeverityTone).\",\n );\n}\n\n/**\n * Resolve a `severity` prop that may have come from anywhere.\n *\n * Three outcomes, because there are three different facts:\n * `null`/`undefined` in → `null` out nothing was claimed; render no marker\n * a recognised tone → its style the normal path\n * anything else → unknown style logged once, and rendered VISIBLY\n *\n * The third case is the whole point. `SEVERITY_FILL[severity]` on an unknown\n * key yields `undefined`, which interpolates into a className as the string\n * `\"undefined\"` — a dot with no colour, no title and no screen-reader word, on\n * a component whose entire purpose is making a deep alarm visible at the top\n * level. Failing loudly (console) and degrading visibly (grey dot, red edge,\n * the token in its tooltip) are both strictly better than vanishing.\n *\n * Note what this deliberately does NOT do: alias `ok`/`warn`/`crit`, or the\n * displayed words `critical`/`ok`, onto the three tones. Quietly accepting a\n * second dialect would re-create exactly the two-vocabularies-for-one-idea\n * problem this module exists to avoid, and would hide the caller's bug instead\n * of surfacing it. The mismatch is reported, not papered over.\n */\nexport function resolveSeverity(severity: unknown, component: string): SeverityStyle | null {\n if (severity == null) return null;\n if (isSeverityTone(severity)) return TONE_STYLES[severity];\n\n const described = describeToken(severity);\n reportUnknownSeverity(component, described);\n return {\n tone: null,\n fill: SEVERITY_UNKNOWN_FILL,\n ink: SEVERITY_UNKNOWN_INK,\n word: `unrecognised severity ${described}`,\n };\n}\n\n/** Deduplicated console line for the other way a caller can hand these\n * components an impossible number. Shared with `resolveSeverity`'s registry so\n * one bad prop is one line, however many rows render it. */\nexport function warnOnce(key: string, message: string): void {\n if (reported.has(key)) return;\n reported.add(key);\n console.error(message);\n}\n","/**\n * MetricBar — a measured value, a proportional bar, and optional threshold\n * ticks. The CPU / memory / disk row every status surface ends up rewriting.\n *\n * The contract worth knowing before you use it: **`null` is not zero.** A\n * missing reading renders as a dashed empty track and an em dash, never as a\n * zero-width bar — a zero-width bar is a picture of a healthy idle box, which\n * is the opposite of \"we have no idea\". Same reasoning one level up: with no\n * thresholds the fill stays grey rather than green, because green is a claim\n * (\"measured, and under warn\") that nothing here has standing to make.\n *\n * Four render states, because there are four different facts:\n * value + thresholds the real row — toned fill, ticks, coloured value ink\n * value, no threshold a real magnitude nobody can judge — grey fill, no ticks\n * thresholds, no value no reading — dashed empty track, em dash\n * neither same\n *\n * `max` is held to the same standard as `value`, because it is the divisor: a\n * bar is a proportion, and a proportion of an unknown total is not a small bar,\n * it is no bar. `max={0}` used to divide to `Infinity`, clamp to 100 % and paint\n * a full green bar out of a division by zero — a fabricated measurement on the\n * exact path this component exists to guard (`max={total ?? 0}` where the probe\n * never learned the total). Now a non-positive or non-finite `max` drops the\n * scale: the value still prints, the bar does not pretend to place it.\n *\n * Severity is `success | warning | danger` — the shell's status vocabulary (see\n * `severity.ts`), not a private ok/warn/crit dialect.\n */\nimport type { ReactNode } from 'react';\nimport { boundOf, resolveSeverity, severityOf, styleForTone, warnOnce, type SeverityTone } from './severity';\n\nexport interface MetricBarProps {\n /** Row label — `CPU`, `Memory`, `Disk`. Rendered in a fixed-width column so\n * a stack of rows aligns. */\n label?: ReactNode;\n /** The measured value. `null` / `undefined` means NO READING — rendered as\n * unknown, never as 0. */\n value: number | null | undefined;\n /** Value mapped to a full bar. Default 100. Must be a positive finite number:\n * it is the divisor, so `0`, a negative or `NaN` is not a scale. Given one,\n * the row prints the value but draws no proportional bar and no ticks —\n * there is nothing truthful to draw them against. */\n max?: number;\n /** Warning bound, in the same unit as `value`. Inclusive (`>=`). */\n warn?: number | null;\n /** Critical bound, in the same unit as `value`. Inclusive (`>=`). */\n crit?: number | null;\n /** Forces the tone when the caller judges severity itself (e.g. a rollup\n * served by the backend). Overrides `warn`/`crit` for colour; the ticks\n * still render wherever `warn`/`crit` say. */\n severity?: SeverityTone;\n /** Trailing secondary text — `10.9 / 16 GiB`, `4 vCPU`. Hidden when there is\n * no reading, where the row has something more important to say. */\n detail?: ReactNode;\n /** Formats the printed value. Default: one decimal plus `%` on the default\n * 0–100 scale, the bare number on any other `max` (a custom scale is not a\n * percentage, and printing one would be a lie). */\n formatValue?: (value: number) => string;\n /** Wording for \"no reading\". Default `no data`. */\n emptyLabel?: string;\n /** `sm` (default) — the compact row that stacks three to a card.\n * `md` — bigger value type for a standalone stat. Neither draws a frame;\n * wrap in a `Card` (or your own) if you want one. */\n size?: 'sm' | 'md';\n /** Accessible name for the meter. Defaults to `label` when it's a string. */\n ariaLabel?: string;\n className?: string;\n}\n\n/** Ticks come from the caller's numbers — the shell hardcodes no threshold,\n * not even as a fallback. Mid-greys, deliberately not dark-remapped: they stay\n * legible on the light (`bg-gray-200`) and dark track alike. */\nfunction Tick({ at, title, className }: { at: number; title: string; className: string }) {\n return (\n <div\n title={title}\n className={`absolute -top-[3px] h-3 w-0.5 rounded-[1px] ${className}`}\n style={{ left: `${at}%` }}\n />\n );\n}\n\nconst clampPct = (n: number) => Math.min(100, Math.max(0, n));\n\nexport default function MetricBar({\n label,\n value,\n max = 100,\n warn,\n crit,\n severity,\n detail,\n formatValue,\n emptyLabel = 'no data',\n size = 'sm',\n ariaLabel,\n className = '',\n}: MetricBarProps) {\n // One narrowed reading for the whole component: `null` covers both \"not\n // supplied\" and NaN/Infinity, which are just as unmeasured.\n const reading = value != null && Number.isFinite(value) ? value : null;\n // The same test applied to the divisor, plus positivity. Anything else is not\n // a smaller scale, it is the absence of one.\n const scale = Number.isFinite(max) && max > 0 ? max : null;\n if (scale == null) {\n warnOnce(\n `MetricBar:max:${String(max)}`,\n `[react-os-shell] MetricBar: max=${String(max)} is not a positive finite number, so there is ` +\n 'no scale to draw a proportional bar against. Printing the value without a bar. Pass the real ' +\n 'capacity, or leave the reading out entirely (value={null}) when it is unknown — do not pass 0.',\n );\n }\n // A `severity` the caller supplied outranks the bounds. An unrecognised one\n // resolves to a visible \"unknown\" style rather than to undefined classes.\n const supplied = resolveSeverity(severity, 'MetricBar');\n const paint = reading != null ? (supplied ?? styleForTone(severityOf(reading, warn, crit))) : null;\n // Ticks need a bound the component can actually place, on a scale that exists.\n const warnAt = boundOf(warn);\n const critAt = boundOf(crit);\n // Clamp the BAR only — never the printed number. A probe blipping to 103 %\n // should draw a full bar and still say 103 %.\n const width = reading != null && scale != null ? clampPct((reading / scale) * 100) : 0;\n const format = formatValue ?? ((v: number) => (scale === 100 ? `${v.toFixed(1)}%` : String(v)));\n const printed = reading != null ? format(reading) : '—';\n const showTicks = reading != null && scale != null && (warnAt != null || critAt != null);\n\n const meterLabel = ariaLabel ?? (typeof label === 'string' ? label : undefined);\n const barHeight = size === 'md' ? 'h-2' : 'h-1.5';\n // It is a meter only when it is actually a meter: a reading, on a scale.\n // `role=\"meter\"` REQUIRES `aria-valuenow` (unlike `progressbar`, it has no\n // indeterminate state), so a roleless track is the honest empty rendering —\n // omitting valuenow under the role would have been a malformed widget whose\n // announcement is undefined, and `aria-valuenow={0}` would have announced a\n // healthy idle box. Either way the row already says \"— / no data\" in text.\n const isMeter = reading != null && scale != null;\n\n const bar = (\n <div\n {...(isMeter\n ? {\n role: 'meter' as const,\n 'aria-label': meterLabel,\n 'aria-valuemin': 0,\n 'aria-valuemax': scale,\n // Kept inside the declared range: the bar clamps, and a valuenow\n // past its own valuemax is an invalid widget. `aria-valuetext`\n // still carries the unclamped truth, and takes precedence in the\n // announcement.\n 'aria-valuenow': Math.min(scale, Math.max(0, reading)),\n 'aria-valuetext': printed,\n }\n : { 'aria-hidden': true as const })}\n className={\n isMeter && paint\n ? `relative mt-2 ${barHeight} rounded-full bg-gray-200`\n // Dashed track: nothing to compare against, nothing to compare, or\n // nothing to compare it on.\n : `relative mt-2 ${barHeight} rounded-full border border-dashed border-gray-300 bg-transparent`\n }\n >\n {isMeter && (\n // Grey when unjudged: the magnitude is real, the verdict is not ours.\n <div\n className={`absolute inset-y-0 left-0 rounded-full ${paint ? paint.fill : 'bg-gray-400'}`}\n style={{ width: `${width}%` }}\n />\n )}\n {showTicks && scale != null && warnAt != null && (\n <Tick at={clampPct((warnAt / scale) * 100)} title={`warning ≥ ${warnAt}`} className=\"bg-gray-400 opacity-75\" />\n )}\n {showTicks && scale != null && critAt != null && (\n <Tick at={clampPct((critAt / scale) * 100)} title={`critical ≥ ${critAt}`} className=\"bg-gray-500\" />\n )}\n </div>\n );\n\n const valueInk = paint ? paint.ink : reading != null ? 'text-gray-900' : 'text-gray-400';\n\n if (size === 'md') {\n return (\n <div className={className}>\n {label != null && (\n <div className=\"text-[10px] font-medium uppercase tracking-wide text-gray-500\">{label}</div>\n )}\n <div className=\"mt-1 flex items-baseline gap-2\">\n <span className={`text-2xl font-semibold leading-[30px] tabular-nums ${valueInk}`}>{printed}</span>\n <span className=\"min-w-0 truncate text-[11px] tabular-nums text-gray-400\">\n {reading != null ? detail : emptyLabel}\n </span>\n </div>\n {bar}\n </div>\n );\n }\n\n return (\n <div className={className}>\n <div className=\"flex items-baseline gap-2\">\n {label != null && (\n <span className=\"w-14 shrink-0 truncate text-[10px] font-medium uppercase tracking-wide text-gray-500\">\n {label}\n </span>\n )}\n <span className={`text-sm font-semibold tabular-nums ${valueInk}`}>{printed}</span>\n {/* One slot, one question — \"what do we know about this number?\".\n \"No reading\" outranks whatever the absolute figure would have said. */}\n <span className=\"ml-auto min-w-0 truncate text-[10px] tabular-nums text-gray-400\">\n {reading != null ? detail : emptyLabel}\n </span>\n </div>\n {bar}\n </div>\n );\n}\n","/**\n * BudgetBar — how much of a run's wall clock is gone.\n *\n * An autonomous run is killed by a clock, not finished by one: 3600 seconds for\n * a run that changes code, 1800 for a read. So the honest reading is BUDGET\n * CONSUMED, never work done — nothing here knows how much of the task is left,\n * and a bar that implied it would be the most confident lie on the screen. The\n * printed figure is a percentage of the budget and the wording says so.\n *\n * `MetricBar` is the sibling to read first; this one keeps its contract that a\n * `null` is NO READING and never a zero, and adds the two facts a deadline has\n * that a gauge does not: a run can go PAST its allowance, and a run can have no\n * allowance at all.\n *\n * ── The three states a glance has to separate ──\n *\n * within budget a solid fill on a solid track. The ordinary case.\n *\n * past the deadline, inside the reaper's grace\n * a HATCHED band. Not a longer solid bar: a solid bar at\n * full width is the calm \"finished\" shape, and this is its\n * opposite. The texture survives a glance, a greyscale\n * screenshot and a colour-blind reader, none of which a\n * change of hue alone does. When a `grace` is given the track\n * spans budget + grace, so the bar is only FULL when the\n * reaper is actually due, and a deadline marker sits where\n * the budget ran out.\n *\n * no estimate at all\n * NO BAR. Not a zero-width one, not an empty track — a run\n * whose budget nobody knows has no proportion to draw, and\n * drawing the track anyway invites the reader to measure the\n * emptiness. The elapsed time still prints, because that part\n * IS known.\n *\n * A fourth, from `MetricBar`'s contract: no reading of `elapsed` prints an em\n * dash and draws nothing. `elapsed={0}` is a reading — a run that just started\n * — and renders a real meter at zero. The two must not look alike.\n *\n * ── Overrun with no grace ──\n * Past the deadline with no `grace` supplied there is no scale for the\n * overrun: the component knows the run is over and cannot know how far the\n * reaper will let it go. It paints the whole track hatched and marks nothing,\n * which claims exactly what is known — \"past the deadline, magnitude unscaled\"\n * — and leaves the magnitude to the printed figure. This is `MetricBar`'s\n * non-positive `max` reasoning applied to the other end of the bar: with no\n * divisor, no proportional claim.\n */\nimport type { ReactNode } from 'react';\n\n/** What the numbers say, before anything is drawn. Exported because a run LIST\n * needs the same verdict to sort and filter by, and re-deriving it at the call\n * site is how two surfaces start disagreeing about which runs are late. */\nexport type BudgetState = 'no-reading' | 'no-budget' | 'within' | 'over';\n\nexport interface BudgetBarProps {\n /** Row label — `Run 41c2`, `Nightly sweep`. */\n label?: ReactNode;\n /** Seconds consumed. `null` / `undefined` / non-finite means NO READING —\n * rendered as unknown, never as 0. Negative is not a reading either. */\n elapsed: number | null | undefined;\n /** The wall clock the run is allowed, in seconds. Must be positive and\n * finite; anything else is NO ESTIMATE and draws no bar at all. */\n budget?: number | null;\n /** Seconds past the budget the reaper tolerates before it kills the run.\n * Given one, the track spans `budget + grace` and the overrun is drawn to\n * scale; without one the overrun is drawn as unscaled. */\n grace?: number | null;\n /** Trailing secondary text. Defaults to `elapsed / budget` as durations. */\n detail?: ReactNode;\n /** Formats a duration in seconds. Default: `1h 0m` / `12m 30s` / `45s`. */\n formatDuration?: (seconds: number) => string;\n /** Wording for \"no reading\". */\n emptyLabel?: string;\n /** Wording for a run with no budget. */\n noBudgetLabel?: string;\n /** `sm` (default) — the compact row that stacks in a run list.\n * `md` — bigger figure for a single run's header. */\n size?: 'sm' | 'md';\n /** Accessible name for the meter. Defaults to `label` when it's a string. */\n ariaLabel?: string;\n className?: string;\n}\n\n/** A number this component can actually use, or `null`. */\nfunction reading(value: number | null | undefined): number | null {\n return value != null && Number.isFinite(value) && value >= 0 ? value : null;\n}\n\n/**\n * The verdict on a pair of numbers. Same rules the component draws by, so a\n * list that colours its rows and the bar inside a row cannot disagree.\n */\nexport function budgetState(\n elapsed: number | null | undefined,\n budget: number | null | undefined,\n): BudgetState {\n const spent = reading(elapsed);\n if (spent == null) return 'no-reading';\n const allowed = reading(budget);\n if (allowed == null || allowed === 0) return 'no-budget';\n return spent > allowed ? 'over' : 'within';\n}\n\n/** `1h 0m`, `12m 30s`, `45s`. Whole seconds — a wall clock in hours does not\n * need milliseconds, and a jittering final digit reads as instability. */\nfunction defaultDuration(seconds: number): string {\n const total = Math.round(seconds);\n const h = Math.floor(total / 3600);\n const m = Math.floor((total % 3600) / 60);\n const s = total % 60;\n if (h > 0) return `${h}h ${m}m`;\n if (m > 0) return `${m}m ${s}s`;\n return `${s}s`;\n}\n\nconst clampPct = (n: number) => Math.min(100, Math.max(0, n));\n\nexport default function BudgetBar({\n label,\n elapsed,\n budget,\n grace,\n detail,\n formatDuration = defaultDuration,\n emptyLabel = 'no reading',\n noBudgetLabel = 'no budget',\n size = 'sm',\n ariaLabel,\n className = '',\n}: BudgetBarProps) {\n const spent = reading(elapsed);\n const allowed = reading(budget);\n const budgetAt = allowed != null && allowed > 0 ? allowed : null;\n // A non-positive or absent grace is not a shorter grace, it is the absence\n // of one — the same distinction `budget` gets.\n const graceAt = reading(grace) ?? 0;\n const state = budgetState(elapsed, budget);\n const over = state === 'over';\n\n // The track spans the reaper's whole window. The PRINTED figure stays a\n // percentage of the budget: the number answers \"how much of my allowance is\n // gone\", the picture answers \"how much room is left before I am killed\", and\n // the deadline marker is where the two meet.\n const span = budgetAt != null ? budgetAt + graceAt : null;\n const deadlineAt = budgetAt != null && span != null ? clampPct((budgetAt / span) * 100) : null;\n // Overrun to scale needs a grace; without one there is no divisor for it.\n const scaledOverrun = over && graceAt > 0;\n\n const solidWidth =\n span == null || spent == null ? 0 : over ? (scaledOverrun ? (deadlineAt ?? 0) : 0) : clampPct((spent / span) * 100);\n const hatchStart = scaledOverrun ? (deadlineAt ?? 0) : 0;\n const hatchEnd = !over ? 0 : scaledOverrun && span != null && spent != null ? clampPct((spent / span) * 100) : 100;\n const hatchWidth = Math.max(0, hatchEnd - hatchStart);\n\n const percent = spent != null && budgetAt != null ? (spent / budgetAt) * 100 : null;\n const printed = percent != null ? `${Math.round(percent)}%` : spent != null ? formatDuration(spent) : '—';\n const trailing =\n detail ??\n (spent == null\n ? emptyLabel\n : budgetAt == null\n ? noBudgetLabel\n : `${formatDuration(spent)} / ${formatDuration(budgetAt)}`);\n\n const meterLabel = ariaLabel ?? (typeof label === 'string' ? label : undefined);\n const barHeight = size === 'md' ? 'h-2' : 'h-1.5';\n // A bar exists only when there is a proportion to draw: a reading, on a\n // budget. `role=\"meter\"` requires `aria-valuenow`, so there is no honest\n // roleless-but-present rendering to fall back to — and unlike `MetricBar`,\n // which draws a dashed track for a missing reading, an unbudgeted run gets\n // nothing at all. There is no scale for a reader to measure the emptiness\n // against, so the track would be furniture pretending to be information.\n const hasBar = spent != null && budgetAt != null && span != null;\n\n // A run past its deadline is the one thing on this row worth colouring. An\n // elapsed time with no budget is a real magnitude with no verdict on it, so\n // it keeps the ordinary ink; only a missing reading goes faint.\n const valueInk = over ? 'text-red-600' : spent != null ? 'text-gray-900' : 'text-gray-400';\n\n const bar = hasBar ? (\n <div\n role=\"meter\"\n aria-label={meterLabel}\n aria-valuemin={0}\n aria-valuemax={span}\n // Inside the declared range: the bar clamps and a valuenow past its own\n // valuemax is an invalid widget. `aria-valuetext` carries the unclamped\n // truth and takes precedence in the announcement.\n aria-valuenow={Math.min(span, spent)}\n aria-valuetext={`${printed} of budget`}\n className={`relative mt-2 ${barHeight} overflow-hidden rounded-full bg-gray-200`}\n >\n {/* Rendered even at 0%: a run that started a second ago IS a reading, and\n the empty bar is the picture of it. The state that draws nothing is\n the one with no reading, and that one draws no track either.\n Past the deadline it stops at the deadline and the hatch takes over —\n except with no grace, where there is no room past it and the hatch\n covers the whole track on its own. */}\n {(!over || scaledOverrun) && (\n <div\n className=\"absolute inset-y-0 left-0 rounded-full bg-blue-600\"\n style={{ width: `${solidWidth}%` }}\n />\n )}\n {hatchWidth > 0 && (\n <div\n className=\"rosh-budget-overrun absolute inset-y-0\"\n style={{ left: `${hatchStart}%`, width: `${hatchWidth}%` }}\n />\n )}\n {/* Marked whenever the track runs past it — which is exactly when a\n grace was given. With no grace the deadline IS the end of the track,\n and a marker there is a line drawn on the border. */}\n {graceAt > 0 && deadlineAt != null && (\n <div\n title=\"budget\"\n className=\"absolute inset-y-0 w-0.5 bg-gray-700\"\n style={{ left: `${deadlineAt}%` }}\n />\n )}\n </div>\n ) : null;\n\n if (size === 'md') {\n return (\n <div className={className}>\n {label != null && (\n <div className=\"text-[10px] font-medium uppercase tracking-wide text-gray-500\">{label}</div>\n )}\n <div className=\"mt-1 flex items-baseline gap-2\">\n <span className={`text-2xl font-semibold leading-[30px] tabular-nums ${valueInk}`}>{printed}</span>\n <span className=\"min-w-0 truncate text-[11px] tabular-nums text-gray-400\">{trailing}</span>\n </div>\n {bar}\n </div>\n );\n }\n\n return (\n <div className={className}>\n <div className=\"flex items-baseline gap-2\">\n {label != null && (\n <span className=\"w-14 shrink-0 truncate text-[10px] font-medium uppercase tracking-wide text-gray-500\">\n {label}\n </span>\n )}\n <span className={`text-sm font-semibold tabular-nums ${valueInk}`}>{printed}</span>\n <span className=\"ml-auto min-w-0 truncate text-[10px] tabular-nums text-gray-400\">{trailing}</span>\n </div>\n {bar}\n </div>\n );\n}\n","/**\n * Shared date formatting utility.\n *\n * Reads the user's preferred date format from localStorage (`user_date_format`)\n * and formats all dates consistently across the app.\n *\n * Supported formats (numeric, two-digit-year, abbreviated- and full-month):\n * 'DD/MM/YYYY' — 24/04/2026 'MM/DD/YY' — 04/24/26\n * 'MM/DD/YYYY' — 04/24/2026 'YYYY/MM/DD' — 2026/04/24\n * 'YYYY-MM-DD' — 2026-04-24 'YYYY.MM.DD' — 2026.04.24\n * 'DD-MM-YYYY' — 24-04-2026 'MM-DD-YYYY' — 04-24-2026\n * 'DD.MM.YYYY' — 24.04.2026 'DD MMM YYYY' — 24 Apr 2026\n * 'DD/MM/YY' — 24/04/26 'MMM DD, YYYY' — Apr 24, 2026\n * 'DD/MMM/YYYY' — 24/Apr/2026 'DD MMMM YYYY' — 24 April 2026\n * 'DD/MMM/YY' — 24/Apr/26 'MMMM DD, YYYY' — April 24, 2026\n */\n\nexport type DateFormatKey =\n | 'DD/MM/YYYY' | 'MM/DD/YYYY' | 'YYYY-MM-DD' | 'DD-MM-YYYY' | 'DD.MM.YYYY'\n | 'DD/MM/YY' | 'DD/MMM/YYYY' | 'DD/MMM/YY'\n | 'MM/DD/YY' | 'YYYY/MM/DD' | 'YYYY.MM.DD' | 'MM-DD-YYYY'\n | 'DD MMM YYYY' | 'MMM DD, YYYY' | 'DD MMMM YYYY' | 'MMMM DD, YYYY';\n\nexport const DATE_FORMAT_OPTIONS: { key: DateFormatKey; example: string }[] = [\n { key: 'DD/MM/YYYY', example: '24/04/2026' },\n { key: 'MM/DD/YYYY', example: '04/24/2026' },\n { key: 'YYYY-MM-DD', example: '2026-04-24' },\n { key: 'DD-MM-YYYY', example: '24-04-2026' },\n { key: 'MM-DD-YYYY', example: '04-24-2026' },\n { key: 'DD.MM.YYYY', example: '24.04.2026' },\n { key: 'YYYY.MM.DD', example: '2026.04.24' },\n { key: 'YYYY/MM/DD', example: '2026/04/24' },\n { key: 'DD/MM/YY', example: '24/04/26' },\n { key: 'MM/DD/YY', example: '04/24/26' },\n { key: 'DD/MMM/YYYY', example: '24/Apr/2026' },\n { key: 'DD/MMM/YY', example: '24/Apr/26' },\n { key: 'DD MMM YYYY', example: '24 Apr 2026' },\n { key: 'MMM DD, YYYY', example: 'Apr 24, 2026' },\n { key: 'DD MMMM YYYY', example: '24 April 2026' },\n { key: 'MMMM DD, YYYY', example: 'April 24, 2026' },\n];\n\n/** Month names for the alpha-numeric 'MMM'/'MMMM' formats. */\nconst MONTH_ABBR = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];\nconst MONTH_FULL = [\n 'January', 'February', 'March', 'April', 'May', 'June',\n 'July', 'August', 'September', 'October', 'November', 'December',\n];\n\nfunction monthAbbr(mm: string): string {\n return MONTH_ABBR[parseInt(mm, 10) - 1] ?? mm;\n}\n\nfunction monthFull(mm: string): string {\n return MONTH_FULL[parseInt(mm, 10) - 1] ?? mm;\n}\n\nexport function getUserDateFormat(): DateFormatKey {\n return (localStorage.getItem('user_date_format') as DateFormatKey) || 'DD/MM/YYYY';\n}\n\nexport function setUserDateFormat(fmt: DateFormatKey) {\n localStorage.setItem('user_date_format', fmt);\n}\n\n/**\n * Format a date string (YYYY-MM-DD or ISO timestamp) for display.\n * Returns '—' for null/empty values.\n */\nexport function formatDate(value: string | null | undefined): string {\n if (!value) return '—';\n // Parse — handle both \"YYYY-MM-DD\" and ISO timestamps\n const dateStr = value.includes('T') ? value.split('T')[0] : value;\n const [y, m, d] = dateStr.split('-').map(Number);\n if (!y || !m || !d) return value; // fallback if unparseable\n\n const dd = String(d).padStart(2, '0');\n const mm = String(m).padStart(2, '0');\n const yyyy = String(y);\n\n const fmt = getUserDateFormat();\n switch (fmt) {\n case 'MM/DD/YYYY': return `${mm}/${dd}/${yyyy}`;\n case 'YYYY-MM-DD': return `${yyyy}-${mm}-${dd}`;\n case 'DD-MM-YYYY': return `${dd}-${mm}-${yyyy}`;\n case 'MM-DD-YYYY': return `${mm}-${dd}-${yyyy}`;\n case 'DD.MM.YYYY': return `${dd}.${mm}.${yyyy}`;\n case 'YYYY.MM.DD': return `${yyyy}.${mm}.${dd}`;\n case 'YYYY/MM/DD': return `${yyyy}/${mm}/${dd}`;\n case 'DD/MM/YY': return `${dd}/${mm}/${yyyy.slice(-2)}`;\n case 'MM/DD/YY': return `${mm}/${dd}/${yyyy.slice(-2)}`;\n case 'DD/MMM/YYYY': return `${dd}/${monthAbbr(mm)}/${yyyy}`;\n case 'DD/MMM/YY': return `${dd}/${monthAbbr(mm)}/${yyyy.slice(-2)}`;\n case 'DD MMM YYYY': return `${dd} ${monthAbbr(mm)} ${yyyy}`;\n case 'MMM DD, YYYY': return `${monthAbbr(mm)} ${dd}, ${yyyy}`;\n case 'DD MMMM YYYY': return `${dd} ${monthFull(mm)} ${yyyy}`;\n case 'MMMM DD, YYYY': return `${monthFull(mm)} ${dd}, ${yyyy}`;\n case 'DD/MM/YYYY':\n default: return `${dd}/${mm}/${yyyy}`;\n }\n}\n\n/**\n * Format a datetime string (ISO timestamp) for display, including time.\n * Returns '—' for null/empty values.\n */\nexport function formatDateTime(value: string | null | undefined): string {\n if (!value) return '—';\n const dt = new Date(value);\n if (isNaN(dt.getTime())) return value;\n const dateStr = `${dt.getFullYear()}-${String(dt.getMonth() + 1).padStart(2, '0')}-${String(dt.getDate()).padStart(2, '0')}`;\n const time = dt.toLocaleTimeString(undefined, { hour: '2-digit', minute: '2-digit' });\n return `${formatDate(dateStr)}, ${time}`;\n}\n","import { formatDate } from '../utils/date';\n\n/**\n * Date maths the timeline family shares — `MilestoneTimeline` (milestone dots\n * on a bar) and `ProductionTimeline` (the draggable scrubber). One copy, so the\n * two bars agree on what a date string means and how a day is labelled.\n */\n\n/** Milliseconds in a day — axis padding + day-resolution math. */\nexport const DAY_MS = 86400000;\n\n/**\n * Parse an ISO date string to epoch ms, or `null` when absent, unparseable, or\n * implausible. The year guard drops a typo'd date (\"0202-12-20\") that would\n * otherwise become the left edge of the axis and squash every real dot into\n * the last pixel.\n */\nexport function toDayMs(dateStr: string | null | undefined): number | null {\n if (!dateStr) return null;\n const t = new Date(dateStr).getTime();\n if (!Number.isFinite(t)) return null;\n const year = new Date(t).getUTCFullYear();\n if (year < 2000 || year > 2100) return null;\n return t;\n}\n\n/** Format an epoch-ms value as a short date in the user's date format. */\nexport function fmtSliderDate(ms: number): string {\n return formatDate(new Date(ms).toISOString().slice(0, 10));\n}\n","/**\n * The expressive layer — fill variants, reveal masks, glow, and motion.\n *\n * The architecture here is taken from EvilCharts (MIT,\n * github.com/legions-developer/evilcharts), which is the current reference for\n * what a chart on a design system looks like when someone art-directs it. Three\n * ideas were worth borrowing wholesale:\n *\n * 1. **A fill is a named variant backed by a `<pattern>`, not a raw colour.**\n * `gradient` · `gradient-reverse` · `solid` · `dotted` · `lines` ·\n * `hatched` · `duotone` · `striped` · `blocks`. That makes texture a\n * first-class option rather than a hack, which matters beyond looks: a\n * texture is the fallback a colour-vision or forced-colors reader needs\n * when hue alone stops separating two series, and SIX distinguishable\n * textures separate six series with no colour at all. That is the reason\n * to keep adding them past the point where they look like decoration.\n *\n * 2. **The intro reveal is an animated `<mask>`, not a stroke dash.** A dash\n * offset only animates strokes, so the fill and the point markers arrive\n * on their own schedule and the chart assembles in pieces. A mask wipes\n * fill, stroke and dots together, in one gesture, because they are all\n * under it.\n *\n * 3. **`animated-dashed` for a series that is a projection.** A marching dash\n * says \"this part is modelled, not measured\" without a second legend\n * entry.\n *\n * Two places this parts company with the reference, both deliberate:\n *\n * - **EvilCharts drives its reveal per frame (motion.dev) and notes it is\n * heavier than a static chart.** Here the mask is animated by a CSS\n * transform instead — same wipe, no JavaScript in the frame loop, and the\n * compositor does the work.\n * - **EvilCharts defaults its gridlines to dashed.** They stay solid here. A\n * dashed rule reads as a threshold or a projection, and a gridline is\n * neither; `gridStyle=\"dashed\"` is available for a caller who wants the\n * look.\n *\n * Ids are derived from a caller-supplied `useId`, because two charts on one\n * page sharing a gradient or mask id is the classic SVG bug where the second\n * silently repaints the first.\n */\nimport type { ReactNode } from 'react';\n\nimport type {\n ChartBackgroundVariant,\n ChartFillVariant,\n ChartRevealDirection,\n ChartStrokeVariant,\n} from './types';\n\n/*\n * These names are re-exports, not second definitions.\n *\n * They started as a parallel copy of the unions in `types.ts`, which is exactly\n * the shape a drift bug takes: adding `duotone` in one place typechecked\n * everywhere except the one call site that crossed the boundary. One list, two\n * names.\n */\nexport type FillVariant = ChartFillVariant;\nexport type StrokeVariant = ChartStrokeVariant;\nexport type RevealDirection = ChartRevealDirection;\nexport type BackgroundVariant = ChartBackgroundVariant;\n\nexport const fillId = (id: string, index: number) => `${id}-fill-${index}`;\nexport const glowId = (id: string) => `${id}-glow`;\nexport const maskId = (id: string) => `${id}-reveal`;\nexport const groundId = (id: string) => `${id}-ground`;\n\n/** The url() a mark should take for its fill, given the variant. */\nexport function fillFor(id: string, index: number, variant: FillVariant, colour: string): string {\n return variant === 'solid' ? colour : `url(#${fillId(id, index)})`;\n}\n\n/** Dash array for a stroke variant, or undefined for a solid one. */\nexport function dashFor(variant: StrokeVariant): string | undefined {\n return variant === 'solid' ? undefined : '4 3';\n}\n\ninterface FillDefProps {\n id: string;\n index: number;\n colour: string;\n variant: FillVariant;\n /** Top-of-fill alpha. EvilCharts sits near 0.1; a stack wants more. */\n from: number;\n to: number;\n}\n\nfunction FillDef({ id, index, colour, variant, from, to }: FillDefProps): ReactNode {\n const key = fillId(id, index);\n\n // `solid` takes the colour directly (see `fillFor`), so it needs no def at\n // all. Falling through to the hatch default put an unreferenced pattern in\n // the defs of every chart that used it — invisible, and dead markup on every\n // render.\n if (variant === 'solid') return null;\n\n if (variant === 'gradient' || variant === 'gradient-reverse') {\n const reversed = variant === 'gradient-reverse';\n return (\n <linearGradient id={key} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0%\" stopColor={colour} stopOpacity={reversed ? to : from} />\n <stop offset=\"100%\" stopColor={colour} stopOpacity={reversed ? from : to} />\n </linearGradient>\n );\n }\n\n // The textured variants paint their motif over a faint wash of the same hue,\n // so a sparse pattern still reads as belonging to its series.\n const wash = <rect width=\"100%\" height=\"100%\" fill={colour} fillOpacity={from * 0.45} />;\n\n if (variant === 'duotone') {\n // Two bands with a HARD stop, not a fade: the edge is the point. It reads\n // as a filled region with a lighter shoulder, which separates two stacked\n // areas that a smooth gradient would blur into each other.\n return (\n <linearGradient id={key} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0%\" stopColor={colour} stopOpacity={from} />\n <stop offset=\"45%\" stopColor={colour} stopOpacity={from} />\n <stop offset=\"45%\" stopColor={colour} stopOpacity={from * 0.35} />\n <stop offset=\"100%\" stopColor={colour} stopOpacity={from * 0.35} />\n </linearGradient>\n );\n }\n\n if (variant === 'striped') {\n // Wider than `hatched` and at the opposite angle, so the two are\n // distinguishable from each other rather than merely from a flat fill.\n return (\n <pattern id={key} width=\"10\" height=\"10\" patternUnits=\"userSpaceOnUse\" patternTransform=\"rotate(-45)\">\n {wash}\n <rect width=\"5\" height=\"10\" fill={colour} fillOpacity={0.7} />\n </pattern>\n );\n }\n\n if (variant === 'blocks') {\n return (\n <pattern id={key} width=\"10\" height=\"10\" patternUnits=\"userSpaceOnUse\">\n {wash}\n <rect x=\"1\" y=\"1\" width=\"4\" height=\"4\" rx=\"1\" fill={colour} fillOpacity={0.8} />\n <rect x=\"6\" y=\"6\" width=\"4\" height=\"4\" rx=\"1\" fill={colour} fillOpacity={0.8} />\n </pattern>\n );\n }\n\n if (variant === 'dotted') {\n return (\n <pattern id={key} width=\"8\" height=\"8\" patternUnits=\"userSpaceOnUse\">\n {wash}\n <circle cx=\"2\" cy=\"2\" r=\"1.2\" fill={colour} fillOpacity={0.85} />\n </pattern>\n );\n }\n if (variant === 'lines') {\n return (\n <pattern id={key} width=\"6\" height=\"6\" patternUnits=\"userSpaceOnUse\">\n {wash}\n <line x1=\"0\" y1=\"0\" x2=\"0\" y2=\"6\" stroke={colour} strokeWidth=\"1.5\" strokeOpacity={0.8} />\n </pattern>\n );\n }\n // hatched — 45°, the direction the texture rule reserves for value scales.\n return (\n <pattern id={key} width=\"6\" height=\"6\" patternUnits=\"userSpaceOnUse\" patternTransform=\"rotate(45)\">\n {wash}\n <line x1=\"0\" y1=\"0\" x2=\"0\" y2=\"6\" stroke={colour} strokeWidth=\"2\" strokeOpacity={0.75} />\n </pattern>\n );\n}\n\n/**\n * The intro wipe. A plain white rect inside a mask, scaled from nothing to full\n * by CSS — everything under the mask appears as it passes.\n */\nfunction RevealMask({ id, direction }: { id: string; direction: RevealDirection }): ReactNode {\n const className = direction === 'center-out'\n ? 'rosh-viz-wipe-center'\n : direction === 'right-to-left'\n ? 'rosh-viz-wipe-rtl'\n : 'rosh-viz-wipe';\n return (\n <mask id={maskId(id)} maskUnits=\"objectBoundingBox\" maskContentUnits=\"objectBoundingBox\">\n <rect x=\"0\" y=\"0\" width=\"1\" height=\"1\" fill=\"white\" className={className} />\n </mask>\n );\n}\n\nexport interface ChartDefsProps {\n /** Unique per chart instance — pass `useId()`. */\n id: string;\n /** One entry per series needing a fill. */\n fills?: { color: string; variant?: FillVariant }[];\n fadeFrom?: number;\n fadeTo?: number;\n /** Soft outer bloom. Off by default — it is an accent, not a default. */\n glow?: boolean;\n /** Emit the intro wipe mask. */\n reveal?: RevealDirection | false;\n /** The ground behind the plot. */\n background?: BackgroundVariant;\n}\n\nexport function ChartDefs({\n id, fills = [], fadeFrom = 0.3, fadeTo = 0,\n glow = false, reveal = false, background = 'none',\n}: ChartDefsProps): ReactNode {\n return (\n <defs>\n {fills.map((fill, i) => (\n <FillDef\n key={i} id={id} index={i} colour={fill.color}\n variant={fill.variant ?? 'gradient'} from={fadeFrom} to={fadeTo}\n />\n ))}\n {reveal && <RevealMask id={id} direction={reveal} />}\n {glow && (\n <filter id={glowId(id)} x=\"-40%\" y=\"-40%\" width=\"180%\" height=\"180%\">\n <feGaussianBlur stdDeviation=\"3.5\" result=\"blur\" />\n <feMerge>\n <feMergeNode in=\"blur\" />\n <feMergeNode in=\"SourceGraphic\" />\n </feMerge>\n </filter>\n )}\n {background !== 'none' && <GroundPattern id={groundId(id)} variant={background} />}\n </defs>\n );\n}\n\nfunction GroundPattern({ id, variant }: { id: string; variant: BackgroundVariant }): ReactNode {\n // `currentColor` throughout, so the ground follows whatever ink the plot\n // group sets rather than pinning a grey that only works in one theme.\n if (variant === 'dots') {\n return (\n <pattern id={id} width=\"20\" height=\"20\" patternUnits=\"userSpaceOnUse\">\n <circle cx=\"2\" cy=\"2\" r=\"1\" fill=\"currentColor\" />\n </pattern>\n );\n }\n if (variant === 'grid') {\n return (\n <pattern id={id} width=\"20\" height=\"20\" patternUnits=\"userSpaceOnUse\">\n <path d=\"M 20 0 L 0 0 0 20\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"0.5\" />\n </pattern>\n );\n }\n if (variant === 'cross-hatch') {\n return (\n <pattern id={id} width=\"20\" height=\"20\" patternUnits=\"userSpaceOnUse\">\n <path d=\"M 0 0 L 20 20 M 20 0 L 0 20\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"0.5\" />\n </pattern>\n );\n }\n if (variant === 'plus') {\n return (\n <pattern id={id} width=\"16\" height=\"16\" patternUnits=\"userSpaceOnUse\">\n <path d=\"M 8 4 L 8 12 M 4 8 L 12 8\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"0.5\" strokeLinecap=\"round\" />\n </pattern>\n );\n }\n return (\n <pattern id={id} width=\"6\" height=\"6\" patternUnits=\"userSpaceOnUse\" patternTransform=\"rotate(45)\">\n <line x1=\"0\" y1=\"0\" x2=\"0\" y2=\"6\" stroke=\"currentColor\" strokeWidth=\"0.5\" />\n </pattern>\n );\n}\n\n/**\n * Class names for the motion, so a chart never writes an animation itself and\n * therefore cannot forget the reduced-motion rule in `ui.css`.\n */\nexport const MOTION = {\n /** A bar growing from its baseline. Needs `transform-box: fill-box`. */\n rise: 'rosh-viz-rise',\n /** A horizontal bar growing from its label edge. */\n grow: 'rosh-viz-grow',\n /** A wedge arriving from twelve o'clock. */\n sweep: 'rosh-viz-sweep',\n /** A marching dash, for a series that is a projection. */\n march: 'rosh-viz-march',\n /** A fill arriving with the line that bounds it. */\n fade: 'rosh-viz-fade',\n} as const;\n\n/** Stagger successive marks so a chart assembles rather than appearing. */\nexport const stagger = (index: number, step = 60): { animationDelay: string } => ({\n animationDelay: `${index * step}ms`,\n});\n","import type { ReactNode } from 'react';\n\n/**\n * The five shapes that carry meaning on a timeline, plus the flag that opens\n * one.\n *\n * Their own file because two places draw them and they must agree: the dots on\n * the rail, and the legend chips under it. A legend drawn from its own copy of\n * the paths is a legend that can describe a shape the track no longer uses —\n * which is what the chip row did before it was a chip row, with a rotated\n * square standing in for both a shipment and an inspection.\n */\nexport type TimelineGlyphName = 'check' | 'doc' | 'flask' | 'flag' | 'truck' | 'receipt';\n\nconst PATHS: Record<TimelineGlyphName, ReactNode> = {\n /**\n * An invoice — a sheet with a torn foot and one ruled line.\n *\n * Not the `doc` glyph, which is a drawing revision on the mould bar; on an\n * order bar the two would sit side by side and a customer reading \"document\"\n * twice would be told nothing. The zig-zag foot is what says \"receipt\" at 9 px.\n */\n receipt: (\n <>\n <path d=\"M3.4 1.9h5.2v7.2l-1.3-.9-1.3.9-1.3-.9-1.3.9z\" fill=\"none\" stroke=\"currentColor\"\n strokeWidth=\"1.2\" strokeLinejoin=\"round\" />\n <path d=\"M4.9 4.4h2.2M4.9 6.1h2.2\" stroke=\"currentColor\" strokeWidth=\"1.1\" strokeLinecap=\"round\" />\n </>\n ),\n // Completion.\n check: (\n <path d=\"M2.6 6.3 4.9 8.6 9.4 3.6\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.9\"\n strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n ),\n // A drawing revision.\n doc: (\n <>\n <path d=\"M3.5 1.9h3.4l2 2v6.2H3.5z\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.2\" strokeLinejoin=\"round\" />\n <path d=\"M5.1 6.5h2.8M5.1 8.2h2\" stroke=\"currentColor\" strokeWidth=\"1.1\" strokeLinecap=\"round\" />\n </>\n ),\n // A test, a sign-off, a QC inspection.\n flask: (\n <path d=\"M4.6 1.8h2.8M5.4 1.8v3.1L3.3 9.3a.9.9 0 0 0 .8 1.3h3.8a.9.9 0 0 0 .8-1.3L6.6 4.9V1.8\"\n fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.2\" strokeLinejoin=\"round\" />\n ),\n /**\n * Goods moving — a shipment.\n *\n * A box, a cab and two wheels, because the diamond alone was not saying it:\n * every kind on the bar is painted in the one accent now and the GLYPH is what\n * tells them apart, so the shipment was a plain accent lozenge among accent\n * discs. Wheels as filled dots rather than outlined circles — at the 9 px a\n * diamond gives its glyph, a 0.9 px ring closes up into a blob.\n */\n truck: (\n <>\n <path d=\"M1.8 2.9h4.9v4.4H1.8z\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.2\"\n strokeLinejoin=\"round\" />\n <path d=\"M6.7 4.4h1.6l1.5 1.7v1.2H6.7z\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.2\"\n strokeLinejoin=\"round\" />\n <circle cx=\"3.5\" cy=\"8.7\" r=\"1\" fill=\"currentColor\" />\n <circle cx=\"8.4\" cy=\"8.7\" r=\"1\" fill=\"currentColor\" />\n </>\n ),\n // The opening milestone.\n flag: (\n <>\n <path d=\"M3.8 1.7v8.6\" stroke=\"currentColor\" strokeWidth=\"1.3\" strokeLinecap=\"round\" />\n <path d=\"M3.8 2.5h4.8L7.5 4.4l1.1 1.9H3.8z\" fill=\"currentColor\" />\n </>\n ),\n};\n\n/** One glyph, sized by whatever draws it. Always decorative: the thing it sits\n * inside carries the accessible name. */\nexport function TimelineGlyph({ name }: { name: TimelineGlyphName }) {\n return <svg viewBox=\"0 0 12 12\" aria-hidden=\"true\">{PATHS[name]}</svg>;\n}\n\n/** The icon beside a milestone card's title — a flag on a mast. */\nexport function TimelineMilestoneIcon() {\n return (\n <svg viewBox=\"0 0 16 16\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.3\"\n strokeLinecap=\"round\" strokeLinejoin=\"round\">\n <path d=\"M4.2 2.2v11.6\" />\n <path d=\"M4.2 3.1h7.4l-1.6 2.5 1.6 2.6H4.2z\" />\n </svg>\n );\n}\n\n/** The icon beside a production card's title — a rising bar chart. */\nexport function TimelineProgressIcon() {\n return (\n <svg viewBox=\"0 0 16 16\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.3\"\n strokeLinecap=\"round\">\n <path d=\"M2.8 11.6V8.2M6.6 11.6V5.4M10.4 11.6V7M14.2 11.6V3.6\" />\n </svg>\n );\n}\n","/**\n * The geometry the timeline family shares: where a time lands on the track,\n * which labels can sit in which lane, and which runs of dots are one step\n * reported several times.\n *\n * Pure — no React, no DOM, no dates beyond `DAY_MS`. `TimelineTrack` draws what\n * these functions decide, and both timelines draw through `TimelineTrack`, so\n * this file is the one place the two bars can disagree about a coordinate. Each\n * function is exported for its own spec, because asserting geometry through a\n * rendered card asserts the markup instead.\n */\n\n/** Two milestones never sit closer together than this, whatever their dates\n * say. 48 px is about where a 10 px label stops touching its neighbour's date\n * line, which is the width the lanes are trying to place. */\nconst DEFAULT_MIN_GAP_PX = 48;\n\n/** A stretch holding more than this share of the window's TIME is cut out of\n * the axis. A mould whose last milestone was ten months ago is the case: that\n * one idle stretch holds 84% of the programme's time, and on a linear axis it\n * takes 84% of the bar and squeezes every real date into the first sixth. */\nconst DEFAULT_MAX_TIME_SHARE = 0.3;\n\n/** What a cut stretch is worth on the track: a fixed notch, the same width\n * whether it swallowed 282 days or 2,820. A cut is not a short stretch — it is\n * a piece of axis that has stopped keeping time — so scaling it by what it\n * hides would be reading a duration off a mark that is not a duration. */\nconst DEFAULT_BREAK_PX = 48;\n\n/** Slack below this is float noise, not space left to hand out. */\nconst FILL_EPSILON = 1e-6;\n\n// ─── Compressed time axis ────────────────────────────────────────────────────\n\n/** One stretch of axis between two consecutive anchors, with every width that\n * went into its final size — the record the break glyph reads. */\nexport interface AxisGap {\n /** The anchor at the left of the stretch, epoch ms. */\n fromMs: number;\n /** The anchor at the right of the stretch, epoch ms. */\n toMs: number;\n /** How much time the stretch actually holds. */\n gapMs: number;\n /** Where the stretch starts on the track, in px. */\n fromPx: number;\n /** Where it ends, in px. */\n toPx: number;\n /** The width a linear axis would have given it. */\n wantPx: number;\n /** Its width once cut or floored, before the flow was fitted to the track. */\n clampedPx: number;\n /** Its width in the end. */\n px: number;\n /** True when this stretch was CUT: it holds more of the window's time than\n * the axis is willing to spend track on, so it was replaced by a fixed\n * notch. This piece of bar does not keep time, and the user has to be told\n * so — it is what puts a break glyph on the rail and on the ruler. */\n compressed: boolean;\n}\n\n/** A time axis that is piecewise linear rather than linear. */\nexport interface CompressedAxis {\n /** The anchors the axis was built from, sorted and de-duplicated. */\n anchorsMs: number[];\n /** One x per anchor, in the same order. */\n xs: number[];\n /** One entry per consecutive pair of anchors. */\n gaps: AxisGap[];\n /** Map ANY time onto the axis: linear inside a stretch, clamped to the track\n * at both ends. Everything drawn on the bar goes through this, so a dot, its\n * label, the fill and today cannot end up on different axes. */\n xByMs: (ms: number) => number;\n /** The inverse, for the scrubber: the time a pixel on the track stands for.\n * A thumb dragged across a compressed stretch therefore reports the dates\n * that stretch actually holds, rather than a linear reading of a non-linear\n * bar. */\n msByPx: (px: number) => number;\n /** True while `ms` falls strictly inside a stretch the axis cut. Nothing is\n * drawn there — a cut is where time is NOT shown, so a ruler tick or a month\n * label inside one would be labelling a coordinate that has no date. */\n inCut: (ms: number) => boolean;\n}\n\nexport interface CompressTimeAxisOptions {\n /** Narrowest a stretch that still keeps time may be. Default 48 px. */\n minGapPx?: number;\n /** The share of the window's TIME above which a stretch is cut rather than\n * drawn. Default 0.3. `Infinity` never cuts, which is a linear axis. */\n maxTimeShare?: number;\n /** The fixed width a cut stretch is given. Default 48 px. */\n breakPx?: number;\n}\n\n/**\n * Raise the stretches under the floor, and take it back from the ones that can\n * afford it.\n *\n * Two dates a week apart on a 337-day window are 1.8 px apart in proportion,\n * which draws them as one date; the floor is what the label lanes are packing\n * against. It is paid for out of the stretches that are ALREADY above it, in\n * proportion to how far above — a stretch at exactly the floor never funds\n * another one, so a pass can never create a new short stretch and one pass is\n * the whole redistribution.\n *\n * When the floor costs more than the whole track can pay, the layout wins: the\n * final fit scales everything back down, and stretches fall below the floor\n * because there is no arrangement in which they do not.\n */\nfunction applyFloor(px: number[], fixed: boolean[], floor: number): number[] {\n const out = px.slice();\n let need = 0;\n for (let i = 0; i < out.length; i++) {\n if (fixed[i] || out[i] >= floor - FILL_EPSILON) continue;\n need += floor - out[i];\n out[i] = floor;\n }\n if (need <= FILL_EPSILON) return out;\n\n let slack = 0;\n for (let i = 0; i < out.length; i++) {\n if (!fixed[i] && out[i] > floor + FILL_EPSILON) slack += out[i] - floor;\n }\n if (slack <= FILL_EPSILON) return out;\n\n const take = Math.min(need, slack);\n for (let i = 0; i < out.length; i++) {\n if (fixed[i] || out[i] <= floor + FILL_EPSILON) continue;\n out[i] -= (take * (out[i] - floor)) / slack;\n }\n return out;\n}\n\n/**\n * Build a piecewise-linear time axis from the times that matter on it.\n *\n * A linear axis is the honest one right up until the data is lumpy, and a mould\n * programme is lumpy by nature: seven dated milestones inside eight weeks, then\n * nothing for ten months while the customer decides. On `(ms - startMs) / span`\n * those seven share the first sixth of the bar, the lanes fill up, and the two\n * milestones a reader came for collapse to hover-only. The empty tail was the\n * problem, not the labels.\n *\n * So the tail is not squeezed — it is CUT. Any stretch between two consecutive\n * anchors that holds more than `maxTimeShare` of the window's time loses its\n * proportion entirely and becomes a fixed `breakPx` notch carrying a break\n * glyph and the number of days it hides; everything left shares the rest of the\n * track in proportion, at one honest density. A stretch under the threshold is\n * never touched, which is what keeps a fortnight looking like twice a week.\n *\n * The floor is applied after that, for the same reason a ruler has millimetres:\n * two dates a week apart on a year-long window are 1.8 px apart in proportion,\n * and two dates drawn as one date are a lie the compression was supposed to\n * stop telling.\n *\n * Anchors are de-duplicated, which is what makes three milestones on one day\n * one coordinate rather than three that happen to coincide.\n *\n * Pass `maxTimeShare: Infinity` for a plain linear axis: nothing is ever cut,\n * and everything else on the card keeps reading its coordinate off the same\n * mapping. That is what the production scrubber asks for, because a supplier's\n * reports arrive weekly and a week is not an idle stretch to hide.\n */\nexport function compressTimeAxis(\n anchorsMs: number[],\n trackWidthPx: number,\n opts: CompressTimeAxisOptions = {},\n): CompressedAxis {\n const track = Number.isFinite(trackWidthPx) && trackWidthPx > 0 ? trackWidthPx : 0;\n const anchors = Array.from(new Set(anchorsMs.filter((ms) => Number.isFinite(ms)))).sort((a, b) => a - b);\n\n // A point is not a range: with one anchor, or no track to draw on, every time\n // maps to the left edge and no stretch exists to compress.\n if (track <= 0 || anchors.length < 2) {\n const only = anchors[0] ?? 0;\n return {\n anchorsMs: anchors,\n xs: anchors.map(() => 0),\n gaps: [],\n xByMs: () => 0,\n msByPx: () => only,\n inCut: () => false,\n };\n }\n\n const totalMs = anchors[anchors.length - 1] - anchors[0];\n const maxShare = opts.maxTimeShare ?? DEFAULT_MAX_TIME_SHARE;\n const breakPx = Math.min(opts.breakPx ?? DEFAULT_BREAK_PX, track);\n const floor = opts.minGapPx ?? DEFAULT_MIN_GAP_PX;\n\n const gapMs: number[] = [];\n const wantPx: number[] = [];\n const cut: boolean[] = [];\n for (let i = 0; i + 1 < anchors.length; i++) {\n const held = anchors[i + 1] - anchors[i];\n gapMs.push(held);\n wantPx.push(totalMs > 0 ? (held / totalMs) * track : 0);\n cut.push(totalMs > 0 && held / totalMs > maxShare);\n }\n\n // The cuts are paid first, out of the track; what is left is shared by the\n // stretches that still keep time, in proportion to how much they hold.\n const cutCount = cut.filter(Boolean).length;\n const flowPx = Math.max(0, track - cutCount * breakPx);\n let flowMs = 0;\n let flowCount = 0;\n for (let i = 0; i < gapMs.length; i++) {\n if (cut[i]) continue;\n flowMs += gapMs[i];\n flowCount += 1;\n }\n const clampedPx = gapMs.map((held, i) => {\n if (cut[i]) return breakPx;\n if (flowCount === 0) return 0;\n return flowMs > 0 ? (flowPx * held) / flowMs : flowPx / flowCount;\n });\n\n const floored = applyFloor(clampedPx, cut, floor);\n // Fit the stretches that keep time back into what the cuts left them. A\n // no-op unless the floor cost more than the track had — see `applyFloor`.\n const flowTotal = floored.reduce((sum, width, i) => (cut[i] ? sum : sum + width), 0);\n const px = floored.map((width, i) => {\n if (cut[i]) return width;\n return flowTotal > 0 ? (width * flowPx) / flowTotal : width;\n });\n\n const xs = [0];\n for (let i = 0; i < px.length; i++) xs.push(xs[i] + px[i]);\n // A dozen additions of floats leave the last anchor a hair short of the\n // track, and `xByMs(endMs) === trackWidthPx` is a claim callers lean on — the\n // fill bar's full width, the right edge of a phase bracket.\n xs[xs.length - 1] = track;\n\n const gaps: AxisGap[] = xs.slice(0, -1).map((fromPx, i) => ({\n fromMs: anchors[i],\n toMs: anchors[i + 1],\n gapMs: gapMs[i],\n fromPx,\n toPx: xs[i + 1],\n wantPx: wantPx[i],\n clampedPx: clampedPx[i],\n px: xs[i + 1] - fromPx,\n compressed: cut[i],\n }));\n\n const xByMs = (ms: number): number => {\n if (!Number.isFinite(ms) || ms <= anchors[0]) return 0;\n if (ms >= anchors[anchors.length - 1]) return track;\n // A linear scan: an axis has as many anchors as the card has milestones, so\n // a binary search would buy nothing but somewhere for an off-by-one to live.\n for (let i = 0; i + 1 < anchors.length; i++) {\n if (ms > anchors[i + 1]) continue;\n const segMs = anchors[i + 1] - anchors[i];\n const t = segMs > 0 ? (ms - anchors[i]) / segMs : 0;\n return xs[i] + t * (xs[i + 1] - xs[i]);\n }\n return track;\n };\n\n const msByPx = (raw: number): number => {\n const x = Math.min(Math.max(Number.isFinite(raw) ? raw : 0, 0), track);\n for (let i = 0; i + 1 < anchors.length; i++) {\n if (x > xs[i + 1] && i + 2 < anchors.length) continue;\n const segPx = xs[i + 1] - xs[i];\n const t = segPx > 0 ? (x - xs[i]) / segPx : 0;\n return anchors[i] + t * (anchors[i + 1] - anchors[i]);\n }\n return anchors[anchors.length - 1];\n };\n\n const inCut = (ms: number): boolean =>\n gaps.some((gap) => gap.compressed && ms > gap.fromMs && ms < gap.toMs);\n\n return { anchorsMs: anchors, xs, gaps, xByMs, msByPx, inCut };\n}\n\n// ─── Label lane packing ──────────────────────────────────────────────────────\n\n/** One label's geometry, as `packLabelLanes` needs it. */\nexport interface LabelLaneItem {\n /** The milestone's `key` — what the answer is keyed by. */\n key: string;\n /** The milestone's date, as epoch ms. */\n ms: number;\n /** The label's rendered width in pixels: measured, or estimated. */\n widthPx: number;\n /** The centre of the label on the track, in px. Pass it whenever the caller's\n * axis is not linear — the fallback below computes the centre from `ms`\n * against `startMs` / `spanMs`, which is only the right answer on a linear\n * axis, and the milestone card's axis is piecewise. */\n xPx?: number;\n /** Which labels claim a lane first; lower goes first, default 0. Chronological\n * within a tier. With more labels than lanes something has to collapse, and\n * it should not be the milestone the reader opened the card for: the caller\n * says which those are by giving the rest a higher number. */\n priority?: number;\n}\n\n/** Where one label ended up: a lane index, or `-1` when no lane could hold it. */\nexport interface LabelLane {\n key: string;\n lane: number;\n}\n\nexport interface PackLabelLanesOptions {\n /** Clear space demanded between two labels sharing a lane. Default 6 px. */\n gapPx?: number;\n /** How many lanes are available. Default `LABEL_LANE_COUNT`. */\n laneCount?: number;\n}\n\n/**\n * The packer's default lane count.\n *\n * The card asks for `TRACK_LABEL_LANE_COUNT` (2) instead: four lanes resolve an\n * overlap at the cost of ~112 px of card height and an eye that has to zig-zag\n * across four rows to read one week of history, which was the \"crammed\"\n * complaint itself. Clustering (below) collapses the runs that used to need the\n * other two lanes. The default stays 4 because the packer is a general helper\n * and its specs describe four-lane geometry.\n */\nexport const LABEL_LANE_COUNT = 4;\n\n/** The lanes the timeline card itself uses: one above the rail, one below. */\nexport const TRACK_LABEL_LANE_COUNT = 2;\n\n/**\n * Assign each label a lane so no two labels sharing a lane overlap.\n *\n * The arrangement this replaced was `i % 2` — an answer that never looked at how\n * wide a label is or how close two dates are, so eight milestones over 337 days\n * drew four of them on top of each other while every check stayed green.\n *\n * Greedy: a label takes the FIRST lane that has room for it, which means the\n * first lane holding nothing within `gapPx` of where it would sit. Two labels on\n * the same day therefore always land in different lanes. A label that fits\n * nowhere — every lane busy at that point, or a label wider than the whole\n * track — gets `-1`, and the caller reveals it on hover instead of overprinting\n * its neighbour.\n *\n * Lanes are claimed in `priority` order (lower first, default 0), and\n * chronologically inside a tier. That is the whole point of the field: on a\n * timeline with four DFM revisions and two milestones that actually settle\n * something, the four revisions used to claim all four lanes by being earlier,\n * and \"DFM Confirmed\" and \"Mould Complete\" were the two that collapsed. A lane\n * therefore remembers every interval it holds rather than just its rightmost\n * one — with priorities the labels no longer arrive left to right, so \"is there\n * room\" is a question about the whole lane.\n *\n * The answer comes back in the order the items arrived, whatever order that is.\n */\nexport function packLabelLanes(\n items: LabelLaneItem[],\n trackWidthPx: number,\n startMs: number,\n spanMs: number,\n opts: PackLabelLanesOptions = {},\n): LabelLane[] {\n const track = trackWidthPx > 0 ? trackWidthPx : 0;\n const span = spanMs > 0 ? spanMs : 1;\n const gapPx = opts.gapPx ?? 6;\n const laneCount = Math.max(1, opts.laneCount ?? LABEL_LANE_COUNT);\n // Priority first, then chronological, then the caller's order — ties keep the\n // caller's order so the answer never depends on the sort's internals.\n const claimOrder = items\n .map((item, index) => ({ item, index }))\n .sort((a, b) => ((a.item.priority ?? 0) - (b.item.priority ?? 0))\n || (a.item.ms - b.item.ms)\n || (a.index - b.index));\n\n const occupied: { left: number; right: number }[][] =\n Array.from({ length: laneCount }, () => []);\n const assigned = new Map<string, number>();\n\n for (const { item } of claimOrder) {\n const width = Math.max(0, item.widthPx);\n // A label wider than the track it labels has no lane anywhere: placing it\n // would run text off both ends of the bar.\n if (track <= 0 || width > track) {\n assigned.set(item.key, -1);\n continue;\n }\n // `xPx` when the caller has an axis; the linear fallback otherwise.\n const centre = item.xPx ?? ((item.ms - startMs) / span) * track;\n const left = Math.min(Math.max(centre - width / 2, 0), track - width);\n const right = left + width;\n let lane = -1;\n for (let candidate = 0; candidate < laneCount; candidate++) {\n const clear = occupied[candidate]\n .every((held) => left > held.right + gapPx || right + gapPx < held.left);\n if (!clear) continue;\n occupied[candidate].push({ left, right });\n lane = candidate;\n break;\n }\n assigned.set(item.key, lane);\n }\n\n return items.map((item) => ({ key: item.key, lane: assigned.get(item.key) ?? -1 }));\n}\n\n/** Where a label sits once it has a lane: clamped so no label overflows the\n * track it labels. The packer clamps the same way — one formula, so a label is\n * drawn where the lane was reserved for it. */\nexport function clampLabelLeft(centrePx: number, widthPx: number, trackWidthPx: number): number {\n return Math.max(0, Math.min(centrePx - widthPx / 2, Math.max(0, trackWidthPx - widthPx)));\n}\n\n// ─── Clustering ──────────────────────────────────────────────────────────────\n\n/** The narrowest two labels may be pitched before they are treated as colliding,\n * whatever their own widths say. */\nconst DEFAULT_CLUSTER_PITCH_PX = 40;\n\n/** Breathing room added to the wider of two neighbouring labels when deciding\n * whether they collide. */\nconst CLUSTER_PITCH_PAD_PX = 8;\n\n/** One dot as the clusterer sees it: a coordinate, a width, a kind, and whether\n * it is the sort of milestone that may be folded away at all. */\nexport interface ClusterMark {\n key: string;\n /** Its coordinate on the track, in px. Marks arrive in ascending order. */\n x: number;\n /** The width of the label it would otherwise draw. */\n widthPx: number;\n /** Only a run of ONE kind clusters — `DFM ×4` is true of four DFM revisions\n * and a lie about three revisions and a shipment. */\n kind: string;\n /** False for a milestone that settles something (a completion, a shipment, a\n * confirmed drawing). Those never fold: `×N` is for iterations of one step,\n * and the reader opened the card for the step itself. */\n collapsible: boolean;\n}\n\n/** A label position, after clustering: either one mark, or a run of them. */\nexport type ClusterGroup<M extends ClusterMark = ClusterMark> =\n | { type: 'item'; mark: M }\n | { type: 'cluster'; kind: string; members: M[] };\n\nexport interface ClusterMarksOptions {\n /** Minimum pitch two labels are allowed before they count as colliding. */\n minPitchPx?: number;\n}\n\n/**\n * Fold runs of same-kind dots into `×N` groups.\n *\n * A run of three or more consecutive dots of one kind is iterations of ONE step\n * — `DFM v1..v4` is one conversation about one drawing — so it always folds,\n * however much room the axis hands out: four labels saying almost the same word\n * is noise even when they fit. A run of two folds only when the two labels\n * would not clear each other, because `DFM ×2` tells the reader strictly less\n * than `DFM v1` and `DFM v2` do.\n *\n * The member marks stay on the rail at their real coordinates — the pill speaks\n * for them but never moves them, so the axis keeps telling the truth about when\n * things happened (vis-timeline's rule, and the reason a cluster is not a\n * summary row).\n */\nexport function clusterMarks<M extends ClusterMark>(\n marks: M[],\n opts: ClusterMarksOptions = {},\n): ClusterGroup<M>[] {\n const minPitch = opts.minPitchPx ?? DEFAULT_CLUSTER_PITCH_PX;\n const out: ClusterGroup<M>[] = [];\n let i = 0;\n while (i < marks.length) {\n const head = marks[i];\n if (!head.collapsible) {\n out.push({ type: 'item', mark: head });\n i += 1;\n continue;\n }\n let end = i + 1;\n while (end < marks.length && marks[end].collapsible && marks[end].kind === head.kind) end += 1;\n const run = marks.slice(i, end);\n const tight = run.length > 1 && run.every((mark, k) => {\n if (k === 0) return true;\n const previous = run[k - 1];\n const pitch = Math.max(minPitch, Math.max(mark.widthPx, previous.widthPx) + CLUSTER_PITCH_PAD_PX);\n return mark.x - previous.x < pitch;\n });\n if (run.length >= 3 || tight) out.push({ type: 'cluster', kind: head.kind, members: run });\n else for (const mark of run) out.push({ type: 'item', mark });\n i = end;\n }\n return out;\n}\n\n/**\n * The widest a mark is drawn, and therefore the closest two of them may be\n * pitched before one is printed over the other: `.rosh-tl-node.is-key` is 16 px\n * across, and every other role (14 px current, 14 px diamond, 10 px dot) is\n * narrower. Centres nearer than this overlap.\n */\nexport const MARK_OVERLAP_PX = 16;\n\n/** The `kind` a fold of two or more kinds carries. Deliberately not a\n * `TimelineTrackKind`: there is no glyph that is true of a shipment and an\n * inspection at once, so a mixed fold draws a neutral `×N` pill instead. */\nexport const MIXED_KIND = 'mixed';\n\n/**\n * Fold runs of marks whose DOTS would be drawn on top of each other.\n *\n * The other half of `clusterMarks`, and a different collision: that one asks\n * whether two LABELS clear each other and folds only iterations of one kind,\n * because `DFM ×4` is a true sentence about four drawings and a lie about three\n * drawings and a shipment. This one asks whether the two 14–16 px DOTS clear\n * each other, and at that range the kinds no longer matter — \"marks that are too\n * close overlap each other\" (Henry, 2026-09-15, translated, looking at two\n * shipments three days apart on a customer's order). A mark hidden under another\n * mark cannot be hovered, read or counted, whatever it is.\n *\n * So a run of two or more marks closer than `minGapPx` folds, of any kinds, and\n * the fold reports whether its members share one kind — the caller draws that\n * kind's shape and glyph with a `×N` beside it, and a neutral `×N` pill for a\n * mixed run.\n *\n * Decided on the coordinates handed in, which the track takes BEFORE any\n * magnification: a fold that dissolved because the axis opened around it would\n * take with it the mark the pointer used to open it, and re-fold the moment it\n * went. The track keeps the fold's identity and chooses to draw it open, which\n * is the same picture with no feedback in it.\n */\nexport function clusterOverlaps<M extends ClusterMark>(\n marks: M[],\n minGapPx: number = MARK_OVERLAP_PX,\n): ClusterGroup<M>[] {\n const out: ClusterGroup<M>[] = [];\n let i = 0;\n while (i < marks.length) {\n let end = i + 1;\n while (end < marks.length && marks[end].x - marks[end - 1].x < minGapPx) end += 1;\n if (end - i === 1) {\n out.push({ type: 'item', mark: marks[i] });\n } else {\n const members = marks.slice(i, end);\n const kinds = new Set(members.map((mark) => mark.kind));\n out.push({ type: 'cluster', kind: kinds.size === 1 ? members[0].kind : MIXED_KIND, members });\n }\n i = end;\n }\n return out;\n}\n\n/**\n * The name a `×N` pill carries.\n *\n * The trailing revision number comes off the first member's label, because the\n * pill stands for all of them: `DFM v1` + three more is `DFM ×4`, not\n * `DFM v1 ×4`.\n */\nexport function clusterLabel(members: { label: string }[]): string {\n const stem = (members[0]?.label ?? '').replace(/\\s*v?\\d+$/i, '').trim();\n return `${stem || (members[0]?.label ?? '')} ×${members.length}`;\n}\n\n// ─── Label widths ────────────────────────────────────────────────────────────\n\n/**\n * A label's width before the DOM has been asked.\n *\n * 5.6 px per character is about right for the 10 px face these labels use, and\n * the 8 px is the slack two centred lines leave around the longer one. It only\n * has to be close, because the measured width replaces it one layout effect\n * later. It does have to be DETERMINISTIC, so that a server render and a spec\n * asserting on one agree.\n */\nexport function estimateLabelWidth(label: string, dateText: string): number {\n return Math.max(label.length, dateText.length) * 5.6 + 8;\n}\n\n/** Track width assumed before anything has been measured — a server render, or\n * the first paint before the layout effect runs. */\nexport const FALLBACK_TRACK_PX = 600;\n","/**\n * The schedule playback follows: which stretch of rail the thumb is crossing,\n * how long that takes, and where it is partway through.\n *\n * Pure — no React, no DOM, and no clock of its own: a reading of the wall clock\n * is an argument. `TimelineTrack` owns the animation frame and the dwell timer\n * and asks these functions where the thumb goes, which is what lets the timing\n * be specified rather than observed: a spec can assert that a 200 px stretch\n * takes 700 ms, and that five idle seconds end one rest rather than five, with\n * nothing rendered and nothing waited for.\n *\n * The whole file exists because of one distinction. A tween in TIME — walk the\n * date from report to report and let the axis place it — looks right on a linear\n * axis and stalls on a compressed one: an idle stretch cut down to a 48 px notch\n * holds most of the window's DAYS, so a time-paced thumb spends most of its\n * journey inside a notch it crosses in 48 px. So the tween is in PIXELS. The\n * thumb travels the rail at one visual speed throughout, the date under it is\n * read back through the axis's inverse mapping, and a cut therefore does what a\n * cut is for: the thumb crosses it in 48 px of travel and the chip skips the\n * days the axis is not showing.\n */\nimport type { CompressedAxis } from './timelineGeometry';\n\n/**\n * How much time 100 px of rail is worth, in ms.\n *\n * 350 ms per 100 px puts a weekly report about 450 ms from the next one on a\n * 700 px card and the two ends of a year-long programme about 2.4 s apart before\n * the clamps. Slower reads as a progress bar the user is waiting on; faster and\n * the dates under the thumb are unreadable.\n */\nconst MS_PER_100_PX = 350;\n\n/** The floor. Under it a glide is a flicker: two reports a day apart are ~10 px\n * on a 700 px card, and 35 ms of travel is one or two frames. */\nconst MIN_GLIDE_MS = 450;\n\n/** The ceiling. NN/g puts the usable band at 100–400 ms and calls ≥ 500 ms\n * \"cumbersome\"; a scrubber crossing a bar is the one case where longer is the\n * point, but past ~1.4 s a single stretch outlasts the reader's patience for\n * it, and the rest of the programme is still to come. */\nconst MAX_GLIDE_MS = 1400;\n\n/** How long the thumb rests on a report before leaving it. Long enough to read\n * the stage row that just changed, short enough that six reports is about\n * seven seconds end to end. */\nexport const PLAYBACK_DWELL_MS = 700;\n\n/** A stretch shorter than this is not travel: two reports filed on one day sit\n * at one coordinate, and easing across half a pixel for 450 ms is a stall. */\nconst ZERO_TRAVEL_PX = 0.5;\n\n/** One stop playback visits: the mark's key, and when it happened. */\nexport interface PlaybackNode {\n key: string;\n ms: number;\n}\n\n/** One node-to-node leg of a playback, with every number the driver needs. */\nexport interface PlaybackSegment {\n /** The node the thumb leaves. */\n fromKey: string;\n /** The node it arrives at — the key `onArrive` is called with. */\n toKey: string;\n fromMs: number;\n toMs: number;\n /** Where those two sit on the rail, in px. */\n fromPx: number;\n toPx: number;\n /** How far the thumb actually travels. The duration is derived from THIS and\n * not from `toMs - fromMs`, which is the whole point of the file. */\n lengthPx: number;\n /** How long the glide takes. 0 means \"arrive at once\" — a zero-length stretch,\n * or reduced motion, where the thumb still moves but nothing tweens. */\n durationMs: number;\n /** How long to rest on `toKey` after arriving. */\n dwellMs: number;\n /** The axis's inverse mapping, carried so `positionAt` can report the date\n * under a pixel without the caller threading the axis back in. */\n msByPx: (px: number) => number;\n}\n\nexport interface PlaybackScheduleOptions {\n /** Multiplier on every duration AND every dwell — 2 plays twice as fast.\n * Values that are not a positive finite number are read as 1. */\n speed?: number;\n /**\n * `prefers-reduced-motion: reduce`. Every glide becomes 0 ms, so playback is\n * the stepwise walk it has always been: the thumb appears at the next report,\n * dwells, appears at the one after. The dwell is kept, because the dwell is\n * not motion — it is how long the snapshot stays readable.\n */\n reducedMotion?: boolean;\n /** Override the rest at each node. Defaults to `PLAYBACK_DWELL_MS`. */\n dwellMs?: number;\n}\n\nconst clamp = (value: number, low: number, high: number) => Math.min(Math.max(value, low), high);\n\n/**\n * Sine in–out — the CSS `cubic-bezier(0.37, 0, 0.63, 1)`.\n *\n * Ease-in-out because playback is system-triggered rather than user-triggered\n * (Polaris), and SINE rather than the cubic one because a cubic in-out spends\n * its first three frames under a single pixel: on a 450 ms glide that is 50 ms\n * of a thumb that has been told to move and has not. The complaint this whole\n * change answers is a thumb that does not appear to travel, so the curve may not\n * have dead frames at its ends.\n */\nconst easeInOut = (t: number): number => -(Math.cos(Math.PI * t) - 1) / 2;\n\n/**\n * The legs of one playback, left to right.\n *\n * Nodes are sorted by date and de-duplicated by coordinate-carrying key; `n`\n * nodes give `n - 1` segments, so a single node schedules nothing and playback\n * ends the moment it starts — which is the honest answer for a programme with\n * one report in it.\n *\n * `axis` is whatever mapping the track is currently drawing on, including a\n * magnified one: the durations are read off the pixels the reader can see, so a\n * zoomed stretch takes longer to cross precisely because it is wider.\n */\nexport function playbackSegments(\n axis: Pick<CompressedAxis, 'xByMs' | 'msByPx'>,\n nodes: PlaybackNode[],\n opts: PlaybackScheduleOptions = {},\n): PlaybackSegment[] {\n const speed = Number.isFinite(opts.speed) && (opts.speed ?? 0) > 0 ? (opts.speed as number) : 1;\n const dwell = Math.max(0, opts.dwellMs ?? PLAYBACK_DWELL_MS) / speed;\n const ordered = nodes\n .filter((node) => Number.isFinite(node.ms))\n .slice()\n .sort((a, b) => a.ms - b.ms);\n\n const segments: PlaybackSegment[] = [];\n for (let i = 0; i + 1 < ordered.length; i++) {\n const from = ordered[i];\n const to = ordered[i + 1];\n const fromPx = axis.xByMs(from.ms);\n const toPx = axis.xByMs(to.ms);\n const lengthPx = Math.max(0, toPx - fromPx);\n const glide = lengthPx <= ZERO_TRAVEL_PX || opts.reducedMotion\n ? 0\n : clamp((lengthPx * MS_PER_100_PX) / 100, MIN_GLIDE_MS, MAX_GLIDE_MS) / speed;\n segments.push({\n fromKey: from.key,\n toKey: to.key,\n fromMs: from.ms,\n toMs: to.ms,\n fromPx,\n toPx,\n lengthPx,\n durationMs: glide,\n dwellMs: dwell,\n msByPx: axis.msByPx,\n });\n }\n return segments;\n}\n\n/**\n * Where the thumb is `t` of the way through a segment, as a pixel and as a date.\n *\n * `t` is raw progress in [0, 1]; the easing is applied here so that every caller\n * — the driver, a spec, the browser check — is reading the same curve. The two\n * ends are returned exactly rather than through the mapping, because a float\n * rounding at `t = 1` would put the chip on the day before the report it has\n * just arrived at.\n */\nexport function positionAt(segment: PlaybackSegment, t: number): { px: number; ms: number } {\n if (!(t > 0)) return { px: segment.fromPx, ms: segment.fromMs };\n if (t >= 1 || segment.durationMs <= 0) return { px: segment.toPx, ms: segment.toMs };\n const px = segment.fromPx + (segment.toPx - segment.fromPx) * easeInOut(t);\n return { px, ms: segment.msByPx(px) };\n}\n\n/**\n * Where the thumb is between two stops, for a consumer that draws numbers.\n *\n * The kit does not render the table under the timeline, and the table is the\n * reason this exists: while the thumb travels from one report to the next, the\n * quantities beneath it should travel too rather than waiting for the arrival\n * and then jumping. So the fraction the thumb is placed by is handed out, and\n * the consumer interpolates whatever it is showing on the same number.\n */\nexport interface TimelineScrubProgress {\n /** The stop the thumb left. */\n fromKey: string;\n /** The stop it is heading for. */\n toKey: string;\n /** 0 at `fromKey`, 1 at `toKey`. EASED during a glide — the same number that\n * places the disc, so the figures and the disc move together — and linear\n * during a drag, because there is no curve in a hand. */\n t: number;\n /** The date under the thumb, epoch ms, read back through the axis. */\n ms: number;\n}\n\n/**\n * Where playback has got to, and the whole of what a pause has to keep.\n *\n * One leg at a time, and the rest at a node is the leg's OWN rest, taken before\n * it sets off: that is what puts a pause on the report the reader has just\n * arrived at rather than on the one it is heading for, and it means arriving at\n * the last node has nothing left to schedule.\n */\nexport interface PlaybackCursor {\n /** Index into the segment list. */\n index: number;\n /** `'rest'` sits on `segments[index].fromKey`; `'glide'` crosses to its `toKey`. */\n phase: 'rest' | 'glide';\n /** Progress through the glide as of `sinceMs`, 0 to 1. */\n t: number;\n /** What is left of the rest as of `sinceMs`, in ms. */\n restLeftMs: number;\n /**\n * The wall clock the two above were read at, or `null` for \"the next reading\n * is the first\".\n *\n * Null is how a phase declines to be charged for time it was not running:\n * a fresh leg, a leg the dwell timer handed over while the page had no\n * frames, and — the one that matters — a resume, because the clock kept\n * running through the pause and a resumed rest that was charged for it would\n * be no rest at all.\n */\n sinceMs: number | null;\n}\n\n/** Everything one reading of the clock decides. */\nexport interface PlaybackFrame {\n /** The cursor to keep. `null` means playback is over. */\n cursor: PlaybackCursor | null;\n /** Where to put the thumb, or `null` when there was no leg to read. */\n at: { px: number; ms: number } | null;\n /** The stop just reached — at MOST one per reading, however long the gap. */\n arrived: { key: string; ms: number } | null;\n /** The in-flight fraction, or `null` at a stop. */\n progress: TimelineScrubProgress | null;\n}\n\n/**\n * Advance a playback to `nowMs` — the wall clock, not a frame count.\n *\n * The distinction is the whole of this function. Playback used to advance by\n * animation-frame deltas clamped to 100 ms, which spends a 700 ms rest in seven\n * frames: right at 60 fps and wrong everywhere else, because a frame is not a\n * unit of time. An occluded or throttled surface hands out frames at whatever\n * rate it likes — the customer portal, embedded and idle, held the thumb on its\n * first report for EIGHT SECONDS on 2026-09-14 — and a control whose timing is\n * measured in frames stretches with it, without bound. Read against the clock,\n * a rest is 700 ms whether it took forty frames or one.\n *\n * The deltas it does take are unclamped, so their sum between a phase's first\n * reading and this one IS the wall clock between them; re-anchoring on every\n * reading rather than at the leg's start is what lets a pause freeze the thumb\n * where the reader can see it, at the last position painted.\n *\n * At most ONE arrival per reading, which is the other half of the fix. A page\n * that comes back after five idle seconds owes the reader four reports, and\n * announcing all four in the frame it wakes up in announces none of them: the\n * status line would land on the last, having never shown the three before it.\n * One per reading walks the backlog forward at a pace somebody can read.\n */\nexport function advancePlayback(\n segments: PlaybackSegment[],\n cursor: PlaybackCursor,\n nowMs: number,\n): PlaybackFrame {\n const segment = segments[cursor.index];\n if (!segment) return { cursor: null, at: null, arrived: null, progress: null };\n const elapsed = cursor.sinceMs === null ? 0 : Math.max(0, nowMs - cursor.sinceMs);\n\n if (cursor.phase === 'rest') {\n const left = cursor.restLeftMs - elapsed;\n // Still resting. Idempotent: it holds the thumb on the node it is resting\n // at, which is also where a render arriving mid-rest would have put it.\n if (left > 0) {\n return {\n cursor: { ...cursor, restLeftMs: left, sinceMs: nowMs },\n at: positionAt(segment, 0),\n arrived: null,\n progress: null,\n };\n }\n // The rest is over on the clock, however few readings it took. The glide\n // starts HERE and not `left` ms ago: a page that went five seconds without\n // a frame owes the reader a glide, not five seconds of one already spent.\n return {\n cursor: { index: cursor.index, phase: 'glide', t: 0, restLeftMs: 0, sinceMs: nowMs },\n at: positionAt(segment, 0),\n arrived: null,\n progress: null,\n };\n }\n\n const t = segment.durationMs > 0 ? Math.min(1, cursor.t + elapsed / segment.durationMs) : 1;\n const at = positionAt(segment, t);\n if (t < 1) {\n return {\n cursor: { ...cursor, t, sinceMs: nowMs },\n at,\n arrived: null,\n progress: { fromKey: segment.fromKey, toKey: segment.toKey, t: easeInOut(t), ms: at.ms },\n };\n }\n // Arrived. The next leg's rest is charged from this reading, because that is\n // the moment the reader was given something to read.\n const next = segments[cursor.index + 1];\n return {\n cursor: next\n ? { index: cursor.index + 1, phase: 'rest', t: 0, restLeftMs: next.dwellMs, sinceMs: nowMs }\n : null,\n at,\n arrived: { key: segment.toKey, ms: segment.toMs },\n progress: null,\n };\n}\n\n/**\n * The two stops a date falls between, and how far along it is.\n *\n * A drag is the other way the thumb ends up between two reports, and the only\n * continuous thing about a MAGNETIC drag is the pointer: the disc is drawn on\n * the nearest stop the whole way across, so a consumer interpolating its table\n * has to be told where the hand is instead.\n *\n * `null` outside the run of stops. Before the first and after the last there is\n * no pair to be between, and a consumer showing that end stop's own figures is\n * showing the truth.\n */\nexport function progressBetween(nodes: PlaybackNode[], ms: number): TimelineScrubProgress | null {\n if (!Number.isFinite(ms)) return null;\n const ordered = nodes\n .filter((node) => Number.isFinite(node.ms))\n .slice()\n .sort((a, b) => a.ms - b.ms);\n for (let i = 0; i + 1 < ordered.length; i++) {\n const from = ordered[i];\n const to = ordered[i + 1];\n if (ms < from.ms || ms > to.ms) continue;\n const span = to.ms - from.ms;\n return {\n fromKey: from.key,\n toKey: to.key,\n // A pair at one coordinate is an arrival rather than a journey, so the\n // hand is at its far end by definition.\n t: span > 0 ? clamp((ms - from.ms) / span, 0, 1) : 1,\n ms,\n };\n }\n return null;\n}\n","import {\n useCallback, useEffect, useId, useLayoutEffect, useRef, useState,\n type ComponentPropsWithRef, type CSSProperties, type ReactNode, type RefObject,\n} from 'react';\nimport { DAY_MS, fmtSliderDate } from './timelineDates';\nimport { registerModalEscapeInterceptor } from './escapeInterceptors';\nimport { TimelineGlyph, type TimelineGlyphName } from './timelineGlyphs';\nimport { stagger } from '../charts/effects';\nimport { popupBounds } from '../forms/dropdownPosition';\nimport {\n clampLabelLeft, clusterLabel, clusterMarks, clusterOverlaps, compressTimeAxis,\n estimateLabelWidth, packLabelLanes, FALLBACK_TRACK_PX, MARK_OVERLAP_PX, MIXED_KIND,\n TRACK_LABEL_LANE_COUNT,\n type ClusterGroup, type CompressedAxis,\n} from './timelineGeometry';\nimport {\n advancePlayback, playbackSegments, positionAt, progressBetween,\n type PlaybackCursor, type PlaybackNode, type TimelineScrubProgress,\n} from './timelinePlayback';\n\nexport type { TimelineScrubProgress } from './timelinePlayback';\n\n// ─── Public types ────────────────────────────────────────────────────────────\n\n/**\n * Visual category for one mark on the track. Drives SHAPE and glyph, so a reader\n * can tell a shipment from a drawing revision without reading a word — and\n * without a hue doing the telling. Every kind but `completion` paints in the\n * accent; see the mapping block in `ui.css` for why.\n *\n * `MilestoneKind` is this list minus the two only a production bar has, and\n * `TimelineMarkerKind` is the two a marker may be — one union, so a kind added\n * here cannot be missing a style below.\n */\nexport type TimelineTrackKind =\n | 'default' // accent disc, a flag on the one that opened the programme\n | 'dfm' // accent disc with a document — an engineering iteration\n | 'shipment' // accent diamond with a truck — goods moving\n | 'testing' // accent disc with a flask — a test, a sign-off, a mould check\n | 'completion' // success disc with a check — the thing finished\n | 'inspection' // accent disc with a flask — a QC report filed against the order\n | 'invoice' // accent disc with a receipt — an invoice raised against the order\n | 'report' // accent ring — a supplier's production-progress report\n;\n\n/** One dated point on the track. */\nexport interface TimelineTrackItem {\n /** Stable key — React key, the active/current lookup, and the focus roving. */\n key: string;\n /** When it happened, epoch ms. Undated things belong in `pending`. */\n ms: number;\n /** Optional visual category — defaults to `'default'`. */\n kind?: TimelineTrackKind;\n /** Short label: the lane label, the tooltip title, the accessible name. */\n label: string;\n /** The date as the user's format would write it. Defaults to `fmtSliderDate`. */\n date?: string;\n /** Optional second line for the tooltip. */\n detail?: ReactNode;\n /**\n * Which marks matter most, lower first (default 0).\n *\n * It does two jobs, and they are the same judgement: a lane goes to a low\n * number before a high one, and a mark with a number ABOVE zero is an ordinary\n * dot — small, and foldable into a `×N` pill with its same-kind neighbours.\n * One field, so the size of a dot and the lane it gets can never disagree\n * about which milestones the reader opened the card for.\n */\n priority?: number;\n /**\n * Which glyph sits inside the dot. Defaults by kind; `'none'` draws a bare\n * one. The FIRST dated mark of the default kind gets a flag when it asks for\n * nothing else, because that is the milestone that opened the programme.\n */\n glyph?: TimelineGlyphName | 'none';\n /**\n * Rich content for the hover/focus popover — a drawing's version and feedback\n * snippet, a report's stage row, a shipment's goods-issue number. Rendered\n * under the mark's own label and date; without it the popover falls back to\n * label · date · `detail`.\n *\n * The popover has ALREADY drawn the label and the date line above this, so a\n * preview that opens with either of them says it twice. Give it what the two\n * lines do not already say.\n */\n preview?: ReactNode;\n /** Optional click handler — the dot is a button either way, so its tooltip is\n * focusable, but only a handler makes activating it do something. */\n onClick?: () => void;\n /**\n * Opens the DOCUMENT behind the mark, as opposed to selecting it. When set,\n * the mark's drawn label becomes a real button and the popover grows an\n * \"Open\" footer; without it the label is text, because a label that looks\n * like a link and does nothing is worse than one that does not.\n */\n onOpen?: () => void;\n /**\n * The few characters drawn ABOVE the mark on a bare rail (`labels=\"none\"`) —\n * `v3` for a drawing revision. The label itself is in the popover; this is\n * what tells revisions apart at a glance without a label lane to say so.\n * Captions that would overprint each other collapse to `first–last`.\n */\n caption?: string;\n /**\n * The mark stands for something that has NOT happened yet, placed on the\n * best date the record holds — a sample ORDERED on a day, drawn where a\n * shipment will be. Hollow, and left out of the fill: the fill is what was\n * reached, and a provisional mark is a promise rather than a fact.\n */\n provisional?: boolean;\n}\n\n/** Visual classification for a `TimelineMarker`. */\nexport type TimelineMarkerKind = 'shipment' | 'inspection' | 'invoice';\n\n/**\n * A non-progress event drawn on the track for context — a goods issue, a QC\n * report. Markers are decorative in the domain sense: they never move a\n * scrubber's displayed snapshot, and they never fold into a cluster.\n */\nexport interface TimelineMarker {\n id: string;\n /** ISO date or full ISO datetime — the date the event happened on. */\n date: string;\n kind: TimelineMarkerKind;\n /** Short label shown in the tooltip (e.g. \"GR#10001\"). */\n label: string;\n /** Which glyph sits inside the dot, overriding the one its `kind` draws. For a\n * consumer whose two shipments are not the same event — a container leaving\n * the factory and a courier bag of samples. */\n glyph?: TimelineGlyphName;\n /** Optional second line for the tooltip. */\n detail?: string;\n /** Rich content for the hover/focus popover — see `TimelineTrackItem`. The\n * label and the date line are already drawn above it; do not repeat them. */\n preview?: ReactNode;\n /** Optional click handler — when set, the dot calls this with the marker. */\n onClick?: (m: TimelineMarker) => void;\n /** Opens the document behind the marker — a goods issue, a QC report. */\n onOpen?: (m: TimelineMarker) => void;\n}\n\n/** An undated thing: listed beside the track, never placed on it. */\nexport interface TimelineTrackPending {\n key: string;\n label: string;\n kind?: TimelineTrackKind;\n}\n\n/**\n * The mark a bare rail draws ON its right edge — an estimated completion, a\n * contractual delivery date: a day the axis already runs to, that has not\n * happened. Hollow and dashed like the cap, but on the axis rather than past\n * it, because the window's right edge IS that date. Its popover carries the\n * label and `dateText`, so the date is a hover away and not printed on the bar.\n */\nexport interface TimelineTrackEndMark {\n key: string;\n label: string;\n /** What the popover prints under the label — the date, in the user's format. */\n dateText?: string;\n detail?: ReactNode;\n}\n\n/** A stretch of parallel work, bracketed under the rail. */\nexport interface TimelineTrackPhase {\n key: string;\n label: string;\n minMs: number;\n maxMs: number;\n}\n\n/** The draggable thumb, controlled by the caller. */\nexport interface TimelineTrackThumb {\n valueMs: number;\n onChange: (ms: number) => void;\n onDragStart?: () => void;\n onDragEnd?: () => void;\n /** The chip above the thumb. Defaults to the date in the user's format. */\n chip?: (ms: number) => ReactNode;\n /**\n * The only values the thumb may rest on, epoch ms, in any order.\n *\n * With stops the slider is DISCRETE: a drag follows the pointer but the thumb\n * snaps to the nearest stop as it goes, a release settles on one, and the\n * arrow keys step between them. That is the difference between a bar you can\n * read and a bar you can interpolate — a production scrubber has facts on\n * certain days and nothing at all between them, so a thumb resting on the\n * 11th of the month would be claiming a snapshot nobody filed.\n *\n * Without it the thumb is continuous and the arrows move by the day.\n */\n stops?: number[];\n /** What a screen reader should read for a value — \"PP#10143 · 13/05/2026\".\n * Defaults to the date alone. */\n valueText?: (ms: number) => string;\n /** Names the slider. Defaults to \"Scrub the timeline\". */\n ariaLabel?: string;\n}\n\n/**\n * Playback: the thumb travelling the rail on its own, stop to stop.\n *\n * The caller owns the button and the `playing` flag; the track owns the travel,\n * because the travel is measured in pixels of ITS axis and the caller has never\n * been told how wide the track is. Flip `playing` on and the thumb glides from\n * the stop it is on to the next one, rests there, and goes on; flip it off\n * mid-glide and it freezes where it is, with the same flag turning it back on\n * from exactly there.\n *\n * `onArrive` is deliberately NOT `onActivate`. Activating a mark is what a click\n * means, and in both portals that navigates — the admin window swaps itself to\n * the report you clicked. A playback that activated each stop in turn would\n * therefore walk the user through six windows and, by remounting the card,\n * cancel itself on the first one. Arriving is a quieter event: move the value,\n * swap the snapshot, leave the window alone.\n */\nexport interface TimelineTrackPlayback {\n /** True while the thumb should be travelling. */\n playing: boolean;\n /**\n * The thumb has reached a stop. Fired once per stop, in axis order, at the\n * moment of arrival and never mid-glide — which is what keeps the consumer's\n * status line (\"Showing PP#…\") an account of where the thumb IS rather than a\n * counter that ticks while it moves.\n *\n * The caller is expected to move `thumb.valueMs` to `ms`: that is what the\n * next segment is measured from.\n */\n onArrive: (key: string, ms: number) => void;\n /**\n * Where the thumb is BETWEEN two stops, on every frame it is travelling, and\n * `null` the moment it is not — on arrival, on a pause, on a cancel, at the\n * end of the run, and on the release of a drag.\n *\n * `onArrive` is the event; this is the journey, and a consumer needs both for\n * a different reason. The kit does not render the table under the timeline,\n * and the table is why this exists: while the thumb travels from one report\n * to the next, the quantities beneath it should travel too rather than\n * waiting for the arrival and jumping. `t` is the EASED fraction — the same\n * number that places the disc — so figures interpolated on it move with the\n * disc and not against it.\n *\n * A drag reports the same shape with the pointer's LINEAR fraction between\n * its two neighbouring stops: the disc snaps to the nearest one as it goes, so\n * the hand is the only continuous thing there is to report. Under\n * `prefers-reduced-motion` a playback has no travel to report, so the only\n * value it ever passes is `null`.\n */\n onProgress?: (state: TimelineScrubProgress | null) => void;\n /** Playback is over — the last stop was reached, or a drag, a click or a key\n * took the thumb back. The caller is expected to set `playing` false; the\n * next `playing` turns into a fresh run rather than a resume. */\n onStop?: () => void;\n /** Multiplier on the glide and the dwell alike. Defaults to 1, which is the\n * timing `timelinePlayback.ts` specifies. */\n speed?: number;\n}\n\nexport interface TimelineTrackProps {\n /** Left edge of the window, epoch ms. */\n startMs: number;\n /** Right edge of the window, epoch ms. */\n endMs: number;\n /**\n * `'compressed'` CUTS any stretch holding more than 30% of the window's time\n * down to a fixed notch with a break glyph saying how many days it hides, and\n * shares the rest of the track proportionally among what is left;\n * `'linear'` (the default) keeps time proportional throughout. A bar whose\n * events arrive weekly wants linear — a week is not an idle stretch to hide.\n * `'spread'` cuts nothing: every stretch between two dated marks is held to\n * at least 48 px and the idle stretches pay for it in proportion, so a\n * fortnight of revisions is readable and a ten-month wait is still drawn as\n * the longest thing on the bar — just not as 84% of it. No break glyph,\n * because no piece of the bar has stopped keeping time.\n */\n axis?: 'linear' | 'compressed' | 'spread';\n /** The dated marks, in any order. */\n items: TimelineTrackItem[];\n /** Context events, drawn on the rail beside the items. */\n markers?: TimelineMarker[];\n /** Undated things, listed at the right edge (or under a vertical track). */\n pending?: TimelineTrackPending[];\n /** A bare rail's mark on its own right edge — see `TimelineTrackEndMark`.\n * Drawn only with `labels=\"none\"`; the card variants say it in the meta. */\n endMark?: TimelineTrackEndMark | null;\n /** Where the filled part of the rail stops. Defaults to the last item, never\n * past today; `null` draws no fill. With a thumb it follows the thumb. */\n fillToMs?: number | null;\n /** \"Now\". Defaults to `Date.now()`, captured once so render stays idempotent. */\n todayMs?: number;\n /**\n * `'lanes'` packs every label into two rows and folds same-kind runs into\n * `×N` pills; `'active'` draws ONE label — the active or hovered mark — which\n * is what a scrubber wants, because the thumb already says where you are.\n * `'none'` draws no label at all: the bare rail, where every mark is a dot\n * with a popover, a mark's `caption` is the only text near it, the edge\n * captions flank the rail on its own row rather than sitting inside the\n * stage, and the undated things are one dashed cap at the end of a dashed\n * tail instead of a column beside the bar.\n */\n labels?: 'lanes' | 'active' | 'none';\n /**\n * The marks to light up, by key. The rail draws one soft band from the\n * leftmost named mark to the rightmost and lights every mark inside it — a\n * single key is a ring around one dot. For a consumer whose stepper above\n * the bar wants to say \"this step is THESE dates\" on hover. `null` lights\n * nothing. A key the bar has no mark for is ignored, except the cap: a bare\n * rail's dashed cap carries the last pending item's key.\n */\n highlightKeys?: string[] | null;\n /**\n * The mark under the pointer or the focus, by key, and `null` when there is\n * none — the other direction of `highlightKeys`, so a consumer can light the\n * step a mark belongs to. A fold reports its first member.\n */\n onHoverChange?: (key: string | null) => void;\n /** The mark the caller considers selected. Gets the hot treatment and, in\n * `'active'` mode, the one label that is drawn. */\n activeKey?: string | null;\n /** Called when a dot is activated by click, Enter or Space. */\n onActivate?: (key: string) => void;\n /** Turns the track into a scrubber. */\n thumb?: TimelineTrackThumb;\n /** Drives the thumb along the rail by itself. Needs a `thumb`; without one\n * there is nothing to move. */\n playback?: TimelineTrackPlayback;\n /**\n * The captions on the two ends of the axis.\n *\n * `start` names the START ANCHOR — the ring the track draws at `startMs`\n * whether or not anything happened on that day — and defaults to\n * `Start · <date>` in the reader's own date format. It is what makes \"the\n * timeline starts at zero, not at the first production report\" (Henry,\n * 2026-09-14) something the reader can SEE: before it, a bar whose first\n * report landed two days after the production start date opened with the\n * report sitting on the rail's left end, and nothing said the axis had begun\n * earlier.\n *\n * `end` is optional and has no default: the right edge is either today, which\n * has its own tag, or a completion, which has its own mark.\n */\n edgeCaptions?: { start?: ReactNode; end?: ReactNode };\n /** Parallel-work brackets under the rail. */\n phases?: TimelineTrackPhase[];\n /** The one mark that is \"where we are\": `aria-current=\"step\"`, the larger\n * accent disc, and the pulse. Defaults to the last dated item. */\n currentKey?: string;\n /**\n * Magnify one stretch of the axis, the way hovering a `×N` pill does.\n *\n * The marks inside the range spread until each pair is at least 28 px apart —\n * far enough for them to carry their own labels — and the rest of the axis\n * gives up the room in proportion. `null` (the default) is the whole bar at\n * one density. It exists so a consumer can offer \"zoom to the DFM phase\" as\n * an action rather than as something only a pointer can reach.\n */\n zoomRange?: [number, number] | null;\n /** Play the mount reveal. Default true; reduced motion is handled in CSS. */\n motion?: boolean;\n /** Names the ordered list of dated marks. Required — a list of dots with no\n * name is a list of nothing. */\n ariaLabel: string;\n}\n\n// ─── Geometry ────────────────────────────────────────────────────────────────\n\n/** The rail's own height. 6 px, as the approved prototype draws it: at 8 the\n * rail competes with the 10 px dots standing on it, and the bar reads as the\n * subject of the card rather than as the line the events are placed on. Every\n * other offset is derived from it, so this is the only number to change. */\nconst RAIL_PX = 6;\n\n/** Every vertical offset inside the stage, per label strategy. One object rather\n * than a stack of flex rows: a label in a lane, its leader hairline, the ruler\n * tick under it and the today line crossing all three have to agree on where\n * each band starts, and a flex column can only place them in order. */\ninterface TrackGeometry {\n /** The row above everything: the \"Today\" tag, or the thumb's date chip. */\n tag: number;\n /** Top of the lane above the rail. */\n laneA: number;\n /** How tall one lane row is. */\n laneH: number;\n /** Top of the rail. */\n rail: number;\n /** Top of the ruler band. */\n ruler: number;\n /** Top of the lane below the ruler. */\n laneB: number;\n /** The stage's height with both lanes in use. */\n height: number;\n}\n\nconst GEOMETRY: Record<'lanes' | 'active' | 'none', TrackGeometry> = {\n lanes: { tag: 0, laneA: 17, laneH: 30, rail: 52, ruler: 64, laneB: 86, height: 120 },\n active: { tag: 0, laneA: 17, laneH: 30, rail: 38, ruler: 50, laneB: 74, height: 108 },\n // The bare rail has one band above the rail — the captions — and the ruler\n // under it. `laneB` is the ruler's own row: nothing is drawn there.\n none: { tag: 0, laneA: 16, laneH: 14, rail: 34, ruler: 46, laneB: 46, height: 72 },\n};\n\n/** The dashed tail a bare rail draws past its axis to the cap that stands for\n * what has not happened yet. Fixed, like a cut: it is not a stretch of time. */\nconst CAP_TAIL_PX = 36;\n\n/** Clear space between two captions before they are read as one run. */\nconst CAPTION_GAP_PX = 6;\n\n/** How far a highlight band reaches past the marks it lights. */\nconst BAND_REACH_PX = 10;\n\n/** Room under the ruler for a phase bracket and its caption. */\nconst PHASE_BAND_PX = 22;\n\n/** Below this the axis is abandoned rather than squeezed: one row per mark, the\n * connector carrying the fill. Ant Design's `Steps` switches at 532 px of\n * viewport; this is the CONTAINER, because the card lives inside resizable\n * shell windows where the viewport says nothing about it. */\nconst VERTICAL_BELOW_PX = 320;\n\n/** The stage's side inset, so a dot on the first or last day is not clipped —\n * `ui.css` sets the padding, and the threshold below has to know about it. */\nconst EDGE_INSET_PX = 10;\n\n/** The pending column and the gap beside it, as `ui.css` sizes them.\n *\n * The variant decision is taken against the CARD's width minus that column,\n * rather than against the track element itself, because the track only exists\n * in one of the two variants: a card measured through it goes vertical once\n * and can never come back, since there is then nothing left to observe. */\nconst PENDING_COLUMN_PX = 156;\nconst BODY_GAP_PX = 20;\n\n/** The least room a hover bubble keeps from the edge of the window it is in. */\nconst BUBBLE_WINDOW_GAP_PX = 8;\n\n/** Two rows of pending, then a real button for the rest. A `title` is invisible\n * on touch, so it cannot be the only way to read what was folded. */\nconst PENDING_ROW_LIMIT = 2;\n\n/** A week tick is drawn only where the weeks stand this far apart. */\nconst WEEK_TICK_MIN_PX = 14;\n\n/**\n * The start anchor's footprint. A dated mark landing inside it is ON the start\n * day as far as the eye is concerned, and the ring opens out to encircle it\n * rather than sitting under it — neither hides the other, and neither moves,\n * because moving one would put it on a date it does not have.\n */\nconst START_MARK_PX = 14;\n\n/** The start/end caption's own height, so it can be hung off the rail rather\n * than off a lane: the two label strategies put their lanes in different\n * places, and the caption's relationship to the rail is the same in both. */\nconst START_CAPTION_PX = 13;\n\n/** What the start caption is assumed to be worth in lane-packing width when a\n * consumer passed something richer than a string. Wide enough for the default\n * `Start · 20/01/2026`, which is the only caption the kit itself writes. */\nconst START_CAPTION_FALLBACK_PX = 96;\n\n/** The lane the start caption reserves, under a key no mark can collide with —\n * a consumer's `TimelineTrackItem.key` is its own, and this one is not. */\nconst START_LANE_KEY = '__rosh-tl-start__';\n\n/** A month is LABELLED only when it clears this much from the last label, so the\n * same code serves a 73-day order and a 337-day mould. */\nconst MONTH_LABEL_PITCH_PX = 72;\n\n/** Per character, for the 10 px mono face the ruler and the date lines use. Only\n * ever used to decide whether two pieces of ruler text would collide. */\nconst MONO_CHAR_PX = 5.6;\n\n/** How long a mark stays lit after the thumb has crossed it. */\nconst SNAP_FLASH_MS = 460;\n\n/** How long a bubble survives the pointer leaving its dot. WCAG 1.4.13 asks for\n * hoverable content, and the bubble sits a few pixels below the dot: without\n * the grace the pointer dismisses it on the way. */\nconst BUBBLE_GRACE_MS = 160;\n\n/** How long an opened fold survives a pointer that is on nothing. Longer than\n * the bubble's grace, because the pointer has to cross whatever gap the\n * magnification just opened between the fold and its first member. */\nconst FOLD_GRACE_MS = 260;\n\n/** How far past its outermost member an opened fold still counts as being under\n * the pointer. A mark's own half-width, and a little: the run springs apart\n * around the pointer, and a reader looking at what it opened has not left it. */\nconst FOLD_REACH_PX = 16;\n\n/** Does the machine ask for stillness? Read once per card, as `Modal` reads it —\n * a media query consulted during render would make render impure, and a user who\n * changes the setting is one window open away from the new answer. */\nfunction prefersReducedMotion(): boolean {\n try {\n return typeof window !== 'undefined' && typeof window.matchMedia === 'function'\n && window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n } catch {\n // A jsdom without media queries, or a browser that refused the query: the\n // answer that keeps the motion is the one the stylesheet would also give.\n return false;\n }\n}\n\nconst MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];\n\nconst monoWidth = (text: string) => text.length * MONO_CHAR_PX;\n\n// ─── Kind styles ─────────────────────────────────────────────────────────────\n\ntype NodeRole = 'dot' | 'key' | 'current';\n\ninterface KindStyle {\n /** `true` when the mark is drawn as a rotated square. */\n diamond?: boolean;\n /** Which glyph sits inside a filled node, unless the item names another. */\n glyph?: TimelineGlyphName;\n /**\n * The kind's colour, as a token reference — declared once in `ui.css`, the\n * same in both themes. `undefined` means \"the accent\", which `nodeDressing`\n * spells `var(--tl-accent)` — and every `--tl-*` kind token IS that accent\n * now, so a kind mark and an accent mark are one colour and the GLYPH is what\n * tells them apart.\n */\n token?: string;\n}\n\nconst KIND_STYLES: Record<TimelineTrackKind, KindStyle> = {\n // No glyph by default: a flag belongs on the milestone that OPENED the\n // programme, not on every milestone whose kind nobody set.\n default: {},\n dfm: { glyph: 'doc', token: 'var(--tl-dfm)' },\n // A truck inside the diamond. The shape alone was not enough once every kind\n // was painted in the one accent: \"the shipment does not show\" (Henry,\n // 2026-09-15, translated) — an accent lozenge among accent discs, with no\n // glyph and, on a scrubber, no caption unless the pointer was on it.\n shipment: { diamond: true, glyph: 'truck', token: 'var(--tl-shipment)' },\n testing: { glyph: 'flask', token: 'var(--tl-testing)' },\n completion: { glyph: 'check', token: 'var(--tl-completion)' },\n // A disc with a flask, not a diamond: a diamond is goods moving, and a bar\n // that draws an inspection as one has two meanings for a shape.\n inspection: { glyph: 'flask', token: 'var(--tl-inspection)' },\n // A disc with a receipt: money asked for, on the day it was asked.\n invoice: { glyph: 'receipt', token: 'var(--tl-invoice)' },\n report: {},\n};\n\n/**\n * The kind a glyph implies, for a mark whose kind says nothing.\n *\n * The milestone spec and the reader's eye do not line up everywhere: \"DFM\n * Confirmed\" is a `default` milestone in the spec and a signed drawing on the\n * card, so a caller naming `glyph: 'doc'` gets the filled document disc that\n * goes with it rather than a bare accent disc. Only `default` borrows — a kind\n * that was stated is never overridden.\n */\nconst GLYPH_KIND: Partial<Record<TimelineGlyphName, TimelineTrackKind>> = {\n doc: 'dfm',\n flask: 'testing',\n check: 'completion',\n truck: 'shipment',\n receipt: 'invoice',\n};\n\n/** The kind a mark is drawn in, after a named glyph has had its say. */\nfunction resolveKind(item: TimelineTrackItem): TimelineTrackKind {\n const kind = item.kind ?? 'default';\n if (kind !== 'default' || !item.glyph || item.glyph === 'none') return kind;\n return GLYPH_KIND[item.glyph] ?? kind;\n}\n\n/** The glyph a mark wears: its own, else its kind's, else a flag if it is the\n * first thing that happened. */\nfunction resolveGlyph(\n item: TimelineTrackItem,\n kind: TimelineTrackKind,\n opensProgramme: boolean,\n): TimelineGlyphName | undefined {\n if (item.glyph === 'none') return undefined;\n if (item.glyph) return item.glyph;\n return KIND_STYLES[kind].glyph ?? (opensProgramme ? 'flag' : undefined);\n}\n\n/**\n * The classes and the inline colour one node wears.\n *\n * Every mark takes its colour from a `--tl-*` token as an INLINE style, and\n * none of them from a `bg-blue-*` / `border-blue-*` utility. That is not a\n * preference — the utility route silently did not work here. `.rosh-tl-node`\n * declares `background: none` and `border: 0` of its own, and `ui.css` is\n * UNLAYERED while Tailwind's utilities live in `@layer utilities`: an unlayered\n * declaration beats a layered one whatever the specificity, so the base rule\n * won and the accent class lost. The current mark rendered as a transparent\n * disc and a default dot as a BLACK ring — except under a custom accent, where\n * `themes.css` remaps the same classes with `!important` and they suddenly\n * appeared. An inline style outranks all of it, in every consumer, whatever\n * their layer order.\n *\n * The kind tokens and the accent are the same value now (see the `--tl-*` block\n * in `ui.css`), so this is one colour reached one way.\n */\nfunction nodeDressing(\n kind: TimelineTrackKind,\n role: NodeRole,\n provisional = false,\n): { className: string; style: CSSProperties } {\n const style = KIND_STYLES[kind];\n const classes = ['rosh-tl-node', 'rosh-tl-mark', `is-${role}`];\n if (style.diamond) classes.push('is-diamond');\n if (provisional) classes.push('is-provisional');\n // The current mark is the accent's, whatever its kind: it is not \"a\n // shipment\", it is where you are. A kind that names no token is the accent\n // too, which is what makes the glyph the only thing telling the kinds apart.\n const colour = role === 'current' ? 'var(--tl-accent)' : style.token ?? 'var(--tl-accent)';\n // A provisional mark is the kind's shape and glyph drawn HOLLOW: the outline\n // says what it will be, the empty middle says it is not that yet.\n const css: CSSProperties = role === 'dot' || provisional\n ? { borderColor: colour, color: colour }\n : { backgroundColor: colour, color: 'var(--tl-on-kind)' };\n return { className: classes.join(' '), style: css };\n}\n\n// ─── Internal mark shape ─────────────────────────────────────────────────────\n\n/** One thing drawn on the rail, with everything the layout needs resolved. */\ninterface Mark {\n key: string;\n ms: number;\n /** Where it is drawn — magnified when a stretch is zoomed. */\n x: number;\n /** Where it would be with nothing magnified. The pill and the clustering read\n * this one: a pill that moved when the axis opened around it would slide out\n * from under the pointer that opened it, close, and open again. */\n baseX: number;\n kind: TimelineTrackKind;\n label: string;\n dateText: string;\n detail?: ReactNode;\n /** Rich popover content, when the caller supplied any. */\n preview?: ReactNode;\n /** Which glyph sits inside the node, once kind and item have both had a say. */\n glyph?: TimelineGlyphName;\n role: NodeRole;\n /** The width of the label it would draw, measured or estimated. */\n widthPx: number;\n /** Ordinary dots fold into `×N` pills; the marks that settle something never\n * do, and neither does a context marker. */\n collapsible: boolean;\n onClick?: () => void;\n /** Opens the document behind the mark, when the caller wired one up. */\n onOpen?: () => void;\n /** False for a context marker — on the rail, but not part of the programme. */\n isItem: boolean;\n /** The short text a bare rail draws above the mark. */\n caption?: string;\n /** Hollow, and outside the fill: placed on the best date the record holds\n * for something that has not happened. */\n provisional: boolean;\n /** The bare rail's cap: the one node past the axis that stands for every\n * undated thing. Never moved by a zoom, never part of the fill. */\n isCap: boolean;\n}\n\n/**\n * One thing the rail actually draws: a mark, or a FOLD standing for a run of\n * marks too close together to be drawn apart.\n *\n * A fold is the answer to \"marks that are too close overlap each other\" (Henry,\n * 2026-09-15, translated): under one mark's width a dot is printed over its\n * neighbour, and a mark nobody can see is a mark nobody can hover, read or\n * count. One node stands in for the run, says how many, and opens the axis\n * around itself when the pointer arrives — at which point the run is drawn as\n * itself again, every member back on its own date with its own popover.\n *\n * `members` is the whole run; `mark` is the one mark a single node draws and\n * `null` for a fold, which is the discriminator.\n */\ninterface RailNode {\n key: string;\n mark: Mark | null;\n members: Mark[];\n /** Where it is drawn: the mark's own x, or the run's midpoint. */\n x: number;\n /** The one kind the run shares, or `MIXED_KIND` where it shares none. */\n kind: string;\n /**\n * Can this fold be opened at all? A run over two or three DATES springs apart\n * when the axis magnifies around it; a run that is all one date is one\n * coordinate, and no magnification will ever separate a coordinate from\n * itself. Those two want opposite things from a pointer — the first should\n * open, the second has nothing to open and must say what it stands for in a\n * popover instead.\n */\n openable: boolean;\n}\n\n/** Every `data-*` a part of the track carries, so a spec or a browser check can\n * name a part without keying on a class the design may restyle. */\ntype NodeButtonProps = ComponentPropsWithRef<'button'> & { [key: `data-${string}`]: string | undefined };\n\nconst detailText = (detail: ReactNode): string => (typeof detail === 'string' ? detail : '');\n\nfunction accessibleName(mark: Mark): string {\n const detail = detailText(mark.detail);\n return `${mark.label} · ${mark.dateText}${detail ? ` · ${detail}` : ''}`;\n}\n\n/**\n * What a fold is called, to a screen reader and in its own popover.\n *\n * Every member by name, because a fold is the one mark on the rail that stands\n * for things which are not drawn: leaving them to the hover would make them\n * reachable by pointer alone, and the list is the whole point of folding.\n */\nfunction foldName(members: Mark[]): string {\n return `${members.length} events · ${members.map(accessibleName).join(', ')}`;\n}\n\n/** The dates a fold covers — one date where the run shares a day, the two ends\n * where it does not. */\nfunction foldDates(members: Mark[]): string {\n const first = members[0].dateText;\n const last = members[members.length - 1].dateText;\n return first === last ? first : `${first} – ${last}`;\n}\n\n// ─── Hooks ───────────────────────────────────────────────────────────────────\n\n/**\n * `useLayoutEffect` on the client, `useEffect` where there is no DOM.\n *\n * The measuring pass has to land before paint or the labels visibly reshuffle\n * from the estimate to the measurement. React's server renderer warns about\n * `useLayoutEffect` on EVERY render though, and this component is meant to\n * render to static markup — so pick the hook once, at module scope, where the\n * choice is constant and the hook order comes out identical either way.\n */\nconst useMeasureEffect = typeof document === 'undefined' ? useEffect : useLayoutEffect;\n\n/** Sub-pixel-tolerant compare, so a re-measure that found the same layout does\n * not set state and re-render for ever. */\nfunction sameWidths(a: Record<string, number>, b: Record<string, number>): boolean {\n const keys = Object.keys(a);\n if (keys.length !== Object.keys(b).length) return false;\n return keys.every((k) => Math.abs((a[k] ?? 0) - (b[k] ?? 0)) < 0.5);\n}\n\n/**\n * An element's width, watched: the same eight milestones fit one lane in a\n * maximised window and two in a side-by-side pane.\n *\n * `enabled` is how the observer follows an element that comes and goes — the\n * track layer exists only in the horizontal variant, and an effect keyed on the\n * ref alone never re-attaches when it is rendered again.\n *\n * A reading of zero is discarded rather than stored. A detaching element\n * measures 0 and a ResizeObserver reports that last size on the way out, so\n * \"the element went away\" and \"the element is 0 px wide\" arrive as the same\n * number — and taking it would collapse the axis at the moment the card\n * switched variants.\n */\nfunction useObservedWidth(ref: RefObject<HTMLElement>, enabled: boolean): number {\n const [width, setWidth] = useState(0);\n useMeasureEffect(() => {\n const el = enabled ? ref.current : null;\n if (!el) return;\n const read = () => {\n const next = el.getBoundingClientRect().width;\n if (next > 0) setWidth(next);\n };\n read();\n // Guarded: this package renders under jsdom and under the server renderer,\n // and neither is required to have a ResizeObserver.\n if (typeof ResizeObserver === 'undefined') return;\n const observer = new ResizeObserver(read);\n observer.observe(el);\n return () => { observer.disconnect(); };\n }, [ref, enabled]);\n return width;\n}\n\n/** The floor on how far apart a magnified stretch holds its marks. The real\n * target is the room two labels need side by side; this is what a pair with no\n * labels to speak of still gets. */\nconst ZOOM_MIN_PITCH_PX = 28;\n\n/** Clear space between two magnified labels, once each has its own width. */\nconst ZOOM_LABEL_PAD_PX = 8;\n\n/** A magnified stretch may not take more of the track than this. Past it the\n * rest of the programme has stopped being context and become a margin. */\nconst ZOOM_MAX_SHARE = 0.8;\n\n/** How long the axis takes to open and close around a magnified stretch. */\nconst ZOOM_TWEEN_MS = 240;\n\n/**\n * Magnify one stretch of a built axis, compressing the rest to pay for it.\n *\n * A fisheye rather than a filter: every mark stays on the bar and keeps its\n * order, so the reader can see what the cluster is a part of while reading what\n * is inside it. Each pair of the magnified marks is opened to at least\n * `ZOOM_MIN_PITCH_PX` — which is the width a label needs, and the reason four\n * revisions on one fortnight can show four labels while zoomed and one pill\n * while not.\n *\n * It wraps the axis rather than rebuilding it, so the cut glyphs, the anchors\n * and `inCut` are the SAME answers as the unzoomed bar: zooming changes where a\n * date is drawn, never which stretches the axis decided not to keep time in.\n */\nfunction magnifyAxis(\n base: CompressedAxis,\n focus: { x: number; widthPx: number }[],\n track: number,\n): CompressedAxis {\n // Two marks on ONE day are one coordinate, here as everywhere else: an axis\n // that pulled them apart would be inventing a date to put between them. They\n // are still both in the pill's popover, which is where a reader finds out\n // that two of the four revisions landed together.\n const byX = new Map<number, number>();\n for (const mark of focus) {\n if (!Number.isFinite(mark.x)) continue;\n byX.set(mark.x, Math.max(byX.get(mark.x) ?? 0, mark.widthPx));\n }\n const xs = [...byX.keys()].sort((a, b) => a - b);\n if (track <= 0 || xs.length < 2) return base;\n\n const from = Math.max(0, xs[0]);\n const to = Math.min(track, xs[xs.length - 1]);\n const span = to - from;\n const wants: number[] = [];\n for (let i = 0; i + 1 < xs.length; i++) {\n // Enough for both labels, never less than the floor, and never less than\n // the room the pair already had: a zoom only ever opens.\n const labels = (byX.get(xs[i]) ?? 0) / 2 + (byX.get(xs[i + 1]) ?? 0) / 2 + ZOOM_LABEL_PAD_PX;\n wants.push(Math.max(ZOOM_MIN_PITCH_PX, labels, xs[i + 1] - xs[i]));\n }\n const wanted = wants.reduce((sum, width) => sum + width, 0);\n const width = Math.min(Math.max(wanted, span), track * ZOOM_MAX_SHARE);\n // Already roomy enough to read: magnifying it would move every other mark for\n // no gain, which is the thing that makes a fisheye feel like a glitch.\n if (width <= span + 0.5) return base;\n\n const leftOld = from;\n const rightOld = track - to;\n const outside = leftOld + rightOld;\n const rest = Math.max(0, track - width);\n const leftNew = outside > 0 ? (rest * leftOld) / outside : 0;\n const fromNew = leftNew;\n const toNew = leftNew + width;\n const inner = wants.map((want) => (wanted > 0 ? (want * width) / wanted : 0));\n\n const map = (x: number): number => {\n if (x <= from) return leftOld > 0 ? (x * leftNew) / leftOld : fromNew;\n if (x >= to) return rightOld > 0 ? toNew + ((x - to) * (track - toNew)) / rightOld : toNew;\n let at = fromNew;\n for (let i = 0; i + 1 < xs.length; i++) {\n if (x > xs[i + 1]) { at += inner[i]; continue; }\n const sub = xs[i + 1] - xs[i];\n return at + (sub > 0 ? ((x - xs[i]) / sub) * inner[i] : 0);\n }\n return toNew;\n };\n const unmap = (x: number): number => {\n if (x <= fromNew) return leftNew > 0 ? (x * leftOld) / leftNew : from;\n if (x >= toNew) return track - toNew > 0 ? to + ((x - toNew) * rightOld) / (track - toNew) : to;\n let at = fromNew;\n for (let i = 0; i + 1 < xs.length; i++) {\n if (x > at + inner[i]) { at += inner[i]; continue; }\n return xs[i] + (inner[i] > 0 ? ((x - at) / inner[i]) * (xs[i + 1] - xs[i]) : 0);\n }\n return to;\n };\n\n return {\n anchorsMs: base.anchorsMs,\n xs: base.xs.map(map),\n gaps: base.gaps.map((gap) => ({\n ...gap,\n fromPx: map(gap.fromPx),\n toPx: map(gap.toPx),\n px: map(gap.toPx) - map(gap.fromPx),\n })),\n xByMs: (ms) => map(base.xByMs(ms)),\n msByPx: (px) => base.msByPx(unmap(px)),\n inCut: base.inCut,\n };\n}\n\n/** The thumb's allowed values, ascending — or null where it is continuous. */\nfunction sortedStops(stops: number[] | undefined): number[] | null {\n if (!stops || stops.length === 0) return null;\n const clean = stops.filter((ms) => Number.isFinite(ms)).sort((a, b) => a - b);\n return clean.length > 0 ? clean : null;\n}\n\n// ─── Parts ───────────────────────────────────────────────────────────────────\n\n/**\n * An off-layout copy of every label, so the packer gets real widths.\n *\n * Every CANDIDATE is measured here, not just the labels currently drawn: a\n * collapsed label is not in the DOM at all, so measuring only what is drawn\n * would leave it collapsed for ever, however wide the card grew.\n */\nfunction MeasuringRow({ marks, innerRef }: { marks: Mark[]; innerRef: RefObject<HTMLDivElement> }) {\n return (\n <div ref={innerRef} aria-hidden=\"true\" className=\"rosh-tl-measure\">\n {marks.map((mark) => (\n <div key={mark.key} data-lane-key={mark.key} className=\"rosh-tl-measure-box\">\n <span className=\"rosh-tl-name\">{mark.label}</span>\n <span className=\"rosh-tl-date\">{mark.dateText}</span>\n </div>\n ))}\n </div>\n );\n}\n\n/**\n * The date ruler: month ticks always, week ticks where they would not crowd, a\n * month label only where one fits, and the span a cut swallowed.\n *\n * Nothing is drawn inside a cut. A cut is the one part of the bar that does not\n * keep time, so a tick there would mark a coordinate with no date.\n */\nfunction Ruler({ startMs, endMs, axis, geo, reveal }: {\n startMs: number;\n endMs: number;\n axis: CompressedAxis;\n geo: TrackGeometry;\n reveal: boolean;\n}) {\n const y = geo.ruler;\n const ticks: ReactNode[] = [];\n const labels: ReactNode[] = [];\n const cuts = axis.gaps.filter((gap) => gap.compressed);\n\n // A week tick where THAT week clears the minimum — asked per tick, because\n // on a piecewise axis a week is 14 px in the fortnight of revisions and 2 px\n // in the ten idle months after them, and one answer for the whole bar drew\n // a dense comb across the stretch it was least true of.\n const monday = new Date(startMs);\n // The next Monday, so the weeks line up with a calendar rather than with the\n // day the programme happened to start.\n monday.setUTCDate(monday.getUTCDate() + ((8 - monday.getUTCDay()) % 7));\n for (let t = monday.getTime(); t < endMs; t += 7 * DAY_MS) {\n if (axis.inCut(t)) continue;\n const x = axis.xByMs(t);\n if (axis.xByMs(t + 7 * DAY_MS) - x < WEEK_TICK_MIN_PX) continue;\n ticks.push(\n <i key={`wk-${t}`} className=\"rosh-tl-tick is-week\"\n style={{ left: `${x}px`, top: `${y}px`, height: '3px' }} />,\n );\n }\n\n // A cut's span label carries information no other mark repeats, so it owns its\n // stretch of the ruler; a month label that would collide is dropped.\n const bands = cuts.map((gap) => {\n const centre = (gap.fromPx + gap.toPx) / 2;\n const half = monoWidth(`${Math.round(gap.gapMs / DAY_MS)} days`) / 2 + 6;\n return [centre - half, centre + half] as const;\n });\n const blocked = (from: number, to: number) => bands.some(([low, high]) => from < high && to > low);\n\n // The axis begins HERE, and a tick is what says so. What stood at x = 0\n // before was the month boundary preceding `startMs`, drawn as a label with no\n // tick under it — a month the window does not contain, pinned to a coordinate\n // that is not its date, and the only thing the left end of the bar had to say\n // for itself. The start caption carries the start date now, so the ruler\n // labels boundaries STRICTLY INSIDE the window and marks the start itself.\n ticks.push(\n <i key=\"start\" data-timeline-part=\"start-tick\" className=\"rosh-tl-tick\"\n style={{ left: '0px', top: `${y}px`, height: '6px' }} />,\n );\n\n const cursor = new Date(startMs);\n cursor.setUTCDate(1);\n let lastLabelX = -Infinity;\n let firstLabel = true;\n while (cursor.getTime() < endMs) {\n const t = cursor.getTime();\n // `<=`, not `<`: a window that opens on the first of a month already has a\n // tick there, and a second one on top of it is a thicker line, not a date.\n const beforeStart = t <= startMs;\n if (!beforeStart && !axis.inCut(t)) {\n const x = axis.xByMs(t);\n ticks.push(\n <i key={`mo-${t}`} className=\"rosh-tl-tick\" style={{ left: `${x}px`, top: `${y}px`, height: '6px' }} />,\n );\n // Pitch is measured label-start to label-start, so a long \"Apr 2026\" does\n // not swallow the month that follows it.\n if (x - lastLabelX >= MONTH_LABEL_PITCH_PX || firstLabel) {\n const withYear = firstLabel || cursor.getUTCMonth() === 0;\n const text = `${MONTHS[cursor.getUTCMonth()]}${withYear ? ` ${cursor.getUTCFullYear()}` : ''}`;\n if (!blocked(x, x + monoWidth(text))) {\n labels.push(\n <span key={`mon-${t}`} className={`rosh-tl-month${reveal ? ' rosh-tl-fade' : ''}`}\n style={{ left: `${x}px`, top: `${y + 9}px`, ...(reveal ? { animationDelay: '420ms' } : {}) }}>\n {text}\n </span>,\n );\n lastLabelX = x;\n firstLabel = false;\n }\n }\n }\n cursor.setUTCMonth(cursor.getUTCMonth() + 1);\n }\n\n return (\n <div aria-hidden=\"true\" data-timeline-part=\"ruler\">\n {ticks}\n {labels}\n {cuts.map((gap) => {\n const days = Math.max(1, Math.round(gap.gapMs / DAY_MS));\n return (\n <span key={`cut-${gap.fromMs}`} data-timeline-part=\"break\"\n className={`rosh-tl-rulercut${reveal ? ' rosh-tl-fade' : ''}`}\n style={{\n left: `${(gap.fromPx + gap.toPx) / 2}px`,\n top: `${y}px`,\n ...(reveal ? { animationDelay: '420ms' } : {}),\n }}>\n <span className=\"rosh-tl-cutglyph\"><i /><i /></span>\n <span>{days.toLocaleString()} days</span>\n </span>\n );\n })}\n </div>\n );\n}\n\n/** The undated things, listed where a date coordinate is not. */\nfunction PendingColumn({ pending, reveal }: { pending: TimelineTrackPending[]; reveal: boolean }) {\n const [expanded, setExpanded] = useState(false);\n const shown = expanded ? pending : pending.slice(0, PENDING_ROW_LIMIT);\n const folded = pending.length - shown.length;\n return (\n <div className=\"rosh-tl-pending\" data-timeline-part=\"pending\">\n <p className=\"rosh-tl-pending-head\">Not yet reached</p>\n <ol className=\"rosh-tl-ghosts\" aria-label=\"Not yet reached\">\n {shown.map((entry, index) => (\n <li key={entry.key} className={reveal ? 'rosh-tl-fade' : undefined}\n style={reveal ? { animationDelay: `${440 + index * 60}ms` } : undefined}>\n {/* Hollow, and in the shape its kind would wear on the rail: a\n shipment that has not happened is still shipment-shaped. */}\n <span aria-hidden=\"true\"\n className={`rosh-tl-node is-ghost${entry.kind && KIND_STYLES[entry.kind].diamond ? ' is-diamond' : ''}`} />\n <span>\n {index === 0 && <b>Next · </b>}\n {entry.label}\n </span>\n </li>\n ))}\n </ol>\n {folded > 0 && (\n <button type=\"button\" className=\"rosh-tl-more text-gray-500\" onClick={() => setExpanded(true)}>\n +{folded} more\n </button>\n )}\n </div>\n );\n}\n\n/**\n * The vertical variant, for a track too narrow to be an axis.\n *\n * The idle stretch is stated in words rather than drawn: a break glyph needs an\n * axis to break.\n */\nfunction VerticalTrack({ marks, pending, currentKey, todayMs, reveal, ariaLabel, step, nodeProps, onKeyDown }: {\n marks: Mark[];\n pending: TimelineTrackPending[];\n currentKey: string | null;\n todayMs: number;\n reveal: boolean;\n ariaLabel: string;\n step: number;\n nodeProps: (mark: Mark) => NodeButtonProps;\n onKeyDown: (event: React.KeyboardEvent) => void;\n}) {\n const currentIndex = marks.findIndex((mark) => mark.key === currentKey);\n const gapDays = marks.length > 0 ? Math.round((todayMs - marks[marks.length - 1].ms) / DAY_MS) : 0;\n return (\n <div data-timeline-part=\"vertical\">\n <ol className=\"rosh-tl-v\" aria-label={ariaLabel} onKeyDown={onKeyDown}>\n {marks.map((mark, index) => {\n const dressing = nodeDressing(mark.kind, mark.role);\n const reached = currentIndex >= 0 && index < currentIndex;\n const { glyph } = mark;\n return (\n <li key={mark.key} className={reveal ? 'rosh-tl-fade' : undefined}\n style={reveal ? stagger(index, step) : undefined}\n {...(mark.key === currentKey ? { 'aria-current': 'step' as const } : {})}>\n <i aria-hidden=\"true\"\n className={`rosh-tl-vline text-blue-600${reached ? ' is-on' : ' is-dash'}${reached && reveal ? ' rosh-tl-drawy' : ''}`} />\n <button {...nodeProps(mark)}\n className={`${dressing.className}${reveal ? ' rosh-tl-pop' : ''}`}\n style={{ ...dressing.style, ...(reveal ? stagger(index, step) : {}) }}>\n {glyph && <TimelineGlyph name={glyph} />}\n {mark.role === 'current' && (\n <span aria-hidden=\"true\" className={`rosh-tl-pulse bg-blue-600${reveal ? ' is-on' : ''}`} />\n )}\n </button>\n <span className=\"rosh-tl-vrow\" aria-hidden=\"true\">\n <span className=\"rosh-tl-name\">{mark.label}</span>\n <span className=\"rosh-tl-date\">{mark.dateText}</span>\n </span>\n </li>\n );\n })}\n </ol>\n {gapDays > 0 && (\n <p className=\"rosh-tl-vgap\" aria-hidden=\"true\">\n <i className=\"rosh-tl-vline is-dash\" />\n <span>{gapDays.toLocaleString()} days to today</span>\n </p>\n )}\n {pending.length > 0 && <PendingColumn pending={pending} reveal={reveal} />}\n </div>\n );\n}\n\n/** The rail, its fill, and the notches where the axis stops keeping time. */\nfunction TrackRail({ axis, geo, fillTo, reveal, trackPx, tweened = false }: {\n axis: CompressedAxis;\n geo: TrackGeometry;\n fillTo: number | null;\n reveal: boolean;\n /** How far the rail runs: the axis's width, which on a bare rail with a cap\n * is short of the layer — the dashed tail is drawn by the caller. */\n trackPx: number;\n /** True where a thumb drives the fill, which is the only case in which its\n * width should ease: a resize moving it is a relayout, not a move. */\n tweened?: boolean;\n}) {\n return (\n <div aria-hidden=\"true\">\n <div className=\"rosh-tl-rail bg-gray-200\"\n style={{ top: `${geo.rail}px`, height: `${RAIL_PX}px`, width: `${trackPx}px` }} />\n {fillTo !== null && (\n <div data-timeline-part=\"fill\"\n className={`rosh-tl-fill bg-blue-600${tweened ? ' is-tweened' : ''}${reveal ? ' rosh-tl-draw' : ''}`}\n style={{\n top: `${geo.rail}px`,\n height: `${RAIL_PX}px`,\n width: `${Math.max(0, Math.min(axis.xByMs(fillTo), trackPx))}px`,\n }} />\n )}\n {axis.gaps.filter((gap) => gap.compressed).map((gap) => (\n <div key={`railcut-${gap.fromMs}`} className=\"rosh-tl-cut\"\n style={{ left: `${(gap.fromPx + gap.toPx) / 2}px`, top: `${geo.rail}px`, height: `${RAIL_PX}px` }}>\n <i /><i />\n </div>\n ))}\n </div>\n );\n}\n\n/**\n * The start anchor: where the axis begins, drawn whether or not anything\n * happened there.\n *\n * A window opens on the day production started, not on the day the first report\n * was filed — but nothing used to be DRAWN at `startMs`, so a report two days\n * in (0.84% of a 237-day window, ~7.6px inside a 10px inset) sat on the rail's\n * left end and read as the beginning of the programme. The ring says otherwise,\n * and the caption under it says when.\n *\n * It is decoration, not a mark: `aria-hidden`, `pointer-events: none`, absent\n * from the ordered list the screen reader walks, and never one of the thumb's\n * stops. The date it stands for is in the caption, which is text.\n *\n * `around` is the collision case — a dated mark inside `START_MARK_PX` of the\n * start, which is every mould card, whose window opens ON its first milestone.\n * The ring opens out and encircles that mark instead of sitting under it: both\n * stay visible, and neither moves, because time stays linear.\n */\nfunction StartMark({ geo, caption, endCaption, around, reveal, trackPx }: {\n geo: TrackGeometry;\n caption: ReactNode;\n endCaption: ReactNode;\n around: boolean;\n reveal: boolean;\n trackPx: number;\n}) {\n const capTop = geo.rail - START_CAPTION_PX - 4;\n const fade = reveal ? ' rosh-tl-fade' : '';\n const delay = reveal ? { animationDelay: '420ms' } : {};\n return (\n <div aria-hidden=\"true\" data-timeline-part=\"start\">\n <i className={`rosh-tl-start${around ? ' is-around' : ''}${fade}`}\n style={{ left: '0px', top: `${geo.rail + RAIL_PX / 2}px`, ...delay }} />\n {caption != null && caption !== false && (\n <span className={`rosh-tl-edge${fade}`} data-timeline-part=\"start-caption\"\n style={{ left: '0px', top: `${capTop}px`, ...delay }}>\n {caption}\n </span>\n )}\n {endCaption != null && endCaption !== false && (\n <span className={`rosh-tl-edge is-end${fade}`} data-timeline-part=\"end-caption\"\n style={{ left: `${trackPx}px`, top: `${capTop}px`, ...delay }}>\n {endCaption}\n </span>\n )}\n </div>\n );\n}\n\n/** Today: a dashed rule through the bands, with a tag that says so. */\nfunction TodayMark({ x, geo, trackPx, label, reveal }: {\n x: number;\n geo: TrackGeometry;\n trackPx: number;\n label: string;\n reveal: boolean;\n}) {\n const tagWidth = 48;\n return (\n <div aria-hidden=\"true\" data-timeline-part=\"today\">\n <div className={`rosh-tl-todayline${reveal ? ' rosh-tl-fade' : ''}`}\n style={{\n left: `${x}px`,\n top: `${geo.laneA}px`,\n height: `${geo.ruler + 20 - geo.laneA}px`,\n ...(reveal ? { animationDelay: '420ms' } : {}),\n }} />\n <span className={`rosh-tl-todaytag${reveal ? ' rosh-tl-fade' : ''}`} title={`Today — ${label}`}\n style={{\n left: `${clampLabelLeft(x, tagWidth, trackPx)}px`,\n top: `${geo.tag}px`,\n ...(reveal ? { animationDelay: '420ms' } : {}),\n }}>\n Today\n </span>\n </div>\n );\n}\n\n/**\n * The bare rail's captions: a few characters over each mark that has any,\n * `v3` over a drawing revision. Nothing else on that rail is text, so this is\n * what tells six revisions apart before the pointer arrives.\n *\n * Captions that would overprint each other are drawn as ONE — `v1–v4` over the\n * run — measured on the same 10 px mono face the ruler uses. A fold's caption\n * spans its members the same way, because a fold is a run already.\n */\nfunction Captions({ nodes, geo, reveal }: { nodes: RailNode[]; geo: TrackGeometry; reveal: boolean }) {\n const captioned = nodes\n .map((node) => {\n const texts = node.members.map((member) => member.caption).filter((c): c is string => !!c);\n if (texts.length === 0) return null;\n return { x: node.x, first: texts[0], last: texts[texts.length - 1] };\n })\n .filter((entry): entry is { x: number; first: string; last: string } => entry !== null)\n .sort((a, b) => a.x - b.x);\n const runs: { x: number; text: string }[] = [];\n let run: { from: number; to: number; first: string; last: string; right: number } | null = null;\n const flush = () => {\n if (!run) return;\n runs.push({\n x: (run.from + run.to) / 2,\n text: run.first === run.last ? run.first : `${run.first}–${run.last}`,\n });\n run = null;\n };\n for (const entry of captioned) {\n const text = entry.first === entry.last ? entry.first : `${entry.first}–${entry.last}`;\n const half = monoWidth(text) / 2;\n if (run && entry.x - half < run.right + CAPTION_GAP_PX) {\n run.to = entry.x;\n run.last = entry.last;\n run.right = entry.x + half;\n continue;\n }\n flush();\n run = { from: entry.x, to: entry.x, first: entry.first, last: entry.last, right: entry.x + half };\n }\n flush();\n return (\n <div aria-hidden=\"true\" data-timeline-part=\"captions\">\n {runs.map((entry) => (\n <span key={`${entry.x}-${entry.text}`} className={`rosh-tl-caption${reveal ? ' rosh-tl-fade' : ''}`}\n style={{ left: `${entry.x}px`, top: `${geo.laneA}px`, ...(reveal ? { animationDelay: '360ms' } : {}) }}>\n {entry.text}\n </span>\n ))}\n </div>\n );\n}\n\n/** A phase bracket: the three-sided box that says \"these ran in parallel\". */\nfunction PhaseBracket({ phase, geo, xOf }: {\n phase: TimelineTrackPhase;\n geo: TrackGeometry;\n xOf: (ms: number) => number;\n}) {\n const left = xOf(phase.minMs);\n // A bracket narrower than its own two borders reads as one line, so a phase\n // whose members share a day still gets a few pixels of span.\n const width = Math.max(xOf(phase.maxMs) - left, 4);\n return (\n <div aria-hidden=\"true\" data-timeline-part=\"phase\">\n <div className=\"rosh-tl-phase border-gray-300\"\n style={{ left: `${left}px`, width: `${width}px`, top: `${geo.laneB + geo.laneH - 4}px` }} />\n <span className=\"rosh-tl-phase-label text-gray-500\"\n style={{ left: `${left + width / 2}px`, top: `${geo.laneB + geo.laneH + 5}px` }}>\n {phase.label} · parallel\n </span>\n </div>\n );\n}\n\n/**\n * The one label a scrubber draws: the hovered mark, else the active one.\n *\n * When the mark has an `onOpen` the NAME is a real button — the document behind\n * the dot is the thing a reader wants next, and a dot that only selects leaves\n * them hunting for a row in a table to click. It is the one part of the label\n * that is not `aria-hidden`: the rest restates the dot's own accessible name,\n * but a control has to be reachable.\n */\nfunction ActiveLabel({ nodes, trackPx, geo, activeKey, hoveredKey, currentKey }: {\n nodes: RailNode[];\n trackPx: number;\n geo: TrackGeometry;\n activeKey: string | null;\n hoveredKey: string | null;\n currentKey: string | null;\n}) {\n const holds = (node: RailNode, key: string | null) =>\n key !== null && (node.key === key || node.members.some((member) => member.key === key));\n const node = nodes.find((n) => n.key === hoveredKey)\n ?? nodes.find((n) => holds(n, activeKey))\n ?? null;\n if (!node) return null;\n // A fold has no one label to draw and no one document to open: it is `×N` over\n // the days it covers, and the popover under it is where the members are named.\n const mark = node.mark;\n const name = mark ? mark.label : `×${node.members.length}`;\n const dateText = mark ? mark.dateText : foldDates(node.members);\n const widthPx = mark ? mark.widthPx : estimateLabelWidth(name, dateText);\n const onOpen = mark?.onOpen;\n return (\n <div data-timeline-part=\"label\"\n className={`rosh-tl-label${node.key === hoveredKey ? ' is-hot' : ''}${holds(node, currentKey) ? ' is-current' : ''}`}\n style={{\n left: `${clampLabelLeft(node.x, widthPx, trackPx)}px`,\n top: `${geo.laneB}px`,\n width: `${widthPx}px`,\n height: `${geo.laneH}px`,\n }}>\n {onOpen ? (\n <button type=\"button\" className=\"rosh-tl-name rosh-tl-open\" data-timeline-part=\"open\"\n aria-label={`Open ${name}`} onClick={onOpen}>\n {name}\n </button>\n ) : (\n <span className=\"rosh-tl-name\" aria-hidden=\"true\">{name}</span>\n )}\n <span className=\"rosh-tl-date\" aria-hidden=\"true\">{dateText}</span>\n </div>\n );\n}\n\n/** One label's worth of layout: a packed label, or a `×N` pill. */\ninterface LaneBox {\n key: string;\n group: ClusterGroup<Mark>;\n text: string;\n x: number;\n widthPx: number;\n index: number;\n lane: number;\n left: number;\n}\n\n/**\n * Two lanes of labels, with same-kind runs folded into `×N` pills.\n *\n * A pill is a real `<button aria-expanded>` opening a popover that lists every\n * member with its date: click pins it, hover previews it, Escape closes it. The\n * members' own dots stay on the rail with a faint span line joining them, so the\n * pill never lies about when anything happened — and every member is in its own\n * dot's accessible name, because nothing here may be hover-only.\n */\nfunction LaneLabels({\n groups, trackPx, geo, startMs, endMs, currentKey, hoveredKey, reveal, step, zoomedKey,\n popId, aimBubble, openCluster, setOpenCluster, previewCluster, setPreviewCluster, setZoomKey,\n startCaptionPx,\n}: {\n groups: ClusterGroup<Mark>[];\n trackPx: number;\n geo: TrackGeometry;\n startMs: number;\n endMs: number;\n /** How much room the start caption claims at x = 0, so a label on the start\n * day is packed into the other lane instead of overprinting it. 0 where the\n * caller drew no caption. */\n startCaptionPx: number;\n currentKey: string | null;\n hoveredKey: string | null;\n reveal: boolean;\n step: number;\n /** The cluster whose stretch is currently magnified, if any: its members show\n * their own labels, because that is what the magnification was for. */\n zoomedKey: string | null;\n popId: string;\n aimBubble: (el: HTMLDivElement | null, x: number) => void;\n openCluster: string | null;\n setOpenCluster: (key: string | null) => void;\n previewCluster: string | null;\n setPreviewCluster: (key: string | null) => void;\n setZoomKey: (key: string | null) => void;\n}) {\n const boxes: LaneBox[] = [];\n groups.forEach((group, index) => {\n if (group.type === 'cluster') {\n const key = `cluster-${group.members[0].key}`;\n const text = clusterLabel(group.members);\n boxes.push({\n key,\n group,\n text,\n // The PILL does not move when the axis opens under it: it is the control\n // the pointer is resting on, and a control that slides away from the\n // pointer that opened it closes itself.\n x: group.members.reduce((sum, m) => sum + m.baseX, 0) / group.members.length,\n index,\n lane: -1,\n left: 0,\n // A pill is a chip, not a two-line label: its text, its kind dot and the\n // padding around them.\n widthPx: Math.ceil(monoWidth(text)) + 28,\n });\n // Magnified: the members are far enough apart to say who they are.\n if (key === zoomedKey) {\n for (const member of group.members) {\n boxes.push({\n key: member.key,\n group: { type: 'item', mark: member },\n text: member.label,\n x: member.x,\n index,\n lane: -1,\n left: 0,\n widthPx: member.widthPx,\n });\n }\n }\n return;\n }\n boxes.push({\n key: group.mark.key,\n group,\n text: group.mark.label,\n x: group.mark.x,\n index,\n lane: -1,\n left: 0,\n widthPx: group.mark.widthPx,\n });\n });\n boxes.sort((a, b) => a.x - b.x);\n\n const lanes = packLabelLanes(\n [\n // The start caption is not a label, but it occupies the same band and the\n // same pixels, so the packer has to know about it: the mould card's\n // window opens ON its first milestone, and without this reservation\n // \"Project Initiated\" and \"Start · 09/10/2025\" are printed over each\n // other. Claimed before everything, so what gives way is the label — into\n // the second lane, which is what the packer is for.\n ...(startCaptionPx > 0\n ? [{ key: START_LANE_KEY, ms: startMs, xPx: 0, widthPx: startCaptionPx, priority: -2 }]\n : []),\n ...boxes.map((box) => ({\n key: box.key,\n ms: box.group.type === 'cluster' ? box.group.members[0].ms : box.group.mark.ms,\n xPx: box.x,\n widthPx: box.widthPx,\n // A pill claims its lane FIRST, which puts it in the row above the rail\n // the way the prototype draws it: it speaks for several marks, so the\n // labels that have to give way around it are single ones — and a single\n // label that finds no lane still reveals on hover, where a pill pushed\n // into the lower lane leaves the row above it empty.\n priority: box.group.type === 'cluster' ? -1 : 0,\n })),\n ],\n trackPx, startMs, Math.max(endMs - startMs, DAY_MS),\n { laneCount: TRACK_LABEL_LANE_COUNT },\n );\n const laneByKey = new Map(lanes.map((l) => [l.key, l.lane]));\n for (const box of boxes) {\n box.lane = laneByKey.get(box.key) ?? -1;\n box.left = clampLabelLeft(box.x, box.widthPx, trackPx);\n }\n\n const openBox = boxes.find((box) => box.key === (openCluster ?? previewCluster));\n const laneTop = (lane: number) => (lane === 0 ? geo.laneA : geo.laneB);\n const leaderTop = (lane: number) => (lane === 0 ? geo.rail - 4 : geo.rail + RAIL_PX + 3);\n\n return (\n <>\n {boxes.map((box) => {\n const lane = Math.max(0, box.lane);\n const delay = Math.round(box.index * step + 60);\n if (box.group.type === 'cluster') {\n const pinned = openCluster === box.key;\n const xs = box.group.members.map((m) => m.x);\n const close = () => {\n setPreviewCluster(null);\n if (!pinned) setZoomKey(null);\n };\n return (\n <div key={box.key}>\n <button type=\"button\" data-timeline-part=\"cluster\"\n className={`rosh-tl-pill${KIND_STYLES[box.group.kind as TimelineTrackKind]?.token ? '' : ' text-blue-600'}${reveal ? ' rosh-tl-fade' : ''}`}\n aria-expanded={pinned} aria-controls={popId}\n style={{\n left: `${box.left}px`,\n top: `${lane === 0 ? geo.laneA + geo.laneH - 19 : geo.laneB}px`,\n color: KIND_STYLES[box.group.kind as TimelineTrackKind]?.token,\n ...(reveal ? { animationDelay: `${delay}ms` } : {}),\n }}\n onMouseEnter={() => { setPreviewCluster(box.key); setZoomKey(box.key); }}\n onMouseLeave={close}\n onFocus={() => { setPreviewCluster(box.key); setZoomKey(box.key); }}\n onBlur={close}\n onClick={() => {\n setOpenCluster(pinned ? null : box.key);\n setZoomKey(pinned ? null : box.key);\n }}>\n <i aria-hidden=\"true\" />\n {box.text}\n </button>\n <i aria-hidden=\"true\" className=\"rosh-tl-cspan\"\n style={{\n left: `${Math.min(...xs)}px`,\n width: `${Math.max(1, Math.max(...xs) - Math.min(...xs))}px`,\n top: `${leaderTop(lane)}px`,\n }} />\n </div>\n );\n }\n const mark = box.group.mark;\n if (box.lane < 0) {\n // A label with nowhere to go is revealed on hover or focus rather than\n // overprinting its neighbour. Its dot announces it either way.\n return mark.key === hoveredKey ? (\n <div key={box.key} aria-hidden=\"true\" data-timeline-part=\"reveal\"\n className=\"rosh-tl-label is-reveal is-hot\"\n style={{ left: `${box.left}px`, top: `${geo.laneA}px`, width: `${box.widthPx}px` }}>\n <span className=\"rosh-tl-name\">{mark.label}</span>\n <span className=\"rosh-tl-date\">{mark.dateText}</span>\n </div>\n ) : null;\n }\n const centred = Math.abs(box.left + box.widthPx / 2 - mark.x) <= 8;\n return (\n <div key={box.key}>\n <div aria-hidden=\"true\" data-timeline-part=\"label\"\n className={`rosh-tl-label${lane === 0 ? ' is-up' : ''}${mark.key === currentKey ? ' is-current' : ''}${mark.key === hoveredKey ? ' is-hot' : ''}${reveal ? ' rosh-tl-fade' : ''}`}\n style={{\n left: `${box.left}px`,\n top: `${laneTop(lane)}px`,\n width: `${box.widthPx}px`,\n height: `${geo.laneH}px`,\n ...(reveal ? { animationDelay: `${delay}ms` } : {}),\n }}>\n <span className=\"rosh-tl-name\">{mark.label}</span>\n <span className=\"rosh-tl-date\">{mark.dateText}</span>\n </div>\n {/* A leader only where the label had to slide off its dot. One on a\n label that still sits over its dot is noise. */}\n {!centred && (\n <i aria-hidden=\"true\" className={`rosh-tl-lead${reveal ? ' rosh-tl-fade' : ''}`}\n style={{\n left: `${Math.min(box.left + box.widthPx / 2, mark.x)}px`,\n width: `${Math.abs(box.left + box.widthPx / 2 - mark.x)}px`,\n top: `${leaderTop(lane)}px`,\n ...(reveal ? { animationDelay: `${delay}ms` } : {}),\n }} />\n )}\n </div>\n );\n })}\n {openBox && openBox.group.type === 'cluster' && (\n <div ref={(el) => { aimBubble(el, openBox.x); }} id={popId} className=\"rosh-tl-popover\"\n data-timeline-part=\"cluster-popover\"\n style={{ top: `${geo.rail + RAIL_PX + 6}px` }}\n onMouseEnter={() => setPreviewCluster(openBox.key)}\n onMouseLeave={() => setPreviewCluster(null)}>\n <p className=\"rosh-tl-popover-head\">{openBox.text}</p>\n <ol>\n {openBox.group.members.map((member) => (\n <li key={member.key}>\n <span>{member.label}</span>\n <span className=\"rosh-tl-date\">{member.dateText}</span>\n </li>\n ))}\n </ol>\n </div>\n )}\n </>\n );\n}\n\n/**\n * The scrubber: an 18 px disc, the date chip above it, and a hit strip.\n *\n * With `stops` the thumb is magnetic: a drag follows the pointer but the disc\n * is drawn on the nearest stop the whole way across, and the caller is told\n * about a stop change the moment it happens rather than on release. The travel\n * between stops is a 120 ms CSS transition, not a rAF tween, so a drag across\n * six reports reads as six settlings instead of a slide — and reduced motion\n * takes the transition away in the stylesheet, where the rest of the card's\n * motion rule already lives.\n *\n * `glide` is the exception, and the only one: while playback owns the thumb the\n * disc, its chip and the fill are placed by an animation frame at a coordinate\n * that is not a stop, and the date on the chip is read back out of the axis. The\n * stop index the screen reader hears stays on the value the caller is showing,\n * because a slider mid-travel has not changed its value yet.\n */\nfunction ThumbLayer({\n thumb, value, snap, axis, geo, startMs, endMs, trackPx, layerRef, glide, onScrub,\n nodes, onProgress,\n}: {\n thumb: TimelineTrackThumb;\n /** The user has taken hold of the thumb — once per gesture, before the value\n * moves. Playback lets go when this fires. */\n onScrub?: () => void;\n /** The stops playback visits, with their keys: what names the two neighbours a\n * drag is between. Empty where the track has no playback to report to. */\n nodes: PlaybackNode[];\n /** Where the hand is between two of those stops, or `null` on release. */\n onProgress: (state: TimelineScrubProgress | null) => void;\n /** `thumb.valueMs`, clamped and snapped — what is actually drawn. */\n value: number;\n /** Where playback has the thumb, or null when the caller's value places it. */\n glide: { px: number; ms: number } | null;\n /** Clamp + snap any time onto an allowed value. */\n snap: (ms: number) => number;\n /** The allowed stops, ascending, or null for a continuous slider. */\n axis: CompressedAxis;\n geo: TrackGeometry;\n startMs: number;\n endMs: number;\n trackPx: number;\n layerRef: RefObject<HTMLDivElement>;\n}) {\n const draggingRef = useRef(false);\n const x = glide ? glide.px : axis.xByMs(value);\n /** The time under the disc: the caller's value at rest, the interpolated one\n * while playback is carrying it between two stops. */\n const at = glide ? glide.ms : value;\n const chipWidth = 88;\n const stops = sortedStops(thumb.stops);\n const index = stops ? stops.indexOf(value) : -1;\n\n const msFromEvent = (clientX: number): number => {\n const box = layerRef.current?.getBoundingClientRect();\n if (!box) return value;\n return axis.msByPx(clientX - box.left);\n };\n /** Only tell the caller about a move that changes the value: a drag fires\n * dozens of pointermoves between two stops, and each one is a re-render of\n * the table the scrubber feeds. */\n const moveTo = (ms: number) => {\n const next = snap(ms);\n if (next !== value) thumb.onChange(next);\n };\n\n const beginDrag = (event: React.PointerEvent) => {\n onScrub?.();\n draggingRef.current = true;\n (event.currentTarget as Element).setPointerCapture?.(event.pointerId);\n thumb.onDragStart?.();\n };\n const endDrag = (event: React.PointerEvent) => {\n if (!draggingRef.current) return;\n draggingRef.current = false;\n (event.currentTarget as Element).releasePointerCapture?.(event.pointerId);\n // The value is already on a stop — every move snapped — so the release has\n // nothing left to settle, and there is no longer a hand between two of them.\n onProgress(null);\n thumb.onDragEnd?.();\n };\n const drag = (event: React.PointerEvent) => {\n if (!draggingRef.current) return;\n const ms = msFromEvent(event.clientX);\n moveTo(ms);\n // The POINTER's position, not the magnet's. The disc is drawn on the nearest\n // stop the whole way across, so the hand is the only continuous thing a\n // consumer interpolating its figures can be told about.\n onProgress(progressBetween(nodes, ms));\n };\n\n /** Where a key takes the thumb: the neighbouring STOP where there are stops,\n * a day (or a week with Shift) where there are not. */\n const keyTarget = (event: React.KeyboardEvent): number | null => {\n const { key } = event;\n if (stops && stops.length > 0) {\n const at = index < 0 ? 0 : index;\n if (key === 'ArrowRight' || key === 'ArrowUp') return stops[Math.min(at + 1, stops.length - 1)];\n if (key === 'ArrowLeft' || key === 'ArrowDown') return stops[Math.max(at - 1, 0)];\n if (key === 'Home') return stops[0];\n if (key === 'End') return stops[stops.length - 1];\n return null;\n }\n const step = (event.shiftKey ? 7 : 1) * DAY_MS;\n if (key === 'ArrowRight' || key === 'ArrowUp') return value + step;\n if (key === 'ArrowLeft' || key === 'ArrowDown') return value - step;\n if (key === 'Home') return startMs;\n if (key === 'End') return endMs;\n return null;\n };\n\n const valueText = thumb.valueText ? thumb.valueText(at) : fmtSliderDate(at);\n const days = Math.max(1, Math.round((endMs - startMs) / DAY_MS));\n\n return (\n <>\n {/* The rail's hit target: 24 px of it, because a 6 px rail is not a thing a\n hand can press. It is wider than the rail and it is drawn AFTER the\n marks, and for as long as neither had a z-index that made it a lid —\n every mark on every track with a thumb sat under it, so a hover opened\n no popover, a focus ring was the only thing keyboard focus produced, and\n a click on a report scrubbed the rail instead of selecting the report.\n The bubble, the `onClick`, the `onOpen` and the hovered caption were all\n wired and all unreachable.\n\n The fix is one line of CSS and it belongs on the MARKS, not here:\n `.rosh-tl-nodes .rosh-tl-node { z-index: 4 }` lifts them over this strip\n (auto) and leaves them under the thumb (5) and the bubble (6). Which\n keeps all four behaviours the scrubber needs at once — a press on the\n bare rail starts a drag, because the strip still owns every pixel no dot\n is standing on; a press on a dot activates it and starts no drag,\n because the event never reaches this element; hover and focus reach\n every kind of mark; and the tab order is untouched, since it is the\n DOM's, and nothing moved in the DOM.\n\n Taking the pointer off the strip instead — `pointer-events: none`, with\n the handlers moved to the rail — was the other candidate, and it was\n turned down for giving the 6 px rail back as the only place a drag can\n begin, which is the thing this strip exists to avoid. */}\n <div className=\"rosh-tl-hit\" aria-hidden=\"true\" data-timeline-part=\"hit\"\n style={{ top: `${geo.rail - 9}px`, height: `${RAIL_PX + 18}px` }}\n onPointerDown={(event) => { beginDrag(event); moveTo(msFromEvent(event.clientX)); }}\n onPointerMove={drag}\n onPointerUp={endDrag}\n onPointerCancel={endDrag} />\n <div className=\"rosh-tl-chip\" data-timeline-part=\"chip\"\n style={{ left: `${clampLabelLeft(x, chipWidth, trackPx) + chipWidth / 2}px`, top: `${geo.tag}px` }}>\n {thumb.chip ? thumb.chip(at) : fmtSliderDate(at)}\n </div>\n <div role=\"slider\" tabIndex={0} className=\"rosh-tl-thumb text-blue-600\" data-timeline-part=\"thumb\"\n aria-label={thumb.ariaLabel ?? 'Scrub the timeline'}\n aria-valuemin={0}\n aria-valuemax={stops && stops.length > 0 ? stops.length - 1 : days}\n aria-valuenow={stops && stops.length > 0\n ? Math.max(0, index)\n : Math.round((value - startMs) / DAY_MS)}\n aria-valuetext={valueText}\n style={{ left: `${x}px`, top: `${geo.rail + RAIL_PX / 2}px` }}\n onPointerDown={beginDrag}\n onPointerMove={drag}\n onPointerUp={endDrag}\n onPointerCancel={endDrag}\n onKeyDown={(event) => {\n const next = keyTarget(event);\n if (next === null) return;\n event.preventDefault();\n onScrub?.();\n moveTo(next);\n }} />\n </>\n );\n}\n\n// ─── Component ───────────────────────────────────────────────────────────────\n\n/** How tall the stage has to be for the bands it actually draws. */\nfunction stageHeight(geo: TrackGeometry, usesFarLane: boolean, hasPhases: boolean): number {\n const base = usesFarLane ? geo.height : geo.ruler + 26;\n return base + (hasPhases ? PHASE_BAND_PX : 0);\n}\n\n/**\n * Which axis options a mode stands for. `'linear'` lifts both the ceiling and\n * the floor; `'spread'` lifts the ceiling alone, so nothing is cut and the\n * floor is paid for out of the idle stretches; `'compressed'` keeps both.\n */\nfunction axisOptions(mode: 'linear' | 'compressed' | 'spread') {\n if (mode === 'compressed') return {};\n if (mode === 'spread') return { maxTimeShare: Infinity };\n return { maxTimeShare: Infinity, minGapPx: 0 };\n}\n\n/**\n * The time axis both timelines are drawn on.\n *\n * One primitive behind the mould milestone card (`MilestoneTimeline`) and the\n * production-progress scrubber (`ProductionTimeline`), because they are the same\n * picture with two label strategies: a rail, a fill, a date ruler, dots that\n * mean something by their shape, and a today tick. Sharing the primitive is what\n * makes them look and move identically — the alternative had them drift into two\n * bars answering the same question in two visual languages.\n *\n * What it owns: the axis (linear or compressed), the rail and its fill, the date\n * ruler, the dots and their glyphs, label placement (two packed lanes with `×N`\n * clustering, or one active label), the local magnification of a dense stretch,\n * the optional scrubber thumb and its stops, its playback — the travel between\n * two stops is measured in pixels of this axis, which is why the caller owns the\n * button and this owns the movement — the hover previews, the pending list, the\n * motion, and the keyboard and screen-reader contract. What it does\n * not own: the card around it, its heading, its legend, or any domain summary —\n * those belong to the consumer, which knows what the bar is about. `TimelineCard`\n * is where both of the kit's own timelines put theirs.\n *\n * Accessibility: the marks are an `<ol>` in axis order with exactly one\n * `aria-current=\"step\"`; the rail, fill, ruler, today tick, break glyphs, leader\n * hairlines, phase brackets and the drawn labels are all `aria-hidden`, because\n * they restate that list. The list is ONE tab stop with a roving `tabindex` —\n * arrows traverse, Home/End jump, Enter/Space activates. Tooltips and cluster\n * popovers are hoverable, persistent and dismissed by Escape (WCAG 1.4.13), and\n * nothing is reachable by hover alone.\n */\nexport default function TimelineTrack({\n startMs, endMs, axis: axisMode = 'linear', items, markers = [], pending = [],\n fillToMs, todayMs, labels = 'lanes', activeKey = null, onActivate, thumb, playback,\n edgeCaptions, phases = [], currentKey, zoomRange = null, motion = true, ariaLabel,\n highlightKeys = null, onHoverChange, endMark = null,\n}: TimelineTrackProps) {\n // The bare rail: no label lanes, captions flanking the rail, undated things\n // as one cap past the axis. Decided once, because it changes the geometry,\n // the width the axis gets, and what the stage draws.\n const bare = labels === 'none';\n // Captured once at mount so render stays idempotent — day-resolution marks do\n // not care that \"today\" does not tick while the view is open.\n const [mountedToday] = useState(() => Date.now());\n const [stillness] = useState(prefersReducedMotion);\n const now = todayMs ?? mountedToday;\n const rootRef = useRef<HTMLDivElement>(null);\n const layerRef = useRef<HTMLDivElement>(null);\n const measureRef = useRef<HTMLDivElement>(null);\n const tipRef = useRef<HTMLDivElement>(null);\n const nodeRefs = useRef(new Map<string, HTMLButtonElement>());\n const graceRef = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n const zoomGraceRef = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n /** A mark to focus once it exists — the first member of a fold that has just\n * been opened, which is not in the DOM until the render that opens it. */\n const focusAfterRenderRef = useRef<string | null>(null);\n const [measured, setMeasured] = useState<Record<string, number>>({});\n const [hoveredKey, setHoveredKey] = useState<string | null>(null);\n const [bubbleKey, setBubbleKey] = useState<string | null>(null);\n const [openCluster, setOpenCluster] = useState<string | null>(null);\n const [previewCluster, setPreviewCluster] = useState<string | null>(null);\n const [zoomKey, setZoomKey] = useState<string | null>(null);\n const [focusKey, setFocusKey] = useState<string | null>(null);\n const tipId = useId();\n const popId = useId();\n\n // The card's width decides the variant; the track's own width, when there is\n // a track, is what every coordinate is computed against.\n const rootWidth = useObservedWidth(rootRef, true);\n const bodyColumn = rootWidth > 0\n ? rootWidth - (pending.length > 0 && !bare ? PENDING_COLUMN_PX + BODY_GAP_PX : 0)\n : 0;\n const vertical = bodyColumn > 0 && bodyColumn - 2 * EDGE_INSET_PX < VERTICAL_BELOW_PX;\n const layerWidth = useObservedWidth(layerRef, !vertical);\n const trackPx = layerWidth > 0 ? layerWidth : FALLBACK_TRACK_PX;\n const geo = GEOMETRY[labels];\n // On a bare rail with something still to come, the axis stops short of the\n // layer's right edge: the last stretch is the dashed tail to the cap, and it\n // keeps no time.\n const hasCap = bare && pending.length > 0;\n const axisPx = hasCap ? Math.max(0, trackPx - CAP_TAIL_PX) : trackPx;\n\n // The axis. Anchored on both ends of the window and on every dated item inside\n // it, so the stretches that get clamped are exactly the stretches between\n // things that happened. A linear axis is the same mapping with the ceiling\n // lifted, which is what keeps one code path for both bars.\n const inWindow = (ms: number) => ms >= startMs - DAY_MS && ms <= endMs + DAY_MS;\n const dated = items\n .filter((item) => Number.isFinite(item.ms) && inWindow(item.ms))\n .slice()\n .sort((a, b) => a.ms - b.ms);\n // A spread axis anchors on the markers too. The floor exists so that no two\n // marks are drawn as one, and on a bare rail a shipment three days after a\n // report is as much a mark as the report; the card axes keep to the items,\n // whose lanes and folds are what their floor was tuned against.\n const markerTimes = axisMode === 'spread'\n ? markers.map((marker) => new Date(marker.date).getTime()).filter((ms) => Number.isFinite(ms))\n : [];\n const axis = compressTimeAxis(\n [\n startMs,\n ...[...dated.map((m) => m.ms), ...markerTimes].filter((ms) => ms > startMs && ms < endMs),\n endMs,\n ],\n axisPx,\n axisOptions(axisMode),\n );\n const xOf = axis.xByMs;\n\n // \"Where we are\" is the last thing that HAPPENED. A provisional mark is a\n // promise placed on a date, and a pulse on a promise says it was kept.\n const happened = dated.filter((item) => !item.provisional);\n const resolvedCurrent = currentKey ?? (happened.length > 0 ? happened[happened.length - 1].key : null);\n\n const itemMarks: Mark[] = dated.map((item, index) => {\n const dateText = item.date ?? fmtSliderDate(item.ms);\n const ordinary = (item.priority ?? 0) > 0 || item.kind === 'report';\n const kind = resolveKind(item);\n return {\n key: item.key,\n ms: item.ms,\n x: xOf(item.ms),\n baseX: xOf(item.ms),\n kind,\n label: item.label,\n dateText,\n detail: item.detail,\n preview: item.preview,\n glyph: resolveGlyph(item, kind, index === 0 && kind === 'default'),\n role: item.key === resolvedCurrent ? 'current' : ordinary ? 'dot' : 'key',\n // A bare rail draws no label, so the only width a mark has to defend when\n // a fold opens around it is its caption's.\n widthPx: bare\n ? Math.max(MARK_OVERLAP_PX, monoWidth(item.caption ?? '') + CAPTION_GAP_PX)\n : measured[item.key] || estimateLabelWidth(item.label, dateText),\n collapsible: ordinary,\n onClick: item.onClick,\n onOpen: item.onOpen,\n isItem: true,\n caption: item.caption,\n provisional: !!item.provisional,\n isCap: false,\n };\n });\n const markerMarks: Mark[] = markers\n .map((marker) => ({ marker, ms: new Date(marker.date).getTime() }))\n .filter(({ ms }) => Number.isFinite(ms) && inWindow(ms))\n .map(({ marker, ms }) => {\n const key = `marker-${marker.id}`;\n const dateText = fmtSliderDate(ms);\n return {\n key,\n ms,\n x: xOf(ms),\n baseX: xOf(ms),\n kind: marker.kind,\n label: marker.label,\n dateText,\n detail: marker.detail,\n preview: marker.preview,\n glyph: marker.glyph ?? KIND_STYLES[marker.kind].glyph,\n role: 'key' as NodeRole,\n widthPx: measured[key] || estimateLabelWidth(marker.label, dateText),\n // A marker is context, not part of the programme: it never folds into\n // someone else's `×N`.\n collapsible: false,\n onClick: marker.onClick ? () => marker.onClick?.(marker) : undefined,\n onOpen: marker.onOpen ? () => marker.onOpen?.(marker) : undefined,\n isItem: false,\n provisional: false,\n isCap: false,\n };\n });\n /**\n * The cap: one node past the axis standing for everything undated, on a\n * bare rail. It is the LAST pending thing by name — the programme's end,\n * which is what the caller listed last — and its popover names the rest, so\n * nothing folded into it is reachable by nobody. It keeps the pending item's\n * own key, so a consumer's `highlightKeys` can light it the way it lights a\n * dated mark.\n */\n const capMarks: Mark[] = hasCap\n ? (() => {\n const cap = pending[pending.length - 1];\n const others = pending.slice(0, -1).map((entry) => entry.label);\n return [{\n key: cap.key,\n // Past the window, so it sorts last; never handed to the axis.\n ms: endMs + DAY_MS,\n x: trackPx,\n baseX: trackPx,\n kind: cap.kind ?? 'default',\n label: cap.label,\n dateText: 'Not yet reached',\n detail: others.length > 0 ? `Also to come: ${others.join(', ')}` : undefined,\n glyph: undefined,\n role: 'key' as NodeRole,\n widthPx: MARK_OVERLAP_PX,\n collapsible: false,\n isItem: false,\n provisional: false,\n isCap: true,\n }];\n })()\n : [];\n /**\n * The end mark: the cap's drawing ON the axis's right edge, for a day the\n * window already runs to — an estimated completion. Same node, same popover;\n * no tail, because the axis keeps time all the way there. Only a bare rail\n * draws one: the card variants state the same date in their meta line.\n */\n const endMarks: Mark[] = bare && endMark && !hasCap\n ? [{\n key: endMark.key,\n ms: endMs,\n x: axisPx,\n baseX: axisPx,\n kind: 'default',\n label: endMark.label,\n dateText: endMark.dateText ?? fmtSliderDate(endMs),\n detail: endMark.detail,\n glyph: undefined,\n role: 'key' as NodeRole,\n widthPx: MARK_OVERLAP_PX,\n collapsible: false,\n isItem: false,\n provisional: false,\n isCap: true,\n }]\n : [];\n const marks = [...itemMarks, ...markerMarks, ...capMarks, ...endMarks]\n .sort((a, b) => a.x - b.x || a.ms - b.ms);\n\n // The start anchor. The caption defaults to the window's own left edge, in the\n // reader's date format, because that is the fact the bar was failing to state.\n const startCaption = edgeCaptions?.start ?? `Start · ${fmtSliderDate(startMs)}`;\n const startCaptionPx = startCaption == null || startCaption === false\n ? 0\n : typeof startCaption === 'string'\n ? Math.ceil(monoWidth(startCaption))\n : START_CAPTION_FALLBACK_PX;\n\n // Clustering is decided on the UNZOOMED axis, before any magnification, and\n // the answer is handed to the labels. Deciding it after the zoom would let a\n // cluster dissolve because it had been opened — and the pill the pointer is\n // resting on would be the first thing to go.\n const groups: ClusterGroup<Mark>[] = labels === 'lanes' ? clusterMarks(marks) : [];\n const groupKey = (group: ClusterGroup<Mark>) =>\n (group.type === 'cluster' ? `cluster-${group.members[0].key}` : group.mark.key);\n\n // The DOTS' own collision, which is a different question from the labels' and\n // is asked on every bar: two marks nearer than one mark's width are drawn on\n // top of each other whatever their kinds, and the one underneath cannot be\n // hovered, read or counted. Decided here, before the magnification, so that\n // opening a fold cannot dissolve the fold that is being opened — what opening\n // changes is whether it is DRAWN folded, a few lines below.\n const railGroups = clusterOverlaps(marks);\n /** A fold's key. Its own namespace, so hovering a fold on the rail cannot be\n * mistaken for hovering the `×N` LABEL pill of the same run in lane mode. */\n const foldKey = (group: ClusterGroup<Mark>) =>\n (group.type === 'cluster' ? `fold-${group.members[0].key}` : group.mark.key);\n /** Which fold a mark belongs to, for the marks that are in one. */\n const foldOwner = new Map<string, string>();\n for (const group of railGroups) {\n if (group.type !== 'cluster') continue;\n for (const member of group.members) foldOwner.set(member.key, foldKey(group));\n }\n\n // What is magnified: the pill or the fold under the pointer, the pill pinned\n // open, else whatever the caller asked for.\n const zoomTarget = openCluster ?? previewCluster ?? zoomKey;\n const zoomedGroup = groups.find((group) => group.type === 'cluster' && groupKey(group) === zoomTarget)\n ?? railGroups.find((group) => group.type === 'cluster' && foldKey(group) === zoomTarget);\n const focusOf = (mark: Mark) => ({ x: mark.baseX, widthPx: mark.widthPx });\n const zoomFocus = zoomedGroup && zoomedGroup.type === 'cluster'\n ? zoomedGroup.members.map(focusOf)\n : zoomRange\n ? marks.filter((mark) => mark.ms >= zoomRange[0] && mark.ms <= zoomRange[1]).map(focusOf)\n : [];\n const view = zoomFocus.length > 1 ? magnifyAxis(axis, zoomFocus, axisPx) : axis;\n const zoomed = view !== axis;\n if (zoomed) {\n // The marks are rebuilt on every render, so moving them is local: the\n // alternative is a second pass that builds every mark twice to change one\n // number on each of them. The cap is not on the axis, so it does not move.\n for (const mark of marks) if (!mark.isCap) mark.x = view.xByMs(mark.ms);\n }\n // A mark on (or within a hair of) the start day, read off the coordinates\n // actually drawn rather than the ones before a magnification. The mould card\n // is always this case: its window opens on its first milestone.\n const startCrowded = marks.some((mark) => mark.x < START_MARK_PX);\n const zoomedKey = zoomed && zoomedGroup ? zoomTarget : null;\n\n /**\n * What the rail draws, once the folds have had their say.\n *\n * A fold is drawn as one node UNLESS the axis has opened around it, in which\n * case its members are drawn as themselves — that is the whole of \"open a\n * fold\": the magnification spreads the run past a mark's width and the run\n * stops needing to be folded. Keyed on the fold rather than on the geometry\n * the magnification produced, so a fold cannot dissolve itself and re-fold on\n * the next frame.\n *\n * Under 320 px the card is vertical, one row per mark, where nothing can\n * overlap anything: there every mark is its own node again.\n */\n const single = (mark: Mark): RailNode =>\n ({ key: mark.key, mark, members: [mark], x: mark.x, kind: mark.kind, openable: false });\n /** Has the magnification actually bought the run room? A fold drawn open whose\n * members still overlap would be the bug with an extra step in it. */\n const apart = (members: Mark[]) =>\n members.every((member, i) => i === 0 || member.x - members[i - 1].x >= MARK_OVERLAP_PX);\n const railNodes: RailNode[] = vertical ? marks.map(single) : railGroups.flatMap((group) => {\n if (group.type === 'item') return [single(group.mark)];\n const key = foldKey(group);\n if (key === zoomedKey && apart(group.members)) return group.members.map(single);\n const xs = group.members.map((member) => member.x);\n return [{\n key,\n mark: null,\n members: group.members,\n x: xs.reduce((sum, x) => sum + x, 0) / xs.length,\n kind: group.kind,\n openable: new Set(group.members.map((member) => member.ms)).size > 1,\n }];\n });\n /** The node a mark is drawn by — itself, or the fold that swallowed it. */\n const drawnKeyOf = new Map<string, string>();\n for (const node of railNodes) for (const member of node.members) drawnKeyOf.set(member.key, node.key);\n\n /**\n * The stretch an opened fold occupies, and the reason it stays open.\n *\n * An open fold is not drawn, so the pointer that opened it is left resting on\n * whatever the magnification moved out of the way — usually bare rail between\n * two members that have just sprung apart. Holding the fold open for as long\n * as the pointer is anywhere over its run is what the label pill gets for\n * free by being a separate control in another band; here it has to be\n * measured. `x` is post-magnification, which is what makes this the span the\n * reader is actually looking at.\n */\n const openFoldGroup = railGroups.find(\n (group) => group.type === 'cluster' && foldKey(group) === zoomedKey,\n );\n const openRun = openFoldGroup && openFoldGroup.type === 'cluster'\n ? {\n from: Math.min(...openFoldGroup.members.map((member) => member.x)) - FOLD_REACH_PX,\n to: Math.max(...openFoldGroup.members.map((member) => member.x)) + FOLD_REACH_PX,\n }\n : null;\n\n // A zoom opens and closes over 240ms, and the transition that carries it is\n // only armed around the change — a positional transition left on permanently\n // would ease every dot sideways while a window edge is being dragged.\n //\n // Not on mount, either: the measuring pass moves every mark from the fallback\n // track width to the measured one before the first paint, and an armed\n // transition would turn that correction into a slide.\n const zoomedRef = useRef(zoomedKey);\n const [zoomTweening, setZoomTweening] = useState(false);\n useEffect(() => {\n if (zoomedRef.current === zoomedKey) return;\n zoomedRef.current = zoomedKey;\n // eslint-disable-next-line react-hooks/set-state-in-effect -- arming a transition for the length of one zoom change is a DOM concern with no render-time expression; deriving it would make it permanent\n setZoomTweening(true);\n const timer = setTimeout(() => setZoomTweening(false), ZOOM_TWEEN_MS);\n return () => clearTimeout(timer);\n }, [zoomedKey]);\n\n // Re-measure when the set of labels or their text changes. Joined into a\n // string because the mark ARRAY is rebuilt on every render.\n const measureSignature = marks.map((m) => `${m.key} ${m.label} ${m.dateText}`).join('|');\n useMeasureEffect(() => {\n const row = measureRef.current;\n if (!row) return;\n const next: Record<string, number> = {};\n for (const child of Array.from(row.children)) {\n const key = (child as HTMLElement).dataset.laneKey;\n const width = child.getBoundingClientRect().width;\n if (key && width > 0) next[key] = width;\n }\n setMeasured((prev) => (sameWidths(prev, next) ? prev : next));\n }, [measureSignature]);\n\n // The reveal runs once per mark set, never per render. `hoveredKey` and the\n // measured widths are both state, so the card re-renders constantly — and the\n // entrance classes have to stay ON across those renders or the animation is\n // cut off mid-flight. Holding the signature the card is CURRENTLY revealing\n // gives both halves: a hover changes nothing, and a genuinely new set of marks\n // drops the classes for exactly one render, which is what lets the animation\n // start again rather than sit at its own end state.\n const revealSignature = `${labels}|${axisMode}|${marks.map((m) => `${m.key}@${m.ms}`).join('|')}`;\n const [revealing, setRevealing] = useState(revealSignature);\n const reveal = motion && revealing === revealSignature;\n useEffect(() => {\n // eslint-disable-next-line react-hooks/set-state-in-effect -- the one-render gap between a new mark set and this write is the reveal restart; deriving it in render would make the classes constant and the entrance would never replay\n if (revealing !== revealSignature) setRevealing(revealSignature);\n }, [revealing, revealSignature]);\n\n const step = Math.min(28, 340 / Math.max(1, marks.length - 1));\n\n // The thumb's value, clamped to the window and snapped to an allowed stop.\n // Resolved HERE rather than inside the thumb because the fill follows it: a\n // fill drawn from the raw value and a disc drawn from the snapped one would\n // disagree by however far the pointer had wandered.\n const thumbStops = sortedStops(thumb?.stops);\n const snapThumb = (ms: number): number => {\n const inRange = Math.min(Math.max(ms, startMs), endMs);\n if (!thumbStops) return inRange;\n let best = thumbStops[0];\n for (const stop of thumbStops) {\n if (Math.abs(stop - inRange) < Math.abs(best - inRange)) best = stop;\n }\n return best;\n };\n const thumbAt = thumb ? snapThumb(thumb.valueMs) : null;\n\n // ── Playback ───────────────────────────────────────────────────────────────\n // The stops the walk visits: the dated ITEMS, and only the ones the thumb is\n // allowed to rest on. A marker is context rather than progress — a playback\n // that stopped on a goods issue would be showing the snapshot of a report\n // filed days earlier and pointing at a shipment.\n const playbackNodes: PlaybackNode[] = playback && thumb\n ? itemMarks\n .filter((mark) => !thumbStops || thumbStops.includes(mark.ms))\n .map((mark) => ({ key: mark.key, ms: mark.ms }))\n : [];\n // Rebuilt every render against the axis being DRAWN, so a resize or a zoom\n // mid-playback changes what is left to cross rather than leaving the thumb\n // travelling to a coordinate that has moved.\n const segments = playbackSegments(view, playbackNodes, {\n speed: playback?.speed,\n reducedMotion: stillness,\n });\n\n /** Where playback has the thumb, or null while the caller's value places it.\n * State rather than a write to the node: the disc, its chip, the fill and\n * `aria-valuetext` all read this, and four imperative writers is how they end\n * up disagreeing about where the thumb is. */\n const [glide, setGlide] = useState<{ px: number; ms: number } | null>(null);\n /** Which leg is being crossed and how far through it. A ref because the driver\n * reads and writes it inside an animation frame, and because it has to\n * survive a pause — surviving is what makes resuming continue rather than\n * restart. */\n const cursorRef = useRef<PlaybackCursor | null>(null);\n /** The schedule as it is NOW, for a loop that was started several renders ago\n * and must not close over the arrangement it started with. */\n const liveRef = useRef({ segments, value: thumbAt, playback });\n // No dependency list: every render publishes its schedule, and this is\n // declared above the driver so the render that flips `playing` has published\n // before the driver reads.\n useEffect(() => { liveRef.current = { segments, value: thumbAt, playback }; });\n\n /** The last in-flight fraction handed out, so that consecutive nothings are\n * one nothing: a consumer interpolating a table on this re-renders on every\n * call, and a thumb at rest is not news forty times a second. */\n const progressRef = useRef<TimelineScrubProgress | null>(null);\n const reportProgress = useCallback((next: TimelineScrubProgress | null) => {\n if (next === null && progressRef.current === null) return;\n progressRef.current = next;\n liveRef.current.playback?.onProgress?.(next);\n }, []);\n\n /** Playback is over: the last stop, or the user taking the thumb back. */\n const endPlayback = useCallback(() => {\n cursorRef.current = null;\n setGlide(null);\n reportProgress(null);\n liveRef.current.playback?.onStop?.();\n }, [reportProgress]);\n\n const playing = !!playback?.playing && !!thumb;\n useEffect(() => {\n // Not playing is not the same as stopped: a PAUSE lands here, and it has to\n // leave both the cursor and the painted position alone. That is the whole\n // mechanism behind \"resume continues the same segment from where it froze\".\n if (!playing) return;\n const opening = liveRef.current;\n const from = opening.value === null\n ? -1\n : opening.segments.findIndex((segment) => segment.fromMs === opening.value);\n // Nowhere to go: the thumb is on the last stop, or there are no stops. The\n // caller hears about it at once rather than watching a Pause button that\n // will never do anything.\n if (from < 0) { endPlayback(); return; }\n // A cursor that belongs to a different leg than the one the caller's value\n // sits on is a stale session — the caller rewound, or jumped. Start over.\n if (!cursorRef.current || cursorRef.current.index !== from) {\n cursorRef.current = {\n index: from,\n phase: 'rest',\n t: 0,\n restLeftMs: opening.segments[from].dwellMs,\n sinceMs: null,\n };\n }\n\n let frame = 0;\n let dwellTimer: ReturnType<typeof setTimeout> | undefined;\n /** Paint a position, and only a position that is new: 700 ms of rest is 44\n * frames, and React bails out of a re-render when the state it is given is\n * the object it already had. */\n const paint = (next: { px: number; ms: number }) => setGlide((prev) => (\n prev && prev.px === next.px && prev.ms === next.ms ? prev : next\n ));\n\n /**\n * Give the rest the cursor is on a deadline of its own — ONCE, when the rest\n * begins, and never again while it runs.\n *\n * A frame is where the thumb MOVES, so travel can only be read there. A rest\n * is not travel, and animation frames are the wrong clock to wait on: an\n * occluded or throttled surface hands them out at whatever rate it likes, and\n * the customer portal, embedded and idle, held the thumb on its first report\n * for eight seconds because a 700 ms rest was seven frames of a page that was\n * getting one a second. So the rest is waited out on a timer.\n *\n * \"Once\" is load-bearing. Re-arming this from each frame — the obvious shape,\n * and the wrong one — pushes the deadline another 700 ms out every time a\n * frame arrives, which is the same unbounded stretch by a different route.\n */\n const waitOutRest = () => {\n clearTimeout(dwellTimer);\n const cursor = cursorRef.current;\n if (cursor?.phase !== 'rest') return;\n dwellTimer = setTimeout(restOver, Math.max(0, cursor.restLeftMs));\n };\n\n /** The rest is over on the wall clock. The glide it hands over to is charged\n * from its own first frame, because travel nobody was shown is not travel. */\n const restOver = () => {\n const cursor = cursorRef.current;\n if (cursor?.phase !== 'rest') return;\n const segment = liveRef.current.segments[cursor.index];\n if (!segment) { endPlayback(); return; }\n cursorRef.current = {\n index: cursor.index, phase: 'glide', t: 0, restLeftMs: 0, sinceMs: null,\n };\n paint(positionAt(segment, 0));\n // No frame is asked for here. One is always in flight — every reading\n // registers the next — and cancelling it to register another does not make\n // one arrive any sooner; on a surface whose frames are timer-driven it\n // restarts the wait, and in a healthy one it moves this loop behind\n // anything else that registered in the meantime, which is a frame of lag\n // on every paint for the rest of the run.\n };\n\n const read = (nowMs: number) => {\n const live = liveRef.current;\n const cursor = cursorRef.current;\n // Cancelled from outside — a drag, a click, a key. Do not reschedule.\n if (!cursor) return;\n const step = advancePlayback(live.segments, cursor, nowMs);\n cursorRef.current = step.cursor;\n if (step.at) paint(step.at);\n reportProgress(step.progress);\n if (step.arrived) live.playback?.onArrive(step.arrived.key, step.arrived.ms);\n if (!step.cursor) { endPlayback(); return; }\n // Only a CHANGE of phase touches the other clock: the rest an arrival opens\n // gets its deadline here, and a rest this frame ended has none left to keep.\n // A rest that is merely still running must not be re-armed.\n if (step.cursor.phase !== cursor.phase || step.cursor.index !== cursor.index) {\n waitOutRest();\n }\n frame = requestAnimationFrame(read);\n };\n\n waitOutRest();\n frame = requestAnimationFrame(read);\n return () => {\n cancelAnimationFrame(frame);\n clearTimeout(dwellTimer);\n // A pause, or a card on its way out. What is LEFT of the phase survives on\n // the cursor; the reading it was taken against does not, because the wall\n // clock keeps running while nothing is playing and a resumed rest charged\n // for the pause would be no rest at all.\n if (cursorRef.current) {\n cursorRef.current.sinceMs = null;\n // Frozen mid-travel: there is a position, but no journey in flight.\n reportProgress(null);\n }\n };\n }, [playing, endPlayback, reportProgress]);\n\n // The fill is what was REACHED, so a provisional mark — placed on a promise\n // rather than a fact — is not the end of it.\n const reached = itemMarks.filter((mark) => !mark.provisional);\n const fillTo = thumb\n ? (glide ? glide.ms : thumbAt)\n : fillToMs !== undefined\n ? fillToMs\n : reached.length > 0 ? Math.min(reached[reached.length - 1].ms, now) : null;\n\n // What the consumer asked to light: one band from the leftmost named mark to\n // the rightmost, and every node standing inside it. A key with no mark on\n // this rail lights nothing, rather than a band to nowhere.\n const litKeys = new Set(highlightKeys ?? []);\n const litXs = marks.filter((mark) => litKeys.has(mark.key)).map((mark) => mark.x);\n const band = litXs.length > 0\n ? { from: Math.min(...litXs), to: Math.max(...litXs) }\n : null;\n const isLit = (node: RailNode) => !!band && node.x >= band.from - 0.5 && node.x <= band.to + 0.5;\n\n const closeOverlays = useCallback(() => {\n clearTimeout(graceRef.current);\n clearTimeout(zoomGraceRef.current);\n setHoveredKey(null);\n setBubbleKey(null);\n setOpenCluster(null);\n setPreviewCluster(null);\n setZoomKey(null);\n }, []);\n useEffect(() => () => {\n clearTimeout(graceRef.current);\n clearTimeout(zoomGraceRef.current);\n }, []);\n\n // The focus a fold handed to its first member, once that member is drawn. No\n // dependency list: the render that opens the fold is the one that creates the\n // button, and the ref is cleared as it is spent.\n useEffect(() => {\n const key = focusAfterRenderRef.current;\n if (!key) return;\n focusAfterRenderRef.current = null;\n nodeRefs.current.get(key)?.focus();\n });\n\n // WCAG 1.4.13: content shown on hover or focus is dismissible without moving\n // the pointer or the focus. Through the shell's interceptor seam rather than a\n // listener of our own — a bubble opened by HOVER holds no focus, so a keydown\n // never reaches the trigger, and `Modal` claims Escape on `window` in the\n // capture phase, which beats a plain document listener.\n const overlayOpen = bubbleKey !== null || openCluster !== null || previewCluster !== null\n || zoomKey !== null;\n useEffect(() => {\n if (!overlayOpen) return;\n return registerModalEscapeInterceptor((event) => {\n if (event.key !== 'Escape') return false;\n closeOverlays();\n return true;\n });\n }, [overlayOpen, closeOverlays]);\n\n // Clamp a bubble inside the track, then inside the window the timeline sits\n // in, then aim its arrow at the dot it describes. Written straight to the\n // node: its own width is only known once it is in the DOM, and putting that\n // in state would re-render on every hover.\n //\n // The window clamp is UI-11's rule for anything anchored to a control: the\n // bubble is drawn inside the track's layer, not portalled, so a window\n // narrower than its track (or a track scrolled sideways) would otherwise cut\n // it off at the window's edge. `popupBounds` is the same box the dropdowns\n // keep to — the owning shell window intersected with the viewport.\n const aimBubble = useCallback((el: HTMLDivElement | null, x: number) => {\n if (!el) return;\n const half = el.offsetWidth / 2;\n let left = half > 0 ? Math.max(half, Math.min(x, trackPx - half)) : x;\n const layer = el.parentElement;\n if (half > 0 && layer) {\n const bounds = popupBounds(el);\n const origin = layer.getBoundingClientRect().left;\n const min = bounds.left + BUBBLE_WINDOW_GAP_PX + half - origin;\n const max = bounds.right - BUBBLE_WINDOW_GAP_PX - half - origin;\n if (min <= max) left = Math.max(min, Math.min(left, max));\n }\n el.style.left = `${left}px`;\n el.style.setProperty('--rosh-tl-arrow', `${half + (x - left)}px`);\n }, [trackPx]);\n\n const bubbleNode = railNodes.find((node) => node.key === bubbleKey) ?? null;\n const bubbleX = bubbleNode ? bubbleNode.x : 0;\n // Keyed on WHICH bubble as well as where: the first dot of a track sits at\n // x = 0, which is also the value `bubbleX` holds while no bubble is open, so\n // opening that dot's bubble changed nothing this effect watched. The bubble\n // then kept the stylesheet's position and its `translateX(-50%)` hung half\n // of it off the left edge of the window.\n useMeasureEffect(() => {\n aimBubble(tipRef.current, bubbleX);\n }, [aimBubble, bubbleKey, bubbleX]);\n\n // The snap highlight: a mark the thumb has just passed lights up for a moment,\n // so a scrub that crosses four reports reads as four events rather than as a\n // bar getting longer. Written to the DOM rather than held in state — a drag\n // moves the thumb every frame, and a re-render per frame to add a class that\n // removes itself is a lot of React for a flash.\n const thumbValue = thumbAt ?? undefined;\n const lastThumbX = useRef<number | null>(null);\n useEffect(() => {\n if (thumbValue === undefined) return;\n const x = view.xByMs(thumbValue);\n const previous = lastThumbX.current;\n lastThumbX.current = x;\n if (previous === null || x <= previous) return;\n const timers: ReturnType<typeof setTimeout>[] = [];\n for (const mark of marks) {\n if (mark.x <= previous || mark.x > x) continue;\n // A mark inside a fold flashes through the fold that is standing in for\n // it, so a scrub across a folded pair still reads as events being passed.\n const el = nodeRefs.current.get(drawnKeyOf.get(mark.key) ?? mark.key);\n if (!el) continue;\n el.classList.add('is-hit');\n timers.push(setTimeout(() => el.classList.remove('is-hit'), SNAP_FLASH_MS));\n }\n return () => { for (const timer of timers) clearTimeout(timer); };\n // `marks` and `axis` are rebuilt every render; the crossing is a function of\n // the thumb moving, and re-running this on a hover would re-light marks the\n // thumb crossed minutes ago.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [thumbValue]);\n\n // The tab order is what is DRAWN: a fold is one stop that names its members,\n // not several stops for buttons that are not on the page.\n const order = railNodes.map((node) => node.key);\n const currentDrawn = resolvedCurrent ? drawnKeyOf.get(resolvedCurrent) ?? null : null;\n const tabKey = focusKey && order.includes(focusKey)\n ? focusKey\n : currentDrawn && order.includes(currentDrawn) ? currentDrawn : order[0];\n\n const onListKeyDown = (event: React.KeyboardEvent) => {\n const from = order.indexOf((event.target as HTMLElement).dataset?.timelineKey ?? '');\n if (from < 0) return;\n const to = event.key === 'ArrowRight' || event.key === 'ArrowDown' ? from + 1\n : event.key === 'ArrowLeft' || event.key === 'ArrowUp' ? from - 1\n : event.key === 'Home' ? 0\n : event.key === 'End' ? order.length - 1\n : -1;\n if (to < 0 || to > order.length - 1) return;\n event.preventDefault();\n setFocusKey(order[to]);\n nodeRefs.current.get(order[to])?.focus();\n };\n\n /**\n * Opening and closing a fold.\n *\n * An open fold is NOT drawn — its members are, spread apart — so the node the\n * pointer opened unmounts under the pointer and its own `mouseleave` never\n * arrives. The grace is what carries the magnification across that gap to\n * whichever member has taken its place; a pointer that landed on neither lets\n * it expire, and a mark belonging to no fold closes it at once. The layer's\n * `mouseover` is the backstop: anywhere on the track that is not a mark and\n * not the popover releases it.\n */\n const keepFold = () => clearTimeout(zoomGraceRef.current);\n const openFold = (key: string) => { keepFold(); setZoomKey(key); };\n const closeFold = () => { keepFold(); setZoomKey(null); };\n const releaseFold = () => {\n clearTimeout(zoomGraceRef.current);\n zoomGraceRef.current = setTimeout(() => setZoomKey(null), FOLD_GRACE_MS);\n };\n /** A mark's pointer arriving: keep the fold it belongs to, close any other. */\n const enterMark = (key: string) => {\n if (zoomedKey && foldOwner.get(key) === zoomedKey) keepFold();\n else closeFold();\n };\n\n /** The key a consumer hears for a node: a mark's own, a fold's first member. */\n const reportedKey = (key: string) => {\n const node = railNodes.find((candidate) => candidate.key === key);\n return node?.members[0]?.key ?? key;\n };\n const showBubble = (key: string) => {\n clearTimeout(graceRef.current);\n setHoveredKey(key);\n setBubbleKey(key);\n onHoverChange?.(reportedKey(key));\n };\n const hideBubble = (key: string) => {\n setHoveredKey((prev) => (prev === key ? null : prev));\n clearTimeout(graceRef.current);\n graceRef.current = setTimeout(\n () => setBubbleKey((prev) => (prev === key ? null : prev)),\n BUBBLE_GRACE_MS,\n );\n // At once, not after the bubble's grace: the consumer is lighting a step\n // to match the pointer, and a step that stays lit for 160 ms after the\n // pointer has gone reads as a stuck highlight, not a courtesy.\n onHoverChange?.(null);\n };\n\n const nodeProps = (mark: Mark): NodeButtonProps => ({\n type: 'button',\n 'data-timeline-node': mark.isCap ? 'cap' : mark.isItem ? 'item' : 'marker',\n 'data-timeline-key': mark.key,\n 'aria-label': accessibleName(mark),\n 'aria-describedby': bubbleKey === mark.key ? tipId : undefined,\n // No `title`: the bubble already shows the label and the date, and the\n // browser drew its own tooltip for the same text beside it — a second\n // copy the page cannot place, left behind on the desktop.\n tabIndex: mark.key === tabKey ? 0 : -1,\n ref: (el: HTMLButtonElement | null) => {\n if (el) nodeRefs.current.set(mark.key, el);\n else nodeRefs.current.delete(mark.key);\n },\n onMouseEnter: () => { enterMark(mark.key); showBubble(mark.key); },\n onMouseLeave: () => { releaseFold(); hideBubble(mark.key); },\n onFocus: () => { enterMark(mark.key); showBubble(mark.key); setFocusKey(mark.key); },\n onBlur: () => { releaseFold(); hideBubble(mark.key); },\n onPointerDown: (event) => event.stopPropagation(),\n onClick: (event) => {\n event.stopPropagation();\n mark.onClick?.();\n if (mark.isItem) onActivate?.(mark.key);\n },\n });\n\n /**\n * A fold's node. It activates nothing — one of several is not a choice — so\n * what a pointer does is OPEN it, where there is anything to open: the axis\n * magnifies, the run is drawn as itself, and each member is a mark with its own\n * popover again. A fold that is all one date cannot be opened by any\n * magnification, so the pointer gets the list instead, in the popover.\n *\n * Focus never opens one — the button would unmount under the focus it was just\n * given — so the keyboard is offered the same list, and Enter opens the run and\n * moves the focus to its first member, which is how a keyboard reaches marks\n * that were folded away.\n */\n const foldProps = (node: RailNode): NodeButtonProps => ({\n type: 'button',\n 'data-timeline-node': 'fold',\n 'data-timeline-key': node.key,\n 'data-timeline-count': String(node.members.length),\n 'aria-label': foldName(node.members),\n 'aria-describedby': bubbleKey === node.key ? tipId : undefined,\n tabIndex: node.key === tabKey ? 0 : -1,\n ref: (el: HTMLButtonElement | null) => {\n if (el) nodeRefs.current.set(node.key, el);\n else nodeRefs.current.delete(node.key);\n },\n onMouseEnter: () => {\n if (node.openable) openFold(node.key);\n else showBubble(node.key);\n },\n onMouseLeave: () => { releaseFold(); hideBubble(node.key); },\n onFocus: () => { keepFold(); showBubble(node.key); setFocusKey(node.key); },\n onBlur: () => { releaseFold(); hideBubble(node.key); },\n onPointerDown: (event) => event.stopPropagation(),\n onClick: (event) => {\n event.stopPropagation();\n if (!node.openable) { showBubble(node.key); return; }\n openFold(node.key);\n const first = node.members[0];\n setFocusKey(first.key);\n focusAfterRenderRef.current = first.key;\n },\n });\n\n const usesFarLane = labels !== 'lanes' || marks.length > 1;\n // One root in both variants, because it is what the variant is decided from.\n if (vertical) {\n return (\n <div ref={rootRef}>\n <VerticalTrack\n // The cap is a horizontal device: past the axis, at the end of a\n // tail. The vertical list has the pending column for the same facts.\n marks={marks.filter((mark) => !mark.isCap)} pending={pending} currentKey={resolvedCurrent}\n todayMs={now} reveal={reveal} ariaLabel={ariaLabel} step={step}\n nodeProps={nodeProps} onKeyDown={onListKeyDown}\n />\n </div>\n );\n }\n\n /** A flank caption: the bare rail's \"Start\" / \"Ready\", on the rail's own row.\n * Hung off the rail's centre line, like the start caption is off the rail. */\n const flank = (caption: ReactNode, end: boolean) => (\n caption == null || caption === false ? null : (\n <span aria-hidden=\"true\" className={`rosh-tl-flank${end ? ' is-end' : ''}`}\n data-timeline-part={end ? 'end-caption' : 'start-caption'}\n style={{ paddingTop: `${geo.rail - 3}px` }}>\n {caption}\n </span>\n )\n );\n\n return (\n <div ref={rootRef} className={`rosh-tl-body${pending.length > 0 && !bare ? '' : ' is-solo'}`}>\n <div className=\"flex items-stretch gap-3\">\n {bare && flank(startCaption, false)}\n <div className=\"rosh-tl-stage\" style={{ height: `${stageHeight(geo, usesFarLane, phases.length > 0 && !bare)}px` }}>\n {/* `is-gliding` takes the thumb's 120 ms transitions away for as long\n as an animation frame is placing it: a transition chasing a tween\n lags behind it, and a pause would then keep sliding for another\n 120 ms after the frame that froze it. */}\n <div ref={layerRef}\n className={`rosh-tl-layer${zoomTweening ? ' is-zooming' : ''}${glide ? ' is-gliding' : ''}`}\n // What holds an opened fold open, and what lets it go. The fold's own\n // node is gone the moment it opens — the run is drawn in its place —\n // so its `mouseleave` never comes and the pointer is left on bare\n // rail between two members that have just sprung apart. So the run's\n // whole stretch is the hover region, measured rather than drawn: no\n // element to intercept a press meant for the rail, and no dependence\n // on which of the spread marks the pointer happens to be nearest.\n onMouseMove={(event) => {\n if (!openRun) return;\n const box = layerRef.current?.getBoundingClientRect();\n if (!box) return;\n const x = event.clientX - box.left;\n if (x >= openRun.from && x <= openRun.to) keepFold();\n else releaseFold();\n }}\n onMouseLeave={releaseFold}>\n {!bare && <MeasuringRow marks={marks} innerRef={measureRef} />}\n <TrackRail axis={view} geo={geo} fillTo={fillTo} reveal={reveal} trackPx={axisPx}\n tweened={!!thumb} />\n {hasCap && (\n /* The tail: from where the axis ends to the cap. Dashed, because\n it is not time — it is the distance to a date nobody has. */\n <i aria-hidden=\"true\" className=\"rosh-tl-tail\" data-timeline-part=\"tail\"\n style={{ left: `${axisPx}px`, width: `${trackPx - axisPx}px`, top: `${geo.rail + RAIL_PX / 2 - 1}px` }} />\n )}\n {band && (\n <div aria-hidden=\"true\" className=\"rosh-tl-band\" data-timeline-part=\"highlight\"\n style={{\n left: `${band.from - BAND_REACH_PX}px`,\n width: `${band.to - band.from + 2 * BAND_REACH_PX}px`,\n top: `${geo.rail - 7}px`,\n height: `${RAIL_PX + 14}px`,\n }} />\n )}\n <Ruler startMs={startMs} endMs={endMs} axis={view} geo={geo} reveal={reveal} />\n <StartMark geo={geo} caption={bare ? null : startCaption} endCaption={bare ? null : edgeCaptions?.end}\n around={startCrowded} reveal={reveal} trackPx={trackPx} />\n {bare && <Captions nodes={railNodes} geo={geo} reveal={reveal} />}\n {/* Today is drawn even where the axis was cut, unlike a ruler tick:\n a tick inside a cut labels a coordinate with no date, but \"you\n are here\" is the one landmark a reader needs most in exactly the\n stretch that got compressed.\n\n It is also drawn when today IS the right edge, which is the\n commonest case of all: a portal with no production-ready date\n passes today as the end of the window, and a strict `now < endMs`\n dropped the tag from every card that had not finished yet. Past\n the edge by more than a day it goes away again — a bar that\n ended in July does not have a \"today\" on it. */}\n {now > startMs && now <= endMs + DAY_MS && (\n <TodayMark x={view.xByMs(Math.min(now, endMs))} geo={geo} trackPx={trackPx}\n label={fmtSliderDate(now)} reveal={reveal} />\n )}\n {!bare && phases.map((phase) => (\n <PhaseBracket key={phase.key} phase={phase} geo={geo} xOf={view.xByMs} />\n ))}\n <ol className=\"rosh-tl-nodes\" aria-label={ariaLabel} onKeyDown={onListKeyDown}>\n {railNodes.map((node, index) => {\n const holds = (key: string | null) =>\n key !== null && node.members.some((member) => member.key === key);\n const top = `${geo.rail + RAIL_PX / 2}px`;\n const entrance = reveal ? stagger(index, step) : {};\n const lit = isLit(node) ? ' is-lit' : '';\n if (node.mark?.isCap) {\n // The cap: hollow and dashed, like the start anchor and for\n // the same reason — nothing was filed on the day it stands on,\n // because there is no such day yet. A real button all the\n // same: its popover is where the undated things are named.\n return (\n <li key={node.key}>\n <button {...nodeProps(node.mark)}\n className={`rosh-tl-node rosh-tl-mark is-cap${lit}${reveal ? ' rosh-tl-pop' : ''}`}\n style={{ left: `${node.x}px`, top, ...entrance }} />\n </li>\n );\n }\n if (!node.mark) {\n // A fold. Same kind throughout: that kind's shape and glyph,\n // with the count beside it. Mixed: a neutral `×N` pill, because\n // no glyph is true of a shipment and an inspection at once.\n const mixed = node.kind === MIXED_KIND;\n const dressing = nodeDressing(mixed ? 'default' : node.kind as TimelineTrackKind, 'key');\n const glyph = mixed ? undefined : KIND_STYLES[node.kind as TimelineTrackKind]?.glyph;\n return (\n <li key={node.key} {...(holds(resolvedCurrent) ? { 'aria-current': 'step' as const } : {})}>\n <button {...foldProps(node)}\n className={`${dressing.className} is-fold${mixed ? ' is-mixed' : ''}${holds(activeKey) ? ' is-active' : ''}${lit}${reveal ? ' rosh-tl-pop' : ''}`}\n style={{ ...dressing.style, left: `${node.x}px`, top, ...entrance }}>\n {glyph && <TimelineGlyph name={glyph} />}\n {mixed && <span aria-hidden=\"true\" className=\"rosh-tl-foldnum\">×{node.members.length}</span>}\n </button>\n {!mixed && (\n <i aria-hidden=\"true\" className={`rosh-tl-count${reveal ? ' rosh-tl-fade' : ''}`}\n style={{ left: `${node.x}px`, top }}>\n ×{node.members.length}\n </i>\n )}\n </li>\n );\n }\n const mark = node.mark;\n const dressing = nodeDressing(mark.kind, mark.role, mark.provisional);\n const { glyph } = mark;\n return (\n <li key={mark.key} {...(mark.key === resolvedCurrent ? { 'aria-current': 'step' as const } : {})}>\n <button {...nodeProps(mark)}\n className={`${dressing.className}${mark.key === activeKey ? ' is-active' : ''}${lit}${reveal ? ' rosh-tl-pop' : ''}`}\n style={{\n ...dressing.style,\n left: `${mark.x}px`,\n top,\n ...entrance,\n }}>\n {glyph && <TimelineGlyph name={glyph} />}\n {mark.role === 'current' && (\n <span aria-hidden=\"true\" className={`rosh-tl-pulse bg-blue-600${reveal ? ' is-on' : ''}`} />\n )}\n </button>\n </li>\n );\n })}\n </ol>\n {labels === 'lanes' ? (\n <LaneLabels\n groups={groups} trackPx={trackPx} geo={geo} startMs={startMs} endMs={endMs}\n currentKey={resolvedCurrent} hoveredKey={hoveredKey} reveal={reveal} step={step}\n zoomedKey={zoomedKey} popId={popId} aimBubble={aimBubble}\n startCaptionPx={startCaptionPx}\n openCluster={openCluster} setOpenCluster={setOpenCluster}\n previewCluster={previewCluster} setPreviewCluster={setPreviewCluster}\n setZoomKey={setZoomKey}\n />\n ) : labels === 'active' ? (\n <ActiveLabel\n nodes={railNodes} trackPx={trackPx} geo={geo}\n activeKey={activeKey} hoveredKey={hoveredKey} currentKey={resolvedCurrent}\n />\n ) : null}\n {/* One bubble, two depths. Without a `preview` it is the label, the\n date and whatever `detail` said — enough to know which dot this\n is. With one it is the document in miniature, supplied by the\n consumer because only the consumer knows what a DFM log or a\n goods issue is worth showing, and it ends in an Open that goes\n to the real thing. It is hoverable, focusable and dismissed by\n Escape either way (WCAG 1.4.13): moving the pointer off the dot\n and into the card must not take it away. */}\n {bubbleNode && (\n <div ref={tipRef} id={tipId} role=\"tooltip\"\n className={`rosh-tl-bubble${bubbleNode.members.some((member) => member.preview) ? ' is-preview' : ''}`}\n data-timeline-part=\"tooltip\"\n style={{ top: `${geo.rail + RAIL_PX + 6}px` }}\n onMouseEnter={() => { keepFold(); showBubble(bubbleNode.key); }}\n onMouseLeave={() => { releaseFold(); hideBubble(bubbleNode.key); }}\n onFocus={() => { keepFold(); showBubble(bubbleNode.key); }}\n onBlur={() => { releaseFold(); hideBubble(bubbleNode.key); }}>\n {bubbleNode.mark ? (\n <>\n <span className=\"rosh-tl-name\">{bubbleNode.mark.label}</span>\n <span className=\"rosh-tl-date\">{bubbleNode.mark.dateText}</span>\n {bubbleNode.mark.preview\n ? <div className=\"rosh-tl-preview\" data-timeline-part=\"preview\">{bubbleNode.mark.preview}</div>\n : bubbleNode.mark.detail && <span className=\"rosh-tl-detail\">{bubbleNode.mark.detail}</span>}\n {(bubbleNode.mark.onOpen ?? bubbleNode.mark.onClick) && (\n <button type=\"button\" className=\"rosh-tl-bubble-open text-blue-600\"\n data-timeline-part=\"bubble-open\"\n onClick={() => (bubbleNode.mark?.onOpen ?? bubbleNode.mark?.onClick)?.()}>\n Open\n </button>\n )}\n </>\n ) : (\n /* A fold names every member it is standing for, with its date\n and with whatever that member would have shown in a popover\n of its own. A run over several dates springs apart when the\n pointer opens it and each member is a mark again — but a run\n that is all ONE date can never be opened, because no\n magnification separates a coordinate from itself, and this\n list is then the only place its members exist. */\n <div className=\"rosh-tl-fold-list\" data-timeline-part=\"fold-members\">\n <p className=\"rosh-tl-popover-head\">×{bubbleNode.members.length}</p>\n <ol>\n {bubbleNode.members.map((member) => (\n <li key={member.key}>\n <p className=\"rosh-tl-foldrow\">\n <span>{member.label}</span>\n <span className=\"rosh-tl-date\">{member.dateText}</span>\n </p>\n {member.preview\n ? <div className=\"rosh-tl-preview\" data-timeline-part=\"preview\">{member.preview}</div>\n : member.detail && <span className=\"rosh-tl-detail\">{member.detail}</span>}\n </li>\n ))}\n </ol>\n </div>\n )}\n </div>\n )}\n {thumb && thumbAt !== null && (\n /* Taking hold of the thumb ends a playback rather than fighting\n it: two hands on one disc is the bug the prototype had, where a\n drag and the sweep wrote the same position every frame. */\n <ThumbLayer thumb={thumb} value={thumbAt} snap={snapThumb} axis={view} geo={geo}\n startMs={startMs} endMs={endMs} trackPx={trackPx} layerRef={layerRef}\n glide={glide} onScrub={playback ? endPlayback : undefined}\n nodes={playbackNodes} onProgress={reportProgress} />\n )}\n </div>\n </div>\n {bare && flank(edgeCaptions?.end, true)}\n </div>\n {pending.length > 0 && !bare && <PendingColumn pending={pending} reveal={reveal} />}\n </div>\n );\n}\n","import { Fragment, type ReactNode } from 'react';\n\n/**\n * The chrome both timeline cards wear: a titled header, the track, and an\n * optional footer rule.\n *\n * One component rather than two title rows, because the two cards had drifted\n * into two different headings for the same kind of statement — a 12 px\n * uppercase tracked label on one and a 13 px sentence-case title on the other —\n * and a reader with both open reads them as two different features.\n *\n * The header is a sentence: an icon, a title, then the facts in a muted 12 px\n * line separated by `·`, with the subject (a reference number) in front of them\n * because that is what a reader scans the card for. Anything interactive — a\n * Play control, a \"Back to …\" — goes in `actions`, right-aligned, so the\n * heading itself is never a row of buttons.\n */\nexport interface TimelineCardProps {\n /** A 15 px decorative glyph before the title. */\n icon?: ReactNode;\n /** Sentence case, 13 px / 600. \"Mould development\", not \"MOULD TIMELINE\". */\n heading: string;\n /** The record the card is about, e.g. `001F/1813` or `SO#35489`. Rendered\n * first in the meta line, a shade heavier than the rest of it. */\n subject?: ReactNode;\n /** The facts, joined with ` · `. Falsy entries are dropped, so a caller can\n * write the list straight through without assembling it first. */\n meta?: ReactNode[];\n /** The right-hand slot of the header row. */\n actions?: ReactNode;\n /** Below a hairline rule: the status line and the legend. */\n footer?: ReactNode;\n children: ReactNode;\n}\n\nexport default function TimelineCard({\n icon, heading, subject, meta = [], actions, footer, children,\n}: TimelineCardProps) {\n const facts: ReactNode[] = [\n ...(subject ? [<b key=\"subject\">{subject}</b>] : []),\n ...meta.filter((entry) => entry !== null && entry !== undefined && entry !== false && entry !== ''),\n ];\n return (\n <section className=\"rosh-tl-card border-gray-200 bg-gray-50\">\n <div className=\"rosh-tl-head\">\n {/* The sentence and the controls are two groups, not one row of five\n items: the sentence wraps inside itself when the card is narrow,\n and the controls stay in the corner instead of being pushed onto a\n line of their own by a meta line one fact too long. */}\n <div className=\"rosh-tl-head-main\">\n {icon && <span className=\"rosh-tl-ico text-gray-500\" aria-hidden=\"true\">{icon}</span>}\n <h4 className=\"rosh-tl-title text-gray-800\">{heading}</h4>\n {facts.length > 0 && (\n <p className=\"rosh-tl-meta text-gray-500\">\n {facts.map((fact, index) => (\n // The index is the key because the list is positional: these are\n // the card's facts in order, not a collection with identities.\n <Fragment key={index}>\n {index > 0 && <span aria-hidden=\"true\"> · </span>}\n {fact}\n </Fragment>\n ))}\n </p>\n )}\n </div>\n {actions && <span className=\"rosh-tl-head-actions\">{actions}</span>}\n </div>\n {children}\n {footer && <div className=\"rosh-tl-foot border-gray-200\">{footer}</div>}\n </section>\n );\n}\n","import { useState, type ReactNode } from 'react';\nimport { DAY_MS, fmtSliderDate, toDayMs } from './timelineDates';\nimport TimelineCard from './TimelineCard';\nimport { TimelineMilestoneIcon, type TimelineGlyphName } from './timelineGlyphs';\nimport TimelineTrack, {\n type TimelineTrackItem, type TimelineTrackKind, type TimelineTrackPending, type TimelineTrackPhase,\n} from './TimelineTrack';\n\n// ─── Public types ────────────────────────────────────────────────────────────\n\n/**\n * Visual category for a milestone. Drives shape + colour so the user can tell\n * different milestone types apart at a glance.\n *\n * Derived from `TimelineTrackKind` rather than written out again: the two lists\n * differ only by the kinds a production bar has and a milestone cannot be\n * (`report`, `inspection`), and a second copy is where a kind added to one and\n * not the other goes to hide.\n */\nexport type MilestoneKind = Exclude<TimelineTrackKind, 'report' | 'inspection'>;\n\n/** A single point on the timeline. Generic, product-agnostic: the consuming\n * app maps its domain records to this shape in a thin wrapper. */\nexport interface Milestone {\n /** Stable key — used for React keys and the active-dot lookup. */\n key: string;\n /** Short label rendered in a lane beside the dot. */\n label: string;\n /** ISO date string (`YYYY-MM-DD`) for the milestone. Null / undefined =\n * \"not reached yet\": the milestone gets NO dot and no coordinate, because\n * the only coordinate available would be a date nobody recorded. It is\n * listed as pending in the block beside the bar instead. */\n date: string | null | undefined;\n /** Optional second line for the hover tooltip. */\n detail?: string;\n /** Optional click handler so the caller can open a related entity. */\n onClick?: () => void;\n /**\n * Opens the DOCUMENT behind the milestone — the drawing, the mould record,\n * the goods issue — as opposed to selecting it on the bar. When set, the\n * popover's \"Open\" button fires this; a card that only ever had `onClick`\n * keeps working, because the button falls back to it.\n */\n onOpen?: () => void;\n /** Optional visual category — defaults to `'default'`. */\n kind?: MilestoneKind;\n /**\n * Which glyph sits inside the dot. Defaults by kind (dfm → a document,\n * testing → a flask, completion → a check, shipment → a diamond with no\n * glyph), and the FIRST dated milestone gets a flag when it asks for nothing\n * else. `'none'` draws a bare dot.\n *\n * It exists because the milestone spec's kinds and the reader's eye do not\n * line up everywhere: \"DFM Confirmed\" is a `default` milestone in the spec\n * and a signed drawing to the reader, so the portal sets `glyph: 'doc'` and\n * gets the filled document disc rather than a bare one.\n */\n glyph?: TimelineGlyphName | 'none';\n /**\n * Rich content for the hover/focus popover — a drawing's version and feedback\n * date, a shipment's goods-issue number. Falls back to label · date · detail.\n *\n * The popover has ALREADY drawn the milestone's label and its date line above\n * this, so a preview that opens with either of them says it twice.\n */\n preview?: ReactNode;\n /** Optional phase grouping — milestones sharing the same `phase` value\n * render with a bracket below the bar showing they happened in parallel\n * (e.g. two concurrent QA steps). Lookup the human-readable name from\n * `MilestoneTimelineProps.phaseLabels`. Undated milestones take no part:\n * a bracket spans a range of dates. The `rail` variant draws no bracket. */\n phase?: string;\n /**\n * The few characters the `rail` variant draws over the dot — `v3` for a\n * drawing revision. That variant draws no label, so this is what tells six\n * revisions apart before the pointer arrives; captions that would overprint\n * collapse to `v1–v4`. The `card` variant ignores it: it has the label.\n */\n caption?: string;\n /**\n * The milestone stands for something that has NOT happened, placed on the\n * best date the record holds — a sample ORDERED on a day, drawn where the\n * shipment will be. Hollow, and left out of the fill, so the bar never\n * claims a shipment off an order date.\n */\n provisional?: boolean;\n}\n\nexport interface MilestoneTimelineProps {\n /** Title rendered above the bar — e.g. \"Mould Development Timeline\". Used as\n * the heading when `heading` is not given, and as the accessible name of the\n * track either way. */\n title: string;\n /** The card's heading, in sentence case — \"Mould development\". Splitting it\n * from `subject` is what lets the reference number carry the weight in the\n * meta line instead of being buried in a sentence. */\n heading?: string;\n /** The record the card is about — `001F/1813`, `SO#35489`. First in the meta\n * line, a shade heavier than the facts after it. */\n subject?: ReactNode;\n /** Ordered milestones from earliest expected to latest expected. The order\n * is the order the pending (undated) ones are listed in; the dated ones are\n * placed by their date. */\n milestones: Milestone[];\n /** Overrides the duration fact in the meta line (e.g. \"On track — delivery\n * expected late June\"). When omitted, the window's length in days is used. */\n summary?: string;\n /** Optional explicit right edge — when provided, the bar always ends here\n * rather than padding to today. Used when the axis should stop at a known\n * final milestone and not run on past it. */\n endDate?: string | null;\n /** Maps `Milestone.phase` keys to the human-readable phase label that\n * appears under the bracket — e.g. `{ qa: 'QA & Sample' }`. Phases\n * without an entry fall back to the phase key itself. */\n phaseLabels?: Record<string, string>;\n /**\n * `'card'` (the default) is the titled card: heading, meta line, two label\n * lanes with `×N` pills, the pending column, a compressed axis with break\n * glyphs. `'rail'` is the bar alone — no card, no heading, no label under\n * any dot: every milestone is a dot with a popover, a revision carries its\n * `caption`, the edge captions flank the rail, nothing is cut (idle\n * stretches are drawn short rather than notched), and what has not happened\n * is one dashed cap past the end of the axis. For a window whose stepper\n * above the bar already names the stages, so the bar has only to place them.\n */\n variant?: 'card' | 'rail';\n /**\n * What the two ends of the rail are called — `{ start: 'Start', end:\n * 'Ready' }`. `start` defaults to `Start · <date>`; `end` has no default.\n * The `card` variant draws them inside the stage, the `rail` variant beside\n * it, on the rail's own row.\n */\n edgeCaptions?: { start?: ReactNode; end?: ReactNode };\n /**\n * Milestones to light, by key: one soft band from the leftmost to the\n * rightmost and every dot inside it, or a ring around a single one. A key\n * with no dated milestone lights nothing — except the last undated one,\n * which the `rail` variant draws as its cap. `null` lights nothing.\n */\n highlightKeys?: string[] | null;\n /** The milestone under the pointer or the focus, by key, and `null` when\n * there is none. The other half of `highlightKeys`. */\n onHoverChange?: (key: string | null) => void;\n}\n\n/**\n * A DFM revision is a step in a conversation; a completion, a shipment or a test\n * is the fact the reader opened the card for.\n *\n * `TimelineTrack` reads this one number twice — for the lane a label claims, and\n * for whether the dot is an ordinary one that may fold into a `×N` pill. Four\n * revisions inside a fortnight used to claim every lane by being earlier than\n * the two milestones that settled anything; now they collapse to `DFM ×4` and\n * the two milestones keep their labels.\n */\nconst milestonePriority = (kind: MilestoneKind | undefined) => (kind === 'dfm' ? 1 : 0);\n\n// ─── Component ───────────────────────────────────────────────────────────────\n\n/**\n * Static date-axis bar showing a sequence of milestones along a single line.\n *\n * A thin domain wrapper over `TimelineTrack`: this component knows what a\n * milestone is — which kinds exist, which of them settle something, what a phase\n * means, how the window is chosen — and the track knows how to draw a time axis.\n * The production-progress scrubber is the same track with a thumb and a\n * different label strategy, which is what makes the two cards look and move\n * alike rather than merely similar.\n *\n * - No scrubber / playback / interpolation — milestones do not move.\n * - A milestone with no date gets no position, because the only position\n * available would be a date the record does not have. It is listed as pending\n * beside the bar instead, and takes no part in the range, the fill, the\n * lead-time summary or a phase bracket.\n * - The axis is piecewise linear: each stretch between two dated milestones gets\n * at least 48 px, so a week between two dates is still two dates, and at most\n * 30% of the track, so ten idle months cannot own the bar and squeeze every\n * real date into the first sixth of it. A stretch the ceiling cut carries a\n * break glyph saying how many days it hides.\n * - Labels are packed into two lanes by their MEASURED width, and a run of\n * same-kind revisions folds into one `×N` pill whose members keep their dots.\n * - Milestones sharing a `phase` (2+ members) get a bracket marking parallel\n * work. The filled portion of the bar never runs past today.\n *\n * Product-agnostic: it takes generic `Milestone` data as props. Map your\n * domain records to the `Milestone` shape in a thin wrapper at the call site.\n */\nexport default function MilestoneTimeline({\n title, heading, subject, milestones, summary, endDate, phaseLabels,\n variant = 'card', edgeCaptions, highlightKeys = null, onHoverChange,\n}: MilestoneTimelineProps) {\n // Captured once at mount so render stays idempotent — day-resolution markers\n // don't care that \"today\" doesn't tick while the view is open.\n const [today] = useState(() => Date.now());\n\n // Two populations, and they are not the same kind of thing. A dated milestone\n // is a coordinate; an undated one is a fact about what has NOT happened, and\n // putting it on the axis states a date the record never held.\n const dated: (Milestone & { ms: number })[] = [];\n const pending: TimelineTrackPending[] = [];\n for (const m of milestones) {\n const ms = toDayMs(m.date ?? null);\n if (ms === null) pending.push({ key: m.key, label: m.label, kind: m.kind });\n else dated.push({ ...m, ms });\n }\n // Chronological; `sort` is stable, so a same-day pair keeps the caller's order.\n dated.sort((a, b) => a.ms - b.ms);\n\n // Date range. The caller can pin the right edge explicitly via `endDate`.\n // Otherwise we fall back to the latest dated milestone, padding to today only\n // when nothing's reached.\n const explicitEnd = toDayMs(endDate ?? null);\n let startMs: number;\n let endMs: number;\n if (dated.length === 0) {\n // Nothing reached yet — show a 30-day window ending at the explicit end (or\n // today), so the axis is still a real axis with nothing on it.\n endMs = explicitEnd ?? today;\n startMs = endMs - 30 * DAY_MS;\n } else {\n startMs = dated[0].ms;\n endMs = explicitEnd ?? dated[dated.length - 1].ms;\n if (endMs - startMs < DAY_MS) endMs = startMs + DAY_MS;\n }\n\n // The card's facts, in the order a reader scans them: when it started, how\n // long it has run, and how far through the programme it is. Caller-provided\n // `summary` replaces the duration so a more meaningful sentence can take its\n // place; the other two are derived and never wrong.\n const totalLeadDays = dated.length > 0 ? Math.max(0, Math.round((endMs - startMs) / DAY_MS)) : 0;\n const duration = summary\n ?? (totalLeadDays > 0 ? `${totalLeadDays.toLocaleString()} day${totalLeadDays === 1 ? '' : 's'}` : undefined);\n const meta = [\n dated.length > 0 ? `started ${fmtSliderDate(dated[0].ms)}` : undefined,\n duration,\n // Only where something HAS not happened: \"7 of 7 milestones\" is a count of\n // nothing, and the reader can see the dots.\n pending.length > 0 ? `${dated.length} of ${milestones.length} milestones` : undefined,\n ];\n\n const items: TimelineTrackItem[] = dated.map((m) => ({\n key: m.key,\n ms: m.ms,\n kind: m.kind,\n label: m.label,\n detail: m.detail,\n preview: m.preview,\n glyph: m.glyph,\n onClick: m.onClick,\n onOpen: m.onOpen,\n priority: milestonePriority(m.kind),\n caption: m.caption,\n provisional: m.provisional,\n }));\n\n // A phase only renders a bracket when it has 2+ members — a single-member\n // \"phase\" would just be a noise glyph under the bar with no parallel work to\n // communicate.\n const groups: Record<string, number[]> = {};\n for (const m of dated) {\n if (!m.phase) continue;\n (groups[m.phase] = groups[m.phase] || []).push(m.ms);\n }\n const phases: TimelineTrackPhase[] = Object.entries(groups)\n .filter(([, ms]) => ms.length >= 2)\n .map(([key, ms]) => ({\n key,\n label: phaseLabels?.[key] ?? key,\n minMs: Math.min(...ms),\n maxMs: Math.max(...ms),\n }));\n\n const rail = variant === 'rail';\n const track = (\n <div className=\"select-none\">\n <TimelineTrack\n axis={rail ? 'spread' : 'compressed'}\n labels={rail ? 'none' : 'lanes'}\n items={items}\n pending={pending}\n phases={phases}\n startMs={startMs}\n endMs={endMs}\n todayMs={today}\n edgeCaptions={edgeCaptions}\n highlightKeys={highlightKeys}\n onHoverChange={onHoverChange}\n ariaLabel={`${title} milestones`}\n />\n </div>\n );\n\n // The rail variant is the track and nothing else: the window around it has\n // already said what the bar is about, so a second heading would say it twice.\n if (rail) {\n return <div className=\"shrink-0\" data-timeline-variant=\"rail\">{track}</div>;\n }\n\n return (\n <div className=\"shrink-0\">\n <TimelineCard\n icon={<TimelineMilestoneIcon />}\n heading={heading ?? title}\n subject={subject}\n meta={meta}\n >\n {track}\n </TimelineCard>\n </div>\n );\n}\n","import { useEffect, useRef, useState, type ReactNode } from 'react';\nimport { DAY_MS, toDayMs, fmtSliderDate } from './timelineDates';\nimport TimelineCard from './TimelineCard';\nimport { TimelineGlyph, TimelineProgressIcon } from './timelineGlyphs';\nimport TimelineTrack, {\n type TimelineMarker, type TimelineMarkerKind, type TimelineScrubProgress,\n type TimelineTrackEndMark, type TimelineTrackItem, type TimelineTrackPlayback, type TimelineTrackProps,\n} from './TimelineTrack';\n\n/**\n * The marker types live with the track that draws them, so the milestone card\n * and this one cannot end up with two shapes for one dot. Re-exported here\n * because this is where consumers have always imported them from.\n */\nexport type { TimelineMarker, TimelineMarkerKind };\n\n// ─── Constants & helpers ────────────────────────────────────────────────────\n\n/** Statuses where the PO has moved past active production. Used to decide\n * whether the timeline's right edge should extend to \"today\" (still active)\n * or stop at est-completion / latest report (already shipped / completed). */\nexport const POST_PRODUCTION_STATUSES: ReadonlySet<string> = new Set([\n 'finished', 'partial_shipped', 'shipped', 'completed', 'cancelled',\n]);\n\n/** Ordered stage breakdown used by `calcOverall`. The first four contribute\n * weighted % progress; finished_goods and stock are reported but excluded\n * from the headline % (they're outcomes, not in-flight progress). */\nexport const STAGES = [\n { key: 'casting', label: 'Casting', weight: 0.20 },\n { key: 'cnc', label: 'CNC', weight: 0.20 },\n { key: 'painting', label: 'Painting', weight: 0.50 },\n { key: 'packing', label: 'Packing', weight: 0.10 },\n { key: 'finished_goods', label: 'FG', weight: 0 },\n { key: 'stock_qty', label: 'Stock', weight: 0 },\n] as const;\n\nexport interface ProgressItem {\n id: string;\n part_number: string;\n description: string;\n order_qty: number;\n casting: number;\n cnc: number;\n painting: number;\n packing: number;\n finished_goods: number;\n stock_qty: number;\n}\n\nexport function calcOverall(item: ProgressItem): number {\n if (item.order_qty <= 0) return 0;\n let weighted = 0;\n for (const s of STAGES) {\n if (s.weight > 0) {\n const stagePct = Math.min((item[s.key] || 0) / item.order_qty, 1);\n weighted += stagePct * s.weight;\n }\n }\n return weighted * 100;\n}\n\n/** A production-progress report as consumed by the timeline. This is the\n * structural subset of the `ProductionProgress` domain type that the hook\n * actually reads — real reports satisfy it, and so do the synthetic\n * zero/interpolated anchors the hook builds internally. */\nexport interface TimelineReport {\n id: string;\n progress_number: string;\n date: string;\n est_completion_date?: string | null;\n items?: ProgressItem[];\n created_by_name?: string;\n notes?: string;\n /**\n * Rich content for this report's hover/focus popover — the stage row it\n * filed, who filed it, the note attached to it. The card forwards it to the\n * dot exactly as a milestone or a marker forwards its own, so a report is not\n * the one mark on the rail that cannot show its document.\n *\n * Kit-only: nothing in the hook reads it, and the synthetic anchors it builds\n * carry none. The popover has ALREADY drawn the report's `progress_number`\n * and its date line above whatever this renders, so a preview that repeats\n * them says them twice. It wins over `renderReportPreview` when both exist.\n */\n preview?: ReactNode;\n}\n\nexport function calcReportOverall(report: Pick<TimelineReport, 'items'> | null | undefined): number {\n const items = report?.items ?? [];\n if (items.length === 0) return 0;\n return items.reduce((sum, item) => sum + calcOverall(item), 0) / items.length;\n}\n\n// ─── State hook ─────────────────────────────────────────────────────────────\n\nexport interface UseProductionTimelineOpts {\n /** Progress reports for this PO, sorted DESC by date (newest first). */\n reports: TimelineReport[];\n /** PO production start date (ISO YYYY-MM-DD or full ISO) — left edge of bar. */\n poProductionStartDate: string | null | undefined;\n /** PO est completion date — right edge candidate. */\n poEstCompletionDate: string | null | undefined;\n /** PO status — when post-production we cap the right edge at est / latest\n * report; otherwise we extend to \"today\" so the slider can reach now. */\n poStatus: string | null | undefined;\n /** PO number — used as a stable key for the synthetic zero anchor only. */\n poNumber?: string;\n /** Optional. The id of the report the user is \"on\" right now. The slider\n * initially sits on this report's date and Play stops there too. When\n * omitted, the slider initial position is the latest report's date and\n * Play runs all the way to the right edge of the visible range. */\n currentReportId?: string;\n /** ISO date string for the report identified by `currentReportId`. We take\n * this as a separate input rather than digging into `reports` because the\n * PP detail page may have the current report fetched independently. */\n currentReportDate?: string | null;\n /** Optional override for what playback presses do. Default: rewind to\n * startMs and walk forward at 0.5 s per timeline-day. */\n msPerDayOfPlayback?: number;\n /** Additional non-progress events to mark on the bar (e.g. goods receipts).\n * Markers are decorative — they DON'T affect interpolation, the displayed\n * snapshot, or playback. They render as dots in their own color so the\n * user can correlate \"PP report X happened the same week as shipment Y\". */\n markers?: TimelineMarker[];\n}\n\nexport interface ProductionTimelineSnapshot {\n // Range\n startMs: number;\n endMs: number;\n /** Total lead time in days (max(1, endMs-startMs in days)). */\n totalLeadDays: number;\n\n // Slider\n scrubMs: number;\n /** Set the slider position (clamped only at render time, not here, so the\n * caller can drag past the edges briefly). */\n setScrubMs: (ms: number) => void;\n /** Reset the slider to the date of the report identified by\n * `currentReportId` (if any). Also stops playback. */\n resetToCurrent: () => void;\n /** True when the slider is on a date other than the current report's date. */\n scrubbedAway: boolean;\n\n // Anchors + computed displayed report\n beforeAnchor: TimelineReport | null;\n nextAfter: TimelineReport | null;\n displayed: TimelineReport | null;\n prevReport: TimelineReport | null;\n /** Quick lookup: part_number -> the prevReport's item with that PN. Used\n * by the items table to render delta bars. */\n prevByPN: Record<string, ProgressItem>;\n /** True when the slider is strictly between two real reports (so the\n * displayed values are interpolated estimates rather than facts). */\n isInterpolated: boolean;\n\n // Playback\n playing: boolean;\n startPlay: () => void;\n stopPlay: () => void;\n\n // Pass-through (so the component doesn't have to re-thread these)\n reports: TimelineReport[];\n /** Decorative event dots (shipments etc.) — not part of interpolation. */\n markers: TimelineMarker[];\n poNumber: string;\n /** The id of the \"current\" report (if any) so the component can label\n * the \"Back to PP#XXX\" affordance. */\n currentReportId?: string;\n /** Convenience: progress_number of the current report, looked up in the\n * reports list. */\n currentReportProgressNumber?: string;\n /** The PO's estimated completion as epoch ms, or null when it has none. The\n * rail variant draws it as the hollow mark on the window's right edge when\n * it is still ahead; the card states it in the meta line. */\n estCompletionMs: number | null;\n}\n\n/** Owns all the state for a Production Timeline: scrub position, playback,\n * hover, plus the derived \"displayed\" snapshot (interpolated or not).\n *\n * Why a hook (and not a component-with-render-prop): the PP detail page\n * renders an items table that depends on `displayed.items` + `prevByPN`,\n * AND it renders the timeline bar. Both views need access to the same live\n * state. A hook gives the parent direct access; a render-prop would force\n * awkward inversion.\n *\n * NOTE — `isInterpolated`, the lerped `displayed` snapshot it produces, and\n * the continuous `startPlay` sweep are no longer reachable from this package.\n * `ProductionTimeline` moves the slider only to dates a report was actually\n * filed on, so the anchors are always a report and never a pair straddling\n * one, and playback steps stop to stop. They stay exported and working for a\n * caller that drives the hook itself and wants an estimate for a day in\n * between; nothing the kit renders asks for one. */\nexport function useProductionTimeline(opts: UseProductionTimelineOpts): ProductionTimelineSnapshot {\n const {\n reports,\n poProductionStartDate,\n poEstCompletionDate,\n poStatus,\n poNumber = '',\n currentReportId,\n currentReportDate,\n msPerDayOfPlayback = 500,\n markers = [],\n } = opts;\n\n // Slider position. null until first effect runs; render uses fallback.\n const [scrubMs, setScrubMs] = useState<number | null>(null);\n\n // Reset slider whenever the \"current\" report identity changes — e.g. user\n // navigated by clicking a dot. We DON'T depend on currentReportDate alone\n // because that would re-snap on every refetch (autosave, polling, etc.).\n useEffect(() => {\n if (currentReportDate) {\n // eslint-disable-next-line react-hooks/set-state-in-effect -- syncing local scrubMs from currentReportDate/reports when the current-report identity changes; deriving in render would drop in-flight drag/playback edits\n setScrubMs(new Date(currentReportDate).getTime());\n } else if (reports.length > 0) {\n // No current report → start the slider on the latest known data point.\n setScrubMs(new Date(reports[0].date).getTime());\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [currentReportId]);\n\n // Playback state. rAF id lives in a ref so we can cancel cleanly.\n const [playing, setPlaying] = useState(false);\n const playRafRef = useRef<number | null>(null);\n const stopPlay = () => {\n if (playRafRef.current != null) {\n cancelAnimationFrame(playRafRef.current);\n playRafRef.current = null;\n }\n setPlaying(false);\n };\n // Halt on unmount and on currentReport change (otherwise the rAF would\n // keep ticking against a now-stale endMs / scrubMs reference).\n useEffect(() => () => stopPlay(), []);\n useEffect(() => {\n // eslint-disable-next-line react-hooks/set-state-in-effect -- intentionally halting playback (setPlaying(false)) when the current-report identity changes so the rAF loop stops ticking against a stale endMs/scrubMs\n stopPlay();\n }, [currentReportId]);\n\n // ─── Range computation ────────────────────────────────────────────────\n const reportTimes = reports\n .map(r => toDayMs(r.date))\n .filter((t): t is number => t != null);\n // eslint-disable-next-line react-hooks/purity -- render-time value used only for display layout: \"today\" fallback for the empty-reports timeline range\n const earliestReport = reportTimes.length ? Math.min(...reportTimes) : Date.now();\n // eslint-disable-next-line react-hooks/purity -- render-time value used only for display layout: \"today\" fallback for the empty-reports timeline range\n const latestReport = reportTimes.length ? Math.max(...reportTimes) : Date.now();\n const startMs = toDayMs(poProductionStartDate ?? null) ?? earliestReport;\n const estComplete = toDayMs(poEstCompletionDate ?? null) ?? 0;\n const isPostProd = POST_PRODUCTION_STATUSES.has((poStatus || '').toLowerCase());\n // Latest marker date — pulls in shipments etc. so a late GRN doesn't fall\n // off the right edge of the visible range.\n const latestMarker = markers.reduce((acc, m) => {\n const t = toDayMs(m.date);\n return t != null && t > acc ? t : acc;\n }, 0);\n const endMs = (() => {\n const candidates = [estComplete, latestReport, latestMarker, startMs + DAY_MS];\n // eslint-disable-next-line react-hooks/purity -- render-time value used only for display layout: extends the timeline's right edge to \"today\" for still-active POs\n if (!isPostProd) candidates.push(Date.now());\n return Math.max(...candidates);\n })();\n const totalLeadDays = Math.max(1, Math.round((endMs - startMs) / DAY_MS));\n\n // ─── Effective scrub (clamped) ────────────────────────────────────────\n const fallback = toDayMs(currentReportDate ?? null) ?? latestReport ?? startMs;\n const effectiveScrub = Math.min(Math.max(scrubMs ?? fallback, startMs), endMs);\n\n // ─── Anchors for interpolation ────────────────────────────────────────\n const realBefore = reports.find(r => {\n const t = toDayMs(r.date);\n return t != null && t <= effectiveScrub;\n }) ?? null;\n let nextAfter: TimelineReport | null = null;\n for (let i = reports.length - 1; i >= 0; i--) {\n const t = toDayMs(reports[i].date);\n if (t != null && t > effectiveScrub) { nextAfter = reports[i]; break; }\n }\n\n // Synthetic zero-state anchor at production_start_date so the slider has\n // meaningful data even before the first real report exists.\n const zeroAnchor = (() => {\n if (realBefore || !nextAfter || reports.length === 0) return null;\n const earliest = reports[reports.length - 1]; // DESC → last is earliest\n const zeroItems: ProgressItem[] = (earliest.items ?? []).map((it, i) => ({\n id: `zero-${it.part_number}-${i}`,\n part_number: it.part_number,\n description: it.description ?? '',\n order_qty: Number(it.order_qty || 0),\n casting: 0, cnc: 0, painting: 0, packing: 0,\n finished_goods: 0, stock_qty: 0,\n }));\n return {\n id: `zero-${poNumber}`,\n progress_number: 'Start',\n date: poProductionStartDate || new Date(startMs).toISOString().slice(0, 10),\n items: zeroItems,\n est_completion_date: poEstCompletionDate ?? null,\n created_by_name: '',\n notes: '',\n };\n })();\n\n const beforeAnchor = realBefore ?? zeroAnchor;\n const beforeMs = realBefore\n ? toDayMs(realBefore.date)\n : (zeroAnchor ? startMs : null);\n const nextMs = nextAfter ? toDayMs(nextAfter.date) : null;\n\n const isInterpolated = !!(\n beforeAnchor && nextAfter\n && beforeMs != null && nextMs != null\n && effectiveScrub > beforeMs && effectiveScrub < nextMs\n );\n\n // ─── Build the displayed snapshot ─────────────────────────────────────\n let displayed: TimelineReport | null;\n let prevReport: TimelineReport | null;\n if (isInterpolated && beforeMs != null && nextMs != null) {\n const ratio = (effectiveScrub - beforeMs) / Math.max(nextMs - beforeMs, 1);\n const lerp = (a: number, b: number) => Math.round(a + (b - a) * ratio);\n const beforeByPN: Record<string, Partial<ProgressItem>> = {};\n for (const it of beforeAnchor?.items ?? []) beforeByPN[it.part_number] = it;\n const afterByPN: Record<string, Partial<ProgressItem>> = {};\n for (const it of nextAfter?.items ?? []) afterByPN[it.part_number] = it;\n const allPNs = Array.from(new Set([\n ...Object.keys(beforeByPN), ...Object.keys(afterByPN),\n ]));\n const items: ProgressItem[] = allPNs.map((pn, i) => {\n const a = beforeByPN[pn] ?? {};\n const b = afterByPN[pn] ?? {};\n const num = (v: number | undefined) => Number(v) || 0;\n return {\n id: `interp-${pn}-${i}`,\n part_number: pn,\n description: a.description ?? b.description ?? '',\n // order_qty is the build target — not interpolated.\n order_qty: num(a.order_qty ?? b.order_qty ?? 0),\n casting: lerp(num(a.casting), num(b.casting)),\n cnc: lerp(num(a.cnc), num(b.cnc)),\n painting: lerp(num(a.painting), num(b.painting)),\n packing: lerp(num(a.packing), num(b.packing)),\n finished_goods: lerp(num(a.finished_goods), num(b.finished_goods)),\n stock_qty: lerp(num(a.stock_qty), num(b.stock_qty)),\n };\n });\n const aEst = toDayMs(beforeAnchor?.est_completion_date);\n const bEst = toDayMs(nextAfter?.est_completion_date);\n let estCompletion: string | null;\n if (aEst != null && bEst != null) {\n estCompletion = new Date(Math.round(aEst + (bEst - aEst) * ratio)).toISOString().slice(0, 10);\n } else {\n estCompletion = beforeAnchor?.est_completion_date || nextAfter?.est_completion_date || null;\n }\n displayed = {\n id: `interp-${effectiveScrub}`,\n progress_number: 'Estimated',\n date: new Date(effectiveScrub).toISOString().slice(0, 10),\n created_by_name: '',\n est_completion_date: estCompletion,\n items,\n notes: '',\n };\n prevReport = beforeAnchor;\n } else {\n displayed = beforeAnchor ?? reports[reports.length - 1] ?? null;\n if (displayed) {\n const idx = reports.findIndex(r => r.id === displayed!.id);\n prevReport = idx >= 0 && idx < reports.length - 1 ? reports[idx + 1] : null;\n } else {\n prevReport = null;\n }\n }\n\n const prevByPN: Record<string, ProgressItem> = {};\n for (const pi of prevReport?.items ?? []) {\n prevByPN[pi.part_number] = pi;\n }\n\n const scrubbedAway = !!(currentReportId && displayed?.id !== currentReportId);\n\n // ─── Playback ─────────────────────────────────────────────────────────\n // Play stops at the date of the \"current\" report (when one is set);\n // otherwise it runs to the right edge of the visible range. The natural\n // PP-detail use is \"show me the buildup that LED to this report\" — playing\n // past it into estimated-future days isn't what the user is asking for.\n const playStopMs = currentReportId\n ? Math.min(toDayMs(currentReportDate ?? null) ?? endMs, endMs)\n : endMs;\n\n const startPlay = () => {\n if (playing) { stopPlay(); return; }\n if (playStopMs <= startMs) { setScrubMs(playStopMs); return; }\n setPlaying(true);\n setScrubMs(startMs);\n let lastTime = performance.now();\n let cur = startMs;\n const step = (now: number) => {\n const dt = now - lastTime;\n lastTime = now;\n cur = cur + (dt / msPerDayOfPlayback) * DAY_MS;\n if (cur >= playStopMs) {\n setScrubMs(playStopMs);\n playRafRef.current = null;\n setPlaying(false);\n return;\n }\n setScrubMs(cur);\n playRafRef.current = requestAnimationFrame(step);\n };\n playRafRef.current = requestAnimationFrame(step);\n };\n\n const resetToCurrent = () => {\n stopPlay();\n if (currentReportDate) setScrubMs(new Date(currentReportDate).getTime());\n };\n\n // ─── Lookup the current report's progress_number for \"Back to PP#XXX\" ─\n const currentReportProgressNumber = currentReportId\n ? reports.find(r => r.id === currentReportId)?.progress_number\n : undefined;\n\n return {\n startMs,\n endMs,\n totalLeadDays,\n scrubMs: effectiveScrub,\n setScrubMs: (ms: number) => { stopPlay(); setScrubMs(ms); },\n resetToCurrent,\n scrubbedAway,\n beforeAnchor,\n nextAfter,\n displayed,\n prevReport,\n prevByPN,\n isInterpolated,\n playing,\n startPlay,\n stopPlay,\n reports,\n markers,\n poNumber,\n currentReportId,\n currentReportProgressNumber,\n estCompletionMs: toDayMs(poEstCompletionDate ?? null),\n };\n}\n\n// ─── Internal: the scrubber, drawn on the shared track ──────────────────────\n\n/** Production timeline scrubber bar.\n *\n * A thin arrangement of `TimelineTrack`: the track owns the axis, the rail and\n * its fill, the date ruler, the dots, the thumb, the tooltips and the keyboard\n * contract, and this knows what the dots MEAN — a progress report, a shipment,\n * a QC inspection. The mould milestone card is the same track with lane labels\n * instead of a thumb, which is what keeps the two bars one picture rather than\n * two that drifted.\n *\n * Reports are `kind: 'report'` marks (an accent ring); markers keep their own\n * kinds and shapes. Clicking a dot both moves the thumb and navigates, exactly\n * as it did when this drew its own bar. */\nfunction TimelineScrubber({\n startMs, endMs, reports, markers, valueMs, activeId,\n onChange, onPickReport, onOpenReport, onOpenMarker, onDragStart, renderReportPreview,\n reportLabel, playback, edgeCaptions, bare = false, endMark = null,\n}: {\n startMs: number;\n endMs: number;\n edgeCaptions?: TimelineTrackProps['edgeCaptions'];\n /** The rail variant: no label under the active report, the 48 px floor\n * without the cut, captions flanking the rail. */\n bare?: boolean;\n /** The estimated completion, drawn on the right edge of a bare rail. */\n endMark?: TimelineTrackEndMark | null;\n reports: TimelineReport[];\n markers: TimelineMarker[];\n /** What a report is called on the bar — see `ProductionTimelineProps`. The\n * track puts the mark's label in the caption, the popover header, the dot's\n * accessible name and its `title`, so one function reaches all four. */\n reportLabel: (report: TimelineReport) => string;\n valueMs: number;\n /** Passed straight to the track, which owns the travel between two reports. */\n playback?: TimelineTrackPlayback;\n activeId: string;\n onChange: (ms: number) => void;\n onPickReport: (id: string) => void;\n onOpenReport?: (id: string) => void;\n onOpenMarker?: (marker: TimelineMarker) => void;\n onDragStart?: () => void;\n renderReportPreview?: (report: TimelineReport) => ReactNode;\n}) {\n const dated = reports\n .map(r => ({ report: r, ms: new Date(r.date).getTime() }))\n .filter(({ ms }) => Number.isFinite(ms))\n .sort((a, b) => a.ms - b.ms);\n const items: TimelineTrackItem[] = dated.map(({ report, ms }) => ({\n key: report.id,\n ms,\n kind: 'report',\n label: reportLabel(report),\n // The report's own preview wins. `renderReportPreview` is the convenience\n // for a caller whose reports come straight off an API and cannot each carry\n // one, not an override of a preview somebody attached deliberately.\n preview: report.preview ?? renderReportPreview?.(report),\n onOpen: onOpenReport ? () => onOpenReport(report.id) : undefined,\n }));\n const msById = new Map(dated.map(({ report, ms }) => [report.id, ms]));\n // The only dates the thumb may rest on. A day between two reports holds no\n // snapshot anybody filed, so a thumb that stopped there would be showing an\n // estimate dressed as a fact.\n const stops = dated.map(({ ms }) => ms);\n /** The report a value stands for — every stop IS a report, so this is a\n * lookup rather than a search for the one before. */\n const reportAt = (ms: number) => dated.find((entry) => entry.ms === ms)?.report;\n const withOpen: TimelineMarker[] = onOpenMarker\n ? markers.map((marker) => ({ ...marker, onOpen: onOpenMarker }))\n : markers;\n\n return (\n <div className=\"select-none\">\n <TimelineTrack\n // The card keeps time linear: a supplier's reports arrive weekly and a\n // week is not an idle stretch to hide. The bare rail spreads instead —\n // every stretch at least 48 px and nothing cut — because with no label\n // lane to say which dot is which, two reports drawn as one are two\n // reports nobody can tell apart.\n axis={bare ? 'spread' : 'linear'}\n labels={bare ? 'none' : 'active'}\n endMark={bare ? endMark : null}\n items={items}\n markers={withOpen}\n startMs={startMs}\n endMs={endMs}\n activeKey={activeId}\n onActivate={(key) => {\n const ms = msById.get(key);\n if (ms != null) onChange(ms);\n onPickReport(key);\n }}\n playback={playback}\n edgeCaptions={edgeCaptions}\n thumb={{\n valueMs,\n onChange,\n onDragStart,\n stops,\n ariaLabel: 'Scrub the production timeline',\n valueText: (ms) => {\n const report = reportAt(ms);\n return report ? `${reportLabel(report)} · ${fmtSliderDate(ms)}` : fmtSliderDate(ms);\n },\n }}\n // The window's ends are the start anchor's caption and, at the right,\n // whatever the caller chose to say. The accessible name states both\n // dates for a reader who has neither the ruler nor the caption.\n ariaLabel={\n `Production reports and events, ${fmtSliderDate(startMs)} to ${fmtSliderDate(endMs)}`\n }\n />\n </div>\n );\n}\n\n// ─── Public component ────────────────────────────────────────────────────\n\nexport interface ProductionTimelineProps {\n /** State from `useProductionTimeline`. Lifting state into the parent lets\n * PP detail's items table read the same `displayed` snapshot the bar is\n * currently rendering. */\n snapshot: ProductionTimelineSnapshot;\n /** Called when the user clicks a report dot. Caller decides what\n * \"navigate\" means in their context (open a new window, swap an in-place\n * detail, etc.). */\n onPickReport: (reportId: string) => void;\n /**\n * Opens the report DOCUMENT, as opposed to selecting it on the bar. When\n * given, the label above the thumb becomes a real button — picking a dot\n * shows you the snapshot, and this is how you get to the report itself.\n */\n onOpenReport?: (reportId: string) => void;\n /** The same for a marker: a goods issue, a QC report. */\n onOpenMarker?: (marker: TimelineMarker) => void;\n /**\n * Builds the popover preview for a report that carries none of its own — the\n * convenience for a caller whose reports arrive straight off an API, where\n * attaching a `TimelineReport.preview` to each of them means copying the list\n * to add one field. A report's own `preview` wins where both are present.\n *\n * As with `preview`, the popover has already drawn the report's number and\n * its date above whatever this returns; repeating either says it twice.\n */\n renderReportPreview?: (report: TimelineReport) => ReactNode;\n /**\n * Where the thumb is between two reports while it is on its way there, keyed\n * by report id, and `null` the moment it is on one.\n *\n * `onPickReport` and the snapshot answer \"which report\", which is all a table\n * needs while the bar is still. It is not all it needs while the bar MOVES:\n * the thumb travels between two reports for up to 1.4 s, and a table that\n * waits for the arrival jumps by a whole report's worth of quantities at the\n * end of a journey the reader watched. Given this, a caller can interpolate\n * its own figures on `t` — the same eased fraction that places the disc, so\n * the numbers and the disc move together — and on a drag, which reports the\n * hand's linear fraction between its two neighbouring reports.\n *\n * Optional, and undefined by default: a consumer that only reads the snapshot\n * needs no change.\n */\n onScrubProgress?: (state: TimelineScrubProgress | null) => void;\n /**\n * What a report is CALLED, everywhere the bar writes its identity: the caption\n * over the thumb, that caption's Open button, the popover header, each dot's\n * accessible name and `title`, the slider's `aria-valuetext` and the\n * \"Showing …\" line. Defaults to the report's own `progress_number`, which is\n * what the admin window wants.\n *\n * It is here for a portal that must not show one. A production-progress report\n * is an internal document with an identity of its own (`PP#10147`), and the\n * customer portal was printing that number in six places on a card about the\n * customer's order — \"the customer portal must not show the standalone\n * production-progress identity anywhere\" (Henry, 2026-09-15, translated).\n * `(report) => fmtSliderDate(new Date(report.date).getTime())` puts the date\n * there instead; `() => 'Progress report'` names the kind and nothing else.\n *\n * It names a report, not a snapshot: the synthetic anchors the hook can build\n * reach it too (`Start`, and `Estimated` for a caller driving the hook itself),\n * so a function that reads only `progress_number` stays right for them.\n */\n reportLabel?: (report: TimelineReport) => string;\n /**\n * The whole text of the button that returns the thumb to the current report,\n * which otherwise reads `Back to <reportLabel(that report)>`.\n *\n * The companion to `reportLabel` for the one place the identity is not a mark\n * on the bar: a portal that has hidden the number needs a way to say where the\n * button goes without naming it — \"Back to latest\".\n */\n resetLabel?: string;\n /** The card's heading, in sentence case. Defaults to \"Production progress\";\n * the PO number is the card's subject, not part of its title. */\n heading?: string;\n /**\n * The captions on the two ends of the axis, passed straight to the track.\n *\n * Omitted, the track writes `Start · <date>` from the window's own left edge\n * and nothing on the right — which is the answer this card wants, and the\n * reason the prop is here at all is a caller who knows something the kit does\n * not (\"Start · PO issued\", a contractual completion date). The rail variant\n * defaults to `Start` on the left and `Est. done` on the right while an\n * estimate is still ahead, because the dates are a hover away there.\n */\n edgeCaptions?: TimelineTrackProps['edgeCaptions'];\n /**\n * `'card'` (the default) is the titled card: heading, window and lead time in\n * the meta line, Play in the corner, the label under the active report, the\n * status line and the legend in the footer. `'rail'` is the bar alone for a\n * window whose own header already says what the order is: no card, no\n * heading, no label under any dot — every report, shipment, inspection and\n * invoice is a dot with a popover — the thumb and its date chip, the\n * estimated completion as a hollow mark on the right edge while it is still\n * ahead, and under the rail one row: Play, the return button when the thumb\n * has been moved, and the \"<report> · date · N% overall · N pc in stock\" line.\n */\n variant?: 'card' | 'rail';\n /**\n * Playback is about to begin — a fresh run or a resume, fired before the\n * thumb moves. For a window that keeps the bar in view while its table shows\n * something else: the customer order window flips its items table from\n * prices to production stages here, so Play is one press wherever the reader\n * was, rather than a hunt for the toggle first.\n */\n onPlayStart?: () => void;\n}\n\n/**\n * Playback, report to report.\n *\n * Three answers, in order. The hook's own `startPlay` sweeps the window\n * continuously, which was right while the bar interpolated between reports and\n * wrong once the thumb only rested on one — most of that sweep was spent on dates\n * holding no snapshot. So the card stepped its own stops with a timer, and the\n * thumb teleported: \"the playback should glide smoothly and continuously, not\n * jump from node to node\" (Henry, 2026-09-14, watching the customer portal).\n * Now the TRACK carries the thumb between two stops, because the distance\n * between them is a distance in pixels of its axis, and this hook keeps only\n * what a card can answer: whether we are playing, where a fresh run starts,\n * and whether the next press is a resume.\n *\n * Pausing keeps the run alive so the track can carry on from the pixel it froze\n * at; stopping ends it, and the press after that rewinds to the first report.\n */\nfunction useReportPlayback(stops: number[], goTo: (ms: number) => void, onStart?: () => void) {\n const [playing, setPlaying] = useState(false);\n /** True while a run exists. A pause is still a run — that is the difference\n * between resuming and starting over. */\n const runningRef = useRef(false);\n\n const stop = () => {\n runningRef.current = false;\n setPlaying(false);\n };\n\n const toggle = () => {\n // Pause: the run survives, and so does the thumb's position, which is where\n // the next press picks it up.\n if (playing) { setPlaying(false); return; }\n if (stops.length === 0) return;\n // The consumer hears first, so a window that shows the thumb's table only\n // in one of its views can switch to it before the first frame moves.\n onStart?.();\n // A fresh run starts at the first report: the question Play answers is \"show\n // me the buildup\", and the buildup starts at the beginning.\n if (!runningRef.current) {\n runningRef.current = true;\n goTo(stops[0]);\n }\n setPlaying(true);\n };\n\n return { playing, toggle, stop };\n}\n\n/** Title row + scrubber bar + Showing/Estimated summary line.\n *\n * Production progress, scrubbable by date. Reports are the supplier's\n * per-part stage quantities on the days they were filed; drag the thumb (or\n * press play) and the hook interpolates between the two nearest reports so\n * the caller's table can show the state of the build on ANY day. Markers\n * are decorative context — shipments and inspections — and never move the\n * displayed snapshot. The same block serves the admin PP window and the\n * customer portal's order window, which feeds it order-level snapshots the\n * backend has already pro-rated to that customer. */\nexport default function ProductionTimeline({\n snapshot, onPickReport, onOpenReport, onOpenMarker, renderReportPreview,\n onScrubProgress, heading = 'Production progress', edgeCaptions,\n reportLabel = (report) => report.progress_number, resetLabel,\n variant = 'card', onPlayStart,\n}: ProductionTimelineProps) {\n const {\n reports, markers, poNumber,\n startMs, endMs, totalLeadDays,\n scrubMs, setScrubMs,\n displayed,\n scrubbedAway, resetToCurrent, currentReportId, currentReportProgressNumber,\n estCompletionMs,\n } = snapshot;\n\n // Ascending, because playback walks forward through the build; the hook takes\n // them newest-first because that is the order the API returns.\n const stops = reports\n .map((report) => toDayMs(report.date))\n .filter((ms): ms is number => ms != null)\n .sort((a, b) => a - b);\n const play = useReportPlayback(stops, setScrubMs, onPlayStart);\n\n // Render the timeline whenever there's at least one event of any kind to\n // show — production reports OR markers (e.g. a PO that has shipments\n // tracked but no progress reports yet).\n if (reports.length === 0 && markers.length === 0) return null;\n\n const shipmentMarkers = markers.filter(m => m.kind === 'shipment');\n const inspectionMarkers = markers.filter(m => m.kind === 'inspection');\n const invoiceMarkers = markers.filter(m => m.kind === 'invoice');\n\n const totalStock = (displayed?.items ?? [])\n .reduce((s, it) => s + (Number(it.stock_qty) || 0), 0);\n const overall = displayed ? calcReportOverall(displayed) : 0;\n\n // The report the reset button goes back to, named the way every other report\n // on the bar is named. `reportLabel` is a function of the REPORT and the\n // snapshot hands out only the number, so look the report up — and keep the\n // number for a current report that is not in the list this bar was given.\n const currentReport = reports.find((report) => report.id === currentReportId);\n const currentLabel = currentReport ? reportLabel(currentReport) : currentReportProgressNumber;\n\n const playButton = (\n /* The glyph follows the state: a triangle while paused, two bars while\n playing. A label that changes over an icon that does not is how a play\n control ends up saying \"Pause ▶\". */\n <button type=\"button\" onClick={play.toggle} aria-pressed={play.playing}\n title={play.playing ? 'Pause' : 'Play the timeline, report by report'}\n className=\"rosh-tl-play text-gray-700 border-gray-300 hover:text-blue-600 hover:border-blue-600\">\n {play.playing\n ? <svg viewBox=\"0 0 10 10\" aria-hidden=\"true\"><path d=\"M2 1.5h2.3v7H2zM5.7 1.5H8v7H5.7z\" /></svg>\n : <svg viewBox=\"0 0 10 10\" aria-hidden=\"true\"><path d=\"M2 1.2 8.4 5 2 8.8z\" /></svg>}\n <span>{play.playing ? 'Pause' : 'Play'}</span>\n </button>\n );\n const resetButton = scrubbedAway && (resetLabel ?? currentLabel) ? (\n <button type=\"button\" onClick={() => { play.stop(); resetToCurrent(); }}\n className=\"text-xs text-blue-600 underline-offset-4 hover:underline font-medium\">\n {resetLabel ?? `Back to ${currentLabel}`}\n </button>\n ) : null;\n /** What the thumb is on, as one line. The rail prints it without \"Showing\":\n * under a bare rail the line IS the caption, not a sentence about one. */\n const statusLine = (showing: boolean) => (\n <p className=\"rosh-tl-status text-gray-800\">\n {displayed ? (\n <>\n {showing && 'Showing '}<b className=\"font-medium\">{reportLabel(displayed)}</b>\n <span className=\"text-gray-500\">\n {' · '}{fmtSliderDate(new Date(displayed.date).getTime())}\n {' · '}{Math.round(overall)}% overall\n {' · '}{totalStock.toLocaleString()} pc in stock\n </span>\n </>\n ) : (\n <span className=\"text-gray-500\">No production report filed yet</span>\n )}\n </p>\n );\n\n if (variant === 'rail') {\n // The estimate is on the bar only while it is still ahead: once it has\n // passed, the window runs to today and the estimate is history the status\n // line under the table already tells.\n const estimateAhead = estCompletionMs != null && estCompletionMs >= endMs && endMs > startMs;\n const endMark: TimelineTrackEndMark | null = estimateAhead\n ? { key: '__estimate__', label: 'Estimated completion', dateText: fmtSliderDate(estCompletionMs) }\n : null;\n return (\n <div className=\"shrink-0\" data-timeline-variant=\"rail\">\n <TimelineScrubber\n bare\n endMark={endMark}\n startMs={startMs}\n endMs={endMs}\n reports={reports}\n markers={markers}\n valueMs={scrubMs}\n activeId={displayed?.id ?? ''}\n onChange={setScrubMs}\n onPickReport={onPickReport}\n onOpenReport={onOpenReport}\n onOpenMarker={onOpenMarker}\n renderReportPreview={renderReportPreview}\n reportLabel={reportLabel}\n edgeCaptions={{\n start: edgeCaptions?.start ?? 'Start',\n end: edgeCaptions?.end ?? (estimateAhead ? 'Est. done' : undefined),\n }}\n onDragStart={play.stop}\n playback={{\n playing: play.playing,\n onArrive: (_key, ms) => setScrubMs(ms),\n onProgress: onScrubProgress,\n onStop: play.stop,\n }}\n />\n <div className=\"rosh-tl-railrow\" data-timeline-part=\"rail-row\">\n {playButton}\n {resetButton}\n {statusLine(false)}\n </div>\n </div>\n );\n }\n\n return (\n <div className=\"shrink-0\">\n <TimelineCard\n icon={<TimelineProgressIcon />}\n heading={heading}\n subject={poNumber}\n // The window and how long it is, as the prototype states them. The\n // counts that used to be here — \"6 reports · 1 shipment\" — are gone:\n // the dots are on the bar and the legend says what each of them is, and\n // the line has to leave room for the control beside it.\n meta={[\n `${fmtSliderDate(startMs)} → ${fmtSliderDate(endMs)}`,\n `${totalLeadDays.toLocaleString()} day${totalLeadDays === 1 ? '' : 's'} lead time`,\n ]}\n actions={\n <>\n {resetButton}\n {playButton}\n </>\n }\n footer={\n <>\n {statusLine(true)}\n {/* Chips, drawn with the track's own glyphs: a legend that keeps its\n own copy of a shape is a legend that can describe a dot the rail\n stopped drawing. */}\n <div className=\"rosh-tl-legend\">\n {reports.length > 0 && (\n <span className=\"border-gray-200 text-gray-500\">\n <i aria-hidden=\"true\" className=\"rosh-tl-glyph is-ring border-blue-600\" />\n Production report\n </span>\n )}\n {shipmentMarkers.length > 0 && (\n <span className=\"border-gray-200 text-gray-500\">\n <i aria-hidden=\"true\" className=\"rosh-tl-glyph is-diamond\"\n style={{ background: 'var(--tl-shipment)', color: 'var(--tl-on-kind)' }}>\n <TimelineGlyph name=\"truck\" />\n </i>\n Shipment\n </span>\n )}\n {inspectionMarkers.length > 0 && (\n <span className=\"border-gray-200 text-gray-500\">\n <i aria-hidden=\"true\" className=\"rosh-tl-glyph is-disc\"\n style={{ background: 'var(--tl-inspection)', color: 'var(--tl-on-kind)' }}>\n <TimelineGlyph name=\"flask\" />\n </i>\n Inspection\n </span>\n )}\n {invoiceMarkers.length > 0 && (\n <span className=\"border-gray-200 text-gray-500\">\n <i aria-hidden=\"true\" className=\"rosh-tl-glyph is-disc\"\n style={{ background: 'var(--tl-invoice)', color: 'var(--tl-on-kind)' }}>\n <TimelineGlyph name=\"receipt\" />\n </i>\n Invoice\n </span>\n )}\n </div>\n </>\n }\n >\n <TimelineScrubber\n startMs={startMs}\n endMs={endMs}\n reports={reports}\n markers={markers}\n valueMs={scrubMs}\n activeId={displayed?.id ?? ''}\n onChange={setScrubMs}\n onPickReport={onPickReport}\n onOpenReport={onOpenReport}\n onOpenMarker={onOpenMarker}\n renderReportPreview={renderReportPreview}\n reportLabel={reportLabel}\n edgeCaptions={edgeCaptions}\n onDragStart={play.stop}\n // Arriving moves the slider and nothing else. `onPickReport` is what a\n // CLICK on a dot means, and in the admin window that swaps the whole\n // detail to another report — a playback that fired it per stop would\n // walk the user through six windows and, by remounting this card,\n // cancel itself on the first of them.\n playback={{\n playing: play.playing,\n onArrive: (_key, ms) => setScrubMs(ms),\n onProgress: onScrubProgress,\n onStop: play.stop,\n }}\n />\n </TimelineCard>\n </div>\n );\n}\n","/**\n * ContainerFillChart — visualises a loading list as one or more shipping\n * containers and their fill percentage. The volume of each line is\n * `quantity * volumePerUnit` unless the consumer supplies the line's volume\n * itself; the chart sizes containers (20ft = 33 m³, 40ft = 67 m³, preferring\n * 20ft when the volume fits within +5%) and draws a fill bar per container\n * slot.\n *\n * Dual-bar mode (instruction vs loaded): when actual quantities exist on the\n * items, each container row layers two bars — blue for instruction volume,\n * green for loaded volume. Whichever is larger is rendered first (background);\n * the smaller one sits on top so both are simultaneously visible.\n *\n * Product-agnostic: this component does NO fetching. The per-unit volume of\n * each item is supplied by the consumer via `getVolume(item)` (typically a\n * lookup into a part-number → volume map the app fetched). When one unit of\n * volume is not one piece — goods packed many pieces to a carton, whose\n * catalogue volume is the carton's — `getInstructionVolume` /\n * `getActualVolume` hand over each line's total instead, and the piece counts\n * in the header stay piece counts. Quantity and\n * \"new\" extraction default to the common `quantity` / `actual_qty` / `_isNew`\n * field names but are overridable so the chart isn't tied to any one shape.\n */\nimport type { CSSProperties } from 'react';\n\nconst C20 = 33; // 20ft container m³\nconst C40 = 67; // 40ft container m³\n\n/** Default item shape — overridable via the accessor props for any other shape. */\nexport interface ContainerFillItem {\n quantity?: number | null;\n actual_qty?: number | null;\n _isNew?: boolean;\n}\n\nexport interface ContainerFillChartProps<T = ContainerFillItem> {\n /**\n * Line items to chart. Each contributes `qty * getVolume(item)` to the total,\n * or what `getInstructionVolume` / `getActualVolume` return for it.\n */\n items: T[];\n /**\n * Per-unit volume (m³) for an item. The lifted app concern — return 0 when\n * unknown. Total volume per item is `quantity * getVolume(item)`. Optional\n * only because a consumer supplying both line-volume accessors below has no\n * use for it; with neither, a chart without it has no volume to show.\n */\n getVolume?: (item: T) => number;\n /**\n * Total volume (m³) of one line on the INSTRUCTION side, replacing\n * `getVolume(item) * instruction qty`. For a line whose volume does not\n * scale with its piece count — accessories shipped hundreds to a carton,\n * where the catalogue volume is one carton's — the consumer does the carton\n * math and returns the result. Return 0 when unknown. The piece counts in\n * the header still come from the quantity accessors.\n */\n getInstructionVolume?: (item: T) => number;\n /**\n * Total volume (m³) of one line on the ACTUAL/loaded side, replacing\n * `getVolume(item) * actual qty` — the counterpart of\n * `getInstructionVolume`. It does not decide whether the loaded layer is\n * drawn: that still follows the actual quantities.\n */\n getActualVolume?: (item: T) => number;\n /**\n * Single-bar quantity source when no actuals are present:\n * - 'instruction' (default): use the instruction quantity.\n * - 'actual': use the actual quantity (falling back to instruction).\n *\n * When actuals exist on at least one item the chart auto-switches to dual-bar\n * mode regardless of `qtyField` — instruction (blue) and loaded (green) are\n * layered into the same bar so both are visible at once.\n */\n qtyField?: 'instruction' | 'actual';\n /** Show the \"new items\" indicator next to the row count. */\n showNewIndicator?: boolean;\n /** Instruction quantity accessor. Defaults to `item.quantity`. */\n getInstructionQty?: (item: T) => number | null | undefined;\n /** Actual/loaded quantity accessor. Defaults to `item.actual_qty`. */\n getActualQty?: (item: T) => number | null | undefined;\n /**\n * Whether an item should count as charted at all. Defaults to \"has a non-empty\n * key\" — i.e. items whose volume source identifies a real part. By default\n * every item is charted; supply this to drop placeholder/empty rows.\n */\n isFilled?: (item: T) => boolean;\n /** Whether an item is newly added (drives `showNewIndicator`). Defaults to `item._isNew`. */\n isNew?: (item: T) => boolean;\n className?: string;\n style?: CSSProperties;\n}\n\nconst toInt = (v: unknown) => (typeof v === 'number' ? v : parseInt(String(v ?? '')) || 0);\n\n/**\n * Container-fill chart for shipping loading lists. Presentational only — pass\n * `getVolume` to inject per-unit volumes (or the line-volume accessors to inject\n * whole-line volumes); the chart owns the container math and the\n * instruction-vs-loaded dual-bar rendering.\n */\nexport default function ContainerFillChart<T = ContainerFillItem>({\n items,\n getVolume,\n getInstructionVolume,\n getActualVolume,\n qtyField = 'instruction',\n showNewIndicator = false,\n getInstructionQty = (item) => (item as ContainerFillItem).quantity,\n getActualQty = (item) => (item as ContainerFillItem).actual_qty,\n isFilled,\n isNew = (item) => Boolean((item as ContainerFillItem)._isNew),\n className,\n style,\n}: ContainerFillChartProps<T>) {\n const filledLines = isFilled ? items.filter(isFilled) : items;\n\n // Instruction quantity always comes from the instruction accessor. Actual\n // quantity comes from the actual accessor (and counts as 0 when missing — the\n // auto-detect uses that to decide whether to draw the second layer).\n const qtyInstr = (l: T) => toInt(getInstructionQty(l));\n const qtyActual = (l: T) => toInt(getActualQty(l));\n\n const hasActual = filledLines.some((l) => getActualQty(l) != null && qtyActual(l) > 0);\n\n // Single-bar fallback: when there are no actuals at all, honor `qtyField` so\n // callers (e.g. a create form) still get an instruction-only chart even if\n // they pass qtyField='actual' at a stage where actuals don't exist yet.\n const qtyOf = (l: T) => {\n if (hasActual) return qtyInstr(l); // dual mode: this branch isn't actually used; we compute both totals separately below\n return qtyField === 'actual' ? (getActualQty(l) ?? getInstructionQty(l) ?? 0) : (getInstructionQty(l) ?? 0);\n };\n const totalQty = filledLines.reduce((s, l) => s + toInt(qtyOf(l)), 0);\n const newCount = filledLines.filter((l) => isNew(l)).length;\n const newQty = filledLines.filter((l) => isNew(l)).reduce((s, l) => s + toInt(qtyOf(l)), 0);\n\n // Per-mode totals.\n const totalQtyInstr = filledLines.reduce((s, l) => s + qtyInstr(l), 0);\n const totalQtyActual = filledLines.reduce((s, l) => s + qtyActual(l), 0);\n const unitVolume = (l: T) => getVolume?.(l) ?? 0;\n const lineVolumeInstr = getInstructionVolume ?? ((l: T) => unitVolume(l) * qtyInstr(l));\n const lineVolumeActual = getActualVolume ?? ((l: T) => unitVolume(l) * qtyActual(l));\n const totalVolumeInstr = filledLines.reduce((s, l) => s + lineVolumeInstr(l), 0);\n const totalVolumeActual = filledLines.reduce((s, l) => s + lineVolumeActual(l), 0);\n\n // The display volume drives container sizing + count. In dual mode we use the\n // larger of the two totals so neither layer gets visually clipped; in single\n // mode we fall back to whichever side has data.\n const totalVolume = hasActual\n ? Math.max(totalVolumeInstr, totalVolumeActual)\n : qtyField === 'actual'\n ? totalVolumeActual || totalVolumeInstr\n : totalVolumeInstr;\n\n // Prefer 20ft when it (the larger of the two volumes) fits within +5%.\n const useType = totalVolume <= C20 * 1.05 ? '20ft' : '40ft';\n const containerCap = useType === '20ft' ? C20 : C40;\n const totalContainers = totalVolume > 0 ? Math.max(1, Math.ceil(totalVolume / containerCap)) : 0;\n\n const totalCap = totalContainers * containerCap;\n const isOptimal = totalVolume > 0 && totalVolume >= totalCap * 0.95 && totalVolume <= totalCap * 1.1;\n\n if (filledLines.length === 0) return null;\n\n // Per-container fill percentages — split totals across N container slots.\n // Returned values can briefly exceed 100 for the last slot if the total\n // volume sits between (n-1)*cap and n*cap; we clamp at the render layer.\n const fillFor = (volume: number, idx: number) =>\n containerCap > 0 ? Math.max(0, Math.min(((volume - idx * containerCap) / containerCap) * 100, 100)) : 0;\n\n return (\n <div className={`mt-2 px-1 space-y-2 ${className ?? ''}`.trim()} style={style}>\n <div className=\"flex items-center justify-between text-xs text-gray-500\">\n <span>\n {filledLines.length} items &middot; {totalQty} pcs\n {hasActual && totalQtyInstr !== totalQtyActual && (\n <span className=\"ml-1 text-gray-400\">({totalQtyInstr} instr / {totalQtyActual} loaded)</span>\n )}\n </span>\n {showNewIndicator && newCount > 0 && (\n <span className=\"flex items-center gap-1 text-green-600\">\n <span className=\"w-1.5 h-1.5 rounded-full bg-green-500\" />\n {newCount} new ({newQty} pcs)\n </span>\n )}\n </div>\n {totalVolume > 0 ? (\n <div className=\"space-y-1.5\">\n {Array.from({ length: totalContainers }).map((_, i) => {\n const instrPct = fillFor(totalVolumeInstr, i);\n const actualPct = fillFor(totalVolumeActual, i);\n // Dual mode: layer the bigger one underneath, smaller one on top (so\n // the smaller bar's color shows in its range and the bigger bar's\n // color shows in the difference range).\n const dual = hasActual;\n const longerPct = Math.max(instrPct, actualPct);\n const shorterPct = Math.min(instrPct, actualPct);\n const longerIsInstr = instrPct >= actualPct;\n const longerColor = dual ? (longerIsInstr ? 'bg-blue-500' : 'bg-green-500') : 'bg-blue-500';\n const shorterColor = dual ? (longerIsInstr ? 'bg-green-500' : 'bg-blue-500') : '';\n return (\n <div key={`bar-${i}`} className=\"flex items-center gap-2\">\n <span className=\"text-[10px] text-gray-400 w-8 shrink-0\">{useType}</span>\n <div className=\"relative flex-1 h-4 bg-gray-100 rounded-full overflow-hidden border border-gray-200\">\n {/* Background = the longer bar */}\n <div className={`absolute inset-y-0 left-0 ${longerColor} transition-all`} style={{ width: `${longerPct}%` }} />\n {/* Foreground (dual mode only) = the shorter bar, layered on top */}\n {dual && shorterPct > 0 && (\n <div className={`absolute inset-y-0 left-0 ${shorterColor} transition-all`} style={{ width: `${shorterPct}%` }} />\n )}\n </div>\n <span className=\"text-[10px] text-gray-500 w-16 text-right\">\n {dual\n ? `${Math.min(totalVolumeActual - i * containerCap, containerCap).toFixed(1)} / ${containerCap} m³`\n : `${Math.min(totalVolumeInstr - i * containerCap, containerCap).toFixed(1)} / ${containerCap} m³`}\n </span>\n </div>\n );\n })}\n <div className=\"flex items-center justify-between text-xs pt-0.5\">\n <span className=\"text-gray-500 inline-flex items-center gap-1\">\n Total:\n {hasActual ? (\n <>\n <span className=\"inline-flex items-center gap-1 text-blue-700\">\n <span className=\"inline-block w-2 h-2 rounded-full bg-blue-500\" />\n {totalVolumeInstr.toFixed(2)} m³ instruction\n </span>\n <span className=\"text-gray-400\">/</span>\n <span className=\"inline-flex items-center gap-1 text-green-700\">\n <span className=\"inline-block w-2 h-2 rounded-full bg-green-500\" />\n {totalVolumeActual.toFixed(2)} m³ loaded\n </span>\n </>\n ) : (\n <b className=\"text-gray-700\">{totalVolume.toFixed(2)} m³</b>\n )}\n </span>\n <span className={`font-medium ${isOptimal ? 'text-green-600' : 'text-gray-500'}`}>\n {isOptimal && '✓ '}\n {totalContainers} × {useType}\n </span>\n </div>\n </div>\n ) : (\n <div className=\"text-xs text-gray-400\">Volume: N/A (no volume data for these part numbers)</div>\n )}\n </div>\n );\n}\n","import type { ReactNode } from 'react';\n\n/**\n * Dependency-free Markdown renderer for help / documentation bodies.\n *\n * Supports the subset used by in-app articles: ATX headings (`##`–`####`),\n * **bold**, *italic*, `inline code`, fenced code blocks, [links](url), bullet\n * and numbered lists (with wrapped continuation lines), GitHub-style pipe\n * **tables**, `>` blockquote **callouts**, `---` rules, paragraphs, and image\n * syntax `![alt](src)` — which renders as a labelled *screenshot placeholder*\n * box (manual images may not exist yet). Unrecognised syntax degrades to plain\n * text, so author-written articles never break the page. No raw HTML is\n * interpreted.\n *\n * Everything here is line- and paragraph-shaped on purpose — there is no\n * nesting, because a regex renderer cannot have any. A body that needs more\n * than this subset (nested lists, task lists, footnotes, autolink literals)\n * wants `react-os-shell/markdown`, which runs a real CommonMark parser behind\n * an optional peer. This one exists so `react-os-shell/ui` can render prose\n * while importing nothing but React — see `src/ui/kit.ts` and the two tests\n * that hold that line.\n */\n\nconst INLINE_RE =\n /!\\[([^\\]]*)\\]\\(([^)]+)\\)|\\[([^\\]]+)\\]\\(([^)]+)\\)|\\*\\*([^*]+)\\*\\*|`([^`]+)`|\\*([^*]+)\\*/g;\n\n/** The full renderer neutralises `javascript:`-class URLs through\n * react-markdown's default urlTransform; this is the same allowlist for the\n * Lite one. A scheme outside the safe set renders the anchor with no href —\n * visible, honest, inert — rather than a clickable script. No scheme at all\n * (relative, anchor, protocol-relative) passes. */\nfunction safeHref(href: string): boolean {\n const scheme = /^[a-zA-Z][a-zA-Z0-9+.-]*:/.exec(href.trim());\n return scheme === null || /^(?:https?|mailto|tel):$/i.test(scheme[0]);\n}\n\nfunction renderInline(text: string): ReactNode[] {\n const out: ReactNode[] = [];\n let last = 0;\n let key = 0;\n let m: RegExpExecArray | null;\n INLINE_RE.lastIndex = 0;\n while ((m = INLINE_RE.exec(text)) !== null) {\n if (m.index > last) out.push(text.slice(last, m.index));\n if (m[1] !== undefined) {\n out.push(\n <span key={key++} className=\"text-gray-400\">\n [{m[1]}]\n </span>,\n );\n } else if (m[3] !== undefined) {\n out.push(\n <a\n key={key++}\n href={safeHref(m[4]) ? m[4] : undefined}\n target=\"_blank\"\n rel=\"noreferrer\"\n className=\"text-blue-600 hover:underline\"\n >\n {m[3]}\n </a>,\n );\n } else if (m[5] !== undefined) {\n out.push(\n <strong key={key++} className=\"font-semibold text-gray-900\">\n {m[5]}\n </strong>,\n );\n } else if (m[6] !== undefined) {\n out.push(\n // bg-gray-200, not bg-gray-100. Both are on the dark-mode allowlist in\n // ui.css, so neither looks wrong in review — but `bg-gray-100` remaps\n // to `--surface`, which is what `bg-white` remaps to as well, and every\n // host that draws this component draws it on a `bg-white` panel\n // (HelpCenter's own `<main>` among them). The chip was therefore the\n // exact colour of the surface behind it in dark mode: present, styled,\n // invisible. `bg-gray-200` is `--surface-raised`, one step up.\n <code\n key={key++}\n className=\"rounded bg-gray-200 px-1 py-0.5 font-mono text-[0.85em] text-gray-800\"\n >\n {m[6]}\n </code>,\n );\n } else if (m[7] !== undefined) {\n out.push(<em key={key++}>{m[7]}</em>);\n }\n last = INLINE_RE.lastIndex;\n }\n if (last < text.length) out.push(text.slice(last));\n return out;\n}\n\nfunction ScreenshotPlaceholder({ alt }: { alt: string }) {\n const label = alt.replace(/^screenshot:\\s*/i, '');\n return (\n <div className=\"my-1 flex items-start gap-2 rounded-lg border border-dashed border-gray-300 bg-gray-50 px-3 py-2.5\">\n <svg\n className=\"mt-0.5 h-4 w-4 shrink-0 text-gray-400\"\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n >\n <path d=\"M3 6a1.5 1.5 0 0 1 1.5-1.5h1.1l.4-.9a1 1 0 0 1 .9-.6h6.2a1 1 0 0 1 .9.6l.4.9h1.1A1.5 1.5 0 0 1 18 6v8.5A1.5 1.5 0 0 1 16.5 16h-13A1.5 1.5 0 0 1 2 14.5V6Zm7.5 1.5a3.25 3.25 0 1 0 0 6.5 3.25 3.25 0 0 0 0-6.5Z\" />\n </svg>\n <span className=\"text-xs text-gray-500\">\n <span className=\"font-medium text-gray-600\">Screenshot — </span>\n {label}\n </span>\n </div>\n );\n}\n\n/** Collect list items, merging wrapped continuation lines into their item. */\nfunction collectItems(lines: string[], itemRe: RegExp): string[] {\n const items: string[] = [];\n for (const line of lines) {\n const m = itemRe.exec(line);\n if (m) {\n items.push(m[1]);\n } else if (items.length) {\n items[items.length - 1] += ' ' + line.trim();\n }\n }\n return items;\n}\n\nconst splitCells = (line: string): string[] =>\n line\n .replace(/^\\s*\\|/, '')\n .replace(/\\|\\s*$/, '')\n .split('|')\n .map(c => c.trim());\n\n/** A pipe table: header row, a `---|---` separator, then body rows. */\nfunction isTable(lines: string[]): boolean {\n return (\n lines.length >= 2 &&\n lines[0].includes('|') &&\n /^\\s*\\|?[\\s:|-]*-[\\s:|-]*\\|?\\s*$/.test(lines[1]) &&\n lines[1].includes('-')\n );\n}\n\nfunction renderTable(lines: string[], key: number): ReactNode {\n const header = splitCells(lines[0]);\n const rows = lines.slice(2).map(splitCells);\n return (\n <div key={key} className=\"my-1 overflow-x-auto rounded-lg border border-gray-200\">\n <table className=\"w-full border-collapse text-sm\">\n <thead>\n <tr className=\"bg-gray-50\">\n {header.map((h, i) => (\n <th\n key={i}\n className=\"border-b border-gray-200 px-3 py-1.5 text-left font-semibold text-gray-700\"\n >\n {renderInline(h)}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {rows.map((row, r) => (\n <tr key={r} className=\"even:bg-gray-50/50\">\n {row.map((c, i) => (\n <td key={i} className=\"border-t border-gray-100 px-3 py-1.5 align-top text-gray-700\">\n {renderInline(c)}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n );\n}\n\nfunction renderBlock(block: string, key: number): ReactNode {\n const lines = block.split('\\n');\n const first = lines[0];\n\n const heading = /^(#{2,4})\\s+(.*)$/.exec(first);\n if (heading && lines.length === 1) {\n const level = heading[1].length;\n const Tag = (`h${level}` as 'h2');\n const cls =\n level === 2\n ? 'mt-2 text-[13px] font-semibold uppercase tracking-wide text-gray-500'\n : level === 3\n ? 'mt-1 text-base font-semibold text-gray-900'\n : 'mt-1 text-sm font-semibold text-gray-900';\n return (\n <Tag key={key} className={cls}>\n {renderInline(heading[2])}\n </Tag>\n );\n }\n\n if (lines.length === 1 && /^---+$/.test(first)) {\n return <hr key={key} className=\"border-gray-200\" />;\n }\n\n if (isTable(lines)) {\n return renderTable(lines, key);\n }\n\n if (/^>\\s?/.test(first)) {\n const text = lines.map(l => l.replace(/^>\\s?/, '')).join(' ');\n return (\n <div\n key={key}\n className=\"my-1 rounded-r-lg border-l-4 border-blue-300 bg-blue-50/60 px-3 py-2 text-gray-700\"\n >\n {renderInline(text)}\n </div>\n );\n }\n\n const img = /^!\\[([^\\]]*)\\]\\(([^)]+)\\)$/.exec(first);\n if (img && lines.length === 1) {\n return <ScreenshotPlaceholder key={key} alt={img[1]} />;\n }\n\n if (/^[-*]\\s+/.test(first)) {\n const items = collectItems(lines, /^[-*]\\s+(.*)$/);\n return (\n <ul key={key} className=\"list-disc space-y-1 pl-5 marker:text-gray-400\">\n {items.map((it, j) => (\n <li key={j}>{renderInline(it)}</li>\n ))}\n </ul>\n );\n }\n\n const ordered = /^(\\d+)\\.\\s+/.exec(first);\n if (ordered) {\n const items = collectItems(lines, /^\\d+\\.\\s+(.*)$/);\n return (\n <ol\n key={key}\n start={Number(ordered[1])}\n className=\"list-decimal space-y-1 pl-5 marker:text-gray-400\"\n >\n {items.map((it, j) => (\n <li key={j} className=\"pl-1\">\n {renderInline(it)}\n </li>\n ))}\n </ol>\n );\n }\n\n return <p key={key}>{renderInline(lines.join(' '))}</p>;\n}\n\n/** A fenced code block: its info string and its lines, delimiters removed. */\ninterface Fence {\n lang: string;\n code: string;\n}\n\n/** A block in source order — a fence, or a paragraph-shaped run of text. */\ntype Block = { fence: Fence } | { text: string };\n\n/** An opening or closing fence: three or more backticks or tildes, indented\n * at most three spaces (CommonMark 4.5). The last capture is the info\n * string — anything after the marker, spaces included (` ```ruby startline=3 `\n * is legal) — which CommonMark forbids on a closer, and that is how the two\n * are told apart without tracking which one we are looking for. One rule is\n * NOT in the regex: a backtick fence's info string may not contain a\n * backtick (that line is prose carrying code spans, not a fence); a tilde\n * fence has no such restriction. The caller checks it, because a regex\n * cannot condition one capture on another. */\nconst FENCE_RE = /^( {0,3})(`{3,}|~{3,})[ \\t]*(.*?)[ \\t]*$/;\n\n/**\n * Split the source into blocks, lifting fences out BEFORE anything is split on\n * blank lines.\n *\n * The order is the whole of the bug this fixes. Splitting on blank lines first\n * tore a fence that contained one into pieces, and every piece fell through to\n * the paragraph branch — which joins its lines with a space. A YAML block came\n * back as a single long line, its opening ``` read as an empty code span and\n * its language tag beginning another, with two bare backticks printed to the\n * reader. Fences are line-shaped, so they have to be found by walking lines.\n */\nfunction splitBlocks(source: string): Block[] {\n const lines = source.replace(/\\r\\n/g, '\\n').split('\\n');\n const blocks: Block[] = [];\n let buf: string[] = [];\n\n /** Paragraph-split whatever plain text has accumulated, in source order. */\n const flush = () => {\n for (const para of buf.join('\\n').split(/\\n{2,}/)) {\n const text = para.replace(/\\s+$/, '');\n if (text.trim() !== '') blocks.push({ text });\n }\n buf = [];\n };\n\n for (let i = 0; i < lines.length; i += 1) {\n const open = FENCE_RE.exec(lines[i]);\n const opens = open !== null && !(open[2][0] === '`' && open[3].includes('`'));\n if (!opens) {\n buf.push(lines[i]);\n continue;\n }\n flush();\n const [, indent, marker, info] = open;\n const code: string[] = [];\n for (i += 1; i < lines.length; i += 1) {\n const close = FENCE_RE.exec(lines[i]);\n const closes =\n close !== null &&\n close[2][0] === marker[0] &&\n close[2].length >= marker.length &&\n close[3] === '';\n if (closes) break;\n // An indented opener's indentation is stripped from the content, per\n // CommonMark — the fence's placement is not part of the code.\n code.push(indent ? lines[i].replace(new RegExp(`^ {0,${indent.length}}`), '') : lines[i]);\n }\n // An unclosed fence runs to the end of the document. That is CommonMark's\n // rule, and it is also the kind one: in a live preview, a half-typed fence\n // shows the rest as code rather than folding it into a paragraph and\n // reflowing the page under the author's cursor.\n //\n // The info string's FIRST word is the language (the rest is host\n // metadata, per convention), and that is what `data-language` carries.\n blocks.push({ fence: { lang: info.split(/[ \\t]/)[0], code: code.join('\\n') } });\n }\n flush();\n return blocks;\n}\n\nfunction renderFence({ lang, code }: Fence, key: number): ReactNode {\n return (\n <pre\n key={key}\n // No syntax highlighting, deliberately: a highlighter costs more bytes\n // than this entire package's UI kit, in a component whose reason to\n // exist is importing nothing. The language is kept as a data attribute\n // so a host that wants highlighting can find these and add it itself.\n data-language={lang || undefined}\n className=\"my-1 overflow-x-auto rounded-lg border border-gray-200 bg-gray-50 p-3 font-mono text-xs text-gray-800\"\n >\n <code>{code}</code>\n </pre>\n );\n}\n\nexport interface MarkdownProps {\n children: string;\n className?: string;\n}\n\nexport default function Markdown({ children, className }: MarkdownProps) {\n return (\n <div className={`space-y-3 text-sm leading-relaxed text-gray-700 ${className ?? ''}`.trim()}>\n {splitBlocks(children ?? '').map((block, i) =>\n 'fence' in block ? renderFence(block.fence, i) : renderBlock(block.text, i),\n )}\n </div>\n );\n}\n","import { useMemo, useState, type ReactNode } from 'react';\nimport Markdown from './Markdown';\nimport { useShellStrings } from './strings';\n\n/**\n * One help article. Generic shape — the consuming portal maps its own\n * help-doc records onto this before passing them in.\n */\nexport interface HelpCenterDoc {\n id: string;\n slug: string;\n title: string;\n body: string;\n /** Grouping key (e.g. `'getting_started'`). */\n category: string;\n /** Group header text (e.g. \"Getting Started\"). */\n category_label: string;\n /** When `false`, a \"Draft\" badge is shown. Omit for always-published docs. */\n is_published?: boolean;\n}\n\nexport interface HelpCenterProps {\n docs: HelpCenterDoc[];\n loading?: boolean;\n /**\n * Category keys in display order. Categories not listed fall to the end in\n * first-seen order. Without it, groups follow first-seen order.\n */\n categoryOrder?: string[];\n /** Show the New/Edit affordances (consumer gates this on write permission). */\n canEdit?: boolean;\n onNew?: () => void;\n onEdit?: (doc: HelpCenterDoc) => void;\n /** Custom body renderer; defaults to preformatted text. */\n renderBody?: (doc: HelpCenterDoc) => ReactNode;\n emptyMessage?: string;\n}\n\ninterface Group {\n key: string;\n label: string;\n docs: HelpCenterDoc[];\n}\n\nconst Chevron = ({ open }: { open: boolean }) => (\n <svg\n className={`h-3.5 w-3.5 shrink-0 text-gray-400 transition-transform ${open ? 'rotate-90' : ''}`}\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n >\n <path\n fillRule=\"evenodd\"\n d=\"M7.21 14.77a.75.75 0 0 1 .02-1.06L11.168 10 7.23 6.29a.75.75 0 1 1 1.04-1.08l4.5 4.25a.75.75 0 0 1 0 1.08l-4.5 4.25a.75.75 0 0 1-1.06-.02Z\"\n clipRule=\"evenodd\"\n />\n </svg>\n);\n\n/**\n * In-app help / documentation viewer. Two panes: a searchable, collapsible\n * category tree on the left, the selected article's body on the right.\n *\n * Presentational only — it holds no API or permission knowledge. The consumer\n * fetches its own help docs, maps them to `HelpCenterDoc`, and (for editors)\n * wires `canEdit` + `onNew`/`onEdit` to its own create/edit UI.\n *\n * Search is client-side: a case-insensitive substring match over title, body\n * and category label. While searching, matching groups auto-expand.\n */\nexport default function HelpCenter({\n docs,\n loading = false,\n categoryOrder,\n canEdit = false,\n onNew,\n onEdit,\n renderBody,\n emptyMessage,\n}: HelpCenterProps) {\n // Catalog defaults — a caller's own `emptyMessage` always wins (see strings.tsx).\n const strings = useShellStrings();\n const [query, setQuery] = useState('');\n const [selectedSlug, setSelectedSlug] = useState<string | null>(null);\n // Per-category open/closed override. A category absent from the map uses its\n // default (only the selected article's group starts open).\n const [expanded, setExpanded] = useState<Record<string, boolean>>({});\n\n const q = query.trim().toLowerCase();\n\n // Group docs by category, preserving categoryOrder then first-seen order.\n const groups = useMemo<Group[]>(() => {\n const map = new Map<string, Group>();\n for (const doc of docs) {\n let g = map.get(doc.category);\n if (!g) {\n g = { key: doc.category, label: doc.category_label || doc.category, docs: [] };\n map.set(doc.category, g);\n }\n g.docs.push(doc);\n }\n if (!categoryOrder?.length) return [...map.values()];\n const rank = new Map(categoryOrder.map((k, i) => [k, i]));\n return [...map.values()].sort(\n (a, b) => (rank.get(a.key) ?? Infinity) - (rank.get(b.key) ?? Infinity),\n );\n }, [docs, categoryOrder]);\n\n const matches = (doc: HelpCenterDoc) =>\n !q ||\n doc.title.toLowerCase().includes(q) ||\n doc.body.toLowerCase().includes(q) ||\n doc.category_label.toLowerCase().includes(q);\n\n // Groups with their docs filtered by the search query; empty groups drop out.\n const visibleGroups = useMemo<Group[]>(\n () =>\n groups\n .map(g => ({ ...g, docs: g.docs.filter(matches) }))\n .filter(g => g.docs.length > 0),\n [groups, q],\n );\n\n const visibleDocs = useMemo(() => visibleGroups.flatMap(g => g.docs), [visibleGroups]);\n\n // Keep the chosen article if it's still visible, else fall back to the first\n // visible one (so typing a query jumps to the first match).\n const selected =\n (selectedSlug ? visibleDocs.find(d => d.slug === selectedSlug) : undefined) ??\n visibleDocs[0] ??\n null;\n\n const isGroupOpen = (key: string) =>\n q ? true : (expanded[key] ?? key === selected?.category);\n\n const toggleGroup = (key: string) =>\n setExpanded(prev => ({ ...prev, [key]: !isGroupOpen(key) }));\n\n return (\n <div className=\"flex h-full gap-4 px-4 py-3 min-h-0\">\n <aside className=\"w-64 shrink-0 flex flex-col bg-white rounded-lg shadow overflow-hidden\">\n <div className=\"flex items-center justify-between gap-2 px-3 py-2 border-b border-gray-200 bg-gray-50 shrink-0\">\n <h2 className=\"text-sm font-semibold text-gray-900\">{strings.help.title}</h2>\n {canEdit && onNew && (\n <button type=\"button\" onClick={onNew} className=\"text-xs text-blue-600 hover:underline\">\n {strings.help.newArticle}\n </button>\n )}\n </div>\n\n <div className=\"px-2.5 py-2 border-b border-gray-100 shrink-0\">\n <div className=\"relative\">\n <svg\n className=\"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400\"\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n >\n <path\n fillRule=\"evenodd\"\n d=\"M9 3.5a5.5 5.5 0 1 0 3.36 9.85l3.14 3.15a.75.75 0 1 0 1.06-1.06l-3.15-3.14A5.5 5.5 0 0 0 9 3.5ZM5 9a4 4 0 1 1 8 0 4 4 0 0 1-8 0Z\"\n clipRule=\"evenodd\"\n />\n </svg>\n <input\n type=\"text\"\n value={query}\n onChange={e => setQuery(e.target.value)}\n placeholder={strings.help.searchPlaceholder}\n className=\"w-full rounded-md border border-gray-300 bg-white py-1.5 pl-8 pr-2 text-sm shadow-sm focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500\"\n />\n </div>\n </div>\n\n <div className=\"flex-1 overflow-y-auto py-1\">\n {loading ? (\n <p className=\"px-3 py-6 text-center text-xs text-gray-400\">{strings.help.loading}</p>\n ) : visibleGroups.length === 0 ? (\n <p className=\"px-3 py-6 text-center text-xs text-gray-500\">\n {q ? strings.help.noResults : (emptyMessage ?? strings.help.empty)}\n </p>\n ) : (\n visibleGroups.map(group => {\n const open = isGroupOpen(group.key);\n return (\n <div key={group.key} className=\"py-0.5\">\n <button\n type=\"button\"\n onClick={() => toggleGroup(group.key)}\n className=\"w-full flex items-center gap-1.5 px-3 py-1.5 text-left text-[10px] font-semibold uppercase tracking-wide text-gray-400 hover:text-gray-600\"\n >\n <Chevron open={open} />\n <span className=\"truncate\">{group.label}</span>\n </button>\n {open &&\n group.docs.map(doc => {\n const active = selected?.slug === doc.slug;\n return (\n <button\n key={doc.slug}\n type=\"button\"\n onClick={() => setSelectedSlug(doc.slug)}\n className={`w-full text-left pl-8 pr-3 py-1.5 text-sm flex items-center gap-1.5 transition-colors ${\n active\n ? 'bg-blue-50 text-blue-700 font-medium'\n : 'text-gray-700 hover:bg-gray-50'\n }`}\n >\n <span className=\"truncate\">{doc.title}</span>\n {doc.is_published === false && (\n <span className=\"ml-auto shrink-0 text-[10px] text-amber-600\">{strings.help.draft}</span>\n )}\n </button>\n );\n })}\n </div>\n );\n })\n )}\n </div>\n </aside>\n\n <main className=\"flex-1 min-w-0 bg-white rounded-lg shadow overflow-hidden flex flex-col\">\n {selected ? (\n <>\n <div className=\"flex items-start justify-between gap-4 px-5 py-3 border-b border-gray-200 bg-gray-50 shrink-0\">\n <div className=\"min-w-0\">\n <h1 className=\"text-lg font-semibold text-gray-900 truncate\">{selected.title}</h1>\n <p className=\"text-xs text-gray-500 mt-0.5\">\n {selected.category_label}\n {selected.is_published === false && (\n <span className=\"ml-2 text-amber-600\">· {strings.help.draft}</span>\n )}\n </p>\n </div>\n {canEdit && onEdit && (\n <button\n type=\"button\"\n onClick={() => onEdit(selected)}\n className=\"shrink-0 text-sm text-blue-600 hover:underline\"\n >\n {strings.help.edit}\n </button>\n )}\n </div>\n <div className=\"flex-1 overflow-auto px-5 py-4\">\n {renderBody ? (\n renderBody(selected)\n ) : selected.body ? (\n <Markdown>{selected.body}</Markdown>\n ) : (\n <p className=\"text-sm text-gray-500 italic\">{strings.help.noBody}</p>\n )}\n </div>\n </>\n ) : (\n <div className=\"flex-1 flex items-center justify-center px-6 text-center\">\n <p className=\"text-sm text-gray-500\">\n {loading ? strings.help.loading : strings.help.pickArticle}\n </p>\n </div>\n )}\n </main>\n </div>\n );\n}\n","import type { ReactNode } from 'react';\n\n/**\n * Full-width action button for the `SidebarLayout` `sidebarTop` / `sidebarBottom`\n * slots — the standard list-window pattern of a primary \"New X\" button pinned\n * at the top and a secondary action (e.g. \"Export CSV\") pinned at the bottom.\n *\n * `variant=\"primary\"` is the solid-blue create button; `\"secondary\"` is the\n * white outline button. Pass `hotkey` (e.g. `ALT_SHIFT_N`) to render the small\n * keyboard-hint chip the shell's `useNewHotkey` binds.\n *\n * @example\n * <SidebarLayout\n * sidebarTop={<SidebarActionButton hotkey={ALT_SHIFT_N} onClick={onNew}>New Invoice</SidebarActionButton>}\n * sidebar={<StatusNav />}\n * >…</SidebarLayout>\n */\nexport interface SidebarActionButtonProps {\n children: ReactNode;\n onClick?: () => void;\n /** Solid-blue create button (`'primary'`, default) or white outline (`'secondary'`). */\n variant?: 'primary' | 'secondary';\n /** Keyboard-hint label rendered as a trailing chip, e.g. `ALT_SHIFT_N`. */\n hotkey?: string;\n disabled?: boolean;\n type?: 'button' | 'submit';\n title?: string;\n /** Extra classes appended after the variant styles (escape hatch). */\n className?: string;\n}\n\nconst VARIANTS = {\n primary: 'bg-blue-600 text-white hover:bg-blue-700',\n secondary: 'bg-white text-gray-700 border border-gray-300 hover:bg-gray-50',\n} as const;\n\nexport default function SidebarActionButton({\n children,\n onClick,\n variant = 'primary',\n hotkey,\n disabled = false,\n type = 'button',\n title,\n className = '',\n}: SidebarActionButtonProps) {\n return (\n <button\n type={type}\n onClick={onClick}\n disabled={disabled}\n title={title}\n className={`w-full inline-flex items-center justify-center gap-2 rounded-lg px-4 py-2 text-sm font-medium transition-colors disabled:opacity-50 ${VARIANTS[variant]} ${className}`}\n >\n {children}\n {hotkey && (\n <kbd className=\"rounded border border-blue-400/50 bg-blue-500/30 px-1.5 py-0.5 text-[10px] font-medium\">\n {hotkey}\n </kbd>\n )}\n </button>\n );\n}\n","import type { ReactNode } from 'react';\nimport { resolveSeverity, type SeverityTone } from './severity';\n\n/**\n * Presentational building blocks for SidebarLayout filter sidebars (status\n * buckets, categories, …) — the same item + group-label markup every list\n * window renders. Data wiring (count fetching) stays in the consuming app.\n */\n\nexport function SidebarGroupLabel({ children }: { children: ReactNode }) {\n return (\n <p className=\"px-2.5 pb-1 pt-1 text-[11px] font-semibold uppercase tracking-wide text-gray-400\">{children}</p>\n );\n}\n\nexport interface SidebarNavItemProps {\n /**\n * Widened from `string` to `ReactNode` so an item can carry markup the label\n * itself needs — a code span on a tenant slug, an `<em>` on the part of the\n * name that matched a filter. A plain string is still the common case and is\n * the only one that gets a `title`: a node has no text this component can\n * read without walking it, and a tooltip reading \"[object Object]\" is worse\n * than none.\n */\n label: ReactNode;\n count?: number;\n active: boolean;\n onClick: () => void;\n /**\n * A 16px glyph at the leading edge, naming the destination — the section\n * icons an admin sidebar repeats from its Start-menu entry, so the same\n * place looks the same in both.\n *\n * Decorative in the a11y tree: the label already names the item, and an\n * icon announced beside it is the name read twice. It follows the row's\n * state rather than inheriting the row's own ink — `gray-400` idle against\n * the label's `gray-700`, `blue-600` active against `blue-700` — so the\n * glyph stays a step quieter than the words it introduces.\n */\n icon?: ReactNode;\n /**\n * The right edge of the row, after the count: a plan chip, an \"external\"\n * mark on an item that leaves the shell, a sync spinner. `shrink-0`, so it\n * keeps its size and the label is what gives way when the sidebar narrows.\n *\n * Not a second count — `count` is still the count, and the two render\n * together in that order. This slot is for what the count cannot say.\n */\n trailing?: ReactNode;\n /**\n * Optional health marker — a small dot before the label, in the shell's\n * status vocabulary (`success | warning | danger`). For sidebars that double\n * as an alarm surface: a problem several levels down inside a section stays\n * visible on the always-on nav item that leads to it, without the operator\n * having to open anything.\n *\n * Roll the tone up in the consuming app (worst-of its children) — the item\n * renders a severity, it never computes one. Omitting it is not a claim of\n * health, it is no claim at all, and renders exactly as an item did before\n * this prop existed.\n *\n * A tone that arrives from a backend rollup has not been near the compiler,\n * so an unrecognised token (`'crit'`, `'critical'`, a stale enum) renders a\n * visible \"unknown severity\" marker and logs — never nothing. This item is\n * often the ONLY place a deep alarm surfaces; a marker that quietly vanishes\n * on a bad token would turn the safety feature into the outage.\n */\n severity?: SeverityTone;\n}\n\nexport function SidebarNavItem({ label, count, active, onClick, icon, trailing, severity }: SidebarNavItemProps) {\n // `null` when the prop was omitted (no marker at all — 3.24's markup), a\n // style otherwise. Never partially-undefined classes, whatever came in.\n const marker = resolveSeverity(severity, 'SidebarNavItem');\n return (\n <button\n type=\"button\"\n onClick={onClick}\n className={`flex w-full items-center justify-between gap-2 rounded-lg px-2.5 py-1.5 text-sm text-left ${active ? 'bg-blue-50 font-medium text-blue-700' : 'text-gray-700 hover:bg-gray-100'}`}\n >\n {/* Icon first, then the severity dot: the glyph is the item's identity\n and belongs at the edge, while the dot is a marker ON the label and\n has to stay against it. A dot stranded to the left of an icon reads\n as the icon's status rather than the section's. */}\n {icon != null && (\n <span aria-hidden=\"true\" className={`shrink-0 h-4 w-4 ${active ? 'text-blue-600' : 'text-gray-400'}`}>\n {icon}\n </span>\n )}\n {marker && (\n // Decorative in the a11y tree — the word itself follows the label, so\n // the item reads \"Warehouses, warning, 12\" in that order instead of\n // leading with a tone before anyone knows what it belongs to.\n <span\n aria-hidden=\"true\"\n title={marker.word}\n className={`shrink-0 h-1.5 w-1.5 rounded-full ${marker.fill}`}\n />\n )}\n {/* `mr-auto` unconditionally, where it used to depend on the marker: the\n button is `justify-between`, which only lands the label left and the\n count right while those are the ONLY two children. Any third child —\n a dot, an icon, a trailing chip — and the free space is dealt out\n between them instead, stranding the label in the middle. An auto\n margin absorbs all of it in one place, so everything before the label\n packs left and everything after it packs right however many there\n are. With exactly two children it is what `justify-between` was\n already doing, so the rendered geometry of a plain item is unchanged.\n\n `min-w-0` is what makes `truncate` work at all here: a flex item's\n default `min-width: auto` refuses to shrink below its content, so a\n long bucket name pushed the count off the row instead of ellipsing. */}\n <span\n className=\"min-w-0 truncate mr-auto\"\n // Only a string can be a tooltip. See `label`.\n title={typeof label === 'string' ? label : undefined}\n >\n {label}\n </span>\n {marker && <span className=\"sr-only\">{marker.word}</span>}\n {count != null && count > 0 && (\n <span className={`shrink-0 inline-flex items-center justify-center min-w-[1.25rem] px-1.5 h-5 rounded-full text-[11px] font-medium ${active ? 'bg-blue-100 text-blue-700' : 'bg-gray-100 text-gray-600'}`}>\n {count}\n </span>\n )}\n {trailing != null && <span className=\"shrink-0\">{trailing}</span>}\n </button>\n );\n}\n","import type { ReactNode } from 'react';\n\n/**\n * Generic top navigation bar. A horizontal row of tab-style links with an\n * optional brand on the left and free-form actions on the right. Self-contained\n * and styled with the shell's Tailwind utilities, so it themes for free.\n *\n * Controlled: pass `activeKey` and handle `onSelect`. The active item gets an\n * accent underline. Items can carry an `icon`, a `badge` (e.g. a count) and be\n * `disabled`.\n */\nexport interface TopNavItem {\n /** Stable key — what `onSelect` receives and `activeKey` matches. */\n key: string;\n label: ReactNode;\n /** Optional leading icon (typically a 4×4 svg). */\n icon?: ReactNode;\n /** Optional trailing badge — a count, dot, \"New\", etc. */\n badge?: ReactNode;\n disabled?: boolean;\n}\n\nexport interface TopNavProps {\n items: TopNavItem[];\n /** Key of the active item — it gets the accent underline. */\n activeKey?: string;\n onSelect?: (key: string) => void;\n /** Left slot — logo / product title. */\n brand?: ReactNode;\n /** Right slot — actions (buttons, search, avatar…). Pinned to the far right. */\n actions?: ReactNode;\n className?: string;\n}\n\nexport default function TopNav({ items, activeKey, onSelect, brand, actions, className }: TopNavProps) {\n return (\n <div\n className={`flex h-12 shrink-0 items-stretch gap-1 border-b border-gray-200 bg-white px-3 ${className ?? ''}`}\n >\n {brand && (\n <div className=\"mr-1 flex items-center gap-2 pr-3 font-semibold text-gray-900\">{brand}</div>\n )}\n <nav className=\"flex items-stretch gap-0.5\">\n {items.map(item => {\n const active = item.key === activeKey;\n return (\n <button\n key={item.key}\n type=\"button\"\n disabled={item.disabled}\n aria-current={active ? 'page' : undefined}\n onClick={() => !item.disabled && onSelect?.(item.key)}\n className={`relative inline-flex items-center gap-1.5 px-3 text-sm font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-40 ${\n active ? 'text-blue-600' : 'text-gray-600 hover:text-gray-900'\n }`}\n >\n {item.icon && <span className=\"h-4 w-4 shrink-0\">{item.icon}</span>}\n <span className=\"whitespace-nowrap\">{item.label}</span>\n {item.badge != null && (\n <span className=\"ml-0.5 inline-flex min-w-[1.25rem] items-center justify-center rounded-full bg-gray-100 px-1.5 text-[11px] font-semibold leading-5 text-gray-600\">\n {item.badge}\n </span>\n )}\n {active && (\n <span className=\"absolute inset-x-2 -bottom-px h-0.5 rounded-full bg-blue-600\" aria-hidden />\n )}\n </button>\n );\n })}\n </nav>\n {actions && <div className=\"ml-auto flex items-center gap-2\">{actions}</div>}\n </div>\n );\n}\n","/**\n * DropdownMenu — a trigger and the menu it opens.\n *\n * `PopupMenu` is the surface: the caller positions it and decides when it\n * exists, which is right for a context menu summoned at a cursor. A dropdown\n * hangs off a control instead, and everything that makes it usable — where it\n * lands, when it closes, which item the arrow keys are on, where focus goes\n * afterwards — is the same wherever it appears. So it lives here rather than\n * being written again beside each trigger.\n *\n * The surface is `PopupMenu`, so a dropdown and a context menu look the same\n * and follow the same `--menu-density`.\n */\nimport { useCallback, useEffect, useId, useRef, useState, type ReactNode } from 'react';\nimport { PopupMenu, PopupMenuItem } from './PopupMenu';\nimport { registerModalEscapeInterceptor } from './escapeInterceptors';\n\nexport type DropdownMenuAlign = 'start' | 'end';\nexport type DropdownMenuSide = 'top' | 'bottom';\n\nexport interface DropdownMenuItem {\n key: string;\n label: ReactNode;\n icon?: ReactNode;\n /** A destructive choice — delete, revoke. Drawn in the danger tone. */\n danger?: boolean;\n disabled?: boolean;\n onSelect: () => void;\n}\n\nexport interface DropdownMenuProps {\n /** What opens the menu. Rendered inside the trigger button. */\n trigger: ReactNode;\n items: DropdownMenuItem[];\n /** Which edge the menu lines up with. `end` (the default) suits a menu at\n * the right of a row, where a left-aligned one would run off the card. */\n align?: DropdownMenuAlign;\n /** Which side of the trigger receives the menu. `bottom` is the default;\n * footer action bars should use `top` so the menu stays inside the window. */\n side?: DropdownMenuSide;\n /** Names the trigger. Required in practice — the trigger is usually an icon. */\n 'aria-label'?: string;\n className?: string;\n disabled?: boolean;\n}\n\nexport default function DropdownMenu({\n trigger, items, align = 'end', side = 'bottom', 'aria-label': ariaLabel, className = '', disabled,\n}: DropdownMenuProps) {\n const [open, setOpen] = useState(false);\n const [active, setActive] = useState(0);\n const wrapRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const itemRefs = useRef<(HTMLButtonElement | null)[]>([]);\n const menuId = useId();\n\n const close = useCallback((restoreFocus: boolean) => {\n setOpen(false);\n // Focus goes back to the trigger unless the user clicked away, where\n // yanking it back would move them somewhere they did not ask to be.\n if (restoreFocus) triggerRef.current?.focus();\n }, []);\n\n // Walks from `from` until it finds an item that can take focus. Bounded by\n // the item count, so an all-disabled menu returns rather than spinning.\n const enabledFrom = (from: number, step: 1 | -1) => {\n for (let i = 0; i < items.length; i += 1) {\n const at = (((from + step * i) % items.length) + items.length) % items.length;\n if (!items[at]?.disabled) return at;\n }\n return from;\n };\n\n useEffect(() => {\n if (!open) return;\n const onPointerDown = (e: PointerEvent) => {\n if (!wrapRef.current?.contains(e.target as Node)) close(false);\n };\n document.addEventListener('pointerdown', onPointerDown, true);\n return () => document.removeEventListener('pointerdown', onPointerDown, true);\n }, [open, close]);\n\n useEffect(() => {\n if (open) itemRefs.current[active]?.focus();\n }, [open, active]);\n\n // Escape, through the shell's interceptor seam rather than an onKeyDown here.\n //\n // A bubble-phase handler cannot win: `Modal` listens for Escape on `window`\n // in the CAPTURE phase and calls stopPropagation() when it closes, and\n // capture runs window before the target — so inside any shell window,\n // Escape closed the whole window and this menu went down with it. The seam\n // is the one place Modal consults BEFORE closing, and since 4.27.0 it drains\n // itself where no shell is mounted, so a till and a routed page are covered\n // by the same registration. Same fix `Tooltip` took in 4.30.1.\n useEffect(() => {\n if (!open) return;\n return registerModalEscapeInterceptor(event => {\n if (event.key !== 'Escape') return false;\n close(true);\n return true;\n });\n }, [open, close]);\n\n const openAt = (index: number) => {\n setActive(index);\n setOpen(true);\n };\n\n const onTriggerKeyDown = (e: React.KeyboardEvent<HTMLButtonElement>) => {\n if (e.key === 'ArrowDown' || e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n openAt(enabledFrom(0, 1));\n } else if (e.key === 'ArrowUp') {\n // Opening upward lands on the last item, which is where the eye goes.\n e.preventDefault();\n openAt(enabledFrom(items.length - 1, -1));\n }\n };\n\n const onMenuKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {\n if (e.key === 'ArrowDown') { e.preventDefault(); setActive(enabledFrom(active + 1, 1)); }\n else if (e.key === 'ArrowUp') { e.preventDefault(); setActive(enabledFrom(active - 1, -1)); }\n else if (e.key === 'Home') { e.preventDefault(); setActive(enabledFrom(0, 1)); }\n else if (e.key === 'End') { e.preventDefault(); setActive(enabledFrom(items.length - 1, -1)); }\n // Escape is deliberately absent: it is registered on the interceptor seam\n // above, because a bubble-phase handler here loses to Modal's window-level\n // capture listener and the whole window would close instead of the menu.\n else if (e.key === 'Tab') {\n // Tab leaves the menu rather than moving inside it, and the menu goes\n // with it — a dropdown left open behind the cursor is a stray overlay.\n //\n // Focus goes back to the TRIGGER, and the Tab is consumed rather than\n // also moving on. Letting it through looks more standard and is not:\n // the default action picks the next tabbable from whatever has focus\n // WHEN IT RUNS, which is still a menu item React has not unmounted yet,\n // so where the user lands depends on render timing. Consuming it costs\n // one more press and always ends somewhere they can see.\n e.preventDefault();\n close(true);\n }\n };\n\n const select = (item: DropdownMenuItem) => {\n if (item.disabled) return;\n close(true);\n item.onSelect();\n };\n\n return (\n <div ref={wrapRef} className={`relative inline-flex ${className}`.trim()}>\n <button\n ref={triggerRef}\n type=\"button\"\n aria-haspopup=\"menu\"\n aria-expanded={open}\n aria-controls={open ? menuId : undefined}\n aria-label={ariaLabel}\n disabled={disabled}\n onClick={() => (open ? close(false) : openAt(enabledFrom(0, 1)))}\n onKeyDown={onTriggerKeyDown}\n className=\"inline-flex items-center justify-center rounded-md text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-400 disabled:cursor-not-allowed disabled:opacity-60\"\n >\n {trigger}\n </button>\n\n {open && (\n <div\n className={`absolute z-50 ${side === 'top' ? 'bottom-full mb-1' : 'top-full mt-1'} ${align === 'end' ? 'right-0' : 'left-0'}`}\n onKeyDown={onMenuKeyDown}\n >\n {/* `portal: false` — the menu is positioned against the trigger by\n this wrapper, so moving it to <body> would leave it at the top\n left of the page.\n\n No `onClose`: PopupMenu's own dismissal calls the same callback\n for Escape and for a click elsewhere, and those want opposite\n things. Escape is the user putting the menu away, so focus goes\n back to the trigger; a click elsewhere is them going somewhere,\n and dragging focus back would take them off what they just\n clicked. The handlers above tell the two apart. */}\n <PopupMenu portal={false} minWidth={180}>\n <div id={menuId} role=\"menu\" aria-orientation=\"vertical\" aria-label={ariaLabel}>\n {items.map((item, i) => (\n <PopupMenuItem\n key={item.key}\n ref={el => { itemRefs.current[i] = el; }}\n role=\"menuitem\"\n // One tab stop for the whole menu; the arrows move inside it.\n tabIndex={i === active ? 0 : -1}\n danger={item.danger}\n disabled={item.disabled}\n onMouseEnter={() => { if (!item.disabled) setActive(i); }}\n onClick={() => select(item)}\n >\n {item.icon}\n {item.label}\n </PopupMenuItem>\n ))}\n </div>\n </PopupMenu>\n </div>\n )}\n </div>\n );\n}\n","/**\n * AppUpdateBanner — \"a new version is available\" for a tab that outlives a deploy.\n *\n * Long-lived tabs (every browser a team leaves open for the day) keep running\n * the bundle they loaded until someone reloads. Fixes land silently hours late,\n * people report bugs that are already fixed, and — since a deploy replaces the\n * lazy chunks the old bundle names — the first lazy window such a tab opens\n * crashes (see `staleChunk.ts` for that half). The banner is the other half:\n * it tells the user a deploy happened and offers the reload before a crash\n * has to.\n *\n * How it knows: `useAppUpdate` polls a small `version.json` the build emits\n * beside the bundle and compares it with the version the running bundle was\n * built as. No service worker, no workbox — a fetch a minute from a visible\n * tab, and one more the moment a hidden tab is shown again, since a tab that\n * sat in the background all afternoon is exactly the one that missed the\n * deploy. Polling stops once an update is known.\n *\n * Kit-safe: Banner, Button and the strings catalog, nothing else.\n */\nimport { useEffect, useState, type ReactNode } from 'react';\nimport Banner from './Banner';\nimport Button from '../forms/Button';\nimport { useShellStrings } from './strings';\n\n/** Default poll interval for a visible tab. */\nexport const APP_UPDATE_POLL_MS = 60_000;\n\nexport interface UseAppUpdateOptions {\n /**\n * The version THIS bundle was built as — the portal's `APP_VERSION`. An\n * empty string (a build with no version, a test) disables polling.\n */\n currentVersion: string;\n /** Where the deployed version is read from. Default `/version.json`. */\n versionUrl?: string;\n /** Poll interval while the tab is visible. Default {@link APP_UPDATE_POLL_MS}. */\n pollMs?: number;\n}\n\n/**\n * The deployed version once it differs from `currentVersion`, else `null`.\n *\n * Reads `{ version }` from `versionUrl` with the cache bypassed; a response\n * that is not JSON (the SPA fallback page, when the file is missing), not\n * `ok`, or unreachable is ignored and tried again next tick.\n */\nexport function useAppUpdate({\n currentVersion,\n versionUrl = '/version.json',\n pollMs = APP_UPDATE_POLL_MS,\n}: UseAppUpdateOptions): string | null {\n const [latest, setLatest] = useState<string | null>(null);\n\n useEffect(() => {\n if (!currentVersion || latest !== null) return;\n let cancelled = false;\n\n const check = async () => {\n if (typeof document !== 'undefined' && document.visibilityState === 'hidden') return;\n try {\n const sep = versionUrl.includes('?') ? '&' : '?';\n const res = await fetch(`${versionUrl}${sep}t=${Date.now()}`, { cache: 'no-store' });\n if (!res.ok) return;\n const data: unknown = await res.json();\n const version =\n data && typeof data === 'object' && typeof (data as { version?: unknown }).version === 'string'\n ? (data as { version: string }).version\n : null;\n if (!cancelled && version && version !== currentVersion) setLatest(version);\n } catch {\n /* offline, mid-deploy, or not JSON — next tick */\n }\n };\n\n void check();\n const timer = setInterval(() => { void check(); }, pollMs);\n const onVisibility = () => {\n if (document.visibilityState === 'visible') void check();\n };\n document.addEventListener('visibilitychange', onVisibility);\n return () => {\n cancelled = true;\n clearInterval(timer);\n document.removeEventListener('visibilitychange', onVisibility);\n };\n }, [currentVersion, versionUrl, pollMs, latest]);\n\n return latest;\n}\n\nexport interface AppUpdateBannerProps extends UseAppUpdateOptions {\n /** Replaces the catalog's `update.available` line. */\n message?: ReactNode;\n /**\n * What \"Refresh now\" does. Default: `window.location.reload()`. A host that\n * wants to flush state first passes its own and ends with the reload.\n */\n onRefresh?: () => void;\n className?: string;\n}\n\n/**\n * Pinned at the top centre of the viewport, above every window, the moment\n * the deployed version differs from the one running. Renders nothing until\n * then. Mount it once, anywhere under the providers.\n */\nexport default function AppUpdateBanner({\n currentVersion,\n versionUrl,\n pollMs,\n message,\n onRefresh,\n className = '',\n}: AppUpdateBannerProps) {\n const latest = useAppUpdate({ currentVersion, versionUrl, pollMs });\n const strings = useShellStrings();\n if (latest === null) return null;\n\n const refresh = onRefresh ?? (() => window.location.reload());\n return (\n <div\n data-app-update-banner=\"\"\n className={`fixed left-1/2 top-3 z-[9999] w-max max-w-[calc(100vw-1.5rem)] -translate-x-1/2 ${className}`.trim()}\n >\n <Banner\n tone=\"warning\"\n className=\"shadow-lg\"\n action={\n <Button type=\"button\" variant=\"primary\" size=\"md\" onClick={refresh}>\n {strings.update.refreshNow}\n </Button>\n }\n >\n <span className=\"font-medium\">{message ?? strings.update.available}</span>\n <span className=\"ml-2 whitespace-nowrap font-mono text-xs text-gray-500\">\n {currentVersion} → {latest}\n </span>\n </Banner>\n </div>\n );\n}\n","/**\n * Drawer — a panel that slides in from an edge, over the page.\n *\n * The same modal contract as `Dialog` — focus trapped, page behind locked,\n * Escape claimed through the shell's interceptor — with a different shape. Use\n * a Drawer when the content is a LIST or a long form that wants height, and a\n * Dialog when it is a question that wants to be answered and dismissed. A\n * drawer holding one sentence and two buttons is a dialog wearing the wrong\n * clothes; a dialog holding twenty fields is a scroll trap.\n *\n * Imports nothing but React and its two sibling modules, so it belongs to\n * `react-os-shell/ui` alongside `Dialog`.\n */\nimport { useEffect, useId, useRef, type ReactNode, type RefObject } from 'react';\nimport { useFocusTrap, useScrollLock } from './focusTrap';\nimport { registerModalEscapeInterceptor } from './escapeInterceptors';\nimport { useDismissPopupsOnOpen } from './useDismissPopupsOnOpen';\nimport { Z_LAYERS } from './zLayers';\n\nexport type DrawerSide = 'right' | 'left' | 'bottom';\nexport type DrawerSize = 'sm' | 'md' | 'lg';\n\nexport interface DrawerProps {\n open: boolean;\n onClose: () => void;\n side?: DrawerSide;\n size?: DrawerSize;\n title?: ReactNode;\n /** Action row pinned to the bottom edge, outside the scrolling body. */\n footer?: ReactNode;\n children?: ReactNode;\n /** Escape and the scrim do nothing. See Dialog's note before reaching for it. */\n blocking?: boolean;\n initialFocus?: RefObject<HTMLElement | null>;\n /**\n * Names the drawer when it carries no visible `title`. A dialog without an\n * accessible name is announced as just \"dialog\", which tells a screen reader\n * user nothing about what opened — and a navigation drawer, whose content is\n * its own heading, is exactly the case that has no title to point at.\n *\n * Ignored when `title` is set: a visible label always wins over a parallel\n * invisible one, or the two drift.\n */\n 'aria-label'?: string;\n className?: string;\n}\n\n/**\n * The same widths as classes, written out rather than interpolated: Tailwind\n * emits a utility only when it has SEEN the literal string in a scanned file,\n * so `sm:w-[${n}px]` produces no rule at all and every drawer would silently\n * stay full width.\n */\nconst SIZE_CLASS: Record<DrawerSize, string> = {\n sm: 'sm:w-[320px]',\n md: 'sm:w-[448px]',\n lg: 'sm:w-[640px]',\n};\n\nconst SIDE_POSITION: Record<DrawerSide, string> = {\n right: 'inset-y-0 right-0',\n left: 'inset-y-0 left-0',\n bottom: 'inset-x-0 bottom-0',\n};\n\nfunction CloseButton({ onClose }: { onClose: () => void }) {\n return (\n <button\n type=\"button\"\n onClick={onClose}\n aria-label=\"Close\"\n className=\"rounded-md p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-600 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-400\"\n >\n <svg className=\"h-5 w-5\" viewBox=\"0 0 20 20\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" aria-hidden=\"true\">\n <path d=\"M6 6l8 8M14 6l-8 8\" />\n </svg>\n </button>\n );\n}\n\nexport default function Drawer({\n open, onClose, side = 'right', size = 'md', title, footer, children,\n blocking = false, initialFocus, 'aria-label': ariaLabel, className = '',\n}: DrawerProps) {\n const panelRef = useRef<HTMLDivElement>(null);\n const bodyId = useId();\n const titleId = useId();\n\n // Same as Dialog: opening closes the popups open elsewhere, which sit above\n // the overlay layer and would float over the scrim.\n useDismissPopupsOnOpen(open);\n\n useFocusTrap(panelRef, open, initialFocus);\n useScrollLock(open);\n\n useEffect(() => {\n if (!open) return;\n return registerModalEscapeInterceptor(() => {\n if (blocking) return true;\n onClose();\n return true;\n });\n }, [open, blocking, onClose]);\n\n if (!open) return null;\n\n const isBottom = side === 'bottom';\n // A side drawer's width is a CLASS, not an inline style: an inline width\n // beats every `sm:` variant, so the responsive step could never take.\n const panelStyle = isBottom ? { maxHeight: '85vh' } : undefined;\n\n return (\n <div className=\"fixed inset-0\" style={{ zIndex: Z_LAYERS.overlay }} role=\"presentation\">\n <div className=\"fixed inset-0 bg-black/30\" onClick={blocking ? undefined : onClose} aria-hidden=\"true\" />\n <div\n ref={panelRef}\n role=\"dialog\"\n aria-modal=\"true\"\n // Points at the rendered heading rather than re-deriving the name from\n // the prop: `title` is a ReactNode, so an element title — an icon beside\n // a word, a count in a badge — used to fall through the string check and\n // leave the drawer with no name at all.\n aria-labelledby={title ? titleId : undefined}\n aria-label={title ? undefined : ariaLabel}\n // Same reasoning as Dialog: the body is the description, and a screen\n // reader only reads it on open if the panel says so.\n aria-describedby={children ? bodyId : undefined}\n style={panelStyle}\n className={[\n 'fixed flex flex-col bg-white shadow-xl',\n // Full width on a phone, the asked-for width from `sm` up. A 320px\n // drawer on a 375px screen leaves a 55px strip of scrim: too narrow\n // to aim at, too wide to read as an edge, and it makes the panel look\n // like a desktop rail that was squeezed rather than a sheet built for\n // the screen it is on.\n isBottom ? '' : `w-full max-w-full ${SIZE_CLASS[size]}`,\n SIDE_POSITION[side],\n isBottom ? 'rounded-t-xl' : '',\n className,\n ].filter(Boolean).join(' ')}\n >\n {/* With a title the close button shares a header row with it. WITHOUT\n one there is nothing to put in that row, and reserving it anyway\n costs a bordered 48px strip of nothing at the top of the panel —\n visible on a phone, where a navigation drawer has no title bar by\n design and its own content is the heading. So the button floats\n over the body instead. */}\n {title ? (\n <div className=\"flex shrink-0 items-center justify-between gap-4 border-b border-gray-100 px-4 py-3\">\n <h2 id={titleId} className=\"text-base font-semibold text-gray-900\">{title}</h2>\n {!blocking && <CloseButton onClose={onClose} />}\n </div>\n ) : (\n !blocking && (\n <div className=\"absolute right-2 top-2 z-10\">\n <CloseButton onClose={onClose} />\n </div>\n )\n )}\n {/* Only the body scrolls, so the header and actions stay reachable in a\n long form — the thing a drawer is usually chosen for. */}\n <div id={bodyId} className=\"min-h-0 flex-1 overflow-y-auto px-4 py-4\">{children}</div>\n {footer && (\n <div className=\"flex shrink-0 justify-end gap-3 border-t border-gray-100 px-4 py-3\">{footer}</div>\n )}\n </div>\n </div>\n );\n}\n","/**\n * GlobalSearch — the ⌘K overlay: one input, every provider queried in\n * parallel, arrow keys and Enter over the merged results.\n *\n * ── Why it takes `onSelect` instead of calling openEntity itself ──\n * It used to `import { useWindowManager }` for exactly one line: opening the\n * chosen result in a window. The hook is only a `useContext` and would not have\n * thrown without a provider — but an import is resolved statically, so that one\n * line pulled `WindowManager` and therefore react-query and axios into the\n * module graph of anything containing this overlay. That is what kept a\n * self-contained search box out of `react-os-shell/ui`.\n *\n * `Layout` passes `openEntity` in, so the desktop shell behaves exactly as\n * before; a routed app passes its own navigation and gets the same overlay\n * without the window manager. The alternative — a second, \"headless\" palette\n * component beside this one — would have put two components with the same job\n * in one barrel, where `export *` loses to an explicit export silently.\n */\nimport { useState, useEffect, useRef, useCallback } from 'react';\nimport { createPortal } from 'react-dom';\nimport { glassStyle as getGlassStyle } from '../utils/glass';\nimport { useDismissPopupsOnOpen } from './useDismissPopupsOnOpen';\nimport { Z_LAYERS } from './zLayers';\n\nexport interface SearchResult {\n /** Category label, e.g. \"Sales Order\". */\n type: string;\n /** Primary text shown in the result row. */\n label: string;\n /** Optional secondary line. */\n sub?: string;\n /** Window-registry key passed to openEntity. */\n entity_type: string;\n entity_id: string;\n}\n\n/** A search provider — given a query, returns matching results. The shell\n * calls every provider in parallel and concatenates the responses. */\nexport type SearchProvider = (query: string) => Promise<SearchResult[]>;\n\n/** Bundle of search-related consumer config. */\nexport interface SearchConfig {\n providers: SearchProvider[];\n /** Per-result-type icon (SVG path `d` attribute). Unmatched types fall\n * back to a generic magnifier glyph. */\n typeIcons?: Record<string, string>;\n placeholder?: string;\n}\n\nexport interface GlobalSearchProps extends Partial<SearchConfig> {\n /**\n * What to do with the chosen result. Called after the overlay closes.\n *\n * Supplied by whoever renders the overlay, not by the consumer's\n * `SearchConfig`: inside the desktop shell `Layout` passes `openEntity`, and\n * a routed app passes its own navigation. Omitted, selecting a result just\n * closes the overlay — which is what a search with nowhere to go should do.\n */\n onSelect?: (result: SearchResult) => void;\n}\n\nconst DEFAULT_MAGNIFIER = 'M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z';\n\nexport default function GlobalSearch({ providers, typeIcons, placeholder = 'Search...', onSelect }: GlobalSearchProps = {}) {\n const [open, setOpen] = useState(false);\n const [query, setQuery] = useState('');\n const [results, setResults] = useState<SearchResult[]>([]);\n const [loading, setLoading] = useState(false);\n const [activeIdx, setActiveIdx] = useState(0);\n const inputRef = useRef<HTMLInputElement>(null);\n const debounceRef = useRef<ReturnType<typeof setTimeout>>();\n\n // Hotkey: Cmd+K / Ctrl+K\n useEffect(() => {\n const handler = (e: KeyboardEvent) => {\n if ((e.ctrlKey || e.metaKey) && e.key === 'k') {\n e.preventDefault();\n setOpen(prev => !prev);\n }\n if (e.key === 'Escape' && open) {\n setOpen(false);\n }\n };\n window.addEventListener('keydown', handler);\n return () => window.removeEventListener('keydown', handler);\n }, [open]);\n\n // A popup open underneath — a SearchableSelect's list in the window the user\n // was editing — sits on the popup layer, above this overlay, and closes on\n // nothing ⌘K does. Tell it to (see `overlayEvents.ts`).\n useDismissPopupsOnOpen(open);\n\n useEffect(() => {\n if (open) {\n setTimeout(() => inputRef.current?.focus(), 50);\n } else {\n setQuery('');\n setResults([]);\n }\n }, [open]);\n\n // Debounced search across all providers\n useEffect(() => {\n if (debounceRef.current) clearTimeout(debounceRef.current);\n if (query.length < 2) { setResults([]); return; }\n if (!providers || providers.length === 0) { setResults([]); return; }\n debounceRef.current = setTimeout(async () => {\n setLoading(true);\n try {\n const responses = await Promise.all(providers.map(p => p(query).catch(() => [] as SearchResult[])));\n setResults(responses.flat());\n setActiveIdx(0);\n } catch { setResults([]); }\n setLoading(false);\n }, 250);\n return () => { if (debounceRef.current) clearTimeout(debounceRef.current); };\n }, [query, providers]);\n\n const handleSelect = useCallback((result: SearchResult) => {\n setOpen(false);\n onSelect?.(result);\n }, [onSelect]);\n\n const handleKeyDown = (e: React.KeyboardEvent) => {\n if (e.key === 'ArrowDown') { e.preventDefault(); setActiveIdx(i => Math.min(i + 1, results.length - 1)); }\n else if (e.key === 'ArrowUp') { e.preventDefault(); setActiveIdx(i => Math.max(i - 1, 0)); }\n else if (e.key === 'Enter' && results[activeIdx]) { handleSelect(results[activeIdx]); }\n };\n\n if (!open) return null;\n\n // Portalled to <body> on the overlay layer. At z-[200], rendered wherever\n // `Layout` put it, it sat under a dozen stacked windows, every pinned window\n // and every Dialog — and a window's stacking context could hold it down\n // whatever number it carried.\n return createPortal(\n <div data-global-search=\"\" className=\"fixed inset-0 flex items-start justify-center pt-[15vh]\" style={{ zIndex: Z_LAYERS.overlay }} onClick={() => setOpen(false)}>\n <div data-global-search-backdrop=\"\" className=\"absolute inset-0 bg-black/50 backdrop-blur-sm\" />\n <div className=\"relative z-10 w-full max-w-xl rounded-2xl overflow-hidden\" onClick={e => e.stopPropagation()} style={getGlassStyle()}>\n {/* Search input */}\n <div className=\"flex items-center gap-3 px-4 py-3 border-b border-gray-200\">\n <svg className=\"h-5 w-5 text-gray-400 shrink-0\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" strokeWidth={2}>\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d={DEFAULT_MAGNIFIER} />\n </svg>\n <input\n ref={inputRef}\n type=\"text\"\n value={query}\n onChange={e => setQuery(e.target.value)}\n onKeyDown={handleKeyDown}\n placeholder={placeholder}\n className=\"flex-1 text-sm bg-transparent border-0 outline-none placeholder-gray-400\"\n />\n <kbd className=\"hidden sm:inline-flex items-center rounded border border-gray-300 px-1.5 py-0.5 text-[10px] font-medium text-gray-400\">ESC</kbd>\n </div>\n\n {/* Results */}\n <div className=\"max-h-[50vh] overflow-y-auto\">\n {loading && (\n <div className=\"px-4 py-6 text-center text-sm text-gray-400\">Searching...</div>\n )}\n {!loading && query.length >= 2 && results.length === 0 && (\n <div className=\"px-4 py-6 text-center text-sm text-gray-400\">No results found.</div>\n )}\n {!loading && results.length > 0 && (\n <ul className=\"py-2\">\n {results.map((r, i) => (\n <li key={`${r.type}-${r.label}-${i}`}>\n <button\n className={`flex items-center gap-3 w-full px-4 py-2.5 text-left transition-colors ${\n i === activeIdx ? 'bg-blue-50' : 'hover:bg-gray-50'\n }`}\n onClick={() => handleSelect(r)}\n onMouseEnter={() => setActiveIdx(i)}\n >\n <svg className=\"h-4 w-4 text-gray-400 shrink-0\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" strokeWidth={1.5}>\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d={typeIcons?.[r.type] || DEFAULT_MAGNIFIER} />\n </svg>\n <div className=\"flex-1 min-w-0\">\n <p className=\"text-sm font-medium text-gray-900 truncate\">{r.label}</p>\n {r.sub && <p className=\"text-xs text-gray-400 truncate\">{r.sub}</p>}\n </div>\n <span className=\"shrink-0 rounded-full bg-gray-100 px-2 py-0.5 text-[10px] font-medium text-gray-500\">{r.type}</span>\n </button>\n </li>\n ))}\n </ul>\n )}\n {!loading && query.length < 2 && (\n <div className=\"px-4 py-6 text-center text-sm text-gray-400\">Type at least 2 characters to search...</div>\n )}\n </div>\n\n {/* Footer */}\n <div className=\"flex items-center justify-between px-4 py-2 border-t border-gray-100 bg-gray-50 text-[11px] text-gray-400\">\n <div className=\"flex items-center gap-3\">\n <span className=\"flex items-center gap-1\"><kbd className=\"rounded border border-gray-300 px-1 py-0.5 font-medium\">&uarr;</kbd><kbd className=\"rounded border border-gray-300 px-1 py-0.5 font-medium\">&darr;</kbd> navigate</span>\n <span className=\"flex items-center gap-1\"><kbd className=\"rounded border border-gray-300 px-1 py-0.5 font-medium\">Enter</kbd> open</span>\n </div>\n <span className=\"flex items-center gap-1\"><kbd className=\"rounded border border-gray-300 px-1 py-0.5 font-medium\">Esc</kbd> close</span>\n </div>\n </div>\n </div>,\n document.body,\n );\n}\n","import { Fragment, useLayoutEffect, useMemo, useRef, useState } from 'react';\nimport type { ReactNode } from 'react';\n\n/**\n * Generic, drag-and-drop Kanban board. Self-contained (native HTML5 DnD, no\n * library) and styled with the same Tailwind utilities + `grid-scroll` class the\n * shell already ships, so consumers get it for free.\n *\n * Group items into columns with `columnOf`, render each card with `renderCard`.\n * Cards can be dragged **between** columns (to change which column they belong\n * to) and **within** a column (to reorder / prioritise). On drop, `onMove(id,\n * toColumn, toIndex)` fires — `toIndex` is the target position within `toColumn`\n * measured against that column's cards *excluding* the dragged one, so the\n * consumer can persist an order (e.g. midpoint between neighbours) that every\n * user then sees. Sort each column by that order via `sortInColumn`.\n *\n * Affordance: a blue **drop-line** shows exactly where the card will land\n * (between two cards, in either the source or a different column), and the\n * target column highlights. The dragged card dims. The insertion point tracks\n * `dragenter` (once per card crossed) so the line stays stable rather than\n * flickering. Pass `onAddItem` to give each column a \"+ Add item\" button at its\n * foot, revealed on column hover / keyboard focus.\n *\n * With no items the board is replaced by `emptyState` — right when the items\n * are the whole story, wrong when the columns are (a pipeline the user just\n * configured has a shape worth showing, and a board with no drop target can't\n * take its first card). Pass `showColumnsWhenEmpty` for that case and the\n * normal layout draws with every column on its `columnEmptyText` placeholder.\n */\nexport interface KanbanColumn {\n /** Stable column key — what `columnOf` returns and `onMove` receives. */\n value: string;\n label: string;\n /** Tailwind text + bg classes for the column header. */\n accent?: string;\n /** Tailwind bg class for the header dot. */\n dot?: string;\n}\n\nexport interface KanbanProps<T> {\n items: T[];\n columns: KanbanColumn[];\n columnOf: (item: T) => string;\n getId: (item: T) => string;\n /**\n * Fired on drop. `toColumn` is the destination column's `value`; `toIndex` is\n * the target position within that column measured against its cards\n * **excluding** the dragged card (0 = top). A same-column drop that wouldn't\n * change the order is not reported.\n */\n onMove: (id: string, toColumn: string, toIndex: number) => void;\n /** Inner card content — the card chrome (border, padding, hover) is provided. */\n renderCard: (item: T) => ReactNode;\n onCardClick?: (item: T) => void;\n /** Comparator for ordering within a column — sort by the persisted order field. */\n sortInColumn?: (a: T, b: T) => number;\n isLoading?: boolean;\n loadingText?: string;\n /** Shown INSTEAD of the board when there are no items at all. */\n emptyState?: ReactNode;\n /**\n * Draw the board — headers, empty columns, drop targets — even with no items,\n * instead of replacing it with `emptyState`. Opt in when the columns are\n * themselves the information (a configurable pipeline the user just defined)\n * or when an empty board still needs somewhere to drop a card into. Default\n * `false` keeps the `emptyState` behaviour every existing caller relies on.\n */\n showColumnsWhenEmpty?: boolean;\n /** Placeholder text inside an empty column. */\n columnEmptyText?: string;\n /**\n * When provided, each column gets a \"+ Add item\" button at its foot, revealed\n * on column hover or keyboard focus, that fires with the column's `value`.\n */\n onAddItem?: (toColumn: string) => void;\n /** Label for the per-column add button. */\n addItemText?: string;\n}\n\ninterface OverState {\n col: string;\n index: number;\n}\n\nexport default function Kanban<T>({\n items,\n columns,\n columnOf,\n getId,\n onMove,\n renderCard,\n onCardClick,\n sortInColumn,\n isLoading = false,\n loadingText = 'Loading…',\n emptyState,\n showColumnsWhenEmpty = false,\n columnEmptyText = 'Drop here',\n onAddItem,\n addItemText = 'Add item',\n}: KanbanProps<T>) {\n const [dragId, setDragId] = useState<string | null>(null);\n const [over, setOver] = useState<OverState | null>(null);\n\n const grouped = useMemo(() => {\n const map: Record<string, T[]> = {};\n for (const c of columns) map[c.value] = [];\n for (const it of items) (map[columnOf(it)] ??= []).push(it);\n if (sortInColumn) for (const k of Object.keys(map)) map[k].sort(sortInColumn);\n return map;\n }, [items, columns, columnOf, sortInColumn]);\n\n const reset = () => {\n setDragId(null);\n setOver(null);\n };\n\n // FLIP: when the order changes (e.g. on drop), slide each card from its old\n // position to its new one — so the dropped card and the cards making room for\n // it animate into place instead of snapping. Skipped while a drag is active.\n const boardRef = useRef<HTMLDivElement>(null);\n const prevRects = useRef<Map<string, DOMRect>>(new Map());\n useLayoutEffect(() => {\n if (dragId !== null) return;\n const board = boardRef.current;\n if (!board) return;\n const next = new Map<string, DOMRect>();\n const moved: [HTMLElement, number, number][] = [];\n board.querySelectorAll<HTMLElement>('[data-kanban-card]').forEach(el => {\n const id = el.dataset.kanbanCard as string;\n const rect = el.getBoundingClientRect();\n next.set(id, rect);\n const prev = prevRects.current.get(id);\n if (prev) {\n const dx = prev.left - rect.left;\n const dy = prev.top - rect.top;\n if (dx || dy) moved.push([el, dx, dy]);\n }\n });\n prevRects.current = next;\n if (!moved.length) return;\n // Invert: jump each moved card back to where it was, with no transition…\n for (const [el, dx, dy] of moved) {\n el.style.transition = 'none';\n el.style.transform = `translate(${dx}px, ${dy}px)`;\n }\n // …then play: release to the real position on the next frame so it animates.\n requestAnimationFrame(() => {\n for (const [el] of moved) {\n el.style.transition = 'transform 200ms cubic-bezier(0.2, 0, 0, 1)';\n el.style.transform = '';\n el.addEventListener(\n 'transitionend',\n () => {\n el.style.transition = '';\n el.style.transform = '';\n },\n { once: true },\n );\n }\n });\n // Re-measure only when the grouping (order/membership) changes or a drag\n // ends — not on every render — so typing/search doesn't thrash layout.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [grouped, dragId]);\n\n const commitMove = (col: string) => {\n if (dragId && over && over.col === col) {\n const colItems = grouped[col] ?? [];\n const dp = colItems.findIndex(it => getId(it) === dragId); // dragged's pos in this column, or -1\n const sameCol = dp !== -1;\n // Dropping right above or below itself changes nothing.\n const noop = sameCol && (over.index === dp || over.index === dp + 1);\n if (!noop) {\n // `over.index` counts the dragged card while it's still shown; remove it\n // from the count when the drop lands below its current slot.\n const toIndex = sameCol && over.index > dp ? over.index - 1 : over.index;\n onMove(dragId, col, toIndex);\n }\n }\n reset();\n };\n\n if (isLoading) return <div className=\"text-sm text-gray-500 p-4\">{loadingText}</div>;\n if (items.length === 0 && !showColumnsWhenEmpty) {\n return <>{emptyState ?? <div className=\"text-sm text-gray-500 p-4\">No items.</div>}</>;\n }\n\n return (\n <div ref={boardRef} className=\"flex-1 overflow-x-auto grid-scroll\">\n <div className=\"flex gap-3 h-full min-w-max pb-2\">\n {columns.map(col => {\n const colItems = grouped[col.value] ?? [];\n const isOver = over !== null && over.col === col.value;\n const dp = dragId !== null ? colItems.findIndex(it => getId(it) === dragId) : -1;\n // The drop-line index, or -1 to hide it (incl. the no-op slots next to the dragged card).\n const lineAt = isOver && !(dp !== -1 && (over!.index === dp || over!.index === dp + 1)) ? over!.index : -1;\n return (\n <div\n key={col.value}\n className={`group flex flex-col w-72 shrink-0 rounded-xl bg-gray-50 border transition-colors ${\n isOver ? 'border-blue-400 ring-2 ring-blue-300/60' : 'border-gray-200'\n }`}\n onDragOver={e => {\n // Accept the drop as a *move* so the browser doesn't treat it as\n // cancelled and play the native \"fly the drag-image back to its\n // origin\" animation — the snap-back the card showed before it\n // jumped to its new slot. Both this and `dropEffect` are needed:\n // preventing the default on dragover marks the column a valid\n // target, `dropEffect` makes the accepted action a move.\n e.preventDefault();\n try {\n e.dataTransfer.dropEffect = 'move';\n } catch {\n /* some environments disallow setting this */\n }\n }}\n onDrop={e => {\n // Prevent the default drop handling too, so the drag ends cleanly\n // at the drop point and React re-renders the card straight into\n // its new position — one smooth motion, no snap-back.\n e.preventDefault();\n commitMove(col.value);\n }}\n >\n <div\n className={`flex items-center justify-between px-3 py-2 rounded-t-xl text-sm font-medium ${\n col.accent ?? 'text-gray-700 bg-gray-100'\n }`}\n >\n <span className=\"flex items-center gap-2\">\n <span className={`h-2 w-2 rounded-full ${col.dot ?? 'bg-gray-400'}`} />\n {col.label}\n </span>\n <span className=\"text-xs opacity-70\">{colItems.length}</span>\n </div>\n <div\n className=\"flex-1 overflow-y-auto p-2 space-y-2 min-h-[120px]\"\n // Entering the column's empty area (not a card) targets the end.\n onDragEnter={() =>\n setOver(prev =>\n prev && prev.col === col.value && prev.index === colItems.length\n ? prev\n : { col: col.value, index: colItems.length },\n )\n }\n >\n {colItems.map((item, index) => {\n const id = getId(item);\n const isDragged = id === dragId;\n return (\n <Fragment key={id}>\n {lineAt === index && <div className=\"h-0.5 rounded-full bg-blue-500\" aria-hidden />}\n <div\n data-kanban-card={id}\n draggable\n onDragStart={e => {\n setDragId(id);\n try {\n e.dataTransfer.effectAllowed = 'move';\n } catch {\n /* some environments disallow setting this */\n }\n }}\n onDragEnter={e => {\n // Don't let the column's onDragEnter override this precise slot.\n e.stopPropagation();\n // Insert *after* this card when dragging it downward onto a\n // neighbour, *before* it when dragging up — otherwise nudging a\n // card down by one lands \"before its neighbour\" = its own slot,\n // which commitMove treats as a no-op (the same-column reorder bug).\n const draggedPos = dragId !== null ? colItems.findIndex(it => getId(it) === dragId) : -1;\n const target = draggedPos !== -1 && draggedPos < index ? index + 1 : index;\n setOver(prev =>\n prev && prev.col === col.value && prev.index === target\n ? prev\n : { col: col.value, index: target },\n );\n }}\n onDragEnd={reset}\n onClick={onCardClick ? () => onCardClick(item) : undefined}\n style={dragId === null ? undefined : { opacity: isDragged ? 0.4 : 1, transition: 'opacity 120ms ease' }}\n className={`rounded-lg bg-white border border-gray-200 p-3 shadow-sm hover:border-blue-400 hover:shadow transition ${\n onCardClick ? 'cursor-pointer' : ''\n }`}\n >\n {renderCard(item)}\n </div>\n </Fragment>\n );\n })}\n {colItems.length > 0 && lineAt === colItems.length && (\n <div className=\"h-0.5 rounded-full bg-blue-500\" aria-hidden />\n )}\n {colItems.length === 0 && (\n <div\n className={`text-[11px] text-center rounded-lg transition-all duration-150 ${\n isOver\n ? 'border-2 border-dashed border-blue-300 bg-blue-50/50 text-blue-400 py-8'\n : 'text-gray-400 py-6'\n }`}\n >\n {columnEmptyText}\n </div>\n )}\n </div>\n {onAddItem && (\n <div className=\"p-2 pt-0\">\n <button\n type=\"button\"\n onClick={() => onAddItem(col.value)}\n // Hidden until the column is hovered or the button is keyboard-focused.\n // It always reserves its row so revealing it never shifts the layout.\n className=\"flex w-full items-center justify-center gap-1 rounded-lg px-2 py-1.5 text-xs font-medium text-gray-500 opacity-0 transition hover:bg-gray-100 hover:text-gray-700 focus-visible:opacity-100 group-hover:opacity-100\"\n >\n <span aria-hidden className=\"text-sm leading-none\">\n +\n </span>\n {addItemText}\n </button>\n </div>\n )}\n </div>\n );\n })}\n </div>\n </div>\n );\n}\n","/**\n * Pagination — a numbered page control for classic paginated tables/lists, with\n * prev/next and optional first/last edges and ellipsis gaps. Controlled: the\n * consumer owns `page` and updates it in `onPageChange`. Complements ListFooter\n * (which shows counts/selection for infinite-scroll lists).\n */\n\nexport interface PaginationProps {\n /** Current page, 1-based. */\n page: number;\n pageCount: number;\n onPageChange: (page: number) => void;\n /** How many page numbers to show on each side of the current page. */\n siblingCount?: number;\n /** Show first/last («/») buttons. */\n showEdges?: boolean;\n className?: string;\n}\n\nfunction buildPages(page: number, pageCount: number, sibling: number): (number | '…')[] {\n const wanted = new Set<number>([1, pageCount]);\n for (let i = page - sibling; i <= page + sibling; i++) {\n if (i >= 1 && i <= pageCount) wanted.add(i);\n }\n const sorted = [...wanted].sort((a, b) => a - b);\n const out: (number | '…')[] = [];\n let prev = 0;\n for (const p of sorted) {\n if (prev && p - prev > 1) out.push('…');\n out.push(p);\n prev = p;\n }\n return out;\n}\n\nconst BTN =\n 'inline-flex h-8 min-w-8 items-center justify-center rounded-md px-2 text-sm transition-colors ' +\n 'disabled:cursor-not-allowed disabled:opacity-40';\n\nexport default function Pagination({\n page, pageCount, onPageChange, siblingCount = 1, showEdges = false, className = '',\n}: PaginationProps) {\n if (pageCount <= 1) return null;\n const pages = buildPages(page, pageCount, siblingCount);\n const go = (p: number) => { if (p >= 1 && p <= pageCount && p !== page) onPageChange(p); };\n\n return (\n <nav aria-label=\"Pagination\" className={`flex items-center gap-1 ${className}`.trim()}>\n {showEdges && (\n <button type=\"button\" aria-label=\"First page\" disabled={page === 1} onClick={() => go(1)} className={`${BTN} text-gray-600 hover:bg-gray-100`}>«</button>\n )}\n <button type=\"button\" aria-label=\"Previous page\" disabled={page === 1} onClick={() => go(page - 1)} className={`${BTN} text-gray-600 hover:bg-gray-100`}>‹</button>\n {pages.map((p, i) =>\n p === '…' ? (\n <span key={`gap-${i}`} className=\"px-1 text-gray-400\">…</span>\n ) : (\n <button\n key={p}\n type=\"button\"\n aria-current={p === page ? 'page' : undefined}\n onClick={() => go(p)}\n className={`${BTN} ${p === page ? 'bg-blue-600 font-medium text-white' : 'text-gray-700 hover:bg-gray-100'}`}\n >\n {p}\n </button>\n )\n )}\n <button type=\"button\" aria-label=\"Next page\" disabled={page === pageCount} onClick={() => go(page + 1)} className={`${BTN} text-gray-600 hover:bg-gray-100`}>›</button>\n {showEdges && (\n <button type=\"button\" aria-label=\"Last page\" disabled={page === pageCount} onClick={() => go(pageCount)} className={`${BTN} text-gray-600 hover:bg-gray-100`}>»</button>\n )}\n </nav>\n );\n}\n","/**\n * DataTable — a presentational table for server-driven lists.\n *\n * It renders and it reports. It does not fetch, it does not sort, and it does\n * not paginate: the caller owns `sort` and `page` and hands back new data. That\n * is the whole design, and it is what makes it usable against a Django list\n * endpoint where the ordering happens in SQL and the rows on screen are one\n * page of a much larger set. A table that sorts its own `data` prop quietly\n * sorts the current page only, which is wrong in a way nobody notices until the\n * second page disagrees with the first.\n *\n * ── Which table is which ──\n * `EditableGrid` — a spreadsheet. Cells are typed into.\n * `ResizableTable` — persists column widths per user; needs react-query + axios.\n * `EntityList` — a whole list VIEW: fetching, export, context actions.\n * `DataTable` — this. Read-only rows, no peers, no data layer.\n *\n * Sort uses the package's own `SortState` rather than a table-specific vocabulary,\n * so `DataTable`, `useSort` and `ResizableTable` all speak the same language and\n * a caller can move between them without a translation layer.\n */\nimport { useLayoutEffect, useRef, useState, type KeyboardEvent, type ReactNode, type UIEvent } from 'react';\nimport Pagination from './Pagination';\nimport Checkbox from '../forms/Checkbox';\nimport { useShellStrings } from '../shell/strings';\nimport type { SortState } from './types';\n\nexport interface DataTableColumn<T> {\n key: string;\n title: ReactNode;\n /** Read this field when there is no `render`. */\n dataIndex?: keyof T & string;\n render?: (row: T, index: number) => ReactNode;\n align?: 'left' | 'right' | 'center';\n /**\n * The column holds a figure or a code — money, a quantity, a part or order\n * number.\n *\n * Renders it monospaced and right-aligns it by default. The table already\n * sets `tabular-nums`, so the digits line up down the column either way;\n * what this adds is a fixed advance for EVERY character, which is what lets\n * `00620L6N25KMFCBTDTM2QND` be compared against its neighbour by shape, and\n * a decimal point be found at the right edge without reading the number.\n */\n numeric?: boolean;\n /** Px. Also feeds the table's minimum width — see `minWidth`. */\n width?: number;\n /** Single-line with an ellipsis. */\n ellipsis?: boolean;\n /**\n * Pin to the left edge while the table scrolls horizontally. Only useful\n * with `minWidth` set, and only worth it for the columns that identify the\n * row — a part number, a name.\n */\n fixed?: 'left';\n /**\n * Offer a sort control. The FIELD sent to the server is `sortField ?? key`,\n * which is what lets a column named `no` sort by `part_number` without the\n * caller mapping names at the call site.\n */\n sortable?: boolean;\n /**\n * Which way the FIRST click sorts. Defaults to ascending.\n *\n * `desc` is right wherever the interesting end is the top: a price column,\n * a quantity, a date where the newest matters. Making those start ascending\n * costs every user two clicks to see the thing they opened the column for.\n *\n * The cycle is unchanged either way — first click, second click, then back\n * to the server's own ordering.\n */\n sortFirst?: 'asc' | 'desc';\n sortField?: string;\n headerClassName?: string;\n}\n\n/**\n * A header spanning several columns — \"Debit\" over an amount and a balance.\n *\n * The group is not decoration: where two children are both called \"Amount\",\n * it is the only thing telling them apart, and a screen reader reads it as\n * part of each cell's column context.\n */\nexport interface DataTableColumnGroup<T> {\n title: ReactNode;\n columns: DataTableColumn<T>[];\n /** Distinct among its siblings. Defaults to the group's index. */\n key?: string;\n headerClassName?: string;\n}\n\n/** A leaf column, or a group of them. */\nexport type DataTableHeader<T> = DataTableColumn<T> | DataTableColumnGroup<T>;\n\nconst isGroup = <T,>(h: DataTableHeader<T>): h is DataTableColumnGroup<T> =>\n Array.isArray((h as DataTableColumnGroup<T>).columns);\n\nexport interface DataTableProps<T> {\n columns: DataTableHeader<T>[];\n data: T[];\n /** Stable identity per row. A string names a field; a function computes it. */\n rowKey: (keyof T & string) | ((row: T, index: number) => string);\n /** Current sort, or null. Controlled — this component never sorts `data`. */\n sort?: SortState | null;\n onSortChange?: (sort: SortState | null) => void;\n /** Server pagination. Omit entirely for an unpaginated or infinite list. */\n pagination?: { page: number; pageCount: number; onPageChange: (page: number) => void };\n /**\n * Names the table for assistive technology, rendered as a visually hidden\n * `<caption>`.\n *\n * A table with no name is announced as \"table\" and nothing else, so a page\n * with two of them — the invoice lines and the payments against it — gives a\n * screen-reader user two identical landmarks and no way to tell which is\n * which. The heading above it is not enough: table navigation jumps between\n * tables, not through the prose around them.\n */\n caption?: string;\n loading?: boolean;\n bordered?: boolean;\n size?: 'sm' | 'md';\n /**\n * Minimum table width in px. Below it the table scrolls horizontally instead\n * of crushing columns. Usually the sum of the columns' widths.\n */\n minWidth?: number;\n rowClassName?: (row: T, index: number) => string;\n onRow?: (row: T, index: number) => { onClick?: () => void; className?: string };\n emptyText?: ReactNode;\n /**\n * Row selection — a leading checkbox column, controlled by row key.\n *\n * `selected` holds row KEYS (what `rowKey` yields), so a selection made on\n * one page survives paging to the next: the header checkbox adds or removes\n * only the CURRENT data's keys and leaves foreign keys alone, which is what\n * lets \"select these three here, two more on page 4\" accumulate. EntityList\n * has the heavyweight version (with shift-click ranges); this is the\n * peer-free one.\n */\n selection?: { selected: string[]; onChange: (selected: string[]) => void };\n /** Rendered under the rows — an infinite-scroll sentinel, a totals strip. */\n footer?: ReactNode;\n /**\n * Windowed rendering for large LOADED datasets. Pagination and infinite\n * scroll bound what is fetched; this bounds what is RENDERED — a few\n * thousand loaded rows otherwise all get DOM, and every sort or filter\n * re-lays-out the lot. The wrapper becomes a vertical scroll container of\n * `height` px, only the rows near the viewport exist in the DOM (padded to\n * the full scroll height by two spacer rows), and the header pins to the\n * top of the scroll.\n *\n * `rowHeight` is a promise, not a measurement: every row is rendered at\n * exactly that height (the scroll math depends on it), so `ellipsis` your\n * long columns rather than letting them wrap. Off-screen rows are absent\n * for assistive technology too — same trade every windowed list makes.\n */\n virtualized?: { height: number; rowHeight: number; overscan?: number };\n className?: string;\n}\n\nconst PAD: Record<'sm' | 'md', string> = {\n sm: 'px-2 py-1.5',\n md: 'px-3 py-2',\n};\n\nconst ALIGN: Record<'left' | 'right' | 'center', string> = {\n left: 'text-left',\n right: 'text-right',\n center: 'text-center',\n};\n\nfunction SortIcon({ direction }: { direction: 'asc' | 'desc' | null }) {\n // Both arrows always render; the inactive one is dimmed. A control that\n // appears only once sorted gives no hint that sorting is available at all.\n return (\n <span className=\"ml-1 inline-flex flex-col leading-none\" aria-hidden=\"true\">\n <svg className={`h-2 w-2 ${direction === 'asc' ? 'text-gray-700' : 'text-gray-300'}`} viewBox=\"0 0 8 5\" fill=\"currentColor\">\n <path d=\"M4 0L8 5H0z\" />\n </svg>\n <svg className={`h-2 w-2 ${direction === 'desc' ? 'text-gray-700' : 'text-gray-300'}`} viewBox=\"0 0 8 5\" fill=\"currentColor\">\n <path d=\"M4 5L0 0h8z\" />\n </svg>\n </span>\n );\n}\n\nexport default function DataTable<T>({\n columns, data, rowKey, sort = null, onSortChange, pagination, caption, loading = false,\n bordered = false, size = 'md', minWidth, rowClassName, onRow, emptyText,\n selection, footer, virtualized, className = '',\n}: DataTableProps<T>) {\n // Catalog defaults — a caller's own `emptyText` always wins (see strings.tsx).\n const strings = useShellStrings();\n const emptyContent = emptyText ?? strings.table.empty;\n const keyOf = (row: T, i: number): string =>\n typeof rowKey === 'function' ? rowKey(row, i) : String(row[rowKey]);\n\n // ── Row window ──\n // `startRow` is the only scroll-derived state, and it is a row index, not a\n // pixel offset: the setter bails until the scroll crosses a row boundary, so\n // a table not being scrolled re-renders nothing.\n const [startRow, setStartRow] = useState(0);\n const overscan = virtualized?.overscan ?? 6;\n const onBodyScroll = virtualized\n ? (e: UIEvent<HTMLDivElement>) => {\n const next = Math.max(0, Math.floor(e.currentTarget.scrollTop / virtualized.rowHeight) - overscan);\n setStartRow(prev => (prev === next ? prev : next));\n }\n : undefined;\n const windowSize = virtualized\n ? Math.ceil(virtualized.height / virtualized.rowHeight) + overscan * 2\n : data.length;\n const start = virtualized ? Math.min(startRow, Math.max(0, data.length - windowSize)) : 0;\n const end = Math.min(data.length, start + windowSize);\n const topPad = virtualized ? start * virtualized.rowHeight : 0;\n const bottomPad = virtualized ? (data.length - end) * virtualized.rowHeight : 0;\n\n // The grouped header's SECOND row pins below the first, which means knowing\n // the first row's height — measured, because it depends on `size` and on\n // whatever the group titles wrap to.\n const headRowRef = useRef<HTMLTableRowElement>(null);\n const [headRowH, setHeadRowH] = useState(0);\n useLayoutEffect(() => {\n if (!virtualized) return;\n const h = headRowRef.current?.offsetHeight ?? 0;\n setHeadRowH(prev => (prev === h ? prev : h));\n });\n\n const fieldOf = (col: DataTableColumn<T>) => col.sortField ?? col.key;\n\n const directionFor = (col: DataTableColumn<T>): 'asc' | 'desc' | null =>\n sort && sort.field === fieldOf(col) ? sort.direction : null;\n\n const toggleSort = (col: DataTableColumn<T>) => {\n if (!onSortChange) return;\n const field = fieldOf(col);\n const current = directionFor(col);\n // First → second → unsorted. The third state matters: without it there is\n // no way back to the server's own default ordering once a column is\n // clicked. Which way \"first\" goes is the column's to say — see sortFirst.\n const first = col.sortFirst ?? 'asc';\n const second = first === 'asc' ? 'desc' : 'asc';\n if (current === null) onSortChange({ field, direction: first });\n else if (current === first) onSortChange({ field, direction: second });\n else onSortChange(null);\n };\n\n // Every rendering below the header row works on the LEAVES: a group has no\n // cells of its own, only a span over its children's.\n const leaves: DataTableColumn<T>[] = columns.flatMap(h => (isGroup(h) ? h.columns : [h]));\n const grouped = columns.some(isGroup);\n\n // ── Selection ──\n const selectedSet = new Set(selection?.selected ?? []);\n const pageKeys = selection ? data.map((row, i) => keyOf(row, i)) : [];\n const allSelected = pageKeys.length > 0 && pageKeys.every(k => selectedSet.has(k));\n const someSelected = pageKeys.some(k => selectedSet.has(k));\n const toggleRow = (key: string) => {\n if (!selection) return;\n selection.onChange(\n selectedSet.has(key)\n ? selection.selected.filter(k => k !== key)\n : [...selection.selected, key],\n );\n };\n // Only the current data's keys move; a selection made on another page is\n // not this checkbox's to clear.\n const toggleAll = () => {\n if (!selection) return;\n const page = new Set(pageKeys);\n selection.onChange(\n allSelected\n ? selection.selected.filter(k => !page.has(k))\n : [...selection.selected, ...pageKeys.filter(k => !selectedSet.has(k))],\n );\n };\n /** The checkbox column shifts every pinned offset right by its width. */\n const SELECT_W = 36;\n const selOffset = selection ? SELECT_W : 0;\n // The spacer/empty colSpans and the pinned-corner z-index care about it too.\n const colCount = leaves.length + (selection ? 1 : 0);\n const hasPinned = leaves.some(c => c.fixed === 'left');\n\n const cellBase = `${PAD[size]} ${size === 'sm' ? 'text-xs' : 'text-sm'}`;\n\n /**\n * One header cell. Shared by both header rows so a grouped table's leaves\n * are drawn by the same code as an ungrouped table's — the sort button, the\n * aria-sort, the pinning and the alignment are not worth having twice.\n */\n const headerCell = (col: DataTableColumn<T>, ci: number, rowSpan: number, topOffset = 0) => {\n const dir = directionFor(col);\n // A figures column right-aligns unless the caller says otherwise: the\n // decimal point is the thing being compared, and it only lines up at the\n // right edge.\n const align = ALIGN[col.align ?? (col.numeric ? 'right' : 'left')];\n const pinned = col.fixed === 'left';\n return (\n <th\n key={col.key}\n scope=\"col\"\n rowSpan={rowSpan > 1 ? rowSpan : undefined}\n // aria-sort is what a screen reader announces; the arrows are\n // decorative and marked so.\n // `none` rather than nothing on a sortable column: it is how a screen\n // reader knows the column CAN be sorted. Omitted, the only columns\n // that announce themselves as sortable are the ones already sorted.\n aria-sort={\n dir === 'asc' ? 'ascending'\n : dir === 'desc' ? 'descending'\n : col.sortable && onSortChange ? 'none'\n : undefined\n }\n style={{\n width: col.width,\n ...(pinned ? { left: (offsets[ci] ?? 0) + selOffset } : {}),\n // A virtualized header pins to the top of the vertical scroll; one\n // sticky box can hold both axes, so a pinned column's header corner\n // stays put in both directions.\n ...(virtualized ? { top: topOffset } : {}),\n }}\n className={[\n cellBase, align,\n 'font-semibold uppercase tracking-wide text-gray-500',\n size === 'sm' ? 'text-[10px]' : 'text-xs',\n pinned\n ? (virtualized ? 'sticky z-20 bg-gray-50' : 'sticky z-10 bg-gray-50')\n : (virtualized ? 'sticky z-10 bg-gray-50' : ''),\n col.headerClassName ?? '',\n ].filter(Boolean).join(' ')}\n >\n {col.sortable && onSortChange ? (\n <button\n type=\"button\"\n onClick={() => toggleSort(col)}\n className={`inline-flex items-center font-semibold uppercase tracking-wide hover:text-gray-700 ${align}`}\n >\n {col.title}\n <SortIcon direction={dir} />\n </button>\n ) : col.title}\n </th>\n );\n };\n // Running totals of the widths to the left of each fixed column, so a second\n // pinned column sits flush against the first instead of on top of it.\n let fixedOffset = 0;\n const offsets = leaves.map(col => {\n if (col.fixed !== 'left') return null;\n const at = fixedOffset;\n fixedOffset += col.width ?? 0;\n return at;\n });\n\n return (\n <div className={className}>\n <div\n onScroll={onBodyScroll}\n style={virtualized ? { maxHeight: virtualized.height } : undefined}\n className={`relative overflow-x-auto ${virtualized ? 'overflow-y-auto' : ''} ${bordered ? 'rounded-lg border border-gray-200' : ''}`.trim()}\n >\n {loading && (\n // An overlay rather than replacing the rows: the table keeps its\n // height and its scroll position, so re-sorting does not throw the\n // page around under the user.\n <div className=\"absolute inset-0 z-20 flex items-start justify-center bg-white/60 pt-8\" role=\"status\" aria-live=\"polite\">\n <span className=\"h-6 w-6 animate-spin rounded-full border-2 border-gray-200 border-t-blue-600\" />\n <span className=\"sr-only\">{strings.table.loading}</span>\n </div>\n )}\n <table className=\"w-full border-collapse tabular-nums\" style={minWidth ? { minWidth } : undefined}>\n {caption && <caption className=\"sr-only\">{caption}</caption>}\n <thead>\n <tr ref={headRowRef} className=\"border-b border-gray-200 bg-gray-50\">\n {selection && (\n <th\n scope=\"col\"\n rowSpan={grouped ? 2 : undefined}\n style={{ width: SELECT_W, ...(virtualized ? { top: 0 } : {}) }}\n className={[\n cellBase,\n hasPinned || virtualized ? 'sticky z-20 bg-gray-50' : '',\n hasPinned ? 'left-0' : '',\n ].filter(Boolean).join(' ')}\n >\n <Checkbox\n aria-label={strings.table.selectAll}\n checked={allSelected}\n // Was a bare ref callback writing the DOM property. The\n // kit's own box owns that dance — and the part the local\n // version was missing: a browser CLEARS `indeterminate`\n // whenever `checked` is assigned, so it has to be rewritten\n // after every render that touches the checked state, not\n // only when the mixed-ness itself changes.\n indeterminate={someSelected && !allSelected}\n onChange={toggleAll}\n />\n </th>\n )}\n {columns.map((h, hi) => {\n if (isGroup(h)) {\n return (\n <th\n key={h.key ?? `group-${hi}`}\n scope=\"colgroup\"\n colSpan={h.columns.length}\n style={virtualized ? { top: 0 } : undefined}\n className={[\n cellBase, 'text-center',\n 'font-semibold uppercase tracking-wide text-gray-500',\n size === 'sm' ? 'text-[10px]' : 'text-xs',\n 'border-b border-gray-200',\n virtualized ? 'sticky z-10 bg-gray-50' : '',\n h.headerClassName ?? '',\n ].filter(Boolean).join(' ')}\n >\n {h.title}\n </th>\n );\n }\n // A leaf beside a group spans both header rows, so its label\n // sits level with the group's children rather than floating\n // above an empty cell.\n return headerCell(h, leaves.indexOf(h), grouped ? 2 : 1);\n })}\n </tr>\n {grouped && (\n <tr className=\"border-b border-gray-200 bg-gray-50\">\n {columns.flatMap(h => (isGroup(h) ? h.columns : [])).map(col =>\n headerCell(col, leaves.indexOf(col), 1, headRowH),\n )}\n </tr>\n )}\n </thead>\n <tbody>\n {data.length === 0 && !loading ? (\n <tr>\n <td colSpan={colCount} className={`${cellBase} py-10 text-center text-gray-500`}>\n {emptyContent}\n </td>\n </tr>\n ) : (\n <>\n {/* Spacer rows stand in for everything scrolled out of the\n * window, so the scrollbar's size and position tell the truth\n * about the whole dataset. aria-hidden: they are geometry, not\n * data. */}\n {topPad > 0 && (\n <tr aria-hidden=\"true\">\n <td colSpan={colCount} style={{ height: topPad, padding: 0, border: 0 }} />\n </tr>\n )}\n {data.slice(start, end).map((row, si) => {\n const i = start + si;\n const rowProps = onRow?.(row, i);\n return (\n <tr\n key={keyOf(row, i)}\n style={virtualized ? { height: virtualized.rowHeight } : undefined}\n onClick={rowProps?.onClick}\n // A clickable row that only answers a mouse is unreachable\n // for everyone else — there is no other control in it to\n // tab to. Focusable, and Enter or Space opens it, which is\n // what the pointer does.\n {...(rowProps?.onClick\n ? {\n tabIndex: 0,\n onKeyDown: (e: KeyboardEvent<HTMLTableRowElement>) => {\n // Only the row's OWN key presses. A keydown from a\n // control inside a cell bubbles up here, so without\n // this an Edit button answered with Enter fired the\n // button AND opened the row — and the\n // preventDefault below ate the space bar of any\n // text input in the table.\n if (e.target !== e.currentTarget) return;\n if (e.key !== 'Enter' && e.key !== ' ') return;\n // Space scrolls the page otherwise, and the row the\n // user was aiming at leaves the screen.\n e.preventDefault();\n rowProps.onClick?.();\n },\n }\n : {})}\n className={[\n 'border-b border-gray-100 last:border-b-0',\n rowProps?.onClick\n ? 'cursor-pointer hover:bg-gray-50 focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-400'\n : '',\n rowClassName?.(row, i) ?? '',\n rowProps?.className ?? '',\n ].filter(Boolean).join(' ')}\n >\n {selection && (() => {\n const key = keyOf(row, i);\n return (\n <td\n style={{ width: SELECT_W }}\n // Clicks here toggle selection, never open the row.\n onClick={e => e.stopPropagation()}\n className={[cellBase, hasPinned ? 'sticky left-0 z-10 bg-white' : ''].filter(Boolean).join(' ')}\n >\n <Checkbox\n aria-label={strings.table.selectRow}\n checked={selectedSet.has(key)}\n onChange={() => toggleRow(key)}\n />\n </td>\n );\n })()}\n {leaves.map((col, ci) => {\n const pinned = col.fixed === 'left';\n return (\n <td\n key={col.key}\n style={pinned ? { left: (offsets[ci] ?? 0) + selOffset } : undefined}\n className={[\n cellBase, ALIGN[col.align ?? (col.numeric ? 'right' : 'left')],\n col.numeric ? 'font-mono' : '', 'text-gray-900',\n col.ellipsis ? 'max-w-0 truncate' : '',\n // A pinned cell needs its own background or the\n // scrolling columns show through it.\n pinned ? 'sticky z-10 bg-white' : '',\n ].filter(Boolean).join(' ')}\n >\n {col.render\n ? col.render(row, i)\n : col.dataIndex\n ? (row[col.dataIndex] as ReactNode)\n : null}\n </td>\n );\n })}\n </tr>\n );\n })}\n {bottomPad > 0 && (\n <tr aria-hidden=\"true\">\n <td colSpan={colCount} style={{ height: bottomPad, padding: 0, border: 0 }} />\n </tr>\n )}\n </>\n )}\n </tbody>\n </table>\n {footer}\n </div>\n {pagination && pagination.pageCount > 1 && (\n <div className=\"mt-3 flex justify-end\">\n <Pagination\n page={pagination.page}\n pageCount={pagination.pageCount}\n onPageChange={pagination.onPageChange}\n />\n </div>\n )}\n </div>\n );\n}\n","import type { ReactNode } from 'react';\n\ninterface ListFooterProps {\n selectedCount: number;\n loadedCount: number;\n totalCount?: number;\n label: string;\n isFetchingMore?: boolean;\n extra?: ReactNode;\n}\n\n/**\n * Standardized footer for `EntityList`. Shows:\n * \"[X selected — ] Y records\"\n * \"Y of Z records · Loading more...\"\n * \"All N records loaded\"\n */\nexport default function ListFooter({\n selectedCount,\n loadedCount,\n totalCount,\n label,\n isFetchingMore,\n extra,\n}: ListFooterProps) {\n const total = totalCount ?? loadedCount;\n const allLoaded = loadedCount >= total;\n\n return (\n <>\n {extra}\n {selectedCount > 0 ? `${selectedCount} selected — ` : ''}\n {allLoaded\n ? (totalCount != null ? `All ${total.toLocaleString()} ${label} loaded` : `${total.toLocaleString()} ${label}`)\n : `${loadedCount.toLocaleString()} of ${total.toLocaleString()} ${label}`\n }\n {isFetchingMore ? ' · Loading more...' : ''}\n </>\n );\n}\n","import Button from '../forms/Button';\n\nexport interface ListLoadErrorProps {\n /** Bold heading. Defaults to \"Couldn't load this list\". */\n title?: string;\n /** Muted explanatory line. Defaults to a generic connection/retry message. */\n message?: string;\n /** When provided, renders a \"Try again\" button that calls it (wire the\n * data source's `refetch`). Omit for a static, non-retryable error. */\n onRetry?: () => void;\n /** Frame around the content, mirroring {@link EmptyState}: `dashed`\n * (default), `card` (bordered surface), or `none`. */\n variant?: 'dashed' | 'card' | 'none';\n}\n\n/**\n * ListLoadError — the error counterpart to `EmptyState` for data lists. Shown\n * when a list's fetch fails (5xx, auth expiry, network) so an outage reads as\n * an error with a retry affordance instead of a misleading \"nothing here\"\n * empty state. Visual language mirrors `EmptyState`, tinted for error.\n */\nexport default function ListLoadError({\n title = \"Couldn't load this list\",\n message = 'Something went wrong fetching these records. Check your connection and try again.',\n onRetry,\n variant = 'dashed',\n}: ListLoadErrorProps) {\n const frame =\n variant === 'card' ? 'rounded-md border border-gray-200 bg-white px-6 py-12' :\n variant === 'none' ? 'px-6 py-12' :\n 'rounded-lg border-2 border-dashed border-red-200 px-6 py-12';\n return (\n <div className={`flex flex-col items-center justify-center text-center ${frame}`} role=\"alert\">\n <svg className=\"h-10 w-10 text-red-300 mb-3\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" strokeWidth={1} aria-hidden=\"true\">\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M12 9v3.75m0 3.75h.008M10.34 3.94l-8.4 14.55A1.5 1.5 0 003.24 21h17.52a1.5 1.5 0 001.3-2.51l-8.4-14.55a1.5 1.5 0 00-2.6 0z\" />\n </svg>\n <h3 className=\"text-sm font-medium text-gray-900\">{title}</h3>\n <p className=\"text-sm text-gray-500 mt-2\">{message}</p>\n {onRetry && (\n <div className=\"mt-4\">\n <Button variant=\"secondary\" size=\"sm\" onClick={onRetry}>Try again</Button>\n </div>\n )}\n </div>\n );\n}\n","/**\n * Sparkline — a compact trend line (optionally area-filled) drawn as inline\n * SVG. Color defaults to `currentColor`, so set the line color with a parent\n * `text-*` class. Good inside StatCards and table cells.\n */\nimport { type SparklineProps } from './types';\n\nexport default function Sparkline({\n data, width = 120, height = 32, stroke = 'currentColor', fill,\n strokeWidth = 1.5, showDots = false, className, style,\n}: SparklineProps) {\n if (data.length === 0) return null;\n const max = Math.max(...data);\n const min = Math.min(...data);\n const span = max - min || 1;\n const pad = strokeWidth + (showDots ? 2 : 0);\n const y = (v: number) => height - pad - ((v - min) / span) * (height - pad * 2);\n // A single point has no slope — draw a flat baseline across the full width.\n const pts: [number, number][] = data.length === 1\n ? [[0, height / 2], [width, height / 2]]\n : data.map((v, i) => [(i * width) / (data.length - 1), y(v)]);\n const line = pts.map(([x, yy], i) => `${i === 0 ? 'M' : 'L'}${x.toFixed(2)},${yy.toFixed(2)}`).join(' ');\n const area = `${line} L${width.toFixed(2)},${height} L0,${height} Z`;\n\n return (\n <svg\n className={className}\n style={style}\n width={width}\n height={height}\n viewBox={`0 0 ${width} ${height}`}\n preserveAspectRatio=\"none\"\n role=\"img\"\n aria-hidden=\"true\"\n >\n {fill && <path d={area} fill={fill} stroke=\"none\" />}\n <path d={line} fill=\"none\" stroke={stroke} strokeWidth={strokeWidth} strokeLinejoin=\"round\" strokeLinecap=\"round\" />\n {showDots && pts.map(([x, yy], i) => <circle key={i} cx={x} cy={yy} r={strokeWidth + 0.5} fill={stroke} />)}\n </svg>\n );\n}\n","/**\n * BarChart — a simple vertical bar chart built from CSS-sized divs (no SVG, no\n * dependency). Bar color defaults to `currentColor` (set it with a parent\n * `text-*` class) or per-bar via `colors`. Covers the decorative bar summaries\n * a dashboard needs.\n */\nimport { type BarChartProps } from './types';\n\nexport default function BarChart({\n data, labels, height = 120, color = 'currentColor', colors, max, gap = 6, className, style,\n}: BarChartProps) {\n if (data.length === 0) return null;\n const peak = max ?? (Math.max(...data, 0) || 1);\n\n return (\n <div className={className} style={style}>\n <div className=\"flex items-end\" style={{ height, gap }}>\n {data.map((v, i) => (\n <div key={i} className=\"flex flex-1 flex-col justify-end\" style={{ height: '100%' }}>\n <div\n className=\"w-full rounded-t\"\n style={{\n height: `${Math.max(0, (v / peak) * 100)}%`,\n minHeight: v > 0 ? 2 : 0,\n backgroundColor: colors?.[i] ?? color,\n }}\n title={labels?.[i] != null ? `${labels[i]}: ${v}` : String(v)}\n />\n </div>\n ))}\n </div>\n {labels && (\n <div className=\"mt-1 flex\" style={{ gap }}>\n {labels.map((l, i) => (\n <div key={i} className=\"flex-1 truncate text-center text-[10px] text-gray-400\">{l}</div>\n ))}\n </div>\n )}\n </div>\n );\n}\n","/**\n * DonutChart — a ring chart drawn with SVG stroke-dasharray segments. Segment\n * colors default to a built-in palette (override per segment). The track uses a\n * theme-agnostic translucent slate so it reads in both light and dark mode.\n */\nimport { type DonutChartProps } from './types';\n\nconst PALETTE = ['#3b82f6', '#22c55e', '#f59e0b', '#ef4444', '#6366f1', '#14b8a6', '#a855f7', '#64748b'];\n\nexport default function DonutChart({ segments, size = 120, thickness = 16, centerLabel, className, style }: DonutChartProps) {\n const total = segments.reduce((s, x) => s + Math.max(0, x.value), 0) || 1;\n const r = (size - thickness) / 2;\n const c = size / 2;\n const circ = 2 * Math.PI * r;\n let offset = 0;\n\n return (\n <div\n className={`relative inline-flex items-center justify-center ${className ?? ''}`.trim()}\n style={{ width: size, height: size, ...style }}\n >\n <svg width={size} height={size} viewBox={`0 0 ${size} ${size}`} role=\"img\" aria-hidden=\"true\" style={{ transform: 'rotate(-90deg)' }}>\n <circle cx={c} cy={c} r={r} fill=\"none\" stroke=\"rgba(148,163,184,0.25)\" strokeWidth={thickness} />\n {segments.map((s, i) => {\n const len = (Math.max(0, s.value) / total) * circ;\n const el = (\n <circle\n key={i}\n cx={c}\n cy={c}\n r={r}\n fill=\"none\"\n stroke={s.color ?? PALETTE[i % PALETTE.length]}\n strokeWidth={thickness}\n strokeDasharray={`${len} ${circ - len}`}\n strokeDashoffset={-offset}\n />\n );\n offset += len;\n return el;\n })}\n </svg>\n {centerLabel != null && (\n <div className=\"absolute text-center text-sm font-semibold text-gray-900\">{centerLabel}</div>\n )}\n </div>\n );\n}\n","/**\n * LineChart — a trend over time with an optional scale, legend and area fill.\n * Sparkline's big sibling: multi-series, container-filling width, still\n * dependency-free inline SVG themed by `currentColor`.\n *\n * The plot stretches (`viewBox 0 0 100 100`, `preserveAspectRatio=\"none\"`) so\n * it can fill whatever the dashboard gives it; `vector-effect:\n * non-scaling-stroke` keeps the lines a uniform screen-space width under that\n * stretch, and the dots are zero-length round-capped strokes for the same\n * reason — a stretched `<circle>` is an ellipse.\n *\n * Like the other charts this is decorative (`aria-hidden`): the numbers it\n * draws should also exist as text somewhere on the page.\n */\nimport { type LineChartProps, type LineChartSeries } from './types';\n\nfunction toPoints(data: number[], min: number, span: number): [number, number][] {\n // A single point has no slope — draw a flat line across the full width.\n if (data.length === 1) return [[0, 100 - ((data[0] - min) / span) * 100], [100, 100 - ((data[0] - min) / span) * 100]];\n return data.map((v, i) => [(i * 100) / (data.length - 1), 100 - ((v - min) / span) * 100]);\n}\n\nfunction pathFor(pts: [number, number][]): string {\n return pts.map(([x, y], i) => `${i === 0 ? 'M' : 'L'}${x.toFixed(2)},${y.toFixed(2)}`).join(' ');\n}\n\nconst fmt = (v: number) => (Number.isInteger(v) ? String(v) : v.toFixed(1));\n\nexport default function LineChart({\n series, labels, height = 160, strokeWidth = 2, showDots = false,\n max, min, showScale = false, showLegend = false, className, style,\n}: LineChartProps) {\n const drawn = series.filter(s => s.data.length > 0);\n if (drawn.length === 0) return null;\n const all = drawn.flatMap(s => s.data);\n const top = max ?? Math.max(...all);\n const bottom = min ?? Math.min(...all);\n const span = top - bottom || 1;\n const color = (s: LineChartSeries) => s.color ?? 'currentColor';\n\n return (\n <div className={className} style={style}>\n {showLegend && drawn.some(s => s.label) && (\n <div className=\"mb-1.5 flex flex-wrap items-center gap-x-3 gap-y-0.5\">\n {drawn.map((s, i) => s.label && (\n <span key={i} className=\"flex items-center gap-1 text-xs text-gray-500\">\n <span className=\"h-2 w-2 rounded-full\" style={{ backgroundColor: color(s) }} />\n {s.label}\n </span>\n ))}\n </div>\n )}\n <div className=\"flex\">\n {showScale && (\n <div className=\"flex flex-col justify-between pr-1.5 text-right text-[10px] leading-none text-gray-400\" style={{ height }}>\n <span>{fmt(top)}</span>\n <span>{fmt(bottom + span / 2)}</span>\n <span>{fmt(bottom)}</span>\n </div>\n )}\n <svg\n className=\"min-w-0 flex-1\"\n width=\"100%\"\n height={height}\n viewBox=\"0 0 100 100\"\n preserveAspectRatio=\"none\"\n role=\"img\"\n aria-hidden=\"true\"\n >\n {showScale && [0, 50, 100].map(y => (\n <line key={y} x1={0} y1={y} x2={100} y2={y} stroke=\"currentColor\" strokeOpacity={0.12} strokeWidth={1} vectorEffect=\"non-scaling-stroke\" />\n ))}\n {drawn.map((s, si) => {\n const pts = toPoints(s.data, bottom, span);\n const line = pathFor(pts);\n return (\n <g key={si}>\n {s.fill && <path d={`${line} L100,100 L0,100 Z`} fill={s.fill} stroke=\"none\" />}\n <path d={line} fill=\"none\" stroke={color(s)} strokeWidth={strokeWidth} strokeLinejoin=\"round\" strokeLinecap=\"round\" vectorEffect=\"non-scaling-stroke\" />\n {showDots && s.data.length > 1 && pts.map(([x, y], i) => (\n <path key={i} d={`M${x.toFixed(2)},${y.toFixed(2)} h0.01`} stroke={color(s)} strokeWidth={strokeWidth * 2.5} strokeLinecap=\"round\" vectorEffect=\"non-scaling-stroke\">\n <title>{`${labels?.[i] != null ? `${labels[i]}: ` : ''}${s.label ? `${s.label} ` : ''}${s.data[i]}`}</title>\n </path>\n ))}\n </g>\n );\n })}\n </svg>\n </div>\n {labels && (\n <div className={`mt-1 flex justify-between ${showScale ? 'pl-6' : ''}`}>\n {labels.map((l, i) => (\n <div key={i} className=\"truncate text-[10px] text-gray-400\">{l}</div>\n ))}\n </div>\n )}\n </div>\n );\n}\n","/**\n * DashboardTemplate — an analytics dashboard starter: a stat-card row, a\n * revenue bar chart + traffic donut, and a recent-orders table. Composed\n * entirely from the kit's primitives so a design agent can adapt it. Static\n * data; wire real data in a consuming app.\n */\nimport StatusBadge, { StatusBadgeProvider } from '../shell/StatusBadge';\nimport type { SemanticGroup } from '../shell/StatusBadge';\nimport Card, { StatCard } from '../shell/Card';\nimport Avatar from '../shell/Avatar';\nimport Button from '../forms/Button';\nimport Sparkline from '../charts/Sparkline';\nimport BarChart from '../charts/BarChart';\nimport DonutChart from '../charts/DonutChart';\n\nconst STATUS_GROUPS: Record<string, SemanticGroup> = {\n paid: 'success', shipped: 'active', processing: 'queued', refunded: 'neutral', overdue: 'danger',\n};\n\nconst REVENUE = [12, 18, 14, 22, 19, 27, 24, 31, 28, 35, 30, 38];\nconst MONTHS = ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'];\n\nconst ORDERS = [\n { id: '#3201', customer: 'Alice Nguyen', total: '$1,204', status: 'paid' },\n { id: '#3202', customer: 'Marco Reyes', total: '$642', status: 'shipped' },\n { id: '#3203', customer: 'Priya Patel', total: '$2,980', status: 'processing' },\n { id: '#3204', customer: 'Tom Becker', total: '$318', status: 'overdue' },\n { id: '#3205', customer: 'Sara Lind', total: '$540', status: 'refunded' },\n];\n\nexport default function DashboardTemplate() {\n return (\n <StatusBadgeProvider groups={STATUS_GROUPS}>\n <div className=\"h-full overflow-auto bg-gray-50 p-6\">\n <div className=\"mx-auto max-w-6xl space-y-6\">\n {/* Header */}\n <div className=\"flex items-center justify-between gap-4\">\n <div>\n <h1 className=\"text-xl font-semibold text-gray-900\">Dashboard</h1>\n <p className=\"text-sm text-gray-500\">Overview of your store this month</p>\n </div>\n <div className=\"flex items-center gap-2\">\n <Button variant=\"secondary\" size=\"sm\">Export</Button>\n <Button size=\"sm\">New report</Button>\n </div>\n </div>\n\n {/* Stat row */}\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4\">\n <StatCard label=\"Revenue\" value=\"$38.2k\" delta={{ value: '12%', direction: 'up' }} />\n <StatCard label=\"Orders\" value=\"1,204\" delta={{ value: '4%', direction: 'up' }} />\n <StatCard label=\"Customers\" value=\"892\" delta={{ value: '2%', direction: 'down' }} />\n <StatCard label=\"Refunds\" value=\"$1.1k\" delta={{ value: '0%', direction: 'flat' }} />\n </div>\n\n {/* Charts */}\n <div className=\"grid grid-cols-1 gap-4 lg:grid-cols-3\">\n <Card header=\"Revenue\" className=\"lg:col-span-2\">\n <div className=\"text-blue-600\">\n <BarChart data={REVENUE} labels={MONTHS} height={160} />\n </div>\n </Card>\n <Card header=\"Traffic sources\">\n <div className=\"flex items-center gap-4\">\n <DonutChart\n size={120}\n segments={[\n { label: 'Direct', value: 45 },\n { label: 'Search', value: 30 },\n { label: 'Social', value: 15 },\n { label: 'Email', value: 10 },\n ]}\n centerLabel={<span className=\"text-gray-900\">100%</span>}\n />\n <ul className=\"space-y-1.5 text-sm text-gray-600\">\n <li className=\"flex items-center gap-2\"><Dot c=\"#3b82f6\" />Direct · 45%</li>\n <li className=\"flex items-center gap-2\"><Dot c=\"#22c55e\" />Search · 30%</li>\n <li className=\"flex items-center gap-2\"><Dot c=\"#f59e0b\" />Social · 15%</li>\n <li className=\"flex items-center gap-2\"><Dot c=\"#ef4444\" />Email · 10%</li>\n </ul>\n </div>\n </Card>\n </div>\n\n {/* Recent orders */}\n <Card header=\"Recent orders\" padded={false}>\n <table className=\"w-full text-sm\">\n <thead>\n <tr className=\"border-b border-gray-100 text-left text-xs uppercase tracking-wide text-gray-400\">\n <th className=\"px-4 py-2 font-medium\">Order</th>\n <th className=\"px-4 py-2 font-medium\">Customer</th>\n <th className=\"px-4 py-2 font-medium\">Total</th>\n <th className=\"px-4 py-2 font-medium\">Status</th>\n </tr>\n </thead>\n <tbody className=\"divide-y divide-gray-100\">\n {ORDERS.map(o => (\n <tr key={o.id} className=\"text-gray-700\">\n <td className=\"px-4 py-2 font-mono text-xs text-gray-500\">{o.id}</td>\n <td className=\"px-4 py-2\">\n <span className=\"flex items-center gap-2\">\n <Avatar size=\"xs\" name={o.customer} />\n {o.customer}\n </span>\n </td>\n <td className=\"px-4 py-2\">{o.total}</td>\n <td className=\"px-4 py-2\"><StatusBadge status={o.status} /></td>\n </tr>\n ))}\n </tbody>\n </table>\n </Card>\n\n <p className=\"flex items-center gap-2 text-xs text-gray-400\">\n <span className=\"text-emerald-600\"><Sparkline data={REVENUE} width={80} height={20} /></span>\n Trending up 12% vs last month\n </p>\n </div>\n </div>\n </StatusBadgeProvider>\n );\n}\n\nfunction Dot({ c }: { c: string }) {\n return <span className=\"inline-block h-2.5 w-2.5 rounded-full\" style={{ backgroundColor: c }} />;\n}\n","/**\n * DataTablePage — a list/table screen: a toolbar (search + filter + action), a\n * static data table with status pills and row actions, and a Pagination footer.\n * Uses plain table markup (not the react-query-backed ResizableTable/EntityList)\n * so it renders standalone in design-sync.\n */\nimport { useState } from 'react';\nimport StatusBadge, { StatusBadgeProvider } from '../shell/StatusBadge';\nimport type { SemanticGroup } from '../shell/StatusBadge';\nimport Card from '../shell/Card';\nimport Button from '../forms/Button';\nimport Input from '../forms/Input';\nimport Select from '../forms/Select';\nimport Pagination from '../data/Pagination';\n\nconst GROUPS: Record<string, SemanticGroup> = {\n active: 'success', invited: 'queued', suspended: 'danger', pending: 'pending',\n};\n\nconst ROWS = [\n { name: 'Alice Nguyen', email: 'alice@acme.co', role: 'Admin', status: 'active' },\n { name: 'Marco Reyes', email: 'marco@acme.co', role: 'Editor', status: 'invited' },\n { name: 'Priya Patel', email: 'priya@acme.co', role: 'Editor', status: 'active' },\n { name: 'Tom Becker', email: 'tom@acme.co', role: 'Viewer', status: 'suspended' },\n { name: 'Sara Lind', email: 'sara@acme.co', role: 'Viewer', status: 'pending' },\n { name: 'Yuki Tanaka', email: 'yuki@acme.co', role: 'Editor', status: 'active' },\n];\n\nexport default function DataTablePage() {\n const [page, setPage] = useState(1);\n const [role, setRole] = useState('');\n const [query, setQuery] = useState('');\n\n return (\n <StatusBadgeProvider groups={GROUPS}>\n <div className=\"h-full overflow-auto bg-gray-50 p-6\">\n <div className=\"mx-auto max-w-5xl space-y-4\">\n <div className=\"flex items-center justify-between gap-4\">\n <h1 className=\"text-xl font-semibold text-gray-900\">Members</h1>\n <Button size=\"sm\">Invite member</Button>\n </div>\n\n <Card padded={false}>\n <div className=\"flex flex-wrap items-center gap-2 border-b border-gray-100 p-3\">\n <div className=\"min-w-48 flex-1\">\n <Input value={query} onChange={e => setQuery(e.target.value)} placeholder=\"Search members…\" leftIcon={<SearchIcon />} />\n </div>\n <div className=\"w-40\">\n <Select\n value={role}\n onChange={setRole}\n placeholder=\"All roles\"\n options={[\n { value: 'admin', label: 'Admin' },\n { value: 'editor', label: 'Editor' },\n { value: 'viewer', label: 'Viewer' },\n ]}\n />\n </div>\n <Button variant=\"secondary\" size=\"sm\">Filter</Button>\n </div>\n\n <table className=\"w-full text-sm\">\n <thead>\n <tr className=\"border-b border-gray-100 text-left text-xs uppercase tracking-wide text-gray-400\">\n <th className=\"px-4 py-2 font-medium\">Name</th>\n <th className=\"px-4 py-2 font-medium\">Role</th>\n <th className=\"px-4 py-2 font-medium\">Status</th>\n <th className=\"px-4 py-2 font-medium text-right\">Actions</th>\n </tr>\n </thead>\n <tbody className=\"divide-y divide-gray-100\">\n {ROWS.map(r => (\n <tr key={r.email} className=\"text-gray-700 hover:bg-gray-50\">\n <td className=\"px-4 py-2.5\">\n <div className=\"font-medium text-gray-900\">{r.name}</div>\n <div className=\"text-xs text-gray-400\">{r.email}</div>\n </td>\n <td className=\"px-4 py-2.5\">{r.role}</td>\n <td className=\"px-4 py-2.5\"><StatusBadge status={r.status} /></td>\n <td className=\"px-4 py-2.5 text-right\">\n <Button variant=\"ghost\" size=\"sm\">Edit</Button>\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n\n <div className=\"flex items-center justify-between border-t border-gray-100 p-3\">\n <span className=\"text-xs text-gray-400\">Showing 1–6 of 48</span>\n <Pagination page={page} pageCount={8} onPageChange={setPage} showEdges />\n </div>\n </Card>\n </div>\n </div>\n </StatusBadgeProvider>\n );\n}\n\nfunction SearchIcon() {\n return (\n <svg className=\"h-4 w-4\" viewBox=\"0 0 20 20\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" aria-hidden=\"true\">\n <circle cx=\"9\" cy=\"9\" r=\"6\" /><path d=\"M14 14l3 3\" strokeLinecap=\"round\" />\n </svg>\n );\n}\n","/**\n * FormLayoutPage — a settings/profile form screen: grouped Cards of FormFields\n * wrapping the kit's inputs (Input, Textarea, Select, Checkbox, Radio), with a\n * sticky-feeling action row. The canonical \"real form\" reference.\n */\nimport { useState } from 'react';\nimport Card from '../shell/Card';\nimport Button from '../forms/Button';\nimport Input from '../forms/Input';\nimport Textarea from '../forms/Textarea';\nimport Select from '../forms/Select';\nimport Checkbox from '../forms/Checkbox';\nimport Radio from '../forms/Radio';\nimport FormField from '../forms/FormField';\n\nexport default function FormLayoutPage() {\n const [plan, setPlan] = useState('pro');\n const [newsletter, setNewsletter] = useState(true);\n const [country, setCountry] = useState('us');\n\n return (\n <div className=\"h-full overflow-auto bg-gray-50 p-6\">\n <form className=\"mx-auto max-w-2xl space-y-5\" onSubmit={e => e.preventDefault()}>\n <div>\n <h1 className=\"text-xl font-semibold text-gray-900\">Account settings</h1>\n <p className=\"text-sm text-gray-500\">Update your profile and preferences.</p>\n </div>\n\n <Card header=\"Profile\">\n <div className=\"space-y-4\">\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2\">\n <FormField label=\"First name\" htmlFor=\"fn\" required>\n <Input id=\"fn\" defaultValue=\"Alice\" />\n </FormField>\n <FormField label=\"Last name\" htmlFor=\"ln\" required>\n <Input id=\"ln\" defaultValue=\"Nguyen\" />\n </FormField>\n </div>\n <FormField label=\"Email\" htmlFor=\"email\" hint=\"We'll never share your email.\">\n <Input id=\"email\" type=\"email\" defaultValue=\"alice@acme.co\" />\n </FormField>\n <FormField label=\"Bio\" htmlFor=\"bio\" hint=\"Brief description for your profile.\">\n <Textarea id=\"bio\" autoGrow defaultValue=\"Product designer at Acme.\" />\n </FormField>\n </div>\n </Card>\n\n <Card header=\"Preferences\">\n <div className=\"space-y-4\">\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2\">\n <FormField label=\"Country\" htmlFor=\"country\">\n <Select\n value={country}\n onChange={setCountry}\n options={[\n { value: 'us', label: 'United States' },\n { value: 'de', label: 'Germany' },\n { value: 'jp', label: 'Japan' },\n ]}\n />\n </FormField>\n <FormField label=\"Plan\">\n <div className=\"space-y-1.5 pt-1\">\n <Radio name=\"plan\" checked={plan === 'free'} onChange={() => setPlan('free')} label=\"Free\" />\n <Radio name=\"plan\" checked={plan === 'pro'} onChange={() => setPlan('pro')} label=\"Pro\" />\n <Radio name=\"plan\" checked={plan === 'team'} onChange={() => setPlan('team')} label=\"Team\" />\n </div>\n </FormField>\n </div>\n <Checkbox checked={newsletter} onChange={setNewsletter} label=\"Email me product updates\" description=\"Occasional news — no more than once a month.\" />\n </div>\n </Card>\n\n <div className=\"flex items-center justify-end gap-2\">\n <Button variant=\"secondary\">Cancel</Button>\n <Button type=\"submit\">Save changes</Button>\n </div>\n </form>\n </div>\n );\n}\n","/**\n * CheckoutTemplate — a two-column checkout: contact/shipping/payment form on the\n * left, an order summary card on the right. Built from Card + FormField + the\n * form inputs + Button, with a Banner for a promo/notice.\n */\nimport { useState } from 'react';\nimport Card from '../shell/Card';\nimport Banner from '../shell/Banner';\nimport Button from '../forms/Button';\nimport Input from '../forms/Input';\nimport Select from '../forms/Select';\nimport Checkbox from '../forms/Checkbox';\nimport FormField from '../forms/FormField';\n\nconst ITEMS = [\n { name: 'Mechanical keyboard', qty: 1, price: 129 },\n { name: 'USB-C cable (2m)', qty: 2, price: 12 },\n { name: 'Laptop stand', qty: 1, price: 48 },\n];\n\nexport default function CheckoutTemplate() {\n const [sameAddress, setSameAddress] = useState(true);\n const [country, setCountry] = useState('us');\n const subtotal = ITEMS.reduce((s, i) => s + i.qty * i.price, 0);\n const shipping = 9;\n const total = subtotal + shipping;\n\n return (\n <div className=\"h-full overflow-auto bg-gray-50 p-6\">\n <div className=\"mx-auto max-w-5xl space-y-5\">\n <h1 className=\"text-xl font-semibold text-gray-900\">Checkout</h1>\n\n <div className=\"grid grid-cols-1 gap-5 lg:grid-cols-3\">\n {/* Form */}\n <form className=\"space-y-5 lg:col-span-2\" onSubmit={e => e.preventDefault()}>\n <Card header=\"Contact\">\n <div className=\"space-y-4\">\n <FormField label=\"Email\" htmlFor=\"ck-email\" required>\n <Input id=\"ck-email\" type=\"email\" placeholder=\"you@example.com\" />\n </FormField>\n </div>\n </Card>\n\n <Card header=\"Shipping address\">\n <div className=\"space-y-4\">\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2\">\n <FormField label=\"First name\" required><Input placeholder=\"Alice\" /></FormField>\n <FormField label=\"Last name\" required><Input placeholder=\"Nguyen\" /></FormField>\n </div>\n <FormField label=\"Address\" required><Input placeholder=\"123 Market St\" /></FormField>\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-3\">\n <FormField label=\"City\"><Input placeholder=\"San Francisco\" /></FormField>\n <FormField label=\"ZIP\"><Input placeholder=\"94103\" /></FormField>\n <FormField label=\"Country\">\n <Select\n value={country}\n onChange={setCountry}\n options={[\n { value: 'us', label: 'United States' },\n { value: 'de', label: 'Germany' },\n { value: 'jp', label: 'Japan' },\n ]}\n />\n </FormField>\n </div>\n <Checkbox checked={sameAddress} onChange={setSameAddress} label=\"Billing address same as shipping\" />\n </div>\n </Card>\n\n <Card header=\"Payment\">\n <div className=\"space-y-4\">\n <FormField label=\"Card number\" required><Input placeholder=\"1234 5678 9012 3456\" /></FormField>\n <div className=\"grid grid-cols-2 gap-4\">\n <FormField label=\"Expiry\" required><Input placeholder=\"MM / YY\" /></FormField>\n <FormField label=\"CVC\" required><Input placeholder=\"123\" /></FormField>\n </div>\n </div>\n </Card>\n </form>\n\n {/* Summary */}\n <div className=\"space-y-4\">\n <Card header=\"Order summary\">\n <ul className=\"space-y-2 text-sm\">\n {ITEMS.map(i => (\n <li key={i.name} className=\"flex items-center justify-between gap-2 text-gray-700\">\n <span>{i.name} <span className=\"text-gray-400\">×{i.qty}</span></span>\n <span>${i.qty * i.price}</span>\n </li>\n ))}\n </ul>\n <div className=\"mt-3 space-y-1.5 border-t border-gray-100 pt-3 text-sm text-gray-600\">\n <div className=\"flex justify-between\"><span>Subtotal</span><span>${subtotal}</span></div>\n <div className=\"flex justify-between\"><span>Shipping</span><span>${shipping}</span></div>\n <div className=\"flex justify-between text-base font-semibold text-gray-900\"><span>Total</span><span>${total}</span></div>\n </div>\n <Button block className=\"mt-4\">Pay ${total}</Button>\n </Card>\n <Banner tone=\"success\" title=\"Promo applied\">Free returns within 30 days.</Banner>\n </div>\n </div>\n </div>\n </div>\n );\n}\n","/**\n * EmailTemplate — a three-pane mail client: folder list (SidebarLayout) ·\n * message list · reading pane. Static data; the message list/reading pane are\n * plain markup so the screen renders standalone. Fills its container height.\n */\nimport { useState } from 'react';\nimport SidebarLayout from '../shell/SidebarLayout';\nimport Avatar from '../shell/Avatar';\nimport Button from '../forms/Button';\n\nconst FOLDERS = [\n { id: 'inbox', label: 'Inbox', count: 12 },\n { id: 'starred', label: 'Starred', count: 3 },\n { id: 'sent', label: 'Sent' },\n { id: 'drafts', label: 'Drafts', count: 1 },\n { id: 'archive', label: 'Archive' },\n { id: 'trash', label: 'Trash' },\n];\n\nconst MESSAGES = [\n { id: 1, from: 'Marco Reyes', subject: 'Q3 roadmap review', preview: 'Sharing the deck ahead of Thursday — let me know…', time: '9:14', unread: true },\n { id: 2, from: 'Priya Patel', subject: 'Design handoff', preview: 'The Figma file is ready for engineering. I exported…', time: '8:02', unread: true },\n { id: 3, from: 'GitHub', subject: '[acme/web] PR #482 merged', preview: 'Your pull request was merged into main by…', time: 'Yest' },\n { id: 4, from: 'Sara Lind', subject: 'Lunch Friday?', preview: 'A few of us are heading to the new place on 5th…', time: 'Yest' },\n];\n\nexport default function EmailTemplate() {\n const [active, setActive] = useState(1);\n const selected = MESSAGES.find(m => m.id === active) ?? MESSAGES[0];\n\n return (\n <div className=\"h-full\">\n <SidebarLayout\n side=\"left\"\n defaultWidth={200}\n sidebar={\n <div className=\"flex h-full flex-col p-2\">\n <Button block className=\"mb-2\">Compose</Button>\n {FOLDERS.map((f, i) => (\n <button\n key={f.id}\n className={`flex items-center justify-between rounded-md px-3 py-2 text-left text-sm ${\n i === 0 ? 'bg-blue-50 font-medium text-blue-700' : 'text-gray-700 hover:bg-gray-100'\n }`}\n >\n <span>{f.label}</span>\n {f.count != null && <span className=\"text-xs text-gray-400\">{f.count}</span>}\n </button>\n ))}\n </div>\n }\n >\n <div className=\"flex h-full\">\n {/* Message list */}\n <div className=\"w-72 shrink-0 overflow-auto border-r border-gray-200\">\n {MESSAGES.map(m => (\n <button\n key={m.id}\n onClick={() => setActive(m.id)}\n className={`block w-full border-b border-gray-100 px-4 py-3 text-left hover:bg-gray-50 ${m.id === active ? 'bg-blue-50/50' : ''}`}\n >\n <div className=\"flex items-center justify-between gap-2\">\n <span className={`truncate text-sm ${m.unread ? 'font-semibold text-gray-900' : 'text-gray-700'}`}>{m.from}</span>\n <span className=\"shrink-0 text-[11px] text-gray-400\">{m.time}</span>\n </div>\n <div className={`truncate text-sm ${m.unread ? 'text-gray-800' : 'text-gray-600'}`}>{m.subject}</div>\n <div className=\"truncate text-xs text-gray-400\">{m.preview}</div>\n </button>\n ))}\n </div>\n\n {/* Reading pane */}\n <div className=\"flex min-w-0 flex-1 flex-col overflow-auto\">\n <div className=\"flex items-center justify-between gap-3 border-b border-gray-200 p-4\">\n <h2 className=\"truncate text-base font-semibold text-gray-900\">{selected.subject}</h2>\n <div className=\"flex shrink-0 gap-1.5\">\n <Button variant=\"ghost\" size=\"sm\">Archive</Button>\n <Button variant=\"secondary\" size=\"sm\">Reply</Button>\n </div>\n </div>\n <div className=\"flex items-center gap-3 border-b border-gray-100 p-4\">\n <Avatar name={selected.from} />\n <div className=\"min-w-0\">\n <div className=\"text-sm font-medium text-gray-900\">{selected.from}</div>\n <div className=\"text-xs text-gray-400\">to me · {selected.time}</div>\n </div>\n </div>\n <div className=\"space-y-3 p-4 text-sm leading-relaxed text-gray-700\">\n <p>Hi,</p>\n <p>{selected.preview} The full details are attached — happy to walk through anything on a quick call.</p>\n <p>Best,<br />{selected.from}</p>\n </div>\n </div>\n </div>\n </SidebarLayout>\n </div>\n );\n}\n","/**\n * ChatTemplate — a messaging screen: conversation list (SidebarLayout) + a\n * message thread with a composer. Avatars + bubble rows are plain markup;\n * the composer uses Input + Button. Fills its container height.\n */\nimport { useState } from 'react';\nimport SidebarLayout from '../shell/SidebarLayout';\nimport Avatar from '../shell/Avatar';\nimport Input from '../forms/Input';\nimport Button from '../forms/Button';\nimport type { AvatarStatus } from '../shell/Avatar';\n\nconst CONVOS: { id: number; name: string; last: string; time: string; status: AvatarStatus }[] = [\n { id: 1, name: 'Priya Patel', last: 'Sounds good — shipping it now', time: '9:41', status: 'online' },\n { id: 2, name: 'Design team', last: 'Marco: updated the tokens', time: '9:12', status: 'away' },\n { id: 3, name: 'Tom Becker', last: 'Thanks!', time: 'Yest', status: 'offline' },\n { id: 4, name: 'Sara Lind', last: 'See you Friday 🎉', time: 'Yest', status: 'busy' },\n];\n\nconst THREAD = [\n { mine: false, text: 'Hey! Did the latest build go out?' },\n { mine: true, text: 'Just merged — deploying now.' },\n { mine: false, text: 'Nice. Any breaking changes for the portal?' },\n { mine: true, text: 'Nope, fully additive. New components only.' },\n { mine: false, text: 'Sounds good — shipping it now' },\n];\n\nexport default function ChatTemplate() {\n const [active, setActive] = useState(1);\n const convo = CONVOS.find(c => c.id === active) ?? CONVOS[0];\n\n return (\n <div className=\"h-full\">\n <SidebarLayout\n side=\"left\"\n defaultWidth={260}\n sidebar={\n <div className=\"h-full overflow-auto\">\n {CONVOS.map(c => (\n <button\n key={c.id}\n onClick={() => setActive(c.id)}\n className={`flex w-full items-center gap-3 border-b border-gray-100 px-3 py-3 text-left hover:bg-gray-50 ${c.id === active ? 'bg-blue-50/50' : ''}`}\n >\n <Avatar name={c.name} status={c.status} />\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex items-center justify-between gap-2\">\n <span className=\"truncate text-sm font-medium text-gray-900\">{c.name}</span>\n <span className=\"shrink-0 text-[11px] text-gray-400\">{c.time}</span>\n </div>\n <div className=\"truncate text-xs text-gray-500\">{c.last}</div>\n </div>\n </button>\n ))}\n </div>\n }\n >\n <div className=\"flex h-full flex-col\">\n {/* Thread header */}\n <div className=\"flex items-center gap-3 border-b border-gray-200 p-3\">\n <Avatar name={convo.name} status={convo.status} size=\"sm\" />\n <div>\n <div className=\"text-sm font-medium text-gray-900\">{convo.name}</div>\n <div className=\"text-xs text-gray-400 capitalize\">{convo.status}</div>\n </div>\n </div>\n\n {/* Messages */}\n <div className=\"flex flex-1 flex-col gap-2 overflow-auto bg-gray-50 p-4\">\n {THREAD.map((m, i) => (\n <div key={i} className={`flex ${m.mine ? 'justify-end' : 'justify-start'}`}>\n <div\n style={{ maxWidth: '75%' }}\n className={`rounded-2xl px-3 py-2 text-sm ${\n m.mine ? 'bg-blue-600 text-white' : 'bg-white text-gray-800 shadow-sm'\n }`}\n >\n {m.text}\n </div>\n </div>\n ))}\n </div>\n\n {/* Composer */}\n <form className=\"flex items-center gap-2 border-t border-gray-200 p-3\" onSubmit={e => e.preventDefault()}>\n <div className=\"flex-1\">\n <Input placeholder=\"Type a message…\" />\n </div>\n <Button type=\"submit\">Send</Button>\n </form>\n </div>\n </SidebarLayout>\n </div>\n );\n}\n","/**\n * GalleryTemplate — a media/photo grid with a Tabs filter and Card tiles that\n * carry a StatusBadge overlay. Tiles use a gradient placeholder (inline style)\n * in place of real images. Scrollable page.\n */\nimport { useState } from 'react';\nimport Card from '../shell/Card';\nimport Tabs from '../shell/Tabs';\nimport Button from '../forms/Button';\nimport StatusBadge, { StatusBadgeProvider } from '../shell/StatusBadge';\nimport type { SemanticGroup } from '../shell/StatusBadge';\n\nconst GROUPS: Record<string, SemanticGroup> = { featured: 'success', new: 'active', draft: 'draft' };\n\nconst GRADIENTS = [\n 'linear-gradient(135deg,#60a5fa,#a78bfa)',\n 'linear-gradient(135deg,#34d399,#10b981)',\n 'linear-gradient(135deg,#fbbf24,#f59e0b)',\n 'linear-gradient(135deg,#f472b6,#ec4899)',\n 'linear-gradient(135deg,#38bdf8,#6366f1)',\n 'linear-gradient(135deg,#fb7185,#ef4444)',\n 'linear-gradient(135deg,#4ade80,#22c55e)',\n 'linear-gradient(135deg,#c084fc,#8b5cf6)',\n];\n\nconst ITEMS = GRADIENTS.map((g, i) => ({\n id: i,\n title: ['Sunrise', 'Forest', 'Desert', 'Bloom', 'Ocean', 'Ember', 'Meadow', 'Dusk'][i],\n tag: ['featured', 'new', 'draft'][i % 3],\n bg: g,\n}));\n\nexport default function GalleryTemplate() {\n const [filter, setFilter] = useState('all');\n const shown = filter === 'all' ? ITEMS : ITEMS.filter(i => i.tag === filter);\n\n return (\n <StatusBadgeProvider groups={GROUPS}>\n <div className=\"h-full overflow-auto bg-gray-50 p-6\">\n <div className=\"mx-auto max-w-5xl space-y-4\">\n <div className=\"flex items-center justify-between gap-4\">\n <h1 className=\"text-xl font-semibold text-gray-900\">Gallery</h1>\n <Button size=\"sm\">Upload</Button>\n </div>\n\n <Tabs\n value={filter}\n onChange={setFilter}\n variant=\"pill\"\n items={[\n { id: 'all', label: 'All' },\n { id: 'featured', label: 'Featured' },\n { id: 'new', label: 'New' },\n { id: 'draft', label: 'Drafts' },\n ]}\n />\n\n <div className=\"grid grid-cols-2 gap-4 sm:grid-cols-3 lg:grid-cols-4\">\n {shown.map(item => (\n <Card key={item.id} padded={false} className=\"overflow-hidden\">\n <div className=\"relative h-28\" style={{ background: item.bg }}>\n <span className=\"absolute right-2 top-2\"><StatusBadge status={item.tag} /></span>\n </div>\n <div className=\"flex items-center justify-between gap-2 p-3\">\n <span className=\"truncate text-sm font-medium text-gray-900\">{item.title}</span>\n <span className=\"text-xs text-gray-400\">2.4 MB</span>\n </div>\n </Card>\n ))}\n </div>\n </div>\n </div>\n </StatusBadgeProvider>\n );\n}\n","/**\n * AuthScreen — centered authentication card. `mode` switches between sign-in,\n * registration, and password-reset layouts. Built from Card + FormField +\n * Input + Checkbox + Button. The design-sync preview renders all three modes.\n */\nimport Card from '../shell/Card';\nimport Button from '../forms/Button';\nimport Input from '../forms/Input';\nimport Checkbox from '../forms/Checkbox';\nimport FormField from '../forms/FormField';\nimport { useState } from 'react';\n\nexport interface AuthScreenProps {\n mode?: 'login' | 'register' | 'forgot';\n}\n\nconst COPY = {\n login: { title: 'Welcome back', subtitle: 'Sign in to your account', cta: 'Sign in' },\n register: { title: 'Create your account', subtitle: 'Start your 14-day free trial', cta: 'Create account' },\n forgot: { title: 'Reset password', subtitle: \"We'll email you a reset link\", cta: 'Send reset link' },\n};\n\nexport default function AuthScreen({ mode = 'login' }: AuthScreenProps) {\n const [remember, setRemember] = useState(true);\n const c = COPY[mode];\n\n return (\n <div className=\"flex h-full items-center justify-center overflow-auto bg-gray-50 p-6\">\n <div className=\"w-full max-w-sm\">\n <div className=\"mb-6 text-center\">\n <div className=\"mx-auto mb-3 flex h-10 w-10 items-center justify-center rounded-lg bg-blue-600 text-sm font-bold text-white\">A</div>\n <h1 className=\"text-lg font-semibold text-gray-900\">{c.title}</h1>\n <p className=\"text-sm text-gray-500\">{c.subtitle}</p>\n </div>\n\n <Card>\n <form className=\"space-y-4\" onSubmit={e => e.preventDefault()}>\n {mode === 'register' && (\n <FormField label=\"Name\" htmlFor=\"au-name\"><Input id=\"au-name\" placeholder=\"Alice Nguyen\" /></FormField>\n )}\n <FormField label=\"Email\" htmlFor=\"au-email\">\n <Input id=\"au-email\" type=\"email\" placeholder=\"you@example.com\" />\n </FormField>\n\n {mode !== 'forgot' && (\n <FormField\n label=\"Password\"\n htmlFor=\"au-pass\"\n hint={mode === 'register' ? 'At least 8 characters.' : undefined}\n >\n <Input id=\"au-pass\" type=\"password\" placeholder=\"••••••••\" />\n </FormField>\n )}\n\n {mode === 'login' && (\n <div className=\"flex items-center justify-between\">\n <Checkbox checked={remember} onChange={setRemember} label=\"Remember me\" />\n <a href=\"#\" className=\"text-sm text-blue-600 hover:underline\">Forgot?</a>\n </div>\n )}\n\n <Button type=\"submit\" block>{c.cta}</Button>\n </form>\n </Card>\n\n <p className=\"mt-4 text-center text-sm text-gray-500\">\n {mode === 'register' ? (\n <>Already have an account? <a href=\"#\" className=\"text-blue-600 hover:underline\">Sign in</a></>\n ) : (\n <>New here? <a href=\"#\" className=\"text-blue-600 hover:underline\">Create an account</a></>\n )}\n </p>\n </div>\n </div>\n );\n}\n","/**\n * ErrorPage — a centered error state for 403 / 404 / 500. `code` selects the\n * heading and copy; `actions` is the way out, supplied by the consumer because\n * the kit has no router. Pure presentational.\n */\nimport { type ReactNode } from 'react';\n\nexport interface ErrorPageProps {\n code?: 403 | 404 | 500;\n /**\n * What the user can do about it — typically a link home.\n *\n * There is no default, and that is the fix: this page used to render \"Go\n * back\" and \"Take me home\" as buttons with no handlers on them. They looked\n * like the way out of a dead end and did nothing, which is worse than\n * offering nothing at all. The kit has no router, so the destination has to\n * come from the consumer.\n */\n actions?: ReactNode;\n}\n\nconst COPY: Record<NonNullable<ErrorPageProps['code']>, { title: string; body: string }> = {\n 403: { title: 'Access denied', body: \"You don't have permission to view this page.\" },\n 404: { title: 'Page not found', body: \"The page you're looking for doesn't exist or was moved.\" },\n 500: { title: 'Something went wrong', body: 'An unexpected error occurred. Please try again.' },\n};\n\nexport default function ErrorPage({ code = 404, actions }: ErrorPageProps) {\n const c = COPY[code];\n return (\n <div className=\"flex h-full flex-col items-center justify-center bg-gray-50 p-6 text-center\">\n <div className=\"text-7xl font-bold tracking-tight text-gray-400\">{code}</div>\n <h1 className=\"mt-2 text-xl font-semibold text-gray-900\">{c.title}</h1>\n <p className=\"mt-1 max-w-sm text-sm text-gray-500\">{c.body}</p>\n {actions && <div className=\"mt-6 flex items-center gap-2\">{actions}</div>}\n </div>\n );\n}\n","/**\n * ErrorBoundary — catches a render crash and shows the 500 page instead of a\n * blank screen.\n *\n * `WindowErrorBoundary` already exists and is not this: it guards one desktop\n * window's body so the taskbar and the other windows keep running, and its\n * fallback is sized to sit inside window chrome. A portal is a plain React app\n * with no windows, so it needs a boundary whose fallback is a whole page. Every\n * portal has written that boundary itself, and each one hard-coded its own\n * colours to do it.\n *\n * Two things the hand-written ones get wrong, worth naming because they are\n * the reason this is a component rather than a snippet:\n *\n * - They print `error.stack` into the page. In development that is the useful\n * part; in production it hands a visitor the internal module layout. Here\n * the detail is opt-in and off by default.\n * - They swap the content out silently. A crash is exactly the moment a screen\n * reader user is owed an announcement, so the PAGE is `role=\"alert\"` — the\n * page, not the whole fallback: `alert` is read wholesale and assertively,\n * and a region spanning the opt-in stack trace would recite `error.stack`\n * at the user before they could act on it.\n */\nimport { Component, type ErrorInfo, type ReactNode } from 'react';\nimport ErrorPage from './ErrorPage';\nimport Button from '../forms/Button';\n\nexport interface ErrorBoundaryProps {\n children: ReactNode;\n /**\n * Replaces the default page. `reset` clears the caught error so the children\n * mount again — worth offering when the cause may have been transient.\n */\n fallback?: (error: Error, reset: () => void) => ReactNode;\n /**\n * What the user can do about it, rendered under the default page. The kit has\n * no router, so a link home has to come from the consumer — the same reason\n * {@link ErrorPage} takes its actions rather than inventing them.\n */\n actions?: ReactNode;\n /**\n * Called with the caught error. This is where a consumer reports to Sentry or\n * its own logger; without it a crash is only ever a `console.error` in a\n * browser nobody is looking at.\n */\n onError?: (error: Error, info: ErrorInfo) => void;\n /**\n * Show the message and stack on the page. Defaults to OFF. Pass\n * `import.meta.env.DEV` to get the detail while developing and nothing in\n * production — the value is the consumer's because the kit is built once and\n * cannot read the app's mode.\n */\n showDetails?: boolean;\n /**\n * Clears the error when any entry changes — typically the current path, so\n * navigating away from a crashed page recovers instead of holding the\n * fallback until a full reload.\n */\n resetKeys?: unknown[];\n}\n\ninterface State {\n error: Error | null;\n}\n\nexport default class ErrorBoundary extends Component<ErrorBoundaryProps, State> {\n state: State = { error: null };\n\n static getDerivedStateFromError(error: Error): State {\n return { error };\n }\n\n componentDidCatch(error: Error, info: ErrorInfo) {\n // Kept even when `onError` is supplied: a reporter that is itself broken\n // would otherwise swallow the only record of the crash.\n console.error('ErrorBoundary caught an error:', error, info);\n this.props.onError?.(error, info);\n }\n\n componentDidUpdate(prev: ErrorBoundaryProps) {\n if (!this.state.error) return;\n // A missing side counts as empty rather than as \"skip\". Guarding on both\n // being present meant a consumer whose keys are conditional — a router\n // hook returning undefined on the first render after a crash, then\n // `[path]` — never recovered, and that transition IS the navigation the\n // prop exists to catch.\n const a = prev.resetKeys ?? [];\n const b = this.props.resetKeys ?? [];\n if (a.length !== b.length || a.some((k, i) => !Object.is(k, b[i]))) {\n this.reset();\n }\n }\n\n reset = () => this.setState({ error: null });\n\n render() {\n const { error } = this.state;\n if (!error) return this.props.children;\n if (this.props.fallback) return this.props.fallback(error, this.reset);\n\n return (\n // A column, not a bare wrapper: `ErrorPage` is `h-full`, so a `<details>`\n // rendered as its sibling inside an `h-full` box starts at the 100% mark\n // and sits below the fold — unreachable under an `overflow-hidden`\n // ancestor, which is the usual app shell. As a flex child it takes the\n // room it needs and the page gives it back.\n <div className=\"flex h-full flex-col\">\n {/* The live region is the PAGE, not everything on screen. `alert` is\n announced wholesale and assertively, so a region spanning the stack\n trace reads a developer's `error.stack` at a screen-reader user\n before they can act. The details sit outside it deliberately. */}\n <div role=\"alert\" className=\"min-h-0 flex-1\">\n <ErrorPage\n code={500}\n actions={\n <>\n {/* The kit's Button, not a hand-written class string. This\n component's whole argument is that the portals' own\n boundaries \"hard-coded its own colours\" — re-typing\n Button's primary here would be the same mistake one layer\n up, and would miss every rung and state Button grows. */}\n <Button onClick={this.reset}>Try again</Button>\n {this.props.actions}\n </>\n }\n />\n </div>\n {this.props.showDetails && (\n <details className=\"mx-auto w-full max-w-2xl shrink-0 px-6 pb-6\">\n <summary className=\"cursor-pointer text-sm font-medium text-gray-600\">Error details</summary>\n <pre className=\"mt-2 overflow-auto rounded-md bg-gray-100 p-3 text-xs text-gray-700\">\n {error.stack ?? error.message}\n </pre>\n </details>\n )}\n </div>\n );\n }\n}\n","import { useEffect, useSyncExternalStore } from 'react';\nimport { useShellPrefs } from '../shell/ShellPrefs';\n\nexport type Theme = 'system' | 'light' | 'dark' | 'pink' | 'green' | 'grey' | 'blue';\n\n/** Subscribe to OS dark-mode changes */\nfunction subscribeMediaQuery(cb: () => void) {\n const mq = window.matchMedia('(prefers-color-scheme: dark)');\n mq.addEventListener('change', cb);\n return () => mq.removeEventListener('change', cb);\n}\nfunction getSystemIsDark() {\n return window.matchMedia('(prefers-color-scheme: dark)').matches;\n}\n\n/** Derive lighter / darker shades from a hex color via HSL */\nfunction hexToHsl(hex: string): [number, number, number] {\n const r = parseInt(hex.slice(1, 3), 16) / 255;\n const g = parseInt(hex.slice(3, 5), 16) / 255;\n const b = parseInt(hex.slice(5, 7), 16) / 255;\n const max = Math.max(r, g, b), min = Math.min(r, g, b);\n let h = 0, s = 0;\n const l = (max + min) / 2;\n if (max !== min) {\n const d = max - min;\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n if (max === r) h = ((g - b) / d + (g < b ? 6 : 0)) / 6;\n else if (max === g) h = ((b - r) / d + 2) / 6;\n else h = ((r - g) / d + 4) / 6;\n }\n return [h * 360, s * 100, l * 100];\n}\nfunction hslToHex(h: number, s: number, l: number): string {\n s /= 100; l /= 100;\n const a = s * Math.min(l, 1 - l);\n const f = (n: number) => { const k = (n + h / 30) % 12; return l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1); };\n const toHex = (x: number) => Math.round(x * 255).toString(16).padStart(2, '0');\n return `#${toHex(f(0))}${toHex(f(8))}${toHex(f(4))}`;\n}\n\n/** Resolve a stored theme to the attribute value <html> actually carries\n * ('system' follows the OS dark-mode media query). */\nexport function resolveTheme(theme: string | null | undefined): string {\n const t = theme || 'system';\n if (t === 'system') return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n return t;\n}\n\n/** Stamp the custom-accent shade scale (or clear it) on <html>. */\nfunction applyAccent(accentColor: string | null) {\n const root = document.documentElement;\n if (accentColor && /^#[0-9a-fA-F]{6}$/.test(accentColor)) {\n const [h, s, l] = hexToHsl(accentColor);\n root.setAttribute('data-custom-accent', 'true');\n root.style.setProperty('--accent-600', accentColor);\n root.style.setProperty('--accent-700', hslToHex(h, s, Math.max(l - 10, 5)));\n root.style.setProperty('--accent-500', hslToHex(h, s, Math.min(l + 10, 95)));\n root.style.setProperty('--accent-400', hslToHex(h, s, Math.min(l + 20, 95)));\n root.style.setProperty('--accent-300', hslToHex(h, Math.min(s + 10, 100), Math.min(l + 30, 92)));\n root.style.setProperty('--accent-200', hslToHex(h, Math.min(s + 15, 100), Math.min(l + 38, 94)));\n root.style.setProperty('--accent-100', hslToHex(h, Math.min(s + 20, 100), Math.min(l + 42, 96)));\n root.style.setProperty('--accent-50', hslToHex(h, Math.min(s + 20, 100), Math.min(l + 46, 98)));\n } else {\n root.removeAttribute('data-custom-accent');\n ['--accent-600', '--accent-700', '--accent-500', '--accent-400', '--accent-300', '--accent-200', '--accent-100', '--accent-50'].forEach(p => root.style.removeProperty(p));\n }\n}\n\n/** Stamp the custom theme colors (bg, title, window, button) on <html>.\n * Only active alongside a custom accent — clears the button/bg vars otherwise. */\nfunction applyCustomColors(\n accentColor: string | null,\n customBgColor: string | null,\n customTitleColor: string | null,\n customWindowColor: string | null,\n customButtonColor: string | null,\n) {\n const root = document.documentElement;\n if (accentColor) {\n // Helper to convert hex to \"r g b\" for rgba usage\n const hexToRgb = (hex: string) => {\n const r = parseInt(hex.slice(1, 3), 16);\n const g = parseInt(hex.slice(3, 5), 16);\n const b = parseInt(hex.slice(5, 7), 16);\n return `${r} ${g} ${b}`;\n };\n if (customBgColor) root.style.setProperty('--custom-bg-color', customBgColor);\n if (customTitleColor) {\n root.style.setProperty('--window-header-rgb', hexToRgb(customTitleColor));\n root.style.setProperty('--window-footer-rgb', hexToRgb(customTitleColor));\n }\n if (customWindowColor) root.style.setProperty('--window-content-rgb', hexToRgb(customWindowColor));\n if (customButtonColor) {\n root.style.setProperty('--custom-button-color', customButtonColor);\n const [h, s, l] = hexToHsl(customButtonColor);\n root.style.setProperty('--custom-button-hover', hslToHex(h, s, Math.max(l - 10, 5)));\n }\n } else {\n ['--custom-bg-color', '--custom-button-color', '--custom-button-hover'].forEach(p => root.style.removeProperty(p));\n }\n}\n\n/**\n * Imperatively apply a theme/accent/custom-color prefs snapshot to <html>.\n *\n * useTheme() already reconciles these from prefs, but it does so via effects\n * that only fire once prefs actually changes — and a backend-backed prefs\n * adapter (the admin/supplier portals PATCH /auth/me/ and refetch) can take\n * seconds to settle, leaving the repaint stalled the whole time. The shell's\n * <Customization> calls this on every theme/accent/color click so the switch\n * lands on the same frame, then persists through save() in the background.\n */\nexport function applyThemePrefs(p: {\n theme?: string | null;\n accent_color?: string | null;\n custom_bg_color?: string | null;\n custom_title_color?: string | null;\n custom_window_color?: string | null;\n custom_button_color?: string | null;\n}) {\n document.documentElement.setAttribute('data-theme', resolveTheme(p.theme));\n applyAccent(p.accent_color ?? null);\n applyCustomColors(\n p.accent_color ?? null,\n p.custom_bg_color ?? null,\n p.custom_title_color ?? null,\n p.custom_window_color ?? null,\n p.custom_button_color ?? null,\n );\n}\n\nexport function useTheme() {\n const { prefs } = useShellPrefs();\n const systemDark = useSyncExternalStore(subscribeMediaQuery, getSystemIsDark);\n const saved: Theme = (prefs.theme as Theme) || 'system';\n const accentColor: string | null = prefs.accent_color || null;\n const customBgColor: string | null = prefs.custom_bg_color || null;\n const customTitleColor: string | null = prefs.custom_title_color || null;\n const customWindowColor: string | null = prefs.custom_window_color || null;\n const customButtonColor: string | null = prefs.custom_button_color || null;\n\n // Resolve \"system\" to actual theme\n const resolved = saved === 'system' ? (systemDark ? 'dark' : 'light') : saved;\n\n useEffect(() => {\n document.documentElement.setAttribute('data-theme', resolved);\n return () => document.documentElement.removeAttribute('data-theme');\n }, [resolved]);\n\n // Custom accent color\n useEffect(() => { applyAccent(accentColor); }, [accentColor]);\n\n // Custom theme colors (bg, title, window, button)\n useEffect(() => {\n applyCustomColors(accentColor, customBgColor, customTitleColor, customWindowColor, customButtonColor);\n }, [accentColor, customBgColor, customTitleColor, customWindowColor, customButtonColor]);\n\n return { theme: saved, resolved };\n}\n","import { useEffect, type RefObject } from 'react';\n\nexport default function useClickOutside(ref: RefObject<HTMLElement | null>, onClose: () => void) {\n useEffect(() => {\n const handler = (e: MouseEvent) => {\n if (ref.current && !ref.current.contains(e.target as Node)) onClose();\n };\n document.addEventListener('mousedown', handler);\n return () => document.removeEventListener('mousedown', handler);\n }, [ref, onClose]);\n}\n","/**\n * The chart palette — the one thing every consumer of this package was missing.\n *\n * Until now `src/charts/*` defaulted every stroke to `currentColor` and there\n * was no series token anywhere in ui.css or themes.css, so each portal picked\n * its own hues by hand. The EFFICIENT Observability console is the worked\n * example: it chose cyan/green/violet/magenta, and two of its four legend\n * entries came out the same green.\n *\n * Three rules, and each one is load-bearing:\n *\n * 1. **Slots are assigned in fixed order and never cycled.** Color follows the\n * entity, not its rank — a reader who learned \"Acme is blue\" must not see\n * Acme repainted when a filter drops the row above it. A ninth series is\n * never a generated hue; fold the tail into \"Other\" or facet instead.\n *\n * 2. **Series color does NOT follow the accent theme.** themes.css remaps the\n * blue accent utilities for the pink/green/grey/blue variants and the custom\n * picker. Charts sit outside that on purpose: identity encoding that moves\n * with a cosmetic preference is not identity encoding. The tokens below are\n * declared once under `:root` and once under `[data-theme=\"dark\"]`, and no\n * accent variant touches them.\n *\n * 3. **Status is a separate reservation.** `good`/`warning`/`serious`/`critical`\n * mean a state, never an identity, and never double as \"series 5\". A chart\n * that colors 2xx/4xx/5xx uses the status set; a chart that colors three\n * tenants uses the categorical set.\n *\n * The eight hues and their two sets of steps are not a taste call. They were\n * run through a colour-vision-deficiency validator against THIS package's real\n * surfaces — white in light, `--surface` (#1e1e2e) in dark — and the ordering\n * is the CVD-safety mechanism rather than decoration:\n *\n * light worst adjacent CVD ΔE 9.1, normal-vision ΔE 19.6 (targets 8 / 15)\n * dark worst adjacent CVD ΔE 8.4, normal-vision ΔE 19.3\n *\n * Three light steps (aqua, yellow, magenta) sit under 3:1 against white. That\n * is a documented WARN, not a pass — it obliges every chart using them to ship\n * visible labels or a table view, which is why `ChartFrame` takes a `table`\n * slot rather than leaving it to each caller's good intentions.\n */\n\n/** How many categorical slots exist. A 9th series folds into \"Other\". */\nexport const SERIES_SLOT_COUNT = 8;\n\n/**\n * CSS custom properties for the categorical slots, in assignment order.\n *\n * Values live in ui.css so a consumer can restyle them without a rebuild, and\n * so the light/dark pair resolves through the same `[data-theme]` mechanism as\n * every other surface in the package.\n */\nexport const SERIES_VARS = [\n 'var(--viz-series-1)',\n 'var(--viz-series-2)',\n 'var(--viz-series-3)',\n 'var(--viz-series-4)',\n 'var(--viz-series-5)',\n 'var(--viz-series-6)',\n 'var(--viz-series-7)',\n 'var(--viz-series-8)',\n] as const;\n\n/** Reserved state colours. Never reused as a categorical slot. */\nexport const STATUS_VARS = {\n good: 'var(--viz-good)',\n neutral: 'var(--viz-neutral)',\n warning: 'var(--viz-warning)',\n serious: 'var(--viz-serious)',\n critical: 'var(--viz-critical)',\n} as const;\n\nexport type StatusTone = keyof typeof STATUS_VARS;\n\n/** Grid, axis and de-emphasis inks, so charts stop hard-coding gray-400. */\nexport const CHART_INK = {\n grid: 'var(--viz-grid)',\n axis: 'var(--viz-axis)',\n label: 'var(--viz-label)',\n /** The \"everything that is not the point\" colour, for the emphasis form. */\n muted: 'var(--viz-muted)',\n /** Painted behind marks to separate them without drawing a border. */\n surface: 'var(--viz-surface)',\n} as const;\n\n/**\n * The colour for categorical slot `index`, counted from zero.\n *\n * Past the eighth slot this returns the de-emphasis ink rather than wrapping:\n * a cycled 9th hue is indistinguishable from an existing slot under CVD, and\n * silently returning one would hide the modelling mistake. Fold the tail into\n * an \"Other\" series instead.\n */\nexport function seriesColor(index: number): string {\n return SERIES_VARS[index] ?? CHART_INK.muted;\n}\n\n/**\n * Resolve one series' colour from an explicit choice, a status tone, or its\n * slot. Explicit wins, because a caller naming a colour has a reason.\n */\nexport function resolveSeriesColor(\n index: number,\n explicit?: string,\n tone?: StatusTone,\n): string {\n if (explicit) return explicit;\n if (tone) return STATUS_VARS[tone];\n return seriesColor(index);\n}\n","/**\n * Scale primitives — the piece the existing charts never needed.\n *\n * `Sparkline`, `BarChart`, `DonutChart` and `LineChart` are decorative: a\n * stretched `0 0 100 100` viewBox, `aria-hidden`, no axis, numbers carried as\n * text elsewhere on the page. That is the right shape for a dashboard tile and\n * the wrong one for a chart someone reads values off, because a stretched\n * viewBox stretches TEXT — an axis label in it is squashed or smeared by\n * whatever aspect ratio the container happens to have.\n *\n * So the analytical charts draw in real pixel space, and that means they need\n * scales. The split is borrowed from visx, which separates `@visx/scale` and\n * `@visx/axis` from any chart type at all: a scale is a pure function from a\n * data value to a pixel, nothing more, and everything else composes on top.\n * Keeping it a plain function (rather than pulling in d3-scale) also keeps this\n * package's dependency count where it is — zero.\n */\n\n/** A pixel range, from the low edge to the high edge, in SVG coordinates. */\nexport interface Range {\n /** Pixel at the domain minimum. For y this is the BOTTOM, so it is larger. */\n from: number;\n /** Pixel at the domain maximum. */\n to: number;\n}\n\nexport interface LinearScale {\n (value: number): number;\n domain: [number, number];\n range: Range;\n /** Evenly spaced domain values, for axis ticks. */\n ticks(count: number): number[];\n}\n\n/**\n * A continuous value → pixel mapping.\n *\n * A zero-width domain maps everything to the low edge rather than dividing by\n * zero: one flat series is a real case (a percentile pinned to one bound for a\n * whole window), and it should draw a flat line, not `NaN`.\n */\nexport function linearScale(\n domain: [number, number],\n range: Range,\n): LinearScale {\n const [lo, hi] = domain;\n const span = hi - lo;\n const scale = ((value: number) => {\n if (span === 0) return range.from;\n return range.from + ((value - lo) / span) * (range.to - range.from);\n }) as LinearScale;\n scale.domain = domain;\n scale.range = range;\n scale.ticks = (count: number) => {\n if (count < 2) return [lo];\n return Array.from({ length: count }, (_, i) => lo + (span * i) / (count - 1));\n };\n return scale;\n}\n\nexport interface BandScale {\n (index: number): number;\n /** Width of one band, gaps already removed. */\n bandwidth: number;\n /** Centre of band `index` — where a tick label or a point marker belongs. */\n center(index: number): number;\n /** Right edge of band `index`. A step segment runs from `(i)` to `end(i)`. */\n end(index: number): number;\n count: number;\n}\n\n/**\n * An index → band mapping, for anything drawn per bucket: bars, step segments,\n * a state ribbon, the hit target under a crosshair.\n *\n * `padding` is the fraction of a band left as gap — `0` for a continuous step\n * chart where segments must touch, `0.2` or so for bars that need daylight\n * between them. The gap is the design-system way to separate adjacent marks;\n * a stroke around each bar is the way that reads as noise.\n */\nexport function bandScale(\n count: number,\n range: Range,\n padding = 0,\n): BandScale {\n const width = count > 0 ? (range.to - range.from) / count : 0;\n const gap = width * padding;\n const scale = ((index: number) => range.from + index * width + gap / 2) as BandScale;\n scale.bandwidth = Math.max(0, width - gap);\n scale.center = (index: number) => range.from + index * width + width / 2;\n scale.end = (index: number) => range.from + (index + 1) * width - gap / 2;\n scale.count = count;\n return scale;\n}\n\nexport interface LadderScale {\n (value: number): number;\n /** The rungs, ascending — these are the axis ticks, by definition. */\n levels: number[];\n /** Rung index for a value, or -1 when it is not on the ladder. */\n indexOf(value: number): number;\n range: Range;\n}\n\n/**\n * An ORDINAL scale over a known set of levels, spaced evenly regardless of\n * their numeric distance.\n *\n * This exists for quantised measures — the ones whose value can only ever land\n * on a boundary. Histogram-derived percentiles are the case that forced it: a\n * backend returning the first bucket bound to reach P95 can only ever answer\n * 25, 50, 100, 250, 500, 1000, 2500 or 5000, and plotting those on a linear\n * millisecond axis crushes the bottom five rungs into a twentieth of the plot\n * while implying the gap from 2500 to 5000 is meaningful resolution. Equal\n * spacing per rung is the honest geometry, and it makes the quantisation\n * visible instead of hiding it under a smooth line.\n *\n * A value off the ladder snaps to the nearest rung at or above it, and to the\n * top rung when it exceeds every level — which is what an overflow bucket\n * means and how it should draw.\n */\nexport function ladderScale(levels: number[], range: Range): LadderScale {\n const rungs = [...levels].sort((a, b) => a - b);\n const last = Math.max(0, rungs.length - 1);\n const at = (index: number) =>\n last === 0 ? range.from : range.from + (index / last) * (range.to - range.from);\n const scale = ((value: number) => {\n const exact = rungs.indexOf(value);\n if (exact >= 0) return at(exact);\n const above = rungs.findIndex(rung => rung >= value);\n return at(above === -1 ? last : above);\n }) as LadderScale;\n scale.levels = rungs;\n scale.indexOf = (value: number) => rungs.indexOf(value);\n scale.range = range;\n return scale;\n}\n\n/**\n * Round a domain maximum up to a readable tick value — 1, 2, 2.5 or 5 times a\n * power of ten. Without it an axis tops out at 16.55 and prints 16.55, 8.28, 0.\n */\nexport function niceMax(value: number): number {\n if (!Number.isFinite(value) || value <= 0) return 1;\n const magnitude = 10 ** Math.floor(Math.log10(value));\n const normalised = value / magnitude;\n const step = normalised <= 1 ? 1 : normalised <= 2 ? 2 : normalised <= 2.5 ? 2.5 : normalised <= 5 ? 5 : 10;\n return step * magnitude;\n}\n\n/**\n * A continuous value → pixel mapping on a logarithmic axis.\n *\n * The case this exists for is a long tail: per-route request counts where most\n * routes sit near the origin and two or three run into the tens of thousands.\n * On a linear axis the many collapse into one unreadable clump against the\n * axis, and the chart answers only a question about the outliers.\n *\n * Zero and negatives have no logarithm, and clamping them to the low edge would\n * place \"never called\" and \"called once\" on the same pixel. So the floor is the\n * domain's own low end whenever that is positive, and only a domain reaching\n * zero or below borrows one — three decades under the top, which is the range a\n * long tail actually occupies. Any value beneath the floor draws AT it —\n * visible, and not claimed to be distinguishable from its neighbours.\n *\n * The floor used to be a hard `Math.max(1, …)` on BOTH ends, which was right\n * for counts and silently wrong for everything else: a domain of seconds like\n * `[0.02, 0.9]` came back as `[1, 1]`, so every point drew on one pixel column\n * under an axis labelled `1`. Fractional data is exactly what a log axis is\n * for, and there was no way for a caller to opt out of the constant.\n *\n * `ticks` returns powers of ten inside the domain rather than even spacing,\n * because evenly spaced values on a log axis land at absurd positions (a tick\n * at 25,000 sits almost on top of one at 50,000). The domain's own ends are\n * added when no power of ten is near them — near being measured in DECADES,\n * since that is what the axis is spaced in: `[1, 1200]` would otherwise label\n * both 1,000 and 1,200, sixteen pixels apart on a 400px plot.\n */\n/** How much of a decade two ticks must be apart to both be worth labelling. */\nconst TICK_DECADE_GAP = 0.15;\n\nexport function logScale(\n domain: [number, number],\n range: Range,\n): LinearScale {\n const top = Math.max(domain[0], domain[1]);\n const bottom = Math.min(domain[0], domain[1]);\n // A domain that never reaches a positive number has no logarithmic form at\n // all; it degenerates rather than returning NaN geometry.\n const hi = top > 0 ? top : 0;\n const lo = bottom > 0 ? bottom : hi > 0 ? 10 ** (Math.ceil(Math.log10(hi)) - 3) : 0;\n const logLo = Math.log10(lo);\n const span = hi > 0 && lo > 0 ? Math.log10(hi) - logLo : 0;\n const scale = ((value: number) => {\n if (span <= 0) return range.from;\n const clamped = Math.max(lo, value);\n return range.from + ((Math.log10(clamped) - logLo) / span) * (range.to - range.from);\n }) as LinearScale;\n scale.domain = [lo, hi];\n scale.range = range;\n scale.ticks = (count: number) => {\n if (count < 2 || span <= 0) return [lo];\n const first = Math.ceil(logLo);\n const last = Math.floor(Math.log10(hi));\n const powers: number[] = [];\n for (let e = first; e <= last; e += 1) powers.push(10 ** e);\n // A domain narrow enough to contain no power of ten still needs its ends\n // labelled, or the axis prints nothing at all.\n if (powers.length === 0) return [lo, hi];\n // An end is worth its own tick only when no power of ten already sits\n // within a sixth of a decade of it. Distance is measured in decades\n // because that is the axis's own spacing: 1,000 and 1,200 are 200 apart\n // and a twelfth of a decade, which is two labels on top of each other.\n if (Math.log10(powers[0]) - logLo > TICK_DECADE_GAP) powers.unshift(lo);\n if (Math.log10(hi) - Math.log10(powers[powers.length - 1]) > TICK_DECADE_GAP) powers.push(hi);\n return powers;\n };\n return scale;\n}\n\nexport interface AngleScale {\n (index: number): number;\n /** Radians per slot. */\n step: number;\n /** Centre angle of slot `index` — where a radar vertex or a label sits. */\n center(index: number): number;\n count: number;\n}\n\n/**\n * An index → angle mapping over a full turn, starting at twelve o'clock.\n *\n * Shared by everything polar: pie and rose wedges, radial bars, radar axes, and\n * the ring of a sunburst. Starting at -90° rather than 0° is the convention\n * every chart library lands on, because a reader expects the first slice at the\n * top; `padAngle` is the gap between marks, which is how adjacent wedges are\n * separated without drawing a border around each one.\n */\nexport function angleScale(count: number, padAngle = 0): AngleScale {\n const step = count > 0 ? (Math.PI * 2) / count : 0;\n const scale = ((index: number) => -Math.PI / 2 + index * step + padAngle / 2) as AngleScale;\n scale.step = Math.max(0, step - padAngle);\n scale.center = (index: number) => -Math.PI / 2 + index * step + step / 2;\n scale.count = count;\n return scale;\n}\n\n/**\n * Value → RADIUS, area-proportional.\n *\n * The one scale that must not be linear. A bubble's meaning is carried by its\n * area, and area grows with the square of the radius — so mapping a value\n * straight to a radius makes a doubled value look four times as big. Every\n * serious library square-roots this, and the bug is common enough in ones that\n * do not that it is worth the separate function.\n */\nexport function radiusScale(\n domain: [number, number],\n range: Range,\n): (value: number) => number {\n const [lo, hi] = domain;\n const span = Math.sqrt(Math.max(0, hi)) - Math.sqrt(Math.max(0, lo));\n return (value: number) => {\n if (span === 0) return range.to;\n const t = (Math.sqrt(Math.max(0, value)) - Math.sqrt(Math.max(0, lo))) / span;\n return range.from + Math.min(1, Math.max(0, t)) * (range.to - range.from);\n };\n}\n\n/** Bin a set of observations into evenly spaced buckets, for a histogram. */\nexport function binValues(\n values: number[],\n bins: number | number[] = 10,\n): { from: number; to: number; count: number }[] {\n // A bad sample is skipped, never a crash: one NaN would poison the spread\n // through `Math.min`/`Math.max` and then index `bins[NaN]`.\n const finite = values.filter(Number.isFinite);\n\n // Explicit boundaries — the caller's edges ARE the bins, `[from, to)` with\n // the top bin closed. A backend that chose latency buckets `[25,50,100,…]`\n // must see counts against those edges, not an even re-spread of the range.\n if (Array.isArray(bins)) {\n const edges = [...bins].filter(Number.isFinite).sort((a, b) => a - b);\n if (edges.length < 2) return [];\n const out = Array.from({ length: edges.length - 1 }, (_, i) => ({\n from: edges[i],\n to: edges[i + 1],\n count: 0,\n }));\n const top = edges[edges.length - 1];\n for (const value of finite) {\n if (value < edges[0] || value > top) continue;\n const index = value === top\n ? out.length - 1\n : out.findIndex(bin => value >= bin.from && value < bin.to);\n if (index >= 0) out[index].count += 1;\n }\n return out;\n }\n\n const binCount = bins;\n if (finite.length === 0 || binCount < 1) return [];\n const lo = Math.min(...finite);\n const hi = Math.max(...finite);\n const width = (hi - lo) / binCount || 1;\n const out = Array.from({ length: binCount }, (_, i) => ({\n from: lo + i * width,\n to: lo + (i + 1) * width,\n count: 0,\n }));\n for (const value of finite) {\n // The top bin is closed on both sides, so the maximum lands in it rather\n // than in an imaginary bin past the end.\n const index = Math.min(binCount - 1, Math.floor((value - lo) / width));\n out[index].count += 1;\n }\n return out;\n}\n","/**\n * Path builders — the shape a line takes between two points.\n *\n * Split out of the chart components because the choice is a claim about the\n * data, not a style preference, and three different charts need to make it:\n *\n * linear the value moved directly from A to B. The default, and the only\n * honest one when the samples are all you know.\n * monotone a smooth curve that CANNOT overshoot between two points. If the\n * data rises from A to B, so does the curve — no local bump, no\n * invented peak. The curved option to reach for by default.\n * spline Catmull-Rom. Looser and rounder, and it can bulge past a point\n * on the way to the next one: 10, 20, 21 draws a hump above 21\n * that the data does not contain. Clamped to the data's overall\n * range, so it cannot leave the plot, but a LOCAL invention is\n * still an invention. Kept for when the looser shape is wanted\n * knowingly.\n * step the value HELD at A until B. Right for anything quantised or\n * state-like, and the reason `TimeSeriesChart` has a step mode at\n * all: joining two histogram bounds with a slope draws a\n * transition that never happened.\n * bump flat AT each point, curved between them. The shape a rank takes:\n * third place is third place for the whole month and then moves,\n * so the tangent at the sample is horizontal and all the change\n * happens in the gap. It is also the shape of a flow between two\n * nodes, which is why `SankeyChart` draws its ribbons with it.\n *\n * The spline is Catmull-Rom converted to cubic Bézier, which is the standard\n * trick — it passes THROUGH the data (a plain Bézier would not) and needs no\n * solver. `tension` 0 gives the classic uniform Catmull-Rom; higher values\n * flatten it toward straight segments.\n *\n * One thing a spline cannot be allowed to do is invent a value outside the\n * data's range — a smooth curve through 0, 10, 0 will dip below zero on the way\n * out and back, and on a count that reads as negative requests. `clampY` pulls\n * the control points back inside the span the points actually occupy.\n */\n\nexport type Curve = 'linear' | 'monotone' | 'spline' | 'step' | 'bump';\n\nexport type Point = [number, number];\n\nconst fixed = (n: number) => n.toFixed(2);\n\nexport function linearPath(points: Point[]): string {\n return points.map(([x, y], i) => `${i === 0 ? 'M' : 'L'}${fixed(x)},${fixed(y)}`).join(' ');\n}\n\n/**\n * Flat across each band, vertical only at the boundary. Takes bands rather than\n * points because a held value occupies an interval, not an instant.\n */\nexport function stepPath(bands: { start: number; end: number; y: number }[]): string {\n let d = '';\n bands.forEach((band, i) => {\n d += `${i === 0 ? 'M' : ' L'}${fixed(band.start)},${fixed(band.y)}`;\n d += ` L${fixed(band.end)},${fixed(band.y)}`;\n });\n return d;\n}\n\n/**\n * Fritsch–Carlson monotone cubic interpolation.\n *\n * The tangent at each point starts as the average of its two neighbouring\n * secants, then gets pulled back until it cannot produce an overshoot. That\n * limiting step is the whole algorithm: without it this is an ordinary cubic\n * spline that bulges past the data between samples, and a bulge on a count is a\n * value nobody measured.\n *\n * Works unchanged in SVG's flipped y-axis — monotonicity survives negation.\n */\nexport function monotonePath(points: Point[]): string {\n if (points.length < 3) return linearPath(points);\n\n const n = points.length;\n const dx: number[] = [];\n const secant: number[] = [];\n for (let i = 0; i < n - 1; i += 1) {\n const h = points[i + 1][0] - points[i][0];\n dx.push(h);\n // A repeated x has no slope; treat the segment as flat rather than\n // dividing by zero.\n secant.push(h === 0 ? 0 : (points[i + 1][1] - points[i][1]) / h);\n }\n\n const m: number[] = [secant[0]];\n for (let i = 1; i < n - 1; i += 1) {\n // At a local extremum the two secants disagree in sign, and ANY non-zero\n // tangent there is an overshoot by construction: the curve would have to\n // leave the data's range and come back. The magnitude test below cannot\n // catch this — it squares alpha and beta, which throws away exactly the\n // sign that says the tangent points the wrong way — so a peak has to be\n // flattened here, before that test ever runs.\n m.push(secant[i - 1] * secant[i] <= 0 ? 0 : (secant[i - 1] + secant[i]) / 2);\n }\n m.push(secant[n - 2]);\n\n for (let i = 0; i < n - 1; i += 1) {\n if (secant[i] === 0) {\n // A flat segment must stay flat, or the curve dips and returns through a\n // value the data says never changed.\n m[i] = 0;\n m[i + 1] = 0;\n continue;\n }\n const alpha = m[i] / secant[i];\n const beta = m[i + 1] / secant[i];\n const magnitude = alpha * alpha + beta * beta;\n if (magnitude > 9) {\n const tau = 3 / Math.sqrt(magnitude);\n m[i] = tau * alpha * secant[i];\n m[i + 1] = tau * beta * secant[i];\n }\n }\n\n let d = `M${fixed(points[0][0])},${fixed(points[0][1])}`;\n for (let i = 0; i < n - 1; i += 1) {\n const h = dx[i] / 3;\n d += ` C${fixed(points[i][0] + h)},${fixed(points[i][1] + m[i] * h)}`\n + ` ${fixed(points[i + 1][0] - h)},${fixed(points[i + 1][1] - m[i + 1] * h)}`\n + ` ${fixed(points[i + 1][0])},${fixed(points[i + 1][1])}`;\n }\n return d;\n}\n\nexport function splinePath(points: Point[], tension = 0): string {\n if (points.length < 3) return linearPath(points);\n\n const ys = points.map(p => p[1]);\n const lo = Math.min(...ys);\n const hi = Math.max(...ys);\n const clampY = (y: number) => Math.min(hi, Math.max(lo, y));\n const factor = (1 - tension) / 6;\n\n let d = `M${fixed(points[0][0])},${fixed(points[0][1])}`;\n for (let i = 0; i < points.length - 1; i += 1) {\n const p0 = points[i - 1] ?? points[i];\n const p1 = points[i];\n const p2 = points[i + 1];\n const p3 = points[i + 2] ?? p2;\n const c1x = p1[0] + (p2[0] - p0[0]) * factor;\n const c1y = clampY(p1[1] + (p2[1] - p0[1]) * factor);\n const c2x = p2[0] - (p3[0] - p1[0]) * factor;\n const c2y = clampY(p2[1] - (p3[1] - p1[1]) * factor);\n d += ` C${fixed(c1x)},${fixed(c1y)} ${fixed(c2x)},${fixed(c2y)} ${fixed(p2[0])},${fixed(p2[1])}`;\n }\n return d;\n}\n\n/**\n * Horizontal tangents at every point: out of A flat, into B flat, all the\n * movement in between. The control points sit at the midpoint x of each pair,\n * which is what makes both ends level.\n */\nexport function bumpPath(points: Point[]): string {\n if (points.length < 2) return linearPath(points);\n let d = `M${fixed(points[0][0])},${fixed(points[0][1])}`;\n for (let i = 1; i < points.length; i += 1) {\n const [x0, y0] = points[i - 1];\n const [x1, y1] = points[i];\n const mid = (x0 + x1) / 2;\n d += ` C${fixed(mid)},${fixed(y0)} ${fixed(mid)},${fixed(y1)} ${fixed(x1)},${fixed(y1)}`;\n }\n return d;\n}\n\nexport function curvePath(points: Point[], curve: Curve = 'linear', tension = 0): string {\n if (points.length === 0) return '';\n if (points.length === 1) return `M${fixed(points[0][0])},${fixed(points[0][1])}`;\n if (curve === 'monotone') return monotonePath(points);\n if (curve === 'spline') return splinePath(points, tension);\n if (curve === 'bump') return bumpPath(points);\n return linearPath(points);\n}\n\n/** Close a line into an area against a flat baseline. */\nexport function areaFrom(path: string, points: Point[], baselineY: number): string {\n if (points.length === 0) return '';\n const first = points[0];\n const last = points[points.length - 1];\n return `${path} L${fixed(last[0])},${fixed(baselineY)} L${fixed(first[0])},${fixed(baselineY)} Z`;\n}\n\n/** Close a line onto another line — a band, or one layer of a stack. */\nexport function areaBetween(topPath: string, bottom: Point[]): string {\n if (bottom.length === 0) return topPath;\n const back = [...bottom].reverse().map(([x, y]) => `${fixed(x)},${fixed(y)}`).join(' L');\n return `${topPath} L${back} Z`;\n}\n\n/** A regular polygon's vertices — six of them is the hexagon a radar draws. */\nexport function polygonPoints(\n cx: number, cy: number, radius: number, sides: number, rotation = -Math.PI / 2,\n): Point[] {\n return Array.from({ length: sides }, (_, i) => {\n const angle = rotation + (i * 2 * Math.PI) / sides;\n return [cx + radius * Math.cos(angle), cy + radius * Math.sin(angle)] as Point;\n });\n}\n\n/** An SVG arc wedge, used by pie, rose, radial bar and sunburst alike. */\nexport function arcPath(\n cx: number, cy: number, inner: number, outer: number, startAngle: number, endAngle: number,\n): string {\n const sweep = endAngle - startAngle;\n // A full turn cannot be drawn as one arc — the start and end points coincide,\n // so the renderer draws nothing. Split it in half.\n if (Math.abs(sweep) >= Math.PI * 2) {\n const mid = startAngle + Math.PI;\n return `${arcPath(cx, cy, inner, outer, startAngle, mid)} ${arcPath(cx, cy, inner, outer, mid, startAngle + Math.PI * 2)}`;\n }\n const large = Math.abs(sweep) > Math.PI ? 1 : 0;\n const p = (r: number, a: number): Point => [cx + r * Math.cos(a), cy + r * Math.sin(a)];\n const [ox1, oy1] = p(outer, startAngle);\n const [ox2, oy2] = p(outer, endAngle);\n if (inner <= 0) {\n return `M${fixed(cx)},${fixed(cy)} L${fixed(ox1)},${fixed(oy1)} A${fixed(outer)},${fixed(outer)} 0 ${large} 1 ${fixed(ox2)},${fixed(oy2)} Z`;\n }\n const [ix2, iy2] = p(inner, endAngle);\n const [ix1, iy1] = p(inner, startAngle);\n return `M${fixed(ox1)},${fixed(oy1)} A${fixed(outer)},${fixed(outer)} 0 ${large} 1 ${fixed(ox2)},${fixed(oy2)} L${fixed(ix2)},${fixed(iy2)} A${fixed(inner)},${fixed(inner)} 0 ${large} 0 ${fixed(ix1)},${fixed(iy1)} Z`;\n}\n","/**\n * Squarified treemap layout, as a pure function.\n *\n * Kept out of the component for the reason the scales are: a layout is data →\n * geometry and nothing else, so it is the part worth testing directly and the\n * part a consumer with its own renderer can reuse.\n *\n * \"Squarified\" is the Bruls–Huizing–van Wijk algorithm, and the naive\n * alternative is why it exists. Slicing the rectangle strictly alternately\n * produces slivers — cells so long and thin their area is unreadable and their\n * label does not fit. Squarify instead grows a row only while doing so improves\n * the worst aspect ratio in it, then lays the row down and starts another. The\n * result is cells near square, which is what makes area comparable by eye.\n */\n\nexport interface TreemapItem {\n key: string;\n label: string;\n value: number;\n}\n\nexport interface TreemapTile extends TreemapItem {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\ninterface Frame { x: number; y: number; width: number; height: number }\n\n/** Worst aspect ratio in a row, given the row's total and the side it sits on. */\nfunction worst(row: number[], sum: number, side: number): number {\n if (row.length === 0 || sum <= 0 || side <= 0) return Infinity;\n const max = Math.max(...row);\n const min = Math.min(...row);\n const s2 = sum * sum;\n const w2 = side * side;\n return Math.max((w2 * max) / s2, s2 / (w2 * min));\n}\n\nfunction layoutRow(row: TreemapItem[], sum: number, frame: Frame, vertical: boolean): { tiles: TreemapTile[]; rest: Frame } {\n const side = vertical ? frame.height : frame.width;\n const thickness = side > 0 ? sum / side : 0;\n let offset = 0;\n const tiles = row.map(item => {\n const length = sum > 0 ? (item.value / sum) * side : 0;\n const tile: TreemapTile = vertical\n ? { ...item, x: frame.x, y: frame.y + offset, width: thickness, height: length }\n : { ...item, x: frame.x + offset, y: frame.y, width: length, height: thickness };\n offset += length;\n return tile;\n });\n const rest: Frame = vertical\n ? { x: frame.x + thickness, y: frame.y, width: frame.width - thickness, height: frame.height }\n : { x: frame.x, y: frame.y + thickness, width: frame.width, height: frame.height - thickness };\n return { tiles, rest };\n}\n\nexport function squarify(\n items: TreemapItem[],\n width: number,\n height: number,\n): TreemapTile[] {\n const positive = items.filter(i => i.value > 0).sort((a, b) => b.value - a.value);\n if (positive.length === 0 || width <= 0 || height <= 0) return [];\n\n const total = positive.reduce((n, i) => n + i.value, 0);\n const area = width * height;\n // Work in AREA units so the row test compares like with like.\n const scaled = positive.map(i => ({ ...i, value: (i.value / total) * area }));\n\n const tiles: TreemapTile[] = [];\n let frame: Frame = { x: 0, y: 0, width, height };\n let row: typeof scaled = [];\n let rowSum = 0;\n let queue = [...scaled];\n\n while (queue.length > 0) {\n const next = queue[0];\n const side = Math.min(frame.width, frame.height);\n const vertical = frame.width >= frame.height;\n const current = worst(row.map(r => r.value), rowSum, side);\n const candidate = worst([...row.map(r => r.value), next.value], rowSum + next.value, side);\n\n if (row.length === 0 || candidate <= current) {\n row.push(next);\n rowSum += next.value;\n queue = queue.slice(1);\n } else {\n const laid = layoutRow(row, rowSum, frame, vertical);\n tiles.push(...laid.tiles);\n frame = laid.rest;\n row = [];\n rowSum = 0;\n }\n }\n\n if (row.length > 0) {\n tiles.push(...layoutRow(row, rowSum, frame, frame.width >= frame.height).tiles);\n }\n\n // Hand back the ORIGINAL values; the area scaling was an implementation\n // detail and a caller labelling a tile wants the number it passed in.\n const byKey = new Map(items.map(i => [i.key, i.value]));\n return tiles.map(t => ({ ...t, value: byKey.get(t.key) ?? t.value }));\n}\n","/**\n * Legend ↔ plot linkage.\n *\n * EvilCharts calls this `hover-highlight`: point at a legend entry and every\n * other series recedes. It is the single most useful interaction on a\n * multi-series chart, because the moment there are four lines the legend stops\n * answering \"which one is Acme\" — the reader has to trace a colour across a\n * tangle, and colours that were distinguishable in a swatch stop being so\n * against a busy plot.\n *\n * The linkage is a context rather than a prop, because of how this family is\n * assembled: `ChartFrame` owns the legend and the chart is its child, so there\n * is no prop path between them that does not make every caller wire a piece of\n * state it has no other use for.\n *\n * Two rules the implementation enforces:\n *\n * - **Keyboard focus does exactly what hover does.** A highlight reachable\n * only by pointer is a feature half the users do not have. The legend\n * entries are buttons for that reason, not for the click.\n * - **A legend key must match a series key.** They are the same identifier —\n * that is what lets colour follow the entity — and a legend entry naming a\n * key no series has would silently highlight nothing. `useHighlight`\n * returns the raw key so a chart can compare, and the specs assert the\n * match rather than trusting it.\n */\nimport { createContext, useContext, useMemo, useState, type ReactNode } from 'react';\n\nimport type { ChartAutoHighlight } from './types';\n\ninterface HighlightValue {\n /** The series key under the pointer or focus, or null. */\n highlighted: string | null;\n setHighlighted: (key: string | null) => void;\n}\n\nconst HighlightContext = createContext<HighlightValue>({\n highlighted: null,\n setHighlighted: () => {},\n});\n\nexport function ChartHighlightProvider({ children }: { children: ReactNode }) {\n const [highlighted, setHighlighted] = useState<string | null>(null);\n const value = useMemo(() => ({ highlighted, setHighlighted }), [highlighted]);\n return <HighlightContext.Provider value={value}>{children}</HighlightContext.Provider>;\n}\n\nexport function useHighlight(): HighlightValue {\n return useContext(HighlightContext);\n}\n\n/**\n * How opaque a series should be, given what is highlighted.\n *\n * Returns `null` when nothing is highlighted, so a caller can keep whatever\n * opacity it was already using rather than being forced to 1 — the difference\n * matters for a stacked fill, which is translucent by design.\n */\nexport function highlightOpacity(\n seriesKey: string,\n highlighted: string | null,\n dimmed = 0.22,\n): number | null {\n if (highlighted === null) return null;\n return highlighted === seriesKey ? 1 : dimmed;\n}\n\n/**\n * The index a chart should light when no pointer is involved.\n *\n * Derived rather than named, because a peak written into a prop goes stale the\n * moment the window moves — and goes SILENTLY stale, which is the worse half.\n * `values` is what the reader compares: a stacked chart passes its bucket\n * totals, not one series.\n *\n * Ties go to the FIRST occurrence. Two equal peaks are a real case and lighting\n * both would say \"these are the peak\", which is true but useless as an\n * emphasis; lighting the earlier one at least reads as \"it first happened\n * here\".\n */\nexport function autoHighlightIndex(\n values: (number | null | undefined)[],\n mode: ChartAutoHighlight = 'none',\n): number | null {\n if (mode === 'none' || values.length === 0) return null;\n\n if (mode === 'last') {\n for (let i = values.length - 1; i >= 0; i -= 1) {\n if (typeof values[i] === 'number' && Number.isFinite(values[i])) return i;\n }\n return null;\n }\n\n let best: number | null = null;\n values.forEach((value, i) => {\n if (typeof value !== 'number' || !Number.isFinite(value)) return;\n if (best === null) { best = i; return; }\n const incumbent = values[best] as number;\n // Strictly better, so a tie keeps the earlier index.\n if (mode === 'max' ? value > incumbent : value < incumbent) best = i;\n });\n return best;\n}\n","/**\n * Measure the container so the analytical charts can draw in real pixels.\n *\n * The decorative charts dodge this with a stretched `0 0 100 100` viewBox, but\n * that stretches text too, so anything with an axis has to know its own width.\n * `@visx/responsive` solves it with a ResizeObserver wrapper; this is the same\n * idea at a tenth of the size, and without a dependency.\n *\n * The fallback matters more than the hook. Server rendering and the package's\n * own specs have no layout, so a chart that waited for a measurement would\n * render an empty box in both — the first paint would be blank in an SSR app\n * and untestable here. Starting at a plausible width means the chart is\n * complete markup from the first frame and only ever gets *corrected* by the\n * observer, never populated by it.\n */\nimport { useEffect, useState, type RefObject } from 'react';\n\n/** Wide enough to look deliberate in a half-window card if never measured. */\nexport const DEFAULT_PLOT_WIDTH = 720;\n\nexport function usePlotWidth(\n ref: RefObject<HTMLElement | null>,\n fallback = DEFAULT_PLOT_WIDTH,\n): number {\n const [width, setWidth] = useState(fallback);\n\n useEffect(() => {\n const node = ref.current;\n if (!node || typeof ResizeObserver === 'undefined') return;\n const observer = new ResizeObserver(entries => {\n const measured = entries[0]?.contentRect.width ?? 0;\n // A hidden window (display:none) measures 0. Keeping the last good width\n // means reopening it does not flash a collapsed plot.\n if (measured > 0) setWidth(measured);\n });\n observer.observe(node);\n return () => observer.disconnect();\n }, [ref]);\n\n return width;\n}\n","/**\n * RankedBars — magnitude across a nominal list whose names are long.\n *\n * Horizontal, because in an ERP the categories are routes, part numbers,\n * tenants and suppliers, and a vertical axis truncates every one of them.\n * Tremor calls this a BarList and Carbon a lollipop; the job is the same.\n *\n * One colour for every bar. Colouring darker-where-bigger is the tempting\n * mistake: the categories have no natural order, the ramp double-encodes the\n * length the bar already shows, and it burns the only free channel on\n * information the reader has. When ONE row is the finding, name it in\n * `emphasisKey` — that row takes the emphasis hue and the rest recede, which is\n * the honest way to say \"look here\" and is far more legible than eight hues.\n */\nimport { CHART_INK, seriesColor, STATUS_VARS } from './palette';\nimport { MOTION, stagger } from './effects';\nimport { autoHighlightIndex } from './highlight';\nimport type { RankedBarsProps } from './types';\n\nexport default function RankedBars({\n rows,\n max,\n formatValue = v => String(v),\n emphasisKey,\n highlight = 'none',\n emphasisTone,\n barHeight = 12,\n rowGap = 30,\n animate = true,\n className,\n emptyLabel = 'Nothing to rank in this window.',\n}: RankedBarsProps) {\n if (rows.length === 0) {\n return <p className={`text-sm text-gray-500 ${className ?? ''}`}>{emptyLabel}</p>;\n }\n\n const derived = autoHighlightIndex(rows.map(r => r.value), highlight);\n const litKey = emphasisKey ?? (derived === null ? undefined : rows[derived]?.key);\n // Only finite values may set the scale: one NaN in `Math.max` poisons the\n // whole spread, zeroing every bar.\n const top = max ?? Math.max(...rows.map(r => r.value).filter(Number.isFinite), 0);\n const base = seriesColor(0);\n\n return (\n <ol className={`m-0 list-none p-0 ${className ?? ''}`} style={{ display: 'grid', rowGap: `${Math.max(4, rowGap - barHeight)}px` }}>\n {rows.map((row, index) => {\n const emphasised = row.key === litKey;\n const colour = emphasised\n ? (emphasisTone ? STATUS_VARS[emphasisTone] : seriesColor(1))\n : litKey\n ? CHART_INK.muted\n : base;\n // A non-finite value is \"no data\", not \"the biggest bar\": a NaN%\n // width is dropped by the browser and the inner div would default to\n // full width. It draws no bar and prints the em dash, the same\n // missing-versus-zero contract the tooltips keep.\n const value = Number.isFinite(row.value) ? row.value : null;\n const share = value !== null && top > 0 ? Math.max(0, Math.min(1, value / top)) : 0;\n return (\n <li key={row.key} className=\"grid gap-1\">\n <div className=\"flex items-baseline justify-between gap-3\">\n <span className={`truncate font-mono text-xs text-gray-600 ${emphasised ? 'font-semibold' : ''}`} title={row.label}>\n {row.label}\n {/* The emphasis must survive a screen reader, where a hue\n change is silent. */}\n {emphasised && <span className=\"sr-only\"> (emphasised)</span>}\n </span>\n <span\n className=\"shrink-0 text-xs font-semibold tabular-nums text-gray-700\"\n style={emphasised ? { color: colour } : undefined}\n >\n {value === null ? '—' : formatValue(value)}\n </span>\n </div>\n {/* A track behind the bar, so a near-zero row is still a row rather\n than an invisible one. bg-gray-200, not bg-gray-100 — gray-100\n collapses into the host card's `--surface` token in dark mode. */}\n <div className=\"w-full rounded-sm bg-gray-200\" style={{ height: barHeight }}>\n <div\n className={`rounded-sm ${animate ? MOTION.grow : ''}`}\n style={{\n width: `${(share * 100).toFixed(2)}%`, height: barHeight,\n backgroundColor: colour, minWidth: share > 0 ? 2 : 0,\n ...(animate ? stagger(index) : {}),\n }}\n />\n </div>\n </li>\n );\n })}\n </ol>\n );\n}\n\n","/**\n * Meter — one ratio against one target, on one track.\n *\n * Carbon ships this as `meter` and `bullet`, Grafana as a bar gauge; the shape\n * everyone converges on is a filled track with the objective marked ON it, so\n * \"are we over the line\" is a spatial question rather than an arithmetic one.\n *\n * It exists here because the alternative keeps getting reached for and is\n * always worse. An attainment figure drawn as a time series is a flat line\n * pinned at the top of a plot, and it has to borrow a second y-axis to get\n * there — which is how the EFFICIENT Observability console ended up with a\n * percentage scale glued to the right of a millisecond chart. A ratio is not a\n * trend; give it the form that has somewhere to put the target.\n *\n * Tone is derived, not passed: at or above the objective is `good`, below it is\n * `critical`, and the caller can override when the domain disagrees. Status\n * colour never travels alone here — the value and the objective are both\n * written out, so the meaning survives greyscale, CVD and forced-colors.\n */\nimport { CHART_INK, STATUS_VARS } from './palette';\nimport type { MeterProps } from './types';\n\nconst clamp01 = (v: number) => Math.max(0, Math.min(1, v));\n\nexport default function Meter({\n value,\n segments,\n objective,\n label,\n detail,\n formatValue = v => `${(v * 100).toFixed(1)}%`,\n tone,\n className,\n unavailableLabel = 'Not enough eligible requests to judge.',\n}: MeterProps) {\n if (value == null || !Number.isFinite(value)) {\n return (\n <div className={className}>\n {label && <p className=\"text-sm font-medium text-gray-700\">{label}</p>}\n <p className=\"mt-1 text-sm text-gray-500\">{unavailableLabel}</p>\n </div>\n );\n }\n\n const filled = clamp01(value);\n const met = objective == null || value >= objective;\n const verdictTone = tone ?? (met ? 'good' : 'critical');\n const colour = STATUS_VARS[verdictTone];\n\n // One caption line, whatever it is made of. A segmented meter used to add a\n // SECOND paragraph beside this one, so a meter with segments and an\n // objective printed two stacked grey lines where every other form of this\n // control prints one.\n const caption = [\n segments?.length\n ? segments.map(seg => `${seg.label} ${formatValue(seg.value)}`).join(' · ')\n : '',\n detail ?? '',\n objective != null ? `objective ${formatValue(objective)}${met ? ' met' : ' missed'}` : '',\n ].filter(Boolean).join(' · ');\n\n return (\n <div className={className}>\n <div className=\"mb-1.5 flex items-baseline justify-between gap-3\">\n <span className=\"text-sm font-medium text-gray-700\">{label}</span>\n <span className=\"text-sm font-semibold tabular-nums\" style={{ color: colour }}>\n {formatValue(value)}\n </span>\n </div>\n {/* bg-gray-200, not bg-gray-100: ui.css remaps gray-100 to the same\n `--surface` token the host card takes in dark mode, which made the\n track invisible there. gray-200 maps to `--surface-raised`. */}\n <div\n className=\"relative w-full rounded-full bg-gray-200\"\n style={{ height: 12 }}\n role=\"meter\"\n aria-valuenow={Number((filled * 100).toFixed(2))}\n aria-valuemin={0}\n aria-valuemax={100}\n aria-valuetext={formatValue(value)}\n aria-label={label}\n >\n {segments?.length ? (\n // Laid end to end in one track. The container keeps the track's\n // radius and clips to it, and the last part rounds its own trailing\n // edge, so a segmented meter ends the way the single-value fill does\n // rather than on a square cut mid-track; the joins between parts stay\n // square, so the split stays visible.\n //\n // `shrink-0` is load-bearing. Flex items shrink by default, so a set\n // of segments summing past the track was RESCALED to fit rather than\n // clipped — an 80/50 pair rendering as 61.5/38.5 — which disagrees\n // with both the written breakdown below and the objective marker,\n // silently and in the reader's favour. Held at their stated widths,\n // the excess is clipped, which is what the overflow rule is for.\n <div className=\"flex h-full overflow-hidden rounded-full\">\n {segments.map((seg, i) => (\n <div\n key={`${seg.label}-${i}`}\n className={`h-full shrink-0${i === segments.length - 1 ? ' rounded-r-full' : ''}`}\n style={{\n width: `${(clamp01(seg.value) * 100).toFixed(2)}%`,\n // The first part carries the meter's own verdict, not a\n // hard-coded `good`: a missed objective painted the readout\n // red and the bar under it green.\n backgroundColor: STATUS_VARS[seg.tone ?? (i === 0 ? verdictTone : 'neutral')],\n }}\n />\n ))}\n </div>\n ) : (\n <div\n className=\"h-full rounded-full\"\n style={{ width: `${(filled * 100).toFixed(2)}%`, backgroundColor: colour }}\n />\n )}\n {/* Inline ink, not a gray class: bg-gray-600 has no dark remap in\n ui.css, so the objective marker vanished against a dark track. */}\n {objective != null && (\n <span\n className=\"absolute top-[-4px] w-0.5 rounded-full\"\n style={{ left: `${(clamp01(objective) * 100).toFixed(2)}%`, height: 20, backgroundColor: CHART_INK.axis }}\n aria-hidden=\"true\"\n />\n )}\n </div>\n {/* Colour never travels alone: each part is named with its share, so a\n segmented meter survives greyscale, CVD and forced-colors exactly as\n the single-value form's written-out value does. */}\n {caption && <p className=\"mt-1.5 text-xs text-gray-500\">{caption}</p>}\n </div>\n );\n}\n\n","/**\n * StatTile — the form a dashboard should reach for before it reaches for a\n * chart at all.\n *\n * Grafana calls it Stat, Tremor pairs a value with a SparkChart; both exist\n * because the most common charting mistake is drawing eight hues when the story\n * is one number. A single current value with an optional trend is a tile, not a\n * one-bar bar chart.\n *\n * Two typographic details that are decisions rather than defaults:\n *\n * - The value uses PROPORTIONAL figures. `tabular-nums` is right where digits\n * line up in columns and wrong at display size, where equal-width digits\n * make a number like 121 read as loose.\n * - The delta carries an arrow and a word, never colour alone. Green-up /\n * red-down is invisible to a red-green reader and meaningless in print.\n *\n * The sparkline is `aria-hidden` and always optional: the number beside it is\n * the accessible content, and a tile whose trend is the only way to read the\n * data would be a chart wearing a tile's clothes.\n */\nimport Sparkline from './Sparkline';\nimport { resolveSeriesColor, STATUS_VARS } from './palette';\nimport type { StatTileProps } from './types';\n\nconst DIRECTION = {\n up: { glyph: '▲', word: 'up' },\n down: { glyph: '▼', word: 'down' },\n flat: { glyph: '■', word: 'flat' },\n} as const;\n\nexport default function StatTile({\n label,\n value,\n unit,\n delta,\n deltaTone,\n trend,\n trendTone,\n footnote,\n className,\n}: StatTileProps) {\n const direction = delta == null ? null : delta > 0 ? 'up' : delta < 0 ? 'down' : 'flat';\n const deltaColour = deltaTone ? STATUS_VARS[deltaTone] : undefined;\n const trendColour = trendTone ? STATUS_VARS[trendTone] : resolveSeriesColor(0);\n\n return (\n <div className={`flex flex-col gap-0.5 rounded-lg border border-gray-200 bg-white p-4 ${className ?? ''}`}>\n <span className=\"text-xs font-medium uppercase tracking-wide text-gray-500\">{label}</span>\n <span className=\"flex items-baseline gap-1.5\">\n <span className=\"text-2xl font-semibold leading-tight text-gray-900\">{value}</span>\n {unit && <span className=\"text-sm font-medium text-gray-500\">{unit}</span>}\n </span>\n {direction && (\n <span className=\"text-xs font-medium\" style={deltaColour ? { color: deltaColour } : undefined}>\n <span aria-hidden=\"true\">{DIRECTION[direction].glyph}</span>{' '}\n {Math.abs(delta as number)}\n <span className=\"sr-only\"> {DIRECTION[direction].word}</span>\n </span>\n )}\n {trend && trend.length > 1 && (\n <Sparkline\n data={trend}\n height={26}\n stroke={trendColour}\n strokeWidth={2}\n className=\"mt-1.5 w-full\"\n />\n )}\n {footnote && <span className=\"mt-1 text-xs text-gray-500\">{footnote}</span>}\n </div>\n );\n}\n","/**\n * ChartSkeleton — what a chart shows before it has ever had data.\n *\n * EvilCharts ships a loading state on every one of its charts; this family had\n * none, so a slow endpoint left an empty box that reads as \"broken\" rather than\n * \"coming\". The shimmer is the same idea: a soft band sweeping across a\n * plausible chart-shaped placeholder.\n *\n * The distinction this component exists to enforce is between two states that\n * are usually collapsed into one `loading` flag, and must not be:\n *\n * **First load** — there is no data yet, so there is nothing to hold. Show\n * the skeleton, at the chart's real height, so the arriving chart does not\n * shove the page.\n *\n * **Refetch** — data is already on screen. Showing a skeleton here throws\n * away a correct render to display a fake one, and on a polling dashboard it\n * strobes. `ChartFrame`'s `busy` holds the previous render at reduced opacity\n * instead. A chart that flashes its skeleton on every poll is the canonical\n * version of this mistake.\n *\n * The placeholder's shape is deliberately generic — a grid and a soft mound,\n * not a fake series. A skeleton that mimics real data teaches the reader a\n * shape that is about to be replaced by a different one, and for a beat they\n * believe it.\n */\nimport { useId } from 'react';\n\nimport { CHART_INK } from './palette';\nimport type { ChartSkeletonProps } from './types';\n\nexport default function ChartSkeleton({\n height = 220,\n width = 720,\n variant = 'area',\n bars = 9,\n label = 'Loading chart data',\n className,\n}: ChartSkeletonProps) {\n const id = useId();\n const shimmerId = `${id}-shimmer`;\n const left = 48;\n const right = width - 16;\n const top = 12;\n const bottom = height - 26;\n const rows = 4;\n\n return (\n <div className={className}>\n <svg\n width=\"100%\" height={height} viewBox={`0 0 ${width} ${height}`}\n role=\"img\" aria-label={label} aria-busy=\"true\"\n >\n <defs>\n {/* A band, not a hard edge: the sweep feathers in and out so it reads\n as light moving across a surface rather than a rectangle sliding. */}\n <linearGradient id={shimmerId} x1=\"0\" y1=\"0\" x2=\"1\" y2=\"0\">\n <stop offset=\"0%\" stopColor={CHART_INK.surface} stopOpacity=\"0\" />\n <stop offset=\"45%\" stopColor={CHART_INK.surface} stopOpacity=\"0.55\" />\n <stop offset=\"55%\" stopColor={CHART_INK.surface} stopOpacity=\"0.55\" />\n <stop offset=\"100%\" stopColor={CHART_INK.surface} stopOpacity=\"0\" />\n </linearGradient>\n </defs>\n\n {Array.from({ length: rows + 1 }, (_, i) => {\n const y = top + ((bottom - top) * i) / rows;\n return (\n <line\n key={i} x1={left} y1={y} x2={right} y2={y}\n stroke={CHART_INK.grid} strokeWidth={1} shapeRendering=\"crispEdges\"\n />\n );\n })}\n\n {/* Axis-tick placeholders, so the plot does not shift left when real\n labels arrive and claim the gutter. */}\n {Array.from({ length: rows + 1 }, (_, i) => (\n <rect\n key={`t${i}`} x={left - 30} y={top + ((bottom - top) * i) / rows - 4}\n width={22} height={8} rx={4} fill={CHART_INK.grid}\n />\n ))}\n\n {variant === 'bars' ? (\n Array.from({ length: bars }, (_, i) => {\n const slot = (right - left) / bars;\n // A fixed, unremarkable profile rather than a random one: a\n // skeleton that changes between renders reads as data.\n const share = 0.35 + 0.4 * Math.abs(Math.sin((i + 1) * 1.1));\n const barHeight = (bottom - top) * share;\n return (\n <rect\n key={i} x={left + i * slot + slot * 0.18} y={bottom - barHeight}\n width={slot * 0.64} height={barHeight} rx={3} fill={CHART_INK.grid}\n />\n );\n })\n ) : (\n <path\n d={`M${left},${bottom} C${left + (right - left) * 0.25},${top + (bottom - top) * 0.35} ${left + (right - left) * 0.55},${top + (bottom - top) * 0.15} ${right},${top + (bottom - top) * 0.55} L${right},${bottom} Z`}\n fill={CHART_INK.grid}\n />\n )}\n\n {/* The sweep. Twice the plot width and translated across it, so the\n band is fully off-screen at both ends of the cycle. */}\n <rect\n className=\"rosh-viz-shimmer\"\n x={-width} y={0} width={width} height={height}\n fill={`url(#${shimmerId})`}\n />\n </svg>\n </div>\n );\n}\n","/**\n * ChartFrame — the card a chart lives in, and the reason it is a component\n * rather than a pattern each caller reimplements.\n *\n * Three of the four things it carries are obligations, not decoration:\n *\n * - **The table view.** Colour-only encoding on a continuous scale fails\n * WCAG, and three of the eight light-mode series steps sit under 3:1\n * against white. Both are discharged by a text equivalent of the same data.\n * Putting the slot in the frame is what stops it being the first thing\n * dropped under deadline.\n * - **The legend.** Two or more series always get one, so identity is never\n * carried by colour alone — and it is LIVE: pointing at an entry recedes\n * every other series in the plot. Past three or four lines a legend stops\n * answering \"which one is Acme\" on its own, because the reader has to trace\n * a colour across a tangle. Focus does the same as hover, so the linkage is\n * not pointer-only.\n * - **Refetch without a flash.** A skeleton on every poll makes a live\n * dashboard strobe and jump. `busy` holds the previous render at reduced\n * opacity instead, so the layout never moves.\n *\n * The fourth is the empty state, which exists because \"no data\" and \"broken\"\n * look identical when a chart just renders nothing.\n */\nimport ChartSkeleton from './ChartSkeleton';\nimport { ChartHighlightProvider, useHighlight } from './highlight';\nimport { CHART_INK, resolveSeriesColor } from './palette';\nimport type { ChartFrameProps, ChartLegendSwatch } from './types';\n\n/**\n * A swatch drawn to look like the mark it names.\n *\n * The outline variants use a ring rather than a lighter fill: a pale swatch\n * reads as a dimmed series, which is what the hover linkage means, and the two\n * must not look alike.\n */\nfunction LegendSwatch({ shape, colour }: { shape: ChartLegendSwatch; colour: string }) {\n const base = 'shrink-0';\n switch (shape) {\n case 'circle':\n return <span className={`${base} h-2.5 w-2.5 rounded-full`} style={{ backgroundColor: colour }} />;\n case 'circle-outline':\n return <span className={`${base} h-2.5 w-2.5 rounded-full border-2`} style={{ borderColor: colour }} />;\n case 'rounded-square-outline':\n return <span className={`${base} h-2.5 w-2.5 rounded-sm border-2`} style={{ borderColor: colour }} />;\n case 'square':\n return <span className={`${base} h-2.5 w-2.5`} style={{ backgroundColor: colour }} />;\n case 'bar':\n return <span className={`${base} h-1 w-4 rounded-full`} style={{ backgroundColor: colour }} />;\n case 'bar-vertical':\n return <span className={`${base} h-3.5 w-1 rounded-full`} style={{ backgroundColor: colour }} />;\n default:\n return <span className={`${base} h-2.5 w-2.5 rounded-sm`} style={{ backgroundColor: colour }} />;\n }\n}\n\n/**\n * The legend, as buttons. Split out because it consumes the highlight context\n * the frame provides, and a component cannot consume a context it renders.\n */\nfunction ChartLegend({\n entries,\n interactive,\n fallbackSwatch,\n}: {\n entries: NonNullable<ChartFrameProps['legend']>;\n interactive: boolean;\n fallbackSwatch: ChartLegendSwatch;\n}) {\n const { highlighted, setHighlighted } = useHighlight();\n return (\n <ul className=\"m-0 flex flex-wrap items-center gap-x-4 gap-y-1 p-0\">\n {entries.map((entry, i) => {\n const dimmed = interactive && highlighted !== null && highlighted !== entry.key;\n const swatch = (\n <>\n <LegendSwatch\n shape={entry.swatch ?? fallbackSwatch}\n colour={resolveSeriesColor(i, entry.color, entry.tone)}\n />\n {entry.label}\n </>\n );\n return (\n <li key={entry.key} className=\"list-none\">\n {interactive ? (\n <button\n type=\"button\"\n // Focus does what hover does: a highlight reachable only by\n // pointer is a feature half the users do not have.\n onMouseEnter={() => setHighlighted(entry.key)}\n onMouseLeave={() => setHighlighted(null)}\n onFocus={() => setHighlighted(entry.key)}\n onBlur={() => setHighlighted(null)}\n className={`flex items-center gap-2 rounded text-xs text-gray-600 transition-opacity focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500 ${dimmed ? 'opacity-40' : ''}`}\n >\n {swatch}\n </button>\n ) : (\n <span className=\"flex items-center gap-2 text-xs text-gray-600\">{swatch}</span>\n )}\n </li>\n );\n })}\n </ul>\n );\n}\n\nexport default function ChartFrame({\n title,\n subtitle,\n legend,\n table,\n tableLabel = 'Show the data as a table',\n busy = false,\n loading = false,\n skeletonVariant = 'area',\n skeletonHeight,\n interactiveLegend = true,\n legendSwatch = 'rounded-square',\n actions,\n children,\n className,\n}: ChartFrameProps) {\n return (\n <ChartHighlightProvider>\n <section\n className={`flex min-w-0 flex-col gap-3 rounded-lg border border-gray-200 bg-white p-5 ${className ?? ''}`}\n aria-busy={busy || loading || undefined}\n >\n <header className=\"flex items-start justify-between gap-4\">\n <div className=\"min-w-0\">\n <h3 className=\"truncate text-base font-semibold text-gray-900\">{title}</h3>\n {subtitle && <p className=\"mt-0.5 text-sm text-gray-500\">{subtitle}</p>}\n </div>\n {actions && <div className=\"shrink-0\">{actions}</div>}\n </header>\n\n {/* First load has nothing to hold, so it gets the skeleton. A refetch\n does: the previous render stays in place and dims, because replacing\n a correct chart with a fake one is a downgrade, and on a polling\n dashboard it strobes. */}\n {loading ? (\n <ChartSkeleton variant={skeletonVariant} height={skeletonHeight} />\n ) : (\n <div className={busy ? 'opacity-60 transition-opacity' : 'transition-opacity'}>\n {children}\n </div>\n )}\n\n {!loading && legend && legend.length > 1 && (\n <ChartLegend entries={legend} interactive={interactiveLegend} fallbackSwatch={legendSwatch} />\n )}\n\n {!loading && table && (\n <details className=\"border-t border-gray-100 pt-3\">\n <summary className=\"cursor-pointer text-sm font-medium text-gray-600 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500\">\n {tableLabel}\n </summary>\n <div className=\"mt-3 overflow-x-auto\" style={{ color: CHART_INK.label }}>\n {table}\n </div>\n </details>\n )}\n </section>\n </ChartHighlightProvider>\n );\n}\n","/**\n * ChartTooltip — what appears under the pointer, as one component every chart\n * shares.\n *\n * It is a component rather than a snippet because a tooltip is where charts\n * quietly diverge: one rounds its values, the next does not; one lists series\n * in stack order, the next in declaration order; one drops the swatch and the\n * reader loses the only link back to the mark. Sharing it settles all of that\n * once.\n *\n * The layout is a card with a heading and one row per series — swatch, name,\n * then the value hard right in tabular figures so the column of numbers lines\n * up. Three details are decisions:\n *\n * - **Rows read in STACK order, bottom segment first.** A stacked column is\n * read from the baseline up, and a tooltip that lists it the other way\n * round makes the reader map between two orders.\n * - **The value is `tabular-nums`; nothing else is.** Digits align down the\n * column here, which is exactly the case tabular figures are for — and the\n * opposite of a hero figure, where equal-width digits read as loose.\n * - **A missing value is an em dash, never a zero.** \"No data for this\n * bucket\" and \"zero requests in this bucket\" are different facts, and a\n * tooltip that prints 0 for both is lying about one of them.\n *\n * `emphasis` dims every row but one, so a chart that highlights a single series\n * on hover can say the same thing in the tooltip.\n */\nimport { CHART_INK } from './palette';\nimport { glassStyle } from '../utils/glass';\nimport type { ChartTooltipProps } from './types';\n\nexport default function ChartTooltip({\n variant = 'solid',\n title,\n rows,\n footnote,\n emphasisKey,\n className,\n}: ChartTooltipProps) {\n // `glassStyle()` is the package's own frosted surface, and reusing it is the\n // point rather than a convenience: it already degrades to an opaque card\n // under the reduce-transparency preference. Hand-rolling\n // `bg-white/70 backdrop-blur` would look identical until someone turned that\n // setting on, at which point the blur is stripped globally and the card is\n // left translucent with the chart legible straight through the numbers.\n const glass = variant === 'glass';\n return (\n <div\n role=\"status\"\n className={`pointer-events-none min-w-44 rounded-xl p-3 text-xs ${glass ? '' : 'bg-white shadow-xl ring-1 ring-black/5'} ${className ?? ''}`}\n style={glass ? glassStyle() : undefined}\n >\n {title && <p className=\"mb-2 text-sm font-medium text-gray-800\">{title}</p>}\n <ul className=\"m-0 flex list-none flex-col gap-1.5 p-0\">\n {rows.map(row => (\n <li\n key={row.key}\n className=\"flex items-center gap-2.5\"\n style={emphasisKey && row.key !== emphasisKey ? { opacity: 0.45 } : undefined}\n >\n <span\n className=\"h-3 w-3 shrink-0 rounded-[4px]\"\n style={{ backgroundColor: row.color ?? CHART_INK.muted }}\n />\n <span className=\"flex-1 whitespace-nowrap text-gray-600\">{row.label}</span>\n <span className=\"pl-4 font-semibold tabular-nums text-gray-900\">\n {row.value ?? '—'}\n </span>\n </li>\n ))}\n </ul>\n {footnote && <p className=\"mt-2 text-[11px] text-gray-500\">{footnote}</p>}\n </div>\n );\n}\n","/**\n * ChartDot — the marker on a line, in the three weights a busy plot needs.\n *\n * Borrowed from EvilCharts, which ships `default` / `border` / `colored-border`\n * for a reason worth restating: a dot's job changes with what is behind it. On\n * an empty plot a filled 3px circle is plenty; laid over an area fill or a\n * neighbouring line it disappears, and the ring is what separates it from the\n * ground without darkening it. Their implementation clips a full-width gradient\n * rect to the dot shape so the marker inherits a horizontal colour run; this\n * family's series are one colour each, so a plain fill reaches the same place\n * with a tenth of the markup.\n *\n * default a filled dot. The plot is quiet; nothing needs separating.\n * border a small core inside a thick SURFACE ring. The heaviest\n * option, for a marker that has to survive an area fill.\n * colored-border a hollow dot ringed in the series colour. Reads as a\n * sample rather than a value, which suits a dense line.\n *\n * `pulse` is EvilCharts' `dot-ping`, and it carries a claim: a pulsing marker\n * says \"this reading is live\". On a feed that has stalled it is a lie the\n * reader has no way to check, so it is opt-in per chart and never derived —\n * the caller asserts liveness because only the caller knows.\n */\nimport { CHART_INK } from './palette';\nimport type { ChartDotProps } from './types';\n\nexport default function ChartDot({\n cx,\n cy,\n color,\n variant = 'default',\n pulse = false,\n title,\n}: ChartDotProps) {\n const ring = variant === 'border' ? 3 : variant === 'colored-border' ? 1.5 : 0;\n const core = variant === 'border' ? 3 : 3.5;\n\n return (\n <g>\n {/* The pulse sits UNDER the marker, so a growing halo never covers the\n value it is drawing attention to. */}\n {pulse && (\n <circle\n className=\"rosh-viz-ping\"\n cx={cx} cy={cy} r={core}\n fill={color} fillOpacity={0.45}\n />\n )}\n {variant === 'border' && (\n <circle cx={cx} cy={cy} r={core + ring} fill={CHART_INK.surface} />\n )}\n <circle\n cx={cx} cy={cy} r={core}\n fill={variant === 'colored-border' ? CHART_INK.surface : color}\n stroke={variant === 'colored-border' ? color : undefined}\n strokeWidth={variant === 'colored-border' ? ring : undefined}\n >\n {title && <title>{title}</title>}\n </circle>\n </g>\n );\n}\n","/**\n * ChartBrush — a range selector under a time series.\n *\n * The strip shows the WHOLE series in miniature with the selected window lit,\n * which is the part that makes a brush honest rather than merely convenient: a\n * chart that only draws the selection tells the reader nothing about what they\n * are not looking at, and a window chosen inside a spike reads as a plateau\n * when the spike is off-screen.\n *\n * Two things a brush usually gets wrong, handled here:\n *\n * **Keyboard.** A drag-only control is unusable by anyone not holding a\n * mouse, and range selection is exactly the interaction that gets shipped\n * drag-only. Both handles are `role=\"slider\"` with arrow-key movement, so the\n * window can be set without a pointer, and `aria-valuetext` reads the LABEL\n * rather than the index — \"00:14\", not \"2\".\n *\n * **The y-axis moves.** Narrowing the window rescales the plot above, so the\n * same line changes shape. That is correct — it is what zooming is for — but\n * it means a reader who looks away and back can misread the amplitude, which\n * is the second reason the strip keeps the full series in view.\n *\n * The handles cannot cross, and the window cannot collapse: a zero-width\n * selection has nothing to show and would leave the chart above empty with no\n * way back except a mouse.\n */\nimport { useRef, type KeyboardEvent, type PointerEvent } from 'react';\n\nimport { CHART_INK, resolveSeriesColor } from './palette';\nimport type { ChartBrushProps } from './types';\n\nconst HANDLE_WIDTH = 9;\n\nexport default function ChartBrush({\n labels,\n data,\n range,\n onRangeChange,\n height = 46,\n width = 720,\n color,\n className,\n}: ChartBrushProps) {\n const track = useRef<SVGSVGElement>(null);\n const last = labels.length - 1;\n const [from, to] = range;\n const hue = color ?? resolveSeriesColor(0);\n\n const xAt = (index: number) => (last === 0 ? 0 : (index / last) * width);\n const indexAt = (clientX: number) => {\n const box = track.current?.getBoundingClientRect();\n if (!box || box.width === 0) return from;\n const ratio = Math.max(0, Math.min(1, (clientX - box.left) / box.width));\n return Math.round(ratio * last);\n };\n\n const isValue = (v: number | null | undefined): v is number => typeof v === 'number' && Number.isFinite(v);\n const finite = data.filter(isValue);\n const peak = Math.max(...finite, 1);\n const yAt = (value: number) => height - (value / peak) * (height - 6);\n\n // `null` is a gap, drawn as one — the promise `data` makes. So the miniature\n // is one area per contiguous run of readings, each closed to the baseline on\n // its own; drawing through a gap would dive to the floor and read as zero.\n const runs: { from: number; to: number }[] = [];\n labels.forEach((_, i) => {\n if (!isValue(data[i])) return;\n const open = runs[runs.length - 1];\n if (open && open.to === i - 1) open.to = i;\n else runs.push({ from: i, to: i });\n });\n const outline = runs.map(run => {\n const points: string[] = [];\n for (let i = run.from; i <= run.to; i += 1) {\n points.push(`${i === run.from ? 'M' : 'L'}${xAt(i).toFixed(2)},${yAt(data[i] as number).toFixed(2)}`);\n }\n return `${points.join(' ')} L${xAt(run.to).toFixed(2)},${height} L${xAt(run.from).toFixed(2)},${height} Z`;\n }).join(' ');\n\n const move = (edge: 'from' | 'to', next: number) => {\n const clamped = Math.max(0, Math.min(last, next));\n // The handles cannot cross and the window cannot collapse: a zero-width\n // selection leaves the plot above empty with no keyboard way back.\n if (edge === 'from') onRangeChange([Math.min(clamped, to - 1), to]);\n else onRangeChange([from, Math.max(clamped, from + 1)]);\n };\n\n const onKey = (edge: 'from' | 'to') => (event: KeyboardEvent<SVGRectElement>) => {\n const step = event.shiftKey ? 5 : 1;\n const current = edge === 'from' ? from : to;\n if (event.key === 'ArrowLeft') { event.preventDefault(); move(edge, current - step); }\n if (event.key === 'ArrowRight') { event.preventDefault(); move(edge, current + step); }\n if (event.key === 'Home') { event.preventDefault(); move(edge, 0); }\n if (event.key === 'End') { event.preventDefault(); move(edge, last); }\n };\n\n // Pointer capture routes every later pointer event to the handle itself, so\n // the drag needs NO window listeners: nothing leaks on unmount mid-drag, and\n // `pointercancel` — the browser reclaiming the gesture — ends the drag the\n // same way `pointerup` does. `touch-action: none` on the handle keeps a\n // touch drag from being stolen for scrolling before it starts.\n const dragging = useRef<'from' | 'to' | null>(null);\n\n const onDragStart = (edge: 'from' | 'to') => (event: PointerEvent<SVGRectElement>) => {\n dragging.current = edge;\n event.currentTarget.setPointerCapture(event.pointerId);\n };\n const onDragMove = (edge: 'from' | 'to') => (event: PointerEvent<SVGRectElement>) => {\n if (dragging.current !== edge) return;\n move(edge, indexAt(event.clientX));\n };\n const onDragEnd = (edge: 'from' | 'to') => () => {\n if (dragging.current === edge) dragging.current = null;\n };\n\n const handle = (edge: 'from' | 'to') => {\n const index = edge === 'from' ? from : to;\n return (\n <rect\n key={edge}\n x={xAt(index) - HANDLE_WIDTH / 2} y={0}\n width={HANDLE_WIDTH} height={height} rx={3}\n fill={hue} className=\"cursor-ew-resize focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500\"\n tabIndex={0}\n role=\"slider\"\n aria-label={edge === 'from' ? 'Window start' : 'Window end'}\n aria-valuemin={0}\n aria-valuemax={last}\n aria-valuenow={index}\n // The label, not the index — \"00:14\" is the thing the reader is\n // choosing; \"2\" is an implementation detail.\n aria-valuetext={labels[index]}\n style={{ touchAction: 'none' }}\n onKeyDown={onKey(edge)}\n onPointerDown={onDragStart(edge)}\n onPointerMove={onDragMove(edge)}\n onPointerUp={onDragEnd(edge)}\n onPointerCancel={onDragEnd(edge)}\n />\n );\n };\n\n return (\n <div className={className}>\n <svg\n ref={track} width=\"100%\" height={height} viewBox={`0 0 ${width} ${height}`}\n role=\"group\" aria-label={`Time window — showing ${labels[from]} to ${labels[to]} of ${labels.length} intervals`}\n >\n {/* The whole series, always. A brush that hides what is outside the\n window lets a plateau look like the whole story. */}\n <path d={outline} fill={CHART_INK.grid} />\n\n <rect x={0} y={0} width={xAt(from)} height={height} fill={CHART_INK.surface} fillOpacity={0.72} />\n <rect x={xAt(to)} y={0} width={Math.max(0, width - xAt(to))} height={height} fill={CHART_INK.surface} fillOpacity={0.72} />\n <rect\n x={xAt(from)} y={0} width={Math.max(1, xAt(to) - xAt(from))} height={height}\n fill=\"none\" stroke={hue} strokeWidth={1}\n />\n {handle('from')}\n {handle('to')}\n </svg>\n </div>\n );\n}\n","/**\n * CartesianPlot — the axes, grid and hover layer every rectangular chart needs,\n * factored out before the tenth one repeated them.\n *\n * Column, scatter, bubble, range, waterfall, histogram, box plot, candlestick\n * and heatmap differ only in what they draw INSIDE the plot area. Sharing the\n * frame is what stops the family drifting: one place decides that gridlines are\n * solid hairlines rather than dashes, that the y-axis prints its ticks outside\n * the plot, and that the hit target for a hover is the whole band rather than\n * the mark. A chart that wanted its own answer to any of those would be a bug.\n *\n * Children receive the resolved geometry, so a chart type is the marks and\n * nothing else — the same division visx draws between `@visx/axis` and whatever\n * you put in the group above it.\n */\nimport { useEffect, useId, useRef, useState, type KeyboardEvent, type ReactNode } from 'react';\n\nimport { registerModalEscapeInterceptor } from '../shell/escapeInterceptors';\nimport { CHART_INK } from './palette';\nimport { bandScale, linearScale, niceMax, type BandScale, type LinearScale } from './scale';\nimport { usePlotWidth } from './usePlotWidth';\n\nexport interface PlotGeometry {\n x: BandScale;\n y: LinearScale;\n left: number;\n right: number;\n top: number;\n bottom: number;\n width: number;\n height: number;\n clipId: string;\n /** The band under the pointer, or null. */\n active: number | null;\n}\n\nexport interface CartesianPlotProps {\n /** X tick labels, one per band. */\n labels: string[];\n /** Every value that must fit on the y-axis. */\n values: number[];\n height?: number;\n width?: number;\n /** Fraction of a band left as gap. 0 makes adjacent marks touch. */\n bandPadding?: number;\n min?: number;\n max?: number;\n yTickCount?: number;\n formatValue?: (value: number) => string;\n yAxisLabel?: string;\n /**\n * Where an x tick label sits. `center` is the default and right for\n * categories; `start` puts the label on the band's left EDGE, for the one\n * case where the label names a boundary rather than the band — histogram\n * bin bounds.\n */\n xTickAnchor?: 'center' | 'start';\n /** Rendered inside the clipped plot area. */\n children: (geometry: PlotGeometry) => ReactNode;\n /** Rendered above the plot when a band is hovered or focused. */\n tooltip?: (index: number) => ReactNode;\n ariaLabel: string;\n className?: string;\n emptyLabel?: string;\n}\n\nexport default function CartesianPlot({\n labels,\n values,\n height = 220,\n width: widthProp,\n bandPadding = 0.24,\n min,\n max,\n yTickCount = 4,\n formatValue = v => String(v),\n yAxisLabel,\n xTickAnchor = 'center',\n children,\n tooltip,\n ariaLabel,\n className,\n emptyLabel = 'No data in this window.',\n}: CartesianPlotProps) {\n const host = useRef<HTMLDivElement>(null);\n const measured = usePlotWidth(host);\n const width = widthProp ?? measured;\n const [active, setActive] = useState<number | null>(null);\n const clipId = useId();\n\n // Escape must go through the modal seam: `Modal` listens on `window` in the\n // CAPTURE phase, so an element-level handler never sees the press inside a\n // shell window — the window closes instead of the crosshair clearing.\n // Registered only while a band is active, so an idle chart still lets\n // Escape close the window.\n useEffect(() => {\n if (active === null) return;\n return registerModalEscapeInterceptor(event => {\n if (event.key !== 'Escape') return false;\n setActive(null);\n return true;\n });\n }, [active]);\n\n if (labels.length === 0) {\n return (\n <div className={className} ref={host}>\n <p className=\"flex items-center justify-center text-sm text-gray-500\" style={{ height }}>{emptyLabel}</p>\n </div>\n );\n }\n\n const margin = { top: 12, right: 16, bottom: 26, left: yAxisLabel ? 58 : 48 };\n const left = margin.left;\n const right = Math.max(left + 1, width - margin.right);\n const top = margin.top;\n const bottom = height - margin.bottom;\n\n const finite = values.filter(Number.isFinite);\n const lo = min ?? Math.min(0, ...finite);\n const hi = max ?? niceMax(Math.max(...finite, 0));\n const y = linearScale([lo, hi], { from: bottom, to: top });\n const x = bandScale(labels.length, { from: left, to: right }, bandPadding);\n const ticks = y.ticks(yTickCount + 1);\n\n const labelStep = Math.max(1, Math.ceil(labels.length / Math.max(1, Math.floor(width / 84))));\n\n const onKey = (event: KeyboardEvent<SVGSVGElement>) => {\n if (event.key !== 'ArrowRight' && event.key !== 'ArrowLeft') return;\n event.preventDefault();\n const delta = event.key === 'ArrowRight' ? 1 : -1;\n setActive(prev => Math.min(labels.length - 1, Math.max(0, (prev ?? 0) + delta)));\n };\n\n return (\n <div className={`relative ${className ?? ''}`} ref={host}>\n <svg\n width=\"100%\" height={height} viewBox={`0 0 ${width} ${height}`}\n role=\"img\" aria-label={ariaLabel} tabIndex={0}\n className=\"focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500\"\n onMouseLeave={() => setActive(null)} onBlur={() => setActive(null)} onKeyDown={onKey}\n >\n <defs>\n <clipPath id={clipId}>\n <rect x={left} y={top} width={right - left} height={bottom - top} />\n </clipPath>\n </defs>\n\n {ticks.map(tick => (\n <line key={`g${tick}`} x1={left} y1={y(tick)} x2={right} y2={y(tick)} stroke={CHART_INK.grid} strokeWidth={1} shapeRendering=\"crispEdges\" />\n ))}\n <line x1={left} y1={y(Math.max(lo, 0))} x2={right} y2={y(Math.max(lo, 0))} stroke={CHART_INK.axis} strokeWidth={1} shapeRendering=\"crispEdges\" />\n\n {ticks.map(tick => (\n <text key={`t${tick}`} x={left - 8} y={y(tick) + 4} textAnchor=\"end\" fontSize={11} fill={CHART_INK.label} style={{ fontVariantNumeric: 'tabular-nums' }}>\n {formatValue(tick)}\n </text>\n ))}\n {yAxisLabel && (\n <text x={14} y={(top + bottom) / 2} transform={`rotate(-90 14 ${(top + bottom) / 2})`} textAnchor=\"middle\" fontSize={11} fill={CHART_INK.label}>\n {yAxisLabel}\n </text>\n )}\n\n <g clipPath={`url(#${clipId})`}>\n {children({ x, y, left, right, top, bottom, width, height, clipId, active })}\n </g>\n\n {labels.map((label, i) => (i % labelStep === 0 ? (\n <text key={`x${i}`} x={xTickAnchor === 'start' ? x(i) : x.center(i)} y={height - 8} textAnchor=\"middle\" fontSize={11} fill={CHART_INK.label} style={{ fontVariantNumeric: 'tabular-nums' }}>\n {label}\n </text>\n ) : null))}\n\n {labels.map((_, i) => (\n <rect\n key={`h${i}`} x={x.center(i) - (right - left) / labels.length / 2} y={top}\n width={(right - left) / labels.length} height={bottom - top}\n fill=\"transparent\" onMouseEnter={() => setActive(i)}\n />\n ))}\n </svg>\n\n {tooltip && active !== null && (\n // Positioning only: the card itself is `ChartTooltip`, so every chart\n // in the family renders the same surface. The clamp budgets for the\n // card's own width (`min-w-44`, 176px): a percentage-only clamp let the\n // card spill past the right edge of any container under ~590px.\n <div\n className=\"absolute top-2 z-10\"\n style={{ left: `clamp(0px, calc(${((x.center(active) / width) * 100).toFixed(2)}% - 88px), calc(100% - 184px))` }}\n >\n {tooltip(active)}\n </div>\n )}\n </div>\n );\n}\n","/**\n * TimeSeriesChart — a trend someone reads values off, rather than glances at.\n *\n * Four series modes, because four different things get plotted against time and\n * only one of them is a plain line:\n *\n * line a continuous measure sampled per bucket\n * area the same, with a fill, for a single series carrying the story\n * stacked counts that sum to a total — the composition IS the point\n * step a QUANTISED measure, held flat across its bucket\n *\n * `step` is the one worth explaining. A value that can only land on a known set\n * of levels — a histogram-derived percentile, a tier, a discrete state — is not\n * a sample of a continuous signal, and joining consecutive levels with a sloped\n * segment draws a transition that never happened. The EFFICIENT Observability\n * console shipped exactly that bug: its P95 line zig-zagged between 100 ms and\n * 250 ms four times in five minutes, which read as latency oscillating and was\n * really one rung of quantisation, drawn as motion. Pair `mode: 'step'` with\n * `levels` and the chart tells the truth twice — flat segments, and an ordinal\n * y-axis whose ticks ARE the levels.\n *\n * What this deliberately is NOT: a second y-axis. Two measures on different\n * scales get two charts, because the alignment between two y-scales is\n * arbitrary and the crossing point it produces is a correlation the data does\n * not contain. There is no prop for it.\n */\nimport { useEffect, useId, useRef, useState, type KeyboardEvent } from 'react';\n\nimport { registerModalEscapeInterceptor } from '../shell/escapeInterceptors';\n\nimport { CHART_INK, resolveSeriesColor, type StatusTone } from './palette';\nimport { areaBetween, areaFrom, curvePath, stepPath, type Point } from './curve';\nimport { ChartDefs, MOTION, dashFor, fillFor, maskId, stagger } from './effects';\nimport { bandScale, ladderScale, linearScale, niceMax } from './scale';\nimport ChartBrush from './ChartBrush';\nimport ChartDot from './ChartDot';\nimport ChartSkeleton from './ChartSkeleton';\nimport { highlightOpacity, useHighlight } from './highlight';\nimport ChartTooltip from './ChartTooltip';\nimport { usePlotWidth } from './usePlotWidth';\nimport { STATUS_VARS } from './palette';\nimport type { ChartRange, TimeSeriesChartProps, TimeSeriesSeries } from './types';\n\nconst MARGIN = { top: 12, right: 16, bottom: 26, left: 52 };\n\n/** A gap in the data is a gap in the line, never a segment across it. */\nconst isValue = (v: number | null | undefined): v is number =>\n typeof v === 'number' && Number.isFinite(v);\n\nexport default function TimeSeriesChart({\n series,\n labels,\n height = 200,\n stacked = false,\n stackMode = 'value',\n levels,\n curve = 'linear',\n tension = 0,\n max,\n yTickCount = 4,\n formatValue = v => String(v),\n yAxisLabel,\n referenceLines,\n labelEndpoints = false,\n dots,\n dotVariant = 'border',\n pulse = false,\n brush = false,\n range,\n onRangeChange,\n loading = false,\n animate = true,\n reveal = 'left-to-right',\n fillVariant = 'gradient',\n gridStyle = 'solid',\n width: widthProp,\n className,\n emptyLabel = 'No data in this window.',\n}: TimeSeriesChartProps) {\n const host = useRef<HTMLDivElement>(null);\n const measured = usePlotWidth(host);\n const width = widthProp ?? measured;\n const [active, setActive] = useState<number | null>(null);\n // Uncontrolled by default; `range` + `onRangeChange` take over when both are\n // given, so two charts can be driven onto one window.\n const [ownRange, setOwnRange] = useState<ChartRange | null>(null);\n const { highlighted } = useHighlight();\n const clipId = useId();\n\n // Escape goes through the modal seam — `Modal` listens on `window` in the\n // CAPTURE phase, so the svg's own handler never sees the press inside a\n // shell window and the window would close instead of the crosshair\n // clearing. Registered only while a band is active.\n useEffect(() => {\n if (active === null) return;\n return registerModalEscapeInterceptor(event => {\n if (event.key !== 'Escape') return false;\n setActive(null);\n return true;\n });\n }, [active]);\n\n if (loading) {\n return <div className={className} ref={host}><ChartSkeleton height={height} width={widthProp ?? measured} /></div>;\n }\n\n const fullLabels = labels;\n // Not named `window`: this file also works with the real one — the modal\n // seam above listens on it — and shadowing the global is how the wrong one\n // gets grabbed silently.\n const viewRange: ChartRange = range\n ?? ownRange\n ?? [0, Math.max(0, fullLabels.length - 1)];\n const [windowFrom, windowTo] = viewRange;\n const setWindow = (next: ChartRange) => {\n if (onRangeChange) onRangeChange(next);\n else setOwnRange(next);\n };\n const slice = <T,>(items: T[]): T[] =>\n brush ? items.slice(windowFrom, windowTo + 1) : items;\n\n // `slot` pins each series to its ORIGINAL index: colour must not shift when\n // an all-null series is dropped, or the plot disagrees with a caller-built\n // legend exactly when a series has a data outage.\n const drawn = series\n .map((s, slot) => ({ ...s, slot }))\n .filter(s => s.data.some(isValue))\n .map(s => ({ ...s, data: slice(s.data) }));\n labels = slice(fullLabels);\n\n if (drawn.length === 0 || labels.length === 0) {\n return (\n <div className={className} ref={host}>\n <p className=\"flex items-center justify-center text-sm text-gray-500\" style={{ height }}>\n {emptyLabel}\n </p>\n </div>\n );\n }\n\n const plot = {\n left: MARGIN.left,\n right: Math.max(MARGIN.left + 1, width - MARGIN.right),\n top: MARGIN.top,\n bottom: height - MARGIN.bottom,\n };\n const x = bandScale(labels.length, { from: plot.left, to: plot.right });\n\n // Stacked series carry cumulative tops; everything else plots its own value.\n //\n // In `percent` mode each bucket is divided by its OWN total, which is what\n // makes composition comparable across buckets of wildly different size. A\n // bucket whose total is zero has no composition — dividing would be 0/0 — so\n // it is left as a gap rather than drawn as an empty or a full stack. That\n // distinction is the whole reason this is not a one-line normalise.\n const bucketTotals = labels.map((_, i) =>\n drawn.reduce((sum, s) => sum + (isValue(s.data[i]) ? (s.data[i] as number) : 0), 0));\n const share = (value: number, i: number) =>\n bucketTotals[i] > 0 ? value / bucketTotals[i] : null;\n\n const tops: (number | null)[][] = [];\n if (stacked) {\n let running = labels.map(() => 0);\n for (const s of drawn) {\n running = running.map((sum, i) => sum + (isValue(s.data[i]) ? (s.data[i] as number) : 0));\n tops.push(stackMode === 'percent'\n ? running.map((sum, i) => share(sum, i))\n : [...running]);\n }\n }\n\n const ladder = levels && levels.length > 0\n ? ladderScale(levels, { from: plot.bottom, to: plot.top })\n : null;\n\n const values = stacked\n ? ((tops.at(-1) ?? []).filter(isValue) as number[])\n : drawn.flatMap(s => s.data.filter(isValue) as number[]);\n const top = stacked && stackMode === 'percent'\n ? 1\n : max ?? niceMax(Math.max(...values, 0));\n const y = linearScale([0, top], { from: plot.bottom, to: plot.top });\n const scaleY = (value: number) => (ladder ? ladder(value) : y(value));\n\n // A percent stack's axis is a percentage. Without this the ticks print\n // 0, 0.25, 0.5 … which reads as a ratio the caller never asked for.\n const isPercent = stacked && stackMode === 'percent';\n const formatTick = isPercent ? (v: number) => `${Math.round(v * 100)}%` : formatValue;\n\n const yTicks = ladder\n ? ladder.levels.map(level => ({ value: level, y: ladder(level) }))\n : y.ticks(yTickCount + 1).map(value => ({ value, y: y(value) }));\n\n const move = (delta: number) => (event: KeyboardEvent<SVGSVGElement>) => {\n event.preventDefault();\n setActive(prev => {\n const next = (prev ?? 0) + delta;\n return Math.min(labels.length - 1, Math.max(0, next));\n });\n };\n\n const tickLabelStep = Math.max(1, Math.ceil(labels.length / Math.max(1, Math.floor(width / 96))));\n\n return (\n <div className={`relative ${className ?? ''}`} ref={host}>\n <svg\n width=\"100%\"\n height={height}\n viewBox={`0 0 ${width} ${height}`}\n role=\"img\"\n aria-label={`${drawn.map(s => s.label).join(', ')} over ${labels.length} intervals`}\n tabIndex={0}\n className=\"focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500\"\n onMouseLeave={() => setActive(null)}\n onBlur={() => setActive(null)}\n onKeyDown={event => {\n if (event.key === 'ArrowRight') move(1)(event);\n if (event.key === 'ArrowLeft') move(-1)(event);\n }}\n >\n <defs>\n <clipPath id={clipId}>\n <rect x={plot.left} y={plot.top} width={plot.right - plot.left} height={plot.bottom - plot.top} />\n </clipPath>\n </defs>\n <ChartDefs\n id={clipId}\n fills={drawn.map((s2, i) => ({\n color: resolveSeriesColor(s2.slot, s2.color, s2.tone),\n variant: s2.fillVariant ?? fillVariant,\n }))}\n fadeFrom={stacked ? 0.42 : 0.3}\n reveal={animate ? reveal : false}\n />\n\n {/* Grid: solid hairlines one shade off the surface. Dashes read as a\n threshold, and none of these are one. */}\n {yTicks.map(tick => (\n <line\n key={`grid-${tick.value}`}\n x1={plot.left} y1={tick.y} x2={plot.right} y2={tick.y}\n stroke={CHART_INK.grid} strokeWidth={1} shapeRendering=\"crispEdges\"\n strokeDasharray={gridStyle === 'dashed' ? '3 3' : undefined}\n />\n ))}\n <line x1={plot.left} y1={plot.bottom} x2={plot.right} y2={plot.bottom} stroke={CHART_INK.axis} strokeWidth={1} shapeRendering=\"crispEdges\" />\n\n {yTicks.map(tick => (\n <text\n key={`ytick-${tick.value}`}\n x={plot.left - 8} y={tick.y + 4}\n textAnchor=\"end\" fontSize={11} fill={CHART_INK.label}\n style={{ fontVariantNumeric: 'tabular-nums' }}\n >\n {formatTick(tick.value)}\n </text>\n ))}\n {yAxisLabel && (\n <text\n x={12} y={(plot.top + plot.bottom) / 2}\n transform={`rotate(-90 12 ${(plot.top + plot.bottom) / 2})`}\n textAnchor=\"middle\" fontSize={11} fill={CHART_INK.label}\n >\n {yAxisLabel}\n </text>\n )}\n\n <g clipPath={`url(#${clipId})`} mask={animate && reveal ? `url(#${maskId(clipId)})` : undefined}>\n {drawn.map((s, si) => {\n const color = resolveSeriesColor(s.slot, s.color, s.tone);\n const mode = s.mode ?? (stacked ? 'area' : 'line');\n // `null` means nothing is highlighted, so the series keeps whatever\n // opacity it already had — a stacked fill is translucent by design\n // and forcing it to 1 would flatten the stack.\n const lit = highlightOpacity(s.key, highlighted);\n\n if (mode === 'step') {\n const bands = labels\n .map((_, i) => ({ start: x(i), end: x.end(i), value: s.data[i] }))\n .filter(b => isValue(b.value))\n .map(b => ({ start: b.start, end: b.end, y: scaleY(b.value as number) }));\n return (\n <path\n key={s.key} d={stepPath(bands)} fill=\"none\" stroke={color}\n strokeWidth={2.5} strokeLinecap=\"butt\" strokeLinejoin=\"miter\"\n opacity={lit ?? undefined} className=\"rosh-viz-mark\"\n />\n );\n }\n\n const points: Point[] = labels\n .map((_, i) => {\n const value = stacked ? tops[si]?.[i] : s.data[i];\n return isValue(value) ? ([x.center(i), scaleY(value)] as Point) : null;\n })\n .filter((p): p is Point => p !== null);\n if (points.length === 0) return null;\n\n if (mode === 'column') {\n // A column series inside a time chart is the Combination form:\n // volume as bars behind a rate as a line, on ONE shared axis.\n const slot = Math.max(1, x.bandwidth * 0.62);\n return (\n <g key={s.key} opacity={lit ?? undefined} className=\"rosh-viz-mark\">\n {labels.map((_, i) => {\n const value = stacked ? tops[si]?.[i] : s.data[i];\n if (!isValue(value)) return null;\n const top = scaleY(value);\n return (\n <rect\n key={i} x={x.center(i) - slot / 2} y={top}\n width={slot} height={Math.max(0, plot.bottom - top)}\n rx={2} fill={color} fillOpacity={0.35}\n className={animate ? MOTION.rise : undefined}\n style={animate ? stagger(i, 26) : undefined}\n />\n );\n })}\n </g>\n );\n }\n\n const line = curvePath(points, curve, tension);\n const baseline: Point[] | null = stacked && si > 0\n ? labels.map((_, i) => [x.center(i), scaleY(tops[si - 1]?.[i] ?? 0) - 2] as Point)\n : null;\n\n // A 2px gap between stacked fills separates them without a border.\n const area = baseline ? areaBetween(line, baseline) : areaFrom(line, points, plot.bottom);\n\n return (\n <g key={s.key} opacity={lit ?? undefined} className=\"rosh-viz-mark\">\n {(mode === 'area' || stacked) && (\n // A vertical alpha fade rather than a flat wash: the fill is\n // densest where the line is and dissolves toward the baseline,\n // so it reads as belonging to the line instead of as a slab.\n <path d={area} fill={fillFor(clipId, si, s.fillVariant ?? fillVariant, color)} stroke=\"none\" />\n )}\n <path\n d={line} fill=\"none\" stroke={color} strokeWidth={2}\n strokeLinejoin=\"round\" strokeLinecap=\"round\"\n strokeDasharray={dashFor(s.stroke ?? (s.forecast ? 'animated-dashed' : 'solid'))}\n className={\n animate && (s.stroke === 'animated-dashed' || (s.forecast && !s.stroke))\n ? MOTION.march : undefined\n }\n />\n </g>\n );\n })}\n </g>\n\n {/* Thresholds. Dashed on purpose, and the only dashed thing here: a\n dash reads as \"a line someone drew\" rather than \"a value the data\n reached\", which is what a threshold is and what a gridline is not.\n Drawn above the series so a rule crossed by a spike stays visible. */}\n {referenceLines?.map((rule, i) => {\n const colour = rule.color ?? STATUS_VARS[rule.tone ?? 'critical'];\n const ry = scaleY(rule.value);\n return (\n <g key={`rule-${i}`}>\n <line\n x1={plot.left} y1={ry} x2={plot.right} y2={ry}\n stroke={colour} strokeWidth={1} strokeDasharray=\"5 4\"\n />\n {rule.label && (\n <text\n x={plot.right - 4} y={ry - 5}\n textAnchor=\"end\" fontSize={10.5} fontWeight={600} fill={colour}\n >\n {rule.label}\n </text>\n )}\n </g>\n );\n })}\n\n {/* Markers. Direct LABELS stay selective — a value on every point is\n chaos and goes unread — but the dots themselves are a separate\n choice, because on a sparse series they are how a reader sees where\n the samples actually are. */}\n {(dots ?? (labelEndpoints ? 'last' : 'none')) !== 'none' && drawn.map((s, si) => {\n const which = dots ?? (labelEndpoints ? 'last' : 'none');\n const color = resolveSeriesColor(s.slot, s.color, s.tone);\n const lastIndex = [...s.data].map(isValue).lastIndexOf(true);\n const indices = which === 'all'\n ? labels.map((_, i) => i).filter(i => isValue(stacked ? tops[si]?.[i] : s.data[i]))\n : lastIndex >= 0 ? [lastIndex] : [];\n return (\n <g key={`dots-${s.key}`}>\n {indices.map(i => {\n const value = stacked ? tops[si]?.[i] : s.data[i];\n if (!isValue(value)) return null;\n return (\n <ChartDot\n key={i} cx={x.center(i)} cy={scaleY(value)} color={color}\n variant={dotVariant}\n // Only the final marker pulses: a whole line of pulsing\n // dots is a strobe, and only the last one is \"now\".\n pulse={pulse && i === lastIndex}\n title={`${labels[i]}: ${s.label} ${formatValue(value)}`}\n />\n );\n })}\n {labelEndpoints && lastIndex >= 0 && isValue(stacked ? tops[si]?.[lastIndex] : s.data[lastIndex]) && (\n <text\n x={x.center(lastIndex) - 10} y={scaleY((stacked ? tops[si]?.[lastIndex] : s.data[lastIndex]) as number) - 9}\n textAnchor=\"end\" fontSize={11.5} fontWeight={600} fill={CHART_INK.label}\n style={{ fontVariantNumeric: 'tabular-nums' }}\n >\n {formatValue((stacked ? tops[si]?.[lastIndex] : s.data[lastIndex]) as number)}\n </text>\n )}\n </g>\n );\n })}\n\n {labels.map((label, i) => (\n i % tickLabelStep === 0 ? (\n <text\n key={`xtick-${i}`} x={x.center(i)} y={height - 8}\n textAnchor=\"middle\" fontSize={11} fill={CHART_INK.label}\n style={{ fontVariantNumeric: 'tabular-nums' }}\n >\n {label}\n </text>\n ) : null\n ))}\n\n {active !== null && (\n <line\n x1={x.center(active)} y1={plot.top} x2={x.center(active)} y2={plot.bottom}\n stroke={CHART_INK.axis} strokeWidth={1}\n />\n )}\n\n {/* Hit targets span the whole band, so the pointer never has to find a\n 2px line. */}\n {labels.map((_, i) => (\n <rect\n key={`hit-${i}`} x={x(i)} y={plot.top} width={Math.max(1, x.bandwidth)} height={plot.bottom - plot.top}\n fill=\"transparent\" onMouseEnter={() => setActive(i)}\n />\n ))}\n </svg>\n\n {brush && fullLabels.length > 2 && (\n <ChartBrush\n className=\"mt-1\"\n labels={fullLabels}\n width={width}\n // The first series carries the outline: the strip is for locating a\n // window, not for reading values, and stacking every series into it\n // would make it a second chart competing with the one above.\n data={series[0]?.data ?? []}\n range={viewRange}\n onRangeChange={setWindow}\n />\n )}\n\n {active !== null && (\n // The clamp budgets for the card's own width (`min-w-44`, 176px): a\n // percentage-only clamp let the card spill past the right edge of any\n // container under ~590px.\n <div\n className=\"absolute top-2 z-10\"\n style={{ left: `clamp(0px, calc(${((x.center(active) / width) * 100).toFixed(2)}% - 88px), calc(100% - 184px))` }}\n >\n <ChartTooltip\n title={labels[active]}\n rows={drawn.map((s, si) => ({\n key: s.key,\n label: s.label,\n color: resolveSeriesColor(s.slot, s.color, s.tone),\n // In percent mode the plot has thrown volume away, so the tooltip\n // carries it back: the share the chart drew AND the count it was\n // taken over. A share without its denominator is the thing this\n // whole family keeps refusing to ship.\n value: !isValue(s.data[active])\n ? undefined\n : stacked && stackMode === 'percent'\n ? `${((share(s.data[active] as number, active) ?? 0) * 100).toFixed(1)}% · ${formatValue(s.data[active] as number)}`\n : formatValue(s.data[active] as number),\n }))}\n footnote={stacked && stackMode === 'percent'\n ? `${formatValue(bucketTotals[active])} in this bucket`\n : undefined}\n />\n </div>\n )}\n </div>\n );\n}\n\nexport type { TimeSeriesChartProps, TimeSeriesSeries, StatusTone };\n","/**\n * ColumnChart — vertical bars, grouped or stacked.\n *\n * `RankedBars` already covers the horizontal case, and the split is not\n * cosmetic: horizontal is for long category names, vertical is for a category\n * axis that is ordered — months, buckets, stages. Choosing vertical for\n * \"api/platform/observability/overview/\" is how a chart ends up with truncated\n * labels or a 45° tilt nobody can read.\n *\n * Stacked segments are separated by a 2px surface gap rather than a stroke. A\n * border around each segment reads as noise and thickens every mark; the gap\n * does the same job by letting the card show through.\n */\nimport { useId } from 'react';\n\nimport { CHART_INK, resolveSeriesColor } from './palette';\nimport { ChartDefs, MOTION, glowId, stagger } from './effects';\nimport CartesianPlot from './CartesianPlot';\nimport ChartSkeleton from './ChartSkeleton';\nimport { autoHighlightIndex, highlightOpacity, useHighlight } from './highlight';\nimport ChartTooltip from './ChartTooltip';\nimport type { ColumnChartProps } from './types';\n\nconst STACK_GAP = 2;\n\nexport default function ColumnChart({\n series, labels, stacked = false, stackMode = 'value', height = 220, width, max,\n formatValue = v => String(v), yAxisLabel, className, emptyLabel, radius = 3,\n loading = false, animate = true, glow = false, emphasise = false, activeKey,\n highlight = 'none',\n}: ColumnChartProps) {\n const defsId = useId();\n const { highlighted } = useHighlight();\n if (loading) return <ChartSkeleton height={height} width={width} variant=\"bars\" className={className} />;\n\n // `slot` pins each series to its ORIGINAL index: colour must not shift when\n // an all-null series is dropped, or the plot and a caller-built legend\n // disagree exactly when a series has a data outage.\n const drawn = series\n .map((s, slot) => ({ ...s, slot }))\n .filter(s => s.data.some(v => Number.isFinite(v)));\n const finiteAt = (s: { data: (number | null)[] }, i: number): number => {\n const v = s.data[i];\n return typeof v === 'number' && Number.isFinite(v) ? v : 0;\n };\n const totals = labels.map((_, i) => drawn.reduce((sum, s) => sum + finiteAt(s, i), 0));\n // Signed data stacks in two directions: positives up from zero, negatives\n // down. Each bucket's axis reach is its one-sided totals, not the net.\n const posTotals = labels.map((_, i) => drawn.reduce((sum, s) => sum + Math.max(0, finiteAt(s, i)), 0));\n const negTotals = labels.map((_, i) => drawn.reduce((sum, s) => sum + Math.min(0, finiteAt(s, i)), 0));\n const percent = stacked && stackMode === 'percent';\n // A bucket with no traffic has no composition: 0/0 is a gap, not an empty\n // stack and not a full one.\n const share = (value: number, i: number) => (totals[i] > 0 ? value / totals[i] : null);\n const values = percent\n ? [1]\n : stacked ? [...posTotals, ...negTotals] : drawn.flatMap(s => s.data.filter(Number.isFinite) as number[]);\n\n return (\n <CartesianPlot\n labels={labels} values={values} height={height} width={width}\n max={percent ? 1 : max}\n formatValue={percent ? v => `${Math.round(v * 100)}%` : formatValue} yAxisLabel={yAxisLabel} className={className}\n emptyLabel={emptyLabel}\n ariaLabel={`${drawn.map(s => s.label).join(', ')} across ${labels.length} categories`}\n tooltip={index => (\n <ChartTooltip\n title={labels[index]}\n // Stack order: the bottom segment is the first row, because that is\n // the order the column itself is read in.\n rows={drawn.map(s => ({\n key: s.key,\n label: s.label,\n color: resolveSeriesColor(s.slot, s.color, s.tone),\n // Percent mode drops volume from the plot, so the tooltip carries\n // it back — the share AND the count it was taken over.\n value: !Number.isFinite(s.data[index])\n ? undefined\n : percent\n ? `${((share(s.data[index] as number, index) ?? 0) * 100).toFixed(1)}% · ${formatValue(s.data[index] as number)}`\n : formatValue(s.data[index] as number),\n }))}\n footnote={percent ? `${formatValue(totals[index])} in this category` : undefined}\n />\n )}\n >\n {({ x, y, bottom, active }) => {\n // Pointer > explicit key > derived. The pointer always wins, because a\n // highlight that ignores where the reader is looking is worse than\n // none; and a named category beats a derived one, because a caller\n // naming it has a reason the data cannot know.\n const named = activeKey ? labels.indexOf(activeKey) : -1;\n const derived = autoHighlightIndex(\n // What the reader compares: a stack's total, not one of its bands.\n stacked ? totals : (drawn[0]?.data ?? []),\n highlight,\n );\n const lit = active ?? (named >= 0 ? named : derived);\n return (\n <g>\n <ChartDefs id={defsId} glow={glow} />\n {labels.map((_, i) => {\n const slot = x.bandwidth / (stacked ? 1 : Math.max(1, drawn.length));\n // Two running bases: positive segments stack up from zero and\n // negative ones down, so a signed series neither vanishes (the old\n // clamp) nor overdraws its neighbours.\n let basePos = 0;\n let baseNeg = 0;\n // The zero line, clamped into the domain: grouped bars grow FROM\n // it, not from the plot floor — a floor foot drew a positive bar\n // through the zero line whenever the domain went negative.\n const zeroY = y(Math.min(y.domain[1], Math.max(y.domain[0], 0)));\n return drawn.map((s, si) => {\n const raw = s.data[i];\n if (!Number.isFinite(raw)) return null;\n // In percent mode a zero-total bucket has nothing to draw at all.\n const value = percent ? share(raw as number, i) : raw;\n if (value === null) return null;\n const colour = resolveSeriesColor(s.slot, s.color, s.tone);\n const bx = stacked ? x(i) : x(i) + si * slot;\n let top: number;\n let foot: number;\n let stackedFromZero = true;\n if (stacked) {\n const v = value as number;\n const from = v >= 0 ? basePos : baseNeg;\n const to = from + v;\n if (v >= 0) basePos = to; else baseNeg = to;\n top = y(Math.max(from, to));\n foot = y(Math.min(from, to));\n stackedFromZero = from === 0;\n } else {\n top = Math.min(y(value as number), zeroY);\n foot = Math.max(y(value as number), zeroY);\n }\n const h = Math.max(0, foot - top - (stacked && !stackedFromZero ? STACK_GAP : 0));\n // Emphasis: everything that is not the point recedes to the\n // de-emphasis ink, rather than staying coloured at low contrast.\n const isLit = lit === null || lit === i;\n const paint = isLit ? colour : emphasise ? CHART_INK.muted : colour;\n // Legend highlight is a SECOND axis of emphasis: the pointer\n // picks a category, the legend picks a series. They compose.\n const seriesLit = highlightOpacity(s.key, highlighted);\n return (\n <rect\n key={`${s.key}-${i}`} x={bx} y={top} width={Math.max(1, slot)} height={h}\n rx={radius} fill={paint}\n fillOpacity={seriesLit ?? (isLit ? 1 : emphasise ? 0.32 : 0.45)}\n filter={glow && lit === i ? `url(#${glowId(defsId)})` : undefined}\n className={`rosh-viz-mark${animate ? ` ${MOTION.rise}` : ''}`}\n style={animate ? stagger(i * (stacked ? 1 : drawn.length) + si, 26) : undefined}\n />\n );\n });\n })}\n {active !== null && !emphasise && (\n <line x1={x.center(active)} y1={y(y.domain[1])} x2={x.center(active)} y2={bottom} stroke={CHART_INK.axis} strokeWidth={1} />\n )}\n </g>\n );\n }}\n </CartesianPlot>\n );\n}\n","/**\n * ScatterChart — correlation between two measures, with an optional third\n * encoded as area. Scatter and bubble are the same chart; the bubble is the one\n * that was given a `size`.\n *\n * The size channel goes through `radiusScale`, which square-roots. This is the\n * detail that separates a bubble chart from a misleading one: meaning is\n * carried by AREA, area grows with the square of the radius, so mapping a value\n * straight to a radius makes a doubled value look four times as large.\n *\n * Two constraints inherited from the colour work, both enforced here rather\n * than left to the caller. Scatter is an all-pairs form — every series can sit\n * beside every other, not just its neighbours — and the palette only clears the\n * separation floors for its first three slots under those conditions. So the\n * series cap is three, and past it the caller folds the tail into \"Other\" or\n * facets. Marks also carry a surface-coloured ring, which is how overlapping\n * points stay countable without a border darkening every one of them.\n */\nimport { registerModalEscapeInterceptor } from '../shell/escapeInterceptors';\nimport { CHART_INK, resolveSeriesColor } from './palette';\nimport { linearScale, logScale, niceMax, radiusScale } from './scale';\nimport { usePlotWidth } from './usePlotWidth';\nimport ChartTooltip from './ChartTooltip';\nimport { useEffect, useId, useRef, useState, type KeyboardEvent } from 'react';\nimport type { ScatterChartProps } from './types';\n\n/** All-pairs colour separation holds for three slots, not eight. */\nexport const SCATTER_SERIES_CAP = 3;\n\nexport default function ScatterChart({\n series, height = 260, width: widthProp, xLabel, yLabel,\n formatX = v => String(v), formatY = v => String(v),\n xDomain, yDomain, xScale = 'linear', yScale = 'linear',\n radiusRange = [4, 22], className, emptyLabel = 'No observations in this window.',\n}: ScatterChartProps) {\n const host = useRef<HTMLDivElement>(null);\n const measured = usePlotWidth(host);\n const width = widthProp ?? measured;\n const clipId = useId();\n const [hover, setHover] = useState<{ s: number; i: number } | null>(null);\n\n // Escape goes through the modal seam — `Modal` listens on `window` in the\n // CAPTURE phase, so the svg's own handler never sees the press inside a\n // shell window. Registered only while a point is lit.\n useEffect(() => {\n if (hover === null) return;\n return registerModalEscapeInterceptor(event => {\n if (event.key !== 'Escape') return false;\n setHover(null);\n return true;\n });\n }, [hover]);\n\n // A SUPPLIED domain is a window on the data, so points outside it are not\n // drawable: the scales extrapolate rather than clamp, and the plot's clip is\n // padded by one bubble radius so an edge bubble is not sliced in half. Left\n // alone, a point just outside painted over the y-axis tick labels and one\n // further out vanished with nothing said — while still occupying a stop in\n // the keyboard walk and a tooltip. Drop them from the series instead, and\n // say how many in the accessible label.\n const inDomain = (v: number, d: [number, number] | undefined) =>\n !d || (v >= Math.min(d[0], d[1]) && v <= Math.max(d[0], d[1]));\n const offered = series.filter(s => s.points.length > 0).slice(0, SCATTER_SERIES_CAP);\n const drawn = (xDomain || yDomain)\n ? offered\n .map(s => ({ ...s, points: s.points.filter(p => inDomain(p.x, xDomain) && inDomain(p.y, yDomain)) }))\n .filter(s => s.points.length > 0)\n : offered;\n const omitted = offered.reduce((n, s) => n + s.points.length, 0)\n - drawn.reduce((n, s) => n + s.points.length, 0);\n\n if (drawn.length === 0) {\n return <div className={className} ref={host}><p className=\"flex items-center justify-center text-sm text-gray-500\" style={{ height }}>{emptyLabel}</p></div>;\n }\n\n const all = drawn.flatMap(s => s.points);\n const sized = all.some(p => p.size != null);\n const margin = { top: 14, right: 20, bottom: 34, left: 52 };\n const left = margin.left;\n const right = Math.max(left + 1, width - margin.right);\n // A derived domain rounds its top up so the axis ends on a readable number;\n // a supplied one is taken as given, because the caller asking for it is\n // usually asking to stop spending a third of the plot on empty space.\n //\n // A derived LOG domain starts at the smallest value present rather than at\n // zero. `Math.min(0, …)` is right for a linear axis, where the origin is the\n // reference the reader measures against; on a log axis it is a value with no\n // logarithm, so it forced `logScale` to borrow a floor and threw away the\n // real one the data already had.\n const axis = (\n values: number[],\n supplied: [number, number] | undefined,\n kind: 'linear' | 'log',\n range: { from: number; to: number },\n ) => {\n // `Math.min()` of nothing is Infinity, and a domain starting there is not\n // a domain. Data with no positive value at all has no log form; hand the\n // zero through and let `logScale` degenerate rather than emit NaN geometry.\n const positive = values.filter(v => v > 0);\n const base = kind === 'log'\n ? (positive.length > 0 ? Math.min(...positive) : 0)\n : Math.min(0, ...values);\n const domain = supplied ?? [base, niceMax(Math.max(...values))];\n return kind === 'log' ? logScale(domain, range) : linearScale(domain, range);\n };\n const x = axis(all.map(p => p.x), xDomain, xScale, { from: left, to: right });\n const y = axis(all.map(p => p.y), yDomain, yScale, { from: height - margin.bottom, to: margin.top });\n const r = radiusScale([0, Math.max(...all.map(p => p.size ?? 1))], { from: radiusRange[0], to: radiusRange[1] });\n\n // Hover indices go stale when a polling caller shrinks the data mid-hover;\n // resolve them defensively so a vanished point drops the tooltip instead of\n // crashing the tree.\n const hoveredSeries = hover ? drawn[hover.s] : undefined;\n const hoveredPoint = hover && hoveredSeries ? hoveredSeries.points[hover.i] : undefined;\n\n // Arrow keys walk every point, series by series — the tooltip a pointer gets\n // must be reachable without one. Same convention as `CartesianPlot`.\n const flat = drawn.flatMap((s, si) => s.points.map((_, i) => ({ s: si, i })));\n const onKey = (event: KeyboardEvent<SVGSVGElement>) => {\n if (event.key !== 'ArrowRight' && event.key !== 'ArrowLeft') return;\n event.preventDefault();\n const delta = event.key === 'ArrowRight' ? 1 : -1;\n const at = hover ? flat.findIndex(p => p.s === hover.s && p.i === hover.i) : 0;\n setHover(flat[Math.min(flat.length - 1, Math.max(0, at + delta))]);\n };\n\n return (\n <div className={`relative ${className ?? ''}`} ref={host}>\n <svg width=\"100%\" height={height} viewBox={`0 0 ${width} ${height}`} role=\"img\"\n aria-label={`${drawn.map(s => s.label).join(', ')}: ${yLabel ?? 'y'} against ${xLabel ?? 'x'}`\n + (omitted > 0 ? `. ${omitted} ${omitted === 1 ? 'point' : 'points'} outside the shown range` : '')}\n tabIndex={0}\n className=\"focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500\"\n onMouseLeave={() => setHover(null)} onBlur={() => setHover(null)} onKeyDown={onKey}>\n <defs><clipPath id={clipId}><rect x={left - radiusRange[1]} y={margin.top - radiusRange[1]} width={right - left + radiusRange[1] * 2} height={height - margin.bottom - margin.top + radiusRange[1] * 2} /></clipPath></defs>\n\n {y.ticks(5).map(t => (\n <g key={`y${t}`}>\n <line x1={left} y1={y(t)} x2={right} y2={y(t)} stroke={CHART_INK.grid} strokeWidth={1} shapeRendering=\"crispEdges\" />\n <text x={left - 8} y={y(t) + 4} textAnchor=\"end\" fontSize={11} fill={CHART_INK.label} style={{ fontVariantNumeric: 'tabular-nums' }}>{formatY(t)}</text>\n </g>\n ))}\n {x.ticks(5).map(t => (\n <text key={`x${t}`} x={x(t)} y={height - 12} textAnchor=\"middle\" fontSize={11} fill={CHART_INK.label} style={{ fontVariantNumeric: 'tabular-nums' }}>{formatX(t)}</text>\n ))}\n {xLabel && <text x={(left + right) / 2} y={height - 0.5} textAnchor=\"middle\" fontSize={11} fill={CHART_INK.label}>{xLabel}</text>}\n {yLabel && <text x={12} y={height / 2} transform={`rotate(-90 12 ${height / 2})`} textAnchor=\"middle\" fontSize={11} fill={CHART_INK.label}>{yLabel}</text>}\n\n <g clipPath={`url(#${clipId})`}>\n {drawn.map((s, si) => {\n const colour = resolveSeriesColor(si, s.color, s.tone);\n return s.points.map((p, i) => (\n <circle\n key={`${s.key}-${i}`} cx={x(p.x)} cy={y(p.y)}\n r={sized ? r(p.size ?? 0) : radiusRange[0] + 1}\n fill={colour} fillOpacity={hover && (hover.s !== si) ? 0.25 : 0.62}\n stroke={CHART_INK.surface} strokeWidth={2}\n onMouseEnter={() => setHover({ s: si, i })}\n />\n ));\n })}\n </g>\n </svg>\n\n {hover && hoveredSeries && hoveredPoint && (\n <div className=\"absolute top-2 left-2 z-10\">\n <ChartTooltip\n title={hoveredPoint.label ?? hoveredSeries.label}\n rows={[\n { key: 'x', label: xLabel ?? 'x', color: resolveSeriesColor(hover.s, hoveredSeries.color, hoveredSeries.tone), value: formatX(hoveredPoint.x) },\n { key: 'y', label: yLabel ?? 'y', color: resolveSeriesColor(hover.s, hoveredSeries.color, hoveredSeries.tone), value: formatY(hoveredPoint.y) },\n ...(hoveredPoint.size != null\n ? [{ key: 'size', label: 'Size', color: CHART_INK.muted, value: String(hoveredPoint.size) }]\n : []),\n ]}\n footnote={hoveredPoint.label ? hoveredSeries.label : undefined}\n />\n </div>\n )}\n </div>\n );\n}\n","/**\n * RangeChart — a low/high pair per category, as a band or as floating bars.\n *\n * Both variants answer \"what was the spread\", and the pair is one chart with a\n * `variant` rather than two because the data shape is identical. `area` is for\n * a continuous span — a confidence interval, min/max envelope, forecast cone.\n * `bar` is for discrete spans that should not be read as flowing into each\n * other, which is also what makes it the right shape for a schedule or a\n * duration.\n *\n * The band is drawn as a single filled path rather than two lines with a fill\n * between them, so a gap in the data leaves a gap in the band instead of a\n * wedge closing across it.\n */\nimport { CHART_INK, resolveSeriesColor } from './palette';\nimport { areaBetween, curvePath, type Point } from './curve';\nimport CartesianPlot from './CartesianPlot';\nimport ChartTooltip from './ChartTooltip';\nimport type { RangeChartProps } from './types';\n\nexport default function RangeChart({\n rows, labels, variant = 'area', curve = 'linear', height = 220, width, max, min,\n formatValue = v => String(v), yAxisLabel, color, tone, label = 'Range',\n className, emptyLabel, radius = 3,\n}: RangeChartProps) {\n const values = rows.flatMap(r => [r.low, r.high]).filter(Number.isFinite);\n const colour = resolveSeriesColor(0, color, tone);\n\n return (\n <CartesianPlot\n labels={labels} values={values} height={height} width={width} max={max} min={min}\n formatValue={formatValue} yAxisLabel={yAxisLabel} className={className} emptyLabel={emptyLabel}\n bandPadding={variant === 'bar' ? 0.34 : 0}\n ariaLabel={`${label}: low and high across ${labels.length} categories`}\n tooltip={index => (\n <ChartTooltip\n title={labels[index]}\n rows={[\n // undefined renders the em dash: \"no row here\" is not \"zero\".\n { key: 'high', label: 'High', color: colour, value: rows[index] == null ? undefined : formatValue(rows[index].high) },\n { key: 'low', label: 'Low', color: colour, value: rows[index] == null ? undefined : formatValue(rows[index].low) },\n ]}\n />\n )}\n >\n {({ x, y, active }) => (variant === 'bar' ? (\n <g>\n {rows.map((row, i) => (\n <rect\n key={i} x={x(i)} y={y(row.high)} width={Math.max(1, x.bandwidth)}\n height={Math.max(1, y(row.low) - y(row.high))} rx={radius}\n fill={colour} fillOpacity={active === null || active === i ? 0.85 : 0.4}\n />\n ))}\n </g>\n ) : (\n <g>\n {(() => {\n const highs: Point[] = rows.map((r, i) => [x.center(i), y(r.high)]);\n const lows: Point[] = rows.map((r, i) => [x.center(i), y(r.low)]);\n return (\n <>\n <path d={areaBetween(curvePath(highs, curve), lows)} fill={colour} fillOpacity={0.2} stroke=\"none\" />\n <path d={curvePath(highs, curve)} fill=\"none\" stroke={colour} strokeWidth={2} strokeLinejoin=\"round\" />\n <path d={curvePath(lows, curve)} fill=\"none\" stroke={colour} strokeWidth={2} strokeLinejoin=\"round\" strokeOpacity={0.7} />\n </>\n );\n })()}\n {active !== null && (\n <line x1={x.center(active)} y1={y(rows[active].high)} x2={x.center(active)} y2={y(rows[active].low)} stroke={CHART_INK.axis} strokeWidth={1} />\n )}\n </g>\n ))}\n </CartesianPlot>\n );\n}\n","/**\n * WaterfallChart — how a starting figure became an ending one.\n *\n * The form exists because a bar chart of {opening, +sales, −refunds, −tax,\n * closing} is unreadable: the increments share an axis with the totals they add\n * up to, so the small ones vanish. A waterfall floats each step at the running\n * balance, which makes the contribution the length of the bar and the sequence\n * the story.\n *\n * Colour here is polarity, not identity, so it comes from the diverging pair\n * rather than the categorical slots — increase, decrease, and a neutral for the\n * total bars that are anchored to the axis. Sign is also carried by the value's\n * own sign in the label, because colour alone does not survive greyscale.\n */\nimport { CHART_INK, STATUS_VARS } from './palette';\nimport CartesianPlot from './CartesianPlot';\nimport ChartTooltip from './ChartTooltip';\nimport type { WaterfallChartProps } from './types';\n\nexport default function WaterfallChart({\n steps, height = 240, width, formatValue = v => String(v), yAxisLabel,\n className, emptyLabel, radius = 3, connectors = true,\n}: WaterfallChartProps) {\n // Resolve each step to the span it occupies, carrying the running balance.\n let running = 0;\n const bars = steps.map(step => {\n if (step.total) {\n const span = { from: 0, to: running, value: running, total: true };\n return { ...step, ...span };\n }\n const from = running;\n running += step.value;\n return { ...step, from, to: running, value: step.value, total: false };\n });\n\n const values = bars.flatMap(b => [b.from, b.to]);\n\n return (\n <CartesianPlot\n labels={steps.map(s => s.label)} values={values} height={height} width={width}\n formatValue={formatValue} yAxisLabel={yAxisLabel} className={className} emptyLabel={emptyLabel}\n bandPadding={0.36}\n ariaLabel={`Waterfall of ${steps.length} steps from ${formatValue(bars[0]?.from ?? 0)} to ${formatValue(running)}`}\n tooltip={index => {\n const bar = bars[index];\n const tone = bar?.total ? STATUS_VARS.neutral : bar.value >= 0 ? STATUS_VARS.good : STATUS_VARS.critical;\n return (\n <ChartTooltip\n title={bar?.label}\n rows={[\n {\n key: 'step', color: tone,\n label: bar?.total ? 'Balance' : bar.value >= 0 ? 'Increase' : 'Decrease',\n // The sign is written out: colour alone does not survive\n // greyscale, and polarity is the whole point of this chart.\n value: bar?.total\n ? formatValue(bar.to)\n : `${bar.value >= 0 ? '+' : '−'}${formatValue(Math.abs(bar.value))}`,\n },\n ...(bar?.total ? [] : [{ key: 'running', label: 'Running total', color: STATUS_VARS.neutral, value: formatValue(bar.to) }]),\n ]}\n />\n );\n }}\n >\n {({ x, y, active }) => (\n <g>\n {connectors && bars.slice(0, -1).map((bar, i) => (\n // The connector spans the GAP — right edge of this bar to left edge\n // of the next. Any wider and it crosses the bar bodies, which shows\n // whenever a bar is translucent (the 0.45 inactive dim).\n <line\n key={`c${i}`} x1={x.end(i)} y1={y(bar.to)} x2={x(i + 1)} y2={y(bar.to)}\n stroke={CHART_INK.grid} strokeWidth={1} shapeRendering=\"crispEdges\"\n />\n ))}\n {bars.map((bar, i) => {\n const colour = bar.total\n ? STATUS_VARS.neutral\n : bar.value >= 0 ? STATUS_VARS.good : STATUS_VARS.critical;\n const top = Math.min(y(bar.from), y(bar.to));\n const h = Math.max(1, Math.abs(y(bar.to) - y(bar.from)));\n return (\n <rect\n key={i} x={x(i)} y={top} width={Math.max(1, x.bandwidth)} height={h} rx={radius}\n fill={colour} fillOpacity={active === null || active === i ? 1 : 0.45}\n />\n );\n })}\n </g>\n )}\n </CartesianPlot>\n );\n}\n","/**\n * HistogramChart — the distribution of ONE measure.\n *\n * Not a bar chart, though it looks like one. A bar chart compares named\n * categories and its bars may be reordered freely; a histogram's x-axis is\n * continuous and its bars are adjacent because the bins are, so reordering them\n * destroys the meaning. That is why the bars touch — `bandPadding` is zero, and\n * a caller cannot pad them apart.\n *\n * Bin count is a real analytical choice, not a default to hide. Too few bins\n * hide a bimodal distribution; too many turn it into noise. `bins` accepts\n * either a count to compute or the boundaries themselves, for the case where\n * the domain already has meaningful edges — a latency histogram whose bucket\n * bounds the backend chose is exactly that case.\n */\nimport { resolveSeriesColor } from './palette';\nimport { binValues } from './scale';\nimport CartesianPlot from './CartesianPlot';\nimport ChartTooltip from './ChartTooltip';\nimport type { HistogramChartProps } from './types';\n\nexport default function HistogramChart({\n values, bins = 10, precomputed, height = 220, width, color, tone,\n formatBound = v => (Number.isInteger(v) ? String(v) : v.toFixed(1)),\n formatCount = v => String(v), yAxisLabel = 'count', label = 'Distribution',\n className, emptyLabel,\n}: HistogramChartProps) {\n // `bins` passes through whole: a count computes even bins, an array IS the\n // boundaries. Collapsing an edge list to `length - 1` even bins silently\n // re-spread backend-chosen bucket bounds over the data's own range.\n const computed = precomputed ?? binValues(values ?? [], bins);\n const colour = resolveSeriesColor(0, color, tone);\n const labels = computed.map(b => formatBound(b.from));\n const counts = computed.map(b => b.count);\n\n return (\n <CartesianPlot\n labels={labels} values={counts} height={height} width={width} bandPadding={0}\n // Each label is a bin's LOWER BOUND, so it sits on the edge it names —\n // centred under the band it would claim the whole bin is that value.\n xTickAnchor=\"start\"\n formatValue={formatCount} yAxisLabel={yAxisLabel} className={className} emptyLabel={emptyLabel}\n ariaLabel={`${label}: ${computed.length} bins over ${(values ?? []).length} observations`}\n tooltip={index => (\n <ChartTooltip\n title={`${formatBound(computed[index].from)} – ${formatBound(computed[index].to)}`}\n rows={[{ key: 'count', label: 'Observations', color: colour, value: formatCount(computed[index].count) }]}\n />\n )}\n >\n {({ x, y, bottom, active }) => (\n <g>\n {computed.map((bin, i) => (\n <rect\n key={i}\n // A 1px inset, not a gap: the bins ARE adjacent, and the hairline\n // only stops two equal bars reading as one wide one.\n x={x(i) + 0.5} y={y(bin.count)}\n width={Math.max(1, x.bandwidth - 1)} height={Math.max(0, bottom - y(bin.count))}\n fill={colour} fillOpacity={active === null || active === i ? 0.85 : 0.42}\n />\n ))}\n </g>\n )}\n </CartesianPlot>\n );\n}\n","/**\n * BoxPlotChart — five numbers per category, so distributions can be compared.\n *\n * Where a histogram shows one distribution in detail, a box plot shows many\n * side by side at a glance: median, the middle half, the whiskers, and the\n * points outside them. For an operator that is the difference between \"P95 went\n * up\" and \"P95 went up because one tenant's tail moved\".\n *\n * The median is drawn thicker than the box edges on purpose — it is the summary\n * statistic the eye should land on first, and giving every line the same weight\n * is how a box plot turns into a grey ladder. Outliers keep a surface ring so\n * two coincident ones are still countable.\n */\nimport { CHART_INK, resolveSeriesColor } from './palette';\nimport CartesianPlot from './CartesianPlot';\nimport ChartTooltip from './ChartTooltip';\nimport type { BoxPlotChartProps } from './types';\n\nexport default function BoxPlotChart({\n boxes, height = 240, width, color, tone, formatValue = v => String(v),\n yAxisLabel, label = 'Distribution', className, emptyLabel,\n}: BoxPlotChartProps) {\n const colour = resolveSeriesColor(0, color, tone);\n const values = boxes.flatMap(b => [b.min, b.max, ...(b.outliers ?? [])]).filter(Number.isFinite);\n\n return (\n <CartesianPlot\n labels={boxes.map(b => b.label)} values={values} height={height} width={width}\n bandPadding={0.5} formatValue={formatValue} yAxisLabel={yAxisLabel}\n className={className} emptyLabel={emptyLabel}\n ariaLabel={`${label}: five-number summary for ${boxes.length} categories`}\n tooltip={index => {\n const b = boxes[index];\n return (\n <ChartTooltip\n title={b.label}\n rows={[\n { key: 'max', label: 'Maximum', color: colour, value: formatValue(b.max) },\n { key: 'q3', label: 'Q3', color: colour, value: formatValue(b.q3) },\n { key: 'median', label: 'Median', color: colour, value: formatValue(b.median) },\n { key: 'q1', label: 'Q1', color: colour, value: formatValue(b.q1) },\n { key: 'min', label: 'Minimum', color: colour, value: formatValue(b.min) },\n ]}\n emphasisKey=\"median\"\n footnote={b.outliers?.length ? `${b.outliers.length} outlier${b.outliers.length > 1 ? 's' : ''} beyond the whiskers` : undefined}\n />\n );\n }}\n >\n {({ x, y, active }) => (\n <g>\n {boxes.map((b, i) => {\n const cx = x.center(i);\n const w = Math.max(6, x.bandwidth);\n const dim = active !== null && active !== i;\n return (\n <g key={i} opacity={dim ? 0.45 : 1}>\n {/* whiskers */}\n <line x1={cx} y1={y(b.max)} x2={cx} y2={y(b.q3)} stroke={colour} strokeWidth={1.5} />\n <line x1={cx} y1={y(b.q1)} x2={cx} y2={y(b.min)} stroke={colour} strokeWidth={1.5} />\n <line x1={cx - w / 4} y1={y(b.max)} x2={cx + w / 4} y2={y(b.max)} stroke={colour} strokeWidth={1.5} />\n <line x1={cx - w / 4} y1={y(b.min)} x2={cx + w / 4} y2={y(b.min)} stroke={colour} strokeWidth={1.5} />\n {/* interquartile box */}\n <rect\n x={cx - w / 2} y={y(b.q3)} width={w} height={Math.max(1, y(b.q1) - y(b.q3))}\n rx={2} fill={colour} fillOpacity={0.22} stroke={colour} strokeWidth={1.5}\n />\n {/* median — deliberately the heaviest mark in the group */}\n <line x1={cx - w / 2} y1={y(b.median)} x2={cx + w / 2} y2={y(b.median)} stroke={colour} strokeWidth={3} />\n {(b.outliers ?? []).map((o, oi) => (\n <circle key={oi} cx={cx} cy={y(o)} r={3} fill={colour} stroke={CHART_INK.surface} strokeWidth={1.5} />\n ))}\n </g>\n );\n })}\n </g>\n )}\n </CartesianPlot>\n );\n}\n","/**\n * CandlestickChart — open, high, low and close per period, as candles or bars.\n *\n * Candlestick and OHLC carry identical data and answer the identical question;\n * they differ only in whether the open-to-close span is a filled body or a pair\n * of ticks. One component with a `variant`, because shipping them as two would\n * duplicate the scale, the axis, the hover and the colour rule, and then let\n * the two drift.\n *\n * Colour is polarity — closed above its open, or below — so it comes from the\n * status set rather than the categorical slots, and it is never the only signal:\n * the tooltip states both numbers, and the body's direction is legible without\n * colour at all.\n */\nimport { STATUS_VARS } from './palette';\nimport CartesianPlot from './CartesianPlot';\nimport ChartTooltip from './ChartTooltip';\nimport type { CandlestickChartProps } from './types';\n\nexport default function CandlestickChart({\n candles, variant = 'candle', height = 260, width,\n // Not `String(v)`: the axis domain is padded off the data, so its ticks are\n // almost never integers, and a raw float prints as 102.72999999999999.\n formatValue = v => (Number.isInteger(v) ? String(v) : v.toFixed(2)),\n yAxisLabel, label = 'Price', className, emptyLabel,\n}: CandlestickChartProps) {\n const values = candles.flatMap(c => [c.low, c.high]).filter(Number.isFinite);\n const lo = Math.min(...values);\n const hi = Math.max(...values);\n // A price axis anchored at zero wastes the plot: the interesting range is the\n // one the series occupies, so pad it rather than starting from the origin.\n const pad = (hi - lo) * 0.08 || 1;\n\n return (\n <CartesianPlot\n labels={candles.map(c => c.label)} values={values} height={height} width={width}\n min={lo - pad} max={hi + pad} bandPadding={0.42}\n formatValue={formatValue} yAxisLabel={yAxisLabel} className={className} emptyLabel={emptyLabel}\n ariaLabel={`${label}: open, high, low and close across ${candles.length} periods`}\n tooltip={index => {\n const c = candles[index];\n const rose = c.close >= c.open;\n const tone = rose ? STATUS_VARS.good : STATUS_VARS.critical;\n return (\n <ChartTooltip\n title={c.label}\n rows={[\n { key: 'open', label: 'Open', color: tone, value: formatValue(c.open) },\n { key: 'high', label: 'High', color: tone, value: formatValue(c.high) },\n { key: 'low', label: 'Low', color: tone, value: formatValue(c.low) },\n { key: 'close', label: 'Close', color: tone, value: formatValue(c.close) },\n ]}\n emphasisKey=\"close\"\n footnote={rose ? 'Closed above its open' : 'Closed below its open'}\n />\n );\n }}\n >\n {({ x, y, active }) => (\n <g>\n {candles.map((c, i) => {\n const rose = c.close >= c.open;\n const colour = rose ? STATUS_VARS.good : STATUS_VARS.critical;\n const cx = x.center(i);\n const w = Math.max(3, x.bandwidth);\n const dim = active !== null && active !== i;\n const bodyTop = y(Math.max(c.open, c.close));\n const bodyHeight = Math.max(1, Math.abs(y(c.close) - y(c.open)));\n return (\n <g key={i} opacity={dim ? 0.45 : 1}>\n <line x1={cx} y1={y(c.high)} x2={cx} y2={y(c.low)} stroke={colour} strokeWidth={1.5} />\n {variant === 'candle' ? (\n <rect\n x={cx - w / 2} y={bodyTop} width={w} height={bodyHeight} rx={1}\n fill={rose ? colour : 'transparent'} fillOpacity={rose ? 0.85 : 1}\n stroke={colour} strokeWidth={1.5}\n />\n ) : (\n <>\n <line x1={cx - w / 2} y1={y(c.open)} x2={cx} y2={y(c.open)} stroke={colour} strokeWidth={2} />\n <line x1={cx} y1={y(c.close)} x2={cx + w / 2} y2={y(c.close)} stroke={colour} strokeWidth={2} />\n </>\n )}\n </g>\n );\n })}\n </g>\n )}\n </CartesianPlot>\n );\n}\n","/**\n * HeatmapChart — magnitude across two dimensions, usually one of them time.\n *\n * The chart an operator wants for \"which hour, which tenant\" — a question a\n * line chart answers badly because it needs one line per tenant and then the\n * lines cross.\n *\n * The colour rule is the whole design. Magnitude is SEQUENTIAL, so it is one\n * hue running light to dark, mixed against the card surface so the lightest\n * cell recedes into it and \"near zero\" reads as absent rather than as a value.\n * A rainbow here would be the classic failure: the reader has to consult the\n * legend for every cell because the hue order carries no inherent magnitude.\n *\n * Because colour is the only channel, the legend is a continuous scale rather\n * than swatches, and the value is always in the cell's title as well — a\n * colour-only continuous encoding is not readable to everyone and the chart\n * should not depend on it.\n */\nimport { useEffect, useId, useRef, useState, type KeyboardEvent } from 'react';\n\nimport { registerModalEscapeInterceptor } from '../shell/escapeInterceptors';\nimport { CHART_INK, resolveSeriesColor } from './palette';\nimport { usePlotWidth } from './usePlotWidth';\nimport ChartTooltip from './ChartTooltip';\nimport type { HeatmapChartProps } from './types';\n\nexport default function HeatmapChart({\n rows, columns, cells, height, width: widthProp, color, max,\n formatValue = v => String(v), label = 'Intensity', className,\n emptyLabel = 'No activity in this window.', cellGap = 2, cellRadius = 2,\n}: HeatmapChartProps) {\n const host = useRef<HTMLDivElement>(null);\n const measured = usePlotWidth(host);\n const width = widthProp ?? measured;\n const gradientId = useId();\n const [hover, setHover] = useState<{ r: number; c: number } | null>(null);\n\n // Escape goes through the modal seam — `Modal` listens on `window` in the\n // CAPTURE phase, so the svg's own handler never sees the press inside a\n // shell window. Registered only while a cell is lit.\n useEffect(() => {\n if (hover === null) return;\n return registerModalEscapeInterceptor(event => {\n if (event.key !== 'Escape') return false;\n setHover(null);\n return true;\n });\n }, [hover]);\n\n if (rows.length === 0 || columns.length === 0) {\n return <div className={className} ref={host}><p className=\"py-8 text-center text-sm text-gray-500\">{emptyLabel}</p></div>;\n }\n\n const hue = color ?? resolveSeriesColor(0);\n const top = max ?? Math.max(1, ...cells.flat().filter(Number.isFinite));\n const left = 96;\n const legendBand = 26;\n const rowHeight = 26;\n const plotHeight = rows.length * rowHeight;\n const totalHeight = height ?? plotHeight + legendBand + 26;\n const cellWidth = Math.max(2, (Math.max(left + 1, width) - left) / columns.length);\n\n // Light → dark in ONE hue, mixed against the surface so the low end recedes.\n const shade = (value: number) => {\n const t = top > 0 ? Math.max(0, Math.min(1, value / top)) : 0;\n return `color-mix(in oklab, ${hue} ${(8 + t * 92).toFixed(1)}%, ${CHART_INK.surface})`;\n };\n\n // Arrow keys walk the grid in two dimensions — the tooltip a pointer gets\n // must be reachable without one. Same convention as `CartesianPlot`.\n const onKey = (event: KeyboardEvent<SVGSVGElement>) => {\n const dr = event.key === 'ArrowDown' ? 1 : event.key === 'ArrowUp' ? -1 : 0;\n const dc = event.key === 'ArrowRight' ? 1 : event.key === 'ArrowLeft' ? -1 : 0;\n if (dr === 0 && dc === 0) return;\n event.preventDefault();\n setHover(prev => ({\n r: Math.min(rows.length - 1, Math.max(0, (prev?.r ?? 0) + dr)),\n c: Math.min(columns.length - 1, Math.max(0, (prev?.c ?? 0) + dc)),\n }));\n };\n\n return (\n <div className={`relative ${className ?? ''}`} ref={host}>\n <svg width=\"100%\" height={totalHeight} viewBox={`0 0 ${width} ${totalHeight}`} role=\"img\"\n aria-label={`${label} across ${rows.length} rows and ${columns.length} columns`}\n tabIndex={0}\n className=\"focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500\"\n onMouseLeave={() => setHover(null)} onBlur={() => setHover(null)} onKeyDown={onKey}>\n <defs>\n <linearGradient id={gradientId} x1=\"0\" x2=\"1\">\n <stop offset=\"0\" stopColor={shade(0)} />\n <stop offset=\"1\" stopColor={shade(top)} />\n </linearGradient>\n </defs>\n\n {rows.map((row, r) => (\n <text key={`r${r}`} x={left - 10} y={r * rowHeight + rowHeight / 2 + 4} textAnchor=\"end\" fontSize={11} fill={CHART_INK.label}>\n {row}\n </text>\n ))}\n\n {rows.map((row, r) => columns.map((column, c) => {\n const value = cells[r]?.[c] ?? 0;\n const faded = hover && (hover.r !== r || hover.c !== c);\n return (\n <rect\n key={`${r}-${c}`}\n x={left + c * cellWidth + cellGap / 2} y={r * rowHeight + cellGap / 2}\n width={Math.max(1, cellWidth - cellGap)} height={rowHeight - cellGap}\n rx={cellRadius} fill={shade(value)} opacity={faded ? 0.55 : 1}\n onMouseEnter={() => setHover({ r, c })}\n >\n <title>{`${row} · ${column}: ${formatValue(value)}`}</title>\n </rect>\n );\n }))}\n\n {columns.map((column, c) => (\n c % Math.max(1, Math.ceil(columns.length / Math.max(1, Math.floor((width - left) / 56)))) === 0 ? (\n <text key={`c${c}`} x={left + c * cellWidth + cellWidth / 2} y={plotHeight + 15} textAnchor=\"middle\" fontSize={11} fill={CHART_INK.label}>\n {column}\n </text>\n ) : null\n ))}\n\n {/* A continuous legend, because the encoding is continuous. */}\n <rect x={left} y={plotHeight + 26} width={Math.min(180, Math.max(40, width - left))} height={8} rx={4} fill={`url(#${gradientId})`} />\n <text x={left} y={plotHeight + 48} fontSize={10.5} fill={CHART_INK.label}>0</text>\n <text x={left + Math.min(180, Math.max(40, width - left))} y={plotHeight + 48} textAnchor=\"end\" fontSize={10.5} fill={CHART_INK.label} style={{ fontVariantNumeric: 'tabular-nums' }}>\n {formatValue(top)}\n </text>\n </svg>\n\n {hover && (\n <div className=\"absolute top-1 right-1 z-10\">\n <ChartTooltip\n title={`${rows[hover.r]} · ${columns[hover.c]}`}\n // A ragged/missing cell renders the em dash: absent is not zero.\n rows={[{ key: 'v', label, color: hue, value: cells[hover.r]?.[hover.c] == null ? undefined : formatValue(cells[hover.r][hover.c]) }]}\n />\n </div>\n )}\n </div>\n );\n}\n","/**\n * AccessibleTable — the text equivalent a chart carries when its SVG is an\n * opaque leaf.\n *\n * `role=\"img\"` makes an SVG a single node to assistive tech: descendants are\n * presentational, so the per-mark `<title>` elements the hierarchical charts\n * used to rely on were never exposed to anyone. `ChartFrame` offers a visible\n * table slot for the same obligation, but a chart cannot assume it is inside a\n * frame — so each chart whose data is otherwise pointer-only renders this,\n * visually hidden, right after its SVG. A screen reader walks a real table;\n * everyone else sees nothing.\n *\n * Internal to the chart family, deliberately unexported from the kit: a caller\n * who wants a VISIBLE table passes one to `ChartFrame`'s slot.\n */\nexport default function AccessibleTable({\n caption,\n head,\n rows,\n}: {\n caption: string;\n head: string[];\n rows: (string | number)[][];\n}) {\n return (\n <table className=\"sr-only\">\n <caption>{caption}</caption>\n <thead>\n <tr>{head.map(label => <th key={label} scope=\"col\">{label}</th>)}</tr>\n </thead>\n <tbody>\n {rows.map((cells, i) => (\n <tr key={i}>{cells.map((cell, j) => <td key={j}>{cell}</td>)}</tr>\n ))}\n </tbody>\n </table>\n );\n}\n","/**\n * RadarChart — several measures on their own axes, radiating from a centre.\n *\n * This is the hexagon. The grid is a regular polygon with one vertex per axis,\n * so six metrics draw a hexagon, five a pentagon, eight an octagon — the shape\n * is a consequence of how many things you are comparing, not a style. A circular\n * grid is available via `grid=\"circle\"` for the case where the axes are samples\n * of something continuous (a direction, a time of day) rather than distinct\n * measures.\n *\n * Radar is the form most often reached for wrongly, so the constraints are\n * worth stating. It compares PROFILES — the shape of one thing against the\n * shape of another — and it is poor at reading individual values, because the\n * eye judges the area of an irregular polygon badly and area grows with the\n * square of the radius. Three consequences, all enforced here:\n *\n * - every axis is normalised to a shared 0–max, or given its own `max`, so a\n * metric measured in thousands cannot flatten one measured in tens;\n * - the fill stays light and the outline carries the shape, because two\n * opaque overlapping polygons hide each other;\n * - the series cap is three, the same all-pairs limit the scatter form has —\n * past it the polygons cannot be told apart by colour under CVD.\n */\nimport { useId, useState } from 'react';\n\nimport { CHART_INK, resolveSeriesColor } from './palette';\nimport { polygonPoints } from './curve';\nimport { ChartDefs, maskId } from './effects';\nimport { useHighlight } from './highlight';\nimport { angleScale } from './scale';\nimport AccessibleTable from './AccessibleTable';\nimport ChartTooltip from './ChartTooltip';\nimport type { RadarChartProps } from './types';\n\n/** All-pairs colour separation holds for three slots, not eight. */\nexport const RADAR_SERIES_CAP = 3;\n\nconst ring = (points: [number, number][]) =>\n `${points.map(([px, py], i) => `${i === 0 ? 'M' : 'L'}${px.toFixed(2)},${py.toFixed(2)}`).join(' ')} Z`;\n\nexport default function RadarChart({\n axes, series, size = 300, mode = 'area', grid = 'polygon', rings = 4,\n formatValue = v => String(v), animate = true, className, emptyLabel = 'Nothing to compare.',\n}: RadarChartProps) {\n const titleId = useId();\n const [hover, setHover] = useState<number | null>(null);\n const { highlighted } = useHighlight();\n\n const drawn = series.slice(0, RADAR_SERIES_CAP);\n if (axes.length < 3 || drawn.length === 0) {\n return <p className={`text-sm text-gray-500 ${className ?? ''}`}>{emptyLabel}</p>;\n }\n\n const cx = size / 2;\n const cy = size / 2;\n const radius = size / 2 - 46;\n const angle = angleScale(axes.length);\n\n // Per-axis maxima, so a metric in thousands cannot flatten one in tens.\n // An explicit max must still be a usable divisor: `max: 0` or NaN would put\n // 0/0 through the clamp — NaN survives Math.min/max — and silently erase\n // the whole polygon.\n const maxima = axes.map((axis, i) =>\n axis.max != null && Number.isFinite(axis.max) && axis.max > 0\n ? axis.max\n : Math.max(1, ...drawn.map(s => s.values[i] ?? 0).filter(Number.isFinite)));\n\n const at = (axisIndex: number, value: number): [number, number] => {\n const t = Math.max(0, Math.min(1, value / maxima[axisIndex]));\n const a = angle.center(axisIndex) - angle.step / 2;\n return [cx + radius * t * Math.cos(a), cy + radius * t * Math.sin(a)];\n };\n\n // Local hover names a series by index; the frame's legend highlight names it\n // by key. Either one recedes the others.\n const dimmed = (si: number, key: string) => {\n if (hover !== null) return hover !== si;\n if (highlighted !== null) return highlighted !== key;\n return false;\n };\n const hoveredSeries = hover !== null ? drawn[hover] : undefined;\n\n return (\n <div className={`relative ${className ?? ''}`}>\n <svg width=\"100%\" height={size} viewBox={`0 0 ${size} ${size}`} role=\"img\" aria-labelledby={titleId}\n onMouseLeave={() => setHover(null)}>\n <title id={titleId}>\n {`${drawn.map(s => s.label).join(', ')} across ${axes.length} measures`}\n </title>\n\n {Array.from({ length: rings }, (_, r) => {\n const rr = (radius * (r + 1)) / rings;\n return grid === 'circle'\n ? <circle key={r} cx={cx} cy={cy} r={rr} fill=\"none\" stroke={CHART_INK.grid} strokeWidth={1} />\n : <path key={r} d={ring(polygonPoints(cx, cy, rr, axes.length))} fill=\"none\" stroke={CHART_INK.grid} strokeWidth={1} />;\n })}\n\n {axes.map((axis, i) => {\n const [ax, ay] = at(i, maxima[i]);\n return (\n <g key={axis.key}>\n <line x1={cx} y1={cy} x2={ax} y2={ay} stroke={CHART_INK.grid} strokeWidth={1} />\n <text\n x={cx + (radius + 18) * Math.cos(angle.center(i) - angle.step / 2)}\n y={cy + (radius + 18) * Math.sin(angle.center(i) - angle.step / 2) + 4}\n textAnchor=\"middle\" fontSize={11} fill={CHART_INK.label}\n >\n {axis.label}\n </text>\n </g>\n );\n })}\n\n <ChartDefs id={titleId} reveal={animate ? 'center-out' : false} />\n {drawn.map((s, si) => {\n const colour = resolveSeriesColor(si, s.color, s.tone);\n const points = axes.map((_, i) => at(i, s.values[i] ?? 0));\n return (\n <g\n key={s.key} opacity={dimmed(si, s.key) ? 0.3 : 1} onMouseEnter={() => setHover(si)}\n mask={animate ? `url(#${maskId(titleId)})` : undefined}\n >\n {mode === 'area' && <path d={ring(points)} fill={colour} fillOpacity={0.18} stroke=\"none\" />}\n <path d={ring(points)} fill=\"none\" stroke={colour} strokeWidth={2} strokeLinejoin=\"round\" />\n {points.map(([px, py], i) => (\n <circle key={i} cx={px} cy={py} r={3.5} fill={colour} stroke={CHART_INK.surface} strokeWidth={1.5} />\n ))}\n </g>\n );\n })}\n </svg>\n\n {hoveredSeries && (\n <div className=\"absolute top-2 left-2 z-10\">\n <ChartTooltip\n title={hoveredSeries.label}\n rows={axes.map((axis, i) => ({\n key: axis.key,\n label: axis.label,\n color: resolveSeriesColor(hover!, hoveredSeries.color, hoveredSeries.tone),\n value: formatValue(hoveredSeries.values[i] ?? 0),\n }))}\n />\n </div>\n )}\n\n {/* Identity was carried by colour alone — the one channel a chart may\n never rely on. The same swatch list the pie draws. */}\n <ul className=\"m-0 mt-3 grid gap-1 p-0\" style={{ gridTemplateColumns: 'repeat(auto-fit,minmax(140px,1fr))' }}>\n {drawn.map((s, si) => (\n <li key={s.key} className=\"flex list-none items-center gap-2 text-xs text-gray-600\">\n <span className=\"h-2.5 w-2.5 shrink-0 rounded-sm\" style={{ backgroundColor: resolveSeriesColor(si, s.color, s.tone) }} />\n <span className=\"flex-1 truncate\">{s.label}</span>\n </li>\n ))}\n </ul>\n\n <AccessibleTable\n caption={`${drawn.map(s => s.label).join(', ')} across ${axes.length} measures`}\n head={['Series', ...axes.map(axis => axis.label)]}\n rows={drawn.map(s => [s.label, ...axes.map((_, i) => formatValue(s.values[i] ?? 0))])}\n />\n </div>\n );\n}\n","/**\n * PieChart — part-to-whole, as a pie, a ring, or a Nightingale rose.\n *\n * `DonutChart` already exists and stays: it is the decorative tile version, a\n * fixed-size ring with a centre label and no axis. This one is the analytical\n * sibling — it labels its slices, states percentages, and refuses the things a\n * pie is bad at.\n *\n * The refusals are the point:\n *\n * - **Six segments, then \"Other\".** Past roughly six slices adjacent wedges\n * stop being distinguishable and the reader is consulting the legend for\n * every one. `maxSegments` folds the tail rather than generating a seventh\n * and eighth hue.\n * - **Two slices is not a chart.** A pie of 60/40 is a sentence; the caller\n * gets a warning-free render but the form to reach for is a stat tile.\n * - **`rose` encodes value as RADIUS, not angle.** Florence Nightingale's\n * rose gives every category the same wedge angle and varies the radius,\n * which is why it is the right form for cyclical categories — months,\n * hours, compass points — where the equal angles carry the cycle. It is\n * also the variant most often misread, because area grows with the square\n * of the radius, so the radius is square-rooted here rather than scaled\n * directly.\n */\nimport { useId, useState } from 'react';\n\nimport { CHART_INK, resolveSeriesColor } from './palette';\nimport { arcPath } from './curve';\nimport { MOTION, stagger } from './effects';\nimport { useHighlight } from './highlight';\nimport { angleScale } from './scale';\nimport ChartTooltip from './ChartTooltip';\nimport type { PieChartProps } from './types';\n\nexport default function PieChart({\n segments, variant = 'pie', size = 280, innerRadius, padAngle = 0.012,\n maxSegments = 6, otherLabel = 'Other', formatValue = v => String(v),\n centerLabel, animate = true, labels = 'none', labelMinShare = 0.04,\n className, emptyLabel = 'Nothing to break down.',\n}: PieChartProps) {\n const titleId = useId();\n const [hover, setHover] = useState<number | null>(null);\n const { highlighted } = useHighlight();\n\n const positive = segments.filter(s => s.value > 0);\n if (positive.length === 0) return <p className={`text-sm text-gray-500 ${className ?? ''}`}>{emptyLabel}</p>;\n\n // Fold the tail rather than reaching for a seventh hue.\n const sorted = [...positive].sort((a, b) => b.value - a.value);\n const kept = sorted.slice(0, maxSegments);\n const tail = sorted.slice(maxSegments);\n const shown = tail.length > 0\n ? [...kept, { key: '__other__', label: otherLabel, value: tail.reduce((n, s) => n + s.value, 0) }]\n : kept;\n\n const total = shown.reduce((n, s) => n + s.value, 0);\n const cx = size / 2;\n const cy = size / 2;\n const outer = size / 2 - 12;\n const inner = innerRadius ?? (variant === 'ring' ? outer * 0.58 : 0);\n const angle = angleScale(shown.length, padAngle);\n\n // Rose: equal angles, radius carries the value — square-rooted, because the\n // wedge's AREA is what the eye reads.\n const maxValue = Math.max(...shown.map(s => s.value));\n const roseRadius = (value: number) =>\n inner + (outer - inner) * Math.sqrt(Math.max(0, value) / maxValue);\n\n let cursor = -Math.PI / 2;\n\n // Outside labels, laid out before the wedges so the geometry is one pass.\n //\n // Two rules keep the fan readable. A slice below `labelMinShare` gets no\n // label at all — a dozen leader lines converging on slivers is less readable\n // than the legend already below, not more. And labels on the same side are\n // pushed apart to a minimum gap rather than allowed to overlap: a collided\n // pair is two labels neither of which can be read.\n const LEADER = 14;\n const LINE_HEIGHT = 15;\n const outside = (() => {\n if (labels !== 'outside') return [];\n let angle = -Math.PI / 2;\n const placed = shown.map((segment, i) => {\n const sweep = variant === 'rose' ? angleScale(shown.length, padAngle).step : (segment.value / total) * Math.PI * 2;\n const mid = variant === 'rose'\n ? angleScale(shown.length, padAngle).center(i)\n : angle + sweep / 2;\n angle += sweep;\n const radius = variant === 'rose' ? roseRadius(segment.value) : outer;\n return {\n key: segment.key,\n label: segment.label,\n share: segment.value / total,\n right: Math.cos(mid) >= 0,\n anchor: [cx + radius * Math.cos(mid), cy + radius * Math.sin(mid)] as const,\n y: cy + (radius + LEADER) * Math.sin(mid),\n index: i,\n };\n }).filter(entry => entry.share >= labelMinShare);\n\n for (const side of [true, false]) {\n const column = placed.filter(entry => entry.right === side).sort((a, b) => a.y - b.y);\n for (let i = 1; i < column.length; i += 1) {\n if (column[i].y - column[i - 1].y < LINE_HEIGHT) column[i].y = column[i - 1].y + LINE_HEIGHT;\n }\n }\n return placed;\n })();\n\n // Local hover names a slice by index; the frame's legend highlight names it\n // by key. Either one recedes the others.\n const dimmed = (i: number, key: string) => {\n if (hover !== null) return hover !== i;\n if (highlighted !== null) return highlighted !== key;\n return false;\n };\n const hoveredSegment = hover !== null ? shown[hover] : undefined;\n\n return (\n <div className={`relative ${className ?? ''}`}>\n <svg width=\"100%\" height={size} viewBox={`0 0 ${size} ${size}`} role=\"img\" aria-labelledby={titleId}\n onMouseLeave={() => setHover(null)}>\n <title id={titleId}>{`Breakdown of ${formatValue(total)} across ${shown.length} segments`}</title>\n {shown.map((segment, i) => {\n const colour = resolveSeriesColor(i, segment.color, segment.tone);\n const start = variant === 'rose' ? angle(i) : cursor;\n const sweep = variant === 'rose' ? angle.step : (segment.value / total) * Math.PI * 2 - padAngle;\n if (variant !== 'rose') cursor += (segment.value / total) * Math.PI * 2;\n const end = start + Math.max(0.001, sweep);\n const radius = variant === 'rose' ? roseRadius(segment.value) : outer;\n return (\n <path\n key={segment.key} d={arcPath(cx, cy, inner, radius, start, end)}\n fill={colour} fillOpacity={dimmed(i, segment.key) ? 0.4 : 1}\n stroke={CHART_INK.surface} strokeWidth={1}\n className={animate ? MOTION.sweep : undefined}\n style={animate ? stagger(i, 55) : undefined}\n onMouseEnter={() => setHover(i)}\n />\n );\n })}\n {outside.map(entry => {\n const edge = entry.right ? size - 6 : 6;\n const elbow = entry.right ? size - 58 : 58;\n return (\n <g key={`lbl-${entry.key}`}>\n <polyline\n points={`${entry.anchor[0].toFixed(1)},${entry.anchor[1].toFixed(1)} ${elbow},${entry.y.toFixed(1)} ${edge},${entry.y.toFixed(1)}`}\n fill=\"none\" stroke={CHART_INK.grid} strokeWidth={1}\n />\n <text\n x={edge} y={entry.y - 2} fontSize={10.5} fill={CHART_INK.label}\n textAnchor={entry.right ? 'end' : 'start'}\n >\n {entry.label}\n </text>\n <text\n x={edge} y={entry.y + 10} fontSize={10.5} fontWeight={600} fill={CHART_INK.label}\n textAnchor={entry.right ? 'end' : 'start'}\n style={{ fontVariantNumeric: 'tabular-nums' }}\n >\n {`${(entry.share * 100).toFixed(1)}%`}\n </text>\n </g>\n );\n })}\n {centerLabel && inner > 0 && (\n <text x={cx} y={cy + 5} textAnchor=\"middle\" fontSize={16} fontWeight={600} fill={CHART_INK.label}>\n {centerLabel}\n </text>\n )}\n </svg>\n\n {hoveredSegment && hover !== null && (\n <div className=\"absolute top-2 left-2 z-10\">\n <ChartTooltip\n title={hoveredSegment.label}\n rows={[\n { key: 'value', label: 'Value', color: resolveSeriesColor(hover, hoveredSegment.color, hoveredSegment.tone), value: formatValue(hoveredSegment.value) },\n { key: 'share', label: 'Share', color: CHART_INK.muted, value: `${((hoveredSegment.value / total) * 100).toFixed(1)}%` },\n ]}\n />\n </div>\n )}\n\n <ul className=\"m-0 mt-3 grid gap-1 p-0\" style={{ gridTemplateColumns: 'repeat(auto-fit,minmax(140px,1fr))' }}>\n {shown.map((segment, i) => (\n <li key={segment.key} className=\"flex list-none items-center gap-2 text-xs text-gray-600\">\n <span className=\"h-2.5 w-2.5 shrink-0 rounded-sm\" style={{ backgroundColor: resolveSeriesColor(i, segment.color, segment.tone) }} />\n <span className=\"flex-1 truncate\">{segment.label}</span>\n <span className=\"tabular-nums text-gray-800\">{((segment.value / total) * 100).toFixed(1)}%</span>\n </li>\n ))}\n </ul>\n </div>\n );\n}\n","/**\n * RadialBarChart — bars bent onto arcs, as concentric tracks or as columns\n * around a shared centre.\n *\n * Be honest about what this is for. A radial bar is harder to compare than a\n * straight one: outer arcs are longer than inner arcs at the same value, so\n * length is not a fair encoding, and the eye judges arcs worse than lines. It\n * earns its place in two cases only, and both are about the CATEGORIES rather\n * than the values:\n *\n * - `track` — a small set of gauges that each read as a proportion of their\n * own ring. The comparison is each bar against its own 100%, not against\n * its neighbours, which is exactly what the concentric layout communicates.\n * - `column` — categories that are genuinely cyclical: hours of a day, months\n * of a year, points of a compass. The circle carries the wrap-around, which\n * a straight axis cannot.\n *\n * For anything else, use `ColumnChart` or `RankedBars`. The angular sweep is\n * capped at 300° in `track` mode so the start and end of a full ring never\n * touch and become unreadable.\n */\nimport { useId, useState } from 'react';\n\nimport { CHART_INK, resolveSeriesColor } from './palette';\nimport { arcPath } from './curve';\nimport { MOTION, stagger } from './effects';\nimport { useHighlight } from './highlight';\nimport { angleScale } from './scale';\nimport ChartTooltip from './ChartTooltip';\nimport type { RadialBarChartProps } from './types';\n\nconst TRACK_SWEEP = (300 * Math.PI) / 180;\n\nexport default function RadialBarChart({\n rows, variant = 'track', size = 300, max, formatValue = v => String(v),\n animate = true, className, emptyLabel = 'Nothing to plot.', trackGap = 6,\n}: RadialBarChartProps) {\n const titleId = useId();\n const [hover, setHover] = useState<number | null>(null);\n const { highlighted } = useHighlight();\n\n if (rows.length === 0) return <p className={`text-sm text-gray-500 ${className ?? ''}`}>{emptyLabel}</p>;\n\n const cx = size / 2;\n const cy = size / 2;\n const outer = size / 2 - 10;\n const top = max ?? Math.max(...rows.map(r => r.value), 1);\n\n const bandWidth = variant === 'track'\n ? Math.max(6, (outer - size * 0.16) / rows.length)\n : 0;\n // Once bandWidth hits its 6px floor, extra rows would walk the radii\n // inwards past zero — zero-thickness tracks, then garbage arcs. Draw the\n // biggest rows that fit rather than degenerating; this is a gauge cluster,\n // not a list form, and RankedBars is the form for a long tail.\n const trackCapacity = Math.max(1, Math.floor((outer - size * 0.16) / bandWidth || 1));\n const drawnRows = variant === 'track' ? rows.slice(0, trackCapacity) : rows;\n // The gap may not eat the whole band: trackGap >= bandWidth would leave\n // zero-thickness tracks.\n const gap = Math.min(trackGap, Math.max(1, bandWidth - 2));\n const angle = angleScale(drawnRows.length, 0.03);\n\n // Local hover names a row by index; the frame's legend highlight names it by\n // key. Either one recedes the others.\n const dimmed = (i: number, key: string) => {\n if (hover !== null) return hover !== i;\n if (highlighted !== null) return highlighted !== key;\n return false;\n };\n const hoveredRow = hover !== null ? drawnRows[hover] : undefined;\n\n return (\n <div className={`relative ${className ?? ''}`}>\n <svg width=\"100%\" height={size} viewBox={`0 0 ${size} ${size}`} role=\"img\" aria-labelledby={titleId}\n onMouseLeave={() => setHover(null)}>\n <title id={titleId}>{`${drawnRows.length} categories, ${variant === 'track' ? 'as concentric proportions' : 'around a cycle'}`}</title>\n\n {drawnRows.map((row, i) => {\n const colour = resolveSeriesColor(i, row.color, row.tone);\n const share = Math.max(0, Math.min(1, row.value / top));\n const dim = dimmed(i, row.key);\n\n if (variant === 'track') {\n const r2 = outer - i * bandWidth;\n const r1 = r2 - bandWidth + gap;\n const start = -Math.PI / 2;\n return (\n <g key={row.key} opacity={dim ? 0.4 : 1} onMouseEnter={() => setHover(i)}\n className={animate ? MOTION.sweep : undefined} style={animate ? stagger(i, 70) : undefined}>\n <path d={arcPath(cx, cy, r1, r2, start, start + TRACK_SWEEP)} fill={CHART_INK.grid} />\n <path d={arcPath(cx, cy, r1, r2, start, start + TRACK_SWEEP * share)} fill={colour} />\n </g>\n );\n }\n\n const inner = size * 0.14;\n return (\n <g key={row.key} opacity={dim ? 0.4 : 1} onMouseEnter={() => setHover(i)}>\n <path\n d={arcPath(cx, cy, inner, inner + (outer - inner) * share, angle(i), angle(i) + angle.step)}\n fill={colour}\n />\n </g>\n );\n })}\n </svg>\n\n {hoveredRow && hover !== null && (\n <div className=\"absolute top-2 left-2 z-10\">\n <ChartTooltip\n title={hoveredRow.label}\n rows={[{ key: 'value', label: 'Value', color: resolveSeriesColor(hover, hoveredRow.color, hoveredRow.tone), value: formatValue(hoveredRow.value) }]}\n />\n </div>\n )}\n\n <ul className=\"m-0 mt-3 grid gap-1 p-0\" style={{ gridTemplateColumns: 'repeat(auto-fit,minmax(150px,1fr))' }}>\n {rows.map((row, i) => (\n <li key={row.key} className=\"flex list-none items-center gap-2 text-xs text-gray-600\">\n <span className=\"h-2.5 w-2.5 shrink-0 rounded-sm\" style={{ backgroundColor: resolveSeriesColor(i, row.color, row.tone) }} />\n <span className=\"flex-1 truncate\">{row.label}</span>\n <span className=\"tabular-nums text-gray-800\">{formatValue(row.value)}</span>\n </li>\n ))}\n </ul>\n </div>\n );\n}\n","/**\n * FunnelChart — an ordered sequence of stages and what was lost between them.\n *\n * The value is the drop-off, not the stages, so this states it: each band is\n * labelled with its own count, its share of the first stage, and the percentage\n * that failed to reach it from the stage immediately above. A funnel that only\n * draws the widths makes the reader do that arithmetic.\n *\n * `cone` tapers each band to the next stage's width instead of drawing a\n * rectangle, which is the variant chart pickers list separately. It reads\n * better when the drop-off is smooth and worse when one stage collapses — the\n * slope then implies a gradual loss that was actually a cliff — so `funnel` is\n * the default.\n *\n * Ordered stages are an ordinal scale, not a nominal one, so the fill is one\n * hue stepping darker down the funnel rather than eight categorical colours.\n * The step stays above the contrast floor at the light end; it never fades into\n * the surface, because a stage that recedes reads as a stage that is missing.\n */\nimport { useId, useState } from 'react';\n\nimport { CHART_INK, resolveSeriesColor, STATUS_VARS } from './palette';\nimport { useHighlight } from './highlight';\nimport ChartTooltip from './ChartTooltip';\nimport type { FunnelChartProps } from './types';\n\nexport default function FunnelChart({\n stages, shape = 'funnel', height, width = 560, gap = 4,\n formatValue = v => String(v), color, className, emptyLabel = 'No stages to chart.',\n}: FunnelChartProps) {\n const titleId = useId();\n const [hover, setHover] = useState<number | null>(null);\n const { highlighted } = useHighlight();\n\n if (stages.length === 0) return <p className={`text-sm text-gray-500 ${className ?? ''}`}>{emptyLabel}</p>;\n\n const hue = color ?? resolveSeriesColor(0);\n const bandHeight = 54;\n const total = height ?? stages.length * bandHeight;\n const top = Math.max(...stages.map(s => s.value), 1);\n const labelWidth = 168;\n const plotWidth = width - labelWidth;\n const half = (value: number) => (plotWidth * Math.max(0, value / top)) / 2;\n const cx = labelWidth + plotWidth / 2;\n\n // Ordinal ramp: one hue, stepping darker, never reaching the surface.\n const mix = (i: number) => 46 + (i / Math.max(1, stages.length - 1)) * 54;\n const shade = (i: number) =>\n `color-mix(in oklab, ${hue} ${mix(i).toFixed(0)}%, ${CHART_INK.surface})`;\n // Surface-coloured text needs a band that is mostly hue behind it. At the\n // ramp's light end the band is nearly the surface itself, so the in-band\n // share switches to the ink that contrasts with the surface.\n const bandInk = (i: number) => (mix(i) >= 55 ? CHART_INK.surface : CHART_INK.label);\n\n // Local hover names a stage by index; the frame's legend highlight names it\n // by key. Either one recedes the others.\n const dimmed = (i: number, key: string) => {\n if (hover !== null) return hover !== i;\n if (highlighted !== null) return highlighted !== key;\n return false;\n };\n const hoveredStage = hover !== null ? stages[hover] : undefined;\n\n return (\n <div className={`relative ${className ?? ''}`}>\n <svg width=\"100%\" height={total} viewBox={`0 0 ${width} ${total}`} role=\"img\" aria-labelledby={titleId}\n onMouseLeave={() => setHover(null)}>\n <title id={titleId}>{`Funnel of ${stages.length} stages, ${formatValue(stages[0].value)} down to ${formatValue(stages[stages.length - 1].value)}`}</title>\n\n {stages.map((stage, i) => {\n const y0 = (i * total) / stages.length + gap / 2;\n const y1 = ((i + 1) * total) / stages.length - gap / 2;\n const w0 = half(stage.value);\n const w1 = shape === 'cone' ? half(stages[i + 1]?.value ?? stage.value) : w0;\n const previous = stages[i - 1]?.value;\n const dropped = previous != null && previous > 0\n ? (1 - stage.value / previous) * 100\n : null;\n return (\n <g key={stage.key} opacity={dimmed(i, stage.key) ? 0.45 : 1} onMouseEnter={() => setHover(i)}>\n <path\n d={`M${cx - w0},${y0} L${cx + w0},${y0} L${cx + w1},${y1} L${cx - w1},${y1} Z`}\n fill={shade(i)}\n />\n <text x={labelWidth - 14} y={(y0 + y1) / 2 - 2} textAnchor=\"end\" fontSize={12} fill={CHART_INK.label}>\n {stage.label}\n </text>\n <text x={labelWidth - 14} y={(y0 + y1) / 2 + 14} textAnchor=\"end\" fontSize={11} fill={CHART_INK.muted} style={{ fontVariantNumeric: 'tabular-nums' }}>\n {formatValue(stage.value)}\n {dropped != null ? ` · −${dropped.toFixed(1)}%` : ''}\n </text>\n <text x={cx} y={(y0 + y1) / 2 + 4} textAnchor=\"middle\" fontSize={11.5} fontWeight={600} fill={bandInk(i)} style={{ fontVariantNumeric: 'tabular-nums' }}>\n {((stage.value / (stages[0].value || 1)) * 100).toFixed(0)}%\n </text>\n </g>\n );\n })}\n </svg>\n\n {hoveredStage && hover !== null && (\n <div className=\"absolute top-2 left-2 z-10\">\n <ChartTooltip\n title={hoveredStage.label}\n rows={[\n { key: 'value', label: 'Count', color: shade(hover), value: formatValue(hoveredStage.value) },\n { key: 'share', label: 'Of first stage', color: CHART_INK.muted, value: `${((hoveredStage.value / (stages[0].value || 1)) * 100).toFixed(0)}%` },\n ...(hover > 0 && stages[hover - 1].value > 0\n ? [{ key: 'drop', label: 'Dropped here', color: STATUS_VARS.critical, value: `−${((1 - hoveredStage.value / stages[hover - 1].value) * 100).toFixed(1)}%` }]\n : []),\n ]}\n />\n </div>\n )}\n </div>\n );\n}\n","/**\n * TreemapChart — part-to-whole when there are far too many parts for a pie.\n *\n * A pie stops working past about six slices; a treemap stays readable into the\n * dozens because area is a stronger channel than angle and the cells tile the\n * space instead of competing for a circle. This is the form for \"which of our\n * forty part-number families is the inventory actually in\".\n *\n * Two rules the layout enforces, both from `marks-and-anatomy`:\n *\n * - **Cells are separated by a surface gap, never a border.** A stroke around\n * every tile thickens the whole picture and reads as a grid; the gap lets\n * the card show through and disappears.\n * - **A label is only drawn when it FITS.** A clipped label is worse than no\n * label — it reads as a different word — so a tile too small to hold its\n * text keeps the value in its tooltip and in the table view instead.\n */\nimport { useRef, useState } from 'react';\n\nimport { CHART_INK, resolveSeriesColor } from './palette';\nimport { useHighlight } from './highlight';\nimport { squarify } from './treemapLayout';\nimport { usePlotWidth } from './usePlotWidth';\nimport AccessibleTable from './AccessibleTable';\nimport ChartTooltip from './ChartTooltip';\nimport type { TreemapChartProps } from './types';\n\n/** Rough px per character at 11px; enough to decide whether a label fits. */\nconst CHAR_WIDTH = 6.2;\n\nexport default function TreemapChart({\n items, height = 320, width: widthProp, gap = 2, radius = 3,\n formatValue = v => String(v), color, className, emptyLabel = 'Nothing to break down.',\n}: TreemapChartProps) {\n const host = useRef<HTMLDivElement>(null);\n const measured = usePlotWidth(host);\n const width = widthProp ?? measured;\n const [hover, setHover] = useState<string | null>(null);\n const { highlighted } = useHighlight();\n\n const tiles = squarify(items, width, height);\n if (tiles.length === 0) {\n return <div className={className} ref={host}><p className=\"py-8 text-center text-sm text-gray-500\">{emptyLabel}</p></div>;\n }\n\n const hue = color ?? resolveSeriesColor(0);\n const top = Math.max(...tiles.map(t => t.value), 1);\n const mix = (value: number) => 34 + (value / top) * 62;\n const shade = (value: number) =>\n `color-mix(in oklab, ${hue} ${mix(value).toFixed(0)}%, ${CHART_INK.surface})`;\n // Surface-coloured text needs a tile that is mostly hue behind it. At the\n // ramp's light end the tile IS nearly the surface, so the label switches to\n // the ink that contrasts with the surface instead of vanishing into it.\n const tileInk = (value: number) => (mix(value) >= 55 ? CHART_INK.surface : CHART_INK.label);\n\n const active = hover ?? highlighted;\n const hoveredTile = hover ? tiles.find(t => t.key === hover) : undefined;\n\n return (\n <div className={`relative ${className ?? ''}`} ref={host}>\n <svg width=\"100%\" height={height} viewBox={`0 0 ${width} ${height}`} role=\"img\"\n aria-label={`Treemap of ${items.length} items`} onMouseLeave={() => setHover(null)}>\n {tiles.map(tile => {\n const w = Math.max(0, tile.width - gap);\n const h = Math.max(0, tile.height - gap);\n const fitsLabel = w > tile.label.length * CHAR_WIDTH + 12 && h > 30;\n const fitsValue = fitsLabel && h > 44;\n return (\n <g key={tile.key} opacity={active && active !== tile.key ? 0.55 : 1} onMouseEnter={() => setHover(tile.key)}>\n <rect\n x={tile.x + gap / 2} y={tile.y + gap / 2} width={w} height={h}\n rx={radius} fill={shade(tile.value)}\n />\n {fitsLabel && (\n <text x={tile.x + gap / 2 + 8} y={tile.y + gap / 2 + 18} fontSize={11.5} fontWeight={600} fill={tileInk(tile.value)}>\n {tile.label}\n </text>\n )}\n {fitsValue && (\n <text x={tile.x + gap / 2 + 8} y={tile.y + gap / 2 + 34} fontSize={11} fill={tileInk(tile.value)} fillOpacity={0.85} style={{ fontVariantNumeric: 'tabular-nums' }}>\n {formatValue(tile.value)}\n </text>\n )}\n </g>\n );\n })}\n </svg>\n\n {hoveredTile && (\n <div className=\"absolute top-2 left-2 z-10\">\n <ChartTooltip\n title={hoveredTile.label}\n rows={[{ key: 'value', label: 'Value', color: shade(hoveredTile.value), value: formatValue(hoveredTile.value) }]}\n />\n </div>\n )}\n\n <AccessibleTable\n caption={`Treemap of ${items.length} items`}\n head={['Item', 'Value']}\n rows={tiles.map(tile => [tile.label, formatValue(tile.value)])}\n />\n </div>\n );\n}\n","/**\n * SunburstChart — a hierarchy where depth is a ring and share is an angle.\n *\n * The treemap's radial sibling, and the choice between them is about what the\n * reader must do. A treemap compares SIZES across the whole set, because area\n * side by side is easy to judge. A sunburst shows STRUCTURE — how a total\n * decomposes, level by level, with each child nested inside the sweep of its\n * parent. Ask \"which is biggest\" and reach for the treemap; ask \"what is this\n * made of\" and reach for this.\n *\n * Colour follows the top level and every descendant inherits it, stepped\n * lighter with depth. Giving each leaf its own categorical hue would break the\n * only thing a sunburst reads well: that a wedge and the wedges above it are\n * the same branch.\n */\nimport { useState } from 'react';\n\nimport { CHART_INK, resolveSeriesColor } from './palette';\nimport { arcPath } from './curve';\nimport { useHighlight } from './highlight';\nimport AccessibleTable from './AccessibleTable';\nimport ChartTooltip from './ChartTooltip';\nimport type { SunburstChartProps, SunburstNode } from './types';\n\ninterface Wedge {\n /**\n * The path from the root, not the node's own key: the same key reused in two\n * branches is two wedges, and identity — React's and the hover's — must say\n * so.\n */\n id: string;\n label: string;\n value: number;\n depth: number;\n start: number;\n end: number;\n branch: number;\n /** Top-level ancestor's key — the identity a ChartFrame legend entry names. */\n branchKey: string;\n}\n\n/**\n * Rings past this depth are unreadable slivers — and, without the cap, a\n * cyclic `children` graph recurses to a stack overflow instead of rendering.\n */\nconst MAX_DEPTH = 8;\n\n/** Flatten the tree into wedges, assigning each its angular span. */\nfunction toWedges(\n nodes: SunburstNode[], start: number, sweep: number,\n depth: number, branch: number, branchKey: string, parentId: string,\n out: Wedge[],\n): void {\n if (depth >= MAX_DEPTH) return;\n const total = nodes.reduce((n, node) => n + nodeValue(node, MAX_DEPTH - depth), 0);\n if (total <= 0) return;\n let cursor = start;\n nodes.forEach((node, i) => {\n const value = nodeValue(node, MAX_DEPTH - depth);\n const span = (value / total) * sweep;\n const id = `${parentId}/${node.key}`;\n const ownBranch = depth === 0 ? i : branch;\n const ownBranchKey = depth === 0 ? node.key : branchKey;\n out.push({\n id, label: node.label, value, depth,\n start: cursor, end: cursor + span,\n branch: ownBranch, branchKey: ownBranchKey,\n });\n if (node.children?.length) toWedges(node.children, cursor, span, depth + 1, ownBranch, ownBranchKey, id, out);\n cursor += span;\n });\n}\n\n/** A node's value is its subtree's, summed no deeper than the drawn rings. */\nfunction nodeValue(node: SunburstNode, budget: number): number {\n if (budget > 0 && node.children?.length) return node.children.reduce((n, c) => n + nodeValue(c, budget - 1), 0);\n return Math.max(0, node.value ?? 0);\n}\n\nexport default function SunburstChart({\n nodes, size = 320, innerRadius = 44, ringGap = 2,\n formatValue = v => String(v), centerLabel, className,\n emptyLabel = 'Nothing to break down.',\n}: SunburstChartProps) {\n const [hover, setHover] = useState<string | null>(null);\n const { highlighted } = useHighlight();\n\n const wedges: Wedge[] = [];\n toWedges(nodes, -Math.PI / 2, Math.PI * 2, 0, 0, '', '', wedges);\n if (wedges.length === 0) return <p className={`text-sm text-gray-500 ${className ?? ''}`}>{emptyLabel}</p>;\n\n const depth = Math.max(...wedges.map(w => w.depth)) + 1;\n const cx = size / 2;\n const cy = size / 2;\n const outer = size / 2 - 8;\n const ring = (outer - innerRadius) / depth;\n const total = wedges.filter(w => w.depth === 0).reduce((n, w) => n + w.value, 0);\n\n // Floored: past depth four the unclamped ramp crosses zero, and a negative\n // percentage is an invalid color-mix() — the deepest rings painted BLACK.\n const shade = (w: Wedge) =>\n `color-mix(in oklab, ${resolveSeriesColor(w.branch)} ${Math.max(16, 100 - w.depth * 24).toFixed(0)}%, ${CHART_INK.surface})`;\n\n // Local hover names ONE wedge; the frame's legend highlight names a top-level\n // branch and lights the whole branch, because that is what its entry means.\n const lit = (w: Wedge) => {\n if (hover !== null) return w.id === hover;\n if (highlighted !== null) return w.branchKey === highlighted;\n return true;\n };\n const hovered = hover ? wedges.find(w => w.id === hover) : undefined;\n const share = (w: Wedge) => `${((w.value / total) * 100).toFixed(1)}%`;\n\n return (\n <div className={`relative ${className ?? ''}`}>\n <svg width=\"100%\" height={size} viewBox={`0 0 ${size} ${size}`} role=\"img\"\n aria-label={`Hierarchy of ${formatValue(total)} across ${depth} levels`}\n onMouseLeave={() => setHover(null)}>\n {wedges.map(w => (\n <path\n key={w.id}\n d={arcPath(cx, cy, innerRadius + w.depth * ring + ringGap / 2, innerRadius + (w.depth + 1) * ring - ringGap / 2, w.start, w.end)}\n fill={shade(w)} fillOpacity={lit(w) ? 1 : 0.45}\n stroke={CHART_INK.surface} strokeWidth={1}\n onMouseEnter={() => setHover(w.id)}\n />\n ))}\n {centerLabel && (\n <text x={cx} y={cy + 5} textAnchor=\"middle\" fontSize={15} fontWeight={600} fill={CHART_INK.label}>\n {centerLabel}\n </text>\n )}\n </svg>\n\n {hovered && (\n <div className=\"absolute top-2 left-2 z-10\">\n <ChartTooltip\n title={hovered.label}\n rows={[\n { key: 'value', label: 'Value', color: shade(hovered), value: formatValue(hovered.value) },\n { key: 'share', label: 'Share', color: CHART_INK.muted, value: share(hovered) },\n ]}\n />\n </div>\n )}\n\n <AccessibleTable\n caption={`Hierarchy of ${formatValue(total)} across ${depth} levels`}\n head={['Level', 'Item', 'Value', 'Share']}\n rows={wedges.map(w => [w.depth + 1, w.label, formatValue(w.value), share(w)])}\n />\n </div>\n );\n}\n","/**\n * SankeyChart — where a quantity went, with the width of each ribbon carrying\n * how much went that way.\n *\n * The form for a flow that splits and rejoins: stock moving between warehouses,\n * an order pipeline where things branch into fulfilled, cancelled and returned,\n * traffic arriving at surfaces and ending in status classes. A stacked bar can\n * show the ends of that but not the paths between them.\n *\n * The layout is deliberately simple and deliberately declared: nodes are placed\n * in the column their `depth` says, stacked in the order given, and ribbons run\n * between them as cubic curves. Crossing-minimisation — the iterative relaxation\n * a full Sankey implementation does — is NOT here. It would be several hundred\n * lines that mostly matter above about thirty nodes, and a caller who orders its\n * nodes sensibly gets a clean diagram without it. Ordering is therefore part of\n * the contract rather than something the component quietly rearranges.\n */\nimport { useRef, useState } from 'react';\n\nimport { CHART_INK, resolveSeriesColor } from './palette';\nimport { bumpPath } from './curve';\nimport { useHighlight } from './highlight';\nimport { usePlotWidth } from './usePlotWidth';\nimport AccessibleTable from './AccessibleTable';\nimport ChartTooltip from './ChartTooltip';\nimport type { SankeyChartProps } from './types';\n\ntype Hover = { kind: 'node'; key: string } | { kind: 'link'; index: number } | null;\n\nexport default function SankeyChart({\n nodes, links, height = 320, width: widthProp, nodeWidth = 14, nodePadding = 12,\n formatValue = v => String(v), className, emptyLabel = 'No flows to chart.',\n}: SankeyChartProps) {\n const host = useRef<HTMLDivElement>(null);\n const measured = usePlotWidth(host);\n const width = widthProp ?? measured;\n const [hover, setHover] = useState<Hover>(null);\n const { highlighted } = useHighlight();\n\n if (nodes.length === 0 || links.length === 0) {\n return <div className={className} ref={host}><p className=\"py-8 text-center text-sm text-gray-500\">{emptyLabel}</p></div>;\n }\n\n const depths = [...new Set(nodes.map(n => n.depth))].sort((a, b) => a - b);\n const columnX = (depth: number) =>\n depths.length <= 1 ? 0 : (depths.indexOf(depth) / (depths.length - 1)) * (width - nodeWidth - 140) + 70;\n\n // A node's height is the larger of what flows in and what flows out, so a\n // source that emits more than it receives is not drawn too thin.\n const throughput = new Map(nodes.map(n => {\n const out = links.filter(l => l.from === n.key).reduce((s, l) => s + l.value, 0);\n const into = links.filter(l => l.to === n.key).reduce((s, l) => s + l.value, 0);\n return [n.key, Math.max(out, into, n.value ?? 0)];\n }));\n\n const byDepth = new Map<number, typeof nodes>();\n for (const node of nodes) byDepth.set(node.depth, [...(byDepth.get(node.depth) ?? []), node]);\n\n const tallestColumn = Math.max(...[...byDepth.values()].map(column =>\n column.reduce((s, n) => s + (throughput.get(n.key) ?? 0), 0)));\n const usable = height - 20;\n const scale = tallestColumn > 0 ? (usable - nodePadding * (Math.max(...[...byDepth.values()].map(c => c.length)) - 1)) / tallestColumn : 0;\n\n const placed = new Map<string, { x: number; y: number; h: number; index: number }>();\n for (const [depth, column] of byDepth) {\n const raw = column.map(node => Math.max(2, (throughput.get(node.key) ?? 0) * scale));\n // The 2px floor is height the budget above never counted: a column of many\n // near-zero nodes inflates past `usable`. The un-floored spans give back\n // exactly the overflow, proportionally; the floors themselves never shrink.\n const need = raw.reduce((s, h) => s + h, 0) + nodePadding * (column.length - 1);\n const give = raw.reduce((s, h) => s + Math.max(0, h - 2), 0);\n const k = need > usable && give > 0 ? Math.max(0, 1 - (need - usable) / give) : 1;\n let cursor = 10;\n column.forEach((node, index) => {\n const h = 2 + Math.max(0, raw[index] - 2) * k;\n placed.set(node.key, { x: columnX(depth), y: cursor, h, index });\n cursor += h + nodePadding;\n });\n }\n\n // Ribbons leave a source and enter a target stacked in link order, so two\n // flows out of one node do not overlap.\n const outCursor = new Map<string, number>();\n const inCursor = new Map<string, number>();\n // Keyed by route, so reordering the links does not remount every ribbon;\n // parallel duplicates of one route get a per-route ordinal.\n const routeSeen = new Map<string, number>();\n\n const touches = (link: { from: string; to: string }, key: string) =>\n link.from === key || link.to === key;\n const linkLit = (link: { from: string; to: string }, index: number) => {\n if (hover) return hover.kind === 'link' ? hover.index === index : touches(link, hover.key);\n if (highlighted !== null) return touches(link, highlighted);\n return null;\n };\n const nodeLit = (key: string) => {\n if (hover) return hover.kind === 'node' ? hover.key === key : touches(links[hover.index], key);\n if (highlighted !== null) return highlighted === key;\n return null;\n };\n\n const hoveredLink = hover?.kind === 'link' ? links[hover.index] : undefined;\n const hoveredNode = hover?.kind === 'node' ? nodes.find(n => n.key === hover.key) : undefined;\n\n return (\n <div className={`relative ${className ?? ''}`} ref={host}>\n <svg width=\"100%\" height={height} viewBox={`0 0 ${width} ${height}`} role=\"img\"\n aria-label={`Flow between ${nodes.length} nodes over ${links.length} links`}\n onMouseLeave={() => setHover(null)}>\n {links.map((link, i) => {\n const a = placed.get(link.from);\n const b = placed.get(link.to);\n if (!a || !b) return null;\n const thickness = Math.max(1, link.value * scale);\n const ay = a.y + (outCursor.get(link.from) ?? 0) + thickness / 2;\n const by = b.y + (inCursor.get(link.to) ?? 0) + thickness / 2;\n outCursor.set(link.from, (outCursor.get(link.from) ?? 0) + thickness);\n inCursor.set(link.to, (inCursor.get(link.to) ?? 0) + thickness);\n const x1 = a.x + nodeWidth;\n const x2 = b.x;\n const colour = resolveSeriesColor(a.index, link.color);\n const route = `${link.from}→${link.to}`;\n const ordinal = routeSeen.get(route) ?? 0;\n routeSeen.set(route, ordinal + 1);\n const lit = linkLit(link, i);\n return (\n <path\n // The same bump the line family uses: flat where it leaves a\n // node, flat where it arrives, all the movement in between.\n key={ordinal ? `${route}#${ordinal}` : route}\n d={bumpPath([[x1, ay], [x2, by]])}\n fill=\"none\" stroke={colour} strokeWidth={thickness}\n strokeOpacity={lit === null || lit ? 0.42 : 0.12}\n onMouseEnter={() => setHover({ kind: 'link', index: i })}\n />\n );\n })}\n\n {nodes.map(node => {\n const p = placed.get(node.key);\n if (!p) return null;\n const last = p.x > width / 2;\n const lit = nodeLit(node.key);\n return (\n <g key={node.key} opacity={lit === null || lit ? 1 : 0.45} onMouseEnter={() => setHover({ kind: 'node', key: node.key })}>\n <rect x={p.x} y={p.y} width={nodeWidth} height={p.h} rx={2} fill={resolveSeriesColor(p.index, node.color, node.tone)} />\n <text\n x={last ? p.x - 8 : p.x + nodeWidth + 8} y={p.y + p.h / 2 + 4}\n textAnchor={last ? 'end' : 'start'} fontSize={11} fill={CHART_INK.label}\n >\n {node.label}\n </text>\n </g>\n );\n })}\n </svg>\n\n {hoveredLink && (\n <div className=\"absolute top-2 left-2 z-10\">\n <ChartTooltip\n title={`${hoveredLink.from} → ${hoveredLink.to}`}\n rows={[{ key: 'value', label: 'Flow', color: resolveSeriesColor(placed.get(hoveredLink.from)?.index ?? 0, hoveredLink.color), value: formatValue(hoveredLink.value) }]}\n />\n </div>\n )}\n {hoveredNode && (\n <div className=\"absolute top-2 left-2 z-10\">\n <ChartTooltip\n title={hoveredNode.label}\n rows={[{ key: 'value', label: 'Throughput', color: resolveSeriesColor(placed.get(hoveredNode.key)?.index ?? 0, hoveredNode.color, hoveredNode.tone), value: formatValue(throughput.get(hoveredNode.key) ?? 0) }]}\n />\n </div>\n )}\n\n <AccessibleTable\n caption={`Flow between ${nodes.length} nodes over ${links.length} links`}\n head={['From', 'To', 'Value']}\n rows={links.map(link => [link.from, link.to, formatValue(link.value)])}\n />\n </div>\n );\n}\n","/**\n * ChordChart — flows between every pair in one set, arranged on a circle.\n *\n * Where a Sankey shows a flow that moves left to right through stages, a chord\n * shows one that can go both ways between the same participants: transfers\n * between warehouses, substitutions between part numbers, traffic between\n * tenants. The circle exists precisely because there is no direction of travel\n * to lay out along.\n *\n * It is a demanding form and the limits are real, so they are enforced rather\n * than documented and hoped for. Past about eight participants the ribbons\n * occlude each other and the chart becomes a decorative tangle — `maxNodes`\n * keeps the biggest participants and DROPS the rest, flows included; it is a\n * cut, not an \"Other\" fold, so a reader comparing against a total should be\n * told. Eight is also the palette's slot count: a ninth arc would take the\n * de-emphasis ink and two participants would become indistinguishable. Colour\n * follows the SOURCE arc, which is the only convention that lets a reader\n * trace a ribbon back to where it came from.\n */\nimport { useState } from 'react';\n\nimport { CHART_INK, resolveSeriesColor } from './palette';\nimport { arcPath } from './curve';\nimport { useHighlight } from './highlight';\nimport AccessibleTable from './AccessibleTable';\nimport ChartTooltip from './ChartTooltip';\nimport type { ChordChartProps } from './types';\n\ntype Hover = { kind: 'arc'; index: number } | { kind: 'ribbon'; index: number } | null;\n\nexport default function ChordChart({\n labels, matrix, size = 340, maxNodes = 8, padAngle = 0.04, arcWidth = 12,\n formatValue = v => String(v), className, emptyLabel = 'No flows to chart.',\n}: ChordChartProps) {\n const [hover, setHover] = useState<Hover>(null);\n const { highlighted } = useHighlight();\n\n // A ragged or NaN-carrying matrix must degrade to zeros, not throw in the\n // row reduce or slip NaN totals past the `grand <= 0` guard.\n const cell = (row: number, col: number): number => {\n const value = matrix[row]?.[col];\n return typeof value === 'number' && Number.isFinite(value) ? value : 0;\n };\n const totals = labels.map((_, i) =>\n labels.reduce((n, _l, j) => n + cell(i, j) + cell(j, i), 0));\n const order = labels.map((_, i) => i).sort((a, b) => totals[b] - totals[a]).slice(0, maxNodes);\n const grand = order.reduce((n, i) => n + totals[i], 0);\n if (grand <= 0) return <p className={`text-sm text-gray-500 ${className ?? ''}`}>{emptyLabel}</p>;\n\n const cx = size / 2;\n const cy = size / 2;\n const outer = size / 2 - 44;\n const inner = outer - arcWidth;\n const gaps = padAngle * order.length;\n\n // Each participant's arc spans its share of the total traffic.\n const spans = new Map<number, { start: number; end: number; slot: number }>();\n let cursor = -Math.PI / 2;\n order.forEach((index, slot) => {\n const sweep = (totals[index] / grand) * (Math.PI * 2 - gaps);\n spans.set(index, { start: cursor, end: cursor + sweep, slot });\n cursor += sweep + padAngle;\n });\n\n // Ribbons leave each arc stacked, so two flows from one participant do not\n // start at the same point.\n const outCursor = new Map<number, number>();\n const ribbons: { from: number; to: number; value: number; a: number; b: number }[] = [];\n for (const from of order) {\n for (const to of order) {\n const value = cell(from, to);\n if (value <= 0) continue;\n const span = spans.get(from)!;\n const width = (value / Math.max(1, totals[from])) * (span.end - span.start);\n const offset = outCursor.get(from) ?? 0;\n outCursor.set(from, offset + width);\n ribbons.push({ from, to, value, a: span.start + offset + width / 2, b: spans.get(to)!.start + (spans.get(to)!.end - spans.get(to)!.start) / 2 });\n }\n }\n\n const point = (angle: number, r: number) => [cx + r * Math.cos(angle), cy + r * Math.sin(angle)] as const;\n\n // Local hover names an arc or one ribbon; the frame's legend highlight names\n // a participant by LABEL, the identity a legend entry carries.\n const ribbonLit = (ribbon: { from: number; to: number }, index: number) => {\n if (hover) {\n return hover.kind === 'ribbon'\n ? hover.index === index\n : hover.index === ribbon.from || hover.index === ribbon.to;\n }\n if (highlighted !== null) return labels[ribbon.from] === highlighted || labels[ribbon.to] === highlighted;\n return null;\n };\n const arcLit = (index: number) => {\n if (hover) {\n return hover.kind === 'arc'\n ? hover.index === index\n : ribbons[hover.index].from === index || ribbons[hover.index].to === index;\n }\n if (highlighted !== null) return labels[index] === highlighted;\n return null;\n };\n\n const hoveredArc = hover?.kind === 'arc' ? hover.index : undefined;\n const hoveredRibbon = hover?.kind === 'ribbon' ? ribbons[hover.index] : undefined;\n\n return (\n <div className={`relative ${className ?? ''}`}>\n <svg width=\"100%\" height={size} viewBox={`0 0 ${size} ${size}`} role=\"img\"\n aria-label={`Flows between ${order.length} participants`} onMouseLeave={() => setHover(null)}>\n {ribbons.map((ribbon, i) => {\n const [x1, y1] = point(ribbon.a, inner);\n const [x2, y2] = point(ribbon.b, inner);\n const colour = resolveSeriesColor(spans.get(ribbon.from)!.slot);\n const lit = ribbonLit(ribbon, i);\n return (\n <path\n key={`${labels[ribbon.from]}→${labels[ribbon.to]}`}\n d={`M${x1},${y1} Q${cx},${cy} ${x2},${y2}`} fill=\"none\"\n stroke={colour} strokeWidth={Math.max(1, (ribbon.value / grand) * size * 0.9)}\n strokeOpacity={lit === null || lit ? 0.34 : 0.07} strokeLinecap=\"round\"\n onMouseEnter={() => setHover({ kind: 'ribbon', index: i })}\n />\n );\n })}\n\n {order.map(index => {\n const span = spans.get(index)!;\n const mid = (span.start + span.end) / 2;\n const [lx, ly] = point(mid, outer + 16);\n const lit = arcLit(index);\n return (\n <g key={index} onMouseEnter={() => setHover({ kind: 'arc', index })}>\n <path\n d={arcPath(cx, cy, inner, outer, span.start, span.end)}\n fill={resolveSeriesColor(span.slot)}\n fillOpacity={lit === null || lit ? 1 : 0.45}\n />\n <text\n x={lx} y={ly + 4} fontSize={11} fill={CHART_INK.label}\n textAnchor={Math.cos(mid) > 0.15 ? 'start' : Math.cos(mid) < -0.15 ? 'end' : 'middle'}\n >\n {labels[index]}\n </text>\n </g>\n );\n })}\n </svg>\n\n {hoveredArc !== undefined && (\n <div className=\"absolute top-2 left-2 z-10\">\n <ChartTooltip\n title={labels[hoveredArc]}\n rows={[{ key: 'total', label: 'Total flow', color: resolveSeriesColor(spans.get(hoveredArc)!.slot), value: formatValue(totals[hoveredArc]) }]}\n />\n </div>\n )}\n {hoveredRibbon && (\n <div className=\"absolute top-2 left-2 z-10\">\n <ChartTooltip\n title={`${labels[hoveredRibbon.from]} → ${labels[hoveredRibbon.to]}`}\n rows={[{ key: 'value', label: 'Flow', color: resolveSeriesColor(spans.get(hoveredRibbon.from)!.slot), value: formatValue(hoveredRibbon.value) }]}\n />\n </div>\n )}\n\n <AccessibleTable\n caption={`Flows between ${order.length} participants`}\n head={['From', 'To', 'Value']}\n rows={ribbons.map(ribbon => [labels[ribbon.from], labels[ribbon.to], formatValue(ribbon.value)])}\n />\n </div>\n );\n}\n"]}