@titan-design/react-ui 0.11.0 → 0.12.1

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 (152) hide show
  1. package/dist/bodymap.js +173 -343
  2. package/dist/bodymap.js.map +1 -1
  3. package/dist/bodymap.mjs +173 -343
  4. package/dist/bodymap.mjs.map +1 -1
  5. package/dist/index.d.mts +27 -22
  6. package/dist/index.d.ts +27 -22
  7. package/dist/index.js +366 -561
  8. package/dist/index.js.map +1 -1
  9. package/dist/index.mjs +360 -553
  10. package/dist/index.mjs.map +1 -1
  11. package/dist/pages.js +242 -407
  12. package/dist/pages.js.map +1 -1
  13. package/dist/pages.mjs +242 -407
  14. package/dist/pages.mjs.map +1 -1
  15. package/dist/theme/index.d.mts +250 -1157
  16. package/dist/theme/index.d.ts +250 -1157
  17. package/dist/theme/index.js +234 -408
  18. package/dist/theme/index.js.map +1 -1
  19. package/dist/theme/index.mjs +227 -399
  20. package/dist/theme/index.mjs.map +1 -1
  21. package/dist/theme/tokens-css.js +141 -140
  22. package/dist/theme/tokens-css.js.map +1 -1
  23. package/dist/theme/tokens-css.mjs +141 -140
  24. package/dist/theme/tokens-css.mjs.map +1 -1
  25. package/dist/theme/tokens.d.mts +904 -0
  26. package/dist/theme/tokens.d.ts +904 -0
  27. package/dist/theme/tokens.js +856 -0
  28. package/dist/theme/tokens.js.map +1 -0
  29. package/dist/theme/tokens.mjs +833 -0
  30. package/dist/theme/tokens.mjs.map +1 -0
  31. package/package.json +7 -1
  32. package/src/arch/Architecture.stories.tsx +9 -9
  33. package/src/components/custom/DateTime/DateTime.stories.tsx +1 -1
  34. package/src/components/custom/Fatigue/DualGhostSpark.stories.tsx +3 -3
  35. package/src/components/custom/Fatigue/FatigueLights.stories.tsx +2 -2
  36. package/src/components/custom/Fatigue/GhostSpark.stories.tsx +3 -3
  37. package/src/components/custom/Fatigue/LiveFatigueCard.tsx +1 -1
  38. package/src/components/custom/Fatigue/LiveFatiguePanel.stories.tsx +2 -2
  39. package/src/components/custom/Fatigue/RomProgressionChart.stories.tsx +2 -2
  40. package/src/components/custom/Fatigue/SilverRedPalette.stories.tsx +4 -4
  41. package/src/components/custom/Fatigue/VelocityHero.stories.tsx +3 -3
  42. package/src/components/custom/Fatigue/VerdictHero.stories.tsx +2 -2
  43. package/src/components/custom/Fatigue/fatigue-tokens.ts +12 -12
  44. package/src/components/custom/Sidebar/Sidebar.tsx +4 -4
  45. package/src/components/custom/Table/Table.tsx +2 -2
  46. package/src/components/custom/Workout/ActiveWorkoutPage.tsx +3 -3
  47. package/src/components/custom/Workout/BaseBadge.test.tsx +6 -1
  48. package/src/components/custom/Workout/BaseBadge.tsx +1 -1
  49. package/src/components/custom/Workout/BodyMap.tsx +2 -2
  50. package/src/components/custom/Workout/BodyMapDetailPanel.tsx +2 -2
  51. package/src/components/custom/Workout/DeviationBar.test.tsx +2 -1
  52. package/src/components/custom/Workout/DeviationBar.tsx +3 -2
  53. package/src/components/custom/Workout/ExerciseCard.test.tsx +3 -3
  54. package/src/components/custom/Workout/ExerciseCard.tsx +2 -2
  55. package/src/components/custom/Workout/ExerciseDetailPage.tsx +4 -4
  56. package/src/components/custom/Workout/InputBar.tsx +2 -2
  57. package/src/components/custom/Workout/LiveAuraFrame.stories.tsx +1 -1
  58. package/src/components/custom/Workout/LiveAuraFrame.test.tsx +1 -1
  59. package/src/components/custom/Workout/LiveAuraFrame.tsx +3 -3
  60. package/src/components/custom/Workout/MesoCard.tsx +3 -1
  61. package/src/components/custom/Workout/MuscleGroupChip.tsx +4 -3
  62. package/src/components/custom/Workout/PrHistoryModal.tsx +2 -2
  63. package/src/components/custom/Workout/ProgramPlanningPage.tsx +1 -1
  64. package/src/components/custom/Workout/README.md +1 -1
  65. package/src/components/custom/Workout/ReadinessCheck.tsx +2 -2
  66. package/src/components/custom/Workout/RestTimer.tsx +2 -2
  67. package/src/components/custom/Workout/S3SetTypes.stories.tsx +3 -3
  68. package/src/components/custom/Workout/SessionHeader.stories.tsx +2 -2
  69. package/src/components/custom/Workout/SessionHeader.tsx +1 -1
  70. package/src/components/custom/Workout/SessionRail.stories.tsx +2 -2
  71. package/src/components/custom/Workout/SessionRail.tsx +13 -5
  72. package/src/components/custom/Workout/SetBar.tsx +3 -3
  73. package/src/components/custom/Workout/SetRow.test.tsx +6 -3
  74. package/src/components/custom/Workout/StatusDot.tsx +5 -4
  75. package/src/components/custom/Workout/StrengthTrendChart.tsx +1 -1
  76. package/src/components/custom/Workout/TrainingStatusPage.tsx +2 -2
  77. package/src/components/custom/Workout/VelocityStrip.test.tsx +5 -2
  78. package/src/components/custom/Workout/VelocityStrip.tsx +4 -4
  79. package/src/components/custom/Workout/VolumeLandmarkBar.tsx +3 -3
  80. package/src/components/custom/Workout/WeightBadge.test.tsx +6 -1
  81. package/src/components/custom/Workout/WeightBadge.tsx +2 -1
  82. package/src/components/custom/Workout/WorkoutCard.tsx +3 -1
  83. package/src/components/custom/Workout/WorkoutPill.tsx +5 -2
  84. package/src/components/custom/Workout/ZoneTrack.tsx +4 -4
  85. package/src/components/custom/Workout/setHeadingKit.tsx +14 -8
  86. package/src/components/custom/Workout/velocity-story-kit.tsx +2 -2
  87. package/src/components/custom/charts/SetBarChart.tsx +3 -3
  88. package/src/components/custom/stepper/Stepper.stories.tsx +1 -1
  89. package/src/components/custom/stepper/Stepper.tsx +3 -3
  90. package/src/components/shell/DeviceMenu.tsx +2 -2
  91. package/src/components/shell/README.md +1 -1
  92. package/src/components/shell/SessionRailSpecimen.stories.tsx +1 -1
  93. package/src/components/shell/SideNav.tsx +1 -1
  94. package/src/components/shell/TopBar.tsx +1 -1
  95. package/src/components/ui/autocomplete/Autocomplete.stories.tsx +1 -1
  96. package/src/components/ui/autocomplete/Autocomplete.tsx +1 -1
  97. package/src/components/ui/avatar/Avatar.tsx +2 -2
  98. package/src/components/ui/badge/Badge.tsx +2 -2
  99. package/src/components/ui/card/Card.tsx +3 -3
  100. package/src/components/ui/checkbox/Checkbox.tsx +1 -1
  101. package/src/components/ui/collapse/Collapse.tsx +1 -1
  102. package/src/components/ui/data-row/DataRow.stories.tsx +1 -1
  103. package/src/components/ui/drawer/Drawer.tsx +3 -3
  104. package/src/components/ui/form-field/FormField.tsx +1 -1
  105. package/src/components/ui/help-tip/HelpTip.tsx +1 -1
  106. package/src/components/ui/menu/Menu.tsx +2 -2
  107. package/src/components/ui/pill/Pill.tsx +2 -2
  108. package/src/components/ui/popover/Popover.stories.tsx +2 -2
  109. package/src/components/ui/popover/Popover.tsx +1 -1
  110. package/src/components/ui/progress/Progress.tsx +3 -3
  111. package/src/components/ui/radio/Radio.stories.tsx +1 -1
  112. package/src/components/ui/radio/Radio.tsx +4 -4
  113. package/src/components/ui/select/Select.tsx +3 -3
  114. package/src/components/ui/surface/Surface.stories.tsx +3 -3
  115. package/src/components/ui/surface/Surface.test.tsx +32 -19
  116. package/src/components/ui/surface/Surface.tsx +3 -3
  117. package/src/components/ui/surface/SurfaceContext.ts +19 -29
  118. package/src/components/ui/surface/surface.contract.test.ts +58 -45
  119. package/src/components/ui/switch/Switch.tsx +1 -1
  120. package/src/components/ui/tabs/Tabs.tsx +2 -2
  121. package/src/components/ui/toolbar-button/ToolbarButton.stories.tsx +5 -5
  122. package/src/components/ui/toolbar-button/ToolbarButton.test.tsx +1 -1
  123. package/src/components/ui/toolbar-button/ToolbarButton.tsx +36 -22
  124. package/src/stories/PresetShowcase.stories.tsx +21 -21
  125. package/src/theme/ColorPalettes.stories.tsx +41 -38
  126. package/src/theme/ColorPrimitives.stories.tsx +89 -41
  127. package/src/theme/Depth.stories.tsx +312 -0
  128. package/src/theme/DepthCalibration.stories.tsx +655 -0
  129. package/src/theme/ThemeProvider.tsx +1 -1
  130. package/src/theme/barrel.ts +7 -14
  131. package/src/theme/color-stories.coverage.test.ts +15 -20
  132. package/src/theme/color-story-kit.tsx +1 -1
  133. package/src/theme/color-utils.ts +197 -0
  134. package/src/theme/config.ts +0 -8
  135. package/src/theme/depth-calibration.test.tsx +97 -0
  136. package/src/theme/elevation.test.ts +62 -1
  137. package/src/theme/elevation.ts +34 -8
  138. package/src/theme/global.css +47 -53
  139. package/src/theme/grey-ramp.test.ts +166 -0
  140. package/src/theme/materials.test.ts +106 -0
  141. package/src/theme/materials.ts +211 -0
  142. package/src/theme/presets/audiobook.ts +4 -4
  143. package/src/theme/presets/types.ts +3 -3
  144. package/src/theme/semantic-contrast.test.ts +83 -0
  145. package/src/theme/token-export-guard.test.ts +104 -0
  146. package/src/theme/tokens/primitives.ts +63 -116
  147. package/src/theme/tokens/semantic.ts +130 -82
  148. package/src/utils/colors.ts +1 -1
  149. package/tailwind.config.js +2 -5
  150. package/src/theme/bar-paper.ts +0 -59
  151. package/src/theme/shadows.stories.tsx +0 -523
  152. package/src/theme/shadows.ts +0 -439
package/dist/pages.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/theme/tokens/primitives.ts","../src/theme/workout-tokens.ts","../src/theme/tokens/semantic.ts","../src/theme/shadows.ts","../src/utils/colors.ts","../src/utils/workout-format.ts","../src/theme/bar-paper.ts","../src/components/ui/surface/SurfaceContext.ts","../src/components/custom/charts/live-rep-growth.ts","../src/web-jsx/jsx-runtime.ts","../src/components/custom/charts/SetBarChart.tsx","../src/components/custom/Workout/VelocityStrip.tsx","../src/utils/cn.ts","../src/components/custom/Workout/PlaceholderStrip.tsx","../src/components/icons/SvgIcon.tsx","../src/components/icons/icons.tsx","../src/components/custom/Workout/BaseBadge.tsx","../src/components/custom/Workout/PrBadge.tsx","../src/components/custom/Workout/SetRow.tsx","../src/components/custom/Workout/SetTableHeader.tsx","../src/components/custom/Workout/metricText.tsx","../src/components/custom/Workout/SetsRepsLoad.tsx","../src/components/custom/Workout/TempoDisplay.tsx","../src/components/custom/Workout/ExerciseIndicator.tsx","../src/components/custom/Workout/ExerciseHeading.tsx","../src/components/custom/Workout/SegmentedBar.tsx","../src/components/custom/Workout/SetBar.tsx","../src/components/custom/Workout/SetStrip.tsx","../src/components/custom/Workout/ExerciseCardHeading.tsx","../src/components/custom/Workout/ExerciseCard.tsx","../src/theme/resolve-color.ts","../src/components/custom/Workout/InputBar.tsx","../src/hooks/useTimer.ts","../src/components/ui/progress/Progress.tsx","../src/components/custom/CircularTimer/CircularTimer.tsx","../src/components/custom/Workout/RestTimer.tsx","../src/components/custom/Workout/SupersetWrapper.tsx","../src/components/custom/Workout/ActiveWorkoutPage.tsx","../src/theme/elevation.ts","../src/utils/useTheme.ts","../src/components/ui/card/Card.tsx","../src/components/custom/Workout/StatusDot.tsx","../src/theme/extracted-colors-dataviz.ts","../src/components/custom/Workout/MesoStatusCard.tsx","../src/components/custom/Workout/StrengthTrendChart.tsx","../src/components/custom/Workout/CapacityBandChart.tsx","../src/components/custom/Workout/ExerciseDetailPage.tsx","../src/components/custom/Workout/MesoProgressBar.tsx","../src/components/ui/indicator/Indicator.tsx","../src/components/ui/badge/Badge.tsx","../src/components/custom/Workout/WorkoutPill.tsx","../src/components/custom/Workout/IntensityBar.tsx","../src/components/custom/Workout/WeekRow.tsx","../src/components/custom/Workout/MesoCard.tsx","../src/components/custom/Workout/MuscleGroupChip.tsx","../src/components/custom/Workout/WorkoutCard.tsx","../src/components/custom/Workout/ProgramPlanningPage.tsx"],"names":["Platform","createContext","useContext","Easing","useState","useEffect","Animated","cn","reactJsx","reactJsxs","t","formatValue","accessibilityLabel","View","Text","t2","t3","REP_GAP","Fragment","Pressable","twMerge","clsx","useCallback","_","DARK","BRAND_PRIMARY","TextInput","useMemo","intensityConfig","useSyncExternalStore","MetricCell","STATUS_SUCCESS","STATUS_ERROR","STATUS_WARNING","buildColumns","toX","toY","sizeStyles","usePulse","BRAND_PRIMARY_DARK","BRAND_PRIMARY_LIGHT","ACCENT_STOPS","ScrollView"],"mappings":";;;;;;;;;;;AAOO,IAAM,eAAA,GAAkB;AAAA;AAAA,EAE7B,IAAA,EAAM;AAAA,IAKJ,GAAA,EAAK,SAAA;AAAA,IAEL,GAAA,EAAK,SAAA;A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A;AAAA,kBACd,YAAA,EAAc;AAAA;AAAA,eAChB;AAAA,cAED,KAAA,KAAU,UAAU,UAAA,IAAc,IAAA,wBAChC,SAAA,EAAA,EAAU,IAAA,EAAM,UAAA,EAAY,eAAA,EAAiB,aAAA,EAAe,CAAA;AAAA,cAE9D,KAAA,KAAU,SAAA,IAAa,aAAA,IAAiB,IAAA,oBACvC,GAAA;AAAA,gBAAC,YAAA;AAAA,gBAAA;AAAA,kBACC,OAAA,EAAS,aAAA;AAAA,kBACT,gBAAA;AAAA,kBACA,gBAAA,EAAkB;AAAA;AAAA;AACpB;AAAA;AAAA;AAEJ,OAAA,EACF;AAAA;AAAA,GACF;AAEJ","file":"pages.js","sourcesContent":["/**\n * Primitive Design Tokens\n *\n * Raw values with no semantic meaning. These are the foundation of the design system\n * and should rarely be used directly in components. Use semantic tokens instead.\n */\n\nexport const primitiveColors = {\n // Blue scale\n blue: {\n 50: '#EFF6FF',\n 100: '#DBEAFE',\n 200: '#BFDBFE',\n 300: '#93C5FD',\n 400: '#60A5FA',\n 500: '#3B82F6',\n 600: '#5048E5',\n 700: '#3832A0',\n 800: '#1E40AF',\n 900: '#1E3A8A',\n },\n\n // Red scale\n red: {\n 50: '#FEF2F2',\n 100: '#FEE2E2',\n 200: '#FECACA',\n 300: '#FCA5A5',\n 400: '#DA6868',\n 500: '#EF4444',\n 600: '#D14343',\n 700: '#922E2E',\n 800: '#991B1B',\n 900: '#7F1D1D',\n },\n\n // Vivid red scale\n redVivid: {\n 50: '#FFECEE',\n 100: '#FFD6DB',\n 200: '#FFB3BC',\n 300: '#FF8593',\n 400: '#FF6070',\n 500: '#FF4757',\n 600: '#E63548',\n 700: '#C42539',\n 800: '#9E1C2C',\n 900: '#7A1520',\n },\n\n // Neutral/Gray scale\n neutral: {\n 50: '#FAFAFA',\n 100: '#F3F4F6',\n 200: '#E5E7EB',\n 300: '#D1D5DB',\n 400: '#9CA3AF',\n 500: '#6B7280',\n 600: '#4B5563',\n 700: '#374151',\n 800: '#1F2937',\n 900: '#111827',\n 950: '#030712',\n },\n\n // Charcoal scale (dark backgrounds)\n charcoal: {\n 0: '#6E6E6E',\n 50: '#5D5D5D',\n 100: '#4C4C4C',\n 200: '#3C3C3C',\n 300: '#2C2C2C',\n 400: '#1F1F1F',\n 500: '#1C1C1C',\n 600: '#191919',\n 700: '#161616',\n 800: '#131313',\n 900: '#101010',\n },\n\n // Pure colors\n white: '#FFFFFF',\n black: '#000000',\n transparent: 'transparent',\n} as const\n\n/**\n * Surface ramp — dark mode (TD-surface-tokens, S-1, re-spaced S-3)\n *\n * Warm-tapered, DERIVED ramp — NOT hand-picked. Shipped verbatim as the output of\n * `deriveSurfaceRamp(shellL=9, steps=[4.5,3.5,3,2.5], rbShadow=6, rbHilite=1.5)`\n * (see `packages/ui/src/components/ui/surface/surface-lab-shared.tsx` on branch\n * `feat/TD-unified-lab`, story `Lab/Surface Exploration -> Surface Ramp System`\n * — that lab default is `[4.5,2.5,2,1.5]` as of this writing and should be\n * updated to match on that branch, follow-up, not done here).\n * Lightness is CIELAB L* off the shell, with DIMINISHING steps (4.5/3.5/3/2.5) —\n * the frame->content jump is biggest, each plane above adds less, but the top\n * three planes (elevated/raised/overlay) were re-spaced WIDER (S-3) than the\n * original 2.5/2/1.5 taper so they read as distinct planes without leaning on\n * the hairline alone. `background`/`base`/`inset` are unchanged by the re-space.\n * Warmth (R-B) tapers 6 -> 1.5 from frame to hero so bright content planes stay\n * near-neutral.\n * Kept separate from the `charcoal` scale above (which several existing\n * components reference directly for unrelated shadow/track tints) so this\n * change is additive and doesn't ripple into those consumers.\n * See coordination/design-explorations/surface-system-north-star.md.\n */\nexport const surfaceRampDark = {\n inset: '#13100D', // L*4.5 — sub-shell well / pressed\n background: '#1C1916', // L*9 — shell / frame\n base: '#252321', // L*13.5 — main content plane\n elevated: '#2C2A28', // L*17 — nav / rail\n raised: '#31302F', // L*20 — cards\n overlay: '#373635', // L*22.5 — hero / popover\n} as const\n\n/**\n * Frame/bezel primitive — dark mode (TD-surface-tokens, S-3)\n *\n * The chrome that \"exits the content ramp\" entirely: the top bar + side nav\n * shell. Sits ONE STEP BELOW `surfaceRampDark.background` (L*9), darker even\n * than `surfaceRampDark.inset` (L*4.5) — it isn't a plane IN the ramp, it's\n * the bezel the ramp sits inside. Literal, not `deriveSurfaceRamp()` output.\n */\nexport const backgroundFrameDark = '#100D0A' // L*3.79\n\n/**\n * Derived tonal ramps (TD-05.09 color foundations)\n *\n * Seven OKLCH-generated hue ramps, 11 perceptual lightness steps each (50 -> 950).\n * Built with hue-torsion + a chroma arc, anchored through existing brand/semantic\n * hexes. `pin` marks the step each ramp flows through its anchor.\n * This is the single source of truth for chromatic hexes — the categorical palette\n * below references these steps rather than duplicating values.\n * See coordination/design-explorations/foundations.\n */\nexport const primitiveRamps = {\n red: {\n 50: '#FFF4F4',\n 100: '#FFE3E5',\n 200: '#FFC2C5',\n 300: '#FF9A9D',\n 400: '#F77175',\n 500: '#E05254',\n 600: '#D14343', // pin\n 700: '#A4221C',\n 800: '#7E1002',\n 900: '#5A0900',\n 950: '#3D0400',\n },\n orange: {\n 50: '#FFF5ED',\n 100: '#FFE6D4',\n 200: '#FFC7A2',\n 300: '#FFA063',\n 400: '#FF7900', // pin\n 500: '#DA5F00',\n 600: '#B94A00',\n 700: '#983804',\n 800: '#6F290F',\n 900: '#4E1C0C',\n 950: '#331107',\n },\n amber: {\n 50: '#FFF7DD',\n 100: '#FFEAA9',\n 200: '#FFD352',\n 300: '#F9B415', // pin\n 400: '#E08C00',\n 500: '#C27400',\n 600: '#A45E00',\n 700: '#814D14',\n 800: '#5B3A1A',\n 900: '#442503',\n 950: '#301500',\n },\n green: {\n 50: '#E3FFEE',\n 100: '#B5FFD2',\n 200: '#58F69E',\n 300: '#2ED573', // pin\n 400: '#21C05D',\n 500: '#22A444',\n 600: '#298732',\n 700: '#2B6B25',\n 800: '#264D1C',\n 900: '#1B3515',\n 950: '#11220D',\n },\n cyan: {\n 50: '#E6FBFF',\n 100: '#C2F6FF',\n 200: '#62EAFF',\n 300: '#22D3EE', // pin\n 400: '#01B5D1',\n 500: '#2697B7',\n 600: '#307B9B',\n 700: '#2A617F',\n 800: '#22465F',\n 900: '#0B3149',\n 950: '#001F36',\n },\n blue: {\n 50: '#EFF8FF',\n 100: '#D9EFFF',\n 200: '#ACDBFF',\n 300: '#78C2FF',\n 400: '#3CA8FF',\n 500: '#2196F3', // pin\n 600: '#1072CB',\n 700: '#135AA8',\n 800: '#14407E',\n 900: '#112C5A',\n 950: '#091B3C',\n },\n magenta: {\n 50: '#FFF3F9',\n 100: '#FFE2F1',\n 200: '#FFBDE2',\n 300: '#FF8FD5',\n 400: '#ED69C3',\n 500: '#D548AF',\n 600: '#BA2996',\n 700: '#9C0D7A', // pin\n 800: '#77005A',\n 900: '#56003F',\n 950: '#3B0029',\n },\n} as const\n\n/**\n * Categorical (qualitative) palette — an ordered, CVD-safe series expressed as\n * references into {@link primitiveRamps} (one source of truth; the palette moves\n * with the ramps).\n *\n * Design: a single canonical hue order (blue, magenta, red, orange, green, cyan,\n * amber), with steps chosen vivid-midtone-first and fanned lighter/darker as the\n * series grows to preserve separation. The sequence is nested-stable — a chart\n * with N series uses the first N colors, and the series index is stable as N\n * changes. Colorblind-safe worst-case deuteranopia/protanopia floor 8 holds\n * through {@link CATEGORICAL_CVD_SAFE_MAX} colors; the 7th is an extended color\n * that should be paired with a legend or other secondary encoding.\n *\n * Two variants: `default` (vivid, sits on neutral/light surfaces, legible under\n * black text) and `dark` (deeper shades legible under white text on a fill). A\n * separate \"light\" variant was dropped — the vivid `default` picks already clear\n * black-text contrast, so it doubles as the light-context palette.\n */\nexport const categoricalPalette = {\n default: [\n primitiveRamps.blue[500],\n primitiveRamps.magenta[500],\n primitiveRamps.red[500],\n primitiveRamps.orange[400],\n primitiveRamps.green[300],\n primitiveRamps.cyan[300],\n primitiveRamps.amber[600], // extended (7th) — pair with a legend\n ],\n dark: [\n primitiveRamps.blue[600],\n primitiveRamps.magenta[600],\n primitiveRamps.red[500],\n primitiveRamps.orange[600],\n primitiveRamps.green[800],\n primitiveRamps.cyan[800],\n primitiveRamps.amber[500], // extended (7th) — pair with a legend\n ],\n} as const\n\n/** Largest series count that holds the CVD floor without a legend. */\nexport const CATEGORICAL_CVD_SAFE_MAX = 6\n\n/**\n * Categorical palette variant.\n * - `default` : vivid; neutral/light surfaces, legible under black text\n * - `dark` : deeper shades, legible under white text on a filled swatch\n */\nexport type CategoricalVariant = keyof typeof categoricalPalette\n\n/**\n * Get a color from the ordered categorical palette by series index.\n * The palette is nested-stable, so the color for a given index does not change\n * with the total series count; `index` simply wraps past the end.\n *\n * @param index - 0-based series index (wraps past the end)\n * @param variant - `default` (black-text / light surfaces) or `dark` (white text)\n * @returns The hex color string\n */\nexport function getCategoricalColor(index: number, variant: CategoricalVariant = 'default'): string {\n const palette = categoricalPalette[variant]\n index = Math.max(0, Math.floor(index))\n return palette[index % palette.length]\n}\n\n/**\n * Diverging status scale (BodyMap training-status: under → optimal → over) as\n * references into {@link primitiveRamps}. A true diverging shape — `optimal` is\n * the lightest center, the extremes go darker — so the signal reads in lightness\n * (colorblind-robust; worst-case deut/protanopia min ΔE ~10.9) and the direction\n * reads in the blue↔red axis (the CVD-safe hue pair).\n *\n * Tuned so every stop is dark enough for the fill yet light enough that BLACK\n * text clears 4.5:1 on all five — no per-cell white/black flipping. The value\n * valley is symmetric: the two mid-arms (maintenance / approaching) sit at equal\n * lightness (both ~0.53 relative luminance), the ends darker.\n */\nexport const divergingScale = [\n primitiveRamps.blue[500], // under\n primitiveRamps.cyan[300], // maintenance\n primitiveRamps.green[200], // optimal (light center)\n primitiveRamps.amber[300], // approaching\n primitiveRamps.red[600], // over\n] as const\n\n/**\n * Sequential \"effort\" scale (low → high intensity: green → yellow → orange → red)\n * as references into {@link primitiveRamps}. A 6-stop ordinal palette; the\n * velocity/RPE strip sub-samples it. Every adjacent pair clears the CVD floor\n * (min deut/protan ΔE ≥ 4.5), and within that the hue walk is kept smooth —\n * the amber-200 → amber-300 → orange-400 run steps the yellow→orange transition\n * gradually rather than lurching. Order encodes magnitude, so it tolerates the\n * green↔red CVD pair. Stops 0–3 take black text; the dark reds take white.\n */\nexport const sequentialEffort = [\n primitiveRamps.green[300],\n primitiveRamps.amber[200],\n primitiveRamps.amber[300],\n primitiveRamps.orange[400],\n primitiveRamps.red[600],\n primitiveRamps.red[700],\n] as const\n\n/**\n * Best-contrast text color (black or white) for a solid fill — for labels sitting\n * on categorical/diverging/effort swatches. Uses the WCAG relative-luminance ratio.\n */\nexport function bestTextColor(hex: string): '#000000' | '#FFFFFF' {\n const [r, g, b] = [0, 2, 4].map((i) => {\n const c = parseInt(hex.replace('#', '').slice(i, i + 2), 16) / 255\n return c >= 0.04045 ? ((c + 0.055) / 1.055) ** 2.4 : c / 12.92\n })\n const l = 0.2126 * r + 0.7152 * g + 0.0722 * b\n return (l + 0.05) / 0.05 >= 1.05 / (l + 0.05) ? '#000000' : '#FFFFFF'\n}\n\n/**\n * Discrete rainbow palette for data visualization\n * Based on Paul Tol's color schemes: https://personal.sron.nl/~pault/#fig:scheme_rainbow_discrete\n */\nexport const discreteRainbow = [\n '#E8ECFB',\n '#D9CCE3',\n '#D1BBD7',\n '#CAACCB',\n '#BA8DB4',\n '#AE76A3',\n '#AA6F9E',\n '#994F88',\n '#882E72',\n '#1965B0',\n '#437DBF',\n '#5289C7',\n '#6195CF',\n '#7BAFDE',\n '#4EB265',\n '#90C987',\n '#CAE0AB',\n '#F7F056',\n '#F7CB45',\n '#F6C141',\n '#F4A736',\n '#F1932D',\n '#EE8026',\n '#E8601C',\n '#E65518',\n '#DC050C',\n '#A5170E',\n '#72190E',\n '#42150A',\n] as const\n\n/**\n * Palette indices for discrete rainbow colors at different palette sizes.\n * For a given palette size (index + 1), returns the indices of colors to use.\n */\nconst discreteRainbowPalettes: number[][] = [\n [10],\n [10, 26],\n [10, 18, 26],\n [10, 15, 18, 26],\n [10, 14, 15, 18, 26],\n [10, 14, 15, 17, 18, 26],\n [9, 10, 14, 15, 17, 18, 26],\n [9, 10, 14, 15, 17, 18, 23, 26],\n [9, 10, 14, 15, 17, 18, 23, 26, 28],\n [9, 10, 14, 15, 17, 18, 21, 24, 26, 28],\n [9, 10, 12, 14, 15, 17, 18, 21, 24, 26, 28],\n [3, 6, 9, 10, 12, 14, 15, 17, 18, 21, 24, 26],\n [3, 6, 9, 10, 12, 14, 15, 16, 17, 18, 21, 24, 26],\n [3, 6, 9, 10, 12, 14, 15, 16, 17, 18, 20, 22, 24, 26],\n [3, 6, 9, 10, 12, 14, 15, 16, 17, 18, 20, 22, 24, 26, 28],\n [3, 5, 7, 9, 10, 12, 14, 15, 16, 17, 18, 20, 22, 24, 26, 28],\n [3, 5, 7, 8, 9, 10, 12, 14, 15, 16, 17, 18, 20, 22, 24, 26, 28],\n [3, 5, 7, 8, 9, 10, 12, 14, 15, 16, 17, 18, 20, 22, 24, 26, 27, 28],\n [2, 4, 5, 7, 8, 9, 10, 12, 14, 15, 16, 17, 18, 20, 22, 24, 26, 27, 28],\n [2, 4, 5, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 20, 22, 24, 26, 27, 28],\n [2, 4, 5, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 21, 23, 25, 26, 27, 28],\n [2, 4, 5, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 21, 23, 25, 26, 27, 28, 29],\n [1, 2, 4, 5, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 21, 23, 25, 26, 27, 28, 29],\n]\n\n/**\n * Get a color from the discrete rainbow palette for a given index and palette size.\n * Colors are optimized for visual distinction at each palette size.\n *\n * @param index - The index of the color in the series (0-based)\n * @param size - The total number of colors needed (1-23)\n * @returns The hex color string\n */\nexport function getDiscreteRainbowColor(index: number, size: number): string {\n index = Math.max(0, index)\n size = Math.min(Math.max(1, size), discreteRainbowPalettes.length)\n\n const palette = discreteRainbowPalettes[size - 1]\n if (index >= palette.length) index = index % palette.length\n\n return discreteRainbow[palette[index] - 1]\n}\n\nexport const primitiveTypography = {\n fontFamilies: {\n sans: ['Inter', '-apple-system', 'BlinkMacSystemFont', 'Segoe UI', 'Helvetica', 'Arial', 'sans-serif'],\n body: ['Nunito Sans', 'sans-serif'],\n heading: ['Space Grotesk', 'sans-serif'],\n mono: ['SF Mono', 'Monaco', 'Inconsolata', 'Fira Mono', 'Droid Sans Mono', 'Source Code Pro', 'monospace'],\n },\n fontSizes: {\n xs: '0.75rem', // 12px\n sm: '0.875rem', // 14px\n base: '1rem', // 16px\n lg: '1.125rem', // 18px\n xl: '1.5rem', // 24px\n '2xl': '2rem', // 32px\n '3xl': '2.25rem', // 36px\n '4xl': '3rem', // 48px\n '5xl': '3.5rem', // 56px\n },\n fontWeights: {\n normal: 400,\n medium: 500,\n semibold: 600,\n bold: 700,\n },\n lineHeights: {\n none: 1,\n tight: 1.375,\n snug: 1.5,\n normal: 1.57,\n relaxed: 1.66,\n loose: 1.75,\n },\n letterSpacing: {\n tighter: '-0.05em',\n tight: '-0.025em',\n normal: '0em',\n wide: '0.025em',\n wider: '0.05em',\n widest: '0.5px',\n },\n} as const\n\nexport const primitiveSpacing = {\n 0: '0',\n px: '1px',\n 0.5: '0.125rem', // 2px\n 1: '0.25rem', // 4px\n 1.5: '0.375rem', // 6px\n 2: '0.5rem', // 8px\n 2.5: '0.625rem', // 10px\n 3: '0.75rem', // 12px\n 3.5: '0.875rem', // 14px\n 4: '1rem', // 16px\n 5: '1.25rem', // 20px\n 6: '1.5rem', // 24px\n 7: '1.75rem', // 28px\n 8: '2rem', // 32px\n 9: '2.25rem', // 36px\n 10: '2.5rem', // 40px\n 11: '2.75rem', // 44px\n 12: '3rem', // 48px\n 14: '3.5rem', // 56px\n 16: '4rem', // 64px\n 20: '5rem', // 80px\n 24: '6rem', // 96px\n 28: '7rem', // 112px\n 32: '8rem', // 128px\n} as const\n\nexport const primitiveBorderRadius = {\n none: '0',\n sm: '4px',\n DEFAULT: '8px',\n md: '8px',\n lg: '12px',\n xl: '16px',\n '2xl': '24px',\n full: '9999px',\n} as const\n\nexport const primitiveShadows = {\n none: 'none',\n sm: '0px 1px 2px rgba(100, 116, 139, 0.12)',\n DEFAULT: '0px 1px 3px rgba(100, 116, 139, 0.12), 0px 1px 2px rgba(100, 116, 139, 0.24)',\n md: '0px 4px 6px rgba(100, 116, 139, 0.12)',\n lg: '0px 10px 15px rgba(100, 116, 139, 0.12)',\n xl: '0px 20px 25px rgba(100, 116, 139, 0.12)',\n '2xl': '0px 25px 50px rgba(100, 116, 139, 0.25)',\n inner: 'inset 0 2px 4px 0 rgba(0, 0, 0, 0.06)',\n} as const\n\nexport const primitiveBreakpoints = {\n xs: 0,\n sm: 600,\n md: 1000,\n lg: 1200,\n xl: 1920,\n} as const\n\nexport const primitiveZIndex = {\n hide: -1,\n auto: 'auto',\n base: 0,\n docked: 10,\n dropdown: 1000,\n sticky: 1100,\n drawer: 1100,\n banner: 1200,\n appBar: 1200,\n overlay: 1300,\n modal: 1400,\n popover: 1500,\n skipLink: 1600,\n toast: 1700,\n tooltip: 1800,\n} as const\n","/**\n * Workout-specific tokens not yet in the main Tailwind config.\n * Use these inline instead of Tailwind classes.\n */\nimport { divergingScale, sequentialEffort, primitiveRamps as ramp } from './tokens/primitives'\n\nexport const WORKOUT_TOKENS = {\n // Canonical 4-band performance scale — the single source for BOTH the\n // VelocityStrip zone bars and the SetRow RPE color (TD-03.43). The direction\n // is intentionally inverted between the two consumers: for velocity, green =\n // fastest/best; for RPE, green = easiest. This is the [0,2,3,4] subsample of\n // the canonical `sequentialEffort` primitive: an EVEN hue walk across the ramp\n // (green → gold → orange → red). The earlier [0,1,2,4] spent two of its four\n // bands on adjacent yellows (amber-200 + amber-300) and skipped orange, reading\n // yellow-heavy with an abrupt jump to red; sampling amber-300 + orange-400\n // instead gives four cleanly separable bands that hold at 3px strip scale.\n // Consumed inline (RN).\n scale: {\n green: sequentialEffort[0], // green-300\n yellow: sequentialEffort[2], // amber-300 (gold)\n orange: sequentialEffort[3], // orange-400 (true orange)\n red: sequentialEffort[4], // red-600\n },\n\n // BodyMap volume heatmap — the canonical `divergingScale` (under → optimal →\n // over): a true diverging shape with a light green center, cool-blue under-\n // trained end and warm-red over-reaching end (colorblind-robust in lightness).\n heatmap: {\n none: '#E0E0E0', // no training data\n under: divergingScale[0], // below MEV\n maintenance: divergingScale[1], // MEV to MAV\n productive: divergingScale[2], // optimal center — MAV to MRV\n approaching: divergingScale[3], // near MRV\n over: divergingScale[4], // over MRV\n },\n\n // Badge border-radius (rounded-sm is 4px, we need 2px)\n badgeRadius: 2,\n\n // Surface and border colors were removed here: those flip with the theme, so\n // components use the CSS custom properties (var(--color-surface-*/border-*))\n // directly. Only theme-independent data-viz values remain below.\n\n // Intensity bar specific — over-target tiers deepen along the red ramp.\n intensity: {\n track: '#333333',\n over1: ramp.red[600], // matches status-error\n over2: ramp.red[700],\n over3: ramp.red[800],\n targetLine: 'rgba(33, 150, 243, 0.5)',\n atTargetGlow:\n '0 0 5px 1px rgba(33, 150, 243, 0.35), 0 0 10px 3px rgba(33, 150, 243, 0.15)',\n },\n\n // Placeholder strip\n placeholder: {\n fill: '#3A3A3A',\n },\n\n // Deviation bar\n deviation: {\n track: '#333333',\n },\n} as const\n","/**\n * Semantic Design Tokens\n *\n * Meaningful tokens following DTCG (Design Tokens Community Group) naming conventions.\n * Pattern: {category}-{intent}-{variant?}-{state?}\n *\n * Categories:\n * - brand-* : Brand colors (primary, secondary, accent)\n * - status-* : Feedback colors (success, error, warning, info)\n * - result-* : Outcome indicators (improve, degrade, inconclusive, neutral)\n * - data-* : Data visualization colors (chart series)\n * - on-* : Text on colored backgrounds\n * - surface-* : Elevated containers (NOT \"paper\")\n * - background-* : Page backgrounds\n * - text-* : Text colors\n * - border-* : Border colors\n * - interactive-* : Hover/focus/active/disabled states\n */\n\nimport {\n primitiveColors as p,\n primitiveRamps as ramp,\n discreteRainbow,\n surfaceRampDark as surf,\n backgroundFrameDark,\n} from './primitives'\n\n// Light mode semantic colors (default)\nexport const semanticColorsLight = {\n // Brand colors (brand-*)\n 'brand-primary': ramp.orange[400],\n 'brand-primary-light': ramp.orange[300],\n 'brand-primary-dark': ramp.orange[500],\n 'brand-primary-subtle': 'rgba(255, 121, 0, 0.08)',\n 'brand-primary-hover': ramp.orange[500],\n 'brand-primary-active': ramp.orange[600],\n\n 'brand-secondary': ramp.cyan[600],\n 'brand-secondary-light': ramp.cyan[500],\n 'brand-secondary-dark': ramp.cyan[700],\n 'brand-secondary-subtle': 'rgba(48, 123, 155, 0.08)',\n 'brand-secondary-hover': ramp.cyan[700],\n 'brand-secondary-active': ramp.cyan[800],\n\n // Text on brand backgrounds (on-*)\n 'on-brand-primary': p.white,\n 'on-brand-secondary': p.white,\n\n // Status colors (status-*)\n 'status-success': ramp.green[300],\n 'status-success-light': ramp.green[200],\n 'status-success-dark': ramp.green[600],\n 'status-success-subtle': ramp.green[50],\n\n // Live-session accent — its OWN role, decoupled from success so the two can diverge\n 'status-live': ramp.green[300],\n 'status-live-muted': ramp.green[500],\n\n 'status-error': ramp.red[600],\n 'status-error-light': ramp.red[500],\n 'status-error-dark': ramp.red[700],\n 'status-error-subtle': ramp.red[50],\n\n 'status-error-vivid': p.redVivid[500], // vivid alert red\n 'status-error-vivid-light': p.redVivid[400],\n 'status-error-vivid-dark': p.redVivid[700],\n 'status-error-vivid-subtle': 'rgba(255, 71, 87, 0.12)',\n\n 'status-warning': ramp.amber[300],\n 'status-warning-light': ramp.amber[200],\n 'status-warning-dark': ramp.amber[500],\n 'status-warning-subtle': ramp.amber[50],\n\n 'status-info': ramp.blue[500],\n 'status-info-light': ramp.blue[300],\n 'status-info-dark': ramp.blue[600],\n 'status-info-subtle': ramp.blue[50],\n\n // Text on status backgrounds (on-status-*)\n 'on-status-success': p.white,\n 'on-status-error': p.white,\n 'on-status-warning': p.white,\n 'on-status-info': p.white,\n\n // Result/outcome indicators (result-*)\n 'result-improve': '#4caf50', // Green - positive outcome\n 'result-improve-light': 'rgba(76, 175, 80, 0.12)',\n 'result-improve-dark': '#248a24',\n 'result-degrade': '#ef5350', // Red - negative outcome\n 'result-degrade-light': 'rgba(239, 83, 80, 0.12)',\n 'result-degrade-dark': '#b30000',\n 'result-inconclusive': '#9E9A97', // Gray - no clear result\n 'result-inconclusive-light': 'rgba(158, 154, 151, 0.12)',\n 'result-neutral': p.neutral[500], // Neutral baseline\n\n // Text on result backgrounds (on-result-*)\n 'on-result-improve': p.white,\n 'on-result-degrade': p.white,\n 'on-result-inconclusive': p.white,\n\n // Data visualization colors (data-*)\n // First 10 colors from discrete rainbow optimized for charts\n 'data-1': discreteRainbow[9], // Blue\n 'data-2': discreteRainbow[14], // Green\n 'data-3': discreteRainbow[17], // Yellow\n 'data-4': discreteRainbow[25], // Red\n 'data-5': discreteRainbow[8], // Purple\n 'data-6': discreteRainbow[20], // Orange\n 'data-7': discreteRainbow[13], // Light Blue\n 'data-8': discreteRainbow[15], // Light Green\n 'data-9': discreteRainbow[3], // Lavender\n 'data-10': discreteRainbow[22], // Dark Orange\n\n // Text colors (text-*)\n 'text-primary': '#121828',\n 'text-secondary': '#65748B',\n 'text-tertiary': p.neutral[400],\n 'text-disabled': 'rgba(55, 65, 81, 0.48)',\n 'text-inverse': p.white,\n 'text-link': p.blue[600],\n 'text-link-hover': p.blue[700],\n\n // Surface colors (surface-*) - for elevated containers\n 'surface-base': p.white,\n 'surface-elevated': p.neutral[50], // slightly off-white for elevated cards\n 'surface-raised': p.neutral[100], // light gray for raised cards\n 'surface-overlay': p.white,\n 'surface-input': p.neutral[50], // Input field background (filled variant)\n // Deepest pressed pit (TD-surface-tokens, S-3) — light-mode counterpart of\n // the dark ramp's `inset` plane; a placeholder pairing, not part of the\n // dark-ramp investigation (surface.contract.test.ts is dark-mode only).\n 'surface-inset': p.neutral[300],\n\n // Background colors (background-*)\n 'background-base': '#EBEBEB',\n 'background-default': p.white,\n 'background-subtle': p.neutral[50],\n // Frame/bezel chrome (TD-surface-tokens, S-3) — top bar + side nav shell,\n // one step below `background-base` (darker still than `surface-inset`\n // above, mirroring the dark-mode ordering). Placeholder pairing for light\n // mode (see dark-mode note on `surface-inset` above).\n 'background-frame': p.neutral[400],\n\n // Border colors (border-*)\n 'border-default': '#E8E9EB',\n 'border-subtle': p.neutral[100],\n 'border-strong': p.neutral[300],\n 'border-prominent': p.neutral[400], // high-visibility divider\n 'border-focus': p.blue[600],\n 'border-input': p.neutral[300], // Input field border\n 'border-input-hover': p.neutral[400], // Input field border on hover\n 'border-input-focus': p.blue[600], // Input field border on focus\n 'border-input-error': p.red[600], // Input field border on error\n\n // Alpha hairline separators (surface-independent — composite toward black on\n // light surfaces, mirroring the dark-mode white-alpha family). See §4/S-2.\n 'hairline-subtle': 'rgba(0, 0, 0, 0.06)',\n 'hairline-default': 'rgba(0, 0, 0, 0.09)',\n 'hairline-strong': 'rgba(0, 0, 0, 0.14)',\n\n // Interactive states (interactive-*)\n 'interactive-hover': 'rgba(55, 65, 81, 0.04)',\n 'interactive-focus': 'rgba(55, 65, 81, 0.12)',\n 'interactive-active': 'rgba(55, 65, 81, 0.16)',\n 'interactive-selected': 'rgba(55, 65, 81, 0.08)',\n 'interactive-disabled': 'rgba(55, 65, 81, 0.12)',\n 'interactive-disabled-text': 'rgba(55, 65, 81, 0.26)',\n\n // Divider\n 'divider': '#E8E9EB',\n\n // Avatar default\n 'avatar-background': p.neutral[500],\n 'avatar-text': p.white,\n} as const\n\n// Dark mode semantic colors\nexport const semanticColorsDark = {\n // Brand colors stay the same in dark mode\n 'brand-primary': ramp.orange[400],\n 'brand-primary-light': ramp.orange[300],\n 'brand-primary-dark': ramp.orange[500],\n 'brand-primary-subtle': 'rgba(255, 121, 0, 0.12)',\n 'brand-primary-hover': ramp.orange[300],\n 'brand-primary-active': ramp.orange[200],\n\n 'brand-secondary': ramp.cyan[600],\n 'brand-secondary-light': ramp.cyan[500],\n 'brand-secondary-dark': ramp.cyan[700],\n 'brand-secondary-subtle': 'rgba(48, 123, 155, 0.12)',\n 'brand-secondary-hover': ramp.cyan[500],\n 'brand-secondary-active': ramp.cyan[400],\n\n // Text on brand backgrounds\n 'on-brand-primary': p.white,\n 'on-brand-secondary': p.white,\n\n // Status colors\n 'status-success': ramp.green[300],\n 'status-success-light': ramp.green[200],\n 'status-success-dark': ramp.green[600],\n 'status-success-subtle': 'rgba(46, 213, 115, 0.12)',\n\n // Live-session accent — its OWN role, decoupled from success so the two can diverge\n 'status-live': ramp.green[300],\n 'status-live-muted': ramp.green[500],\n\n 'status-error': ramp.red[600],\n 'status-error-light': ramp.red[500],\n 'status-error-dark': ramp.red[700],\n 'status-error-subtle': 'rgba(209, 67, 67, 0.12)',\n\n 'status-error-vivid': p.redVivid[500],\n 'status-error-vivid-light': p.redVivid[400],\n 'status-error-vivid-dark': p.redVivid[700],\n 'status-error-vivid-subtle': 'rgba(255, 71, 87, 0.12)',\n\n 'status-warning': ramp.amber[300],\n 'status-warning-light': ramp.amber[200],\n 'status-warning-dark': ramp.amber[500],\n 'status-warning-subtle': 'rgba(249, 180, 21, 0.12)',\n\n 'status-info': ramp.blue[500],\n 'status-info-light': ramp.blue[300],\n 'status-info-dark': ramp.blue[600],\n 'status-info-subtle': 'rgba(33, 150, 243, 0.12)',\n\n // Text on status backgrounds\n 'on-status-success': p.white,\n 'on-status-error': p.white,\n 'on-status-warning': p.white,\n 'on-status-info': p.white,\n\n // Result/outcome indicators (result-*)\n 'result-improve': '#4caf50',\n 'result-improve-light': 'rgba(76, 175, 80, 0.16)',\n 'result-improve-dark': '#248a24',\n 'result-degrade': '#ef5350',\n 'result-degrade-light': 'rgba(239, 83, 80, 0.16)',\n 'result-degrade-dark': '#b30000',\n 'result-inconclusive': '#9E9A97',\n 'result-inconclusive-light': 'rgba(158, 154, 151, 0.16)',\n 'result-neutral': p.neutral[400],\n\n // Text on result backgrounds\n 'on-result-improve': p.white,\n 'on-result-degrade': p.white,\n 'on-result-inconclusive': p.white,\n\n // Data visualization colors (same in dark mode for consistency)\n 'data-1': discreteRainbow[9],\n 'data-2': discreteRainbow[14],\n 'data-3': discreteRainbow[17],\n 'data-4': discreteRainbow[25],\n 'data-5': discreteRainbow[8],\n 'data-6': discreteRainbow[20],\n 'data-7': discreteRainbow[13],\n 'data-8': discreteRainbow[15],\n 'data-9': discreteRainbow[3],\n 'data-10': discreteRainbow[22],\n\n // Text colors - inverted for dark mode\n 'text-primary': p.neutral[100],\n 'text-secondary': p.neutral[400],\n 'text-tertiary': p.neutral[500],\n 'text-disabled': 'rgba(255, 255, 255, 0.38)',\n 'text-inverse': p.neutral[900],\n 'text-link': '#828DF8',\n 'text-link-hover': p.blue[400],\n\n // Surface colors - dark backgrounds — warm-tapered DERIVED ramp (TD-surface-tokens,\n // S-1, re-spaced S-3). Shipped verbatim from `deriveSurfaceRamp()` — see\n // `surfaceRampDark` in primitives.ts for the full derivation note. `surface-overlay`\n // and `surface-elevated` are distinct (were both #191919 pre-S-1); `surface-input`\n // tracks one plane above `surface-base`, same relative position as before the remap.\n // `background-base` backs `Surface level=\"background\"` (SurfaceContext.SURFACE_LEVEL_TOKEN),\n // so it takes the ramp's `background` (shell/frame) role, NOT `inset`. The ramp's\n // deepest `inset` plane is now promoted to `surface-inset` below (S-3) — still no\n // `SurfaceLevel` member for it (follow-up, alongside the elevation.ts -1/-2 pressed\n // levels — parallel workstream, not this branch).\n 'surface-base': surf.base, // main surface (#252321, L*13.5)\n 'surface-elevated': surf.elevated, // elevated surface (#2C2A28, L*17 — nav/rail)\n 'surface-raised': surf.raised, // raised surface (#31302F, L*20 — cards)\n 'surface-overlay': surf.overlay, // overlay surface (#373635, L*22.5 — hero/popover)\n 'surface-input': surf.elevated, // input surface (#2C2A28 — one plane above base)\n 'surface-inset': surf.inset, // deepest pressed pit (#13100D, L*4.5 — sub-shell well)\n\n // Background colors — same ramp, the frame/shell end of it.\n 'background-base': surf.background, // shell / frame (#1C1916, L*9 — Surface level=\"background\")\n 'background-default': surf.base, // main background (#252321, L*13.5 — matches surface-base)\n 'background-subtle': surf.elevated, // subtle background (#2C2A28, L*17 — matches surface-elevated)\n // Frame/bezel chrome (S-3) — the top bar + side nav shell; one step BELOW\n // `background-base`, darker even than `surface-inset` — it exits the content\n // ramp entirely rather than sitting in it. See `backgroundFrameDark` in\n // primitives.ts.\n 'background-frame': backgroundFrameDark, // frame / bezel (#100D0A, L*3.79)\n\n // Border colors — `border-subtle` (#1C1C1C) previously collided with\n // `surface-raised` (also #1C1C1C, an invisible border on raised cards). The\n // re-spaced ramp above moved `surface-raised` to #2D2C2B, so this value is now\n // distinct from every surface hex without needing to change it — see\n // `surface.contract.test.ts` R2/R4.\n 'border-default': p.charcoal[400], // default border\n 'border-subtle': p.charcoal[500], // subtle border\n 'border-strong': p.charcoal[300], // strong border\n 'border-prominent': p.charcoal[200], // high-visibility divider\n 'border-focus': '#828DF8',\n 'border-input': p.neutral[600],\n 'border-input-hover': p.neutral[500],\n 'border-input-focus': '#828DF8',\n 'border-input-error': p.red[500],\n\n // Alpha hairline separators — the primary separation cue (§4/S-2). Self-\n // normalizing: composites toward white by ~the same amount on ANY plane, so\n // one family works at every elevation instead of per-surface border tokens.\n // Shadows are demoted to floating-overlay use only (not shipped as a fill\n // separator here — see elevation.ts, follow-up S-4).\n 'hairline-subtle': 'rgba(255, 255, 255, 0.06)',\n 'hairline-default': 'rgba(255, 255, 255, 0.09)',\n 'hairline-strong': 'rgba(255, 255, 255, 0.14)',\n\n // Interactive states\n 'interactive-hover': 'rgba(255, 255, 255, 0.04)',\n 'interactive-focus': 'rgba(255, 255, 255, 0.12)',\n 'interactive-active': 'rgba(255, 255, 255, 0.16)',\n 'interactive-selected': 'rgba(255, 255, 255, 0.08)',\n 'interactive-disabled': 'rgba(255, 255, 255, 0.12)',\n 'interactive-disabled-text': 'rgba(255, 255, 255, 0.26)',\n\n // Divider\n 'divider': p.charcoal[400], // divider color\n\n // Avatar default\n 'avatar-background': p.neutral[600],\n 'avatar-text': p.white,\n} as const\n\n// Typography tokens matching existing app\nexport const semanticTypography = {\n // Headings (Space Grotesk)\n h1: {\n fontFamily: 'heading',\n fontSize: '3.5rem',\n fontWeight: 700,\n lineHeight: 1.375,\n },\n h2: {\n fontFamily: 'heading',\n fontSize: '3rem',\n fontWeight: 700,\n lineHeight: 1.375,\n },\n h3: {\n fontFamily: 'heading',\n fontSize: '2.25rem',\n fontWeight: 700,\n lineHeight: 1.375,\n },\n h4: {\n fontFamily: 'heading',\n fontSize: '2rem',\n fontWeight: 700,\n lineHeight: 1.375,\n },\n h5: {\n fontFamily: 'heading',\n fontSize: '1.5rem',\n fontWeight: 600,\n lineHeight: 1.375,\n },\n h6: {\n fontFamily: 'heading',\n fontSize: '1.125rem',\n fontWeight: 600,\n lineHeight: 1.375,\n },\n\n // Body text (Nunito Sans)\n body1: {\n fontFamily: 'body',\n fontSize: '1rem',\n fontWeight: 400,\n lineHeight: 1.5,\n },\n body2: {\n fontFamily: 'body',\n fontSize: '0.875rem',\n fontWeight: 400,\n lineHeight: 1.57,\n },\n subtitle1: {\n fontFamily: 'body',\n fontSize: '1rem',\n fontWeight: 500,\n lineHeight: 1.75,\n },\n subtitle2: {\n fontFamily: 'body',\n fontSize: '0.875rem',\n fontWeight: 500,\n lineHeight: 1.57,\n },\n caption: {\n fontFamily: 'body',\n fontSize: '0.75rem',\n fontWeight: 400,\n lineHeight: 1.66,\n },\n overline: {\n fontFamily: 'body',\n fontSize: '0.75rem',\n fontWeight: 600,\n lineHeight: 2.5,\n letterSpacing: '0.5px',\n textTransform: 'uppercase' as const,\n },\n button: {\n fontFamily: 'sans',\n fontSize: '0.875rem',\n fontWeight: 600,\n lineHeight: 1.75,\n },\n} as const\n\n// Button size tokens\nexport const buttonSizes = {\n sm: {\n paddingX: '16px',\n paddingY: '6px',\n fontSize: '0.875rem',\n },\n md: {\n paddingX: '20px',\n paddingY: '8px',\n fontSize: '0.875rem',\n },\n lg: {\n paddingX: '24px',\n paddingY: '11px',\n fontSize: '1rem',\n },\n} as const\n\n// Export type for theme mode\nexport type ThemeMode = 'light' | 'dark'\n\n// Helper to get semantic colors based on mode\nexport function getSemanticColors(mode: ThemeMode) {\n return mode === 'dark' ? semanticColorsDark : semanticColorsLight\n}\n","/**\n * Neumorphic Shadow Utilities\n * \n * Neumorphism creates soft, extruded UI using dual opposing shadows.\n * - Light source assumed from top-left\n * - Raised elements: dark shadow bottom-right, light highlight top-left\n * - Pressed elements: inverted with `inset` shadows\n */\n\nimport { Platform, type ViewStyle } from 'react-native'\n\n// ============================================================================\n// Color Math Utilities\n// ============================================================================\n\n/**\n * Parse a hex color to RGB values (0-255).\n * Supports both #RGB and #RRGGBB formats.\n */\nexport function hexToRgb(hex: string): { r: number; g: number; b: number } | null {\n const cleaned = hex.replace('#', '')\n \n let r: number, g: number, b: number\n \n if (cleaned.length === 3) {\n r = parseInt(cleaned[0] + cleaned[0], 16)\n g = parseInt(cleaned[1] + cleaned[1], 16)\n b = parseInt(cleaned[2] + cleaned[2], 16)\n } else if (cleaned.length === 6) {\n r = parseInt(cleaned.slice(0, 2), 16)\n g = parseInt(cleaned.slice(2, 4), 16)\n b = parseInt(cleaned.slice(4, 6), 16)\n } else {\n return null\n }\n \n return { r, g, b }\n}\n\n/**\n * Convert RGB (0-255) to HSV (h: 0-360, s: 0-1, v: 0-1).\n */\nexport function rgbToHsv(r: number, g: number, b: number): { h: number; s: number; v: number } {\n const rNorm = r / 255\n const gNorm = g / 255\n const bNorm = b / 255\n \n const max = Math.max(rNorm, gNorm, bNorm)\n const min = Math.min(rNorm, gNorm, bNorm)\n const delta = max - min\n \n // Value\n const v = max\n \n // Saturation\n const s = max === 0 ? 0 : delta / max\n \n // Hue\n let h = 0\n if (delta !== 0) {\n if (max === rNorm) {\n h = 60 * (((gNorm - bNorm) / delta) % 6)\n } else if (max === gNorm) {\n h = 60 * ((bNorm - rNorm) / delta + 2)\n } else {\n h = 60 * ((rNorm - gNorm) / delta + 4)\n }\n }\n if (h < 0) h += 360\n \n return { h, s, v }\n}\n\n/**\n * Convert HSV (h: 0-360, s: 0-1, v: 0-1) to RGB (0-255).\n */\nexport function hsvToRgb(h: number, s: number, v: number): { r: number; g: number; b: number } {\n const c = v * s\n const x = c * (1 - Math.abs((h / 60) % 2 - 1))\n const m = v - c\n \n let rPrime: number, gPrime: number, bPrime: number\n\n if (h >= 0 && h < 60) {\n rPrime = c; gPrime = x; bPrime = 0\n } else if (h >= 60 && h < 120) {\n rPrime = x; gPrime = c; bPrime = 0\n } else if (h >= 120 && h < 180) {\n rPrime = 0; gPrime = c; bPrime = x\n } else if (h >= 180 && h < 240) {\n rPrime = 0; gPrime = x; bPrime = c\n } else if (h >= 240 && h < 300) {\n rPrime = x; gPrime = 0; bPrime = c\n } else {\n rPrime = c; gPrime = 0; bPrime = x\n }\n \n return {\n r: Math.round((rPrime + m) * 255),\n g: Math.round((gPrime + m) * 255),\n b: Math.round((bPrime + m) * 255),\n }\n}\n\n/**\n * Convert RGB values to hex string.\n */\nexport function rgbToHex(r: number, g: number, b: number): string {\n const toHex = (n: number) => {\n const clamped = Math.max(0, Math.min(255, Math.round(n)))\n return clamped.toString(16).padStart(2, '0')\n }\n return `#${toHex(r)}${toHex(g)}${toHex(b)}`\n}\n\n/**\n * Lighten a color by increasing its HSV Value component.\n * \n * @param hex - The hex color to lighten\n * @param amount - Amount to increase V by (0-1)\n */\nexport function lighten(hex: string, amount: number = 0.1): string {\n const rgb = hexToRgb(hex)\n if (!rgb) return hex\n \n const hsv = rgbToHsv(rgb.r, rgb.g, rgb.b)\n const newV = Math.min(1, hsv.v + amount)\n \n const newRgb = hsvToRgb(hsv.h, hsv.s, newV)\n return rgbToHex(newRgb.r, newRgb.g, newRgb.b)\n}\n\n/**\n * Darken a color by decreasing its HSV Value component.\n * \n * @param hex - The hex color to darken\n * @param amount - Amount to decrease V by (0-1)\n */\nexport function darken(hex: string, amount: number = 0.1): string {\n const rgb = hexToRgb(hex)\n if (!rgb) return hex\n \n const hsv = rgbToHsv(rgb.r, rgb.g, rgb.b)\n const newV = Math.max(0, hsv.v - amount)\n \n const newRgb = hsvToRgb(hsv.h, hsv.s, newV)\n return rgbToHex(newRgb.r, newRgb.g, newRgb.b)\n}\n\n/**\n * Get hover colors for a button based on its background color.\n * Automatically adapts intensity based on the color's luminance.\n * \n * @param bgColor - The button's background color (hex)\n * @param intensity - How strong the hover effect should be ('subtle' | 'medium' | 'strong')\n */\nexport function getHoverColors(\n bgColor: string, \n intensity: 'subtle' | 'medium' | 'strong' = 'medium'\n): { raised: string; pressed: string } {\n const amounts = {\n subtle: 0.01,\n medium: 0.02,\n strong: 0.03,\n }\n \n const amount = amounts[intensity]\n \n return {\n raised: lighten(bgColor, amount), // Raised hover: lighten (lifting up)\n pressed: darken(bgColor, amount), // Pressed hover: darken (pressing down)\n }\n}\n\n/**\n * Check if a color is considered \"dark\" (for choosing text color).\n * Uses HSV Value component for simplicity.\n */\nexport function isDark(hex: string): boolean {\n const rgb = hexToRgb(hex)\n if (!rgb) return true\n const hsv = rgbToHsv(rgb.r, rgb.g, rgb.b)\n return hsv.v < 0.6\n}\n\n/**\n * Shadow configuration for different surface colors.\n * Each surface needs calibrated light/dark shadow colors.\n * \n * - dark: soft shadow for depth (bottom-right)\n * - light: sharp rim highlight (top-left) - higher opacity for crisp edge\n * - darker: deeper shadow for pressed/inset states\n */\nexport const shadowColors = {\n // For charcoal surfaces (~#2C2C2C to #3C3C3C)\n charcoal: {\n dark: 'rgba(0, 0, 0, 0.5)',\n light: 'rgba(255, 255, 255, 0.12)', // brighter for crisp rim light\n darker: 'rgba(0, 0, 0, 0.6)',\n },\n // For neutral dark surfaces (~#1F2937)\n neutralDark: {\n dark: 'rgba(0, 0, 0, 0.4)',\n light: 'rgba(255, 255, 255, 0.08)',\n darker: 'rgba(0, 0, 0, 0.5)',\n },\n // For light surfaces (white/light gray backgrounds)\n neutralLight: {\n dark: 'rgba(0, 0, 0, 0.15)', // Visible dark shadow for depth on light backgrounds\n light: 'rgba(255, 255, 255, 1)', // Bright highlight for raised effect (visible on light gray)\n darker: 'rgba(0, 0, 0, 0.2)', // Deeper shadow for pressed states\n },\n}\n\nexport type ShadowIntensity = 'subtle' | 'medium' | 'strong'\nexport type ShadowSurface = keyof typeof shadowColors\n\ninterface ShadowConfig {\n offset: number\n blur: number\n}\n\nconst intensityConfig: Record<ShadowIntensity, ShadowConfig> = {\n subtle: { offset: 1, blur: 2 }, // very light, barely visible\n medium: { offset: 2, blur: 4 }, // noticeable but restrained\n strong: { offset: 2, blur: 5 }, // slightly deeper blur, same offset as medium\n}\n\n/**\n * Creates a raised (elevated) neumorphic shadow.\n * Element appears to float above the surface.\n * \n * Uses a soft dark shadow (bottom-right) and a sharp rim light (top-left).\n */\nexport function createRaisedShadow(\n surface: ShadowSurface = 'charcoal',\n intensity: ShadowIntensity = 'medium'\n): ViewStyle {\n const colors = shadowColors[surface]\n const { offset, blur } = intensityConfig[intensity]\n \n // Rim light is sharper: same offset as shadow, but minimal blur for crisp edge\n const rimBlur = 1 // Very tight blur for crisp rim\n \n return Platform.select({\n web: {\n boxShadow: `${offset}px ${offset}px ${blur}px ${colors.dark}, -${offset}px -${offset}px ${rimBlur}px ${colors.light}`,\n } as any,\n default: {\n // React Native shadow approximation (limited compared to web)\n shadowColor: '#000',\n shadowOffset: { width: offset, height: offset },\n shadowOpacity: 0.3,\n shadowRadius: blur / 2,\n elevation: offset,\n },\n }) as ViewStyle\n}\n\n/**\n * Creates a pressed (inset) neumorphic shadow.\n * Element appears pushed into the surface.\n * \n * Uses a soft dark inset shadow (top-left) and a thin sharp rim light (bottom-right).\n */\nexport function createPressedShadow(\n surface: ShadowSurface = 'charcoal',\n intensity: ShadowIntensity = 'medium'\n): ViewStyle {\n const colors = shadowColors[surface]\n const { offset, blur } = intensityConfig[intensity]\n \n // Rim light is always thin and subtle for pressed states\n const rimOffset = 1 // Fixed thin rim\n const rimBlur = 1 // Very tight blur for crisp edge\n \n return Platform.select({\n web: {\n boxShadow: `inset ${offset}px ${offset}px ${blur}px ${colors.darker}, inset -${rimOffset}px -${rimOffset}px ${rimBlur}px ${colors.light}`,\n } as any,\n default: {\n // React Native doesn't support inset shadows, approximate with darker bg\n shadowOpacity: 0,\n elevation: 0,\n },\n }) as ViewStyle\n}\n\n/**\n * Creates a flat (no shadow) style for hover states.\n */\nexport function createFlatShadow(): ViewStyle {\n return Platform.select({\n web: {\n boxShadow: 'none',\n } as any,\n default: {\n shadowOpacity: 0,\n elevation: 0,\n },\n }) as ViewStyle\n}\n\n/**\n * Creates a hover shadow for raised elements.\n * Reduces shadow depth but keeps a subtle rim light to maintain visual boundary.\n */\nexport function createRaisedHoverShadow(\n surface: ShadowSurface = 'charcoal',\n intensity: ShadowIntensity = 'medium'\n): ViewStyle {\n const colors = shadowColors[surface]\n const { offset, blur } = intensityConfig[intensity]\n \n // Reduce shadow depth by half for hover, keep minimal rim light\n const hoverOffset = Math.max(1, Math.round(offset / 2))\n const hoverBlur = Math.max(1, Math.round(blur / 2))\n const rimBlur = 1\n \n return Platform.select({\n web: {\n // Keep same offsets as normal state for rim to prevent \"shrinking\" effect\n boxShadow: `${hoverOffset}px ${hoverOffset}px ${hoverBlur}px ${colors.dark}, -${offset}px -${offset}px ${rimBlur}px ${colors.light}`,\n } as any,\n default: {\n shadowColor: '#000',\n shadowOffset: { width: hoverOffset, height: hoverOffset },\n shadowOpacity: 0.2,\n shadowRadius: hoverBlur / 2,\n elevation: hoverOffset,\n },\n }) as ViewStyle\n}\n\n/**\n * Creates a hover shadow for pressed elements.\n * Reduces shadow depth but keeps a subtle rim light to maintain visual boundary.\n */\nexport function createPressedHoverShadow(\n surface: ShadowSurface = 'charcoal',\n intensity: ShadowIntensity = 'medium'\n): ViewStyle {\n const colors = shadowColors[surface]\n const { offset, blur } = intensityConfig[intensity]\n \n // Reduce shadow depth by half for hover, keep minimal rim light\n const hoverOffset = Math.max(1, Math.round(offset / 2))\n const hoverBlur = Math.max(1, Math.round(blur / 2))\n const rimBlur = 1\n \n return Platform.select({\n web: {\n // Keep rim offset at 1px (same as pressed normal) to prevent \"shrinking\" effect\n boxShadow: `inset ${hoverOffset}px ${hoverOffset}px ${hoverBlur}px ${colors.darker}, inset -1px -1px ${rimBlur}px ${colors.light}`,\n } as any,\n default: {\n shadowOpacity: 0,\n elevation: 0,\n },\n }) as ViewStyle\n}\n\n/**\n * Pre-built shadow presets for common use cases.\n */\nexport const neumorphicShadows = {\n // Charcoal surface shadows (for dark toolbars, cards)\n charcoal: {\n raised: {\n subtle: createRaisedShadow('charcoal', 'subtle'),\n medium: createRaisedShadow('charcoal', 'medium'),\n strong: createRaisedShadow('charcoal', 'strong'),\n },\n raisedHover: {\n subtle: createRaisedHoverShadow('charcoal', 'subtle'),\n medium: createRaisedHoverShadow('charcoal', 'medium'),\n strong: createRaisedHoverShadow('charcoal', 'strong'),\n },\n pressed: {\n subtle: createPressedShadow('charcoal', 'subtle'),\n medium: createPressedShadow('charcoal', 'medium'),\n strong: createPressedShadow('charcoal', 'strong'),\n },\n pressedHover: {\n subtle: createPressedHoverShadow('charcoal', 'subtle'),\n medium: createPressedHoverShadow('charcoal', 'medium'),\n strong: createPressedHoverShadow('charcoal', 'strong'),\n },\n flat: createFlatShadow(),\n },\n // Neutral dark surface shadows\n neutralDark: {\n raised: {\n subtle: createRaisedShadow('neutralDark', 'subtle'),\n medium: createRaisedShadow('neutralDark', 'medium'),\n strong: createRaisedShadow('neutralDark', 'strong'),\n },\n raisedHover: {\n subtle: createRaisedHoverShadow('neutralDark', 'subtle'),\n medium: createRaisedHoverShadow('neutralDark', 'medium'),\n strong: createRaisedHoverShadow('neutralDark', 'strong'),\n },\n pressed: {\n subtle: createPressedShadow('neutralDark', 'subtle'),\n medium: createPressedShadow('neutralDark', 'medium'),\n strong: createPressedShadow('neutralDark', 'strong'),\n },\n pressedHover: {\n subtle: createPressedHoverShadow('neutralDark', 'subtle'),\n medium: createPressedHoverShadow('neutralDark', 'medium'),\n strong: createPressedHoverShadow('neutralDark', 'strong'),\n },\n flat: createFlatShadow(),\n },\n // Neutral light surface shadows\n neutralLight: {\n raised: {\n subtle: createRaisedShadow('neutralLight', 'subtle'),\n medium: createRaisedShadow('neutralLight', 'medium'),\n strong: createRaisedShadow('neutralLight', 'strong'),\n },\n raisedHover: {\n subtle: createRaisedHoverShadow('neutralLight', 'subtle'),\n medium: createRaisedHoverShadow('neutralLight', 'medium'),\n strong: createRaisedHoverShadow('neutralLight', 'strong'),\n },\n pressed: {\n subtle: createPressedShadow('neutralLight', 'subtle'),\n medium: createPressedShadow('neutralLight', 'medium'),\n strong: createPressedShadow('neutralLight', 'strong'),\n },\n pressedHover: {\n subtle: createPressedHoverShadow('neutralLight', 'subtle'),\n medium: createPressedHoverShadow('neutralLight', 'medium'),\n strong: createPressedHoverShadow('neutralLight', 'strong'),\n },\n flat: createFlatShadow(),\n },\n}\n","/**\n * Color utility functions for the design system\n *\n * lighten/darken are re-exported from shadows.ts which uses HSV-based\n * color math for more perceptually consistent results across hues.\n */\n\nexport { lighten, darken } from '../theme/shadows'\n\nexport type StatusType = 'success' | 'error' | 'warning' | 'info'\nexport type ResultType = 'improve' | 'degrade' | 'inconclusive' | 'neutral'\n\n/**\n * Get the semantic color token for a status type.\n *\n * @param status - The status type\n * @returns The CSS variable reference for the status color\n *\n * @example\n * const color = getStatusColor('success') // 'var(--color-status-success)'\n */\nexport function getStatusColor(status: StatusType): string {\n return `var(--color-status-${status})`\n}\n\n/**\n * Get the semantic color token for a result type.\n *\n * @param result - The result type\n * @returns The CSS variable reference for the result color\n *\n * @example\n * const color = getResultColor('improve') // 'var(--color-result-improve)'\n */\nexport function getResultColor(result: ResultType): string {\n return `var(--color-result-${result})`\n}\n\n/**\n * Apply alpha/opacity to a color.\n * Works with hex colors and rgb values.\n *\n * @param color - The color value (hex or rgb)\n * @param opacity - Opacity value between 0 and 1\n * @returns The color with alpha applied\n *\n * @example\n * alpha('#5048E5', 0.5) // 'rgba(80, 72, 229, 0.5)'\n * alpha('rgb(80, 72, 229)', 0.5) // 'rgba(80, 72, 229, 0.5)'\n */\nexport function alpha(color: string, opacity: number): string {\n // Clamp opacity between 0 and 1\n const clampedOpacity = Math.max(0, Math.min(1, opacity))\n\n // Handle hex colors\n if (color.startsWith('#')) {\n const hex = color.slice(1)\n let r: number, g: number, b: number\n\n if (hex.length === 3) {\n r = parseInt(hex[0] + hex[0], 16)\n g = parseInt(hex[1] + hex[1], 16)\n b = parseInt(hex[2] + hex[2], 16)\n } else if (hex.length === 6) {\n r = parseInt(hex.slice(0, 2), 16)\n g = parseInt(hex.slice(2, 4), 16)\n b = parseInt(hex.slice(4, 6), 16)\n } else {\n return color\n }\n\n return `rgba(${r}, ${g}, ${b}, ${clampedOpacity})`\n }\n\n // Handle rgb colors\n const rgbMatch = color.match(/rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)/)\n if (rgbMatch) {\n const [, r, g, b] = rgbMatch\n return `rgba(${r}, ${g}, ${b}, ${clampedOpacity})`\n }\n\n // Handle rgba colors - replace the alpha value\n const rgbaMatch = color.match(/rgba\\((\\d+),\\s*(\\d+),\\s*(\\d+),\\s*[\\d.]+\\)/)\n if (rgbaMatch) {\n const [, r, g, b] = rgbaMatch\n return `rgba(${r}, ${g}, ${b}, ${clampedOpacity})`\n }\n\n return color\n}\n\n/**\n * Determine if a color is light or dark.\n * Useful for determining text color contrast.\n *\n * @param color - Hex color value\n * @returns 'light' or 'dark'\n *\n * @example\n * getLuminance('#FFFFFF') // 'light'\n * getLuminance('#000000') // 'dark'\n */\nexport function getLuminance(color: string): 'light' | 'dark' {\n if (!color.startsWith('#')) return 'dark'\n\n const hex = color.slice(1)\n let r: number, g: number, b: number\n\n if (hex.length === 3) {\n r = parseInt(hex[0] + hex[0], 16)\n g = parseInt(hex[1] + hex[1], 16)\n b = parseInt(hex[2] + hex[2], 16)\n } else if (hex.length === 6) {\n r = parseInt(hex.slice(0, 2), 16)\n g = parseInt(hex.slice(2, 4), 16)\n b = parseInt(hex.slice(4, 6), 16)\n } else {\n return 'dark'\n }\n\n // Calculate relative luminance using sRGB\n const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255\n\n return luminance > 0.5 ? 'light' : 'dark'\n}\n\n/**\n * Get a contrasting text color for a given background.\n *\n * @param backgroundColor - The background color (hex)\n * @returns 'white' or 'black' for contrast\n *\n * @example\n * getContrastText('#5048E5') // 'white'\n * getContrastText('#FFFFFF') // 'black'\n */\nexport function getContrastText(backgroundColor: string): string {\n return getLuminance(backgroundColor) === 'light' ? '#000000' : '#FFFFFF'\n}\n\n","// Font mapping context: presentation-only helpers, no rendering.\nimport { WORKOUT_TOKENS } from '../theme/workout-tokens'\n\n/**\n * Presentation helpers for workout metrics.\n *\n * The data layer (`@voltras/workout-analytics` view-model derivations) supplies\n * EXACT, unrounded values; these turn them into the rounded / banded / formatted\n * forms a view renders. Keeping display munging here — in the design system, not\n * the analytics layer — is the render half of the model↔render split: one view\n * can round while another (or a hover) shows the exact value from the same real\n * data. Workout components consume these so the rules live in one place.\n */\n\n/** Round an exact RPE onto its conventional 0.5 granularity for display. */\nexport function roundRpe(rpe: number): number {\n return Math.round(rpe * 2) / 2\n}\n\n/**\n * Color band for an RPE on the canonical performance scale. Higher RPE = harder\n * = red (direction inverted vs velocity, which shares the same scale). Bands:\n * `<7` green, `7–8.5` yellow, `8.5–9.5` orange, `≥9.5` red.\n */\nexport function rpeColor(rpe: number): string {\n if (rpe >= 9.5) return WORKOUT_TOKENS.scale.red\n if (rpe >= 8.5) return WORKOUT_TOKENS.scale.orange\n if (rpe >= 7) return WORKOUT_TOKENS.scale.yellow\n return WORKOUT_TOKENS.scale.green\n}\n\n/** Round a weight or e1RM to a whole unit for compact display. */\nexport function roundWeight(weight: number): number {\n return Math.round(weight)\n}\n\n/** Format an exact velocity (m/s) to the 2-dp string shown on the velocity strip. */\nexport function formatVelocity(velocity: number): string {\n return velocity.toFixed(2)\n}\n\n/** Round an exact tempo tuple (seconds) to 1 dp per phase for display. */\nexport function roundTempo(\n tempo: [number, number, number, number]\n): [number, number, number, number] {\n return tempo.map((v) => Math.round(v * 10) / 10) as [number, number, number, number]\n}\n\n/** Signed percentage label for a deviation ratio, e.g. `+9%` / `-5%` / `0%`. */\nexport function formatSignedPct(ratio: number): string {\n const pct = Math.round(ratio * 100)\n return `${pct > 0 ? '+' : ''}${pct}%`\n}\n\n/** Structured prescription for the active exercise (from the plan). */\nexport interface PrescriptionInput {\n repsLow?: number\n repsHigh?: number\n weightLbs?: number\n rpe?: number\n}\n\n/**\n * Human prescription string, e.g. `\"8–10 @ 62 lb · RPE 8\"`. `null` when there is\n * nothing to show. Presentation-only: the plan supplies the numbers, this shapes\n * the label.\n */\nexport function formatPrescription(p: PrescriptionInput | null | undefined): string | null {\n if (p == null) return null\n let reps: string | null = null\n if (p.repsLow != null && p.repsHigh != null) {\n reps = p.repsLow === p.repsHigh ? `${p.repsLow}` : `${p.repsLow}–${p.repsHigh}`\n } else if (p.repsLow != null) {\n reps = `${p.repsLow}`\n }\n const weight = p.weightLbs != null ? `${p.weightLbs} lb` : null\n const head = [reps, weight].filter((s): s is string => s != null).join(' @ ')\n const rpe = p.rpe != null ? `RPE ${p.rpe}` : null\n const full = [head.length > 0 ? head : null, rpe]\n .filter((s): s is string => s != null)\n .join(' · ')\n return full.length > 0 ? full : null\n}\n","// The matte \"paper\" treatment for a colored bar — a brightness-scaled fractal-noise\n// grain + a crisp top rim-light + a soft contact shadow, so filled bars read as one\n// tactile material across the system (velocity bars, ROM bars, …). Web-only CSS\n// (backgroundImage + boxShadow) — harmless on native (ignored), styled for RNW/web.\n//\n// Promoted out of VelocityStrip so every colored-bar family composes ONE treatment\n// instead of re-rolling it. Consumers spread it onto a bar's style: `...barPaper(hex)`.\nimport type { ViewStyle } from 'react-native'\n\n/**\n * Grain opacity scaled by a color's perceived brightness: a bright bar keeps full\n * texture, a darker bar carries proportionally less so the grain never reads hot on a\n * dark tone. Anchored so lum ≈ 0.13 → ≈ 0.06 and lum ≈ 0.58 → ≈ 0.20.\n */\nfunction grainOpacityForColor(hex: string): number {\n const h = hex.replace('#', '')\n const full =\n h.length === 3\n ? h\n .split('')\n .map((ch) => ch + ch)\n .join('')\n : h\n const r = parseInt(full.slice(0, 2), 16)\n const g = parseInt(full.slice(2, 4), 16)\n const b = parseInt(full.slice(4, 6), 16)\n if ([r, g, b].some(Number.isNaN)) return 0.14\n const lum = (0.299 * r + 0.587 * g + 0.114 * b) / 255\n return Math.min(0.24, Math.max(0.04, 0.02 + 0.31 * lum))\n}\n\n/** The matte paper grain tile (fractalNoise), opacity brightness-scaled to `color`. */\nfunction barGrain(color: string): string {\n const op = grainOpacityForColor(color).toFixed(3)\n return (\n `url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E` +\n `%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E` +\n `%3Crect width='120' height='120' filter='url(%23n)' opacity='${op}'/%3E%3C/svg%3E\")`\n )\n}\n\n/**\n * Paper/raised treatment for a colored bar of the given `color`: brightness-scaled\n * matte grain + a crisp top rim-light + a defined contact shadow. Spread onto a bar's\n * style. Presentation-only; scoped to filled bars (not shared strips/dividers).\n *\n * `flip` = a vertically-mirrored (`scaleY(-1)`) plot — a `down` wing of the diverging\n * chart. The contact shadow's y-offset is pre-inverted so the mirror lands it pointing\n * AWAY from the shared axis (not up across it), and the top rim-light is DROPPED (mirrored\n * it would sit on the axis edge and read wrong; grain + shadow alone carry the material).\n */\nexport function barPaper(color: string, flip = false): ViewStyle {\n return {\n backgroundImage: barGrain(color),\n boxShadow: flip\n ? '0 -6px 16px rgba(0,0,0,0.45)'\n : 'inset 0 1.5px 0 rgba(255,255,255,0.22), 0 6px 16px rgba(0,0,0,0.45)',\n } as unknown as ViewStyle\n}\n","// On-surface colour context (TD-05.12).\n//\n// A <Surface> owns a background from a small elevation scale AND publishes the\n// current theme mode so descendant text/icons resolve their colour from \"what\n// surface am I on\" instead of a `text-*` className. Those classNames silently\n// fail to black when the tree renders as raw RN in the standalone wall SPA\n// (no global.css, no nativewind) — the bug class this primitive retires.\nimport { createContext, useContext } from 'react'\nimport { getSemanticColors, type ThemeMode } from '../../../theme/tokens/semantic'\nimport { surfaceRampDark } from '../../../theme/tokens/primitives'\n\ntype ColorToken = keyof ReturnType<typeof getSemanticColors>\n\n/**\n * A Surface's depth on the dark surface ramp. Each addressable level maps to an\n * EXISTING semantic surface/background token (already grounded in the derived\n * surface ramp — TD-surface-tokens S-1 — and theme-aware) — Surface introduces\n * no new hexes. Darkest → lightest:\n * inset (#13100D) < background (#1C1916) < base (#252321) < elevated (#2A2827) < raised (#2D2C2B) < overlay (#302F2E)\n *\n * `inset` is the ramp's deepest pit — the sub-shell well. It's the floor a\n * `<Surface pressed>` clamps at (see {@link pressedLevel}); it has no shipped\n * semantic token yet, so {@link surfaceBackground} resolves it from the\n * `surface-inset` token when present, else the `surfaceRampDark.inset` primitive.\n */\nexport type SurfaceLevel = 'inset' | 'background' | 'base' | 'elevated' | 'raised' | 'overlay'\n\n/** On-surface neutral text roles, resolved for the current surface + theme. */\nexport type OnSurfaceRole = 'primary' | 'secondary' | 'tertiary'\n\n// Which semantic token backs each ADDRESSABLE level. Values live in `semantic.ts`\n// and stay in sync with the charcoal ramp — this map never carries literal hexes.\n// `inset` is intentionally absent: it has no shipped semantic token yet, so it's\n// resolved separately (token-or-primitive) in `surfaceBackground`.\nexport const SURFACE_LEVEL_TOKEN = {\n background: 'background-base',\n base: 'surface-base',\n elevated: 'surface-elevated',\n raised: 'surface-raised',\n overlay: 'surface-overlay',\n} as const satisfies Record<Exclude<SurfaceLevel, 'inset'>, ColorToken>\n\n// Darkest → lightest, INCLUDING the inset floor. A `<Surface pressed>` renders\n// one index DOWN from its parent's level and clamps at `inset` (index 0). Kept\n// in lockstep with the derived ramp and the surface.contract.test PLANE_ORDER.\nconst PRESSED_RAMP = ['inset', 'background', 'base', 'elevated', 'raised', 'overlay'] as const\n\nconst ON_SURFACE_TOKEN = {\n primary: 'text-primary',\n secondary: 'text-secondary',\n tertiary: 'text-tertiary',\n} as const satisfies Record<OnSurfaceRole, ColorToken>\n\nexport interface SurfaceContextValue {\n /** Active theme mode. Defaults to dark (the wall). */\n mode: ThemeMode\n /** Depth of the nearest enclosing Surface. */\n level: SurfaceLevel\n}\n\n// Default context: dark 'base' plane, so descendants OUTSIDE any Surface still\n// resolve to real dark colours (never black) on the dark-only wall.\nconst DEFAULT_CONTEXT: SurfaceContextValue = { mode: 'dark', level: 'base' }\n\nexport const SurfaceContext = createContext<SurfaceContextValue>(DEFAULT_CONTEXT)\n\n/** The nearest surface context ({ mode, level }); default dark 'base'. */\nexport function useSurface(): SurfaceContextValue {\n return useContext(SurfaceContext)\n}\n\n/** The active theme mode from the nearest Surface/provider (default dark). */\nexport function useSurfaceMode(): ThemeMode {\n return useContext(SurfaceContext).mode\n}\n\n/**\n * Literal-hex on-surface neutral text colours for a theme mode. Uses\n * `getSemanticColors` (literal hex — the TempoBar pattern), never `resolveColor`\n * (which returns `var()` under the RNW vitest alias), so values stay real in\n * tested component code and on raw-RN surfaces alike.\n */\nexport function onSurfaceColors(mode: ThemeMode): Record<OnSurfaceRole, string> {\n const c = getSemanticColors(mode)\n return {\n primary: c[ON_SURFACE_TOKEN.primary],\n secondary: c[ON_SURFACE_TOKEN.secondary],\n tertiary: c[ON_SURFACE_TOKEN.tertiary],\n }\n}\n\n/** Resolve one on-surface text colour for descendants of a Surface. */\nexport function useOnSurfaceColor(role: OnSurfaceRole = 'primary'): string {\n return getSemanticColors(useSurfaceMode())[ON_SURFACE_TOKEN[role]]\n}\n\n/**\n * The inset floor hex — the ramp's deepest pit that a pressed surface clamps at.\n * Prefers the `surface-inset` semantic token (theme-aware; being promoted in a\n * parallel token change) and falls back to the `surfaceRampDark.inset` primitive\n * (#13100D, dark-ramp only) until that token ships.\n */\nfunction insetFloor(mode: ThemeMode): string {\n const colors = getSemanticColors(mode) as Record<string, string>\n return colors['surface-inset'] ?? surfaceRampDark.inset\n}\n\n/** The background hex for a surface level under a theme mode (literal hex). */\nexport function surfaceBackground(level: SurfaceLevel, mode: ThemeMode): string {\n if (level === 'inset') return insetFloor(mode)\n return getSemanticColors(mode)[SURFACE_LEVEL_TOKEN[level]]\n}\n\n/**\n * The level a `<Surface pressed>` resolves to: its parent's level stepped one\n * index DOWN the ramp — the symmetric twin of a raised surface stepping up —\n * clamped at the `inset` floor so a pressed surface never underflows the pit.\n * overlay→raised, raised→elevated, elevated→base, base→background,\n * background→inset, inset→inset (clamped).\n * Pressed exposes ONE level of depth only (no pressed-2).\n */\nexport function pressedLevel(parent: SurfaceLevel): SurfaceLevel {\n const index = PRESSED_RAMP.indexOf(parent)\n const down = Math.max(0, index - 1)\n return PRESSED_RAMP[down]\n}\n","// The newest-rep grow-from-bottom entrance, shared by SetBarChart (hero / dual / ROM)\n// and VelocityStrip's framed + bare expanded charts. Promoted out of VelocityStrip so\n// every value-height bar family animates the live rep identically instead of re-rolling\n// the hook.\nimport { useEffect, useState } from 'react'\nimport { Animated, Easing } from 'react-native'\n\nconst ANIMATION_EASING = Easing.bezier(0.22, 1, 0.36, 1)\n\n/**\n * Growth-factor overshoot for a new-peak bar: it grows past its full height then\n * settles back to 1 (a small bounce), rather than the plain 0→1 grow every other\n * bar gets. Modest (12%) since it stretches actual bar HEIGHT, not a uniform scale\n * — a large overshoot here reads as a much bigger jump than the same factor did\n * against the old whole-bar scale pop.\n */\nconst PEAK_OVERSHOOT = 1.12\n\nfunction getReducedMotionPreference(): boolean {\n if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') return false\n return window.matchMedia('(prefers-reduced-motion: reduce)').matches\n}\n\n/** Track the OS \"reduce motion\" preference; falls back to `false` (jsdom/SSR). */\nexport function usePrefersReducedMotion(): boolean {\n const [reduced, setReduced] = useState(getReducedMotionPreference)\n useEffect(() => {\n if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') return\n const mq = window.matchMedia('(prefers-reduced-motion: reduce)')\n const handler = () => setReduced(mq.matches)\n handler()\n mq.addEventListener?.('change', handler)\n return () => mq.removeEventListener?.('change', handler)\n }, [])\n return reduced\n}\n\n/**\n * The newest-rep entrance shared by SetBarChart and the framed / bare `expanded` charts:\n * the bar GROWS UP FROM THE BASELINE (0 → full height), reading as though it's tracking\n * the rep as it lands. A new set peak overshoots past full height then settles (a small\n * bounce) instead of the plain grow. Honors reduced motion (jumps straight to full\n * height, no animation). Returns a 0→1(+overshoot) growth-factor `Animated.Value`;\n * callers interpolate it against their own target height. Inert while `active` is\n * false or no live rep is present.\n */\nexport function useLiveRepGrowth(\n active: boolean,\n liveRepIndex: number | undefined,\n liveVelocity: number | undefined,\n isNewPeak: boolean\n): Animated.Value {\n const prefersReducedMotion = usePrefersReducedMotion()\n const [liveGrowth] = useState(() => new Animated.Value(1))\n useEffect(() => {\n if (!active || liveRepIndex == null || liveVelocity == null) return\n if (prefersReducedMotion) {\n liveGrowth.setValue(1)\n return\n }\n liveGrowth.setValue(0)\n if (isNewPeak) {\n Animated.sequence([\n Animated.timing(liveGrowth, {\n toValue: PEAK_OVERSHOOT,\n duration: 220,\n easing: Easing.out(Easing.quad),\n useNativeDriver: false,\n }),\n Animated.spring(liveGrowth, {\n toValue: 1,\n friction: 5,\n tension: 140,\n useNativeDriver: false,\n }),\n ]).start()\n } else {\n // Plain entrance: a clean ease-out grow with no overshoot (ANIMATION_EASING has\n // no control point above y=1) — it reads as tracking the rep, not bouncing.\n Animated.timing(liveGrowth, {\n toValue: 1,\n duration: 300,\n easing: ANIMATION_EASING,\n useNativeDriver: false,\n }).start()\n }\n }, [active, liveRepIndex, liveVelocity, isNewPeak, prefersReducedMotion, liveGrowth])\n return liveGrowth\n}\n\nexport { ANIMATION_EASING }\n","/**\n * Custom JSX runtime for titan-design's web distribution.\n *\n * Converts className props to $$css style objects at build time,\n * eliminating the need for NativeWind's runtime interopComponents\n * Map lookup. RNW's styleq recognizes $$css objects and applies\n * their values as CSS class names on DOM elements.\n *\n * This file is NOT used by source builds (specimen, storybook,\n * native Metro). It is only inlined into the dist by tsup via\n * an esbuild onResolve plugin.\n */\nimport {\n jsx as reactJsx,\n jsxs as reactJsxs,\n Fragment,\n} from 'react/jsx-runtime'\nimport type { StyleProp } from 'react-native'\n\ntype JsxFn = typeof reactJsx\n\nfunction wrapJsx(fn: JsxFn): JsxFn {\n return function (type, props: Record<string, any>, ...rest) {\n if (props && typeof props.className === 'string' && props.className) {\n const cn = props.className\n const cssStyle = { $$css: true, [cn]: cn } as unknown as StyleProp<any>\n const existing = props.style\n props = {\n ...props,\n style: existing ? [cssStyle, existing] : cssStyle,\n }\n delete props.className\n }\n return fn(type, props, ...rest)\n } as JsxFn\n}\n\nconst jsx = wrapJsx(reactJsx)\nconst jsxs = wrapJsx(reactJsxs)\n\nexport { jsx, jsxs, Fragment }\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\n/**\n * SetBarChart — the generic per-rep value-height bar chart both the velocity hero and the\n * ROM progression compose. It OWNS the chart geometry (value→height scaling, the shared\n * `scaleMax` override, the plot-width-driven adaptive bar width / gap stepping / value-label\n * thinning) and the shared bar language (paper treatment, grow-from-bottom live rep, up/down\n * orientation, the set-type slot vocabulary). Everything domain-specific — bar COLOR, the\n * reference overlay (velocity VL bands / ROM working+short lines) — is passed in, so an\n * improvement to the chart (spacing, paper, live-grow) lands once for every consumer.\n *\n * VALUE-HEIGHT ONLY: the flat 3px `mini` strip stays its own thin strip in VelocityStrip.\n */\nimport { useState, type ReactNode } from 'react'\nimport {\n View,\n Text,\n Animated,\n type ViewProps,\n type ViewStyle,\n type LayoutChangeEvent,\n} from 'react-native'\nimport { primitiveRamps } from '../../../theme/tokens/primitives'\nimport { barPaper } from '../../../theme/bar-paper'\nimport { useOnSurfaceColor, useSurface, surfaceBackground } from '../../ui/surface/SurfaceContext'\nimport { useLiveRepGrowth } from './live-rep-growth'\n\n/** Linear-blend two #RRGGBB hexes (`t`=0 → a, 1 → b) — the surface-relative solid to-do tone. */\nfunction mixHex(a: string, b: string, t: number): string {\n const parse = (h: string): [number, number, number] => {\n const s = h.replace('#', '')\n return [parseInt(s.slice(0, 2), 16), parseInt(s.slice(2, 4), 16), parseInt(s.slice(4, 6), 16)]\n }\n const [ar, ag, ab] = parse(a)\n const [br, bg, bb] = parse(b)\n const ch = (x: number, y: number): string =>\n Math.round(x + (y - x) * t)\n .toString(16)\n .padStart(2, '0')\n return `#${ch(ar, br)}${ch(ag, bg)}${ch(ab, bb)}`\n}\n\n/** The cyan variable-window fill — the range set's `floor..max` window (shared with SetStrip). */\nexport const VARIABLE_FILL = primitiveRamps.cyan[900]\n/** The thin cyan-800 outline on the open-ended \"continue\" slot — reads as \"keep going\". */\nexport const CONTINUE_OUTLINE = primitiveRamps.cyan[800]\n\n/**\n * One drawn cell of the chart. `rep` carries a `value` and draws a value-height bar;\n * `todo` / `variable` / `continue` are the set-type window stubs (planned remainder, the\n * range floor..max window, the AMRAP/myo open tail); `empty` is a rep COLUMN a side didn't\n * log — a faint constant-contrast placeholder that keeps the two diverging wings index-locked\n * (a lagging side's missing rep sits at the SAME column index as the other side's rep).\n * `leadingGap` adds spacing BEFORE the cell beyond the uniform inter-bar gap — the WIDE\n * chunk-notch that splits drop sub-loads / myo clusters / cluster intra-rests. Absent\n * `leadingGap` = the ordinary rep gap.\n */\nexport interface SetSlot {\n kind: 'rep' | 'todo' | 'variable' | 'continue' | 'empty'\n value?: number\n leadingGap?: number\n}\n\n/** The geometry SetBarChart hands a {@link SetBarChartProps.renderReference} overlay painter. */\nexport interface SetBarGeometry {\n /** The height-scaling denominator (a value `v` sits `yOf(v)` px up from the baseline). */\n scaleDenom: number\n /** The drawable plot height (px) — `height` minus the value-label headroom when labels show. */\n plotHeight: number\n /** px UP from the baseline for a value. */\n yOf: (value: number) => number\n /** The tallest performed value — the running-best reps are measured against. */\n best: number\n /** The plot is vertically mirrored (a `down` wing) — counter-flip any text in the overlay. */\n flip: boolean\n}\n\nexport interface SetBarChartProps {\n /** Ordered cells — performed reps + any set-type window stubs. */\n slots: SetSlot[]\n /** value → bar fill color. Reps only; window stubs use the fixed set-type tones. */\n colorFor: (value: number) => string\n /** Plot height (px). Bars scale into this (minus the value-label headroom when labels show). */\n height: number\n /**\n * Height scaling. `peak` (default) scales to the performed max (+headroom); `fixed` scales\n * to a fixed velocity ceiling so heights read the same absolute value across sets. Overridden\n * by {@link scaleMax}.\n */\n scale?: 'peak' | 'fixed'\n /**\n * OVERRIDE the height denominator with `scaleMax * headroom` (BAR HEIGHT ONLY; color + the\n * reference `best` still read this chart's own values). The diverging dual passes the pair's\n * shared max so a stronger side reads TALLER against one common scale.\n */\n scaleMax?: number\n /** `up` (default) grows bars UP from a bottom baseline; `down` mirrors the plot (grows DOWN, text upright). */\n orientation?: 'up' | 'down'\n /** Index (into the rep slots) of the newest rep — that bar grows up from the baseline as it lands. */\n liveRepIndex?: number\n /** The live rep set a new peak — its entrance overshoots then settles (a small bounce). */\n isNewPeak?: boolean\n /**\n * Append dashed todo placeholders so the chart reads \"3 of N done\". Ignored when the `slots`\n * already run to (or past) this count — a caller that supplies its own todo slots omits this.\n */\n targetReps?: number\n /**\n * Inter-bar gap as a fraction of bar width (gap ≈ gapRatio·barWidth, floored at 2px). Default\n * {@link GAP_RATIO}. Lower = denser (toward the near-touching expanded density); narrow screens\n * floor to 2px regardless. Exposed mainly for a spacing-density comparison.\n */\n gapRatio?: number\n /** Corner radius on the bars (px). Default 5. */\n barRadius?: number\n /**\n * Which corners round. `top` (default) — the bolder top-rounded WALL HERO look. `all` — the thin\n * radius-2 flat-bar language (the SegmentedBar pill), for rep-level compact + expanded in the\n * rail / card / table so a compact↔expanded morph keeps a constant all-corners radius.\n */\n cornerStyle?: 'top' | 'all'\n /**\n * FLAT height mode (the `compact` resting form). Every rep bar renders at ONE uniform short height\n * ({@link FLAT_BAR_FRACTION} of the plot) instead of value-height — EVERYTHING else identical\n * (colors, paper, the proportional spacing + chunk-notch, todo/variable/continue slots, gutter).\n * Value labels are suppressed. Same x-positions/widths/gaps as value mode, so a compact↔expanded\n * toggle only changes bar HEIGHTS in place (no horizontal reflow).\n */\n flat?: boolean\n /**\n * Draw a per-rep value label. Default false. When on, every label pins to one aligned row at the\n * plot TOP (not offset per bar height) in the muted on-surface-secondary tone. Ignored in {@link flat} mode.\n */\n showValueLabels?: boolean\n /** Format a rep value for its label. Default `String`. */\n formatValue?: (value: number) => string\n /**\n * To-do placeholder treatment. `solid` (default) — a solid surface-relative section (the plane\n * blended toward the on-surface neutral). `dashed` — a dashed outline stub. Exists so ROM can keep\n * its dashed to-do while the hero (and the dual that composes it) take the solid section.\n */\n todoVariant?: 'solid' | 'dashed'\n /**\n * Pad the rendered columns to at least this many with placeholder to-do cells. The diverging dual\n * passes the union column count of both wings so bars line up top↔bottom across the centre axis.\n */\n minColumns?: number\n /** Paint a reference overlay (VL bands / working-standard lines) given the chart geometry. */\n renderReference?: (geometry: SetBarGeometry) => ReactNode\n /**\n * Per-rep OVERLAY, rendered inside each rep column above the bar (for the framed `expanded`\n * chrome to inject its per-bar m/s label + `onRepPress` pressable without duplicating bar\n * rendering). When provided, SetBarChart suppresses its OWN value label (the overlay owns it) and\n * the rep columns become interactive (not a11y-hidden).\n */\n renderBarOverlay?: (repIndex: number, value: number) => ReactNode\n /**\n * IN-PLACE expand animation: an `Animated.Value` 0→1 that morphs every rep bar between its FLAT\n * (compact) height and its VALUE height, and fades the value labels in. The x-geometry stays fixed\n * (widths / gaps / positions), so a compact↔expanded toggle animates only heights — no reflow.\n * Overrides `flat` + the live-rep grow while animating.\n */\n expandProgress?: Animated.Value\n /** Suppress the plot's own 2px baseline border (the dual draws ONE shared centre axis instead). */\n hideBaseline?: boolean\n /** Container testID. */\n testID?: string\n /** Prefix for the per-cell testIDs: `${prefix}-bar-N`, `${prefix}-label-N`, `${prefix}-slot-KIND`. Default `setbar`. */\n testIDPrefix?: string\n /** When set, the container reads as an `image` with this label; omit for a plain (unlabeled) plot. */\n accessibilityLabel?: string\n /**\n * Optional stream / slot NAME (e.g. \"Left Arm\") rendered as a rotated vertical edge label down a\n * left gutter — the same treatment the diverging dual gives each wing. Font size scales to `height`\n * so it fits without truncation. Omitted → no gutter.\n */\n label?: string\n className?: string\n /** Rest View props (style is merged onto the container). */\n viewProps?: ViewProps\n}\n\n/** The `scale=\"fixed\"` velocity ceiling (m/s) — a bar height reads the same absolute value across sets. */\nconst FIXED_MAX_VALUE = 1.15\n/** Headroom above the peak bar: just enough to seat its value label without a big empty band on top. */\nexport const PEAK_HEADROOM = 1.03\n\n/** The height-scaling denominator for `scale` at the given performed max (guarded ≥ 0 by callers). */\nexport function scaleDenominator(scale: 'peak' | 'fixed', maxValue: number): number {\n return scale === 'fixed' ? FIXED_MAX_VALUE : maxValue * PEAK_HEADROOM\n}\n\n/**\n * The per-bar value-label font size (px), scaled to chart `height` (floored at 8) so the numbers stay\n * proportionate to the bars at small heights instead of reading oversized. Hits the full 12px at the\n * standard single-hero (220px) and dual-wing (~110px) scales; shrinks toward the floor on tiny charts.\n */\nexport function valueLabelFontSize(height: number): number {\n return Math.round(Math.max(8, Math.min(12, height * 0.11)))\n}\n\n// --- Hero geometry -----------------------------------------------------------\n/** Default plot height (px) — tall enough to read a set's shape across a room. */\nexport const SET_BAR_DEFAULT_HEIGHT = 220\n/** Value-label row height (px) — the only headroom reserved above the bars when labels show. */\nconst LABEL_ROW_HEIGHT = 16\n/** Gap between the value-label row and the peak bar top (px). */\nconst LABEL_GAP = 3\n/** Inter-bar gap as a fraction of bar width — the locked dense default (near expanded density). */\nexport const GAP_RATIO = 0.08\n/** Floor on the proportional inter-bar gap (px) — narrow plots tighten to ~expanded density. */\nconst MIN_BAR_GAP = 2\n/**\n * The EXTRA margin at a chunk boundary (drop sub-load / myo cluster / cluster intra-rest), as a\n * fraction of bar width — proportional so it scales with the dense spacing and reads as a clear\n * cluster break (total boundary gap ≈ this + the normal gapRatio ≈ ⅓ of a bar). Floored so small\n * charts still separate clusters.\n */\nconst CHUNK_NOTCH_RATIO = 0.25\n/** Floor on the chunk-boundary extra margin (px). */\nconst CHUNK_NOTCH_MIN_PX = 10\n/** Cap on a single bar's width so a 2–3 rep set doesn't render slab-wide bars (px). */\nexport const BAR_MAX_WIDTH = 120\n/** Below this per-bar width the value labels collide, so all but the peak + live rep are dropped. */\nconst LABEL_MIN_BAR_WIDTH = 30\n/** Default top-corner radius on bars (px). */\nconst DEFAULT_BAR_RADIUS = 5\n/** Minimum drawn height of a performed bar (px) — a near-zero rep still reads as a rep. */\nconst MIN_BAR_HEIGHT = 4\n/** In `flat` (compact) mode every rep bar is this fraction of the plot height — a uniform short bar. */\nconst FLAT_BAR_FRACTION = 0.5\n/** The stub height for a window cell (todo / variable / continue / empty) — a short, clear placeholder. */\nconst STUB_HEIGHT = 9\n/** The ordinary rep gap the per-slot `leadingGap` is measured against (extra margin = leadingGap − this). */\nconst REP_GAP = 2\n\n/**\n * The shared adaptive bar layout — solve `N·bw + (N−1)·(gapRatio·bw) = plotWidth` for the per-bar\n * width (capped at {@link BAR_MAX_WIDTH}) and the proportional inter-bar gap (floored at MIN_BAR_GAP).\n * SetBarChart uses this for its own bars; the diverging compact/rail renderers call it too, so their\n * columns land at the SAME x-positions and widths as the single chart — one shared geometry.\n */\nexport function computeBarLayout(\n plotWidth: number,\n count: number,\n gapRatio: number = GAP_RATIO\n): { barWidth: number; gap: number } {\n const rawBarWidth =\n plotWidth > 0 && count > 0 ? plotWidth / (count + (count - 1) * gapRatio) : BAR_MAX_WIDTH\n const barWidth = Math.min(BAR_MAX_WIDTH, rawBarWidth)\n const gap = plotWidth === 0 ? MIN_BAR_GAP : Math.max(MIN_BAR_GAP, gapRatio * barWidth)\n return { barWidth, gap }\n}\n\n/** Is this cell a performed rep (carries a value)? */\nfunction isRep(slot: SetSlot): boolean {\n return slot.kind === 'rep'\n}\n\n/**\n * The performed-rep index for each cell (`-1` for a window stub) — reps are contiguous from 0 in\n * every set type, so this maps `liveRepIndex` / peak / label-thinning (rep-indexed) onto cells.\n */\nfunction repIndexByCell(cells: SetSlot[]): number[] {\n let count = 0\n return cells.map((slot) => (isRep(slot) ? count++ : -1))\n}\n\nexport function SetBarChart({\n slots,\n colorFor,\n height,\n scale = 'peak',\n scaleMax,\n orientation = 'up',\n liveRepIndex,\n isNewPeak = false,\n targetReps,\n gapRatio = GAP_RATIO,\n barRadius = DEFAULT_BAR_RADIUS,\n cornerStyle = 'top',\n flat = false,\n showValueLabels: showValueLabelsProp = false,\n formatValue = String,\n todoVariant = 'solid',\n minColumns,\n renderReference,\n renderBarOverlay,\n expandProgress,\n hideBaseline = false,\n testID,\n testIDPrefix = 'setbar',\n accessibilityLabel,\n label,\n className,\n viewProps = {},\n}: SetBarChartProps) {\n // Append todo placeholders up to `targetReps` (a caller that builds its own todo slots omits it),\n // then pad to `minColumns` so a diverging wing aligns column-for-column with its sibling.\n const targetPadded = Math.max(slots.length, targetReps ?? 0, minColumns ?? 0)\n const cells: SetSlot[] =\n targetPadded > slots.length\n ? [\n ...slots,\n ...Array.from({ length: targetPadded - slots.length }, () => ({ kind: 'todo' as const })),\n ]\n : slots\n\n const repValues = cells.filter(isRep).map((s) => s.value ?? 0)\n const best = repValues.length > 0 ? Math.max(...repValues) : 0\n\n // The whole plot mirrors for `down`; text nodes counter-flip so they read upright.\n const flip = orientation === 'down'\n const flipStyle = flip ? ({ transform: [{ scaleY: -1 as number }] } as const) : null\n\n // Planned/to-do reps + the baseline draw in a SURFACE-relative neutral (on-surface tertiary)\n // so they stay legible on every plane instead of a fixed charcoal.\n const placeholderColor = useOnSurfaceColor('tertiary')\n // The expanded strip's solid to-do tone: the surface plane blended toward the neutral (the same\n // relative model), so a `todoVariant=\"solid\"` section holds ~constant contrast on every plane.\n const surface = useSurface()\n const surfaceBg = surfaceBackground(surface.level, surface.mode)\n const solidTodoColor = mixHex(surfaceBg, placeholderColor, 0.55)\n // An `empty` cell (a rep the diverging side didn't log) is fainter than a planned to-do.\n const emptyColor = mixHex(surfaceBg, placeholderColor, 0.28)\n // `all` rounds every corner (the thin flat-bar pill); `top` keeps the bolder hero top-round.\n const barCorners: ViewStyle =\n cornerStyle === 'all'\n ? { borderRadius: barRadius }\n : { borderTopLeftRadius: barRadius, borderTopRightRadius: barRadius }\n\n // `scaleMax` (the diverging dual's shared pair-max) overrides the height denominator so both\n // sides share ONE height scale; color + the reference still read this chart's own values.\n const scaleDenom =\n scaleMax != null && scaleMax > 0 ? scaleMax * PEAK_HEADROOM : scaleDenominator(scale, best)\n\n // `flat` (compact) mode suppresses value labels and renders every rep at one uniform short height.\n const showValueLabels = showValueLabelsProp && !flat\n // Reserve ONLY the value-label row (+ its gap to the peak bar) as headroom — not a fat fixed\n // band — so the bars fill the plot and, at small heights, aren't over-stubbed.\n const plotHeight = Math.max(0, height - (showValueLabels ? LABEL_ROW_HEIGHT + LABEL_GAP : 0))\n const yOf = (value: number): number => (scaleDenom > 0 ? (value / scaleDenom) * plotHeight : 0)\n // The `expandProgress` morph starts from a PARTIAL flat height (bars visibly grow to their value);\n // a STATIC compact strip instead FILLS its plot — an 8px plot → an 8px bar, the SegmentedBar model —\n // so a resting strip is sized by its container, not left half-empty.\n const flatBarHeight = Math.max(MIN_BAR_HEIGHT, FLAT_BAR_FRACTION * plotHeight)\n const compactBarHeight = Math.max(MIN_BAR_HEIGHT, plotHeight)\n const valueBarHeight = (value: number): number =>\n scaleDenom > 0\n ? Math.max(MIN_BAR_HEIGHT, Math.min(1, value / scaleDenom) * plotHeight)\n : MIN_BAR_HEIGHT\n const barHeight = (value: number): number => (flat ? compactBarHeight : valueBarHeight(value))\n\n // Live-rep grow-from-bottom (rep index → cell index; reps are contiguous from 0 in every set type).\n const liveValue =\n liveRepIndex != null && liveRepIndex < repValues.length ? repValues[liveRepIndex] : undefined\n const liveGrowth = useLiveRepGrowth(true, liveRepIndex, liveValue, isNewPeak)\n\n // Measure the plot so per-bar value labels can thin on a narrow chart (they collide once bars\n // get thin). Width 0 (unmeasured) → show all, so test/server renders are unchanged.\n const [plotW, setPlotW] = useState(0)\n const onPlotLayout = (e: LayoutChangeEvent) => setPlotW(e.nativeEvent.layout.width)\n\n // Inter-bar gap is PROPORTIONAL to bar width (gap ≈ gapRatio·barWidth, floored at MIN_BAR_GAP).\n // Solve N·bw + (N−1)·(gapRatio·bw) = plotW → bw = plotW / (N + (N−1)·gapRatio); the bars tighten to\n // ~expanded density on narrow plots (the floor) and the ratio sets how dense they read at wall scale.\n const totalCells = cells.length\n const { barWidth, gap } = computeBarLayout(plotW, totalCells, gapRatio)\n const labelsCrowded = plotW > 0 && barWidth < LABEL_MIN_BAR_WIDTH\n\n // Peak rep index (over rep values) — its label always survives label-thinning.\n const peakRepIndex = repValues.reduce((b, v, i) => (v > repValues[b] ? i : b), 0)\n const showBarLabel = (repIndex: number): boolean =>\n !labelsCrowded || repIndex === peakRepIndex || repIndex === liveRepIndex\n\n const geometry: SetBarGeometry = { scaleDenom, plotHeight, yOf, best, flip }\n\n const { style: externalStyle, ...restProps } = viewProps\n const a11y =\n accessibilityLabel != null ? { accessibilityRole: 'image' as const, accessibilityLabel } : {}\n\n // Which performed rep each cell is (window stubs → -1) — for live-grow / peak / label thinning.\n const repIndices = repIndexByCell(cells)\n\n return (\n <View\n className={className}\n style={[{ height, flexDirection: 'row' }, externalStyle]}\n testID={testID}\n {...a11y}\n {...restProps}\n >\n {label ? (\n <ChartSideRail\n sections={[{ label, testID: `${testIDPrefix}-side-label` }]}\n sectionExtent={height}\n />\n ) : null}\n <View\n onLayout={onPlotLayout}\n style={{\n flex: 1,\n flexDirection: 'row',\n alignItems: 'flex-end',\n gap,\n position: 'relative',\n borderBottomWidth: hideBaseline ? 0 : 2,\n borderBottomColor: placeholderColor,\n ...flipStyle,\n }}\n >\n {renderReference?.(geometry)}\n\n {cells.map((slot, i) => {\n // A chunk boundary (leadingGap > the ordinary rep gap) gets extra margin PROPORTIONAL to\n // bar width (floored) so the cluster break scales with the dense spacing and stays clear;\n // ordinary cells add nothing beyond the container's flex gap.\n const isChunkBoundary = (slot.leadingGap ?? REP_GAP) > REP_GAP\n const extraGap = isChunkBoundary\n ? Math.max(CHUNK_NOTCH_MIN_PX, CHUNK_NOTCH_RATIO * barWidth)\n : 0\n const column: ViewStyle = {\n flex: 1,\n maxWidth: BAR_MAX_WIDTH,\n height: '100%',\n alignItems: 'center',\n justifyContent: 'flex-end',\n marginLeft: extraGap,\n }\n\n if (!isRep(slot)) {\n return (\n <View key={i} accessibilityElementsHidden style={column}>\n {renderStub(\n slot.kind,\n barCorners,\n // Flat (compact) stubs fill the plot like the compact bars; else the fixed short stub.\n flat ? compactBarHeight : STUB_HEIGHT,\n placeholderColor,\n testIDPrefix,\n todoVariant,\n solidTodoColor,\n emptyColor\n )}\n </View>\n )\n }\n\n const repIndex = repIndices[i]\n const value = slot.value ?? 0\n const isLive = liveRepIndex === repIndex\n const color = colorFor(value)\n // Bar height: `expandProgress` morphs flat↔value in place; else the live-rep grow; else static.\n const barHeightStyle = expandProgress\n ? expandProgress.interpolate({\n inputRange: [0, 1],\n outputRange: [flatBarHeight, valueBarHeight(value)],\n })\n : isLive\n ? liveGrowth.interpolate({ inputRange: [0, 1], outputRange: [0, barHeight(value)] })\n : barHeight(value)\n // The wrapper's `renderBarOverlay` owns labels + press when present (so SetBarChart doesn't\n // duplicate them); its own label shows otherwise, fading in with `expandProgress`.\n const ownLabel = showValueLabels && !renderBarOverlay && showBarLabel(repIndex)\n const labelBottom = (expandProgress ? valueBarHeight(best) : barHeight(best)) + LABEL_GAP\n return (\n <View key={i} accessibilityElementsHidden={renderBarOverlay == null} style={column}>\n {ownLabel && (\n // All labels pin to one aligned row JUST ABOVE THE PEAK BAR (not the container top),\n // in the muted on-surface-secondary tone — so the row hugs the bars, no floating void.\n <Animated.View\n style={{\n position: 'absolute',\n bottom: labelBottom,\n left: 0,\n right: 0,\n alignItems: 'center',\n ...(expandProgress ? { opacity: expandProgress } : null),\n }}\n pointerEvents=\"none\"\n >\n <Text\n className=\"text-text-secondary\"\n style={[{ fontSize: valueLabelFontSize(height), fontWeight: '700' }, flipStyle]}\n testID={`${testIDPrefix}-label-${repIndex}`}\n >\n {formatValue(value)}\n </Text>\n </Animated.View>\n )}\n <Animated.View\n style={[\n { width: '100%', height: barHeightStyle, backgroundColor: color },\n barCorners,\n barPaper(color, flip),\n ]}\n testID={`${testIDPrefix}-bar-${repIndex}`}\n />\n {renderBarOverlay?.(repIndex, value)}\n </View>\n )\n })}\n </View>\n </View>\n )\n}\n\n/** A window cell (planned / variable / continue / empty) — a fixed-height stub in its set-type tone. */\nfunction renderStub(\n kind: SetSlot['kind'],\n barCorners: ViewStyle,\n stubHeight: number,\n placeholderColor: string,\n testIDPrefix: string,\n todoVariant: 'dashed' | 'solid',\n solidTodoColor: string,\n emptyColor: string\n): ReactNode {\n const base: ViewStyle = {\n width: '100%',\n height: stubHeight,\n ...barCorners,\n }\n if (kind === 'variable') {\n return (\n <View\n style={{ ...base, backgroundColor: VARIABLE_FILL }}\n testID={`${testIDPrefix}-slot-variable`}\n />\n )\n }\n if (kind === 'continue') {\n return (\n <View\n style={{ ...base, borderWidth: 1, borderColor: CONTINUE_OUTLINE }}\n testID={`${testIDPrefix}-slot-continue`}\n />\n )\n }\n if (kind === 'empty') {\n // A rep column the diverging side did NOT log — a faint constant-contrast section, quieter than\n // a planned to-do (it's a hole in this side's data, index-locked to the other side's rep).\n return (\n <View\n style={{ ...base, backgroundColor: emptyColor }}\n testID={`${testIDPrefix}-slot-empty`}\n />\n )\n }\n // todo — a solid surface-relative section (expanded language) or a dashed outline (hero language).\n const todoStyle: ViewStyle =\n todoVariant === 'solid'\n ? { ...base, backgroundColor: solidTodoColor }\n : { ...base, borderWidth: 1, borderStyle: 'dashed', borderColor: placeholderColor }\n return <View style={todoStyle} testID={`${testIDPrefix}-slot-todo`} />\n}\n\n/** Side/stream-name label font size (px), scaled to chart height so a long name fits un-truncated. */\nexport function sideLabelFontSize(height: number): number {\n return Math.round(Math.max(7, Math.min(13, height * 0.06)))\n}\n\n/**\n * Below this vertical extent (px) the side label collapses to initials rather than shrink further.\n * A 120px dual (60px per wing) sits below this, so its wings degrade to \"L\" / \"R\"; the compact `rail`\n * is exempted at its call site (it keeps its own tuned full-name treatment).\n */\nexport const SIDE_LABEL_INITIALS_BELOW = 70\n\n/**\n * The side-label text for the available vertical `extent`: the full name when there's room, else it\n * degrades to INITIALS — the first letter of each word (\"Left Arm\" → \"L A\", \"Left\" → \"L\", \"Right\" →\n * \"R\") — so a slot name stays legible at tiny chart heights instead of shrinking into a smear.\n */\nexport function sideLabelText(label: string, extent: number): string {\n if (extent >= SIDE_LABEL_INITIALS_BELOW) return label\n return label\n .trim()\n .split(/\\s+/)\n .map((word) => word.charAt(0))\n .join(' ')\n .toUpperCase()\n}\n\n/** One section of the shared {@link ChartSideRail} — a wing's rotated stream/slot-name label. */\nexport interface SideRailSection {\n label?: string\n testID: string\n}\n\n/**\n * The ONE shared gutter/side-rail lockup used by BOTH the single hero and the diverging dual, so a\n * single chart is pixel-identical to the dual's upper half — going dual only adds a lower section.\n * A fixed-width gutter (34px hero / 18px rail) with the `border-border` right hairline (the vertical\n * axis) and one rotated, height-responsive, initials-collapsing label per section (each `sectionExtent`\n * tall). The single passes ONE section; the dual passes two (up + down wings). Rendered null when no\n * section carries a label. The rotate lives on a wrapper sized to `sectionExtent` so `numberOfLines`\n * resolves against the tall vertical extent — a long name only ellipsizes when it exceeds the section.\n */\nexport function ChartSideRail({\n sections,\n sectionExtent,\n variant = 'hero',\n}: {\n sections: SideRailSection[]\n sectionExtent: number\n variant?: 'hero' | 'rail'\n}) {\n if (!sections.some((s) => s.label)) return null\n const isRail = variant === 'rail'\n const labelLength = Math.max(0, sectionExtent - (isRail ? 0 : 6))\n // Font scales to the SECTION (wing) height so a slot name fits without truncating; the compact rail\n // keeps its own tuned 7px full-name treatment (hero + single collapse to initials at small heights).\n const fontSize = isRail ? 7 : sideLabelFontSize(sectionExtent)\n const textStyle = {\n maxWidth: '100%' as const,\n textAlign: 'center' as const,\n fontSize,\n fontWeight: '700' as const,\n letterSpacing: isRail || fontSize < 10 ? 0 : 2,\n textTransform: 'uppercase' as const,\n }\n return (\n <View style={{ width: isRail ? 18 : 34 }} accessibilityElementsHidden>\n {sections.map((s) => (\n <View\n key={s.testID}\n style={{ height: sectionExtent, alignItems: 'center', justifyContent: 'center' }}\n >\n {s.label ? (\n <View\n style={{\n width: labelLength,\n alignItems: 'center',\n transform: [{ rotate: '-90deg' }],\n }}\n >\n <Text\n className=\"text-text-tertiary\"\n style={textStyle}\n numberOfLines={1}\n testID={s.testID}\n >\n {isRail ? s.label : sideLabelText(s.label, sectionExtent)}\n </Text>\n </View>\n ) : null}\n </View>\n ))}\n </View>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { useEffect, useState } from 'react'\nimport { View, Text, Pressable, Animated, type ViewProps, type ViewStyle } from 'react-native'\nimport { WORKOUT_TOKENS } from '../../../theme/workout-tokens'\nimport { primitiveColors, sequentialEffort } from '../../../theme/tokens/primitives'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\nimport { alpha } from '../../../utils/colors'\nimport { formatVelocity } from '../../../utils/workout-format'\nimport {\n SetBarChart,\n type SetSlot,\n type SetBarGeometry,\n ChartSideRail,\n SET_BAR_DEFAULT_HEIGHT,\n} from '../charts/SetBarChart'\nimport { ANIMATION_EASING } from '../charts/live-rep-growth'\n\n/**\n * Structural velocity-zone band accepted from an upstream analytics source\n * (e.g. workout-analytics' `VelocityZones.bands`).\n *\n * Deliberately a plain structural shape — titan never imports the analytics\n * package (the same presentational-only policy the Workout family follows). Any object with\n * this shape can be passed, so `zones={waVelocityZones.bands}` works directly.\n * Bands are ordered slow → fast, contiguous, and cover `[0, ∞)` with the top\n * band's `max === null`. Bands carry NO color — color is a UI concern resolved\n * here via {@link zoneIdToScaleToken}.\n */\nexport interface VelocityZoneBandProp {\n /** Stable zone identity (e.g. WA's `VelocityZoneId`). Drives color mapping. */\n id: string\n /** Human-readable label shown in the summary row. */\n label: string\n /** Inclusive lower bound (m/s mean concentric velocity). */\n min: number\n /** Exclusive upper bound (m/s); `null` marks the open top band. */\n max: number | null\n}\n\nexport interface VelocityStripProps extends ViewProps {\n /**\n * Per-rep MEAN concentric velocity (m/s), one entry per rep (brain WA-D02).\n * Drives both bar height and — in the default path — zone color. Callers must\n * feed mean (not peak) concentric velocity so bar color, height, and the\n * summary label all describe one metric.\n *\n * Optional: provide exactly one of `velocities` or {@link VelocityStripProps.set}.\n * When neither is given the strip renders nothing.\n */\n velocities?: number[]\n /**\n * Optional structured strength-training set descriptor (see {@link VelocitySet}).\n * When present it supersedes `velocities`: the done-velocity array is derived\n * from the set (so mean / loss / zone summaries still work) and the strip is\n * drawn as a typed slot list — grey todo, cyan variable / continue windows and\n * the wide-gap chunking that distinguishes drop / myo / cluster sets. Provide\n * exactly one of `velocities` or `set`.\n */\n set?: VelocitySet\n /**\n * Optional velocity-zone bands (shape-compatible with WA's\n * `VelocityZones.bands`). When provided, bar color and the summary zone label\n * come from these bands via {@link zoneIdToScaleToken}. When omitted, the\n * built-in default scale (≥1.0 / ≥0.75 / ≥0.5) is used — identical to prior\n * releases. Colors NEVER come from the bands themselves.\n */\n zones?: readonly VelocityZoneBandProp[]\n /**\n * Bar-fill coloring mode. `loss` (DEFAULT) — color each performed bar by its\n * velocity LOSS from the set's OWN best (see {@link getVelocityLossColor}), so a\n * fatiguing set reads green→red by loss regardless of its absolute speed; ignores\n * {@link zones} (it is a wholly separate scale). `zone` — color from the absolute\n * velocity-zone scale ({@link zones} when provided, else the built-in\n * ≥1.0/≥0.75/≥0.5 default). `todo`/`variable`/`continue` slots are unaffected either way.\n */\n barColor?: 'zone' | 'loss'\n /**\n * `hero` only: draw the VL20 / VL30 velocity-loss decision bands behind the bars\n * (see {@link VelocityLossBands}). Defaults to on when {@link barColor} is `loss`\n * (the default), off for `zone` — the bands and the loss bar-fill are the two\n * halves of the same loss-relative language.\n */\n showLossBands?: boolean\n /**\n * `hero` only: `up` (default) grows bars UP from a bottom baseline; `down` mirrors\n * the whole plot (bars grow DOWN from a top baseline, text upright). The diverging\n * dual is just an `up` hero over a `down` hero sharing one axis — so any hero\n * improvement reaches the dual for free.\n */\n orientation?: 'up' | 'down'\n /**\n * `hero` only: OVERRIDE the height-scaling denominator with `scaleMax * headroom` instead of\n * this strip's own `peak`/`fixed` scale. Affects BAR HEIGHT ONLY — velocity-LOSS coloring and\n * the running-best reference line still measure off THIS strip's own velocities. The diverging\n * dual passes the pair's shared max here so a stronger arm's bars read TALLER against one common\n * scale while each arm still colors by its own loss.\n */\n scaleMax?: number\n /**\n * `hero` only (internal): suppress this strip's own 2px baseline border. The diverging dual sets\n * it on BOTH composed wings and draws ONE shared centre axis where they meet, so the axis is a\n * single crisp line rather than two abutting baselines reading as a double-thick rule.\n */\n hideBaseline?: boolean\n /**\n * `hero` only (internal): the EXACT rendered column structure, overriding this strip's own\n * slot-building. The diverging dual builds ONE index-locked structure shared by both wings (same\n * rep indices, same WIDE-gap positions, same column count; a column a side didn't log renders\n * `empty`) and passes it here so bars line up column-for-column across the centre axis. Bar\n * height / color / the running-best reference still read this strip's own `velocities`.\n */\n columnSlots?: SetSlot[]\n /**\n * `hero` only: an optional stream / slot NAME (e.g. \"Left Arm\"), rendered as a rotated vertical\n * edge label down the chart's left gutter — the same treatment the diverging dual gives each wing,\n * so a single hero and a dual read consistently. Omitted → no gutter.\n */\n label?: string\n /**\n * Live mode: index of the most-recently-completed rep. That bar GROWS UP FROM\n * THE BASELINE to its full height as it enters, tracking the rep as it lands;\n * if it is also the current set peak (a new best) the growth slightly\n * overshoots then settles, reading as a small bounce. Only the latest bar\n * animates. Honors `prefers-reduced-motion`. Framed `expanded` chart and\n * `hero` only (interactive tap-to-expand use).\n */\n liveRepIndex?: number\n /**\n * `expanded` variant: whether the chart is OPEN. Default true (the variant shows\n * its chart). Toggle it (with {@link onToggle}) for the interactive tap-to-expand\n * collapse↔chart animation; a static open chart (no `onToggle`) does not animate.\n */\n expanded?: boolean\n onToggle?: () => void\n onRepPress?: (index: number, velocity: number) => void\n /**\n * `compact` — the flat resting strip: {@link SetBarChart} in FLAT mode (uniform short bars, no\n * value labels), sharing hero's exact geometry (colors, paper, spacing, chunk-notch, slots, gutter).\n * `expanded` — the velocity-HEIGHT bar chart (rounded tops), whose chrome is prop-driven: with\n * {@link showNumbers} or {@link showInfo} on it's the framed chart (raised surface, padding, per-bar\n * m/s labels, mean/loss info row, interactive collapse); with both off it's a bare strip — the\n * active-set \"spotlight\" of {@link ExerciseCard}. `hero` — the across-the-room, single-set wall\n * treatment: tall bars, a per-bar m/s value label, a dashed running-best reference line, and dashed\n * placeholders for the reps still to come (see {@link targetReps}). All three share SetBarChart, so\n * bars align across compact / expanded / hero.\n */\n variant?: 'compact' | 'expanded' | 'hero'\n /** `expanded` / `hero` plot height in px (bars scale to this). Default 60 (`expanded`) / 220 (`hero`). */\n height?: number\n /**\n * `hero` only: the set's planned rep count. Reps beyond {@link velocities} draw as\n * dashed placeholder stubs so the wall reads \"3 of 8 done\" at a glance. Ignored\n * (and no placeholders drawn) when absent or ≤ the performed-rep count.\n */\n targetReps?: number\n /**\n * `expanded` / `hero` bar scaling. `peak` (default) scales to the set's own max\n * (+15% headroom). `fixed` scales to a fixed velocity ceiling so bar heights read\n * the same absolute velocity across sets (the spotlight).\n */\n scale?: 'peak' | 'fixed'\n /** `expanded` framed chart: per-bar m/s labels. Default true. */\n showNumbers?: boolean\n /** `expanded` framed chart: the mean/loss info row. Default true. */\n showInfo?: boolean\n className?: string\n}\n\n// Canonical 4-color performance scale shared with SetRow's RPE color\n// (see theme/workout-tokens.ts). green = fastest, red = slowest/grinding.\nconst VEL_COLORS = WORKOUT_TOKENS.scale\n\n/**\n * Map a velocity-zone id (WA's 5-band taxonomy) directly onto the 6-stop\n * `sequentialEffort` ramp. The default strip uses the 4-color {@link VEL_COLORS}\n * scale (a subsample of the same ramp), but the 5-band taxonomy has one more\n * level than that scale carries, so it samples 5 stops: the top four align with\n * the default scale (speed/power/strengthSpeed/maximalStrength = green/gold/\n * orange/red) and `grinding` takes the ramp's darker red. `maximalStrength` and\n * `grinding` therefore stay DISTINCT — they no longer collapse onto one red for\n * lack of a 5th hue. An exercise moving from default to profile-derived zones\n * never shifts its fast-end colors.\n *\n * Unknown ids fall back to `green` (matching the historical default-path\n * fallback), so a forward-compatible band id never renders an empty bar.\n */\nconst bandIdToEffortColor: Record<string, string> = {\n speed: sequentialEffort[0], // green-300\n power: sequentialEffort[2], // amber-300 (gold)\n strengthSpeed: sequentialEffort[3], // orange-400\n maximalStrength: sequentialEffort[4], // red-600\n grinding: sequentialEffort[5], // red-700 — the distinct 5th band\n}\n\n// --- Default (no-zones) scale ------------------------------------------------\n// Retained as named exports for back-compat; they define the default path.\n\nexport function getVelocityZoneColor(velocity: number): string {\n if (velocity >= 1.0) return 'vel-green'\n if (velocity >= 0.75) return 'vel-yellow'\n if (velocity >= 0.5) return 'vel-orange'\n return 'vel-red'\n}\n\nexport function getVelocityZoneName(velocity: number): string {\n if (velocity >= 1.0) return 'Speed'\n if (velocity >= 0.75) return 'Power'\n if (velocity >= 0.5) return 'Strength-Speed'\n return 'Strength'\n}\n\nconst zoneHexMap: Record<string, string> = {\n 'vel-green': VEL_COLORS.green,\n 'vel-yellow': VEL_COLORS.yellow,\n 'vel-orange': VEL_COLORS.orange,\n 'vel-red': VEL_COLORS.red,\n}\n\n/**\n * Velocity loss for a set, as a whole percentage. Uses the running-best rep as\n * the reference (matching WA-02.05 / brain WA-D01): `(vBest − vLast) / vBest`,\n * clamped to ≥ 0 so a set that ends on its best rep reports 0 loss.\n */\nexport function calculateVelocityLoss(velocities: number[]): number {\n if (velocities.length < 2) return 0\n const best = Math.max(...velocities)\n if (best <= 0) return 0\n const last = velocities[velocities.length - 1]\n return Math.max(0, Math.round(((best - last) / best) * 100))\n}\n\n/** Arithmetic mean of the per-rep mean-concentric velocities. */\nexport function calculateMeanVelocity(velocities: number[]): number {\n if (velocities.length === 0) return 0\n const sum = velocities.reduce((acc, v) => acc + v, 0)\n return sum / velocities.length\n}\n\n/**\n * Velocity-loss band thresholds (loss %), the same VL10/VL20/VL30 coaching cues\n * FatigueMeter's default thresholds use — kept in sync so a `barColor=\"loss\"`\n * strip and a fatigue hero's VL20/VL30 reference bands agree on where amber/red start.\n */\nconst VL_LOSS_THRESHOLDS: readonly [number, number, number] = [10, 20, 30]\n\n/**\n * Map a per-rep velocity LOSS (%, from the set's own best — see {@link\n * velocityLossForRep}) onto the same green→gold→orange→red scale as the absolute\n * zone scale ({@link VEL_COLORS}), banded at the {@link VL_LOSS_THRESHOLDS}\n * VL10/VL20/VL30 cues. Past VL20 reads orange (\"past VL20 = amber\" in coaching\n * terms — this scale's amber/gold band is the yellow stop, orange is the VL20+\n * band), past VL30 reads red, so a fatiguing set reads green→red by LOSS\n * regardless of how slow its absolute velocity is.\n */\nexport function getVelocityLossColor(lossPct: number): string {\n const [t1, t2, t3] = VL_LOSS_THRESHOLDS\n if (lossPct < t1) return VEL_COLORS.green\n if (lossPct < t2) return VEL_COLORS.yellow\n if (lossPct < t3) return VEL_COLORS.orange\n return VEL_COLORS.red\n}\n\n/**\n * A single rep's velocity loss (%) relative to the set's own best rep, clamped to\n * ≥ 0 (a best-so-far rep, or a set with no positive best, reports 0 loss — green).\n * Rounded (matching {@link calculateVelocityLoss}'s convention) so a rep that is\n * arithmetically the set's best — or lands exactly on a VL threshold — doesn't drift\n * across a color-band boundary on floating-point noise (e.g. `1.0 − 0.9` ≈ `0.0999…998`).\n * Feeds `barColor=\"loss\"` bar coloring; distinct from {@link calculateVelocityLoss},\n * which reports only the set's FINAL loss (last rep vs best) as a single summary number.\n */\nfunction velocityLossForRep(velocity: number, best: number): number {\n if (best <= 0) return 0\n return Math.max(0, Math.round(((best - velocity) / best) * 100))\n}\n\n/** Classify a velocity into its band (slow → fast, min inclusive / max exclusive). */\nfunction classifyBand(\n velocity: number,\n bands: readonly VelocityZoneBandProp[]\n): VelocityZoneBandProp | undefined {\n for (const band of bands) {\n if (band.max === null || velocity < band.max) return band\n }\n return bands[bands.length - 1]\n}\n\nfunction bandColor(band: VelocityZoneBandProp): string {\n return bandIdToEffortColor[band.id] ?? VEL_COLORS.green\n}\n\n/**\n * The zone → bar-color resolver, single-sourced so every variant (and the dual\n * diverging sibling) colors reps identically: profile-derived `zones` map through\n * {@link bandColor}; the default (no-zones) path uses the built-in 4-color scale.\n * Color is ALWAYS the velocity zone — never the voltra side.\n */\nfunction makeBarColorFor(zones?: readonly VelocityZoneBandProp[]): (v: number) => string {\n const hasZones = zones != null && zones.length > 0\n return (v: number): string =>\n hasZones ? bandColor(classifyBand(v, zones)!) : zoneHexMap[getVelocityZoneColor(v)]\n}\n\nfunction getLossStyle(loss: number): Record<string, string> | null {\n if (loss > 25) return { color: VEL_COLORS.red }\n if (loss > 20) return { color: VEL_COLORS.orange }\n return null\n}\n\n// --- Set-type slot model -----------------------------------------------------\n// The strength-training set vocabulary (operator-approved in the Set Modalities\n// exploration): one strip encoding for every per-rep set type. A set resolves to\n// an ordered list of slots; the slot `kind` picks the color and `leadingGap`\n// encodes the chunk pattern (rep gap vs the wide notch that splits drop sub-loads\n// / myo clusters / cluster intra-rests). Set-LEVEL types (pyramid / superset /\n// tempo) belong to the heading, not the strip.\n\n/**\n * A structured strength-training set. Supply as {@link VelocityStripProps.set} to\n * render its set-type encoding; the done-velocity array (used for the mean / loss\n * / zone summary) is derived from the type's velocity fields.\n */\nexport type VelocitySet =\n /** Fixed reps at a fixed load: done reps colored + a grey todo remainder to `planned`. */\n | { type: 'straight'; velocities: number[]; planned?: number }\n /** Bounded reps: committed slots `0..floor`, then a cyan variable window `floor..max`. */\n | { type: 'range'; velocities: number[]; floor: number; max: number }\n /** As-many-reps-as-possible: done reps + a trailing cyan \"continue\" slot that never closes. */\n | { type: 'amrap'; velocities: number[]; target?: number }\n /** Load drops with no rest: each sub-load's reps, split by a WIDE notch gap. */\n | { type: 'drop'; subloads: number[][] }\n /** Rest-pause: an activation chunk + mini-clusters split by WIDE gaps; `open` adds a cyan continue. */\n | { type: 'myo'; activation: number[]; clusters: number[][]; open?: boolean }\n /** Fixed count broken by intra-set rests: reps grouped by `groupSize` with WIDE intra-rest gaps. */\n | { type: 'cluster'; velocities: number[]; groupSize: number; planned?: number }\n\n/** One drawn cell of the strip. `kind` picks the color; `leadingGap` the spacing before it. */\ninterface VelocitySlot {\n kind: 'rep' | 'todo' | 'variable' | 'continue'\n velocity?: number\n leadingGap: number\n}\n\n/** Butted reps carry this gap; chunk boundaries carry {@link WIDE_GAP}. */\nconst REP_GAP = 2\n/**\n * The between-group notch (drop sub-loads / myo clusters / cluster intra-rests): a\n * fixed 8px total gap that reads as a group break without dominating a narrow strip.\n * 4× the rep gap — enough to separate groups at session-rail scale AND wall scale\n * without the notch ballooning at large widths. In the mini variant the container's\n * 2px gap covers part of it, so per-slot margin adds the remaining 6px (2 + 6 = 8).\n */\nconst WIDE_GAP = 8\n\n/** The done-velocity array a set contributes to the mean / loss / zone summary. */\nfunction deriveDoneVelocities(set: VelocitySet): number[] {\n switch (set.type) {\n case 'drop':\n return set.subloads.flat()\n case 'myo':\n return [...set.activation, ...set.clusters.flat()]\n default:\n return set.velocities\n }\n}\n\n/** Flatten velocity chunks into rep slots, carving a WIDE gap before each chunk but the first. */\nfunction chunkedRepSlots(chunks: number[][]): VelocitySlot[] {\n const slots: VelocitySlot[] = []\n chunks.forEach((chunk) => {\n chunk.forEach((velocity, ri) => {\n const first = slots.length === 0\n slots.push({ kind: 'rep', velocity, leadingGap: first ? 0 : ri === 0 ? WIDE_GAP : REP_GAP })\n })\n })\n return slots\n}\n\n/** Resolve a set to its ordered slot list — the exact vocabulary of the Set Modalities sheet. */\nfunction buildSlots(set: VelocitySet): VelocitySlot[] {\n switch (set.type) {\n case 'straight': {\n const total = Math.max(set.velocities.length, set.planned ?? set.velocities.length)\n return Array.from({ length: total }, (_, i) => {\n const done = i < set.velocities.length\n return {\n kind: done ? 'rep' : 'todo',\n velocity: done ? set.velocities[i] : undefined,\n leadingGap: i === 0 ? 0 : REP_GAP,\n }\n })\n }\n case 'range': {\n const total = Math.max(set.max, set.velocities.length)\n return Array.from({ length: total }, (_, i) => {\n const kind: VelocitySlot['kind'] =\n i < set.velocities.length ? 'rep' : i < set.floor ? 'todo' : 'variable'\n return {\n kind,\n velocity: kind === 'rep' ? set.velocities[i] : undefined,\n leadingGap: i === 0 ? 0 : REP_GAP,\n }\n })\n }\n case 'amrap': {\n const reps = set.velocities.map<VelocitySlot>((velocity, i) => ({\n kind: 'rep',\n velocity,\n leadingGap: i === 0 ? 0 : REP_GAP,\n }))\n reps.push({ kind: 'continue', leadingGap: reps.length === 0 ? 0 : REP_GAP })\n return reps\n }\n case 'drop':\n return chunkedRepSlots(set.subloads)\n case 'myo': {\n const slots = chunkedRepSlots([set.activation, ...set.clusters])\n if (set.open) slots.push({ kind: 'continue', leadingGap: slots.length === 0 ? 0 : REP_GAP })\n return slots\n }\n case 'cluster': {\n const total = Math.max(set.velocities.length, set.planned ?? set.velocities.length)\n return Array.from({ length: total }, (_, i) => {\n const done = i < set.velocities.length\n const boundary = i > 0 && i % set.groupSize === 0\n return {\n kind: done ? 'rep' : 'todo',\n velocity: done ? set.velocities[i] : undefined,\n leadingGap: i === 0 ? 0 : boundary ? WIDE_GAP : REP_GAP,\n }\n })\n }\n }\n}\n\n/** A concise, set-type-aware summary for the strip's accessibility label. */\nfunction setAccessibilityLabel(set: VelocitySet, repCount: number): string {\n switch (set.type) {\n case 'straight':\n return `Velocity strip, straight set, ${repCount} reps`\n case 'range':\n return `Velocity strip, rep-range set, floor ${set.floor} to ${set.max}, ${repCount} reps done`\n case 'amrap':\n return `Velocity strip, AMRAP set, ${repCount} reps and counting`\n case 'drop':\n return `Velocity strip, drop set, ${set.subloads.length} loads, ${repCount} reps`\n case 'myo':\n return `Velocity strip, myo-reps set, ${set.clusters.length} clusters${set.open ? ', open' : ''}, ${repCount} reps`\n case 'cluster':\n return `Velocity strip, cluster set, groups of ${set.groupSize}, ${repCount} reps`\n }\n}\n\n/** Default framed `expanded` chart height (px). */\nconst EXPANDED_HEIGHT = 60\n/** Default `compact` (flat resting strip) height (px) — a THIN radius-2 pill row, the resting glance. */\nconst COMPACT_HEIGHT = 8\n\n/** The dashed running-best reference line color (the lightest charcoal step). */\nconst HERO_REFERENCE_COLOR = primitiveColors.charcoal[0]\n\n/**\n * A dashed running-best reference line spanning the plot width, absolutely positioned a\n * pixel `offset` from the given `anchor` edge. Shared by the single `hero` chart (anchored\n * to the baseline, `bottom`) and BOTH wings of the diverging dual chart (anchored to the\n * centre axis, `top`) so the three sites render one line treatment (charcoal-0, 1px dashed).\n * Presentation-only + non-interactive — the numeric best lives in each chart's container\n * accessibility label, so the line itself is hidden from the a11y tree.\n *\n * REUSE FOLLOW-UP: `Sparkline` hand-rolls the same dashed-line overlay (plus opacity, an\n * optional label, and a data-domain Y), and two lab specimens duplicate it again. A\n * top-level `ReferenceLine` overlay primitive unifying all of them is a scoped follow-up\n * (see the Workout README) — kept in-file here to keep the hero PR focused.\n */\nfunction DashedReferenceLine({\n anchor,\n offset,\n testID,\n}: {\n anchor: 'top' | 'bottom'\n offset: number\n testID: string\n}) {\n const edge: ViewStyle = anchor === 'top' ? { top: offset } : { bottom: offset }\n return (\n <View\n accessibilityElementsHidden\n style={{\n position: 'absolute',\n left: 0,\n right: 0,\n borderTopWidth: 1,\n borderStyle: 'dashed',\n borderColor: HERO_REFERENCE_COLOR,\n pointerEvents: 'none',\n ...edge,\n }}\n testID={testID}\n />\n )\n}\n\nconst BAND_LABEL_FONT = 'monospace'\n/**\n * Below this plot height (px) the VL20/VL30 labels are DROPPED entirely (the dashed lines + washes\n * stay) rather than shrunk into an overlapping smear. Tuned so a 120px dual (≈41px plot/wing) and the\n * cramped mid-small range drop, while the accepted board scale (≈76px plot/wing) keeps its labels.\n */\nconst VL_LABEL_MIN_PLOT = 65\nconst VL_SEMANTIC = getSemanticColors('dark')\n\n/**\n * Velocity-LOSS decision bands for the `hero` variant: the VL20 / VL30 coaching\n * cues (off the running best) drawn as absolutely-positioned bands + dashed\n * threshold lines BEHIND the bars, on the hero's own peak scale so a bar dropping\n * into the amber → red band reads as \"these are your last effective reps\". Shared\n * by the single hero, the diverging dual wings, and {@link VelocityHero}; render\n * it as the first child of the bottom-anchored plot container.\n *\n * `best` is the running-best velocity (the peak the loss is measured from);\n * `scaleDenom` / `plotHeight` are the hero chart's bar-scaling geometry — a\n * velocity `v` sits `(v / scaleDenom) * plotHeight` px up from the baseline,\n * matching {@link HeroVelocityChart}'s `barHeight`.\n */\nexport function VelocityLossBands({\n best,\n scaleDenom,\n plotHeight,\n flip = false,\n}: {\n best: number\n scaleDenom: number\n plotHeight: number\n /** The parent plot is vertically mirrored (a `down` wing) — counter-flip the labels upright. */\n flip?: boolean\n}) {\n if (best <= 0 || scaleDenom <= 0 || plotHeight <= 0) return null\n const yOf = (v: number): number => (v / scaleDenom) * plotHeight\n const vl20 = best * 0.8\n const vl30 = best * 0.7\n // The VL20 / VL30 lines sit ~0.09·plotHeight apart, so on a short chart their labels crowd. Scale\n // the label font to the plot height; below VL_LABEL_MIN_PLOT DROP the labels entirely (keep the\n // dashed lines + washes) rather than shrink them into an illegible smear.\n const vlFont = Math.round(Math.max(7, Math.min(9, plotHeight * 0.05)))\n const showLabels = plotHeight >= VL_LABEL_MIN_PLOT\n const band = (loV: number, hiV: number, color: string) => (\n <View\n style={{\n position: 'absolute',\n left: 0,\n right: 0,\n bottom: yOf(loV),\n height: Math.max(0, yOf(hiV) - yOf(loV)),\n backgroundColor: color,\n }}\n />\n )\n // The label sits ~90% along the threshold, with the dashed line breaking around it (a long segment\n // before + a short stub after) — near the quiet right end where a declining set has room. Below the\n // label threshold the line spans full width with no text.\n const threshold = (v: number, color: string, label: string) => (\n <View\n style={{\n position: 'absolute',\n left: 0,\n right: 0,\n bottom: yOf(v),\n // Collapse to zero height so the dashed border lands EXACTLY on `yOf(v)` — the\n // band edge — instead of floating up half a text-row (the label then centres on\n // the line, breaking it). Matches DashedReferenceLine's bare-border anchoring.\n height: 0,\n flexDirection: 'row',\n alignItems: 'center',\n }}\n >\n <View style={{ flex: 9, borderTopWidth: 1, borderStyle: 'dashed', borderColor: color }} />\n {showLabels ? (\n <>\n <Text\n style={{\n marginHorizontal: 6,\n fontSize: vlFont,\n fontWeight: '800',\n fontFamily: BAND_LABEL_FONT,\n color,\n ...(flip ? { transform: [{ scaleY: -1 as number }] } : null),\n }}\n >\n {label}\n </Text>\n <View style={{ flex: 1, borderTopWidth: 1, borderStyle: 'dashed', borderColor: color }} />\n </>\n ) : null}\n </View>\n )\n return (\n <View\n accessibilityElementsHidden\n pointerEvents=\"none\"\n style={{ position: 'absolute', left: 0, right: 0, bottom: 0, top: 0 }}\n testID=\"velocity-loss-bands\"\n >\n {band(0, vl30, alpha(VL_SEMANTIC['status-error'], 0.09))}\n {band(vl30, vl20, alpha(VL_SEMANTIC['status-warning'], 0.08))}\n {threshold(vl20, alpha(VL_SEMANTIC['status-warning'], 0.75), 'VL 20%')}\n {threshold(vl30, alpha(VL_SEMANTIC['status-error'], 0.75), 'VL 30%')}\n </View>\n )\n}\n\n/**\n * The velocity hero's reference overlay, painted by {@link SetBarChart} via `renderReference` from\n * the chart geometry: the VL20 / VL30 loss decision bands (when `showLossBands`) behind the bars,\n * plus the dashed running-best line at the peak. Both measure off the chart's OWN `best` — the\n * per-side loss language that survives the dual's shared height scale. Unlabeled by design (the peak\n * bar already shows its value; the numeric best is in the chart's accessibility label).\n */\nfunction velocityReferenceOverlay(g: SetBarGeometry, showLossBands: boolean) {\n const referencePx = g.best > 0 && g.scaleDenom > 0 ? Math.min(g.plotHeight, g.yOf(g.best)) : 0\n return (\n <>\n {showLossBands && (\n <VelocityLossBands\n best={g.best}\n scaleDenom={g.scaleDenom}\n plotHeight={g.plotHeight}\n flip={g.flip}\n />\n )}\n {referencePx > 0 && (\n <DashedReferenceLine\n anchor=\"bottom\"\n offset={referencePx}\n testID=\"velocity-hero-reference\"\n />\n )}\n </>\n )\n}\n\n/** Framed expanded collapse-animation duration (ms). */\nconst ANIMATION_DURATION = 400\n\n// --- Dual (bilateral) diverging chart ----------------------------------------\n// The two-device (LEFT + RIGHT voltra) treatment. Instead of two stacked single\n// heroes with independent baselines, ONE diverging chart shares a horizontal centre\n// axis: LEFT reps grow UP, RIGHT reps grow DOWN, one mirrored pair per rep index. The\n// asymmetry (left-dominant / right-lagging) reads pre-attentively as the silhouette.\n// It reuses VelocityStrip's slot model ({@link buildSlots}/{@link VelocitySlot}), its\n// zone color scale ({@link makeBarColorFor}), the hero geometry constants, and the\n// live-rep entrance ({@link useLiveRepGrowth}) — side is POSITION only, never hue.\n//\n// LIVE-REP ENTRANCE — do NOT re-add a dual-only one. The dual used to hand-roll its wing bars and\n// drive them from its own scale-pop hook, so the newest-rep animation existed TWICE and the two\n// copies drifted. Composing single strips retired that hook: `liveRepIndex` is now an ordinary\n// prop on each wing, so both wings animate through the same code path as a single hero and an\n// entrance that fires on one wing only is not expressible. Whether the wings should POP (a\n// whole-bar scale) rather than GROW from the axis is a live design question — but it belongs in\n// SetBarChart's shared entrance, applied to the single hero and the wings together. Reintroducing\n// it here would rebuild exactly the divergence this composition removed.\n\n/** One voltra's velocity stream — the SAME shape VelocityStrip accepts (one of these). */\nexport interface DualVelocityStream {\n /** Per-rep MEAN concentric velocity (m/s) for this side. */\n velocities?: number[]\n /** A structured set descriptor for this side (drives the typed slot vocabulary). */\n set?: VelocitySet\n /**\n * The side's SLOT NAME (e.g. \"Left Arm\"), rendered as the vertical edge label. This is\n * the slot's identity supplied by data — there is no hardcoded LEFT/RIGHT fallback. When\n * absent or empty, that side renders no label.\n */\n label?: string\n}\n\nexport interface DualVelocityStripProps extends ViewProps {\n /** The up-wing stream — drawn growing UP from the centre axis; its edge name comes from `left.label`. */\n left: DualVelocityStream\n /** The down-wing stream — drawn growing DOWN from the centre axis; its edge name comes from `right.label`. */\n right: DualVelocityStream\n /**\n * Optional velocity-zone bands (shape-compatible with WA's `VelocityZones.bands`),\n * shared with {@link VelocityStrip}. Colors the reps by zone on BOTH sides; side is\n * never encoded by hue. When omitted the built-in default scale is used.\n */\n zones?: readonly VelocityZoneBandProp[]\n /**\n * Bar-fill coloring mode, matching {@link VelocityStrip}. `loss` (DEFAULT) — each\n * wing colors by its velocity LOSS from THAT arm's own best (per-wing, since arms\n * fatigue independently). `zone` — the shared absolute zone scale. Side is never\n * encoded by hue either way.\n */\n barColor?: 'zone' | 'loss'\n /**\n * Planned rep count. Reps beyond a side's performed count draw as mirrored dashed\n * todo stubs (same \"3 of 8 done\" read as the single hero), on both wings.\n */\n targetReps?: number\n /** Index of the most-recently-completed rep; that mirrored pair animates in (hero only). */\n liveRepIndex?: number\n /**\n * `hero` — the across-the-room wall scale: tall wings, per-rep m/s value labels, and a dashed\n * running-best reference line per side. `compact` — the flat resting form: dual-hero but flat +\n * no labels (both wings are the `compact` VelocityStrip variant), same aligned structure + shared\n * gutter + axis. `rail` — the compact rail-expanded lean renderer, no labels / reference lines.\n */\n variant?: 'hero' | 'compact' | 'rail'\n /**\n * Bar-height scaling, shared across BOTH wings so the L/R asymmetry reads as bar\n * length against one scale. `peak` (default) = the pair's max +headroom; `fixed` =\n * a fixed velocity ceiling.\n */\n scale?: 'peak' | 'fixed'\n /** Total plot height (px), split evenly into the up (L) and down (R) wings. */\n height?: number\n className?: string\n}\n\n/** Default `hero` diverging height (px) — matches the single hero. */\nconst DUAL_HERO_HEIGHT = SET_BAR_DEFAULT_HEIGHT\n/** Default `rail` diverging height (px) — compact enough to sit inside a rail slot. */\nconst DUAL_RAIL_HEIGHT = 96\n/** Default `compact` diverging height (px) — two 5px rounded L/R sub-segments + the 1.5px fold gap. */\nconst DUAL_COMPACT_HEIGHT = 11.5\n\n// --- Rail geometry (the compact dedicated path) ------------------------------\n// The `hero` variant COMPOSES two single VelocityStrip heroes, so it inherits the\n// hero geometry for free. The `rail` variant is far smaller than a hero (no value\n// labels, reference lines, paper, or label headroom), so composing the hero would\n// drag all of that in; it keeps a lean dedicated renderer at these compact metrics.\n/** The vertical gap between the up/down wings on the axis-less rail (value-height dual-expanded). */\nconst DUAL_WING_GAP = 2\n/** The centre gap (px) splitting the folded compact dual's L (top) and R (bottom) halves — a gap, no line. */\nconst COMPACT_FOLD_GAP = 1.5\n/** Each folded-compact sub-segment's height (px) — a rounded pill per side, above/below the fold gap. */\nconst COMPACT_FOLD_HALF = 5\n\n/** One side's performed per-rep velocities — flattened from a `set` descriptor, or the raw array. */\nfunction streamDone(stream: DualVelocityStream): number[] {\n return stream.set ? deriveDoneVelocities(stream.set) : (stream.velocities ?? [])\n}\n\n/** A side's NATURAL slot list — its `set` slot vocabulary, or bare rep slots + a `targetReps` remainder. */\nfunction streamNaturalSlots(stream: DualVelocityStream, targetReps?: number): SetSlot[] {\n if (stream.set) {\n return buildSlots(stream.set).map((s) => ({\n kind: s.kind,\n value: s.velocity,\n leadingGap: s.leadingGap,\n }))\n }\n const reps: SetSlot[] = (stream.velocities ?? []).map((v, i) => ({\n kind: 'rep',\n value: v,\n leadingGap: i === 0 ? 0 : REP_GAP,\n }))\n const pad = Math.max(0, (targetReps ?? 0) - reps.length)\n return [...reps, ...Array.from({ length: pad }, () => ({ kind: 'todo' as const }))]\n}\n\n/**\n * The window-kind precedence when merging two sides' cells at a column: a set-type window (variable /\n * continue) that either side has wins; else if either logged (or plans) a rep there it's a REP column;\n * else it's a shared to-do. So a lagging side's not-yet-logged rep column stays a REP column (rendered\n * `empty` for that side), index-locked to the other side's rep — never shifted or re-spaced.\n */\nfunction mergeColumnKind(l: SetSlot | undefined, r: SetSlot | undefined): SetSlot['kind'] {\n const kinds = [l?.kind, r?.kind]\n if (kinds.includes('variable')) return 'variable'\n if (kinds.includes('continue')) return 'continue'\n if (kinds.includes('rep')) return 'rep'\n return 'todo'\n}\n\n/** One side's cell at a merged column: its logged rep (with value), else `empty` for a rep column, else the shared window kind. */\nfunction sideColumnCell(\n slot: SetSlot | undefined,\n kind: SetSlot['kind'],\n leadingGap: number\n): SetSlot {\n if (kind !== 'rep') return { kind, leadingGap }\n return slot?.kind === 'rep'\n ? { kind: 'rep', value: slot.value, leadingGap }\n : { kind: 'empty', leadingGap }\n}\n\n/**\n * Build ONE index-locked column structure shared by both diverging wings from their natural slot\n * lists: same column count, same rep indices, same WIDE-gap positions. Each column resolves to a\n * shared kind ({@link mergeColumnKind}); per side it's that side's rep value, or `empty` when the\n * side hasn't logged that rep (assumes symmetric bilateral reps — both sides step together).\n */\nfunction alignDualSlots(left: SetSlot[], right: SetSlot[]): { left: SetSlot[]; right: SetSlot[] } {\n const n = Math.max(left.length, right.length)\n const L: SetSlot[] = []\n const R: SetSlot[] = []\n for (let i = 0; i < n; i++) {\n const lt = left[i]\n const rt = right[i]\n const kind = mergeColumnKind(lt, rt)\n const gap = Math.max(lt?.leadingGap ?? REP_GAP, rt?.leadingGap ?? REP_GAP)\n L.push(sideColumnCell(lt, kind, gap))\n R.push(sideColumnCell(rt, kind, gap))\n }\n return { left: L, right: R }\n}\n\n/** Shared inputs for both dual renderers — the resolved per-side done arrays + presentation props. */\ninterface DualChartProps {\n leftDone: number[]\n rightDone: number[]\n /**\n * The raw per-side streams. The `hero` renderer passes each side's `set` (or `velocities`)\n * straight through to its composed VelocityStrip hero so a side's set-type WINDOWS (the range\n * cyan variable window, the AMRAP/myo \"continue\", drop/myo chunk-notch gaps) render on the dual\n * — not just the flattened reps. The lean `rail` renderer ignores them (it only takes velocities).\n */\n leftStream?: DualVelocityStream\n rightStream?: DualVelocityStream\n leftLabel?: string\n rightLabel?: string\n zones?: readonly VelocityZoneBandProp[]\n barColor: 'zone' | 'loss'\n /** Shared across BOTH wings: `peak` (the pair's max +headroom) or `fixed` (a cross-set ceiling). */\n scale: 'peak' | 'fixed'\n targetReps?: number\n height: number\n className?: string\n label: string\n viewProps: ViewProps\n}\n\n/**\n * The `hero` diverging chart — COMPOSED from two single {@link VelocityStrip} heroes: an `up` hero\n * over a `down` (vertically-mirrored) hero, sharing ONE height scale via {@link\n * VelocityStripProps.scaleMax} and meeting at one shared centre axis. Each wing hides its own\n * baseline ({@link VelocityStripProps.hideBaseline}) so the axis is a single crisp line. Because it\n * is literally two heroes, every hero improvement — paper, loss bands, grow-from-bottom, the\n * running-best reference, surface-relative placeholders, per-side loss coloring — reaches the dual\n * for free. Side is POSITION only: both wings color reps by the SAME `barColor` scale; the shared\n * `scaleMax` makes a stronger arm read TALLER while each wing still colors off its own best.\n */\nfunction DualVelocityHero({\n leftDone,\n rightDone,\n leftStream,\n rightStream,\n leftLabel,\n rightLabel,\n zones,\n barColor,\n scale,\n targetReps,\n liveRepIndex,\n height,\n className,\n label,\n viewProps,\n}: DualChartProps & { liveRepIndex?: number }) {\n // The two wings are separated by the SAME small gap as the expanded/rail dual (no centre-axis rule).\n const plotHalf = (height - DUAL_WING_GAP) / 2\n // ONE shared height scale across both wings so the L/R asymmetry reads as bar length, not two\n // scales; each composed strip still colors by its OWN loss and draws its OWN best reference.\n // `peak` shares the pair max via `scaleMax`; `fixed` shares the cross-set ceiling (both wings\n // resolve the same fixed ceiling), so `scaleMax` is left off and `scale` carries it.\n const sharedMax = Math.max(...leftDone, ...rightDone, 0)\n // ONE index-locked column structure shared by both wings: same rep indices, same WIDE-gap\n // positions, same column count. A column a side didn't log renders `empty` there — so a lagging\n // side's next rep lands at the SAME column index as the other side, never shifted or re-spaced.\n const aligned = alignDualSlots(\n leftStream ? streamNaturalSlots(leftStream, targetReps) : [],\n rightStream ? streamNaturalSlots(rightStream, targetReps) : []\n )\n const { style: externalStyle, ...restProps } = viewProps\n\n // Each wing renders the SHARED aligned structure (`columnSlots`); its own `velocities` still drive\n // bar height / per-side loss color / the running-best reference.\n const wing = (orientation: 'up' | 'down', columns: SetSlot[], done: number[]) => (\n <VelocityStrip\n variant=\"hero\"\n orientation={orientation}\n velocities={done}\n columnSlots={columns}\n scale={scale}\n scaleMax={scale === 'fixed' ? undefined : sharedMax}\n barColor={barColor}\n zones={zones}\n liveRepIndex={liveRepIndex}\n height={plotHalf}\n hideBaseline\n />\n )\n\n return (\n <View\n className={className}\n style={[{ height, flexDirection: 'row' }, externalStyle]}\n accessibilityRole=\"image\"\n accessibilityLabel={label}\n testID=\"dual-velocity-strip\"\n {...restProps}\n >\n {/* The SHARED gutter/side-rail (34px, no hairline) — one section per wing. A single hero renders\n the same rail with ONE section, so it's pixel-identical to this upper half. */}\n <ChartSideRail\n sectionExtent={plotHalf}\n variant=\"hero\"\n sections={[\n { label: leftLabel, testID: 'dual-velocity-side-label-L' },\n { label: rightLabel, testID: 'dual-velocity-side-label-R' },\n ]}\n />\n\n {/* The two composed heroes, separated by the shared wing gap (no centre-axis rule). Their own\n labels are redundant with the dual's summary label, so the wings are a11y-hidden. */}\n <View style={{ flex: 1, gap: DUAL_WING_GAP }}>\n <View accessibilityElementsHidden testID=\"dual-velocity-wing-up\">\n {wing('up', aligned.left, leftDone)}\n </View>\n <View accessibilityElementsHidden testID=\"dual-velocity-wing-down\">\n {wing('down', aligned.right, rightDone)}\n </View>\n </View>\n </View>\n )\n}\n\n/**\n * The `rail` diverging chart — a lean, compact dedicated renderer. Composing the hero here would\n * drag in its value labels, reference lines, paper, and label headroom, none of which belong at\n * rail scale; instead it draws mirrored per-side bars at the compact rail metrics. Same shared\n * height scale + per-side loss coloring + mirrored radius + shared axis as the hero, but no labels\n * / reference lines / paper. (Set-type slot windows are a hero-composition concern; rail only ever\n * takes plain velocities.)\n */\nfunction DualVelocityRail({\n leftDone,\n rightDone,\n leftStream,\n rightStream,\n zones,\n barColor,\n scale,\n targetReps,\n liveRepIndex,\n height,\n className,\n label,\n viewProps,\n}: DualChartProps & { liveRepIndex?: number }) {\n // The lean dual-EXPANDED. Composed from two bare `expanded` strips exactly as the hero composes\n // two heroes, rather than drawing its own bars: composing is what makes the dual inherit the\n // single's bar widths, gaps, chunk-notch, set-type slot windows, paper and live-rep growth. The\n // bespoke renderer this replaces took only velocities, so the dual silently dropped every\n // set-type window and let a lagging side render fewer bars than its partner.\n const plotHalf = (height - DUAL_WING_GAP) / 2\n // ONE shared height scale across both wings, so an L/R asymmetry reads as bar length rather than\n // as two independent scales.\n const sharedMax = Math.max(...leftDone, ...rightDone, 0)\n // ONE index-locked column structure. A column a side did not log renders as an aligned empty, so\n // the lagging side's next rep lands at the SAME column index as its partner's.\n const aligned = alignDualSlots(\n leftStream ? streamNaturalSlots(leftStream, targetReps) : [],\n rightStream ? streamNaturalSlots(rightStream, targetReps) : []\n )\n const { style: externalStyle, ...restProps } = viewProps\n\n const wing = (orientation: 'up' | 'down', columns: SetSlot[], done: number[]) => (\n <VelocityStrip\n variant=\"expanded\"\n showNumbers={false}\n showInfo={false}\n orientation={orientation}\n velocities={done}\n columnSlots={columns}\n scale={scale}\n scaleMax={scale === 'fixed' ? undefined : sharedMax}\n barColor={barColor}\n zones={zones}\n liveRepIndex={liveRepIndex}\n height={plotHalf}\n />\n )\n\n return (\n <View\n className={className}\n style={[{ height, flexDirection: 'column', gap: DUAL_WING_GAP }, externalStyle]}\n accessibilityRole=\"image\"\n accessibilityLabel={label}\n testID=\"dual-velocity-strip\"\n {...restProps}\n >\n {/* No gutter, side labels or centre axis at rail scale — the wings read as two rows via the\n shared gap alone. Their own labels would duplicate the dual's summary label. */}\n <View accessibilityElementsHidden testID=\"dual-velocity-wing-up\">\n {wing('up', aligned.left, leftDone)}\n </View>\n <View accessibilityElementsHidden testID=\"dual-velocity-wing-down\">\n {wing('down', aligned.right, rightDone)}\n </View>\n </View>\n )\n}\n\n/**\n * The `compact` diverging chart — the resting dual FOLDED into ONE 8px strip. Because the compact\n * bars are flat (colour-encoded, not height-encoded), the diverging pair need not stack into two\n * rows: each rep column splits at the centre into an L (top) and R (bottom) flat half (≈3.25px each,\n * a {@link COMPACT_FOLD_GAP}px gap between — a gap, not a line), so the pair occupies the SAME 8px as\n * the single compact — the per-rep analogue of the north-star stacked-halves. Index-locked (a lagging\n * side's un-logged reps render as faint empties); no gutter / labels / axis (no room at 8px). The\n * value-height diverging (where bar length must encode velocity) lives in `hero` / `rail`.\n */\nfunction DualVelocityCompactStrip({\n leftDone,\n rightDone,\n leftStream,\n rightStream,\n zones,\n barColor,\n targetReps,\n height,\n className,\n label,\n viewProps,\n}: DualChartProps) {\n // COMPOSED, like the hero and rail: two `compact` strips at COMPACT_FOLD_HALF each, separated by\n // COMPACT_FOLD_GAP (5 + 1.5 + 5 = DUAL_COMPACT_HEIGHT exactly). Because a compact bar FILLS its\n // plot, each column reads as an L top pill over an R bottom pill — the folded design, but drawn\n // by the same SetBarChart the single uses. Composing rather than hand-rolling is what makes the\n // set-type vocabulary (to-do, the cyan variable/continue windows, drop chunk-notch) and the\n // index-locked empty arrive for free, and keeps them from drifting apart later.\n const half = height === DUAL_COMPACT_HEIGHT ? COMPACT_FOLD_HALF : (height - COMPACT_FOLD_GAP) / 2\n const aligned = alignDualSlots(\n leftStream ? streamNaturalSlots(leftStream, targetReps) : [],\n rightStream ? streamNaturalSlots(rightStream, targetReps) : []\n )\n const { style: externalStyle, ...restProps } = viewProps\n\n const wing = (orientation: 'up' | 'down', columns: SetSlot[], done: number[]) => (\n <VelocityStrip\n variant=\"compact\"\n orientation={orientation}\n velocities={done}\n columnSlots={columns}\n barColor={barColor}\n zones={zones}\n height={half}\n />\n )\n\n return (\n <View\n className={className}\n style={[{ height, flexDirection: 'column', gap: COMPACT_FOLD_GAP }, externalStyle]}\n accessibilityRole=\"image\"\n accessibilityLabel={label}\n testID=\"dual-velocity-strip\"\n {...restProps}\n >\n <View accessibilityElementsHidden testID=\"dual-velocity-wing-up\">\n {wing('up', aligned.left, leftDone)}\n </View>\n <View accessibilityElementsHidden testID=\"dual-velocity-wing-down\">\n {wing('down', aligned.right, rightDone)}\n </View>\n </View>\n )\n}\n\n/**\n * The dual-voltra (bilateral) DIVERGING per-rep velocity chart. The up-wing stream grows UP, the\n * down-wing stream grows DOWN from one shared centre axis. The `hero` variant COMPOSES two single\n * {@link VelocityStrip} heroes (see {@link DualVelocityHero}) so any hero improvement reaches the\n * dual for free; `rail` uses a lean value-height renderer ({@link DualVelocityRail}); `compact` folds\n * the pair into one 8px strip ({@link DualVelocityCompactStrip}). Single-voltra sets keep using\n * {@link VelocityStrip} (`variant=\"hero\"`) — unchanged.\n */\nexport function DualVelocityStrip({\n left,\n right,\n zones,\n barColor = 'loss',\n targetReps,\n liveRepIndex,\n variant = 'hero',\n scale = 'peak',\n height,\n className,\n ...props\n}: DualVelocityStripProps) {\n const resolvedHeight =\n height ??\n (variant === 'hero'\n ? DUAL_HERO_HEIGHT\n : variant === 'compact'\n ? DUAL_COMPACT_HEIGHT\n : DUAL_RAIL_HEIGHT)\n // The done arrays drive the shared max + per-side best + the summary counts; the raw streams\n // flow to the hero wings so a side's set-type WINDOWS render (the `rail` renderer uses `*Done`).\n const leftDone = streamDone(left)\n const rightDone = streamDone(right)\n\n const label =\n `Dual velocity chart, left ${leftDone.length} of ${Math.max(leftDone.length, targetReps ?? leftDone.length)} reps, ` +\n `right ${rightDone.length} of ${Math.max(rightDone.length, targetReps ?? rightDone.length)} reps`\n\n const shared: DualChartProps = {\n leftDone,\n rightDone,\n leftStream: left,\n rightStream: right,\n leftLabel: left.label,\n rightLabel: right.label,\n zones,\n barColor,\n scale,\n targetReps,\n height: resolvedHeight,\n className,\n label,\n viewProps: props,\n }\n\n // `liveRepIndex` reaches the rail too: its wings are composed strips, so the newest rep grows\n // from the midline on BOTH sides. Compact is flat, so a grow animation has nothing to animate.\n if (variant === 'rail') return <DualVelocityRail {...shared} liveRepIndex={liveRepIndex} />\n if (variant === 'compact') return <DualVelocityCompactStrip {...shared} />\n return <DualVelocityHero {...shared} liveRepIndex={liveRepIndex} />\n}\n\nexport function VelocityStrip({\n velocities,\n set,\n zones,\n barColor = 'loss',\n showLossBands,\n orientation = 'up',\n scaleMax,\n hideBaseline,\n columnSlots,\n label,\n liveRepIndex,\n expanded = true,\n onToggle,\n onRepPress,\n variant = 'expanded',\n height = EXPANDED_HEIGHT,\n targetReps,\n scale = 'peak',\n showNumbers = true,\n showInfo = true,\n className,\n ...props\n}: VelocityStripProps) {\n // Bands default on with the loss bar-fill (the two halves of the loss language),\n // off for the absolute zone scale; an explicit prop always wins.\n const lossBandsOn = showLossBands ?? barColor === 'loss'\n // A `set` descriptor derives its own done-velocity array; the legacy\n // `velocities` path stays the source of truth otherwise. Every summary calc\n // (mean / loss / zone) runs on this one array so the info row works either way.\n const doneVelocities = set ? deriveDoneVelocities(set) : (velocities ?? [])\n\n const maxVelocity = Math.max(...doneVelocities, 0)\n const meanVelocity = calculateMeanVelocity(doneVelocities)\n const loss = calculateVelocityLoss(doneVelocities)\n\n // The framed chart (raised box, labels, info) vs the bare spotlight strip is the\n // only fork in the `expanded` variant — keyed by whether any chrome is requested.\n const framed = showNumbers || showInfo\n\n const hasZones = zones != null && zones.length > 0\n // Single-sourced zone resolver (diverging-hero) wrapped with the loss-relative mode: `barColor=\"loss\"`\n // colors each rep by its velocity loss from the set's own best, else the shared zone scale. Every\n // variant hands this `colorFor` to SetBarChart, so all variants color identically.\n const zoneColorFor = makeBarColorFor(zones)\n const barColorFor = (v: number): string =>\n barColor === 'loss' ? getVelocityLossColor(velocityLossForRep(v, maxVelocity)) : zoneColorFor(v)\n const meanZone = hasZones\n ? (classifyBand(meanVelocity, zones)?.label ?? '')\n : getVelocityZoneName(meanVelocity)\n\n // The framed collapse is now an IN-PLACE bar-height morph: `expandProgress` (0 collapsed → 1 open)\n // drives SetBarChart's bars flat↔value (no reflow), replacing the old collapse-to-3px height anim.\n // `infoOpacity` fades the info row; the per-bar labels fade with `expandProgress` in the overlay.\n const [expandProgress] = useState(() => new Animated.Value(expanded ? 1 : 0))\n const [infoOpacity] = useState(() => new Animated.Value(expanded ? 1 : 0))\n\n // Newest-rep animation: pop for a normal rep, bounce when it sets a new peak.\n const liveVelocity = liveRepIndex != null ? doneVelocities[liveRepIndex] : undefined\n const isNewPeak = liveVelocity != null && maxVelocity > 0 && liveVelocity === maxVelocity\n\n useEffect(() => {\n if (variant !== 'expanded' || !framed) return\n Animated.parallel([\n Animated.timing(expandProgress, {\n toValue: expanded ? 1 : 0,\n duration: ANIMATION_DURATION,\n easing: ANIMATION_EASING,\n useNativeDriver: false,\n }),\n Animated.timing(infoOpacity, {\n toValue: expanded ? 1 : 0,\n duration: 300,\n delay: expanded ? 200 : 0,\n useNativeDriver: false,\n }),\n ]).start()\n }, [expanded, variant, framed, expandProgress, infoOpacity])\n\n // Nothing to draw: neither a legacy velocity array nor a set descriptor.\n if (set == null && velocities == null) return null\n\n const repCount = doneVelocities.length\n const miniLabel = set ? setAccessibilityLabel(set, repCount) : `Velocity strip, ${repCount} reps`\n\n if (variant === 'hero') {\n // Hero's plot is far taller than the expanded chart; apply its own default when the caller left\n // `height` at the shared 60px default. The diverging dual (which passes `columnSlots`) sets an\n // explicit per-wing height — exempt it, so a dual whose wing height happens to be 60px (a 120px\n // dual) isn't mistaken for \"unset\" and blown up to 220.\n const heroHeight =\n height === EXPANDED_HEIGHT && columnSlots == null ? SET_BAR_DEFAULT_HEIGHT : height\n // `columnSlots` (the diverging dual's shared index-locked structure) wins; else a `set` builds\n // its own typed slots, and the plain `velocities` path is bare rep slots + a `targetReps` remainder.\n const heroSlots: SetSlot[] =\n columnSlots ??\n (set\n ? buildSlots(set).map((s) => ({\n kind: s.kind,\n value: s.velocity,\n leadingGap: s.leadingGap,\n }))\n : doneVelocities.map((v) => ({ kind: 'rep', value: v })))\n const total = Math.max(repCount, targetReps ?? repCount)\n const heroLabel =\n maxVelocity > 0\n ? `Velocity chart, ${repCount} of ${total} reps, best ${formatVelocity(maxVelocity)} meters per second`\n : `Velocity chart, ${repCount} of ${total} reps`\n return (\n <SetBarChart\n slots={heroSlots}\n colorFor={barColorFor}\n height={heroHeight}\n scale={scale}\n scaleMax={scaleMax}\n orientation={orientation}\n liveRepIndex={liveRepIndex}\n isNewPeak={isNewPeak}\n targetReps={set || columnSlots ? undefined : targetReps}\n label={label}\n showValueLabels\n formatValue={formatVelocity}\n renderReference={(g) => velocityReferenceOverlay(g, lossBandsOn)}\n hideBaseline\n testID=\"velocity-strip-hero\"\n testIDPrefix=\"velocity\"\n accessibilityLabel={heroLabel}\n className={className}\n viewProps={props}\n />\n )\n }\n\n if (variant === 'compact') {\n // `compact` = the flat resting form: SetBarChart in FLAT mode (uniform short bars, no value\n // labels), sharing hero's geometry — same colors, paper, 0.08 spacing, proportional chunk-notch,\n // todo/variable/continue slots, and gutter — so a compact↔expanded toggle only changes bar HEIGHT.\n // `columnSlots` (the diverging dual-compact's shared index-locked structure) wins, like the hero.\n const compactSlots: SetSlot[] =\n columnSlots ??\n (set\n ? buildSlots(set).map((s) => ({\n kind: s.kind,\n value: s.velocity,\n leadingGap: s.leadingGap,\n }))\n : doneVelocities.map((v) => ({ kind: 'rep', value: v })))\n const compactHeight = height === EXPANDED_HEIGHT ? COMPACT_HEIGHT : height\n return (\n <SetBarChart\n slots={compactSlots}\n colorFor={barColorFor}\n height={compactHeight}\n scale={scale}\n scaleMax={scaleMax}\n orientation={orientation}\n flat\n barRadius={2}\n cornerStyle=\"all\"\n targetReps={set || columnSlots ? undefined : targetReps}\n label={label}\n hideBaseline\n testID=\"velocity-strip-compact\"\n testIDPrefix=\"velocity\"\n accessibilityLabel={miniLabel}\n className={className}\n viewProps={props}\n />\n )\n }\n\n // Bare `expanded` strip (both chrome flags off): the velocity-HEIGHT spotlight — now\n // FOLDED onto SetBarChart (value mode, no labels), so its bars share the SAME geometry\n // (widths / gaps / chunk-notch / slots / paper) as compact + hero. Only the height-mode\n // (value here, flat in compact) differs, so a compact↔spotlight toggle never reflows.\n if (!framed) {\n // `columnSlots` wins, exactly as it does for compact and hero. The diverging dual passes the\n // index-locked shared structure through here; ignoring it gave the expanded dual its own\n // per-side columns, so a lagging side rendered FEWER bars instead of an aligned empty cell.\n const spotlightSlots: SetSlot[] =\n columnSlots ??\n (set\n ? buildSlots(set).map((s) => ({\n kind: s.kind,\n value: s.velocity,\n leadingGap: s.leadingGap,\n }))\n : doneVelocities.map((v) => ({ kind: 'rep', value: v })))\n return (\n <SetBarChart\n slots={spotlightSlots}\n colorFor={barColorFor}\n height={height}\n scale={scale}\n scaleMax={scaleMax}\n orientation={orientation}\n liveRepIndex={liveRepIndex}\n isNewPeak={isNewPeak}\n barRadius={2}\n cornerStyle=\"top\"\n targetReps={set ? undefined : targetReps}\n label={label}\n hideBaseline\n testID=\"velocity-strip-spotlight\"\n testIDPrefix=\"velocity\"\n accessibilityLabel={miniLabel}\n className={className}\n viewProps={props}\n />\n )\n }\n\n const stripLabel = set\n ? `${setAccessibilityLabel(set, repCount)}, tap to ${expanded ? 'collapse' : 'expand'}`\n : `Velocity chart for set, ${repCount} reps, tap to ${expanded ? 'collapse' : 'expand'}`\n // When onToggle wraps the strip or individual reps are interactive, the container itself is not a button\n const hasInteractiveContainer = onToggle != null\n const hasInteractiveReps = onRepPress != null && expanded\n\n const framedSlots: SetSlot[] = set\n ? buildSlots(set).map((sl) => ({\n kind: sl.kind,\n value: sl.velocity,\n leadingGap: sl.leadingGap,\n }))\n : doneVelocities.map((v) => ({ kind: 'rep', value: v }))\n\n // Per-bar overlay handed to SetBarChart so the framed chart keeps its m/s label (fading with the\n // expand) + its onRepPress hit-target WITHOUT re-rolling bars — one bar-rendering path remains.\n const needsBarOverlay = showNumbers || onRepPress != null\n const renderFramedBarOverlay = needsBarOverlay\n ? (repIndex: number, value: number) => (\n <>\n {showNumbers && (\n <Animated.View\n style={{\n opacity: expandProgress,\n position: 'absolute',\n top: -13,\n left: 0,\n right: 0,\n alignItems: 'center',\n }}\n accessibilityElementsHidden\n pointerEvents=\"none\"\n >\n <Text\n className=\"text-text-secondary\"\n style={{ fontSize: 8, fontWeight: '600' }}\n testID={`velocity-label-${repIndex}`}\n >\n {formatVelocity(value)}\n </Text>\n </Animated.View>\n )}\n {onRepPress && expanded && (\n <Pressable\n style={{ position: 'absolute', top: 0, bottom: 0, left: 0, right: 0 }}\n onPress={() => onRepPress(repIndex, value)}\n accessibilityRole=\"button\"\n accessibilityLabel={`Rep ${repIndex + 1}: ${formatVelocity(value)} meters per second, tap for details`}\n testID={`velocity-bar-pressable-${repIndex}`}\n />\n )}\n </>\n )\n : undefined\n\n // The framed chrome is a WRAPPER (raised box + info row + tap-to-collapse) around ONE SetBarChart\n // in value mode; the collapse is the in-place `expandProgress` bar-height morph, not a height strip.\n const stripContent = (\n <Animated.View\n className={[className, 'bg-surface-raised'].filter(Boolean).join(' ')}\n style={{ width: '100%', borderRadius: 6, paddingTop: 16, paddingBottom: showInfo ? 8 : 4 }}\n accessibilityRole={hasInteractiveContainer || hasInteractiveReps ? 'none' : 'button'}\n accessibilityLabel={hasInteractiveContainer || hasInteractiveReps ? undefined : stripLabel}\n testID=\"velocity-strip\"\n {...props}\n >\n <SetBarChart\n slots={framedSlots}\n colorFor={barColorFor}\n height={height}\n scale={scale}\n scaleMax={scaleMax}\n expandProgress={expandProgress}\n renderBarOverlay={renderFramedBarOverlay}\n targetReps={set ? undefined : targetReps}\n barRadius={2}\n cornerStyle=\"top\"\n hideBaseline\n testIDPrefix=\"velocity\"\n />\n {expanded && showInfo && (\n <Animated.View\n style={{\n flexDirection: 'row',\n justifyContent: 'space-between',\n opacity: infoOpacity,\n marginTop: 6,\n paddingHorizontal: 6,\n }}\n testID=\"velocity-info-row\"\n >\n <Text\n className=\"text-text-secondary\"\n style={{ fontSize: 10, fontFamily: 'Inter, sans-serif' }}\n >\n {meanZone} {'·'} {formatVelocity(meanVelocity)} m/s\n </Text>\n <Text\n className=\"text-text-secondary\"\n style={{ fontSize: 10, fontFamily: 'Inter, sans-serif', ...getLossStyle(loss) }}\n >\n Loss: {loss}%\n </Text>\n </Animated.View>\n )}\n </Animated.View>\n )\n\n if (onToggle) {\n return (\n <Pressable\n onPress={onToggle}\n accessibilityRole=\"button\"\n accessibilityLabel={stripLabel}\n testID=\"velocity-strip-pressable\"\n >\n {stripContent}\n </Pressable>\n )\n }\n\n return stripContent\n}\n","import { clsx, type ClassValue } from 'clsx'\nimport { twMerge } from 'tailwind-merge'\n\n/**\n * Utility function to merge Tailwind CSS classes with proper conflict resolution.\n * Combines clsx for conditional classes with tailwind-merge for deduplication.\n *\n * @example\n * cn('p-4 bg-red-500', isActive && 'bg-blue-500', className)\n * // If isActive is true, returns 'p-4 bg-blue-500' (not 'p-4 bg-red-500 bg-blue-500')\n */\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(clsx(inputs))\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { View, type ViewProps } from 'react-native'\nimport { cn } from '../../../utils/cn'\nimport { WORKOUT_TOKENS } from '../../../theme/workout-tokens'\n\nexport interface PlaceholderStripProps extends ViewProps {\n width?: number | string\n /** Render as single solid strip or segmented mini-strip */\n mode?: 'single' | 'segmented'\n /** Number of segments when mode is 'segmented' */\n segments?: number\n className?: string\n}\n\nfunction SingleStrip({\n width,\n className,\n ...props\n}: Omit<PlaceholderStripProps, 'mode' | 'segments'>) {\n return (\n <View\n className={className}\n style={[\n {\n height: 3,\n backgroundColor: WORKOUT_TOKENS.placeholder.fill,\n borderRadius: 2,\n opacity: 0.5,\n },\n width != null ? { width: width as number } : { flex: 1 },\n ]}\n accessibilityRole=\"image\"\n accessibilityLabel=\"Planned set, not yet completed\"\n testID=\"placeholder-strip\"\n {...props}\n />\n )\n}\n\nfunction SegmentedStrip({\n segments = 3,\n width,\n className,\n ...props\n}: Omit<PlaceholderStripProps, 'mode'>) {\n return (\n <View\n className={cn('flex-row', className)}\n style={[\n { height: 3, gap: 2, opacity: 0.5 },\n width != null ? { width: width as number } : { flex: 1 },\n ]}\n accessibilityRole=\"image\"\n accessibilityLabel=\"Planned set, not yet completed\"\n testID=\"placeholder-strip\"\n {...props}\n >\n {Array.from({ length: segments }, (_, i) => (\n <View\n key={i}\n style={{\n flex: 1,\n height: 3,\n backgroundColor: WORKOUT_TOKENS.placeholder.fill,\n borderRadius: 1,\n minWidth: 4,\n }}\n accessibilityElementsHidden\n testID=\"placeholder-segment\"\n />\n ))}\n </View>\n )\n}\n\nexport function PlaceholderStrip({\n mode = 'single',\n segments,\n ...props\n}: PlaceholderStripProps) {\n if (mode === 'segmented') {\n return <SegmentedStrip segments={segments} {...props} />\n }\n return <SingleStrip {...props} />\n}\n","import type { ReactNode } from 'react'\n\nexport interface IconProps {\n /** Rendered width/height in px (viewBox is fixed 24×24). */\n size?: number\n /** Stroke color (or fill, for solid icons). Defaults to `currentColor` so a wrapper's text token drives it. */\n color?: string\n /** Stroke width for outline icons. */\n strokeWidth?: number\n /** Fill color; defaults to `none` (outline). */\n fill?: string\n /** Accessible title — sets `role=\"img\"` + `<title>`. Omit for a decorative icon (hidden from AT). */\n title?: string\n}\n\nexport interface SvgIconProps extends IconProps {\n children: ReactNode\n}\n\n/**\n * Base SVG wrapper for the titan icon set — a 24×24 web-`<svg>` with the shared\n * accessibility contract (titled → `role=\"img\"` + `<title>`; untitled →\n * `aria-hidden`) and `currentColor` inheritance. Icons pass their paths as\n * children plus their stroke/fill defaults.\n */\nexport function SvgIcon({\n size = 24,\n color = 'currentColor',\n strokeWidth = 2,\n fill = 'none',\n title,\n children,\n}: SvgIconProps) {\n return (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill={fill}\n stroke={color}\n strokeWidth={strokeWidth}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n {...(title ? { role: 'img', 'aria-label': title } : { 'aria-hidden': true })}\n >\n {title ? <title>{title}</title> : null}\n {children}\n </svg>\n )\n}\n","import { SvgIcon, type IconProps } from './SvgIcon'\n\n/**\n * Voltras brand mark — the ◇ diamond (outline). Pass `fill` for a solid mark.\n */\nexport function VoltrasMark({ size = 14, ...props }: IconProps) {\n return (\n <SvgIcon size={size} {...props}>\n <path d=\"M12 2 22 12 12 22 2 12Z\" />\n </SvgIcon>\n )\n}\n\n/**\n * Bluetooth glyph (stroked) — e.g. device-connection state (color via `currentColor`).\n */\nexport function BluetoothIcon({ size = 18, ...props }: IconProps) {\n return (\n <SvgIcon size={size} {...props}>\n <path d=\"M7 7 17 17 12 22 12 2 17 7 7 17\" />\n </SvgIcon>\n )\n}\n\n/** Dumbbell glyph (mirrors lucide-react `Dumbbell`). Outline-only by default. */\nexport function DumbbellIcon(props: IconProps) {\n return (\n <SvgIcon {...props}>\n <path d=\"M14.4 14.4 9.6 9.6\" />\n <path d=\"M18.657 21.485a2 2 0 1 1-2.829-2.828l-1.767 1.768a2 2 0 1 1-2.829-2.829l6.364-6.364a2 2 0 1 1 2.829 2.829l-1.768 1.767a2 2 0 1 1 2.828 2.829z\" />\n <path d=\"m21.5 21.5-1.4-1.4\" />\n <path d=\"M3.9 3.9 2.5 2.5\" />\n <path d=\"M6.404 12.768a2 2 0 1 1-2.829-2.829l1.768-1.767a2 2 0 1 1-2.828-2.829l2.828-2.828a2 2 0 1 1 2.829 2.828l1.767-1.768a2 2 0 1 1 2.829 2.829z\" />\n </SvgIcon>\n )\n}\n\n/** Star glyph (mirrors lucide-react `Star`). Pass `fill` for a solid star. */\nexport function StarIcon(props: IconProps) {\n return (\n <SvgIcon {...props}>\n <path d=\"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z\" />\n </SvgIcon>\n )\n}\n\n/** Activity / pulse-line glyph (mirrors lucide-react `Activity`). Shell S2 nav → Live. */\nexport function ActivityIcon(props: IconProps) {\n return (\n <SvgIcon {...props}>\n <path d=\"M22 12h-4l-3 9L9 3l-3 9H2\" />\n </SvgIcon>\n )\n}\n\n/** History / clock-arrow glyph (mirrors lucide-react `History`). Shell S2 nav → Review. */\nexport function HistoryIcon(props: IconProps) {\n return (\n <SvgIcon {...props}>\n <path d=\"M3 12a9 9 0 1 0 3-6.7L3 8\" />\n <path d=\"M3 3v5h5\" />\n <path d=\"M12 7v5l4 2\" />\n </SvgIcon>\n )\n}\n\n/** Layers / stack glyph (mirrors lucide-react `Layers`). Shell S2 nav → Program (mesocycle stack). */\nexport function LayersIcon(props: IconProps) {\n return (\n <SvgIcon {...props}>\n <path d=\"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z\" />\n <path d=\"m6.08 9.5-3.49 1.59a1 1 0 0 0 0 1.81l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9a1 1 0 0 0 0-1.83l-3.5-1.59\" />\n <path d=\"m6.08 14.5-3.49 1.59a1 1 0 0 0 0 1.81l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9a1 1 0 0 0 0-1.83l-3.5-1.59\" />\n </SvgIcon>\n )\n}\n\n/** Standing-figure glyph (mirrors lucide-react `PersonStanding`). Shell S2 nav → Body (muscle map). */\nexport function PersonStandingIcon(props: IconProps) {\n return (\n <SvgIcon {...props}>\n <circle cx=\"12\" cy=\"5\" r=\"1\" />\n <path d=\"m9 20 3-6 3 6\" />\n <path d=\"m6 8 6 2 6-2\" />\n <path d=\"M12 10v4\" />\n </SvgIcon>\n )\n}\n\n/** Balance-scale glyph (mirrors lucide-react `Scale`). ExerciseIndicator → `imbalance`. */\nexport function ScaleIcon(props: IconProps) {\n return (\n <SvgIcon {...props}>\n <path d=\"m16 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z\" />\n <path d=\"m2 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z\" />\n <path d=\"M7 21h10\" />\n <path d=\"M12 3v18\" />\n <path d=\"M3 7h2c2 0 5-1 7-2 2 1 5 2 7 2h2\" />\n </SvgIcon>\n )\n}\n\n/** Warning-triangle glyph (mirrors lucide-react `AlertTriangle`). ExerciseIndicator → `overshoot`. */\nexport function AlertTriangleIcon(props: IconProps) {\n return (\n <SvgIcon {...props}>\n <path d=\"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z\" />\n <path d=\"M12 9v4\" />\n <path d=\"M12 17h.01\" />\n </SvgIcon>\n )\n}\n\n/** Down-trend glyph (mirrors lucide-react `TrendingDown`). ExerciseIndicator → `velocity-loss`. */\nexport function TrendingDownIcon(props: IconProps) {\n return (\n <SvgIcon {...props}>\n <path d=\"M16 17h6v-6\" />\n <path d=\"m22 17-8.5-8.5-5 5L2 7\" />\n </SvgIcon>\n )\n}\n\n/** Slashed-circle glyph (mirrors lucide-react `CircleSlash`). ExerciseIndicator → `missed-reps`. */\nexport function CircleSlashIcon(props: IconProps) {\n return (\n <SvgIcon {...props}>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"m9 15 6-6\" />\n </SvgIcon>\n )\n}\n\n/** Medal glyph (mirrors lucide-react `Award`). ExerciseIndicator → `pr`. */\nexport function AwardIcon(props: IconProps) {\n return (\n <SvgIcon {...props}>\n <path d=\"m15.477 12.89 1.515 8.526a.5.5 0 0 1-.81.47l-3.58-2.687a1 1 0 0 0-1.197 0l-3.586 2.686a.5.5 0 0 1-.81-.469l1.514-8.526\" />\n <circle cx=\"12\" cy=\"8\" r=\"6\" />\n </SvgIcon>\n )\n}\n\n/** Info-circle glyph (mirrors lucide-react `Info`). ExerciseIndicator → `info`. */\nexport function InfoIcon(props: IconProps) {\n return (\n <SvgIcon {...props}>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 16v-4\" />\n <path d=\"M12 8h.01\" />\n </SvgIcon>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { useState, type ReactNode } from 'react'\nimport { View, Pressable, Animated, type ViewProps } from 'react-native'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\n\nconst t = getSemanticColors('dark')\n\nexport type BaseBadgeVariant = 'plain' | 'pr'\nexport type BaseBadgeSize = 'sm' | 'md' | 'lg'\n\nexport interface BaseBadgeProps extends ViewProps {\n /** Visual variant — plain (neutral) or pr (brand-primary-subtle) */\n variant?: BaseBadgeVariant\n /** Size variant */\n size?: BaseBadgeSize\n /** Optional icon rendered left of children; hidden from a11y tree */\n icon?: ReactNode\n onPress?: () => void\n className?: string\n children?: ReactNode\n}\n\nexport const baseBadgeSizeConfig: Record<\n BaseBadgeSize,\n { fontSize: number; paddingH: number; paddingV: number; iconSize: number }\n> = {\n sm: { fontSize: 9, paddingH: 6, paddingV: 2, iconSize: 10 },\n md: { fontSize: 10, paddingH: 8, paddingV: 2, iconSize: 12 },\n lg: { fontSize: 12, paddingH: 10, paddingV: 4, iconSize: 14 },\n}\n\nconst variantColors: Record<BaseBadgeVariant, { backgroundColor: string; borderColor: string }> = {\n plain: { backgroundColor: t['surface-raised'], borderColor: '#1F1F1F' },\n pr: {\n backgroundColor: 'rgba(255, 121, 0, 0.12)',\n borderColor: 'rgba(255, 121, 0, 0.3)',\n },\n}\n\nexport function BaseBadge({\n variant = 'plain',\n size = 'md',\n icon,\n onPress,\n className,\n children,\n ...props\n}: BaseBadgeProps) {\n const [scaleAnim] = useState(() => new Animated.Value(1))\n const config = baseBadgeSizeConfig[size]\n const colors = variantColors[variant]\n\n const handlePressIn = () => {\n Animated.timing(scaleAnim, {\n toValue: 0.97,\n duration: 150,\n useNativeDriver: true,\n }).start()\n }\n\n const handlePressOut = () => {\n Animated.timing(scaleAnim, {\n toValue: 1,\n duration: 150,\n useNativeDriver: true,\n }).start()\n }\n\n const badge = (\n <View\n className={className}\n style={{\n flexDirection: 'row',\n alignItems: 'center',\n gap: 3,\n // borderRadius 2 is intentional per workout-tokens.ts (squared-off pill)\n borderRadius: 2,\n borderWidth: 1,\n borderColor: colors.borderColor,\n backgroundColor: colors.backgroundColor,\n paddingHorizontal: config.paddingH,\n paddingVertical: config.paddingV,\n }}\n {...props}\n >\n {icon != null && (\n <View accessibilityElementsHidden testID=\"base-badge-icon\">\n {icon}\n </View>\n )}\n {children}\n </View>\n )\n\n if (onPress) {\n return (\n <Animated.View style={{ transform: [{ scale: scaleAnim }] }}>\n <Pressable\n onPress={onPress}\n onPressIn={handlePressIn}\n onPressOut={handlePressOut}\n accessibilityRole=\"button\"\n accessibilityLabel={props.accessibilityLabel}\n testID=\"base-badge-pressable\"\n >\n {badge}\n </Pressable>\n </Animated.View>\n )\n }\n\n return badge\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { useEffect, useState } from 'react'\nimport { View, Text, Animated, Easing, type ViewProps } from 'react-native'\nimport { StarIcon } from './icons'\nimport { BaseBadge } from './BaseBadge'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\n\nconst BRAND_PRIMARY = getSemanticColors('dark')['brand-primary']\n\nexport type PRType = 'e1rm' | 'weight' | 'reps' | 'volume' | 'velocity'\n\nexport interface PrBadgeProps extends ViewProps {\n /** PR type determines auto-generated label */\n type?: PRType\n /** Display label (e.g., \"PR e1RM\", \"PR 5RM\"). Auto-generated from type if omitted. */\n label?: string\n /** Show only the star icon, no text label */\n compact?: boolean\n /** Trigger pop animation on mount */\n animate?: boolean\n className?: string\n}\n\nconst typeLabels: Record<PRType, string> = {\n e1rm: 'PR e1RM',\n weight: 'PR Weight',\n reps: 'PR Reps',\n volume: 'PR Volume',\n velocity: 'PR Velocity',\n}\n\nexport function PrBadge({\n type = 'e1rm',\n label: labelProp,\n compact = false,\n animate = true,\n className,\n ...props\n}: PrBadgeProps) {\n const resolvedLabel = labelProp ?? typeLabels[type]\n const [scale] = useState(() => new Animated.Value(animate ? 0.8 : 1))\n const [opacity] = useState(() => new Animated.Value(animate ? 0 : 1))\n\n useEffect(() => {\n if (!animate) return\n\n // HTML demo uses a 3-keyframe sequence; bezier approximation is close enough for native\n Animated.parallel([\n Animated.timing(scale, {\n toValue: 1,\n duration: 400,\n easing: Easing.bezier(0.34, 1.56, 0.64, 1),\n useNativeDriver: true,\n }),\n Animated.timing(opacity, {\n toValue: 1,\n duration: 400,\n easing: Easing.bezier(0.34, 1.56, 0.64, 1),\n useNativeDriver: true,\n }),\n ]).start()\n }, [animate, scale, opacity])\n\n const badge = compact ? (\n <View\n className={className}\n accessibilityRole=\"image\"\n accessibilityLabel={`Personal record: ${resolvedLabel}`}\n testID=\"pr-badge-star\"\n {...props}\n >\n <StarIcon size={14} color={BRAND_PRIMARY} fill={BRAND_PRIMARY} strokeWidth={2} />\n </View>\n ) : (\n <BaseBadge\n variant=\"pr\"\n className={className}\n accessibilityLabel={`Personal record: ${resolvedLabel}`}\n {...props}\n >\n <Text\n style={{\n fontSize: 12,\n color: BRAND_PRIMARY,\n fontWeight: '700',\n fontFamily: 'Inter, sans-serif',\n }}\n >\n {'\\u2605'} {resolvedLabel}\n </Text>\n </BaseBadge>\n )\n\n if (animate) {\n return (\n <Animated.View\n style={{ transform: [{ scale }], opacity }}\n testID=\"pr-badge-animated\"\n >\n {badge}\n </Animated.View>\n )\n }\n\n return badge\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { type ReactNode } from 'react'\nimport { View, Text } from 'react-native'\nimport { VelocityStrip, type VelocityZoneBandProp } from './VelocityStrip'\nimport { roundWeight, roundRpe } from '../../../utils/workout-format'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\nimport { WORKOUT_TOKENS } from '../../../theme/workout-tokens'\n\nexport type SetRowUnit = 'lbs' | 'kg'\n\n/** A set's lifecycle: logged (`done`), being performed now (`live`), or planned (`todo`). */\nexport type SetRowState = 'done' | 'live' | 'todo'\n\ninterface SetRowBase {\n setNumber: number\n unit: SetRowUnit\n /** Optional set-type marker (e.g. \"DROP\", \"AMRAP\") shown in the SET cell. */\n setType?: string\n /** Optional velocity-zone bands (WA `VelocityZones.bands`); default scale when absent. */\n velocityZones?: readonly VelocityZoneBandProp[]\n}\n\n/**\n * One row of the unified expanded exercise table (SET · REPS · LBS · RPE + a\n * per-row velocity strip), as a lifecycle discriminated union:\n * - `done` — a logged set: recorded reps / weight / rpe, a flat `mini` strip.\n * - `live` — performed right now: shows its TARGET (never \"reps-done/target\"),\n * stands out by brightness, and a compact velocity-HEIGHT spotlight strip.\n * - `todo` — planned: shows its target, muted, a flat grey `mini` stub strip.\n *\n * `done` + `todo` share ONE muted treatment; only `live` is brightened. There is\n * no PREV column (dropped in the unified design).\n */\nexport type SetRowProps =\n | (SetRowBase & {\n state: 'done'\n reps: number\n weight: number\n rpe?: number | null\n /** Per-rep MEAN concentric velocities (m/s). */\n velocities: number[]\n })\n | (SetRowBase & {\n state: 'live'\n /** The prescribed target shown in the REPS / LBS cells (no live \"5/10\"). */\n target: { reps: number; weight: number }\n /** Reps / weight committed so far (available to hosts; the display shows `target`). */\n reps: number\n weight: number\n rpe?: number | null\n /** Per-rep MEAN concentric velocities logged so far this set. */\n velocities: number[]\n /** Newest rep index — reserved; the compact spotlight strip is static. */\n liveRepIndex?: number\n })\n | (SetRowBase & {\n state: 'todo'\n /** The prescribed target shown in the REPS / LBS cells. */\n target: { reps: number; weight: number }\n /** Planned rep count backing the grey stub strip. Default `target.reps`. */\n planned?: number\n })\n\nconst DARK = getSemanticColors('dark')\n/** Live set — brightest (neutral 100). Done + upcoming share the muted neutral 400. */\nconst TEXT_ACTIVE = DARK['text-primary']\nconst TEXT_MUTED = DARK['text-secondary']\n\n/** Column widths mirror SetTableHeader(showPrevious=false) so cells align under it. */\nconst COL = { set: 36, reps: 44, load: 56, rpe: 36 } as const\nconst cellText = { fontFamily: 'Inter, sans-serif', fontSize: 13, fontWeight: '600' as const }\nconst typeBadge = {\n fontSize: 10,\n fontWeight: '700' as const,\n fontFamily: 'Inter, sans-serif',\n color: WORKOUT_TOKENS.scale.orange,\n backgroundColor: 'rgba(255,165,2,0.12)',\n paddingVertical: 1,\n paddingHorizontal: 5,\n borderRadius: 3,\n overflow: 'hidden' as const,\n}\n\n/** Reps to show: recorded for a `done` set, else the prescribed target. */\nfunction displayReps(set: SetRowProps): number {\n return set.state === 'done' ? set.reps : set.target.reps\n}\n\nfunction displayWeight(set: SetRowProps): number {\n return set.state === 'done' ? set.weight : set.target.weight\n}\n\n/** Planned rep count backing the row's strip. */\nfunction plannedReps(set: SetRowProps): number {\n if (set.state === 'done') return set.velocities.length\n if (set.state === 'live') return set.target.reps\n return set.planned ?? set.target.reps\n}\n\nfunction accessibilityLabel(set: SetRowProps): string {\n const base = `Set ${set.setNumber}: ${displayReps(set)} reps at ${roundWeight(displayWeight(set))} ${set.unit}`\n if (set.state === 'live') return `${base}, in progress`\n if (set.state === 'todo') return `${base}, upcoming`\n return base\n}\n\nfunction Cell({\n width,\n children,\n testID,\n}: {\n width: number\n children: ReactNode\n testID?: string\n}) {\n return (\n <View style={{ width, alignItems: 'center', justifyContent: 'center' }} testID={testID}>\n {children}\n </View>\n )\n}\n\n/** The per-row velocity strip: the velocity-height `expanded` spotlight for the live set, the flat `compact` strip otherwise. */\nfunction RowStrip({ set }: { set: SetRowProps }) {\n const zones = set.velocityZones\n if (set.state === 'live') {\n // The active-set spotlight: the bare velocity-height `expanded` chart at 24px,\n // fixed scale, no labels / info (both chrome flags off → the bare strip).\n return (\n <VelocityStrip\n variant=\"expanded\"\n showNumbers={false}\n showInfo={false}\n height={24}\n scale=\"fixed\"\n // Grow the newest rep from the baseline as it lands (the live-set spotlight).\n liveRepIndex={set.velocities.length - 1}\n set={{ type: 'straight', velocities: set.velocities, planned: set.target.reps }}\n zones={zones}\n />\n )\n }\n const velocities = set.state === 'done' ? set.velocities : []\n // Resting (done / todo) → the flat `compact` strip at the 8px SegmentedBar flat-bar language (the\n // static compact bar fills its plot), so the resting per-rep strip matches the set-level segmented\n // bars used elsewhere; the live spotlight above stays taller (24px).\n return (\n <VelocityStrip\n variant=\"compact\"\n height={8}\n hideBaseline\n set={{ type: 'straight', velocities, planned: plannedReps(set) }}\n zones={zones}\n />\n )\n}\n\n/**\n * ONE set row of the unified expanded exercise table. SET · REPS · LBS · RPE over\n * a per-row {@link VelocityStrip}; `live` stands out by brightness with a compact\n * velocity-height spotlight, `done`/`todo` are muted with a flat mini strip. Its\n * column widths mirror {@link SetTableHeader}(`showPrevious={false}`).\n */\nexport function SetRow(set: SetRowProps) {\n const live = set.state === 'live'\n const valueColor = live ? TEXT_ACTIVE : TEXT_MUTED\n const rpe = set.state === 'todo' ? null : set.rpe\n\n return (\n <View\n style={{ paddingVertical: 6, paddingHorizontal: 8 }}\n accessibilityLabel={accessibilityLabel(set)}\n testID=\"set-row\"\n >\n <View className=\"flex-row items-center\" style={{ justifyContent: 'space-between' }}>\n <Cell width={COL.set} testID=\"set-row-set-number\">\n {set.setType ? (\n <Text style={typeBadge} testID=\"set-row-type-badge\">\n {set.setType}\n </Text>\n ) : (\n <Text style={{ ...cellText, color: valueColor, fontWeight: live ? '700' : '600' }}>\n {set.setNumber}\n </Text>\n )}\n </Cell>\n <Cell width={COL.reps} testID=\"set-row-reps\">\n <Text style={{ ...cellText, color: valueColor }}>{displayReps(set)}</Text>\n </Cell>\n <Cell width={COL.load} testID=\"set-row-weight\">\n <Text style={{ ...cellText, color: valueColor }}>{roundWeight(displayWeight(set))}</Text>\n </Cell>\n <Cell width={COL.rpe} testID=\"set-row-rpe\">\n <Text style={{ ...cellText, color: TEXT_MUTED }}>\n {rpe != null ? roundRpe(rpe) : '—'}\n </Text>\n </Cell>\n </View>\n <View style={{ marginTop: live ? 6 : 4 }} testID=\"set-row-strip\">\n <RowStrip set={set} />\n </View>\n </View>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { View, Text } from 'react-native'\n\n// One header column: its label and its fixed width (PREV is the lone flex column,\n// `undefined`). Order + widths mirror SetRow's cells so headers align over rows.\ntype Column = { label: string; width: number | undefined }\n\nexport interface SetTableHeaderProps {\n /** Weight-column label: LBS / KG. Default lbs. */\n unit?: 'lbs' | 'kg'\n /** Show the PREV (previous-best) column. Default true; false drops it for rail density. */\n showPrevious?: boolean\n /** Overridable so a host card can keep its own testID. Default \"table-header\". */\n testID?: string\n}\n\n// The previous-best column is the lone flex column (`undefined` width). When hidden\n// it is dropped entirely (not blanked to a spacer) and the four fixed columns\n// distribute across the full strip width via `justifyContent: space-between`.\nconst PREV_COLUMN: Column = { label: 'PREV', width: undefined }\n\n/** Columns in order, with the weight column reflecting `unit`; PREV dropped when hidden. */\nfunction buildColumns(unit: 'lbs' | 'kg', showPrevious: boolean): Column[] {\n return [\n { label: 'SET', width: 36 },\n ...(showPrevious ? [PREV_COLUMN] : []),\n { label: 'REPS', width: 44 },\n { label: unit.toUpperCase(), width: 56 },\n { label: 'RPE', width: 36 },\n ]\n}\n\n/**\n * The expanded-set-table column-header row: SET · PREV · REPS · LOAD · RPE, with\n * the weight column reflecting `unit`. `showPrevious={false}` drops PREV (rail\n * density). Its per-column widths mirror {@link SetRow} so headers align over the\n * rows. Extracted from {@link ExerciseCard}'s expanded state for reuse.\n */\nexport function SetTableHeader({\n unit = 'lbs',\n showPrevious = true,\n testID = 'table-header',\n}: SetTableHeaderProps) {\n const columns = buildColumns(unit, showPrevious)\n\n return (\n <View\n className=\"flex-row\"\n style={{\n paddingVertical: 8,\n paddingHorizontal: 8,\n paddingBottom: 4,\n ...(showPrevious ? {} : { justifyContent: 'space-between' }),\n }}\n testID={testID}\n >\n {columns.map(({ label, width }) => {\n const isFlex = width === undefined\n\n return (\n <View\n key={label}\n style={{\n ...(isFlex ? { minWidth: 44 } : { width, flexShrink: 1 }),\n alignItems: 'center',\n justifyContent: 'center',\n gap: 8,\n }}\n {...(isFlex ? { className: 'flex-1' } : {})}\n >\n <Text\n className=\"text-text-tertiary\"\n style={{\n fontSize: 10,\n fontWeight: '600',\n fontFamily: 'Inter, sans-serif',\n textTransform: 'uppercase',\n letterSpacing: 0.8,\n }}\n >\n {label}\n </Text>\n </View>\n )\n })}\n </View>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport type { ReactNode } from 'react'\nimport { Text } from 'react-native'\n\n/**\n * Shared \"segmented metric\" typography primitive — the Inter · 600 · letter-spacing 1\n * value/separator cell used by both {@link TempoDisplay} (tempo digits + dashes) and\n * {@link SetsRepsLoad} (sets × reps @ load). Extracted so the two read as one visual\n * language instead of drifting copies.\n */\nexport const METRIC_FONT = 'Inter, sans-serif'\n\nexport interface MetricCellProps {\n children: ReactNode\n /** Cell text color — value cells take a primary color, separators a muted one. */\n color: string\n fontSize?: number\n}\n\nexport function MetricCell({ children, color, fontSize = 11 }: MetricCellProps) {\n return (\n <Text\n style={{\n fontFamily: METRIC_FONT,\n fontSize,\n color,\n fontWeight: '600',\n letterSpacing: 1,\n }}\n >\n {children}\n </Text>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { View, type ViewProps } from 'react-native'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\nimport { MetricCell } from './metricText'\n\nconst t = getSemanticColors('dark')\n\nconst TIMES = '×' // × multiplication sign, padded by muted separators\nconst AT = '@'\n\nexport interface SetsRepsLoadProps extends ViewProps {\n sets: number\n reps: number | string\n /** Load value; a string (e.g. \"—\") passes through verbatim for an unset/discovery load. */\n load: number | string\n /** Displayed load unit label (e.g. \"lb\", \"kg\"). */\n unit?: string\n /** Cell font size (px). Default 11 — the compact rail/card scale. Raise for a wall read-out. */\n fontSize?: number\n className?: string\n}\n\n/**\n * The `sets × reps @ load` prescription line, in the TempoDisplay visual language\n * (Inter · 600 · letter-spacing 1 · value cells with muted `×` / `@` separators).\n * Shares the {@link MetricCell} primitive with TempoDisplay so the two stay in step.\n */\nexport function SetsRepsLoad({\n sets,\n reps,\n load,\n unit = 'lb',\n fontSize,\n className,\n ...props\n}: SetsRepsLoadProps) {\n const value = t['text-primary']\n const sep = t['text-tertiary']\n\n return (\n <View\n className={className}\n style={{ flexDirection: 'row', alignItems: 'baseline' }}\n accessibilityLabel={`${sets} sets of ${reps} reps at ${load} ${unit}`}\n testID=\"sets-reps-load\"\n {...props}\n >\n <MetricCell color={value} fontSize={fontSize}>\n {sets}\n </MetricCell>\n <MetricCell color={sep} fontSize={fontSize}>{` ${TIMES} `}</MetricCell>\n <MetricCell color={value} fontSize={fontSize}>\n {reps}\n </MetricCell>\n <MetricCell color={sep} fontSize={fontSize}>{` ${AT} `}</MetricCell>\n <MetricCell color={value} fontSize={fontSize}>\n {load}\n </MetricCell>\n <MetricCell color={sep} fontSize={fontSize}>{` ${unit}`}</MetricCell>\n </View>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { useState, useCallback } from 'react'\nimport { View, Text, Pressable, type ViewProps } from 'react-native'\nimport { roundTempo } from '../../../utils/workout-format'\nimport { alpha } from '../../../utils/colors'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\nimport { primitiveRamps } from '../../../theme/tokens/primitives'\nimport { MetricCell } from './metricText'\n\nconst t = getSemanticColors('dark')\n\n/** The four tempo phases, in the order the display renders them. */\nexport type TempoLivePhase = 'eccentric' | 'pauseBottom' | 'concentric' | 'pauseTop'\n\n/**\n * Live rep state driving the phase-fill overlay. Controlled by the consumer\n * (matching titan's `elapsedMs`-in convention) so the same real timer feeds\n * both web dashboard and native app — TempoDisplay owns rendering only.\n */\nexport interface TempoLiveState {\n /** Phase currently in progress, or null when idle/at rest. */\n activePhase: TempoLivePhase | null\n /** Elapsed time (ms) within the active phase. */\n phaseElapsedMs: number\n /**\n * Actual completed durations (ms) for phases finished earlier THIS rep. A done cell\n * freezes at its final readout (not the target) until the next rep resets the row.\n * Omit a phase to fall back to its target (assume it completed on pace).\n */\n completed?: Partial<Record<TempoLivePhase, number>>\n}\n\nexport interface TempoDisplayProps extends ViewProps {\n /** Tempo values: [eccentric, pauseBottom, concentric, pauseTop] in seconds */\n tempo: [number, number, number, number]\n size?: 'sm' | 'md'\n /** Override the digit font size (px). Defaults from `size` (9 sm / 11 md); raise for a wall read-out. */\n fontSize?: number\n /** Show the \"TEMPO\" caption before the values. Default true. */\n showLabel?: boolean\n /** Show info tooltip on press */\n showInfo?: boolean\n /**\n * When set, renders a live phase-fill: the active phase digit fills against\n * its prescribed duration and inactive phases dim. Omit for the static\n * prescription string (default, backward compatible).\n */\n live?: TempoLiveState\n /** Active-phase readout when `live`: `countdown` remaining to 0.0 (default), or `countup` elapsed. */\n liveReadout?: TempoLiveReadout\n onPress?: () => void\n className?: string\n}\n\nconst INTER = 'Inter, sans-serif'\nconst TEXT_TERTIARY = '#6B7280'\nconst STATUS_ERROR = t['status-error'] // slow — over the target time\nconst STATUS_SUCCESS = t['status-success'] // on target (within the band of 0.0)\nconst STATUS_WARNING = t['status-warning'] // ahead — still time left to the target\n\n/** Live active-phase readout: `countdown` remaining to 0.0, or `countup` elapsed to target. */\nexport type TempoLiveReadout = 'countdown' | 'countup'\n\n/** ± this window (ms) around the target still counts as on target (0.0 ± 0.1s). */\nconst ON_TARGET_MS = 100\n\n/** Phase-progress fill percent (0–100): how far the active phase has run toward its target. */\nfunction getTempoFillPct(elapsedMs: number, targetMs: number | null): number {\n if (!targetMs) return 100\n return Math.min(100, (elapsedMs / targetMs) * 100)\n}\n\n/**\n * Semantic pacing tone for the active/completed phase's NUMBER (the fill bar carries phase\n * identity, so the number is free to carry pacing). Keyed on time remaining to target:\n * ahead of target (still counting) → warning; within ±0.1s of 0.0 → success; over → error.\n */\nfunction activeNumberTone(elapsedMs: number, targetMs: number | null): string {\n if (targetMs == null) return t['text-primary']\n const remainingMs = targetMs - elapsedMs\n if (remainingMs > ON_TARGET_MS) return STATUS_WARNING\n if (remainingMs >= -ON_TARGET_MS) return STATUS_SUCCESS\n return STATUS_ERROR\n}\n\n/** The active number: `countup` elapsed (→ target) or `countdown` remaining (→ 0.0, then −). */\nfunction liveReadoutText(elapsedMs: number, targetMs: number, readout: TempoLiveReadout): string {\n const seconds = readout === 'countup' ? elapsedMs / 1000 : (targetMs - elapsedMs) / 1000\n return seconds.toFixed(1)\n}\n\n// Phase IDENTITY colours — deliberately NON-semantic (magenta ecc / cyan con) so the\n// phase hue never collides with the semantic pacing tones (success/error) the active\n// number carries. Pauses stay neutral grey. [eccentric, pauseBottom, concentric, pauseTop]\nconst phaseColors = {\n eccentric: primitiveRamps.magenta[400],\n pauseBottom: TEXT_TERTIARY,\n concentric: primitiveRamps.cyan[300],\n pauseTop: TEXT_TERTIARY,\n dash: TEXT_TERTIARY,\n}\n\nfunction TempoValue({\n value,\n color,\n fontSize,\n}: {\n value: number\n color: string\n fontSize: number\n}) {\n return (\n <MetricCell color={color} fontSize={fontSize}>\n {value}\n </MetricCell>\n )\n}\n\nfunction TempoSeparator({ color, fontSize }: { color: string; fontSize: number }) {\n return (\n <MetricCell color={color} fontSize={fontSize}>\n -\n </MetricCell>\n )\n}\n\n// Phase order + color matching the tempo tuple, for the live phase-fill row.\nconst LIVE_PHASES: { key: TempoLivePhase; color: string }[] = [\n { key: 'eccentric', color: phaseColors.eccentric },\n { key: 'pauseBottom', color: phaseColors.pauseBottom },\n { key: 'concentric', color: phaseColors.concentric },\n { key: 'pauseTop', color: phaseColors.pauseTop },\n]\n\n/** A phase's place in the current rep: already done (locked full), filling now, or still to come. */\ntype LiveCellStatus = 'done' | 'active' | 'upcoming'\n\n/** A bottom-anchored vertical fill behind the number (the phase-progress bar). */\nfunction CellFill({ color, pct }: { color: string; pct: number }) {\n return (\n <View\n style={{\n position: 'absolute',\n left: 2,\n right: 2,\n bottom: 0,\n height: `${pct}%`,\n backgroundColor: alpha(color, 0.28),\n borderRadius: 3,\n }}\n />\n )\n}\n\n/** Monospace stack for the live readout so digit widths never shift. */\nconst MONO = 'ui-monospace, SFMono-Regular, Menlo, Consolas, monospace'\n/** Widest readout the cell must hold: sign · two whole digits · point · tenths, e.g. \"-12.3\". */\nconst READOUT_MAX_CHARS = 5\n\nfunction LiveTempoCell({\n value,\n color,\n status,\n phaseElapsedMs,\n completedMs,\n fontSize,\n readout,\n}: {\n value: number\n color: string\n status: LiveCellStatus\n phaseElapsedMs: number\n completedMs: number | undefined\n fontSize: number\n readout: TempoLiveReadout\n}) {\n const targetMs = value > 0 ? value * 1000 : null\n // Fixed, monospace-width cell sized to the widest readout — a phase activating or its\n // number changing never shifts the layout (the fill bar stays put too).\n const cellW = Math.ceil(fontSize * 0.62 * READOUT_MAX_CHARS)\n const wrap = {\n position: 'relative' as const,\n width: cellW,\n minHeight: Math.round(fontSize * 1.25),\n alignItems: 'center' as const,\n justifyContent: 'center' as const,\n }\n const num = (c: string, text: string) => (\n <Text style={{ fontFamily: MONO, fontSize, color: c, fontWeight: '700' }}>{text}</Text>\n )\n\n // Upcoming / idle: the phase's prescribed time in the FULL phase colour, no fill — so a\n // not-yet-started (or fully idle) row just reads as the base tempo lockup, not a dim mode.\n if (status === 'upcoming') {\n const targetText = targetMs != null ? (targetMs / 1000).toFixed(1) : String(value)\n return <View style={wrap}>{num(color, targetText)}</View>\n }\n\n // Done: FROZEN at the phase's final readout (its actual completed time, not the target),\n // fill locked full in the phase colour. The number keeps its SEMANTIC pacing tone (it is\n // showing the final time, not the target) — banked progress until the next rep resets.\n if (status === 'done') {\n const finalMs = completedMs ?? targetMs ?? 0\n const finalText = targetMs != null ? liveReadoutText(finalMs, targetMs, readout) : String(value)\n const finalTone = targetMs != null ? activeNumberTone(finalMs, targetMs) : color\n return (\n <View style={wrap} testID=\"tempo-live-done\">\n <CellFill color={color} pct={100} />\n {num(finalTone, finalText)}\n </View>\n )\n }\n\n // Active: the phase-hued fill grows with the phase; the number reads the live time\n // (countdown/countup) to 0.1s, coloured SEMANTICALLY by pacing (neutral/on-target/behind).\n const numberTone = activeNumberTone(phaseElapsedMs, targetMs)\n const fillPct = getTempoFillPct(phaseElapsedMs, targetMs)\n const activeText =\n targetMs != null ? liveReadoutText(phaseElapsedMs, targetMs, readout) : String(value)\n return (\n <View style={wrap} testID=\"tempo-live-active\">\n <CellFill color={color} pct={fillPct} />\n {num(numberTone, activeText)}\n </View>\n )\n}\n\nfunction LiveTempoRow({\n values,\n live,\n fontSize,\n readout,\n}: {\n values: [number, number, number, number]\n live: TempoLiveState\n fontSize: number\n readout: TempoLiveReadout\n}) {\n // Phases run in a fixed order within a rep, so the active phase's position tells us which\n // phases are already done (locked). When it wraps back to the first phase, the row resets.\n const activeIndex = live.activePhase\n ? LIVE_PHASES.findIndex((p) => p.key === live.activePhase)\n : -1\n return (\n <>\n {LIVE_PHASES.map((phase, i) => {\n const status: LiveCellStatus =\n activeIndex < 0 || i > activeIndex ? 'upcoming' : i < activeIndex ? 'done' : 'active'\n return (\n <View key={phase.key} style={{ flexDirection: 'row', alignItems: 'center' }}>\n {i > 0 && <TempoSeparator color={phaseColors.dash} fontSize={fontSize} />}\n <LiveTempoCell\n value={values[i]}\n color={phase.color}\n status={status}\n phaseElapsedMs={live.phaseElapsedMs}\n completedMs={live.completed?.[phase.key]}\n fontSize={fontSize}\n readout={readout}\n />\n </View>\n )\n })}\n </>\n )\n}\n\nexport function TempoDisplay({\n tempo,\n size = 'md',\n fontSize: fontSizeProp,\n showLabel = true,\n showInfo = true,\n live,\n liveReadout = 'countdown',\n onPress,\n className,\n ...props\n}: TempoDisplayProps) {\n const [showTooltip, setShowTooltip] = useState(false)\n // Round exact (unrounded) tempo seconds to the 1-dp display granularity.\n const [eccentric, pauseBottom, concentric, pauseTop] = roundTempo(tempo)\n const isSm = size === 'sm'\n const fontSize = fontSizeProp ?? (isSm ? 9 : 11)\n // The chrome (padding, radius, label) scales with the digit size so the whole view stays\n // proportional at any form factor — a compact rail chip up to a wall read-out.\n const chromePadX = Math.round(fontSize * 0.6)\n const chromePadY = Math.round(fontSize * 0.3)\n const chromeRadius = Math.round(fontSize * 0.4)\n const labelFont = Math.max(9, Math.round(fontSize * 0.5))\n\n const handlePress = useCallback(() => {\n if (onPress) {\n onPress()\n }\n if (showInfo) {\n setShowTooltip((prev) => !prev)\n }\n }, [onPress, showInfo])\n\n const content = (\n <View\n className={className}\n style={{\n flexDirection: 'row',\n alignItems: 'center',\n backgroundColor: t['surface-raised'],\n paddingHorizontal: chromePadX,\n paddingVertical: chromePadY,\n borderRadius: chromeRadius,\n }}\n {...props}\n >\n {showLabel && (\n <Text\n style={{\n fontFamily: INTER,\n fontSize: labelFont,\n fontWeight: '500',\n // Live-muted green while a rep is running, tertiary at rest.\n color: live ? t['status-live-muted'] : TEXT_TERTIARY,\n letterSpacing: 0.5,\n textTransform: 'uppercase',\n marginRight: Math.round(fontSize * 0.5),\n }}\n >\n TEMPO\n </Text>\n )}\n <View style={{ flexDirection: 'row' }} testID=\"tempo-value\">\n {live ? (\n <LiveTempoRow\n values={[eccentric, pauseBottom, concentric, pauseTop]}\n live={live}\n fontSize={fontSize}\n readout={liveReadout}\n />\n ) : (\n // Static prescription: the phase-coloured lockup (the same colours the live row rests at).\n <>\n <TempoValue value={eccentric} color={phaseColors.eccentric} fontSize={fontSize} />\n <TempoSeparator color={phaseColors.dash} fontSize={fontSize} />\n <TempoValue value={pauseBottom} color={phaseColors.pauseBottom} fontSize={fontSize} />\n <TempoSeparator color={phaseColors.dash} fontSize={fontSize} />\n <TempoValue value={concentric} color={phaseColors.concentric} fontSize={fontSize} />\n <TempoSeparator color={phaseColors.dash} fontSize={fontSize} />\n <TempoValue value={pauseTop} color={phaseColors.pauseTop} fontSize={fontSize} />\n </>\n )}\n </View>\n </View>\n )\n\n return (\n <Pressable\n accessibilityLabel={`Tempo: ${eccentric} second eccentric, ${pauseBottom} second pause, ${concentric} second concentric, ${pauseTop} second pause`}\n accessibilityRole=\"button\"\n onPress={handlePress}\n testID=\"tempo-display\"\n >\n {content}\n {showTooltip && (\n <View\n style={{\n position: 'absolute',\n bottom: '100%',\n left: '50%',\n transform: [{ translateX: '-50%' as unknown as number }],\n marginBottom: 8,\n zIndex: 20,\n alignItems: 'center',\n }}\n testID=\"tempo-tooltip\"\n >\n <View\n style={{\n backgroundColor: t['surface-overlay'],\n borderRadius: 6,\n paddingVertical: 8,\n paddingHorizontal: 12,\n borderWidth: 1,\n borderColor: '#2C2C2C',\n }}\n >\n <Text style={{ fontSize: 10, lineHeight: 16, color: '#9CA3AF', fontFamily: INTER }}>\n Eccentric: {eccentric}s\n </Text>\n <Text style={{ fontSize: 10, lineHeight: 16, color: '#9CA3AF', fontFamily: INTER }}>\n Pause (bottom): {pauseBottom}s\n </Text>\n <Text style={{ fontSize: 10, lineHeight: 16, color: '#9CA3AF', fontFamily: INTER }}>\n Concentric: {concentric}s\n </Text>\n <Text style={{ fontSize: 10, lineHeight: 16, color: '#9CA3AF', fontFamily: INTER }}>\n Pause (top): {pauseTop}s\n </Text>\n </View>\n <View\n style={{\n width: 0,\n height: 0,\n borderLeftWidth: 5,\n borderRightWidth: 5,\n borderTopWidth: 5,\n borderLeftColor: 'transparent',\n borderRightColor: 'transparent',\n borderTopColor: '#2C2C2C',\n }}\n />\n </View>\n )}\n </Pressable>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport type { ComponentType } from 'react'\nimport { View, Pressable, type ViewProps } from 'react-native'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\nimport {\n ScaleIcon,\n AlertTriangleIcon,\n TrendingDownIcon,\n CircleSlashIcon,\n AwardIcon,\n InfoIcon,\n type IconProps,\n} from '../../icons'\n\n// Literal-hex status pins (getSemanticColors, not resolveColor) — `resolveColor()` yields a\n// `var(...)` under the RNW vitest alias, which breaks `toHaveStyle` in tests.\nconst t = getSemanticColors('dark')\n\n/**\n * The LOCKED 6-kind indicator taxonomy (TD-03.51). One precedence-ranked slot is\n * ever shown per exercise, resolved by {@link resolveIndicator}. Glyph = the\n * specific signal; color = the severity tier (danger/warning/success/info, bound\n * to titan status tokens). Outlined (border + glyph, no fill) so a chip never\n * collides with the filled velocity strip beside it.\n */\nexport type ExerciseIndicatorKind =\n | 'imbalance'\n | 'overshoot'\n | 'velocity-loss'\n | 'missed-reps'\n | 'pr'\n | 'info'\n\ninterface IndicatorConfig {\n Icon: ComponentType<IconProps>\n /** Tier color — a titan status semantic token (literal hex on `t`). */\n color: string\n /** Accessible description (also the intended tooltip subject). */\n label: string\n}\n\nconst INDICATOR_CONFIG: Record<ExerciseIndicatorKind, IndicatorConfig> = {\n imbalance: { Icon: ScaleIcon, color: t['status-error'], label: 'Left/right imbalance' },\n overshoot: { Icon: AlertTriangleIcon, color: t['status-error'], label: 'Load overshoot' },\n 'velocity-loss': { Icon: TrendingDownIcon, color: t['status-warning'], label: 'Velocity loss' },\n 'missed-reps': { Icon: CircleSlashIcon, color: t['status-warning'], label: 'Missed reps' },\n pr: { Icon: AwardIcon, color: t['status-success'], label: 'Personal record' },\n info: { Icon: InfoIcon, color: t['status-info'], label: 'More info' },\n}\n\n/**\n * Precedence order (1=highest → last=lowest). A single chip is shown, so when\n * several signals are true the highest-ranked wins. Alerts outrank `pr`; `info`\n * is the floor. This ordering is LOCKED — do not reshuffle.\n */\nexport const INDICATOR_PRECEDENCE: readonly ExerciseIndicatorKind[] = [\n 'imbalance',\n 'overshoot',\n 'velocity-loss',\n 'missed-reps',\n 'pr',\n 'info',\n]\n\n/**\n * Given the signals currently true for an exercise, pick the single\n * highest-precedence kind to surface (or `undefined` when none apply). Order and\n * duplicates in `candidates` don't matter — {@link INDICATOR_PRECEDENCE} decides.\n */\nexport function resolveIndicator(\n candidates: ExerciseIndicatorKind[],\n): ExerciseIndicatorKind | undefined {\n return INDICATOR_PRECEDENCE.find((kind) => candidates.includes(kind))\n}\n\nexport interface ExerciseIndicatorProps extends Omit<ViewProps, 'children'> {\n kind: ExerciseIndicatorKind\n /** Optional tap handler (surfaces detail — PR history / alert / info). */\n onPress?: () => void\n className?: string\n}\n\n/**\n * A small circular outlined chip for an exercise heading. Presentational and\n * static (chips are chrome — no pulse); the tap detail (tooltip/sheet) is wired\n * by the consumer.\n */\nexport function ExerciseIndicator({ kind, onPress, className, ...props }: ExerciseIndicatorProps) {\n const { Icon, color, label } = INDICATOR_CONFIG[kind]\n\n const chip = (\n <View\n className={className}\n style={{\n width: 16,\n height: 16,\n borderRadius: 8,\n borderWidth: 1,\n borderColor: color,\n alignItems: 'center',\n justifyContent: 'center',\n }}\n accessibilityRole=\"image\"\n accessibilityLabel={label}\n testID=\"exercise-indicator\"\n {...props}\n >\n <Icon size={11} color={color} />\n </View>\n )\n\n if (onPress) {\n return (\n <Pressable onPress={onPress} accessibilityRole=\"button\" accessibilityLabel={label}>\n {chip}\n </Pressable>\n )\n }\n return chip\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { View, Text, Pressable } from 'react-native'\nimport { roundWeight } from '../../../utils/workout-format'\nimport { SetsRepsLoad } from './SetsRepsLoad'\nimport { TempoDisplay } from './TempoDisplay'\nimport { ExerciseIndicator, type ExerciseIndicatorKind } from './ExerciseIndicator'\n\nexport interface ExerciseHeadingProps {\n name: string\n /** Prescription line values (sets × reps @ load). */\n sets: number\n reps: number | string\n /** Load value; a string (e.g. \"—\") passes through verbatim for an unset/discovery load. */\n load: number | string\n unit?: 'lbs' | 'kg'\n /** Tempo tuple [eccentric, pauseBottom, concentric, pauseTop]; hidden when absent. */\n tempo?: [number, number, number, number]\n /** Small PR / issue / info chip in the title row. */\n indicator?: ExerciseIndicatorKind\n /** Dim the block as a not-yet-reached exercise (standalone use). */\n dimmed?: boolean\n /** Press target for the name row (expand / select). */\n onPress?: () => void\n}\n\nfunction headingLabel(\n name: string,\n sets: number,\n reps: number | string,\n load: number | string,\n unit: string\n) {\n const loadLabel = typeof load === 'number' ? roundWeight(load) : load\n return `${name}, ${sets}×${reps} @ ${loadLabel} ${unit}`\n}\n\n/**\n * The exercise-heading info block (no strip): the name + {@link ExerciseIndicator}\n * title row over a tight {@link SetsRepsLoad} prescription line beside the real\n * {@link TempoDisplay} (`showLabel={false}`). The name row is the sole press\n * target — TempoDisplay is a sibling, never a descendant, since it is itself a\n * Pressable (nesting would be an a11y nested-interactive violation).\n */\nexport function ExerciseHeading({\n name,\n sets,\n reps,\n load,\n unit = 'lbs',\n tempo,\n indicator,\n dimmed,\n onPress,\n}: ExerciseHeadingProps) {\n return (\n <View style={{ opacity: dimmed ? 0.55 : 1 }} testID=\"exercise-heading\">\n <Pressable\n onPress={onPress}\n accessibilityRole=\"button\"\n accessibilityLabel={headingLabel(name, sets, reps, load, unit)}\n className=\"flex-row items-center\"\n style={{ gap: 8 }}\n testID=\"exercise-card-header\"\n >\n <Text\n className=\"text-text-primary\"\n style={{ fontSize: 14, fontFamily: '\"Space Grotesk\", sans-serif', fontWeight: '700' }}\n testID=\"exercise-card-name\"\n >\n {name}\n </Text>\n <View className=\"flex-1\" />\n {indicator && <ExerciseIndicator kind={indicator} />}\n </Pressable>\n\n <View\n className=\"flex-row items-center\"\n style={{ gap: 8, marginTop: 1 }}\n testID=\"exercise-card-summary\"\n >\n <SetsRepsLoad sets={sets} reps={reps} load={load} unit={unit} />\n <View className=\"flex-1\" />\n {tempo && <TempoDisplay tempo={tempo} size=\"sm\" showLabel={false} showInfo={false} />}\n </View>\n </View>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { useEffect, useState } from 'react'\nimport { View, Animated, Easing, type ViewProps, type DimensionValue } from 'react-native'\n\n/** ~1.9s full cycle: a pulsing segment eases up then back down (2 × half). */\nconst PULSE_HALF_MS = 950\n\n/** Pulsing segments breathe their opacity between this floor and full. */\nconst PULSE_MIN_OPACITY = 0.45\n\n/** Default between-segment gap — matches SetStrip's between-set gap so strips read the same. */\nconst SEGMENTED_BAR_GAP = 5\n\nexport interface SegmentedBarSegment {\n /** Flex weight of this segment's slot. Default 1 (all segments equal width). */\n weight?: number\n /** Fraction 0..1 of the slot the coloured fill covers, left-aligned. Default 1 (full). */\n fill?: number\n /** Fill colour — a literal hex (RNW-safe), never a `var()` token ref. */\n color: string\n /** When true the fill animates on the shared active-pulse loop. */\n pulse?: boolean\n /**\n * When pulsing, interpolate the fill's `backgroundColor` from→to over the loop\n * (full opacity). Omit to fall back to the default opacity breathe.\n */\n pulseColor?: [from: string, to: string]\n /**\n * A fixed gap (px) carved in before this segment's slot — lets a composer split\n * an otherwise-butted bar into sub-structure (drop notch, myo cluster) without a\n * uniform {@link SegmentedBarProps.gap}. Default 0 (butted against the previous).\n */\n leadingGap?: number\n /**\n * Static fill opacity 0..1 for a non-pulsing segment (e.g. a fading \"count\n * unknown\" trail). Ignored for `pulse` segments, which drive their own opacity.\n */\n opacity?: number\n}\n\nexport interface SegmentedBarProps extends ViewProps {\n /** The weighted segments, laid left-to-right. */\n segments: SegmentedBarSegment[]\n /** Track height in px. Default 8. */\n height?: number\n /** Gap between segment slots in px. Default 5 (SetStrip's between-set gap). */\n gap?: number\n /** Corner radius of each segment slot in px. Default 2. */\n radius?: number\n /** An absolutely-positioned vertical marker line at `position` (0..1 of total width). */\n marker?: { position: number; color: string } | null\n /**\n * Resolve the testID of a segment's fill element. Lets a composing component\n * (e.g. SetBar) preserve its own test hooks; defaults to `segmented-bar-segment`.\n */\n segmentTestID?: (segment: SegmentedBarSegment, index: number) => string | undefined\n}\n\n/** The shared active-pulse loop: a single 0→1→0 value driving every pulsing segment. */\nfunction usePulse(active: boolean): Animated.Value {\n const [value] = useState(() => new Animated.Value(0))\n\n useEffect(() => {\n if (!active) return\n const loop = Animated.loop(\n Animated.sequence([\n Animated.timing(value, {\n toValue: 1,\n duration: PULSE_HALF_MS,\n easing: Easing.inOut(Easing.ease),\n useNativeDriver: false,\n }),\n Animated.timing(value, {\n toValue: 0,\n duration: PULSE_HALF_MS,\n easing: Easing.inOut(Easing.ease),\n useNativeDriver: false,\n }),\n ])\n )\n loop.start()\n return () => loop.stop()\n }, [active, value])\n\n return value\n}\n\n/**\n * A horizontal track split into weighted, individually-fillable segments — the\n * presentational atom the per-set strips are built from. Each segment is a flex\n * slot (flex = `weight`) holding a left-aligned fill (`fill` fraction, `color`);\n * `pulse` segments breathe on a shared active-pulse loop, and `marker` drops a\n * vertical line at a fraction of the total width. Colours are passed-in literal hex.\n */\nexport function SegmentedBar({\n segments,\n height = 8,\n gap = SEGMENTED_BAR_GAP,\n radius = 2,\n marker = null,\n segmentTestID,\n style,\n ...props\n}: SegmentedBarProps) {\n const pulse = usePulse(segments.some((s) => s.pulse))\n\n return (\n <View style={[{ flexDirection: 'row', height, gap, position: 'relative' }, style]} {...props}>\n {segments.map((seg, i) => {\n const fillStyle = {\n width: `${(seg.fill ?? 1) * 100}%` as DimensionValue,\n height: '100%' as DimensionValue,\n backgroundColor: seg.color,\n opacity: seg.opacity,\n }\n const testID = segmentTestID?.(seg, i) ?? 'segmented-bar-segment'\n return (\n <View\n key={i}\n style={{\n flex: seg.weight ?? 1,\n minWidth: 0,\n height: '100%',\n marginLeft: seg.leadingGap,\n borderRadius: radius,\n overflow: 'hidden',\n }}\n >\n {seg.pulse ? (\n <Animated.View\n style={{\n ...fillStyle,\n ...(seg.pulseColor\n ? {\n backgroundColor: pulse.interpolate({\n inputRange: [0, 1],\n outputRange: seg.pulseColor,\n }),\n }\n : {\n opacity: pulse.interpolate({\n inputRange: [0, 1],\n outputRange: [PULSE_MIN_OPACITY, 1],\n }),\n }),\n }}\n accessibilityElementsHidden\n testID={testID}\n />\n ) : (\n <View style={fillStyle} accessibilityElementsHidden testID={testID} />\n )}\n </View>\n )\n })}\n {marker ? (\n <View\n style={{\n position: 'absolute',\n left: `${marker.position * 100}%` as DimensionValue,\n top: 0,\n bottom: 0,\n width: 2,\n backgroundColor: marker.color,\n }}\n accessibilityElementsHidden\n testID=\"segmented-bar-marker\"\n />\n ) : null}\n </View>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { primitiveColors, primitiveRamps } from '../../../theme/tokens/primitives'\nimport { SegmentedBar, type SegmentedBarSegment } from './SegmentedBar'\n\n/**\n * The four canonical rep-intensity zone pins (real titan ramp pins). A rep's mean\n * velocity ratio maps to one of these; butted together they form a set's bar.\n */\nexport const SET_STRIP_ZONES = {\n slow: primitiveRamps.red[600],\n moderate: primitiveRamps.orange[400],\n fast: primitiveRamps.amber[300],\n fastest: primitiveRamps.green[300],\n} as const\n\n/** Grey fill for planned-but-unperformed reps / upcoming sets (charcoal placeholder). */\nconst TODO_COLOR = primitiveColors.charcoal[300]\n\n/**\n * The learned \"variable / unknown / opportunity\" semantic (cyan-900, a real ramp\n * pin): an unperformed rep in a range's variable zone, and the fading trail of a\n * myo set whose cluster count isn't yet known.\n */\nexport const SET_STRIP_VARIABLE_COLOR = primitiveRamps.cyan[900]\n\n// Gap hierarchy — the chunk-size *pattern* carries set-type identity:\n// butted reps (0) < NOTCH (drop sub-load) < CLUSTER (myo rest-pause) < SET_GAP (5, between sets).\n/** Drop-set sub-load divider — a thin notch, narrower than a myo cluster gap. */\nconst NOTCH_GAP = 2\n/** Myo rest-pause divider between the activation chunk and each mini-cluster. */\nconst CLUSTER_GAP = 3\n\n/** myo-upcoming trail defaults: N fading expected clusters, each this many reps. */\nconst MYO_UPCOMING_CLUSTERS = 3\nconst MYO_UPCOMING_CLUSTER_LEN = 5\n/** Per-cluster opacity decay along the \"count unknown\" trail (1 · 0.6 · 0.36 · …). */\nconst MYO_UPCOMING_FADE = 0.6\n\n/**\n * Active-set pulse range per zone: each segment eases between its pin's adjacent\n * lighter/darker ramp steps, keeping the intensity reading while signalling \"live\".\n */\nconst PULSE_RANGE: Record<string, [string, string]> = {\n [SET_STRIP_ZONES.slow]: [primitiveRamps.red[500], primitiveRamps.red[700]],\n [SET_STRIP_ZONES.moderate]: [primitiveRamps.orange[300], primitiveRamps.orange[500]],\n [SET_STRIP_ZONES.fast]: [primitiveRamps.amber[200], primitiveRamps.amber[400]],\n [SET_STRIP_ZONES.fastest]: [primitiveRamps.green[200], primitiveRamps.green[400]],\n}\n\n/** Map a per-rep mean-velocity ratio to its zone pin (fastest = green, slowest = red). */\nexport function velocityZoneColor(v: number): string {\n if (v < 0.5) return SET_STRIP_ZONES.slow\n if (v < 0.75) return SET_STRIP_ZONES.moderate\n if (v < 1.0) return SET_STRIP_ZONES.fast\n return SET_STRIP_ZONES.fastest\n}\n\n/**\n * One set's data. Flat variants: `done` = every rep performed; `active` = reps-so-far\n * performed against a planned count (remainder greyed, performed reps pulse); `todo` =\n * a planned but unstarted set (solid grey bar). Set-type variants:\n * - `range` — variable rep-range (e.g. 15–20): `max` segments; committed zone\n * `0..floor` (done = velocity, todo = grey), variable zone `floor..max` (done =\n * velocity, todo = the variable/opportunity cyan). `doneVels` may run past `floor`.\n * - `drop` — one set, no rest: `subloads` butted internally, split by 2px notches.\n * - `myo` — done rest-pause: `activation` chunk + `clusters`, split by 3px cluster gaps.\n * - `myo-upcoming` — planned myo, length unknown: grey activation (`activationLen`) +\n * a fading cyan \"clusters-to-failure\" trail with the right edge left open.\n */\nexport type SetStripSet =\n | { status: 'done'; velocities: number[] }\n | { status: 'active'; velocities: number[]; planned: number }\n | { status: 'todo'; planned: number }\n | { status: 'range'; floor: number; max: number; doneVels: number[] }\n | { status: 'drop'; subloads: number[][] }\n | { status: 'myo'; activation: number[]; clusters: number[][] }\n | { status: 'myo-upcoming'; activationLen: number; clusterCount?: number }\n\n/** Flatten velocity chunks into butted segments, carving `gap` before each chunk but the first. */\nfunction chunkedSegments(chunks: number[][], gap: number): SegmentedBarSegment[] {\n return chunks.flatMap((vels, ci) =>\n vels.map((v, ri) => ({\n color: velocityZoneColor(v),\n ...(ci > 0 && ri === 0 ? { leadingGap: gap } : {}),\n }))\n )\n}\n\n/** The variable rep-range's `max` segments: velocity where done, else grey (committed) / cyan (variable). */\nfunction rangeSegments(floor: number, max: number, doneVels: number[]): SegmentedBarSegment[] {\n return Array.from({ length: max }, (_, i) => {\n if (i < doneVels.length) return { color: velocityZoneColor(doneVels[i]) }\n return { color: i < floor ? TODO_COLOR : SET_STRIP_VARIABLE_COLOR }\n })\n}\n\n/** Grey activation chunk + a fading, right-open cyan trail of expected rest-pause clusters. */\nfunction myoUpcomingSegments(activationLen: number, clusterCount: number): SegmentedBarSegment[] {\n const activation = Array.from({ length: activationLen }, () => ({ color: TODO_COLOR }))\n const trail = Array.from({ length: clusterCount }, (_, ci) =>\n Array.from({ length: MYO_UPCOMING_CLUSTER_LEN }, (_, ri) => ({\n color: SET_STRIP_VARIABLE_COLOR,\n opacity: MYO_UPCOMING_FADE ** ci,\n ...(ri === 0 ? { leadingGap: CLUSTER_GAP } : {}),\n }))\n ).flat()\n return [...activation, ...trail]\n}\n\n/** Map a set's performance state to the butted per-rep segments of its bar. */\nfunction setSegments(set: SetStripSet): SegmentedBarSegment[] {\n if (set.status === 'todo') {\n return [{ color: TODO_COLOR }]\n }\n if (set.status === 'done') {\n return set.velocities.map((v) => ({ color: velocityZoneColor(v) }))\n }\n if (set.status === 'range') {\n return rangeSegments(set.floor, set.max, set.doneVels)\n }\n if (set.status === 'drop') {\n return chunkedSegments(set.subloads, NOTCH_GAP)\n }\n if (set.status === 'myo') {\n return chunkedSegments([set.activation, ...set.clusters], CLUSTER_GAP)\n }\n if (set.status === 'myo-upcoming') {\n return myoUpcomingSegments(set.activationLen, set.clusterCount ?? MYO_UPCOMING_CLUSTERS)\n }\n const performed = set.velocities.map((v) => {\n const color = velocityZoneColor(v)\n return { color, pulse: true, pulseColor: PULSE_RANGE[color] }\n })\n const remaining = Math.max(0, set.planned - set.velocities.length)\n return [...performed, ...Array.from({ length: remaining }, () => ({ color: TODO_COLOR }))]\n}\n\n/** Preserve SetBar's per-segment test hooks over the generic SegmentedBar fills. */\nfunction setBarSegmentTestID(seg: SegmentedBarSegment): string {\n if (seg.pulse) return 'set-strip-pulse'\n if (seg.color === SET_STRIP_VARIABLE_COLOR) return 'set-strip-variable'\n return seg.color === TODO_COLOR ? 'set-strip-empty' : 'set-strip-fill'\n}\n\nexport interface SetBarProps {\n /** One set's performance state (done / active / todo). */\n set: SetStripSet\n /** Bar height in px. Default 8. */\n height?: number\n}\n\n/**\n * ONE set's multi-coloured bar: the butted per-rep colour segments for a single\n * set (`done` = velocity-coloured reps · `active` = performed reps pulsing + grey\n * remainder · `todo` = a solid grey bar), composed over {@link SegmentedBar}.\n * Fills its flex slot; {@link SetStrip} lays several side by side. Colours are the\n * real titan ramp pins.\n */\nexport function SetBar({ set, height = 8 }: SetBarProps) {\n return (\n <SegmentedBar\n segments={setSegments(set)}\n height={height}\n gap={0}\n radius={0}\n segmentTestID={setBarSegmentTestID}\n style={{ flex: 1, minWidth: 0, borderRadius: 2, overflow: 'hidden' }}\n testID=\"set-strip-set\"\n />\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { View, type ViewProps } from 'react-native'\nimport { SetBar, type SetStripSet } from './SetBar'\n\n// Re-exported so the per-set colour vocabulary stays importable from either the\n// molecule (SetStrip) or the atom (SetBar) it now lives in.\nexport {\n SET_STRIP_ZONES,\n SET_STRIP_VARIABLE_COLOR,\n velocityZoneColor,\n SetBar,\n type SetBarProps,\n} from './SetBar'\nexport type { SetStripSet } from './SetBar'\n\n/** Gap between set bars — ~2× the (zero) rep gap, so sets read as discrete units. */\nconst SET_STRIP_GAP = 5\n\n/** Collapse a set (flat or set-type) to its glance category for the progress summary. */\nfunction setCategory(set: SetStripSet): 'done' | 'active' | 'upcoming' {\n switch (set.status) {\n case 'done':\n case 'drop':\n case 'myo':\n return 'done'\n case 'active':\n return 'active'\n case 'range':\n return set.doneVels.length > 0 ? 'active' : 'upcoming'\n case 'todo':\n case 'myo-upcoming':\n return 'upcoming'\n }\n}\n\nfunction describeSets(sets: SetStripSet[]): string {\n const done = sets.filter((s) => setCategory(s) === 'done').length\n const active = sets.filter((s) => setCategory(s) === 'active').length\n const upcoming = sets.filter((s) => setCategory(s) === 'upcoming').length\n return `Set progress: ${done} done, ${active} in progress, ${upcoming} upcoming`\n}\n\nexport interface SetStripProps extends ViewProps {\n /** Per-set performance data, in set order. */\n sets: SetStripSet[]\n /** Bar height in px. Default 8. */\n height?: number\n className?: string\n}\n\n/**\n * The per-set segmented performance strip: one continuous {@link SetBar} per set\n * (rep intensities as butted color segments, no rep gaps), sets separated by a\n * fixed gap. Fills its container width. Colors are the real titan ramp pins.\n */\nexport function SetStrip({ sets, height = 8, className, ...props }: SetStripProps) {\n return (\n <View\n className={className}\n style={{ flexDirection: 'row', width: '100%', height, gap: SET_STRIP_GAP }}\n accessibilityRole=\"image\"\n accessibilityLabel={describeSets(sets)}\n testID=\"set-strip\"\n {...props}\n >\n {sets.map((set, i) => (\n <SetBar key={i} set={set} height={height} />\n ))}\n </View>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { View } from 'react-native'\nimport { ExerciseHeading, type ExerciseHeadingProps } from './ExerciseHeading'\nimport { SetStrip, type SetStripSet } from './SetStrip'\n\nexport interface ExerciseCardHeadingProps extends ExerciseHeadingProps {\n /** Per-set performance data driving the strip; an empty list renders no strip. */\n setStates: SetStripSet[]\n /** Strip height in px. Default 8. */\n stripHeight?: number\n /** Root testID. Default \"exercise-card\"; override when nested inside another card. */\n testID?: string\n}\n\n/**\n * The complete, standalone session-rail heading: an {@link ExerciseHeading} info\n * block over its per-set {@link SetStrip}. The unit the rail lists — self-contained\n * and independent of {@link ExerciseCard} (whose `rail` state delegates here).\n * e1RM is intentionally dropped (a planning / live-panel concern). Dimming lives on\n * the outer wrapper so the strip dims with the heading.\n */\nexport function ExerciseCardHeading({\n setStates,\n stripHeight = 8,\n dimmed,\n testID = 'exercise-card',\n ...heading\n}: ExerciseCardHeadingProps) {\n return (\n <View\n style={{ paddingVertical: 9, paddingHorizontal: 12, opacity: dimmed ? 0.55 : 1 }}\n testID={testID}\n >\n <ExerciseHeading {...heading} />\n\n {setStates.length > 0 && (\n <View style={{ marginTop: 7 }} testID=\"exercise-card-strip\">\n <SetStrip sets={setStates} height={stripHeight} />\n </View>\n )}\n </View>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { useState } from 'react'\nimport { View, Text, Pressable } from 'react-native'\nimport { VelocityStrip, type VelocityZoneBandProp } from './VelocityStrip'\nimport { PlaceholderStrip } from './PlaceholderStrip'\nimport { PrBadge } from './PrBadge'\nimport { SetRow, type SetRowProps } from './SetRow'\nimport { type SetStripSet } from './SetStrip'\nimport { SetTableHeader } from './SetTableHeader'\nimport { ExerciseCardHeading } from './ExerciseCardHeading'\nimport { type ExerciseIndicatorKind } from './ExerciseIndicator'\nimport { roundWeight } from '../../../utils/workout-format'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\n\nexport interface ExerciseCardProps {\n name: string\n /**\n * The dimmed, not-yet-reached representation (prescription + previous-best line).\n * Overrides the expand state — an upcoming card never expands.\n */\n upcoming?: boolean\n /** Controlled expand state. Omit to run uncontrolled (see {@link defaultExpanded}). */\n expanded?: boolean\n /** Uncontrolled initial expand state. Default false. Ignored when `expanded` is set. */\n defaultExpanded?: boolean\n /** Notified when the user toggles the card between collapsed and expanded. */\n onExpandedChange?: (expanded: boolean) => void\n onNavigateDetail?: () => void\n summary?: {\n sets: number\n reps: number | string\n weight: number\n unit: 'lbs' | 'kg'\n }\n isPR?: boolean\n /** Collapsed glance: per-set logged velocities (drives the mini strips). */\n setVelocities?: number[][]\n /** Optional velocity-zone bands shared across this exercise's sets (WA bands). */\n velocityZones?: readonly VelocityZoneBandProp[]\n /** Collapsed glance: total planned sets (placeholder strips fill the remainder). */\n totalPlannedSets?: number\n /** Expanded body: the per-set rows (done / live / todo). */\n sets?: SetRowProps[]\n tempo?: [number, number, number, number]\n prescription?: string\n previousBest?: string\n supersetPosition?: 'first' | 'last' | 'middle' | null\n supersetColor?: string\n /** Expanded header per-set strip override; derived from `sets` when omitted. */\n setStates?: SetStripSet[]\n /** A small PR / issue / info chip in the title line (expanded header). */\n indicator?: ExerciseIndicatorKind\n /** Expanded header strip height in px. Default 8. */\n stripHeight?: number\n}\n\n/** The sub-card render props: everything but the expand-control surface, plus a resolved toggle. */\ntype CardBodyProps = Omit<\n ExerciseCardProps,\n 'upcoming' | 'expanded' | 'defaultExpanded' | 'onExpandedChange'\n> & { onToggle: () => void }\n\nfunction getSupersetBorderRadius(\n position: ExerciseCardProps['supersetPosition']\n): Record<string, number> {\n switch (position) {\n case 'first':\n return {\n borderTopLeftRadius: 12,\n borderTopRightRadius: 12,\n borderBottomLeftRadius: 8,\n borderBottomRightRadius: 8,\n }\n case 'last':\n return {\n borderTopLeftRadius: 8,\n borderTopRightRadius: 8,\n borderBottomLeftRadius: 12,\n borderBottomRightRadius: 12,\n }\n case 'middle':\n return {\n borderTopLeftRadius: 8,\n borderTopRightRadius: 8,\n borderBottomLeftRadius: 8,\n borderBottomRightRadius: 8,\n }\n default:\n return {\n borderTopLeftRadius: 12,\n borderTopRightRadius: 12,\n borderBottomLeftRadius: 12,\n borderBottomRightRadius: 12,\n }\n }\n}\n\nfunction getSupersetMargin(\n position: ExerciseCardProps['supersetPosition']\n): Record<string, number> {\n if (position === 'first' || position === 'middle') {\n return { marginBottom: 2 }\n }\n return {}\n}\n\nfunction formatSummary(summary: ExerciseCardProps['summary']): string {\n if (!summary) return ''\n return `${summary.sets}×${summary.reps} @ ${roundWeight(summary.weight)} ${summary.unit}`\n}\n\nfunction formatAccessibilityLabel(\n name: string,\n summary: ExerciseCardProps['summary'],\n prescription: ExerciseCardProps['prescription']\n): string {\n if (summary) return `${name}, ${formatSummary(summary)}`\n if (prescription) return `${name}, ${prescription}`\n return name\n}\n\nfunction CollapsedCard({\n name,\n onToggle,\n summary,\n isPR,\n setVelocities,\n velocityZones,\n totalPlannedSets,\n supersetPosition,\n}: CardBodyProps) {\n const [pressed, setPressed] = useState(false)\n const completedSets = setVelocities?.length ?? 0\n const remaining = Math.max(0, (totalPlannedSets ?? 0) - completedSets)\n const borderRadius = getSupersetBorderRadius(supersetPosition)\n const supersetMargin = getSupersetMargin(supersetPosition)\n\n return (\n <Pressable\n onPress={onToggle}\n onPressIn={() => setPressed(true)}\n onPressOut={() => setPressed(false)}\n accessibilityRole=\"button\"\n accessibilityLabel={formatAccessibilityLabel(name, summary, undefined)}\n testID=\"exercise-card\"\n >\n <View\n className={pressed ? 'bg-surface-raised' : undefined}\n style={{\n padding: 12,\n paddingHorizontal: 14,\n cursor: 'pointer',\n ...borderRadius,\n ...supersetMargin,\n }}\n >\n <View className=\"flex-row items-center\" testID=\"exercise-card-header\">\n <Text\n className=\"text-text-primary\"\n style={{\n fontSize: 14,\n fontFamily: '\"Space Grotesk\", sans-serif',\n fontWeight: '700',\n }}\n testID=\"exercise-card-name\"\n >\n {name}\n </Text>\n <View className=\"flex-1\" />\n {summary && (\n <Text\n className=\"text-text-secondary\"\n style={{\n fontSize: 12,\n fontFamily: 'Inter, sans-serif',\n marginRight: 8,\n }}\n testID=\"exercise-card-summary\"\n >\n {formatSummary(summary)}\n </Text>\n )}\n {isPR && (\n <View style={{ marginLeft: 4 }}>\n <PrBadge type=\"e1rm\" compact animate={false} />\n </View>\n )}\n </View>\n\n {(completedSets > 0 || remaining > 0) && (\n <View className=\"flex-row\" style={{ marginTop: 6, gap: 4 }} testID=\"exercise-card-strips\">\n {setVelocities?.map((velocities, i) => (\n <VelocityStrip\n key={i}\n velocities={velocities}\n zones={velocityZones}\n variant=\"compact\"\n height={8}\n hideBaseline\n testID={`exercise-card-velocity-strip-${i}`}\n />\n ))}\n {Array.from({ length: remaining }, (_, i) => (\n <PlaceholderStrip\n key={`placeholder-${i}`}\n testID={`exercise-card-placeholder-${i}`}\n />\n ))}\n </View>\n )}\n </View>\n </Pressable>\n )\n}\n\n// --- Unified expanded card ---------------------------------------------------\n// The expanded card is \"one object\" with its rail heading: the persistent header\n// is the real ExerciseCardHeading, and the revealed body drops PREV and renders\n// one real SetRow per set (muted done/todo, brightened live spotlight).\n\nconst DARK = getSemanticColors('dark')\n/** The header↔body seam. */\nconst BODY_DIVIDER = DARK['border-subtle']\n\n/** Project the set rows onto the heading strip's per-set state (done / active / todo). */\nfunction deriveHeaderSetStates(sets: SetRowProps[]): SetStripSet[] {\n return sets.map((set): SetStripSet => {\n switch (set.state) {\n case 'live':\n return { status: 'active', velocities: set.velocities, planned: set.target.reps }\n case 'done':\n return { status: 'done', velocities: set.velocities }\n case 'todo':\n return { status: 'todo', planned: set.planned ?? set.target.reps }\n }\n })\n}\n\nfunction ExpandedCard({\n name,\n onToggle,\n summary,\n isPR,\n sets,\n tempo,\n indicator,\n setStates,\n stripHeight = 8,\n velocityZones,\n supersetPosition,\n}: CardBodyProps) {\n const borderRadius = getSupersetBorderRadius(supersetPosition)\n const supersetMargin = getSupersetMargin(supersetPosition)\n // Summary is the card-level authority for the weight column; fall back to the\n // first set's unit, then lbs. (Mixed per-set units keep the card-level label.)\n const unit = summary?.unit ?? sets?.[0]?.unit ?? 'lbs'\n // The rail heading IS the header: its per-set strip comes from an explicit\n // `setStates` when supplied, else it's derived from the set rows. e1RM is dropped\n // entirely; a PR surfaces via the chip.\n const headerStates = setStates ?? (sets ? deriveHeaderSetStates(sets) : [])\n const headerIndicator = indicator ?? (isPR ? 'pr' : undefined)\n\n return (\n <View\n className=\"bg-surface-elevated border-border\"\n style={{\n borderWidth: 1,\n ...borderRadius,\n ...supersetMargin,\n }}\n testID=\"exercise-card\"\n >\n <ExerciseCardHeading\n name={name}\n sets={summary?.sets ?? sets?.length ?? 0}\n reps={summary?.reps ?? 0}\n load={summary?.weight ?? 0}\n unit={unit}\n tempo={tempo}\n indicator={headerIndicator}\n setStates={headerStates}\n stripHeight={stripHeight}\n onPress={onToggle}\n testID=\"exercise-card-heading\"\n />\n\n <View\n style={{ borderTopWidth: 1, borderTopColor: BODY_DIVIDER, paddingBottom: 6 }}\n testID=\"exercise-card-body\"\n >\n <SetTableHeader unit={unit} showPrevious={false} testID=\"exercise-card-column-headers\" />\n\n {sets && (\n <View testID=\"exercise-card-sets\">\n {sets.map((set, i) => (\n <SetRow key={i} {...set} velocityZones={set.velocityZones ?? velocityZones} />\n ))}\n </View>\n )}\n </View>\n </View>\n )\n}\n\nfunction UpcomingCard({\n name,\n prescription,\n previousBest,\n supersetPosition,\n onToggle,\n}: CardBodyProps) {\n const borderRadius = getSupersetBorderRadius(supersetPosition)\n const supersetMargin = getSupersetMargin(supersetPosition)\n\n return (\n <Pressable onPress={onToggle} accessibilityRole=\"button\">\n <View\n style={{\n opacity: 0.6,\n padding: 12,\n paddingHorizontal: 14,\n ...borderRadius,\n ...supersetMargin,\n }}\n accessibilityLabel={formatAccessibilityLabel(name, undefined, prescription)}\n testID=\"exercise-card\"\n >\n <View className=\"flex-row items-center\">\n {/* Name never truncates (no numberOfLines); prescription + previousBest ellipsize first. */}\n <Text\n className=\"text-text-primary\"\n style={{\n flexShrink: 0,\n fontSize: 14,\n fontFamily: '\"Space Grotesk\", sans-serif',\n fontWeight: '700',\n }}\n testID=\"exercise-card-name\"\n >\n {name}\n </Text>\n {prescription && (\n <Text\n className=\"text-text-secondary\"\n numberOfLines={1}\n style={{\n flexShrink: 1,\n fontSize: 12,\n fontFamily: 'Inter, sans-serif',\n marginLeft: 8,\n }}\n testID=\"exercise-card-prescription\"\n >\n {prescription}\n </Text>\n )}\n <View className=\"flex-1\" style={{ minWidth: 8 }} />\n {previousBest && (\n <Text\n className=\"text-text-tertiary\"\n numberOfLines={1}\n style={{\n flexShrink: 1,\n fontSize: 11,\n fontFamily: 'Inter, sans-serif',\n }}\n testID=\"exercise-card-previous-best\"\n >\n {previousBest}\n </Text>\n )}\n </View>\n </View>\n </Pressable>\n )\n}\n\n/**\n * The data-contract exercise card, in three representations:\n * - `upcoming` — a dimmed, not-yet-reached row (prescription + previous best).\n * - collapsed — a glance: name + summary + per-set velocity strips.\n * - expanded — the unified card: the real {@link ExerciseCardHeading} header over\n * the SET · REPS · LBS · RPE body (one {@link SetRow} per set).\n *\n * Expand is controlled (`expanded` + `onExpandedChange`) or uncontrolled\n * (`defaultExpanded`, internal state). `upcoming` overrides expand.\n */\nexport function ExerciseCard({\n upcoming,\n expanded,\n defaultExpanded,\n onExpandedChange,\n ...rest\n}: ExerciseCardProps) {\n const [internalExpanded, setInternalExpanded] = useState(defaultExpanded ?? false)\n const isControlled = expanded !== undefined\n const isExpanded = isControlled ? expanded : internalExpanded\n\n const onToggle = () => {\n const next = !isExpanded\n onExpandedChange?.(next)\n if (!isControlled) setInternalExpanded(next)\n }\n\n if (upcoming) return <UpcomingCard {...rest} onToggle={onToggle} />\n return isExpanded ? (\n <ExpandedCard {...rest} onToggle={onToggle} />\n ) : (\n <CollapsedCard {...rest} onToggle={onToggle} />\n )\n}\n","import { Platform } from 'react-native'\nimport { getSemanticColors, type ThemeMode } from './tokens/semantic'\n\ntype ColorToken = keyof ReturnType<typeof getSemanticColors>\n\n/**\n * Resolve a semantic color token for an inline style where a nativewind\n * className can't apply — gradients (`backgroundImage`), per-edge borders\n * (`borderTopColor`, …), SVG attributes, and conditional hex/token mixes.\n *\n * The companion to className color tokens: on **web** it returns the CSS\n * variable (`var(--color-…)`), so the dashboard's light/dark switching keeps\n * working exactly as `global.css` intends; on **native** it returns the\n * resolved hex from `getSemanticColors` (mobile is dark-only). This is why\n * these spots stay theme-correct on web while also rendering on-device.\n */\nexport function resolveColor(token: ColorToken, mode: ThemeMode = 'dark'): string {\n return Platform.OS === 'web' ? `var(--color-${token})` : getSemanticColors(mode)[token]\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport React from 'react'\nimport { View, Text, Pressable, TextInput } from 'react-native'\nimport { resolveColor } from '../../../theme/resolve-color'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\n\nexport interface InputBarProps {\n exerciseName: string\n setNumber: number\n totalSets: number | null\n reps: string\n weight: string\n unit: 'lbs' | 'kg'\n onRepsChange: (value: string) => void\n onWeightChange: (value: string) => void\n onRecord: () => void\n canRecord: boolean\n visible: boolean\n}\n\nconst BRAND_PRIMARY = getSemanticColors('dark')['brand-primary']\nconst INPUT_CLASSNAME = 'bg-surface-raised border-border-strong text-text-primary'\n\nconst inputStyle = {\n fontSize: 14,\n fontWeight: '600' as const,\n fontFamily: 'Inter, sans-serif',\n borderWidth: 1,\n borderRadius: 6,\n textAlign: 'center' as const,\n paddingVertical: 5,\n paddingHorizontal: 2,\n}\n\nexport function InputBar({\n exerciseName,\n setNumber,\n totalSets,\n reps,\n weight,\n unit,\n onRepsChange,\n onWeightChange,\n onRecord,\n canRecord,\n visible,\n}: InputBarProps) {\n if (!visible) return null\n\n const setLabel = totalSets != null ? `Set ${setNumber}/${totalSets}` : `Set ${setNumber}`\n\n return (\n <View\n className=\"bg-surface-elevated\"\n style={{\n width: '100%',\n borderTopWidth: 1,\n borderTopColor: resolveColor('border-default'),\n paddingTop: 10,\n paddingHorizontal: 16,\n paddingBottom: 12,\n flexDirection: 'row',\n alignItems: 'center',\n gap: 10,\n }}\n accessibilityRole=\"toolbar\"\n testID=\"input-bar\"\n >\n <View style={{ minWidth: 80, flexDirection: 'column' }}>\n <Text\n className=\"text-text-primary\"\n style={{\n fontSize: 12,\n fontWeight: '700',\n fontFamily: '\"Space Grotesk\", sans-serif',\n }}\n testID=\"input-bar-exercise-name\"\n numberOfLines={1}\n >\n {exerciseName}\n </Text>\n <Text\n className=\"text-text-tertiary\"\n style={{\n fontSize: 10,\n fontFamily: 'Inter, sans-serif',\n }}\n testID=\"input-bar-set-info\"\n >\n {setLabel}\n </Text>\n </View>\n\n <View className=\"flex-1 flex-row items-center\" style={{ gap: 4 }}>\n <TextInput\n value={reps}\n onChangeText={onRepsChange}\n className={INPUT_CLASSNAME}\n style={{ ...inputStyle, width: 36 }}\n accessibilityLabel=\"Reps\"\n testID=\"input-bar-reps\"\n keyboardType=\"numeric\"\n />\n <Text\n className=\"text-text-tertiary\"\n style={{\n fontSize: 12,\n fontFamily: 'Inter, sans-serif',\n }}\n >\n {'\\u00D7'}\n </Text>\n <TextInput\n value={weight}\n onChangeText={onWeightChange}\n className={INPUT_CLASSNAME}\n style={{ ...inputStyle, width: 52 }}\n accessibilityLabel={`Weight in ${unit}`}\n testID=\"input-bar-weight\"\n keyboardType=\"numeric\"\n />\n <Text\n className=\"text-text-tertiary\"\n style={{\n fontSize: 12,\n fontWeight: '500',\n fontFamily: 'Inter, sans-serif',\n }}\n testID=\"input-bar-unit\"\n >\n {unit}\n </Text>\n </View>\n\n <Pressable\n onPress={onRecord}\n disabled={!canRecord}\n style={({ pressed }) => ({\n backgroundColor: BRAND_PRIMARY,\n borderRadius: 8,\n paddingVertical: 10,\n paddingHorizontal: 16,\n opacity: !canRecord ? 0.4 : pressed ? 0.8 : 1,\n })}\n accessibilityRole=\"button\"\n accessibilityLabel=\"Record set\"\n testID=\"input-bar-record\"\n >\n <Text\n style={{\n fontSize: 13,\n fontWeight: '700',\n fontFamily: 'Inter, sans-serif',\n color: '#FFFFFF',\n }}\n >\n Record\n </Text>\n </Pressable>\n </View>\n )\n}\n","import { useEffect, useState } from 'react'\n\nexport type TimerMode = 'up' | 'down'\n\nexport interface UseTimerOptions {\n /** 'up' counts elapsed upward; 'down' counts remaining toward 0. Default 'up'. */\n mode?: TimerMode\n /** Total duration in ms. Required for 'down' mode and for progress in 'up' mode. */\n durationMs?: number\n /** Controlled elapsed time in ms. When provided, the hook derives everything from it and never ticks. */\n elapsedMs?: number\n /** Self-tick only advances while running. */\n running?: boolean\n /** Enable the internal interval. Ignored when `elapsedMs` is controlled. */\n autoTick?: boolean\n /** Interval step in ms. Default 1000. */\n tickMs?: number\n}\n\nexport interface TimerState {\n elapsedMs: number\n remainingMs: number\n /** 0..1, clamped. */\n progress: number\n /** mm:ss for the active direction (remaining when 'down', elapsed when 'up'). */\n label: string\n /** True once a down-timer reaches 0 (or an up-timer passes its duration). */\n done: boolean\n}\n\n/** Format a millisecond duration as mm:ss, rounding partial seconds up. */\nexport function formatDuration(ms: number): string {\n const totalSeconds = Math.max(0, Math.ceil(ms / 1000))\n const minutes = Math.floor(totalSeconds / 60)\n const seconds = totalSeconds % 60\n return `${minutes}:${String(seconds).padStart(2, '0')}`\n}\n\nexport function useTimer(options: UseTimerOptions = {}): TimerState {\n const {\n mode = 'up',\n durationMs,\n elapsedMs: controlledElapsedMs,\n running = false,\n autoTick = false,\n tickMs = 1000,\n } = options\n\n const isControlled = controlledElapsedMs != null\n const [internalElapsedMs, setInternalElapsedMs] = useState(0)\n\n useEffect(() => {\n if (isControlled || !autoTick || !running) return\n const id = setInterval(() => {\n setInternalElapsedMs((prev) => prev + tickMs)\n }, tickMs)\n return () => clearInterval(id)\n }, [isControlled, autoTick, running, tickMs])\n\n const elapsedMs = isControlled ? controlledElapsedMs : internalElapsedMs\n\n const hasDuration = durationMs != null && durationMs > 0\n const remainingMs = durationMs != null ? Math.max(0, durationMs - elapsedMs) : 0\n\n let progress: number\n if (hasDuration) {\n progress = Math.min(1, Math.max(0, elapsedMs / durationMs))\n } else {\n // A zero/undefined duration is trivially complete for a countdown, empty for a stopwatch.\n progress = mode === 'down' ? 1 : 0\n }\n\n const label = formatDuration(mode === 'down' ? remainingMs : elapsedMs)\n const done = durationMs != null && elapsedMs >= durationMs\n\n return { elapsedMs, remainingMs, progress, label, done }\n}\n","import React from 'react'\nimport { View, Text, type ViewProps } from 'react-native'\nimport { cn } from '../../../utils/cn'\n\nexport type ProgressSize = 'sm' | 'md' | 'lg'\nexport type ProgressColor = 'primary' | 'secondary' | 'success' | 'error' | 'warning' | 'info'\nexport type ProgressVariant = 'linear' | 'circular'\n\n/** Maps the color prop to a CSS variable reference for inline styles */\nexport const colorVarMap: Record<ProgressColor, string> = {\n primary: 'var(--color-brand-primary)',\n secondary: 'var(--color-brand-secondary)',\n success: 'var(--color-status-success)',\n error: 'var(--color-status-error)',\n warning: 'var(--color-status-warning)',\n info: 'var(--color-status-info)',\n}\n\nexport interface ProgressProps extends ViewProps {\n /** Current value (0-100) */\n value?: number\n /** Maximum value */\n max?: number\n /** Whether the progress is indeterminate */\n isIndeterminate?: boolean\n /** Size of the progress bar */\n size?: ProgressSize\n /** Color of the progress */\n color?: ProgressColor\n /** Whether to show the value label */\n showValue?: boolean\n /** Custom value format function */\n formatValue?: (value: number, max: number) => string\n /** Label text */\n label?: string\n /** Fixed track width in pixels (default: full width) */\n trackWidth?: number\n /** Custom hex color override for the fill bar */\n customColor?: string\n /** Additional className */\n className?: string\n}\n\nconst sizeStyles: Record<ProgressSize, string> = {\n sm: 'h-1',\n md: 'h-2',\n lg: 'h-3',\n}\n\nconst colorStyles: Record<ProgressColor, string> = {\n primary: 'bg-brand-primary',\n secondary: 'bg-brand-secondary',\n success: 'bg-status-success',\n error: 'bg-status-error',\n warning: 'bg-status-warning',\n info: 'bg-status-info',\n}\n\nconst trackColorStyles: Record<ProgressColor, string> = {\n primary: 'bg-brand-primary/20',\n secondary: 'bg-brand-secondary/20',\n success: 'bg-status-success/20',\n error: 'bg-status-error/20',\n warning: 'bg-status-warning/20',\n info: 'bg-status-info/20',\n}\n\n/**\n * Linear progress bar component.\n *\n * @example\n * // Determinate progress\n * <Progress value={75} />\n *\n * @example\n * // With label and value\n * <Progress value={45} label=\"Uploading...\" showValue />\n *\n * @example\n * // Indeterminate progress\n * <Progress isIndeterminate />\n */\nexport function Progress({\n value = 0,\n max = 100,\n isIndeterminate = false,\n size = 'md',\n color = 'primary',\n showValue = false,\n formatValue = (v, m) => `${Math.round((v / m) * 100)}%`,\n label,\n trackWidth,\n customColor,\n className,\n ...props\n}: ProgressProps) {\n const percentage = Math.min(Math.max((value / max) * 100, 0), 100)\n\n return (\n <View className={cn('w-full', className)} {...props}>\n {/* Label and Value Row */}\n {(label || showValue) && (\n <View className=\"flex-row justify-between items-center mb-1\">\n {label && <Text className=\"text-sm text-text-secondary\">{label}</Text>}\n {showValue && !isIndeterminate && (\n <Text className=\"text-sm font-medium text-text-primary\">{formatValue(value, max)}</Text>\n )}\n </View>\n )}\n\n {/* Progress Track */}\n <View\n className={cn(\n 'rounded-full overflow-hidden',\n trackWidth ? undefined : 'w-full',\n trackColorStyles[color],\n sizeStyles[size]\n )}\n style={trackWidth ? { width: trackWidth } : undefined}\n accessibilityRole=\"progressbar\"\n accessibilityValue={{\n min: 0,\n max: max,\n now: isIndeterminate ? undefined : value,\n }}\n >\n {/* Progress Fill */}\n <View\n className={cn(\n 'h-full rounded-full',\n !customColor && colorStyles[color],\n isIndeterminate && 'animate-pulse w-1/3'\n )}\n style={{\n ...(isIndeterminate ? {} : { width: `${percentage}%` }),\n ...(customColor ? { backgroundColor: customColor } : {}),\n }}\n />\n </View>\n </View>\n )\n}\n\nexport interface CircularProgressProps extends ViewProps {\n /** Current value (0-100) */\n value?: number\n /** Maximum value */\n max?: number\n /** Whether the progress is indeterminate */\n isIndeterminate?: boolean\n /** Size of the progress circle (diameter) */\n size?: number\n /** Stroke width */\n strokeWidth?: number\n /** Color of the progress */\n color?: ProgressColor\n /** Whether to show the value in center */\n showValue?: boolean\n /** Custom value format function */\n formatValue?: (value: number, max: number) => string\n /**\n * Custom center content (a numeral, a timer readout, an icon). When provided it\n * replaces the {@link showValue} text — the ring becomes a generic container for\n * any centered element. See {@link CircularTimer} for the batteries-included timer.\n */\n children?: React.ReactNode\n /**\n * Fill the parent container (responsive) instead of drawing a fixed `size` box.\n * The SVG uses a `0 0 size size` viewBox scaled to the container, so `size` still\n * sets the geometry proportions (radius, stroke) while the ring grows/shrinks with\n * its parent — e.g. a wall column. Default false (fixed `size` px).\n */\n fill?: boolean\n /** Additional className */\n className?: string\n}\n\n/**\n * Circular progress indicator component.\n *\n * @example\n * <CircularProgress value={75} showValue />\n */\nexport function CircularProgress({\n value = 0,\n max = 100,\n isIndeterminate = false,\n size = 48,\n strokeWidth = 4,\n color = 'primary',\n showValue = false,\n formatValue = (v, m) => `${Math.round((v / m) * 100)}%`,\n children,\n fill = false,\n className,\n ...props\n}: CircularProgressProps) {\n const percentage = Math.min(Math.max((value / max) * 100, 0), 100)\n const radius = (size - strokeWidth) / 2\n const circumference = 2 * Math.PI * radius\n const strokeDashoffset = circumference - (percentage / 100) * circumference\n const center = size / 2\n // Fixed: a `size × size` px box. Fill: fill the parent, staying square, and let\n // the `0 0 size size` viewBox scale the geometry to fit (a responsive ring).\n const boxStyle = fill ? { width: '100%' as const, aspectRatio: 1 } : { width: size, height: size }\n\n return (\n <View\n className={cn('items-center justify-center', className)}\n style={boxStyle}\n accessibilityRole=\"progressbar\"\n accessibilityValue={{\n min: 0,\n max: max,\n now: isIndeterminate ? undefined : value,\n }}\n {...props}\n >\n {/* SVG implementation for web — width/height 100% so it scales with `boxStyle`. */}\n <View className={cn(isIndeterminate && 'animate-spin')} style={boxStyle}>\n <svg\n width=\"100%\"\n height=\"100%\"\n viewBox={`0 0 ${size} ${size}`}\n style={{ position: 'absolute' }}\n >\n {/* Background track */}\n <circle\n cx={center}\n cy={center}\n r={radius}\n fill=\"none\"\n stroke=\"var(--color-border-default)\"\n strokeWidth={strokeWidth}\n />\n {/* Progress arc */}\n <circle\n cx={center}\n cy={center}\n r={radius}\n fill=\"none\"\n stroke={colorVarMap[color]}\n strokeWidth={strokeWidth}\n strokeLinecap=\"round\"\n strokeDasharray={circumference}\n strokeDashoffset={isIndeterminate ? circumference * 0.75 : strokeDashoffset}\n transform={`rotate(-90 ${center} ${center})`}\n style={{ transition: 'stroke-dashoffset 300ms cubic-bezier(0.22, 1, 0.36, 1)' }}\n />\n </svg>\n </View>\n\n {/* Center: custom children take precedence over the showValue readout. */}\n {children != null ? (\n <View\n style={{\n position: 'absolute',\n alignItems: 'center',\n justifyContent: 'center',\n pointerEvents: 'none',\n }}\n >\n {children}\n </View>\n ) : (\n showValue &&\n !isIndeterminate && (\n <Text\n className=\"text-xs font-semibold text-text-primary absolute\"\n style={{ fontSize: Math.max(size * 0.22, 10) }}\n >\n {formatValue(value, max)}\n </Text>\n )\n )}\n </View>\n )\n}\n\nexport interface ProgressStepsProps extends ViewProps {\n /** Current step (0-indexed) */\n currentStep: number\n /** Total number of steps */\n totalSteps: number\n /** Color of completed steps */\n color?: ProgressColor\n /** Size of step indicators */\n size?: ProgressSize\n /** Labels for each step */\n labels?: string[]\n /** Additional className */\n className?: string\n}\n\nconst stepSizeStyles: Record<ProgressSize, { dot: string; connector: string }> = {\n sm: { dot: 'w-2 h-2', connector: 'h-0.5' },\n md: { dot: 'w-3 h-3', connector: 'h-1' },\n lg: { dot: 'w-4 h-4', connector: 'h-1.5' },\n}\n\n/**\n * Step-based progress indicator.\n *\n * @example\n * <ProgressSteps currentStep={2} totalSteps={4} labels={['Cart', 'Shipping', 'Payment', 'Done']} />\n */\nexport function ProgressSteps({\n currentStep,\n totalSteps,\n color = 'primary',\n size = 'md',\n labels,\n className,\n ...props\n}: ProgressStepsProps) {\n const { dot, connector } = stepSizeStyles[size]\n\n return (\n <View className={cn('w-full', className)} {...props}>\n <View className=\"flex-row items-center\">\n {Array.from({ length: totalSteps }).map((_, index) => (\n <React.Fragment key={index}>\n {/* Step dot */}\n <View\n className={cn(\n 'rounded-full',\n dot,\n index <= currentStep ? colorStyles[color] : 'bg-border-strong'\n )}\n />\n\n {/* Connector line */}\n {index < totalSteps - 1 && (\n <View\n className={cn(\n 'flex-1 mx-1',\n connector,\n index < currentStep ? colorStyles[color] : 'bg-border-strong'\n )}\n />\n )}\n </React.Fragment>\n ))}\n </View>\n\n {/* Labels */}\n {labels && labels.length > 0 && (\n <View className=\"flex-row mt-2\">\n {labels.map((label, index) => (\n <Text\n key={index}\n className={cn(\n 'flex-1 text-xs text-center',\n index <= currentStep ? 'text-text-primary font-medium' : 'text-text-tertiary'\n )}\n >\n {label}\n </Text>\n ))}\n </View>\n )}\n </View>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport type { ReactNode } from 'react'\nimport { View, Text } from 'react-native'\nimport { CircularProgress, colorVarMap, type ProgressColor } from '../../ui/progress/Progress'\nimport { useTimer, type TimerMode } from '../../../hooks/useTimer'\n\nexport interface CircularTimerProps {\n /** Total duration (ms). `down`: the countdown length; `up`: the target for progress. */\n durationMs: number\n /** Controlled elapsed time (ms). */\n elapsedMs: number\n /** `down` (default) counts remaining toward 0 (ring drains); `up` counts elapsed up (ring fills). */\n mode?: TimerMode\n /** Ring diameter (px) — the geometry/stroke reference. Default 160. */\n size?: number\n /** Ring stroke width (px). Default 8. */\n strokeWidth?: number\n /** Fill the parent container (responsive) instead of a fixed `size` box. */\n fill?: boolean\n /** Ring color while running. Default `primary`. */\n color?: ProgressColor\n /**\n * `down` mode: the text shown in the center — and the color the ring fills to — when\n * the countdown completes (e.g. `doneLabel=\"GO\"`). Omit to keep showing `0:00`.\n */\n doneLabel?: string\n /** Ring + center color when complete (with {@link doneLabel}). Default `success`. */\n doneColor?: ProgressColor\n /** Optional controls rendered below the ring (e.g. +30s / Skip). */\n controls?: ReactNode\n /** Accessibility label for the timer. Defaults to a seconds-remaining description. */\n accessibilityLabel?: string\n testID?: string\n}\n\n/**\n * A circular countdown / countup with a time readout in the center — the graphical\n * sibling of {@link TimerReadout}. Batteries-included: owns {@link useTimer} (pass\n * controlled `durationMs` + `elapsedMs`) and composes {@link CircularProgress} for the\n * arc (`down` drains as time runs out, `up` fills), rendering the mm:ss label in its\n * center slot. On completion (`down` + {@link doneLabel}) the ring fills fully in\n * {@link doneColor} and the center reads the done label — the \"go\" moment. An optional\n * {@link controls} node renders below the ring. Consumers (e.g. `RestTimer`'s `ring`\n * variant) wrap this and add their own domain chrome.\n */\nexport function CircularTimer({\n durationMs,\n elapsedMs,\n mode = 'down',\n size = 160,\n strokeWidth = 8,\n fill = false,\n color = 'primary',\n doneLabel,\n doneColor = 'success',\n controls,\n accessibilityLabel,\n testID,\n}: CircularTimerProps) {\n const { remainingMs, progress, label, done } = useTimer({ mode, durationMs, elapsedMs })\n\n const isDone = done && mode === 'down'\n const showDone = isDone && doneLabel != null\n // Down → the remaining fraction (ring drains); up → elapsed progress (ring fills).\n // A completed countdown with a done label fills fully to signal \"go\".\n const remainingFrac = durationMs > 0 ? Math.max(0, Math.min(1, remainingMs / durationMs)) : 0\n const arc = mode === 'down' ? (showDone ? 1 : remainingFrac) : progress\n const ringColor: ProgressColor = showDone ? doneColor : color\n\n const remainingSec = Math.ceil(Math.max(0, remainingMs) / 1000)\n const a11y =\n accessibilityLabel ?? (isDone ? 'Timer complete' : `${remainingSec} seconds remaining`)\n\n return (\n <View\n style={{ alignItems: 'center', gap: 16 }}\n accessibilityRole=\"timer\"\n accessibilityLabel={a11y}\n testID={testID ?? 'circular-timer'}\n >\n <CircularProgress\n value={arc}\n max={1}\n size={size}\n strokeWidth={strokeWidth}\n fill={fill}\n color={ringColor}\n // A distinct static name for the ring (the live countdown text lives on the\n // enclosing timer role) — satisfies the progressbar-name a11y rule without\n // duplicating the timer label.\n accessibilityLabel=\"Timer ring\"\n testID=\"circular-timer-ring\"\n >\n <Text\n className={showDone ? undefined : 'text-text-primary'}\n style={{\n fontSize: Math.round(size * (showDone ? 0.28 : 0.24)),\n fontFamily: '\"Space Grotesk\", sans-serif',\n fontWeight: '800',\n fontVariant: ['tabular-nums'],\n letterSpacing: showDone ? 1 : -1,\n ...(showDone ? { color: colorVarMap[doneColor] } : null),\n }}\n testID=\"circular-timer-label\"\n >\n {showDone ? doneLabel : label}\n </Text>\n </CircularProgress>\n {controls}\n </View>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { View, Text, Pressable } from 'react-native'\nimport { resolveColor } from '../../../theme/resolve-color'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\nimport { useTimer } from '../../../hooks/useTimer'\nimport { CircularTimer } from '../CircularTimer/CircularTimer'\n\nconst BRAND_PRIMARY = getSemanticColors('dark')['brand-primary']\n\n/** Default `ring` diameter (px) — the across-the-room wall rest treatment. */\nconst RING_DEFAULT_SIZE = 180\n\nexport interface RestTimerProps {\n totalSeconds: number\n elapsedMs: number\n onSkip: () => void\n onAddTime: () => void\n nextSetInfo?: string\n visible: boolean\n /** Passive/poll-only mode: hides the Skip and +30s controls, keeps the countdown, progress bar, and next-set line. */\n displayOnly?: boolean\n /**\n * `bar` (default) — the compact linear card (REST label + mm:ss + progress bar +\n * controls), the mobile bottom-bar treatment. `ring` — the across-the-room wall\n * treatment: a draining countdown ring (composes {@link CircularProgress}) with a\n * big remaining-seconds numeral, the next-set line, and the same controls.\n */\n variant?: 'bar' | 'ring'\n /** `ring` diameter in px. Default 180. */\n size?: number\n}\n\n/** The +30s / Skip control row — shared by both variants (hidden in `displayOnly`). */\nfunction RestActions({ onAddTime, onSkip }: { onAddTime: () => void; onSkip: () => void }) {\n return (\n <View style={{ flexDirection: 'row', gap: 8 }}>\n <Pressable\n onPress={onAddTime}\n style={{\n backgroundColor: 'rgba(255,255,255,0.06)',\n paddingVertical: 8,\n paddingHorizontal: 20,\n borderRadius: 8,\n }}\n accessibilityRole=\"button\"\n accessibilityLabel=\"Add 30 seconds\"\n testID=\"rest-timer-add-time\"\n >\n <Text\n className=\"text-text-secondary\"\n style={{ fontSize: 11, fontFamily: 'Inter, sans-serif', fontWeight: '600' }}\n >\n +30s\n </Text>\n </Pressable>\n <Pressable\n onPress={onSkip}\n style={{\n backgroundColor: 'rgba(255,121,0,0.12)',\n paddingVertical: 8,\n paddingHorizontal: 20,\n borderRadius: 8,\n }}\n accessibilityRole=\"button\"\n accessibilityLabel=\"Skip rest\"\n testID=\"rest-timer-skip\"\n >\n <Text\n style={{\n fontSize: 11,\n fontFamily: 'Inter, sans-serif',\n fontWeight: '600',\n color: BRAND_PRIMARY,\n }}\n >\n Skip\n </Text>\n </Pressable>\n </View>\n )\n}\n\ninterface RestTimerRingProps {\n totalSeconds: number\n elapsedMs: number\n remainingSec: number\n done: boolean\n size: number\n nextSetInfo?: string\n displayOnly: boolean\n onSkip: () => void\n onAddTime: () => void\n}\n\n/**\n * The `ring` render: the wall rest treatment. Composes the generic {@link CircularTimer}\n * (which owns the arc + mm:ss readout + the fill-green \"GO\" done state), passing the\n * shared {@link RestActions} as its controls, and adds the rest-specific next-set footer\n * caption below. Rest-domain chrome only — the timer mechanics live in `CircularTimer`.\n */\nfunction RestTimerRing({\n totalSeconds,\n elapsedMs,\n remainingSec,\n done,\n size,\n nextSetInfo,\n displayOnly,\n onSkip,\n onAddTime,\n}: RestTimerRingProps) {\n const a11yLabel = done\n ? 'Rest complete, next set ready'\n : `Rest timer, ${Math.max(0, remainingSec)} seconds remaining`\n return (\n <View style={{ alignItems: 'center', gap: 16 }} testID=\"rest-timer\">\n <CircularTimer\n durationMs={totalSeconds * 1000}\n elapsedMs={elapsedMs}\n mode=\"down\"\n size={size}\n doneLabel=\"GO\"\n doneColor=\"success\"\n accessibilityLabel={a11yLabel}\n controls={!displayOnly ? <RestActions onAddTime={onAddTime} onSkip={onSkip} /> : undefined}\n testID=\"rest-timer-ring\"\n />\n {nextSetInfo != null && (\n <Text\n className=\"text-text-tertiary\"\n style={{ fontSize: 13, fontFamily: 'Inter, sans-serif' }}\n testID=\"rest-timer-next-set\"\n >\n {nextSetInfo}\n </Text>\n )}\n </View>\n )\n}\n\nexport function RestTimer({\n totalSeconds,\n elapsedMs,\n onSkip,\n onAddTime,\n nextSetInfo,\n visible,\n displayOnly = false,\n variant = 'bar',\n size = RING_DEFAULT_SIZE,\n}: RestTimerProps) {\n // useTimer owns the countdown math (remaining/progress/mm:ss); a zero-duration\n // timer is complete, which keeps the width out of the 0/0 === NaN case.\n const {\n remainingMs,\n progress,\n label: timeDisplay,\n done,\n } = useTimer({\n mode: 'down',\n durationMs: totalSeconds * 1000,\n elapsedMs,\n })\n const remainingSec = Math.ceil(remainingMs / 1000)\n const progressPct = progress * 100\n\n if (!visible) return null\n\n if (variant === 'ring') {\n return (\n <RestTimerRing\n totalSeconds={totalSeconds}\n elapsedMs={elapsedMs}\n remainingSec={remainingSec}\n done={done}\n size={size}\n nextSetInfo={nextSetInfo}\n displayOnly={displayOnly}\n onSkip={onSkip}\n onAddTime={onAddTime}\n />\n )\n }\n\n return (\n <View\n className=\"bg-surface-raised\"\n style={{\n width: '100%',\n borderTopWidth: 1,\n borderTopColor: resolveColor('border-default'),\n paddingVertical: 12,\n paddingHorizontal: 16,\n }}\n accessibilityRole=\"timer\"\n accessibilityLabel={`Rest timer, ${remainingSec} seconds remaining`}\n testID=\"rest-timer\"\n >\n {/* Top row */}\n <View\n style={{\n flexDirection: 'row',\n justifyContent: 'space-between',\n alignItems: 'center',\n marginBottom: 8,\n }}\n >\n {/* Left side */}\n <View style={{ flexDirection: 'column' }}>\n <Text\n className=\"text-text-secondary\"\n style={{\n fontSize: 11,\n fontFamily: 'Inter, sans-serif',\n fontWeight: '600',\n textTransform: 'uppercase',\n letterSpacing: 1,\n }}\n testID=\"rest-timer-label\"\n >\n REST\n </Text>\n {nextSetInfo != null && (\n <Text\n className=\"text-text-tertiary\"\n style={{\n fontSize: 11,\n fontFamily: 'Inter, sans-serif',\n marginTop: 2,\n }}\n testID=\"rest-timer-next-set\"\n >\n {nextSetInfo}\n </Text>\n )}\n </View>\n\n {/* Right side - time display */}\n <Text\n className=\"text-text-primary\"\n style={{\n fontSize: 28,\n fontFamily: '\"Space Grotesk\", sans-serif',\n fontWeight: '700',\n fontVariant: ['tabular-nums'],\n letterSpacing: -0.5,\n }}\n testID=\"rest-timer-time\"\n >\n {timeDisplay}\n </Text>\n </View>\n\n {/* Progress bar */}\n <View\n className=\"bg-border\"\n style={{\n height: 3,\n borderRadius: 2,\n marginBottom: 12,\n }}\n testID=\"rest-timer-progress-track\"\n >\n <View\n style={{\n height: '100%',\n backgroundColor: BRAND_PRIMARY,\n borderRadius: 2,\n width: `${progressPct}%`,\n }}\n testID=\"rest-timer-progress-fill\"\n />\n </View>\n\n {/* Actions row — hidden in display-only (poll-only) mode */}\n {!displayOnly && <RestActions onAddTime={onAddTime} onSkip={onSkip} />}\n </View>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport React from 'react'\nimport { View, Text } from 'react-native'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\n\nexport interface SupersetWrapperProps {\n label?: string\n color?: string\n children: React.ReactNode\n}\n\nconst DEFAULTS = {\n label: 'SS',\n color: getSemanticColors('dark')['brand-primary'],\n bgBase: getSemanticColors('dark')['background-base'],\n} as const\n\nexport function SupersetWrapper({\n label = DEFAULTS.label,\n color = DEFAULTS.color,\n children,\n}: SupersetWrapperProps) {\n return (\n <View\n style={{\n position: 'relative',\n borderLeftWidth: 3,\n borderLeftColor: color,\n paddingLeft: 8,\n marginHorizontal: 12,\n marginBottom: 8,\n overflow: 'visible',\n }}\n accessibilityRole={'group' as never}\n accessibilityLabel={`Superset: ${label}`}\n testID=\"superset-wrapper\"\n >\n <Text\n style={{\n position: 'absolute',\n top: -1,\n left: -3,\n fontSize: 9,\n fontFamily: 'Inter, sans-serif',\n fontWeight: '700',\n backgroundColor: color,\n color: DEFAULTS.bgBase,\n paddingVertical: 2,\n paddingHorizontal: 6,\n borderBottomRightRadius: 4,\n letterSpacing: 0.5,\n zIndex: 2,\n }}\n testID=\"superset-label\"\n >\n {label}\n </Text>\n <View style={{ gap: 2 }} testID=\"superset-children\">\n {children}\n </View>\n </View>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { useMemo, useState } from 'react'\nimport { View, Text, type ViewProps } from 'react-native'\nimport { ExerciseCard, type ExerciseCardProps } from './ExerciseCard'\nimport { InputBar } from './InputBar'\nimport { RestTimer } from './RestTimer'\nimport { SupersetWrapper } from './SupersetWrapper'\nimport { type SetRowProps } from './SetRow'\nimport { resolveColor } from '../../../theme/resolve-color'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\n\nconst BRAND_PRIMARY = getSemanticColors('dark')['brand-primary']\n\n/** Where an exercise sits in the during-workout flow. */\nexport type ActiveExerciseStatus = 'completed' | 'active' | 'upcoming'\n\n/**\n * One exercise in the running workout. Projected onto an `ExerciseCard`, whose\n * visual state is driven by `status` and the page's zoom focus: completed and\n * active exercises collapse/expand, upcoming ones stay dimmed.\n */\nexport interface ActiveWorkoutExercise {\n /** Stable id for zoom-focus selection. */\n id: string\n /** Exercise name, e.g. \"Barbell Bench Press\". */\n name: string\n /** Position in the workout flow. */\n status: ActiveExerciseStatus\n /** Unit used for this exercise's loads. */\n unit: 'lbs' | 'kg'\n /** Total sets prescribed for this exercise. */\n totalPlannedSets: number\n /** Collapsed summary (sets × reps @ weight) for a completed exercise. */\n summary?: ExerciseCardProps['summary']\n /** Flags a personal-record exercise. */\n isPR?: boolean\n /** Prescribed tempo, revealed when expanded. */\n tempo?: ExerciseCardProps['tempo']\n /** Per-rep velocities for each logged set (drives collapsed strips + set count). */\n setVelocities?: number[][]\n /** Per-set breakdown revealed when expanded. */\n sets?: SetRowProps[]\n /** One-line prescription for an upcoming exercise. */\n prescription?: string\n /** Previous-best hint for an upcoming exercise. */\n previousBest?: string\n /** Groups consecutive exercises under a shared `SupersetWrapper`. */\n supersetId?: string\n}\n\n/** A superset grouping consecutive exercises that share its id. */\nexport interface ActiveWorkoutSuperset {\n /** Matches `ActiveWorkoutExercise.supersetId`. */\n id: string\n /** Corner badge label, e.g. \"SS1\". */\n label: string\n /** Accent color for the wrapper rail + label. */\n color?: string\n}\n\n/** Live-set inputs shown in the bottom `InputBar`. */\nexport interface ActiveWorkoutInput {\n /** Current reps field value. */\n reps: string\n /** Current weight field value. */\n weight: string\n}\n\n/** Rest-timer inputs shown in the bottom `RestTimer`. */\nexport interface ActiveWorkoutRest {\n /** Prescribed rest length, seconds. */\n totalSeconds: number\n /** Elapsed rest, milliseconds. */\n elapsedMs: number\n /** Next-set hint, e.g. \"Set 3 · 8 × 195 lbs\". */\n nextSetInfo?: string\n}\n\n/** Derived, page-level roll-up of workout progress. */\nexport interface WorkoutProgress {\n /** Number of exercises marked completed. */\n completedExercises: number\n /** Total exercises in the workout. */\n totalExercises: number\n /** Sets logged so far across all exercises. */\n completedSets: number\n /** Total sets prescribed across all exercises. */\n totalSets: number\n /** Fraction of prescribed sets logged, 0-1. */\n fraction: number\n}\n\n/** An ordered render group: a lone exercise or a superset of exercises. */\nexport type WorkoutGroup =\n | { type: 'single'; exercise: ActiveWorkoutExercise }\n | { type: 'superset'; superset: ActiveWorkoutSuperset; exercises: ActiveWorkoutExercise[] }\n\nexport interface ActiveWorkoutPageProps extends ViewProps {\n /** Workout name shown in the header. */\n title?: string\n /** Context line under the title, e.g. \"Push Day A · Week 6\". */\n subtitle?: string\n /** Exercises in flow order. */\n exercises: ActiveWorkoutExercise[]\n /** Superset groupings referenced by `exercise.supersetId`. */\n supersets?: ActiveWorkoutSuperset[]\n /** Seed reps/weight for the live `InputBar`. */\n input?: ActiveWorkoutInput\n /** Rest-timer state; when resting, the timer replaces the input bar. */\n rest?: ActiveWorkoutRest\n /** Start the page in the resting state (timer showing). */\n initialResting?: boolean\n className?: string\n}\n\n/** Count the sets logged for an exercise (pure). */\nexport function countCompletedSets(exercise: ActiveWorkoutExercise): number {\n if (exercise.setVelocities != null) return exercise.setVelocities.length\n if (exercise.status === 'completed') return exercise.totalPlannedSets\n return 0\n}\n\n/** Roll up the exercises into the header progress readout (pure, testable). */\nexport function deriveWorkoutProgress(exercises: ActiveWorkoutExercise[]): WorkoutProgress {\n let completedExercises = 0\n let completedSets = 0\n let totalSets = 0\n for (const exercise of exercises) {\n if (exercise.status === 'completed') completedExercises += 1\n completedSets += countCompletedSets(exercise)\n totalSets += exercise.totalPlannedSets\n }\n return {\n completedExercises,\n totalExercises: exercises.length,\n completedSets,\n totalSets,\n fraction: totalSets === 0 ? 0 : completedSets / totalSets,\n }\n}\n\n/** The active exercise anchors the bottom bar; find it, or null (pure). */\nexport function findActiveExercise(\n exercises: ActiveWorkoutExercise[]\n): ActiveWorkoutExercise | null {\n return exercises.find((exercise) => exercise.status === 'active') ?? null\n}\n\n/** Whether an exercise renders as the dimmed, not-yet-reached representation (pure). */\nexport function isUpcomingExercise(status: ActiveExerciseStatus): boolean {\n return status === 'upcoming'\n}\n\n/** Project an exercise onto ExerciseCard props, wiring zoom focus (pure). */\nexport function toActiveCardProps(\n exercise: ActiveWorkoutExercise,\n focused: boolean,\n onToggle: () => void,\n supersetPosition: ExerciseCardProps['supersetPosition'] = null,\n supersetColor?: string\n): ExerciseCardProps {\n const upcoming = isUpcomingExercise(exercise.status)\n return {\n name: exercise.name,\n upcoming,\n expanded: focused,\n onExpandedChange: onToggle,\n summary: exercise.summary,\n isPR: exercise.isPR,\n tempo: exercise.tempo,\n setVelocities: exercise.setVelocities,\n totalPlannedSets: exercise.totalPlannedSets,\n sets: focused ? exercise.sets : undefined,\n prescription: exercise.prescription,\n previousBest: exercise.previousBest,\n supersetPosition,\n supersetColor,\n }\n}\n\n/** Fold consecutive same-superset exercises into render groups (pure). */\nexport function groupExercises(\n exercises: ActiveWorkoutExercise[],\n supersets: ActiveWorkoutSuperset[]\n): WorkoutGroup[] {\n const byId = new Map(supersets.map((superset) => [superset.id, superset]))\n const groups: WorkoutGroup[] = []\n for (const exercise of exercises) {\n const superset = exercise.supersetId != null ? byId.get(exercise.supersetId) : undefined\n const last = groups[groups.length - 1]\n if (superset != null && last?.type === 'superset' && last.superset.id === superset.id) {\n last.exercises.push(exercise)\n } else if (superset != null) {\n groups.push({ type: 'superset', superset, exercises: [exercise] })\n } else {\n groups.push({ type: 'single', exercise })\n }\n }\n return groups\n}\n\n/** Position of an exercise within its superset, for corner-radius stitching. */\nfunction supersetPositionAt(index: number, length: number): ExerciseCardProps['supersetPosition'] {\n if (length === 1) return null\n if (index === 0) return 'first'\n if (index === length - 1) return 'last'\n return 'middle'\n}\n\nfunction WorkoutHeader({\n title,\n subtitle,\n progress,\n}: {\n title: string\n subtitle?: string\n progress: WorkoutProgress\n}) {\n return (\n <View style={{ gap: 10 }} testID=\"active-workout-page-header\">\n <View className=\"flex-row items-start justify-between\" style={{ gap: 8 }}>\n <View style={{ flexShrink: 1 }}>\n <Text\n accessibilityRole=\"header\"\n className=\"text-text-primary\"\n style={{\n fontSize: 20,\n fontFamily: '\"Space Grotesk\", sans-serif',\n fontWeight: '700',\n }}\n testID=\"active-workout-page-title\"\n >\n {title}\n </Text>\n {subtitle != null && (\n <Text\n className=\"text-text-secondary\"\n style={{\n marginTop: 2,\n fontSize: 12,\n fontFamily: 'Inter, sans-serif',\n }}\n testID=\"active-workout-page-subtitle\"\n >\n {subtitle}\n </Text>\n )}\n </View>\n <View style={{ alignItems: 'flex-end' }} testID=\"active-workout-page-progress-count\">\n <Text\n style={{\n fontSize: 15,\n fontFamily: '\"Space Grotesk\", sans-serif',\n fontWeight: '700',\n color: BRAND_PRIMARY,\n fontVariant: ['tabular-nums'],\n }}\n >\n {`${progress.completedExercises}/${progress.totalExercises}`}\n </Text>\n <Text\n className=\"text-text-tertiary\"\n style={{\n fontSize: 10,\n fontFamily: 'Inter, sans-serif',\n fontWeight: '600',\n letterSpacing: 0.4,\n textTransform: 'uppercase',\n }}\n >\n {`${progress.completedSets}/${progress.totalSets} sets`}\n </Text>\n </View>\n </View>\n <View\n className=\"bg-border\"\n style={{ height: 4, borderRadius: 2 }}\n testID=\"active-workout-page-progress-track\"\n >\n <View\n style={{\n height: '100%',\n width: `${Math.round(progress.fraction * 100)}%`,\n backgroundColor: BRAND_PRIMARY,\n borderRadius: 2,\n }}\n testID=\"active-workout-page-progress-fill\"\n />\n </View>\n </View>\n )\n}\n\ninterface ExerciseListProps {\n groups: WorkoutGroup[]\n focusedId: string | null\n onToggle: (id: string) => void\n}\n\nfunction ExerciseList({ groups, focusedId, onToggle }: ExerciseListProps) {\n return (\n <View style={{ gap: 10 }} testID=\"active-workout-page-exercises\">\n {groups.map((group) => {\n if (group.type === 'single') {\n return (\n <View\n key={group.exercise.id}\n className=\"bg-surface-elevated border-border\"\n style={{\n borderWidth: 1,\n borderRadius: 12,\n }}\n >\n <ExerciseCard\n {...toActiveCardProps(group.exercise, group.exercise.id === focusedId, () =>\n onToggle(group.exercise.id)\n )}\n />\n </View>\n )\n }\n return (\n <SupersetWrapper\n key={group.superset.id}\n label={group.superset.label}\n color={group.superset.color}\n >\n {group.exercises.map((exercise, index) => (\n <ExerciseCard\n key={exercise.id}\n {...toActiveCardProps(\n exercise,\n exercise.id === focusedId,\n () => onToggle(exercise.id),\n supersetPositionAt(index, group.exercises.length),\n group.superset.color\n )}\n />\n ))}\n </SupersetWrapper>\n )\n })}\n </View>\n )\n}\n\n/**\n * ActiveWorkoutPage — the during-workout screen, built as a zoom hierarchy over\n * `ExerciseCard`s. A header progress bar rolls up completed sets; the flow list\n * dims upcoming exercises, collapses finished ones to their velocity strips, and\n * expands exactly one focused exercise to its `SetRow` breakdown. Consecutive\n * superset exercises stitch together inside a `SupersetWrapper`. A pinned bottom\n * bar toggles between the live `InputBar` (log the next set) and the `RestTimer`.\n * Focus and rest are page-level state; children keep their own styles.\n *\n * @example\n * <ActiveWorkoutPage title=\"Push Day A\" exercises={exercises} />\n */\nexport function ActiveWorkoutPage({\n title = 'Active Workout',\n subtitle,\n exercises,\n supersets = [],\n input,\n rest,\n initialResting = false,\n className,\n ...props\n}: ActiveWorkoutPageProps) {\n const active = findActiveExercise(exercises)\n const [focusedId, setFocusedId] = useState<string | null>(active?.id ?? null)\n const [resting, setResting] = useState(initialResting)\n const [reps, setReps] = useState(input?.reps ?? '')\n const [weight, setWeight] = useState(input?.weight ?? '')\n\n const progress = useMemo(() => deriveWorkoutProgress(exercises), [exercises])\n const groups = useMemo(() => groupExercises(exercises, supersets), [exercises, supersets])\n\n const toggleFocus = (id: string) => setFocusedId((current) => (current === id ? null : id))\n\n const nextSetNumber = active != null ? countCompletedSets(active) + 1 : 1\n const canRecord = reps.trim() !== '' && weight.trim() !== ''\n const showRest = resting && rest != null\n const showInput = !showRest && active != null\n\n return (\n <View\n className={['bg-background-base', className].filter(Boolean).join(' ')}\n style={{ position: 'relative', width: 390 }}\n accessibilityRole={'main' as ViewProps['accessibilityRole']}\n aria-label={title}\n testID=\"active-workout-page\"\n {...props}\n >\n <View style={{ padding: 16, gap: 14 }} testID=\"active-workout-page-content\">\n <WorkoutHeader title={title} subtitle={subtitle} progress={progress} />\n <ExerciseList groups={groups} focusedId={focusedId} onToggle={toggleFocus} />\n </View>\n\n {(showRest || showInput) && (\n <View\n style={{ borderTopWidth: 1, borderTopColor: resolveColor('border-default') }}\n testID=\"active-workout-page-bottom-bar\"\n >\n {showRest && rest != null ? (\n <RestTimer\n totalSeconds={rest.totalSeconds}\n elapsedMs={rest.elapsedMs}\n nextSetInfo={rest.nextSetInfo}\n onSkip={() => setResting(false)}\n onAddTime={() => undefined}\n visible\n />\n ) : (\n active != null && (\n <InputBar\n exerciseName={active.name}\n setNumber={nextSetNumber}\n totalSets={active.totalPlannedSets}\n reps={reps}\n weight={weight}\n unit={active.unit}\n onRepsChange={setReps}\n onWeightChange={setWeight}\n onRecord={() => {\n if (rest != null) setResting(true)\n }}\n canRecord={canRecord}\n visible\n />\n )\n )}\n </View>\n )}\n </View>\n )\n}\n","/**\n * Elevation System\n *\n * A unified depth system where each elevation level corresponds to:\n * - Calculated surface color (derived from base using lighten)\n * - Shadow intensity and style (raised/pressed)\n * - Dynamically calculated shadow colors (derived from surface color)\n * - Semantic name for reference\n *\n * Elevation range: -2 (deep inset) to +5 (floating overlay)\n *\n * Negative elevations: Inset/pressed elements (sunken into surface)\n * Zero elevation: Base surface (background/page level)\n * Positive elevations: Raised elements (floating above surface)\n *\n * All colors are calculated dynamically from a base surface color,\n * allowing for custom surfaces and consistent color relationships.\n *\n * Lighting Model: Light source from upper-right corner\n * - Raised elements are always lighter than base (consistent across themes)\n * - Base colors must allow sufficient lightening in both themes\n */\n\nimport { Platform, type ViewStyle } from 'react-native'\nimport { lighten, darken, hexToRgb, rgbToHsv, hsvToRgb, rgbToHex } from './shadows'\nimport { semanticColorsLight, semanticColorsDark } from './tokens/semantic'\n\nexport type ElevationLevel = -2 | -1 | 0 | 1 | 2 | 3 | 4 | 5\n\nexport interface ElevationConfig {\n /** Semantic name for this elevation level */\n name: string\n /** Amount to lighten base color (0-1) */\n colorAdjustment: number\n /** Shadow intensity */\n shadowIntensity: 'subtle' | 'medium' | 'strong'\n /** Shadow style: raised (floating) or pressed (inset) */\n shadowStyle: 'raised' | 'pressed'\n /** Description of use case */\n description: string\n}\n\nexport const elevationSystem: Record<ElevationLevel, ElevationConfig> = {\n // Deep inset (recessed input fields, deeply pressed buttons)\n [-2]: {\n name: 'deep-inset',\n colorAdjustment: 0,\n shadowIntensity: 'strong',\n shadowStyle: 'pressed',\n description: 'Deeply recessed elements (e.g., input fields, deeply pressed buttons)',\n },\n\n // Shallow inset (pressed buttons, sunken panels)\n [-1]: {\n name: 'inset',\n colorAdjustment: 0,\n shadowIntensity: 'medium',\n shadowStyle: 'pressed',\n description: 'Shallow inset elements (e.g., pressed buttons, sunken panels within cards)',\n },\n\n // Base level (page background, default surface)\n [0]: {\n name: 'base',\n colorAdjustment: 0,\n shadowIntensity: 'subtle',\n shadowStyle: 'raised',\n description: 'Base surface level (page background, default containers)',\n },\n\n // Level 1: Subtle elevation (outline cards, subtle containers)\n [1]: {\n name: 'subtle',\n colorAdjustment: 0.01,\n shadowIntensity: 'subtle',\n shadowStyle: 'raised',\n description: 'Subtle elevation (outline cards, subtle containers)',\n },\n\n // Level 2: Standard elevation (default cards, buttons)\n [2]: {\n name: 'standard',\n colorAdjustment: 0.02,\n shadowIntensity: 'medium',\n shadowStyle: 'raised',\n description: 'Standard elevation (default cards, raised buttons)',\n },\n\n // Level 3: Prominent elevation (important cards, modals)\n [3]: {\n name: 'prominent',\n colorAdjustment: 0.04,\n shadowIntensity: 'strong',\n shadowStyle: 'raised',\n description: 'Prominent elevation (important cards, modals, dropdowns)',\n },\n\n // Level 4: High elevation (overlays, popovers)\n [4]: {\n name: 'high',\n colorAdjustment: 0.06,\n shadowIntensity: 'strong',\n shadowStyle: 'raised',\n description: 'High elevation (overlays, popovers, tooltips)',\n },\n\n // Level 5: Floating (toasts, floating action buttons)\n [5]: {\n name: 'floating',\n colorAdjustment: 0.08,\n shadowIntensity: 'strong',\n shadowStyle: 'raised',\n description: 'Floating elevation (toasts, floating action buttons, highest z-index)',\n },\n}\n\n/**\n * Calculate rim light color from the BASE color.\n * Creates a consistent bright highlight with opacity that scales with elevation.\n *\n * The rim light represents light hitting the edge of raised elements from a\n * consistent light source. Uses ABSOLUTE HSV value (not relative lightening)\n * for consistent intensity across all surface colors.\n *\n * For colored surfaces: preserves hue/saturation, sets value to fixed bright level\n * For gray surfaces: uses white with appropriate opacity\n *\n * @param baseColor - The base surface color (hex)\n * @param level - Elevation level (used to scale opacity)\n */\nfunction calculateRimLightColor(baseColor: string, level: ElevationLevel): string {\n const rgb = hexToRgb(baseColor)\n if (!rgb) {\n return 'rgba(255, 255, 255, 0.5)'\n }\n\n const hsv = rgbToHsv(rgb.r, rgb.g, rgb.b)\n const isLight = hsv.v > 0.6\n const isSaturated = hsv.s > 0.3 // Colored (not gray)\n\n // Opacity scales with elevation to compensate for lighter surfaces at higher levels\n // Range: +0% at level 1 to +20% at level 5\n const absLevel = Math.abs(level)\n const opacityBoost = Math.max(0, (absLevel - 1) * 0.05) // +5% per level above 1 (0% to 20%)\n\n if (isSaturated) {\n // For colored surfaces, preserve hue and saturation but set value to fixed bright level\n // This ensures consistent rim light intensity across all colored surfaces\n const rimLightValue = 0.95 // Fixed bright value for rim light\n const rimLightRgb = hsvToRgb(hsv.h, hsv.s * 0.3, rimLightValue) // Reduce saturation for brighter appearance\n\n // Base opacity + elevation boost, capped at 1.0\n const baseOpacity = isLight ? 0.9 : 0.5\n const finalOpacity = Math.min(1, baseOpacity + opacityBoost)\n return `rgba(${rimLightRgb.r}, ${rimLightRgb.g}, ${rimLightRgb.b}, ${finalOpacity.toFixed(2)})`\n } else {\n // For gray/neutral surfaces, use white with appropriate opacity\n const baseOpacity = isLight ? 0.9 : 0.12\n const finalOpacity = Math.min(1, baseOpacity + opacityBoost)\n return `rgba(255, 255, 255, ${finalOpacity.toFixed(2)})`\n }\n}\n\n/**\n * Calculate dark shadow colors from the surface color.\n * The dark shadow is cast BY the element, so it should match the surface color.\n *\n * Uses ABSOLUTE HSV value (not relative darkening) for consistent shadow intensity\n * across all surface colors - simulating a consistent light source.\n *\n * For colored surfaces: preserves hue/saturation, sets value to fixed dark level\n * For gray surfaces: uses black with appropriate opacity\n */\nfunction calculateDarkShadowColors(surfaceColor: string): {\n dark: string\n darker: string\n} {\n const rgb = hexToRgb(surfaceColor)\n if (!rgb) {\n return {\n dark: 'rgba(0, 0, 0, 0.3)',\n darker: 'rgba(0, 0, 0, 0.4)',\n }\n }\n\n const hsv = rgbToHsv(rgb.r, rgb.g, rgb.b)\n const isLight = hsv.v > 0.6\n const isSaturated = hsv.s > 0.3\n\n if (isSaturated) {\n // For colored surfaces, preserve hue and saturation but set value to fixed dark level\n // This ensures consistent shadow intensity across all colored surfaces\n const darkShadowValue = 0.15 // Fixed dark value for shadows\n const darkShadowRgb = hsvToRgb(hsv.h, hsv.s, darkShadowValue)\n\n if (isLight) {\n return {\n dark: `rgba(${darkShadowRgb.r}, ${darkShadowRgb.g}, ${darkShadowRgb.b}, 0.3)`,\n darker: `rgba(${darkShadowRgb.r}, ${darkShadowRgb.g}, ${darkShadowRgb.b}, 0.4)`,\n }\n } else {\n return {\n dark: `rgba(${darkShadowRgb.r}, ${darkShadowRgb.g}, ${darkShadowRgb.b}, 0.5)`,\n darker: `rgba(${darkShadowRgb.r}, ${darkShadowRgb.g}, ${darkShadowRgb.b}, 0.6)`,\n }\n }\n } else {\n // For gray surfaces, use standard black shadows\n if (isLight) {\n return {\n dark: 'rgba(0, 0, 0, 0.2)',\n darker: 'rgba(0, 0, 0, 0.3)',\n }\n } else {\n return {\n dark: 'rgba(0, 0, 0, 0.5)',\n darker: 'rgba(0, 0, 0, 0.6)',\n }\n }\n }\n}\n\n/**\n * Get rim light size config.\n * Fixed 1px offset and blur for a consistent, crisp rim highlight.\n * Opacity scaling (in calculateRimLightColor) handles elevation differences.\n */\nfunction getRimLightConfig(): { offset: number; blur: number } {\n return {\n offset: 1, // Fixed 1px for crisp rim\n blur: 1, // Tight blur for crisp edge\n }\n}\n\n/**\n * Get elevation configuration for a given level\n */\nexport function getElevationConfig(level: ElevationLevel): ElevationConfig {\n return elevationSystem[level]\n}\n\n// Simple cache for elevation surface colors\nconst elevationSurfaceCache = new Map<string, string>()\nconst MAX_CACHE_SIZE = 100\n\nfunction getCacheKey(baseColor: string, level: ElevationLevel, theme: 'light' | 'dark'): string {\n return `${baseColor}-${level}-${theme}`\n}\n\nfunction calculateElevationSurface(\n baseColor: string,\n level: ElevationLevel,\n theme: 'light' | 'dark'\n): string {\n const config = elevationSystem[level]\n\n if (config.colorAdjustment === 0) {\n return baseColor\n }\n\n // For raised elevations (positive), always lighten (consistent lighting model)\n // Light source is from upper-right, so raised elements are always lighter\n // For inset elevations (negative), we keep base color (shadow creates depth)\n if (level < 0) {\n return baseColor // Inset elements use base color\n }\n\n // Always lighten for raised elements (consistent across themes)\n // Base colors must be chosen to allow sufficient lightening in dark mode\n return lighten(baseColor, config.colorAdjustment)\n}\n\n/**\n * Calculate surface color for an elevation level from a base color.\n * Results are cached to avoid redundant calculations.\n *\n * @param baseColor - Base surface color (hex)\n * @param level - Elevation level\n * @param theme - Current theme ('light' or 'dark')\n * @returns Calculated surface color (hex)\n */\nexport function getElevationSurface(\n baseColor: string,\n level: ElevationLevel,\n theme: 'light' | 'dark'\n): string {\n const cacheKey = getCacheKey(baseColor, level, theme)\n\n // Check cache\n if (elevationSurfaceCache.has(cacheKey)) {\n return elevationSurfaceCache.get(cacheKey)!\n }\n\n // Calculate\n const result = calculateElevationSurface(baseColor, level, theme)\n\n // Cache result (with size limit to prevent memory leaks)\n if (elevationSurfaceCache.size >= MAX_CACHE_SIZE) {\n // Remove oldest entry (simple FIFO)\n const firstKey = elevationSurfaceCache.keys().next().value!\n elevationSurfaceCache.delete(firstKey)\n }\n elevationSurfaceCache.set(cacheKey, result)\n\n return result\n}\n\n// Cache for shadow styles (less frequently used, smaller cache)\nconst elevationShadowCache = new Map<string, ViewStyle>()\nconst MAX_SHADOW_CACHE_SIZE = 50\n\nfunction getShadowCacheKey(\n baseColor: string,\n level: ElevationLevel,\n theme: 'light' | 'dark',\n isHovered: boolean\n): string {\n return `${baseColor}-${level}-${theme}-${isHovered}`\n}\n\nfunction calculateElevationShadow(\n baseColor: string,\n level: ElevationLevel,\n theme: 'light' | 'dark',\n isHovered: boolean = false\n): ViewStyle {\n const config = elevationSystem[level]\n\n // Base level has no shadow\n if (level === 0) {\n return {}\n }\n\n // Calculate the actual elevated surface color\n const elevatedSurfaceColor = calculateElevationSurface(baseColor, level, theme)\n\n // Rim light: calculated from BASE color (consistent across all elevations)\n // This represents a consistent light source - only size changes with elevation\n const rimLightColor = calculateRimLightColor(baseColor, level)\n\n // Dark shadow: calculated from ELEVATED surface color\n // The shadow is cast by the element, so it should match the surface\n const darkShadowColors = calculateDarkShadowColors(elevatedSurfaceColor)\n\n // Get shadow intensity config (for dark shadow)\n const intensityConfig = {\n subtle: { offset: 1, blur: 2 },\n medium: { offset: 2, blur: 4 },\n strong: { offset: 2, blur: 5 },\n }\n\n const { offset, blur } = intensityConfig[config.shadowIntensity]\n\n // Get rim light config (scales with elevation level)\n const rimConfig = getRimLightConfig()\n\n if (config.shadowStyle === 'pressed') {\n // Inset shadow (pressed elements)\n if (isHovered) {\n // Reduce shadow depth for hover\n const hoverOffset = Math.max(1, Math.round(offset / 2))\n const hoverBlur = Math.max(1, Math.round(blur / 2))\n return Platform.select({\n web: {\n boxShadow: `inset ${hoverOffset}px ${hoverOffset}px ${hoverBlur}px ${darkShadowColors.darker}, inset -${rimConfig.offset}px -${rimConfig.offset}px ${rimConfig.blur}px ${rimLightColor}`,\n } as any,\n default: {\n shadowOpacity: 0,\n elevation: 0,\n },\n }) as ViewStyle\n }\n\n return Platform.select({\n web: {\n boxShadow: `inset ${offset}px ${offset}px ${blur}px ${darkShadowColors.darker}, inset -${rimConfig.offset}px -${rimConfig.offset}px ${rimConfig.blur}px ${rimLightColor}`,\n } as any,\n default: {\n shadowOpacity: 0,\n elevation: 0,\n },\n }) as ViewStyle\n } else {\n // Raised shadow (floating elements)\n if (isHovered) {\n // Reduce shadow depth for hover\n const hoverOffset = Math.max(1, Math.round(offset / 2))\n const hoverBlur = Math.max(1, Math.round(blur / 2))\n return Platform.select({\n web: {\n boxShadow: `${hoverOffset}px ${hoverOffset}px ${hoverBlur}px ${darkShadowColors.dark}, -${rimConfig.offset}px -${rimConfig.offset}px ${rimConfig.blur}px ${rimLightColor}`,\n } as any,\n default: {\n shadowColor: '#000',\n shadowOffset: { width: hoverOffset, height: hoverOffset },\n shadowOpacity: 0.2,\n shadowRadius: hoverBlur / 2,\n elevation: hoverOffset,\n },\n }) as ViewStyle\n }\n\n return Platform.select({\n web: {\n boxShadow: `${offset}px ${offset}px ${blur}px ${darkShadowColors.dark}, -${rimConfig.offset}px -${rimConfig.offset}px ${rimConfig.blur}px ${rimLightColor}`,\n } as any,\n default: {\n shadowColor: '#000',\n shadowOffset: { width: offset, height: offset },\n shadowOpacity: 0.3,\n shadowRadius: blur / 2,\n elevation: offset,\n },\n }) as ViewStyle\n }\n}\n\n/**\n * Get shadow style for an elevation level, calculated dynamically from surface color.\n * Results are cached to avoid redundant calculations.\n *\n * @param baseColor - Base surface color (hex)\n * @param level - Elevation level\n * @param theme - Current theme ('light' or 'dark')\n * @param isHovered - Whether element is hovered\n * @returns ViewStyle with shadow properties\n */\nexport function getElevationShadow(\n baseColor: string,\n level: ElevationLevel,\n theme: 'light' | 'dark',\n isHovered: boolean = false\n): ViewStyle {\n const cacheKey = getShadowCacheKey(baseColor, level, theme, isHovered)\n\n // Check cache\n if (elevationShadowCache.has(cacheKey)) {\n return elevationShadowCache.get(cacheKey)!\n }\n\n // Calculate shadow\n const result = calculateElevationShadow(baseColor, level, theme, isHovered)\n\n // Cache result\n if (elevationShadowCache.size >= MAX_SHADOW_CACHE_SIZE) {\n const firstKey = elevationShadowCache.keys().next().value!\n elevationShadowCache.delete(firstKey)\n }\n elevationShadowCache.set(cacheKey, result)\n\n return result\n}\n\n/**\n * Elevation level backing a `<Surface pressed>` recess: the shallow `inset`\n * (-1) step. Pressed exposes ONE level of depth — pressed-2 is intentionally\n * not surfaced (the deeper `-2` deep-inset stays available to `elevation`).\n */\nexport const PRESSED_ELEVATION_LEVEL: ElevationLevel = -1\n\n/**\n * Inner-shadow recess for a pressed (sunken) surface, tuned to the well's own\n * fill colour so the rim/shadow tints track the darker fill. Composes WITH the\n * darker pressed fill: on web it adds an inset boxShadow; on the native path\n * (no inset-shadow support) it's a no-op and the recess reads via the fill\n * alone — so a pressed surface stays legibly sunken with or without the shadow.\n *\n * @param fillColor - The pressed surface's own fill (one ramp step down).\n * @param theme - Current theme ('light' or 'dark').\n */\nexport function getPressedRecessShadow(fillColor: string, theme: 'light' | 'dark'): ViewStyle {\n return getElevationShadow(fillColor, PRESSED_ELEVATION_LEVEL, theme)\n}\n\n/**\n * Get base surface color from theme.\n * This is the foundation color that all elevations are calculated from.\n *\n * IMPORTANT: Base colors must be chosen to allow sufficient lightening.\n *\n * **Light Mode**: Cannot use `#FFFFFF` (white) - cannot lighten white!\n * - Use `#F3F4F6` (neutral[100]) - can lighten to `#FAFAFA` → `#FFFFFF`\n * - This allows raised elevations to be lighter (closer to white)\n *\n * **Dark Mode**: Need lighter base to allow sufficient lightening\n * - Use `surface-elevated` (#2A2827, TD-surface-tokens ramp) - allows further lightening\n *\n * Can be overridden to use custom base colors for special cases.\n */\nexport function getBaseSurfaceColor(theme: 'light' | 'dark'): string {\n // Use semantic token values so elevation colors stay in sync with the token pipeline.\n // Light mode: surface-raised (#F3F4F6 / neutral[100]) - NOT white, so we can lighten it\n // Dark mode: surface-elevated (#2A2827, TD-surface-tokens ramp) - allows sufficient lightening\n\n return theme === 'light'\n ? semanticColorsLight['surface-raised']\n : semanticColorsDark['surface-elevated']\n}\n\n/**\n * Component-specific elevation ranges\n * Defines which elevation levels each component type can use\n */\nexport const componentElevationRanges = {\n button: {\n allowed: [2] as const,\n default: 2 as const,\n hover: 3 as const,\n },\n card: {\n allowed: [1, 2, 3] as const,\n default: 2 as const,\n hover: 3 as const,\n },\n input: {\n allowed: [-2, -1, 0] as const,\n default: -1 as const,\n },\n overlay: {\n allowed: [4, 5] as const,\n default: 4 as const,\n },\n} as const\n\nexport type ComponentType = keyof typeof componentElevationRanges\n\n/**\n * Validate and clamp elevation to component's allowed range\n */\nexport function getValidatedElevation(\n component: ComponentType,\n requested: ElevationLevel\n): ElevationLevel {\n const range = componentElevationRanges[component]\n if ((range.allowed as readonly ElevationLevel[]).includes(requested)) {\n return requested\n }\n // Clamp to nearest allowed elevation\n const sorted = [...range.allowed].sort((a, b) => a - b)\n if (requested < sorted[0]) return sorted[0]\n if (requested > sorted[sorted.length - 1]) return sorted[sorted.length - 1]\n // Find closest\n return sorted.reduce((prev, curr) =>\n Math.abs(curr - requested) < Math.abs(prev - requested) ? curr : prev\n ) as ElevationLevel\n}\n\n// =============================================================================\n// Glow Shadow Support\n// =============================================================================\n\nexport type GlowIntensity = 'subtle' | 'medium' | 'strong'\n\nconst glowConfig: Record<GlowIntensity, { blur: number; spread: number; opacity: number }> = {\n subtle: { blur: 12, spread: 0, opacity: 0.25 },\n medium: { blur: 20, spread: 2, opacity: 0.4 },\n strong: { blur: 30, spread: 4, opacity: 0.55 },\n}\n\n/**\n * Get a glow shadow style for emphasis/active states.\n *\n * Creates a colored radial glow around an element, useful for:\n * - Active recording indicators (orange glow)\n * - Success states (green glow)\n * - Error/danger indicators (red glow)\n * - Focus rings and attention-drawing elements\n *\n * @param color - Glow color (hex string, e.g. '#FF7900')\n * @param intensity - Glow intensity level\n * @returns ViewStyle with platform-specific shadow properties\n */\nexport function getGlowShadow(color: string, intensity: GlowIntensity = 'medium'): ViewStyle {\n const config = glowConfig[intensity]\n const rgb = hexToRgb(color)\n if (!rgb) return {}\n\n return Platform.select({\n web: {\n boxShadow: `0 0 ${config.blur}px ${config.spread}px rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${config.opacity})`,\n } as any,\n default: {\n shadowColor: color,\n shadowOffset: { width: 0, height: 0 },\n shadowOpacity: config.opacity,\n shadowRadius: config.blur / 2,\n elevation: 0,\n },\n }) as ViewStyle\n}\n","import { useSyncExternalStore } from 'react'\n\n/**\n * Utility function to detect the current theme.\n * Checks for the 'light' class on the html element (set by Storybook's theme addon).\n * \n * NOTE: This function reads the theme at call time. For reactive theme detection\n * that re-renders when the theme changes, use the `useTheme` hook instead.\n * \n * @returns 'light' if light theme is active, 'dark' otherwise\n */\nexport function getTheme(): 'light' | 'dark' {\n if (typeof document === 'undefined') return 'dark'\n return document.documentElement.classList.contains('light') ? 'light' : 'dark'\n}\n\n// Subscribers for theme changes\nlet listeners: Array<() => void> = []\n\nfunction subscribe(listener: () => void) {\n listeners = [...listeners, listener]\n \n // Set up MutationObserver to watch for class changes on html element\n if (typeof document !== 'undefined' && listeners.length === 1) {\n const observer = new MutationObserver((mutations) => {\n for (const mutation of mutations) {\n if (mutation.type === 'attributes' && mutation.attributeName === 'class') {\n // Notify all listeners when class changes\n listeners.forEach(l => l())\n }\n }\n })\n \n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: ['class'],\n })\n \n // Store observer for cleanup\n ;(subscribe as any)._observer = observer\n }\n \n return () => {\n listeners = listeners.filter(l => l !== listener)\n \n // Clean up observer when no more listeners\n if (listeners.length === 0 && (subscribe as any)._observer) {\n ;(subscribe as any)._observer.disconnect()\n ;(subscribe as any)._observer = null\n }\n }\n}\n\nfunction getSnapshot(): 'light' | 'dark' {\n return getTheme()\n}\n\nfunction getServerSnapshot(): 'light' | 'dark' {\n return 'dark'\n}\n\n/**\n * React hook for reactive theme detection.\n * Automatically re-renders when the theme changes (via class changes on html element).\n * \n * Uses useSyncExternalStore for proper React 18 concurrent mode support.\n * \n * @returns 'light' if light theme is active, 'dark' otherwise\n */\nexport function useTheme(): 'light' | 'dark' {\n return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot)\n}\n","import React, { useMemo, useState } from 'react'\nimport { View, Text, Pressable, type ViewProps } from 'react-native'\nimport { cn } from '../../../utils/cn'\nimport { \n getElevationSurface, \n getElevationShadow, \n getBaseSurfaceColor,\n getValidatedElevation,\n type ElevationLevel \n} from '../../../theme'\nimport { useTheme } from '../../../utils/useTheme'\n\nexport type CardVariant = 'elevated' | 'outline' | 'filled' | 'accent' | 'subtle'\nexport type CardElevation = 1 | 2 | 3 // subtle, standard, prominent\n\nexport interface CardProps extends ViewProps {\n /** Visual variant */\n variant?: CardVariant\n /** Elevation level (1=subtle, 2=standard, 3=prominent) */\n elevation?: CardElevation\n /** Whether the card is interactive (hoverable/pressable) */\n isInteractive?: boolean\n /** Whether the card is in a loading state (renders skeleton) */\n isLoading?: boolean\n /** Callback when card is pressed (makes card interactive) */\n onPress?: () => void\n /** Custom border color (hex, rgb, or CSS color). Useful for status cards. */\n borderColor?: string\n /** Custom background color (hex, rgb, or CSS color). Useful for colored cards. */\n bgColor?: string\n /** Accent stripe color for accent variant (CSS color or hex) */\n accentColor?: string\n /** Accent stripe width for accent variant in pixels (default: 3) */\n accentWidth?: number\n /** Additional className */\n className?: string\n children?: React.ReactNode\n /** Show header skeleton when loading (default: true) */\n skeletonHasHeader?: boolean\n /** Show footer skeleton when loading (default: false) */\n skeletonHasFooter?: boolean\n /** Number of content lines in skeleton when loading (default: 3) */\n skeletonContentLines?: number\n}\n\nconst variantStyles: Record<CardVariant, string> = {\n elevated: '', // Will be set dynamically via elevation system\n outline: 'border-2 border-border-strong', // Thicker border with stronger contrast\n filled: '', // Will be set dynamically via elevation system\n accent: 'border border-border',\n subtle: 'border border-border-subtle',\n}\n\n/**\n * Card component for containing related content.\n *\n * @example\n * <Card>\n * <CardHeader>\n * <CardTitle>Card Title</CardTitle>\n * <CardDescription>Card description</CardDescription>\n * </CardHeader>\n * <CardContent>\n * <Text>Card content goes here</Text>\n * </CardContent>\n * <CardFooter>\n * <Button>Action</Button>\n * </CardFooter>\n * </Card>\n *\n * // Interactive card\n * <Card isInteractive onPress={() => console.log('pressed')}>\n * <CardContent>Click me</CardContent>\n * </Card>\n */\nexport function Card({\n variant = 'elevated',\n elevation = 2,\n isInteractive = false,\n isLoading = false,\n onPress,\n borderColor,\n bgColor,\n accentColor,\n accentWidth,\n className,\n children,\n style,\n skeletonHasHeader = true,\n skeletonHasFooter = false,\n skeletonContentLines = 3,\n ...props\n}: CardProps) {\n const isClickable = isInteractive || !!onPress\n const [isHovered, setIsHovered] = useState(false)\n const theme = useTheme()\n\n // Get elevation level (validate and clamp to card's allowed range)\n const elevationLevel = useMemo(() => {\n const validated = getValidatedElevation('card', elevation as ElevationLevel)\n // Map variant to elevation if needed\n if (variant === 'outline' || variant === 'accent' || variant === 'subtle') {\n return 1 as ElevationLevel // These border variants use subtle elevation\n }\n return validated\n }, [variant, elevation])\n\n // Get base surface color for theme\n const baseColor = useMemo(() => getBaseSurfaceColor(theme), [theme])\n\n // Calculate surface color and shadow from elevation\n const surfaceColor = useMemo(() => {\n // Outline variant in light mode uses a specific off-white for clear visibility\n if ((variant === 'outline' || variant === 'accent') && theme === 'light') {\n return '#FAFAFA' // Matches --color-surface-elevated in light mode\n }\n // Subtle variant uses the base surface color without elevation lift\n if (variant === 'subtle') {\n return getElevationSurface(baseColor, 0 as ElevationLevel, theme)\n }\n return getElevationSurface(baseColor, elevationLevel, theme)\n }, [baseColor, elevationLevel, theme, variant])\n\n const shadowStyle = useMemo(() => {\n // Only apply hover shadow if card is actually clickable\n const shouldHover = isHovered && isClickable\n return getElevationShadow(baseColor, elevationLevel, theme, shouldHover)\n }, [baseColor, elevationLevel, theme, isHovered, isClickable])\n\n // Render skeleton content when loading, otherwise render children\n const cardContent = isLoading ? (\n <>\n {skeletonHasHeader && (\n <CardHeader>\n <View className=\"h-5 w-1/3 bg-interactive-disabled rounded\" />\n <View className=\"mt-2 h-4 w-2/3 bg-interactive-disabled rounded\" />\n </CardHeader>\n )}\n <CardContent>\n {Array.from({ length: skeletonContentLines }).map((_, i) => (\n <View\n key={i}\n className={cn(\n 'h-4 bg-interactive-disabled rounded',\n i < skeletonContentLines - 1 ? 'mb-2 w-full' : 'w-4/5'\n )}\n />\n ))}\n </CardContent>\n {skeletonHasFooter && (\n <CardFooter>\n <View className=\"h-9 w-24 bg-interactive-disabled rounded\" />\n </CardFooter>\n )}\n </>\n ) : (\n children\n )\n\n const baseClassName = cn(\n 'rounded-lg overflow-hidden relative',\n // Apply variant styles, but only use default border color if no custom borderColor\n variant === 'outline'\n ? borderColor\n ? 'border-2' // Just the border width, color via style\n : variantStyles[variant] // Full variant styles including color\n : variantStyles[variant],\n // Remove Tailwind shadow classes - we're using elevation shadows via style prop\n isClickable && 'web:cursor-pointer web:transition-all web:duration-150',\n isClickable && 'web:hover:-translate-y-0.5 active:scale-[0.99]',\n isLoading && 'pointer-events-none animate-pulse',\n className\n )\n\n // Accent variant: left stripe via borderLeft override\n const accentStyle = useMemo(() => variant === 'accent' ? {\n borderLeftWidth: accentWidth ?? 3,\n borderLeftColor: accentColor ?? 'var(--color-brand-primary)',\n } : {}, [variant, accentWidth, accentColor])\n\n // Merge styles: background color from elevation + shadow style + custom colors + custom style\n const mergedStyle = useMemo(() => {\n const elevationStyle: Record<string, any> = {\n backgroundColor: bgColor || surfaceColor,\n borderRadius: 8,\n overflow: 'hidden' as const,\n ...shadowStyle,\n ...accentStyle,\n }\n\n // Add custom border color if provided\n if (borderColor) {\n elevationStyle.borderColor = borderColor\n }\n\n if (!style) return elevationStyle\n // User style takes precedence over elevation defaults (e.g. maxWidth, custom bg)\n return [elevationStyle, style]\n }, [style, surfaceColor, shadowStyle, borderColor, bgColor, accentStyle])\n\n if (isClickable) {\n return (\n <Pressable\n onPress={onPress}\n onHoverIn={() => setIsHovered(true)}\n onHoverOut={() => setIsHovered(false)}\n accessibilityRole=\"button\"\n className={baseClassName}\n style={mergedStyle}\n {...props}\n >\n {cardContent}\n </Pressable>\n )\n }\n\n return (\n <View className={baseClassName} style={mergedStyle} {...props}>\n {cardContent}\n </View>\n )\n}\n\nexport interface CardHeaderProps {\n children?: React.ReactNode\n className?: string\n}\n\n/**\n * Header section of a Card.\n */\nexport function CardHeader({ children, className }: CardHeaderProps) {\n return (\n <View className={cn('px-6 py-6', className)}>\n {children}\n </View>\n )\n}\n\nexport interface CardTitleProps {\n children?: React.ReactNode\n className?: string\n}\n\n/**\n * Title for CardHeader.\n */\nexport function CardTitle({ children, className }: CardTitleProps) {\n return (\n <Text\n accessibilityRole=\"header\"\n className={cn('text-lg font-semibold text-text-primary font-heading', className)}\n >\n {children}\n </Text>\n )\n}\n\nexport interface CardDescriptionProps {\n children?: React.ReactNode\n className?: string\n}\n\n/**\n * Description for CardHeader.\n */\nexport function CardDescription({ children, className }: CardDescriptionProps) {\n return (\n <Text className={cn('mt-1.5 text-sm text-text-secondary', className)}>\n {children}\n </Text>\n )\n}\n\nexport interface CardContentProps {\n children?: React.ReactNode\n className?: string\n}\n\n/**\n * Content section of a Card.\n */\nexport function CardContent({ children, className }: CardContentProps) {\n return (\n <View className={cn('px-6 py-4', className)}>\n {children}\n </View>\n )\n}\n\nexport interface CardFooterProps {\n children?: React.ReactNode\n className?: string\n}\n\n/**\n * Footer section of a Card.\n */\nexport function CardFooter({ children, className }: CardFooterProps) {\n return (\n <View className={cn('px-6 py-4 flex-row items-center gap-2', className)}>\n {children}\n </View>\n )\n}\n\nexport interface CardSkeletonProps {\n /** Whether to show header skeleton */\n hasHeader?: boolean\n /** Whether to show footer skeleton */\n hasFooter?: boolean\n /** Number of content lines */\n contentLines?: number\n /** Additional className */\n className?: string\n}\n\n/**\n * Skeleton placeholder for Card loading state.\n */\nexport function CardSkeleton({\n hasHeader = true,\n hasFooter = false,\n contentLines = 3,\n className,\n}: CardSkeletonProps) {\n return (\n <Card variant=\"elevated\" elevation={2} className={cn('animate-pulse', className)}>\n {hasHeader && (\n <CardHeader>\n <View className=\"h-5 w-1/3 bg-interactive-disabled rounded\" />\n <View className=\"mt-2 h-4 w-2/3 bg-interactive-disabled rounded\" />\n </CardHeader>\n )}\n <CardContent>\n {Array.from({ length: contentLines }).map((_, i) => (\n <View\n key={i}\n className={cn(\n 'h-4 bg-interactive-disabled rounded',\n i < contentLines - 1 ? 'mb-2 w-full' : 'w-4/5'\n )}\n />\n ))}\n </CardContent>\n {hasFooter && (\n <CardFooter>\n <View className=\"h-9 w-24 bg-interactive-disabled rounded\" />\n </CardFooter>\n )}\n </Card>\n )\n}\n\nexport interface CardInsetProps extends ViewProps {\n /** Elevation level for inset (-2=deep, -1=shallow) */\n elevation?: -2 | -1\n /** Additional className */\n className?: string\n children?: React.ReactNode\n}\n\n/**\n * Inset element within a Card. Applies pressed neumorphic shadow\n * to create a sunken/recessed appearance.\n * \n * @example\n * <Card elevation={2}>\n * <CardContent>\n * <CardInset elevation={-1}>\n * <Text>This content appears inset/sunken</Text>\n * </CardInset>\n * </CardContent>\n * </Card>\n */\nexport function CardInset({\n elevation = -1,\n className,\n children,\n style,\n ...props\n}: CardInsetProps) {\n const theme = useTheme()\n const baseColor = useMemo(() => getBaseSurfaceColor(theme), [theme])\n const surfaceColor = useMemo(() => {\n return getElevationSurface(baseColor, elevation as ElevationLevel, theme)\n }, [baseColor, elevation, theme])\n const shadowStyle = useMemo(() => {\n return getElevationShadow(baseColor, elevation as ElevationLevel, theme)\n }, [baseColor, elevation, theme])\n \n return (\n <View\n className={cn('rounded', className)}\n style={[{ backgroundColor: surfaceColor }, shadowStyle, style]}\n {...props}\n >\n {children}\n </View>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { View, Text, type ViewProps } from 'react-native'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\n\nconst t = getSemanticColors('dark')\n\nexport type StatusDotVariant =\n | 'success'\n | 'warning'\n | 'error'\n | 'neutral'\n | 'on-track'\n | 'deviation'\n | 'future'\n\nexport interface StatusDotProps extends ViewProps {\n variant: StatusDotVariant\n /** Center glyph. Only rendered at size=\"md\"; the 8px \"sm\" dot is too small to fit one. */\n icon?: 'check' | 'exclamation' | 'dash'\n size?: 'sm' | 'md'\n /** Adds a subtle glow effect in the variant color */\n glow?: boolean\n label?: string\n className?: string\n}\n\nconst solidVariantColors: Record<string, string> = {\n success: t['status-success'],\n warning: t['status-warning'],\n error: t['status-error'],\n neutral: '#6B7280',\n}\n\nconst ringVariantStyles: Record<string, Record<string, unknown>> = {\n 'on-track': {\n backgroundColor: 'rgba(46,213,115,0.15)',\n borderWidth: 1,\n borderColor: 'rgba(46,213,115,0.3)',\n },\n deviation: {\n backgroundColor: 'rgba(245,158,11,0.15)',\n borderWidth: 1,\n borderColor: 'rgba(245,158,11,0.25)',\n },\n future: {\n backgroundColor: 'rgba(107,114,128,0.1)',\n borderWidth: 1,\n borderStyle: 'dashed',\n borderColor: 'rgba(107,114,128,0.2)',\n },\n}\n\nconst glowStyles: Record<StatusDotVariant, Record<string, unknown>> = {\n success: { boxShadow: '0 0 4px rgba(46,213,115,0.4)' },\n warning: { boxShadow: '0 0 4px rgba(245,158,11,0.4)' },\n error: { boxShadow: '0 0 4px rgba(239,68,68,0.4)' },\n neutral: { boxShadow: '0 0 4px rgba(107,114,128,0.4)' },\n 'on-track': { boxShadow: '0 0 4px rgba(46,213,115,0.4)' },\n deviation: { boxShadow: '0 0 4px rgba(245,158,11,0.4)' },\n future: { boxShadow: '0 0 4px rgba(107,114,128,0.4)' },\n}\n\nconst iconChars: Record<string, string> = {\n check: '\\u2713',\n exclamation: '!',\n dash: '\\u2014',\n}\n\n/** Color-matched icon colors: dark on solid bg, light on transparent bg */\nconst iconColors: Record<StatusDotVariant, string> = {\n success: '#0A5C52',\n warning: '#6B4000',\n error: '#5C1A1A',\n neutral: '#D1D5DB',\n 'on-track': t['status-success'],\n deviation: t['status-warning'],\n future: '#6B7280',\n}\n\nconst sizeDimensions = {\n sm: { size: 8, showIcon: false },\n md: { size: 18, showIcon: true },\n}\n\nfunction isSolidVariant(variant: StatusDotVariant): boolean {\n return variant in solidVariantColors\n}\n\nexport function StatusDot({\n variant,\n icon,\n size = 'sm',\n glow,\n label,\n className,\n ...props\n}: StatusDotProps) {\n const config = sizeDimensions[size]\n const solid = isSolidVariant(variant)\n const ring = ringVariantStyles[variant]\n\n const glowStyle = glow ? glowStyles[variant] : null\n\n const dot = (\n <View\n style={[\n {\n width: config.size,\n height: config.size,\n borderRadius: 9999,\n alignItems: 'center',\n justifyContent: 'center',\n flexShrink: 0,\n },\n solid ? { backgroundColor: solidVariantColors[variant] } : undefined,\n ring ? (ring as Record<string, unknown>) : undefined,\n glowStyle ? (glowStyle as Record<string, unknown>) : undefined,\n ]}\n accessibilityRole=\"image\"\n accessibilityLabel={`${variant} status`}\n testID=\"status-dot\"\n >\n {config.showIcon && icon && (\n <Text\n style={{\n fontSize: 11,\n lineHeight: 11,\n fontWeight: '900',\n color: iconColors[variant],\n }}\n accessibilityElementsHidden\n >\n {iconChars[icon]}\n </Text>\n )}\n </View>\n )\n\n if (label) {\n return (\n <View\n className={className}\n style={{ flexDirection: 'row', alignItems: 'center', gap: 6 }}\n accessibilityLabel={`${variant} status: ${label}`}\n {...props}\n >\n <View accessibilityElementsHidden>{dot}</View>\n <Text\n style={{ fontSize: 12, lineHeight: 16, color: '#9CA3AF' }}\n accessibilityElementsHidden\n >\n {label}\n </Text>\n </View>\n )\n }\n\n return (\n <View className={className} {...props}>\n {dot}\n </View>\n )\n}\n","/**\n * Data-viz / status / brand fills, sourced from the color foundations.\n */\n\nimport { categoricalPalette, primitiveRamps as ramp } from './tokens/primitives'\n\n/**\n * Titan categorical fallback palette shared by Treemap and Scatter — the\n * canonical {@link categoricalPalette} (ordered, nested-stable, CVD-safe).\n * Components index into it modulo length, so the 7-color series is sufficient.\n */\nexport const DATAVIZ_CATEGORICAL_PALETTE = categoricalPalette.default\n\n/**\n * MesoCard / MesoStatusCard 3px top-accent gradient stops (dark → primary →\n * light), on the orange ramp that brand-primary (orange-400) lives in.\n */\nexport const MESO_ACCENT_GRADIENT_DARK = ramp.orange[500]\nexport const MESO_ACCENT_GRADIENT_LIGHT = ramp.orange[300]\n\nexport const WORKOUT_PILL_DELOAD = ramp.magenta[600]\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { Fragment, type ReactNode } from 'react'\nimport { View, Text, type ViewProps, type ViewStyle } from 'react-native'\nimport { Card } from '../../ui/card'\nimport { StatusDot } from './StatusDot'\nimport { resolveColor } from '../../../theme/resolve-color'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\nimport {\n MESO_ACCENT_GRADIENT_DARK,\n MESO_ACCENT_GRADIENT_LIGHT,\n} from '../../../theme/extracted-colors-dataviz'\n\nconst t = getSemanticColors('dark')\n\nconst BRAND_PRIMARY = t['brand-primary']\nconst BRAND_PRIMARY_DARK = MESO_ACCENT_GRADIENT_DARK\nconst BRAND_PRIMARY_LIGHT = MESO_ACCENT_GRADIENT_LIGHT\n\nconst SUCCESS = t['status-success']\nconst WARNING = t['status-warning']\nconst ERROR = t['status-error']\n\n/** Gradient stops for the 3px top accent: dark -> primary -> light (matches MesoCard). */\nconst ACCENT_STOPS = [BRAND_PRIMARY_DARK, BRAND_PRIMARY, BRAND_PRIMARY_LIGHT]\n\n/**\n * Card surface gradient: elevated -> raised at 135deg. Uses resolved dark-theme\n * hexes (a gradient string can't carry a className token, and var() renders\n * black on native).\n */\nconst CARD_GRADIENT = `linear-gradient(135deg, ${resolveColor('surface-elevated')} 0%, ${resolveColor('surface-raised')} 100%)`\n\n/** Gauge track gradient (teal -> amber -> red) at 0.25 alpha. */\nconst GAUGE_GRADIENT =\n 'linear-gradient(90deg, rgba(46,213,115,0.25) 0%, rgba(249,180,21,0.25) 50%, rgba(209,67,67,0.25) 100%)'\n\nexport type MesoStatusBadgeVariant = 'success' | 'warning' | 'error'\n\nconst STATUS_VARIANTS: Record<\n MesoStatusBadgeVariant,\n { bg: string; border: string; text: string }\n> = {\n success: { bg: 'rgba(46,213,115,0.15)', border: 'rgba(46,213,115,0.3)', text: SUCCESS },\n warning: { bg: 'rgba(249,180,21,0.15)', border: 'rgba(249,180,21,0.3)', text: WARNING },\n error: { bg: 'rgba(209,67,67,0.15)', border: 'rgba(209,67,67,0.25)', text: ERROR },\n}\n\nexport interface MesoStatusBadge {\n /** Short status label, e.g. \"On Track\". */\n label: string\n /** Color treatment for the badge. */\n variant: MesoStatusBadgeVariant\n}\n\nexport interface MesoStatusMetric {\n /** Cell label, e.g. \"Prescribed\". */\n label: string\n /** Cell value, e.g. \"3×8 @ RPE 8\". */\n value: string\n}\n\nexport interface MesoStatusGauge {\n /** Gauge label, e.g. \"Intensity\". */\n label: string\n /** Fill position 0-1; the 14px marker sits at this level. */\n level: number\n /** Optional right-aligned sublabel, e.g. \"Prescribed\". */\n sublabel?: string\n}\n\nexport interface MesoStatusCoaching {\n /** Coaching recommendation copy. */\n text: string\n /** Substrings within `text` to render in bold. */\n highlights?: string[]\n}\n\nexport interface MesoStatusNextTarget {\n /** Leading glyph/emoji, e.g. \"→\" or \"🎯\". */\n icon: string\n /** Next-session target copy. */\n text: string\n}\n\nexport interface MesoStatusCardProps extends ViewProps {\n /** Mesocycle name, e.g. \"Hypertrophy Block\". */\n mesoName: string\n /** Context line, e.g. \"Week 6 of 8 · Upper/Lower\". */\n mesoSubtitle: string\n /** Status pill in the header. */\n statusBadge: MesoStatusBadge\n /** Prescription-vs-actual metrics rendered as a 2x2 grid. */\n metrics: MesoStatusMetric[]\n /** Intensity / volume gauges stacked vertically. */\n gauges: MesoStatusGauge[]\n /** Optional coaching recommendation box. */\n coaching?: MesoStatusCoaching\n /** Optional next-session target box. */\n nextTarget?: MesoStatusNextTarget\n className?: string\n}\n\nfunction clamp01(value: number): number {\n if (!Number.isFinite(value)) return 0\n if (value < 0) return 0\n if (value > 1) return 1\n return value\n}\n\n/** Marker fill color by gauge zone: teal 0-0.4, amber 0.4-0.7, red 0.7-1.0. */\nfunction getGaugeZoneColor(level: number): string {\n if (level >= 0.7) return ERROR\n if (level >= 0.4) return WARNING\n return SUCCESS\n}\n\n/** Splits `text` into nodes, bolding any segment that exactly matches a highlight. */\nfunction renderCoachingText(text: string, highlights?: string[]): ReactNode {\n if (!highlights || highlights.length === 0) return text\n const escaped = highlights\n .filter(Boolean)\n .map((h) => h.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'))\n if (escaped.length === 0) return text\n const regex = new RegExp(`(${escaped.join('|')})`, 'g')\n return text.split(regex).map((part, index) =>\n highlights.includes(part) ? (\n <Text\n key={`${part}-${index}`}\n className=\"text-text-primary\"\n style={{ fontWeight: '700' }}\n >\n {part}\n </Text>\n ) : (\n <Fragment key={`t-${index}`}>{part}</Fragment>\n ),\n )\n}\n\nfunction StatusPill({ badge }: { badge: MesoStatusBadge }) {\n const colors = STATUS_VARIANTS[badge.variant]\n return (\n <View\n className=\"flex-row items-center\"\n style={{\n gap: 5,\n paddingVertical: 3,\n paddingHorizontal: 8,\n borderRadius: 4,\n borderWidth: 1,\n backgroundColor: colors.bg,\n borderColor: colors.border,\n }}\n testID=\"meso-status-card-badge\"\n >\n <View accessibilityElementsHidden>\n <StatusDot variant={badge.variant} size=\"sm\" />\n </View>\n <Text\n style={{\n fontSize: 10,\n fontFamily: 'Inter, sans-serif',\n fontWeight: '700',\n letterSpacing: 0.3,\n color: colors.text,\n }}\n >\n {badge.label}\n </Text>\n </View>\n )\n}\n\nfunction MetricCell({ metric }: { metric: MesoStatusMetric }) {\n return (\n <View style={{ width: '48%' }} testID=\"meso-status-card-metric\">\n <Text\n className=\"text-text-tertiary\"\n style={{\n fontSize: 10,\n fontFamily: 'Inter, sans-serif',\n fontWeight: '600',\n letterSpacing: 0.5,\n textTransform: 'uppercase',\n }}\n >\n {metric.label}\n </Text>\n <Text\n className=\"text-text-primary\"\n style={{\n marginTop: 2,\n fontSize: 13,\n fontFamily: 'Inter, sans-serif',\n fontWeight: '600',\n }}\n >\n {metric.value}\n </Text>\n </View>\n )\n}\n\nfunction Gauge({ gauge }: { gauge: MesoStatusGauge }) {\n const level = clamp01(gauge.level)\n const percentage = Math.round(level * 100)\n const markerColor = getGaugeZoneColor(level)\n return (\n <View\n style={{ gap: 6 }}\n accessibilityRole=\"progressbar\"\n accessibilityValue={{ min: 0, max: 100, now: percentage }}\n accessibilityLabel={`${gauge.label}: ${percentage}%`}\n aria-valuenow={percentage}\n aria-valuemin={0}\n aria-valuemax={100}\n testID=\"meso-status-card-gauge\"\n >\n <View\n className=\"flex-row items-center justify-between\"\n accessibilityElementsHidden\n >\n <Text\n className=\"text-text-secondary\"\n style={{\n fontSize: 10,\n fontFamily: 'Inter, sans-serif',\n fontWeight: '500',\n letterSpacing: 0.5,\n textTransform: 'uppercase',\n }}\n >\n {gauge.label}\n </Text>\n {gauge.sublabel != null && (\n <Text\n className=\"text-text-tertiary\"\n style={{\n fontSize: 10,\n fontFamily: 'Inter, sans-serif',\n fontWeight: '500',\n }}\n >\n {gauge.sublabel}\n </Text>\n )}\n </View>\n\n <View\n style={\n {\n height: 8,\n borderRadius: 4,\n position: 'relative',\n backgroundImage: GAUGE_GRADIENT,\n } as ViewStyle\n }\n accessibilityElementsHidden\n >\n <View\n style={{\n position: 'absolute',\n left: '50%',\n top: 0,\n bottom: 0,\n width: 1,\n marginLeft: -0.5,\n backgroundColor: 'rgba(255,255,255,0.3)',\n }}\n testID=\"meso-status-card-gauge-center\"\n />\n <View\n className=\"border-text-primary\"\n style={{\n position: 'absolute',\n left: `${percentage}%`,\n top: -3,\n marginLeft: -7,\n width: 14,\n height: 14,\n borderRadius: 9999,\n borderWidth: 2,\n backgroundColor: markerColor,\n boxShadow: '0 0 4px rgba(0,0,0,0.5)',\n }}\n testID=\"meso-status-card-gauge-marker\"\n />\n </View>\n </View>\n )\n}\n\n/**\n * Mesocycle context card for a specific exercise: prescription vs actual\n * metrics, intensity/volume gauges, and coaching guidance. Composes the titan\n * `Card` plus the Workout `StatusDot`, and renders the §25 gauge (8px track,\n * 50% center line, 14px marker) inline since that visual differs from the\n * IntensityBar/DeviationBar primitives.\n *\n * @example\n * <MesoStatusCard\n * mesoName=\"Hypertrophy Block\"\n * mesoSubtitle=\"Week 6 of 8 · Upper/Lower\"\n * statusBadge={{ label: 'On Track', variant: 'success' }}\n * metrics={[\n * { label: 'Prescribed', value: '3×8 @ RPE 8' },\n * { label: 'Actual', value: '3×8 @ 185 lbs' },\n * ]}\n * gauges={[{ label: 'Intensity', level: 0.7, sublabel: 'Actual' }]}\n * coaching={{ text: 'Add load next session.', highlights: ['Add load'] }}\n * nextTarget={{ icon: '→', text: '190 lbs × 8' }}\n * />\n */\nexport function MesoStatusCard({\n mesoName,\n mesoSubtitle,\n statusBadge,\n metrics,\n gauges,\n coaching,\n nextTarget,\n className,\n ...props\n}: MesoStatusCardProps) {\n return (\n <Card\n variant=\"outline\"\n elevation={1}\n borderColor={BRAND_PRIMARY_DARK}\n className={className}\n style={\n {\n borderColor: BRAND_PRIMARY_DARK,\n borderWidth: 1,\n backgroundImage: CARD_GRADIENT,\n } as ViewStyle\n }\n role=\"article\"\n aria-label={`Mesocycle status for ${mesoName}`}\n testID=\"meso-status-card\"\n {...props}\n >\n <View\n className=\"flex-row\"\n style={{ position: 'absolute', top: 0, left: 0, right: 0, height: 3, zIndex: 1 }}\n accessibilityElementsHidden\n testID=\"meso-status-card-accent\"\n >\n {ACCENT_STOPS.map((color) => (\n <View key={color} style={{ flex: 1, backgroundColor: color }} />\n ))}\n </View>\n\n <View style={{ padding: 14, gap: 14 }} testID=\"meso-status-card-body\">\n <View testID=\"meso-status-card-header\">\n <View\n className=\"flex-row items-center justify-between\"\n style={{ gap: 8 }}\n >\n <Text\n className=\"text-text-primary\"\n style={{\n flexShrink: 1,\n fontSize: 15,\n fontFamily: '\"Space Grotesk\", sans-serif',\n fontWeight: '700',\n }}\n testID=\"meso-status-card-name\"\n >\n {mesoName}\n </Text>\n <StatusPill badge={statusBadge} />\n </View>\n <Text\n className=\"text-text-secondary\"\n style={{\n marginTop: 4,\n fontSize: 12,\n fontFamily: 'Inter, sans-serif',\n }}\n testID=\"meso-status-card-subtitle\"\n >\n {mesoSubtitle}\n </Text>\n </View>\n\n {metrics.length > 0 && (\n <View\n className=\"flex-row flex-wrap\"\n style={{ gap: 8 }}\n testID=\"meso-status-card-metrics\"\n >\n {metrics.map((metric, index) => (\n <MetricCell key={`${metric.label}-${index}`} metric={metric} />\n ))}\n </View>\n )}\n\n {gauges.length > 0 && (\n <View style={{ gap: 12 }} testID=\"meso-status-card-gauges\">\n {gauges.map((gauge, index) => (\n <Gauge key={`${gauge.label}-${index}`} gauge={gauge} />\n ))}\n </View>\n )}\n\n {coaching != null && (\n <View\n style={{\n backgroundColor: 'rgba(249,180,21,0.06)',\n borderWidth: 1,\n borderColor: 'rgba(249,180,21,0.15)',\n borderRadius: 8,\n paddingVertical: 10,\n paddingHorizontal: 12,\n }}\n testID=\"meso-status-card-coaching\"\n >\n <Text\n className=\"text-text-secondary\"\n style={{\n fontSize: 12,\n lineHeight: 17,\n fontFamily: 'Inter, sans-serif',\n }}\n >\n {renderCoachingText(coaching.text, coaching.highlights)}\n </Text>\n </View>\n )}\n\n {nextTarget != null && (\n <View\n className=\"flex-row items-center\"\n style={{\n gap: 8,\n backgroundColor: 'rgba(46,213,115,0.06)',\n borderWidth: 1,\n borderColor: 'rgba(46,213,115,0.2)',\n borderRadius: 8,\n paddingVertical: 10,\n paddingHorizontal: 12,\n }}\n testID=\"meso-status-card-next-target\"\n >\n <Text style={{ fontSize: 14, color: SUCCESS }} accessibilityElementsHidden>\n {nextTarget.icon}\n </Text>\n <Text\n style={{\n flexShrink: 1,\n fontSize: 12,\n fontFamily: 'Inter, sans-serif',\n fontWeight: '600',\n color: SUCCESS,\n }}\n >\n {nextTarget.text}\n </Text>\n </View>\n )}\n </View>\n </Card>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { useEffect, useMemo, useState } from 'react'\nimport { View, Text, Pressable, Animated, Easing, type ViewProps } from 'react-native'\nimport { cn } from '../../../utils/cn'\nimport { resolveColor } from '../../../theme/resolve-color'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\n\nconst sem = getSemanticColors('dark')\n\nconst BRAND_PRIMARY = sem['brand-primary']\n// Line/border color for the dashed projection, used where a className cannot\n// apply (passed as a prop into an inline style, and a per-edge borderTopColor).\nconst PROJECTION_LINE_COLOR = resolveColor('text-tertiary')\nconst STATUS_SUCCESS = sem['status-success']\nconst STATUS_ERROR = sem['status-error']\nconst STATUS_WARNING = sem['status-warning']\nconst GRID_LINE = 'rgba(255,255,255,0.06)'\nconst SUCCESS_PILL_BG = 'rgba(46,213,115,0.10)'\nconst SUCCESS_PILL_BORDER = 'rgba(46,213,115,0.20)'\nconst ERROR_PILL_BG = 'rgba(209,67,67,0.10)'\nconst ERROR_PILL_BORDER = 'rgba(209,67,67,0.20)'\n\n/** Left gutter reserved for y-axis value labels. */\nconst PLOT_LEFT = 26\n/** Approximate tooltip width used for edge clamping. */\nconst TOOLTIP_WIDTH = 124\n\nexport interface StrengthTrendDataPoint {\n /** ISO date string for the session. */\n date: string\n /** Estimated one-rep max in the chart's unit. */\n e1rm: number\n /** Marks a personal-record session (rendered with a star). */\n isPR?: boolean\n /** Optional human label shown in the tooltip instead of the raw date. */\n sessionLabel?: string\n}\n\nexport interface StrengthTrendChartMesoBoundary {\n /** ISO date where the mesocycle boundary falls. */\n date: string\n /** Short label, e.g. \"Hypertrophy\". */\n label: string\n}\n\nexport interface StrengthTrendChartProps extends ViewProps {\n /** Actual e1RM data points, chronological. */\n data: StrengthTrendDataPoint[]\n /** Projected/planned e1RM trajectory, drawn as a dashed line. */\n projection?: StrengthTrendDataPoint[]\n /** Chart plot width in pixels. */\n width: number\n /** Chart plot height in pixels (120-160 for the compact variant). */\n height: number\n /** Mesocycle boundary markers (vertical guides + labels). */\n mesoBoundaries?: StrengthTrendChartMesoBoundary[]\n /** Called when an actual data point is tapped. */\n onPointPress?: (point: StrengthTrendDataPoint) => void\n /** Unit for display and labels. */\n unit: 'lbs' | 'kg'\n /** Animate the left-to-right line draw on mount (default true). */\n animateOnMount?: boolean\n className?: string\n}\n\ninterface Coord {\n x: number\n y: number\n point: StrengthTrendDataPoint\n index: number\n}\n\ninterface Geometry {\n hasData: boolean\n toX: (time: number) => number\n toY: (value: number) => number\n actual: Coord[]\n projection: Coord[]\n gridLines: Array<{ y: number; label: string }>\n boundaries: Array<{ x: number; label: string }>\n}\n\nfunction timeOf(dateStr: string): number {\n const t = Date.parse(dateStr)\n return Number.isNaN(t) ? 0 : t\n}\n\nfunction formatValue(value: number): string {\n return `${Math.round(value)}`\n}\n\nfunction buildGeometry(\n data: StrengthTrendDataPoint[],\n projection: StrengthTrendDataPoint[],\n boundaries: StrengthTrendChartMesoBoundary[],\n width: number,\n height: number,\n): Geometry {\n const values = [...data, ...projection].map((p) => p.e1rm)\n // Empty state keys off actual data only: a projection with no measured\n // sessions still shows the placeholder rather than a \"Current: 0\" chart.\n if (data.length === 0) {\n return {\n hasData: false,\n toX: () => 0,\n toY: () => 0,\n actual: [],\n projection: [],\n gridLines: [],\n boundaries: [],\n }\n }\n\n const times = [\n ...data.map((p) => timeOf(p.date)),\n ...projection.map((p) => timeOf(p.date)),\n ...boundaries.map((b) => timeOf(b.date)),\n ]\n const tMin = Math.min(...times)\n const tMaxRaw = Math.max(...times)\n const tMax = tMaxRaw === tMin ? tMin + 1 : tMaxRaw\n\n const yMin = Math.min(...values)\n const yMax = Math.max(...values)\n const range = yMax - yMin || Math.max(1, yMax * 0.1)\n const padV = range * 0.15\n const domainMin = yMin - padV\n const domainMax = yMax + padV\n\n const innerW = Math.max(1, width - PLOT_LEFT)\n const toX = (time: number) =>\n PLOT_LEFT + ((time - tMin) / (tMax - tMin)) * innerW\n const toY = (value: number) =>\n height - ((value - domainMin) / (domainMax - domainMin)) * height\n\n const project = (points: StrengthTrendDataPoint[]): Coord[] =>\n points.map((point, index) => ({\n x: toX(timeOf(point.date)),\n y: toY(point.e1rm),\n point,\n index,\n }))\n\n const tickValues = Array.from(\n new Set([yMax, (yMin + yMax) / 2, yMin].map((v) => Math.round(v))),\n )\n const gridLines = tickValues.map((v) => ({ y: toY(v), label: formatValue(v) }))\n\n return {\n hasData: true,\n toX,\n toY,\n actual: project(data),\n projection: project(projection),\n gridLines,\n boundaries: boundaries.map((b) => ({\n x: toX(timeOf(b.date)),\n label: b.label,\n })),\n }\n}\n\nfunction computeTrend(\n data: StrengthTrendDataPoint[],\n boundaries: StrengthTrendChartMesoBoundary[],\n): { percent: number; positive: boolean } {\n if (data.length < 2) return { percent: 0, positive: true }\n let series = data\n if (boundaries.length > 0) {\n const lastBoundary = Math.max(...boundaries.map((b) => timeOf(b.date)))\n const filtered = data.filter((p) => timeOf(p.date) >= lastBoundary)\n // The pill is labelled \"this meso\"; if the current meso has <2 points\n // there is no meso trend to show — stay neutral rather than silently\n // reporting the whole-series change under a \"this meso\" label.\n if (filtered.length < 2) return { percent: 0, positive: true }\n series = filtered\n }\n const first = series[0].e1rm\n const last = series[series.length - 1].e1rm\n const percent = first ? ((last - first) / first) * 100 : 0\n return { percent, positive: percent >= 0 }\n}\n\nfunction ChartLine({\n coords,\n color,\n strokeWidth,\n dashed,\n testID,\n}: {\n coords: Coord[]\n color: string\n strokeWidth: number\n dashed?: boolean\n testID: string\n}) {\n return (\n <>\n {coords.map((c, i) => {\n if (i === 0) return null\n const prev = coords[i - 1]\n const dx = c.x - prev.x\n const dy = c.y - prev.y\n const length = Math.sqrt(dx * dx + dy * dy)\n const angle = Math.atan2(dy, dx) * (180 / Math.PI)\n return (\n <View\n key={`${testID}-${i}`}\n testID={testID}\n accessibilityElementsHidden\n style={[\n {\n position: 'absolute',\n left: prev.x,\n top: prev.y,\n width: length,\n transformOrigin: '0 0',\n transform: [{ rotate: `${angle}deg` }],\n },\n dashed\n ? {\n height: 0,\n borderTopWidth: strokeWidth,\n borderStyle: 'dashed',\n borderTopColor: color,\n }\n : {\n height: strokeWidth,\n borderRadius: strokeWidth / 2,\n backgroundColor: color,\n },\n ]}\n />\n )\n })}\n </>\n )\n}\n\n/**\n * Estimated-1RM line chart over time with an optional dashed plan-projection\n * line and PR star markers. Rendered entirely with absolutely-positioned\n * Views (no SVG), following the Sparkline approach. Tapping an actual point\n * opens a tooltip and fires `onPointPress`. A trend pill below the chart\n * summarizes the percentage change for the current mesocycle.\n *\n * @example\n * <StrengthTrendChart\n * data={[{ date: '2026-01-01', e1rm: 225 }, { date: '2026-02-01', e1rm: 245, isPR: true }]}\n * projection={[{ date: '2026-02-01', e1rm: 245 }, { date: '2026-03-01', e1rm: 260 }]}\n * width={320}\n * height={150}\n * unit=\"lbs\"\n * />\n */\nexport function StrengthTrendChart({\n data,\n projection = [],\n width,\n height,\n mesoBoundaries = [],\n onPointPress,\n unit,\n animateOnMount = true,\n className,\n ...props\n}: StrengthTrendChartProps) {\n const geometry = useMemo(\n () => buildGeometry(data, projection, mesoBoundaries, width, height),\n [data, projection, mesoBoundaries, width, height],\n )\n const trend = useMemo(\n () => computeTrend(data, mesoBoundaries),\n [data, mesoBoundaries],\n )\n\n const [reveal] = useState(() => new Animated.Value(animateOnMount ? 0 : 1))\n const [selected, setSelected] = useState<number | null>(null)\n\n useEffect(() => {\n if (!animateOnMount) return\n const animation = Animated.timing(reveal, {\n toValue: 1,\n duration: 600,\n easing: Easing.out(Easing.ease),\n useNativeDriver: false,\n })\n animation.start()\n return () => animation.stop()\n }, [animateOnMount, reveal])\n\n const current = data.length > 0 ? data[data.length - 1].e1rm : 0\n const trendSign = trend.percent >= 0 ? '+' : '-'\n const trendText = `${trendSign}${Math.abs(trend.percent).toFixed(1)}% this meso`\n const ariaLabel = geometry.hasData\n ? `Strength trend chart showing estimated one rep max over time. Current: ${formatValue(current)} ${unit}. Trend: ${trendSign}${Math.abs(trend.percent).toFixed(1)}%`\n : 'Strength trend chart, no data'\n\n if (!geometry.hasData) {\n return (\n <View\n style={{ width }}\n className={cn(className)}\n accessibilityRole=\"image\"\n accessibilityLabel={ariaLabel}\n testID=\"strength-trend-chart-empty\"\n {...props}\n >\n <View\n style={{\n width,\n height,\n alignItems: 'center',\n justifyContent: 'center',\n }}\n >\n <Text className=\"text-text-tertiary\" style={{ fontSize: 12, fontFamily: 'Inter, sans-serif' }}>\n No strength data yet\n </Text>\n </View>\n </View>\n )\n }\n\n const revealWidth = reveal.interpolate({\n inputRange: [0, 1],\n outputRange: [0, width],\n })\n\n const selectedCoord =\n selected != null ? geometry.actual[selected] : undefined\n\n return (\n <View\n style={{ width }}\n className={cn(className)}\n testID=\"strength-trend-chart\"\n {...props}\n >\n <View style={{ width, height, position: 'relative' }}>\n {/* Labelled, non-interactive chart canvas (grid + lines + markers). */}\n <View\n style={{ position: 'absolute', top: 0, left: 0, width, height }}\n accessibilityRole=\"image\"\n accessibilityLabel={ariaLabel}\n testID=\"strength-trend-chart-canvas\"\n >\n {geometry.gridLines.map((line, i) => (\n <View\n key={`grid-${i}`}\n accessibilityElementsHidden\n testID=\"strength-trend-chart-gridline\"\n style={{\n position: 'absolute',\n left: PLOT_LEFT,\n right: 0,\n top: line.y,\n height: 1,\n backgroundColor: GRID_LINE,\n }}\n >\n <Text\n className=\"text-text-tertiary\"\n style={{\n position: 'absolute',\n left: -PLOT_LEFT,\n top: -6,\n width: PLOT_LEFT - 4,\n textAlign: 'right',\n fontSize: 9,\n fontFamily: 'Inter, sans-serif',\n }}\n >\n {line.label}\n </Text>\n </View>\n ))}\n\n {geometry.boundaries.map((boundary, i) => (\n <View\n key={`boundary-${i}`}\n accessibilityElementsHidden\n testID=\"strength-trend-chart-meso-boundary\"\n style={{\n position: 'absolute',\n left: boundary.x,\n top: 0,\n width: 0,\n height,\n borderLeftWidth: 1,\n borderStyle: 'dashed',\n borderLeftColor: 'rgba(255,255,255,0.10)',\n }}\n />\n ))}\n\n <Animated.View\n style={{\n position: 'absolute',\n top: 0,\n left: 0,\n width: revealWidth,\n height,\n overflow: 'hidden',\n }}\n testID=\"strength-trend-chart-reveal\"\n >\n <View style={{ width, height, position: 'absolute', top: 0, left: 0 }}>\n <ChartLine\n coords={geometry.projection}\n color={PROJECTION_LINE_COLOR}\n strokeWidth={2}\n dashed\n testID=\"strength-trend-chart-projection-segment\"\n />\n <ChartLine\n coords={geometry.actual}\n color={BRAND_PRIMARY}\n strokeWidth={2.5}\n testID=\"strength-trend-chart-actual-segment\"\n />\n </View>\n </Animated.View>\n\n {geometry.actual.map((c) =>\n c.point.isPR ? (\n <Text\n key={`star-${c.index}`}\n accessibilityElementsHidden\n testID=\"strength-trend-chart-pr-star\"\n style={{\n position: 'absolute',\n left: c.x - 7,\n top: c.y - 20,\n fontSize: 12,\n color: STATUS_WARNING,\n }}\n >\n ★\n </Text>\n ) : null,\n )}\n </View>\n\n {/* Interactive point overlay (kept out of the image-role canvas). */}\n <View\n style={{ position: 'absolute', top: 0, left: 0, width, height }}\n testID=\"strength-trend-chart-points\"\n >\n {geometry.actual.map((c) => {\n const label = c.point.sessionLabel ?? c.point.date\n return (\n <Pressable\n key={`point-${c.index}`}\n testID=\"strength-trend-chart-point\"\n accessibilityRole=\"button\"\n accessibilityLabel={`${label}: ${formatValue(c.point.e1rm)} ${unit}${c.point.isPR ? ', personal record' : ''}`}\n onPress={() => {\n setSelected(c.index)\n onPointPress?.(c.point)\n }}\n style={{\n position: 'absolute',\n left: c.x - 4,\n top: c.y - 4,\n width: 8,\n height: 8,\n borderRadius: 1,\n backgroundColor: BRAND_PRIMARY,\n }}\n />\n )\n })}\n </View>\n\n {selectedCoord && (\n <View\n testID=\"strength-trend-chart-tooltip\"\n accessibilityElementsHidden\n className=\"bg-surface-elevated border-border-strong\"\n style={{\n position: 'absolute',\n left: Math.max(\n 0,\n Math.min(width - TOOLTIP_WIDTH, selectedCoord.x - TOOLTIP_WIDTH / 2),\n ),\n top: Math.max(0, selectedCoord.y - 52),\n maxWidth: TOOLTIP_WIDTH,\n borderWidth: 1,\n borderRadius: 8,\n paddingVertical: 8,\n paddingHorizontal: 10,\n }}\n >\n <Text\n className=\"text-text-tertiary\"\n style={{\n fontSize: 10,\n fontFamily: 'Inter, sans-serif',\n }}\n >\n {selectedCoord.point.sessionLabel ?? selectedCoord.point.date}\n </Text>\n <Text\n className=\"text-text-primary\"\n style={{\n marginTop: 2,\n fontSize: 13,\n fontFamily: 'Inter, sans-serif',\n fontWeight: '700',\n }}\n >\n {`${formatValue(selectedCoord.point.e1rm)} ${unit}`}\n </Text>\n {selected != null && selected > 0 && (\n <Text\n style={{\n marginTop: 1,\n fontSize: 10,\n fontFamily: 'Inter, sans-serif',\n color:\n selectedCoord.point.e1rm - geometry.actual[selected - 1].point.e1rm >= 0\n ? STATUS_SUCCESS\n : STATUS_ERROR,\n }}\n >\n {`${\n selectedCoord.point.e1rm - geometry.actual[selected - 1].point.e1rm >= 0\n ? '+'\n : '-'\n }${Math.abs(\n selectedCoord.point.e1rm - geometry.actual[selected - 1].point.e1rm,\n ).toFixed(1)} ${unit}`}\n </Text>\n )}\n </View>\n )}\n </View>\n\n {/* Meso boundary x-axis labels. */}\n {geometry.boundaries.length > 0 && (\n <View\n style={{ width, height: 14, position: 'relative', marginTop: 2 }}\n accessibilityElementsHidden\n testID=\"strength-trend-chart-axis\"\n >\n {geometry.boundaries.map((boundary, i) => (\n <Text\n key={`axis-${i}`}\n testID=\"strength-trend-chart-axis-label\"\n className=\"text-text-tertiary\"\n style={{\n position: 'absolute',\n left: boundary.x - 24,\n width: 48,\n textAlign: 'center',\n fontSize: 10,\n fontFamily: 'Inter, sans-serif',\n }}\n >\n {boundary.label}\n </Text>\n ))}\n </View>\n )}\n\n {/* Trend pill. */}\n <View className=\"flex-row\" style={{ marginTop: 8 }}>\n <View\n testID=\"strength-trend-chart-trend-pill\"\n accessibilityLabel={`Strength trend: ${trendText}`}\n style={{\n paddingVertical: 3,\n paddingHorizontal: 8,\n borderRadius: 4,\n borderWidth: 1,\n backgroundColor: trend.positive ? SUCCESS_PILL_BG : ERROR_PILL_BG,\n borderColor: trend.positive ? SUCCESS_PILL_BORDER : ERROR_PILL_BORDER,\n }}\n >\n <Text\n style={{\n fontSize: 11,\n fontFamily: 'Inter, sans-serif',\n fontWeight: '600',\n color: trend.positive ? STATUS_SUCCESS : STATUS_ERROR,\n }}\n >\n {trendText}\n </Text>\n </View>\n </View>\n\n {/* Legend. */}\n <View\n className=\"flex-row items-center\"\n style={{ marginTop: 8, gap: 14 }}\n testID=\"strength-trend-chart-legend\"\n >\n <View className=\"flex-row items-center\" style={{ gap: 5 }}>\n <View style={{ width: 14, height: 2.5, borderRadius: 1.5, backgroundColor: BRAND_PRIMARY }} />\n <Text className=\"text-text-secondary\" style={{ fontSize: 10, fontFamily: 'Inter, sans-serif' }}>\n Actual\n </Text>\n </View>\n <View className=\"flex-row items-center\" style={{ gap: 5 }}>\n <View\n style={{\n width: 14,\n height: 0,\n borderTopWidth: 2,\n borderStyle: 'dashed',\n borderTopColor: PROJECTION_LINE_COLOR,\n }}\n />\n <Text className=\"text-text-secondary\" style={{ fontSize: 10, fontFamily: 'Inter, sans-serif' }}>\n Projected\n </Text>\n </View>\n <View className=\"flex-row items-center\" style={{ gap: 5 }}>\n <Text style={{ fontSize: 12, color: STATUS_WARNING }}>★</Text>\n <Text className=\"text-text-secondary\" style={{ fontSize: 10, fontFamily: 'Inter, sans-serif' }}>\n PR\n </Text>\n </View>\n </View>\n </View>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { useEffect, useState, useMemo } from 'react'\nimport { View, Text, Pressable, Animated, Easing, type ViewProps } from 'react-native'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\n\nconst t = getSemanticColors('dark')\n\nconst STATUS_SUCCESS = t['status-success']\nconst STATUS_WARNING = t['status-warning']\nconst STATUS_INFO = t['status-info']\n/** Dot outline: near-white ring so load dots read on the band fill and any\n * surface (matches the MesoStatusCard gauge-marker convention). */\nconst DOT_BORDER = '#F3F4F6'\nconst BAND_FILL = 'rgba(46,213,115,0.1)'\nconst BAND_EDGE = 'rgba(46,213,115,0.45)'\nconst PROJECTION_FILL = 'rgba(46,213,115,0.05)'\n\nconst PADDING_LEFT = 28\nconst PADDING_RIGHT = 10\nconst PADDING_TOP = 8\nconst PADDING_BOTTOM = 16\nconst COLUMN_STEP = 4\nconst DOT_SIZE = 8\n\nexport type WorkoutDotStatus = 'within' | 'above' | 'below'\n\nexport interface CapacityBandDataPoint {\n /** ISO-ish date string (e.g. \"2026-06-01\"). */\n date: string\n /** Lower bound of the capacity band (MEV equivalent). */\n bandLow: number\n /** Upper bound of the capacity band (MRV equivalent). */\n bandHigh: number\n}\n\nexport interface WorkoutDot {\n date: string\n /** Actual session load score. */\n load: number\n /** Position of the session relative to the band. */\n status: WorkoutDotStatus\n}\n\nexport interface CapacityBandProjection {\n /** Band shape over the next days if training continues (rises). */\n withTraining: CapacityBandDataPoint[]\n /** Band shape over the next days if resting (drops). */\n withRest: CapacityBandDataPoint[]\n}\n\nexport interface CapacityBandChartProps extends ViewProps {\n /** Capacity band shape over time. */\n band: CapacityBandDataPoint[]\n /** Workout sessions plotted as dots. */\n workouts: WorkoutDot[]\n /** Optional forward projection (next few days). */\n projection?: CapacityBandProjection\n /** Chart width in px. */\n width: number\n /** Chart height in px. */\n height: number\n /** Called when a workout dot is tapped. */\n onWorkoutPress?: (workout: WorkoutDot) => void\n className?: string\n}\n\ninterface PixelPoint {\n x: number\n yHigh: number\n yLow: number\n}\n\nconst DOT_COLORS: Record<WorkoutDotStatus, string> = {\n within: STATUS_SUCCESS,\n above: STATUS_WARNING,\n below: STATUS_INFO,\n}\n\nconst STATUS_PHRASES: Record<WorkoutDotStatus, string> = {\n within: 'within range',\n above: 'above range',\n below: 'below range',\n}\n\nfunction parseTime(date: string): number {\n const parts = date.split('-')\n if (parts.length === 3) {\n return Date.UTC(Number(parts[0]), Number(parts[1]) - 1, Number(parts[2]))\n }\n const parsed = Date.parse(date)\n return Number.isNaN(parsed) ? 0 : parsed\n}\n\nfunction formatDate(date: string): string {\n const parts = date.split('-')\n if (parts.length === 3) return `${Number(parts[1])}/${Number(parts[2])}`\n const d = new Date(date)\n return Number.isNaN(d.getTime()) ? date : `${d.getMonth() + 1}/${d.getDate()}`\n}\n\nfunction toPixels(\n points: CapacityBandDataPoint[],\n toX: (date: string) => number,\n toY: (value: number) => number,\n): PixelPoint[] {\n return points\n .map((p) => ({ x: toX(p.date), yHigh: toY(p.bandHigh), yLow: toY(p.bandLow) }))\n .sort((a, b) => a.x - b.x)\n}\n\nfunction interpEdge(pixels: PixelPoint[], x: number, key: 'yHigh' | 'yLow'): number {\n for (let i = 0; i < pixels.length - 1; i++) {\n const a = pixels[i]\n const b = pixels[i + 1]\n if (x >= a.x && x <= b.x) {\n const t = b.x === a.x ? 0 : (x - a.x) / (b.x - a.x)\n return a[key] + t * (b[key] - a[key])\n }\n }\n return pixels[pixels.length - 1][key]\n}\n\nfunction buildColumns(pixels: PixelPoint[], step: number) {\n if (pixels.length < 2) return []\n const start = pixels[0].x\n const end = pixels[pixels.length - 1].x\n const columns: Array<{ x: number; top: number; height: number }> = []\n for (let x = start; x < end; x += step) {\n const top = interpEdge(pixels, x, 'yHigh')\n const bottom = interpEdge(pixels, x, 'yLow')\n columns.push({ x, top, height: Math.max(0, bottom - top) })\n }\n return columns\n}\n\nfunction buildEdges(pixels: PixelPoint[], key: 'yHigh' | 'yLow') {\n const segments: Array<{ left: number; top: number; length: number; angle: number }> = []\n for (let i = 1; i < pixels.length; i++) {\n const a = pixels[i - 1]\n const b = pixels[i]\n const dx = b.x - a.x\n const dy = b[key] - a[key]\n segments.push({\n left: a.x,\n top: a[key],\n length: Math.sqrt(dx * dx + dy * dy),\n angle: Math.atan2(dy, dx) * (180 / Math.PI),\n })\n }\n return segments\n}\n\nfunction collectValues(\n band: CapacityBandDataPoint[],\n workouts: WorkoutDot[],\n projection?: CapacityBandProjection,\n): number[] {\n const values: number[] = []\n band.forEach((p) => values.push(p.bandLow, p.bandHigh))\n workouts.forEach((w) => values.push(w.load))\n projection?.withTraining.forEach((p) => values.push(p.bandLow, p.bandHigh))\n projection?.withRest.forEach((p) => values.push(p.bandLow, p.bandHigh))\n return values\n}\n\nfunction currentStatus(workouts: WorkoutDot[]): string {\n if (workouts.length === 0) return 'no recent sessions'\n const latest = [...workouts].sort((a, b) => parseTime(b.date) - parseTime(a.date))[0]\n return STATUS_PHRASES[latest.status]\n}\n\n/**\n * Gentler-Streak-inspired fatigue visualization. Renders a shaded capacity\n * band (between a rolling MEV/MRV estimate), workout sessions as colored dots\n * positioned by load, and an optional dashed forward projection that diverges\n * for \"keep training\" (rises) versus \"rest\" (drops). View-based, no SVG:\n * the band fill is a run of vertical columns and the edges/projection are\n * rotated line Views (same technique as Sparkline).\n *\n * @example\n * <CapacityBandChart\n * band={band}\n * workouts={workouts}\n * projection={{ withTraining, withRest }}\n * width={320}\n * height={180}\n * onWorkoutPress={(w) => openSession(w)}\n * />\n */\nexport function CapacityBandChart({\n band,\n workouts,\n projection,\n width,\n height,\n onWorkoutPress,\n className,\n ...props\n}: CapacityBandChartProps) {\n const [reveal] = useState(() => new Animated.Value(0))\n const dotAnims = useMemo(\n () => Array.from({ length: workouts.length }, () => new Animated.Value(0)),\n [workouts.length],\n )\n\n useEffect(() => {\n reveal.setValue(0)\n dotAnims.forEach((a) => a.setValue(0))\n const draw = Animated.timing(reveal, {\n toValue: 1,\n duration: 800,\n easing: Easing.out(Easing.ease),\n useNativeDriver: false,\n })\n const pops = dotAnims.map((a) =>\n Animated.timing(a, {\n toValue: 1,\n duration: 200,\n easing: Easing.out(Easing.ease),\n useNativeDriver: false,\n }),\n )\n const animation = Animated.sequence([draw, Animated.stagger(200, pops)])\n animation.start()\n return () => animation.stop()\n }, [reveal, dotAnims, band.length, workouts.length])\n\n const plotWidth = width - PADDING_LEFT - PADDING_RIGHT\n const plotHeight = height - PADDING_TOP - PADDING_BOTTOM\n\n const scale = useMemo(() => {\n const times = band.map((p) => parseTime(p.date))\n projection?.withTraining.forEach((p) => times.push(parseTime(p.date)))\n projection?.withRest.forEach((p) => times.push(parseTime(p.date)))\n const minT = times.length ? Math.min(...times) : 0\n const maxT = times.length ? Math.max(...times) : 1\n const tRange = maxT - minT || 1\n\n const values = collectValues(band, workouts, projection)\n const minV = values.length ? Math.min(...values) : 0\n const maxV = values.length ? Math.max(...values) : 1\n const pad = (maxV - minV) * 0.1 || 1\n const domainMin = minV - pad\n const domainMax = maxV + pad\n const vRange = domainMax - domainMin || 1\n\n const toX = (date: string) =>\n PADDING_LEFT + ((parseTime(date) - minT) / tRange) * plotWidth\n const toY = (value: number) =>\n PADDING_TOP + (1 - (value - domainMin) / vRange) * plotHeight\n return { toX, toY }\n }, [band, workouts, projection, plotWidth, plotHeight])\n\n if (band.length === 0) {\n return (\n <View\n style={{ width, height }}\n className={className}\n accessibilityRole=\"image\"\n accessibilityLabel=\"Training capacity band chart, no data\"\n testID=\"capacity-band-chart-empty\"\n {...props}\n />\n )\n }\n\n const { toX, toY } = scale\n const bandPixels = toPixels(band, toX, toY)\n const columns = buildColumns(bandPixels, COLUMN_STEP)\n const topEdge = buildEdges(bandPixels, 'yHigh')\n const bottomEdge = buildEdges(bandPixels, 'yLow')\n\n const lastBandPoint = band[band.length - 1]\n const trainingPixels = projection\n ? toPixels([lastBandPoint, ...projection.withTraining], toX, toY)\n : []\n const restPixels = projection\n ? toPixels([lastBandPoint, ...projection.withRest], toX, toY)\n : []\n\n const labelStride = Math.max(1, Math.ceil(band.length / 5))\n const revealWidth = reveal.interpolate({ inputRange: [0, 1], outputRange: [0, width] })\n\n const renderColumns = (cols: ReturnType<typeof buildColumns>, color: string, key: string) =>\n cols.map((col, i) => (\n <View\n key={`${key}-${i}`}\n style={{\n position: 'absolute',\n left: col.x,\n top: col.top,\n width: COLUMN_STEP + 0.5,\n height: col.height,\n backgroundColor: color,\n }}\n accessibilityElementsHidden\n importantForAccessibility=\"no-hide-descendants\"\n testID={key}\n />\n ))\n\n const renderEdges = (\n segments: ReturnType<typeof buildEdges>,\n color: string,\n dashed: boolean,\n key: string,\n ) =>\n segments.map((seg, i) => (\n <View\n key={`${key}-${i}`}\n style={{\n position: 'absolute',\n left: seg.left,\n top: seg.top,\n width: seg.length,\n height: dashed ? 0 : 1.5,\n borderTopWidth: dashed ? 1 : 0,\n borderTopColor: dashed ? color : undefined,\n borderStyle: dashed ? 'dashed' : 'solid',\n backgroundColor: dashed ? undefined : color,\n opacity: dashed ? 0.7 : 1,\n transformOrigin: '0 0',\n transform: [{ rotate: `${seg.angle}deg` }],\n }}\n accessibilityElementsHidden\n importantForAccessibility=\"no-hide-descendants\"\n testID={key}\n />\n ))\n\n return (\n <View\n style={{ width, height, position: 'relative' }}\n className={className}\n testID=\"capacity-band-chart-root\"\n {...props}\n >\n {/* Static visual layer carries the image role; interactive dots live as\n siblings so the image role has no focusable descendants. */}\n <View\n style={{ position: 'absolute', top: 0, left: 0, width, height }}\n accessibilityRole=\"image\"\n accessibilityLabel={`Training capacity band chart. Current capacity: ${currentStatus(\n workouts,\n )}. ${workouts.length} workout${workouts.length === 1 ? '' : 's'} shown.`}\n testID=\"capacity-band-chart\"\n >\n {/* Band + projection draw left-to-right via an animated clip. */}\n <Animated.View\n style={{ position: 'absolute', top: 0, left: 0, height, width: revealWidth, overflow: 'hidden' }}\n accessibilityElementsHidden\n importantForAccessibility=\"no-hide-descendants\"\n testID=\"capacity-band-chart-reveal\"\n >\n <View style={{ width, height, position: 'relative' }}>\n {projection && (\n <View testID=\"capacity-band-chart-projection\">\n {renderColumns(buildColumns(trainingPixels, COLUMN_STEP), PROJECTION_FILL, 'capacity-band-chart-projection-fill')}\n {renderColumns(buildColumns(restPixels, COLUMN_STEP), PROJECTION_FILL, 'capacity-band-chart-projection-fill')}\n {renderEdges(buildEdges(trainingPixels, 'yHigh'), STATUS_SUCCESS, true, 'capacity-band-chart-projection-training')}\n {renderEdges(buildEdges(trainingPixels, 'yLow'), STATUS_SUCCESS, true, 'capacity-band-chart-projection-training')}\n {renderEdges(buildEdges(restPixels, 'yHigh'), STATUS_INFO, true, 'capacity-band-chart-projection-rest')}\n {renderEdges(buildEdges(restPixels, 'yLow'), STATUS_INFO, true, 'capacity-band-chart-projection-rest')}\n <Text\n style={{\n position: 'absolute',\n left: trainingPixels[trainingPixels.length - 1]?.x + 2,\n top: trainingPixels[trainingPixels.length - 1]?.yHigh - 12,\n fontSize: 9,\n fontFamily: 'Inter, sans-serif',\n color: STATUS_SUCCESS,\n }}\n testID=\"capacity-band-chart-projection-training-label\"\n >\n Training\n </Text>\n <Text\n style={{\n position: 'absolute',\n left: restPixels[restPixels.length - 1]?.x + 2,\n top: restPixels[restPixels.length - 1]?.yLow + 2,\n fontSize: 9,\n fontFamily: 'Inter, sans-serif',\n color: STATUS_INFO,\n }}\n testID=\"capacity-band-chart-projection-rest-label\"\n >\n Rest\n </Text>\n </View>\n )}\n\n <View testID=\"capacity-band-chart-band\">\n {renderColumns(columns, BAND_FILL, 'capacity-band-chart-band-cell')}\n </View>\n {renderEdges(topEdge, BAND_EDGE, false, 'capacity-band-chart-edge-top')}\n {renderEdges(bottomEdge, BAND_EDGE, false, 'capacity-band-chart-edge-bottom')}\n </View>\n </Animated.View>\n\n {/* Y axis conceptual label (no numbers). */}\n <Text\n className=\"text-text-tertiary\"\n style={{\n position: 'absolute',\n left: PADDING_LEFT / 2 - 14,\n top: PADDING_TOP + plotHeight / 2 - 7,\n width: 32,\n textAlign: 'center',\n fontSize: 9,\n fontFamily: 'Inter, sans-serif',\n transform: [{ rotate: '-90deg' }],\n }}\n accessibilityElementsHidden\n importantForAccessibility=\"no-hide-descendants\"\n testID=\"capacity-band-chart-y-axis-label\"\n >\n Load\n </Text>\n\n {/* X axis date labels (subset to avoid overlap). */}\n {band.map((point, i) => {\n if (i % labelStride !== 0 && i !== band.length - 1) return null\n return (\n <Text\n key={`x-${point.date}`}\n className=\"text-text-tertiary\"\n style={{\n position: 'absolute',\n left: toX(point.date) - 14,\n top: height - PADDING_BOTTOM + 2,\n width: 28,\n textAlign: 'center',\n fontSize: 10,\n fontFamily: 'Inter, sans-serif',\n }}\n accessibilityElementsHidden\n importantForAccessibility=\"no-hide-descendants\"\n testID=\"capacity-band-chart-x-label\"\n >\n {formatDate(point.date)}\n </Text>\n )\n })}\n </View>\n\n {/* Workout dots — scale in after the band draws. */}\n {workouts.map((workout, i) => {\n const cx = toX(workout.date)\n const cy = toY(workout.load)\n const color = DOT_COLORS[workout.status]\n const dotStyle = {\n width: DOT_SIZE,\n height: DOT_SIZE,\n borderRadius: DOT_SIZE / 2,\n backgroundColor: color,\n borderWidth: 2,\n borderColor: DOT_BORDER,\n }\n const label = `Workout on ${formatDate(workout.date)}, load ${workout.load}, ${\n STATUS_PHRASES[workout.status]\n }`\n return (\n <Animated.View\n key={`dot-${workout.date}-${i}`}\n style={{\n position: 'absolute',\n left: cx - DOT_SIZE / 2,\n top: cy - DOT_SIZE / 2,\n transform: [{ scale: dotAnims[i] ?? 1 }],\n }}\n testID=\"capacity-band-chart-dot-wrapper\"\n >\n {onWorkoutPress ? (\n <Pressable\n onPress={() => onWorkoutPress(workout)}\n accessibilityRole=\"button\"\n accessibilityLabel={label}\n style={dotStyle}\n testID=\"capacity-band-chart-dot\"\n />\n ) : (\n <View\n accessibilityElementsHidden\n importantForAccessibility=\"no-hide-descendants\"\n style={dotStyle}\n testID=\"capacity-band-chart-dot\"\n />\n )}\n </Animated.View>\n )\n })}\n </View>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { useMemo, useState } from 'react'\nimport { View, Text, Pressable, type ViewProps } from 'react-native'\nimport { MesoStatusCard, type MesoStatusCardProps } from './MesoStatusCard'\nimport {\n StrengthTrendChart,\n type StrengthTrendDataPoint,\n type StrengthTrendChartMesoBoundary,\n} from './StrengthTrendChart'\nimport {\n CapacityBandChart,\n type CapacityBandDataPoint,\n type CapacityBandProjection,\n type WorkoutDot,\n} from './CapacityBandChart'\nimport { ExerciseCard, type ExerciseCardProps } from './ExerciseCard'\nimport { type SetRowProps } from './SetRow'\nimport {\n VelocityStrip,\n calculateMeanVelocity,\n calculateVelocityLoss,\n type VelocityZoneBandProp,\n} from './VelocityStrip'\nimport { resolveColor } from '../../../theme/resolve-color'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\nimport { cn } from '../../../utils/cn'\n\nconst BRAND_PRIMARY = getSemanticColors('dark')['brand-primary']\n\n/** Inner plot width: page width 390 − 16 page padding − 12 card padding on each side. */\nconst CHART_WIDTH = 326\nconst CHART_HEIGHT = 150\n\n/** Which tab of the exercise detail view is showing. */\nexport type ExerciseDetailTab = 'progress' | 'history' | 'advanced'\n\n/** Tabs in display order. */\nexport const EXERCISE_DETAIL_TABS: Array<{ key: ExerciseDetailTab; label: string }> = [\n { key: 'progress', label: 'Progress' },\n { key: 'history', label: 'History' },\n { key: 'advanced', label: 'Advanced' },\n]\n\n/** Identity + headline stats for the exercise being inspected. */\nexport interface ExerciseDetailHeader {\n /** Exercise name, e.g. \"Barbell Bench Press\". */\n name: string\n /** Context line, e.g. \"Chest · Barbell\". */\n subtitle: string\n /** Unit used across the page. */\n unit: 'lbs' | 'kg'\n /** Current estimated one-rep max, shown as a header pill. */\n currentE1rm?: number\n}\n\n/**\n * A single expandable entry — one progression week or one logged session.\n * Projected onto an `ExerciseCard`, so it collapses to a summary and expands\n * to its `SetRow` breakdown.\n */\nexport interface ExerciseDetailEntry {\n /** Stable id for inline-expansion selection. */\n id: string\n /** Row title, e.g. \"Week 3\" or \"Mon, Jun 16\". */\n title: string\n /** Collapsed summary (sets × reps @ weight). */\n summary?: ExerciseCardProps['summary']\n /** Estimated one-rep max, feeding the page's best-e1RM stat. */\n e1rm?: { value: number; unit: 'lbs' | 'kg' }\n /** Flags a personal-record entry. */\n isPR?: boolean\n /** Prescribed tempo, revealed when expanded. */\n tempo?: ExerciseCardProps['tempo']\n /** Per-set breakdown revealed when expanded. */\n sets: SetRowProps[]\n}\n\n/** Strength-trend inputs for the Progress tab chart. */\nexport interface ExerciseTrend {\n /** Measured e1RM data points, chronological. */\n data: StrengthTrendDataPoint[]\n /** Planned/projected trajectory (dashed line). */\n projection?: StrengthTrendDataPoint[]\n /** Mesocycle boundary guides. */\n mesoBoundaries?: StrengthTrendChartMesoBoundary[]\n}\n\n/** One set's velocity trace for the Advanced tab breakdown. */\nexport interface ExerciseVbtSet {\n /** Row label, e.g. \"Set 1\". */\n label: string\n /** Per-rep mean concentric velocities (m/s). */\n velocities: number[]\n}\n\n/** Velocity-based-training inputs for the Advanced tab. */\nexport interface ExerciseVbt {\n /** Capacity band shape over time. */\n band: CapacityBandDataPoint[]\n /** Sessions plotted against the band. */\n workouts: WorkoutDot[]\n /** Optional forward band projection. */\n projection?: CapacityBandProjection\n /** Per-set velocity traces for the most recent session. */\n sets: ExerciseVbtSet[]\n /** Optional velocity-zone bands for this exercise (WA `VelocityZones.bands`). */\n zones?: readonly VelocityZoneBandProp[]\n}\n\n/** Page-level roll-up of the logged sessions. */\nexport interface ExerciseDetailStats {\n /** Number of logged sessions. */\n sessions: number\n /** Best estimated one-rep max seen, or null if none recorded. */\n bestE1rm: number | null\n /** Count of PR entries. */\n prCount: number\n}\n\n/** Aggregate velocity readout for the Advanced tab. */\nexport interface VbtSummary {\n /** Mean concentric velocity across every logged rep. */\n meanVelocity: number\n /** Worst within-set velocity loss (%), i.e. the most-fatigued set. */\n velocityLoss: number\n}\n\nexport interface ExerciseDetailPageProps extends ViewProps {\n /** Exercise identity + headline stats. */\n exercise: ExerciseDetailHeader\n /** Mesocycle context banner (Progress tab). */\n meso: MesoStatusCardProps\n /** Strength trend inputs (Progress tab). */\n trend: ExerciseTrend\n /** Week-by-week progression entries (Progress tab). */\n progression: ExerciseDetailEntry[]\n /** All logged sessions (History tab). */\n history: ExerciseDetailEntry[]\n /** Velocity-based-training inputs (Advanced tab). */\n vbt: ExerciseVbt\n className?: string\n}\n\n/** Roll up logged sessions into the page summary (pure, testable). */\nexport function deriveExerciseStats(entries: ExerciseDetailEntry[]): ExerciseDetailStats {\n let bestE1rm: number | null = null\n let prCount = 0\n for (const entry of entries) {\n if (entry.e1rm != null && (bestE1rm == null || entry.e1rm.value > bestE1rm)) {\n bestE1rm = entry.e1rm.value\n }\n if (entry.isPR) prCount += 1\n }\n return { sessions: entries.length, bestE1rm, prCount }\n}\n\n/** Project an entry onto ExerciseCard props, wiring inline expansion (pure). */\nexport function toExerciseCardProps(\n entry: ExerciseDetailEntry,\n expanded: boolean,\n onToggle: () => void\n): ExerciseCardProps {\n return {\n name: entry.title,\n expanded,\n onExpandedChange: onToggle,\n summary: entry.summary,\n isPR: entry.isPR,\n tempo: entry.tempo,\n sets: expanded ? entry.sets : undefined,\n }\n}\n\n/** Aggregate per-set velocity traces into the Advanced readout (pure). */\nexport function summarizeVbt(sets: ExerciseVbtSet[]): VbtSummary {\n const allReps = sets.flatMap((set) => set.velocities)\n const meanVelocity = calculateMeanVelocity(allReps)\n let velocityLoss = 0\n for (const set of sets) {\n velocityLoss = Math.max(velocityLoss, calculateVelocityLoss(set.velocities))\n }\n return { meanVelocity, velocityLoss }\n}\n\ninterface TabBarProps {\n active: ExerciseDetailTab\n onSelect: (tab: ExerciseDetailTab) => void\n}\n\nfunction TabBar({ active, onSelect }: TabBarProps) {\n return (\n <View\n className=\"flex-row\"\n style={{\n borderBottomWidth: 1,\n borderBottomColor: resolveColor('border-default'),\n }}\n accessibilityRole={'tablist' as ViewProps['accessibilityRole']}\n testID=\"exercise-detail-page-tabs\"\n >\n {EXERCISE_DETAIL_TABS.map(({ key, label }) => {\n const isActive = key === active\n return (\n <Pressable\n key={key}\n onPress={() => onSelect(key)}\n accessibilityRole=\"tab\"\n accessibilityState={{ selected: isActive }}\n style={{\n flex: 1,\n alignItems: 'center',\n paddingVertical: 10,\n borderBottomWidth: 2,\n borderBottomColor: isActive ? BRAND_PRIMARY : 'transparent',\n }}\n testID={`exercise-detail-page-tab-${key}`}\n >\n <Text\n className={isActive ? 'text-text-primary' : 'text-text-tertiary'}\n style={{\n fontSize: 13,\n fontFamily: 'Inter, sans-serif',\n fontWeight: isActive ? '700' : '500',\n }}\n >\n {label}\n </Text>\n </Pressable>\n )\n })}\n </View>\n )\n}\n\nconst STAT_CARDS: Array<{ key: keyof ExerciseDetailStats; label: string }> = [\n { key: 'sessions', label: 'Sessions' },\n { key: 'bestE1rm', label: 'Best e1RM' },\n { key: 'prCount', label: 'PRs' },\n]\n\nfunction StatStrip({ stats, unit }: { stats: ExerciseDetailStats; unit: 'lbs' | 'kg' }) {\n return (\n <View className=\"flex-row\" style={{ gap: 8 }} testID=\"exercise-detail-page-stats\">\n {STAT_CARDS.map(({ key, label }) => {\n const raw = stats[key]\n const value = key === 'bestE1rm' ? (raw == null ? '—' : `${raw} ${unit}`) : `${raw}`\n return (\n <View\n key={key}\n className=\"bg-surface-elevated border-border\"\n style={{\n flex: 1,\n padding: 12,\n borderRadius: 10,\n borderWidth: 1,\n }}\n testID={`exercise-detail-page-stat-${key}`}\n >\n <Text\n className=\"text-text-primary\"\n style={{\n fontSize: 18,\n fontFamily: '\"Space Grotesk\", sans-serif',\n fontWeight: '700',\n }}\n >\n {value}\n </Text>\n <Text\n className=\"text-text-tertiary\"\n style={{\n marginTop: 2,\n fontSize: 10,\n fontFamily: 'Inter, sans-serif',\n fontWeight: '600',\n letterSpacing: 0.4,\n textTransform: 'uppercase',\n }}\n >\n {label}\n </Text>\n </View>\n )\n })}\n </View>\n )\n}\n\nfunction SectionCard({\n title,\n children,\n testID,\n}: {\n title: string\n children: React.ReactNode\n testID: string\n}) {\n return (\n <View\n className=\"bg-surface-elevated border-border\"\n style={{\n borderWidth: 1,\n borderRadius: 12,\n padding: 12,\n gap: 10,\n }}\n testID={testID}\n >\n <Text\n className=\"text-text-tertiary\"\n style={{\n fontSize: 11,\n fontFamily: 'Inter, sans-serif',\n fontWeight: '600',\n letterSpacing: 0.6,\n textTransform: 'uppercase',\n }}\n >\n {title}\n </Text>\n {children}\n </View>\n )\n}\n\ninterface EntryListProps {\n entries: ExerciseDetailEntry[]\n expandedId: string | null\n onToggle: (id: string) => void\n emptyLabel: string\n testID: string\n}\n\nfunction EntryList({ entries, expandedId, onToggle, emptyLabel, testID }: EntryListProps) {\n if (entries.length === 0) {\n return (\n <Text\n className=\"text-text-tertiary\"\n style={{ fontSize: 12, fontFamily: 'Inter, sans-serif' }}\n testID={`${testID}-empty`}\n >\n {emptyLabel}\n </Text>\n )\n }\n return (\n <View style={{ gap: 8 }} testID={testID}>\n {entries.map((entry) => (\n <ExerciseCard\n key={entry.id}\n {...toExerciseCardProps(entry, entry.id === expandedId, () => onToggle(entry.id))}\n />\n ))}\n </View>\n )\n}\n\nfunction VbtBreakdown({\n sets,\n zones,\n}: {\n sets: ExerciseVbtSet[]\n zones?: readonly VelocityZoneBandProp[]\n}) {\n return (\n <View style={{ gap: 10 }} testID=\"exercise-detail-page-vbt-breakdown\">\n {sets.map((set) => {\n const mean = calculateMeanVelocity(set.velocities)\n const loss = calculateVelocityLoss(set.velocities)\n return (\n <View\n key={set.label}\n className=\"flex-row items-center\"\n style={{ gap: 10 }}\n testID=\"exercise-detail-page-vbt-set\"\n >\n <Text\n className=\"text-text-secondary\"\n style={{\n width: 44,\n fontSize: 11,\n fontFamily: 'Inter, sans-serif',\n fontWeight: '600',\n }}\n >\n {set.label}\n </Text>\n <View className=\"flex-1\" style={{ height: 8, justifyContent: 'center' }}>\n <VelocityStrip\n velocities={set.velocities}\n zones={zones}\n variant=\"compact\"\n height={8}\n hideBaseline\n />\n </View>\n <Text\n className=\"text-text-tertiary\"\n style={{\n fontSize: 11,\n fontFamily: 'Inter, sans-serif',\n fontVariant: ['tabular-nums'],\n }}\n >\n {`${mean.toFixed(2)} · -${loss}%`}\n </Text>\n </View>\n )\n })}\n </View>\n )\n}\n\nfunction VbtSummaryRow({ summary }: { summary: VbtSummary }) {\n const cells = [\n { label: 'Mean Velocity', value: `${summary.meanVelocity.toFixed(2)} m/s` },\n { label: 'Peak Vel. Loss', value: `-${summary.velocityLoss}%` },\n ]\n return (\n <View className=\"flex-row\" style={{ gap: 8 }} testID=\"exercise-detail-page-vbt-summary\">\n {cells.map((cell) => (\n <View\n key={cell.label}\n className=\"bg-surface-elevated border-border\"\n style={{\n flex: 1,\n padding: 12,\n borderRadius: 10,\n borderWidth: 1,\n }}\n >\n <Text\n className=\"text-text-primary\"\n style={{\n fontSize: 16,\n fontFamily: '\"Space Grotesk\", sans-serif',\n fontWeight: '700',\n }}\n >\n {cell.value}\n </Text>\n <Text\n className=\"text-text-tertiary\"\n style={{\n marginTop: 2,\n fontSize: 10,\n fontFamily: 'Inter, sans-serif',\n fontWeight: '600',\n letterSpacing: 0.4,\n textTransform: 'uppercase',\n }}\n >\n {cell.label}\n </Text>\n </View>\n ))}\n </View>\n )\n}\n\n/**\n * ExerciseDetailPage — a tabbed per-exercise view. A shared header (name,\n * context line, current e1RM pill) sits above a Progress / History / Advanced\n * tab bar. Progress composes the `MesoStatusCard` context banner, a stats\n * strip, a `StrengthTrendChart`, and a week-by-week progression list with\n * inline `ExerciseCard` expansion. History lists every logged session with the\n * same inline expansion. Advanced surfaces VBT data via a `CapacityBandChart`,\n * a velocity summary, and a per-set `VelocityStrip` breakdown. Tab and\n * per-list expansion are page-level state; children keep their own styles.\n *\n * @example\n * <ExerciseDetailPage\n * exercise={exercise}\n * meso={meso}\n * trend={trend}\n * progression={progression}\n * history={history}\n * vbt={vbt}\n * />\n */\nexport function ExerciseDetailPage({\n exercise,\n meso,\n trend,\n progression,\n history,\n vbt,\n className,\n ...props\n}: ExerciseDetailPageProps) {\n const [tab, setTab] = useState<ExerciseDetailTab>('progress')\n const [expandedProgressId, setExpandedProgressId] = useState<string | null>(null)\n const [expandedHistoryId, setExpandedHistoryId] = useState<string | null>(null)\n\n const stats = useMemo(() => deriveExerciseStats(history), [history])\n const vbtSummary = useMemo(() => summarizeVbt(vbt.sets), [vbt.sets])\n\n const toggle =\n (setId: (updater: (current: string | null) => string | null) => void) => (id: string) =>\n setId((current) => (current === id ? null : id))\n\n return (\n <View\n className={cn('bg-background-base', className)}\n style={{ width: 390 }}\n accessibilityRole={'main' as ViewProps['accessibilityRole']}\n aria-label={exercise.name}\n testID=\"exercise-detail-page\"\n {...props}\n >\n <View style={{ padding: 16, gap: 14 }} testID=\"exercise-detail-page-content\">\n <View\n className=\"flex-row items-start justify-between\"\n style={{ gap: 8 }}\n testID=\"exercise-detail-page-header\"\n >\n <View style={{ flexShrink: 1 }}>\n <Text\n accessibilityRole=\"header\"\n className=\"text-text-primary\"\n style={{\n fontSize: 20,\n fontFamily: '\"Space Grotesk\", sans-serif',\n fontWeight: '700',\n }}\n testID=\"exercise-detail-page-title\"\n >\n {exercise.name}\n </Text>\n <Text\n className=\"text-text-secondary\"\n style={{\n marginTop: 2,\n fontSize: 12,\n fontFamily: 'Inter, sans-serif',\n }}\n testID=\"exercise-detail-page-subtitle\"\n >\n {exercise.subtitle}\n </Text>\n </View>\n {exercise.currentE1rm != null && (\n <View\n style={{\n paddingVertical: 4,\n paddingHorizontal: 10,\n borderRadius: 6,\n backgroundColor: 'rgba(255,121,0,0.10)',\n borderWidth: 1,\n borderColor: 'rgba(255,121,0,0.25)',\n }}\n testID=\"exercise-detail-page-e1rm\"\n >\n <Text\n className=\"text-text-tertiary\"\n style={{\n fontSize: 9,\n fontFamily: 'Inter, sans-serif',\n fontWeight: '600',\n letterSpacing: 0.4,\n textTransform: 'uppercase',\n }}\n >\n e1RM\n </Text>\n <Text\n style={{\n fontSize: 15,\n fontFamily: '\"Space Grotesk\", sans-serif',\n fontWeight: '700',\n color: BRAND_PRIMARY,\n }}\n >\n {`${exercise.currentE1rm} ${exercise.unit}`}\n </Text>\n </View>\n )}\n </View>\n\n <TabBar active={tab} onSelect={setTab} />\n\n {tab === 'progress' && (\n <View style={{ gap: 14 }} testID=\"exercise-detail-page-panel-progress\">\n <MesoStatusCard {...meso} />\n <StatStrip stats={stats} unit={exercise.unit} />\n <SectionCard title=\"Strength Trend\" testID=\"exercise-detail-page-trend\">\n <StrengthTrendChart\n data={trend.data}\n projection={trend.projection}\n mesoBoundaries={trend.mesoBoundaries}\n width={CHART_WIDTH}\n height={CHART_HEIGHT}\n unit={exercise.unit}\n animateOnMount={false}\n />\n </SectionCard>\n <SectionCard title=\"Week-by-Week\" testID=\"exercise-detail-page-progression\">\n <EntryList\n entries={progression}\n expandedId={expandedProgressId}\n onToggle={toggle(setExpandedProgressId)}\n emptyLabel=\"No progression logged yet\"\n testID=\"exercise-detail-page-progression-list\"\n />\n </SectionCard>\n </View>\n )}\n\n {tab === 'history' && (\n <View style={{ gap: 14 }} testID=\"exercise-detail-page-panel-history\">\n <SectionCard title=\"All Sessions\" testID=\"exercise-detail-page-history\">\n <EntryList\n entries={history}\n expandedId={expandedHistoryId}\n onToggle={toggle(setExpandedHistoryId)}\n emptyLabel=\"No sessions logged yet\"\n testID=\"exercise-detail-page-history-list\"\n />\n </SectionCard>\n </View>\n )}\n\n {tab === 'advanced' && (\n <View style={{ gap: 14 }} testID=\"exercise-detail-page-panel-advanced\">\n <SectionCard title=\"Capacity Band\" testID=\"exercise-detail-page-capacity\">\n <CapacityBandChart\n band={vbt.band}\n workouts={vbt.workouts}\n projection={vbt.projection}\n width={CHART_WIDTH}\n height={CHART_HEIGHT}\n />\n </SectionCard>\n <VbtSummaryRow summary={vbtSummary} />\n <SectionCard title=\"Velocity Breakdown\" testID=\"exercise-detail-page-velocity\">\n <VbtBreakdown sets={vbt.sets} zones={vbt.zones} />\n </SectionCard>\n </View>\n )}\n </View>\n </View>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { useState } from 'react'\nimport { View, Pressable, Animated, type ViewProps } from 'react-native'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\n\nconst BRAND_PRIMARY = getSemanticColors('dark')['brand-primary']\n\nexport type MesoStatus = 'completed' | 'current' | 'upcoming'\n\nexport interface Meso {\n id: string\n name: string\n weekCount: number\n status: MesoStatus\n /**\n * 1-based week index of progress within a `current` meso.\n * Drives the solid fill width. Ignored for non-current mesos.\n */\n currentWeek?: number\n}\n\nexport interface MesoProgressBarProps extends ViewProps {\n mesos: Meso[]\n activeMesoId: string | null\n onMesoPress: (mesoId: string) => void\n className?: string\n}\n\nconst segmentBgColors: Record<MesoStatus, string> = {\n completed: 'rgba(46,213,115,0.3)',\n current: 'rgba(255,121,0,0.5)',\n upcoming: 'rgba(255,255,255,0.06)',\n}\n\nfunction clampProgress(currentWeek: number | undefined, weekCount: number): number {\n if (currentWeek == null || weekCount <= 0) return 0\n const ratio = currentWeek / weekCount\n return Math.max(0, Math.min(1, ratio))\n}\n\ninterface SegmentProps {\n meso: Meso\n isActive: boolean\n onPress: (id: string) => void\n}\n\nfunction MesoSegment({ meso, isActive, onPress }: SegmentProps) {\n const [pressScale] = useState(() => new Animated.Value(1))\n\n const handlePressIn = () => {\n Animated.timing(pressScale, {\n toValue: 0.98,\n duration: 150,\n useNativeDriver: true,\n }).start()\n }\n\n const handlePressOut = () => {\n Animated.timing(pressScale, {\n toValue: 1,\n duration: 150,\n useNativeDriver: true,\n }).start()\n }\n\n const progress = meso.status === 'current'\n ? clampProgress(meso.currentWeek, meso.weekCount)\n : 0\n\n // weekCount drives the segment's flex width; guard 0 / negative so flex stays\n // a valid positive value and the segment never collapses out of the layout.\n const segmentFlex = Math.max(1, meso.weekCount)\n\n return (\n <Pressable\n style={{ flex: segmentFlex }}\n onPress={() => onPress(meso.id)}\n onPressIn={handlePressIn}\n onPressOut={handlePressOut}\n accessibilityRole=\"button\"\n accessibilityLabel={`${meso.name}, ${meso.status}`}\n testID={`meso-segment-${meso.id}`}\n >\n <Animated.View\n style={[\n {\n height: 8,\n borderRadius: 4,\n overflow: 'hidden',\n backgroundColor: segmentBgColors[meso.status],\n transform: [{ scale: pressScale }],\n },\n isActive\n ? {\n borderWidth: 2,\n borderColor: BRAND_PRIMARY,\n transform: [{ scale: 1.02 }, { scale: pressScale }],\n }\n : undefined,\n ]}\n testID={`meso-segment-inner-${meso.id}`}\n >\n {meso.status === 'current' && progress > 0 && (\n <View\n style={{\n position: 'absolute',\n left: 0,\n top: 0,\n bottom: 0,\n width: `${progress * 100}%`,\n backgroundColor: BRAND_PRIMARY,\n }}\n testID={`meso-segment-fill-${meso.id}`}\n />\n )}\n </Animated.View>\n </Pressable>\n )\n}\n\n/**\n * Segmented horizontal bar of mesocycles. Each segment is tappable and its\n * flex width is proportional to the meso's `weekCount`. The active segment is\n * highlighted with a 2px brand border to stay in sync with MesoCard selection.\n *\n * @example\n * <MesoProgressBar\n * mesos={[\n * { id: 'm1', name: 'Accumulation', weekCount: 4, status: 'completed' },\n * { id: 'm2', name: 'Intensification', weekCount: 3, status: 'current', currentWeek: 2 },\n * { id: 'm3', name: 'Peak', weekCount: 2, status: 'upcoming' },\n * ]}\n * activeMesoId=\"m2\"\n * onMesoPress={(id) => console.log(id)}\n * />\n */\nexport function MesoProgressBar({\n mesos,\n activeMesoId,\n onMesoPress,\n className,\n ...props\n}: MesoProgressBarProps) {\n return (\n <View\n className={className}\n style={{\n flexDirection: 'row',\n gap: 2,\n paddingHorizontal: 16,\n alignItems: 'center',\n }}\n testID=\"meso-progress-bar\"\n {...props}\n >\n {mesos.map((meso) => (\n <MesoSegment\n key={meso.id}\n meso={meso}\n isActive={meso.id === activeMesoId}\n onPress={onMesoPress}\n />\n ))}\n </View>\n )\n}\n","import { View, type ViewProps } from 'react-native'\nimport { cn } from '../../../utils/cn'\n\nexport type IndicatorSize = 'xs' | 'sm' | 'md' | 'lg'\nexport type IndicatorColor =\n | 'default'\n | 'primary'\n | 'success'\n | 'live'\n | 'error'\n | 'warning'\n | 'info'\n | 'error-vivid'\n\n/** How a pulsing indicator animates: a subtle opacity fade, or an expanding ring. */\nexport type IndicatorPulse = 'opacity' | 'ping'\n\nexport interface IndicatorProps extends ViewProps {\n /** Dot size */\n size?: IndicatorSize\n /** Semantic color */\n color?: IndicatorColor\n /** Custom hex color (overrides color prop) */\n customColor?: string\n /** Add a glow shadow effect */\n glow?: boolean\n /** Add a ring border */\n ring?: boolean\n /** Animate for live/active status. `true` = opacity fade; `'ping'` = expanding ring. */\n pulse?: boolean | IndicatorPulse\n /** Additional className */\n className?: string\n}\n\nconst sizeStyles: Record<IndicatorSize, string> = {\n xs: 'w-1 h-1',\n sm: 'w-1.5 h-1.5',\n md: 'w-2 h-2',\n lg: 'w-2.5 h-2.5',\n}\n\nconst colorStyles: Record<IndicatorColor, string> = {\n default: 'bg-text-tertiary',\n primary: 'bg-brand-primary',\n success: 'bg-status-success',\n live: 'bg-status-live',\n error: 'bg-status-error',\n warning: 'bg-status-warning',\n info: 'bg-status-info',\n 'error-vivid': 'bg-status-error-vivid',\n}\n\nexport function Indicator({\n size = 'sm',\n color = 'default',\n customColor,\n glow = false,\n ring = false,\n pulse = false,\n className,\n style,\n ...props\n}: IndicatorProps) {\n const pulseMode: IndicatorPulse | false = pulse === true ? 'opacity' : pulse || false\n const colorClass = !customColor ? colorStyles[color] : undefined\n const colorStyle = customColor ? { backgroundColor: customColor } : undefined\n\n // Expanding-ring pulse: a ping layer behind the solid dot (for live/active status).\n if (pulseMode === 'ping') {\n return (\n <View className={cn('relative', sizeStyles[size], className)} style={style} {...props}>\n <View\n className={cn('absolute inset-0 rounded-full animate-ping', colorClass)}\n style={colorStyle}\n />\n <View\n className={cn(\n 'relative rounded-full',\n sizeStyles[size],\n colorClass,\n ring && 'border-2 border-background-base'\n )}\n style={colorStyle}\n />\n </View>\n )\n }\n\n const dynamicStyle = {\n ...(typeof style === 'object' ? style : {}),\n ...(colorStyle ?? {}),\n ...(glow && customColor ? { boxShadow: `0 0 6px ${customColor}` } : {}),\n }\n\n return (\n <View\n className={cn(\n 'rounded-full shrink-0',\n sizeStyles[size],\n colorClass,\n pulseMode === 'opacity' && 'animate-pulse',\n ring && 'border-2 border-background-base',\n glow &&\n !customColor &&\n (color === 'success' || color === 'live') &&\n 'shadow-[0_0_6px_rgba(46,213,115,0.6)]',\n glow && !customColor && color === 'error' && 'shadow-[0_0_6px_rgba(239,68,68,0.6)]',\n glow && !customColor && color === 'warning' && 'shadow-[0_0_6px_rgba(245,158,11,0.6)]',\n glow && !customColor && color === 'primary' && 'shadow-[0_0_6px_rgba(255,121,0,0.6)]',\n glow && !customColor && color === 'error-vivid' && 'shadow-[0_0_6px_rgba(255,71,87,0.6)]',\n className\n )}\n style={Object.keys(dynamicStyle).length > 0 ? dynamicStyle : style}\n {...props}\n />\n )\n}\n","import React from 'react'\nimport { View, Text, type ViewProps } from 'react-native'\nimport { cn } from '../../../utils/cn'\nimport { Indicator, type IndicatorColor } from '../indicator'\n\nexport type BadgeVariant = 'solid' | 'subtle' | 'outline'\nexport type BadgeColor = 'default' | 'primary' | 'secondary' | 'success' | 'error' | 'warning' | 'info'\nexport type BadgeSize = 'sm' | 'md' | 'lg'\n\nexport interface BadgeProps extends ViewProps {\n /** Visual variant */\n variant?: BadgeVariant\n /** Color scheme */\n color?: BadgeColor\n /** Size */\n size?: BadgeSize\n /** Show a leading indicator dot */\n dot?: boolean\n /** Color for the dot indicator (defaults to match badge color) */\n dotColor?: IndicatorColor\n /** Additional className */\n className?: string\n children?: React.ReactNode\n}\n\nconst variantColorStyles: Record<BadgeVariant, Record<BadgeColor, string>> = {\n solid: {\n default: 'bg-border-strong text-text-inverse',\n primary: 'bg-brand-primary text-text-inverse',\n secondary: 'bg-brand-secondary text-text-inverse',\n success: 'bg-status-success text-text-inverse',\n error: 'bg-status-error text-text-inverse',\n warning: 'bg-status-warning text-text-inverse',\n info: 'bg-status-info text-text-inverse',\n },\n subtle: {\n default: 'bg-surface-raised text-text-secondary',\n primary: 'bg-brand-primary-subtle text-brand-primary',\n secondary: 'bg-brand-secondary-subtle text-brand-secondary',\n success: 'bg-status-success-subtle text-status-success',\n error: 'bg-status-error-subtle text-status-error',\n warning: 'bg-status-warning-subtle text-status-warning',\n info: 'bg-status-info-subtle text-status-info',\n },\n outline: {\n default: 'border border-border-strong text-text-secondary',\n primary: 'border border-brand-primary text-brand-primary',\n secondary: 'border border-brand-secondary text-brand-secondary',\n success: 'border border-status-success text-status-success',\n error: 'border border-status-error text-status-error',\n warning: 'border border-status-warning text-status-warning',\n info: 'border border-status-info text-status-info',\n },\n}\n\nconst sizeStyles: Record<BadgeSize, string> = {\n sm: 'px-1.5 py-0.5 text-xs',\n md: 'px-2 py-0.5 text-xs',\n lg: 'px-2.5 py-1 text-sm',\n}\n\n/**\n * Badge component for status indicators and labels.\n *\n * @example\n * <Badge color=\"success\">Active</Badge>\n * <Badge variant=\"outline\" color=\"warning\">Pending</Badge>\n */\nexport function Badge({\n variant = 'subtle',\n color = 'default',\n size = 'md',\n dot,\n dotColor,\n className,\n children,\n ...props\n}: BadgeProps) {\n return (\n <View\n className={cn(\n 'inline-flex items-center justify-center rounded-full font-medium',\n variantColorStyles[variant][color],\n sizeStyles[size],\n className\n )}\n {...props}\n >\n {dot && (\n <Indicator\n size=\"xs\"\n color={dotColor ?? (color === 'default' || color === 'secondary' ? 'default' : color as IndicatorColor)}\n className=\"mr-0.5\"\n />\n )}\n {typeof children === 'string' ? (\n <Text className=\"text-inherit font-medium\">{children}</Text>\n ) : (\n children\n )}\n </View>\n )\n}\n\nexport interface BadgeTextProps {\n children: React.ReactNode\n className?: string\n}\n\n/**\n * Text component for Badge content.\n */\nexport function BadgeText({ children, className }: BadgeTextProps) {\n return (\n <Text className={cn('text-inherit font-medium', className)}>\n {children}\n </Text>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { useEffect, useState } from 'react'\nimport { View, Text, Pressable, Animated, Easing, type ViewProps } from 'react-native'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\nimport { WORKOUT_PILL_DELOAD } from '../../../theme/extracted-colors-dataviz'\n\nconst t = getSemanticColors('dark')\n\n/**\n * Spec statuses: completed | current | upcoming | deload.\n * `next` and `missed` are additive extras supported by this implementation.\n */\nexport type WorkoutPillStatus = 'completed' | 'current' | 'upcoming' | 'deload' | 'next' | 'missed'\n\nexport interface WorkoutPillProps extends ViewProps {\n name: string\n status: WorkoutPillStatus\n /** Force pulsing animation. Defaults to pulsing only on `current` status. */\n pulse?: boolean\n onPress?: () => void\n highlighted?: boolean\n className?: string\n}\n\nconst statusBgColors: Record<WorkoutPillStatus, string> = {\n completed: 'rgba(46,213,115,0.15)',\n current: 'rgba(255,121,0,0.15)',\n next: 'transparent',\n upcoming: t['surface-raised'],\n missed: 'rgba(209,67,67,0.1)',\n deload: 'rgba(186,41,150,0.15)',\n}\n\nconst statusBorderStyles: Record<WorkoutPillStatus, Record<string, unknown>> = {\n completed: { borderWidth: 1, borderColor: 'rgba(46,213,115,0.3)' },\n current: { borderWidth: 1, borderColor: 'rgba(255,121,0,0.3)' },\n next: { borderWidth: 1, borderColor: 'rgba(255,121,0,0.4)' },\n upcoming: { borderWidth: 1, borderColor: '#1F1F1F' },\n missed: { borderWidth: 1, borderColor: 'rgba(209,67,67,0.25)' },\n deload: { borderWidth: 1, borderColor: 'rgba(186,41,150,0.3)' },\n}\n\nconst textColors: Record<WorkoutPillStatus, string> = {\n completed: t['status-success'],\n current: t['brand-primary'],\n next: t['brand-primary'],\n upcoming: '#6B7280',\n missed: 'rgba(209,67,67,0.7)',\n deload: WORKOUT_PILL_DELOAD,\n}\n\nfunction usePulse(enabled: boolean) {\n const [opacity] = useState(() => new Animated.Value(1))\n\n useEffect(() => {\n if (!enabled) {\n opacity.setValue(1)\n return\n }\n\n const animation = Animated.loop(\n Animated.sequence([\n Animated.timing(opacity, {\n toValue: 0.7,\n duration: 1000,\n easing: Easing.inOut(Easing.ease),\n useNativeDriver: true,\n }),\n Animated.timing(opacity, {\n toValue: 1,\n duration: 1000,\n easing: Easing.inOut(Easing.ease),\n useNativeDriver: true,\n }),\n ])\n )\n animation.start()\n\n return () => animation.stop()\n }, [enabled, opacity])\n\n return opacity\n}\n\nexport function WorkoutPill({\n name,\n status,\n pulse,\n onPress,\n highlighted = false,\n className,\n ...props\n}: WorkoutPillProps) {\n const shouldPulse = pulse ?? status === 'current'\n const pulseOpacity = usePulse(shouldPulse)\n const isCompleted = status === 'completed'\n const isMissed = status === 'missed'\n\n const pill = (\n <Animated.View\n style={shouldPulse ? { opacity: pulseOpacity } : undefined}\n testID=\"workout-pill\"\n >\n <View\n className={className}\n style={[\n {\n flexDirection: 'row',\n alignItems: 'center',\n paddingHorizontal: 10,\n paddingVertical: 4,\n borderRadius: 6,\n backgroundColor: statusBgColors[status],\n },\n statusBorderStyles[status] as Record<string, unknown>,\n highlighted ? { borderWidth: 2, transform: [{ scale: 1.02 }] } : undefined,\n ]}\n accessibilityLabel={onPress ? undefined : `${name} workout, ${status}`}\n {...props}\n >\n {isCompleted && (\n <Text\n style={{\n fontWeight: '600',\n fontFamily: '\"Nunito Sans\", sans-serif',\n fontSize: 11,\n color: textColors[status],\n marginRight: 4,\n }}\n accessibilityElementsHidden\n testID=\"workout-pill-check\"\n >\n {'\\u2713'}\n </Text>\n )}\n {isMissed && (\n <Text\n style={{\n fontWeight: '600',\n fontFamily: '\"Nunito Sans\", sans-serif',\n fontSize: 11,\n color: textColors[status],\n marginRight: 4,\n }}\n accessibilityElementsHidden\n testID=\"workout-pill-dash\"\n >\n {'\\u2014'}\n </Text>\n )}\n <Text\n style={{\n fontWeight: '600',\n fontFamily: '\"Nunito Sans\", sans-serif',\n fontSize: 11,\n color: textColors[status],\n }}\n accessibilityElementsHidden={onPress != null}\n testID=\"workout-pill-name\"\n >\n {name}\n </Text>\n </View>\n </Animated.View>\n )\n\n if (onPress) {\n return (\n <Pressable\n onPress={onPress}\n accessibilityRole=\"button\"\n accessibilityLabel={`${name} workout, ${status}`}\n testID=\"workout-pill-pressable\"\n >\n {pill}\n </Pressable>\n )\n }\n\n return pill\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { useEffect, useState } from 'react'\nimport {\n View,\n Text,\n Animated,\n type ViewProps,\n type ViewStyle,\n type DimensionValue,\n} from 'react-native'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\nimport { WORKOUT_TOKENS } from '../../../theme/workout-tokens'\n\nconst t = getSemanticColors('dark')\n\nexport type IntensityBarOrientation = 'vertical' | 'horizontal'\n\nexport interface IntensityBarProps extends ViewProps {\n /** Current intensity level; 1 == 100% of target. Values >1 render as over-target. */\n level: number\n /** Target position 0-1. When the level sits at this target the fill gains an at-target glow. */\n threshold?: number\n /** Orientation */\n orientation?: IntensityBarOrientation\n /** Height for vertical (default 24px) or width for horizontal */\n size?: number\n /** Width for vertical (default 6px) or height for horizontal */\n thickness?: number\n /** Show the \"MRV\" threshold label under the bar */\n showThresholdLabel?: boolean\n className?: string\n}\n\nconst TRACK_BG = '#333333'\nconst LABEL_COLOR = '#6B7280'\nconst TARGET_LINE_COLOR = 'rgba(33, 150, 243, 0.5)'\nconst AT_TARGET_GLOW = '0 0 5px 1px rgba(33, 150, 243, 0.35), 0 0 10px 3px rgba(33, 150, 243, 0.15)'\n\n// Zone colors graded by TRUE percentage (level * 100).\nconst ZONE = {\n building: t['status-success'], // below target ramp-up\n approaching: t['status-warning'], // nearing target\n target: t['brand-primary'], // exactly at target\n over1: t['status-error'], // mild over-target\n over2: WORKOUT_TOKENS.intensity.over2, // moderate over-target\n over3: WORKOUT_TOKENS.intensity.over3, // severe over-target\n} as const\n\ntype OverTier = 0 | 1 | 2 | 3\n\ninterface Zone {\n color: string\n over: OverTier\n}\n\nconst BULGE_SIZE: Record<Exclude<OverTier, 0>, number> = { 1: 8, 2: 10, 3: 11 }\n\n/** Map a true percentage to its fill color and over-target tier. */\nfunction zoneForPct(pct: number): Zone {\n if (pct >= 125) return { color: ZONE.over3, over: 3 }\n if (pct >= 115) return { color: ZONE.over2, over: 2 }\n if (pct > 100) return { color: ZONE.over1, over: 1 }\n if (pct === 100) return { color: ZONE.target, over: 0 }\n if (pct >= 75) return { color: ZONE.approaching, over: 0 }\n return { color: ZONE.building, over: 0 }\n}\n\nfunction clampFill(value: number): number {\n if (value < 0) return 0\n if (value > 1) return 1\n return value\n}\n\n/** True when the level rests on the supplied target (within 5%). */\nfunction isAtTarget(pct: number, threshold?: number): boolean {\n if (threshold == null) return false\n return Math.abs(pct - Math.round(threshold * 100)) <= 5\n}\n\nexport function IntensityBar({\n level,\n threshold,\n orientation = 'vertical',\n size = 24,\n thickness = 6,\n showThresholdLabel,\n className,\n ...props\n}: IntensityBarProps) {\n const isVertical = orientation === 'vertical'\n const fillLevel = clampFill(level)\n const pct = Math.round(Math.max(0, level) * 100)\n const zone = zoneForPct(pct)\n const atTarget = isAtTarget(pct, threshold)\n\n const [fillAnim] = useState(() => new Animated.Value(fillLevel))\n\n useEffect(() => {\n const animation = Animated.timing(fillAnim, {\n toValue: fillLevel,\n duration: 250,\n useNativeDriver: false,\n })\n animation.start()\n return () => animation.stop()\n }, [fillLevel, fillAnim])\n\n const fillSizePercent = fillAnim.interpolate({\n inputRange: [0, 1],\n outputRange: ['0%', '100%'],\n })\n\n const trackStyle = isVertical\n ? { width: thickness, height: size }\n : { width: size, height: thickness }\n\n const fillStyle = isVertical\n ? { position: 'absolute' as const, bottom: 0, left: 0, right: 0, height: fillSizePercent }\n : { position: 'absolute' as const, top: 0, bottom: 0, left: 0, width: fillSizePercent }\n\n const bulgeSize = zone.over === 0 ? 0 : BULGE_SIZE[zone.over]\n const bulgeStyle: ViewStyle = {\n position: 'absolute',\n width: bulgeSize,\n height: bulgeSize,\n borderRadius: bulgeSize / 2,\n backgroundColor: zone.color,\n zIndex: 1,\n ...(isVertical\n ? { top: 0, left: '50%', transform: [{ translateX: -bulgeSize / 2 }] }\n : { right: 0, top: '50%', transform: [{ translateY: -bulgeSize / 2 }] }),\n }\n\n const targetPct: DimensionValue = `${clampFill(threshold ?? 0) * 100}%`\n const targetLineStyle: ViewStyle = isVertical\n ? {\n position: 'absolute',\n bottom: targetPct,\n left: -3,\n right: -3,\n height: 1.5,\n backgroundColor: TARGET_LINE_COLOR,\n zIndex: 4,\n }\n : {\n position: 'absolute',\n left: targetPct,\n top: -3,\n bottom: -3,\n width: 1.5,\n backgroundColor: TARGET_LINE_COLOR,\n zIndex: 4,\n }\n\n return (\n <View\n className={className}\n style={{ alignItems: 'center' }}\n accessibilityRole=\"progressbar\"\n accessibilityValue={{ min: 0, max: 100, now: pct }}\n accessibilityLabel={`Intensity level: ${pct}%`}\n testID=\"intensity-bar\"\n {...props}\n >\n <View\n style={{\n ...trackStyle,\n borderRadius: 3,\n backgroundColor: TRACK_BG,\n position: 'relative',\n overflow: 'visible',\n }}\n accessibilityElementsHidden\n >\n <Animated.View\n style={{\n ...fillStyle,\n borderRadius: 3,\n backgroundColor: zone.color,\n zIndex: 2,\n ...(atTarget ? { boxShadow: AT_TARGET_GLOW } : null),\n }}\n testID=\"intensity-fill\"\n />\n\n {zone.over !== 0 && <View style={bulgeStyle} testID=\"intensity-bulge\" />}\n\n {threshold != null && <View style={targetLineStyle} testID=\"intensity-target\" />}\n </View>\n\n <Text\n style={{\n fontSize: 8,\n color: LABEL_COLOR,\n fontFamily: '\"Nunito Sans\", sans-serif',\n marginTop: 6,\n }}\n accessibilityElementsHidden\n testID=\"intensity-label\"\n >\n {pct}%\n </Text>\n\n {showThresholdLabel && threshold != null && (\n <Text\n style={{\n fontSize: 8,\n fontWeight: '500',\n color: LABEL_COLOR,\n fontFamily: 'Inter, sans-serif',\n marginTop: 2,\n }}\n accessibilityElementsHidden\n testID=\"intensity-threshold-label\"\n >\n MRV\n </Text>\n )}\n </View>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { View, Text, type ViewProps } from 'react-native'\nimport { WorkoutPill, type WorkoutPillStatus } from './WorkoutPill'\nimport { IntensityBar } from './IntensityBar'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\n\nconst BRAND_PRIMARY = getSemanticColors('dark')['brand-primary']\n\nexport interface WeekRowWorkout {\n name: string\n status: WorkoutPillStatus\n onPress?: () => void\n}\n\nexport interface WeekRowProps extends ViewProps {\n /** Week index within the mesocycle (1-based) */\n weekNumber: number\n /** Total weeks in the mesocycle */\n totalWeeks: number\n /** Workouts scheduled for this week */\n workouts: WeekRowWorkout[]\n /** Planned intensity for the week, 0-1 */\n intensityLevel: number\n /** Optional MRV/overexertion threshold, 0-1 */\n intensityThreshold?: number\n /** Highlights this row as the active week */\n isCurrent?: boolean\n /** Renders this row as a deload week (purple tint, deload pills) */\n isDeload?: boolean\n className?: string\n}\n\n/**\n * A single week within a mesocycle, showing the week number, its workout pills,\n * and a right-aligned vertical intensity indicator.\n *\n * @example\n * <WeekRow\n * weekNumber={1}\n * totalWeeks={4}\n * workouts={[\n * { name: 'Upper', status: 'completed' },\n * { name: 'Lower', status: 'current' },\n * ]}\n * intensityLevel={0.55}\n * intensityThreshold={0.8}\n * isCurrent\n * />\n */\nexport function WeekRow({\n weekNumber,\n totalWeeks,\n workouts,\n intensityLevel,\n intensityThreshold,\n isCurrent = false,\n isDeload = false,\n className,\n ...props\n}: WeekRowProps) {\n const rowStyle: Record<string, unknown> = {\n flexDirection: 'row' as const,\n alignItems: 'center' as const,\n paddingVertical: 10,\n paddingHorizontal: 12,\n gap: 12,\n }\n\n if (isDeload) {\n rowStyle.backgroundColor = 'rgba(186,41,150,0.06)'\n }\n\n if (isCurrent) {\n rowStyle.backgroundColor = 'rgba(255,121,0,0.04)'\n rowStyle.borderLeftWidth = 2\n rowStyle.borderLeftColor = BRAND_PRIMARY\n }\n\n return (\n <View\n className={className}\n style={rowStyle}\n accessibilityLabel={`Week ${weekNumber} of ${totalWeeks}, ${workouts.length} workouts`}\n testID=\"week-row\"\n {...props}\n >\n <View\n style={{ flexDirection: 'row', alignItems: 'center', width: 32, gap: 4 }}\n testID=\"week-row-number\"\n >\n {isCurrent && (\n <View\n style={{\n width: 6,\n height: 6,\n borderRadius: 3,\n backgroundColor: BRAND_PRIMARY,\n }}\n accessibilityElementsHidden\n testID=\"week-row-current-dot\"\n />\n )}\n <Text\n className={isCurrent ? undefined : 'text-text-primary'}\n style={{\n fontSize: 13,\n fontWeight: '700',\n fontFamily: 'Inter, sans-serif',\n color: isCurrent ? BRAND_PRIMARY : undefined,\n }}\n accessibilityElementsHidden\n >\n {`W${weekNumber}`}\n </Text>\n </View>\n\n <View\n style={{ flex: 1, flexDirection: 'row', alignItems: 'center', flexWrap: 'wrap', gap: 6 }}\n testID=\"week-row-pills\"\n >\n {workouts.map((workout, i) => (\n <WorkoutPill\n key={i}\n name={workout.name}\n status={isDeload ? 'deload' : workout.status}\n onPress={workout.onPress}\n />\n ))}\n </View>\n\n <View testID=\"week-row-intensity\">\n <IntensityBar\n level={intensityLevel}\n threshold={intensityThreshold}\n orientation=\"vertical\"\n size={24}\n thickness={6}\n />\n </View>\n </View>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { useEffect, useState } from 'react'\nimport { View, Text, Pressable, Animated, Easing, type ViewProps } from 'react-native'\nimport { Card } from '../../ui/card'\nimport { Badge } from '../../ui/badge'\nimport { WeekRow, type WeekRowProps } from './WeekRow'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\nimport {\n MESO_ACCENT_GRADIENT_DARK,\n MESO_ACCENT_GRADIENT_LIGHT,\n} from '../../../theme/extracted-colors-dataviz'\n\nconst BRAND_PRIMARY = getSemanticColors('dark')['brand-primary']\nconst BRAND_PRIMARY_DARK = MESO_ACCENT_GRADIENT_DARK\nconst BRAND_PRIMARY_LIGHT = MESO_ACCENT_GRADIENT_LIGHT\nconst BORDER_DEFAULT = '#1F1F1F'\n\n/** Gradient stops for the 3px top accent: dark -> primary -> light. */\nconst ACCENT_STOPS = [BRAND_PRIMARY_DARK, BRAND_PRIMARY, BRAND_PRIMARY_LIGHT]\n\nexport interface MesoVolumeHeatmapEntry {\n /** Muscle group identifier (free-form to match plan data). */\n group: string\n /** Planned volume intensity for the group, 0-100. */\n percentage: number\n}\n\nexport interface MesoCardProps extends ViewProps {\n /** Mesocycle name, e.g. \"Accumulation\". */\n name: string\n /** Training goal, e.g. \"Hypertrophy\", \"Strength\", \"Peaking\". */\n goal: string\n /** Training split, e.g. \"Upper/Lower\", \"Push/Pull/Legs\". */\n split: string\n /** Week range label, e.g. \"Weeks 1-4\". */\n weekRange: string\n /** Current week within the mesocycle (1-based). */\n currentWeek?: number\n /** Total weeks in the mesocycle. */\n totalWeeks: number\n /** Weeks rendered as a WeekRow list when expanded. */\n weeks: WeekRowProps[]\n /** Whether the card is expanded to reveal the week list. */\n expanded?: boolean\n /** Toggles expansion; makes the header a button when provided. */\n onToggle?: () => void\n /** Whether this meso is highlighted in the MesoProgressBar. */\n highlighted?: boolean\n /** Volume heatmap data per muscle group for the meso. */\n volumeHeatmap?: MesoVolumeHeatmapEntry[]\n className?: string\n}\n\n/**\n * Maps a 0-100 volume percentage onto a brand-primary tint whose opacity\n * tracks intensity, keeping a visible floor so low-volume groups stay legible.\n */\nfunction heatmapColor(percentage: number): string {\n const clamped = Math.max(0, Math.min(100, percentage))\n const opacity = 0.12 + (clamped / 100) * 0.78\n return `rgba(255,121,0,${opacity.toFixed(3)})`\n}\n\n/**\n * A mesocycle card with name, goal, split, week range, an optional volume\n * heatmap strip, and an expandable WeekRow list. Highlighting animates the\n * border toward brand-primary with a subtle glow to stay in sync with the\n * MesoProgressBar.\n *\n * @example\n * <MesoCard\n * name=\"Accumulation\"\n * goal=\"Hypertrophy\"\n * split=\"Upper/Lower\"\n * weekRange=\"Weeks 1-4\"\n * currentWeek={2}\n * totalWeeks={4}\n * weeks={weeks}\n * volumeHeatmap={[{ group: 'chest', percentage: 80 }]}\n * expanded\n * onToggle={() => {}}\n * highlighted\n * />\n */\nexport function MesoCard({\n name,\n goal,\n split,\n weekRange,\n currentWeek,\n totalWeeks,\n weeks,\n expanded = false,\n onToggle,\n highlighted = false,\n volumeHeatmap,\n className,\n ...props\n}: MesoCardProps) {\n const isExpandable = onToggle != null\n const [highlight] = useState(() => new Animated.Value(highlighted ? 1 : 0))\n\n useEffect(() => {\n const animation = Animated.timing(highlight, {\n toValue: highlighted ? 1 : 0,\n duration: 250,\n easing: Easing.out(Easing.ease),\n useNativeDriver: false,\n })\n animation.start()\n return () => animation.stop()\n }, [highlighted, highlight])\n\n const borderColor = highlight.interpolate({\n inputRange: [0, 1],\n outputRange: [BORDER_DEFAULT, BRAND_PRIMARY],\n })\n\n const header = (\n <View style={{ paddingHorizontal: 14, paddingTop: 12, paddingBottom: 10 }} testID=\"meso-card-body\">\n <View className=\"flex-row items-center\" style={{ gap: 8 }} testID=\"meso-card-header\">\n <Text\n className=\"text-text-primary\"\n style={{\n fontSize: 15,\n fontFamily: '\"Space Grotesk\", sans-serif',\n fontWeight: '700',\n }}\n testID=\"meso-card-name\"\n >\n {name}\n </Text>\n <Badge variant=\"subtle\" color=\"primary\" size=\"sm\" testID=\"meso-card-goal-badge\">\n {goal}\n </Badge>\n </View>\n\n <Text\n className=\"text-text-secondary\"\n style={{\n marginTop: 4,\n fontSize: 12,\n fontFamily: 'Inter, sans-serif',\n }}\n testID=\"meso-card-subheader\"\n >\n {`${split} · ${weekRange}`}\n </Text>\n\n {volumeHeatmap && volumeHeatmap.length > 0 && (\n <View\n className=\"flex-row items-center\"\n style={{ marginTop: 10, gap: 3 }}\n accessibilityElementsHidden\n testID=\"meso-card-heatmap\"\n >\n {volumeHeatmap.map((entry) => (\n <View\n key={entry.group}\n style={{\n flex: 1,\n height: 8,\n borderRadius: 2,\n backgroundColor: heatmapColor(entry.percentage),\n }}\n testID=\"meso-card-heatmap-cell\"\n />\n ))}\n </View>\n )}\n </View>\n )\n\n return (\n <Animated.View style={highlighted ? { transform: [{ scale: 1.0 }] } : undefined} testID=\"meso-card-wrapper\">\n <Card\n variant=\"outline\"\n elevation={2}\n borderColor={highlighted ? BRAND_PRIMARY : BORDER_DEFAULT}\n className={className}\n style={[\n { borderColor: borderColor as unknown as string },\n highlighted\n ? { boxShadow: '0 0 12px 2px rgba(255,121,0,0.25)' }\n : undefined,\n ]}\n testID=\"meso-card\"\n {...props}\n >\n <View\n className=\"flex-row\"\n style={{ position: 'absolute', top: 0, left: 0, right: 0, height: 3, zIndex: 1 }}\n accessibilityElementsHidden\n testID=\"meso-card-accent\"\n >\n {ACCENT_STOPS.map((color) => (\n <View key={color} style={{ flex: 1, backgroundColor: color }} />\n ))}\n </View>\n\n {isExpandable ? (\n <Pressable\n onPress={onToggle}\n accessibilityRole=\"button\"\n accessibilityLabel={`${name}, ${goal}, ${weekRange}`}\n aria-expanded={expanded}\n testID=\"meso-card-toggle\"\n >\n {header}\n </Pressable>\n ) : (\n <View\n accessibilityLabel={`${name}, ${goal}, ${weekRange}`}\n testID=\"meso-card-static\"\n >\n {header}\n </View>\n )}\n\n {expanded && weeks.length > 0 && (\n <View\n style={{ borderTopWidth: 1, borderTopColor: BORDER_DEFAULT }}\n testID=\"meso-card-weeks\"\n >\n {weeks.map((week) => (\n <WeekRow\n key={week.weekNumber}\n {...week}\n totalWeeks={week.totalWeeks ?? totalWeeks}\n isCurrent={week.isCurrent ?? week.weekNumber === currentWeek}\n />\n ))}\n </View>\n )}\n </Card>\n </Animated.View>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { View, Text, Pressable, type ViewProps } from 'react-native'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\n\nconst t = getSemanticColors('dark')\n\n// Aliases for spec compatibility: under=behind, maintenance=ontrack, productive=target\nexport type VolumeStatus = 'untrained' | 'behind' | 'ontrack' | 'target' | 'over'\n\nexport interface MuscleGroupChipProps extends ViewProps {\n name: string\n volumeStatus?: VolumeStatus\n onPress?: () => void\n className?: string\n}\n\nconst dotColorMap: Record<VolumeStatus, string> = {\n untrained: '#2C2C2C',\n behind: t['brand-secondary'],\n ontrack: t['status-success'],\n target: t['brand-primary'],\n over: t['status-error'],\n}\n\nexport function MuscleGroupChip({\n name,\n volumeStatus,\n onPress,\n className,\n ...props\n}: MuscleGroupChipProps) {\n const dotColor = volumeStatus\n ? dotColorMap[volumeStatus]\n : '#2C2C2C'\n\n const statusLabel = volumeStatus ?? 'no status'\n\n const content = (\n <View\n className={['bg-surface-raised border-border', className].filter(Boolean).join(' ')}\n style={{\n flexDirection: 'row',\n alignItems: 'center',\n borderRadius: 9999,\n paddingHorizontal: 9,\n paddingVertical: 3,\n borderWidth: 1,\n }}\n accessibilityLabel={onPress ? undefined : `${name}, volume status: ${statusLabel}`}\n testID=\"muscle-group-chip\"\n {...props}\n >\n <View\n style={{\n width: 6,\n height: 6,\n borderRadius: 9999,\n marginRight: 5,\n flexShrink: 0,\n backgroundColor: dotColor,\n }}\n accessibilityElementsHidden\n testID=\"muscle-group-chip-dot\"\n />\n <Text\n className=\"text-text-secondary\"\n style={{\n fontFamily: 'Inter, sans-serif',\n fontWeight: '500',\n fontSize: 11,\n }}\n accessibilityElementsHidden\n >\n {name}\n </Text>\n </View>\n )\n\n if (onPress) {\n return (\n <Pressable\n onPress={onPress}\n accessibilityRole=\"button\"\n accessibilityLabel={`${name}, volume status: ${statusLabel}`}\n testID=\"muscle-group-chip-pressable\"\n >\n {content}\n </Pressable>\n )\n }\n\n return content\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { View, Text, ScrollView, Pressable, type ViewProps } from 'react-native'\nimport { Card } from '../../ui/card'\nimport { ExerciseCard, type ExerciseCardProps } from './ExerciseCard'\nimport {\n MuscleGroupChip,\n type VolumeStatus,\n} from './MuscleGroupChip'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\n\nconst t = getSemanticColors('dark')\n\nexport type WorkoutStatus = 'completed' | 'today' | 'upcoming'\n\n/** Spec volume-status vocabulary; mapped to MuscleGroupChip's VolumeStatus internally. */\nexport type WorkoutMuscleVolumeStatus =\n | 'under'\n | 'maintenance'\n | 'productive'\n | 'over'\n\nexport interface WorkoutMuscleGroup {\n /** Muscle group identifier (free-form to match plan data). */\n group: string\n /** Display label, may be abbreviated. */\n label: string\n /** Volume status relative to landmarks. */\n volumeStatus?: WorkoutMuscleVolumeStatus\n}\n\nexport interface WorkoutCardProps extends ViewProps {\n name: string\n date: string\n /** e.g. \"45 min\" */\n duration?: string\n status: WorkoutStatus\n muscleGroups: WorkoutMuscleGroup[]\n totalSets: number\n /** Total lbs/kg moved across the workout. */\n totalVolume?: number\n unit: 'lbs' | 'kg'\n exercises?: ExerciseCardProps[]\n expanded?: boolean\n onToggle?: () => void\n className?: string\n}\n\nconst COLORS = {\n statusSuccess: t['status-success'],\n brandPrimary: t['brand-primary'],\n borderDefault: '#1F1F1F',\n brandPrimarySubtle: 'rgba(255,121,0,0.06)',\n}\n\nconst statusBorderColors: Record<WorkoutStatus, string> = {\n completed: COLORS.statusSuccess,\n today: COLORS.brandPrimary,\n upcoming: COLORS.borderDefault,\n}\n\n/** Maps the spec's volume-status vocabulary onto MuscleGroupChip's enum. */\nconst volumeStatusMap: Record<WorkoutMuscleVolumeStatus, VolumeStatus> = {\n under: 'behind',\n maintenance: 'ontrack',\n productive: 'target',\n over: 'over',\n}\n\nfunction formatStats(\n totalSets: number,\n totalVolume: number | undefined,\n unit: 'lbs' | 'kg',\n duration: string | undefined,\n): string {\n const parts = [`${totalSets} sets`]\n if (totalVolume != null) parts.push(`${totalVolume} ${unit}`)\n if (duration) parts.push(duration)\n return parts.join(' · ')\n}\n\n/**\n * A workout within a week: name, date, duration, muscle-group pills, and a\n * stats summary. When expandable it renders contained ExerciseCards on expand.\n * Status drives a colored left border, today adds a brand tint, and upcoming\n * is dimmed.\n *\n * @example\n * <WorkoutCard\n * name=\"Upper A\"\n * date=\"Mon, Jun 23\"\n * duration=\"45 min\"\n * status=\"today\"\n * muscleGroups={[{ group: 'chest', label: 'Chest', volumeStatus: 'productive' }]}\n * totalSets={18}\n * totalVolume={12450}\n * unit=\"lbs\"\n * expanded\n * onToggle={() => {}}\n * exercises={exercises}\n * />\n */\nexport function WorkoutCard({\n name,\n date,\n duration,\n status,\n muscleGroups,\n totalSets,\n totalVolume,\n unit,\n exercises,\n expanded = false,\n onToggle,\n className,\n ...props\n}: WorkoutCardProps) {\n const isExpandable = onToggle != null\n const isUpcoming = status === 'upcoming'\n const isToday = status === 'today'\n\n const summary = (\n <View style={{ padding: 14 }} testID=\"workout-card-body\">\n <View className=\"flex-row items-center\" testID=\"workout-card-header\">\n <Text\n className=\"text-text-primary\"\n style={{\n fontSize: 15,\n fontFamily: '\"Space Grotesk\", sans-serif',\n fontWeight: '700',\n }}\n testID=\"workout-card-name\"\n >\n {name}\n </Text>\n <View className=\"flex-1\" />\n <Text\n className=\"text-text-tertiary\"\n style={{\n fontSize: 11,\n fontFamily: 'Inter, sans-serif',\n }}\n testID=\"workout-card-date\"\n >\n {date}\n </Text>\n </View>\n\n <Text\n className=\"text-text-secondary\"\n style={{\n marginTop: 4,\n fontSize: 12,\n fontFamily: 'Inter, sans-serif',\n }}\n testID=\"workout-card-stats\"\n >\n {formatStats(totalSets, totalVolume, unit, duration)}\n </Text>\n\n {muscleGroups.length > 0 && (\n <ScrollView\n horizontal\n showsHorizontalScrollIndicator={false}\n contentContainerStyle={{ gap: 5 }}\n style={{ marginTop: 8 }}\n testID=\"workout-card-muscle-groups\"\n >\n {muscleGroups.map((muscle) => (\n <MuscleGroupChip\n key={muscle.group}\n name={muscle.label}\n volumeStatus={\n muscle.volumeStatus\n ? volumeStatusMap[muscle.volumeStatus]\n : undefined\n }\n />\n ))}\n </ScrollView>\n )}\n </View>\n )\n\n return (\n <Card\n variant=\"accent\"\n elevation={1}\n accentColor={statusBorderColors[status]}\n bgColor={isToday ? COLORS.brandPrimarySubtle : undefined}\n className={className}\n style={isUpcoming ? { opacity: 0.6 } : undefined}\n testID=\"workout-card\"\n {...props}\n >\n {isExpandable ? (\n <Pressable\n onPress={onToggle}\n accessibilityRole=\"button\"\n accessibilityLabel={`${name} workout, ${date}, ${status}`}\n aria-expanded={expanded}\n testID=\"workout-card-toggle\"\n >\n {summary}\n </Pressable>\n ) : (\n <View\n accessibilityLabel={`${name} workout, ${date}, ${status}`}\n testID=\"workout-card-static\"\n >\n {summary}\n </View>\n )}\n\n {expanded && exercises && exercises.length > 0 && (\n <View\n style={{ paddingHorizontal: 8, paddingBottom: 8, gap: 6 }}\n testID=\"workout-card-exercises\"\n >\n {exercises.map((exercise, i) => (\n <ExerciseCard key={i} {...exercise} />\n ))}\n </View>\n )}\n </Card>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { useMemo, useState } from 'react'\nimport { View, Text, Pressable, type ViewProps } from 'react-native'\nimport { MesoProgressBar, type Meso, type MesoStatus } from './MesoProgressBar'\nimport { MesoCard, type MesoVolumeHeatmapEntry } from './MesoCard'\nimport { type WeekRowProps, type WeekRowWorkout } from './WeekRow'\nimport { WorkoutCard, type WorkoutStatus, type WorkoutMuscleGroup } from './WorkoutCard'\nimport { type WorkoutPillStatus } from './WorkoutPill'\nimport { type ExerciseCardProps } from './ExerciseCard'\nimport { cn } from '../../../utils/cn'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\n\nconst BRAND_PRIMARY = getSemanticColors('dark')['brand-primary']\n\n/** A single workout within a planned week, plus its exercise breakdown. */\nexport interface PlanWorkout {\n /** Stable identifier used for drill-down selection. */\n id: string\n name: string\n date: string\n duration?: string\n status: WorkoutStatus\n muscleGroups: WorkoutMuscleGroup[]\n totalSets: number\n totalVolume?: number\n unit: 'lbs' | 'kg'\n /** Exercises revealed when the workout is opened. */\n exercises: ExerciseCardProps[]\n}\n\n/** A training week inside a mesocycle. */\nexport interface PlanWeek {\n /** 1-based week index within the mesocycle. */\n weekNumber: number\n /** Planned intensity for the week, 0-1. */\n intensityLevel: number\n /** Optional MRV/overexertion threshold, 0-1. */\n intensityThreshold?: number\n isDeload?: boolean\n isCurrent?: boolean\n workouts: PlanWorkout[]\n}\n\n/** A mesocycle: the top level of the drill-down. */\nexport interface PlanMeso {\n id: string\n name: string\n goal: string\n split: string\n weekRange: string\n weekCount: number\n currentWeek?: number\n status: MesoStatus\n volumeHeatmap?: MesoVolumeHeatmapEntry[]\n weeks: PlanWeek[]\n}\n\n/** Current depth of the meso -> week -> workout drill-down. */\nexport type ProgramNavLevel = 'meso' | 'week' | 'workout'\n\n/** The navigation cursor within the active mesocycle. */\nexport interface ProgramSelection {\n weekNumber: number | null\n workoutId: string | null\n}\n\n/** One tappable step in the breadcrumb trail. */\nexport interface ProgramBreadcrumb {\n key: string\n label: string\n level: ProgramNavLevel\n}\n\nexport interface ProgramPlanningPageProps extends ViewProps {\n /** Page heading. */\n title?: string\n /** Mesocycles that make up the program. */\n mesos: PlanMeso[]\n className?: string\n}\n\n/** Map a workout's lifecycle status onto a WorkoutPill status. */\nconst WORKOUT_PILL_STATUS: Record<WorkoutStatus, WorkoutPillStatus> = {\n completed: 'completed',\n today: 'current',\n upcoming: 'upcoming',\n}\n\n/** Derive the current drill-down level from the selection cursor (pure). */\nexport function deriveNavLevel(selection: ProgramSelection): ProgramNavLevel {\n if (selection.workoutId != null) return 'workout'\n if (selection.weekNumber != null) return 'week'\n return 'meso'\n}\n\n/** Project the mesocycles onto MesoProgressBar segment data (pure). */\nexport function toProgressBarMesos(mesos: PlanMeso[]): Meso[] {\n return mesos.map(({ id, name, weekCount, status, currentWeek }) => ({\n id,\n name,\n weekCount,\n status,\n currentWeek,\n }))\n}\n\n/** Look up a meso by id, or null. */\nexport function findMeso(mesos: PlanMeso[], id: string | null): PlanMeso | null {\n if (id == null) return null\n return mesos.find((meso) => meso.id === id) ?? null\n}\n\n/** Look up a week within a meso, or null. */\nexport function findWeek(meso: PlanMeso | null, weekNumber: number | null): PlanWeek | null {\n if (meso == null || weekNumber == null) return null\n return meso.weeks.find((week) => week.weekNumber === weekNumber) ?? null\n}\n\n/** Look up a workout within a week, or null. */\nexport function findWorkout(week: PlanWeek | null, workoutId: string | null): PlanWorkout | null {\n if (week == null || workoutId == null) return null\n return week.workouts.find((workout) => workout.id === workoutId) ?? null\n}\n\n/** Build the breadcrumb trail for the active drill path (pure). */\nexport function buildBreadcrumbs(\n meso: PlanMeso,\n weekNumber: number | null,\n workout: PlanWorkout | null\n): ProgramBreadcrumb[] {\n const crumbs: ProgramBreadcrumb[] = [{ key: 'meso', label: meso.name, level: 'meso' }]\n if (weekNumber != null) {\n crumbs.push({ key: 'week', label: `Week ${weekNumber}`, level: 'week' })\n }\n if (workout != null) {\n crumbs.push({ key: 'workout', label: workout.name, level: 'workout' })\n }\n return crumbs\n}\n\ninterface BreadcrumbsProps {\n crumbs: ProgramBreadcrumb[]\n onNavigate: (level: ProgramNavLevel) => void\n}\n\nfunction Breadcrumbs({ crumbs, onNavigate }: BreadcrumbsProps) {\n return (\n <View\n className=\"flex-row items-center flex-wrap\"\n style={{ gap: 4 }}\n testID=\"program-planning-page-breadcrumbs\"\n >\n {crumbs.map((crumb, index) => {\n const isLast = index === crumbs.length - 1\n return (\n <View key={crumb.key} className=\"flex-row items-center\" style={{ gap: 4 }}>\n {index > 0 && (\n <Text className=\"text-text-tertiary\" style={{ fontSize: 12 }}>\n {'›'}\n </Text>\n )}\n <Pressable\n onPress={() => onNavigate(crumb.level)}\n disabled={isLast}\n accessibilityRole=\"button\"\n testID={`program-planning-page-crumb-${crumb.key}`}\n >\n <Text\n className={isLast ? 'text-text-primary' : undefined}\n style={{\n fontSize: 12,\n fontFamily: 'Inter, sans-serif',\n fontWeight: isLast ? '700' : '500',\n color: isLast ? undefined : BRAND_PRIMARY,\n }}\n >\n {crumb.label}\n </Text>\n </Pressable>\n </View>\n )\n })}\n </View>\n )\n}\n\n/** Project a plan week onto WeekRow props, wiring pill taps to week selection. */\nfunction toWeekRow(\n week: PlanWeek,\n meso: PlanMeso,\n onSelectWeek: (weekNumber: number) => void\n): WeekRowProps {\n const workouts: WeekRowWorkout[] = week.workouts.map((workout) => ({\n name: workout.name,\n status: WORKOUT_PILL_STATUS[workout.status],\n onPress: () => onSelectWeek(week.weekNumber),\n }))\n return {\n weekNumber: week.weekNumber,\n totalWeeks: meso.weekCount,\n workouts,\n intensityLevel: week.intensityLevel,\n intensityThreshold: week.intensityThreshold,\n isCurrent: week.isCurrent ?? week.weekNumber === meso.currentWeek,\n isDeload: week.isDeload,\n }\n}\n\ninterface MesoLevelProps {\n mesos: PlanMeso[]\n activeMesoId: string | null\n onSelectMeso: (id: string) => void\n onSelectWeek: (weekNumber: number) => void\n}\n\nfunction MesoLevel({ mesos, activeMesoId, onSelectMeso, onSelectWeek }: MesoLevelProps) {\n return (\n <View style={{ gap: 12 }} testID=\"program-planning-page-meso-level\">\n {mesos.map((meso) => {\n const expanded = meso.id === activeMesoId\n return (\n <MesoCard\n key={meso.id}\n name={meso.name}\n goal={meso.goal}\n split={meso.split}\n weekRange={meso.weekRange}\n currentWeek={meso.currentWeek}\n totalWeeks={meso.weekCount}\n weeks={expanded ? meso.weeks.map((week) => toWeekRow(week, meso, onSelectWeek)) : []}\n volumeHeatmap={meso.volumeHeatmap}\n expanded={expanded}\n onToggle={() => onSelectMeso(meso.id)}\n highlighted={expanded}\n />\n )\n })}\n </View>\n )\n}\n\ninterface WeekLevelProps {\n week: PlanWeek\n onSelectWorkout: (id: string) => void\n}\n\nfunction WeekLevel({ week, onSelectWorkout }: WeekLevelProps) {\n return (\n <View style={{ gap: 10 }} testID=\"program-planning-page-week-level\">\n {week.workouts.map((workout) => (\n <WorkoutCard\n key={workout.id}\n name={workout.name}\n date={workout.date}\n duration={workout.duration}\n status={workout.status}\n muscleGroups={workout.muscleGroups}\n totalSets={workout.totalSets}\n totalVolume={workout.totalVolume}\n unit={workout.unit}\n exercises={workout.exercises}\n expanded={false}\n onToggle={() => onSelectWorkout(workout.id)}\n />\n ))}\n </View>\n )\n}\n\ninterface WorkoutLevelProps {\n workout: PlanWorkout\n expandedExercise: number | null\n onToggleExercise: (index: number) => void\n}\n\nfunction WorkoutLevel({ workout, expandedExercise, onToggleExercise }: WorkoutLevelProps) {\n // `upcoming` cards ignore `expanded`, so it's safe to wire the toggle uniformly.\n const exercises = workout.exercises.map((exercise, index) => ({\n ...exercise,\n expanded: index === expandedExercise,\n onExpandedChange: () => onToggleExercise(index),\n }))\n return (\n <View testID=\"program-planning-page-workout-level\">\n <WorkoutCard\n name={workout.name}\n date={workout.date}\n duration={workout.duration}\n status={workout.status}\n muscleGroups={workout.muscleGroups}\n totalSets={workout.totalSets}\n totalVolume={workout.totalVolume}\n unit={workout.unit}\n exercises={exercises}\n expanded\n onToggle={() => undefined}\n />\n </View>\n )\n}\n\n/**\n * ProgramPlanningPage — a meso -> week -> workout drill-down over an entire\n * training program. A `MesoProgressBar` pins the mesocycle timeline to the top;\n * the body swaps between three levels: expandable `MesoCard`s (with inline\n * `WeekRow`s), a week's `WorkoutCard` list, and a single opened `WorkoutCard`\n * with inline `ExerciseCard` expansion. A breadcrumb trail tracks and rewinds\n * the drill path. Selection is page-level state; children keep their own styles.\n *\n * @example\n * <ProgramPlanningPage mesos={mesos} />\n */\nexport function ProgramPlanningPage({\n title = 'Program Plan',\n mesos,\n className,\n ...props\n}: ProgramPlanningPageProps) {\n const [activeMesoId, setActiveMesoId] = useState<string | null>(mesos[0]?.id ?? null)\n const [selectedWeek, setSelectedWeek] = useState<number | null>(null)\n const [selectedWorkoutId, setSelectedWorkoutId] = useState<string | null>(null)\n const [expandedExercise, setExpandedExercise] = useState<number | null>(null)\n\n const progressMesos = useMemo(() => toProgressBarMesos(mesos), [mesos])\n const activeMeso = findMeso(mesos, activeMesoId)\n const level = deriveNavLevel({ weekNumber: selectedWeek, workoutId: selectedWorkoutId })\n const activeWeek = findWeek(activeMeso, selectedWeek)\n const activeWorkout = findWorkout(activeWeek, selectedWorkoutId)\n\n const selectMeso = (id: string) => {\n setActiveMesoId(id)\n setSelectedWeek(null)\n setSelectedWorkoutId(null)\n }\n const selectWeek = (weekNumber: number) => {\n setSelectedWeek(weekNumber)\n setSelectedWorkoutId(null)\n setExpandedExercise(null)\n }\n const selectWorkout = (id: string) => {\n setSelectedWorkoutId(id)\n setExpandedExercise(null)\n }\n const toggleExercise = (index: number) =>\n setExpandedExercise((current) => (current === index ? null : index))\n\n const navigateTo = (target: ProgramNavLevel) => {\n if (target === 'meso') selectMeso(activeMesoId ?? mesos[0]?.id)\n else if (target === 'week' && selectedWeek != null) selectWeek(selectedWeek)\n }\n\n return (\n <View\n className={cn(className, 'bg-background-base')}\n style={{ width: 390 }}\n accessibilityRole={'main' as ViewProps['accessibilityRole']}\n aria-label={title}\n testID=\"program-planning-page\"\n {...props}\n >\n <View style={{ padding: 16, gap: 14 }} testID=\"program-planning-page-content\">\n <Text\n accessibilityRole=\"header\"\n className=\"text-text-primary\"\n style={{\n fontSize: 20,\n fontFamily: '\"Space Grotesk\", sans-serif',\n fontWeight: '700',\n }}\n testID=\"program-planning-page-title\"\n >\n {title}\n </Text>\n\n <View style={{ marginHorizontal: -16 }}>\n <MesoProgressBar\n mesos={progressMesos}\n activeMesoId={activeMesoId}\n onMesoPress={selectMeso}\n />\n </View>\n\n {activeMeso != null && (\n <Breadcrumbs\n crumbs={buildBreadcrumbs(activeMeso, selectedWeek, activeWorkout)}\n onNavigate={navigateTo}\n />\n )}\n\n <View\n className=\"bg-surface-elevated border-border\"\n style={{\n borderWidth: 1,\n borderRadius: 12,\n padding: 12,\n }}\n testID=\"program-planning-page-body\"\n >\n {level === 'meso' && (\n <MesoLevel\n mesos={mesos}\n activeMesoId={activeMesoId}\n onSelectMeso={selectMeso}\n onSelectWeek={selectWeek}\n />\n )}\n {level === 'week' && activeWeek != null && (\n <WeekLevel week={activeWeek} onSelectWorkout={selectWorkout} />\n )}\n {level === 'workout' && activeWorkout != null && (\n <WorkoutLevel\n workout={activeWorkout}\n expandedExercise={expandedExercise}\n onToggleExercise={toggleExercise}\n />\n )}\n </View>\n </View>\n </View>\n )\n}\n"]}
1
+ {"version":3,"sources":["../src/theme/tokens/primitives.ts","../src/theme/workout-tokens.ts","../src/theme/tokens/semantic.ts","../src/theme/color-utils.ts","../src/utils/colors.ts","../src/utils/workout-format.ts","../src/theme/materials.ts","../src/components/ui/surface/SurfaceContext.ts","../src/components/custom/charts/live-rep-growth.ts","../src/web-jsx/jsx-runtime.ts","../src/components/custom/charts/SetBarChart.tsx","../src/components/custom/Workout/VelocityStrip.tsx","../src/utils/cn.ts","../src/components/custom/Workout/PlaceholderStrip.tsx","../src/components/icons/SvgIcon.tsx","../src/components/icons/icons.tsx","../src/components/custom/Workout/BaseBadge.tsx","../src/components/custom/Workout/PrBadge.tsx","../src/components/custom/Workout/SetRow.tsx","../src/components/custom/Workout/SetTableHeader.tsx","../src/components/custom/Workout/metricText.tsx","../src/components/custom/Workout/SetsRepsLoad.tsx","../src/components/custom/Workout/TempoDisplay.tsx","../src/components/custom/Workout/ExerciseIndicator.tsx","../src/components/custom/Workout/ExerciseHeading.tsx","../src/components/custom/Workout/SegmentedBar.tsx","../src/components/custom/Workout/SetBar.tsx","../src/components/custom/Workout/SetStrip.tsx","../src/components/custom/Workout/ExerciseCardHeading.tsx","../src/components/custom/Workout/ExerciseCard.tsx","../src/theme/resolve-color.ts","../src/components/custom/Workout/InputBar.tsx","../src/hooks/useTimer.ts","../src/components/ui/progress/Progress.tsx","../src/components/custom/CircularTimer/CircularTimer.tsx","../src/components/custom/Workout/RestTimer.tsx","../src/components/custom/Workout/SupersetWrapper.tsx","../src/components/custom/Workout/ActiveWorkoutPage.tsx","../src/theme/elevation.ts","../src/utils/useTheme.ts","../src/components/ui/card/Card.tsx","../src/components/custom/Workout/StatusDot.tsx","../src/theme/extracted-colors-dataviz.ts","../src/components/custom/Workout/MesoStatusCard.tsx","../src/components/custom/Workout/StrengthTrendChart.tsx","../src/components/custom/Workout/CapacityBandChart.tsx","../src/components/custom/Workout/ExerciseDetailPage.tsx","../src/components/custom/Workout/MesoProgressBar.tsx","../src/components/ui/indicator/Indicator.tsx","../src/components/ui/badge/Badge.tsx","../src/components/custom/Workout/WorkoutPill.tsx","../src/components/custom/Workout/IntensityBar.tsx","../src/components/custom/Workout/WeekRow.tsx","../src/components/custom/Workout/MesoCard.tsx","../src/components/custom/Workout/MuscleGroupChip.tsx","../src/components/custom/Workout/WorkoutCard.tsx","../src/components/custom/Workout/ProgramPlanningPage.tsx"],"names":["c","createContext","useContext","Easing","useState","useEffect","Animated","cn","reactJsx","reactJsxs","t","formatValue","accessibilityLabel","View","Text","t2","t3","REP_GAP","Fragment","Pressable","twMerge","clsx","useCallback","_","DARK","Platform","BRAND_PRIMARY","TextInput","useMemo","useSyncExternalStore","MetricCell","STATUS_SUCCESS","STATUS_ERROR","STATUS_WARNING","buildColumns","toX","toY","sizeStyles","usePulse","HAIRLINE_DEFAULT","BRAND_PRIMARY_DARK","BRAND_PRIMARY_LIGHT","ACCENT_STOPS","ScrollView"],"mappings":";;;;;;;;;;;AAeO,IAAM,eAAA,GAAkB;AAAA,EAC7B,KAAA,EAAO,SAGT,CAAA;AAiCO,IAAM,QAAA,GAAW;AAAA,EACtB,EAAA,EAAI,SAAA;AAAA;AAAA,EACJ,GAAA,EAAK,SAAA;AAAA;AAAA,EACL,GAAA,EAAK,SAAA;AAAA,EACA;AAAA,EACL,GAAA,EAAK,SAAA;AAAA;AAAA,EACL,GAAA,EAAK,SAAA;AAAA;AAAA,EACL,GAAA,EAAK,SAAA;AAAA;AAAA,EACL,GAAA,EAAK,SAAA;AAAA;AAAA,EACL,GAAA,EAAK,SAAA;AAAA;AAAA,EACL,GAAA,EAAK,SAAA;AAAA;AAAA,EACL,GAAA,EAAK,SAAA;AAAA;AAAA,EACL,GAAA,EAAK,SAAA;AAAA;AAAA,EACL,GAAA,EAAK,SAAA;AAAA;AAAA,EACL,GAAA,EAAK,SAAA;AAAA;AAAA,EACL,GAAA,EAAK;AAAA;AACP,CAAA;AA0BO,IAAM,cAAA,GAAiB;AAAA,EAC5B,GAAA,EAAK;AA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,YACC,MAAA,EAAQ,gBAAA,CAAiB,UAAA,EAAY,YAAA,EAAc,aAAa,CAAA;AAAA,YAChE,UAAA,EAAY;AAAA;AAAA,SACd;AAAA,wBAGF,IAAA;AAAA,UAACA,gBAAAA;AAAA,UAAA;AAAA,YACC,SAAA,EAAU,qCAAA;AAAA,YACV,KAAA,EAAO;AAAA,cACL,WAAA,EAAa,CAAA;AAAA,cACb,YAAA,EAAc,EAAA;AAAA,cACd,OAAA,EAAS;AAAA,aACX;AAAA,YACA,MAAA,EAAO,4BAAA;AAAA,YAEN,QAAA,EAAA;AAAA,cAAA,KAAA,KAAU,MAAA,oBACT,GAAA;AAAA,gBAAC,SAAA;AAAA,gBAAA;AAAA,kBACC,KAAA;AAAA,kBACA,YAAA;AAAA,kBACA,YAAA,EAAc,UAAA;AAAA,kBACd,YAAA,EAAc;AAAA;AAAA,eAChB;AAAA,cAED,KAAA,KAAU,UAAU,UAAA,IAAc,IAAA,wBAChC,SAAA,EAAA,EAAU,IAAA,EAAM,UAAA,EAAY,eAAA,EAAiB,aAAA,EAAe,CAAA;AAAA,cAE9D,KAAA,KAAU,SAAA,IAAa,aAAA,IAAiB,IAAA,oBACvC,GAAA;AAAA,gBAAC,YAAA;AAAA,gBAAA;AAAA,kBACC,OAAA,EAAS,aAAA;AAAA,kBACT,gBAAA;AAAA,kBACA,gBAAA,EAAkB;AAAA;AAAA;AACpB;AAAA;AAAA;AAEJ,OAAA,EACF;AAAA;AAAA,GACF;AAEJ","file":"pages.js","sourcesContent":["/**\n * Primitive Design Tokens\n *\n * Raw values with no semantic meaning. These are the foundation of the design system\n * and should rarely be used directly in components. Use semantic tokens instead.\n */\n\n/**\n * Absolute colour keywords.\n *\n * This used to hold five scales — `blue`, `red`, `redVivid`, `neutral` and\n * `charcoal`. All five are gone (TD-07.14): the greys folded into `greyRamp`\n * below and the chromatics into the OKLCH `primitiveRamps`. What is left has no\n * scale because these three are not colours you tune, they are keywords.\n */\nexport const primitiveColors = {\n white: '#FFFFFF',\n black: '#000000',\n transparent: 'transparent',\n} as const\n\n/**\n * Unified warm-neutral grey ramp (TD-07.14)\n *\n * The ONE achromatic scale. Regenerate with `scripts/generate-grey-ramp.mjs` —\n * preserve the generator, not just the hexes.\n *\n * The surface planes ARE steps here rather than a parallel object: `850` is\n * overlay, `975` is the bezel. That is the whole point of the ramp. `grey`,\n * `neutral`, `surfaceRampDark` and `backgroundFrameDark` all resolve into it,\n * which is why every plane step below is byte-identical to the value that\n * shipped in v0.10.0 — the surfaces do not move, only their names.\n *\n * TWO THINGS ABOUT THE NUMBERING, both deliberate and both previously re-derived\n * from scratch more than once because they were never written down:\n *\n * 1. `975` sits BELOW the standard grid. `canonL` — the median L* of the seven\n * chromatic `primitiveRamps` at each step — ends at L*10.3, which is step\n * `950`. The bezel is L*3.8, darker than the grid's last rung, so there is\n * simply no step number left for it and `975` extends past the end.\n * 2. `850`/`875` are quarter-steps because overlay/raised/elevated are only\n * ~2.7 L* apart and all three collide on `900` at normal resolution. `800`\n * is a generated bridge between `700` (L*37.9) and overlay (L*22.7) so the\n * spacing stays even across the join.\n *\n * There is no `inset`. It was retired, not renamed: at ΔE 1.10 from `975` it was\n * an imperceptible duplicate of the frame, which is exactly why `<Surface pressed>`\n * (surface − 1) kept collapsing into it. `975` is the floor.\n *\n * Spec, generator and the rejected v1/v2 cuts:\n * sources/design/foundations/warm-grey-ramp/\n */\nexport const greyRamp = {\n 50: '#F9F6F3', // L*97.0 W6\n 100: '#EDEAE7', // L*92.8 W6\n 200: '#D4D1CE', // L*84.0 W6 — warm silver\n 300: '#BDBAB7', // L*75.7 W6\n 400: '#A29F9D', // L*65.7 W5\n 500: '#888684', // L*56.0 W4\n 600: '#72716F', // L*47.7 W3\n 700: '#5A5958', // L*37.9 W2\n 800: '#424140', // L*27.6 W2 — generated bridge\n 850: '#373635', // L*22.7 W2 — surface overlay\n 875: '#31302F', // L*19.9 W2 — surface raised\n 900: '#2C2A28', // L*17.2 W4 — surface elevated\n 925: '#252321', // L*13.9 W4 — surface base\n 950: '#1C1916', // L*9.0 W6 — background base / shell\n 975: '#100D0A', // L*3.8 W6 — background frame / bezel\n} as const\n\n/**\n * The surface planes, as ramp steps — the mapping `<Surface level>` resolves through.\n *\n * Ordered darkest -> lightest, which is the order `pressedLevel()` walks.\n */\nexport const SURFACE_PLANE_STEPS = {\n frame: 975,\n background: 950,\n base: 925,\n elevated: 900,\n raised: 875,\n overlay: 850,\n} as const\n\n/**\n * Derived tonal ramps (TD-05.09 color foundations)\n *\n * Seven OKLCH-generated hue ramps, 11 perceptual lightness steps each (50 -> 950).\n * Built with hue-torsion + a chroma arc, anchored through existing brand/semantic\n * hexes. `pin` marks the step each ramp flows through its anchor.\n * This is the single source of truth for chromatic hexes — the categorical palette\n * below references these steps rather than duplicating values.\n * See sources/design/foundations.\n */\nexport const primitiveRamps = {\n red: {\n 50: '#FFF4F4',\n 100: '#FFE3E5',\n 200: '#FFC2C5',\n 300: '#FF9A9D',\n 400: '#F77175',\n 500: '#E05254',\n 600: '#D14343', // pin\n 700: '#A4221C',\n 800: '#7E1002',\n 900: '#5A0900',\n 950: '#3D0400',\n },\n orange: {\n 50: '#FFF5ED',\n 100: '#FFE6D4',\n 200: '#FFC7A2',\n 300: '#FFA063',\n 400: '#FF7900', // pin\n 500: '#DA5F00',\n 600: '#B94A00',\n 700: '#983804',\n 800: '#6F290F',\n 900: '#4E1C0C',\n 950: '#331107',\n },\n amber: {\n 50: '#FFF7DD',\n 100: '#FFEAA9',\n 200: '#FFD352',\n 300: '#F9B415', // pin\n 400: '#E08C00',\n 500: '#C27400',\n 600: '#A45E00',\n 700: '#814D14',\n 800: '#5B3A1A',\n 900: '#442503',\n 950: '#301500',\n },\n green: {\n 50: '#E3FFEE',\n 100: '#B5FFD2',\n 200: '#58F69E',\n 300: '#2ED573', // pin\n 400: '#21C05D',\n 500: '#22A444',\n 600: '#298732',\n 700: '#2B6B25',\n 800: '#264D1C',\n 900: '#1B3515',\n 950: '#11220D',\n },\n cyan: {\n 50: '#E6FBFF',\n 100: '#C2F6FF',\n 200: '#62EAFF',\n 300: '#22D3EE', // pin\n 400: '#01B5D1',\n 500: '#2697B7',\n 600: '#307B9B',\n 700: '#2A617F',\n 800: '#22465F',\n 900: '#0B3149',\n 950: '#001F36',\n },\n blue: {\n 50: '#EFF8FF',\n 100: '#D9EFFF',\n 200: '#ACDBFF',\n 300: '#78C2FF',\n 400: '#3CA8FF',\n 500: '#2196F3', // pin\n 600: '#1072CB',\n 700: '#135AA8',\n 800: '#14407E',\n 900: '#112C5A',\n 950: '#091B3C',\n },\n magenta: {\n 50: '#FFF3F9',\n 100: '#FFE2F1',\n 200: '#FFBDE2',\n 300: '#FF8FD5',\n 400: '#ED69C3',\n 500: '#D548AF',\n 600: '#BA2996',\n 700: '#9C0D7A', // pin\n 800: '#77005A',\n 900: '#56003F',\n 950: '#3B0029',\n },\n} as const\n\n/**\n * Categorical (qualitative) palette — an ordered, CVD-safe series expressed as\n * references into {@link primitiveRamps} (one source of truth; the palette moves\n * with the ramps).\n *\n * Design: a single canonical hue order (blue, magenta, red, orange, green, cyan,\n * amber), with steps chosen vivid-midtone-first and fanned lighter/darker as the\n * series grows to preserve separation. The sequence is nested-stable — a chart\n * with N series uses the first N colors, and the series index is stable as N\n * changes. Colorblind-safe worst-case deuteranopia/protanopia floor 8 holds\n * through {@link CATEGORICAL_CVD_SAFE_MAX} colors; the 7th is an extended color\n * that should be paired with a legend or other secondary encoding.\n *\n * Two variants: `default` (vivid, sits on neutral/light surfaces, legible under\n * black text) and `dark` (deeper shades legible under white text on a fill). A\n * separate \"light\" variant was dropped — the vivid `default` picks already clear\n * black-text contrast, so it doubles as the light-context palette.\n */\nexport const categoricalPalette = {\n default: [\n primitiveRamps.blue[500],\n primitiveRamps.magenta[500],\n primitiveRamps.red[500],\n primitiveRamps.orange[400],\n primitiveRamps.green[300],\n primitiveRamps.cyan[300],\n primitiveRamps.amber[600], // extended (7th) — pair with a legend\n ],\n dark: [\n primitiveRamps.blue[600],\n primitiveRamps.magenta[600],\n primitiveRamps.red[500],\n primitiveRamps.orange[600],\n primitiveRamps.green[800],\n primitiveRamps.cyan[800],\n primitiveRamps.amber[500], // extended (7th) — pair with a legend\n ],\n} as const\n\n/** Largest series count that holds the CVD floor without a legend. */\nexport const CATEGORICAL_CVD_SAFE_MAX = 6\n\n/**\n * Categorical palette variant.\n * - `default` : vivid; neutral/light surfaces, legible under black text\n * - `dark` : deeper shades, legible under white text on a filled swatch\n */\nexport type CategoricalVariant = keyof typeof categoricalPalette\n\n/**\n * Get a color from the ordered categorical palette by series index.\n * The palette is nested-stable, so the color for a given index does not change\n * with the total series count; `index` simply wraps past the end.\n *\n * @param index - 0-based series index (wraps past the end)\n * @param variant - `default` (black-text / light surfaces) or `dark` (white text)\n * @returns The hex color string\n */\nexport function getCategoricalColor(index: number, variant: CategoricalVariant = 'default'): string {\n const palette = categoricalPalette[variant]\n index = Math.max(0, Math.floor(index))\n return palette[index % palette.length]\n}\n\n/**\n * Diverging status scale (BodyMap training-status: under → optimal → over) as\n * references into {@link primitiveRamps}. A true diverging shape — `optimal` is\n * the lightest center, the extremes go darker — so the signal reads in lightness\n * (colorblind-robust; worst-case deut/protanopia min ΔE ~10.9) and the direction\n * reads in the blue↔red axis (the CVD-safe hue pair).\n *\n * Tuned so every stop is dark enough for the fill yet light enough that BLACK\n * text clears 4.5:1 on all five — no per-cell white/black flipping. The value\n * valley is symmetric: the two mid-arms (maintenance / approaching) sit at equal\n * lightness (both ~0.53 relative luminance), the ends darker.\n */\nexport const divergingScale = [\n primitiveRamps.blue[500], // under\n primitiveRamps.cyan[300], // maintenance\n primitiveRamps.green[200], // optimal (light center)\n primitiveRamps.amber[300], // approaching\n primitiveRamps.red[600], // over\n] as const\n\n/**\n * Sequential \"effort\" scale (low → high intensity: green → yellow → orange → red)\n * as references into {@link primitiveRamps}. A 6-stop ordinal palette; the\n * velocity/RPE strip sub-samples it. Every adjacent pair clears the CVD floor\n * (min deut/protan ΔE ≥ 4.5), and within that the hue walk is kept smooth —\n * the amber-200 → amber-300 → orange-400 run steps the yellow→orange transition\n * gradually rather than lurching. Order encodes magnitude, so it tolerates the\n * green↔red CVD pair. Stops 0–3 take black text; the dark reds take white.\n */\nexport const sequentialEffort = [\n primitiveRamps.green[300],\n primitiveRamps.amber[200],\n primitiveRamps.amber[300],\n primitiveRamps.orange[400],\n primitiveRamps.red[600],\n primitiveRamps.red[700],\n] as const\n\n/**\n * Best-contrast text color (black or white) for a solid fill — for labels sitting\n * on categorical/diverging/effort swatches. Uses the WCAG relative-luminance ratio.\n */\nexport function bestTextColor(hex: string): '#000000' | '#FFFFFF' {\n const [r, g, b] = [0, 2, 4].map((i) => {\n const c = parseInt(hex.replace('#', '').slice(i, i + 2), 16) / 255\n return c >= 0.04045 ? ((c + 0.055) / 1.055) ** 2.4 : c / 12.92\n })\n const l = 0.2126 * r + 0.7152 * g + 0.0722 * b\n return (l + 0.05) / 0.05 >= 1.05 / (l + 0.05) ? '#000000' : '#FFFFFF'\n}\n\n/**\n * Discrete rainbow palette for data visualization\n * Based on Paul Tol's color schemes: https://personal.sron.nl/~pault/#fig:scheme_rainbow_discrete\n */\nexport const discreteRainbow = [\n '#E8ECFB',\n '#D9CCE3',\n '#D1BBD7',\n '#CAACCB',\n '#BA8DB4',\n '#AE76A3',\n '#AA6F9E',\n '#994F88',\n '#882E72',\n '#1965B0',\n '#437DBF',\n '#5289C7',\n '#6195CF',\n '#7BAFDE',\n '#4EB265',\n '#90C987',\n '#CAE0AB',\n '#F7F056',\n '#F7CB45',\n '#F6C141',\n '#F4A736',\n '#F1932D',\n '#EE8026',\n '#E8601C',\n '#E65518',\n '#DC050C',\n '#A5170E',\n '#72190E',\n '#42150A',\n] as const\n\n/**\n * Palette indices for discrete rainbow colors at different palette sizes.\n * For a given palette size (index + 1), returns the indices of colors to use.\n */\nconst discreteRainbowPalettes: number[][] = [\n [10],\n [10, 26],\n [10, 18, 26],\n [10, 15, 18, 26],\n [10, 14, 15, 18, 26],\n [10, 14, 15, 17, 18, 26],\n [9, 10, 14, 15, 17, 18, 26],\n [9, 10, 14, 15, 17, 18, 23, 26],\n [9, 10, 14, 15, 17, 18, 23, 26, 28],\n [9, 10, 14, 15, 17, 18, 21, 24, 26, 28],\n [9, 10, 12, 14, 15, 17, 18, 21, 24, 26, 28],\n [3, 6, 9, 10, 12, 14, 15, 17, 18, 21, 24, 26],\n [3, 6, 9, 10, 12, 14, 15, 16, 17, 18, 21, 24, 26],\n [3, 6, 9, 10, 12, 14, 15, 16, 17, 18, 20, 22, 24, 26],\n [3, 6, 9, 10, 12, 14, 15, 16, 17, 18, 20, 22, 24, 26, 28],\n [3, 5, 7, 9, 10, 12, 14, 15, 16, 17, 18, 20, 22, 24, 26, 28],\n [3, 5, 7, 8, 9, 10, 12, 14, 15, 16, 17, 18, 20, 22, 24, 26, 28],\n [3, 5, 7, 8, 9, 10, 12, 14, 15, 16, 17, 18, 20, 22, 24, 26, 27, 28],\n [2, 4, 5, 7, 8, 9, 10, 12, 14, 15, 16, 17, 18, 20, 22, 24, 26, 27, 28],\n [2, 4, 5, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 20, 22, 24, 26, 27, 28],\n [2, 4, 5, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 21, 23, 25, 26, 27, 28],\n [2, 4, 5, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 21, 23, 25, 26, 27, 28, 29],\n [1, 2, 4, 5, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 21, 23, 25, 26, 27, 28, 29],\n]\n\n/**\n * Get a color from the discrete rainbow palette for a given index and palette size.\n * Colors are optimized for visual distinction at each palette size.\n *\n * @param index - The index of the color in the series (0-based)\n * @param size - The total number of colors needed (1-23)\n * @returns The hex color string\n */\nexport function getDiscreteRainbowColor(index: number, size: number): string {\n index = Math.max(0, index)\n size = Math.min(Math.max(1, size), discreteRainbowPalettes.length)\n\n const palette = discreteRainbowPalettes[size - 1]\n if (index >= palette.length) index = index % palette.length\n\n return discreteRainbow[palette[index] - 1]\n}\n\nexport const primitiveTypography = {\n fontFamilies: {\n sans: ['Inter', '-apple-system', 'BlinkMacSystemFont', 'Segoe UI', 'Helvetica', 'Arial', 'sans-serif'],\n body: ['Nunito Sans', 'sans-serif'],\n heading: ['Space Grotesk', 'sans-serif'],\n mono: ['SF Mono', 'Monaco', 'Inconsolata', 'Fira Mono', 'Droid Sans Mono', 'Source Code Pro', 'monospace'],\n },\n fontSizes: {\n xs: '0.75rem', // 12px\n sm: '0.875rem', // 14px\n base: '1rem', // 16px\n lg: '1.125rem', // 18px\n xl: '1.5rem', // 24px\n '2xl': '2rem', // 32px\n '3xl': '2.25rem', // 36px\n '4xl': '3rem', // 48px\n '5xl': '3.5rem', // 56px\n },\n fontWeights: {\n normal: 400,\n medium: 500,\n semibold: 600,\n bold: 700,\n },\n lineHeights: {\n none: 1,\n tight: 1.375,\n snug: 1.5,\n normal: 1.57,\n relaxed: 1.66,\n loose: 1.75,\n },\n letterSpacing: {\n tighter: '-0.05em',\n tight: '-0.025em',\n normal: '0em',\n wide: '0.025em',\n wider: '0.05em',\n widest: '0.5px',\n },\n} as const\n\nexport const primitiveSpacing = {\n 0: '0',\n px: '1px',\n 0.5: '0.125rem', // 2px\n 1: '0.25rem', // 4px\n 1.5: '0.375rem', // 6px\n 2: '0.5rem', // 8px\n 2.5: '0.625rem', // 10px\n 3: '0.75rem', // 12px\n 3.5: '0.875rem', // 14px\n 4: '1rem', // 16px\n 5: '1.25rem', // 20px\n 6: '1.5rem', // 24px\n 7: '1.75rem', // 28px\n 8: '2rem', // 32px\n 9: '2.25rem', // 36px\n 10: '2.5rem', // 40px\n 11: '2.75rem', // 44px\n 12: '3rem', // 48px\n 14: '3.5rem', // 56px\n 16: '4rem', // 64px\n 20: '5rem', // 80px\n 24: '6rem', // 96px\n 28: '7rem', // 112px\n 32: '8rem', // 128px\n} as const\n\nexport const primitiveBorderRadius = {\n none: '0',\n sm: '4px',\n DEFAULT: '8px',\n md: '8px',\n lg: '12px',\n xl: '16px',\n '2xl': '24px',\n full: '9999px',\n} as const\n\nexport const primitiveBreakpoints = {\n xs: 0,\n sm: 600,\n md: 1000,\n lg: 1200,\n xl: 1920,\n} as const\n\nexport const primitiveZIndex = {\n hide: -1,\n auto: 'auto',\n base: 0,\n docked: 10,\n dropdown: 1000,\n sticky: 1100,\n drawer: 1100,\n banner: 1200,\n appBar: 1200,\n overlay: 1300,\n modal: 1400,\n popover: 1500,\n skipLink: 1600,\n toast: 1700,\n tooltip: 1800,\n} as const\n","/**\n * Workout-specific tokens not yet in the main Tailwind config.\n * Use these inline instead of Tailwind classes.\n */\nimport { divergingScale, sequentialEffort, primitiveRamps as ramp } from './tokens/primitives'\n\nexport const WORKOUT_TOKENS = {\n // Canonical 4-band performance scale — the single source for BOTH the\n // VelocityStrip zone bars and the SetRow RPE color (TD-03.43). The direction\n // is intentionally inverted between the two consumers: for velocity, green =\n // fastest/best; for RPE, green = easiest. This is the [0,2,3,4] subsample of\n // the canonical `sequentialEffort` primitive: an EVEN hue walk across the ramp\n // (green → gold → orange → red). The earlier [0,1,2,4] spent two of its four\n // bands on adjacent yellows (amber-200 + amber-300) and skipped orange, reading\n // yellow-heavy with an abrupt jump to red; sampling amber-300 + orange-400\n // instead gives four cleanly separable bands that hold at 3px strip scale.\n // Consumed inline (RN).\n scale: {\n green: sequentialEffort[0], // green-300\n yellow: sequentialEffort[2], // amber-300 (gold)\n orange: sequentialEffort[3], // orange-400 (true orange)\n red: sequentialEffort[4], // red-600\n },\n\n // BodyMap volume heatmap — the canonical `divergingScale` (under → optimal →\n // over): a true diverging shape with a light green center, cool-blue under-\n // trained end and warm-red over-reaching end (colorblind-robust in lightness).\n heatmap: {\n none: '#E0E0E0', // no training data\n under: divergingScale[0], // below MEV\n maintenance: divergingScale[1], // MEV to MAV\n productive: divergingScale[2], // optimal center — MAV to MRV\n approaching: divergingScale[3], // near MRV\n over: divergingScale[4], // over MRV\n },\n\n // Badge border-radius (rounded-sm is 4px, we need 2px)\n badgeRadius: 2,\n\n // Surface and border colors were removed here: those flip with the theme, so\n // components use the CSS custom properties (var(--color-surface-*/border-*))\n // directly. Only theme-independent data-viz values remain below.\n\n // Intensity bar specific — over-target tiers deepen along the red ramp.\n intensity: {\n track: '#333333',\n over1: ramp.red[600], // matches status-error\n over2: ramp.red[700],\n over3: ramp.red[800],\n targetLine: 'rgba(33, 150, 243, 0.5)',\n atTargetGlow:\n '0 0 5px 1px rgba(33, 150, 243, 0.35), 0 0 10px 3px rgba(33, 150, 243, 0.15)',\n },\n\n // Placeholder strip\n placeholder: {\n fill: '#3A3A3A',\n },\n\n // Deviation bar\n deviation: {\n track: '#333333',\n },\n} as const\n","/**\n * Semantic Design Tokens\n *\n * Meaningful tokens following DTCG (Design Tokens Community Group) naming conventions.\n * Pattern: {category}-{intent}-{variant?}-{state?}\n *\n * Categories:\n * - brand-* : Brand colors (primary, secondary, accent)\n * - status-* : Feedback colors (success, error, warning, info)\n * - result-* : Outcome indicators (improve, degrade, inconclusive, neutral)\n * - data-* : Data visualization colors (chart series)\n * - on-* : Text on colored backgrounds\n * - surface-* : Elevated containers (NOT \"paper\")\n * - background-* : Page backgrounds\n * - text-* : Text colors\n * - border-* : Border colors\n * - interactive-* : Hover/focus/active/disabled states\n */\n\nimport { primitiveColors as p, primitiveRamps as ramp, greyRamp, discreteRainbow } from './primitives'\n\n/**\n * GREY MAPPING (TD-07.14) — how the old cool scales resolved onto `greyRamp`.\n *\n * Every grey below came off `grey` (pure R=G=B) or `neutral` (cool, R−B\n * down to −26). They were snapped by NEAREST L*, not by matching step numbers,\n * because the two old scales were numbered incompatibly: `grey` ran\n * INVERTED and compressed (0 = #6E6E6E lightest, 900 = #101010 darkest), so\n * `grey[400]` and `greyRamp[400]` have nothing to do with each other.\n *\n * grey 200→800 300→900 400→925 500→950\n * neutral 50→50 100→100 300→200 400→400 500→600 600→700 900→950\n *\n * Surfaces move ΔE 1.9–4.8 — at or near imperceptible. The TEXT roles move\n * further (8.6–12.8), and that is the intended part of the change: they are\n * picking up the warmth the surfaces already had.\n *\n * Light gets its own column because strict L*-nearest collapsed `neutral[50]`\n * and `[100]` onto one step, flattening surface-elevated into surface-raised.\n * Light is still deferred as a design question — there is no `surfaceRampLight`.\n *\n * `border-default`, `-subtle` and `-strong` are GONE, replaced by `hairline-*`.\n * Once the planes became ramp steps, every value dark enough to read as a\n * border was also a plane's fill. Alpha composites instead of colliding.\n *\n * `text-tertiary` on dark is the one role that ignores L*-nearest; see it.\n */\n\n// Light mode semantic colors (default)\nexport const semanticColorsLight = {\n // Brand colors (brand-*)\n 'brand-primary': ramp.orange[400],\n 'brand-primary-light': ramp.orange[300],\n 'brand-primary-dark': ramp.orange[500],\n 'brand-primary-subtle': 'rgba(255, 121, 0, 0.08)',\n 'brand-primary-hover': ramp.orange[500],\n 'brand-primary-active': ramp.orange[600],\n\n 'brand-secondary': ramp.cyan[600],\n 'brand-secondary-light': ramp.cyan[500],\n 'brand-secondary-dark': ramp.cyan[700],\n 'brand-secondary-subtle': 'rgba(48, 123, 155, 0.08)',\n 'brand-secondary-hover': ramp.cyan[700],\n 'brand-secondary-active': ramp.cyan[800],\n\n // Text on brand backgrounds (on-*)\n 'on-brand-primary': p.white,\n 'on-brand-secondary': p.white,\n\n // Status colors (status-*)\n 'status-success': ramp.green[300],\n 'status-success-light': ramp.green[200],\n 'status-success-dark': ramp.green[600],\n 'status-success-subtle': ramp.green[50],\n\n // Live-session accent — its OWN role, decoupled from success so the two can diverge\n 'status-live': ramp.green[300],\n 'status-live-muted': ramp.green[500],\n\n 'status-error': ramp.red[600],\n 'status-error-light': ramp.red[500],\n 'status-error-dark': ramp.red[700],\n 'status-error-subtle': ramp.red[50],\n\n 'status-error-vivid': ramp.red[600], // vivid alert red\n 'status-error-vivid-light': ramp.red[500],\n 'status-error-vivid-dark': ramp.red[700],\n 'status-error-vivid-subtle': 'rgba(255, 71, 87, 0.12)',\n\n 'status-warning': ramp.amber[300],\n 'status-warning-light': ramp.amber[200],\n 'status-warning-dark': ramp.amber[500],\n 'status-warning-subtle': ramp.amber[50],\n\n 'status-info': ramp.blue[500],\n 'status-info-light': ramp.blue[300],\n 'status-info-dark': ramp.blue[600],\n 'status-info-subtle': ramp.blue[50],\n\n // Text on status backgrounds (on-status-*)\n 'on-status-success': p.white,\n 'on-status-error': p.white,\n 'on-status-warning': p.white,\n 'on-status-info': p.white,\n\n // Result/outcome indicators (result-*)\n 'result-improve': '#4caf50', // Green - positive outcome\n 'result-improve-light': 'rgba(76, 175, 80, 0.12)',\n 'result-improve-dark': '#248a24',\n 'result-degrade': '#ef5350', // Red - negative outcome\n 'result-degrade-light': 'rgba(239, 83, 80, 0.12)',\n 'result-degrade-dark': '#b30000',\n 'result-inconclusive': '#9E9A97', // Gray - no clear result\n 'result-inconclusive-light': 'rgba(158, 154, 151, 0.12)',\n 'result-neutral': greyRamp[600], // Neutral baseline\n\n // Text on result backgrounds (on-result-*)\n 'on-result-improve': p.white,\n 'on-result-degrade': p.white,\n 'on-result-inconclusive': p.white,\n\n // Data visualization colors (data-*)\n // First 10 colors from discrete rainbow optimized for charts\n 'data-1': discreteRainbow[9], // Blue\n 'data-2': discreteRainbow[14], // Green\n 'data-3': discreteRainbow[17], // Yellow\n 'data-4': discreteRainbow[25], // Red\n 'data-5': discreteRainbow[8], // Purple\n 'data-6': discreteRainbow[20], // Orange\n 'data-7': discreteRainbow[13], // Light Blue\n 'data-8': discreteRainbow[15], // Light Green\n 'data-9': discreteRainbow[3], // Lavender\n 'data-10': discreteRainbow[22], // Dark Orange\n\n // Text colors (text-*)\n 'text-primary': '#121828',\n 'text-secondary': '#65748B',\n 'text-tertiary': greyRamp[400],\n 'text-disabled': 'rgba(55, 65, 81, 0.48)',\n 'text-inverse': p.white,\n 'text-link': ramp.blue[600],\n 'text-link-hover': ramp.blue[700],\n\n // Surface colors (surface-*) - for elevated containers\n 'surface-base': p.white,\n 'surface-elevated': greyRamp[50], // slightly off-white for elevated cards\n 'surface-raised': greyRamp[100], // light gray for raised cards\n 'surface-overlay': p.white,\n 'surface-input': greyRamp[50], // Input field background (filled variant)\n\n // Background colors (background-*)\n 'background-base': '#EBEBEB',\n 'background-default': p.white,\n 'background-subtle': greyRamp[50],\n // Frame/bezel chrome — top bar + side nav shell, one step below\n // `background-base`. Placeholder pairing for light mode, which is deferred.\n 'background-frame': greyRamp[400],\n\n // Border colors (border-*)\n 'border-prominent': greyRamp[400], // high-visibility divider\n 'border-focus': ramp.blue[600],\n 'border-input': greyRamp[200], // Input field border\n 'border-input-hover': greyRamp[400], // Input field border on hover\n 'border-input-focus': ramp.blue[600], // Input field border on focus\n 'border-input-error': ramp.red[600], // Input field border on error\n\n // Alpha hairline separators (surface-independent — composite toward black on\n // light surfaces, mirroring the dark-mode white-alpha family). See §4/S-2.\n 'hairline-subtle': 'rgba(0, 0, 0, 0.06)',\n 'hairline-default': 'rgba(0, 0, 0, 0.09)',\n 'hairline-strong': 'rgba(0, 0, 0, 0.14)',\n\n // Interactive states (interactive-*)\n 'interactive-hover': 'rgba(55, 65, 81, 0.04)',\n 'interactive-focus': 'rgba(55, 65, 81, 0.12)',\n 'interactive-active': 'rgba(55, 65, 81, 0.16)',\n 'interactive-selected': 'rgba(55, 65, 81, 0.08)',\n 'interactive-disabled': 'rgba(55, 65, 81, 0.12)',\n 'interactive-disabled-text': 'rgba(55, 65, 81, 0.26)',\n\n // Divider\n 'divider': '#E8E9EB',\n\n // Avatar default\n 'avatar-background': greyRamp[600],\n 'avatar-text': p.white,\n} as const\n\n// Dark mode semantic colors\nexport const semanticColorsDark = {\n // Brand colors stay the same in dark mode\n 'brand-primary': ramp.orange[400],\n 'brand-primary-light': ramp.orange[300],\n 'brand-primary-dark': ramp.orange[500],\n 'brand-primary-subtle': 'rgba(255, 121, 0, 0.12)',\n 'brand-primary-hover': ramp.orange[300],\n 'brand-primary-active': ramp.orange[200],\n\n 'brand-secondary': ramp.cyan[600],\n 'brand-secondary-light': ramp.cyan[500],\n 'brand-secondary-dark': ramp.cyan[700],\n 'brand-secondary-subtle': 'rgba(48, 123, 155, 0.12)',\n 'brand-secondary-hover': ramp.cyan[500],\n 'brand-secondary-active': ramp.cyan[400],\n\n // Text on brand backgrounds\n 'on-brand-primary': p.white,\n 'on-brand-secondary': p.white,\n\n // Status colors\n 'status-success': ramp.green[300],\n 'status-success-light': ramp.green[200],\n 'status-success-dark': ramp.green[600],\n 'status-success-subtle': 'rgba(46, 213, 115, 0.12)',\n\n // Live-session accent — its OWN role, decoupled from success so the two can diverge\n 'status-live': ramp.green[300],\n 'status-live-muted': ramp.green[500],\n\n 'status-error': ramp.red[600],\n 'status-error-light': ramp.red[500],\n 'status-error-dark': ramp.red[700],\n 'status-error-subtle': 'rgba(209, 67, 67, 0.12)',\n\n 'status-error-vivid': ramp.red[600],\n 'status-error-vivid-light': ramp.red[500],\n 'status-error-vivid-dark': ramp.red[700],\n 'status-error-vivid-subtle': 'rgba(255, 71, 87, 0.12)',\n\n 'status-warning': ramp.amber[300],\n 'status-warning-light': ramp.amber[200],\n 'status-warning-dark': ramp.amber[500],\n 'status-warning-subtle': 'rgba(249, 180, 21, 0.12)',\n\n 'status-info': ramp.blue[500],\n 'status-info-light': ramp.blue[300],\n 'status-info-dark': ramp.blue[600],\n 'status-info-subtle': 'rgba(33, 150, 243, 0.12)',\n\n // Text on status backgrounds\n 'on-status-success': p.white,\n 'on-status-error': p.white,\n 'on-status-warning': p.white,\n 'on-status-info': p.white,\n\n // Result/outcome indicators (result-*)\n 'result-improve': '#4caf50',\n 'result-improve-light': 'rgba(76, 175, 80, 0.16)',\n 'result-improve-dark': '#248a24',\n 'result-degrade': '#ef5350',\n 'result-degrade-light': 'rgba(239, 83, 80, 0.16)',\n 'result-degrade-dark': '#b30000',\n 'result-inconclusive': '#9E9A97',\n 'result-inconclusive-light': 'rgba(158, 154, 151, 0.16)',\n 'result-neutral': greyRamp[400],\n\n // Text on result backgrounds\n 'on-result-improve': p.white,\n 'on-result-degrade': p.white,\n 'on-result-inconclusive': p.white,\n\n // Data visualization colors (same in dark mode for consistency)\n 'data-1': discreteRainbow[9],\n 'data-2': discreteRainbow[14],\n 'data-3': discreteRainbow[17],\n 'data-4': discreteRainbow[25],\n 'data-5': discreteRainbow[8],\n 'data-6': discreteRainbow[20],\n 'data-7': discreteRainbow[13],\n 'data-8': discreteRainbow[15],\n 'data-9': discreteRainbow[3],\n 'data-10': discreteRainbow[22],\n\n // Text colors - inverted for dark mode\n 'text-primary': greyRamp[50],\n 'text-secondary': greyRamp[400],\n // Deliberately ONE step lighter than the L*-nearest match (`greyRamp[600]`).\n // The colour this replaced failed WCAG large-text outright on the three\n // lightest planes — 2.96 / 2.72 / 2.49 against elevated / raised / overlay —\n // and `600` carried that failure forward almost exactly (2.93 / 2.70 / 2.47).\n // `500` clears 3:1 everywhere (3.32–5.34). Contrast beats colour fidelity for\n // text roles; borders and surfaces still use strict L*-nearest. See\n // semantic-contrast.test.ts, which fails if this is moved back down.\n 'text-tertiary': greyRamp[500],\n 'text-disabled': 'rgba(255, 255, 255, 0.38)',\n 'text-inverse': greyRamp[950],\n 'text-link': '#828DF8',\n 'text-link-hover': ramp.blue[400],\n\n // Surface colors - dark backgrounds — warm-tapered DERIVED ramp (TD-surface-tokens,\n // S-1, re-spaced S-3). Shipped verbatim from `deriveSurfaceRamp()` — see\n // `surfaceRampDark` in primitives.ts for the full derivation note. `surface-overlay`\n // and `surface-elevated` are distinct (were both #191919 pre-S-1); `surface-input`\n // tracks one plane above `surface-base`, same relative position as before the remap.\n // `background-base` backs `Surface level=\"background\"` (SurfaceContext.SURFACE_LEVEL_TOKEN),\n // so it takes the ramp's shell role. The deepest plane is `background-frame`,\n // which is also the `SurfaceLevel` floor a pressed surface clamps at.\n 'surface-base': greyRamp[925], // main surface (#252321, L*13.9)\n 'surface-elevated': greyRamp[900], // elevated surface (#2C2A28, L*17.2 — nav/rail)\n 'surface-raised': greyRamp[875], // raised surface (#31302F, L*19.9 — cards)\n 'surface-overlay': greyRamp[850], // overlay surface (#373635, L*22.7 — hero/popover)\n 'surface-input': greyRamp[900], // input surface (#2C2A28 — one plane above base)\n\n // Background colors — same ramp, the frame/shell end of it.\n 'background-base': greyRamp[950], // shell (#1C1916, L*9 — Surface level=\"background\")\n 'background-default': greyRamp[925], // main background (#252321, L*13.9 — matches surface-base)\n 'background-subtle': greyRamp[900], // subtle background (#2C2A28, L*17.2 — matches surface-elevated)\n // Frame/bezel chrome — the top bar + side nav shell, one step BELOW\n // `background-base`. It used to be described as sitting OUTSIDE the ramp; it\n // is simply the ramp's last step now, and the floor `<Surface pressed>` clamps at.\n 'background-frame': greyRamp[975], // frame / bezel (#100D0A, L*3.8)\n\n // Border colors — solid dark borders are RETIRED (TD-07.14). Not a preference — a structural\n // consequence of one ramp. Every step from 850 to 975 is now a surface plane,\n // so a solid border dark enough to read as a border necessarily equals some\n // plane's fill, which is exactly the collision `surface.contract.test.ts` R2\n // forbids. The only non-plane steps left in that band are 800 and 700, and\n // borders there jump from L*~10-25 to L*~28-38 — a restyle, not a migration.\n //\n // So separation moves to the alpha hairlines, which dark mode already called\n // \"the primary separation cue\". Being alpha, they composite against whatever\n // plane they land on and cannot collide with any of them — the problem stops\n // existing rather than being re-solved per plane. The three solid tokens were\n // deleted outright; consumers point at the `hairline-*` family below.\n //\n // `border-prominent` stays SOLID: it is the one border meant to be seen\n // outright (4 call sites, high-visibility dividers), and grey-800 is not a\n // plane, so it keeps its job without collision.\n 'border-prominent': greyRamp[800], // high-visibility divider\n 'border-focus': '#828DF8',\n 'border-input': greyRamp[700],\n 'border-input-hover': greyRamp[600],\n 'border-input-focus': '#828DF8',\n 'border-input-error': ramp.red[500],\n\n // Alpha hairline separators — the primary separation cue (§4/S-2). Self-\n // normalizing: composites toward white by ~the same amount on ANY plane, so\n // one family works at every elevation instead of per-surface border tokens.\n // Shadows are demoted to floating-overlay use only (not shipped as a fill\n // separator here — see elevation.ts, follow-up S-4).\n //\n // RETUNED on the wall (VW-99, S-6). The original .06/.09/.14 were set at a\n // desk. On the panel at ~3 m `subtle` rendered but was indiscernible, and\n // `default` — the load-bearing one, with no solid-border fallback since\n // TD-07.14 — went weak on the lightest plane. `strong` read cleanly with room\n // to spare, which is what made raising the whole family viable.\n //\n // Each tier steps up onto the next MEASURED-GOOD rung rather than an\n // interpolated one: the new `subtle` is the old `default`, and the new\n // `default` is the old `strong` — a value just confirmed legible on all four\n // planes. Spacing goes 1 : 1.56 : 2.33, against the original 1 : 1.5 : 2.33.\n //\n // RUN 2 (VW-99): all three tiers were seen on all four planes — the retune\n // worked — but `subtle` was still \"a bit hard to read\", so the whole family\n // took a further +.01. That is a comfort margin on a passing row, not a fix\n // for a failing one, which is why it is a flat offset: the 1 : 1.56 : 2.33\n // spacing that the run validated is preserved rather than re-derived.\n //\n // Keep these to TWO decimals. react-native-web quantises alpha to 8 bits, so\n // a 3-decimal value silently rounds on the way to the DOM (.135 renders as\n // .13) — the token would say one thing and paint another.\n //\n // DARK ONLY. The light family above composites toward BLACK on light planes,\n // which this run says nothing about — do not mirror these numbers into it\n // without its own verification.\n 'hairline-subtle': 'rgba(255, 255, 255, 0.10)',\n 'hairline-default': 'rgba(255, 255, 255, 0.15)',\n 'hairline-strong': 'rgba(255, 255, 255, 0.22)',\n\n // Interactive states\n 'interactive-hover': 'rgba(255, 255, 255, 0.04)',\n 'interactive-focus': 'rgba(255, 255, 255, 0.12)',\n 'interactive-active': 'rgba(255, 255, 255, 0.16)',\n 'interactive-selected': 'rgba(255, 255, 255, 0.08)',\n 'interactive-disabled': 'rgba(255, 255, 255, 0.12)',\n 'interactive-disabled-text': 'rgba(255, 255, 255, 0.26)',\n\n // Divider\n 'divider': 'rgba(255, 255, 255, 0.09)',\n\n // Avatar default\n 'avatar-background': greyRamp[700],\n 'avatar-text': p.white,\n} as const\n\n// Typography tokens matching existing app\nexport const semanticTypography = {\n // Headings (Space Grotesk)\n h1: {\n fontFamily: 'heading',\n fontSize: '3.5rem',\n fontWeight: 700,\n lineHeight: 1.375,\n },\n h2: {\n fontFamily: 'heading',\n fontSize: '3rem',\n fontWeight: 700,\n lineHeight: 1.375,\n },\n h3: {\n fontFamily: 'heading',\n fontSize: '2.25rem',\n fontWeight: 700,\n lineHeight: 1.375,\n },\n h4: {\n fontFamily: 'heading',\n fontSize: '2rem',\n fontWeight: 700,\n lineHeight: 1.375,\n },\n h5: {\n fontFamily: 'heading',\n fontSize: '1.5rem',\n fontWeight: 600,\n lineHeight: 1.375,\n },\n h6: {\n fontFamily: 'heading',\n fontSize: '1.125rem',\n fontWeight: 600,\n lineHeight: 1.375,\n },\n\n // Body text (Nunito Sans)\n body1: {\n fontFamily: 'body',\n fontSize: '1rem',\n fontWeight: 400,\n lineHeight: 1.5,\n },\n body2: {\n fontFamily: 'body',\n fontSize: '0.875rem',\n fontWeight: 400,\n lineHeight: 1.57,\n },\n subtitle1: {\n fontFamily: 'body',\n fontSize: '1rem',\n fontWeight: 500,\n lineHeight: 1.75,\n },\n subtitle2: {\n fontFamily: 'body',\n fontSize: '0.875rem',\n fontWeight: 500,\n lineHeight: 1.57,\n },\n caption: {\n fontFamily: 'body',\n fontSize: '0.75rem',\n fontWeight: 400,\n lineHeight: 1.66,\n },\n overline: {\n fontFamily: 'body',\n fontSize: '0.75rem',\n fontWeight: 600,\n lineHeight: 2.5,\n letterSpacing: '0.5px',\n textTransform: 'uppercase' as const,\n },\n button: {\n fontFamily: 'sans',\n fontSize: '0.875rem',\n fontWeight: 600,\n lineHeight: 1.75,\n },\n} as const\n\n// Button size tokens\nexport const buttonSizes = {\n sm: {\n paddingX: '16px',\n paddingY: '6px',\n fontSize: '0.875rem',\n },\n md: {\n paddingX: '20px',\n paddingY: '8px',\n fontSize: '0.875rem',\n },\n lg: {\n paddingX: '24px',\n paddingY: '11px',\n fontSize: '1rem',\n },\n} as const\n\n// Export type for theme mode\nexport type ThemeMode = 'light' | 'dark'\n\n// Helper to get semantic colors based on mode\nexport function getSemanticColors(mode: ThemeMode) {\n return mode === 'dark' ? semanticColorsDark : semanticColorsLight\n}\n","/**\n * Colour math shared by the depth system.\n *\n * This file used to be `shadows.ts` and shipped a neumorphic shadow builder —\n * dual opposing shadows, dark bottom-right and light top-left. That was removed\n * in TD-07.16. Neumorphism needs a mid-tone background (roughly 75-90%\n * lightness) so BOTH shadows have somewhere to fall; our surfaces sit near 10%,\n * which leaves the dark half nothing to fall onto. It collapsed to a one-sided\n * rim light and read as noise on the wall.\n *\n * Inline depth is a hairline now (`hairline-*`, self-normalising alpha), texture\n * is `materials.ts`, and drop-shadow survives only for genuinely FLOATING\n * things — see `elevation.ts`.\n *\n * What is left here is the HSV/hex maths that `elevation.ts` still uses to\n * derive rim and shadow tints from whatever surface colour it is handed.\n */\n\n// ============================================================================\n// Color Math Utilities\n// ============================================================================\n\n/**\n * Parse a hex color to RGB values (0-255).\n * Supports both #RGB and #RRGGBB formats.\n */\nexport function hexToRgb(hex: string): { r: number; g: number; b: number } | null {\n const cleaned = hex.replace('#', '')\n \n let r: number, g: number, b: number\n \n if (cleaned.length === 3) {\n r = parseInt(cleaned[0] + cleaned[0], 16)\n g = parseInt(cleaned[1] + cleaned[1], 16)\n b = parseInt(cleaned[2] + cleaned[2], 16)\n } else if (cleaned.length === 6) {\n r = parseInt(cleaned.slice(0, 2), 16)\n g = parseInt(cleaned.slice(2, 4), 16)\n b = parseInt(cleaned.slice(4, 6), 16)\n } else {\n return null\n }\n \n return { r, g, b }\n}\n\n/**\n * Convert RGB (0-255) to HSV (h: 0-360, s: 0-1, v: 0-1).\n */\nexport function rgbToHsv(r: number, g: number, b: number): { h: number; s: number; v: number } {\n const rNorm = r / 255\n const gNorm = g / 255\n const bNorm = b / 255\n \n const max = Math.max(rNorm, gNorm, bNorm)\n const min = Math.min(rNorm, gNorm, bNorm)\n const delta = max - min\n \n // Value\n const v = max\n \n // Saturation\n const s = max === 0 ? 0 : delta / max\n \n // Hue\n let h = 0\n if (delta !== 0) {\n if (max === rNorm) {\n h = 60 * (((gNorm - bNorm) / delta) % 6)\n } else if (max === gNorm) {\n h = 60 * ((bNorm - rNorm) / delta + 2)\n } else {\n h = 60 * ((rNorm - gNorm) / delta + 4)\n }\n }\n if (h < 0) h += 360\n \n return { h, s, v }\n}\n\n/**\n * Convert HSV (h: 0-360, s: 0-1, v: 0-1) to RGB (0-255).\n */\nexport function hsvToRgb(h: number, s: number, v: number): { r: number; g: number; b: number } {\n const c = v * s\n const x = c * (1 - Math.abs((h / 60) % 2 - 1))\n const m = v - c\n \n let rPrime: number, gPrime: number, bPrime: number\n\n if (h >= 0 && h < 60) {\n rPrime = c; gPrime = x; bPrime = 0\n } else if (h >= 60 && h < 120) {\n rPrime = x; gPrime = c; bPrime = 0\n } else if (h >= 120 && h < 180) {\n rPrime = 0; gPrime = c; bPrime = x\n } else if (h >= 180 && h < 240) {\n rPrime = 0; gPrime = x; bPrime = c\n } else if (h >= 240 && h < 300) {\n rPrime = x; gPrime = 0; bPrime = c\n } else {\n rPrime = c; gPrime = 0; bPrime = x\n }\n \n return {\n r: Math.round((rPrime + m) * 255),\n g: Math.round((gPrime + m) * 255),\n b: Math.round((bPrime + m) * 255),\n }\n}\n\n/**\n * Convert RGB values to hex string.\n */\nexport function rgbToHex(r: number, g: number, b: number): string {\n const toHex = (n: number) => {\n const clamped = Math.max(0, Math.min(255, Math.round(n)))\n return clamped.toString(16).padStart(2, '0')\n }\n return `#${toHex(r)}${toHex(g)}${toHex(b)}`\n}\n\n/**\n * Lighten a color by increasing its HSV Value component.\n * \n * @param hex - The hex color to lighten\n * @param amount - Amount to increase V by (0-1)\n */\nexport function lighten(hex: string, amount: number = 0.1): string {\n const rgb = hexToRgb(hex)\n if (!rgb) return hex\n \n const hsv = rgbToHsv(rgb.r, rgb.g, rgb.b)\n const newV = Math.min(1, hsv.v + amount)\n \n const newRgb = hsvToRgb(hsv.h, hsv.s, newV)\n return rgbToHex(newRgb.r, newRgb.g, newRgb.b)\n}\n\n/**\n * Darken a color by decreasing its HSV Value component.\n * \n * @param hex - The hex color to darken\n * @param amount - Amount to decrease V by (0-1)\n */\nexport function darken(hex: string, amount: number = 0.1): string {\n const rgb = hexToRgb(hex)\n if (!rgb) return hex\n \n const hsv = rgbToHsv(rgb.r, rgb.g, rgb.b)\n const newV = Math.max(0, hsv.v - amount)\n \n const newRgb = hsvToRgb(hsv.h, hsv.s, newV)\n return rgbToHex(newRgb.r, newRgb.g, newRgb.b)\n}\n\n/**\n * Get hover colors for a button based on its background color.\n * Automatically adapts intensity based on the color's luminance.\n * \n * @param bgColor - The button's background color (hex)\n * @param intensity - How strong the hover effect should be ('subtle' | 'medium' | 'strong')\n */\nexport function getHoverColors(\n bgColor: string, \n intensity: 'subtle' | 'medium' | 'strong' = 'medium'\n): { raised: string; pressed: string } {\n const amounts = {\n subtle: 0.01,\n medium: 0.02,\n strong: 0.03,\n }\n \n const amount = amounts[intensity]\n \n return {\n raised: lighten(bgColor, amount), // Raised hover: lighten (lifting up)\n pressed: darken(bgColor, amount), // Pressed hover: darken (pressing down)\n }\n}\n\n/**\n * Check if a color is considered \"dark\" (for choosing text color).\n * Uses HSV Value component for simplicity.\n */\nexport function isDark(hex: string): boolean {\n const rgb = hexToRgb(hex)\n if (!rgb) return true\n const hsv = rgbToHsv(rgb.r, rgb.g, rgb.b)\n return hsv.v < 0.6\n}\n\n/**\n * Shadow strength tiers. Retained because `elevation.ts` keys its level table on\n * them; the neumorphic shadow BUILDERS that used to live here are gone.\n */\nexport type ShadowIntensity = 'subtle' | 'medium' | 'strong'\n","/**\n * Color utility functions for the design system\n *\n * lighten/darken are re-exported from shadows.ts which uses HSV-based\n * color math for more perceptually consistent results across hues.\n */\n\nexport { lighten, darken } from '../theme/color-utils'\n\nexport type StatusType = 'success' | 'error' | 'warning' | 'info'\nexport type ResultType = 'improve' | 'degrade' | 'inconclusive' | 'neutral'\n\n/**\n * Get the semantic color token for a status type.\n *\n * @param status - The status type\n * @returns The CSS variable reference for the status color\n *\n * @example\n * const color = getStatusColor('success') // 'var(--color-status-success)'\n */\nexport function getStatusColor(status: StatusType): string {\n return `var(--color-status-${status})`\n}\n\n/**\n * Get the semantic color token for a result type.\n *\n * @param result - The result type\n * @returns The CSS variable reference for the result color\n *\n * @example\n * const color = getResultColor('improve') // 'var(--color-result-improve)'\n */\nexport function getResultColor(result: ResultType): string {\n return `var(--color-result-${result})`\n}\n\n/**\n * Apply alpha/opacity to a color.\n * Works with hex colors and rgb values.\n *\n * @param color - The color value (hex or rgb)\n * @param opacity - Opacity value between 0 and 1\n * @returns The color with alpha applied\n *\n * @example\n * alpha('#5048E5', 0.5) // 'rgba(80, 72, 229, 0.5)'\n * alpha('rgb(80, 72, 229)', 0.5) // 'rgba(80, 72, 229, 0.5)'\n */\nexport function alpha(color: string, opacity: number): string {\n // Clamp opacity between 0 and 1\n const clampedOpacity = Math.max(0, Math.min(1, opacity))\n\n // Handle hex colors\n if (color.startsWith('#')) {\n const hex = color.slice(1)\n let r: number, g: number, b: number\n\n if (hex.length === 3) {\n r = parseInt(hex[0] + hex[0], 16)\n g = parseInt(hex[1] + hex[1], 16)\n b = parseInt(hex[2] + hex[2], 16)\n } else if (hex.length === 6) {\n r = parseInt(hex.slice(0, 2), 16)\n g = parseInt(hex.slice(2, 4), 16)\n b = parseInt(hex.slice(4, 6), 16)\n } else {\n return color\n }\n\n return `rgba(${r}, ${g}, ${b}, ${clampedOpacity})`\n }\n\n // Handle rgb colors\n const rgbMatch = color.match(/rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)/)\n if (rgbMatch) {\n const [, r, g, b] = rgbMatch\n return `rgba(${r}, ${g}, ${b}, ${clampedOpacity})`\n }\n\n // Handle rgba colors - replace the alpha value\n const rgbaMatch = color.match(/rgba\\((\\d+),\\s*(\\d+),\\s*(\\d+),\\s*[\\d.]+\\)/)\n if (rgbaMatch) {\n const [, r, g, b] = rgbaMatch\n return `rgba(${r}, ${g}, ${b}, ${clampedOpacity})`\n }\n\n return color\n}\n\n/**\n * Determine if a color is light or dark.\n * Useful for determining text color contrast.\n *\n * @param color - Hex color value\n * @returns 'light' or 'dark'\n *\n * @example\n * getLuminance('#FFFFFF') // 'light'\n * getLuminance('#000000') // 'dark'\n */\nexport function getLuminance(color: string): 'light' | 'dark' {\n if (!color.startsWith('#')) return 'dark'\n\n const hex = color.slice(1)\n let r: number, g: number, b: number\n\n if (hex.length === 3) {\n r = parseInt(hex[0] + hex[0], 16)\n g = parseInt(hex[1] + hex[1], 16)\n b = parseInt(hex[2] + hex[2], 16)\n } else if (hex.length === 6) {\n r = parseInt(hex.slice(0, 2), 16)\n g = parseInt(hex.slice(2, 4), 16)\n b = parseInt(hex.slice(4, 6), 16)\n } else {\n return 'dark'\n }\n\n // Calculate relative luminance using sRGB\n const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255\n\n return luminance > 0.5 ? 'light' : 'dark'\n}\n\n/**\n * Get a contrasting text color for a given background.\n *\n * @param backgroundColor - The background color (hex)\n * @returns 'white' or 'black' for contrast\n *\n * @example\n * getContrastText('#5048E5') // 'white'\n * getContrastText('#FFFFFF') // 'black'\n */\nexport function getContrastText(backgroundColor: string): string {\n return getLuminance(backgroundColor) === 'light' ? '#000000' : '#FFFFFF'\n}\n\n","// Font mapping context: presentation-only helpers, no rendering.\nimport { WORKOUT_TOKENS } from '../theme/workout-tokens'\n\n/**\n * Presentation helpers for workout metrics.\n *\n * The data layer (`@voltras/workout-analytics` view-model derivations) supplies\n * EXACT, unrounded values; these turn them into the rounded / banded / formatted\n * forms a view renders. Keeping display munging here — in the design system, not\n * the analytics layer — is the render half of the model↔render split: one view\n * can round while another (or a hover) shows the exact value from the same real\n * data. Workout components consume these so the rules live in one place.\n */\n\n/** Round an exact RPE onto its conventional 0.5 granularity for display. */\nexport function roundRpe(rpe: number): number {\n return Math.round(rpe * 2) / 2\n}\n\n/**\n * Color band for an RPE on the canonical performance scale. Higher RPE = harder\n * = red (direction inverted vs velocity, which shares the same scale). Bands:\n * `<7` green, `7–8.5` yellow, `8.5–9.5` orange, `≥9.5` red.\n */\nexport function rpeColor(rpe: number): string {\n if (rpe >= 9.5) return WORKOUT_TOKENS.scale.red\n if (rpe >= 8.5) return WORKOUT_TOKENS.scale.orange\n if (rpe >= 7) return WORKOUT_TOKENS.scale.yellow\n return WORKOUT_TOKENS.scale.green\n}\n\n/** Round a weight or e1RM to a whole unit for compact display. */\nexport function roundWeight(weight: number): number {\n return Math.round(weight)\n}\n\n/** Format an exact velocity (m/s) to the 2-dp string shown on the velocity strip. */\nexport function formatVelocity(velocity: number): string {\n return velocity.toFixed(2)\n}\n\n/** Round an exact tempo tuple (seconds) to 1 dp per phase for display. */\nexport function roundTempo(\n tempo: [number, number, number, number]\n): [number, number, number, number] {\n return tempo.map((v) => Math.round(v * 10) / 10) as [number, number, number, number]\n}\n\n/** Signed percentage label for a deviation ratio, e.g. `+9%` / `-5%` / `0%`. */\nexport function formatSignedPct(ratio: number): string {\n const pct = Math.round(ratio * 100)\n return `${pct > 0 ? '+' : ''}${pct}%`\n}\n\n/** Structured prescription for the active exercise (from the plan). */\nexport interface PrescriptionInput {\n repsLow?: number\n repsHigh?: number\n weightLbs?: number\n rpe?: number\n}\n\n/**\n * Human prescription string, e.g. `\"8–10 @ 62 lb · RPE 8\"`. `null` when there is\n * nothing to show. Presentation-only: the plan supplies the numbers, this shapes\n * the label.\n */\nexport function formatPrescription(p: PrescriptionInput | null | undefined): string | null {\n if (p == null) return null\n let reps: string | null = null\n if (p.repsLow != null && p.repsHigh != null) {\n reps = p.repsLow === p.repsHigh ? `${p.repsLow}` : `${p.repsLow}–${p.repsHigh}`\n } else if (p.repsLow != null) {\n reps = `${p.repsLow}`\n }\n const weight = p.weightLbs != null ? `${p.weightLbs} lb` : null\n const head = [reps, weight].filter((s): s is string => s != null).join(' @ ')\n const rpe = p.rpe != null ? `RPE ${p.rpe}` : null\n const full = [head.length > 0 ? head : null, rpe]\n .filter((s): s is string => s != null)\n .join(' · ')\n return full.length > 0 ? full : null\n}\n","/**\n * Surface MATERIALS — the treatments layered on top of the flat grey ramp.\n *\n * The ramp says how deep a plane sits. This says what it is made of. Two\n * materials, deliberately: a matte PAPER sheet for hero surfaces, and a recessed\n * INSET WELL for grouped or awaiting-data regions.\n *\n * SCOPE, and it is a hard rule rather than a preference: paper goes on hero\n * surfaces only — the live card, the LOAD/verdict chip, the rest hero. The\n * \"everything is a paper card\" look is explicitly NOT the model; it was an\n * over-application built to find the ceiling. There are no LEVELS of paper. One\n * treatment, used sparingly, or the texture stops meaning anything.\n *\n * Second hard rule: paper fills take DEEP/MUTED tones only (a ramp step, or a\n * categorical `dark` variant). Vivid and neon colours are ink ON paper — never\n * the paper itself.\n *\n * PLATFORM: `backgroundImage` and multi-layer `boxShadow` are web/RNW only. On\n * native these are ignored and the surface falls back to its flat fill, which is\n * why every material here keeps `backgroundColor` load-bearing on its own. A\n * material must never be the only thing carrying meaning.\n *\n * ── THE TONAL FILL IS GONE (VW-99, S-6 wall calibration) ───────────────────\n *\n * `paperSheet` used to carry a vertical ΔL* 3 gradient, sized \"just under seen\n * as a gradient\". On the wall panel at ~3 m it could not be told from a flat\n * sheet of the same tone, and the full material still read as — the operator's\n * words — \"a flat digital rectangle\". It failed its own stated purpose, which\n * was precisely to stop that.\n *\n * Raising it was not available. The design ceiling is ~ΔL* 4 (past that it reads\n * decorative, which the exploration rejected), and the same run showed why the\n * headroom would not have helped: the 0.025 ELEVATION step — a comparable ΔL*\n * — was called instantly, because it sits at a hard edge between two flat\n * fields. The fill spread the same amount smoothly over ~300 px, where vision is\n * genuinely poor. It is a spatial-frequency problem, not an amplitude one, so\n * the band between \"invisible\" and \"decorative\" may simply not exist here.\n *\n * ── AND THE DITHER WENT WITH IT (VW-99 run 2) ──────────────────────────────\n *\n * `ditherTile` was held back one run on the grounds that \"probably dead weight\"\n * is not a measurement. Run 1 could not measure it: with the fill invisible\n * there was no gradient to band, so the panel returned a guaranteed clean sheet.\n *\n * Run 2 settled it by adding a hand-quantised REFERENCE beside the smooth\n * control — the same tone span drawn as five hard-edged 1-level steps, which is\n * what the artefact looks like when it happens. The reference banded plainly and\n * the smooth gradient did not. So the panel can resolve banding; this render\n * path simply does not produce it. A mitigation for an artefact that does not\n * occur is cost with no benefit, and it is gone.\n *\n * That is a claim about THIS display, which is the one the product ships on and\n * the reason `paperSheet` is hero-surface-only. A phone is a separate question.\n *\n * Kept: grain, rim-light, contact shadow.\n *\n * See sources/design/surface-system-north-star.md §4 and\n * sources/runbooks/VW-99-depth-wall-calibration.md.\n */\nimport type { ViewStyle } from 'react-native'\nimport { getSemanticColors } from './tokens/semantic'\n\nconst c = getSemanticColors('dark')\n\n// ── colour math ─────────────────────────────────────────────────────────────\n\nfunction parseHex(hex: string): [number, number, number] | null {\n const h = hex.replace('#', '')\n const full = h.length === 3 ? h.split('').map((ch) => ch + ch).join('') : h\n const rgb: [number, number, number] = [\n parseInt(full.slice(0, 2), 16),\n parseInt(full.slice(2, 4), 16),\n parseInt(full.slice(4, 6), 16),\n ]\n return rgb.some(Number.isNaN) ? null : rgb\n}\n\n/** sRGB perceived luminance (0 dark … 1 bright), Rec.601 weights. */\nfunction perceivedLuminance(hex: string): number {\n const rgb = parseHex(hex)\n if (!rgb) return 0.5\n const [r, g, b] = rgb\n return (0.299 * r + 0.587 * g + 0.114 * b) / 255\n}\n\n// The CIELAB conversion chain (srgb2lin/lin2srgb/fLab/fInv, hexToLab/labToHex,\n// shiftL) lived here so the tonal fill could be specified in ΔL*. It had no\n// other caller, so it went with the fill — see the module header.\n\n// ── grain ───────────────────────────────────────────────────────────────────\n\n/**\n * Grain opacity for a tone, scaled by perceived brightness.\n *\n * A fixed opacity reads hot on a dark plane and vanishes on a bright one, so\n * darker tones get a whisper and brighter tones keep full texture. Anchored so a\n * dark chip (lum ≈ 0.13) lands ≈ 0.06 and a bright bar (lum ≈ 0.58) lands ≈ 0.20.\n * Above roughly 0.05α on a mid tone it starts reading as \"dirty\" rather than\n * matte, which is what the clamp is protecting.\n *\n * This is the ONE curve all grain goes through — a card and a bar carry\n * proportional, not identical, texture. That is what makes them read as the same\n * material.\n */\nexport function grainOpacityForTone(baseColor: string): number {\n return Math.min(0.24, Math.max(0.04, 0.02 + 0.31 * perceivedLuminance(baseColor)))\n}\n\n/**\n * The matte grain tile as a `backgroundImage` url — one shared `feTurbulence`\n * fractal-noise tile, painted once, NEVER animated. Pair with\n * `backgroundColor: baseColor`.\n */\nexport function grainForTone(baseColor: string): string {\n const op = grainOpacityForTone(baseColor).toFixed(3)\n return (\n `url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E` +\n `%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E` +\n `%3Crect width='120' height='120' filter='url(%23n)' opacity='${op}'/%3E%3C/svg%3E\")`\n )\n}\n\n// `tonalFill` and `ditherTile` both lived here until VW-99 measured them on the\n// wall. Deleted rather than left exported-but-unused; the reasoning is in the\n// module header, which is the part worth keeping.\n\n// ── the materials ───────────────────────────────────────────────────────────\n\n/**\n * A matte PAPER hero sheet: brightness-scaled grain + a crisp top rim-light +\n * one soft contact shadow.\n *\n * The contact shadow is the ONE place a drop-shadow is still correct on a dark\n * surface: it is large, soft, and describes a sheet lying on a plane rather than\n * trying to encode hierarchy. Inline depth is the hairline's job.\n *\n * Defaults to `surface-raised` so a same-toned card laid inside reads as one\n * continuous sheet rather than a seam.\n *\n * THE RIM-LIGHT IS A HAIRLINE. Run 2 of VW-99 called it \"weak at distance\" on\n * both the card and the hero sheet, and the reason is visible in the number: it\n * was `rgba(255,255,255,0.10)`, a 1px white line on a dark plane — physically\n * the same cue as `hairline-*`, but set BELOW `hairline-default`, which the same\n * run had just had to raise twice. It is not a subtler species of edge, it was\n * simply mistuned. Raised to `0.20`, between `hairline-default` and\n * `hairline-strong`: this edge defines a hero surface, so it earns more than the\n * default separator, and unlike a separator there is no fallback behind it.\n *\n * Deliberately NOT wired to the token, though the values now agree in spirit: a\n * box-shadow rim and a border hairline are retuned by different evidence, and\n * coupling them means a hairline run silently restyles every hero sheet.\n *\n * HERO SURFACES ONLY, MUTED TONES ONLY — see the module header.\n */\nexport function paperSheet(tone: string = c['surface-raised']): ViewStyle {\n return {\n backgroundColor: tone,\n // Grain alone. The dither went with the gradient it protected — see header.\n backgroundImage: grainForTone(tone),\n boxShadow: 'inset 0 1px 0 rgba(255,255,255,0.20), 0 8px 22px rgba(0,0,0,0.50)',\n } as unknown as ViewStyle\n}\n\n/**\n * A recessed INSET WELL: a tone pressed BELOW the surrounding plane, cut in by an\n * inner top shadow with a faint light line on the floor.\n *\n * The bottom rim is the load-bearing half. A dark inset alone just reads as a\n * darker rectangle; it is the light catching the floor that says \"this is below\n * the surface\" — which is why the treatment survives at 16px where a full paper\n * treatment does not.\n *\n * The floor light was `0.04` and is now `0.12`, chosen on the wall in VW-99 run\n * 2 against a `.04`-vs-`.12`-vs-none forced choice. Worth recording that `.04`\n * was NOT invisible — the no-line decoy was correctly rejected and both real\n * values were seen, so this is a preference between two working values, not a\n * rescue. The rim-light next door was a genuine miss; this one was only thin.\n *\n * Note this is a MATERIAL, and independent of the surface LEVEL named `inset`\n * that was retired in TD-07.14. A well is something you apply; a level is\n * somewhere you sit.\n */\nexport function insetWell(tone: string = c['surface-input']): ViewStyle {\n return {\n backgroundColor: tone,\n boxShadow: 'inset 0 2px 6px rgba(0,0,0,0.55), inset 0 -1px 0 rgba(255,255,255,0.12)',\n } as unknown as ViewStyle\n}\n\n/**\n * Paper for a COLORED BAR — the same material as {@link paperSheet}, tuned for a\n * small saturated element: grain + top rim-light + a contact shadow cast past the\n * bar's leading edge, so a filled bar reads as a physical block that has travelled.\n *\n * No tonal fill or dither here: a bar is too narrow for a ΔL* 3 gradient to read,\n * and too narrow to band.\n *\n * `flip` = a vertically mirrored (`scaleY(-1)`) plot, i.e. the `down` wing of a\n * diverging chart. The contact shadow's y-offset is pre-inverted so the mirror\n * lands it pointing AWAY from the shared axis rather than up across it, and the\n * top rim-light is DROPPED — mirrored it would sit on the axis edge and read\n * wrong, so grain and shadow carry the material alone.\n */\nexport function barPaper(color: string, flip = false): ViewStyle {\n return {\n backgroundImage: grainForTone(color),\n boxShadow: flip\n ? '0 -6px 16px rgba(0,0,0,0.45)'\n : 'inset 0 1.5px 0 rgba(255,255,255,0.22), 0 6px 16px rgba(0,0,0,0.45)',\n } as unknown as ViewStyle\n}\n","// On-surface colour context (TD-05.12).\n//\n// A <Surface> owns a background from a small elevation scale AND publishes the\n// current theme mode so descendant text/icons resolve their colour from \"what\n// surface am I on\" instead of a `text-*` className. Those classNames silently\n// fail to black when the tree renders as raw RN in the standalone wall SPA\n// (no global.css, no nativewind) — the bug class this primitive retires.\nimport { createContext, useContext } from 'react'\nimport { getSemanticColors, type ThemeMode } from '../../../theme/tokens/semantic'\n\ntype ColorToken = keyof ReturnType<typeof getSemanticColors>\n\n/**\n * A Surface's depth on the dark surface ramp. Each addressable level maps to an\n * EXISTING semantic surface/background token (already grounded in the derived\n * surface ramp — TD-surface-tokens S-1 — and theme-aware) — Surface introduces\n * no new hexes. Darkest → lightest:\n * inset (#13100D) < background (#1C1916) < base (#252321) < elevated (#2A2827) < raised (#2D2C2B) < overlay (#302F2E)\n *\n * `frame` is the bezel the ramp sits inside — the top bar / side nav chrome —\n * and the floor a `<Surface pressed>` clamps at (see {@link pressedLevel}).\n *\n * It replaced a separate `inset` level in TD-07.14. That level was RETIRED, not\n * renamed: at ΔE 1.10 from the frame it was an imperceptible duplicate, which is\n * exactly why pressed (surface − 1) kept collapsing into it.\n */\nexport type SurfaceLevel = 'frame' | 'background' | 'base' | 'elevated' | 'raised' | 'overlay'\n\n/** On-surface neutral text roles, resolved for the current surface + theme. */\nexport type OnSurfaceRole = 'primary' | 'secondary' | 'tertiary'\n\n// Which semantic token backs each level. Values live in `semantic.ts` and stay\n// in sync with the grey ramp — this map never carries literal hexes. Every level\n// is present now: swapping `inset` (which had no token) for `frame` (which does)\n// is what made this a total map and removed `surfaceBackground`'s special case.\nexport const SURFACE_LEVEL_TOKEN = {\n frame: 'background-frame',\n background: 'background-base',\n base: 'surface-base',\n elevated: 'surface-elevated',\n raised: 'surface-raised',\n overlay: 'surface-overlay',\n} as const satisfies Record<SurfaceLevel, ColorToken>\n\n// Darkest → lightest. A `<Surface pressed>` renders one index DOWN from its\n// parent's level and clamps at `frame` (index 0). Kept in lockstep with the grey\n// ramp and the surface.contract.test PLANE_ORDER.\nconst PRESSED_RAMP = ['frame', 'background', 'base', 'elevated', 'raised', 'overlay'] as const\n\nconst ON_SURFACE_TOKEN = {\n primary: 'text-primary',\n secondary: 'text-secondary',\n tertiary: 'text-tertiary',\n} as const satisfies Record<OnSurfaceRole, ColorToken>\n\nexport interface SurfaceContextValue {\n /** Active theme mode. Defaults to dark (the wall). */\n mode: ThemeMode\n /** Depth of the nearest enclosing Surface. */\n level: SurfaceLevel\n}\n\n// Default context: dark 'base' plane, so descendants OUTSIDE any Surface still\n// resolve to real dark colours (never black) on the dark-only wall.\nconst DEFAULT_CONTEXT: SurfaceContextValue = { mode: 'dark', level: 'base' }\n\nexport const SurfaceContext = createContext<SurfaceContextValue>(DEFAULT_CONTEXT)\n\n/** The nearest surface context ({ mode, level }); default dark 'base'. */\nexport function useSurface(): SurfaceContextValue {\n return useContext(SurfaceContext)\n}\n\n/** The active theme mode from the nearest Surface/provider (default dark). */\nexport function useSurfaceMode(): ThemeMode {\n return useContext(SurfaceContext).mode\n}\n\n/**\n * Literal-hex on-surface neutral text colours for a theme mode. Uses\n * `getSemanticColors` (literal hex — the TempoBar pattern), never `resolveColor`\n * (which returns `var()` under the RNW vitest alias), so values stay real in\n * tested component code and on raw-RN surfaces alike.\n */\nexport function onSurfaceColors(mode: ThemeMode): Record<OnSurfaceRole, string> {\n const c = getSemanticColors(mode)\n return {\n primary: c[ON_SURFACE_TOKEN.primary],\n secondary: c[ON_SURFACE_TOKEN.secondary],\n tertiary: c[ON_SURFACE_TOKEN.tertiary],\n }\n}\n\n/** Resolve one on-surface text colour for descendants of a Surface. */\nexport function useOnSurfaceColor(role: OnSurfaceRole = 'primary'): string {\n return getSemanticColors(useSurfaceMode())[ON_SURFACE_TOKEN[role]]\n}\n\n/** The background hex for a surface level under a theme mode (literal hex). */\nexport function surfaceBackground(level: SurfaceLevel, mode: ThemeMode): string {\n return getSemanticColors(mode)[SURFACE_LEVEL_TOKEN[level]]\n}\n\n/**\n * The level a `<Surface pressed>` resolves to: its parent's level stepped one\n * index DOWN the ramp — the symmetric twin of a raised surface stepping up —\n * clamped at the `frame` floor so a pressed surface never underflows the bezel.\n * overlay→raised, raised→elevated, elevated→base, base→background,\n * background→frame, frame→frame (clamped).\n * Pressed exposes ONE level of depth only (no pressed-2).\n */\nexport function pressedLevel(parent: SurfaceLevel): SurfaceLevel {\n const index = PRESSED_RAMP.indexOf(parent)\n const down = Math.max(0, index - 1)\n return PRESSED_RAMP[down]\n}\n","// The newest-rep grow-from-bottom entrance, shared by SetBarChart (hero / dual / ROM)\n// and VelocityStrip's framed + bare expanded charts. Promoted out of VelocityStrip so\n// every value-height bar family animates the live rep identically instead of re-rolling\n// the hook.\nimport { useEffect, useState } from 'react'\nimport { Animated, Easing } from 'react-native'\n\nconst ANIMATION_EASING = Easing.bezier(0.22, 1, 0.36, 1)\n\n/**\n * Growth-factor overshoot for a new-peak bar: it grows past its full height then\n * settles back to 1 (a small bounce), rather than the plain 0→1 grow every other\n * bar gets. Modest (12%) since it stretches actual bar HEIGHT, not a uniform scale\n * — a large overshoot here reads as a much bigger jump than the same factor did\n * against the old whole-bar scale pop.\n */\nconst PEAK_OVERSHOOT = 1.12\n\nfunction getReducedMotionPreference(): boolean {\n if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') return false\n return window.matchMedia('(prefers-reduced-motion: reduce)').matches\n}\n\n/** Track the OS \"reduce motion\" preference; falls back to `false` (jsdom/SSR). */\nexport function usePrefersReducedMotion(): boolean {\n const [reduced, setReduced] = useState(getReducedMotionPreference)\n useEffect(() => {\n if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') return\n const mq = window.matchMedia('(prefers-reduced-motion: reduce)')\n const handler = () => setReduced(mq.matches)\n handler()\n mq.addEventListener?.('change', handler)\n return () => mq.removeEventListener?.('change', handler)\n }, [])\n return reduced\n}\n\n/**\n * The newest-rep entrance shared by SetBarChart and the framed / bare `expanded` charts:\n * the bar GROWS UP FROM THE BASELINE (0 → full height), reading as though it's tracking\n * the rep as it lands. A new set peak overshoots past full height then settles (a small\n * bounce) instead of the plain grow. Honors reduced motion (jumps straight to full\n * height, no animation). Returns a 0→1(+overshoot) growth-factor `Animated.Value`;\n * callers interpolate it against their own target height. Inert while `active` is\n * false or no live rep is present.\n */\nexport function useLiveRepGrowth(\n active: boolean,\n liveRepIndex: number | undefined,\n liveVelocity: number | undefined,\n isNewPeak: boolean\n): Animated.Value {\n const prefersReducedMotion = usePrefersReducedMotion()\n const [liveGrowth] = useState(() => new Animated.Value(1))\n useEffect(() => {\n if (!active || liveRepIndex == null || liveVelocity == null) return\n if (prefersReducedMotion) {\n liveGrowth.setValue(1)\n return\n }\n liveGrowth.setValue(0)\n if (isNewPeak) {\n Animated.sequence([\n Animated.timing(liveGrowth, {\n toValue: PEAK_OVERSHOOT,\n duration: 220,\n easing: Easing.out(Easing.quad),\n useNativeDriver: false,\n }),\n Animated.spring(liveGrowth, {\n toValue: 1,\n friction: 5,\n tension: 140,\n useNativeDriver: false,\n }),\n ]).start()\n } else {\n // Plain entrance: a clean ease-out grow with no overshoot (ANIMATION_EASING has\n // no control point above y=1) — it reads as tracking the rep, not bouncing.\n Animated.timing(liveGrowth, {\n toValue: 1,\n duration: 300,\n easing: ANIMATION_EASING,\n useNativeDriver: false,\n }).start()\n }\n }, [active, liveRepIndex, liveVelocity, isNewPeak, prefersReducedMotion, liveGrowth])\n return liveGrowth\n}\n\nexport { ANIMATION_EASING }\n","/**\n * Custom JSX runtime for titan-design's web distribution.\n *\n * Converts className props to $$css style objects at build time,\n * eliminating the need for NativeWind's runtime interopComponents\n * Map lookup. RNW's styleq recognizes $$css objects and applies\n * their values as CSS class names on DOM elements.\n *\n * This file is NOT used by source builds (specimen, storybook,\n * native Metro). It is only inlined into the dist by tsup via\n * an esbuild onResolve plugin.\n */\nimport {\n jsx as reactJsx,\n jsxs as reactJsxs,\n Fragment,\n} from 'react/jsx-runtime'\nimport type { StyleProp } from 'react-native'\n\ntype JsxFn = typeof reactJsx\n\nfunction wrapJsx(fn: JsxFn): JsxFn {\n return function (type, props: Record<string, any>, ...rest) {\n if (props && typeof props.className === 'string' && props.className) {\n const cn = props.className\n const cssStyle = { $$css: true, [cn]: cn } as unknown as StyleProp<any>\n const existing = props.style\n props = {\n ...props,\n style: existing ? [cssStyle, existing] : cssStyle,\n }\n delete props.className\n }\n return fn(type, props, ...rest)\n } as JsxFn\n}\n\nconst jsx = wrapJsx(reactJsx)\nconst jsxs = wrapJsx(reactJsxs)\n\nexport { jsx, jsxs, Fragment }\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\n/**\n * SetBarChart — the generic per-rep value-height bar chart both the velocity hero and the\n * ROM progression compose. It OWNS the chart geometry (value→height scaling, the shared\n * `scaleMax` override, the plot-width-driven adaptive bar width / gap stepping / value-label\n * thinning) and the shared bar language (paper treatment, grow-from-bottom live rep, up/down\n * orientation, the set-type slot vocabulary). Everything domain-specific — bar COLOR, the\n * reference overlay (velocity VL bands / ROM working+short lines) — is passed in, so an\n * improvement to the chart (spacing, paper, live-grow) lands once for every consumer.\n *\n * VALUE-HEIGHT ONLY: the flat 3px `mini` strip stays its own thin strip in VelocityStrip.\n */\nimport { useState, type ReactNode } from 'react'\nimport {\n View,\n Text,\n Animated,\n type ViewProps,\n type ViewStyle,\n type LayoutChangeEvent,\n} from 'react-native'\nimport { primitiveRamps } from '../../../theme/tokens/primitives'\nimport { barPaper } from '../../../theme/materials'\nimport { useOnSurfaceColor, useSurface, surfaceBackground } from '../../ui/surface/SurfaceContext'\nimport { useLiveRepGrowth } from './live-rep-growth'\n\n/** Linear-blend two #RRGGBB hexes (`t`=0 → a, 1 → b) — the surface-relative solid to-do tone. */\nfunction mixHex(a: string, b: string, t: number): string {\n const parse = (h: string): [number, number, number] => {\n const s = h.replace('#', '')\n return [parseInt(s.slice(0, 2), 16), parseInt(s.slice(2, 4), 16), parseInt(s.slice(4, 6), 16)]\n }\n const [ar, ag, ab] = parse(a)\n const [br, bg, bb] = parse(b)\n const ch = (x: number, y: number): string =>\n Math.round(x + (y - x) * t)\n .toString(16)\n .padStart(2, '0')\n return `#${ch(ar, br)}${ch(ag, bg)}${ch(ab, bb)}`\n}\n\n/** The cyan variable-window fill — the range set's `floor..max` window (shared with SetStrip). */\nexport const VARIABLE_FILL = primitiveRamps.cyan[900]\n/** The thin cyan-800 outline on the open-ended \"continue\" slot — reads as \"keep going\". */\nexport const CONTINUE_OUTLINE = primitiveRamps.cyan[800]\n\n/**\n * One drawn cell of the chart. `rep` carries a `value` and draws a value-height bar;\n * `todo` / `variable` / `continue` are the set-type window stubs (planned remainder, the\n * range floor..max window, the AMRAP/myo open tail); `empty` is a rep COLUMN a side didn't\n * log — a faint constant-contrast placeholder that keeps the two diverging wings index-locked\n * (a lagging side's missing rep sits at the SAME column index as the other side's rep).\n * `leadingGap` adds spacing BEFORE the cell beyond the uniform inter-bar gap — the WIDE\n * chunk-notch that splits drop sub-loads / myo clusters / cluster intra-rests. Absent\n * `leadingGap` = the ordinary rep gap.\n */\nexport interface SetSlot {\n kind: 'rep' | 'todo' | 'variable' | 'continue' | 'empty'\n value?: number\n leadingGap?: number\n}\n\n/** The geometry SetBarChart hands a {@link SetBarChartProps.renderReference} overlay painter. */\nexport interface SetBarGeometry {\n /** The height-scaling denominator (a value `v` sits `yOf(v)` px up from the baseline). */\n scaleDenom: number\n /** The drawable plot height (px) — `height` minus the value-label headroom when labels show. */\n plotHeight: number\n /** px UP from the baseline for a value. */\n yOf: (value: number) => number\n /** The tallest performed value — the running-best reps are measured against. */\n best: number\n /** The plot is vertically mirrored (a `down` wing) — counter-flip any text in the overlay. */\n flip: boolean\n}\n\nexport interface SetBarChartProps {\n /** Ordered cells — performed reps + any set-type window stubs. */\n slots: SetSlot[]\n /** value → bar fill color. Reps only; window stubs use the fixed set-type tones. */\n colorFor: (value: number) => string\n /** Plot height (px). Bars scale into this (minus the value-label headroom when labels show). */\n height: number\n /**\n * Height scaling. `peak` (default) scales to the performed max (+headroom); `fixed` scales\n * to a fixed velocity ceiling so heights read the same absolute value across sets. Overridden\n * by {@link scaleMax}.\n */\n scale?: 'peak' | 'fixed'\n /**\n * OVERRIDE the height denominator with `scaleMax * headroom` (BAR HEIGHT ONLY; color + the\n * reference `best` still read this chart's own values). The diverging dual passes the pair's\n * shared max so a stronger side reads TALLER against one common scale.\n */\n scaleMax?: number\n /** `up` (default) grows bars UP from a bottom baseline; `down` mirrors the plot (grows DOWN, text upright). */\n orientation?: 'up' | 'down'\n /** Index (into the rep slots) of the newest rep — that bar grows up from the baseline as it lands. */\n liveRepIndex?: number\n /** The live rep set a new peak — its entrance overshoots then settles (a small bounce). */\n isNewPeak?: boolean\n /**\n * Append dashed todo placeholders so the chart reads \"3 of N done\". Ignored when the `slots`\n * already run to (or past) this count — a caller that supplies its own todo slots omits this.\n */\n targetReps?: number\n /**\n * Inter-bar gap as a fraction of bar width (gap ≈ gapRatio·barWidth, floored at 2px). Default\n * {@link GAP_RATIO}. Lower = denser (toward the near-touching expanded density); narrow screens\n * floor to 2px regardless. Exposed mainly for a spacing-density comparison.\n */\n gapRatio?: number\n /** Corner radius on the bars (px). Default 5. */\n barRadius?: number\n /**\n * Which corners round. `top` (default) — the bolder top-rounded WALL HERO look. `all` — the thin\n * radius-2 flat-bar language (the SegmentedBar pill), for rep-level compact + expanded in the\n * rail / card / table so a compact↔expanded morph keeps a constant all-corners radius.\n */\n cornerStyle?: 'top' | 'all'\n /**\n * FLAT height mode (the `compact` resting form). Every rep bar renders at ONE uniform short height\n * ({@link FLAT_BAR_FRACTION} of the plot) instead of value-height — EVERYTHING else identical\n * (colors, paper, the proportional spacing + chunk-notch, todo/variable/continue slots, gutter).\n * Value labels are suppressed. Same x-positions/widths/gaps as value mode, so a compact↔expanded\n * toggle only changes bar HEIGHTS in place (no horizontal reflow).\n */\n flat?: boolean\n /**\n * Draw a per-rep value label. Default false. When on, every label pins to one aligned row at the\n * plot TOP (not offset per bar height) in the muted on-surface-secondary tone. Ignored in {@link flat} mode.\n */\n showValueLabels?: boolean\n /** Format a rep value for its label. Default `String`. */\n formatValue?: (value: number) => string\n /**\n * To-do placeholder treatment. `solid` (default) — a solid surface-relative section (the plane\n * blended toward the on-surface neutral). `dashed` — a dashed outline stub. Exists so ROM can keep\n * its dashed to-do while the hero (and the dual that composes it) take the solid section.\n */\n todoVariant?: 'solid' | 'dashed'\n /**\n * Pad the rendered columns to at least this many with placeholder to-do cells. The diverging dual\n * passes the union column count of both wings so bars line up top↔bottom across the centre axis.\n */\n minColumns?: number\n /** Paint a reference overlay (VL bands / working-standard lines) given the chart geometry. */\n renderReference?: (geometry: SetBarGeometry) => ReactNode\n /**\n * Per-rep OVERLAY, rendered inside each rep column above the bar (for the framed `expanded`\n * chrome to inject its per-bar m/s label + `onRepPress` pressable without duplicating bar\n * rendering). When provided, SetBarChart suppresses its OWN value label (the overlay owns it) and\n * the rep columns become interactive (not a11y-hidden).\n */\n renderBarOverlay?: (repIndex: number, value: number) => ReactNode\n /**\n * IN-PLACE expand animation: an `Animated.Value` 0→1 that morphs every rep bar between its FLAT\n * (compact) height and its VALUE height, and fades the value labels in. The x-geometry stays fixed\n * (widths / gaps / positions), so a compact↔expanded toggle animates only heights — no reflow.\n * Overrides `flat` + the live-rep grow while animating.\n */\n expandProgress?: Animated.Value\n /** Suppress the plot's own 2px baseline border (the dual draws ONE shared centre axis instead). */\n hideBaseline?: boolean\n /** Container testID. */\n testID?: string\n /** Prefix for the per-cell testIDs: `${prefix}-bar-N`, `${prefix}-label-N`, `${prefix}-slot-KIND`. Default `setbar`. */\n testIDPrefix?: string\n /** When set, the container reads as an `image` with this label; omit for a plain (unlabeled) plot. */\n accessibilityLabel?: string\n /**\n * Optional stream / slot NAME (e.g. \"Left Arm\") rendered as a rotated vertical edge label down a\n * left gutter — the same treatment the diverging dual gives each wing. Font size scales to `height`\n * so it fits without truncation. Omitted → no gutter.\n */\n label?: string\n className?: string\n /** Rest View props (style is merged onto the container). */\n viewProps?: ViewProps\n}\n\n/** The `scale=\"fixed\"` velocity ceiling (m/s) — a bar height reads the same absolute value across sets. */\nconst FIXED_MAX_VALUE = 1.15\n/** Headroom above the peak bar: just enough to seat its value label without a big empty band on top. */\nexport const PEAK_HEADROOM = 1.03\n\n/** The height-scaling denominator for `scale` at the given performed max (guarded ≥ 0 by callers). */\nexport function scaleDenominator(scale: 'peak' | 'fixed', maxValue: number): number {\n return scale === 'fixed' ? FIXED_MAX_VALUE : maxValue * PEAK_HEADROOM\n}\n\n/**\n * The per-bar value-label font size (px), scaled to chart `height` (floored at 8) so the numbers stay\n * proportionate to the bars at small heights instead of reading oversized. Hits the full 12px at the\n * standard single-hero (220px) and dual-wing (~110px) scales; shrinks toward the floor on tiny charts.\n */\nexport function valueLabelFontSize(height: number): number {\n return Math.round(Math.max(8, Math.min(12, height * 0.11)))\n}\n\n// --- Hero geometry -----------------------------------------------------------\n/** Default plot height (px) — tall enough to read a set's shape across a room. */\nexport const SET_BAR_DEFAULT_HEIGHT = 220\n/** Value-label row height (px) — the only headroom reserved above the bars when labels show. */\nconst LABEL_ROW_HEIGHT = 16\n/** Gap between the value-label row and the peak bar top (px). */\nconst LABEL_GAP = 3\n/** Inter-bar gap as a fraction of bar width — the locked dense default (near expanded density). */\nexport const GAP_RATIO = 0.08\n/** Floor on the proportional inter-bar gap (px) — narrow plots tighten to ~expanded density. */\nconst MIN_BAR_GAP = 2\n/**\n * The EXTRA margin at a chunk boundary (drop sub-load / myo cluster / cluster intra-rest), as a\n * fraction of bar width — proportional so it scales with the dense spacing and reads as a clear\n * cluster break (total boundary gap ≈ this + the normal gapRatio ≈ ⅓ of a bar). Floored so small\n * charts still separate clusters.\n */\nconst CHUNK_NOTCH_RATIO = 0.25\n/** Floor on the chunk-boundary extra margin (px). */\nconst CHUNK_NOTCH_MIN_PX = 10\n/** Cap on a single bar's width so a 2–3 rep set doesn't render slab-wide bars (px). */\nexport const BAR_MAX_WIDTH = 120\n/** Below this per-bar width the value labels collide, so all but the peak + live rep are dropped. */\nconst LABEL_MIN_BAR_WIDTH = 30\n/** Default top-corner radius on bars (px). */\nconst DEFAULT_BAR_RADIUS = 5\n/** Minimum drawn height of a performed bar (px) — a near-zero rep still reads as a rep. */\nconst MIN_BAR_HEIGHT = 4\n/** In `flat` (compact) mode every rep bar is this fraction of the plot height — a uniform short bar. */\nconst FLAT_BAR_FRACTION = 0.5\n/** The stub height for a window cell (todo / variable / continue / empty) — a short, clear placeholder. */\nconst STUB_HEIGHT = 9\n/** The ordinary rep gap the per-slot `leadingGap` is measured against (extra margin = leadingGap − this). */\nconst REP_GAP = 2\n\n/**\n * The shared adaptive bar layout — solve `N·bw + (N−1)·(gapRatio·bw) = plotWidth` for the per-bar\n * width (capped at {@link BAR_MAX_WIDTH}) and the proportional inter-bar gap (floored at MIN_BAR_GAP).\n * SetBarChart uses this for its own bars; the diverging compact/rail renderers call it too, so their\n * columns land at the SAME x-positions and widths as the single chart — one shared geometry.\n */\nexport function computeBarLayout(\n plotWidth: number,\n count: number,\n gapRatio: number = GAP_RATIO\n): { barWidth: number; gap: number } {\n const rawBarWidth =\n plotWidth > 0 && count > 0 ? plotWidth / (count + (count - 1) * gapRatio) : BAR_MAX_WIDTH\n const barWidth = Math.min(BAR_MAX_WIDTH, rawBarWidth)\n const gap = plotWidth === 0 ? MIN_BAR_GAP : Math.max(MIN_BAR_GAP, gapRatio * barWidth)\n return { barWidth, gap }\n}\n\n/** Is this cell a performed rep (carries a value)? */\nfunction isRep(slot: SetSlot): boolean {\n return slot.kind === 'rep'\n}\n\n/**\n * The performed-rep index for each cell (`-1` for a window stub) — reps are contiguous from 0 in\n * every set type, so this maps `liveRepIndex` / peak / label-thinning (rep-indexed) onto cells.\n */\nfunction repIndexByCell(cells: SetSlot[]): number[] {\n let count = 0\n return cells.map((slot) => (isRep(slot) ? count++ : -1))\n}\n\nexport function SetBarChart({\n slots,\n colorFor,\n height,\n scale = 'peak',\n scaleMax,\n orientation = 'up',\n liveRepIndex,\n isNewPeak = false,\n targetReps,\n gapRatio = GAP_RATIO,\n barRadius = DEFAULT_BAR_RADIUS,\n cornerStyle = 'top',\n flat = false,\n showValueLabels: showValueLabelsProp = false,\n formatValue = String,\n todoVariant = 'solid',\n minColumns,\n renderReference,\n renderBarOverlay,\n expandProgress,\n hideBaseline = false,\n testID,\n testIDPrefix = 'setbar',\n accessibilityLabel,\n label,\n className,\n viewProps = {},\n}: SetBarChartProps) {\n // Append todo placeholders up to `targetReps` (a caller that builds its own todo slots omits it),\n // then pad to `minColumns` so a diverging wing aligns column-for-column with its sibling.\n const targetPadded = Math.max(slots.length, targetReps ?? 0, minColumns ?? 0)\n const cells: SetSlot[] =\n targetPadded > slots.length\n ? [\n ...slots,\n ...Array.from({ length: targetPadded - slots.length }, () => ({ kind: 'todo' as const })),\n ]\n : slots\n\n const repValues = cells.filter(isRep).map((s) => s.value ?? 0)\n const best = repValues.length > 0 ? Math.max(...repValues) : 0\n\n // The whole plot mirrors for `down`; text nodes counter-flip so they read upright.\n const flip = orientation === 'down'\n const flipStyle = flip ? ({ transform: [{ scaleY: -1 as number }] } as const) : null\n\n // Planned/to-do reps + the baseline draw in a SURFACE-relative neutral (on-surface tertiary)\n // so they stay legible on every plane instead of a fixed grey.\n const placeholderColor = useOnSurfaceColor('tertiary')\n // The expanded strip's solid to-do tone: the surface plane blended toward the neutral (the same\n // relative model), so a `todoVariant=\"solid\"` section holds ~constant contrast on every plane.\n const surface = useSurface()\n const surfaceBg = surfaceBackground(surface.level, surface.mode)\n const solidTodoColor = mixHex(surfaceBg, placeholderColor, 0.55)\n // An `empty` cell (a rep the diverging side didn't log) is fainter than a planned to-do.\n const emptyColor = mixHex(surfaceBg, placeholderColor, 0.28)\n // `all` rounds every corner (the thin flat-bar pill); `top` keeps the bolder hero top-round.\n const barCorners: ViewStyle =\n cornerStyle === 'all'\n ? { borderRadius: barRadius }\n : { borderTopLeftRadius: barRadius, borderTopRightRadius: barRadius }\n\n // `scaleMax` (the diverging dual's shared pair-max) overrides the height denominator so both\n // sides share ONE height scale; color + the reference still read this chart's own values.\n const scaleDenom =\n scaleMax != null && scaleMax > 0 ? scaleMax * PEAK_HEADROOM : scaleDenominator(scale, best)\n\n // `flat` (compact) mode suppresses value labels and renders every rep at one uniform short height.\n const showValueLabels = showValueLabelsProp && !flat\n // Reserve ONLY the value-label row (+ its gap to the peak bar) as headroom — not a fat fixed\n // band — so the bars fill the plot and, at small heights, aren't over-stubbed.\n const plotHeight = Math.max(0, height - (showValueLabels ? LABEL_ROW_HEIGHT + LABEL_GAP : 0))\n const yOf = (value: number): number => (scaleDenom > 0 ? (value / scaleDenom) * plotHeight : 0)\n // The `expandProgress` morph starts from a PARTIAL flat height (bars visibly grow to their value);\n // a STATIC compact strip instead FILLS its plot — an 8px plot → an 8px bar, the SegmentedBar model —\n // so a resting strip is sized by its container, not left half-empty.\n const flatBarHeight = Math.max(MIN_BAR_HEIGHT, FLAT_BAR_FRACTION * plotHeight)\n const compactBarHeight = Math.max(MIN_BAR_HEIGHT, plotHeight)\n const valueBarHeight = (value: number): number =>\n scaleDenom > 0\n ? Math.max(MIN_BAR_HEIGHT, Math.min(1, value / scaleDenom) * plotHeight)\n : MIN_BAR_HEIGHT\n const barHeight = (value: number): number => (flat ? compactBarHeight : valueBarHeight(value))\n\n // Live-rep grow-from-bottom (rep index → cell index; reps are contiguous from 0 in every set type).\n const liveValue =\n liveRepIndex != null && liveRepIndex < repValues.length ? repValues[liveRepIndex] : undefined\n const liveGrowth = useLiveRepGrowth(true, liveRepIndex, liveValue, isNewPeak)\n\n // Measure the plot so per-bar value labels can thin on a narrow chart (they collide once bars\n // get thin). Width 0 (unmeasured) → show all, so test/server renders are unchanged.\n const [plotW, setPlotW] = useState(0)\n const onPlotLayout = (e: LayoutChangeEvent) => setPlotW(e.nativeEvent.layout.width)\n\n // Inter-bar gap is PROPORTIONAL to bar width (gap ≈ gapRatio·barWidth, floored at MIN_BAR_GAP).\n // Solve N·bw + (N−1)·(gapRatio·bw) = plotW → bw = plotW / (N + (N−1)·gapRatio); the bars tighten to\n // ~expanded density on narrow plots (the floor) and the ratio sets how dense they read at wall scale.\n const totalCells = cells.length\n const { barWidth, gap } = computeBarLayout(plotW, totalCells, gapRatio)\n const labelsCrowded = plotW > 0 && barWidth < LABEL_MIN_BAR_WIDTH\n\n // Peak rep index (over rep values) — its label always survives label-thinning.\n const peakRepIndex = repValues.reduce((b, v, i) => (v > repValues[b] ? i : b), 0)\n const showBarLabel = (repIndex: number): boolean =>\n !labelsCrowded || repIndex === peakRepIndex || repIndex === liveRepIndex\n\n const geometry: SetBarGeometry = { scaleDenom, plotHeight, yOf, best, flip }\n\n const { style: externalStyle, ...restProps } = viewProps\n const a11y =\n accessibilityLabel != null ? { accessibilityRole: 'image' as const, accessibilityLabel } : {}\n\n // Which performed rep each cell is (window stubs → -1) — for live-grow / peak / label thinning.\n const repIndices = repIndexByCell(cells)\n\n return (\n <View\n className={className}\n style={[{ height, flexDirection: 'row' }, externalStyle]}\n testID={testID}\n {...a11y}\n {...restProps}\n >\n {label ? (\n <ChartSideRail\n sections={[{ label, testID: `${testIDPrefix}-side-label` }]}\n sectionExtent={height}\n />\n ) : null}\n <View\n onLayout={onPlotLayout}\n style={{\n flex: 1,\n flexDirection: 'row',\n alignItems: 'flex-end',\n gap,\n position: 'relative',\n borderBottomWidth: hideBaseline ? 0 : 2,\n borderBottomColor: placeholderColor,\n ...flipStyle,\n }}\n >\n {renderReference?.(geometry)}\n\n {cells.map((slot, i) => {\n // A chunk boundary (leadingGap > the ordinary rep gap) gets extra margin PROPORTIONAL to\n // bar width (floored) so the cluster break scales with the dense spacing and stays clear;\n // ordinary cells add nothing beyond the container's flex gap.\n const isChunkBoundary = (slot.leadingGap ?? REP_GAP) > REP_GAP\n const extraGap = isChunkBoundary\n ? Math.max(CHUNK_NOTCH_MIN_PX, CHUNK_NOTCH_RATIO * barWidth)\n : 0\n const column: ViewStyle = {\n flex: 1,\n maxWidth: BAR_MAX_WIDTH,\n height: '100%',\n alignItems: 'center',\n justifyContent: 'flex-end',\n marginLeft: extraGap,\n }\n\n if (!isRep(slot)) {\n return (\n <View key={i} accessibilityElementsHidden style={column}>\n {renderStub(\n slot.kind,\n barCorners,\n // Flat (compact) stubs fill the plot like the compact bars; else the fixed short stub.\n flat ? compactBarHeight : STUB_HEIGHT,\n placeholderColor,\n testIDPrefix,\n todoVariant,\n solidTodoColor,\n emptyColor\n )}\n </View>\n )\n }\n\n const repIndex = repIndices[i]\n const value = slot.value ?? 0\n const isLive = liveRepIndex === repIndex\n const color = colorFor(value)\n // Bar height: `expandProgress` morphs flat↔value in place; else the live-rep grow; else static.\n const barHeightStyle = expandProgress\n ? expandProgress.interpolate({\n inputRange: [0, 1],\n outputRange: [flatBarHeight, valueBarHeight(value)],\n })\n : isLive\n ? liveGrowth.interpolate({ inputRange: [0, 1], outputRange: [0, barHeight(value)] })\n : barHeight(value)\n // The wrapper's `renderBarOverlay` owns labels + press when present (so SetBarChart doesn't\n // duplicate them); its own label shows otherwise, fading in with `expandProgress`.\n const ownLabel = showValueLabels && !renderBarOverlay && showBarLabel(repIndex)\n const labelBottom = (expandProgress ? valueBarHeight(best) : barHeight(best)) + LABEL_GAP\n return (\n <View key={i} accessibilityElementsHidden={renderBarOverlay == null} style={column}>\n {ownLabel && (\n // All labels pin to one aligned row JUST ABOVE THE PEAK BAR (not the container top),\n // in the muted on-surface-secondary tone — so the row hugs the bars, no floating void.\n <Animated.View\n style={{\n position: 'absolute',\n bottom: labelBottom,\n left: 0,\n right: 0,\n alignItems: 'center',\n ...(expandProgress ? { opacity: expandProgress } : null),\n }}\n pointerEvents=\"none\"\n >\n <Text\n className=\"text-text-secondary\"\n style={[{ fontSize: valueLabelFontSize(height), fontWeight: '700' }, flipStyle]}\n testID={`${testIDPrefix}-label-${repIndex}`}\n >\n {formatValue(value)}\n </Text>\n </Animated.View>\n )}\n <Animated.View\n style={[\n { width: '100%', height: barHeightStyle, backgroundColor: color },\n barCorners,\n barPaper(color, flip),\n ]}\n testID={`${testIDPrefix}-bar-${repIndex}`}\n />\n {renderBarOverlay?.(repIndex, value)}\n </View>\n )\n })}\n </View>\n </View>\n )\n}\n\n/** A window cell (planned / variable / continue / empty) — a fixed-height stub in its set-type tone. */\nfunction renderStub(\n kind: SetSlot['kind'],\n barCorners: ViewStyle,\n stubHeight: number,\n placeholderColor: string,\n testIDPrefix: string,\n todoVariant: 'dashed' | 'solid',\n solidTodoColor: string,\n emptyColor: string\n): ReactNode {\n const base: ViewStyle = {\n width: '100%',\n height: stubHeight,\n ...barCorners,\n }\n if (kind === 'variable') {\n return (\n <View\n style={{ ...base, backgroundColor: VARIABLE_FILL }}\n testID={`${testIDPrefix}-slot-variable`}\n />\n )\n }\n if (kind === 'continue') {\n return (\n <View\n style={{ ...base, borderWidth: 1, borderColor: CONTINUE_OUTLINE }}\n testID={`${testIDPrefix}-slot-continue`}\n />\n )\n }\n if (kind === 'empty') {\n // A rep column the diverging side did NOT log — a faint constant-contrast section, quieter than\n // a planned to-do (it's a hole in this side's data, index-locked to the other side's rep).\n return (\n <View\n style={{ ...base, backgroundColor: emptyColor }}\n testID={`${testIDPrefix}-slot-empty`}\n />\n )\n }\n // todo — a solid surface-relative section (expanded language) or a dashed outline (hero language).\n const todoStyle: ViewStyle =\n todoVariant === 'solid'\n ? { ...base, backgroundColor: solidTodoColor }\n : { ...base, borderWidth: 1, borderStyle: 'dashed', borderColor: placeholderColor }\n return <View style={todoStyle} testID={`${testIDPrefix}-slot-todo`} />\n}\n\n/** Side/stream-name label font size (px), scaled to chart height so a long name fits un-truncated. */\nexport function sideLabelFontSize(height: number): number {\n return Math.round(Math.max(7, Math.min(13, height * 0.06)))\n}\n\n/**\n * Below this vertical extent (px) the side label collapses to initials rather than shrink further.\n * A 120px dual (60px per wing) sits below this, so its wings degrade to \"L\" / \"R\"; the compact `rail`\n * is exempted at its call site (it keeps its own tuned full-name treatment).\n */\nexport const SIDE_LABEL_INITIALS_BELOW = 70\n\n/**\n * The side-label text for the available vertical `extent`: the full name when there's room, else it\n * degrades to INITIALS — the first letter of each word (\"Left Arm\" → \"L A\", \"Left\" → \"L\", \"Right\" →\n * \"R\") — so a slot name stays legible at tiny chart heights instead of shrinking into a smear.\n */\nexport function sideLabelText(label: string, extent: number): string {\n if (extent >= SIDE_LABEL_INITIALS_BELOW) return label\n return label\n .trim()\n .split(/\\s+/)\n .map((word) => word.charAt(0))\n .join(' ')\n .toUpperCase()\n}\n\n/** One section of the shared {@link ChartSideRail} — a wing's rotated stream/slot-name label. */\nexport interface SideRailSection {\n label?: string\n testID: string\n}\n\n/**\n * The ONE shared gutter/side-rail lockup used by BOTH the single hero and the diverging dual, so a\n * single chart is pixel-identical to the dual's upper half — going dual only adds a lower section.\n * A fixed-width gutter (34px hero / 18px rail) with the `border-hairline` right hairline (the vertical\n * axis) and one rotated, height-responsive, initials-collapsing label per section (each `sectionExtent`\n * tall). The single passes ONE section; the dual passes two (up + down wings). Rendered null when no\n * section carries a label. The rotate lives on a wrapper sized to `sectionExtent` so `numberOfLines`\n * resolves against the tall vertical extent — a long name only ellipsizes when it exceeds the section.\n */\nexport function ChartSideRail({\n sections,\n sectionExtent,\n variant = 'hero',\n}: {\n sections: SideRailSection[]\n sectionExtent: number\n variant?: 'hero' | 'rail'\n}) {\n if (!sections.some((s) => s.label)) return null\n const isRail = variant === 'rail'\n const labelLength = Math.max(0, sectionExtent - (isRail ? 0 : 6))\n // Font scales to the SECTION (wing) height so a slot name fits without truncating; the compact rail\n // keeps its own tuned 7px full-name treatment (hero + single collapse to initials at small heights).\n const fontSize = isRail ? 7 : sideLabelFontSize(sectionExtent)\n const textStyle = {\n maxWidth: '100%' as const,\n textAlign: 'center' as const,\n fontSize,\n fontWeight: '700' as const,\n letterSpacing: isRail || fontSize < 10 ? 0 : 2,\n textTransform: 'uppercase' as const,\n }\n return (\n <View style={{ width: isRail ? 18 : 34 }} accessibilityElementsHidden>\n {sections.map((s) => (\n <View\n key={s.testID}\n style={{ height: sectionExtent, alignItems: 'center', justifyContent: 'center' }}\n >\n {s.label ? (\n <View\n style={{\n width: labelLength,\n alignItems: 'center',\n transform: [{ rotate: '-90deg' }],\n }}\n >\n <Text\n className=\"text-text-tertiary\"\n style={textStyle}\n numberOfLines={1}\n testID={s.testID}\n >\n {isRail ? s.label : sideLabelText(s.label, sectionExtent)}\n </Text>\n </View>\n ) : null}\n </View>\n ))}\n </View>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { useEffect, useState } from 'react'\nimport { View, Text, Pressable, Animated, type ViewProps, type ViewStyle } from 'react-native'\nimport { WORKOUT_TOKENS } from '../../../theme/workout-tokens'\nimport { sequentialEffort, greyRamp } from '../../../theme/tokens/primitives'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\nimport { alpha } from '../../../utils/colors'\nimport { formatVelocity } from '../../../utils/workout-format'\nimport {\n SetBarChart,\n type SetSlot,\n type SetBarGeometry,\n ChartSideRail,\n SET_BAR_DEFAULT_HEIGHT,\n} from '../charts/SetBarChart'\nimport { ANIMATION_EASING } from '../charts/live-rep-growth'\n\n/**\n * Structural velocity-zone band accepted from an upstream analytics source\n * (e.g. workout-analytics' `VelocityZones.bands`).\n *\n * Deliberately a plain structural shape — titan never imports the analytics\n * package (the same presentational-only policy the Workout family follows). Any object with\n * this shape can be passed, so `zones={waVelocityZones.bands}` works directly.\n * Bands are ordered slow → fast, contiguous, and cover `[0, ∞)` with the top\n * band's `max === null`. Bands carry NO color — color is a UI concern resolved\n * here via {@link zoneIdToScaleToken}.\n */\nexport interface VelocityZoneBandProp {\n /** Stable zone identity (e.g. WA's `VelocityZoneId`). Drives color mapping. */\n id: string\n /** Human-readable label shown in the summary row. */\n label: string\n /** Inclusive lower bound (m/s mean concentric velocity). */\n min: number\n /** Exclusive upper bound (m/s); `null` marks the open top band. */\n max: number | null\n}\n\nexport interface VelocityStripProps extends ViewProps {\n /**\n * Per-rep MEAN concentric velocity (m/s), one entry per rep (brain WA-D02).\n * Drives both bar height and — in the default path — zone color. Callers must\n * feed mean (not peak) concentric velocity so bar color, height, and the\n * summary label all describe one metric.\n *\n * Optional: provide exactly one of `velocities` or {@link VelocityStripProps.set}.\n * When neither is given the strip renders nothing.\n */\n velocities?: number[]\n /**\n * Optional structured strength-training set descriptor (see {@link VelocitySet}).\n * When present it supersedes `velocities`: the done-velocity array is derived\n * from the set (so mean / loss / zone summaries still work) and the strip is\n * drawn as a typed slot list — grey todo, cyan variable / continue windows and\n * the wide-gap chunking that distinguishes drop / myo / cluster sets. Provide\n * exactly one of `velocities` or `set`.\n */\n set?: VelocitySet\n /**\n * Optional velocity-zone bands (shape-compatible with WA's\n * `VelocityZones.bands`). When provided, bar color and the summary zone label\n * come from these bands via {@link zoneIdToScaleToken}. When omitted, the\n * built-in default scale (≥1.0 / ≥0.75 / ≥0.5) is used — identical to prior\n * releases. Colors NEVER come from the bands themselves.\n */\n zones?: readonly VelocityZoneBandProp[]\n /**\n * Bar-fill coloring mode. `loss` (DEFAULT) — color each performed bar by its\n * velocity LOSS from the set's OWN best (see {@link getVelocityLossColor}), so a\n * fatiguing set reads green→red by loss regardless of its absolute speed; ignores\n * {@link zones} (it is a wholly separate scale). `zone` — color from the absolute\n * velocity-zone scale ({@link zones} when provided, else the built-in\n * ≥1.0/≥0.75/≥0.5 default). `todo`/`variable`/`continue` slots are unaffected either way.\n */\n barColor?: 'zone' | 'loss'\n /**\n * `hero` only: draw the VL20 / VL30 velocity-loss decision bands behind the bars\n * (see {@link VelocityLossBands}). Defaults to on when {@link barColor} is `loss`\n * (the default), off for `zone` — the bands and the loss bar-fill are the two\n * halves of the same loss-relative language.\n */\n showLossBands?: boolean\n /**\n * `hero` only: `up` (default) grows bars UP from a bottom baseline; `down` mirrors\n * the whole plot (bars grow DOWN from a top baseline, text upright). The diverging\n * dual is just an `up` hero over a `down` hero sharing one axis — so any hero\n * improvement reaches the dual for free.\n */\n orientation?: 'up' | 'down'\n /**\n * `hero` only: OVERRIDE the height-scaling denominator with `scaleMax * headroom` instead of\n * this strip's own `peak`/`fixed` scale. Affects BAR HEIGHT ONLY — velocity-LOSS coloring and\n * the running-best reference line still measure off THIS strip's own velocities. The diverging\n * dual passes the pair's shared max here so a stronger arm's bars read TALLER against one common\n * scale while each arm still colors by its own loss.\n */\n scaleMax?: number\n /**\n * `hero` only (internal): suppress this strip's own 2px baseline border. The diverging dual sets\n * it on BOTH composed wings and draws ONE shared centre axis where they meet, so the axis is a\n * single crisp line rather than two abutting baselines reading as a double-thick rule.\n */\n hideBaseline?: boolean\n /**\n * `hero` only (internal): the EXACT rendered column structure, overriding this strip's own\n * slot-building. The diverging dual builds ONE index-locked structure shared by both wings (same\n * rep indices, same WIDE-gap positions, same column count; a column a side didn't log renders\n * `empty`) and passes it here so bars line up column-for-column across the centre axis. Bar\n * height / color / the running-best reference still read this strip's own `velocities`.\n */\n columnSlots?: SetSlot[]\n /**\n * `hero` only: an optional stream / slot NAME (e.g. \"Left Arm\"), rendered as a rotated vertical\n * edge label down the chart's left gutter — the same treatment the diverging dual gives each wing,\n * so a single hero and a dual read consistently. Omitted → no gutter.\n */\n label?: string\n /**\n * Live mode: index of the most-recently-completed rep. That bar GROWS UP FROM\n * THE BASELINE to its full height as it enters, tracking the rep as it lands;\n * if it is also the current set peak (a new best) the growth slightly\n * overshoots then settles, reading as a small bounce. Only the latest bar\n * animates. Honors `prefers-reduced-motion`. Framed `expanded` chart and\n * `hero` only (interactive tap-to-expand use).\n */\n liveRepIndex?: number\n /**\n * `expanded` variant: whether the chart is OPEN. Default true (the variant shows\n * its chart). Toggle it (with {@link onToggle}) for the interactive tap-to-expand\n * collapse↔chart animation; a static open chart (no `onToggle`) does not animate.\n */\n expanded?: boolean\n onToggle?: () => void\n onRepPress?: (index: number, velocity: number) => void\n /**\n * `compact` — the flat resting strip: {@link SetBarChart} in FLAT mode (uniform short bars, no\n * value labels), sharing hero's exact geometry (colors, paper, spacing, chunk-notch, slots, gutter).\n * `expanded` — the velocity-HEIGHT bar chart (rounded tops), whose chrome is prop-driven: with\n * {@link showNumbers} or {@link showInfo} on it's the framed chart (raised surface, padding, per-bar\n * m/s labels, mean/loss info row, interactive collapse); with both off it's a bare strip — the\n * active-set \"spotlight\" of {@link ExerciseCard}. `hero` — the across-the-room, single-set wall\n * treatment: tall bars, a per-bar m/s value label, a dashed running-best reference line, and dashed\n * placeholders for the reps still to come (see {@link targetReps}). All three share SetBarChart, so\n * bars align across compact / expanded / hero.\n */\n variant?: 'compact' | 'expanded' | 'hero'\n /** `expanded` / `hero` plot height in px (bars scale to this). Default 60 (`expanded`) / 220 (`hero`). */\n height?: number\n /**\n * `hero` only: the set's planned rep count. Reps beyond {@link velocities} draw as\n * dashed placeholder stubs so the wall reads \"3 of 8 done\" at a glance. Ignored\n * (and no placeholders drawn) when absent or ≤ the performed-rep count.\n */\n targetReps?: number\n /**\n * `expanded` / `hero` bar scaling. `peak` (default) scales to the set's own max\n * (+15% headroom). `fixed` scales to a fixed velocity ceiling so bar heights read\n * the same absolute velocity across sets (the spotlight).\n */\n scale?: 'peak' | 'fixed'\n /** `expanded` framed chart: per-bar m/s labels. Default true. */\n showNumbers?: boolean\n /** `expanded` framed chart: the mean/loss info row. Default true. */\n showInfo?: boolean\n className?: string\n}\n\n// Canonical 4-color performance scale shared with SetRow's RPE color\n// (see theme/workout-tokens.ts). green = fastest, red = slowest/grinding.\nconst VEL_COLORS = WORKOUT_TOKENS.scale\n\n/**\n * Map a velocity-zone id (WA's 5-band taxonomy) directly onto the 6-stop\n * `sequentialEffort` ramp. The default strip uses the 4-color {@link VEL_COLORS}\n * scale (a subsample of the same ramp), but the 5-band taxonomy has one more\n * level than that scale carries, so it samples 5 stops: the top four align with\n * the default scale (speed/power/strengthSpeed/maximalStrength = green/gold/\n * orange/red) and `grinding` takes the ramp's darker red. `maximalStrength` and\n * `grinding` therefore stay DISTINCT — they no longer collapse onto one red for\n * lack of a 5th hue. An exercise moving from default to profile-derived zones\n * never shifts its fast-end colors.\n *\n * Unknown ids fall back to `green` (matching the historical default-path\n * fallback), so a forward-compatible band id never renders an empty bar.\n */\nconst bandIdToEffortColor: Record<string, string> = {\n speed: sequentialEffort[0], // green-300\n power: sequentialEffort[2], // amber-300 (gold)\n strengthSpeed: sequentialEffort[3], // orange-400\n maximalStrength: sequentialEffort[4], // red-600\n grinding: sequentialEffort[5], // red-700 — the distinct 5th band\n}\n\n// --- Default (no-zones) scale ------------------------------------------------\n// Retained as named exports for back-compat; they define the default path.\n\nexport function getVelocityZoneColor(velocity: number): string {\n if (velocity >= 1.0) return 'vel-green'\n if (velocity >= 0.75) return 'vel-yellow'\n if (velocity >= 0.5) return 'vel-orange'\n return 'vel-red'\n}\n\nexport function getVelocityZoneName(velocity: number): string {\n if (velocity >= 1.0) return 'Speed'\n if (velocity >= 0.75) return 'Power'\n if (velocity >= 0.5) return 'Strength-Speed'\n return 'Strength'\n}\n\nconst zoneHexMap: Record<string, string> = {\n 'vel-green': VEL_COLORS.green,\n 'vel-yellow': VEL_COLORS.yellow,\n 'vel-orange': VEL_COLORS.orange,\n 'vel-red': VEL_COLORS.red,\n}\n\n/**\n * Velocity loss for a set, as a whole percentage. Uses the running-best rep as\n * the reference (matching WA-02.05 / brain WA-D01): `(vBest − vLast) / vBest`,\n * clamped to ≥ 0 so a set that ends on its best rep reports 0 loss.\n */\nexport function calculateVelocityLoss(velocities: number[]): number {\n if (velocities.length < 2) return 0\n const best = Math.max(...velocities)\n if (best <= 0) return 0\n const last = velocities[velocities.length - 1]\n return Math.max(0, Math.round(((best - last) / best) * 100))\n}\n\n/** Arithmetic mean of the per-rep mean-concentric velocities. */\nexport function calculateMeanVelocity(velocities: number[]): number {\n if (velocities.length === 0) return 0\n const sum = velocities.reduce((acc, v) => acc + v, 0)\n return sum / velocities.length\n}\n\n/**\n * Velocity-loss band thresholds (loss %), the same VL10/VL20/VL30 coaching cues\n * FatigueMeter's default thresholds use — kept in sync so a `barColor=\"loss\"`\n * strip and a fatigue hero's VL20/VL30 reference bands agree on where amber/red start.\n */\nconst VL_LOSS_THRESHOLDS: readonly [number, number, number] = [10, 20, 30]\n\n/**\n * Map a per-rep velocity LOSS (%, from the set's own best — see {@link\n * velocityLossForRep}) onto the same green→gold→orange→red scale as the absolute\n * zone scale ({@link VEL_COLORS}), banded at the {@link VL_LOSS_THRESHOLDS}\n * VL10/VL20/VL30 cues. Past VL20 reads orange (\"past VL20 = amber\" in coaching\n * terms — this scale's amber/gold band is the yellow stop, orange is the VL20+\n * band), past VL30 reads red, so a fatiguing set reads green→red by LOSS\n * regardless of how slow its absolute velocity is.\n */\nexport function getVelocityLossColor(lossPct: number): string {\n const [t1, t2, t3] = VL_LOSS_THRESHOLDS\n if (lossPct < t1) return VEL_COLORS.green\n if (lossPct < t2) return VEL_COLORS.yellow\n if (lossPct < t3) return VEL_COLORS.orange\n return VEL_COLORS.red\n}\n\n/**\n * A single rep's velocity loss (%) relative to the set's own best rep, clamped to\n * ≥ 0 (a best-so-far rep, or a set with no positive best, reports 0 loss — green).\n * Rounded (matching {@link calculateVelocityLoss}'s convention) so a rep that is\n * arithmetically the set's best — or lands exactly on a VL threshold — doesn't drift\n * across a color-band boundary on floating-point noise (e.g. `1.0 − 0.9` ≈ `0.0999…998`).\n * Feeds `barColor=\"loss\"` bar coloring; distinct from {@link calculateVelocityLoss},\n * which reports only the set's FINAL loss (last rep vs best) as a single summary number.\n */\nfunction velocityLossForRep(velocity: number, best: number): number {\n if (best <= 0) return 0\n return Math.max(0, Math.round(((best - velocity) / best) * 100))\n}\n\n/** Classify a velocity into its band (slow → fast, min inclusive / max exclusive). */\nfunction classifyBand(\n velocity: number,\n bands: readonly VelocityZoneBandProp[]\n): VelocityZoneBandProp | undefined {\n for (const band of bands) {\n if (band.max === null || velocity < band.max) return band\n }\n return bands[bands.length - 1]\n}\n\nfunction bandColor(band: VelocityZoneBandProp): string {\n return bandIdToEffortColor[band.id] ?? VEL_COLORS.green\n}\n\n/**\n * The zone → bar-color resolver, single-sourced so every variant (and the dual\n * diverging sibling) colors reps identically: profile-derived `zones` map through\n * {@link bandColor}; the default (no-zones) path uses the built-in 4-color scale.\n * Color is ALWAYS the velocity zone — never the voltra side.\n */\nfunction makeBarColorFor(zones?: readonly VelocityZoneBandProp[]): (v: number) => string {\n const hasZones = zones != null && zones.length > 0\n return (v: number): string =>\n hasZones ? bandColor(classifyBand(v, zones)!) : zoneHexMap[getVelocityZoneColor(v)]\n}\n\nfunction getLossStyle(loss: number): Record<string, string> | null {\n if (loss > 25) return { color: VEL_COLORS.red }\n if (loss > 20) return { color: VEL_COLORS.orange }\n return null\n}\n\n// --- Set-type slot model -----------------------------------------------------\n// The strength-training set vocabulary (operator-approved in the Set Modalities\n// exploration): one strip encoding for every per-rep set type. A set resolves to\n// an ordered list of slots; the slot `kind` picks the color and `leadingGap`\n// encodes the chunk pattern (rep gap vs the wide notch that splits drop sub-loads\n// / myo clusters / cluster intra-rests). Set-LEVEL types (pyramid / superset /\n// tempo) belong to the heading, not the strip.\n\n/**\n * A structured strength-training set. Supply as {@link VelocityStripProps.set} to\n * render its set-type encoding; the done-velocity array (used for the mean / loss\n * / zone summary) is derived from the type's velocity fields.\n */\nexport type VelocitySet =\n /** Fixed reps at a fixed load: done reps colored + a grey todo remainder to `planned`. */\n | { type: 'straight'; velocities: number[]; planned?: number }\n /** Bounded reps: committed slots `0..floor`, then a cyan variable window `floor..max`. */\n | { type: 'range'; velocities: number[]; floor: number; max: number }\n /** As-many-reps-as-possible: done reps + a trailing cyan \"continue\" slot that never closes. */\n | { type: 'amrap'; velocities: number[]; target?: number }\n /** Load drops with no rest: each sub-load's reps, split by a WIDE notch gap. */\n | { type: 'drop'; subloads: number[][] }\n /** Rest-pause: an activation chunk + mini-clusters split by WIDE gaps; `open` adds a cyan continue. */\n | { type: 'myo'; activation: number[]; clusters: number[][]; open?: boolean }\n /** Fixed count broken by intra-set rests: reps grouped by `groupSize` with WIDE intra-rest gaps. */\n | { type: 'cluster'; velocities: number[]; groupSize: number; planned?: number }\n\n/** One drawn cell of the strip. `kind` picks the color; `leadingGap` the spacing before it. */\ninterface VelocitySlot {\n kind: 'rep' | 'todo' | 'variable' | 'continue'\n velocity?: number\n leadingGap: number\n}\n\n/** Butted reps carry this gap; chunk boundaries carry {@link WIDE_GAP}. */\nconst REP_GAP = 2\n/**\n * The between-group notch (drop sub-loads / myo clusters / cluster intra-rests): a\n * fixed 8px total gap that reads as a group break without dominating a narrow strip.\n * 4× the rep gap — enough to separate groups at session-rail scale AND wall scale\n * without the notch ballooning at large widths. In the mini variant the container's\n * 2px gap covers part of it, so per-slot margin adds the remaining 6px (2 + 6 = 8).\n */\nconst WIDE_GAP = 8\n\n/** The done-velocity array a set contributes to the mean / loss / zone summary. */\nfunction deriveDoneVelocities(set: VelocitySet): number[] {\n switch (set.type) {\n case 'drop':\n return set.subloads.flat()\n case 'myo':\n return [...set.activation, ...set.clusters.flat()]\n default:\n return set.velocities\n }\n}\n\n/** Flatten velocity chunks into rep slots, carving a WIDE gap before each chunk but the first. */\nfunction chunkedRepSlots(chunks: number[][]): VelocitySlot[] {\n const slots: VelocitySlot[] = []\n chunks.forEach((chunk) => {\n chunk.forEach((velocity, ri) => {\n const first = slots.length === 0\n slots.push({ kind: 'rep', velocity, leadingGap: first ? 0 : ri === 0 ? WIDE_GAP : REP_GAP })\n })\n })\n return slots\n}\n\n/** Resolve a set to its ordered slot list — the exact vocabulary of the Set Modalities sheet. */\nfunction buildSlots(set: VelocitySet): VelocitySlot[] {\n switch (set.type) {\n case 'straight': {\n const total = Math.max(set.velocities.length, set.planned ?? set.velocities.length)\n return Array.from({ length: total }, (_, i) => {\n const done = i < set.velocities.length\n return {\n kind: done ? 'rep' : 'todo',\n velocity: done ? set.velocities[i] : undefined,\n leadingGap: i === 0 ? 0 : REP_GAP,\n }\n })\n }\n case 'range': {\n const total = Math.max(set.max, set.velocities.length)\n return Array.from({ length: total }, (_, i) => {\n const kind: VelocitySlot['kind'] =\n i < set.velocities.length ? 'rep' : i < set.floor ? 'todo' : 'variable'\n return {\n kind,\n velocity: kind === 'rep' ? set.velocities[i] : undefined,\n leadingGap: i === 0 ? 0 : REP_GAP,\n }\n })\n }\n case 'amrap': {\n const reps = set.velocities.map<VelocitySlot>((velocity, i) => ({\n kind: 'rep',\n velocity,\n leadingGap: i === 0 ? 0 : REP_GAP,\n }))\n reps.push({ kind: 'continue', leadingGap: reps.length === 0 ? 0 : REP_GAP })\n return reps\n }\n case 'drop':\n return chunkedRepSlots(set.subloads)\n case 'myo': {\n const slots = chunkedRepSlots([set.activation, ...set.clusters])\n if (set.open) slots.push({ kind: 'continue', leadingGap: slots.length === 0 ? 0 : REP_GAP })\n return slots\n }\n case 'cluster': {\n const total = Math.max(set.velocities.length, set.planned ?? set.velocities.length)\n return Array.from({ length: total }, (_, i) => {\n const done = i < set.velocities.length\n const boundary = i > 0 && i % set.groupSize === 0\n return {\n kind: done ? 'rep' : 'todo',\n velocity: done ? set.velocities[i] : undefined,\n leadingGap: i === 0 ? 0 : boundary ? WIDE_GAP : REP_GAP,\n }\n })\n }\n }\n}\n\n/** A concise, set-type-aware summary for the strip's accessibility label. */\nfunction setAccessibilityLabel(set: VelocitySet, repCount: number): string {\n switch (set.type) {\n case 'straight':\n return `Velocity strip, straight set, ${repCount} reps`\n case 'range':\n return `Velocity strip, rep-range set, floor ${set.floor} to ${set.max}, ${repCount} reps done`\n case 'amrap':\n return `Velocity strip, AMRAP set, ${repCount} reps and counting`\n case 'drop':\n return `Velocity strip, drop set, ${set.subloads.length} loads, ${repCount} reps`\n case 'myo':\n return `Velocity strip, myo-reps set, ${set.clusters.length} clusters${set.open ? ', open' : ''}, ${repCount} reps`\n case 'cluster':\n return `Velocity strip, cluster set, groups of ${set.groupSize}, ${repCount} reps`\n }\n}\n\n/** Default framed `expanded` chart height (px). */\nconst EXPANDED_HEIGHT = 60\n/** Default `compact` (flat resting strip) height (px) — a THIN radius-2 pill row, the resting glance. */\nconst COMPACT_HEIGHT = 8\n\n/** The dashed running-best reference line color (the lightest grey step). */\nconst HERO_REFERENCE_COLOR = greyRamp[600]\n\n/**\n * A dashed running-best reference line spanning the plot width, absolutely positioned a\n * pixel `offset` from the given `anchor` edge. Shared by the single `hero` chart (anchored\n * to the baseline, `bottom`) and BOTH wings of the diverging dual chart (anchored to the\n * centre axis, `top`) so the three sites render one line treatment (grey-0, 1px dashed).\n * Presentation-only + non-interactive — the numeric best lives in each chart's container\n * accessibility label, so the line itself is hidden from the a11y tree.\n *\n * REUSE FOLLOW-UP: `Sparkline` hand-rolls the same dashed-line overlay (plus opacity, an\n * optional label, and a data-domain Y), and two lab specimens duplicate it again. A\n * top-level `ReferenceLine` overlay primitive unifying all of them is a scoped follow-up\n * (see the Workout README) — kept in-file here to keep the hero PR focused.\n */\nfunction DashedReferenceLine({\n anchor,\n offset,\n testID,\n}: {\n anchor: 'top' | 'bottom'\n offset: number\n testID: string\n}) {\n const edge: ViewStyle = anchor === 'top' ? { top: offset } : { bottom: offset }\n return (\n <View\n accessibilityElementsHidden\n style={{\n position: 'absolute',\n left: 0,\n right: 0,\n borderTopWidth: 1,\n borderStyle: 'dashed',\n borderColor: HERO_REFERENCE_COLOR,\n pointerEvents: 'none',\n ...edge,\n }}\n testID={testID}\n />\n )\n}\n\nconst BAND_LABEL_FONT = 'monospace'\n/**\n * Below this plot height (px) the VL20/VL30 labels are DROPPED entirely (the dashed lines + washes\n * stay) rather than shrunk into an overlapping smear. Tuned so a 120px dual (≈41px plot/wing) and the\n * cramped mid-small range drop, while the accepted board scale (≈76px plot/wing) keeps its labels.\n */\nconst VL_LABEL_MIN_PLOT = 65\nconst VL_SEMANTIC = getSemanticColors('dark')\n\n/**\n * Velocity-LOSS decision bands for the `hero` variant: the VL20 / VL30 coaching\n * cues (off the running best) drawn as absolutely-positioned bands + dashed\n * threshold lines BEHIND the bars, on the hero's own peak scale so a bar dropping\n * into the amber → red band reads as \"these are your last effective reps\". Shared\n * by the single hero, the diverging dual wings, and {@link VelocityHero}; render\n * it as the first child of the bottom-anchored plot container.\n *\n * `best` is the running-best velocity (the peak the loss is measured from);\n * `scaleDenom` / `plotHeight` are the hero chart's bar-scaling geometry — a\n * velocity `v` sits `(v / scaleDenom) * plotHeight` px up from the baseline,\n * matching {@link HeroVelocityChart}'s `barHeight`.\n */\nexport function VelocityLossBands({\n best,\n scaleDenom,\n plotHeight,\n flip = false,\n}: {\n best: number\n scaleDenom: number\n plotHeight: number\n /** The parent plot is vertically mirrored (a `down` wing) — counter-flip the labels upright. */\n flip?: boolean\n}) {\n if (best <= 0 || scaleDenom <= 0 || plotHeight <= 0) return null\n const yOf = (v: number): number => (v / scaleDenom) * plotHeight\n const vl20 = best * 0.8\n const vl30 = best * 0.7\n // The VL20 / VL30 lines sit ~0.09·plotHeight apart, so on a short chart their labels crowd. Scale\n // the label font to the plot height; below VL_LABEL_MIN_PLOT DROP the labels entirely (keep the\n // dashed lines + washes) rather than shrink them into an illegible smear.\n const vlFont = Math.round(Math.max(7, Math.min(9, plotHeight * 0.05)))\n const showLabels = plotHeight >= VL_LABEL_MIN_PLOT\n const band = (loV: number, hiV: number, color: string) => (\n <View\n style={{\n position: 'absolute',\n left: 0,\n right: 0,\n bottom: yOf(loV),\n height: Math.max(0, yOf(hiV) - yOf(loV)),\n backgroundColor: color,\n }}\n />\n )\n // The label sits ~90% along the threshold, with the dashed line breaking around it (a long segment\n // before + a short stub after) — near the quiet right end where a declining set has room. Below the\n // label threshold the line spans full width with no text.\n const threshold = (v: number, color: string, label: string) => (\n <View\n style={{\n position: 'absolute',\n left: 0,\n right: 0,\n bottom: yOf(v),\n // Collapse to zero height so the dashed border lands EXACTLY on `yOf(v)` — the\n // band edge — instead of floating up half a text-row (the label then centres on\n // the line, breaking it). Matches DashedReferenceLine's bare-border anchoring.\n height: 0,\n flexDirection: 'row',\n alignItems: 'center',\n }}\n >\n <View style={{ flex: 9, borderTopWidth: 1, borderStyle: 'dashed', borderColor: color }} />\n {showLabels ? (\n <>\n <Text\n style={{\n marginHorizontal: 6,\n fontSize: vlFont,\n fontWeight: '800',\n fontFamily: BAND_LABEL_FONT,\n color,\n ...(flip ? { transform: [{ scaleY: -1 as number }] } : null),\n }}\n >\n {label}\n </Text>\n <View style={{ flex: 1, borderTopWidth: 1, borderStyle: 'dashed', borderColor: color }} />\n </>\n ) : null}\n </View>\n )\n return (\n <View\n accessibilityElementsHidden\n pointerEvents=\"none\"\n style={{ position: 'absolute', left: 0, right: 0, bottom: 0, top: 0 }}\n testID=\"velocity-loss-bands\"\n >\n {band(0, vl30, alpha(VL_SEMANTIC['status-error'], 0.09))}\n {band(vl30, vl20, alpha(VL_SEMANTIC['status-warning'], 0.08))}\n {threshold(vl20, alpha(VL_SEMANTIC['status-warning'], 0.75), 'VL 20%')}\n {threshold(vl30, alpha(VL_SEMANTIC['status-error'], 0.75), 'VL 30%')}\n </View>\n )\n}\n\n/**\n * The velocity hero's reference overlay, painted by {@link SetBarChart} via `renderReference` from\n * the chart geometry: the VL20 / VL30 loss decision bands (when `showLossBands`) behind the bars,\n * plus the dashed running-best line at the peak. Both measure off the chart's OWN `best` — the\n * per-side loss language that survives the dual's shared height scale. Unlabeled by design (the peak\n * bar already shows its value; the numeric best is in the chart's accessibility label).\n */\nfunction velocityReferenceOverlay(g: SetBarGeometry, showLossBands: boolean) {\n const referencePx = g.best > 0 && g.scaleDenom > 0 ? Math.min(g.plotHeight, g.yOf(g.best)) : 0\n return (\n <>\n {showLossBands && (\n <VelocityLossBands\n best={g.best}\n scaleDenom={g.scaleDenom}\n plotHeight={g.plotHeight}\n flip={g.flip}\n />\n )}\n {referencePx > 0 && (\n <DashedReferenceLine\n anchor=\"bottom\"\n offset={referencePx}\n testID=\"velocity-hero-reference\"\n />\n )}\n </>\n )\n}\n\n/** Framed expanded collapse-animation duration (ms). */\nconst ANIMATION_DURATION = 400\n\n// --- Dual (bilateral) diverging chart ----------------------------------------\n// The two-device (LEFT + RIGHT voltra) treatment. Instead of two stacked single\n// heroes with independent baselines, ONE diverging chart shares a horizontal centre\n// axis: LEFT reps grow UP, RIGHT reps grow DOWN, one mirrored pair per rep index. The\n// asymmetry (left-dominant / right-lagging) reads pre-attentively as the silhouette.\n// It reuses VelocityStrip's slot model ({@link buildSlots}/{@link VelocitySlot}), its\n// zone color scale ({@link makeBarColorFor}), the hero geometry constants, and the\n// live-rep entrance ({@link useLiveRepGrowth}) — side is POSITION only, never hue.\n//\n// LIVE-REP ENTRANCE — do NOT re-add a dual-only one. The dual used to hand-roll its wing bars and\n// drive them from its own scale-pop hook, so the newest-rep animation existed TWICE and the two\n// copies drifted. Composing single strips retired that hook: `liveRepIndex` is now an ordinary\n// prop on each wing, so both wings animate through the same code path as a single hero and an\n// entrance that fires on one wing only is not expressible. Whether the wings should POP (a\n// whole-bar scale) rather than GROW from the axis is a live design question — but it belongs in\n// SetBarChart's shared entrance, applied to the single hero and the wings together. Reintroducing\n// it here would rebuild exactly the divergence this composition removed.\n\n/** One voltra's velocity stream — the SAME shape VelocityStrip accepts (one of these). */\nexport interface DualVelocityStream {\n /** Per-rep MEAN concentric velocity (m/s) for this side. */\n velocities?: number[]\n /** A structured set descriptor for this side (drives the typed slot vocabulary). */\n set?: VelocitySet\n /**\n * The side's SLOT NAME (e.g. \"Left Arm\"), rendered as the vertical edge label. This is\n * the slot's identity supplied by data — there is no hardcoded LEFT/RIGHT fallback. When\n * absent or empty, that side renders no label.\n */\n label?: string\n}\n\nexport interface DualVelocityStripProps extends ViewProps {\n /** The up-wing stream — drawn growing UP from the centre axis; its edge name comes from `left.label`. */\n left: DualVelocityStream\n /** The down-wing stream — drawn growing DOWN from the centre axis; its edge name comes from `right.label`. */\n right: DualVelocityStream\n /**\n * Optional velocity-zone bands (shape-compatible with WA's `VelocityZones.bands`),\n * shared with {@link VelocityStrip}. Colors the reps by zone on BOTH sides; side is\n * never encoded by hue. When omitted the built-in default scale is used.\n */\n zones?: readonly VelocityZoneBandProp[]\n /**\n * Bar-fill coloring mode, matching {@link VelocityStrip}. `loss` (DEFAULT) — each\n * wing colors by its velocity LOSS from THAT arm's own best (per-wing, since arms\n * fatigue independently). `zone` — the shared absolute zone scale. Side is never\n * encoded by hue either way.\n */\n barColor?: 'zone' | 'loss'\n /**\n * Planned rep count. Reps beyond a side's performed count draw as mirrored dashed\n * todo stubs (same \"3 of 8 done\" read as the single hero), on both wings.\n */\n targetReps?: number\n /** Index of the most-recently-completed rep; that mirrored pair animates in (hero only). */\n liveRepIndex?: number\n /**\n * `hero` — the across-the-room wall scale: tall wings, per-rep m/s value labels, and a dashed\n * running-best reference line per side. `compact` — the flat resting form: dual-hero but flat +\n * no labels (both wings are the `compact` VelocityStrip variant), same aligned structure + shared\n * gutter + axis. `rail` — the compact rail-expanded lean renderer, no labels / reference lines.\n */\n variant?: 'hero' | 'compact' | 'rail'\n /**\n * Bar-height scaling, shared across BOTH wings so the L/R asymmetry reads as bar\n * length against one scale. `peak` (default) = the pair's max +headroom; `fixed` =\n * a fixed velocity ceiling.\n */\n scale?: 'peak' | 'fixed'\n /** Total plot height (px), split evenly into the up (L) and down (R) wings. */\n height?: number\n className?: string\n}\n\n/** Default `hero` diverging height (px) — matches the single hero. */\nconst DUAL_HERO_HEIGHT = SET_BAR_DEFAULT_HEIGHT\n/** Default `rail` diverging height (px) — compact enough to sit inside a rail slot. */\nconst DUAL_RAIL_HEIGHT = 96\n/** Default `compact` diverging height (px) — two 5px rounded L/R sub-segments + the 1.5px fold gap. */\nconst DUAL_COMPACT_HEIGHT = 11.5\n\n// --- Rail geometry (the compact dedicated path) ------------------------------\n// The `hero` variant COMPOSES two single VelocityStrip heroes, so it inherits the\n// hero geometry for free. The `rail` variant is far smaller than a hero (no value\n// labels, reference lines, paper, or label headroom), so composing the hero would\n// drag all of that in; it keeps a lean dedicated renderer at these compact metrics.\n/** The vertical gap between the up/down wings on the axis-less rail (value-height dual-expanded). */\nconst DUAL_WING_GAP = 2\n/** The centre gap (px) splitting the folded compact dual's L (top) and R (bottom) halves — a gap, no line. */\nconst COMPACT_FOLD_GAP = 1.5\n/** Each folded-compact sub-segment's height (px) — a rounded pill per side, above/below the fold gap. */\nconst COMPACT_FOLD_HALF = 5\n\n/** One side's performed per-rep velocities — flattened from a `set` descriptor, or the raw array. */\nfunction streamDone(stream: DualVelocityStream): number[] {\n return stream.set ? deriveDoneVelocities(stream.set) : (stream.velocities ?? [])\n}\n\n/** A side's NATURAL slot list — its `set` slot vocabulary, or bare rep slots + a `targetReps` remainder. */\nfunction streamNaturalSlots(stream: DualVelocityStream, targetReps?: number): SetSlot[] {\n if (stream.set) {\n return buildSlots(stream.set).map((s) => ({\n kind: s.kind,\n value: s.velocity,\n leadingGap: s.leadingGap,\n }))\n }\n const reps: SetSlot[] = (stream.velocities ?? []).map((v, i) => ({\n kind: 'rep',\n value: v,\n leadingGap: i === 0 ? 0 : REP_GAP,\n }))\n const pad = Math.max(0, (targetReps ?? 0) - reps.length)\n return [...reps, ...Array.from({ length: pad }, () => ({ kind: 'todo' as const }))]\n}\n\n/**\n * The window-kind precedence when merging two sides' cells at a column: a set-type window (variable /\n * continue) that either side has wins; else if either logged (or plans) a rep there it's a REP column;\n * else it's a shared to-do. So a lagging side's not-yet-logged rep column stays a REP column (rendered\n * `empty` for that side), index-locked to the other side's rep — never shifted or re-spaced.\n */\nfunction mergeColumnKind(l: SetSlot | undefined, r: SetSlot | undefined): SetSlot['kind'] {\n const kinds = [l?.kind, r?.kind]\n if (kinds.includes('variable')) return 'variable'\n if (kinds.includes('continue')) return 'continue'\n if (kinds.includes('rep')) return 'rep'\n return 'todo'\n}\n\n/** One side's cell at a merged column: its logged rep (with value), else `empty` for a rep column, else the shared window kind. */\nfunction sideColumnCell(\n slot: SetSlot | undefined,\n kind: SetSlot['kind'],\n leadingGap: number\n): SetSlot {\n if (kind !== 'rep') return { kind, leadingGap }\n return slot?.kind === 'rep'\n ? { kind: 'rep', value: slot.value, leadingGap }\n : { kind: 'empty', leadingGap }\n}\n\n/**\n * Build ONE index-locked column structure shared by both diverging wings from their natural slot\n * lists: same column count, same rep indices, same WIDE-gap positions. Each column resolves to a\n * shared kind ({@link mergeColumnKind}); per side it's that side's rep value, or `empty` when the\n * side hasn't logged that rep (assumes symmetric bilateral reps — both sides step together).\n */\nfunction alignDualSlots(left: SetSlot[], right: SetSlot[]): { left: SetSlot[]; right: SetSlot[] } {\n const n = Math.max(left.length, right.length)\n const L: SetSlot[] = []\n const R: SetSlot[] = []\n for (let i = 0; i < n; i++) {\n const lt = left[i]\n const rt = right[i]\n const kind = mergeColumnKind(lt, rt)\n const gap = Math.max(lt?.leadingGap ?? REP_GAP, rt?.leadingGap ?? REP_GAP)\n L.push(sideColumnCell(lt, kind, gap))\n R.push(sideColumnCell(rt, kind, gap))\n }\n return { left: L, right: R }\n}\n\n/** Shared inputs for both dual renderers — the resolved per-side done arrays + presentation props. */\ninterface DualChartProps {\n leftDone: number[]\n rightDone: number[]\n /**\n * The raw per-side streams. The `hero` renderer passes each side's `set` (or `velocities`)\n * straight through to its composed VelocityStrip hero so a side's set-type WINDOWS (the range\n * cyan variable window, the AMRAP/myo \"continue\", drop/myo chunk-notch gaps) render on the dual\n * — not just the flattened reps. The lean `rail` renderer ignores them (it only takes velocities).\n */\n leftStream?: DualVelocityStream\n rightStream?: DualVelocityStream\n leftLabel?: string\n rightLabel?: string\n zones?: readonly VelocityZoneBandProp[]\n barColor: 'zone' | 'loss'\n /** Shared across BOTH wings: `peak` (the pair's max +headroom) or `fixed` (a cross-set ceiling). */\n scale: 'peak' | 'fixed'\n targetReps?: number\n height: number\n className?: string\n label: string\n viewProps: ViewProps\n}\n\n/**\n * The `hero` diverging chart — COMPOSED from two single {@link VelocityStrip} heroes: an `up` hero\n * over a `down` (vertically-mirrored) hero, sharing ONE height scale via {@link\n * VelocityStripProps.scaleMax} and meeting at one shared centre axis. Each wing hides its own\n * baseline ({@link VelocityStripProps.hideBaseline}) so the axis is a single crisp line. Because it\n * is literally two heroes, every hero improvement — paper, loss bands, grow-from-bottom, the\n * running-best reference, surface-relative placeholders, per-side loss coloring — reaches the dual\n * for free. Side is POSITION only: both wings color reps by the SAME `barColor` scale; the shared\n * `scaleMax` makes a stronger arm read TALLER while each wing still colors off its own best.\n */\nfunction DualVelocityHero({\n leftDone,\n rightDone,\n leftStream,\n rightStream,\n leftLabel,\n rightLabel,\n zones,\n barColor,\n scale,\n targetReps,\n liveRepIndex,\n height,\n className,\n label,\n viewProps,\n}: DualChartProps & { liveRepIndex?: number }) {\n // The two wings are separated by the SAME small gap as the expanded/rail dual (no centre-axis rule).\n const plotHalf = (height - DUAL_WING_GAP) / 2\n // ONE shared height scale across both wings so the L/R asymmetry reads as bar length, not two\n // scales; each composed strip still colors by its OWN loss and draws its OWN best reference.\n // `peak` shares the pair max via `scaleMax`; `fixed` shares the cross-set ceiling (both wings\n // resolve the same fixed ceiling), so `scaleMax` is left off and `scale` carries it.\n const sharedMax = Math.max(...leftDone, ...rightDone, 0)\n // ONE index-locked column structure shared by both wings: same rep indices, same WIDE-gap\n // positions, same column count. A column a side didn't log renders `empty` there — so a lagging\n // side's next rep lands at the SAME column index as the other side, never shifted or re-spaced.\n const aligned = alignDualSlots(\n leftStream ? streamNaturalSlots(leftStream, targetReps) : [],\n rightStream ? streamNaturalSlots(rightStream, targetReps) : []\n )\n const { style: externalStyle, ...restProps } = viewProps\n\n // Each wing renders the SHARED aligned structure (`columnSlots`); its own `velocities` still drive\n // bar height / per-side loss color / the running-best reference.\n const wing = (orientation: 'up' | 'down', columns: SetSlot[], done: number[]) => (\n <VelocityStrip\n variant=\"hero\"\n orientation={orientation}\n velocities={done}\n columnSlots={columns}\n scale={scale}\n scaleMax={scale === 'fixed' ? undefined : sharedMax}\n barColor={barColor}\n zones={zones}\n liveRepIndex={liveRepIndex}\n height={plotHalf}\n hideBaseline\n />\n )\n\n return (\n <View\n className={className}\n style={[{ height, flexDirection: 'row' }, externalStyle]}\n accessibilityRole=\"image\"\n accessibilityLabel={label}\n testID=\"dual-velocity-strip\"\n {...restProps}\n >\n {/* The SHARED gutter/side-rail (34px, no hairline) — one section per wing. A single hero renders\n the same rail with ONE section, so it's pixel-identical to this upper half. */}\n <ChartSideRail\n sectionExtent={plotHalf}\n variant=\"hero\"\n sections={[\n { label: leftLabel, testID: 'dual-velocity-side-label-L' },\n { label: rightLabel, testID: 'dual-velocity-side-label-R' },\n ]}\n />\n\n {/* The two composed heroes, separated by the shared wing gap (no centre-axis rule). Their own\n labels are redundant with the dual's summary label, so the wings are a11y-hidden. */}\n <View style={{ flex: 1, gap: DUAL_WING_GAP }}>\n <View accessibilityElementsHidden testID=\"dual-velocity-wing-up\">\n {wing('up', aligned.left, leftDone)}\n </View>\n <View accessibilityElementsHidden testID=\"dual-velocity-wing-down\">\n {wing('down', aligned.right, rightDone)}\n </View>\n </View>\n </View>\n )\n}\n\n/**\n * The `rail` diverging chart — a lean, compact dedicated renderer. Composing the hero here would\n * drag in its value labels, reference lines, paper, and label headroom, none of which belong at\n * rail scale; instead it draws mirrored per-side bars at the compact rail metrics. Same shared\n * height scale + per-side loss coloring + mirrored radius + shared axis as the hero, but no labels\n * / reference lines / paper. (Set-type slot windows are a hero-composition concern; rail only ever\n * takes plain velocities.)\n */\nfunction DualVelocityRail({\n leftDone,\n rightDone,\n leftStream,\n rightStream,\n zones,\n barColor,\n scale,\n targetReps,\n liveRepIndex,\n height,\n className,\n label,\n viewProps,\n}: DualChartProps & { liveRepIndex?: number }) {\n // The lean dual-EXPANDED. Composed from two bare `expanded` strips exactly as the hero composes\n // two heroes, rather than drawing its own bars: composing is what makes the dual inherit the\n // single's bar widths, gaps, chunk-notch, set-type slot windows, paper and live-rep growth. The\n // bespoke renderer this replaces took only velocities, so the dual silently dropped every\n // set-type window and let a lagging side render fewer bars than its partner.\n const plotHalf = (height - DUAL_WING_GAP) / 2\n // ONE shared height scale across both wings, so an L/R asymmetry reads as bar length rather than\n // as two independent scales.\n const sharedMax = Math.max(...leftDone, ...rightDone, 0)\n // ONE index-locked column structure. A column a side did not log renders as an aligned empty, so\n // the lagging side's next rep lands at the SAME column index as its partner's.\n const aligned = alignDualSlots(\n leftStream ? streamNaturalSlots(leftStream, targetReps) : [],\n rightStream ? streamNaturalSlots(rightStream, targetReps) : []\n )\n const { style: externalStyle, ...restProps } = viewProps\n\n const wing = (orientation: 'up' | 'down', columns: SetSlot[], done: number[]) => (\n <VelocityStrip\n variant=\"expanded\"\n showNumbers={false}\n showInfo={false}\n orientation={orientation}\n velocities={done}\n columnSlots={columns}\n scale={scale}\n scaleMax={scale === 'fixed' ? undefined : sharedMax}\n barColor={barColor}\n zones={zones}\n liveRepIndex={liveRepIndex}\n height={plotHalf}\n />\n )\n\n return (\n <View\n className={className}\n style={[{ height, flexDirection: 'column', gap: DUAL_WING_GAP }, externalStyle]}\n accessibilityRole=\"image\"\n accessibilityLabel={label}\n testID=\"dual-velocity-strip\"\n {...restProps}\n >\n {/* No gutter, side labels or centre axis at rail scale — the wings read as two rows via the\n shared gap alone. Their own labels would duplicate the dual's summary label. */}\n <View accessibilityElementsHidden testID=\"dual-velocity-wing-up\">\n {wing('up', aligned.left, leftDone)}\n </View>\n <View accessibilityElementsHidden testID=\"dual-velocity-wing-down\">\n {wing('down', aligned.right, rightDone)}\n </View>\n </View>\n )\n}\n\n/**\n * The `compact` diverging chart — the resting dual FOLDED into ONE 8px strip. Because the compact\n * bars are flat (colour-encoded, not height-encoded), the diverging pair need not stack into two\n * rows: each rep column splits at the centre into an L (top) and R (bottom) flat half (≈3.25px each,\n * a {@link COMPACT_FOLD_GAP}px gap between — a gap, not a line), so the pair occupies the SAME 8px as\n * the single compact — the per-rep analogue of the north-star stacked-halves. Index-locked (a lagging\n * side's un-logged reps render as faint empties); no gutter / labels / axis (no room at 8px). The\n * value-height diverging (where bar length must encode velocity) lives in `hero` / `rail`.\n */\nfunction DualVelocityCompactStrip({\n leftDone,\n rightDone,\n leftStream,\n rightStream,\n zones,\n barColor,\n targetReps,\n height,\n className,\n label,\n viewProps,\n}: DualChartProps) {\n // COMPOSED, like the hero and rail: two `compact` strips at COMPACT_FOLD_HALF each, separated by\n // COMPACT_FOLD_GAP (5 + 1.5 + 5 = DUAL_COMPACT_HEIGHT exactly). Because a compact bar FILLS its\n // plot, each column reads as an L top pill over an R bottom pill — the folded design, but drawn\n // by the same SetBarChart the single uses. Composing rather than hand-rolling is what makes the\n // set-type vocabulary (to-do, the cyan variable/continue windows, drop chunk-notch) and the\n // index-locked empty arrive for free, and keeps them from drifting apart later.\n const half = height === DUAL_COMPACT_HEIGHT ? COMPACT_FOLD_HALF : (height - COMPACT_FOLD_GAP) / 2\n const aligned = alignDualSlots(\n leftStream ? streamNaturalSlots(leftStream, targetReps) : [],\n rightStream ? streamNaturalSlots(rightStream, targetReps) : []\n )\n const { style: externalStyle, ...restProps } = viewProps\n\n const wing = (orientation: 'up' | 'down', columns: SetSlot[], done: number[]) => (\n <VelocityStrip\n variant=\"compact\"\n orientation={orientation}\n velocities={done}\n columnSlots={columns}\n barColor={barColor}\n zones={zones}\n height={half}\n />\n )\n\n return (\n <View\n className={className}\n style={[{ height, flexDirection: 'column', gap: COMPACT_FOLD_GAP }, externalStyle]}\n accessibilityRole=\"image\"\n accessibilityLabel={label}\n testID=\"dual-velocity-strip\"\n {...restProps}\n >\n <View accessibilityElementsHidden testID=\"dual-velocity-wing-up\">\n {wing('up', aligned.left, leftDone)}\n </View>\n <View accessibilityElementsHidden testID=\"dual-velocity-wing-down\">\n {wing('down', aligned.right, rightDone)}\n </View>\n </View>\n )\n}\n\n/**\n * The dual-voltra (bilateral) DIVERGING per-rep velocity chart. The up-wing stream grows UP, the\n * down-wing stream grows DOWN from one shared centre axis. The `hero` variant COMPOSES two single\n * {@link VelocityStrip} heroes (see {@link DualVelocityHero}) so any hero improvement reaches the\n * dual for free; `rail` uses a lean value-height renderer ({@link DualVelocityRail}); `compact` folds\n * the pair into one 8px strip ({@link DualVelocityCompactStrip}). Single-voltra sets keep using\n * {@link VelocityStrip} (`variant=\"hero\"`) — unchanged.\n */\nexport function DualVelocityStrip({\n left,\n right,\n zones,\n barColor = 'loss',\n targetReps,\n liveRepIndex,\n variant = 'hero',\n scale = 'peak',\n height,\n className,\n ...props\n}: DualVelocityStripProps) {\n const resolvedHeight =\n height ??\n (variant === 'hero'\n ? DUAL_HERO_HEIGHT\n : variant === 'compact'\n ? DUAL_COMPACT_HEIGHT\n : DUAL_RAIL_HEIGHT)\n // The done arrays drive the shared max + per-side best + the summary counts; the raw streams\n // flow to the hero wings so a side's set-type WINDOWS render (the `rail` renderer uses `*Done`).\n const leftDone = streamDone(left)\n const rightDone = streamDone(right)\n\n const label =\n `Dual velocity chart, left ${leftDone.length} of ${Math.max(leftDone.length, targetReps ?? leftDone.length)} reps, ` +\n `right ${rightDone.length} of ${Math.max(rightDone.length, targetReps ?? rightDone.length)} reps`\n\n const shared: DualChartProps = {\n leftDone,\n rightDone,\n leftStream: left,\n rightStream: right,\n leftLabel: left.label,\n rightLabel: right.label,\n zones,\n barColor,\n scale,\n targetReps,\n height: resolvedHeight,\n className,\n label,\n viewProps: props,\n }\n\n // `liveRepIndex` reaches the rail too: its wings are composed strips, so the newest rep grows\n // from the midline on BOTH sides. Compact is flat, so a grow animation has nothing to animate.\n if (variant === 'rail') return <DualVelocityRail {...shared} liveRepIndex={liveRepIndex} />\n if (variant === 'compact') return <DualVelocityCompactStrip {...shared} />\n return <DualVelocityHero {...shared} liveRepIndex={liveRepIndex} />\n}\n\nexport function VelocityStrip({\n velocities,\n set,\n zones,\n barColor = 'loss',\n showLossBands,\n orientation = 'up',\n scaleMax,\n hideBaseline,\n columnSlots,\n label,\n liveRepIndex,\n expanded = true,\n onToggle,\n onRepPress,\n variant = 'expanded',\n height = EXPANDED_HEIGHT,\n targetReps,\n scale = 'peak',\n showNumbers = true,\n showInfo = true,\n className,\n ...props\n}: VelocityStripProps) {\n // Bands default on with the loss bar-fill (the two halves of the loss language),\n // off for the absolute zone scale; an explicit prop always wins.\n const lossBandsOn = showLossBands ?? barColor === 'loss'\n // A `set` descriptor derives its own done-velocity array; the legacy\n // `velocities` path stays the source of truth otherwise. Every summary calc\n // (mean / loss / zone) runs on this one array so the info row works either way.\n const doneVelocities = set ? deriveDoneVelocities(set) : (velocities ?? [])\n\n const maxVelocity = Math.max(...doneVelocities, 0)\n const meanVelocity = calculateMeanVelocity(doneVelocities)\n const loss = calculateVelocityLoss(doneVelocities)\n\n // The framed chart (raised box, labels, info) vs the bare spotlight strip is the\n // only fork in the `expanded` variant — keyed by whether any chrome is requested.\n const framed = showNumbers || showInfo\n\n const hasZones = zones != null && zones.length > 0\n // Single-sourced zone resolver (diverging-hero) wrapped with the loss-relative mode: `barColor=\"loss\"`\n // colors each rep by its velocity loss from the set's own best, else the shared zone scale. Every\n // variant hands this `colorFor` to SetBarChart, so all variants color identically.\n const zoneColorFor = makeBarColorFor(zones)\n const barColorFor = (v: number): string =>\n barColor === 'loss' ? getVelocityLossColor(velocityLossForRep(v, maxVelocity)) : zoneColorFor(v)\n const meanZone = hasZones\n ? (classifyBand(meanVelocity, zones)?.label ?? '')\n : getVelocityZoneName(meanVelocity)\n\n // The framed collapse is now an IN-PLACE bar-height morph: `expandProgress` (0 collapsed → 1 open)\n // drives SetBarChart's bars flat↔value (no reflow), replacing the old collapse-to-3px height anim.\n // `infoOpacity` fades the info row; the per-bar labels fade with `expandProgress` in the overlay.\n const [expandProgress] = useState(() => new Animated.Value(expanded ? 1 : 0))\n const [infoOpacity] = useState(() => new Animated.Value(expanded ? 1 : 0))\n\n // Newest-rep animation: pop for a normal rep, bounce when it sets a new peak.\n const liveVelocity = liveRepIndex != null ? doneVelocities[liveRepIndex] : undefined\n const isNewPeak = liveVelocity != null && maxVelocity > 0 && liveVelocity === maxVelocity\n\n useEffect(() => {\n if (variant !== 'expanded' || !framed) return\n Animated.parallel([\n Animated.timing(expandProgress, {\n toValue: expanded ? 1 : 0,\n duration: ANIMATION_DURATION,\n easing: ANIMATION_EASING,\n useNativeDriver: false,\n }),\n Animated.timing(infoOpacity, {\n toValue: expanded ? 1 : 0,\n duration: 300,\n delay: expanded ? 200 : 0,\n useNativeDriver: false,\n }),\n ]).start()\n }, [expanded, variant, framed, expandProgress, infoOpacity])\n\n // Nothing to draw: neither a legacy velocity array nor a set descriptor.\n if (set == null && velocities == null) return null\n\n const repCount = doneVelocities.length\n const miniLabel = set ? setAccessibilityLabel(set, repCount) : `Velocity strip, ${repCount} reps`\n\n if (variant === 'hero') {\n // Hero's plot is far taller than the expanded chart; apply its own default when the caller left\n // `height` at the shared 60px default. The diverging dual (which passes `columnSlots`) sets an\n // explicit per-wing height — exempt it, so a dual whose wing height happens to be 60px (a 120px\n // dual) isn't mistaken for \"unset\" and blown up to 220.\n const heroHeight =\n height === EXPANDED_HEIGHT && columnSlots == null ? SET_BAR_DEFAULT_HEIGHT : height\n // `columnSlots` (the diverging dual's shared index-locked structure) wins; else a `set` builds\n // its own typed slots, and the plain `velocities` path is bare rep slots + a `targetReps` remainder.\n const heroSlots: SetSlot[] =\n columnSlots ??\n (set\n ? buildSlots(set).map((s) => ({\n kind: s.kind,\n value: s.velocity,\n leadingGap: s.leadingGap,\n }))\n : doneVelocities.map((v) => ({ kind: 'rep', value: v })))\n const total = Math.max(repCount, targetReps ?? repCount)\n const heroLabel =\n maxVelocity > 0\n ? `Velocity chart, ${repCount} of ${total} reps, best ${formatVelocity(maxVelocity)} meters per second`\n : `Velocity chart, ${repCount} of ${total} reps`\n return (\n <SetBarChart\n slots={heroSlots}\n colorFor={barColorFor}\n height={heroHeight}\n scale={scale}\n scaleMax={scaleMax}\n orientation={orientation}\n liveRepIndex={liveRepIndex}\n isNewPeak={isNewPeak}\n targetReps={set || columnSlots ? undefined : targetReps}\n label={label}\n showValueLabels\n formatValue={formatVelocity}\n renderReference={(g) => velocityReferenceOverlay(g, lossBandsOn)}\n hideBaseline\n testID=\"velocity-strip-hero\"\n testIDPrefix=\"velocity\"\n accessibilityLabel={heroLabel}\n className={className}\n viewProps={props}\n />\n )\n }\n\n if (variant === 'compact') {\n // `compact` = the flat resting form: SetBarChart in FLAT mode (uniform short bars, no value\n // labels), sharing hero's geometry — same colors, paper, 0.08 spacing, proportional chunk-notch,\n // todo/variable/continue slots, and gutter — so a compact↔expanded toggle only changes bar HEIGHT.\n // `columnSlots` (the diverging dual-compact's shared index-locked structure) wins, like the hero.\n const compactSlots: SetSlot[] =\n columnSlots ??\n (set\n ? buildSlots(set).map((s) => ({\n kind: s.kind,\n value: s.velocity,\n leadingGap: s.leadingGap,\n }))\n : doneVelocities.map((v) => ({ kind: 'rep', value: v })))\n const compactHeight = height === EXPANDED_HEIGHT ? COMPACT_HEIGHT : height\n return (\n <SetBarChart\n slots={compactSlots}\n colorFor={barColorFor}\n height={compactHeight}\n scale={scale}\n scaleMax={scaleMax}\n orientation={orientation}\n flat\n barRadius={2}\n cornerStyle=\"all\"\n targetReps={set || columnSlots ? undefined : targetReps}\n label={label}\n hideBaseline\n testID=\"velocity-strip-compact\"\n testIDPrefix=\"velocity\"\n accessibilityLabel={miniLabel}\n className={className}\n viewProps={props}\n />\n )\n }\n\n // Bare `expanded` strip (both chrome flags off): the velocity-HEIGHT spotlight — now\n // FOLDED onto SetBarChart (value mode, no labels), so its bars share the SAME geometry\n // (widths / gaps / chunk-notch / slots / paper) as compact + hero. Only the height-mode\n // (value here, flat in compact) differs, so a compact↔spotlight toggle never reflows.\n if (!framed) {\n // `columnSlots` wins, exactly as it does for compact and hero. The diverging dual passes the\n // index-locked shared structure through here; ignoring it gave the expanded dual its own\n // per-side columns, so a lagging side rendered FEWER bars instead of an aligned empty cell.\n const spotlightSlots: SetSlot[] =\n columnSlots ??\n (set\n ? buildSlots(set).map((s) => ({\n kind: s.kind,\n value: s.velocity,\n leadingGap: s.leadingGap,\n }))\n : doneVelocities.map((v) => ({ kind: 'rep', value: v })))\n return (\n <SetBarChart\n slots={spotlightSlots}\n colorFor={barColorFor}\n height={height}\n scale={scale}\n scaleMax={scaleMax}\n orientation={orientation}\n liveRepIndex={liveRepIndex}\n isNewPeak={isNewPeak}\n barRadius={2}\n cornerStyle=\"top\"\n targetReps={set ? undefined : targetReps}\n label={label}\n hideBaseline\n testID=\"velocity-strip-spotlight\"\n testIDPrefix=\"velocity\"\n accessibilityLabel={miniLabel}\n className={className}\n viewProps={props}\n />\n )\n }\n\n const stripLabel = set\n ? `${setAccessibilityLabel(set, repCount)}, tap to ${expanded ? 'collapse' : 'expand'}`\n : `Velocity chart for set, ${repCount} reps, tap to ${expanded ? 'collapse' : 'expand'}`\n // When onToggle wraps the strip or individual reps are interactive, the container itself is not a button\n const hasInteractiveContainer = onToggle != null\n const hasInteractiveReps = onRepPress != null && expanded\n\n const framedSlots: SetSlot[] = set\n ? buildSlots(set).map((sl) => ({\n kind: sl.kind,\n value: sl.velocity,\n leadingGap: sl.leadingGap,\n }))\n : doneVelocities.map((v) => ({ kind: 'rep', value: v }))\n\n // Per-bar overlay handed to SetBarChart so the framed chart keeps its m/s label (fading with the\n // expand) + its onRepPress hit-target WITHOUT re-rolling bars — one bar-rendering path remains.\n const needsBarOverlay = showNumbers || onRepPress != null\n const renderFramedBarOverlay = needsBarOverlay\n ? (repIndex: number, value: number) => (\n <>\n {showNumbers && (\n <Animated.View\n style={{\n opacity: expandProgress,\n position: 'absolute',\n top: -13,\n left: 0,\n right: 0,\n alignItems: 'center',\n }}\n accessibilityElementsHidden\n pointerEvents=\"none\"\n >\n <Text\n className=\"text-text-secondary\"\n style={{ fontSize: 8, fontWeight: '600' }}\n testID={`velocity-label-${repIndex}`}\n >\n {formatVelocity(value)}\n </Text>\n </Animated.View>\n )}\n {onRepPress && expanded && (\n <Pressable\n style={{ position: 'absolute', top: 0, bottom: 0, left: 0, right: 0 }}\n onPress={() => onRepPress(repIndex, value)}\n accessibilityRole=\"button\"\n accessibilityLabel={`Rep ${repIndex + 1}: ${formatVelocity(value)} meters per second, tap for details`}\n testID={`velocity-bar-pressable-${repIndex}`}\n />\n )}\n </>\n )\n : undefined\n\n // The framed chrome is a WRAPPER (raised box + info row + tap-to-collapse) around ONE SetBarChart\n // in value mode; the collapse is the in-place `expandProgress` bar-height morph, not a height strip.\n const stripContent = (\n <Animated.View\n className={[className, 'bg-surface-raised'].filter(Boolean).join(' ')}\n style={{ width: '100%', borderRadius: 6, paddingTop: 16, paddingBottom: showInfo ? 8 : 4 }}\n accessibilityRole={hasInteractiveContainer || hasInteractiveReps ? 'none' : 'button'}\n accessibilityLabel={hasInteractiveContainer || hasInteractiveReps ? undefined : stripLabel}\n testID=\"velocity-strip\"\n {...props}\n >\n <SetBarChart\n slots={framedSlots}\n colorFor={barColorFor}\n height={height}\n scale={scale}\n scaleMax={scaleMax}\n expandProgress={expandProgress}\n renderBarOverlay={renderFramedBarOverlay}\n targetReps={set ? undefined : targetReps}\n barRadius={2}\n cornerStyle=\"top\"\n hideBaseline\n testIDPrefix=\"velocity\"\n />\n {expanded && showInfo && (\n <Animated.View\n style={{\n flexDirection: 'row',\n justifyContent: 'space-between',\n opacity: infoOpacity,\n marginTop: 6,\n paddingHorizontal: 6,\n }}\n testID=\"velocity-info-row\"\n >\n <Text\n className=\"text-text-secondary\"\n style={{ fontSize: 10, fontFamily: 'Inter, sans-serif' }}\n >\n {meanZone} {'·'} {formatVelocity(meanVelocity)} m/s\n </Text>\n <Text\n className=\"text-text-secondary\"\n style={{ fontSize: 10, fontFamily: 'Inter, sans-serif', ...getLossStyle(loss) }}\n >\n Loss: {loss}%\n </Text>\n </Animated.View>\n )}\n </Animated.View>\n )\n\n if (onToggle) {\n return (\n <Pressable\n onPress={onToggle}\n accessibilityRole=\"button\"\n accessibilityLabel={stripLabel}\n testID=\"velocity-strip-pressable\"\n >\n {stripContent}\n </Pressable>\n )\n }\n\n return stripContent\n}\n","import { clsx, type ClassValue } from 'clsx'\nimport { twMerge } from 'tailwind-merge'\n\n/**\n * Utility function to merge Tailwind CSS classes with proper conflict resolution.\n * Combines clsx for conditional classes with tailwind-merge for deduplication.\n *\n * @example\n * cn('p-4 bg-red-500', isActive && 'bg-blue-500', className)\n * // If isActive is true, returns 'p-4 bg-blue-500' (not 'p-4 bg-red-500 bg-blue-500')\n */\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(clsx(inputs))\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { View, type ViewProps } from 'react-native'\nimport { cn } from '../../../utils/cn'\nimport { WORKOUT_TOKENS } from '../../../theme/workout-tokens'\n\nexport interface PlaceholderStripProps extends ViewProps {\n width?: number | string\n /** Render as single solid strip or segmented mini-strip */\n mode?: 'single' | 'segmented'\n /** Number of segments when mode is 'segmented' */\n segments?: number\n className?: string\n}\n\nfunction SingleStrip({\n width,\n className,\n ...props\n}: Omit<PlaceholderStripProps, 'mode' | 'segments'>) {\n return (\n <View\n className={className}\n style={[\n {\n height: 3,\n backgroundColor: WORKOUT_TOKENS.placeholder.fill,\n borderRadius: 2,\n opacity: 0.5,\n },\n width != null ? { width: width as number } : { flex: 1 },\n ]}\n accessibilityRole=\"image\"\n accessibilityLabel=\"Planned set, not yet completed\"\n testID=\"placeholder-strip\"\n {...props}\n />\n )\n}\n\nfunction SegmentedStrip({\n segments = 3,\n width,\n className,\n ...props\n}: Omit<PlaceholderStripProps, 'mode'>) {\n return (\n <View\n className={cn('flex-row', className)}\n style={[\n { height: 3, gap: 2, opacity: 0.5 },\n width != null ? { width: width as number } : { flex: 1 },\n ]}\n accessibilityRole=\"image\"\n accessibilityLabel=\"Planned set, not yet completed\"\n testID=\"placeholder-strip\"\n {...props}\n >\n {Array.from({ length: segments }, (_, i) => (\n <View\n key={i}\n style={{\n flex: 1,\n height: 3,\n backgroundColor: WORKOUT_TOKENS.placeholder.fill,\n borderRadius: 1,\n minWidth: 4,\n }}\n accessibilityElementsHidden\n testID=\"placeholder-segment\"\n />\n ))}\n </View>\n )\n}\n\nexport function PlaceholderStrip({\n mode = 'single',\n segments,\n ...props\n}: PlaceholderStripProps) {\n if (mode === 'segmented') {\n return <SegmentedStrip segments={segments} {...props} />\n }\n return <SingleStrip {...props} />\n}\n","import type { ReactNode } from 'react'\n\nexport interface IconProps {\n /** Rendered width/height in px (viewBox is fixed 24×24). */\n size?: number\n /** Stroke color (or fill, for solid icons). Defaults to `currentColor` so a wrapper's text token drives it. */\n color?: string\n /** Stroke width for outline icons. */\n strokeWidth?: number\n /** Fill color; defaults to `none` (outline). */\n fill?: string\n /** Accessible title — sets `role=\"img\"` + `<title>`. Omit for a decorative icon (hidden from AT). */\n title?: string\n}\n\nexport interface SvgIconProps extends IconProps {\n children: ReactNode\n}\n\n/**\n * Base SVG wrapper for the titan icon set — a 24×24 web-`<svg>` with the shared\n * accessibility contract (titled → `role=\"img\"` + `<title>`; untitled →\n * `aria-hidden`) and `currentColor` inheritance. Icons pass their paths as\n * children plus their stroke/fill defaults.\n */\nexport function SvgIcon({\n size = 24,\n color = 'currentColor',\n strokeWidth = 2,\n fill = 'none',\n title,\n children,\n}: SvgIconProps) {\n return (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill={fill}\n stroke={color}\n strokeWidth={strokeWidth}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n {...(title ? { role: 'img', 'aria-label': title } : { 'aria-hidden': true })}\n >\n {title ? <title>{title}</title> : null}\n {children}\n </svg>\n )\n}\n","import { SvgIcon, type IconProps } from './SvgIcon'\n\n/**\n * Voltras brand mark — the ◇ diamond (outline). Pass `fill` for a solid mark.\n */\nexport function VoltrasMark({ size = 14, ...props }: IconProps) {\n return (\n <SvgIcon size={size} {...props}>\n <path d=\"M12 2 22 12 12 22 2 12Z\" />\n </SvgIcon>\n )\n}\n\n/**\n * Bluetooth glyph (stroked) — e.g. device-connection state (color via `currentColor`).\n */\nexport function BluetoothIcon({ size = 18, ...props }: IconProps) {\n return (\n <SvgIcon size={size} {...props}>\n <path d=\"M7 7 17 17 12 22 12 2 17 7 7 17\" />\n </SvgIcon>\n )\n}\n\n/** Dumbbell glyph (mirrors lucide-react `Dumbbell`). Outline-only by default. */\nexport function DumbbellIcon(props: IconProps) {\n return (\n <SvgIcon {...props}>\n <path d=\"M14.4 14.4 9.6 9.6\" />\n <path d=\"M18.657 21.485a2 2 0 1 1-2.829-2.828l-1.767 1.768a2 2 0 1 1-2.829-2.829l6.364-6.364a2 2 0 1 1 2.829 2.829l-1.768 1.767a2 2 0 1 1 2.828 2.829z\" />\n <path d=\"m21.5 21.5-1.4-1.4\" />\n <path d=\"M3.9 3.9 2.5 2.5\" />\n <path d=\"M6.404 12.768a2 2 0 1 1-2.829-2.829l1.768-1.767a2 2 0 1 1-2.828-2.829l2.828-2.828a2 2 0 1 1 2.829 2.828l1.767-1.768a2 2 0 1 1 2.829 2.829z\" />\n </SvgIcon>\n )\n}\n\n/** Star glyph (mirrors lucide-react `Star`). Pass `fill` for a solid star. */\nexport function StarIcon(props: IconProps) {\n return (\n <SvgIcon {...props}>\n <path d=\"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z\" />\n </SvgIcon>\n )\n}\n\n/** Activity / pulse-line glyph (mirrors lucide-react `Activity`). Shell S2 nav → Live. */\nexport function ActivityIcon(props: IconProps) {\n return (\n <SvgIcon {...props}>\n <path d=\"M22 12h-4l-3 9L9 3l-3 9H2\" />\n </SvgIcon>\n )\n}\n\n/** History / clock-arrow glyph (mirrors lucide-react `History`). Shell S2 nav → Review. */\nexport function HistoryIcon(props: IconProps) {\n return (\n <SvgIcon {...props}>\n <path d=\"M3 12a9 9 0 1 0 3-6.7L3 8\" />\n <path d=\"M3 3v5h5\" />\n <path d=\"M12 7v5l4 2\" />\n </SvgIcon>\n )\n}\n\n/** Layers / stack glyph (mirrors lucide-react `Layers`). Shell S2 nav → Program (mesocycle stack). */\nexport function LayersIcon(props: IconProps) {\n return (\n <SvgIcon {...props}>\n <path d=\"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z\" />\n <path d=\"m6.08 9.5-3.49 1.59a1 1 0 0 0 0 1.81l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9a1 1 0 0 0 0-1.83l-3.5-1.59\" />\n <path d=\"m6.08 14.5-3.49 1.59a1 1 0 0 0 0 1.81l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9a1 1 0 0 0 0-1.83l-3.5-1.59\" />\n </SvgIcon>\n )\n}\n\n/** Standing-figure glyph (mirrors lucide-react `PersonStanding`). Shell S2 nav → Body (muscle map). */\nexport function PersonStandingIcon(props: IconProps) {\n return (\n <SvgIcon {...props}>\n <circle cx=\"12\" cy=\"5\" r=\"1\" />\n <path d=\"m9 20 3-6 3 6\" />\n <path d=\"m6 8 6 2 6-2\" />\n <path d=\"M12 10v4\" />\n </SvgIcon>\n )\n}\n\n/** Balance-scale glyph (mirrors lucide-react `Scale`). ExerciseIndicator → `imbalance`. */\nexport function ScaleIcon(props: IconProps) {\n return (\n <SvgIcon {...props}>\n <path d=\"m16 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z\" />\n <path d=\"m2 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z\" />\n <path d=\"M7 21h10\" />\n <path d=\"M12 3v18\" />\n <path d=\"M3 7h2c2 0 5-1 7-2 2 1 5 2 7 2h2\" />\n </SvgIcon>\n )\n}\n\n/** Warning-triangle glyph (mirrors lucide-react `AlertTriangle`). ExerciseIndicator → `overshoot`. */\nexport function AlertTriangleIcon(props: IconProps) {\n return (\n <SvgIcon {...props}>\n <path d=\"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z\" />\n <path d=\"M12 9v4\" />\n <path d=\"M12 17h.01\" />\n </SvgIcon>\n )\n}\n\n/** Down-trend glyph (mirrors lucide-react `TrendingDown`). ExerciseIndicator → `velocity-loss`. */\nexport function TrendingDownIcon(props: IconProps) {\n return (\n <SvgIcon {...props}>\n <path d=\"M16 17h6v-6\" />\n <path d=\"m22 17-8.5-8.5-5 5L2 7\" />\n </SvgIcon>\n )\n}\n\n/** Slashed-circle glyph (mirrors lucide-react `CircleSlash`). ExerciseIndicator → `missed-reps`. */\nexport function CircleSlashIcon(props: IconProps) {\n return (\n <SvgIcon {...props}>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"m9 15 6-6\" />\n </SvgIcon>\n )\n}\n\n/** Medal glyph (mirrors lucide-react `Award`). ExerciseIndicator → `pr`. */\nexport function AwardIcon(props: IconProps) {\n return (\n <SvgIcon {...props}>\n <path d=\"m15.477 12.89 1.515 8.526a.5.5 0 0 1-.81.47l-3.58-2.687a1 1 0 0 0-1.197 0l-3.586 2.686a.5.5 0 0 1-.81-.469l1.514-8.526\" />\n <circle cx=\"12\" cy=\"8\" r=\"6\" />\n </SvgIcon>\n )\n}\n\n/** Info-circle glyph (mirrors lucide-react `Info`). ExerciseIndicator → `info`. */\nexport function InfoIcon(props: IconProps) {\n return (\n <SvgIcon {...props}>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 16v-4\" />\n <path d=\"M12 8h.01\" />\n </SvgIcon>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { useState, type ReactNode } from 'react'\nimport { View, Pressable, Animated, type ViewProps } from 'react-native'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\n\nconst t = getSemanticColors('dark')\n\nexport type BaseBadgeVariant = 'plain' | 'pr'\nexport type BaseBadgeSize = 'sm' | 'md' | 'lg'\n\nexport interface BaseBadgeProps extends ViewProps {\n /** Visual variant — plain (neutral) or pr (brand-primary-subtle) */\n variant?: BaseBadgeVariant\n /** Size variant */\n size?: BaseBadgeSize\n /** Optional icon rendered left of children; hidden from a11y tree */\n icon?: ReactNode\n onPress?: () => void\n className?: string\n children?: ReactNode\n}\n\nexport const baseBadgeSizeConfig: Record<\n BaseBadgeSize,\n { fontSize: number; paddingH: number; paddingV: number; iconSize: number }\n> = {\n sm: { fontSize: 9, paddingH: 6, paddingV: 2, iconSize: 10 },\n md: { fontSize: 10, paddingH: 8, paddingV: 2, iconSize: 12 },\n lg: { fontSize: 12, paddingH: 10, paddingV: 4, iconSize: 14 },\n}\n\nconst variantColors: Record<BaseBadgeVariant, { backgroundColor: string; borderColor: string }> = {\n plain: { backgroundColor: t['surface-raised'], borderColor: t['hairline-default'] },\n pr: {\n backgroundColor: 'rgba(255, 121, 0, 0.12)',\n borderColor: 'rgba(255, 121, 0, 0.3)',\n },\n}\n\nexport function BaseBadge({\n variant = 'plain',\n size = 'md',\n icon,\n onPress,\n className,\n children,\n ...props\n}: BaseBadgeProps) {\n const [scaleAnim] = useState(() => new Animated.Value(1))\n const config = baseBadgeSizeConfig[size]\n const colors = variantColors[variant]\n\n const handlePressIn = () => {\n Animated.timing(scaleAnim, {\n toValue: 0.97,\n duration: 150,\n useNativeDriver: true,\n }).start()\n }\n\n const handlePressOut = () => {\n Animated.timing(scaleAnim, {\n toValue: 1,\n duration: 150,\n useNativeDriver: true,\n }).start()\n }\n\n const badge = (\n <View\n className={className}\n style={{\n flexDirection: 'row',\n alignItems: 'center',\n gap: 3,\n // borderRadius 2 is intentional per workout-tokens.ts (squared-off pill)\n borderRadius: 2,\n borderWidth: 1,\n borderColor: colors.borderColor,\n backgroundColor: colors.backgroundColor,\n paddingHorizontal: config.paddingH,\n paddingVertical: config.paddingV,\n }}\n {...props}\n >\n {icon != null && (\n <View accessibilityElementsHidden testID=\"base-badge-icon\">\n {icon}\n </View>\n )}\n {children}\n </View>\n )\n\n if (onPress) {\n return (\n <Animated.View style={{ transform: [{ scale: scaleAnim }] }}>\n <Pressable\n onPress={onPress}\n onPressIn={handlePressIn}\n onPressOut={handlePressOut}\n accessibilityRole=\"button\"\n accessibilityLabel={props.accessibilityLabel}\n testID=\"base-badge-pressable\"\n >\n {badge}\n </Pressable>\n </Animated.View>\n )\n }\n\n return badge\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { useEffect, useState } from 'react'\nimport { View, Text, Animated, Easing, type ViewProps } from 'react-native'\nimport { StarIcon } from './icons'\nimport { BaseBadge } from './BaseBadge'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\n\nconst BRAND_PRIMARY = getSemanticColors('dark')['brand-primary']\n\nexport type PRType = 'e1rm' | 'weight' | 'reps' | 'volume' | 'velocity'\n\nexport interface PrBadgeProps extends ViewProps {\n /** PR type determines auto-generated label */\n type?: PRType\n /** Display label (e.g., \"PR e1RM\", \"PR 5RM\"). Auto-generated from type if omitted. */\n label?: string\n /** Show only the star icon, no text label */\n compact?: boolean\n /** Trigger pop animation on mount */\n animate?: boolean\n className?: string\n}\n\nconst typeLabels: Record<PRType, string> = {\n e1rm: 'PR e1RM',\n weight: 'PR Weight',\n reps: 'PR Reps',\n volume: 'PR Volume',\n velocity: 'PR Velocity',\n}\n\nexport function PrBadge({\n type = 'e1rm',\n label: labelProp,\n compact = false,\n animate = true,\n className,\n ...props\n}: PrBadgeProps) {\n const resolvedLabel = labelProp ?? typeLabels[type]\n const [scale] = useState(() => new Animated.Value(animate ? 0.8 : 1))\n const [opacity] = useState(() => new Animated.Value(animate ? 0 : 1))\n\n useEffect(() => {\n if (!animate) return\n\n // HTML demo uses a 3-keyframe sequence; bezier approximation is close enough for native\n Animated.parallel([\n Animated.timing(scale, {\n toValue: 1,\n duration: 400,\n easing: Easing.bezier(0.34, 1.56, 0.64, 1),\n useNativeDriver: true,\n }),\n Animated.timing(opacity, {\n toValue: 1,\n duration: 400,\n easing: Easing.bezier(0.34, 1.56, 0.64, 1),\n useNativeDriver: true,\n }),\n ]).start()\n }, [animate, scale, opacity])\n\n const badge = compact ? (\n <View\n className={className}\n accessibilityRole=\"image\"\n accessibilityLabel={`Personal record: ${resolvedLabel}`}\n testID=\"pr-badge-star\"\n {...props}\n >\n <StarIcon size={14} color={BRAND_PRIMARY} fill={BRAND_PRIMARY} strokeWidth={2} />\n </View>\n ) : (\n <BaseBadge\n variant=\"pr\"\n className={className}\n accessibilityLabel={`Personal record: ${resolvedLabel}`}\n {...props}\n >\n <Text\n style={{\n fontSize: 12,\n color: BRAND_PRIMARY,\n fontWeight: '700',\n fontFamily: 'Inter, sans-serif',\n }}\n >\n {'\\u2605'} {resolvedLabel}\n </Text>\n </BaseBadge>\n )\n\n if (animate) {\n return (\n <Animated.View\n style={{ transform: [{ scale }], opacity }}\n testID=\"pr-badge-animated\"\n >\n {badge}\n </Animated.View>\n )\n }\n\n return badge\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { type ReactNode } from 'react'\nimport { View, Text } from 'react-native'\nimport { VelocityStrip, type VelocityZoneBandProp } from './VelocityStrip'\nimport { roundWeight, roundRpe } from '../../../utils/workout-format'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\nimport { WORKOUT_TOKENS } from '../../../theme/workout-tokens'\n\nexport type SetRowUnit = 'lbs' | 'kg'\n\n/** A set's lifecycle: logged (`done`), being performed now (`live`), or planned (`todo`). */\nexport type SetRowState = 'done' | 'live' | 'todo'\n\ninterface SetRowBase {\n setNumber: number\n unit: SetRowUnit\n /** Optional set-type marker (e.g. \"DROP\", \"AMRAP\") shown in the SET cell. */\n setType?: string\n /** Optional velocity-zone bands (WA `VelocityZones.bands`); default scale when absent. */\n velocityZones?: readonly VelocityZoneBandProp[]\n}\n\n/**\n * One row of the unified expanded exercise table (SET · REPS · LBS · RPE + a\n * per-row velocity strip), as a lifecycle discriminated union:\n * - `done` — a logged set: recorded reps / weight / rpe, a flat `mini` strip.\n * - `live` — performed right now: shows its TARGET (never \"reps-done/target\"),\n * stands out by brightness, and a compact velocity-HEIGHT spotlight strip.\n * - `todo` — planned: shows its target, muted, a flat grey `mini` stub strip.\n *\n * `done` + `todo` share ONE muted treatment; only `live` is brightened. There is\n * no PREV column (dropped in the unified design).\n */\nexport type SetRowProps =\n | (SetRowBase & {\n state: 'done'\n reps: number\n weight: number\n rpe?: number | null\n /** Per-rep MEAN concentric velocities (m/s). */\n velocities: number[]\n })\n | (SetRowBase & {\n state: 'live'\n /** The prescribed target shown in the REPS / LBS cells (no live \"5/10\"). */\n target: { reps: number; weight: number }\n /** Reps / weight committed so far (available to hosts; the display shows `target`). */\n reps: number\n weight: number\n rpe?: number | null\n /** Per-rep MEAN concentric velocities logged so far this set. */\n velocities: number[]\n /** Newest rep index — reserved; the compact spotlight strip is static. */\n liveRepIndex?: number\n })\n | (SetRowBase & {\n state: 'todo'\n /** The prescribed target shown in the REPS / LBS cells. */\n target: { reps: number; weight: number }\n /** Planned rep count backing the grey stub strip. Default `target.reps`. */\n planned?: number\n })\n\nconst DARK = getSemanticColors('dark')\n/** Live set — brightest (neutral 100). Done + upcoming share the muted neutral 400. */\nconst TEXT_ACTIVE = DARK['text-primary']\nconst TEXT_MUTED = DARK['text-secondary']\n\n/** Column widths mirror SetTableHeader(showPrevious=false) so cells align under it. */\nconst COL = { set: 36, reps: 44, load: 56, rpe: 36 } as const\nconst cellText = { fontFamily: 'Inter, sans-serif', fontSize: 13, fontWeight: '600' as const }\nconst typeBadge = {\n fontSize: 10,\n fontWeight: '700' as const,\n fontFamily: 'Inter, sans-serif',\n color: WORKOUT_TOKENS.scale.orange,\n backgroundColor: 'rgba(255,165,2,0.12)',\n paddingVertical: 1,\n paddingHorizontal: 5,\n borderRadius: 3,\n overflow: 'hidden' as const,\n}\n\n/** Reps to show: recorded for a `done` set, else the prescribed target. */\nfunction displayReps(set: SetRowProps): number {\n return set.state === 'done' ? set.reps : set.target.reps\n}\n\nfunction displayWeight(set: SetRowProps): number {\n return set.state === 'done' ? set.weight : set.target.weight\n}\n\n/** Planned rep count backing the row's strip. */\nfunction plannedReps(set: SetRowProps): number {\n if (set.state === 'done') return set.velocities.length\n if (set.state === 'live') return set.target.reps\n return set.planned ?? set.target.reps\n}\n\nfunction accessibilityLabel(set: SetRowProps): string {\n const base = `Set ${set.setNumber}: ${displayReps(set)} reps at ${roundWeight(displayWeight(set))} ${set.unit}`\n if (set.state === 'live') return `${base}, in progress`\n if (set.state === 'todo') return `${base}, upcoming`\n return base\n}\n\nfunction Cell({\n width,\n children,\n testID,\n}: {\n width: number\n children: ReactNode\n testID?: string\n}) {\n return (\n <View style={{ width, alignItems: 'center', justifyContent: 'center' }} testID={testID}>\n {children}\n </View>\n )\n}\n\n/** The per-row velocity strip: the velocity-height `expanded` spotlight for the live set, the flat `compact` strip otherwise. */\nfunction RowStrip({ set }: { set: SetRowProps }) {\n const zones = set.velocityZones\n if (set.state === 'live') {\n // The active-set spotlight: the bare velocity-height `expanded` chart at 24px,\n // fixed scale, no labels / info (both chrome flags off → the bare strip).\n return (\n <VelocityStrip\n variant=\"expanded\"\n showNumbers={false}\n showInfo={false}\n height={24}\n scale=\"fixed\"\n // Grow the newest rep from the baseline as it lands (the live-set spotlight).\n liveRepIndex={set.velocities.length - 1}\n set={{ type: 'straight', velocities: set.velocities, planned: set.target.reps }}\n zones={zones}\n />\n )\n }\n const velocities = set.state === 'done' ? set.velocities : []\n // Resting (done / todo) → the flat `compact` strip at the 8px SegmentedBar flat-bar language (the\n // static compact bar fills its plot), so the resting per-rep strip matches the set-level segmented\n // bars used elsewhere; the live spotlight above stays taller (24px).\n return (\n <VelocityStrip\n variant=\"compact\"\n height={8}\n hideBaseline\n set={{ type: 'straight', velocities, planned: plannedReps(set) }}\n zones={zones}\n />\n )\n}\n\n/**\n * ONE set row of the unified expanded exercise table. SET · REPS · LBS · RPE over\n * a per-row {@link VelocityStrip}; `live` stands out by brightness with a compact\n * velocity-height spotlight, `done`/`todo` are muted with a flat mini strip. Its\n * column widths mirror {@link SetTableHeader}(`showPrevious={false}`).\n */\nexport function SetRow(set: SetRowProps) {\n const live = set.state === 'live'\n const valueColor = live ? TEXT_ACTIVE : TEXT_MUTED\n const rpe = set.state === 'todo' ? null : set.rpe\n\n return (\n <View\n style={{ paddingVertical: 6, paddingHorizontal: 8 }}\n accessibilityLabel={accessibilityLabel(set)}\n testID=\"set-row\"\n >\n <View className=\"flex-row items-center\" style={{ justifyContent: 'space-between' }}>\n <Cell width={COL.set} testID=\"set-row-set-number\">\n {set.setType ? (\n <Text style={typeBadge} testID=\"set-row-type-badge\">\n {set.setType}\n </Text>\n ) : (\n <Text style={{ ...cellText, color: valueColor, fontWeight: live ? '700' : '600' }}>\n {set.setNumber}\n </Text>\n )}\n </Cell>\n <Cell width={COL.reps} testID=\"set-row-reps\">\n <Text style={{ ...cellText, color: valueColor }}>{displayReps(set)}</Text>\n </Cell>\n <Cell width={COL.load} testID=\"set-row-weight\">\n <Text style={{ ...cellText, color: valueColor }}>{roundWeight(displayWeight(set))}</Text>\n </Cell>\n <Cell width={COL.rpe} testID=\"set-row-rpe\">\n <Text style={{ ...cellText, color: TEXT_MUTED }}>\n {rpe != null ? roundRpe(rpe) : '—'}\n </Text>\n </Cell>\n </View>\n <View style={{ marginTop: live ? 6 : 4 }} testID=\"set-row-strip\">\n <RowStrip set={set} />\n </View>\n </View>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { View, Text } from 'react-native'\n\n// One header column: its label and its fixed width (PREV is the lone flex column,\n// `undefined`). Order + widths mirror SetRow's cells so headers align over rows.\ntype Column = { label: string; width: number | undefined }\n\nexport interface SetTableHeaderProps {\n /** Weight-column label: LBS / KG. Default lbs. */\n unit?: 'lbs' | 'kg'\n /** Show the PREV (previous-best) column. Default true; false drops it for rail density. */\n showPrevious?: boolean\n /** Overridable so a host card can keep its own testID. Default \"table-header\". */\n testID?: string\n}\n\n// The previous-best column is the lone flex column (`undefined` width). When hidden\n// it is dropped entirely (not blanked to a spacer) and the four fixed columns\n// distribute across the full strip width via `justifyContent: space-between`.\nconst PREV_COLUMN: Column = { label: 'PREV', width: undefined }\n\n/** Columns in order, with the weight column reflecting `unit`; PREV dropped when hidden. */\nfunction buildColumns(unit: 'lbs' | 'kg', showPrevious: boolean): Column[] {\n return [\n { label: 'SET', width: 36 },\n ...(showPrevious ? [PREV_COLUMN] : []),\n { label: 'REPS', width: 44 },\n { label: unit.toUpperCase(), width: 56 },\n { label: 'RPE', width: 36 },\n ]\n}\n\n/**\n * The expanded-set-table column-header row: SET · PREV · REPS · LOAD · RPE, with\n * the weight column reflecting `unit`. `showPrevious={false}` drops PREV (rail\n * density). Its per-column widths mirror {@link SetRow} so headers align over the\n * rows. Extracted from {@link ExerciseCard}'s expanded state for reuse.\n */\nexport function SetTableHeader({\n unit = 'lbs',\n showPrevious = true,\n testID = 'table-header',\n}: SetTableHeaderProps) {\n const columns = buildColumns(unit, showPrevious)\n\n return (\n <View\n className=\"flex-row\"\n style={{\n paddingVertical: 8,\n paddingHorizontal: 8,\n paddingBottom: 4,\n ...(showPrevious ? {} : { justifyContent: 'space-between' }),\n }}\n testID={testID}\n >\n {columns.map(({ label, width }) => {\n const isFlex = width === undefined\n\n return (\n <View\n key={label}\n style={{\n ...(isFlex ? { minWidth: 44 } : { width, flexShrink: 1 }),\n alignItems: 'center',\n justifyContent: 'center',\n gap: 8,\n }}\n {...(isFlex ? { className: 'flex-1' } : {})}\n >\n <Text\n className=\"text-text-tertiary\"\n style={{\n fontSize: 10,\n fontWeight: '600',\n fontFamily: 'Inter, sans-serif',\n textTransform: 'uppercase',\n letterSpacing: 0.8,\n }}\n >\n {label}\n </Text>\n </View>\n )\n })}\n </View>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport type { ReactNode } from 'react'\nimport { Text } from 'react-native'\n\n/**\n * Shared \"segmented metric\" typography primitive — the Inter · 600 · letter-spacing 1\n * value/separator cell used by both {@link TempoDisplay} (tempo digits + dashes) and\n * {@link SetsRepsLoad} (sets × reps @ load). Extracted so the two read as one visual\n * language instead of drifting copies.\n */\nexport const METRIC_FONT = 'Inter, sans-serif'\n\nexport interface MetricCellProps {\n children: ReactNode\n /** Cell text color — value cells take a primary color, separators a muted one. */\n color: string\n fontSize?: number\n}\n\nexport function MetricCell({ children, color, fontSize = 11 }: MetricCellProps) {\n return (\n <Text\n style={{\n fontFamily: METRIC_FONT,\n fontSize,\n color,\n fontWeight: '600',\n letterSpacing: 1,\n }}\n >\n {children}\n </Text>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { View, type ViewProps } from 'react-native'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\nimport { MetricCell } from './metricText'\n\nconst t = getSemanticColors('dark')\n\nconst TIMES = '×' // × multiplication sign, padded by muted separators\nconst AT = '@'\n\nexport interface SetsRepsLoadProps extends ViewProps {\n sets: number\n reps: number | string\n /** Load value; a string (e.g. \"—\") passes through verbatim for an unset/discovery load. */\n load: number | string\n /** Displayed load unit label (e.g. \"lb\", \"kg\"). */\n unit?: string\n /** Cell font size (px). Default 11 — the compact rail/card scale. Raise for a wall read-out. */\n fontSize?: number\n className?: string\n}\n\n/**\n * The `sets × reps @ load` prescription line, in the TempoDisplay visual language\n * (Inter · 600 · letter-spacing 1 · value cells with muted `×` / `@` separators).\n * Shares the {@link MetricCell} primitive with TempoDisplay so the two stay in step.\n */\nexport function SetsRepsLoad({\n sets,\n reps,\n load,\n unit = 'lb',\n fontSize,\n className,\n ...props\n}: SetsRepsLoadProps) {\n const value = t['text-primary']\n const sep = t['text-tertiary']\n\n return (\n <View\n className={className}\n style={{ flexDirection: 'row', alignItems: 'baseline' }}\n accessibilityLabel={`${sets} sets of ${reps} reps at ${load} ${unit}`}\n testID=\"sets-reps-load\"\n {...props}\n >\n <MetricCell color={value} fontSize={fontSize}>\n {sets}\n </MetricCell>\n <MetricCell color={sep} fontSize={fontSize}>{` ${TIMES} `}</MetricCell>\n <MetricCell color={value} fontSize={fontSize}>\n {reps}\n </MetricCell>\n <MetricCell color={sep} fontSize={fontSize}>{` ${AT} `}</MetricCell>\n <MetricCell color={value} fontSize={fontSize}>\n {load}\n </MetricCell>\n <MetricCell color={sep} fontSize={fontSize}>{` ${unit}`}</MetricCell>\n </View>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { useState, useCallback } from 'react'\nimport { View, Text, Pressable, type ViewProps } from 'react-native'\nimport { roundTempo } from '../../../utils/workout-format'\nimport { alpha } from '../../../utils/colors'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\nimport { primitiveRamps } from '../../../theme/tokens/primitives'\nimport { MetricCell } from './metricText'\n\nconst t = getSemanticColors('dark')\n\n/** The four tempo phases, in the order the display renders them. */\nexport type TempoLivePhase = 'eccentric' | 'pauseBottom' | 'concentric' | 'pauseTop'\n\n/**\n * Live rep state driving the phase-fill overlay. Controlled by the consumer\n * (matching titan's `elapsedMs`-in convention) so the same real timer feeds\n * both web dashboard and native app — TempoDisplay owns rendering only.\n */\nexport interface TempoLiveState {\n /** Phase currently in progress, or null when idle/at rest. */\n activePhase: TempoLivePhase | null\n /** Elapsed time (ms) within the active phase. */\n phaseElapsedMs: number\n /**\n * Actual completed durations (ms) for phases finished earlier THIS rep. A done cell\n * freezes at its final readout (not the target) until the next rep resets the row.\n * Omit a phase to fall back to its target (assume it completed on pace).\n */\n completed?: Partial<Record<TempoLivePhase, number>>\n}\n\nexport interface TempoDisplayProps extends ViewProps {\n /** Tempo values: [eccentric, pauseBottom, concentric, pauseTop] in seconds */\n tempo: [number, number, number, number]\n size?: 'sm' | 'md'\n /** Override the digit font size (px). Defaults from `size` (9 sm / 11 md); raise for a wall read-out. */\n fontSize?: number\n /** Show the \"TEMPO\" caption before the values. Default true. */\n showLabel?: boolean\n /** Show info tooltip on press */\n showInfo?: boolean\n /**\n * When set, renders a live phase-fill: the active phase digit fills against\n * its prescribed duration and inactive phases dim. Omit for the static\n * prescription string (default, backward compatible).\n */\n live?: TempoLiveState\n /** Active-phase readout when `live`: `countdown` remaining to 0.0 (default), or `countup` elapsed. */\n liveReadout?: TempoLiveReadout\n onPress?: () => void\n className?: string\n}\n\nconst INTER = 'Inter, sans-serif'\nconst TEXT_TERTIARY = '#6B7280'\nconst STATUS_ERROR = t['status-error'] // slow — over the target time\nconst STATUS_SUCCESS = t['status-success'] // on target (within the band of 0.0)\nconst STATUS_WARNING = t['status-warning'] // ahead — still time left to the target\n\n/** Live active-phase readout: `countdown` remaining to 0.0, or `countup` elapsed to target. */\nexport type TempoLiveReadout = 'countdown' | 'countup'\n\n/** ± this window (ms) around the target still counts as on target (0.0 ± 0.1s). */\nconst ON_TARGET_MS = 100\n\n/** Phase-progress fill percent (0–100): how far the active phase has run toward its target. */\nfunction getTempoFillPct(elapsedMs: number, targetMs: number | null): number {\n if (!targetMs) return 100\n return Math.min(100, (elapsedMs / targetMs) * 100)\n}\n\n/**\n * Semantic pacing tone for the active/completed phase's NUMBER (the fill bar carries phase\n * identity, so the number is free to carry pacing). Keyed on time remaining to target:\n * ahead of target (still counting) → warning; within ±0.1s of 0.0 → success; over → error.\n */\nfunction activeNumberTone(elapsedMs: number, targetMs: number | null): string {\n if (targetMs == null) return t['text-primary']\n const remainingMs = targetMs - elapsedMs\n if (remainingMs > ON_TARGET_MS) return STATUS_WARNING\n if (remainingMs >= -ON_TARGET_MS) return STATUS_SUCCESS\n return STATUS_ERROR\n}\n\n/** The active number: `countup` elapsed (→ target) or `countdown` remaining (→ 0.0, then −). */\nfunction liveReadoutText(elapsedMs: number, targetMs: number, readout: TempoLiveReadout): string {\n const seconds = readout === 'countup' ? elapsedMs / 1000 : (targetMs - elapsedMs) / 1000\n return seconds.toFixed(1)\n}\n\n// Phase IDENTITY colours — deliberately NON-semantic (magenta ecc / cyan con) so the\n// phase hue never collides with the semantic pacing tones (success/error) the active\n// number carries. Pauses stay neutral grey. [eccentric, pauseBottom, concentric, pauseTop]\nconst phaseColors = {\n eccentric: primitiveRamps.magenta[400],\n pauseBottom: TEXT_TERTIARY,\n concentric: primitiveRamps.cyan[300],\n pauseTop: TEXT_TERTIARY,\n dash: TEXT_TERTIARY,\n}\n\nfunction TempoValue({\n value,\n color,\n fontSize,\n}: {\n value: number\n color: string\n fontSize: number\n}) {\n return (\n <MetricCell color={color} fontSize={fontSize}>\n {value}\n </MetricCell>\n )\n}\n\nfunction TempoSeparator({ color, fontSize }: { color: string; fontSize: number }) {\n return (\n <MetricCell color={color} fontSize={fontSize}>\n -\n </MetricCell>\n )\n}\n\n// Phase order + color matching the tempo tuple, for the live phase-fill row.\nconst LIVE_PHASES: { key: TempoLivePhase; color: string }[] = [\n { key: 'eccentric', color: phaseColors.eccentric },\n { key: 'pauseBottom', color: phaseColors.pauseBottom },\n { key: 'concentric', color: phaseColors.concentric },\n { key: 'pauseTop', color: phaseColors.pauseTop },\n]\n\n/** A phase's place in the current rep: already done (locked full), filling now, or still to come. */\ntype LiveCellStatus = 'done' | 'active' | 'upcoming'\n\n/** A bottom-anchored vertical fill behind the number (the phase-progress bar). */\nfunction CellFill({ color, pct }: { color: string; pct: number }) {\n return (\n <View\n style={{\n position: 'absolute',\n left: 2,\n right: 2,\n bottom: 0,\n height: `${pct}%`,\n backgroundColor: alpha(color, 0.28),\n borderRadius: 3,\n }}\n />\n )\n}\n\n/** Monospace stack for the live readout so digit widths never shift. */\nconst MONO = 'ui-monospace, SFMono-Regular, Menlo, Consolas, monospace'\n/** Widest readout the cell must hold: sign · two whole digits · point · tenths, e.g. \"-12.3\". */\nconst READOUT_MAX_CHARS = 5\n\nfunction LiveTempoCell({\n value,\n color,\n status,\n phaseElapsedMs,\n completedMs,\n fontSize,\n readout,\n}: {\n value: number\n color: string\n status: LiveCellStatus\n phaseElapsedMs: number\n completedMs: number | undefined\n fontSize: number\n readout: TempoLiveReadout\n}) {\n const targetMs = value > 0 ? value * 1000 : null\n // Fixed, monospace-width cell sized to the widest readout — a phase activating or its\n // number changing never shifts the layout (the fill bar stays put too).\n const cellW = Math.ceil(fontSize * 0.62 * READOUT_MAX_CHARS)\n const wrap = {\n position: 'relative' as const,\n width: cellW,\n minHeight: Math.round(fontSize * 1.25),\n alignItems: 'center' as const,\n justifyContent: 'center' as const,\n }\n const num = (c: string, text: string) => (\n <Text style={{ fontFamily: MONO, fontSize, color: c, fontWeight: '700' }}>{text}</Text>\n )\n\n // Upcoming / idle: the phase's prescribed time in the FULL phase colour, no fill — so a\n // not-yet-started (or fully idle) row just reads as the base tempo lockup, not a dim mode.\n if (status === 'upcoming') {\n const targetText = targetMs != null ? (targetMs / 1000).toFixed(1) : String(value)\n return <View style={wrap}>{num(color, targetText)}</View>\n }\n\n // Done: FROZEN at the phase's final readout (its actual completed time, not the target),\n // fill locked full in the phase colour. The number keeps its SEMANTIC pacing tone (it is\n // showing the final time, not the target) — banked progress until the next rep resets.\n if (status === 'done') {\n const finalMs = completedMs ?? targetMs ?? 0\n const finalText = targetMs != null ? liveReadoutText(finalMs, targetMs, readout) : String(value)\n const finalTone = targetMs != null ? activeNumberTone(finalMs, targetMs) : color\n return (\n <View style={wrap} testID=\"tempo-live-done\">\n <CellFill color={color} pct={100} />\n {num(finalTone, finalText)}\n </View>\n )\n }\n\n // Active: the phase-hued fill grows with the phase; the number reads the live time\n // (countdown/countup) to 0.1s, coloured SEMANTICALLY by pacing (neutral/on-target/behind).\n const numberTone = activeNumberTone(phaseElapsedMs, targetMs)\n const fillPct = getTempoFillPct(phaseElapsedMs, targetMs)\n const activeText =\n targetMs != null ? liveReadoutText(phaseElapsedMs, targetMs, readout) : String(value)\n return (\n <View style={wrap} testID=\"tempo-live-active\">\n <CellFill color={color} pct={fillPct} />\n {num(numberTone, activeText)}\n </View>\n )\n}\n\nfunction LiveTempoRow({\n values,\n live,\n fontSize,\n readout,\n}: {\n values: [number, number, number, number]\n live: TempoLiveState\n fontSize: number\n readout: TempoLiveReadout\n}) {\n // Phases run in a fixed order within a rep, so the active phase's position tells us which\n // phases are already done (locked). When it wraps back to the first phase, the row resets.\n const activeIndex = live.activePhase\n ? LIVE_PHASES.findIndex((p) => p.key === live.activePhase)\n : -1\n return (\n <>\n {LIVE_PHASES.map((phase, i) => {\n const status: LiveCellStatus =\n activeIndex < 0 || i > activeIndex ? 'upcoming' : i < activeIndex ? 'done' : 'active'\n return (\n <View key={phase.key} style={{ flexDirection: 'row', alignItems: 'center' }}>\n {i > 0 && <TempoSeparator color={phaseColors.dash} fontSize={fontSize} />}\n <LiveTempoCell\n value={values[i]}\n color={phase.color}\n status={status}\n phaseElapsedMs={live.phaseElapsedMs}\n completedMs={live.completed?.[phase.key]}\n fontSize={fontSize}\n readout={readout}\n />\n </View>\n )\n })}\n </>\n )\n}\n\nexport function TempoDisplay({\n tempo,\n size = 'md',\n fontSize: fontSizeProp,\n showLabel = true,\n showInfo = true,\n live,\n liveReadout = 'countdown',\n onPress,\n className,\n ...props\n}: TempoDisplayProps) {\n const [showTooltip, setShowTooltip] = useState(false)\n // Round exact (unrounded) tempo seconds to the 1-dp display granularity.\n const [eccentric, pauseBottom, concentric, pauseTop] = roundTempo(tempo)\n const isSm = size === 'sm'\n const fontSize = fontSizeProp ?? (isSm ? 9 : 11)\n // The chrome (padding, radius, label) scales with the digit size so the whole view stays\n // proportional at any form factor — a compact rail chip up to a wall read-out.\n const chromePadX = Math.round(fontSize * 0.6)\n const chromePadY = Math.round(fontSize * 0.3)\n const chromeRadius = Math.round(fontSize * 0.4)\n const labelFont = Math.max(9, Math.round(fontSize * 0.5))\n\n const handlePress = useCallback(() => {\n if (onPress) {\n onPress()\n }\n if (showInfo) {\n setShowTooltip((prev) => !prev)\n }\n }, [onPress, showInfo])\n\n const content = (\n <View\n className={className}\n style={{\n flexDirection: 'row',\n alignItems: 'center',\n backgroundColor: t['surface-raised'],\n paddingHorizontal: chromePadX,\n paddingVertical: chromePadY,\n borderRadius: chromeRadius,\n }}\n {...props}\n >\n {showLabel && (\n <Text\n style={{\n fontFamily: INTER,\n fontSize: labelFont,\n fontWeight: '500',\n // Live-muted green while a rep is running, tertiary at rest.\n color: live ? t['status-live-muted'] : TEXT_TERTIARY,\n letterSpacing: 0.5,\n textTransform: 'uppercase',\n marginRight: Math.round(fontSize * 0.5),\n }}\n >\n TEMPO\n </Text>\n )}\n <View style={{ flexDirection: 'row' }} testID=\"tempo-value\">\n {live ? (\n <LiveTempoRow\n values={[eccentric, pauseBottom, concentric, pauseTop]}\n live={live}\n fontSize={fontSize}\n readout={liveReadout}\n />\n ) : (\n // Static prescription: the phase-coloured lockup (the same colours the live row rests at).\n <>\n <TempoValue value={eccentric} color={phaseColors.eccentric} fontSize={fontSize} />\n <TempoSeparator color={phaseColors.dash} fontSize={fontSize} />\n <TempoValue value={pauseBottom} color={phaseColors.pauseBottom} fontSize={fontSize} />\n <TempoSeparator color={phaseColors.dash} fontSize={fontSize} />\n <TempoValue value={concentric} color={phaseColors.concentric} fontSize={fontSize} />\n <TempoSeparator color={phaseColors.dash} fontSize={fontSize} />\n <TempoValue value={pauseTop} color={phaseColors.pauseTop} fontSize={fontSize} />\n </>\n )}\n </View>\n </View>\n )\n\n return (\n <Pressable\n accessibilityLabel={`Tempo: ${eccentric} second eccentric, ${pauseBottom} second pause, ${concentric} second concentric, ${pauseTop} second pause`}\n accessibilityRole=\"button\"\n onPress={handlePress}\n testID=\"tempo-display\"\n >\n {content}\n {showTooltip && (\n <View\n style={{\n position: 'absolute',\n bottom: '100%',\n left: '50%',\n transform: [{ translateX: '-50%' as unknown as number }],\n marginBottom: 8,\n zIndex: 20,\n alignItems: 'center',\n }}\n testID=\"tempo-tooltip\"\n >\n <View\n style={{\n backgroundColor: t['surface-overlay'],\n borderRadius: 6,\n paddingVertical: 8,\n paddingHorizontal: 12,\n borderWidth: 1,\n borderColor: '#2C2C2C',\n }}\n >\n <Text style={{ fontSize: 10, lineHeight: 16, color: '#9CA3AF', fontFamily: INTER }}>\n Eccentric: {eccentric}s\n </Text>\n <Text style={{ fontSize: 10, lineHeight: 16, color: '#9CA3AF', fontFamily: INTER }}>\n Pause (bottom): {pauseBottom}s\n </Text>\n <Text style={{ fontSize: 10, lineHeight: 16, color: '#9CA3AF', fontFamily: INTER }}>\n Concentric: {concentric}s\n </Text>\n <Text style={{ fontSize: 10, lineHeight: 16, color: '#9CA3AF', fontFamily: INTER }}>\n Pause (top): {pauseTop}s\n </Text>\n </View>\n <View\n style={{\n width: 0,\n height: 0,\n borderLeftWidth: 5,\n borderRightWidth: 5,\n borderTopWidth: 5,\n borderLeftColor: 'transparent',\n borderRightColor: 'transparent',\n borderTopColor: '#2C2C2C',\n }}\n />\n </View>\n )}\n </Pressable>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport type { ComponentType } from 'react'\nimport { View, Pressable, type ViewProps } from 'react-native'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\nimport {\n ScaleIcon,\n AlertTriangleIcon,\n TrendingDownIcon,\n CircleSlashIcon,\n AwardIcon,\n InfoIcon,\n type IconProps,\n} from '../../icons'\n\n// Literal-hex status pins (getSemanticColors, not resolveColor) — `resolveColor()` yields a\n// `var(...)` under the RNW vitest alias, which breaks `toHaveStyle` in tests.\nconst t = getSemanticColors('dark')\n\n/**\n * The LOCKED 6-kind indicator taxonomy (TD-03.51). One precedence-ranked slot is\n * ever shown per exercise, resolved by {@link resolveIndicator}. Glyph = the\n * specific signal; color = the severity tier (danger/warning/success/info, bound\n * to titan status tokens). Outlined (border + glyph, no fill) so a chip never\n * collides with the filled velocity strip beside it.\n */\nexport type ExerciseIndicatorKind =\n | 'imbalance'\n | 'overshoot'\n | 'velocity-loss'\n | 'missed-reps'\n | 'pr'\n | 'info'\n\ninterface IndicatorConfig {\n Icon: ComponentType<IconProps>\n /** Tier color — a titan status semantic token (literal hex on `t`). */\n color: string\n /** Accessible description (also the intended tooltip subject). */\n label: string\n}\n\nconst INDICATOR_CONFIG: Record<ExerciseIndicatorKind, IndicatorConfig> = {\n imbalance: { Icon: ScaleIcon, color: t['status-error'], label: 'Left/right imbalance' },\n overshoot: { Icon: AlertTriangleIcon, color: t['status-error'], label: 'Load overshoot' },\n 'velocity-loss': { Icon: TrendingDownIcon, color: t['status-warning'], label: 'Velocity loss' },\n 'missed-reps': { Icon: CircleSlashIcon, color: t['status-warning'], label: 'Missed reps' },\n pr: { Icon: AwardIcon, color: t['status-success'], label: 'Personal record' },\n info: { Icon: InfoIcon, color: t['status-info'], label: 'More info' },\n}\n\n/**\n * Precedence order (1=highest → last=lowest). A single chip is shown, so when\n * several signals are true the highest-ranked wins. Alerts outrank `pr`; `info`\n * is the floor. This ordering is LOCKED — do not reshuffle.\n */\nexport const INDICATOR_PRECEDENCE: readonly ExerciseIndicatorKind[] = [\n 'imbalance',\n 'overshoot',\n 'velocity-loss',\n 'missed-reps',\n 'pr',\n 'info',\n]\n\n/**\n * Given the signals currently true for an exercise, pick the single\n * highest-precedence kind to surface (or `undefined` when none apply). Order and\n * duplicates in `candidates` don't matter — {@link INDICATOR_PRECEDENCE} decides.\n */\nexport function resolveIndicator(\n candidates: ExerciseIndicatorKind[],\n): ExerciseIndicatorKind | undefined {\n return INDICATOR_PRECEDENCE.find((kind) => candidates.includes(kind))\n}\n\nexport interface ExerciseIndicatorProps extends Omit<ViewProps, 'children'> {\n kind: ExerciseIndicatorKind\n /** Optional tap handler (surfaces detail — PR history / alert / info). */\n onPress?: () => void\n className?: string\n}\n\n/**\n * A small circular outlined chip for an exercise heading. Presentational and\n * static (chips are chrome — no pulse); the tap detail (tooltip/sheet) is wired\n * by the consumer.\n */\nexport function ExerciseIndicator({ kind, onPress, className, ...props }: ExerciseIndicatorProps) {\n const { Icon, color, label } = INDICATOR_CONFIG[kind]\n\n const chip = (\n <View\n className={className}\n style={{\n width: 16,\n height: 16,\n borderRadius: 8,\n borderWidth: 1,\n borderColor: color,\n alignItems: 'center',\n justifyContent: 'center',\n }}\n accessibilityRole=\"image\"\n accessibilityLabel={label}\n testID=\"exercise-indicator\"\n {...props}\n >\n <Icon size={11} color={color} />\n </View>\n )\n\n if (onPress) {\n return (\n <Pressable onPress={onPress} accessibilityRole=\"button\" accessibilityLabel={label}>\n {chip}\n </Pressable>\n )\n }\n return chip\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { View, Text, Pressable } from 'react-native'\nimport { roundWeight } from '../../../utils/workout-format'\nimport { SetsRepsLoad } from './SetsRepsLoad'\nimport { TempoDisplay } from './TempoDisplay'\nimport { ExerciseIndicator, type ExerciseIndicatorKind } from './ExerciseIndicator'\n\nexport interface ExerciseHeadingProps {\n name: string\n /** Prescription line values (sets × reps @ load). */\n sets: number\n reps: number | string\n /** Load value; a string (e.g. \"—\") passes through verbatim for an unset/discovery load. */\n load: number | string\n unit?: 'lbs' | 'kg'\n /** Tempo tuple [eccentric, pauseBottom, concentric, pauseTop]; hidden when absent. */\n tempo?: [number, number, number, number]\n /** Small PR / issue / info chip in the title row. */\n indicator?: ExerciseIndicatorKind\n /** Dim the block as a not-yet-reached exercise (standalone use). */\n dimmed?: boolean\n /** Press target for the name row (expand / select). */\n onPress?: () => void\n}\n\nfunction headingLabel(\n name: string,\n sets: number,\n reps: number | string,\n load: number | string,\n unit: string\n) {\n const loadLabel = typeof load === 'number' ? roundWeight(load) : load\n return `${name}, ${sets}×${reps} @ ${loadLabel} ${unit}`\n}\n\n/**\n * The exercise-heading info block (no strip): the name + {@link ExerciseIndicator}\n * title row over a tight {@link SetsRepsLoad} prescription line beside the real\n * {@link TempoDisplay} (`showLabel={false}`). The name row is the sole press\n * target — TempoDisplay is a sibling, never a descendant, since it is itself a\n * Pressable (nesting would be an a11y nested-interactive violation).\n */\nexport function ExerciseHeading({\n name,\n sets,\n reps,\n load,\n unit = 'lbs',\n tempo,\n indicator,\n dimmed,\n onPress,\n}: ExerciseHeadingProps) {\n return (\n <View style={{ opacity: dimmed ? 0.55 : 1 }} testID=\"exercise-heading\">\n <Pressable\n onPress={onPress}\n accessibilityRole=\"button\"\n accessibilityLabel={headingLabel(name, sets, reps, load, unit)}\n className=\"flex-row items-center\"\n style={{ gap: 8 }}\n testID=\"exercise-card-header\"\n >\n <Text\n className=\"text-text-primary\"\n style={{ fontSize: 14, fontFamily: '\"Space Grotesk\", sans-serif', fontWeight: '700' }}\n testID=\"exercise-card-name\"\n >\n {name}\n </Text>\n <View className=\"flex-1\" />\n {indicator && <ExerciseIndicator kind={indicator} />}\n </Pressable>\n\n <View\n className=\"flex-row items-center\"\n style={{ gap: 8, marginTop: 1 }}\n testID=\"exercise-card-summary\"\n >\n <SetsRepsLoad sets={sets} reps={reps} load={load} unit={unit} />\n <View className=\"flex-1\" />\n {tempo && <TempoDisplay tempo={tempo} size=\"sm\" showLabel={false} showInfo={false} />}\n </View>\n </View>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { useEffect, useState } from 'react'\nimport { View, Animated, Easing, type ViewProps, type DimensionValue } from 'react-native'\n\n/** ~1.9s full cycle: a pulsing segment eases up then back down (2 × half). */\nconst PULSE_HALF_MS = 950\n\n/** Pulsing segments breathe their opacity between this floor and full. */\nconst PULSE_MIN_OPACITY = 0.45\n\n/** Default between-segment gap — matches SetStrip's between-set gap so strips read the same. */\nconst SEGMENTED_BAR_GAP = 5\n\nexport interface SegmentedBarSegment {\n /** Flex weight of this segment's slot. Default 1 (all segments equal width). */\n weight?: number\n /** Fraction 0..1 of the slot the coloured fill covers, left-aligned. Default 1 (full). */\n fill?: number\n /** Fill colour — a literal hex (RNW-safe), never a `var()` token ref. */\n color: string\n /** When true the fill animates on the shared active-pulse loop. */\n pulse?: boolean\n /**\n * When pulsing, interpolate the fill's `backgroundColor` from→to over the loop\n * (full opacity). Omit to fall back to the default opacity breathe.\n */\n pulseColor?: [from: string, to: string]\n /**\n * A fixed gap (px) carved in before this segment's slot — lets a composer split\n * an otherwise-butted bar into sub-structure (drop notch, myo cluster) without a\n * uniform {@link SegmentedBarProps.gap}. Default 0 (butted against the previous).\n */\n leadingGap?: number\n /**\n * Static fill opacity 0..1 for a non-pulsing segment (e.g. a fading \"count\n * unknown\" trail). Ignored for `pulse` segments, which drive their own opacity.\n */\n opacity?: number\n}\n\nexport interface SegmentedBarProps extends ViewProps {\n /** The weighted segments, laid left-to-right. */\n segments: SegmentedBarSegment[]\n /** Track height in px. Default 8. */\n height?: number\n /** Gap between segment slots in px. Default 5 (SetStrip's between-set gap). */\n gap?: number\n /** Corner radius of each segment slot in px. Default 2. */\n radius?: number\n /** An absolutely-positioned vertical marker line at `position` (0..1 of total width). */\n marker?: { position: number; color: string } | null\n /**\n * Resolve the testID of a segment's fill element. Lets a composing component\n * (e.g. SetBar) preserve its own test hooks; defaults to `segmented-bar-segment`.\n */\n segmentTestID?: (segment: SegmentedBarSegment, index: number) => string | undefined\n}\n\n/** The shared active-pulse loop: a single 0→1→0 value driving every pulsing segment. */\nfunction usePulse(active: boolean): Animated.Value {\n const [value] = useState(() => new Animated.Value(0))\n\n useEffect(() => {\n if (!active) return\n const loop = Animated.loop(\n Animated.sequence([\n Animated.timing(value, {\n toValue: 1,\n duration: PULSE_HALF_MS,\n easing: Easing.inOut(Easing.ease),\n useNativeDriver: false,\n }),\n Animated.timing(value, {\n toValue: 0,\n duration: PULSE_HALF_MS,\n easing: Easing.inOut(Easing.ease),\n useNativeDriver: false,\n }),\n ])\n )\n loop.start()\n return () => loop.stop()\n }, [active, value])\n\n return value\n}\n\n/**\n * A horizontal track split into weighted, individually-fillable segments — the\n * presentational atom the per-set strips are built from. Each segment is a flex\n * slot (flex = `weight`) holding a left-aligned fill (`fill` fraction, `color`);\n * `pulse` segments breathe on a shared active-pulse loop, and `marker` drops a\n * vertical line at a fraction of the total width. Colours are passed-in literal hex.\n */\nexport function SegmentedBar({\n segments,\n height = 8,\n gap = SEGMENTED_BAR_GAP,\n radius = 2,\n marker = null,\n segmentTestID,\n style,\n ...props\n}: SegmentedBarProps) {\n const pulse = usePulse(segments.some((s) => s.pulse))\n\n return (\n <View style={[{ flexDirection: 'row', height, gap, position: 'relative' }, style]} {...props}>\n {segments.map((seg, i) => {\n const fillStyle = {\n width: `${(seg.fill ?? 1) * 100}%` as DimensionValue,\n height: '100%' as DimensionValue,\n backgroundColor: seg.color,\n opacity: seg.opacity,\n }\n const testID = segmentTestID?.(seg, i) ?? 'segmented-bar-segment'\n return (\n <View\n key={i}\n style={{\n flex: seg.weight ?? 1,\n minWidth: 0,\n height: '100%',\n marginLeft: seg.leadingGap,\n borderRadius: radius,\n overflow: 'hidden',\n }}\n >\n {seg.pulse ? (\n <Animated.View\n style={{\n ...fillStyle,\n ...(seg.pulseColor\n ? {\n backgroundColor: pulse.interpolate({\n inputRange: [0, 1],\n outputRange: seg.pulseColor,\n }),\n }\n : {\n opacity: pulse.interpolate({\n inputRange: [0, 1],\n outputRange: [PULSE_MIN_OPACITY, 1],\n }),\n }),\n }}\n accessibilityElementsHidden\n testID={testID}\n />\n ) : (\n <View style={fillStyle} accessibilityElementsHidden testID={testID} />\n )}\n </View>\n )\n })}\n {marker ? (\n <View\n style={{\n position: 'absolute',\n left: `${marker.position * 100}%` as DimensionValue,\n top: 0,\n bottom: 0,\n width: 2,\n backgroundColor: marker.color,\n }}\n accessibilityElementsHidden\n testID=\"segmented-bar-marker\"\n />\n ) : null}\n </View>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { primitiveRamps, greyRamp } from '../../../theme/tokens/primitives'\nimport { SegmentedBar, type SegmentedBarSegment } from './SegmentedBar'\n\n/**\n * The four canonical rep-intensity zone pins (real titan ramp pins). A rep's mean\n * velocity ratio maps to one of these; butted together they form a set's bar.\n */\nexport const SET_STRIP_ZONES = {\n slow: primitiveRamps.red[600],\n moderate: primitiveRamps.orange[400],\n fast: primitiveRamps.amber[300],\n fastest: primitiveRamps.green[300],\n} as const\n\n/** Grey fill for planned-but-unperformed reps / upcoming sets (grey placeholder). */\nconst TODO_COLOR = greyRamp[900]\n\n/**\n * The learned \"variable / unknown / opportunity\" semantic (cyan-900, a real ramp\n * pin): an unperformed rep in a range's variable zone, and the fading trail of a\n * myo set whose cluster count isn't yet known.\n */\nexport const SET_STRIP_VARIABLE_COLOR = primitiveRamps.cyan[900]\n\n// Gap hierarchy — the chunk-size *pattern* carries set-type identity:\n// butted reps (0) < NOTCH (drop sub-load) < CLUSTER (myo rest-pause) < SET_GAP (5, between sets).\n/** Drop-set sub-load divider — a thin notch, narrower than a myo cluster gap. */\nconst NOTCH_GAP = 2\n/** Myo rest-pause divider between the activation chunk and each mini-cluster. */\nconst CLUSTER_GAP = 3\n\n/** myo-upcoming trail defaults: N fading expected clusters, each this many reps. */\nconst MYO_UPCOMING_CLUSTERS = 3\nconst MYO_UPCOMING_CLUSTER_LEN = 5\n/** Per-cluster opacity decay along the \"count unknown\" trail (1 · 0.6 · 0.36 · …). */\nconst MYO_UPCOMING_FADE = 0.6\n\n/**\n * Active-set pulse range per zone: each segment eases between its pin's adjacent\n * lighter/darker ramp steps, keeping the intensity reading while signalling \"live\".\n */\nconst PULSE_RANGE: Record<string, [string, string]> = {\n [SET_STRIP_ZONES.slow]: [primitiveRamps.red[500], primitiveRamps.red[700]],\n [SET_STRIP_ZONES.moderate]: [primitiveRamps.orange[300], primitiveRamps.orange[500]],\n [SET_STRIP_ZONES.fast]: [primitiveRamps.amber[200], primitiveRamps.amber[400]],\n [SET_STRIP_ZONES.fastest]: [primitiveRamps.green[200], primitiveRamps.green[400]],\n}\n\n/** Map a per-rep mean-velocity ratio to its zone pin (fastest = green, slowest = red). */\nexport function velocityZoneColor(v: number): string {\n if (v < 0.5) return SET_STRIP_ZONES.slow\n if (v < 0.75) return SET_STRIP_ZONES.moderate\n if (v < 1.0) return SET_STRIP_ZONES.fast\n return SET_STRIP_ZONES.fastest\n}\n\n/**\n * One set's data. Flat variants: `done` = every rep performed; `active` = reps-so-far\n * performed against a planned count (remainder greyed, performed reps pulse); `todo` =\n * a planned but unstarted set (solid grey bar). Set-type variants:\n * - `range` — variable rep-range (e.g. 15–20): `max` segments; committed zone\n * `0..floor` (done = velocity, todo = grey), variable zone `floor..max` (done =\n * velocity, todo = the variable/opportunity cyan). `doneVels` may run past `floor`.\n * - `drop` — one set, no rest: `subloads` butted internally, split by 2px notches.\n * - `myo` — done rest-pause: `activation` chunk + `clusters`, split by 3px cluster gaps.\n * - `myo-upcoming` — planned myo, length unknown: grey activation (`activationLen`) +\n * a fading cyan \"clusters-to-failure\" trail with the right edge left open.\n */\nexport type SetStripSet =\n | { status: 'done'; velocities: number[] }\n | { status: 'active'; velocities: number[]; planned: number }\n | { status: 'todo'; planned: number }\n | { status: 'range'; floor: number; max: number; doneVels: number[] }\n | { status: 'drop'; subloads: number[][] }\n | { status: 'myo'; activation: number[]; clusters: number[][] }\n | { status: 'myo-upcoming'; activationLen: number; clusterCount?: number }\n\n/** Flatten velocity chunks into butted segments, carving `gap` before each chunk but the first. */\nfunction chunkedSegments(chunks: number[][], gap: number): SegmentedBarSegment[] {\n return chunks.flatMap((vels, ci) =>\n vels.map((v, ri) => ({\n color: velocityZoneColor(v),\n ...(ci > 0 && ri === 0 ? { leadingGap: gap } : {}),\n }))\n )\n}\n\n/** The variable rep-range's `max` segments: velocity where done, else grey (committed) / cyan (variable). */\nfunction rangeSegments(floor: number, max: number, doneVels: number[]): SegmentedBarSegment[] {\n return Array.from({ length: max }, (_, i) => {\n if (i < doneVels.length) return { color: velocityZoneColor(doneVels[i]) }\n return { color: i < floor ? TODO_COLOR : SET_STRIP_VARIABLE_COLOR }\n })\n}\n\n/** Grey activation chunk + a fading, right-open cyan trail of expected rest-pause clusters. */\nfunction myoUpcomingSegments(activationLen: number, clusterCount: number): SegmentedBarSegment[] {\n const activation = Array.from({ length: activationLen }, () => ({ color: TODO_COLOR }))\n const trail = Array.from({ length: clusterCount }, (_, ci) =>\n Array.from({ length: MYO_UPCOMING_CLUSTER_LEN }, (_, ri) => ({\n color: SET_STRIP_VARIABLE_COLOR,\n opacity: MYO_UPCOMING_FADE ** ci,\n ...(ri === 0 ? { leadingGap: CLUSTER_GAP } : {}),\n }))\n ).flat()\n return [...activation, ...trail]\n}\n\n/** Map a set's performance state to the butted per-rep segments of its bar. */\nfunction setSegments(set: SetStripSet): SegmentedBarSegment[] {\n if (set.status === 'todo') {\n return [{ color: TODO_COLOR }]\n }\n if (set.status === 'done') {\n return set.velocities.map((v) => ({ color: velocityZoneColor(v) }))\n }\n if (set.status === 'range') {\n return rangeSegments(set.floor, set.max, set.doneVels)\n }\n if (set.status === 'drop') {\n return chunkedSegments(set.subloads, NOTCH_GAP)\n }\n if (set.status === 'myo') {\n return chunkedSegments([set.activation, ...set.clusters], CLUSTER_GAP)\n }\n if (set.status === 'myo-upcoming') {\n return myoUpcomingSegments(set.activationLen, set.clusterCount ?? MYO_UPCOMING_CLUSTERS)\n }\n const performed = set.velocities.map((v) => {\n const color = velocityZoneColor(v)\n return { color, pulse: true, pulseColor: PULSE_RANGE[color] }\n })\n const remaining = Math.max(0, set.planned - set.velocities.length)\n return [...performed, ...Array.from({ length: remaining }, () => ({ color: TODO_COLOR }))]\n}\n\n/** Preserve SetBar's per-segment test hooks over the generic SegmentedBar fills. */\nfunction setBarSegmentTestID(seg: SegmentedBarSegment): string {\n if (seg.pulse) return 'set-strip-pulse'\n if (seg.color === SET_STRIP_VARIABLE_COLOR) return 'set-strip-variable'\n return seg.color === TODO_COLOR ? 'set-strip-empty' : 'set-strip-fill'\n}\n\nexport interface SetBarProps {\n /** One set's performance state (done / active / todo). */\n set: SetStripSet\n /** Bar height in px. Default 8. */\n height?: number\n}\n\n/**\n * ONE set's multi-coloured bar: the butted per-rep colour segments for a single\n * set (`done` = velocity-coloured reps · `active` = performed reps pulsing + grey\n * remainder · `todo` = a solid grey bar), composed over {@link SegmentedBar}.\n * Fills its flex slot; {@link SetStrip} lays several side by side. Colours are the\n * real titan ramp pins.\n */\nexport function SetBar({ set, height = 8 }: SetBarProps) {\n return (\n <SegmentedBar\n segments={setSegments(set)}\n height={height}\n gap={0}\n radius={0}\n segmentTestID={setBarSegmentTestID}\n style={{ flex: 1, minWidth: 0, borderRadius: 2, overflow: 'hidden' }}\n testID=\"set-strip-set\"\n />\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { View, type ViewProps } from 'react-native'\nimport { SetBar, type SetStripSet } from './SetBar'\n\n// Re-exported so the per-set colour vocabulary stays importable from either the\n// molecule (SetStrip) or the atom (SetBar) it now lives in.\nexport {\n SET_STRIP_ZONES,\n SET_STRIP_VARIABLE_COLOR,\n velocityZoneColor,\n SetBar,\n type SetBarProps,\n} from './SetBar'\nexport type { SetStripSet } from './SetBar'\n\n/** Gap between set bars — ~2× the (zero) rep gap, so sets read as discrete units. */\nconst SET_STRIP_GAP = 5\n\n/** Collapse a set (flat or set-type) to its glance category for the progress summary. */\nfunction setCategory(set: SetStripSet): 'done' | 'active' | 'upcoming' {\n switch (set.status) {\n case 'done':\n case 'drop':\n case 'myo':\n return 'done'\n case 'active':\n return 'active'\n case 'range':\n return set.doneVels.length > 0 ? 'active' : 'upcoming'\n case 'todo':\n case 'myo-upcoming':\n return 'upcoming'\n }\n}\n\nfunction describeSets(sets: SetStripSet[]): string {\n const done = sets.filter((s) => setCategory(s) === 'done').length\n const active = sets.filter((s) => setCategory(s) === 'active').length\n const upcoming = sets.filter((s) => setCategory(s) === 'upcoming').length\n return `Set progress: ${done} done, ${active} in progress, ${upcoming} upcoming`\n}\n\nexport interface SetStripProps extends ViewProps {\n /** Per-set performance data, in set order. */\n sets: SetStripSet[]\n /** Bar height in px. Default 8. */\n height?: number\n className?: string\n}\n\n/**\n * The per-set segmented performance strip: one continuous {@link SetBar} per set\n * (rep intensities as butted color segments, no rep gaps), sets separated by a\n * fixed gap. Fills its container width. Colors are the real titan ramp pins.\n */\nexport function SetStrip({ sets, height = 8, className, ...props }: SetStripProps) {\n return (\n <View\n className={className}\n style={{ flexDirection: 'row', width: '100%', height, gap: SET_STRIP_GAP }}\n accessibilityRole=\"image\"\n accessibilityLabel={describeSets(sets)}\n testID=\"set-strip\"\n {...props}\n >\n {sets.map((set, i) => (\n <SetBar key={i} set={set} height={height} />\n ))}\n </View>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { View } from 'react-native'\nimport { ExerciseHeading, type ExerciseHeadingProps } from './ExerciseHeading'\nimport { SetStrip, type SetStripSet } from './SetStrip'\n\nexport interface ExerciseCardHeadingProps extends ExerciseHeadingProps {\n /** Per-set performance data driving the strip; an empty list renders no strip. */\n setStates: SetStripSet[]\n /** Strip height in px. Default 8. */\n stripHeight?: number\n /** Root testID. Default \"exercise-card\"; override when nested inside another card. */\n testID?: string\n}\n\n/**\n * The complete, standalone session-rail heading: an {@link ExerciseHeading} info\n * block over its per-set {@link SetStrip}. The unit the rail lists — self-contained\n * and independent of {@link ExerciseCard} (whose `rail` state delegates here).\n * e1RM is intentionally dropped (a planning / live-panel concern). Dimming lives on\n * the outer wrapper so the strip dims with the heading.\n */\nexport function ExerciseCardHeading({\n setStates,\n stripHeight = 8,\n dimmed,\n testID = 'exercise-card',\n ...heading\n}: ExerciseCardHeadingProps) {\n return (\n <View\n style={{ paddingVertical: 9, paddingHorizontal: 12, opacity: dimmed ? 0.55 : 1 }}\n testID={testID}\n >\n <ExerciseHeading {...heading} />\n\n {setStates.length > 0 && (\n <View style={{ marginTop: 7 }} testID=\"exercise-card-strip\">\n <SetStrip sets={setStates} height={stripHeight} />\n </View>\n )}\n </View>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { useState } from 'react'\nimport { View, Text, Pressable } from 'react-native'\nimport { VelocityStrip, type VelocityZoneBandProp } from './VelocityStrip'\nimport { PlaceholderStrip } from './PlaceholderStrip'\nimport { PrBadge } from './PrBadge'\nimport { SetRow, type SetRowProps } from './SetRow'\nimport { type SetStripSet } from './SetStrip'\nimport { SetTableHeader } from './SetTableHeader'\nimport { ExerciseCardHeading } from './ExerciseCardHeading'\nimport { type ExerciseIndicatorKind } from './ExerciseIndicator'\nimport { roundWeight } from '../../../utils/workout-format'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\n\nexport interface ExerciseCardProps {\n name: string\n /**\n * The dimmed, not-yet-reached representation (prescription + previous-best line).\n * Overrides the expand state — an upcoming card never expands.\n */\n upcoming?: boolean\n /** Controlled expand state. Omit to run uncontrolled (see {@link defaultExpanded}). */\n expanded?: boolean\n /** Uncontrolled initial expand state. Default false. Ignored when `expanded` is set. */\n defaultExpanded?: boolean\n /** Notified when the user toggles the card between collapsed and expanded. */\n onExpandedChange?: (expanded: boolean) => void\n onNavigateDetail?: () => void\n summary?: {\n sets: number\n reps: number | string\n weight: number\n unit: 'lbs' | 'kg'\n }\n isPR?: boolean\n /** Collapsed glance: per-set logged velocities (drives the mini strips). */\n setVelocities?: number[][]\n /** Optional velocity-zone bands shared across this exercise's sets (WA bands). */\n velocityZones?: readonly VelocityZoneBandProp[]\n /** Collapsed glance: total planned sets (placeholder strips fill the remainder). */\n totalPlannedSets?: number\n /** Expanded body: the per-set rows (done / live / todo). */\n sets?: SetRowProps[]\n tempo?: [number, number, number, number]\n prescription?: string\n previousBest?: string\n supersetPosition?: 'first' | 'last' | 'middle' | null\n supersetColor?: string\n /** Expanded header per-set strip override; derived from `sets` when omitted. */\n setStates?: SetStripSet[]\n /** A small PR / issue / info chip in the title line (expanded header). */\n indicator?: ExerciseIndicatorKind\n /** Expanded header strip height in px. Default 8. */\n stripHeight?: number\n}\n\n/** The sub-card render props: everything but the expand-control surface, plus a resolved toggle. */\ntype CardBodyProps = Omit<\n ExerciseCardProps,\n 'upcoming' | 'expanded' | 'defaultExpanded' | 'onExpandedChange'\n> & { onToggle: () => void }\n\nfunction getSupersetBorderRadius(\n position: ExerciseCardProps['supersetPosition']\n): Record<string, number> {\n switch (position) {\n case 'first':\n return {\n borderTopLeftRadius: 12,\n borderTopRightRadius: 12,\n borderBottomLeftRadius: 8,\n borderBottomRightRadius: 8,\n }\n case 'last':\n return {\n borderTopLeftRadius: 8,\n borderTopRightRadius: 8,\n borderBottomLeftRadius: 12,\n borderBottomRightRadius: 12,\n }\n case 'middle':\n return {\n borderTopLeftRadius: 8,\n borderTopRightRadius: 8,\n borderBottomLeftRadius: 8,\n borderBottomRightRadius: 8,\n }\n default:\n return {\n borderTopLeftRadius: 12,\n borderTopRightRadius: 12,\n borderBottomLeftRadius: 12,\n borderBottomRightRadius: 12,\n }\n }\n}\n\nfunction getSupersetMargin(\n position: ExerciseCardProps['supersetPosition']\n): Record<string, number> {\n if (position === 'first' || position === 'middle') {\n return { marginBottom: 2 }\n }\n return {}\n}\n\nfunction formatSummary(summary: ExerciseCardProps['summary']): string {\n if (!summary) return ''\n return `${summary.sets}×${summary.reps} @ ${roundWeight(summary.weight)} ${summary.unit}`\n}\n\nfunction formatAccessibilityLabel(\n name: string,\n summary: ExerciseCardProps['summary'],\n prescription: ExerciseCardProps['prescription']\n): string {\n if (summary) return `${name}, ${formatSummary(summary)}`\n if (prescription) return `${name}, ${prescription}`\n return name\n}\n\nfunction CollapsedCard({\n name,\n onToggle,\n summary,\n isPR,\n setVelocities,\n velocityZones,\n totalPlannedSets,\n supersetPosition,\n}: CardBodyProps) {\n const [pressed, setPressed] = useState(false)\n const completedSets = setVelocities?.length ?? 0\n const remaining = Math.max(0, (totalPlannedSets ?? 0) - completedSets)\n const borderRadius = getSupersetBorderRadius(supersetPosition)\n const supersetMargin = getSupersetMargin(supersetPosition)\n\n return (\n <Pressable\n onPress={onToggle}\n onPressIn={() => setPressed(true)}\n onPressOut={() => setPressed(false)}\n accessibilityRole=\"button\"\n accessibilityLabel={formatAccessibilityLabel(name, summary, undefined)}\n testID=\"exercise-card\"\n >\n <View\n className={pressed ? 'bg-surface-raised' : undefined}\n style={{\n padding: 12,\n paddingHorizontal: 14,\n cursor: 'pointer',\n ...borderRadius,\n ...supersetMargin,\n }}\n >\n <View className=\"flex-row items-center\" testID=\"exercise-card-header\">\n <Text\n className=\"text-text-primary\"\n style={{\n fontSize: 14,\n fontFamily: '\"Space Grotesk\", sans-serif',\n fontWeight: '700',\n }}\n testID=\"exercise-card-name\"\n >\n {name}\n </Text>\n <View className=\"flex-1\" />\n {summary && (\n <Text\n className=\"text-text-secondary\"\n style={{\n fontSize: 12,\n fontFamily: 'Inter, sans-serif',\n marginRight: 8,\n }}\n testID=\"exercise-card-summary\"\n >\n {formatSummary(summary)}\n </Text>\n )}\n {isPR && (\n <View style={{ marginLeft: 4 }}>\n <PrBadge type=\"e1rm\" compact animate={false} />\n </View>\n )}\n </View>\n\n {(completedSets > 0 || remaining > 0) && (\n <View className=\"flex-row\" style={{ marginTop: 6, gap: 4 }} testID=\"exercise-card-strips\">\n {setVelocities?.map((velocities, i) => (\n <VelocityStrip\n key={i}\n velocities={velocities}\n zones={velocityZones}\n variant=\"compact\"\n height={8}\n hideBaseline\n testID={`exercise-card-velocity-strip-${i}`}\n />\n ))}\n {Array.from({ length: remaining }, (_, i) => (\n <PlaceholderStrip\n key={`placeholder-${i}`}\n testID={`exercise-card-placeholder-${i}`}\n />\n ))}\n </View>\n )}\n </View>\n </Pressable>\n )\n}\n\n// --- Unified expanded card ---------------------------------------------------\n// The expanded card is \"one object\" with its rail heading: the persistent header\n// is the real ExerciseCardHeading, and the revealed body drops PREV and renders\n// one real SetRow per set (muted done/todo, brightened live spotlight).\n\nconst DARK = getSemanticColors('dark')\n/** The header↔body seam. */\nconst BODY_DIVIDER = DARK['hairline-subtle']\n\n/** Project the set rows onto the heading strip's per-set state (done / active / todo). */\nfunction deriveHeaderSetStates(sets: SetRowProps[]): SetStripSet[] {\n return sets.map((set): SetStripSet => {\n switch (set.state) {\n case 'live':\n return { status: 'active', velocities: set.velocities, planned: set.target.reps }\n case 'done':\n return { status: 'done', velocities: set.velocities }\n case 'todo':\n return { status: 'todo', planned: set.planned ?? set.target.reps }\n }\n })\n}\n\nfunction ExpandedCard({\n name,\n onToggle,\n summary,\n isPR,\n sets,\n tempo,\n indicator,\n setStates,\n stripHeight = 8,\n velocityZones,\n supersetPosition,\n}: CardBodyProps) {\n const borderRadius = getSupersetBorderRadius(supersetPosition)\n const supersetMargin = getSupersetMargin(supersetPosition)\n // Summary is the card-level authority for the weight column; fall back to the\n // first set's unit, then lbs. (Mixed per-set units keep the card-level label.)\n const unit = summary?.unit ?? sets?.[0]?.unit ?? 'lbs'\n // The rail heading IS the header: its per-set strip comes from an explicit\n // `setStates` when supplied, else it's derived from the set rows. e1RM is dropped\n // entirely; a PR surfaces via the chip.\n const headerStates = setStates ?? (sets ? deriveHeaderSetStates(sets) : [])\n const headerIndicator = indicator ?? (isPR ? 'pr' : undefined)\n\n return (\n <View\n className=\"bg-surface-elevated border-hairline\"\n style={{\n borderWidth: 1,\n ...borderRadius,\n ...supersetMargin,\n }}\n testID=\"exercise-card\"\n >\n <ExerciseCardHeading\n name={name}\n sets={summary?.sets ?? sets?.length ?? 0}\n reps={summary?.reps ?? 0}\n load={summary?.weight ?? 0}\n unit={unit}\n tempo={tempo}\n indicator={headerIndicator}\n setStates={headerStates}\n stripHeight={stripHeight}\n onPress={onToggle}\n testID=\"exercise-card-heading\"\n />\n\n <View\n style={{ borderTopWidth: 1, borderTopColor: BODY_DIVIDER, paddingBottom: 6 }}\n testID=\"exercise-card-body\"\n >\n <SetTableHeader unit={unit} showPrevious={false} testID=\"exercise-card-column-headers\" />\n\n {sets && (\n <View testID=\"exercise-card-sets\">\n {sets.map((set, i) => (\n <SetRow key={i} {...set} velocityZones={set.velocityZones ?? velocityZones} />\n ))}\n </View>\n )}\n </View>\n </View>\n )\n}\n\nfunction UpcomingCard({\n name,\n prescription,\n previousBest,\n supersetPosition,\n onToggle,\n}: CardBodyProps) {\n const borderRadius = getSupersetBorderRadius(supersetPosition)\n const supersetMargin = getSupersetMargin(supersetPosition)\n\n return (\n <Pressable onPress={onToggle} accessibilityRole=\"button\">\n <View\n style={{\n opacity: 0.6,\n padding: 12,\n paddingHorizontal: 14,\n ...borderRadius,\n ...supersetMargin,\n }}\n accessibilityLabel={formatAccessibilityLabel(name, undefined, prescription)}\n testID=\"exercise-card\"\n >\n <View className=\"flex-row items-center\">\n {/* Name never truncates (no numberOfLines); prescription + previousBest ellipsize first. */}\n <Text\n className=\"text-text-primary\"\n style={{\n flexShrink: 0,\n fontSize: 14,\n fontFamily: '\"Space Grotesk\", sans-serif',\n fontWeight: '700',\n }}\n testID=\"exercise-card-name\"\n >\n {name}\n </Text>\n {prescription && (\n <Text\n className=\"text-text-secondary\"\n numberOfLines={1}\n style={{\n flexShrink: 1,\n fontSize: 12,\n fontFamily: 'Inter, sans-serif',\n marginLeft: 8,\n }}\n testID=\"exercise-card-prescription\"\n >\n {prescription}\n </Text>\n )}\n <View className=\"flex-1\" style={{ minWidth: 8 }} />\n {previousBest && (\n <Text\n className=\"text-text-tertiary\"\n numberOfLines={1}\n style={{\n flexShrink: 1,\n fontSize: 11,\n fontFamily: 'Inter, sans-serif',\n }}\n testID=\"exercise-card-previous-best\"\n >\n {previousBest}\n </Text>\n )}\n </View>\n </View>\n </Pressable>\n )\n}\n\n/**\n * The data-contract exercise card, in three representations:\n * - `upcoming` — a dimmed, not-yet-reached row (prescription + previous best).\n * - collapsed — a glance: name + summary + per-set velocity strips.\n * - expanded — the unified card: the real {@link ExerciseCardHeading} header over\n * the SET · REPS · LBS · RPE body (one {@link SetRow} per set).\n *\n * Expand is controlled (`expanded` + `onExpandedChange`) or uncontrolled\n * (`defaultExpanded`, internal state). `upcoming` overrides expand.\n */\nexport function ExerciseCard({\n upcoming,\n expanded,\n defaultExpanded,\n onExpandedChange,\n ...rest\n}: ExerciseCardProps) {\n const [internalExpanded, setInternalExpanded] = useState(defaultExpanded ?? false)\n const isControlled = expanded !== undefined\n const isExpanded = isControlled ? expanded : internalExpanded\n\n const onToggle = () => {\n const next = !isExpanded\n onExpandedChange?.(next)\n if (!isControlled) setInternalExpanded(next)\n }\n\n if (upcoming) return <UpcomingCard {...rest} onToggle={onToggle} />\n return isExpanded ? (\n <ExpandedCard {...rest} onToggle={onToggle} />\n ) : (\n <CollapsedCard {...rest} onToggle={onToggle} />\n )\n}\n","import { Platform } from 'react-native'\nimport { getSemanticColors, type ThemeMode } from './tokens/semantic'\n\ntype ColorToken = keyof ReturnType<typeof getSemanticColors>\n\n/**\n * Resolve a semantic color token for an inline style where a nativewind\n * className can't apply — gradients (`backgroundImage`), per-edge borders\n * (`borderTopColor`, …), SVG attributes, and conditional hex/token mixes.\n *\n * The companion to className color tokens: on **web** it returns the CSS\n * variable (`var(--color-…)`), so the dashboard's light/dark switching keeps\n * working exactly as `global.css` intends; on **native** it returns the\n * resolved hex from `getSemanticColors` (mobile is dark-only). This is why\n * these spots stay theme-correct on web while also rendering on-device.\n */\nexport function resolveColor(token: ColorToken, mode: ThemeMode = 'dark'): string {\n return Platform.OS === 'web' ? `var(--color-${token})` : getSemanticColors(mode)[token]\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport React from 'react'\nimport { View, Text, Pressable, TextInput } from 'react-native'\nimport { resolveColor } from '../../../theme/resolve-color'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\n\nexport interface InputBarProps {\n exerciseName: string\n setNumber: number\n totalSets: number | null\n reps: string\n weight: string\n unit: 'lbs' | 'kg'\n onRepsChange: (value: string) => void\n onWeightChange: (value: string) => void\n onRecord: () => void\n canRecord: boolean\n visible: boolean\n}\n\nconst BRAND_PRIMARY = getSemanticColors('dark')['brand-primary']\nconst INPUT_CLASSNAME = 'bg-surface-raised border-hairline-strong text-text-primary'\n\nconst inputStyle = {\n fontSize: 14,\n fontWeight: '600' as const,\n fontFamily: 'Inter, sans-serif',\n borderWidth: 1,\n borderRadius: 6,\n textAlign: 'center' as const,\n paddingVertical: 5,\n paddingHorizontal: 2,\n}\n\nexport function InputBar({\n exerciseName,\n setNumber,\n totalSets,\n reps,\n weight,\n unit,\n onRepsChange,\n onWeightChange,\n onRecord,\n canRecord,\n visible,\n}: InputBarProps) {\n if (!visible) return null\n\n const setLabel = totalSets != null ? `Set ${setNumber}/${totalSets}` : `Set ${setNumber}`\n\n return (\n <View\n className=\"bg-surface-elevated\"\n style={{\n width: '100%',\n borderTopWidth: 1,\n borderTopColor: resolveColor('hairline-default'),\n paddingTop: 10,\n paddingHorizontal: 16,\n paddingBottom: 12,\n flexDirection: 'row',\n alignItems: 'center',\n gap: 10,\n }}\n accessibilityRole=\"toolbar\"\n testID=\"input-bar\"\n >\n <View style={{ minWidth: 80, flexDirection: 'column' }}>\n <Text\n className=\"text-text-primary\"\n style={{\n fontSize: 12,\n fontWeight: '700',\n fontFamily: '\"Space Grotesk\", sans-serif',\n }}\n testID=\"input-bar-exercise-name\"\n numberOfLines={1}\n >\n {exerciseName}\n </Text>\n <Text\n className=\"text-text-tertiary\"\n style={{\n fontSize: 10,\n fontFamily: 'Inter, sans-serif',\n }}\n testID=\"input-bar-set-info\"\n >\n {setLabel}\n </Text>\n </View>\n\n <View className=\"flex-1 flex-row items-center\" style={{ gap: 4 }}>\n <TextInput\n value={reps}\n onChangeText={onRepsChange}\n className={INPUT_CLASSNAME}\n style={{ ...inputStyle, width: 36 }}\n accessibilityLabel=\"Reps\"\n testID=\"input-bar-reps\"\n keyboardType=\"numeric\"\n />\n <Text\n className=\"text-text-tertiary\"\n style={{\n fontSize: 12,\n fontFamily: 'Inter, sans-serif',\n }}\n >\n {'\\u00D7'}\n </Text>\n <TextInput\n value={weight}\n onChangeText={onWeightChange}\n className={INPUT_CLASSNAME}\n style={{ ...inputStyle, width: 52 }}\n accessibilityLabel={`Weight in ${unit}`}\n testID=\"input-bar-weight\"\n keyboardType=\"numeric\"\n />\n <Text\n className=\"text-text-tertiary\"\n style={{\n fontSize: 12,\n fontWeight: '500',\n fontFamily: 'Inter, sans-serif',\n }}\n testID=\"input-bar-unit\"\n >\n {unit}\n </Text>\n </View>\n\n <Pressable\n onPress={onRecord}\n disabled={!canRecord}\n style={({ pressed }) => ({\n backgroundColor: BRAND_PRIMARY,\n borderRadius: 8,\n paddingVertical: 10,\n paddingHorizontal: 16,\n opacity: !canRecord ? 0.4 : pressed ? 0.8 : 1,\n })}\n accessibilityRole=\"button\"\n accessibilityLabel=\"Record set\"\n testID=\"input-bar-record\"\n >\n <Text\n style={{\n fontSize: 13,\n fontWeight: '700',\n fontFamily: 'Inter, sans-serif',\n color: '#FFFFFF',\n }}\n >\n Record\n </Text>\n </Pressable>\n </View>\n )\n}\n","import { useEffect, useState } from 'react'\n\nexport type TimerMode = 'up' | 'down'\n\nexport interface UseTimerOptions {\n /** 'up' counts elapsed upward; 'down' counts remaining toward 0. Default 'up'. */\n mode?: TimerMode\n /** Total duration in ms. Required for 'down' mode and for progress in 'up' mode. */\n durationMs?: number\n /** Controlled elapsed time in ms. When provided, the hook derives everything from it and never ticks. */\n elapsedMs?: number\n /** Self-tick only advances while running. */\n running?: boolean\n /** Enable the internal interval. Ignored when `elapsedMs` is controlled. */\n autoTick?: boolean\n /** Interval step in ms. Default 1000. */\n tickMs?: number\n}\n\nexport interface TimerState {\n elapsedMs: number\n remainingMs: number\n /** 0..1, clamped. */\n progress: number\n /** mm:ss for the active direction (remaining when 'down', elapsed when 'up'). */\n label: string\n /** True once a down-timer reaches 0 (or an up-timer passes its duration). */\n done: boolean\n}\n\n/** Format a millisecond duration as mm:ss, rounding partial seconds up. */\nexport function formatDuration(ms: number): string {\n const totalSeconds = Math.max(0, Math.ceil(ms / 1000))\n const minutes = Math.floor(totalSeconds / 60)\n const seconds = totalSeconds % 60\n return `${minutes}:${String(seconds).padStart(2, '0')}`\n}\n\nexport function useTimer(options: UseTimerOptions = {}): TimerState {\n const {\n mode = 'up',\n durationMs,\n elapsedMs: controlledElapsedMs,\n running = false,\n autoTick = false,\n tickMs = 1000,\n } = options\n\n const isControlled = controlledElapsedMs != null\n const [internalElapsedMs, setInternalElapsedMs] = useState(0)\n\n useEffect(() => {\n if (isControlled || !autoTick || !running) return\n const id = setInterval(() => {\n setInternalElapsedMs((prev) => prev + tickMs)\n }, tickMs)\n return () => clearInterval(id)\n }, [isControlled, autoTick, running, tickMs])\n\n const elapsedMs = isControlled ? controlledElapsedMs : internalElapsedMs\n\n const hasDuration = durationMs != null && durationMs > 0\n const remainingMs = durationMs != null ? Math.max(0, durationMs - elapsedMs) : 0\n\n let progress: number\n if (hasDuration) {\n progress = Math.min(1, Math.max(0, elapsedMs / durationMs))\n } else {\n // A zero/undefined duration is trivially complete for a countdown, empty for a stopwatch.\n progress = mode === 'down' ? 1 : 0\n }\n\n const label = formatDuration(mode === 'down' ? remainingMs : elapsedMs)\n const done = durationMs != null && elapsedMs >= durationMs\n\n return { elapsedMs, remainingMs, progress, label, done }\n}\n","import React from 'react'\nimport { View, Text, type ViewProps } from 'react-native'\nimport { cn } from '../../../utils/cn'\n\nexport type ProgressSize = 'sm' | 'md' | 'lg'\nexport type ProgressColor = 'primary' | 'secondary' | 'success' | 'error' | 'warning' | 'info'\nexport type ProgressVariant = 'linear' | 'circular'\n\n/** Maps the color prop to a CSS variable reference for inline styles */\nexport const colorVarMap: Record<ProgressColor, string> = {\n primary: 'var(--color-brand-primary)',\n secondary: 'var(--color-brand-secondary)',\n success: 'var(--color-status-success)',\n error: 'var(--color-status-error)',\n warning: 'var(--color-status-warning)',\n info: 'var(--color-status-info)',\n}\n\nexport interface ProgressProps extends ViewProps {\n /** Current value (0-100) */\n value?: number\n /** Maximum value */\n max?: number\n /** Whether the progress is indeterminate */\n isIndeterminate?: boolean\n /** Size of the progress bar */\n size?: ProgressSize\n /** Color of the progress */\n color?: ProgressColor\n /** Whether to show the value label */\n showValue?: boolean\n /** Custom value format function */\n formatValue?: (value: number, max: number) => string\n /** Label text */\n label?: string\n /** Fixed track width in pixels (default: full width) */\n trackWidth?: number\n /** Custom hex color override for the fill bar */\n customColor?: string\n /** Additional className */\n className?: string\n}\n\nconst sizeStyles: Record<ProgressSize, string> = {\n sm: 'h-1',\n md: 'h-2',\n lg: 'h-3',\n}\n\nconst colorStyles: Record<ProgressColor, string> = {\n primary: 'bg-brand-primary',\n secondary: 'bg-brand-secondary',\n success: 'bg-status-success',\n error: 'bg-status-error',\n warning: 'bg-status-warning',\n info: 'bg-status-info',\n}\n\nconst trackColorStyles: Record<ProgressColor, string> = {\n primary: 'bg-brand-primary/20',\n secondary: 'bg-brand-secondary/20',\n success: 'bg-status-success/20',\n error: 'bg-status-error/20',\n warning: 'bg-status-warning/20',\n info: 'bg-status-info/20',\n}\n\n/**\n * Linear progress bar component.\n *\n * @example\n * // Determinate progress\n * <Progress value={75} />\n *\n * @example\n * // With label and value\n * <Progress value={45} label=\"Uploading...\" showValue />\n *\n * @example\n * // Indeterminate progress\n * <Progress isIndeterminate />\n */\nexport function Progress({\n value = 0,\n max = 100,\n isIndeterminate = false,\n size = 'md',\n color = 'primary',\n showValue = false,\n formatValue = (v, m) => `${Math.round((v / m) * 100)}%`,\n label,\n trackWidth,\n customColor,\n className,\n ...props\n}: ProgressProps) {\n const percentage = Math.min(Math.max((value / max) * 100, 0), 100)\n\n return (\n <View className={cn('w-full', className)} {...props}>\n {/* Label and Value Row */}\n {(label || showValue) && (\n <View className=\"flex-row justify-between items-center mb-1\">\n {label && <Text className=\"text-sm text-text-secondary\">{label}</Text>}\n {showValue && !isIndeterminate && (\n <Text className=\"text-sm font-medium text-text-primary\">{formatValue(value, max)}</Text>\n )}\n </View>\n )}\n\n {/* Progress Track */}\n <View\n className={cn(\n 'rounded-full overflow-hidden',\n trackWidth ? undefined : 'w-full',\n trackColorStyles[color],\n sizeStyles[size]\n )}\n style={trackWidth ? { width: trackWidth } : undefined}\n accessibilityRole=\"progressbar\"\n accessibilityValue={{\n min: 0,\n max: max,\n now: isIndeterminate ? undefined : value,\n }}\n >\n {/* Progress Fill */}\n <View\n className={cn(\n 'h-full rounded-full',\n !customColor && colorStyles[color],\n isIndeterminate && 'animate-pulse w-1/3'\n )}\n style={{\n ...(isIndeterminate ? {} : { width: `${percentage}%` }),\n ...(customColor ? { backgroundColor: customColor } : {}),\n }}\n />\n </View>\n </View>\n )\n}\n\nexport interface CircularProgressProps extends ViewProps {\n /** Current value (0-100) */\n value?: number\n /** Maximum value */\n max?: number\n /** Whether the progress is indeterminate */\n isIndeterminate?: boolean\n /** Size of the progress circle (diameter) */\n size?: number\n /** Stroke width */\n strokeWidth?: number\n /** Color of the progress */\n color?: ProgressColor\n /** Whether to show the value in center */\n showValue?: boolean\n /** Custom value format function */\n formatValue?: (value: number, max: number) => string\n /**\n * Custom center content (a numeral, a timer readout, an icon). When provided it\n * replaces the {@link showValue} text — the ring becomes a generic container for\n * any centered element. See {@link CircularTimer} for the batteries-included timer.\n */\n children?: React.ReactNode\n /**\n * Fill the parent container (responsive) instead of drawing a fixed `size` box.\n * The SVG uses a `0 0 size size` viewBox scaled to the container, so `size` still\n * sets the geometry proportions (radius, stroke) while the ring grows/shrinks with\n * its parent — e.g. a wall column. Default false (fixed `size` px).\n */\n fill?: boolean\n /** Additional className */\n className?: string\n}\n\n/**\n * Circular progress indicator component.\n *\n * @example\n * <CircularProgress value={75} showValue />\n */\nexport function CircularProgress({\n value = 0,\n max = 100,\n isIndeterminate = false,\n size = 48,\n strokeWidth = 4,\n color = 'primary',\n showValue = false,\n formatValue = (v, m) => `${Math.round((v / m) * 100)}%`,\n children,\n fill = false,\n className,\n ...props\n}: CircularProgressProps) {\n const percentage = Math.min(Math.max((value / max) * 100, 0), 100)\n const radius = (size - strokeWidth) / 2\n const circumference = 2 * Math.PI * radius\n const strokeDashoffset = circumference - (percentage / 100) * circumference\n const center = size / 2\n // Fixed: a `size × size` px box. Fill: fill the parent, staying square, and let\n // the `0 0 size size` viewBox scale the geometry to fit (a responsive ring).\n const boxStyle = fill ? { width: '100%' as const, aspectRatio: 1 } : { width: size, height: size }\n\n return (\n <View\n className={cn('items-center justify-center', className)}\n style={boxStyle}\n accessibilityRole=\"progressbar\"\n accessibilityValue={{\n min: 0,\n max: max,\n now: isIndeterminate ? undefined : value,\n }}\n {...props}\n >\n {/* SVG implementation for web — width/height 100% so it scales with `boxStyle`. */}\n <View className={cn(isIndeterminate && 'animate-spin')} style={boxStyle}>\n <svg\n width=\"100%\"\n height=\"100%\"\n viewBox={`0 0 ${size} ${size}`}\n style={{ position: 'absolute' }}\n >\n {/* Background track */}\n <circle\n cx={center}\n cy={center}\n r={radius}\n fill=\"none\"\n stroke=\"var(--color-hairline-default)\"\n strokeWidth={strokeWidth}\n />\n {/* Progress arc */}\n <circle\n cx={center}\n cy={center}\n r={radius}\n fill=\"none\"\n stroke={colorVarMap[color]}\n strokeWidth={strokeWidth}\n strokeLinecap=\"round\"\n strokeDasharray={circumference}\n strokeDashoffset={isIndeterminate ? circumference * 0.75 : strokeDashoffset}\n transform={`rotate(-90 ${center} ${center})`}\n style={{ transition: 'stroke-dashoffset 300ms cubic-bezier(0.22, 1, 0.36, 1)' }}\n />\n </svg>\n </View>\n\n {/* Center: custom children take precedence over the showValue readout. */}\n {children != null ? (\n <View\n style={{\n position: 'absolute',\n alignItems: 'center',\n justifyContent: 'center',\n pointerEvents: 'none',\n }}\n >\n {children}\n </View>\n ) : (\n showValue &&\n !isIndeterminate && (\n <Text\n className=\"text-xs font-semibold text-text-primary absolute\"\n style={{ fontSize: Math.max(size * 0.22, 10) }}\n >\n {formatValue(value, max)}\n </Text>\n )\n )}\n </View>\n )\n}\n\nexport interface ProgressStepsProps extends ViewProps {\n /** Current step (0-indexed) */\n currentStep: number\n /** Total number of steps */\n totalSteps: number\n /** Color of completed steps */\n color?: ProgressColor\n /** Size of step indicators */\n size?: ProgressSize\n /** Labels for each step */\n labels?: string[]\n /** Additional className */\n className?: string\n}\n\nconst stepSizeStyles: Record<ProgressSize, { dot: string; connector: string }> = {\n sm: { dot: 'w-2 h-2', connector: 'h-0.5' },\n md: { dot: 'w-3 h-3', connector: 'h-1' },\n lg: { dot: 'w-4 h-4', connector: 'h-1.5' },\n}\n\n/**\n * Step-based progress indicator.\n *\n * @example\n * <ProgressSteps currentStep={2} totalSteps={4} labels={['Cart', 'Shipping', 'Payment', 'Done']} />\n */\nexport function ProgressSteps({\n currentStep,\n totalSteps,\n color = 'primary',\n size = 'md',\n labels,\n className,\n ...props\n}: ProgressStepsProps) {\n const { dot, connector } = stepSizeStyles[size]\n\n return (\n <View className={cn('w-full', className)} {...props}>\n <View className=\"flex-row items-center\">\n {Array.from({ length: totalSteps }).map((_, index) => (\n <React.Fragment key={index}>\n {/* Step dot */}\n <View\n className={cn(\n 'rounded-full',\n dot,\n index <= currentStep ? colorStyles[color] : 'bg-hairline-strong'\n )}\n />\n\n {/* Connector line */}\n {index < totalSteps - 1 && (\n <View\n className={cn(\n 'flex-1 mx-1',\n connector,\n index < currentStep ? colorStyles[color] : 'bg-hairline-strong'\n )}\n />\n )}\n </React.Fragment>\n ))}\n </View>\n\n {/* Labels */}\n {labels && labels.length > 0 && (\n <View className=\"flex-row mt-2\">\n {labels.map((label, index) => (\n <Text\n key={index}\n className={cn(\n 'flex-1 text-xs text-center',\n index <= currentStep ? 'text-text-primary font-medium' : 'text-text-tertiary'\n )}\n >\n {label}\n </Text>\n ))}\n </View>\n )}\n </View>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport type { ReactNode } from 'react'\nimport { View, Text } from 'react-native'\nimport { CircularProgress, colorVarMap, type ProgressColor } from '../../ui/progress/Progress'\nimport { useTimer, type TimerMode } from '../../../hooks/useTimer'\n\nexport interface CircularTimerProps {\n /** Total duration (ms). `down`: the countdown length; `up`: the target for progress. */\n durationMs: number\n /** Controlled elapsed time (ms). */\n elapsedMs: number\n /** `down` (default) counts remaining toward 0 (ring drains); `up` counts elapsed up (ring fills). */\n mode?: TimerMode\n /** Ring diameter (px) — the geometry/stroke reference. Default 160. */\n size?: number\n /** Ring stroke width (px). Default 8. */\n strokeWidth?: number\n /** Fill the parent container (responsive) instead of a fixed `size` box. */\n fill?: boolean\n /** Ring color while running. Default `primary`. */\n color?: ProgressColor\n /**\n * `down` mode: the text shown in the center — and the color the ring fills to — when\n * the countdown completes (e.g. `doneLabel=\"GO\"`). Omit to keep showing `0:00`.\n */\n doneLabel?: string\n /** Ring + center color when complete (with {@link doneLabel}). Default `success`. */\n doneColor?: ProgressColor\n /** Optional controls rendered below the ring (e.g. +30s / Skip). */\n controls?: ReactNode\n /** Accessibility label for the timer. Defaults to a seconds-remaining description. */\n accessibilityLabel?: string\n testID?: string\n}\n\n/**\n * A circular countdown / countup with a time readout in the center — the graphical\n * sibling of {@link TimerReadout}. Batteries-included: owns {@link useTimer} (pass\n * controlled `durationMs` + `elapsedMs`) and composes {@link CircularProgress} for the\n * arc (`down` drains as time runs out, `up` fills), rendering the mm:ss label in its\n * center slot. On completion (`down` + {@link doneLabel}) the ring fills fully in\n * {@link doneColor} and the center reads the done label — the \"go\" moment. An optional\n * {@link controls} node renders below the ring. Consumers (e.g. `RestTimer`'s `ring`\n * variant) wrap this and add their own domain chrome.\n */\nexport function CircularTimer({\n durationMs,\n elapsedMs,\n mode = 'down',\n size = 160,\n strokeWidth = 8,\n fill = false,\n color = 'primary',\n doneLabel,\n doneColor = 'success',\n controls,\n accessibilityLabel,\n testID,\n}: CircularTimerProps) {\n const { remainingMs, progress, label, done } = useTimer({ mode, durationMs, elapsedMs })\n\n const isDone = done && mode === 'down'\n const showDone = isDone && doneLabel != null\n // Down → the remaining fraction (ring drains); up → elapsed progress (ring fills).\n // A completed countdown with a done label fills fully to signal \"go\".\n const remainingFrac = durationMs > 0 ? Math.max(0, Math.min(1, remainingMs / durationMs)) : 0\n const arc = mode === 'down' ? (showDone ? 1 : remainingFrac) : progress\n const ringColor: ProgressColor = showDone ? doneColor : color\n\n const remainingSec = Math.ceil(Math.max(0, remainingMs) / 1000)\n const a11y =\n accessibilityLabel ?? (isDone ? 'Timer complete' : `${remainingSec} seconds remaining`)\n\n return (\n <View\n style={{ alignItems: 'center', gap: 16 }}\n accessibilityRole=\"timer\"\n accessibilityLabel={a11y}\n testID={testID ?? 'circular-timer'}\n >\n <CircularProgress\n value={arc}\n max={1}\n size={size}\n strokeWidth={strokeWidth}\n fill={fill}\n color={ringColor}\n // A distinct static name for the ring (the live countdown text lives on the\n // enclosing timer role) — satisfies the progressbar-name a11y rule without\n // duplicating the timer label.\n accessibilityLabel=\"Timer ring\"\n testID=\"circular-timer-ring\"\n >\n <Text\n className={showDone ? undefined : 'text-text-primary'}\n style={{\n fontSize: Math.round(size * (showDone ? 0.28 : 0.24)),\n fontFamily: '\"Space Grotesk\", sans-serif',\n fontWeight: '800',\n fontVariant: ['tabular-nums'],\n letterSpacing: showDone ? 1 : -1,\n ...(showDone ? { color: colorVarMap[doneColor] } : null),\n }}\n testID=\"circular-timer-label\"\n >\n {showDone ? doneLabel : label}\n </Text>\n </CircularProgress>\n {controls}\n </View>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { View, Text, Pressable } from 'react-native'\nimport { resolveColor } from '../../../theme/resolve-color'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\nimport { useTimer } from '../../../hooks/useTimer'\nimport { CircularTimer } from '../CircularTimer/CircularTimer'\n\nconst BRAND_PRIMARY = getSemanticColors('dark')['brand-primary']\n\n/** Default `ring` diameter (px) — the across-the-room wall rest treatment. */\nconst RING_DEFAULT_SIZE = 180\n\nexport interface RestTimerProps {\n totalSeconds: number\n elapsedMs: number\n onSkip: () => void\n onAddTime: () => void\n nextSetInfo?: string\n visible: boolean\n /** Passive/poll-only mode: hides the Skip and +30s controls, keeps the countdown, progress bar, and next-set line. */\n displayOnly?: boolean\n /**\n * `bar` (default) — the compact linear card (REST label + mm:ss + progress bar +\n * controls), the mobile bottom-bar treatment. `ring` — the across-the-room wall\n * treatment: a draining countdown ring (composes {@link CircularProgress}) with a\n * big remaining-seconds numeral, the next-set line, and the same controls.\n */\n variant?: 'bar' | 'ring'\n /** `ring` diameter in px. Default 180. */\n size?: number\n}\n\n/** The +30s / Skip control row — shared by both variants (hidden in `displayOnly`). */\nfunction RestActions({ onAddTime, onSkip }: { onAddTime: () => void; onSkip: () => void }) {\n return (\n <View style={{ flexDirection: 'row', gap: 8 }}>\n <Pressable\n onPress={onAddTime}\n style={{\n backgroundColor: 'rgba(255,255,255,0.06)',\n paddingVertical: 8,\n paddingHorizontal: 20,\n borderRadius: 8,\n }}\n accessibilityRole=\"button\"\n accessibilityLabel=\"Add 30 seconds\"\n testID=\"rest-timer-add-time\"\n >\n <Text\n className=\"text-text-secondary\"\n style={{ fontSize: 11, fontFamily: 'Inter, sans-serif', fontWeight: '600' }}\n >\n +30s\n </Text>\n </Pressable>\n <Pressable\n onPress={onSkip}\n style={{\n backgroundColor: 'rgba(255,121,0,0.12)',\n paddingVertical: 8,\n paddingHorizontal: 20,\n borderRadius: 8,\n }}\n accessibilityRole=\"button\"\n accessibilityLabel=\"Skip rest\"\n testID=\"rest-timer-skip\"\n >\n <Text\n style={{\n fontSize: 11,\n fontFamily: 'Inter, sans-serif',\n fontWeight: '600',\n color: BRAND_PRIMARY,\n }}\n >\n Skip\n </Text>\n </Pressable>\n </View>\n )\n}\n\ninterface RestTimerRingProps {\n totalSeconds: number\n elapsedMs: number\n remainingSec: number\n done: boolean\n size: number\n nextSetInfo?: string\n displayOnly: boolean\n onSkip: () => void\n onAddTime: () => void\n}\n\n/**\n * The `ring` render: the wall rest treatment. Composes the generic {@link CircularTimer}\n * (which owns the arc + mm:ss readout + the fill-green \"GO\" done state), passing the\n * shared {@link RestActions} as its controls, and adds the rest-specific next-set footer\n * caption below. Rest-domain chrome only — the timer mechanics live in `CircularTimer`.\n */\nfunction RestTimerRing({\n totalSeconds,\n elapsedMs,\n remainingSec,\n done,\n size,\n nextSetInfo,\n displayOnly,\n onSkip,\n onAddTime,\n}: RestTimerRingProps) {\n const a11yLabel = done\n ? 'Rest complete, next set ready'\n : `Rest timer, ${Math.max(0, remainingSec)} seconds remaining`\n return (\n <View style={{ alignItems: 'center', gap: 16 }} testID=\"rest-timer\">\n <CircularTimer\n durationMs={totalSeconds * 1000}\n elapsedMs={elapsedMs}\n mode=\"down\"\n size={size}\n doneLabel=\"GO\"\n doneColor=\"success\"\n accessibilityLabel={a11yLabel}\n controls={!displayOnly ? <RestActions onAddTime={onAddTime} onSkip={onSkip} /> : undefined}\n testID=\"rest-timer-ring\"\n />\n {nextSetInfo != null && (\n <Text\n className=\"text-text-tertiary\"\n style={{ fontSize: 13, fontFamily: 'Inter, sans-serif' }}\n testID=\"rest-timer-next-set\"\n >\n {nextSetInfo}\n </Text>\n )}\n </View>\n )\n}\n\nexport function RestTimer({\n totalSeconds,\n elapsedMs,\n onSkip,\n onAddTime,\n nextSetInfo,\n visible,\n displayOnly = false,\n variant = 'bar',\n size = RING_DEFAULT_SIZE,\n}: RestTimerProps) {\n // useTimer owns the countdown math (remaining/progress/mm:ss); a zero-duration\n // timer is complete, which keeps the width out of the 0/0 === NaN case.\n const {\n remainingMs,\n progress,\n label: timeDisplay,\n done,\n } = useTimer({\n mode: 'down',\n durationMs: totalSeconds * 1000,\n elapsedMs,\n })\n const remainingSec = Math.ceil(remainingMs / 1000)\n const progressPct = progress * 100\n\n if (!visible) return null\n\n if (variant === 'ring') {\n return (\n <RestTimerRing\n totalSeconds={totalSeconds}\n elapsedMs={elapsedMs}\n remainingSec={remainingSec}\n done={done}\n size={size}\n nextSetInfo={nextSetInfo}\n displayOnly={displayOnly}\n onSkip={onSkip}\n onAddTime={onAddTime}\n />\n )\n }\n\n return (\n <View\n className=\"bg-surface-raised\"\n style={{\n width: '100%',\n borderTopWidth: 1,\n borderTopColor: resolveColor('hairline-default'),\n paddingVertical: 12,\n paddingHorizontal: 16,\n }}\n accessibilityRole=\"timer\"\n accessibilityLabel={`Rest timer, ${remainingSec} seconds remaining`}\n testID=\"rest-timer\"\n >\n {/* Top row */}\n <View\n style={{\n flexDirection: 'row',\n justifyContent: 'space-between',\n alignItems: 'center',\n marginBottom: 8,\n }}\n >\n {/* Left side */}\n <View style={{ flexDirection: 'column' }}>\n <Text\n className=\"text-text-secondary\"\n style={{\n fontSize: 11,\n fontFamily: 'Inter, sans-serif',\n fontWeight: '600',\n textTransform: 'uppercase',\n letterSpacing: 1,\n }}\n testID=\"rest-timer-label\"\n >\n REST\n </Text>\n {nextSetInfo != null && (\n <Text\n className=\"text-text-tertiary\"\n style={{\n fontSize: 11,\n fontFamily: 'Inter, sans-serif',\n marginTop: 2,\n }}\n testID=\"rest-timer-next-set\"\n >\n {nextSetInfo}\n </Text>\n )}\n </View>\n\n {/* Right side - time display */}\n <Text\n className=\"text-text-primary\"\n style={{\n fontSize: 28,\n fontFamily: '\"Space Grotesk\", sans-serif',\n fontWeight: '700',\n fontVariant: ['tabular-nums'],\n letterSpacing: -0.5,\n }}\n testID=\"rest-timer-time\"\n >\n {timeDisplay}\n </Text>\n </View>\n\n {/* Progress bar */}\n <View\n className=\"bg-hairline\"\n style={{\n height: 3,\n borderRadius: 2,\n marginBottom: 12,\n }}\n testID=\"rest-timer-progress-track\"\n >\n <View\n style={{\n height: '100%',\n backgroundColor: BRAND_PRIMARY,\n borderRadius: 2,\n width: `${progressPct}%`,\n }}\n testID=\"rest-timer-progress-fill\"\n />\n </View>\n\n {/* Actions row — hidden in display-only (poll-only) mode */}\n {!displayOnly && <RestActions onAddTime={onAddTime} onSkip={onSkip} />}\n </View>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport React from 'react'\nimport { View, Text } from 'react-native'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\n\nexport interface SupersetWrapperProps {\n label?: string\n color?: string\n children: React.ReactNode\n}\n\nconst DEFAULTS = {\n label: 'SS',\n color: getSemanticColors('dark')['brand-primary'],\n bgBase: getSemanticColors('dark')['background-base'],\n} as const\n\nexport function SupersetWrapper({\n label = DEFAULTS.label,\n color = DEFAULTS.color,\n children,\n}: SupersetWrapperProps) {\n return (\n <View\n style={{\n position: 'relative',\n borderLeftWidth: 3,\n borderLeftColor: color,\n paddingLeft: 8,\n marginHorizontal: 12,\n marginBottom: 8,\n overflow: 'visible',\n }}\n accessibilityRole={'group' as never}\n accessibilityLabel={`Superset: ${label}`}\n testID=\"superset-wrapper\"\n >\n <Text\n style={{\n position: 'absolute',\n top: -1,\n left: -3,\n fontSize: 9,\n fontFamily: 'Inter, sans-serif',\n fontWeight: '700',\n backgroundColor: color,\n color: DEFAULTS.bgBase,\n paddingVertical: 2,\n paddingHorizontal: 6,\n borderBottomRightRadius: 4,\n letterSpacing: 0.5,\n zIndex: 2,\n }}\n testID=\"superset-label\"\n >\n {label}\n </Text>\n <View style={{ gap: 2 }} testID=\"superset-children\">\n {children}\n </View>\n </View>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { useMemo, useState } from 'react'\nimport { View, Text, type ViewProps } from 'react-native'\nimport { ExerciseCard, type ExerciseCardProps } from './ExerciseCard'\nimport { InputBar } from './InputBar'\nimport { RestTimer } from './RestTimer'\nimport { SupersetWrapper } from './SupersetWrapper'\nimport { type SetRowProps } from './SetRow'\nimport { resolveColor } from '../../../theme/resolve-color'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\n\nconst BRAND_PRIMARY = getSemanticColors('dark')['brand-primary']\n\n/** Where an exercise sits in the during-workout flow. */\nexport type ActiveExerciseStatus = 'completed' | 'active' | 'upcoming'\n\n/**\n * One exercise in the running workout. Projected onto an `ExerciseCard`, whose\n * visual state is driven by `status` and the page's zoom focus: completed and\n * active exercises collapse/expand, upcoming ones stay dimmed.\n */\nexport interface ActiveWorkoutExercise {\n /** Stable id for zoom-focus selection. */\n id: string\n /** Exercise name, e.g. \"Barbell Bench Press\". */\n name: string\n /** Position in the workout flow. */\n status: ActiveExerciseStatus\n /** Unit used for this exercise's loads. */\n unit: 'lbs' | 'kg'\n /** Total sets prescribed for this exercise. */\n totalPlannedSets: number\n /** Collapsed summary (sets × reps @ weight) for a completed exercise. */\n summary?: ExerciseCardProps['summary']\n /** Flags a personal-record exercise. */\n isPR?: boolean\n /** Prescribed tempo, revealed when expanded. */\n tempo?: ExerciseCardProps['tempo']\n /** Per-rep velocities for each logged set (drives collapsed strips + set count). */\n setVelocities?: number[][]\n /** Per-set breakdown revealed when expanded. */\n sets?: SetRowProps[]\n /** One-line prescription for an upcoming exercise. */\n prescription?: string\n /** Previous-best hint for an upcoming exercise. */\n previousBest?: string\n /** Groups consecutive exercises under a shared `SupersetWrapper`. */\n supersetId?: string\n}\n\n/** A superset grouping consecutive exercises that share its id. */\nexport interface ActiveWorkoutSuperset {\n /** Matches `ActiveWorkoutExercise.supersetId`. */\n id: string\n /** Corner badge label, e.g. \"SS1\". */\n label: string\n /** Accent color for the wrapper rail + label. */\n color?: string\n}\n\n/** Live-set inputs shown in the bottom `InputBar`. */\nexport interface ActiveWorkoutInput {\n /** Current reps field value. */\n reps: string\n /** Current weight field value. */\n weight: string\n}\n\n/** Rest-timer inputs shown in the bottom `RestTimer`. */\nexport interface ActiveWorkoutRest {\n /** Prescribed rest length, seconds. */\n totalSeconds: number\n /** Elapsed rest, milliseconds. */\n elapsedMs: number\n /** Next-set hint, e.g. \"Set 3 · 8 × 195 lbs\". */\n nextSetInfo?: string\n}\n\n/** Derived, page-level roll-up of workout progress. */\nexport interface WorkoutProgress {\n /** Number of exercises marked completed. */\n completedExercises: number\n /** Total exercises in the workout. */\n totalExercises: number\n /** Sets logged so far across all exercises. */\n completedSets: number\n /** Total sets prescribed across all exercises. */\n totalSets: number\n /** Fraction of prescribed sets logged, 0-1. */\n fraction: number\n}\n\n/** An ordered render group: a lone exercise or a superset of exercises. */\nexport type WorkoutGroup =\n | { type: 'single'; exercise: ActiveWorkoutExercise }\n | { type: 'superset'; superset: ActiveWorkoutSuperset; exercises: ActiveWorkoutExercise[] }\n\nexport interface ActiveWorkoutPageProps extends ViewProps {\n /** Workout name shown in the header. */\n title?: string\n /** Context line under the title, e.g. \"Push Day A · Week 6\". */\n subtitle?: string\n /** Exercises in flow order. */\n exercises: ActiveWorkoutExercise[]\n /** Superset groupings referenced by `exercise.supersetId`. */\n supersets?: ActiveWorkoutSuperset[]\n /** Seed reps/weight for the live `InputBar`. */\n input?: ActiveWorkoutInput\n /** Rest-timer state; when resting, the timer replaces the input bar. */\n rest?: ActiveWorkoutRest\n /** Start the page in the resting state (timer showing). */\n initialResting?: boolean\n className?: string\n}\n\n/** Count the sets logged for an exercise (pure). */\nexport function countCompletedSets(exercise: ActiveWorkoutExercise): number {\n if (exercise.setVelocities != null) return exercise.setVelocities.length\n if (exercise.status === 'completed') return exercise.totalPlannedSets\n return 0\n}\n\n/** Roll up the exercises into the header progress readout (pure, testable). */\nexport function deriveWorkoutProgress(exercises: ActiveWorkoutExercise[]): WorkoutProgress {\n let completedExercises = 0\n let completedSets = 0\n let totalSets = 0\n for (const exercise of exercises) {\n if (exercise.status === 'completed') completedExercises += 1\n completedSets += countCompletedSets(exercise)\n totalSets += exercise.totalPlannedSets\n }\n return {\n completedExercises,\n totalExercises: exercises.length,\n completedSets,\n totalSets,\n fraction: totalSets === 0 ? 0 : completedSets / totalSets,\n }\n}\n\n/** The active exercise anchors the bottom bar; find it, or null (pure). */\nexport function findActiveExercise(\n exercises: ActiveWorkoutExercise[]\n): ActiveWorkoutExercise | null {\n return exercises.find((exercise) => exercise.status === 'active') ?? null\n}\n\n/** Whether an exercise renders as the dimmed, not-yet-reached representation (pure). */\nexport function isUpcomingExercise(status: ActiveExerciseStatus): boolean {\n return status === 'upcoming'\n}\n\n/** Project an exercise onto ExerciseCard props, wiring zoom focus (pure). */\nexport function toActiveCardProps(\n exercise: ActiveWorkoutExercise,\n focused: boolean,\n onToggle: () => void,\n supersetPosition: ExerciseCardProps['supersetPosition'] = null,\n supersetColor?: string\n): ExerciseCardProps {\n const upcoming = isUpcomingExercise(exercise.status)\n return {\n name: exercise.name,\n upcoming,\n expanded: focused,\n onExpandedChange: onToggle,\n summary: exercise.summary,\n isPR: exercise.isPR,\n tempo: exercise.tempo,\n setVelocities: exercise.setVelocities,\n totalPlannedSets: exercise.totalPlannedSets,\n sets: focused ? exercise.sets : undefined,\n prescription: exercise.prescription,\n previousBest: exercise.previousBest,\n supersetPosition,\n supersetColor,\n }\n}\n\n/** Fold consecutive same-superset exercises into render groups (pure). */\nexport function groupExercises(\n exercises: ActiveWorkoutExercise[],\n supersets: ActiveWorkoutSuperset[]\n): WorkoutGroup[] {\n const byId = new Map(supersets.map((superset) => [superset.id, superset]))\n const groups: WorkoutGroup[] = []\n for (const exercise of exercises) {\n const superset = exercise.supersetId != null ? byId.get(exercise.supersetId) : undefined\n const last = groups[groups.length - 1]\n if (superset != null && last?.type === 'superset' && last.superset.id === superset.id) {\n last.exercises.push(exercise)\n } else if (superset != null) {\n groups.push({ type: 'superset', superset, exercises: [exercise] })\n } else {\n groups.push({ type: 'single', exercise })\n }\n }\n return groups\n}\n\n/** Position of an exercise within its superset, for corner-radius stitching. */\nfunction supersetPositionAt(index: number, length: number): ExerciseCardProps['supersetPosition'] {\n if (length === 1) return null\n if (index === 0) return 'first'\n if (index === length - 1) return 'last'\n return 'middle'\n}\n\nfunction WorkoutHeader({\n title,\n subtitle,\n progress,\n}: {\n title: string\n subtitle?: string\n progress: WorkoutProgress\n}) {\n return (\n <View style={{ gap: 10 }} testID=\"active-workout-page-header\">\n <View className=\"flex-row items-start justify-between\" style={{ gap: 8 }}>\n <View style={{ flexShrink: 1 }}>\n <Text\n accessibilityRole=\"header\"\n className=\"text-text-primary\"\n style={{\n fontSize: 20,\n fontFamily: '\"Space Grotesk\", sans-serif',\n fontWeight: '700',\n }}\n testID=\"active-workout-page-title\"\n >\n {title}\n </Text>\n {subtitle != null && (\n <Text\n className=\"text-text-secondary\"\n style={{\n marginTop: 2,\n fontSize: 12,\n fontFamily: 'Inter, sans-serif',\n }}\n testID=\"active-workout-page-subtitle\"\n >\n {subtitle}\n </Text>\n )}\n </View>\n <View style={{ alignItems: 'flex-end' }} testID=\"active-workout-page-progress-count\">\n <Text\n style={{\n fontSize: 15,\n fontFamily: '\"Space Grotesk\", sans-serif',\n fontWeight: '700',\n color: BRAND_PRIMARY,\n fontVariant: ['tabular-nums'],\n }}\n >\n {`${progress.completedExercises}/${progress.totalExercises}`}\n </Text>\n <Text\n className=\"text-text-tertiary\"\n style={{\n fontSize: 10,\n fontFamily: 'Inter, sans-serif',\n fontWeight: '600',\n letterSpacing: 0.4,\n textTransform: 'uppercase',\n }}\n >\n {`${progress.completedSets}/${progress.totalSets} sets`}\n </Text>\n </View>\n </View>\n <View\n className=\"bg-hairline\"\n style={{ height: 4, borderRadius: 2 }}\n testID=\"active-workout-page-progress-track\"\n >\n <View\n style={{\n height: '100%',\n width: `${Math.round(progress.fraction * 100)}%`,\n backgroundColor: BRAND_PRIMARY,\n borderRadius: 2,\n }}\n testID=\"active-workout-page-progress-fill\"\n />\n </View>\n </View>\n )\n}\n\ninterface ExerciseListProps {\n groups: WorkoutGroup[]\n focusedId: string | null\n onToggle: (id: string) => void\n}\n\nfunction ExerciseList({ groups, focusedId, onToggle }: ExerciseListProps) {\n return (\n <View style={{ gap: 10 }} testID=\"active-workout-page-exercises\">\n {groups.map((group) => {\n if (group.type === 'single') {\n return (\n <View\n key={group.exercise.id}\n className=\"bg-surface-elevated border-hairline\"\n style={{\n borderWidth: 1,\n borderRadius: 12,\n }}\n >\n <ExerciseCard\n {...toActiveCardProps(group.exercise, group.exercise.id === focusedId, () =>\n onToggle(group.exercise.id)\n )}\n />\n </View>\n )\n }\n return (\n <SupersetWrapper\n key={group.superset.id}\n label={group.superset.label}\n color={group.superset.color}\n >\n {group.exercises.map((exercise, index) => (\n <ExerciseCard\n key={exercise.id}\n {...toActiveCardProps(\n exercise,\n exercise.id === focusedId,\n () => onToggle(exercise.id),\n supersetPositionAt(index, group.exercises.length),\n group.superset.color\n )}\n />\n ))}\n </SupersetWrapper>\n )\n })}\n </View>\n )\n}\n\n/**\n * ActiveWorkoutPage — the during-workout screen, built as a zoom hierarchy over\n * `ExerciseCard`s. A header progress bar rolls up completed sets; the flow list\n * dims upcoming exercises, collapses finished ones to their velocity strips, and\n * expands exactly one focused exercise to its `SetRow` breakdown. Consecutive\n * superset exercises stitch together inside a `SupersetWrapper`. A pinned bottom\n * bar toggles between the live `InputBar` (log the next set) and the `RestTimer`.\n * Focus and rest are page-level state; children keep their own styles.\n *\n * @example\n * <ActiveWorkoutPage title=\"Push Day A\" exercises={exercises} />\n */\nexport function ActiveWorkoutPage({\n title = 'Active Workout',\n subtitle,\n exercises,\n supersets = [],\n input,\n rest,\n initialResting = false,\n className,\n ...props\n}: ActiveWorkoutPageProps) {\n const active = findActiveExercise(exercises)\n const [focusedId, setFocusedId] = useState<string | null>(active?.id ?? null)\n const [resting, setResting] = useState(initialResting)\n const [reps, setReps] = useState(input?.reps ?? '')\n const [weight, setWeight] = useState(input?.weight ?? '')\n\n const progress = useMemo(() => deriveWorkoutProgress(exercises), [exercises])\n const groups = useMemo(() => groupExercises(exercises, supersets), [exercises, supersets])\n\n const toggleFocus = (id: string) => setFocusedId((current) => (current === id ? null : id))\n\n const nextSetNumber = active != null ? countCompletedSets(active) + 1 : 1\n const canRecord = reps.trim() !== '' && weight.trim() !== ''\n const showRest = resting && rest != null\n const showInput = !showRest && active != null\n\n return (\n <View\n className={['bg-background-base', className].filter(Boolean).join(' ')}\n style={{ position: 'relative', width: 390 }}\n accessibilityRole={'main' as ViewProps['accessibilityRole']}\n aria-label={title}\n testID=\"active-workout-page\"\n {...props}\n >\n <View style={{ padding: 16, gap: 14 }} testID=\"active-workout-page-content\">\n <WorkoutHeader title={title} subtitle={subtitle} progress={progress} />\n <ExerciseList groups={groups} focusedId={focusedId} onToggle={toggleFocus} />\n </View>\n\n {(showRest || showInput) && (\n <View\n style={{ borderTopWidth: 1, borderTopColor: resolveColor('hairline-default') }}\n testID=\"active-workout-page-bottom-bar\"\n >\n {showRest && rest != null ? (\n <RestTimer\n totalSeconds={rest.totalSeconds}\n elapsedMs={rest.elapsedMs}\n nextSetInfo={rest.nextSetInfo}\n onSkip={() => setResting(false)}\n onAddTime={() => undefined}\n visible\n />\n ) : (\n active != null && (\n <InputBar\n exerciseName={active.name}\n setNumber={nextSetNumber}\n totalSets={active.totalPlannedSets}\n reps={reps}\n weight={weight}\n unit={active.unit}\n onRepsChange={setReps}\n onWeightChange={setWeight}\n onRecord={() => {\n if (rest != null) setResting(true)\n }}\n canRecord={canRecord}\n visible\n />\n )\n )}\n </View>\n )}\n </View>\n )\n}\n","/**\n * Elevation System\n *\n * A unified depth system where each elevation level corresponds to:\n * - Calculated surface color (derived from base using lighten)\n * - Shadow intensity and style (raised/pressed)\n * - Dynamically calculated shadow colors (derived from surface color)\n * - Semantic name for reference\n *\n * Elevation range: -2 (deep inset) to +5 (floating overlay)\n *\n * Negative elevations: Inset/pressed elements (sunken into surface)\n * Zero elevation: Base surface (background/page level)\n * Positive elevations: Raised elements (floating above surface)\n *\n * All colors are calculated dynamically from a base surface color,\n * allowing for custom surfaces and consistent color relationships.\n *\n * Lighting Model: Light source from upper-right corner\n * - Raised elements are always lighter than base (consistent across themes)\n * - Base colors must allow sufficient lightening in both themes\n */\n\nimport { Platform, type ViewStyle } from 'react-native'\nimport { lighten, darken, hexToRgb, rgbToHsv, hsvToRgb, rgbToHex } from './color-utils'\nimport { semanticColorsLight, semanticColorsDark } from './tokens/semantic'\n\nexport type ElevationLevel = -2 | -1 | 0 | 1 | 2 | 3 | 4 | 5\n\nexport interface ElevationConfig {\n /** Semantic name for this elevation level */\n name: string\n /** Amount to lighten base color (0-1) */\n colorAdjustment: number\n /** Shadow intensity */\n shadowIntensity: 'subtle' | 'medium' | 'strong'\n /** Shadow style: raised (floating) or pressed (inset) */\n shadowStyle: 'raised' | 'pressed'\n /** Description of use case */\n description: string\n}\n\nexport const elevationSystem: Record<ElevationLevel, ElevationConfig> = {\n // Deep inset (recessed input fields, deeply pressed buttons)\n [-2]: {\n name: 'deep-inset',\n colorAdjustment: 0,\n shadowIntensity: 'strong',\n shadowStyle: 'pressed',\n description: 'Deeply recessed elements (e.g., input fields, deeply pressed buttons)',\n },\n\n // Shallow inset (pressed buttons, sunken panels)\n [-1]: {\n name: 'inset',\n colorAdjustment: 0,\n shadowIntensity: 'medium',\n shadowStyle: 'pressed',\n description: 'Shallow inset elements (e.g., pressed buttons, sunken panels within cards)',\n },\n\n // Base level (page background, default surface)\n [0]: {\n name: 'base',\n colorAdjustment: 0,\n shadowIntensity: 'subtle',\n shadowStyle: 'raised',\n description: 'Base surface level (page background, default containers)',\n },\n\n // Level 1: Subtle elevation (outline cards, subtle containers)\n [1]: {\n name: 'subtle',\n // The whole ladder was re-spaced in TD-07.16. It used to run\n // 0.01/0.02/0.04/0.06/0.08, where the first step was ~2 RGB values — under\n // the perceptual floor, so level 1 existed in the type system and nowhere on\n // screen. With drop-shadow now gated off below FLOATING_ELEVATION_MIN, TONE\n // is the only thing separating 0-3, so every step has to actually land.\n // Even 0.025 spacing, verified in elevation.test.ts as ΔL* > 1 per step.\n colorAdjustment: 0.025,\n shadowIntensity: 'subtle',\n shadowStyle: 'raised',\n description: 'Subtle elevation (outline cards, subtle containers)',\n },\n\n // Level 2: Standard elevation (default cards, buttons)\n [2]: {\n name: 'standard',\n colorAdjustment: 0.05,\n shadowIntensity: 'medium',\n shadowStyle: 'raised',\n description: 'Standard elevation (default cards, raised buttons)',\n },\n\n // Level 3: Prominent elevation (important cards, modals)\n [3]: {\n name: 'prominent',\n colorAdjustment: 0.075,\n shadowIntensity: 'strong',\n shadowStyle: 'raised',\n description: 'Prominent elevation (important cards, modals, dropdowns)',\n },\n\n // Level 4: High elevation (overlays, popovers)\n [4]: {\n name: 'high',\n colorAdjustment: 0.10,\n shadowIntensity: 'strong',\n shadowStyle: 'raised',\n description: 'High elevation (overlays, popovers, tooltips)',\n },\n\n // Level 5: Floating (toasts, floating action buttons)\n [5]: {\n name: 'floating',\n colorAdjustment: 0.13,\n shadowIntensity: 'strong',\n shadowStyle: 'raised',\n description: 'Floating elevation (toasts, floating action buttons, highest z-index)',\n },\n}\n\n/**\n * Calculate rim light color from the BASE color.\n * Creates a consistent bright highlight with opacity that scales with elevation.\n *\n * The rim light represents light hitting the edge of raised elements from a\n * consistent light source. Uses ABSOLUTE HSV value (not relative lightening)\n * for consistent intensity across all surface colors.\n *\n * For colored surfaces: preserves hue/saturation, sets value to fixed bright level\n * For gray surfaces: uses white with appropriate opacity\n *\n * @param baseColor - The base surface color (hex)\n * @param level - Elevation level (used to scale opacity)\n */\nfunction calculateRimLightColor(baseColor: string, level: ElevationLevel): string {\n const rgb = hexToRgb(baseColor)\n if (!rgb) {\n return 'rgba(255, 255, 255, 0.5)'\n }\n\n const hsv = rgbToHsv(rgb.r, rgb.g, rgb.b)\n const isLight = hsv.v > 0.6\n const isSaturated = hsv.s > 0.3 // Colored (not gray)\n\n // Opacity scales with elevation to compensate for lighter surfaces at higher levels\n // Range: +0% at level 1 to +20% at level 5\n const absLevel = Math.abs(level)\n const opacityBoost = Math.max(0, (absLevel - 1) * 0.05) // +5% per level above 1 (0% to 20%)\n\n if (isSaturated) {\n // For colored surfaces, preserve hue and saturation but set value to fixed bright level\n // This ensures consistent rim light intensity across all colored surfaces\n const rimLightValue = 0.95 // Fixed bright value for rim light\n const rimLightRgb = hsvToRgb(hsv.h, hsv.s * 0.3, rimLightValue) // Reduce saturation for brighter appearance\n\n // Base opacity + elevation boost, capped at 1.0\n const baseOpacity = isLight ? 0.9 : 0.5\n const finalOpacity = Math.min(1, baseOpacity + opacityBoost)\n return `rgba(${rimLightRgb.r}, ${rimLightRgb.g}, ${rimLightRgb.b}, ${finalOpacity.toFixed(2)})`\n } else {\n // For gray/neutral surfaces, use white with appropriate opacity\n const baseOpacity = isLight ? 0.9 : 0.12\n const finalOpacity = Math.min(1, baseOpacity + opacityBoost)\n return `rgba(255, 255, 255, ${finalOpacity.toFixed(2)})`\n }\n}\n\n/**\n * Calculate dark shadow colors from the surface color.\n * The dark shadow is cast BY the element, so it should match the surface color.\n *\n * Uses ABSOLUTE HSV value (not relative darkening) for consistent shadow intensity\n * across all surface colors - simulating a consistent light source.\n *\n * For colored surfaces: preserves hue/saturation, sets value to fixed dark level\n * For gray surfaces: uses black with appropriate opacity\n */\nfunction calculateDarkShadowColors(surfaceColor: string): {\n dark: string\n darker: string\n} {\n const rgb = hexToRgb(surfaceColor)\n if (!rgb) {\n return {\n dark: 'rgba(0, 0, 0, 0.3)',\n darker: 'rgba(0, 0, 0, 0.4)',\n }\n }\n\n const hsv = rgbToHsv(rgb.r, rgb.g, rgb.b)\n const isLight = hsv.v > 0.6\n const isSaturated = hsv.s > 0.3\n\n if (isSaturated) {\n // For colored surfaces, preserve hue and saturation but set value to fixed dark level\n // This ensures consistent shadow intensity across all colored surfaces\n const darkShadowValue = 0.15 // Fixed dark value for shadows\n const darkShadowRgb = hsvToRgb(hsv.h, hsv.s, darkShadowValue)\n\n if (isLight) {\n return {\n dark: `rgba(${darkShadowRgb.r}, ${darkShadowRgb.g}, ${darkShadowRgb.b}, 0.3)`,\n darker: `rgba(${darkShadowRgb.r}, ${darkShadowRgb.g}, ${darkShadowRgb.b}, 0.4)`,\n }\n } else {\n return {\n dark: `rgba(${darkShadowRgb.r}, ${darkShadowRgb.g}, ${darkShadowRgb.b}, 0.5)`,\n darker: `rgba(${darkShadowRgb.r}, ${darkShadowRgb.g}, ${darkShadowRgb.b}, 0.6)`,\n }\n }\n } else {\n // For gray surfaces, use standard black shadows\n if (isLight) {\n return {\n dark: 'rgba(0, 0, 0, 0.2)',\n darker: 'rgba(0, 0, 0, 0.3)',\n }\n } else {\n return {\n dark: 'rgba(0, 0, 0, 0.5)',\n darker: 'rgba(0, 0, 0, 0.6)',\n }\n }\n }\n}\n\n/**\n * Get rim light size config.\n * Fixed 1px offset and blur for a consistent, crisp rim highlight.\n * Opacity scaling (in calculateRimLightColor) handles elevation differences.\n */\nfunction getRimLightConfig(): { offset: number; blur: number } {\n return {\n offset: 1, // Fixed 1px for crisp rim\n blur: 1, // Tight blur for crisp edge\n }\n}\n\n/**\n * Get elevation configuration for a given level\n */\nexport function getElevationConfig(level: ElevationLevel): ElevationConfig {\n return elevationSystem[level]\n}\n\n// Simple cache for elevation surface colors\nconst elevationSurfaceCache = new Map<string, string>()\nconst MAX_CACHE_SIZE = 100\n\nfunction getCacheKey(baseColor: string, level: ElevationLevel, theme: 'light' | 'dark'): string {\n return `${baseColor}-${level}-${theme}`\n}\n\nfunction calculateElevationSurface(\n baseColor: string,\n level: ElevationLevel,\n theme: 'light' | 'dark'\n): string {\n const config = elevationSystem[level]\n\n if (config.colorAdjustment === 0) {\n return baseColor\n }\n\n // For raised elevations (positive), always lighten (consistent lighting model)\n // Light source is from upper-right, so raised elements are always lighter\n // For inset elevations (negative), we keep base color (shadow creates depth)\n if (level < 0) {\n return baseColor // Inset elements use base color\n }\n\n // Always lighten for raised elements (consistent across themes)\n // Base colors must be chosen to allow sufficient lightening in dark mode\n return lighten(baseColor, config.colorAdjustment)\n}\n\n/**\n * Calculate surface color for an elevation level from a base color.\n * Results are cached to avoid redundant calculations.\n *\n * @param baseColor - Base surface color (hex)\n * @param level - Elevation level\n * @param theme - Current theme ('light' or 'dark')\n * @returns Calculated surface color (hex)\n */\nexport function getElevationSurface(\n baseColor: string,\n level: ElevationLevel,\n theme: 'light' | 'dark'\n): string {\n const cacheKey = getCacheKey(baseColor, level, theme)\n\n // Check cache\n if (elevationSurfaceCache.has(cacheKey)) {\n return elevationSurfaceCache.get(cacheKey)!\n }\n\n // Calculate\n const result = calculateElevationSurface(baseColor, level, theme)\n\n // Cache result (with size limit to prevent memory leaks)\n if (elevationSurfaceCache.size >= MAX_CACHE_SIZE) {\n // Remove oldest entry (simple FIFO)\n const firstKey = elevationSurfaceCache.keys().next().value!\n elevationSurfaceCache.delete(firstKey)\n }\n elevationSurfaceCache.set(cacheKey, result)\n\n return result\n}\n\n// Cache for shadow styles (less frequently used, smaller cache)\nconst elevationShadowCache = new Map<string, ViewStyle>()\nconst MAX_SHADOW_CACHE_SIZE = 50\n\nfunction getShadowCacheKey(\n baseColor: string,\n level: ElevationLevel,\n theme: 'light' | 'dark',\n isHovered: boolean\n): string {\n return `${baseColor}-${level}-${theme}-${isHovered}`\n}\n\nfunction calculateElevationShadow(\n baseColor: string,\n level: ElevationLevel,\n theme: 'light' | 'dark',\n isHovered: boolean = false\n): ViewStyle {\n const config = elevationSystem[level]\n\n // Base level has no shadow\n if (level === 0) {\n return {}\n }\n\n // Calculate the actual elevated surface color\n const elevatedSurfaceColor = calculateElevationSurface(baseColor, level, theme)\n\n // Rim light: calculated from BASE color (consistent across all elevations)\n // This represents a consistent light source - only size changes with elevation\n const rimLightColor = calculateRimLightColor(baseColor, level)\n\n // Dark shadow: calculated from ELEVATED surface color\n // The shadow is cast by the element, so it should match the surface\n const darkShadowColors = calculateDarkShadowColors(elevatedSurfaceColor)\n\n // Get shadow intensity config (for dark shadow)\n const intensityConfig = {\n subtle: { offset: 1, blur: 2 },\n medium: { offset: 2, blur: 4 },\n strong: { offset: 2, blur: 5 },\n }\n\n const { offset, blur } = intensityConfig[config.shadowIntensity]\n\n // Get rim light config (scales with elevation level)\n const rimConfig = getRimLightConfig()\n\n if (config.shadowStyle === 'pressed') {\n // Inset shadow (pressed elements)\n if (isHovered) {\n // Reduce shadow depth for hover\n const hoverOffset = Math.max(1, Math.round(offset / 2))\n const hoverBlur = Math.max(1, Math.round(blur / 2))\n return Platform.select({\n web: {\n boxShadow: `inset ${hoverOffset}px ${hoverOffset}px ${hoverBlur}px ${darkShadowColors.darker}, inset -${rimConfig.offset}px -${rimConfig.offset}px ${rimConfig.blur}px ${rimLightColor}`,\n } as any,\n default: {\n shadowOpacity: 0,\n elevation: 0,\n },\n }) as ViewStyle\n }\n\n return Platform.select({\n web: {\n boxShadow: `inset ${offset}px ${offset}px ${blur}px ${darkShadowColors.darker}, inset -${rimConfig.offset}px -${rimConfig.offset}px ${rimConfig.blur}px ${rimLightColor}`,\n } as any,\n default: {\n shadowOpacity: 0,\n elevation: 0,\n },\n }) as ViewStyle\n } else {\n // Raised shadow (floating elements)\n if (isHovered) {\n // Reduce shadow depth for hover\n const hoverOffset = Math.max(1, Math.round(offset / 2))\n const hoverBlur = Math.max(1, Math.round(blur / 2))\n return Platform.select({\n web: {\n boxShadow: `${hoverOffset}px ${hoverOffset}px ${hoverBlur}px ${darkShadowColors.dark}, -${rimConfig.offset}px -${rimConfig.offset}px ${rimConfig.blur}px ${rimLightColor}`,\n } as any,\n default: {\n shadowColor: '#000',\n shadowOffset: { width: hoverOffset, height: hoverOffset },\n shadowOpacity: 0.2,\n shadowRadius: hoverBlur / 2,\n elevation: hoverOffset,\n },\n }) as ViewStyle\n }\n\n return Platform.select({\n web: {\n boxShadow: `${offset}px ${offset}px ${blur}px ${darkShadowColors.dark}, -${rimConfig.offset}px -${rimConfig.offset}px ${rimConfig.blur}px ${rimLightColor}`,\n } as any,\n default: {\n shadowColor: '#000',\n shadowOffset: { width: offset, height: offset },\n shadowOpacity: 0.3,\n shadowRadius: blur / 2,\n elevation: offset,\n },\n }) as ViewStyle\n }\n}\n\n/**\n * Get shadow style for an elevation level, calculated dynamically from surface color.\n * Results are cached to avoid redundant calculations.\n *\n * @param baseColor - Base surface color (hex)\n * @param level - Elevation level\n * @param theme - Current theme ('light' or 'dark')\n * @param isHovered - Whether element is hovered\n * @returns ViewStyle with shadow properties\n */\n/**\n * The lowest elevation that still casts an outward shadow.\n *\n * On a near-black surface a drop-shadow is inert: at levels 1-3 the shadow is\n * dark-on-dark and contributes nothing a viewer can see, while still costing a\n * composite layer. Material dropped shadow-as-hierarchy for the same reason.\n * Inline hierarchy is the hairline's job (`hairline-*`), which composites by a\n * constant amount over any plane.\n *\n * At 4+ the element is genuinely FLOATING over a backdrop — menu, popover,\n * toast — where a large soft shadow describes separation from the page rather\n * than a rank in a stack. Those should also carry a hairline ring.\n */\nexport const FLOATING_ELEVATION_MIN: ElevationLevel = 4\n\nexport function getElevationShadow(\n baseColor: string,\n level: ElevationLevel,\n theme: 'light' | 'dark',\n isHovered: boolean = false\n): ViewStyle {\n const cacheKey = getShadowCacheKey(baseColor, level, theme, isHovered)\n\n // Check cache\n if (elevationShadowCache.has(cacheKey)) {\n return elevationShadowCache.get(cacheKey)!\n }\n\n // Calculate shadow. Outward drop-shadow is gated to FLOATING levels only —\n // see FLOATING_ELEVATION_MIN. Inset levels keep theirs; a recess reads from\n // the inner shadow, which is a different mechanism from a cast shadow.\n const result =\n level > 0 && level < FLOATING_ELEVATION_MIN\n ? {}\n : calculateElevationShadow(baseColor, level, theme, isHovered)\n\n // Cache result\n if (elevationShadowCache.size >= MAX_SHADOW_CACHE_SIZE) {\n const firstKey = elevationShadowCache.keys().next().value!\n elevationShadowCache.delete(firstKey)\n }\n elevationShadowCache.set(cacheKey, result)\n\n return result\n}\n\n/**\n * Elevation level backing a `<Surface pressed>` recess: the shallow `inset`\n * (-1) step. Pressed exposes ONE level of depth — pressed-2 is intentionally\n * not surfaced (the deeper `-2` deep-inset stays available to `elevation`).\n */\nexport const PRESSED_ELEVATION_LEVEL: ElevationLevel = -1\n\n/**\n * Inner-shadow recess for a pressed (sunken) surface, tuned to the well's own\n * fill colour so the rim/shadow tints track the darker fill. Composes WITH the\n * darker pressed fill: on web it adds an inset boxShadow; on the native path\n * (no inset-shadow support) it's a no-op and the recess reads via the fill\n * alone — so a pressed surface stays legibly sunken with or without the shadow.\n *\n * @param fillColor - The pressed surface's own fill (one ramp step down).\n * @param theme - Current theme ('light' or 'dark').\n */\nexport function getPressedRecessShadow(fillColor: string, theme: 'light' | 'dark'): ViewStyle {\n return getElevationShadow(fillColor, PRESSED_ELEVATION_LEVEL, theme)\n}\n\n/**\n * Get base surface color from theme.\n * This is the foundation color that all elevations are calculated from.\n *\n * IMPORTANT: Base colors must be chosen to allow sufficient lightening.\n *\n * **Light Mode**: Cannot use `#FFFFFF` (white) - cannot lighten white!\n * - Use `#F3F4F6` (neutral[100]) - can lighten to `#FAFAFA` → `#FFFFFF`\n * - This allows raised elevations to be lighter (closer to white)\n *\n * **Dark Mode**: Need lighter base to allow sufficient lightening\n * - Use `surface-elevated` (#2A2827, TD-surface-tokens ramp) - allows further lightening\n *\n * Can be overridden to use custom base colors for special cases.\n */\nexport function getBaseSurfaceColor(theme: 'light' | 'dark'): string {\n // Use semantic token values so elevation colors stay in sync with the token pipeline.\n // Light mode: surface-raised (#F3F4F6 / neutral[100]) - NOT white, so we can lighten it\n // Dark mode: surface-elevated (#2A2827, TD-surface-tokens ramp) - allows sufficient lightening\n\n return theme === 'light'\n ? semanticColorsLight['surface-raised']\n : semanticColorsDark['surface-elevated']\n}\n\n/**\n * Component-specific elevation ranges\n * Defines which elevation levels each component type can use\n */\nexport const componentElevationRanges = {\n button: {\n allowed: [2] as const,\n default: 2 as const,\n hover: 3 as const,\n },\n card: {\n allowed: [1, 2, 3] as const,\n default: 2 as const,\n hover: 3 as const,\n },\n input: {\n allowed: [-2, -1, 0] as const,\n default: -1 as const,\n },\n overlay: {\n allowed: [4, 5] as const,\n default: 4 as const,\n },\n} as const\n\nexport type ComponentType = keyof typeof componentElevationRanges\n\n/**\n * Validate and clamp elevation to component's allowed range\n */\nexport function getValidatedElevation(\n component: ComponentType,\n requested: ElevationLevel\n): ElevationLevel {\n const range = componentElevationRanges[component]\n if ((range.allowed as readonly ElevationLevel[]).includes(requested)) {\n return requested\n }\n // Clamp to nearest allowed elevation\n const sorted = [...range.allowed].sort((a, b) => a - b)\n if (requested < sorted[0]) return sorted[0]\n if (requested > sorted[sorted.length - 1]) return sorted[sorted.length - 1]\n // Find closest\n return sorted.reduce((prev, curr) =>\n Math.abs(curr - requested) < Math.abs(prev - requested) ? curr : prev\n ) as ElevationLevel\n}\n\n// =============================================================================\n// Glow Shadow Support\n// =============================================================================\n\nexport type GlowIntensity = 'subtle' | 'medium' | 'strong'\n\nconst glowConfig: Record<GlowIntensity, { blur: number; spread: number; opacity: number }> = {\n subtle: { blur: 12, spread: 0, opacity: 0.25 },\n medium: { blur: 20, spread: 2, opacity: 0.4 },\n strong: { blur: 30, spread: 4, opacity: 0.55 },\n}\n\n/**\n * Get a glow shadow style for emphasis/active states.\n *\n * Creates a colored radial glow around an element, useful for:\n * - Active recording indicators (orange glow)\n * - Success states (green glow)\n * - Error/danger indicators (red glow)\n * - Focus rings and attention-drawing elements\n *\n * @param color - Glow color (hex string, e.g. '#FF7900')\n * @param intensity - Glow intensity level\n * @returns ViewStyle with platform-specific shadow properties\n */\nexport function getGlowShadow(color: string, intensity: GlowIntensity = 'medium'): ViewStyle {\n const config = glowConfig[intensity]\n const rgb = hexToRgb(color)\n if (!rgb) return {}\n\n return Platform.select({\n web: {\n boxShadow: `0 0 ${config.blur}px ${config.spread}px rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${config.opacity})`,\n } as any,\n default: {\n shadowColor: color,\n shadowOffset: { width: 0, height: 0 },\n shadowOpacity: config.opacity,\n shadowRadius: config.blur / 2,\n elevation: 0,\n },\n }) as ViewStyle\n}\n","import { useSyncExternalStore } from 'react'\n\n/**\n * Utility function to detect the current theme.\n * Checks for the 'light' class on the html element (set by Storybook's theme addon).\n * \n * NOTE: This function reads the theme at call time. For reactive theme detection\n * that re-renders when the theme changes, use the `useTheme` hook instead.\n * \n * @returns 'light' if light theme is active, 'dark' otherwise\n */\nexport function getTheme(): 'light' | 'dark' {\n if (typeof document === 'undefined') return 'dark'\n return document.documentElement.classList.contains('light') ? 'light' : 'dark'\n}\n\n// Subscribers for theme changes\nlet listeners: Array<() => void> = []\n\nfunction subscribe(listener: () => void) {\n listeners = [...listeners, listener]\n \n // Set up MutationObserver to watch for class changes on html element\n if (typeof document !== 'undefined' && listeners.length === 1) {\n const observer = new MutationObserver((mutations) => {\n for (const mutation of mutations) {\n if (mutation.type === 'attributes' && mutation.attributeName === 'class') {\n // Notify all listeners when class changes\n listeners.forEach(l => l())\n }\n }\n })\n \n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: ['class'],\n })\n \n // Store observer for cleanup\n ;(subscribe as any)._observer = observer\n }\n \n return () => {\n listeners = listeners.filter(l => l !== listener)\n \n // Clean up observer when no more listeners\n if (listeners.length === 0 && (subscribe as any)._observer) {\n ;(subscribe as any)._observer.disconnect()\n ;(subscribe as any)._observer = null\n }\n }\n}\n\nfunction getSnapshot(): 'light' | 'dark' {\n return getTheme()\n}\n\nfunction getServerSnapshot(): 'light' | 'dark' {\n return 'dark'\n}\n\n/**\n * React hook for reactive theme detection.\n * Automatically re-renders when the theme changes (via class changes on html element).\n * \n * Uses useSyncExternalStore for proper React 18 concurrent mode support.\n * \n * @returns 'light' if light theme is active, 'dark' otherwise\n */\nexport function useTheme(): 'light' | 'dark' {\n return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot)\n}\n","import React, { useMemo, useState } from 'react'\nimport { View, Text, Pressable, type ViewProps } from 'react-native'\nimport { cn } from '../../../utils/cn'\nimport { \n getElevationSurface, \n getElevationShadow, \n getBaseSurfaceColor,\n getValidatedElevation,\n type ElevationLevel \n} from '../../../theme'\nimport { useTheme } from '../../../utils/useTheme'\n\nexport type CardVariant = 'elevated' | 'outline' | 'filled' | 'accent' | 'subtle'\nexport type CardElevation = 1 | 2 | 3 // subtle, standard, prominent\n\nexport interface CardProps extends ViewProps {\n /** Visual variant */\n variant?: CardVariant\n /** Elevation level (1=subtle, 2=standard, 3=prominent) */\n elevation?: CardElevation\n /** Whether the card is interactive (hoverable/pressable) */\n isInteractive?: boolean\n /** Whether the card is in a loading state (renders skeleton) */\n isLoading?: boolean\n /** Callback when card is pressed (makes card interactive) */\n onPress?: () => void\n /** Custom border color (hex, rgb, or CSS color). Useful for status cards. */\n borderColor?: string\n /** Custom background color (hex, rgb, or CSS color). Useful for colored cards. */\n bgColor?: string\n /** Accent stripe color for accent variant (CSS color or hex) */\n accentColor?: string\n /** Accent stripe width for accent variant in pixels (default: 3) */\n accentWidth?: number\n /** Additional className */\n className?: string\n children?: React.ReactNode\n /** Show header skeleton when loading (default: true) */\n skeletonHasHeader?: boolean\n /** Show footer skeleton when loading (default: false) */\n skeletonHasFooter?: boolean\n /** Number of content lines in skeleton when loading (default: 3) */\n skeletonContentLines?: number\n}\n\nconst variantStyles: Record<CardVariant, string> = {\n elevated: '', // Will be set dynamically via elevation system\n outline: 'border-2 border-hairline-strong', // Thicker border with stronger contrast\n filled: '', // Will be set dynamically via elevation system\n accent: 'border border-hairline',\n subtle: 'border border-hairline-subtle',\n}\n\n/**\n * Card component for containing related content.\n *\n * @example\n * <Card>\n * <CardHeader>\n * <CardTitle>Card Title</CardTitle>\n * <CardDescription>Card description</CardDescription>\n * </CardHeader>\n * <CardContent>\n * <Text>Card content goes here</Text>\n * </CardContent>\n * <CardFooter>\n * <Button>Action</Button>\n * </CardFooter>\n * </Card>\n *\n * // Interactive card\n * <Card isInteractive onPress={() => console.log('pressed')}>\n * <CardContent>Click me</CardContent>\n * </Card>\n */\nexport function Card({\n variant = 'elevated',\n elevation = 2,\n isInteractive = false,\n isLoading = false,\n onPress,\n borderColor,\n bgColor,\n accentColor,\n accentWidth,\n className,\n children,\n style,\n skeletonHasHeader = true,\n skeletonHasFooter = false,\n skeletonContentLines = 3,\n ...props\n}: CardProps) {\n const isClickable = isInteractive || !!onPress\n const [isHovered, setIsHovered] = useState(false)\n const theme = useTheme()\n\n // Get elevation level (validate and clamp to card's allowed range)\n const elevationLevel = useMemo(() => {\n const validated = getValidatedElevation('card', elevation as ElevationLevel)\n // Map variant to elevation if needed\n if (variant === 'outline' || variant === 'accent' || variant === 'subtle') {\n return 1 as ElevationLevel // These border variants use subtle elevation\n }\n return validated\n }, [variant, elevation])\n\n // Get base surface color for theme\n const baseColor = useMemo(() => getBaseSurfaceColor(theme), [theme])\n\n // Calculate surface color and shadow from elevation\n const surfaceColor = useMemo(() => {\n // Outline variant in light mode uses a specific off-white for clear visibility\n if ((variant === 'outline' || variant === 'accent') && theme === 'light') {\n return '#FAFAFA' // Matches --color-surface-elevated in light mode\n }\n // Subtle variant uses the base surface color without elevation lift\n if (variant === 'subtle') {\n return getElevationSurface(baseColor, 0 as ElevationLevel, theme)\n }\n return getElevationSurface(baseColor, elevationLevel, theme)\n }, [baseColor, elevationLevel, theme, variant])\n\n const shadowStyle = useMemo(() => {\n // Only apply hover shadow if card is actually clickable\n const shouldHover = isHovered && isClickable\n return getElevationShadow(baseColor, elevationLevel, theme, shouldHover)\n }, [baseColor, elevationLevel, theme, isHovered, isClickable])\n\n // Render skeleton content when loading, otherwise render children\n const cardContent = isLoading ? (\n <>\n {skeletonHasHeader && (\n <CardHeader>\n <View className=\"h-5 w-1/3 bg-interactive-disabled rounded\" />\n <View className=\"mt-2 h-4 w-2/3 bg-interactive-disabled rounded\" />\n </CardHeader>\n )}\n <CardContent>\n {Array.from({ length: skeletonContentLines }).map((_, i) => (\n <View\n key={i}\n className={cn(\n 'h-4 bg-interactive-disabled rounded',\n i < skeletonContentLines - 1 ? 'mb-2 w-full' : 'w-4/5'\n )}\n />\n ))}\n </CardContent>\n {skeletonHasFooter && (\n <CardFooter>\n <View className=\"h-9 w-24 bg-interactive-disabled rounded\" />\n </CardFooter>\n )}\n </>\n ) : (\n children\n )\n\n const baseClassName = cn(\n 'rounded-lg overflow-hidden relative',\n // Apply variant styles, but only use default border color if no custom borderColor\n variant === 'outline'\n ? borderColor\n ? 'border-2' // Just the border width, color via style\n : variantStyles[variant] // Full variant styles including color\n : variantStyles[variant],\n // Remove Tailwind shadow classes - we're using elevation shadows via style prop\n isClickable && 'web:cursor-pointer web:transition-all web:duration-150',\n isClickable && 'web:hover:-translate-y-0.5 active:scale-[0.99]',\n isLoading && 'pointer-events-none animate-pulse',\n className\n )\n\n // Accent variant: left stripe via borderLeft override\n const accentStyle = useMemo(() => variant === 'accent' ? {\n borderLeftWidth: accentWidth ?? 3,\n borderLeftColor: accentColor ?? 'var(--color-brand-primary)',\n } : {}, [variant, accentWidth, accentColor])\n\n // Merge styles: background color from elevation + shadow style + custom colors + custom style\n const mergedStyle = useMemo(() => {\n const elevationStyle: Record<string, any> = {\n backgroundColor: bgColor || surfaceColor,\n borderRadius: 8,\n overflow: 'hidden' as const,\n ...shadowStyle,\n ...accentStyle,\n }\n\n // Add custom border color if provided\n if (borderColor) {\n elevationStyle.borderColor = borderColor\n }\n\n if (!style) return elevationStyle\n // User style takes precedence over elevation defaults (e.g. maxWidth, custom bg)\n return [elevationStyle, style]\n }, [style, surfaceColor, shadowStyle, borderColor, bgColor, accentStyle])\n\n if (isClickable) {\n return (\n <Pressable\n onPress={onPress}\n onHoverIn={() => setIsHovered(true)}\n onHoverOut={() => setIsHovered(false)}\n accessibilityRole=\"button\"\n className={baseClassName}\n style={mergedStyle}\n {...props}\n >\n {cardContent}\n </Pressable>\n )\n }\n\n return (\n <View className={baseClassName} style={mergedStyle} {...props}>\n {cardContent}\n </View>\n )\n}\n\nexport interface CardHeaderProps {\n children?: React.ReactNode\n className?: string\n}\n\n/**\n * Header section of a Card.\n */\nexport function CardHeader({ children, className }: CardHeaderProps) {\n return (\n <View className={cn('px-6 py-6', className)}>\n {children}\n </View>\n )\n}\n\nexport interface CardTitleProps {\n children?: React.ReactNode\n className?: string\n}\n\n/**\n * Title for CardHeader.\n */\nexport function CardTitle({ children, className }: CardTitleProps) {\n return (\n <Text\n accessibilityRole=\"header\"\n className={cn('text-lg font-semibold text-text-primary font-heading', className)}\n >\n {children}\n </Text>\n )\n}\n\nexport interface CardDescriptionProps {\n children?: React.ReactNode\n className?: string\n}\n\n/**\n * Description for CardHeader.\n */\nexport function CardDescription({ children, className }: CardDescriptionProps) {\n return (\n <Text className={cn('mt-1.5 text-sm text-text-secondary', className)}>\n {children}\n </Text>\n )\n}\n\nexport interface CardContentProps {\n children?: React.ReactNode\n className?: string\n}\n\n/**\n * Content section of a Card.\n */\nexport function CardContent({ children, className }: CardContentProps) {\n return (\n <View className={cn('px-6 py-4', className)}>\n {children}\n </View>\n )\n}\n\nexport interface CardFooterProps {\n children?: React.ReactNode\n className?: string\n}\n\n/**\n * Footer section of a Card.\n */\nexport function CardFooter({ children, className }: CardFooterProps) {\n return (\n <View className={cn('px-6 py-4 flex-row items-center gap-2', className)}>\n {children}\n </View>\n )\n}\n\nexport interface CardSkeletonProps {\n /** Whether to show header skeleton */\n hasHeader?: boolean\n /** Whether to show footer skeleton */\n hasFooter?: boolean\n /** Number of content lines */\n contentLines?: number\n /** Additional className */\n className?: string\n}\n\n/**\n * Skeleton placeholder for Card loading state.\n */\nexport function CardSkeleton({\n hasHeader = true,\n hasFooter = false,\n contentLines = 3,\n className,\n}: CardSkeletonProps) {\n return (\n <Card variant=\"elevated\" elevation={2} className={cn('animate-pulse', className)}>\n {hasHeader && (\n <CardHeader>\n <View className=\"h-5 w-1/3 bg-interactive-disabled rounded\" />\n <View className=\"mt-2 h-4 w-2/3 bg-interactive-disabled rounded\" />\n </CardHeader>\n )}\n <CardContent>\n {Array.from({ length: contentLines }).map((_, i) => (\n <View\n key={i}\n className={cn(\n 'h-4 bg-interactive-disabled rounded',\n i < contentLines - 1 ? 'mb-2 w-full' : 'w-4/5'\n )}\n />\n ))}\n </CardContent>\n {hasFooter && (\n <CardFooter>\n <View className=\"h-9 w-24 bg-interactive-disabled rounded\" />\n </CardFooter>\n )}\n </Card>\n )\n}\n\nexport interface CardInsetProps extends ViewProps {\n /** Elevation level for inset (-2=deep, -1=shallow) */\n elevation?: -2 | -1\n /** Additional className */\n className?: string\n children?: React.ReactNode\n}\n\n/**\n * Inset element within a Card. Applies pressed neumorphic shadow\n * to create a sunken/recessed appearance.\n * \n * @example\n * <Card elevation={2}>\n * <CardContent>\n * <CardInset elevation={-1}>\n * <Text>This content appears inset/sunken</Text>\n * </CardInset>\n * </CardContent>\n * </Card>\n */\nexport function CardInset({\n elevation = -1,\n className,\n children,\n style,\n ...props\n}: CardInsetProps) {\n const theme = useTheme()\n const baseColor = useMemo(() => getBaseSurfaceColor(theme), [theme])\n const surfaceColor = useMemo(() => {\n return getElevationSurface(baseColor, elevation as ElevationLevel, theme)\n }, [baseColor, elevation, theme])\n const shadowStyle = useMemo(() => {\n return getElevationShadow(baseColor, elevation as ElevationLevel, theme)\n }, [baseColor, elevation, theme])\n \n return (\n <View\n className={cn('rounded', className)}\n style={[{ backgroundColor: surfaceColor }, shadowStyle, style]}\n {...props}\n >\n {children}\n </View>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { View, Text, type ViewProps } from 'react-native'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\nimport { greyRamp } from '../../../theme/tokens/primitives'\n\nconst t = getSemanticColors('dark')\n\nexport type StatusDotVariant =\n | 'success'\n | 'warning'\n | 'error'\n | 'neutral'\n | 'on-track'\n | 'deviation'\n | 'future'\n\nexport interface StatusDotProps extends ViewProps {\n variant: StatusDotVariant\n /** Center glyph. Only rendered at size=\"md\"; the 8px \"sm\" dot is too small to fit one. */\n icon?: 'check' | 'exclamation' | 'dash'\n size?: 'sm' | 'md'\n /** Adds a subtle glow effect in the variant color */\n glow?: boolean\n label?: string\n className?: string\n}\n\nconst solidVariantColors: Record<string, string> = {\n success: t['status-success'],\n warning: t['status-warning'],\n error: t['status-error'],\n neutral: greyRamp[500],\n}\n\nconst ringVariantStyles: Record<string, Record<string, unknown>> = {\n 'on-track': {\n backgroundColor: 'rgba(46,213,115,0.15)',\n borderWidth: 1,\n borderColor: 'rgba(46,213,115,0.3)',\n },\n deviation: {\n backgroundColor: 'rgba(245,158,11,0.15)',\n borderWidth: 1,\n borderColor: 'rgba(245,158,11,0.25)',\n },\n future: {\n backgroundColor: 'rgba(107,114,128,0.1)',\n borderWidth: 1,\n borderStyle: 'dashed',\n borderColor: 'rgba(107,114,128,0.2)',\n },\n}\n\nconst glowStyles: Record<StatusDotVariant, Record<string, unknown>> = {\n success: { boxShadow: '0 0 4px rgba(46,213,115,0.4)' },\n warning: { boxShadow: '0 0 4px rgba(245,158,11,0.4)' },\n error: { boxShadow: '0 0 4px rgba(239,68,68,0.4)' },\n neutral: { boxShadow: '0 0 4px rgba(107,114,128,0.4)' },\n 'on-track': { boxShadow: '0 0 4px rgba(46,213,115,0.4)' },\n deviation: { boxShadow: '0 0 4px rgba(245,158,11,0.4)' },\n future: { boxShadow: '0 0 4px rgba(107,114,128,0.4)' },\n}\n\nconst iconChars: Record<string, string> = {\n check: '\\u2713',\n exclamation: '!',\n dash: '\\u2014',\n}\n\n/** Color-matched icon colors: dark on solid bg, light on transparent bg */\nconst iconColors: Record<StatusDotVariant, string> = {\n success: '#0A5C52',\n warning: '#6B4000',\n error: '#5C1A1A',\n neutral: greyRamp[200],\n 'on-track': t['status-success'],\n deviation: t['status-warning'],\n future: greyRamp[500],\n}\n\nconst sizeDimensions = {\n sm: { size: 8, showIcon: false },\n md: { size: 18, showIcon: true },\n}\n\nfunction isSolidVariant(variant: StatusDotVariant): boolean {\n return variant in solidVariantColors\n}\n\nexport function StatusDot({\n variant,\n icon,\n size = 'sm',\n glow,\n label,\n className,\n ...props\n}: StatusDotProps) {\n const config = sizeDimensions[size]\n const solid = isSolidVariant(variant)\n const ring = ringVariantStyles[variant]\n\n const glowStyle = glow ? glowStyles[variant] : null\n\n const dot = (\n <View\n style={[\n {\n width: config.size,\n height: config.size,\n borderRadius: 9999,\n alignItems: 'center',\n justifyContent: 'center',\n flexShrink: 0,\n },\n solid ? { backgroundColor: solidVariantColors[variant] } : undefined,\n ring ? (ring as Record<string, unknown>) : undefined,\n glowStyle ? (glowStyle as Record<string, unknown>) : undefined,\n ]}\n accessibilityRole=\"image\"\n accessibilityLabel={`${variant} status`}\n testID=\"status-dot\"\n >\n {config.showIcon && icon && (\n <Text\n style={{\n fontSize: 11,\n lineHeight: 11,\n fontWeight: '900',\n color: iconColors[variant],\n }}\n accessibilityElementsHidden\n >\n {iconChars[icon]}\n </Text>\n )}\n </View>\n )\n\n if (label) {\n return (\n <View\n className={className}\n style={{ flexDirection: 'row', alignItems: 'center', gap: 6 }}\n accessibilityLabel={`${variant} status: ${label}`}\n {...props}\n >\n <View accessibilityElementsHidden>{dot}</View>\n <Text\n style={{ fontSize: 12, lineHeight: 16, color: greyRamp[400] }}\n accessibilityElementsHidden\n >\n {label}\n </Text>\n </View>\n )\n }\n\n return (\n <View className={className} {...props}>\n {dot}\n </View>\n )\n}\n","/**\n * Data-viz / status / brand fills, sourced from the color foundations.\n */\n\nimport { categoricalPalette, primitiveRamps as ramp } from './tokens/primitives'\n\n/**\n * Titan categorical fallback palette shared by Treemap and Scatter — the\n * canonical {@link categoricalPalette} (ordered, nested-stable, CVD-safe).\n * Components index into it modulo length, so the 7-color series is sufficient.\n */\nexport const DATAVIZ_CATEGORICAL_PALETTE = categoricalPalette.default\n\n/**\n * MesoCard / MesoStatusCard 3px top-accent gradient stops (dark → primary →\n * light), on the orange ramp that brand-primary (orange-400) lives in.\n */\nexport const MESO_ACCENT_GRADIENT_DARK = ramp.orange[500]\nexport const MESO_ACCENT_GRADIENT_LIGHT = ramp.orange[300]\n\nexport const WORKOUT_PILL_DELOAD = ramp.magenta[600]\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { Fragment, type ReactNode } from 'react'\nimport { View, Text, type ViewProps, type ViewStyle } from 'react-native'\nimport { Card } from '../../ui/card'\nimport { StatusDot } from './StatusDot'\nimport { resolveColor } from '../../../theme/resolve-color'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\nimport {\n MESO_ACCENT_GRADIENT_DARK,\n MESO_ACCENT_GRADIENT_LIGHT,\n} from '../../../theme/extracted-colors-dataviz'\n\nconst t = getSemanticColors('dark')\n\nconst BRAND_PRIMARY = t['brand-primary']\nconst BRAND_PRIMARY_DARK = MESO_ACCENT_GRADIENT_DARK\nconst BRAND_PRIMARY_LIGHT = MESO_ACCENT_GRADIENT_LIGHT\n\nconst SUCCESS = t['status-success']\nconst WARNING = t['status-warning']\nconst ERROR = t['status-error']\n\n/** Gradient stops for the 3px top accent: dark -> primary -> light (matches MesoCard). */\nconst ACCENT_STOPS = [BRAND_PRIMARY_DARK, BRAND_PRIMARY, BRAND_PRIMARY_LIGHT]\n\n/**\n * Card surface gradient: elevated -> raised at 135deg. Uses resolved dark-theme\n * hexes (a gradient string can't carry a className token, and var() renders\n * black on native).\n */\nconst CARD_GRADIENT = `linear-gradient(135deg, ${resolveColor('surface-elevated')} 0%, ${resolveColor('surface-raised')} 100%)`\n\n/** Gauge track gradient (teal -> amber -> red) at 0.25 alpha. */\nconst GAUGE_GRADIENT =\n 'linear-gradient(90deg, rgba(46,213,115,0.25) 0%, rgba(249,180,21,0.25) 50%, rgba(209,67,67,0.25) 100%)'\n\nexport type MesoStatusBadgeVariant = 'success' | 'warning' | 'error'\n\nconst STATUS_VARIANTS: Record<\n MesoStatusBadgeVariant,\n { bg: string; border: string; text: string }\n> = {\n success: { bg: 'rgba(46,213,115,0.15)', border: 'rgba(46,213,115,0.3)', text: SUCCESS },\n warning: { bg: 'rgba(249,180,21,0.15)', border: 'rgba(249,180,21,0.3)', text: WARNING },\n error: { bg: 'rgba(209,67,67,0.15)', border: 'rgba(209,67,67,0.25)', text: ERROR },\n}\n\nexport interface MesoStatusBadge {\n /** Short status label, e.g. \"On Track\". */\n label: string\n /** Color treatment for the badge. */\n variant: MesoStatusBadgeVariant\n}\n\nexport interface MesoStatusMetric {\n /** Cell label, e.g. \"Prescribed\". */\n label: string\n /** Cell value, e.g. \"3×8 @ RPE 8\". */\n value: string\n}\n\nexport interface MesoStatusGauge {\n /** Gauge label, e.g. \"Intensity\". */\n label: string\n /** Fill position 0-1; the 14px marker sits at this level. */\n level: number\n /** Optional right-aligned sublabel, e.g. \"Prescribed\". */\n sublabel?: string\n}\n\nexport interface MesoStatusCoaching {\n /** Coaching recommendation copy. */\n text: string\n /** Substrings within `text` to render in bold. */\n highlights?: string[]\n}\n\nexport interface MesoStatusNextTarget {\n /** Leading glyph/emoji, e.g. \"→\" or \"🎯\". */\n icon: string\n /** Next-session target copy. */\n text: string\n}\n\nexport interface MesoStatusCardProps extends ViewProps {\n /** Mesocycle name, e.g. \"Hypertrophy Block\". */\n mesoName: string\n /** Context line, e.g. \"Week 6 of 8 · Upper/Lower\". */\n mesoSubtitle: string\n /** Status pill in the header. */\n statusBadge: MesoStatusBadge\n /** Prescription-vs-actual metrics rendered as a 2x2 grid. */\n metrics: MesoStatusMetric[]\n /** Intensity / volume gauges stacked vertically. */\n gauges: MesoStatusGauge[]\n /** Optional coaching recommendation box. */\n coaching?: MesoStatusCoaching\n /** Optional next-session target box. */\n nextTarget?: MesoStatusNextTarget\n className?: string\n}\n\nfunction clamp01(value: number): number {\n if (!Number.isFinite(value)) return 0\n if (value < 0) return 0\n if (value > 1) return 1\n return value\n}\n\n/** Marker fill color by gauge zone: teal 0-0.4, amber 0.4-0.7, red 0.7-1.0. */\nfunction getGaugeZoneColor(level: number): string {\n if (level >= 0.7) return ERROR\n if (level >= 0.4) return WARNING\n return SUCCESS\n}\n\n/** Splits `text` into nodes, bolding any segment that exactly matches a highlight. */\nfunction renderCoachingText(text: string, highlights?: string[]): ReactNode {\n if (!highlights || highlights.length === 0) return text\n const escaped = highlights\n .filter(Boolean)\n .map((h) => h.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'))\n if (escaped.length === 0) return text\n const regex = new RegExp(`(${escaped.join('|')})`, 'g')\n return text.split(regex).map((part, index) =>\n highlights.includes(part) ? (\n <Text\n key={`${part}-${index}`}\n className=\"text-text-primary\"\n style={{ fontWeight: '700' }}\n >\n {part}\n </Text>\n ) : (\n <Fragment key={`t-${index}`}>{part}</Fragment>\n ),\n )\n}\n\nfunction StatusPill({ badge }: { badge: MesoStatusBadge }) {\n const colors = STATUS_VARIANTS[badge.variant]\n return (\n <View\n className=\"flex-row items-center\"\n style={{\n gap: 5,\n paddingVertical: 3,\n paddingHorizontal: 8,\n borderRadius: 4,\n borderWidth: 1,\n backgroundColor: colors.bg,\n borderColor: colors.border,\n }}\n testID=\"meso-status-card-badge\"\n >\n <View accessibilityElementsHidden>\n <StatusDot variant={badge.variant} size=\"sm\" />\n </View>\n <Text\n style={{\n fontSize: 10,\n fontFamily: 'Inter, sans-serif',\n fontWeight: '700',\n letterSpacing: 0.3,\n color: colors.text,\n }}\n >\n {badge.label}\n </Text>\n </View>\n )\n}\n\nfunction MetricCell({ metric }: { metric: MesoStatusMetric }) {\n return (\n <View style={{ width: '48%' }} testID=\"meso-status-card-metric\">\n <Text\n className=\"text-text-tertiary\"\n style={{\n fontSize: 10,\n fontFamily: 'Inter, sans-serif',\n fontWeight: '600',\n letterSpacing: 0.5,\n textTransform: 'uppercase',\n }}\n >\n {metric.label}\n </Text>\n <Text\n className=\"text-text-primary\"\n style={{\n marginTop: 2,\n fontSize: 13,\n fontFamily: 'Inter, sans-serif',\n fontWeight: '600',\n }}\n >\n {metric.value}\n </Text>\n </View>\n )\n}\n\nfunction Gauge({ gauge }: { gauge: MesoStatusGauge }) {\n const level = clamp01(gauge.level)\n const percentage = Math.round(level * 100)\n const markerColor = getGaugeZoneColor(level)\n return (\n <View\n style={{ gap: 6 }}\n accessibilityRole=\"progressbar\"\n accessibilityValue={{ min: 0, max: 100, now: percentage }}\n accessibilityLabel={`${gauge.label}: ${percentage}%`}\n aria-valuenow={percentage}\n aria-valuemin={0}\n aria-valuemax={100}\n testID=\"meso-status-card-gauge\"\n >\n <View\n className=\"flex-row items-center justify-between\"\n accessibilityElementsHidden\n >\n <Text\n className=\"text-text-secondary\"\n style={{\n fontSize: 10,\n fontFamily: 'Inter, sans-serif',\n fontWeight: '500',\n letterSpacing: 0.5,\n textTransform: 'uppercase',\n }}\n >\n {gauge.label}\n </Text>\n {gauge.sublabel != null && (\n <Text\n className=\"text-text-tertiary\"\n style={{\n fontSize: 10,\n fontFamily: 'Inter, sans-serif',\n fontWeight: '500',\n }}\n >\n {gauge.sublabel}\n </Text>\n )}\n </View>\n\n <View\n style={\n {\n height: 8,\n borderRadius: 4,\n position: 'relative',\n backgroundImage: GAUGE_GRADIENT,\n } as ViewStyle\n }\n accessibilityElementsHidden\n >\n <View\n style={{\n position: 'absolute',\n left: '50%',\n top: 0,\n bottom: 0,\n width: 1,\n marginLeft: -0.5,\n backgroundColor: 'rgba(255,255,255,0.3)',\n }}\n testID=\"meso-status-card-gauge-center\"\n />\n <View\n className=\"border-text-primary\"\n style={{\n position: 'absolute',\n left: `${percentage}%`,\n top: -3,\n marginLeft: -7,\n width: 14,\n height: 14,\n borderRadius: 9999,\n borderWidth: 2,\n backgroundColor: markerColor,\n boxShadow: '0 0 4px rgba(0,0,0,0.5)',\n }}\n testID=\"meso-status-card-gauge-marker\"\n />\n </View>\n </View>\n )\n}\n\n/**\n * Mesocycle context card for a specific exercise: prescription vs actual\n * metrics, intensity/volume gauges, and coaching guidance. Composes the titan\n * `Card` plus the Workout `StatusDot`, and renders the §25 gauge (8px track,\n * 50% center line, 14px marker) inline since that visual differs from the\n * IntensityBar/DeviationBar primitives.\n *\n * @example\n * <MesoStatusCard\n * mesoName=\"Hypertrophy Block\"\n * mesoSubtitle=\"Week 6 of 8 · Upper/Lower\"\n * statusBadge={{ label: 'On Track', variant: 'success' }}\n * metrics={[\n * { label: 'Prescribed', value: '3×8 @ RPE 8' },\n * { label: 'Actual', value: '3×8 @ 185 lbs' },\n * ]}\n * gauges={[{ label: 'Intensity', level: 0.7, sublabel: 'Actual' }]}\n * coaching={{ text: 'Add load next session.', highlights: ['Add load'] }}\n * nextTarget={{ icon: '→', text: '190 lbs × 8' }}\n * />\n */\nexport function MesoStatusCard({\n mesoName,\n mesoSubtitle,\n statusBadge,\n metrics,\n gauges,\n coaching,\n nextTarget,\n className,\n ...props\n}: MesoStatusCardProps) {\n return (\n <Card\n variant=\"outline\"\n elevation={1}\n borderColor={BRAND_PRIMARY_DARK}\n className={className}\n style={\n {\n borderColor: BRAND_PRIMARY_DARK,\n borderWidth: 1,\n backgroundImage: CARD_GRADIENT,\n } as ViewStyle\n }\n role=\"article\"\n aria-label={`Mesocycle status for ${mesoName}`}\n testID=\"meso-status-card\"\n {...props}\n >\n <View\n className=\"flex-row\"\n style={{ position: 'absolute', top: 0, left: 0, right: 0, height: 3, zIndex: 1 }}\n accessibilityElementsHidden\n testID=\"meso-status-card-accent\"\n >\n {ACCENT_STOPS.map((color) => (\n <View key={color} style={{ flex: 1, backgroundColor: color }} />\n ))}\n </View>\n\n <View style={{ padding: 14, gap: 14 }} testID=\"meso-status-card-body\">\n <View testID=\"meso-status-card-header\">\n <View\n className=\"flex-row items-center justify-between\"\n style={{ gap: 8 }}\n >\n <Text\n className=\"text-text-primary\"\n style={{\n flexShrink: 1,\n fontSize: 15,\n fontFamily: '\"Space Grotesk\", sans-serif',\n fontWeight: '700',\n }}\n testID=\"meso-status-card-name\"\n >\n {mesoName}\n </Text>\n <StatusPill badge={statusBadge} />\n </View>\n <Text\n className=\"text-text-secondary\"\n style={{\n marginTop: 4,\n fontSize: 12,\n fontFamily: 'Inter, sans-serif',\n }}\n testID=\"meso-status-card-subtitle\"\n >\n {mesoSubtitle}\n </Text>\n </View>\n\n {metrics.length > 0 && (\n <View\n className=\"flex-row flex-wrap\"\n style={{ gap: 8 }}\n testID=\"meso-status-card-metrics\"\n >\n {metrics.map((metric, index) => (\n <MetricCell key={`${metric.label}-${index}`} metric={metric} />\n ))}\n </View>\n )}\n\n {gauges.length > 0 && (\n <View style={{ gap: 12 }} testID=\"meso-status-card-gauges\">\n {gauges.map((gauge, index) => (\n <Gauge key={`${gauge.label}-${index}`} gauge={gauge} />\n ))}\n </View>\n )}\n\n {coaching != null && (\n <View\n style={{\n backgroundColor: 'rgba(249,180,21,0.06)',\n borderWidth: 1,\n borderColor: 'rgba(249,180,21,0.15)',\n borderRadius: 8,\n paddingVertical: 10,\n paddingHorizontal: 12,\n }}\n testID=\"meso-status-card-coaching\"\n >\n <Text\n className=\"text-text-secondary\"\n style={{\n fontSize: 12,\n lineHeight: 17,\n fontFamily: 'Inter, sans-serif',\n }}\n >\n {renderCoachingText(coaching.text, coaching.highlights)}\n </Text>\n </View>\n )}\n\n {nextTarget != null && (\n <View\n className=\"flex-row items-center\"\n style={{\n gap: 8,\n backgroundColor: 'rgba(46,213,115,0.06)',\n borderWidth: 1,\n borderColor: 'rgba(46,213,115,0.2)',\n borderRadius: 8,\n paddingVertical: 10,\n paddingHorizontal: 12,\n }}\n testID=\"meso-status-card-next-target\"\n >\n <Text style={{ fontSize: 14, color: SUCCESS }} accessibilityElementsHidden>\n {nextTarget.icon}\n </Text>\n <Text\n style={{\n flexShrink: 1,\n fontSize: 12,\n fontFamily: 'Inter, sans-serif',\n fontWeight: '600',\n color: SUCCESS,\n }}\n >\n {nextTarget.text}\n </Text>\n </View>\n )}\n </View>\n </Card>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { useEffect, useMemo, useState } from 'react'\nimport { View, Text, Pressable, Animated, Easing, type ViewProps } from 'react-native'\nimport { cn } from '../../../utils/cn'\nimport { resolveColor } from '../../../theme/resolve-color'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\n\nconst sem = getSemanticColors('dark')\n\nconst BRAND_PRIMARY = sem['brand-primary']\n// Line/border color for the dashed projection, used where a className cannot\n// apply (passed as a prop into an inline style, and a per-edge borderTopColor).\nconst PROJECTION_LINE_COLOR = resolveColor('text-tertiary')\nconst STATUS_SUCCESS = sem['status-success']\nconst STATUS_ERROR = sem['status-error']\nconst STATUS_WARNING = sem['status-warning']\nconst GRID_LINE = 'rgba(255,255,255,0.06)'\nconst SUCCESS_PILL_BG = 'rgba(46,213,115,0.10)'\nconst SUCCESS_PILL_BORDER = 'rgba(46,213,115,0.20)'\nconst ERROR_PILL_BG = 'rgba(209,67,67,0.10)'\nconst ERROR_PILL_BORDER = 'rgba(209,67,67,0.20)'\n\n/** Left gutter reserved for y-axis value labels. */\nconst PLOT_LEFT = 26\n/** Approximate tooltip width used for edge clamping. */\nconst TOOLTIP_WIDTH = 124\n\nexport interface StrengthTrendDataPoint {\n /** ISO date string for the session. */\n date: string\n /** Estimated one-rep max in the chart's unit. */\n e1rm: number\n /** Marks a personal-record session (rendered with a star). */\n isPR?: boolean\n /** Optional human label shown in the tooltip instead of the raw date. */\n sessionLabel?: string\n}\n\nexport interface StrengthTrendChartMesoBoundary {\n /** ISO date where the mesocycle boundary falls. */\n date: string\n /** Short label, e.g. \"Hypertrophy\". */\n label: string\n}\n\nexport interface StrengthTrendChartProps extends ViewProps {\n /** Actual e1RM data points, chronological. */\n data: StrengthTrendDataPoint[]\n /** Projected/planned e1RM trajectory, drawn as a dashed line. */\n projection?: StrengthTrendDataPoint[]\n /** Chart plot width in pixels. */\n width: number\n /** Chart plot height in pixels (120-160 for the compact variant). */\n height: number\n /** Mesocycle boundary markers (vertical guides + labels). */\n mesoBoundaries?: StrengthTrendChartMesoBoundary[]\n /** Called when an actual data point is tapped. */\n onPointPress?: (point: StrengthTrendDataPoint) => void\n /** Unit for display and labels. */\n unit: 'lbs' | 'kg'\n /** Animate the left-to-right line draw on mount (default true). */\n animateOnMount?: boolean\n className?: string\n}\n\ninterface Coord {\n x: number\n y: number\n point: StrengthTrendDataPoint\n index: number\n}\n\ninterface Geometry {\n hasData: boolean\n toX: (time: number) => number\n toY: (value: number) => number\n actual: Coord[]\n projection: Coord[]\n gridLines: Array<{ y: number; label: string }>\n boundaries: Array<{ x: number; label: string }>\n}\n\nfunction timeOf(dateStr: string): number {\n const t = Date.parse(dateStr)\n return Number.isNaN(t) ? 0 : t\n}\n\nfunction formatValue(value: number): string {\n return `${Math.round(value)}`\n}\n\nfunction buildGeometry(\n data: StrengthTrendDataPoint[],\n projection: StrengthTrendDataPoint[],\n boundaries: StrengthTrendChartMesoBoundary[],\n width: number,\n height: number,\n): Geometry {\n const values = [...data, ...projection].map((p) => p.e1rm)\n // Empty state keys off actual data only: a projection with no measured\n // sessions still shows the placeholder rather than a \"Current: 0\" chart.\n if (data.length === 0) {\n return {\n hasData: false,\n toX: () => 0,\n toY: () => 0,\n actual: [],\n projection: [],\n gridLines: [],\n boundaries: [],\n }\n }\n\n const times = [\n ...data.map((p) => timeOf(p.date)),\n ...projection.map((p) => timeOf(p.date)),\n ...boundaries.map((b) => timeOf(b.date)),\n ]\n const tMin = Math.min(...times)\n const tMaxRaw = Math.max(...times)\n const tMax = tMaxRaw === tMin ? tMin + 1 : tMaxRaw\n\n const yMin = Math.min(...values)\n const yMax = Math.max(...values)\n const range = yMax - yMin || Math.max(1, yMax * 0.1)\n const padV = range * 0.15\n const domainMin = yMin - padV\n const domainMax = yMax + padV\n\n const innerW = Math.max(1, width - PLOT_LEFT)\n const toX = (time: number) =>\n PLOT_LEFT + ((time - tMin) / (tMax - tMin)) * innerW\n const toY = (value: number) =>\n height - ((value - domainMin) / (domainMax - domainMin)) * height\n\n const project = (points: StrengthTrendDataPoint[]): Coord[] =>\n points.map((point, index) => ({\n x: toX(timeOf(point.date)),\n y: toY(point.e1rm),\n point,\n index,\n }))\n\n const tickValues = Array.from(\n new Set([yMax, (yMin + yMax) / 2, yMin].map((v) => Math.round(v))),\n )\n const gridLines = tickValues.map((v) => ({ y: toY(v), label: formatValue(v) }))\n\n return {\n hasData: true,\n toX,\n toY,\n actual: project(data),\n projection: project(projection),\n gridLines,\n boundaries: boundaries.map((b) => ({\n x: toX(timeOf(b.date)),\n label: b.label,\n })),\n }\n}\n\nfunction computeTrend(\n data: StrengthTrendDataPoint[],\n boundaries: StrengthTrendChartMesoBoundary[],\n): { percent: number; positive: boolean } {\n if (data.length < 2) return { percent: 0, positive: true }\n let series = data\n if (boundaries.length > 0) {\n const lastBoundary = Math.max(...boundaries.map((b) => timeOf(b.date)))\n const filtered = data.filter((p) => timeOf(p.date) >= lastBoundary)\n // The pill is labelled \"this meso\"; if the current meso has <2 points\n // there is no meso trend to show — stay neutral rather than silently\n // reporting the whole-series change under a \"this meso\" label.\n if (filtered.length < 2) return { percent: 0, positive: true }\n series = filtered\n }\n const first = series[0].e1rm\n const last = series[series.length - 1].e1rm\n const percent = first ? ((last - first) / first) * 100 : 0\n return { percent, positive: percent >= 0 }\n}\n\nfunction ChartLine({\n coords,\n color,\n strokeWidth,\n dashed,\n testID,\n}: {\n coords: Coord[]\n color: string\n strokeWidth: number\n dashed?: boolean\n testID: string\n}) {\n return (\n <>\n {coords.map((c, i) => {\n if (i === 0) return null\n const prev = coords[i - 1]\n const dx = c.x - prev.x\n const dy = c.y - prev.y\n const length = Math.sqrt(dx * dx + dy * dy)\n const angle = Math.atan2(dy, dx) * (180 / Math.PI)\n return (\n <View\n key={`${testID}-${i}`}\n testID={testID}\n accessibilityElementsHidden\n style={[\n {\n position: 'absolute',\n left: prev.x,\n top: prev.y,\n width: length,\n transformOrigin: '0 0',\n transform: [{ rotate: `${angle}deg` }],\n },\n dashed\n ? {\n height: 0,\n borderTopWidth: strokeWidth,\n borderStyle: 'dashed',\n borderTopColor: color,\n }\n : {\n height: strokeWidth,\n borderRadius: strokeWidth / 2,\n backgroundColor: color,\n },\n ]}\n />\n )\n })}\n </>\n )\n}\n\n/**\n * Estimated-1RM line chart over time with an optional dashed plan-projection\n * line and PR star markers. Rendered entirely with absolutely-positioned\n * Views (no SVG), following the Sparkline approach. Tapping an actual point\n * opens a tooltip and fires `onPointPress`. A trend pill below the chart\n * summarizes the percentage change for the current mesocycle.\n *\n * @example\n * <StrengthTrendChart\n * data={[{ date: '2026-01-01', e1rm: 225 }, { date: '2026-02-01', e1rm: 245, isPR: true }]}\n * projection={[{ date: '2026-02-01', e1rm: 245 }, { date: '2026-03-01', e1rm: 260 }]}\n * width={320}\n * height={150}\n * unit=\"lbs\"\n * />\n */\nexport function StrengthTrendChart({\n data,\n projection = [],\n width,\n height,\n mesoBoundaries = [],\n onPointPress,\n unit,\n animateOnMount = true,\n className,\n ...props\n}: StrengthTrendChartProps) {\n const geometry = useMemo(\n () => buildGeometry(data, projection, mesoBoundaries, width, height),\n [data, projection, mesoBoundaries, width, height],\n )\n const trend = useMemo(\n () => computeTrend(data, mesoBoundaries),\n [data, mesoBoundaries],\n )\n\n const [reveal] = useState(() => new Animated.Value(animateOnMount ? 0 : 1))\n const [selected, setSelected] = useState<number | null>(null)\n\n useEffect(() => {\n if (!animateOnMount) return\n const animation = Animated.timing(reveal, {\n toValue: 1,\n duration: 600,\n easing: Easing.out(Easing.ease),\n useNativeDriver: false,\n })\n animation.start()\n return () => animation.stop()\n }, [animateOnMount, reveal])\n\n const current = data.length > 0 ? data[data.length - 1].e1rm : 0\n const trendSign = trend.percent >= 0 ? '+' : '-'\n const trendText = `${trendSign}${Math.abs(trend.percent).toFixed(1)}% this meso`\n const ariaLabel = geometry.hasData\n ? `Strength trend chart showing estimated one rep max over time. Current: ${formatValue(current)} ${unit}. Trend: ${trendSign}${Math.abs(trend.percent).toFixed(1)}%`\n : 'Strength trend chart, no data'\n\n if (!geometry.hasData) {\n return (\n <View\n style={{ width }}\n className={cn(className)}\n accessibilityRole=\"image\"\n accessibilityLabel={ariaLabel}\n testID=\"strength-trend-chart-empty\"\n {...props}\n >\n <View\n style={{\n width,\n height,\n alignItems: 'center',\n justifyContent: 'center',\n }}\n >\n <Text className=\"text-text-tertiary\" style={{ fontSize: 12, fontFamily: 'Inter, sans-serif' }}>\n No strength data yet\n </Text>\n </View>\n </View>\n )\n }\n\n const revealWidth = reveal.interpolate({\n inputRange: [0, 1],\n outputRange: [0, width],\n })\n\n const selectedCoord =\n selected != null ? geometry.actual[selected] : undefined\n\n return (\n <View\n style={{ width }}\n className={cn(className)}\n testID=\"strength-trend-chart\"\n {...props}\n >\n <View style={{ width, height, position: 'relative' }}>\n {/* Labelled, non-interactive chart canvas (grid + lines + markers). */}\n <View\n style={{ position: 'absolute', top: 0, left: 0, width, height }}\n accessibilityRole=\"image\"\n accessibilityLabel={ariaLabel}\n testID=\"strength-trend-chart-canvas\"\n >\n {geometry.gridLines.map((line, i) => (\n <View\n key={`grid-${i}`}\n accessibilityElementsHidden\n testID=\"strength-trend-chart-gridline\"\n style={{\n position: 'absolute',\n left: PLOT_LEFT,\n right: 0,\n top: line.y,\n height: 1,\n backgroundColor: GRID_LINE,\n }}\n >\n <Text\n className=\"text-text-tertiary\"\n style={{\n position: 'absolute',\n left: -PLOT_LEFT,\n top: -6,\n width: PLOT_LEFT - 4,\n textAlign: 'right',\n fontSize: 9,\n fontFamily: 'Inter, sans-serif',\n }}\n >\n {line.label}\n </Text>\n </View>\n ))}\n\n {geometry.boundaries.map((boundary, i) => (\n <View\n key={`boundary-${i}`}\n accessibilityElementsHidden\n testID=\"strength-trend-chart-meso-boundary\"\n style={{\n position: 'absolute',\n left: boundary.x,\n top: 0,\n width: 0,\n height,\n borderLeftWidth: 1,\n borderStyle: 'dashed',\n borderLeftColor: 'rgba(255,255,255,0.10)',\n }}\n />\n ))}\n\n <Animated.View\n style={{\n position: 'absolute',\n top: 0,\n left: 0,\n width: revealWidth,\n height,\n overflow: 'hidden',\n }}\n testID=\"strength-trend-chart-reveal\"\n >\n <View style={{ width, height, position: 'absolute', top: 0, left: 0 }}>\n <ChartLine\n coords={geometry.projection}\n color={PROJECTION_LINE_COLOR}\n strokeWidth={2}\n dashed\n testID=\"strength-trend-chart-projection-segment\"\n />\n <ChartLine\n coords={geometry.actual}\n color={BRAND_PRIMARY}\n strokeWidth={2.5}\n testID=\"strength-trend-chart-actual-segment\"\n />\n </View>\n </Animated.View>\n\n {geometry.actual.map((c) =>\n c.point.isPR ? (\n <Text\n key={`star-${c.index}`}\n accessibilityElementsHidden\n testID=\"strength-trend-chart-pr-star\"\n style={{\n position: 'absolute',\n left: c.x - 7,\n top: c.y - 20,\n fontSize: 12,\n color: STATUS_WARNING,\n }}\n >\n ★\n </Text>\n ) : null,\n )}\n </View>\n\n {/* Interactive point overlay (kept out of the image-role canvas). */}\n <View\n style={{ position: 'absolute', top: 0, left: 0, width, height }}\n testID=\"strength-trend-chart-points\"\n >\n {geometry.actual.map((c) => {\n const label = c.point.sessionLabel ?? c.point.date\n return (\n <Pressable\n key={`point-${c.index}`}\n testID=\"strength-trend-chart-point\"\n accessibilityRole=\"button\"\n accessibilityLabel={`${label}: ${formatValue(c.point.e1rm)} ${unit}${c.point.isPR ? ', personal record' : ''}`}\n onPress={() => {\n setSelected(c.index)\n onPointPress?.(c.point)\n }}\n style={{\n position: 'absolute',\n left: c.x - 4,\n top: c.y - 4,\n width: 8,\n height: 8,\n borderRadius: 1,\n backgroundColor: BRAND_PRIMARY,\n }}\n />\n )\n })}\n </View>\n\n {selectedCoord && (\n <View\n testID=\"strength-trend-chart-tooltip\"\n accessibilityElementsHidden\n className=\"bg-surface-elevated border-hairline-strong\"\n style={{\n position: 'absolute',\n left: Math.max(\n 0,\n Math.min(width - TOOLTIP_WIDTH, selectedCoord.x - TOOLTIP_WIDTH / 2),\n ),\n top: Math.max(0, selectedCoord.y - 52),\n maxWidth: TOOLTIP_WIDTH,\n borderWidth: 1,\n borderRadius: 8,\n paddingVertical: 8,\n paddingHorizontal: 10,\n }}\n >\n <Text\n className=\"text-text-tertiary\"\n style={{\n fontSize: 10,\n fontFamily: 'Inter, sans-serif',\n }}\n >\n {selectedCoord.point.sessionLabel ?? selectedCoord.point.date}\n </Text>\n <Text\n className=\"text-text-primary\"\n style={{\n marginTop: 2,\n fontSize: 13,\n fontFamily: 'Inter, sans-serif',\n fontWeight: '700',\n }}\n >\n {`${formatValue(selectedCoord.point.e1rm)} ${unit}`}\n </Text>\n {selected != null && selected > 0 && (\n <Text\n style={{\n marginTop: 1,\n fontSize: 10,\n fontFamily: 'Inter, sans-serif',\n color:\n selectedCoord.point.e1rm - geometry.actual[selected - 1].point.e1rm >= 0\n ? STATUS_SUCCESS\n : STATUS_ERROR,\n }}\n >\n {`${\n selectedCoord.point.e1rm - geometry.actual[selected - 1].point.e1rm >= 0\n ? '+'\n : '-'\n }${Math.abs(\n selectedCoord.point.e1rm - geometry.actual[selected - 1].point.e1rm,\n ).toFixed(1)} ${unit}`}\n </Text>\n )}\n </View>\n )}\n </View>\n\n {/* Meso boundary x-axis labels. */}\n {geometry.boundaries.length > 0 && (\n <View\n style={{ width, height: 14, position: 'relative', marginTop: 2 }}\n accessibilityElementsHidden\n testID=\"strength-trend-chart-axis\"\n >\n {geometry.boundaries.map((boundary, i) => (\n <Text\n key={`axis-${i}`}\n testID=\"strength-trend-chart-axis-label\"\n className=\"text-text-tertiary\"\n style={{\n position: 'absolute',\n left: boundary.x - 24,\n width: 48,\n textAlign: 'center',\n fontSize: 10,\n fontFamily: 'Inter, sans-serif',\n }}\n >\n {boundary.label}\n </Text>\n ))}\n </View>\n )}\n\n {/* Trend pill. */}\n <View className=\"flex-row\" style={{ marginTop: 8 }}>\n <View\n testID=\"strength-trend-chart-trend-pill\"\n accessibilityLabel={`Strength trend: ${trendText}`}\n style={{\n paddingVertical: 3,\n paddingHorizontal: 8,\n borderRadius: 4,\n borderWidth: 1,\n backgroundColor: trend.positive ? SUCCESS_PILL_BG : ERROR_PILL_BG,\n borderColor: trend.positive ? SUCCESS_PILL_BORDER : ERROR_PILL_BORDER,\n }}\n >\n <Text\n style={{\n fontSize: 11,\n fontFamily: 'Inter, sans-serif',\n fontWeight: '600',\n color: trend.positive ? STATUS_SUCCESS : STATUS_ERROR,\n }}\n >\n {trendText}\n </Text>\n </View>\n </View>\n\n {/* Legend. */}\n <View\n className=\"flex-row items-center\"\n style={{ marginTop: 8, gap: 14 }}\n testID=\"strength-trend-chart-legend\"\n >\n <View className=\"flex-row items-center\" style={{ gap: 5 }}>\n <View style={{ width: 14, height: 2.5, borderRadius: 1.5, backgroundColor: BRAND_PRIMARY }} />\n <Text className=\"text-text-secondary\" style={{ fontSize: 10, fontFamily: 'Inter, sans-serif' }}>\n Actual\n </Text>\n </View>\n <View className=\"flex-row items-center\" style={{ gap: 5 }}>\n <View\n style={{\n width: 14,\n height: 0,\n borderTopWidth: 2,\n borderStyle: 'dashed',\n borderTopColor: PROJECTION_LINE_COLOR,\n }}\n />\n <Text className=\"text-text-secondary\" style={{ fontSize: 10, fontFamily: 'Inter, sans-serif' }}>\n Projected\n </Text>\n </View>\n <View className=\"flex-row items-center\" style={{ gap: 5 }}>\n <Text style={{ fontSize: 12, color: STATUS_WARNING }}>★</Text>\n <Text className=\"text-text-secondary\" style={{ fontSize: 10, fontFamily: 'Inter, sans-serif' }}>\n PR\n </Text>\n </View>\n </View>\n </View>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { useEffect, useState, useMemo } from 'react'\nimport { View, Text, Pressable, Animated, Easing, type ViewProps } from 'react-native'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\n\nconst t = getSemanticColors('dark')\n\nconst STATUS_SUCCESS = t['status-success']\nconst STATUS_WARNING = t['status-warning']\nconst STATUS_INFO = t['status-info']\n/** Dot outline: near-white ring so load dots read on the band fill and any\n * surface (matches the MesoStatusCard gauge-marker convention). */\nconst DOT_BORDER = '#F3F4F6'\nconst BAND_FILL = 'rgba(46,213,115,0.1)'\nconst BAND_EDGE = 'rgba(46,213,115,0.45)'\nconst PROJECTION_FILL = 'rgba(46,213,115,0.05)'\n\nconst PADDING_LEFT = 28\nconst PADDING_RIGHT = 10\nconst PADDING_TOP = 8\nconst PADDING_BOTTOM = 16\nconst COLUMN_STEP = 4\nconst DOT_SIZE = 8\n\nexport type WorkoutDotStatus = 'within' | 'above' | 'below'\n\nexport interface CapacityBandDataPoint {\n /** ISO-ish date string (e.g. \"2026-06-01\"). */\n date: string\n /** Lower bound of the capacity band (MEV equivalent). */\n bandLow: number\n /** Upper bound of the capacity band (MRV equivalent). */\n bandHigh: number\n}\n\nexport interface WorkoutDot {\n date: string\n /** Actual session load score. */\n load: number\n /** Position of the session relative to the band. */\n status: WorkoutDotStatus\n}\n\nexport interface CapacityBandProjection {\n /** Band shape over the next days if training continues (rises). */\n withTraining: CapacityBandDataPoint[]\n /** Band shape over the next days if resting (drops). */\n withRest: CapacityBandDataPoint[]\n}\n\nexport interface CapacityBandChartProps extends ViewProps {\n /** Capacity band shape over time. */\n band: CapacityBandDataPoint[]\n /** Workout sessions plotted as dots. */\n workouts: WorkoutDot[]\n /** Optional forward projection (next few days). */\n projection?: CapacityBandProjection\n /** Chart width in px. */\n width: number\n /** Chart height in px. */\n height: number\n /** Called when a workout dot is tapped. */\n onWorkoutPress?: (workout: WorkoutDot) => void\n className?: string\n}\n\ninterface PixelPoint {\n x: number\n yHigh: number\n yLow: number\n}\n\nconst DOT_COLORS: Record<WorkoutDotStatus, string> = {\n within: STATUS_SUCCESS,\n above: STATUS_WARNING,\n below: STATUS_INFO,\n}\n\nconst STATUS_PHRASES: Record<WorkoutDotStatus, string> = {\n within: 'within range',\n above: 'above range',\n below: 'below range',\n}\n\nfunction parseTime(date: string): number {\n const parts = date.split('-')\n if (parts.length === 3) {\n return Date.UTC(Number(parts[0]), Number(parts[1]) - 1, Number(parts[2]))\n }\n const parsed = Date.parse(date)\n return Number.isNaN(parsed) ? 0 : parsed\n}\n\nfunction formatDate(date: string): string {\n const parts = date.split('-')\n if (parts.length === 3) return `${Number(parts[1])}/${Number(parts[2])}`\n const d = new Date(date)\n return Number.isNaN(d.getTime()) ? date : `${d.getMonth() + 1}/${d.getDate()}`\n}\n\nfunction toPixels(\n points: CapacityBandDataPoint[],\n toX: (date: string) => number,\n toY: (value: number) => number,\n): PixelPoint[] {\n return points\n .map((p) => ({ x: toX(p.date), yHigh: toY(p.bandHigh), yLow: toY(p.bandLow) }))\n .sort((a, b) => a.x - b.x)\n}\n\nfunction interpEdge(pixels: PixelPoint[], x: number, key: 'yHigh' | 'yLow'): number {\n for (let i = 0; i < pixels.length - 1; i++) {\n const a = pixels[i]\n const b = pixels[i + 1]\n if (x >= a.x && x <= b.x) {\n const t = b.x === a.x ? 0 : (x - a.x) / (b.x - a.x)\n return a[key] + t * (b[key] - a[key])\n }\n }\n return pixels[pixels.length - 1][key]\n}\n\nfunction buildColumns(pixels: PixelPoint[], step: number) {\n if (pixels.length < 2) return []\n const start = pixels[0].x\n const end = pixels[pixels.length - 1].x\n const columns: Array<{ x: number; top: number; height: number }> = []\n for (let x = start; x < end; x += step) {\n const top = interpEdge(pixels, x, 'yHigh')\n const bottom = interpEdge(pixels, x, 'yLow')\n columns.push({ x, top, height: Math.max(0, bottom - top) })\n }\n return columns\n}\n\nfunction buildEdges(pixels: PixelPoint[], key: 'yHigh' | 'yLow') {\n const segments: Array<{ left: number; top: number; length: number; angle: number }> = []\n for (let i = 1; i < pixels.length; i++) {\n const a = pixels[i - 1]\n const b = pixels[i]\n const dx = b.x - a.x\n const dy = b[key] - a[key]\n segments.push({\n left: a.x,\n top: a[key],\n length: Math.sqrt(dx * dx + dy * dy),\n angle: Math.atan2(dy, dx) * (180 / Math.PI),\n })\n }\n return segments\n}\n\nfunction collectValues(\n band: CapacityBandDataPoint[],\n workouts: WorkoutDot[],\n projection?: CapacityBandProjection,\n): number[] {\n const values: number[] = []\n band.forEach((p) => values.push(p.bandLow, p.bandHigh))\n workouts.forEach((w) => values.push(w.load))\n projection?.withTraining.forEach((p) => values.push(p.bandLow, p.bandHigh))\n projection?.withRest.forEach((p) => values.push(p.bandLow, p.bandHigh))\n return values\n}\n\nfunction currentStatus(workouts: WorkoutDot[]): string {\n if (workouts.length === 0) return 'no recent sessions'\n const latest = [...workouts].sort((a, b) => parseTime(b.date) - parseTime(a.date))[0]\n return STATUS_PHRASES[latest.status]\n}\n\n/**\n * Gentler-Streak-inspired fatigue visualization. Renders a shaded capacity\n * band (between a rolling MEV/MRV estimate), workout sessions as colored dots\n * positioned by load, and an optional dashed forward projection that diverges\n * for \"keep training\" (rises) versus \"rest\" (drops). View-based, no SVG:\n * the band fill is a run of vertical columns and the edges/projection are\n * rotated line Views (same technique as Sparkline).\n *\n * @example\n * <CapacityBandChart\n * band={band}\n * workouts={workouts}\n * projection={{ withTraining, withRest }}\n * width={320}\n * height={180}\n * onWorkoutPress={(w) => openSession(w)}\n * />\n */\nexport function CapacityBandChart({\n band,\n workouts,\n projection,\n width,\n height,\n onWorkoutPress,\n className,\n ...props\n}: CapacityBandChartProps) {\n const [reveal] = useState(() => new Animated.Value(0))\n const dotAnims = useMemo(\n () => Array.from({ length: workouts.length }, () => new Animated.Value(0)),\n [workouts.length],\n )\n\n useEffect(() => {\n reveal.setValue(0)\n dotAnims.forEach((a) => a.setValue(0))\n const draw = Animated.timing(reveal, {\n toValue: 1,\n duration: 800,\n easing: Easing.out(Easing.ease),\n useNativeDriver: false,\n })\n const pops = dotAnims.map((a) =>\n Animated.timing(a, {\n toValue: 1,\n duration: 200,\n easing: Easing.out(Easing.ease),\n useNativeDriver: false,\n }),\n )\n const animation = Animated.sequence([draw, Animated.stagger(200, pops)])\n animation.start()\n return () => animation.stop()\n }, [reveal, dotAnims, band.length, workouts.length])\n\n const plotWidth = width - PADDING_LEFT - PADDING_RIGHT\n const plotHeight = height - PADDING_TOP - PADDING_BOTTOM\n\n const scale = useMemo(() => {\n const times = band.map((p) => parseTime(p.date))\n projection?.withTraining.forEach((p) => times.push(parseTime(p.date)))\n projection?.withRest.forEach((p) => times.push(parseTime(p.date)))\n const minT = times.length ? Math.min(...times) : 0\n const maxT = times.length ? Math.max(...times) : 1\n const tRange = maxT - minT || 1\n\n const values = collectValues(band, workouts, projection)\n const minV = values.length ? Math.min(...values) : 0\n const maxV = values.length ? Math.max(...values) : 1\n const pad = (maxV - minV) * 0.1 || 1\n const domainMin = minV - pad\n const domainMax = maxV + pad\n const vRange = domainMax - domainMin || 1\n\n const toX = (date: string) =>\n PADDING_LEFT + ((parseTime(date) - minT) / tRange) * plotWidth\n const toY = (value: number) =>\n PADDING_TOP + (1 - (value - domainMin) / vRange) * plotHeight\n return { toX, toY }\n }, [band, workouts, projection, plotWidth, plotHeight])\n\n if (band.length === 0) {\n return (\n <View\n style={{ width, height }}\n className={className}\n accessibilityRole=\"image\"\n accessibilityLabel=\"Training capacity band chart, no data\"\n testID=\"capacity-band-chart-empty\"\n {...props}\n />\n )\n }\n\n const { toX, toY } = scale\n const bandPixels = toPixels(band, toX, toY)\n const columns = buildColumns(bandPixels, COLUMN_STEP)\n const topEdge = buildEdges(bandPixels, 'yHigh')\n const bottomEdge = buildEdges(bandPixels, 'yLow')\n\n const lastBandPoint = band[band.length - 1]\n const trainingPixels = projection\n ? toPixels([lastBandPoint, ...projection.withTraining], toX, toY)\n : []\n const restPixels = projection\n ? toPixels([lastBandPoint, ...projection.withRest], toX, toY)\n : []\n\n const labelStride = Math.max(1, Math.ceil(band.length / 5))\n const revealWidth = reveal.interpolate({ inputRange: [0, 1], outputRange: [0, width] })\n\n const renderColumns = (cols: ReturnType<typeof buildColumns>, color: string, key: string) =>\n cols.map((col, i) => (\n <View\n key={`${key}-${i}`}\n style={{\n position: 'absolute',\n left: col.x,\n top: col.top,\n width: COLUMN_STEP + 0.5,\n height: col.height,\n backgroundColor: color,\n }}\n accessibilityElementsHidden\n importantForAccessibility=\"no-hide-descendants\"\n testID={key}\n />\n ))\n\n const renderEdges = (\n segments: ReturnType<typeof buildEdges>,\n color: string,\n dashed: boolean,\n key: string,\n ) =>\n segments.map((seg, i) => (\n <View\n key={`${key}-${i}`}\n style={{\n position: 'absolute',\n left: seg.left,\n top: seg.top,\n width: seg.length,\n height: dashed ? 0 : 1.5,\n borderTopWidth: dashed ? 1 : 0,\n borderTopColor: dashed ? color : undefined,\n borderStyle: dashed ? 'dashed' : 'solid',\n backgroundColor: dashed ? undefined : color,\n opacity: dashed ? 0.7 : 1,\n transformOrigin: '0 0',\n transform: [{ rotate: `${seg.angle}deg` }],\n }}\n accessibilityElementsHidden\n importantForAccessibility=\"no-hide-descendants\"\n testID={key}\n />\n ))\n\n return (\n <View\n style={{ width, height, position: 'relative' }}\n className={className}\n testID=\"capacity-band-chart-root\"\n {...props}\n >\n {/* Static visual layer carries the image role; interactive dots live as\n siblings so the image role has no focusable descendants. */}\n <View\n style={{ position: 'absolute', top: 0, left: 0, width, height }}\n accessibilityRole=\"image\"\n accessibilityLabel={`Training capacity band chart. Current capacity: ${currentStatus(\n workouts,\n )}. ${workouts.length} workout${workouts.length === 1 ? '' : 's'} shown.`}\n testID=\"capacity-band-chart\"\n >\n {/* Band + projection draw left-to-right via an animated clip. */}\n <Animated.View\n style={{ position: 'absolute', top: 0, left: 0, height, width: revealWidth, overflow: 'hidden' }}\n accessibilityElementsHidden\n importantForAccessibility=\"no-hide-descendants\"\n testID=\"capacity-band-chart-reveal\"\n >\n <View style={{ width, height, position: 'relative' }}>\n {projection && (\n <View testID=\"capacity-band-chart-projection\">\n {renderColumns(buildColumns(trainingPixels, COLUMN_STEP), PROJECTION_FILL, 'capacity-band-chart-projection-fill')}\n {renderColumns(buildColumns(restPixels, COLUMN_STEP), PROJECTION_FILL, 'capacity-band-chart-projection-fill')}\n {renderEdges(buildEdges(trainingPixels, 'yHigh'), STATUS_SUCCESS, true, 'capacity-band-chart-projection-training')}\n {renderEdges(buildEdges(trainingPixels, 'yLow'), STATUS_SUCCESS, true, 'capacity-band-chart-projection-training')}\n {renderEdges(buildEdges(restPixels, 'yHigh'), STATUS_INFO, true, 'capacity-band-chart-projection-rest')}\n {renderEdges(buildEdges(restPixels, 'yLow'), STATUS_INFO, true, 'capacity-band-chart-projection-rest')}\n <Text\n style={{\n position: 'absolute',\n left: trainingPixels[trainingPixels.length - 1]?.x + 2,\n top: trainingPixels[trainingPixels.length - 1]?.yHigh - 12,\n fontSize: 9,\n fontFamily: 'Inter, sans-serif',\n color: STATUS_SUCCESS,\n }}\n testID=\"capacity-band-chart-projection-training-label\"\n >\n Training\n </Text>\n <Text\n style={{\n position: 'absolute',\n left: restPixels[restPixels.length - 1]?.x + 2,\n top: restPixels[restPixels.length - 1]?.yLow + 2,\n fontSize: 9,\n fontFamily: 'Inter, sans-serif',\n color: STATUS_INFO,\n }}\n testID=\"capacity-band-chart-projection-rest-label\"\n >\n Rest\n </Text>\n </View>\n )}\n\n <View testID=\"capacity-band-chart-band\">\n {renderColumns(columns, BAND_FILL, 'capacity-band-chart-band-cell')}\n </View>\n {renderEdges(topEdge, BAND_EDGE, false, 'capacity-band-chart-edge-top')}\n {renderEdges(bottomEdge, BAND_EDGE, false, 'capacity-band-chart-edge-bottom')}\n </View>\n </Animated.View>\n\n {/* Y axis conceptual label (no numbers). */}\n <Text\n className=\"text-text-tertiary\"\n style={{\n position: 'absolute',\n left: PADDING_LEFT / 2 - 14,\n top: PADDING_TOP + plotHeight / 2 - 7,\n width: 32,\n textAlign: 'center',\n fontSize: 9,\n fontFamily: 'Inter, sans-serif',\n transform: [{ rotate: '-90deg' }],\n }}\n accessibilityElementsHidden\n importantForAccessibility=\"no-hide-descendants\"\n testID=\"capacity-band-chart-y-axis-label\"\n >\n Load\n </Text>\n\n {/* X axis date labels (subset to avoid overlap). */}\n {band.map((point, i) => {\n if (i % labelStride !== 0 && i !== band.length - 1) return null\n return (\n <Text\n key={`x-${point.date}`}\n className=\"text-text-tertiary\"\n style={{\n position: 'absolute',\n left: toX(point.date) - 14,\n top: height - PADDING_BOTTOM + 2,\n width: 28,\n textAlign: 'center',\n fontSize: 10,\n fontFamily: 'Inter, sans-serif',\n }}\n accessibilityElementsHidden\n importantForAccessibility=\"no-hide-descendants\"\n testID=\"capacity-band-chart-x-label\"\n >\n {formatDate(point.date)}\n </Text>\n )\n })}\n </View>\n\n {/* Workout dots — scale in after the band draws. */}\n {workouts.map((workout, i) => {\n const cx = toX(workout.date)\n const cy = toY(workout.load)\n const color = DOT_COLORS[workout.status]\n const dotStyle = {\n width: DOT_SIZE,\n height: DOT_SIZE,\n borderRadius: DOT_SIZE / 2,\n backgroundColor: color,\n borderWidth: 2,\n borderColor: DOT_BORDER,\n }\n const label = `Workout on ${formatDate(workout.date)}, load ${workout.load}, ${\n STATUS_PHRASES[workout.status]\n }`\n return (\n <Animated.View\n key={`dot-${workout.date}-${i}`}\n style={{\n position: 'absolute',\n left: cx - DOT_SIZE / 2,\n top: cy - DOT_SIZE / 2,\n transform: [{ scale: dotAnims[i] ?? 1 }],\n }}\n testID=\"capacity-band-chart-dot-wrapper\"\n >\n {onWorkoutPress ? (\n <Pressable\n onPress={() => onWorkoutPress(workout)}\n accessibilityRole=\"button\"\n accessibilityLabel={label}\n style={dotStyle}\n testID=\"capacity-band-chart-dot\"\n />\n ) : (\n <View\n accessibilityElementsHidden\n importantForAccessibility=\"no-hide-descendants\"\n style={dotStyle}\n testID=\"capacity-band-chart-dot\"\n />\n )}\n </Animated.View>\n )\n })}\n </View>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { useMemo, useState } from 'react'\nimport { View, Text, Pressable, type ViewProps } from 'react-native'\nimport { MesoStatusCard, type MesoStatusCardProps } from './MesoStatusCard'\nimport {\n StrengthTrendChart,\n type StrengthTrendDataPoint,\n type StrengthTrendChartMesoBoundary,\n} from './StrengthTrendChart'\nimport {\n CapacityBandChart,\n type CapacityBandDataPoint,\n type CapacityBandProjection,\n type WorkoutDot,\n} from './CapacityBandChart'\nimport { ExerciseCard, type ExerciseCardProps } from './ExerciseCard'\nimport { type SetRowProps } from './SetRow'\nimport {\n VelocityStrip,\n calculateMeanVelocity,\n calculateVelocityLoss,\n type VelocityZoneBandProp,\n} from './VelocityStrip'\nimport { resolveColor } from '../../../theme/resolve-color'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\nimport { cn } from '../../../utils/cn'\n\nconst BRAND_PRIMARY = getSemanticColors('dark')['brand-primary']\n\n/** Inner plot width: page width 390 − 16 page padding − 12 card padding on each side. */\nconst CHART_WIDTH = 326\nconst CHART_HEIGHT = 150\n\n/** Which tab of the exercise detail view is showing. */\nexport type ExerciseDetailTab = 'progress' | 'history' | 'advanced'\n\n/** Tabs in display order. */\nexport const EXERCISE_DETAIL_TABS: Array<{ key: ExerciseDetailTab; label: string }> = [\n { key: 'progress', label: 'Progress' },\n { key: 'history', label: 'History' },\n { key: 'advanced', label: 'Advanced' },\n]\n\n/** Identity + headline stats for the exercise being inspected. */\nexport interface ExerciseDetailHeader {\n /** Exercise name, e.g. \"Barbell Bench Press\". */\n name: string\n /** Context line, e.g. \"Chest · Barbell\". */\n subtitle: string\n /** Unit used across the page. */\n unit: 'lbs' | 'kg'\n /** Current estimated one-rep max, shown as a header pill. */\n currentE1rm?: number\n}\n\n/**\n * A single expandable entry — one progression week or one logged session.\n * Projected onto an `ExerciseCard`, so it collapses to a summary and expands\n * to its `SetRow` breakdown.\n */\nexport interface ExerciseDetailEntry {\n /** Stable id for inline-expansion selection. */\n id: string\n /** Row title, e.g. \"Week 3\" or \"Mon, Jun 16\". */\n title: string\n /** Collapsed summary (sets × reps @ weight). */\n summary?: ExerciseCardProps['summary']\n /** Estimated one-rep max, feeding the page's best-e1RM stat. */\n e1rm?: { value: number; unit: 'lbs' | 'kg' }\n /** Flags a personal-record entry. */\n isPR?: boolean\n /** Prescribed tempo, revealed when expanded. */\n tempo?: ExerciseCardProps['tempo']\n /** Per-set breakdown revealed when expanded. */\n sets: SetRowProps[]\n}\n\n/** Strength-trend inputs for the Progress tab chart. */\nexport interface ExerciseTrend {\n /** Measured e1RM data points, chronological. */\n data: StrengthTrendDataPoint[]\n /** Planned/projected trajectory (dashed line). */\n projection?: StrengthTrendDataPoint[]\n /** Mesocycle boundary guides. */\n mesoBoundaries?: StrengthTrendChartMesoBoundary[]\n}\n\n/** One set's velocity trace for the Advanced tab breakdown. */\nexport interface ExerciseVbtSet {\n /** Row label, e.g. \"Set 1\". */\n label: string\n /** Per-rep mean concentric velocities (m/s). */\n velocities: number[]\n}\n\n/** Velocity-based-training inputs for the Advanced tab. */\nexport interface ExerciseVbt {\n /** Capacity band shape over time. */\n band: CapacityBandDataPoint[]\n /** Sessions plotted against the band. */\n workouts: WorkoutDot[]\n /** Optional forward band projection. */\n projection?: CapacityBandProjection\n /** Per-set velocity traces for the most recent session. */\n sets: ExerciseVbtSet[]\n /** Optional velocity-zone bands for this exercise (WA `VelocityZones.bands`). */\n zones?: readonly VelocityZoneBandProp[]\n}\n\n/** Page-level roll-up of the logged sessions. */\nexport interface ExerciseDetailStats {\n /** Number of logged sessions. */\n sessions: number\n /** Best estimated one-rep max seen, or null if none recorded. */\n bestE1rm: number | null\n /** Count of PR entries. */\n prCount: number\n}\n\n/** Aggregate velocity readout for the Advanced tab. */\nexport interface VbtSummary {\n /** Mean concentric velocity across every logged rep. */\n meanVelocity: number\n /** Worst within-set velocity loss (%), i.e. the most-fatigued set. */\n velocityLoss: number\n}\n\nexport interface ExerciseDetailPageProps extends ViewProps {\n /** Exercise identity + headline stats. */\n exercise: ExerciseDetailHeader\n /** Mesocycle context banner (Progress tab). */\n meso: MesoStatusCardProps\n /** Strength trend inputs (Progress tab). */\n trend: ExerciseTrend\n /** Week-by-week progression entries (Progress tab). */\n progression: ExerciseDetailEntry[]\n /** All logged sessions (History tab). */\n history: ExerciseDetailEntry[]\n /** Velocity-based-training inputs (Advanced tab). */\n vbt: ExerciseVbt\n className?: string\n}\n\n/** Roll up logged sessions into the page summary (pure, testable). */\nexport function deriveExerciseStats(entries: ExerciseDetailEntry[]): ExerciseDetailStats {\n let bestE1rm: number | null = null\n let prCount = 0\n for (const entry of entries) {\n if (entry.e1rm != null && (bestE1rm == null || entry.e1rm.value > bestE1rm)) {\n bestE1rm = entry.e1rm.value\n }\n if (entry.isPR) prCount += 1\n }\n return { sessions: entries.length, bestE1rm, prCount }\n}\n\n/** Project an entry onto ExerciseCard props, wiring inline expansion (pure). */\nexport function toExerciseCardProps(\n entry: ExerciseDetailEntry,\n expanded: boolean,\n onToggle: () => void\n): ExerciseCardProps {\n return {\n name: entry.title,\n expanded,\n onExpandedChange: onToggle,\n summary: entry.summary,\n isPR: entry.isPR,\n tempo: entry.tempo,\n sets: expanded ? entry.sets : undefined,\n }\n}\n\n/** Aggregate per-set velocity traces into the Advanced readout (pure). */\nexport function summarizeVbt(sets: ExerciseVbtSet[]): VbtSummary {\n const allReps = sets.flatMap((set) => set.velocities)\n const meanVelocity = calculateMeanVelocity(allReps)\n let velocityLoss = 0\n for (const set of sets) {\n velocityLoss = Math.max(velocityLoss, calculateVelocityLoss(set.velocities))\n }\n return { meanVelocity, velocityLoss }\n}\n\ninterface TabBarProps {\n active: ExerciseDetailTab\n onSelect: (tab: ExerciseDetailTab) => void\n}\n\nfunction TabBar({ active, onSelect }: TabBarProps) {\n return (\n <View\n className=\"flex-row\"\n style={{\n borderBottomWidth: 1,\n borderBottomColor: resolveColor('hairline-default'),\n }}\n accessibilityRole={'tablist' as ViewProps['accessibilityRole']}\n testID=\"exercise-detail-page-tabs\"\n >\n {EXERCISE_DETAIL_TABS.map(({ key, label }) => {\n const isActive = key === active\n return (\n <Pressable\n key={key}\n onPress={() => onSelect(key)}\n accessibilityRole=\"tab\"\n accessibilityState={{ selected: isActive }}\n style={{\n flex: 1,\n alignItems: 'center',\n paddingVertical: 10,\n borderBottomWidth: 2,\n borderBottomColor: isActive ? BRAND_PRIMARY : 'transparent',\n }}\n testID={`exercise-detail-page-tab-${key}`}\n >\n <Text\n className={isActive ? 'text-text-primary' : 'text-text-tertiary'}\n style={{\n fontSize: 13,\n fontFamily: 'Inter, sans-serif',\n fontWeight: isActive ? '700' : '500',\n }}\n >\n {label}\n </Text>\n </Pressable>\n )\n })}\n </View>\n )\n}\n\nconst STAT_CARDS: Array<{ key: keyof ExerciseDetailStats; label: string }> = [\n { key: 'sessions', label: 'Sessions' },\n { key: 'bestE1rm', label: 'Best e1RM' },\n { key: 'prCount', label: 'PRs' },\n]\n\nfunction StatStrip({ stats, unit }: { stats: ExerciseDetailStats; unit: 'lbs' | 'kg' }) {\n return (\n <View className=\"flex-row\" style={{ gap: 8 }} testID=\"exercise-detail-page-stats\">\n {STAT_CARDS.map(({ key, label }) => {\n const raw = stats[key]\n const value = key === 'bestE1rm' ? (raw == null ? '—' : `${raw} ${unit}`) : `${raw}`\n return (\n <View\n key={key}\n className=\"bg-surface-elevated border-hairline\"\n style={{\n flex: 1,\n padding: 12,\n borderRadius: 10,\n borderWidth: 1,\n }}\n testID={`exercise-detail-page-stat-${key}`}\n >\n <Text\n className=\"text-text-primary\"\n style={{\n fontSize: 18,\n fontFamily: '\"Space Grotesk\", sans-serif',\n fontWeight: '700',\n }}\n >\n {value}\n </Text>\n <Text\n className=\"text-text-tertiary\"\n style={{\n marginTop: 2,\n fontSize: 10,\n fontFamily: 'Inter, sans-serif',\n fontWeight: '600',\n letterSpacing: 0.4,\n textTransform: 'uppercase',\n }}\n >\n {label}\n </Text>\n </View>\n )\n })}\n </View>\n )\n}\n\nfunction SectionCard({\n title,\n children,\n testID,\n}: {\n title: string\n children: React.ReactNode\n testID: string\n}) {\n return (\n <View\n className=\"bg-surface-elevated border-hairline\"\n style={{\n borderWidth: 1,\n borderRadius: 12,\n padding: 12,\n gap: 10,\n }}\n testID={testID}\n >\n <Text\n className=\"text-text-tertiary\"\n style={{\n fontSize: 11,\n fontFamily: 'Inter, sans-serif',\n fontWeight: '600',\n letterSpacing: 0.6,\n textTransform: 'uppercase',\n }}\n >\n {title}\n </Text>\n {children}\n </View>\n )\n}\n\ninterface EntryListProps {\n entries: ExerciseDetailEntry[]\n expandedId: string | null\n onToggle: (id: string) => void\n emptyLabel: string\n testID: string\n}\n\nfunction EntryList({ entries, expandedId, onToggle, emptyLabel, testID }: EntryListProps) {\n if (entries.length === 0) {\n return (\n <Text\n className=\"text-text-tertiary\"\n style={{ fontSize: 12, fontFamily: 'Inter, sans-serif' }}\n testID={`${testID}-empty`}\n >\n {emptyLabel}\n </Text>\n )\n }\n return (\n <View style={{ gap: 8 }} testID={testID}>\n {entries.map((entry) => (\n <ExerciseCard\n key={entry.id}\n {...toExerciseCardProps(entry, entry.id === expandedId, () => onToggle(entry.id))}\n />\n ))}\n </View>\n )\n}\n\nfunction VbtBreakdown({\n sets,\n zones,\n}: {\n sets: ExerciseVbtSet[]\n zones?: readonly VelocityZoneBandProp[]\n}) {\n return (\n <View style={{ gap: 10 }} testID=\"exercise-detail-page-vbt-breakdown\">\n {sets.map((set) => {\n const mean = calculateMeanVelocity(set.velocities)\n const loss = calculateVelocityLoss(set.velocities)\n return (\n <View\n key={set.label}\n className=\"flex-row items-center\"\n style={{ gap: 10 }}\n testID=\"exercise-detail-page-vbt-set\"\n >\n <Text\n className=\"text-text-secondary\"\n style={{\n width: 44,\n fontSize: 11,\n fontFamily: 'Inter, sans-serif',\n fontWeight: '600',\n }}\n >\n {set.label}\n </Text>\n <View className=\"flex-1\" style={{ height: 8, justifyContent: 'center' }}>\n <VelocityStrip\n velocities={set.velocities}\n zones={zones}\n variant=\"compact\"\n height={8}\n hideBaseline\n />\n </View>\n <Text\n className=\"text-text-tertiary\"\n style={{\n fontSize: 11,\n fontFamily: 'Inter, sans-serif',\n fontVariant: ['tabular-nums'],\n }}\n >\n {`${mean.toFixed(2)} · -${loss}%`}\n </Text>\n </View>\n )\n })}\n </View>\n )\n}\n\nfunction VbtSummaryRow({ summary }: { summary: VbtSummary }) {\n const cells = [\n { label: 'Mean Velocity', value: `${summary.meanVelocity.toFixed(2)} m/s` },\n { label: 'Peak Vel. Loss', value: `-${summary.velocityLoss}%` },\n ]\n return (\n <View className=\"flex-row\" style={{ gap: 8 }} testID=\"exercise-detail-page-vbt-summary\">\n {cells.map((cell) => (\n <View\n key={cell.label}\n className=\"bg-surface-elevated border-hairline\"\n style={{\n flex: 1,\n padding: 12,\n borderRadius: 10,\n borderWidth: 1,\n }}\n >\n <Text\n className=\"text-text-primary\"\n style={{\n fontSize: 16,\n fontFamily: '\"Space Grotesk\", sans-serif',\n fontWeight: '700',\n }}\n >\n {cell.value}\n </Text>\n <Text\n className=\"text-text-tertiary\"\n style={{\n marginTop: 2,\n fontSize: 10,\n fontFamily: 'Inter, sans-serif',\n fontWeight: '600',\n letterSpacing: 0.4,\n textTransform: 'uppercase',\n }}\n >\n {cell.label}\n </Text>\n </View>\n ))}\n </View>\n )\n}\n\n/**\n * ExerciseDetailPage — a tabbed per-exercise view. A shared header (name,\n * context line, current e1RM pill) sits above a Progress / History / Advanced\n * tab bar. Progress composes the `MesoStatusCard` context banner, a stats\n * strip, a `StrengthTrendChart`, and a week-by-week progression list with\n * inline `ExerciseCard` expansion. History lists every logged session with the\n * same inline expansion. Advanced surfaces VBT data via a `CapacityBandChart`,\n * a velocity summary, and a per-set `VelocityStrip` breakdown. Tab and\n * per-list expansion are page-level state; children keep their own styles.\n *\n * @example\n * <ExerciseDetailPage\n * exercise={exercise}\n * meso={meso}\n * trend={trend}\n * progression={progression}\n * history={history}\n * vbt={vbt}\n * />\n */\nexport function ExerciseDetailPage({\n exercise,\n meso,\n trend,\n progression,\n history,\n vbt,\n className,\n ...props\n}: ExerciseDetailPageProps) {\n const [tab, setTab] = useState<ExerciseDetailTab>('progress')\n const [expandedProgressId, setExpandedProgressId] = useState<string | null>(null)\n const [expandedHistoryId, setExpandedHistoryId] = useState<string | null>(null)\n\n const stats = useMemo(() => deriveExerciseStats(history), [history])\n const vbtSummary = useMemo(() => summarizeVbt(vbt.sets), [vbt.sets])\n\n const toggle =\n (setId: (updater: (current: string | null) => string | null) => void) => (id: string) =>\n setId((current) => (current === id ? null : id))\n\n return (\n <View\n className={cn('bg-background-base', className)}\n style={{ width: 390 }}\n accessibilityRole={'main' as ViewProps['accessibilityRole']}\n aria-label={exercise.name}\n testID=\"exercise-detail-page\"\n {...props}\n >\n <View style={{ padding: 16, gap: 14 }} testID=\"exercise-detail-page-content\">\n <View\n className=\"flex-row items-start justify-between\"\n style={{ gap: 8 }}\n testID=\"exercise-detail-page-header\"\n >\n <View style={{ flexShrink: 1 }}>\n <Text\n accessibilityRole=\"header\"\n className=\"text-text-primary\"\n style={{\n fontSize: 20,\n fontFamily: '\"Space Grotesk\", sans-serif',\n fontWeight: '700',\n }}\n testID=\"exercise-detail-page-title\"\n >\n {exercise.name}\n </Text>\n <Text\n className=\"text-text-secondary\"\n style={{\n marginTop: 2,\n fontSize: 12,\n fontFamily: 'Inter, sans-serif',\n }}\n testID=\"exercise-detail-page-subtitle\"\n >\n {exercise.subtitle}\n </Text>\n </View>\n {exercise.currentE1rm != null && (\n <View\n style={{\n paddingVertical: 4,\n paddingHorizontal: 10,\n borderRadius: 6,\n backgroundColor: 'rgba(255,121,0,0.10)',\n borderWidth: 1,\n borderColor: 'rgba(255,121,0,0.25)',\n }}\n testID=\"exercise-detail-page-e1rm\"\n >\n <Text\n className=\"text-text-tertiary\"\n style={{\n fontSize: 9,\n fontFamily: 'Inter, sans-serif',\n fontWeight: '600',\n letterSpacing: 0.4,\n textTransform: 'uppercase',\n }}\n >\n e1RM\n </Text>\n <Text\n style={{\n fontSize: 15,\n fontFamily: '\"Space Grotesk\", sans-serif',\n fontWeight: '700',\n color: BRAND_PRIMARY,\n }}\n >\n {`${exercise.currentE1rm} ${exercise.unit}`}\n </Text>\n </View>\n )}\n </View>\n\n <TabBar active={tab} onSelect={setTab} />\n\n {tab === 'progress' && (\n <View style={{ gap: 14 }} testID=\"exercise-detail-page-panel-progress\">\n <MesoStatusCard {...meso} />\n <StatStrip stats={stats} unit={exercise.unit} />\n <SectionCard title=\"Strength Trend\" testID=\"exercise-detail-page-trend\">\n <StrengthTrendChart\n data={trend.data}\n projection={trend.projection}\n mesoBoundaries={trend.mesoBoundaries}\n width={CHART_WIDTH}\n height={CHART_HEIGHT}\n unit={exercise.unit}\n animateOnMount={false}\n />\n </SectionCard>\n <SectionCard title=\"Week-by-Week\" testID=\"exercise-detail-page-progression\">\n <EntryList\n entries={progression}\n expandedId={expandedProgressId}\n onToggle={toggle(setExpandedProgressId)}\n emptyLabel=\"No progression logged yet\"\n testID=\"exercise-detail-page-progression-list\"\n />\n </SectionCard>\n </View>\n )}\n\n {tab === 'history' && (\n <View style={{ gap: 14 }} testID=\"exercise-detail-page-panel-history\">\n <SectionCard title=\"All Sessions\" testID=\"exercise-detail-page-history\">\n <EntryList\n entries={history}\n expandedId={expandedHistoryId}\n onToggle={toggle(setExpandedHistoryId)}\n emptyLabel=\"No sessions logged yet\"\n testID=\"exercise-detail-page-history-list\"\n />\n </SectionCard>\n </View>\n )}\n\n {tab === 'advanced' && (\n <View style={{ gap: 14 }} testID=\"exercise-detail-page-panel-advanced\">\n <SectionCard title=\"Capacity Band\" testID=\"exercise-detail-page-capacity\">\n <CapacityBandChart\n band={vbt.band}\n workouts={vbt.workouts}\n projection={vbt.projection}\n width={CHART_WIDTH}\n height={CHART_HEIGHT}\n />\n </SectionCard>\n <VbtSummaryRow summary={vbtSummary} />\n <SectionCard title=\"Velocity Breakdown\" testID=\"exercise-detail-page-velocity\">\n <VbtBreakdown sets={vbt.sets} zones={vbt.zones} />\n </SectionCard>\n </View>\n )}\n </View>\n </View>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { useState } from 'react'\nimport { View, Pressable, Animated, type ViewProps } from 'react-native'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\n\nconst BRAND_PRIMARY = getSemanticColors('dark')['brand-primary']\n\nexport type MesoStatus = 'completed' | 'current' | 'upcoming'\n\nexport interface Meso {\n id: string\n name: string\n weekCount: number\n status: MesoStatus\n /**\n * 1-based week index of progress within a `current` meso.\n * Drives the solid fill width. Ignored for non-current mesos.\n */\n currentWeek?: number\n}\n\nexport interface MesoProgressBarProps extends ViewProps {\n mesos: Meso[]\n activeMesoId: string | null\n onMesoPress: (mesoId: string) => void\n className?: string\n}\n\nconst segmentBgColors: Record<MesoStatus, string> = {\n completed: 'rgba(46,213,115,0.3)',\n current: 'rgba(255,121,0,0.5)',\n upcoming: 'rgba(255,255,255,0.06)',\n}\n\nfunction clampProgress(currentWeek: number | undefined, weekCount: number): number {\n if (currentWeek == null || weekCount <= 0) return 0\n const ratio = currentWeek / weekCount\n return Math.max(0, Math.min(1, ratio))\n}\n\ninterface SegmentProps {\n meso: Meso\n isActive: boolean\n onPress: (id: string) => void\n}\n\nfunction MesoSegment({ meso, isActive, onPress }: SegmentProps) {\n const [pressScale] = useState(() => new Animated.Value(1))\n\n const handlePressIn = () => {\n Animated.timing(pressScale, {\n toValue: 0.98,\n duration: 150,\n useNativeDriver: true,\n }).start()\n }\n\n const handlePressOut = () => {\n Animated.timing(pressScale, {\n toValue: 1,\n duration: 150,\n useNativeDriver: true,\n }).start()\n }\n\n const progress = meso.status === 'current'\n ? clampProgress(meso.currentWeek, meso.weekCount)\n : 0\n\n // weekCount drives the segment's flex width; guard 0 / negative so flex stays\n // a valid positive value and the segment never collapses out of the layout.\n const segmentFlex = Math.max(1, meso.weekCount)\n\n return (\n <Pressable\n style={{ flex: segmentFlex }}\n onPress={() => onPress(meso.id)}\n onPressIn={handlePressIn}\n onPressOut={handlePressOut}\n accessibilityRole=\"button\"\n accessibilityLabel={`${meso.name}, ${meso.status}`}\n testID={`meso-segment-${meso.id}`}\n >\n <Animated.View\n style={[\n {\n height: 8,\n borderRadius: 4,\n overflow: 'hidden',\n backgroundColor: segmentBgColors[meso.status],\n transform: [{ scale: pressScale }],\n },\n isActive\n ? {\n borderWidth: 2,\n borderColor: BRAND_PRIMARY,\n transform: [{ scale: 1.02 }, { scale: pressScale }],\n }\n : undefined,\n ]}\n testID={`meso-segment-inner-${meso.id}`}\n >\n {meso.status === 'current' && progress > 0 && (\n <View\n style={{\n position: 'absolute',\n left: 0,\n top: 0,\n bottom: 0,\n width: `${progress * 100}%`,\n backgroundColor: BRAND_PRIMARY,\n }}\n testID={`meso-segment-fill-${meso.id}`}\n />\n )}\n </Animated.View>\n </Pressable>\n )\n}\n\n/**\n * Segmented horizontal bar of mesocycles. Each segment is tappable and its\n * flex width is proportional to the meso's `weekCount`. The active segment is\n * highlighted with a 2px brand border to stay in sync with MesoCard selection.\n *\n * @example\n * <MesoProgressBar\n * mesos={[\n * { id: 'm1', name: 'Accumulation', weekCount: 4, status: 'completed' },\n * { id: 'm2', name: 'Intensification', weekCount: 3, status: 'current', currentWeek: 2 },\n * { id: 'm3', name: 'Peak', weekCount: 2, status: 'upcoming' },\n * ]}\n * activeMesoId=\"m2\"\n * onMesoPress={(id) => console.log(id)}\n * />\n */\nexport function MesoProgressBar({\n mesos,\n activeMesoId,\n onMesoPress,\n className,\n ...props\n}: MesoProgressBarProps) {\n return (\n <View\n className={className}\n style={{\n flexDirection: 'row',\n gap: 2,\n paddingHorizontal: 16,\n alignItems: 'center',\n }}\n testID=\"meso-progress-bar\"\n {...props}\n >\n {mesos.map((meso) => (\n <MesoSegment\n key={meso.id}\n meso={meso}\n isActive={meso.id === activeMesoId}\n onPress={onMesoPress}\n />\n ))}\n </View>\n )\n}\n","import { View, type ViewProps } from 'react-native'\nimport { cn } from '../../../utils/cn'\n\nexport type IndicatorSize = 'xs' | 'sm' | 'md' | 'lg'\nexport type IndicatorColor =\n | 'default'\n | 'primary'\n | 'success'\n | 'live'\n | 'error'\n | 'warning'\n | 'info'\n | 'error-vivid'\n\n/** How a pulsing indicator animates: a subtle opacity fade, or an expanding ring. */\nexport type IndicatorPulse = 'opacity' | 'ping'\n\nexport interface IndicatorProps extends ViewProps {\n /** Dot size */\n size?: IndicatorSize\n /** Semantic color */\n color?: IndicatorColor\n /** Custom hex color (overrides color prop) */\n customColor?: string\n /** Add a glow shadow effect */\n glow?: boolean\n /** Add a ring border */\n ring?: boolean\n /** Animate for live/active status. `true` = opacity fade; `'ping'` = expanding ring. */\n pulse?: boolean | IndicatorPulse\n /** Additional className */\n className?: string\n}\n\nconst sizeStyles: Record<IndicatorSize, string> = {\n xs: 'w-1 h-1',\n sm: 'w-1.5 h-1.5',\n md: 'w-2 h-2',\n lg: 'w-2.5 h-2.5',\n}\n\nconst colorStyles: Record<IndicatorColor, string> = {\n default: 'bg-text-tertiary',\n primary: 'bg-brand-primary',\n success: 'bg-status-success',\n live: 'bg-status-live',\n error: 'bg-status-error',\n warning: 'bg-status-warning',\n info: 'bg-status-info',\n 'error-vivid': 'bg-status-error-vivid',\n}\n\nexport function Indicator({\n size = 'sm',\n color = 'default',\n customColor,\n glow = false,\n ring = false,\n pulse = false,\n className,\n style,\n ...props\n}: IndicatorProps) {\n const pulseMode: IndicatorPulse | false = pulse === true ? 'opacity' : pulse || false\n const colorClass = !customColor ? colorStyles[color] : undefined\n const colorStyle = customColor ? { backgroundColor: customColor } : undefined\n\n // Expanding-ring pulse: a ping layer behind the solid dot (for live/active status).\n if (pulseMode === 'ping') {\n return (\n <View className={cn('relative', sizeStyles[size], className)} style={style} {...props}>\n <View\n className={cn('absolute inset-0 rounded-full animate-ping', colorClass)}\n style={colorStyle}\n />\n <View\n className={cn(\n 'relative rounded-full',\n sizeStyles[size],\n colorClass,\n ring && 'border-2 border-background-base'\n )}\n style={colorStyle}\n />\n </View>\n )\n }\n\n const dynamicStyle = {\n ...(typeof style === 'object' ? style : {}),\n ...(colorStyle ?? {}),\n ...(glow && customColor ? { boxShadow: `0 0 6px ${customColor}` } : {}),\n }\n\n return (\n <View\n className={cn(\n 'rounded-full shrink-0',\n sizeStyles[size],\n colorClass,\n pulseMode === 'opacity' && 'animate-pulse',\n ring && 'border-2 border-background-base',\n glow &&\n !customColor &&\n (color === 'success' || color === 'live') &&\n 'shadow-[0_0_6px_rgba(46,213,115,0.6)]',\n glow && !customColor && color === 'error' && 'shadow-[0_0_6px_rgba(239,68,68,0.6)]',\n glow && !customColor && color === 'warning' && 'shadow-[0_0_6px_rgba(245,158,11,0.6)]',\n glow && !customColor && color === 'primary' && 'shadow-[0_0_6px_rgba(255,121,0,0.6)]',\n glow && !customColor && color === 'error-vivid' && 'shadow-[0_0_6px_rgba(255,71,87,0.6)]',\n className\n )}\n style={Object.keys(dynamicStyle).length > 0 ? dynamicStyle : style}\n {...props}\n />\n )\n}\n","import React from 'react'\nimport { View, Text, type ViewProps } from 'react-native'\nimport { cn } from '../../../utils/cn'\nimport { Indicator, type IndicatorColor } from '../indicator'\n\nexport type BadgeVariant = 'solid' | 'subtle' | 'outline'\nexport type BadgeColor = 'default' | 'primary' | 'secondary' | 'success' | 'error' | 'warning' | 'info'\nexport type BadgeSize = 'sm' | 'md' | 'lg'\n\nexport interface BadgeProps extends ViewProps {\n /** Visual variant */\n variant?: BadgeVariant\n /** Color scheme */\n color?: BadgeColor\n /** Size */\n size?: BadgeSize\n /** Show a leading indicator dot */\n dot?: boolean\n /** Color for the dot indicator (defaults to match badge color) */\n dotColor?: IndicatorColor\n /** Additional className */\n className?: string\n children?: React.ReactNode\n}\n\nconst variantColorStyles: Record<BadgeVariant, Record<BadgeColor, string>> = {\n solid: {\n default: 'bg-hairline-strong text-text-inverse',\n primary: 'bg-brand-primary text-text-inverse',\n secondary: 'bg-brand-secondary text-text-inverse',\n success: 'bg-status-success text-text-inverse',\n error: 'bg-status-error text-text-inverse',\n warning: 'bg-status-warning text-text-inverse',\n info: 'bg-status-info text-text-inverse',\n },\n subtle: {\n default: 'bg-surface-raised text-text-secondary',\n primary: 'bg-brand-primary-subtle text-brand-primary',\n secondary: 'bg-brand-secondary-subtle text-brand-secondary',\n success: 'bg-status-success-subtle text-status-success',\n error: 'bg-status-error-subtle text-status-error',\n warning: 'bg-status-warning-subtle text-status-warning',\n info: 'bg-status-info-subtle text-status-info',\n },\n outline: {\n default: 'border border-hairline-strong text-text-secondary',\n primary: 'border border-brand-primary text-brand-primary',\n secondary: 'border border-brand-secondary text-brand-secondary',\n success: 'border border-status-success text-status-success',\n error: 'border border-status-error text-status-error',\n warning: 'border border-status-warning text-status-warning',\n info: 'border border-status-info text-status-info',\n },\n}\n\nconst sizeStyles: Record<BadgeSize, string> = {\n sm: 'px-1.5 py-0.5 text-xs',\n md: 'px-2 py-0.5 text-xs',\n lg: 'px-2.5 py-1 text-sm',\n}\n\n/**\n * Badge component for status indicators and labels.\n *\n * @example\n * <Badge color=\"success\">Active</Badge>\n * <Badge variant=\"outline\" color=\"warning\">Pending</Badge>\n */\nexport function Badge({\n variant = 'subtle',\n color = 'default',\n size = 'md',\n dot,\n dotColor,\n className,\n children,\n ...props\n}: BadgeProps) {\n return (\n <View\n className={cn(\n 'inline-flex items-center justify-center rounded-full font-medium',\n variantColorStyles[variant][color],\n sizeStyles[size],\n className\n )}\n {...props}\n >\n {dot && (\n <Indicator\n size=\"xs\"\n color={dotColor ?? (color === 'default' || color === 'secondary' ? 'default' : color as IndicatorColor)}\n className=\"mr-0.5\"\n />\n )}\n {typeof children === 'string' ? (\n <Text className=\"text-inherit font-medium\">{children}</Text>\n ) : (\n children\n )}\n </View>\n )\n}\n\nexport interface BadgeTextProps {\n children: React.ReactNode\n className?: string\n}\n\n/**\n * Text component for Badge content.\n */\nexport function BadgeText({ children, className }: BadgeTextProps) {\n return (\n <Text className={cn('text-inherit font-medium', className)}>\n {children}\n </Text>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { useEffect, useState } from 'react'\nimport { View, Text, Pressable, Animated, Easing, type ViewProps } from 'react-native'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\nimport { WORKOUT_PILL_DELOAD } from '../../../theme/extracted-colors-dataviz'\nimport { greyRamp } from '../../../theme/tokens/primitives'\n\nconst HAIRLINE_DEFAULT = getSemanticColors('dark')['hairline-default']\n\nconst t = getSemanticColors('dark')\n\n/**\n * Spec statuses: completed | current | upcoming | deload.\n * `next` and `missed` are additive extras supported by this implementation.\n */\nexport type WorkoutPillStatus = 'completed' | 'current' | 'upcoming' | 'deload' | 'next' | 'missed'\n\nexport interface WorkoutPillProps extends ViewProps {\n name: string\n status: WorkoutPillStatus\n /** Force pulsing animation. Defaults to pulsing only on `current` status. */\n pulse?: boolean\n onPress?: () => void\n highlighted?: boolean\n className?: string\n}\n\nconst statusBgColors: Record<WorkoutPillStatus, string> = {\n completed: 'rgba(46,213,115,0.15)',\n current: 'rgba(255,121,0,0.15)',\n next: 'transparent',\n upcoming: t['surface-raised'],\n missed: 'rgba(209,67,67,0.1)',\n deload: 'rgba(186,41,150,0.15)',\n}\n\nconst statusBorderStyles: Record<WorkoutPillStatus, Record<string, unknown>> = {\n completed: { borderWidth: 1, borderColor: 'rgba(46,213,115,0.3)' },\n current: { borderWidth: 1, borderColor: 'rgba(255,121,0,0.3)' },\n next: { borderWidth: 1, borderColor: 'rgba(255,121,0,0.4)' },\n upcoming: { borderWidth: 1, borderColor: HAIRLINE_DEFAULT },\n missed: { borderWidth: 1, borderColor: 'rgba(209,67,67,0.25)' },\n deload: { borderWidth: 1, borderColor: 'rgba(186,41,150,0.3)' },\n}\n\nconst textColors: Record<WorkoutPillStatus, string> = {\n completed: t['status-success'],\n current: t['brand-primary'],\n next: t['brand-primary'],\n upcoming: greyRamp[500],\n missed: 'rgba(209,67,67,0.7)',\n deload: WORKOUT_PILL_DELOAD,\n}\n\nfunction usePulse(enabled: boolean) {\n const [opacity] = useState(() => new Animated.Value(1))\n\n useEffect(() => {\n if (!enabled) {\n opacity.setValue(1)\n return\n }\n\n const animation = Animated.loop(\n Animated.sequence([\n Animated.timing(opacity, {\n toValue: 0.7,\n duration: 1000,\n easing: Easing.inOut(Easing.ease),\n useNativeDriver: true,\n }),\n Animated.timing(opacity, {\n toValue: 1,\n duration: 1000,\n easing: Easing.inOut(Easing.ease),\n useNativeDriver: true,\n }),\n ])\n )\n animation.start()\n\n return () => animation.stop()\n }, [enabled, opacity])\n\n return opacity\n}\n\nexport function WorkoutPill({\n name,\n status,\n pulse,\n onPress,\n highlighted = false,\n className,\n ...props\n}: WorkoutPillProps) {\n const shouldPulse = pulse ?? status === 'current'\n const pulseOpacity = usePulse(shouldPulse)\n const isCompleted = status === 'completed'\n const isMissed = status === 'missed'\n\n const pill = (\n <Animated.View\n style={shouldPulse ? { opacity: pulseOpacity } : undefined}\n testID=\"workout-pill\"\n >\n <View\n className={className}\n style={[\n {\n flexDirection: 'row',\n alignItems: 'center',\n paddingHorizontal: 10,\n paddingVertical: 4,\n borderRadius: 6,\n backgroundColor: statusBgColors[status],\n },\n statusBorderStyles[status] as Record<string, unknown>,\n highlighted ? { borderWidth: 2, transform: [{ scale: 1.02 }] } : undefined,\n ]}\n accessibilityLabel={onPress ? undefined : `${name} workout, ${status}`}\n {...props}\n >\n {isCompleted && (\n <Text\n style={{\n fontWeight: '600',\n fontFamily: '\"Nunito Sans\", sans-serif',\n fontSize: 11,\n color: textColors[status],\n marginRight: 4,\n }}\n accessibilityElementsHidden\n testID=\"workout-pill-check\"\n >\n {'\\u2713'}\n </Text>\n )}\n {isMissed && (\n <Text\n style={{\n fontWeight: '600',\n fontFamily: '\"Nunito Sans\", sans-serif',\n fontSize: 11,\n color: textColors[status],\n marginRight: 4,\n }}\n accessibilityElementsHidden\n testID=\"workout-pill-dash\"\n >\n {'\\u2014'}\n </Text>\n )}\n <Text\n style={{\n fontWeight: '600',\n fontFamily: '\"Nunito Sans\", sans-serif',\n fontSize: 11,\n color: textColors[status],\n }}\n accessibilityElementsHidden={onPress != null}\n testID=\"workout-pill-name\"\n >\n {name}\n </Text>\n </View>\n </Animated.View>\n )\n\n if (onPress) {\n return (\n <Pressable\n onPress={onPress}\n accessibilityRole=\"button\"\n accessibilityLabel={`${name} workout, ${status}`}\n testID=\"workout-pill-pressable\"\n >\n {pill}\n </Pressable>\n )\n }\n\n return pill\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { useEffect, useState } from 'react'\nimport {\n View,\n Text,\n Animated,\n type ViewProps,\n type ViewStyle,\n type DimensionValue,\n} from 'react-native'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\nimport { WORKOUT_TOKENS } from '../../../theme/workout-tokens'\n\nconst t = getSemanticColors('dark')\n\nexport type IntensityBarOrientation = 'vertical' | 'horizontal'\n\nexport interface IntensityBarProps extends ViewProps {\n /** Current intensity level; 1 == 100% of target. Values >1 render as over-target. */\n level: number\n /** Target position 0-1. When the level sits at this target the fill gains an at-target glow. */\n threshold?: number\n /** Orientation */\n orientation?: IntensityBarOrientation\n /** Height for vertical (default 24px) or width for horizontal */\n size?: number\n /** Width for vertical (default 6px) or height for horizontal */\n thickness?: number\n /** Show the \"MRV\" threshold label under the bar */\n showThresholdLabel?: boolean\n className?: string\n}\n\nconst TRACK_BG = '#333333'\nconst LABEL_COLOR = '#6B7280'\nconst TARGET_LINE_COLOR = 'rgba(33, 150, 243, 0.5)'\nconst AT_TARGET_GLOW = '0 0 5px 1px rgba(33, 150, 243, 0.35), 0 0 10px 3px rgba(33, 150, 243, 0.15)'\n\n// Zone colors graded by TRUE percentage (level * 100).\nconst ZONE = {\n building: t['status-success'], // below target ramp-up\n approaching: t['status-warning'], // nearing target\n target: t['brand-primary'], // exactly at target\n over1: t['status-error'], // mild over-target\n over2: WORKOUT_TOKENS.intensity.over2, // moderate over-target\n over3: WORKOUT_TOKENS.intensity.over3, // severe over-target\n} as const\n\ntype OverTier = 0 | 1 | 2 | 3\n\ninterface Zone {\n color: string\n over: OverTier\n}\n\nconst BULGE_SIZE: Record<Exclude<OverTier, 0>, number> = { 1: 8, 2: 10, 3: 11 }\n\n/** Map a true percentage to its fill color and over-target tier. */\nfunction zoneForPct(pct: number): Zone {\n if (pct >= 125) return { color: ZONE.over3, over: 3 }\n if (pct >= 115) return { color: ZONE.over2, over: 2 }\n if (pct > 100) return { color: ZONE.over1, over: 1 }\n if (pct === 100) return { color: ZONE.target, over: 0 }\n if (pct >= 75) return { color: ZONE.approaching, over: 0 }\n return { color: ZONE.building, over: 0 }\n}\n\nfunction clampFill(value: number): number {\n if (value < 0) return 0\n if (value > 1) return 1\n return value\n}\n\n/** True when the level rests on the supplied target (within 5%). */\nfunction isAtTarget(pct: number, threshold?: number): boolean {\n if (threshold == null) return false\n return Math.abs(pct - Math.round(threshold * 100)) <= 5\n}\n\nexport function IntensityBar({\n level,\n threshold,\n orientation = 'vertical',\n size = 24,\n thickness = 6,\n showThresholdLabel,\n className,\n ...props\n}: IntensityBarProps) {\n const isVertical = orientation === 'vertical'\n const fillLevel = clampFill(level)\n const pct = Math.round(Math.max(0, level) * 100)\n const zone = zoneForPct(pct)\n const atTarget = isAtTarget(pct, threshold)\n\n const [fillAnim] = useState(() => new Animated.Value(fillLevel))\n\n useEffect(() => {\n const animation = Animated.timing(fillAnim, {\n toValue: fillLevel,\n duration: 250,\n useNativeDriver: false,\n })\n animation.start()\n return () => animation.stop()\n }, [fillLevel, fillAnim])\n\n const fillSizePercent = fillAnim.interpolate({\n inputRange: [0, 1],\n outputRange: ['0%', '100%'],\n })\n\n const trackStyle = isVertical\n ? { width: thickness, height: size }\n : { width: size, height: thickness }\n\n const fillStyle = isVertical\n ? { position: 'absolute' as const, bottom: 0, left: 0, right: 0, height: fillSizePercent }\n : { position: 'absolute' as const, top: 0, bottom: 0, left: 0, width: fillSizePercent }\n\n const bulgeSize = zone.over === 0 ? 0 : BULGE_SIZE[zone.over]\n const bulgeStyle: ViewStyle = {\n position: 'absolute',\n width: bulgeSize,\n height: bulgeSize,\n borderRadius: bulgeSize / 2,\n backgroundColor: zone.color,\n zIndex: 1,\n ...(isVertical\n ? { top: 0, left: '50%', transform: [{ translateX: -bulgeSize / 2 }] }\n : { right: 0, top: '50%', transform: [{ translateY: -bulgeSize / 2 }] }),\n }\n\n const targetPct: DimensionValue = `${clampFill(threshold ?? 0) * 100}%`\n const targetLineStyle: ViewStyle = isVertical\n ? {\n position: 'absolute',\n bottom: targetPct,\n left: -3,\n right: -3,\n height: 1.5,\n backgroundColor: TARGET_LINE_COLOR,\n zIndex: 4,\n }\n : {\n position: 'absolute',\n left: targetPct,\n top: -3,\n bottom: -3,\n width: 1.5,\n backgroundColor: TARGET_LINE_COLOR,\n zIndex: 4,\n }\n\n return (\n <View\n className={className}\n style={{ alignItems: 'center' }}\n accessibilityRole=\"progressbar\"\n accessibilityValue={{ min: 0, max: 100, now: pct }}\n accessibilityLabel={`Intensity level: ${pct}%`}\n testID=\"intensity-bar\"\n {...props}\n >\n <View\n style={{\n ...trackStyle,\n borderRadius: 3,\n backgroundColor: TRACK_BG,\n position: 'relative',\n overflow: 'visible',\n }}\n accessibilityElementsHidden\n >\n <Animated.View\n style={{\n ...fillStyle,\n borderRadius: 3,\n backgroundColor: zone.color,\n zIndex: 2,\n ...(atTarget ? { boxShadow: AT_TARGET_GLOW } : null),\n }}\n testID=\"intensity-fill\"\n />\n\n {zone.over !== 0 && <View style={bulgeStyle} testID=\"intensity-bulge\" />}\n\n {threshold != null && <View style={targetLineStyle} testID=\"intensity-target\" />}\n </View>\n\n <Text\n style={{\n fontSize: 8,\n color: LABEL_COLOR,\n fontFamily: '\"Nunito Sans\", sans-serif',\n marginTop: 6,\n }}\n accessibilityElementsHidden\n testID=\"intensity-label\"\n >\n {pct}%\n </Text>\n\n {showThresholdLabel && threshold != null && (\n <Text\n style={{\n fontSize: 8,\n fontWeight: '500',\n color: LABEL_COLOR,\n fontFamily: 'Inter, sans-serif',\n marginTop: 2,\n }}\n accessibilityElementsHidden\n testID=\"intensity-threshold-label\"\n >\n MRV\n </Text>\n )}\n </View>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { View, Text, type ViewProps } from 'react-native'\nimport { WorkoutPill, type WorkoutPillStatus } from './WorkoutPill'\nimport { IntensityBar } from './IntensityBar'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\n\nconst BRAND_PRIMARY = getSemanticColors('dark')['brand-primary']\n\nexport interface WeekRowWorkout {\n name: string\n status: WorkoutPillStatus\n onPress?: () => void\n}\n\nexport interface WeekRowProps extends ViewProps {\n /** Week index within the mesocycle (1-based) */\n weekNumber: number\n /** Total weeks in the mesocycle */\n totalWeeks: number\n /** Workouts scheduled for this week */\n workouts: WeekRowWorkout[]\n /** Planned intensity for the week, 0-1 */\n intensityLevel: number\n /** Optional MRV/overexertion threshold, 0-1 */\n intensityThreshold?: number\n /** Highlights this row as the active week */\n isCurrent?: boolean\n /** Renders this row as a deload week (purple tint, deload pills) */\n isDeload?: boolean\n className?: string\n}\n\n/**\n * A single week within a mesocycle, showing the week number, its workout pills,\n * and a right-aligned vertical intensity indicator.\n *\n * @example\n * <WeekRow\n * weekNumber={1}\n * totalWeeks={4}\n * workouts={[\n * { name: 'Upper', status: 'completed' },\n * { name: 'Lower', status: 'current' },\n * ]}\n * intensityLevel={0.55}\n * intensityThreshold={0.8}\n * isCurrent\n * />\n */\nexport function WeekRow({\n weekNumber,\n totalWeeks,\n workouts,\n intensityLevel,\n intensityThreshold,\n isCurrent = false,\n isDeload = false,\n className,\n ...props\n}: WeekRowProps) {\n const rowStyle: Record<string, unknown> = {\n flexDirection: 'row' as const,\n alignItems: 'center' as const,\n paddingVertical: 10,\n paddingHorizontal: 12,\n gap: 12,\n }\n\n if (isDeload) {\n rowStyle.backgroundColor = 'rgba(186,41,150,0.06)'\n }\n\n if (isCurrent) {\n rowStyle.backgroundColor = 'rgba(255,121,0,0.04)'\n rowStyle.borderLeftWidth = 2\n rowStyle.borderLeftColor = BRAND_PRIMARY\n }\n\n return (\n <View\n className={className}\n style={rowStyle}\n accessibilityLabel={`Week ${weekNumber} of ${totalWeeks}, ${workouts.length} workouts`}\n testID=\"week-row\"\n {...props}\n >\n <View\n style={{ flexDirection: 'row', alignItems: 'center', width: 32, gap: 4 }}\n testID=\"week-row-number\"\n >\n {isCurrent && (\n <View\n style={{\n width: 6,\n height: 6,\n borderRadius: 3,\n backgroundColor: BRAND_PRIMARY,\n }}\n accessibilityElementsHidden\n testID=\"week-row-current-dot\"\n />\n )}\n <Text\n className={isCurrent ? undefined : 'text-text-primary'}\n style={{\n fontSize: 13,\n fontWeight: '700',\n fontFamily: 'Inter, sans-serif',\n color: isCurrent ? BRAND_PRIMARY : undefined,\n }}\n accessibilityElementsHidden\n >\n {`W${weekNumber}`}\n </Text>\n </View>\n\n <View\n style={{ flex: 1, flexDirection: 'row', alignItems: 'center', flexWrap: 'wrap', gap: 6 }}\n testID=\"week-row-pills\"\n >\n {workouts.map((workout, i) => (\n <WorkoutPill\n key={i}\n name={workout.name}\n status={isDeload ? 'deload' : workout.status}\n onPress={workout.onPress}\n />\n ))}\n </View>\n\n <View testID=\"week-row-intensity\">\n <IntensityBar\n level={intensityLevel}\n threshold={intensityThreshold}\n orientation=\"vertical\"\n size={24}\n thickness={6}\n />\n </View>\n </View>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { useEffect, useState } from 'react'\nimport { View, Text, Pressable, Animated, Easing, type ViewProps } from 'react-native'\nimport { Card } from '../../ui/card'\nimport { Badge } from '../../ui/badge'\nimport { WeekRow, type WeekRowProps } from './WeekRow'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\nimport {\n MESO_ACCENT_GRADIENT_DARK,\n MESO_ACCENT_GRADIENT_LIGHT,\n} from '../../../theme/extracted-colors-dataviz'\n\nconst HAIRLINE_DEFAULT = getSemanticColors('dark')['hairline-default']\n\nconst BRAND_PRIMARY = getSemanticColors('dark')['brand-primary']\nconst BRAND_PRIMARY_DARK = MESO_ACCENT_GRADIENT_DARK\nconst BRAND_PRIMARY_LIGHT = MESO_ACCENT_GRADIENT_LIGHT\nconst BORDER_DEFAULT = HAIRLINE_DEFAULT\n\n/** Gradient stops for the 3px top accent: dark -> primary -> light. */\nconst ACCENT_STOPS = [BRAND_PRIMARY_DARK, BRAND_PRIMARY, BRAND_PRIMARY_LIGHT]\n\nexport interface MesoVolumeHeatmapEntry {\n /** Muscle group identifier (free-form to match plan data). */\n group: string\n /** Planned volume intensity for the group, 0-100. */\n percentage: number\n}\n\nexport interface MesoCardProps extends ViewProps {\n /** Mesocycle name, e.g. \"Accumulation\". */\n name: string\n /** Training goal, e.g. \"Hypertrophy\", \"Strength\", \"Peaking\". */\n goal: string\n /** Training split, e.g. \"Upper/Lower\", \"Push/Pull/Legs\". */\n split: string\n /** Week range label, e.g. \"Weeks 1-4\". */\n weekRange: string\n /** Current week within the mesocycle (1-based). */\n currentWeek?: number\n /** Total weeks in the mesocycle. */\n totalWeeks: number\n /** Weeks rendered as a WeekRow list when expanded. */\n weeks: WeekRowProps[]\n /** Whether the card is expanded to reveal the week list. */\n expanded?: boolean\n /** Toggles expansion; makes the header a button when provided. */\n onToggle?: () => void\n /** Whether this meso is highlighted in the MesoProgressBar. */\n highlighted?: boolean\n /** Volume heatmap data per muscle group for the meso. */\n volumeHeatmap?: MesoVolumeHeatmapEntry[]\n className?: string\n}\n\n/**\n * Maps a 0-100 volume percentage onto a brand-primary tint whose opacity\n * tracks intensity, keeping a visible floor so low-volume groups stay legible.\n */\nfunction heatmapColor(percentage: number): string {\n const clamped = Math.max(0, Math.min(100, percentage))\n const opacity = 0.12 + (clamped / 100) * 0.78\n return `rgba(255,121,0,${opacity.toFixed(3)})`\n}\n\n/**\n * A mesocycle card with name, goal, split, week range, an optional volume\n * heatmap strip, and an expandable WeekRow list. Highlighting animates the\n * border toward brand-primary with a subtle glow to stay in sync with the\n * MesoProgressBar.\n *\n * @example\n * <MesoCard\n * name=\"Accumulation\"\n * goal=\"Hypertrophy\"\n * split=\"Upper/Lower\"\n * weekRange=\"Weeks 1-4\"\n * currentWeek={2}\n * totalWeeks={4}\n * weeks={weeks}\n * volumeHeatmap={[{ group: 'chest', percentage: 80 }]}\n * expanded\n * onToggle={() => {}}\n * highlighted\n * />\n */\nexport function MesoCard({\n name,\n goal,\n split,\n weekRange,\n currentWeek,\n totalWeeks,\n weeks,\n expanded = false,\n onToggle,\n highlighted = false,\n volumeHeatmap,\n className,\n ...props\n}: MesoCardProps) {\n const isExpandable = onToggle != null\n const [highlight] = useState(() => new Animated.Value(highlighted ? 1 : 0))\n\n useEffect(() => {\n const animation = Animated.timing(highlight, {\n toValue: highlighted ? 1 : 0,\n duration: 250,\n easing: Easing.out(Easing.ease),\n useNativeDriver: false,\n })\n animation.start()\n return () => animation.stop()\n }, [highlighted, highlight])\n\n const borderColor = highlight.interpolate({\n inputRange: [0, 1],\n outputRange: [BORDER_DEFAULT, BRAND_PRIMARY],\n })\n\n const header = (\n <View style={{ paddingHorizontal: 14, paddingTop: 12, paddingBottom: 10 }} testID=\"meso-card-body\">\n <View className=\"flex-row items-center\" style={{ gap: 8 }} testID=\"meso-card-header\">\n <Text\n className=\"text-text-primary\"\n style={{\n fontSize: 15,\n fontFamily: '\"Space Grotesk\", sans-serif',\n fontWeight: '700',\n }}\n testID=\"meso-card-name\"\n >\n {name}\n </Text>\n <Badge variant=\"subtle\" color=\"primary\" size=\"sm\" testID=\"meso-card-goal-badge\">\n {goal}\n </Badge>\n </View>\n\n <Text\n className=\"text-text-secondary\"\n style={{\n marginTop: 4,\n fontSize: 12,\n fontFamily: 'Inter, sans-serif',\n }}\n testID=\"meso-card-subheader\"\n >\n {`${split} · ${weekRange}`}\n </Text>\n\n {volumeHeatmap && volumeHeatmap.length > 0 && (\n <View\n className=\"flex-row items-center\"\n style={{ marginTop: 10, gap: 3 }}\n accessibilityElementsHidden\n testID=\"meso-card-heatmap\"\n >\n {volumeHeatmap.map((entry) => (\n <View\n key={entry.group}\n style={{\n flex: 1,\n height: 8,\n borderRadius: 2,\n backgroundColor: heatmapColor(entry.percentage),\n }}\n testID=\"meso-card-heatmap-cell\"\n />\n ))}\n </View>\n )}\n </View>\n )\n\n return (\n <Animated.View style={highlighted ? { transform: [{ scale: 1.0 }] } : undefined} testID=\"meso-card-wrapper\">\n <Card\n variant=\"outline\"\n elevation={2}\n borderColor={highlighted ? BRAND_PRIMARY : BORDER_DEFAULT}\n className={className}\n style={[\n { borderColor: borderColor as unknown as string },\n highlighted\n ? { boxShadow: '0 0 12px 2px rgba(255,121,0,0.25)' }\n : undefined,\n ]}\n testID=\"meso-card\"\n {...props}\n >\n <View\n className=\"flex-row\"\n style={{ position: 'absolute', top: 0, left: 0, right: 0, height: 3, zIndex: 1 }}\n accessibilityElementsHidden\n testID=\"meso-card-accent\"\n >\n {ACCENT_STOPS.map((color) => (\n <View key={color} style={{ flex: 1, backgroundColor: color }} />\n ))}\n </View>\n\n {isExpandable ? (\n <Pressable\n onPress={onToggle}\n accessibilityRole=\"button\"\n accessibilityLabel={`${name}, ${goal}, ${weekRange}`}\n aria-expanded={expanded}\n testID=\"meso-card-toggle\"\n >\n {header}\n </Pressable>\n ) : (\n <View\n accessibilityLabel={`${name}, ${goal}, ${weekRange}`}\n testID=\"meso-card-static\"\n >\n {header}\n </View>\n )}\n\n {expanded && weeks.length > 0 && (\n <View\n style={{ borderTopWidth: 1, borderTopColor: BORDER_DEFAULT }}\n testID=\"meso-card-weeks\"\n >\n {weeks.map((week) => (\n <WeekRow\n key={week.weekNumber}\n {...week}\n totalWeeks={week.totalWeeks ?? totalWeeks}\n isCurrent={week.isCurrent ?? week.weekNumber === currentWeek}\n />\n ))}\n </View>\n )}\n </Card>\n </Animated.View>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { View, Text, Pressable, type ViewProps } from 'react-native'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\nimport { greyRamp } from '../../../theme/tokens/primitives'\n\nconst t = getSemanticColors('dark')\n\n// Aliases for spec compatibility: under=behind, maintenance=ontrack, productive=target\nexport type VolumeStatus = 'untrained' | 'behind' | 'ontrack' | 'target' | 'over'\n\nexport interface MuscleGroupChipProps extends ViewProps {\n name: string\n volumeStatus?: VolumeStatus\n onPress?: () => void\n className?: string\n}\n\nconst dotColorMap: Record<VolumeStatus, string> = {\n untrained: greyRamp[900],\n behind: t['brand-secondary'],\n ontrack: t['status-success'],\n target: t['brand-primary'],\n over: t['status-error'],\n}\n\nexport function MuscleGroupChip({\n name,\n volumeStatus,\n onPress,\n className,\n ...props\n}: MuscleGroupChipProps) {\n const dotColor = volumeStatus\n ? dotColorMap[volumeStatus]\n : greyRamp[900]\n\n const statusLabel = volumeStatus ?? 'no status'\n\n const content = (\n <View\n className={['bg-surface-raised border-hairline', className].filter(Boolean).join(' ')}\n style={{\n flexDirection: 'row',\n alignItems: 'center',\n borderRadius: 9999,\n paddingHorizontal: 9,\n paddingVertical: 3,\n borderWidth: 1,\n }}\n accessibilityLabel={onPress ? undefined : `${name}, volume status: ${statusLabel}`}\n testID=\"muscle-group-chip\"\n {...props}\n >\n <View\n style={{\n width: 6,\n height: 6,\n borderRadius: 9999,\n marginRight: 5,\n flexShrink: 0,\n backgroundColor: dotColor,\n }}\n accessibilityElementsHidden\n testID=\"muscle-group-chip-dot\"\n />\n <Text\n className=\"text-text-secondary\"\n style={{\n fontFamily: 'Inter, sans-serif',\n fontWeight: '500',\n fontSize: 11,\n }}\n accessibilityElementsHidden\n >\n {name}\n </Text>\n </View>\n )\n\n if (onPress) {\n return (\n <Pressable\n onPress={onPress}\n accessibilityRole=\"button\"\n accessibilityLabel={`${name}, volume status: ${statusLabel}`}\n testID=\"muscle-group-chip-pressable\"\n >\n {content}\n </Pressable>\n )\n }\n\n return content\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { View, Text, ScrollView, Pressable, type ViewProps } from 'react-native'\nimport { Card } from '../../ui/card'\nimport { ExerciseCard, type ExerciseCardProps } from './ExerciseCard'\nimport {\n MuscleGroupChip,\n type VolumeStatus,\n} from './MuscleGroupChip'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\n\nconst HAIRLINE_DEFAULT = getSemanticColors('dark')['hairline-default']\n\nconst t = getSemanticColors('dark')\n\nexport type WorkoutStatus = 'completed' | 'today' | 'upcoming'\n\n/** Spec volume-status vocabulary; mapped to MuscleGroupChip's VolumeStatus internally. */\nexport type WorkoutMuscleVolumeStatus =\n | 'under'\n | 'maintenance'\n | 'productive'\n | 'over'\n\nexport interface WorkoutMuscleGroup {\n /** Muscle group identifier (free-form to match plan data). */\n group: string\n /** Display label, may be abbreviated. */\n label: string\n /** Volume status relative to landmarks. */\n volumeStatus?: WorkoutMuscleVolumeStatus\n}\n\nexport interface WorkoutCardProps extends ViewProps {\n name: string\n date: string\n /** e.g. \"45 min\" */\n duration?: string\n status: WorkoutStatus\n muscleGroups: WorkoutMuscleGroup[]\n totalSets: number\n /** Total lbs/kg moved across the workout. */\n totalVolume?: number\n unit: 'lbs' | 'kg'\n exercises?: ExerciseCardProps[]\n expanded?: boolean\n onToggle?: () => void\n className?: string\n}\n\nconst COLORS = {\n statusSuccess: t['status-success'],\n brandPrimary: t['brand-primary'],\n borderDefault: HAIRLINE_DEFAULT,\n brandPrimarySubtle: 'rgba(255,121,0,0.06)',\n}\n\nconst statusBorderColors: Record<WorkoutStatus, string> = {\n completed: COLORS.statusSuccess,\n today: COLORS.brandPrimary,\n upcoming: COLORS.borderDefault,\n}\n\n/** Maps the spec's volume-status vocabulary onto MuscleGroupChip's enum. */\nconst volumeStatusMap: Record<WorkoutMuscleVolumeStatus, VolumeStatus> = {\n under: 'behind',\n maintenance: 'ontrack',\n productive: 'target',\n over: 'over',\n}\n\nfunction formatStats(\n totalSets: number,\n totalVolume: number | undefined,\n unit: 'lbs' | 'kg',\n duration: string | undefined,\n): string {\n const parts = [`${totalSets} sets`]\n if (totalVolume != null) parts.push(`${totalVolume} ${unit}`)\n if (duration) parts.push(duration)\n return parts.join(' · ')\n}\n\n/**\n * A workout within a week: name, date, duration, muscle-group pills, and a\n * stats summary. When expandable it renders contained ExerciseCards on expand.\n * Status drives a colored left border, today adds a brand tint, and upcoming\n * is dimmed.\n *\n * @example\n * <WorkoutCard\n * name=\"Upper A\"\n * date=\"Mon, Jun 23\"\n * duration=\"45 min\"\n * status=\"today\"\n * muscleGroups={[{ group: 'chest', label: 'Chest', volumeStatus: 'productive' }]}\n * totalSets={18}\n * totalVolume={12450}\n * unit=\"lbs\"\n * expanded\n * onToggle={() => {}}\n * exercises={exercises}\n * />\n */\nexport function WorkoutCard({\n name,\n date,\n duration,\n status,\n muscleGroups,\n totalSets,\n totalVolume,\n unit,\n exercises,\n expanded = false,\n onToggle,\n className,\n ...props\n}: WorkoutCardProps) {\n const isExpandable = onToggle != null\n const isUpcoming = status === 'upcoming'\n const isToday = status === 'today'\n\n const summary = (\n <View style={{ padding: 14 }} testID=\"workout-card-body\">\n <View className=\"flex-row items-center\" testID=\"workout-card-header\">\n <Text\n className=\"text-text-primary\"\n style={{\n fontSize: 15,\n fontFamily: '\"Space Grotesk\", sans-serif',\n fontWeight: '700',\n }}\n testID=\"workout-card-name\"\n >\n {name}\n </Text>\n <View className=\"flex-1\" />\n <Text\n className=\"text-text-tertiary\"\n style={{\n fontSize: 11,\n fontFamily: 'Inter, sans-serif',\n }}\n testID=\"workout-card-date\"\n >\n {date}\n </Text>\n </View>\n\n <Text\n className=\"text-text-secondary\"\n style={{\n marginTop: 4,\n fontSize: 12,\n fontFamily: 'Inter, sans-serif',\n }}\n testID=\"workout-card-stats\"\n >\n {formatStats(totalSets, totalVolume, unit, duration)}\n </Text>\n\n {muscleGroups.length > 0 && (\n <ScrollView\n horizontal\n showsHorizontalScrollIndicator={false}\n contentContainerStyle={{ gap: 5 }}\n style={{ marginTop: 8 }}\n testID=\"workout-card-muscle-groups\"\n >\n {muscleGroups.map((muscle) => (\n <MuscleGroupChip\n key={muscle.group}\n name={muscle.label}\n volumeStatus={\n muscle.volumeStatus\n ? volumeStatusMap[muscle.volumeStatus]\n : undefined\n }\n />\n ))}\n </ScrollView>\n )}\n </View>\n )\n\n return (\n <Card\n variant=\"accent\"\n elevation={1}\n accentColor={statusBorderColors[status]}\n bgColor={isToday ? COLORS.brandPrimarySubtle : undefined}\n className={className}\n style={isUpcoming ? { opacity: 0.6 } : undefined}\n testID=\"workout-card\"\n {...props}\n >\n {isExpandable ? (\n <Pressable\n onPress={onToggle}\n accessibilityRole=\"button\"\n accessibilityLabel={`${name} workout, ${date}, ${status}`}\n aria-expanded={expanded}\n testID=\"workout-card-toggle\"\n >\n {summary}\n </Pressable>\n ) : (\n <View\n accessibilityLabel={`${name} workout, ${date}, ${status}`}\n testID=\"workout-card-static\"\n >\n {summary}\n </View>\n )}\n\n {expanded && exercises && exercises.length > 0 && (\n <View\n style={{ paddingHorizontal: 8, paddingBottom: 8, gap: 6 }}\n testID=\"workout-card-exercises\"\n >\n {exercises.map((exercise, i) => (\n <ExerciseCard key={i} {...exercise} />\n ))}\n </View>\n )}\n </Card>\n )\n}\n","// Font mapping: font-heading=Space Grotesk, font-body=Nunito Sans (UI), font-sans=Inter (body)\nimport { useMemo, useState } from 'react'\nimport { View, Text, Pressable, type ViewProps } from 'react-native'\nimport { MesoProgressBar, type Meso, type MesoStatus } from './MesoProgressBar'\nimport { MesoCard, type MesoVolumeHeatmapEntry } from './MesoCard'\nimport { type WeekRowProps, type WeekRowWorkout } from './WeekRow'\nimport { WorkoutCard, type WorkoutStatus, type WorkoutMuscleGroup } from './WorkoutCard'\nimport { type WorkoutPillStatus } from './WorkoutPill'\nimport { type ExerciseCardProps } from './ExerciseCard'\nimport { cn } from '../../../utils/cn'\nimport { getSemanticColors } from '../../../theme/tokens/semantic'\n\nconst BRAND_PRIMARY = getSemanticColors('dark')['brand-primary']\n\n/** A single workout within a planned week, plus its exercise breakdown. */\nexport interface PlanWorkout {\n /** Stable identifier used for drill-down selection. */\n id: string\n name: string\n date: string\n duration?: string\n status: WorkoutStatus\n muscleGroups: WorkoutMuscleGroup[]\n totalSets: number\n totalVolume?: number\n unit: 'lbs' | 'kg'\n /** Exercises revealed when the workout is opened. */\n exercises: ExerciseCardProps[]\n}\n\n/** A training week inside a mesocycle. */\nexport interface PlanWeek {\n /** 1-based week index within the mesocycle. */\n weekNumber: number\n /** Planned intensity for the week, 0-1. */\n intensityLevel: number\n /** Optional MRV/overexertion threshold, 0-1. */\n intensityThreshold?: number\n isDeload?: boolean\n isCurrent?: boolean\n workouts: PlanWorkout[]\n}\n\n/** A mesocycle: the top level of the drill-down. */\nexport interface PlanMeso {\n id: string\n name: string\n goal: string\n split: string\n weekRange: string\n weekCount: number\n currentWeek?: number\n status: MesoStatus\n volumeHeatmap?: MesoVolumeHeatmapEntry[]\n weeks: PlanWeek[]\n}\n\n/** Current depth of the meso -> week -> workout drill-down. */\nexport type ProgramNavLevel = 'meso' | 'week' | 'workout'\n\n/** The navigation cursor within the active mesocycle. */\nexport interface ProgramSelection {\n weekNumber: number | null\n workoutId: string | null\n}\n\n/** One tappable step in the breadcrumb trail. */\nexport interface ProgramBreadcrumb {\n key: string\n label: string\n level: ProgramNavLevel\n}\n\nexport interface ProgramPlanningPageProps extends ViewProps {\n /** Page heading. */\n title?: string\n /** Mesocycles that make up the program. */\n mesos: PlanMeso[]\n className?: string\n}\n\n/** Map a workout's lifecycle status onto a WorkoutPill status. */\nconst WORKOUT_PILL_STATUS: Record<WorkoutStatus, WorkoutPillStatus> = {\n completed: 'completed',\n today: 'current',\n upcoming: 'upcoming',\n}\n\n/** Derive the current drill-down level from the selection cursor (pure). */\nexport function deriveNavLevel(selection: ProgramSelection): ProgramNavLevel {\n if (selection.workoutId != null) return 'workout'\n if (selection.weekNumber != null) return 'week'\n return 'meso'\n}\n\n/** Project the mesocycles onto MesoProgressBar segment data (pure). */\nexport function toProgressBarMesos(mesos: PlanMeso[]): Meso[] {\n return mesos.map(({ id, name, weekCount, status, currentWeek }) => ({\n id,\n name,\n weekCount,\n status,\n currentWeek,\n }))\n}\n\n/** Look up a meso by id, or null. */\nexport function findMeso(mesos: PlanMeso[], id: string | null): PlanMeso | null {\n if (id == null) return null\n return mesos.find((meso) => meso.id === id) ?? null\n}\n\n/** Look up a week within a meso, or null. */\nexport function findWeek(meso: PlanMeso | null, weekNumber: number | null): PlanWeek | null {\n if (meso == null || weekNumber == null) return null\n return meso.weeks.find((week) => week.weekNumber === weekNumber) ?? null\n}\n\n/** Look up a workout within a week, or null. */\nexport function findWorkout(week: PlanWeek | null, workoutId: string | null): PlanWorkout | null {\n if (week == null || workoutId == null) return null\n return week.workouts.find((workout) => workout.id === workoutId) ?? null\n}\n\n/** Build the breadcrumb trail for the active drill path (pure). */\nexport function buildBreadcrumbs(\n meso: PlanMeso,\n weekNumber: number | null,\n workout: PlanWorkout | null\n): ProgramBreadcrumb[] {\n const crumbs: ProgramBreadcrumb[] = [{ key: 'meso', label: meso.name, level: 'meso' }]\n if (weekNumber != null) {\n crumbs.push({ key: 'week', label: `Week ${weekNumber}`, level: 'week' })\n }\n if (workout != null) {\n crumbs.push({ key: 'workout', label: workout.name, level: 'workout' })\n }\n return crumbs\n}\n\ninterface BreadcrumbsProps {\n crumbs: ProgramBreadcrumb[]\n onNavigate: (level: ProgramNavLevel) => void\n}\n\nfunction Breadcrumbs({ crumbs, onNavigate }: BreadcrumbsProps) {\n return (\n <View\n className=\"flex-row items-center flex-wrap\"\n style={{ gap: 4 }}\n testID=\"program-planning-page-breadcrumbs\"\n >\n {crumbs.map((crumb, index) => {\n const isLast = index === crumbs.length - 1\n return (\n <View key={crumb.key} className=\"flex-row items-center\" style={{ gap: 4 }}>\n {index > 0 && (\n <Text className=\"text-text-tertiary\" style={{ fontSize: 12 }}>\n {'›'}\n </Text>\n )}\n <Pressable\n onPress={() => onNavigate(crumb.level)}\n disabled={isLast}\n accessibilityRole=\"button\"\n testID={`program-planning-page-crumb-${crumb.key}`}\n >\n <Text\n className={isLast ? 'text-text-primary' : undefined}\n style={{\n fontSize: 12,\n fontFamily: 'Inter, sans-serif',\n fontWeight: isLast ? '700' : '500',\n color: isLast ? undefined : BRAND_PRIMARY,\n }}\n >\n {crumb.label}\n </Text>\n </Pressable>\n </View>\n )\n })}\n </View>\n )\n}\n\n/** Project a plan week onto WeekRow props, wiring pill taps to week selection. */\nfunction toWeekRow(\n week: PlanWeek,\n meso: PlanMeso,\n onSelectWeek: (weekNumber: number) => void\n): WeekRowProps {\n const workouts: WeekRowWorkout[] = week.workouts.map((workout) => ({\n name: workout.name,\n status: WORKOUT_PILL_STATUS[workout.status],\n onPress: () => onSelectWeek(week.weekNumber),\n }))\n return {\n weekNumber: week.weekNumber,\n totalWeeks: meso.weekCount,\n workouts,\n intensityLevel: week.intensityLevel,\n intensityThreshold: week.intensityThreshold,\n isCurrent: week.isCurrent ?? week.weekNumber === meso.currentWeek,\n isDeload: week.isDeload,\n }\n}\n\ninterface MesoLevelProps {\n mesos: PlanMeso[]\n activeMesoId: string | null\n onSelectMeso: (id: string) => void\n onSelectWeek: (weekNumber: number) => void\n}\n\nfunction MesoLevel({ mesos, activeMesoId, onSelectMeso, onSelectWeek }: MesoLevelProps) {\n return (\n <View style={{ gap: 12 }} testID=\"program-planning-page-meso-level\">\n {mesos.map((meso) => {\n const expanded = meso.id === activeMesoId\n return (\n <MesoCard\n key={meso.id}\n name={meso.name}\n goal={meso.goal}\n split={meso.split}\n weekRange={meso.weekRange}\n currentWeek={meso.currentWeek}\n totalWeeks={meso.weekCount}\n weeks={expanded ? meso.weeks.map((week) => toWeekRow(week, meso, onSelectWeek)) : []}\n volumeHeatmap={meso.volumeHeatmap}\n expanded={expanded}\n onToggle={() => onSelectMeso(meso.id)}\n highlighted={expanded}\n />\n )\n })}\n </View>\n )\n}\n\ninterface WeekLevelProps {\n week: PlanWeek\n onSelectWorkout: (id: string) => void\n}\n\nfunction WeekLevel({ week, onSelectWorkout }: WeekLevelProps) {\n return (\n <View style={{ gap: 10 }} testID=\"program-planning-page-week-level\">\n {week.workouts.map((workout) => (\n <WorkoutCard\n key={workout.id}\n name={workout.name}\n date={workout.date}\n duration={workout.duration}\n status={workout.status}\n muscleGroups={workout.muscleGroups}\n totalSets={workout.totalSets}\n totalVolume={workout.totalVolume}\n unit={workout.unit}\n exercises={workout.exercises}\n expanded={false}\n onToggle={() => onSelectWorkout(workout.id)}\n />\n ))}\n </View>\n )\n}\n\ninterface WorkoutLevelProps {\n workout: PlanWorkout\n expandedExercise: number | null\n onToggleExercise: (index: number) => void\n}\n\nfunction WorkoutLevel({ workout, expandedExercise, onToggleExercise }: WorkoutLevelProps) {\n // `upcoming` cards ignore `expanded`, so it's safe to wire the toggle uniformly.\n const exercises = workout.exercises.map((exercise, index) => ({\n ...exercise,\n expanded: index === expandedExercise,\n onExpandedChange: () => onToggleExercise(index),\n }))\n return (\n <View testID=\"program-planning-page-workout-level\">\n <WorkoutCard\n name={workout.name}\n date={workout.date}\n duration={workout.duration}\n status={workout.status}\n muscleGroups={workout.muscleGroups}\n totalSets={workout.totalSets}\n totalVolume={workout.totalVolume}\n unit={workout.unit}\n exercises={exercises}\n expanded\n onToggle={() => undefined}\n />\n </View>\n )\n}\n\n/**\n * ProgramPlanningPage — a meso -> week -> workout drill-down over an entire\n * training program. A `MesoProgressBar` pins the mesocycle timeline to the top;\n * the body swaps between three levels: expandable `MesoCard`s (with inline\n * `WeekRow`s), a week's `WorkoutCard` list, and a single opened `WorkoutCard`\n * with inline `ExerciseCard` expansion. A breadcrumb trail tracks and rewinds\n * the drill path. Selection is page-level state; children keep their own styles.\n *\n * @example\n * <ProgramPlanningPage mesos={mesos} />\n */\nexport function ProgramPlanningPage({\n title = 'Program Plan',\n mesos,\n className,\n ...props\n}: ProgramPlanningPageProps) {\n const [activeMesoId, setActiveMesoId] = useState<string | null>(mesos[0]?.id ?? null)\n const [selectedWeek, setSelectedWeek] = useState<number | null>(null)\n const [selectedWorkoutId, setSelectedWorkoutId] = useState<string | null>(null)\n const [expandedExercise, setExpandedExercise] = useState<number | null>(null)\n\n const progressMesos = useMemo(() => toProgressBarMesos(mesos), [mesos])\n const activeMeso = findMeso(mesos, activeMesoId)\n const level = deriveNavLevel({ weekNumber: selectedWeek, workoutId: selectedWorkoutId })\n const activeWeek = findWeek(activeMeso, selectedWeek)\n const activeWorkout = findWorkout(activeWeek, selectedWorkoutId)\n\n const selectMeso = (id: string) => {\n setActiveMesoId(id)\n setSelectedWeek(null)\n setSelectedWorkoutId(null)\n }\n const selectWeek = (weekNumber: number) => {\n setSelectedWeek(weekNumber)\n setSelectedWorkoutId(null)\n setExpandedExercise(null)\n }\n const selectWorkout = (id: string) => {\n setSelectedWorkoutId(id)\n setExpandedExercise(null)\n }\n const toggleExercise = (index: number) =>\n setExpandedExercise((current) => (current === index ? null : index))\n\n const navigateTo = (target: ProgramNavLevel) => {\n if (target === 'meso') selectMeso(activeMesoId ?? mesos[0]?.id)\n else if (target === 'week' && selectedWeek != null) selectWeek(selectedWeek)\n }\n\n return (\n <View\n className={cn(className, 'bg-background-base')}\n style={{ width: 390 }}\n accessibilityRole={'main' as ViewProps['accessibilityRole']}\n aria-label={title}\n testID=\"program-planning-page\"\n {...props}\n >\n <View style={{ padding: 16, gap: 14 }} testID=\"program-planning-page-content\">\n <Text\n accessibilityRole=\"header\"\n className=\"text-text-primary\"\n style={{\n fontSize: 20,\n fontFamily: '\"Space Grotesk\", sans-serif',\n fontWeight: '700',\n }}\n testID=\"program-planning-page-title\"\n >\n {title}\n </Text>\n\n <View style={{ marginHorizontal: -16 }}>\n <MesoProgressBar\n mesos={progressMesos}\n activeMesoId={activeMesoId}\n onMesoPress={selectMeso}\n />\n </View>\n\n {activeMeso != null && (\n <Breadcrumbs\n crumbs={buildBreadcrumbs(activeMeso, selectedWeek, activeWorkout)}\n onNavigate={navigateTo}\n />\n )}\n\n <View\n className=\"bg-surface-elevated border-hairline\"\n style={{\n borderWidth: 1,\n borderRadius: 12,\n padding: 12,\n }}\n testID=\"program-planning-page-body\"\n >\n {level === 'meso' && (\n <MesoLevel\n mesos={mesos}\n activeMesoId={activeMesoId}\n onSelectMeso={selectMeso}\n onSelectWeek={selectWeek}\n />\n )}\n {level === 'week' && activeWeek != null && (\n <WeekLevel week={activeWeek} onSelectWorkout={selectWorkout} />\n )}\n {level === 'workout' && activeWorkout != null && (\n <WorkoutLevel\n workout={activeWorkout}\n expandedExercise={expandedExercise}\n onToggleExercise={toggleExercise}\n />\n )}\n </View>\n </View>\n </View>\n )\n}\n"]}