@alfadocs/ui-kit-debug 0.44.0 → 0.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/dist/_chunks/{alia-sidebar-BpX4z_af.js → alia-sidebar-Be8FhKYd.js} +332 -237
  2. package/dist/_chunks/alia-sidebar-Be8FhKYd.js.map +1 -0
  3. package/dist/_chunks/{autocomplete-DIgdhCGJ.js → autocomplete-CDqxB68B.js} +2 -2
  4. package/dist/_chunks/{autocomplete-DIgdhCGJ.js.map → autocomplete-CDqxB68B.js.map} +1 -1
  5. package/dist/_chunks/bmi-calculator-CQqXTVNL.js +258 -0
  6. package/dist/_chunks/bmi-calculator-CQqXTVNL.js.map +1 -0
  7. package/dist/_chunks/{booking-CtLwaxkK.js → booking-DlDVuWMd.js} +2 -2
  8. package/dist/_chunks/{booking-CtLwaxkK.js.map → booking-DlDVuWMd.js.map} +1 -1
  9. package/dist/_chunks/{cycle-calculator-ChHBcjet.js → cycle-calculator-KxA8dqDf.js} +31 -20
  10. package/dist/_chunks/cycle-calculator-KxA8dqDf.js.map +1 -0
  11. package/dist/_chunks/{due-date-calculator-CYXKLoof.js → due-date-calculator-mFxpHLml.js} +51 -39
  12. package/dist/_chunks/due-date-calculator-mFxpHLml.js.map +1 -0
  13. package/dist/_chunks/{editable-currency-cell-renderer-9jqwDv5x.js → editable-currency-cell-renderer-BEBUQl9P.js} +2 -2
  14. package/dist/_chunks/{editable-currency-cell-renderer-9jqwDv5x.js.map → editable-currency-cell-renderer-BEBUQl9P.js.map} +1 -1
  15. package/dist/_chunks/{freemium-paywall-BLXESpH4.js → freemium-paywall-DzpD63WY.js} +2 -2
  16. package/dist/_chunks/{freemium-paywall-BLXESpH4.js.map → freemium-paywall-DzpD63WY.js.map} +1 -1
  17. package/dist/_chunks/{gestational-age-calculator-sRmoqgVr.js → gestational-age-calculator-gWI_uRA1.js} +52 -39
  18. package/dist/_chunks/gestational-age-calculator-gWI_uRA1.js.map +1 -0
  19. package/dist/_chunks/insert-result-C5ABnzDl.js +711 -0
  20. package/dist/_chunks/insert-result-C5ABnzDl.js.map +1 -0
  21. package/dist/_chunks/{marketplace-app-shell-Dc5cTIt8.js → marketplace-app-shell-Gfsf78ge.js} +2 -2
  22. package/dist/_chunks/{marketplace-app-shell-Dc5cTIt8.js.map → marketplace-app-shell-Gfsf78ge.js.map} +1 -1
  23. package/dist/_chunks/{patient-search-DPe2ZYEL.js → patient-search-CocVcGJ3.js} +2 -2
  24. package/dist/_chunks/{patient-search-DPe2ZYEL.js.map → patient-search-CocVcGJ3.js.map} +1 -1
  25. package/dist/_chunks/payment-form-BNTx4876.js +671 -0
  26. package/dist/_chunks/payment-form-BNTx4876.js.map +1 -0
  27. package/dist/_chunks/{pdf-viewer-B6MC6VTx.js → pdf-viewer-CWEXTlwq.js} +2 -2
  28. package/dist/_chunks/{pdf-viewer-B6MC6VTx.js.map → pdf-viewer-CWEXTlwq.js.map} +1 -1
  29. package/dist/_chunks/{practice-results-CrLpEiiW.js → practice-results-DDi-kvaD.js} +2 -2
  30. package/dist/_chunks/{practice-results-CrLpEiiW.js.map → practice-results-DDi-kvaD.js.map} +1 -1
  31. package/dist/_chunks/{pregnancy-weight-gain-C5YhfYnL.js → pregnancy-weight-gain-BtEHaSqy.js} +26 -13
  32. package/dist/_chunks/pregnancy-weight-gain-BtEHaSqy.js.map +1 -0
  33. package/dist/_chunks/{search-bar-CP6wUJFY.js → search-bar-CvN_S0jW.js} +2 -2
  34. package/dist/_chunks/{search-bar-CP6wUJFY.js.map → search-bar-CvN_S0jW.js.map} +1 -1
  35. package/dist/_chunks/{search-input-C1C3jQpD.js → search-input-D3aMvi4l.js} +2 -2
  36. package/dist/_chunks/{search-input-C1C3jQpD.js.map → search-input-D3aMvi4l.js.map} +1 -1
  37. package/dist/_chunks/{sign-document-B-3k_0LO.js → sign-document-BCyLpFHJ.js} +2 -2
  38. package/dist/_chunks/{sign-document-B-3k_0LO.js.map → sign-document-BCyLpFHJ.js.map} +1 -1
  39. package/dist/_chunks/{sign-in-with-alfadocs-button-DeHBFRNS.js → sign-in-with-alfadocs-button-CuYn_kKP.js} +2 -2
  40. package/dist/_chunks/{sign-in-with-alfadocs-button-DeHBFRNS.js.map → sign-in-with-alfadocs-button-CuYn_kKP.js.map} +1 -1
  41. package/dist/_chunks/{social-sign-in-button-X54ySJr1.js → social-sign-in-button-uJYLM366.js} +2 -2
  42. package/dist/_chunks/{social-sign-in-button-X54ySJr1.js.map → social-sign-in-button-uJYLM366.js.map} +1 -1
  43. package/dist/_chunks/{spinner-CCByyvcb.js → spinner-OjQNn8oN.js} +7 -3
  44. package/dist/_chunks/spinner-OjQNn8oN.js.map +1 -0
  45. package/dist/_chunks/{transcript-panel-CR7VY1uw.js → transcript-panel-B4HiC7ed.js} +2 -2
  46. package/dist/_chunks/{transcript-panel-CR7VY1uw.js.map → transcript-panel-B4HiC7ed.js.map} +1 -1
  47. package/dist/_chunks/{unit-converter-Ds9jalbN.js → unit-converter-u3CwNDpP.js} +63 -52
  48. package/dist/_chunks/unit-converter-u3CwNDpP.js.map +1 -0
  49. package/dist/_chunks/{wallet-pay-button-DK4ESYge.js → wallet-pay-button-DuDPBlCO.js} +2 -2
  50. package/dist/_chunks/{wallet-pay-button-DK4ESYge.js.map → wallet-pay-button-DuDPBlCO.js.map} +1 -1
  51. package/dist/agent-catalog.json +1 -1
  52. package/dist/components/_shared/banded-gauge.d.ts +193 -0
  53. package/dist/components/_shared/banded-gauge.d.ts.map +1 -0
  54. package/dist/components/_shared/insert-result.d.ts +81 -8
  55. package/dist/components/_shared/insert-result.d.ts.map +1 -1
  56. package/dist/components/autocomplete/index.js +1 -1
  57. package/dist/components/bmi-calculator/bmi-calculator.d.ts +2 -2
  58. package/dist/components/bmi-calculator/bmi-calculator.d.ts.map +1 -1
  59. package/dist/components/bmi-calculator/index.js +1 -1
  60. package/dist/components/booking/index.js +1 -1
  61. package/dist/components/cycle-calculator/cycle-calculator.d.ts +2 -2
  62. package/dist/components/cycle-calculator/cycle-calculator.d.ts.map +1 -1
  63. package/dist/components/cycle-calculator/index.js +1 -1
  64. package/dist/components/data-table/index.js +1 -1
  65. package/dist/components/due-date-calculator/due-date-calculator.d.ts +2 -2
  66. package/dist/components/due-date-calculator/due-date-calculator.d.ts.map +1 -1
  67. package/dist/components/due-date-calculator/index.js +1 -1
  68. package/dist/components/freemium-paywall/index.js +1 -1
  69. package/dist/components/gestational-age-calculator/gestational-age-calculator.d.ts +2 -2
  70. package/dist/components/gestational-age-calculator/gestational-age-calculator.d.ts.map +1 -1
  71. package/dist/components/gestational-age-calculator/index.js +1 -1
  72. package/dist/components/patient-search/index.js +1 -1
  73. package/dist/components/payment-form/index.js +1 -1
  74. package/dist/components/payment-form/payment-form.d.ts +30 -2
  75. package/dist/components/payment-form/payment-form.d.ts.map +1 -1
  76. package/dist/components/pdf-viewer/index.js +1 -1
  77. package/dist/components/practice-results/index.js +1 -1
  78. package/dist/components/pregnancy-weight-gain/index.js +1 -1
  79. package/dist/components/pregnancy-weight-gain/pregnancy-weight-gain.d.ts +2 -2
  80. package/dist/components/pregnancy-weight-gain/pregnancy-weight-gain.d.ts.map +1 -1
  81. package/dist/components/search-bar/index.js +1 -1
  82. package/dist/components/search-input/index.js +1 -1
  83. package/dist/components/sign-document/index.js +1 -1
  84. package/dist/components/sign-in-with-alfadocs-button/index.js +1 -1
  85. package/dist/components/social-sign-in-button/index.js +1 -1
  86. package/dist/components/spinner/index.js +1 -1
  87. package/dist/components/spinner/spinner.d.ts +2 -2
  88. package/dist/components/spinner/spinner.d.ts.map +1 -1
  89. package/dist/components/transcript-panel/index.js +1 -1
  90. package/dist/components/unit-converter/index.js +1 -1
  91. package/dist/components/unit-converter/unit-converter.d.ts +2 -2
  92. package/dist/components/unit-converter/unit-converter.d.ts.map +1 -1
  93. package/dist/components/wallet-pay-button/index.js +1 -1
  94. package/dist/i18n/locales/ar.d.ts +1 -1
  95. package/dist/i18n/locales/ar.js +1 -1
  96. package/dist/i18n/locales/ar.js.map +1 -1
  97. package/dist/i18n/locales/de.d.ts +1 -1
  98. package/dist/i18n/locales/de.js +1 -1
  99. package/dist/i18n/locales/de.js.map +1 -1
  100. package/dist/i18n/locales/el.d.ts +1 -1
  101. package/dist/i18n/locales/el.js +1 -1
  102. package/dist/i18n/locales/el.js.map +1 -1
  103. package/dist/i18n/locales/en.d.ts +1 -1
  104. package/dist/i18n/locales/en.js +1 -1
  105. package/dist/i18n/locales/en.js.map +1 -1
  106. package/dist/i18n/locales/es.d.ts +1 -1
  107. package/dist/i18n/locales/es.js +1 -1
  108. package/dist/i18n/locales/es.js.map +1 -1
  109. package/dist/i18n/locales/fr.d.ts +1 -1
  110. package/dist/i18n/locales/fr.js +1 -1
  111. package/dist/i18n/locales/fr.js.map +1 -1
  112. package/dist/i18n/locales/hi.d.ts +1 -1
  113. package/dist/i18n/locales/hi.js +1 -1
  114. package/dist/i18n/locales/hi.js.map +1 -1
  115. package/dist/i18n/locales/it.d.ts +1 -1
  116. package/dist/i18n/locales/it.js +1 -1
  117. package/dist/i18n/locales/it.js.map +1 -1
  118. package/dist/i18n/locales/ja.d.ts +1 -1
  119. package/dist/i18n/locales/ja.js +1 -1
  120. package/dist/i18n/locales/ja.js.map +1 -1
  121. package/dist/i18n/locales/nl.d.ts +1 -1
  122. package/dist/i18n/locales/nl.js +1 -1
  123. package/dist/i18n/locales/nl.js.map +1 -1
  124. package/dist/i18n/locales/pl.d.ts +1 -1
  125. package/dist/i18n/locales/pl.js +1 -1
  126. package/dist/i18n/locales/pl.js.map +1 -1
  127. package/dist/i18n/locales/pt.d.ts +1 -1
  128. package/dist/i18n/locales/pt.js +1 -1
  129. package/dist/i18n/locales/pt.js.map +1 -1
  130. package/dist/i18n/locales/ro.d.ts +1 -1
  131. package/dist/i18n/locales/ro.js +1 -1
  132. package/dist/i18n/locales/ro.js.map +1 -1
  133. package/dist/i18n/locales/ru.d.ts +1 -1
  134. package/dist/i18n/locales/ru.js +1 -1
  135. package/dist/i18n/locales/ru.js.map +1 -1
  136. package/dist/i18n/locales/sq.d.ts +1 -1
  137. package/dist/i18n/locales/sq.js +1 -1
  138. package/dist/i18n/locales/sq.js.map +1 -1
  139. package/dist/i18n/locales/sv.d.ts +1 -1
  140. package/dist/i18n/locales/sv.js +1 -1
  141. package/dist/i18n/locales/sv.js.map +1 -1
  142. package/dist/i18n/locales/tr.d.ts +1 -1
  143. package/dist/i18n/locales/tr.js +1 -1
  144. package/dist/i18n/locales/tr.js.map +1 -1
  145. package/dist/i18n/locales/zh.d.ts +1 -1
  146. package/dist/i18n/locales/zh.js +1 -1
  147. package/dist/i18n/locales/zh.js.map +1 -1
  148. package/dist/index.js +25 -25
  149. package/dist/locales/ar.json +1 -1
  150. package/dist/locales/de.json +1 -1
  151. package/dist/locales/el.json +1 -1
  152. package/dist/locales/en.json +1 -1
  153. package/dist/locales/es.json +1 -1
  154. package/dist/locales/fr.json +1 -1
  155. package/dist/locales/hi.json +1 -1
  156. package/dist/locales/it.json +1 -1
  157. package/dist/locales/ja.json +1 -1
  158. package/dist/locales/nl.json +1 -1
  159. package/dist/locales/pl.json +1 -1
  160. package/dist/locales/pt.json +1 -1
  161. package/dist/locales/ro.json +1 -1
  162. package/dist/locales/ru.json +1 -1
  163. package/dist/locales/sq.json +1 -1
  164. package/dist/locales/sv.json +1 -1
  165. package/dist/locales/tr.json +1 -1
  166. package/dist/locales/zh.json +1 -1
  167. package/dist/patterns/alia-assistant/alia-chat-surface.d.ts.map +1 -1
  168. package/dist/patterns/alia-assistant/alia-types.d.ts +20 -0
  169. package/dist/patterns/alia-assistant/alia-types.d.ts.map +1 -1
  170. package/dist/patterns/alia-assistant/index.js +1 -1
  171. package/dist/patterns/marketplace-app-shell/index.js +1 -1
  172. package/dist/tokens/themes/bridges/stripe-appearance.d.ts.map +1 -1
  173. package/dist/tokens.css +1 -1
  174. package/package.json +1 -1
  175. package/dist/_chunks/alia-sidebar-BpX4z_af.js.map +0 -1
  176. package/dist/_chunks/bmi-calculator-DFPWL2OJ.js +0 -273
  177. package/dist/_chunks/bmi-calculator-DFPWL2OJ.js.map +0 -1
  178. package/dist/_chunks/cycle-calculator-ChHBcjet.js.map +0 -1
  179. package/dist/_chunks/due-date-calculator-CYXKLoof.js.map +0 -1
  180. package/dist/_chunks/gestational-age-calculator-sRmoqgVr.js.map +0 -1
  181. package/dist/_chunks/insert-result-CoC1oo6R.js +0 -334
  182. package/dist/_chunks/insert-result-CoC1oo6R.js.map +0 -1
  183. package/dist/_chunks/payment-form-BzVsG6Ks.js +0 -590
  184. package/dist/_chunks/payment-form-BzVsG6Ks.js.map +0 -1
  185. package/dist/_chunks/pregnancy-weight-gain-C5YhfYnL.js.map +0 -1
  186. package/dist/_chunks/spinner-CCByyvcb.js.map +0 -1
  187. package/dist/_chunks/unit-converter-Ds9jalbN.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"gestational-age-calculator-sRmoqgVr.js","sources":["../../src/components/gestational-age-calculator/gestational-age-calculator.tsx"],"sourcesContent":["/* ------------------------------------------------------------------ */\n/* GestationalAgeCalculator — current gestational age, trimester and */\n/* milestone dates, from either a known LMP or a known due date. */\n/* */\n/* Reuses the shared `gestation` maths from due-date-calculator: GA day */\n/* 0 is the LMP; from an EDD we back out LMP = EDD − 280 days. */\n/* ------------------------------------------------------------------ */\n\nimport { forwardRef, useEffect, useMemo, useState } from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { subDays, isAfter } from 'date-fns';\nimport { RadioGroup, Radio } from '../radio-group';\nimport { FormField } from '../form-field';\nimport { DatePicker } from '../date-picker';\nimport { Card } from '../card';\nimport { Badge } from '../badge';\nimport {\n InsertButton,\n type InsertPayload,\n type InsertVariant,\n type InsertMode,\n} from '../_shared/insert-result';\nimport {\n type Trimester,\n type GestationalAge,\n computeDueDate,\n gestationalMilestones,\n GESTATION_DAYS,\n} from '../due-date-calculator';\n\nconst rootVariants = cva('ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]', {\n variants: {\n width: { full: 'ds:w-full', auto: 'ds:inline-flex' },\n },\n defaultVariants: { width: 'full' },\n});\n\nconst TRIMESTER_BADGE: Record<\n Trimester,\n 'neutral' | 'info' | 'success' | 'warning' | 'error'\n> = {\n preconception: 'neutral',\n first: 'info',\n second: 'success',\n third: 'warning',\n postterm: 'error',\n};\n\n/**\n * DS token NAME backing each trimester's result-card chip — the solid-fill\n * companion of the on-screen `TRIMESTER_BADGE` variant (Badge `error` fills\n * `--destructive`; `neutral` fills `--muted`). Passed as the card's\n * `highlightToken` so the inserted PNG chip matches the on-screen trimester\n * badge; `InsertButton` resolves the name to a concrete colour at raster time.\n */\nconst TRIMESTER_HIGHLIGHT_TOKEN: Record<Trimester, string> = {\n preconception: '--muted',\n first: '--info',\n second: '--success',\n third: '--warning',\n postterm: '--destructive',\n};\n\ntype DateMethod = 'lmp' | 'edd';\n\nexport interface GestationalAgeResult {\n gestationalAge: GestationalAge | null;\n trimester: Trimester;\n dueDate: Date;\n}\n\nexport interface GestationalAgeCalculatorProps extends VariantProps<\n typeof rootVariants\n> {\n /** Whether the input date is the last period (`lmp`) or the due date (`edd`). */\n defaultMethod?: DateMethod;\n /** Fires whenever a result can be computed (and `null` when it can't). */\n onResultChange?: (result: GestationalAgeResult | null) => void;\n /** When provided, shows the result-action buttons that emit / copy the result. */\n onInsert?: (payload: InsertPayload) => void;\n /**\n * Which verb the result button performs. Defaults to `'insert'`.\n * Use `'copy'` in an app-shell surface (no editor to insert into) — the\n * button writes the result to the clipboard as a multi-format `ClipboardItem`.\n */\n insertVariant?: InsertVariant;\n /** `copy` variant only — fired after a successful clipboard write. */\n onCopy?: (mode: InsertMode) => void;\n /** `copy` variant only — fired if the clipboard write can't proceed. */\n onError?: (error: unknown) => void;\n /**\n * Brand wordmark printed in the inserted/copied result-card footer.\n * Omitted → the default `'AlfaDocs'` wordmark; a string overrides it;\n * `false` removes the brand line.\n */\n insertBrand?: string | false;\n /** Opaque instance id, emitted as `data-component-id`. */\n id?: string;\n /** Extra class names on the wrapper. */\n className?: string;\n}\n\nexport const GestationalAgeCalculator = forwardRef<\n HTMLDivElement,\n GestationalAgeCalculatorProps\n>(\n (\n {\n defaultMethod = 'lmp',\n onResultChange,\n onInsert,\n insertVariant = 'insert',\n onCopy,\n onError,\n insertBrand,\n id,\n width,\n className,\n },\n ref,\n ) => {\n const { t, i18n } = useTranslation();\n\n const [method, setMethod] = useState<DateMethod>(defaultMethod);\n const [refDate, setRefDate] = useState<Date | undefined>(undefined);\n\n const today = useMemo(() => new Date(), []);\n\n const data = useMemo(() => {\n if (!refDate) return null;\n // Normalise to an LMP, then reuse the shared gestation maths.\n const lmp = method === 'lmp' ? refDate : subDays(refDate, GESTATION_DAYS);\n const r = computeDueDate({ method: 'lmp', date: lmp }, today);\n return {\n result: {\n gestationalAge: r.gestationalAge,\n trimester: r.trimester,\n dueDate: r.dueDate,\n } satisfies GestationalAgeResult,\n milestones: gestationalMilestones(r.gestationalStart),\n };\n }, [method, refDate, today]);\n\n const dateFormatter = useMemo(\n () => new Intl.DateTimeFormat(i18n.language, { dateStyle: 'medium' }),\n [i18n.language],\n );\n\n useEffect(() => {\n onResultChange?.(data?.result ?? null);\n }, [data, onResultChange]);\n\n const gaText = (ga: GestationalAge | null): string =>\n ga\n ? t('gestationalAgeCalculator.gestation', {\n weeks: ga.weeks,\n days: ga.days,\n })\n : '—';\n\n return (\n <div\n ref={ref}\n data-component=\"gestational-age-calculator\"\n data-component-id={id}\n className={rootVariants({ width, className })}\n >\n <RadioGroup\n label={t('gestationalAgeCalculator.method.label')}\n variant=\"horizontal\"\n value={method}\n onValueChange={(next) => setMethod(next as DateMethod)}\n >\n <Radio label={t('gestationalAgeCalculator.method.lmp')} value=\"lmp\" />\n <Radio label={t('gestationalAgeCalculator.method.edd')} value=\"edd\" />\n </RadioGroup>\n\n <FormField\n label={t(\n method === 'lmp'\n ? 'gestationalAgeCalculator.lmpDate'\n : 'gestationalAgeCalculator.eddDate',\n )}\n >\n <DatePicker\n value={refDate}\n onChange={setRefDate}\n maxDate={method === 'lmp' ? today : undefined}\n />\n </FormField>\n\n <p className=\"ds:sr-only\" role=\"status\" aria-live=\"polite\">\n {data\n ? `${t('gestationalAgeCalculator.gestationLabel')}: ${gaText(\n data.result.gestationalAge,\n )}. ${t('gestationalAgeCalculator.trimesterLabel')}: ${t(\n `gestationalAgeCalculator.trimester.${data.result.trimester}`,\n )}.`\n : ''}\n </p>\n\n {data ? (\n <Card variant=\"elevated\">\n <Card.Body className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-md)]\">\n <dl className=\"ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:sm:grid-cols-2\">\n <div className=\"ds:flex ds:flex-col ds:items-start ds:gap-[var(--spacing-xs)]\">\n <dt className=\"type-label ds:text-muted-foreground\">\n {t('gestationalAgeCalculator.trimesterLabel')}\n </dt>\n <dd>\n <Badge\n variant={TRIMESTER_BADGE[data.result.trimester]}\n size=\"lg\"\n >\n {t(\n `gestationalAgeCalculator.trimester.${data.result.trimester}`,\n )}\n </Badge>\n </dd>\n </div>\n <div className=\"ds:flex ds:flex-col ds:items-end ds:gap-[var(--spacing-xs)] ds:text-end\">\n <dt className=\"type-label ds:text-muted-foreground\">\n {t('gestationalAgeCalculator.gestationLabel')}\n </dt>\n <dd className=\"type-metric ds:text-foreground\">\n {gaText(data.result.gestationalAge)}\n </dd>\n </div>\n </dl>\n\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]\">\n <span className=\"type-label ds:text-muted-foreground\">\n {t('gestationalAgeCalculator.milestonesLabel')}\n </span>\n <ul className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]\">\n {data.milestones.map((m) => {\n const reached = isAfter(today, m.date);\n return (\n <li\n key={m.key}\n className=\"ds:flex ds:items-center ds:justify-between ds:gap-[var(--spacing-md)]\"\n >\n <span className=\"type-body ds:text-foreground\">\n {t(`gestationalAgeCalculator.milestone.${m.key}`)}\n </span>\n <span className=\"ds:flex ds:items-center ds:gap-[var(--spacing-sm)]\">\n <span className=\"type-body ds:text-muted-foreground\">\n {dateFormatter.format(m.date)}\n </span>\n {reached ? (\n <Badge variant=\"success\">\n {t('gestationalAgeCalculator.reached')}\n </Badge>\n ) : null}\n </span>\n </li>\n );\n })}\n </ul>\n </div>\n {insertVariant === 'copy' || onInsert ? (\n <InsertButton\n onInsert={onInsert}\n variant={insertVariant}\n onCopy={onCopy}\n onError={onError}\n card={{\n title: t('insert.title.gestationalAge'),\n highlight: t(\n `gestationalAgeCalculator.trimester.${data.result.trimester}`,\n ),\n // Chip shares the trimester's semantic token so the\n // inserted PNG chip matches the on-screen trimester badge.\n highlightToken:\n TRIMESTER_HIGHLIGHT_TOKEN[data.result.trimester],\n brand: insertBrand,\n fields: [\n {\n label: t('gestationalAgeCalculator.gestationLabel'),\n value: gaText(data.result.gestationalAge),\n },\n {\n label: t('gestationalAgeCalculator.trimesterLabel'),\n value: t(\n `gestationalAgeCalculator.trimester.${data.result.trimester}`,\n ),\n },\n ],\n }}\n />\n ) : null}\n </Card.Body>\n </Card>\n ) : (\n <p className=\"type-body ds:text-muted-foreground\">\n {t('gestationalAgeCalculator.empty')}\n </p>\n )}\n </div>\n );\n },\n);\n\nGestationalAgeCalculator.displayName = 'GestationalAgeCalculator';\n"],"names":["rootVariants","cva","TRIMESTER_BADGE","TRIMESTER_HIGHLIGHT_TOKEN","GestationalAgeCalculator","forwardRef","defaultMethod","onResultChange","onInsert","insertVariant","onCopy","onError","insertBrand","id","width","className","ref","t","i18n","useTranslation","method","setMethod","useState","refDate","setRefDate","today","useMemo","data","lmp","subDays","GESTATION_DAYS","computeDueDate","gestationalMilestones","dateFormatter","useEffect","gaText","ga","jsxs","RadioGroup","next","jsx","Radio","FormField","DatePicker","Card","Badge","m","reached","isAfter","InsertButton"],"mappings":";;;;;;;;;;;;;;AA+BA,MAAMA,IAAeC,EAAI,kD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AAA,oBAC7D;AAAA,kBACF;AAAA,gBACF;AAAA,cACF;AAAA,YAAA,IAEA;AAAA,UAAA,EAAA,CACN,EAAA,CACF,IAEA,gBAAAa,EAAC,KAAA,EAAE,WAAU,sCACV,UAAAvB,EAAE,gCAAgC,EAAA,CACrC;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEAb,EAAyB,cAAc;"}
@@ -1,334 +0,0 @@
1
- import { jsxs as E, jsx as p } from "react/jsx-runtime";
2
- import { forwardRef as J, useRef as Q } from "react";
3
- import { useTranslation as Z } from "react-i18next";
4
- import { c as tt } from "./index-D2ZczOXr.js";
5
- import { B as et } from "./button-DD_0Xdmr.js";
6
- import { c as L } from "./createLucideIcon-CrFbzy84.js";
7
- import { I as nt } from "./image-C6RM5hfF.js";
8
- /**
9
- * @license lucide-react v1.8.0 - ISC
10
- *
11
- * This source code is licensed under the ISC license.
12
- * See the LICENSE file in the root directory of this source tree.
13
- */
14
- const ot = [
15
- [
16
- "path",
17
- {
18
- 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",
19
- key: "zw3jo"
20
- }
21
- ],
22
- [
23
- "path",
24
- {
25
- d: "M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",
26
- key: "1wduqc"
27
- }
28
- ],
29
- [
30
- "path",
31
- {
32
- d: "M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",
33
- key: "kqbvx6"
34
- }
35
- ]
36
- ], at = L("layers", ot);
37
- /**
38
- * @license lucide-react v1.8.0 - ISC
39
- *
40
- * This source code is licensed under the ISC license.
41
- * See the LICENSE file in the root directory of this source tree.
42
- */
43
- const it = [
44
- ["path", { d: "M12 4v16", key: "1654pz" }],
45
- ["path", { d: "M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2", key: "e0r10z" }],
46
- ["path", { d: "M9 20h6", key: "s66wpe" }]
47
- ], rt = L("type", it), st = ["fg", "muted", "accent", "border", "bg"], N = "--primary", D = 380, H = (t) => t.trim().replace(/^--/, "");
48
- function R(t) {
49
- const e = /* @__PURE__ */ new Set();
50
- if (t.highlight) {
51
- const o = t.highlightToken ?? N;
52
- e.add(o), e.add(`${o}-foreground`);
53
- }
54
- return t.gauge && e.add(t.gauge.colorToken), [...e];
55
- }
56
- function M(t, e = []) {
57
- const o = {
58
- fg: "currentColor",
59
- muted: "currentColor",
60
- accent: "currentColor",
61
- border: "currentColor",
62
- bg: "transparent",
63
- font: "sans-serif",
64
- tokens: {}
65
- };
66
- if (!t) return o;
67
- const n = (a) => {
68
- const r = t.querySelector(`[data-k="${a}"]`);
69
- return r && getComputedStyle(r).color || "currentColor";
70
- }, i = {};
71
- for (const a of e) {
72
- const r = t.querySelector(
73
- `[data-token="${H(a)}"]`
74
- );
75
- if (r) {
76
- const u = getComputedStyle(r).color;
77
- u && (i[a] = u);
78
- }
79
- }
80
- return {
81
- fg: n("fg"),
82
- muted: n("muted"),
83
- accent: n("accent"),
84
- border: n("border"),
85
- bg: n("bg"),
86
- font: getComputedStyle(t).fontFamily || "sans-serif",
87
- tokens: i
88
- };
89
- }
90
- function _(t, e, o) {
91
- var n;
92
- return e ? ((n = t.tokens) == null ? void 0 : n[e]) ?? o : o;
93
- }
94
- const f = (t) => t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
95
- function O(t) {
96
- const e = [t.title];
97
- t.highlight && e.push(t.highlight);
98
- for (const o of t.fields) e.push(`• ${o.label}: ${o.value}`);
99
- return e.join(`
100
- `);
101
- }
102
- function Y(t) {
103
- const e = t.fields.map((n) => `<li>${f(n.label)}: ${f(n.value)}</li>`).join(""), o = t.highlight ? `<p><strong>${f(t.highlight)}</strong></p>` : "";
104
- return `<p><strong>${f(t.title)}</strong></p>${o}<ul>${e}</ul>`;
105
- }
106
- const z = "AlfaDocs", m = 20, y = m + 18, T = 22, lt = 10, B = 22, S = 16, F = 12, ct = 12, V = 34, U = 9, k = (V + U) * 2;
107
- function A(t, e) {
108
- const o = e !== void 0 ? e : t.brand;
109
- return o === !1 ? !1 : typeof o == "string" ? o : z;
110
- }
111
- function ut(t) {
112
- if (typeof t.fraction == "number")
113
- return Math.min(1, Math.max(0, t.fraction));
114
- const e = parseFloat(t.value);
115
- return Number.isFinite(e) && typeof t.max == "number" && t.max > 0 ? Math.min(1, Math.max(0, e / t.max)) : 1;
116
- }
117
- function W(t, e) {
118
- const o = !!t.highlight, n = y + lt, i = (o ? n + T + S : y + S) + B - 6, a = i + Math.max(0, t.fields.length - 1) * B, r = o ? n : y, u = t.gauge ? r + k : 0, l = Math.max(a, u), c = e ? l + F + ct - 4 : l, d = Math.round(c + (e ? F : m));
119
- return { hasChip: o, chipY: n, firstFieldY: i, fieldsEndY: a, footerY: c, height: d };
120
- }
121
- function q(t, e) {
122
- return W(t, e !== !1).height;
123
- }
124
- function dt(t, e, o, n, i) {
125
- const a = V, r = 2 * Math.PI * a, u = ut(t), l = _(e, t.colorToken, e.accent), c = typeof t.segments == "number" && t.segments > 1 ? t.segments : 0, d = c ? 3 : 0, g = c ? r / c - d : r, $ = c ? `${g} ${d}` : "", v = `${r * u} ${r}`, w = `transform="rotate(-90 ${n} ${i})"`, s = f(
126
- t.label ? `${t.value} — ${t.label}` : t.value
127
- ), x = `<circle cx="${n}" cy="${i}" r="${a}" fill="none" stroke="${e.border}" stroke-width="${U}"${$ ? ` stroke-dasharray="${$}"` : ""} ${w}/>`, h = `<circle cx="${n}" cy="${i}" r="${a}" fill="none" stroke="${l}" stroke-width="${U}" stroke-linecap="round" stroke-dasharray="${v}" ${w}/>`, b = `<text x="${n}" y="${i + 1}" text-anchor="middle" dominant-baseline="middle" font-family="${o}" font-size="16" font-weight="700" fill="${e.fg}">${f(
128
- t.value
129
- )}</text>`, C = t.label ? `<text x="${n}" y="${i + 15}" text-anchor="middle" dominant-baseline="middle" font-family="${o}" font-size="9" fill="${e.muted}">${f(
130
- t.label
131
- )}</text>` : "";
132
- return `<g role="img" aria-label="${s}"><title>${s}</title>${x}${h}${b}${C}</g>`;
133
- }
134
- function ft(t, e, o, n) {
135
- const i = t.highlight, a = t.highlightToken ?? N, r = _(e, a, e.accent), u = _(e, `${a}-foreground`, e.bg), l = Math.round(i.length * 7.2 + 28), c = m + l / 2, d = n + T / 2 + 1;
136
- return `<rect x="${m}" y="${n}" width="${l}" height="${T}" rx="${T / 2}" fill="${r}"/><text x="${c}" y="${d}" text-anchor="middle" dominant-baseline="middle" font-family="${o}" font-size="12" font-weight="600" fill="${u}">${f(
137
- i
138
- )}</text>`;
139
- }
140
- function P(t, e, o = z) {
141
- const n = D, i = W(t, o !== !1), a = i.height, r = f(e.font);
142
- t.gauge ? n - m - k - 12 : n - m;
143
- const u = t.fields.map((g, $) => {
144
- const v = i.firstFieldY + $ * B;
145
- return `<text x="${m}" y="${v}" font-family="${r}" font-size="13"><tspan fill="${e.muted}">${f(
146
- g.label
147
- )}: </tspan><tspan fill="${e.fg}">${f(g.value)}</tspan></text>`;
148
- }).join(""), l = i.hasChip ? ft(t, e, r, i.chipY) : "", c = t.gauge ? dt(
149
- t.gauge,
150
- e,
151
- r,
152
- n - m - k / 2,
153
- (i.hasChip ? i.chipY : y) + k / 2
154
- ) : "", d = o !== !1 ? `<text x="${m}" y="${i.footerY}" font-family="${r}" font-size="10" fill="${e.muted}">${f(
155
- o
156
- )}</text>` : "";
157
- return `<svg xmlns="http://www.w3.org/2000/svg" width="${n}" height="${a}" viewBox="0 0 ${n} ${a}" role="img" aria-label="${f(
158
- t.title
159
- )}"><rect x="0.5" y="0.5" width="${n - 1}" height="${a - 1}" rx="12" fill="${e.bg}" stroke="${e.border}"/><text x="${m}" y="${y}" font-family="${r}" font-size="16" font-weight="700" fill="${e.fg}">${f(
160
- t.title
161
- )}</text>${l}${c}${u}${d}</svg>`;
162
- }
163
- function mt() {
164
- var t;
165
- return typeof navigator < "u" && typeof ((t = navigator.clipboard) == null ? void 0 : t.write) == "function" && typeof ClipboardItem < "u";
166
- }
167
- function j(t, e, o) {
168
- return new Promise((n, i) => {
169
- const a = new Image();
170
- a.decoding = "async", a.onload = () => {
171
- const r = document.createElement("canvas");
172
- r.width = e, r.height = o;
173
- const u = r.getContext("2d");
174
- if (!u) {
175
- i(new Error("2D canvas context unavailable"));
176
- return;
177
- }
178
- u.drawImage(a, 0, 0, e, o), r.toBlob((l) => {
179
- l ? n(l) : i(new Error("canvas.toBlob produced no PNG"));
180
- }, "image/png");
181
- }, a.onerror = () => i(new Error("SVG failed to decode as an image")), a.src = t;
182
- });
183
- }
184
- function K() {
185
- const t = typeof window < "u" && typeof window.devicePixelRatio == "number" ? window.devicePixelRatio : 1;
186
- return Math.max(2, t);
187
- }
188
- async function Mt(t, e = {}) {
189
- return (await X(t, e)).dataUri;
190
- }
191
- async function X(t, e = {}) {
192
- const { colours: o, scale: n = K() } = e, i = o ?? M(null), a = A(t, e.brand), r = P(t, i, a), u = `data:image/svg+xml,${encodeURIComponent(r)}`, l = D, c = q(t, a), d = await j(
193
- u,
194
- Math.round(l * n),
195
- Math.round(c * n)
196
- );
197
- return { dataUri: await gt(d), width: l, height: c };
198
- }
199
- function gt(t) {
200
- return new Promise((e, o) => {
201
- const n = new FileReader();
202
- n.onload = () => e(String(n.result)), n.onerror = () => o(n.error ?? new Error("FileReader error")), n.readAsDataURL(t);
203
- });
204
- }
205
- async function ht(t, e, o) {
206
- const n = O(e), i = new Blob([n], { type: "text/plain" });
207
- if (t === "text")
208
- return new ClipboardItem({ "text/plain": i });
209
- const a = A(e, void 0), r = P(e, o, a), u = `data:image/svg+xml,${encodeURIComponent(r)}`, l = K(), c = await j(
210
- u,
211
- Math.round(D * l),
212
- Math.round(q(e, a) * l)
213
- );
214
- if (t === "image")
215
- return new ClipboardItem({ "image/png": c, "text/plain": i });
216
- const d = new Blob([Y(e)], { type: "text/html" });
217
- return new ClipboardItem({
218
- "text/html": d,
219
- "image/png": c,
220
- "text/plain": i
221
- });
222
- }
223
- const pt = tt(
224
- "ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]",
225
- {
226
- variants: {
227
- variant: {
228
- insert: "",
229
- copy: ""
230
- }
231
- },
232
- defaultVariants: { variant: "insert" }
233
- }
234
- ), $t = ["text", "image", "text-image"], xt = {
235
- text: /* @__PURE__ */ p(rt, { "aria-hidden": !0 }),
236
- image: /* @__PURE__ */ p(nt, { "aria-hidden": !0 }),
237
- "text-image": /* @__PURE__ */ p(at, { "aria-hidden": !0 })
238
- }, G = {
239
- insert: {
240
- text: "insert.text",
241
- image: "insert.image",
242
- "text-image": "insert.textImage"
243
- },
244
- copy: {
245
- text: "insert.copyText",
246
- image: "insert.copyImage",
247
- "text-image": "insert.copyTextImage"
248
- }
249
- }, bt = J(
250
- function({
251
- card: e,
252
- variant: o = "insert",
253
- onInsert: n,
254
- onCopy: i,
255
- onError: a,
256
- size: r = "sm",
257
- intent: u = "primary"
258
- }, l) {
259
- const { t: c } = Z(), d = Q(null), g = (s) => {
260
- const x = O(e), h = Y(e);
261
- let b = "", C = "";
262
- const I = s === "text" ? null : M(d.current, R(e));
263
- return I && (b = P(e, I, A(e, void 0)), C = `data:image/svg+xml,${encodeURIComponent(b)}`), { mode: s, text: x, html: h, svg: b, imageDataUri: C, pngDataUri: () => I ? X(e, { colours: I }) : Promise.resolve({ dataUri: "", width: 0, height: 0 }) };
264
- }, w = o === "copy" ? (s) => {
265
- if (!mt()) {
266
- a == null || a(new Error("Clipboard write unavailable in this context"));
267
- return;
268
- }
269
- const x = M(
270
- d.current,
271
- R(e)
272
- );
273
- (async () => {
274
- try {
275
- const h = await ht(s, e, x);
276
- await navigator.clipboard.write([h]), i == null || i(s);
277
- } catch (h) {
278
- a == null || a(h);
279
- }
280
- })();
281
- } : (s) => {
282
- n == null || n(g(s));
283
- };
284
- return /* @__PURE__ */ E(
285
- "div",
286
- {
287
- ref: l,
288
- "data-component": "insert-result",
289
- "data-variant": o,
290
- className: pt({ variant: o }),
291
- children: [
292
- /* @__PURE__ */ E("span", { ref: d, "aria-hidden": !0, className: "ds:sr-only", children: [
293
- st.map((s) => /* @__PURE__ */ p(
294
- "span",
295
- {
296
- "data-k": s,
297
- className: s === "fg" ? "ds:text-foreground" : s === "muted" ? "ds:text-muted-foreground" : s === "accent" ? "ds:text-[color:var(--primary)]" : s === "border" ? "ds:text-[color:var(--border)]" : "ds:text-[color:var(--card)]"
298
- },
299
- s
300
- )),
301
- R(e).map((s) => /* @__PURE__ */ p(
302
- "span",
303
- {
304
- "data-token": H(s),
305
- className: `ds:text-[color:var(${s})]`
306
- },
307
- s
308
- ))
309
- ] }),
310
- $t.map((s) => /* @__PURE__ */ p(
311
- et,
312
- {
313
- type: "button",
314
- intent: u,
315
- size: r,
316
- startIcon: xt[s],
317
- "aria-label": c(G[o][s]),
318
- onClick: () => w(s),
319
- children: c(G[o][s])
320
- },
321
- s
322
- ))
323
- ]
324
- }
325
- );
326
- }
327
- );
328
- bt.displayName = "InsertButton";
329
- export {
330
- bt as I,
331
- Mt as a,
332
- X as s
333
- };
334
- //# sourceMappingURL=insert-result-CoC1oo6R.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"insert-result-CoC1oo6R.js","sources":["../../node_modules/lucide-react/dist/esm/icons/layers.js","../../node_modules/lucide-react/dist/esm/icons/type.js","../../src/components/_shared/insert-result.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.8.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst __iconNode = [\n [\n \"path\",\n {\n 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 key: \"zw3jo\"\n }\n ],\n [\n \"path\",\n {\n d: \"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12\",\n key: \"1wduqc\"\n }\n ],\n [\n \"path\",\n {\n d: \"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17\",\n key: \"kqbvx6\"\n }\n ]\n];\nconst Layers = createLucideIcon(\"layers\", __iconNode);\n\nexport { __iconNode, Layers as default };\n//# sourceMappingURL=layers.js.map\n","/**\n * @license lucide-react v1.8.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst __iconNode = [\n [\"path\", { d: \"M12 4v16\", key: \"1654pz\" }],\n [\"path\", { d: \"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2\", key: \"e0r10z\" }],\n [\"path\", { d: \"M9 20h6\", key: \"s66wpe\" }]\n];\nconst Type = createLucideIcon(\"type\", __iconNode);\n\nexport { __iconNode, Type as default };\n//# sourceMappingURL=type.js.map\n","/* ------------------------------------------------------------------ */\n/* InsertButton — shared \"use this result\" control for the calculator */\n/* toolset. */\n/* */\n/* Two variants, one set of payload builders: */\n/* */\n/* • `insert` (default) — editor-extension context. Each button hands */\n/* the built InsertPayload to `onInsert`, who drops it into whatever */\n/* editor they use. The kit never touches an editor. */\n/* */\n/* • `copy` — app-shell context. Each button writes the chosen */\n/* representation(s) to the clipboard as a multi-format ClipboardItem */\n/* so a single copy serves any paste target. The image format is a */\n/* REAL raster PNG (the SVG card rasterised to a canvas) — clipboards */\n/* reject SVG as an image, so copying the data-URI as text is the */\n/* exact \"copied text without the image\" bug this variant fixes. */\n/* */\n/* Three inline buttons, one per mode (text / image / text + image). */\n/* */\n/* The SVG card embeds CONCRETE colours so it renders standalone as an */\n/* <img>. To stay within the \"no hardcoded colours\" rule, those colours */\n/* are sampled at click time from hidden probe spans that carry the */\n/* token utility classes — i.e. resolved from the live theme, never */\n/* written as literals in source. */\n/* ------------------------------------------------------------------ */\n\nimport { forwardRef, useRef } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { cva } from 'class-variance-authority';\nimport { Type, Image as ImageIcon, Layers } from 'lucide-react';\nimport { Button, type ButtonProps } from '../button';\n\nexport type InsertMode = 'text' | 'image' | 'text-image';\n\nexport type InsertVariant = 'insert' | 'copy';\n\nexport interface InsertCardField {\n label: string;\n value: string;\n}\n\n/**\n * Optional radial gauge, drawn as a hand-rolled native-SVG donut (track\n * `<circle>` + value arc via `stroke-dasharray`) so it survives the\n * `<img>` → `<canvas>` → `toBlob` raster. No `<foreignObject>`, no charting lib.\n */\nexport interface InsertCardGauge {\n /** Big number rendered in the gauge centre (e.g. `'22.4'`). */\n value: string;\n /**\n * Filled fraction of the ring, `0`–`1`. Takes precedence when supplied;\n * otherwise derived from a `value`/`max` numeric parse (falling back to a\n * full ring when neither is numeric).\n */\n fraction?: number;\n /** Denominator used to derive `fraction` when `fraction` is omitted. */\n max?: number;\n /**\n * Number of evenly-spaced segment gaps to notch into the ring (e.g. `4` for\n * a quartered dial). `0`/omitted draws a continuous arc.\n */\n segments?: number;\n /**\n * DS token NAME for the arc colour — e.g. `'--success'`, `'--warning'`,\n * `'--destructive'`, `'--info'`, or the light-orange overweight override.\n * Resolved to a concrete colour from a probe span at raster time; never a\n * hex literal in source.\n */\n colorToken: string;\n /** Small category label under the value inside the ring. */\n label?: string;\n}\n\nexport interface InsertCardData {\n /** Card heading. */\n title: string;\n /** Key/value rows. */\n fields: InsertCardField[];\n /** Optional highlighted line, rendered as a category chip (pill). */\n highlight?: string;\n /**\n * DS token NAME for the highlight chip fill. Defaults to the accent token\n * (`--primary`). The chip text uses the matching `<token>-foreground` when it\n * resolves, else falls back to the card background for contrast.\n */\n highlightToken?: string;\n /** Optional radial gauge drawn natively in the card. */\n gauge?: InsertCardGauge;\n /**\n * Brand wordmark printed in the card footer.\n *\n * - omitted → the default `'AlfaDocs'` wordmark.\n * - a string → that custom wordmark.\n * - `false` → no brand line at all.\n *\n * A `brand` passed to {@link SvgCardToPngOptions} overrides this per-render.\n */\n brand?: string | false;\n}\n\nexport interface InsertPayload {\n /** Which button the user chose. */\n mode: InsertMode;\n /** Plain-text summary. Always present. */\n text: string;\n /** Rich HTML summary (heading + list). Always present. */\n html: string;\n /**\n * Branded SVG result-card markup. Empty for mode `'text'`.\n *\n * Kept for back-compat and for callers that need the live, copy-pasteable\n * vector. NOTE: SVG can carry `<script>` and is routinely stripped by\n * rich-text sanitisers, so it is NOT the format to insert into an editor —\n * use {@link InsertPayload.pngDataUri} for that.\n */\n svg: string;\n /**\n * SVG as an `image/svg+xml` data URI for `<img src>`. Empty for `'text'`.\n *\n * Same caveat as {@link InsertPayload.svg}: fine for a preview `<img>`, but a\n * sanitiser-stripped vector once it reaches an editor. Prefer\n * {@link InsertPayload.pngDataUri}.\n */\n imageDataUri: string;\n /**\n * Async thunk that resolves the result-card raster — the format intended for\n * editor insertion. PNG is a flat raster: it carries no script and survives\n * the rich-text sanitiser that strips SVG.\n *\n * Resolves to `{ dataUri, width, height }` where `width`/`height` are the\n * **logical (un-scaled) CSS pixel** dimensions: set them on the inserted\n * `<img width height>` and the supersampled (`>= 2×`) PNG renders crisp with\n * no consumer-side shim. For mode `'text'` resolves to an empty\n * `{ dataUri: '', width: 0, height: 0 }`. Rendered lazily so the synchronous\n * payload stays cheap; `await payload.pngDataUri()` only when you need it.\n *\n * @since 0.43.0 — this return shape changed from a bare `Promise<string>` to\n * `Promise<{ dataUri; width; height }>` (see CHANGELOG).\n */\n pngDataUri: () => Promise<InsertPngResult>;\n}\n\n/** Resolved PNG raster plus its logical (un-scaled) `<img>` dimensions. */\nexport interface InsertPngResult {\n /** `image/png` data URI, or `''` for the text-only mode. */\n dataUri: string;\n /** Logical (CSS px) width to set on the inserted `<img>`. `0` when empty. */\n width: number;\n /** Logical (CSS px) height to set on the inserted `<img>`. `0` when empty. */\n height: number;\n}\n\nexport interface InsertButtonProps {\n /** Structured result used to build every payload representation. */\n card: InsertCardData;\n /**\n * Verb the buttons perform. Defaults to `'insert'`.\n *\n * - `'insert'` — fires `onInsert(payload)` (editor-extension context).\n * - `'copy'` — writes the chosen representation(s) to the clipboard as a\n * multi-format `ClipboardItem` (app-shell context).\n */\n variant?: InsertVariant;\n /**\n * Receives the built payload when a button is pressed.\n *\n * Required for the `insert` variant; optional (and ignored) for `copy`.\n */\n onInsert?: (payload: InsertPayload) => void;\n /** `copy` variant only — fired after a successful clipboard write. */\n onCopy?: (mode: InsertMode) => void;\n /** `copy` variant only — fired if the clipboard write can't proceed. */\n onError?: (error: unknown) => void;\n /** Trigger size. Defaults to `'sm'`. */\n size?: 'sm' | 'md' | 'lg';\n /**\n * Visual intent of the three trigger buttons (text / image / text+image).\n * Mirrors the `Button` `intent` prop and applies to every trigger uniformly\n * so the three stay visually consistent. Defaults to `'primary'`.\n */\n intent?: ButtonProps['intent'];\n}\n\ninterface ThemeColours {\n fg: string;\n muted: string;\n accent: string;\n border: string;\n bg: string;\n font: string;\n /**\n * Concrete colours resolved from arbitrary DS token names, keyed by the token\n * name the caller passed (e.g. `'--success'`). Populated for the gauge arc\n * and the highlight chip; consulted by {@link buildResultCardSvg} via\n * {@link resolveToken}.\n */\n tokens?: Record<string, string>;\n}\n\n/* Fixed probe keys → the resolved colour they sample. */\nconst PROBE_KEYS = ['fg', 'muted', 'accent', 'border', 'bg'] as const;\n\n/** Default DS token names driving the chip and the on-token text colours. */\nconst DEFAULT_HIGHLIGHT_TOKEN = '--primary';\n\nconst SVG_W = 380;\n\n/** Strip a leading `--`/whitespace so a token name is a safe class/probe id. */\nconst tokenName = (token: string): string => token.trim().replace(/^--/, '');\n\n/**\n * Extra `<token>` → resolved-colour probes a given card needs beyond the five\n * fixed keys: the gauge arc colour, the highlight chip fill, and each token's\n * `-foreground` companion (for contrasting on-token text).\n */\nfunction extraTokensForCard(card: InsertCardData): string[] {\n const wanted = new Set<string>();\n if (card.highlight) {\n const fill = card.highlightToken ?? DEFAULT_HIGHLIGHT_TOKEN;\n wanted.add(fill);\n wanted.add(`${fill}-foreground`);\n }\n if (card.gauge) wanted.add(card.gauge.colorToken);\n return [...wanted];\n}\n\nfunction readThemeColours(\n probe: HTMLElement | null,\n extraTokens: string[] = [],\n): ThemeColours {\n const fallback: ThemeColours = {\n fg: 'currentColor',\n muted: 'currentColor',\n accent: 'currentColor',\n border: 'currentColor',\n bg: 'transparent',\n font: 'sans-serif',\n tokens: {},\n };\n if (!probe) return fallback;\n const read = (key: string): string => {\n const el = probe.querySelector<HTMLElement>(`[data-k=\"${key}\"]`);\n if (!el) return 'currentColor';\n return getComputedStyle(el).color || 'currentColor';\n };\n const tokens: Record<string, string> = {};\n for (const token of extraTokens) {\n const el = probe.querySelector<HTMLElement>(\n `[data-token=\"${tokenName(token)}\"]`,\n );\n if (el) {\n const colour = getComputedStyle(el).color;\n if (colour) tokens[token] = colour;\n }\n }\n return {\n fg: read('fg'),\n muted: read('muted'),\n accent: read('accent'),\n border: read('border'),\n bg: read('bg'),\n font: getComputedStyle(probe).fontFamily || 'sans-serif',\n tokens,\n };\n}\n\n/**\n * Internal resolved-colour shape, re-exported for tests that construct a card\n * raster without a live DOM probe. Not part of the public component API.\n */\nexport type ThemeColoursForTest = ThemeColours;\n\n/** Resolve a token NAME to a concrete colour, or a fallback when unsampled. */\nfunction resolveToken(\n c: ThemeColours,\n token: string | undefined,\n fallback: string,\n): string {\n if (!token) return fallback;\n return c.tokens?.[token] ?? fallback;\n}\n\nconst escapeXml = (s: string): string =>\n s\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n .replace(/\"/g, '&quot;');\n\nexport function buildResultText(card: InsertCardData): string {\n const lines = [card.title];\n if (card.highlight) lines.push(card.highlight);\n for (const f of card.fields) lines.push(`• ${f.label}: ${f.value}`);\n return lines.join('\\n');\n}\n\nexport function buildResultHtml(card: InsertCardData): string {\n const items = card.fields\n .map((f) => `<li>${escapeXml(f.label)}: ${escapeXml(f.value)}</li>`)\n .join('');\n const highlight = card.highlight\n ? `<p><strong>${escapeXml(card.highlight)}</strong></p>`\n : '';\n return `<p><strong>${escapeXml(card.title)}</strong></p>${highlight}<ul>${items}</ul>`;\n}\n\n/** Default brand wordmark printed in the footer when none is specified. */\nconst DEFAULT_BRAND = 'AlfaDocs';\n\n/* Layout constants — shared by the height calc and the markup builder. */\nconst PAD = 20;\nconst TITLE_BASELINE = PAD + 18;\nconst CHIP_H = 22;\nconst CHIP_GAP = 10;\nconst ROW_H = 22;\nconst FIELDS_GAP = 16;\nconst FOOTER_GAP = 12;\nconst FOOTER_H = 12;\nconst GAUGE_R = 34; // outer radius\nconst GAUGE_STROKE = 9;\nconst GAUGE_BOX = (GAUGE_R + GAUGE_STROKE) * 2; // gauge group bounding box\n\n/** Resolve the brand line for a render: option override wins over card field. */\nfunction resolveBrand(\n card: InsertCardData,\n override: string | false | undefined,\n): string | false {\n const value = override !== undefined ? override : card.brand;\n if (value === false) return false;\n if (typeof value === 'string') return value;\n return DEFAULT_BRAND;\n}\n\n/** Filled fraction `0`–`1` for a gauge, from `fraction` or `value`/`max`. */\nfunction gaugeFraction(gauge: InsertCardGauge): number {\n if (typeof gauge.fraction === 'number') {\n return Math.min(1, Math.max(0, gauge.fraction));\n }\n const v = parseFloat(gauge.value);\n if (Number.isFinite(v) && typeof gauge.max === 'number' && gauge.max > 0) {\n return Math.min(1, Math.max(0, v / gauge.max));\n }\n return 1;\n}\n\ninterface CardLayout {\n hasChip: boolean;\n chipY: number;\n firstFieldY: number;\n fieldsEndY: number;\n footerY: number;\n height: number;\n}\n\n/** Compute the vertical layout once; reused by height + markup. */\nfunction layoutCard(card: InsertCardData, hasBrand: boolean): CardLayout {\n const hasChip = Boolean(card.highlight);\n const chipY = TITLE_BASELINE + CHIP_GAP; // chip top\n const firstFieldY =\n (hasChip ? chipY + CHIP_H + FIELDS_GAP : TITLE_BASELINE + FIELDS_GAP) +\n ROW_H -\n 6;\n const fieldsEndY = firstFieldY + Math.max(0, card.fields.length - 1) * ROW_H;\n // Keep the body at least as tall as the gauge so the donut never clips.\n const bodyTop = hasChip ? chipY : TITLE_BASELINE;\n const gaugeFloor = card.gauge ? bodyTop + GAUGE_BOX : 0;\n const contentBottom = Math.max(fieldsEndY, gaugeFloor);\n const footerY = hasBrand\n ? contentBottom + FOOTER_GAP + FOOTER_H - 4\n : contentBottom;\n const height = Math.round(footerY + (hasBrand ? FOOTER_GAP : PAD));\n return { hasChip, chipY, firstFieldY, fieldsEndY, footerY, height };\n}\n\n/** Result-card SVG height for a given card — kept in sync with the markup. */\nfunction svgHeight(card: InsertCardData, brand: string | false): number {\n return layoutCard(card, brand !== false).height;\n}\n\n/**\n * Build the gauge group: a track `<circle>` plus a value arc drawn with\n * `stroke-dasharray`/`stroke-dashoffset` (optionally notched into `segments`),\n * a centred value + label, and a `<title>` accessible name. Pure native SVG —\n * never `<foreignObject>`.\n */\nfunction buildGauge(\n gauge: InsertCardGauge,\n c: ThemeColours,\n font: string,\n cx: number,\n cy: number,\n): string {\n const r = GAUGE_R;\n const circumference = 2 * Math.PI * r;\n const frac = gaugeFraction(gauge);\n const arc = resolveToken(c, gauge.colorToken, c.accent);\n const segments =\n typeof gauge.segments === 'number' && gauge.segments > 1\n ? gauge.segments\n : 0;\n // Notch the ring into evenly-spaced segments via a dasharray pattern.\n const gap = segments ? 3 : 0;\n const segLen = segments ? circumference / segments - gap : circumference;\n const trackDash = segments ? `${segLen} ${gap}` : '';\n const valueDash = `${circumference * frac} ${circumference}`;\n const rotate = `transform=\"rotate(-90 ${cx} ${cy})\"`;\n const title = escapeXml(\n gauge.label ? `${gauge.value} — ${gauge.label}` : gauge.value,\n );\n const track = `<circle cx=\"${cx}\" cy=\"${cy}\" r=\"${r}\" fill=\"none\" stroke=\"${c.border}\" stroke-width=\"${GAUGE_STROKE}\"${\n trackDash ? ` stroke-dasharray=\"${trackDash}\"` : ''\n } ${rotate}/>`;\n const valueArc = `<circle cx=\"${cx}\" cy=\"${cy}\" r=\"${r}\" fill=\"none\" stroke=\"${arc}\" stroke-width=\"${GAUGE_STROKE}\" stroke-linecap=\"round\" stroke-dasharray=\"${valueDash}\" ${rotate}/>`;\n const centreValue = `<text x=\"${cx}\" y=\"${cy + 1}\" text-anchor=\"middle\" dominant-baseline=\"middle\" font-family=\"${font}\" font-size=\"16\" font-weight=\"700\" fill=\"${c.fg}\">${escapeXml(\n gauge.value,\n )}</text>`;\n const centreLabel = gauge.label\n ? `<text x=\"${cx}\" y=\"${cy + 15}\" text-anchor=\"middle\" dominant-baseline=\"middle\" font-family=\"${font}\" font-size=\"9\" fill=\"${c.muted}\">${escapeXml(\n gauge.label,\n )}</text>`\n : '';\n return `<g role=\"img\" aria-label=\"${title}\"><title>${title}</title>${track}${valueArc}${centreValue}${centreLabel}</g>`;\n}\n\n/** Build the highlight chip: rounded `<rect>` pill + centred `<text>`. */\nfunction buildChip(\n card: InsertCardData,\n c: ThemeColours,\n font: string,\n y: number,\n): string {\n const text = card.highlight as string;\n const fillToken = card.highlightToken ?? DEFAULT_HIGHLIGHT_TOKEN;\n const fill = resolveToken(c, fillToken, c.accent);\n const textColour = resolveToken(c, `${fillToken}-foreground`, c.bg);\n // Rough monospace-free width estimate: glyph ≈ 7.2px at 12px + 28px padding.\n const chipW = Math.round(text.length * 7.2 + 28);\n const textX = PAD + chipW / 2;\n const textY = y + CHIP_H / 2 + 1;\n return `<rect x=\"${PAD}\" y=\"${y}\" width=\"${chipW}\" height=\"${CHIP_H}\" rx=\"${\n CHIP_H / 2\n }\" fill=\"${fill}\"/><text x=\"${textX}\" y=\"${textY}\" text-anchor=\"middle\" dominant-baseline=\"middle\" font-family=\"${font}\" font-size=\"12\" font-weight=\"600\" fill=\"${textColour}\">${escapeXml(\n text,\n )}</text>`;\n}\n\nexport function buildResultCardSvg(\n card: InsertCardData,\n c: ThemeColours,\n brand: string | false = DEFAULT_BRAND,\n): string {\n const W = SVG_W;\n const L = layoutCard(card, brand !== false);\n const H = L.height;\n const font = escapeXml(c.font);\n\n // Fields flow on the inline-start edge; when a gauge is present it sits on\n // the inline-end edge so the rows don't run under it.\n const fieldsRightEdge = card.gauge ? W - PAD - GAUGE_BOX - 12 : W - PAD;\n const rows = card.fields\n .map((f, i) => {\n const y = L.firstFieldY + i * ROW_H;\n return `<text x=\"${PAD}\" y=\"${y}\" font-family=\"${font}\" font-size=\"13\"><tspan fill=\"${c.muted}\">${escapeXml(\n f.label,\n )}: </tspan><tspan fill=\"${c.fg}\">${escapeXml(f.value)}</tspan></text>`;\n })\n .join('');\n\n const chip = L.hasChip ? buildChip(card, c, font, L.chipY) : '';\n\n const gauge = card.gauge\n ? buildGauge(\n card.gauge,\n c,\n font,\n W - PAD - GAUGE_BOX / 2,\n (L.hasChip ? L.chipY : TITLE_BASELINE) + GAUGE_BOX / 2,\n )\n : '';\n\n const footer =\n brand !== false\n ? `<text x=\"${PAD}\" y=\"${L.footerY}\" font-family=\"${font}\" font-size=\"10\" fill=\"${c.muted}\">${escapeXml(\n brand,\n )}</text>`\n : '';\n\n // `fieldsRightEdge` is reserved for future wrapping; referenced to keep the\n // intent explicit even though rows are single-line today.\n void fieldsRightEdge;\n\n return `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${W}\" height=\"${H}\" viewBox=\"0 0 ${W} ${H}\" role=\"img\" aria-label=\"${escapeXml(\n card.title,\n )}\"><rect x=\"0.5\" y=\"0.5\" width=\"${W - 1}\" height=\"${H - 1}\" rx=\"12\" fill=\"${c.bg}\" stroke=\"${c.border}\"/><text x=\"${PAD}\" y=\"${TITLE_BASELINE}\" font-family=\"${font}\" font-size=\"16\" font-weight=\"700\" fill=\"${c.fg}\">${escapeXml(\n card.title,\n )}</text>${chip}${gauge}${rows}${footer}</svg>`;\n}\n\n/* ------------------------------------------------------------------ */\n/* Clipboard helpers (copy variant) */\n/* ------------------------------------------------------------------ */\n\n/** True when a multi-format clipboard write is reachable in this context. */\nfunction canWriteRichClipboard(): boolean {\n return (\n typeof navigator !== 'undefined' &&\n typeof navigator.clipboard?.write === 'function' &&\n typeof ClipboardItem !== 'undefined'\n );\n}\n\n/**\n * Rasterise the result-card SVG data-URI to a PNG Blob. Clipboards reject\n * SVG as an image, so we load the SVG into an <img>, paint it onto a canvas\n * at the SVG's intrinsic size, and read the canvas back as `image/png`.\n */\nfunction rasteriseSvgToPng(\n imageDataUri: string,\n width: number,\n height: number,\n): Promise<Blob> {\n return new Promise<Blob>((resolve, reject) => {\n const img = new Image();\n img.decoding = 'async';\n img.onload = () => {\n const canvas = document.createElement('canvas');\n canvas.width = width;\n canvas.height = height;\n const ctx = canvas.getContext('2d');\n if (!ctx) {\n reject(new Error('2D canvas context unavailable'));\n return;\n }\n ctx.drawImage(img, 0, 0, width, height);\n canvas.toBlob((blob) => {\n if (blob) resolve(blob);\n else reject(new Error('canvas.toBlob produced no PNG'));\n }, 'image/png');\n };\n img.onerror = () => reject(new Error('SVG failed to decode as an image'));\n img.src = imageDataUri;\n });\n}\n\n/** Options for {@link svgCardToPngDataUri}. */\nexport interface SvgCardToPngOptions {\n /**\n * Resolved theme colours to paint into the card. When omitted, the card\n * renders with `currentColor` / transparent fallbacks (see\n * {@link buildResultCardSvg}) — pass sampled colours for a branded raster.\n */\n colours?: ThemeColours;\n /**\n * Device-pixel scale factor for the raster. `2` yields a retina-sharp PNG.\n * Defaults to `Math.max(2, devicePixelRatio)` so the inserted image is crisp\n * without a consumer-side supersampling shim.\n */\n scale?: number;\n /**\n * Brand wordmark for the footer. Omitted → the card's own `brand` (then the\n * default `'AlfaDocs'`); a string overrides it; `false` removes it.\n */\n brand?: string | false;\n}\n\n/** dpr-aware default raster scale — never below 2× so the PNG stays crisp. */\nfunction defaultRasterScale(): number {\n const dpr =\n typeof window !== 'undefined' && typeof window.devicePixelRatio === 'number'\n ? window.devicePixelRatio\n : 1;\n return Math.max(2, dpr);\n}\n\n/**\n * Render an {@link InsertCardData} result card to an `image/png` data URI.\n *\n * This is the format intended for editor insertion: a flat raster carries no\n * `<script>` and survives the rich-text sanitiser that strips inline SVG. The\n * card is built as SVG, loaded into an `<img>`, painted onto a canvas at the\n * card's intrinsic size (optionally scaled), and read back as `image/png`.\n *\n * Browser-only — relies on `Image`, `<canvas>`, and `canvas.toBlob`. Throws if\n * called in a non-DOM context or if the SVG fails to decode.\n */\nexport async function svgCardToPngDataUri(\n card: InsertCardData,\n opts: SvgCardToPngOptions = {},\n): Promise<string> {\n return (await svgCardToPng(card, opts)).dataUri;\n}\n\n/**\n * Like {@link svgCardToPngDataUri} but also returns the **logical (un-scaled)**\n * card dimensions so consumers can size the inserted `<img width height>` and\n * drop their own supersampling shim. The PNG itself is rasterised at `scale`\n * (default `Math.max(2, devicePixelRatio)`) for crispness.\n */\nexport async function svgCardToPng(\n card: InsertCardData,\n opts: SvgCardToPngOptions = {},\n): Promise<InsertPngResult> {\n const { colours, scale = defaultRasterScale() } = opts;\n const resolved: ThemeColours = colours ?? readThemeColours(null);\n const brand = resolveBrand(card, opts.brand);\n const svg = buildResultCardSvg(card, resolved, brand);\n const imageDataUri = `data:image/svg+xml,${encodeURIComponent(svg)}`;\n const logicalW = SVG_W;\n const logicalH = svgHeight(card, brand);\n const blob = await rasteriseSvgToPng(\n imageDataUri,\n Math.round(logicalW * scale),\n Math.round(logicalH * scale),\n );\n const dataUri = await blobToDataUri(blob);\n return { dataUri, width: logicalW, height: logicalH };\n}\n\n/** Read a Blob back as a `data:` URI string. */\nfunction blobToDataUri(blob: Blob): Promise<string> {\n return new Promise<string>((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => resolve(String(reader.result));\n reader.onerror = () =>\n reject(reader.error ?? new Error('FileReader error'));\n reader.readAsDataURL(blob);\n });\n}\n\n/** Build the per-mode ClipboardItem contents map for a copy. */\nasync function buildClipboardItem(\n mode: InsertMode,\n card: InsertCardData,\n colours: ThemeColours,\n): Promise<ClipboardItem> {\n const text = buildResultText(card);\n const textBlob = new Blob([text], { type: 'text/plain' });\n\n if (mode === 'text') {\n return new ClipboardItem({ 'text/plain': textBlob });\n }\n\n const brand = resolveBrand(card, undefined);\n const svg = buildResultCardSvg(card, colours, brand);\n const imageDataUri = `data:image/svg+xml,${encodeURIComponent(svg)}`;\n const scale = defaultRasterScale();\n const pngBlob = await rasteriseSvgToPng(\n imageDataUri,\n Math.round(SVG_W * scale),\n Math.round(svgHeight(card, brand) * scale),\n );\n\n if (mode === 'image') {\n return new ClipboardItem({ 'image/png': pngBlob, 'text/plain': textBlob });\n }\n\n const htmlBlob = new Blob([buildResultHtml(card)], { type: 'text/html' });\n return new ClipboardItem({\n 'text/html': htmlBlob,\n 'image/png': pngBlob,\n 'text/plain': textBlob,\n });\n}\n\n/* ------------------------------------------------------------------ */\n/* Component */\n/* ------------------------------------------------------------------ */\n\nconst rowVariants = cva(\n 'ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]',\n {\n variants: {\n variant: {\n insert: '',\n copy: '',\n },\n },\n defaultVariants: { variant: 'insert' },\n },\n);\n\nconst MODES: readonly InsertMode[] = ['text', 'image', 'text-image'] as const;\n\nconst MODE_ICON: Record<InsertMode, React.ReactNode> = {\n text: <Type aria-hidden />,\n image: <ImageIcon aria-hidden />,\n 'text-image': <Layers aria-hidden />,\n};\n\n/* i18n leaf keys per variant × mode — bare keys against the `ui` namespace. */\nconst LABEL_KEY: Record<InsertVariant, Record<InsertMode, string>> = {\n insert: {\n text: 'insert.text',\n image: 'insert.image',\n 'text-image': 'insert.textImage',\n },\n copy: {\n text: 'insert.copyText',\n image: 'insert.copyImage',\n 'text-image': 'insert.copyTextImage',\n },\n};\n\nexport const InsertButton = forwardRef<HTMLDivElement, InsertButtonProps>(\n function InsertButton(\n {\n card,\n variant = 'insert',\n onInsert,\n onCopy,\n onError,\n size = 'sm',\n intent = 'primary',\n },\n ref,\n ) {\n const { t } = useTranslation();\n const probeRef = useRef<HTMLSpanElement>(null);\n\n const buildPayload = (mode: InsertMode): InsertPayload => {\n const text = buildResultText(card);\n const html = buildResultHtml(card);\n let svg = '';\n let imageDataUri = '';\n // Sample the live theme once, at click time (including any gauge/chip\n // token colours the card needs), so both the SVG fields and the lazy PNG\n // thunk paint with the same resolved colours.\n const colours =\n mode === 'text'\n ? null\n : readThemeColours(probeRef.current, extraTokensForCard(card));\n if (colours) {\n svg = buildResultCardSvg(card, colours, resolveBrand(card, undefined));\n imageDataUri = `data:image/svg+xml,${encodeURIComponent(svg)}`;\n }\n const pngDataUri = (): Promise<InsertPngResult> =>\n colours\n ? svgCardToPng(card, { colours })\n : Promise.resolve({ dataUri: '', width: 0, height: 0 });\n return { mode, text, html, svg, imageDataUri, pngDataUri };\n };\n\n const handleInsert = (mode: InsertMode): void => {\n onInsert?.(buildPayload(mode));\n };\n\n const handleCopy = (mode: InsertMode): void => {\n if (!canWriteRichClipboard()) {\n onError?.(new Error('Clipboard write unavailable in this context'));\n return;\n }\n const colours = readThemeColours(\n probeRef.current,\n extraTokensForCard(card),\n );\n void (async () => {\n try {\n const item = await buildClipboardItem(mode, card, colours);\n await navigator.clipboard.write([item]);\n onCopy?.(mode);\n } catch (error) {\n onError?.(error);\n }\n })();\n };\n\n const onActivate = variant === 'copy' ? handleCopy : handleInsert;\n\n return (\n <div\n ref={ref}\n data-component=\"insert-result\"\n data-variant={variant}\n className={rowVariants({ variant })}\n >\n {/* Hidden colour probes — sampled at click time so the SVG card uses\n the live theme's resolved colours (no literals in source). The\n fixed five plus any per-card gauge/chip token colours. */}\n <span ref={probeRef} aria-hidden className=\"ds:sr-only\">\n {PROBE_KEYS.map((k) => (\n <span\n key={k}\n data-k={k}\n className={\n k === 'fg'\n ? 'ds:text-foreground'\n : k === 'muted'\n ? 'ds:text-muted-foreground'\n : k === 'accent'\n ? 'ds:text-[color:var(--primary)]'\n : k === 'border'\n ? 'ds:text-[color:var(--border)]'\n : 'ds:text-[color:var(--card)]'\n }\n />\n ))}\n {extraTokensForCard(card).map((token) => (\n <span\n key={token}\n data-token={tokenName(token)}\n className={`ds:text-[color:var(${token})]`}\n />\n ))}\n </span>\n {MODES.map((mode) => (\n <Button\n key={mode}\n type=\"button\"\n intent={intent}\n size={size}\n startIcon={MODE_ICON[mode]}\n aria-label={t(LABEL_KEY[variant][mode])}\n onClick={() => onActivate(mode)}\n >\n {t(LABEL_KEY[variant][mode])}\n </Button>\n ))}\n </div>\n );\n },\n);\n\nInsertButton.displayName = 'InsertButton';\n"],"names":["__iconNode","Layers","createLucideIcon","Type","PROBE_KEYS","DEFAULT_HIGHLIGHT_TOKEN","SVG_W","tokenName","token","extraTokensForCard","card","wanted","fill","readThemeColours","probe","extraTokens","fallback","read","key","el","tokens","colour","resolveToken","c","_a","escapeXml","s","buildResultText","lines","f","buildResultHtml","items","highlight","DEFAULT_BRAND","PAD","TITLE_BASELINE","CHIP_H","CHIP_GAP","ROW_H","FIELDS_GAP","FOOTER_GAP","FOOTER_H","GAUGE_R","GAUGE_STROKE","GAUGE_BOX","resolveBrand","override","value","gaugeFraction","gauge","v","layoutCard","hasBrand","hasChip","chipY","firstFieldY","fieldsEndY","bodyTop","gaugeFloor","contentBottom","footerY","height","svgHeight","brand","buildGauge","font","cx","cy","r","circumference","frac","arc","segments","gap","segLen","trackDash","valueDash","rotate","title","track","valueArc","centreValue","centreLabel","buildChip","y","text","fillToken","textColour","chipW","textX","textY","buildResultCardSvg","W","L","H","rows","i","chip","footer","canWriteRichClipboard","rasteriseSvgToPng","imageDataUri","width","resolve","reject","img","canvas","ctx","blob","defaultRasterScale","dpr","svgCardToPngDataUri","opts","svgCardToPng","colours","scale","resolved","svg","logicalW","logicalH","blobToDataUri","reader","buildClipboardItem","mode","textBlob","pngBlob","htmlBlob","rowVariants","cva","MODES","MODE_ICON","jsx","ImageIcon","LABEL_KEY","InsertButton","forwardRef","variant","onInsert","onCopy","onError","size","intent","ref","t","useTranslation","probeRef","useRef","buildPayload","html","onActivate","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