@alfadocs/ui-kit-debug 1.4.12 → 1.4.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/actions-cell-renderer-BD-jruqA.js +1784 -0
- package/dist/_chunks/actions-cell-renderer-BD-jruqA.js.map +1 -0
- package/dist/_chunks/{anamnesis-summary-rows-DAIpD0Or.js → anamnesis-summary-rows-B5MAYkJ-.js} +2150 -2092
- package/dist/_chunks/anamnesis-summary-rows-B5MAYkJ-.js.map +1 -0
- package/dist/_chunks/{bmi-calculator-CxPn0T0s.js → bmi-calculator-DC5SaqXT.js} +2 -2
- package/dist/_chunks/{bmi-calculator-CxPn0T0s.js.map → bmi-calculator-DC5SaqXT.js.map} +1 -1
- package/dist/_chunks/{cycle-calculator-D9M7IKfh.js → cycle-calculator-B_NlctlQ.js} +2 -2
- package/dist/_chunks/{cycle-calculator-D9M7IKfh.js.map → cycle-calculator-B_NlctlQ.js.map} +1 -1
- package/dist/_chunks/{due-date-calculator-BkqZEvL4.js → due-date-calculator-le1z3KpW.js} +2 -2
- package/dist/_chunks/{due-date-calculator-BkqZEvL4.js.map → due-date-calculator-le1z3KpW.js.map} +1 -1
- package/dist/_chunks/{fetal-weight-C7JXGg6E.js → fetal-weight-DXA6ZpMq.js} +2 -2
- package/dist/_chunks/{fetal-weight-C7JXGg6E.js.map → fetal-weight-DXA6ZpMq.js.map} +1 -1
- package/dist/_chunks/{file-manager-DzWYcRpE.js → file-manager-BjCM2fZB.js} +2 -2
- package/dist/_chunks/{file-manager-DzWYcRpE.js.map → file-manager-BjCM2fZB.js.map} +1 -1
- package/dist/_chunks/{hcg-doubling-CFJlMH7Z.js → hcg-doubling-BT6lki_i.js} +2 -2
- package/dist/_chunks/{hcg-doubling-CFJlMH7Z.js.map → hcg-doubling-BT6lki_i.js.map} +1 -1
- package/dist/_chunks/{link-cell-renderer-DCCca2m3.js → link-cell-renderer-C7GvyK66.js} +2 -2
- package/dist/_chunks/{link-cell-renderer-DCCca2m3.js.map → link-cell-renderer-C7GvyK66.js.map} +1 -1
- package/dist/_chunks/number-input-CM1q9zvH.js +414 -0
- package/dist/_chunks/number-input-CM1q9zvH.js.map +1 -0
- package/dist/_chunks/{optical-prescription-Brs0CeP3.js → optical-prescription-CQR_WJiS.js} +2 -2
- package/dist/_chunks/{optical-prescription-Brs0CeP3.js.map → optical-prescription-CQR_WJiS.js.map} +1 -1
- package/dist/_chunks/{patient-details-CGhnfdUB.js → patient-details-CnFgF3MU.js} +2 -2
- package/dist/_chunks/{patient-details-CGhnfdUB.js.map → patient-details-CnFgF3MU.js.map} +1 -1
- package/dist/_chunks/{patient-table-D2fhV4mV.js → patient-table-BXzcrC79.js} +3 -3
- package/dist/_chunks/{patient-table-D2fhV4mV.js.map → patient-table-BXzcrC79.js.map} +1 -1
- package/dist/_chunks/{pregnancy-dating-iI6_j2K2.js → pregnancy-dating-4tPV_Yko.js} +2 -2
- package/dist/_chunks/{pregnancy-dating-iI6_j2K2.js.map → pregnancy-dating-4tPV_Yko.js.map} +1 -1
- package/dist/_chunks/{pregnancy-weight-gain-Co-YFMJZ.js → pregnancy-weight-gain-BBgbWBGe.js} +2 -2
- package/dist/_chunks/{pregnancy-weight-gain-Co-YFMJZ.js.map → pregnancy-weight-gain-BBgbWBGe.js.map} +1 -1
- package/dist/_chunks/{signature-status-chip-DUcTgQ0E.js → signature-status-chip-DlLJk1VA.js} +16 -14
- package/dist/_chunks/signature-status-chip-DlLJk1VA.js.map +1 -0
- package/dist/_chunks/{unit-converter-BeTicruA.js → unit-converter-Dsk__pjA.js} +2 -2
- package/dist/_chunks/{unit-converter-BeTicruA.js.map → unit-converter-Dsk__pjA.js.map} +1 -1
- package/dist/agent-catalog.json +14 -8
- package/dist/agent-i18n/en.json +3 -2
- package/dist/components/bmi-calculator/index.js +1 -1
- package/dist/components/cycle-calculator/index.js +1 -1
- package/dist/components/data-table/data-table.agent.d.ts.map +1 -1
- package/dist/components/data-table/data-table.d.ts +19 -0
- package/dist/components/data-table/data-table.d.ts.map +1 -1
- package/dist/components/data-table/expanded-row-renderer.d.ts +47 -0
- package/dist/components/data-table/expanded-row-renderer.d.ts.map +1 -0
- package/dist/components/data-table/index.d.ts +2 -0
- package/dist/components/data-table/index.d.ts.map +1 -1
- package/dist/components/data-table/index.js +31 -27
- package/dist/components/due-date-calculator/index.js +1 -1
- package/dist/components/fetal-weight/index.js +1 -1
- package/dist/components/file-manager/index.js +1 -1
- package/dist/components/hcg-doubling/index.js +1 -1
- package/dist/components/number-input/index.js +1 -1
- package/dist/components/number-input/number-input.d.ts +11 -0
- package/dist/components/number-input/number-input.d.ts.map +1 -1
- package/dist/components/optical-prescription/index.js +1 -1
- package/dist/components/patient-details/index.js +1 -1
- package/dist/components/patient-table/index.js +1 -1
- package/dist/components/pregnancy-dating/index.js +1 -1
- package/dist/components/pregnancy-weight-gain/index.js +1 -1
- package/dist/components/signature-status-chip/index.js +1 -1
- package/dist/components/signature-status-chip/signature-status-chip.d.ts.map +1 -1
- package/dist/components/unit-converter/index.js +1 -1
- package/dist/host-compat.css +4 -1
- package/dist/i18n/locales/ar.d.ts +1 -0
- package/dist/i18n/locales/ar.d.ts.map +1 -1
- package/dist/i18n/locales/ar.js +1 -0
- package/dist/i18n/locales/ar.js.map +1 -1
- package/dist/i18n/locales/de.d.ts +1 -0
- package/dist/i18n/locales/de.d.ts.map +1 -1
- package/dist/i18n/locales/de.js +1 -0
- package/dist/i18n/locales/de.js.map +1 -1
- package/dist/i18n/locales/el.d.ts +1 -0
- package/dist/i18n/locales/el.d.ts.map +1 -1
- package/dist/i18n/locales/el.js +1 -0
- package/dist/i18n/locales/el.js.map +1 -1
- package/dist/i18n/locales/en.d.ts +1 -0
- package/dist/i18n/locales/en.d.ts.map +1 -1
- package/dist/i18n/locales/en.js +1 -0
- package/dist/i18n/locales/en.js.map +1 -1
- package/dist/i18n/locales/es.d.ts +1 -0
- package/dist/i18n/locales/es.d.ts.map +1 -1
- package/dist/i18n/locales/es.js +1 -0
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.d.ts +1 -0
- package/dist/i18n/locales/fr.d.ts.map +1 -1
- package/dist/i18n/locales/fr.js +1 -0
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hi.d.ts +1 -0
- package/dist/i18n/locales/hi.d.ts.map +1 -1
- package/dist/i18n/locales/hi.js +1 -0
- package/dist/i18n/locales/hi.js.map +1 -1
- package/dist/i18n/locales/it.d.ts +1 -0
- package/dist/i18n/locales/it.d.ts.map +1 -1
- package/dist/i18n/locales/it.js +1 -0
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/ja.d.ts +1 -0
- package/dist/i18n/locales/ja.d.ts.map +1 -1
- package/dist/i18n/locales/ja.js +1 -0
- package/dist/i18n/locales/ja.js.map +1 -1
- package/dist/i18n/locales/nl.d.ts +1 -0
- package/dist/i18n/locales/nl.d.ts.map +1 -1
- package/dist/i18n/locales/nl.js +1 -0
- package/dist/i18n/locales/nl.js.map +1 -1
- package/dist/i18n/locales/pl.d.ts +1 -0
- package/dist/i18n/locales/pl.d.ts.map +1 -1
- package/dist/i18n/locales/pl.js +1 -0
- package/dist/i18n/locales/pl.js.map +1 -1
- package/dist/i18n/locales/pt.d.ts +1 -0
- package/dist/i18n/locales/pt.d.ts.map +1 -1
- package/dist/i18n/locales/pt.js +1 -0
- package/dist/i18n/locales/pt.js.map +1 -1
- package/dist/i18n/locales/ro.d.ts +1 -0
- package/dist/i18n/locales/ro.d.ts.map +1 -1
- package/dist/i18n/locales/ro.js +1 -0
- package/dist/i18n/locales/ro.js.map +1 -1
- package/dist/i18n/locales/ru.d.ts +1 -0
- package/dist/i18n/locales/ru.d.ts.map +1 -1
- package/dist/i18n/locales/ru.js +1 -0
- package/dist/i18n/locales/ru.js.map +1 -1
- package/dist/i18n/locales/sq.d.ts +1 -0
- package/dist/i18n/locales/sq.d.ts.map +1 -1
- package/dist/i18n/locales/sq.js +1 -0
- package/dist/i18n/locales/sq.js.map +1 -1
- package/dist/i18n/locales/sv.d.ts +1 -0
- package/dist/i18n/locales/sv.d.ts.map +1 -1
- package/dist/i18n/locales/sv.js +1 -0
- package/dist/i18n/locales/sv.js.map +1 -1
- package/dist/i18n/locales/tr.d.ts +1 -0
- package/dist/i18n/locales/tr.d.ts.map +1 -1
- package/dist/i18n/locales/tr.js +1 -0
- package/dist/i18n/locales/tr.js.map +1 -1
- package/dist/i18n/locales/zh.d.ts +1 -0
- package/dist/i18n/locales/zh.d.ts.map +1 -1
- package/dist/i18n/locales/zh.js +1 -0
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/index.js +779 -775
- package/dist/locales/ar.json +1 -0
- package/dist/locales/de.json +1 -0
- package/dist/locales/el.json +1 -0
- package/dist/locales/en.json +1 -0
- package/dist/locales/es.json +1 -0
- package/dist/locales/fr.json +1 -0
- package/dist/locales/hi.json +1 -0
- package/dist/locales/it.json +1 -0
- package/dist/locales/ja.json +1 -0
- package/dist/locales/nl.json +1 -0
- package/dist/locales/pl.json +1 -0
- package/dist/locales/pt.json +1 -0
- package/dist/locales/ro.json +1 -0
- package/dist/locales/ru.json +1 -0
- package/dist/locales/sq.json +1 -0
- package/dist/locales/sv.json +1 -0
- package/dist/locales/tr.json +1 -0
- package/dist/locales/zh.json +1 -0
- package/dist/patterns/anamnesis/anamnesis-evolution.d.ts.map +1 -1
- package/dist/patterns/anamnesis/anamnesis-field.d.ts.map +1 -1
- package/dist/patterns/anamnesis/anamnesis-i18n.d.ts.map +1 -1
- package/dist/patterns/anamnesis/anamnesis-intake.d.ts +5 -1
- package/dist/patterns/anamnesis/anamnesis-intake.d.ts.map +1 -1
- package/dist/patterns/anamnesis/index.js +1 -1
- package/dist/tokens.css +5 -2
- package/package.json +1 -1
- package/dist/_chunks/actions-cell-renderer-C67oj7mR.js +0 -1581
- package/dist/_chunks/actions-cell-renderer-C67oj7mR.js.map +0 -1
- package/dist/_chunks/anamnesis-summary-rows-DAIpD0Or.js.map +0 -1
- package/dist/_chunks/number-input-DOe5VYei.js +0 -370
- package/dist/_chunks/number-input-DOe5VYei.js.map +0 -1
- package/dist/_chunks/signature-status-chip-DUcTgQ0E.js.map +0 -1
package/dist/_chunks/{due-date-calculator-BkqZEvL4.js.map → due-date-calculator-le1z3KpW.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"due-date-calculator-BkqZEvL4.js","sources":["../../src/components/due-date-calculator/due-date-calculator.agent.ts","../../src/components/due-date-calculator/due-date-calculator.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — DueDateCalculator. */\n/* */\n/* Estimates the date of delivery from one of three dating methods (LMP / */\n/* conception / IVF transfer) plus current gestational age + trimester. */\n/* The agent surface is the dating inputs plus the computed EDD / GA; the */\n/* handle is the curated `DueDateCalculatorHandle` (the public `ref` */\n/* stays the root <div>, exactly as `slider.tsx` and `bmi-calculator.tsx` */\n/* keep theirs). */\n/* */\n/* Dates cross the boundary as local-time `yyyy-MM-dd` strings, never */\n/* `Date` objects, so nothing shifts a day under JSON/UTC serialisation. */\n/* */\n/* DEPRECATED surface: this component is superseded by PregnancyDating, */\n/* which unifies dating + gestational age. Prefer the `pregnancy-dating` */\n/* adapter for new work — every action here is marked deprecated. */\n/* */\n/* PHI (§7): never exposes patient identity — the slots return the */\n/* operator's own structural dating inputs and the dates derived from */\n/* them. See `src/docs/26-agent-readiness.mdx`. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { DueDateCalculatorHandle } from './due-date-calculator';\n\nconst DEPRECATED = 'Superseded by the `pregnancy-dating` adapter.';\n\n/** Shared JSON Schema fragment for a local calendar date. */\nconst isoDate = {\n type: 'string',\n pattern: '^\\\\d{4}-\\\\d{2}-\\\\d{2}$',\n} as const;\n\nexport const dueDateCalculatorAgent: AgentAdapter<DueDateCalculatorHandle> = {\n id: 'due-date-calculator',\n // set_value → the six `set_*` actions + the `inputs` state slot.\n capabilities: ['set_value'],\n state: {\n inputs: {\n type: '{ method: string, referenceDate: string | null, cycleLength: number | null, embryoAge: 3 | 5, crlMm: number | null, scanDate: string | null, asOfDate: string }',\n descriptionKey: 'ui.agent.dueDateCalculator.state.inputs',\n description:\n 'The dating inputs as entered — method, its reference date, cycle length (LMP), embryo age (IVF), the optional CRL + scan date, and the evaluation date. Dates are `yyyy-MM-dd`. Read this to see which method a reference date will be interpreted under.',\n read: (handle) => handle.getInputs(),\n },\n result: {\n type: '{ dueDate: string, gestationalStart: string, gestationalAge: { weeks: number, days: number, totalDays: number } | null, trimester: string } | null',\n descriptionKey: 'ui.agent.dueDateCalculator.state.result',\n description:\n 'Computed estimated delivery date, the GA day-0 anchor after any CRL re-dating, the gestational age as of the evaluation date, and the trimester band. Null until a reference date is set.',\n read: (handle) => handle.getResult(),\n },\n },\n actions: {\n set_method: {\n // Drives the same local input state a user picks; nothing is persisted\n // to a record, and the choice is reversible in the same UI.\n safety: 'write',\n argsType: \"{ method: 'lmp' | 'conception' | 'ivf' }\",\n argsSchema: {\n type: 'object',\n properties: {\n method: {\n enum: ['lmp', 'conception', 'ivf'],\n description:\n 'Which anchor to date from — last menstrual period, conception, or IVF transfer.',\n },\n },\n required: ['method'],\n additionalProperties: false,\n },\n idempotent: true,\n deprecated: DEPRECATED,\n returns: 'boolean',\n returnsSchema: {\n type: 'boolean',\n description: 'True when the method was applied.',\n },\n errors: [\n 'Returns false for a method outside the three supported anchors.',\n ],\n descriptionKey: 'ui.agent.dueDateCalculator.actions.setMethod',\n description:\n 'Choose which anchor the pregnancy is dated from. The reference date is kept and re-interpreted under the new method, so set the method first.',\n invoke: (handle, args: { method: 'lmp' | 'conception' | 'ivf' }) =>\n handle.setMethod(args.method),\n },\n set_reference_date: {\n safety: 'write',\n argsType: '{ date: string | null }',\n argsSchema: {\n type: 'object',\n properties: {\n date: {\n oneOf: [\n { ...isoDate, description: 'Local calendar date, `yyyy-MM-dd`.' },\n { type: 'null' },\n ],\n description:\n 'The date the active method anchors on — LMP, conception, or transfer — or null to clear it. Must not be in the future.',\n },\n },\n required: ['date'],\n additionalProperties: false,\n },\n idempotent: true,\n deprecated: DEPRECATED,\n returns: 'boolean',\n returnsSchema: {\n type: 'boolean',\n description: 'True when the date was applied.',\n },\n errors: [\n 'Returns false for an unparseable date or a date in the future — the on-screen DatePicker caps at today.',\n ],\n examples: [\n {\n args: { date: '2026-01-12' },\n note: 'Under the default LMP method, a last period starting 12 January.',\n },\n ],\n descriptionKey: 'ui.agent.dueDateCalculator.actions.setReferenceDate',\n description:\n 'Set the reference date for the active method. This is the only required input — the result stays null without it.',\n invoke: (handle, args: { date: string | null }) =>\n handle.setReferenceDate(args.date),\n },\n set_cycle_length: {\n safety: 'write',\n argsType: '{ days: number | null }',\n argsSchema: {\n type: 'object',\n properties: {\n days: {\n oneOf: [\n { type: 'integer', minimum: 20, maximum: 45 },\n { type: 'null' },\n ],\n description:\n 'Average cycle length in days (20–45), or null to fall back to the 28-day default.',\n },\n },\n required: ['days'],\n additionalProperties: false,\n },\n idempotent: true,\n deprecated: DEPRECATED,\n returns: 'boolean',\n returnsSchema: {\n type: 'boolean',\n description: 'True when the value was applied.',\n },\n errors: [\n 'Returns false outside 20–45 days — the same bounds the on-screen NumberInput enforces.',\n 'Applies but changes nothing unless the method is `lmp`, and is ignored once a CRL re-dating is confirmed.',\n ],\n descriptionKey: 'ui.agent.dueDateCalculator.actions.setCycleLength',\n description:\n 'LMP method only — set the average cycle length, which shifts Naegele dating off the 28-day assumption.',\n invoke: (handle, args: { days: number | null }) =>\n handle.setCycleLength(args.days),\n },\n set_embryo_age: {\n safety: 'write',\n argsType: '{ days: 3 | 5 }',\n argsSchema: {\n type: 'object',\n properties: {\n days: {\n enum: [3, 5],\n description:\n 'Embryo age at transfer in days — 3 (cleavage) or 5 (blastocyst).',\n },\n },\n required: ['days'],\n additionalProperties: false,\n },\n idempotent: true,\n deprecated: DEPRECATED,\n returns: 'boolean',\n returnsSchema: {\n type: 'boolean',\n description: 'True when the value was applied.',\n },\n errors: [\n 'Returns false for any value other than 3 or 5.',\n 'Applies but changes nothing unless the method is `ivf`.',\n ],\n descriptionKey: 'ui.agent.dueDateCalculator.actions.setEmbryoAge',\n description:\n 'IVF method only — set the embryo age at transfer, which offsets the transfer date back to a notional LMP.',\n invoke: (handle, args: { days: 3 | 5 }) => handle.setEmbryoAge(args.days),\n },\n set_crl: {\n safety: 'write',\n argsType: '{ crlMm?: number | null, scanDate?: string | null }',\n argsSchema: {\n type: 'object',\n properties: {\n crlMm: {\n oneOf: [{ type: 'number', exclusiveMinimum: 0 }, { type: 'null' }],\n description:\n 'Crown-rump length in millimetres, or null to clear it.',\n },\n scanDate: {\n oneOf: [{ ...isoDate }, { type: 'null' }],\n description:\n 'Date of the CRL scan (`yyyy-MM-dd`, not in the future), or null to clear it.',\n },\n },\n additionalProperties: false,\n },\n idempotent: true,\n deprecated: DEPRECATED,\n returns: 'boolean',\n returnsSchema: {\n type: 'boolean',\n description: 'True when the measurement was applied.',\n },\n errors: [\n 'Returns false and writes nothing when the length is not positive or the scan date is unparseable or in the future — the payload applies all-or-nothing.',\n 'Re-dating only happens under the `lmp` method, and only when both the length and the scan date are set.',\n ],\n examples: [\n {\n args: { crlMm: 42, scanDate: '2026-02-20' },\n note: 'A first-trimester CRL that may re-date the pregnancy per ACOG CO 700.',\n },\n ],\n descriptionKey: 'ui.agent.dueDateCalculator.actions.setCrl',\n description:\n 'LMP method only — set the first-trimester crown-rump length and its scan date. When the two disagree with the LMP beyond the ACOG threshold, the scan re-dates the pregnancy and overrides cycle length.',\n invoke: (\n handle,\n args: { crlMm?: number | null; scanDate?: string | null },\n ) => handle.setCrl(args),\n },\n set_as_of_date: {\n safety: 'write',\n argsType: '{ date: string }',\n argsSchema: {\n type: 'object',\n properties: {\n date: {\n ...isoDate,\n description:\n 'Date to evaluate gestational age and trimester against, `yyyy-MM-dd`. May be in the future to project forward.',\n },\n },\n required: ['date'],\n additionalProperties: false,\n },\n idempotent: true,\n deprecated: DEPRECATED,\n returns: 'boolean',\n returnsSchema: {\n type: 'boolean',\n description: 'True when the date was applied.',\n },\n errors: ['Returns false for an unparseable date.'],\n examples: [\n {\n args: { date: '2026-09-15' },\n note: 'Project gestational age forward to an upcoming appointment.',\n },\n ],\n descriptionKey: 'ui.agent.dueDateCalculator.actions.setAsOfDate',\n description:\n 'Set the date gestational age, trimester and the antenatal schedule are evaluated against. Defaults to today; the estimated delivery date itself does not depend on it.',\n invoke: (handle, args: { date: string }) => handle.setAsOfDate(args.date),\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'due-date-calculator',\n description: 'Marks the DueDateCalculator wrapper.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description:\n 'Sourced from the id prop. Also the registry key — without an `id` the instance does not register and the handle-driven actions/state are unreachable.',\n },\n },\n};\n","/* ------------------------------------------------------------------ */\n/* DueDateCalculator — estimate the date of delivery from one of three */\n/* dating methods, with current gestational age + trimester. */\n/* */\n/* - Maths lives in `./gestation` (pure, separately tested). */\n/* - Three methods: LMP (Naegele, cycle-length adjustable), conception, */\n/* and IVF transfer (Day-3 vs Day-5 embryo). */\n/* - The reference date can't be in the future, so the DatePicker caps */\n/* at today. */\n/* ------------------------------------------------------------------ */\n\nimport { forwardRef, useEffect, useMemo, useRef, useState } from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { format, isAfter, parseISO } from 'date-fns';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { dueDateCalculatorAgent } from './due-date-calculator.agent';\nimport { RadioGroup, Radio } from '../radio-group';\nimport { FormField } from '../form-field';\nimport { DatePicker } from '../date-picker';\nimport { NumberInput } from '../number-input';\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 DueDateMethod,\n type EmbryoAge,\n type DueDateResult,\n computeDueDate,\n redateByCrl,\n DEFAULT_CYCLE_LENGTH,\n TRIMESTER_BADGE_VARIANT,\n trimesterHighlightToken,\n} from '../_shared/obstetrics';\nimport {\n computeAntenatalSchedule,\n type AntenatalScheduleOptions,\n} from '../_shared/antenatal-schedule';\nimport {\n AntenatalScheduleTimeline,\n buildScheduleInsertFields,\n} from '../_shared/antenatal-schedule-timeline';\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\n/** Reference-date i18n key per method. */\nconst DATE_LABEL_KEY: Record<DueDateMethod, string> = {\n lmp: 'dueDateCalculator.lmpDate',\n conception: 'dueDateCalculator.conceptionDate',\n ivf: 'dueDateCalculator.transferDate',\n};\n\n/* ------------------------------------------------------------------ */\n/* Agent boundary */\n/* */\n/* Dates cross the agent boundary as local-time `yyyy-MM-dd` strings, */\n/* never `Date` objects — a Date JSON-serialises to UTC and silently */\n/* shifts the day for anyone east or west of Greenwich. */\n/* ------------------------------------------------------------------ */\n\nconst toIsoDate = (d: Date): string => format(d, 'yyyy-MM-dd');\n\nconst fromIsoDate = (iso: string): Date | null => {\n const d = parseISO(iso);\n return Number.isNaN(d.getTime()) ? null : d;\n};\n\n/** UI input bounds, mirrored by the agent handle so it can't out-type a user. */\nconst CYCLE_LENGTH_RANGE = { min: 20, max: 45 } as const;\n\n/** The dating inputs as entered. */\nexport interface DueDateInputsSnapshot {\n /** Which anchor the pregnancy is dated from. */\n method: DueDateMethod;\n /** The method's reference date (`yyyy-MM-dd`), or null when unset. */\n referenceDate: string | null;\n /** LMP only — average cycle length in days, or null for the 28-day default. */\n cycleLength: number | null;\n /** IVF only — embryo age at transfer, in days. */\n embryoAge: EmbryoAge;\n /** LMP only — crown-rump length in millimetres, or null. */\n crlMm: number | null;\n /** LMP only — date of the CRL scan (`yyyy-MM-dd`), or null. */\n scanDate: string | null;\n /** The date gestational age and trimester are evaluated against. */\n asOfDate: string;\n}\n\n/** `DueDateResult` projected onto the agent boundary — ISO dates, no Dates. */\nexport interface DueDateSnapshot {\n /** Estimated date of delivery, `yyyy-MM-dd`. */\n dueDate: string;\n /** GA day-0 anchor (effective LMP) after any CRL re-dating, `yyyy-MM-dd`. */\n gestationalStart: string;\n /** Gestational age as of the evaluation date; null before conception. */\n gestationalAge: { weeks: number; days: number; totalDays: number } | null;\n /** Trimester band as of the evaluation date. */\n trimester: DueDateResult['trimester'];\n}\n\n/**\n * Curated imperative handle for agent / external automation. Reads the dating\n * inputs and the computed due date, and drives the inputs the way a user\n * would. Never exposes patient identity — only structural dates and numbers.\n * Consumed by `due-date-calculator.agent.ts`; the public `ref` stays the root\n * DOM element.\n */\nexport interface DueDateCalculatorHandle {\n /** The dating inputs as entered. */\n getInputs: () => DueDateInputsSnapshot;\n /** Computed due date, gestational age and trimester, or null until a reference date is set. */\n getResult: () => DueDateSnapshot | null;\n /** Switch the dating method. Keeps the reference date, which is re-interpreted. */\n setMethod: (method: DueDateMethod) => boolean;\n /** Set the method's reference date (`yyyy-MM-dd`, not in the future). */\n setReferenceDate: (isoDate: string | null) => boolean;\n /** LMP only — set the average cycle length in days (20–45). */\n setCycleLength: (days: number | null) => boolean;\n /** IVF only — set the embryo age at transfer (3 or 5 days). */\n setEmbryoAge: (days: EmbryoAge) => boolean;\n /** LMP only — set the CRL measurement and/or its scan date for ACOG re-dating. */\n setCrl: (next: {\n crlMm?: number | null;\n scanDate?: string | null;\n }) => boolean;\n /** Set the date gestational age and trimester are evaluated against. */\n setAsOfDate: (isoDate: string) => boolean;\n}\n\nexport interface DueDateCalculatorProps extends VariantProps<\n typeof rootVariants\n> {\n /** Initial dating method. Defaults to `'lmp'`. */\n defaultMethod?: DueDateMethod;\n /** Fires whenever a due date can be computed (and with `null` when it can't). */\n onResultChange?: (result: DueDateResult | null) => void;\n /** When provided, shows an \"Insert\" button that emits the result for an editor. */\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 → no brand line (and no footer hairline); a string → that custom\n * brand; `false` → no brand line. Brand is opt-in.\n */\n insertBrand?: string | false;\n /**\n * Append the antenatal exam schedule (the time-sensitive screening windows)\n * below the result, dated from the computed gestational start.\n */\n showSchedule?: boolean;\n /**\n * Passthrough options for the appended schedule (national `schedule`,\n * `plurality`, `chorionicity`, `rhNegative`, `gdmRisk`, …). `today` is\n * supplied by the component. Ignored unless `showSchedule` is set.\n */\n scheduleOptions?: Omit<AntenatalScheduleOptions, 'today'>;\n /** Opaque instance id, emitted as `data-component-id`. */\n id?: string;\n /** Extra class names on the wrapper. */\n className?: string;\n}\n\n/**\n * @deprecated Superseded by `PregnancyDating`, which unifies the due-date and\n * gestational-age calculators (any anchor → both EDD and current GA) and adds a\n * manual ±days dating adjustment. This component will be removed in a future\n * release; migrate to `PregnancyDating` (`defaultMethod=\"lmp\"`).\n */\nexport const DueDateCalculator = forwardRef<\n HTMLDivElement,\n DueDateCalculatorProps\n>(\n (\n {\n defaultMethod = 'lmp',\n onResultChange,\n onInsert,\n insertVariant = 'insert',\n onCopy,\n onError,\n insertBrand,\n showSchedule = false,\n scheduleOptions,\n id,\n width,\n className,\n },\n ref,\n ) => {\n const { t, i18n } = useTranslation();\n\n const [method, setMethod] = useState<DueDateMethod>(defaultMethod);\n const [refDate, setRefDate] = useState<Date | undefined>(undefined);\n const [cycleLength, setCycleLength] = useState<number | null>(\n DEFAULT_CYCLE_LENGTH,\n );\n const [embryoAge, setEmbryoAge] = useState<EmbryoAge>(5);\n // Optional first-trimester ultrasound (LMP method only) for ACOG CO700 redating.\n const [crlMm, setCrlMm] = useState<number | null>(null);\n const [scanDate, setScanDate] = useState<Date | undefined>(undefined);\n\n // Real today — caps the date inputs (LMP / ultrasound can't be in the future).\n const today = useMemo(() => new Date(), []);\n // The date GA, trimester and schedule status are evaluated against; defaults\n // to today but can be a future appointment date to project forward. (The EDD\n // itself is dating-anchored and does not depend on this.)\n const [asOfDate, setAsOfDate] = useState<Date>(() => new Date());\n\n // ACOG CO700 CRL redating — only when an LMP, a CRL and a scan date are set.\n const redating = useMemo(() => {\n if (method !== 'lmp' || !refDate || crlMm === null || !scanDate) {\n return null;\n }\n return redateByCrl({ lmp: refDate, scanDate, crlMm });\n }, [method, refDate, crlMm, scanDate]);\n\n const result = useMemo<DueDateResult | null>(() => {\n if (!refDate) return null;\n // A confirmed redating moves the effective LMP to the ultrasound's; the\n // CRL already reflects true gestation, so cycle adjustment no longer applies.\n const effectiveDate =\n method === 'lmp' && redating?.redated\n ? redating.gestationalStart\n : refDate;\n const effectiveCycle =\n method === 'lmp' && redating?.redated\n ? DEFAULT_CYCLE_LENGTH\n : (cycleLength ?? DEFAULT_CYCLE_LENGTH);\n return computeDueDate(\n {\n method,\n date: effectiveDate,\n cycleLength: effectiveCycle,\n embryoAge,\n },\n asOfDate,\n );\n }, [method, refDate, cycleLength, embryoAge, redating, asOfDate]);\n\n const dateFormatter = useMemo(\n () => new Intl.DateTimeFormat(i18n.language, { dateStyle: 'long' }),\n [i18n.language],\n );\n\n useEffect(() => {\n onResultChange?.(result);\n }, [result, onResultChange]);\n\n /* ── Agent handle ────────────────────────────────────────────────── */\n const liveRef = useRef({\n method,\n refDate,\n cycleLength,\n embryoAge,\n crlMm,\n scanDate,\n asOfDate,\n result,\n });\n liveRef.current = {\n method,\n refDate,\n cycleLength,\n embryoAge,\n crlMm,\n scanDate,\n asOfDate,\n result,\n };\n\n const agentHandle = useMemo<DueDateCalculatorHandle>(\n () => ({\n getInputs: () => {\n const live = liveRef.current;\n return {\n method: live.method,\n referenceDate: live.refDate ? toIsoDate(live.refDate) : null,\n cycleLength: live.cycleLength,\n embryoAge: live.embryoAge,\n crlMm: live.crlMm,\n scanDate: live.scanDate ? toIsoDate(live.scanDate) : null,\n asOfDate: toIsoDate(live.asOfDate),\n };\n },\n getResult: () => {\n const r = liveRef.current.result;\n if (!r) return null;\n return {\n dueDate: toIsoDate(r.dueDate),\n gestationalStart: toIsoDate(r.gestationalStart),\n gestationalAge: r.gestationalAge ? { ...r.gestationalAge } : null,\n trimester: r.trimester,\n };\n },\n setMethod: (next) => {\n if (next !== 'lmp' && next !== 'conception' && next !== 'ivf') {\n return false;\n }\n setMethod(next);\n return true;\n },\n setReferenceDate: (isoDate) => {\n if (isoDate === null) {\n setRefDate(undefined);\n return true;\n }\n const parsed = fromIsoDate(isoDate);\n // The DatePicker caps at today; the handle honours the same bound.\n if (!parsed || isAfter(parsed, new Date())) return false;\n setRefDate(parsed);\n return true;\n },\n setCycleLength: (days) => {\n if (\n days !== null &&\n !(\n Number.isFinite(days) &&\n days >= CYCLE_LENGTH_RANGE.min &&\n days <= CYCLE_LENGTH_RANGE.max\n )\n ) {\n return false;\n }\n setCycleLength(days);\n return true;\n },\n setEmbryoAge: (days) => {\n if (days !== 3 && days !== 5) return false;\n setEmbryoAge(days);\n return true;\n },\n setCrl: (next) => {\n const now = new Date();\n let parsedScan: Date | undefined;\n // Validate the whole payload before writing any of it, so a bad\n // value can't leave the form half-updated.\n if ('crlMm' in next) {\n const mm = next.crlMm;\n if (\n mm !== null &&\n mm !== undefined &&\n !(Number.isFinite(mm) && mm > 0)\n ) {\n return false;\n }\n }\n if ('scanDate' in next && next.scanDate != null) {\n const d = fromIsoDate(next.scanDate);\n if (!d || isAfter(d, now)) return false;\n parsedScan = d;\n }\n if ('crlMm' in next) setCrlMm(next.crlMm ?? null);\n if ('scanDate' in next) setScanDate(parsedScan);\n return true;\n },\n setAsOfDate: (isoDate) => {\n const parsed = fromIsoDate(isoDate);\n if (!parsed) return false;\n setAsOfDate(parsed);\n return true;\n },\n }),\n [],\n );\n useAgentRegistration(dueDateCalculatorAgent, agentHandle, id);\n\n const schedule = useMemo(() => {\n if (!showSchedule || !result) return null;\n return computeAntenatalSchedule(result.gestationalStart, {\n ...scheduleOptions,\n today: asOfDate,\n });\n }, [showSchedule, result, asOfDate, scheduleOptions]);\n\n return (\n <div\n ref={ref}\n data-component=\"due-date-calculator\"\n data-component-id={id}\n className={rootVariants({ width, className })}\n >\n <RadioGroup\n label={t('dueDateCalculator.method.label')}\n variant=\"horizontal\"\n value={method}\n onValueChange={(next) => setMethod(next as DueDateMethod)}\n >\n <Radio label={t('dueDateCalculator.method.lmp')} value=\"lmp\" />\n <Radio\n label={t('dueDateCalculator.method.conception')}\n value=\"conception\"\n />\n <Radio label={t('dueDateCalculator.method.ivf')} value=\"ivf\" />\n </RadioGroup>\n\n <div className=\"ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:sm:grid-cols-2\">\n <FormField label={t(DATE_LABEL_KEY[method])}>\n <DatePicker value={refDate} onChange={setRefDate} maxDate={today} />\n </FormField>\n\n {method === 'lmp' && (\n <FormField\n label={t('dueDateCalculator.cycleLength')}\n description={t('dueDateCalculator.cycleLengthHint')}\n >\n <NumberInput\n mode=\"integer\"\n min={CYCLE_LENGTH_RANGE.min}\n max={CYCLE_LENGTH_RANGE.max}\n value={cycleLength}\n onChange={setCycleLength}\n />\n </FormField>\n )}\n\n {method === 'ivf' && (\n <RadioGroup\n label={t('dueDateCalculator.embryoAge')}\n variant=\"horizontal\"\n value={String(embryoAge)}\n onValueChange={(next) => setEmbryoAge(Number(next) as EmbryoAge)}\n >\n <Radio label={t('dueDateCalculator.day3')} value=\"3\" />\n <Radio label={t('dueDateCalculator.day5')} value=\"5\" />\n </RadioGroup>\n )}\n </div>\n\n <FormField\n label={t('dueDateCalculator.asOfDate')}\n description={t('dueDateCalculator.asOfDateHint')}\n >\n <DatePicker value={asOfDate} onChange={(d) => d && setAsOfDate(d)} />\n </FormField>\n\n {method === 'lmp' ? (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\">\n <div className=\"ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:sm:grid-cols-2\">\n <FormField\n label={t('dueDateCalculator.crl')}\n description={t('dueDateCalculator.crlHint')}\n >\n <NumberInput\n mode=\"decimal\"\n min={0}\n step={0.1}\n value={crlMm}\n onChange={setCrlMm}\n />\n </FormField>\n <FormField label={t('dueDateCalculator.scanDate')}>\n <DatePicker\n value={scanDate}\n onChange={setScanDate}\n maxDate={today}\n />\n </FormField>\n </div>\n {redating ? (\n <div className=\"ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]\">\n <Badge variant={redating.redated ? 'warning' : 'success'}>\n {redating.redated\n ? t('dueDateCalculator.redated', {\n days: redating.discrepancyDays,\n })\n : t('dueDateCalculator.datesAgree')}\n </Badge>\n {!redating.crlInRange ? (\n <span className=\"type-meta ds:text-muted-foreground\">\n {t('dueDateCalculator.crlOutOfRange')}\n </span>\n ) : null}\n </div>\n ) : null}\n </div>\n ) : null}\n\n {/* Concise polite announcement when a due date resolves. */}\n <p className=\"ds:sr-only\" role=\"status\" aria-live=\"polite\">\n {result\n ? `${t('dueDateCalculator.result.dueDateLabel')}: ${dateFormatter.format(\n result.dueDate,\n )}. ${t('dueDateCalculator.result.trimesterLabel')}: ${t(\n `dueDateCalculator.trimester.${result.trimester}`,\n )}.`\n : ''}\n </p>\n\n {result ? (\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-3\">\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('dueDateCalculator.result.trimesterLabel')}\n </dt>\n <dd>\n <Badge\n variant={TRIMESTER_BADGE_VARIANT[result.trimester]}\n size=\"lg\"\n >\n {t(`dueDateCalculator.trimester.${result.trimester}`)}\n </Badge>\n </dd>\n </div>\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]\">\n <dt className=\"type-label ds:text-muted-foreground\">\n {t('dueDateCalculator.result.gestationLabel')}\n </dt>\n <dd className=\"type-body ds:text-foreground\">\n {result.gestationalAge\n ? t('dueDateCalculator.result.gestation', {\n weeks: result.gestationalAge.weeks,\n days: result.gestationalAge.days,\n })\n : '—'}\n </dd>\n </div>\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]\">\n <dt className=\"type-label ds:text-muted-foreground\">\n {t('dueDateCalculator.result.dueDateLabel')}\n </dt>\n <dd className=\"type-metric ds:text-foreground\">\n {dateFormatter.format(result.dueDate)}\n </dd>\n </div>\n </dl>\n </Card.Body>\n </Card>\n ) : (\n <p className=\"type-body ds:text-muted-foreground\">\n {t('dueDateCalculator.empty')}\n </p>\n )}\n\n {schedule ? <AntenatalScheduleTimeline events={schedule} /> : null}\n\n {/* One result-action group for the whole result — sits after both the\n due-date card and the schedule, and its payload carries the schedule\n rows when shown (no per-card buttons). */}\n {result && (insertVariant === 'copy' || onInsert) ? (\n <InsertButton\n variant={insertVariant}\n onInsert={onInsert}\n onCopy={onCopy}\n onError={onError}\n card={{\n title: t('insert.title.dueDate'),\n icon: 'calendar-heart',\n highlight: dateFormatter.format(result.dueDate),\n // Chip tinted with the trimester's semantic token so the inserted\n // PNG carries the same clinical-stage colour as the on-screen\n // trimester badge — with the contrast-safe orange override for the\n // `--warning` third trimester.\n highlightToken: trimesterHighlightToken(result.trimester),\n brand: insertBrand,\n fields: [\n {\n // The estimated date of delivery → calendar glyph.\n icon: 'calendar',\n label: t('dueDateCalculator.result.dueDateLabel'),\n value: dateFormatter.format(result.dueDate),\n },\n {\n // Gestational age is an elapsed duration → clock glyph.\n icon: 'clock',\n label: t('dueDateCalculator.result.gestationLabel'),\n value: result.gestationalAge\n ? t('dueDateCalculator.result.gestation', {\n weeks: result.gestationalAge.weeks,\n days: result.gestationalAge.days,\n })\n : '—',\n },\n {\n // Trimester is a clinical-stage classification → tag.\n icon: 'tag',\n label: t('dueDateCalculator.result.trimesterLabel'),\n value: t(`dueDateCalculator.trimester.${result.trimester}`),\n },\n // When the schedule is shown, the single Insert button carries\n // the exam windows too (no second button).\n ...(schedule\n ? buildScheduleInsertFields(schedule, t, (d) =>\n dateFormatter.format(d),\n )\n : []),\n ],\n }}\n />\n ) : null}\n </div>\n );\n },\n);\n\nDueDateCalculator.displayName = 'DueDateCalculator';\n"],"names":["DEPRECATED","isoDate","dueDateCalculatorAgent","handle","args","rootVariants","cva","DATE_LABEL_KEY","toIsoDate","d","format","fromIsoDate","iso","parseISO","CYCLE_LENGTH_RANGE","DueDateCalculator","forwardRef","defaultMethod","onResultChange","onInsert","insertVariant","onCopy","onError","insertBrand","showSchedule","scheduleOptions","id","width","className","ref","i18n","useTranslation","method","setMethod","useState","refDate","setRefDate","cycleLength","setCycleLength","DEFAULT_CYCLE_LENGTH","embryoAge","setEmbryoAge","crlMm","setCrlMm","scanDate","setScanDate","today","useMemo","asOfDate","setAsOfDate","redating","redateByCrl","result","effectiveDate","effectiveCycle","computeDueDate","dateFormatter","useEffect","liveRef","useRef","agentHandle","live","r","next","parsed","isAfter","days","now","parsedScan","mm","useAgentRegistration","schedule","computeAntenatalSchedule","jsxs","RadioGroup","jsx","Radio","FormField","DatePicker","NumberInput","Badge","Card","TRIMESTER_BADGE_VARIANT","AntenatalScheduleTimeline","InsertButton","trimesterHighlightToken","buildScheduleInsertFields"],"mappings":";;;;;;;;;;;;;;;;;AAyBA,MAAMA,IAAa,iDAGbC,IAAU;AAAA,EACd,MAAM;AAAA,EACN,SAAS;AACX,GAEaC,KAAgE;AAAA,EAC3E,IAAI;AAAA;AAAA,EAEJ,cAAc,CAAC,WAAW;AAAA,EAC1B,OAAO;AAAA,IACL,QAAQ;AAAA,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EAAE,sBAAsB;AAAA,gBAC/B,MAAM;AAAA,gBACN,WAAWkC,EAAc,OAAOJ,EAAO,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,gBAK9C,gBAAgBiC,GAAwBjC,EAAO,SAAS;AAAA,gBACxD,OAAO7B;AAAA,gBACP,QAAQ;AAAA,kBACN;AAAA;AAAA,oBAEE,MAAM;AAAA,oBACN,OAAO,EAAE,uCAAuC;AAAA,oBAChD,OAAOiC,EAAc,OAAOJ,EAAO,OAAO;AAAA,kBAAA;AAAA,kBAE5C;AAAA;AAAA,oBAEE,MAAM;AAAA,oBACN,OAAO,EAAE,yCAAyC;AAAA,oBAClD,OAAOA,EAAO,iBACV,EAAE,sCAAsC;AAAA,sBACtC,OAAOA,EAAO,eAAe;AAAA,sBAC7B,MAAMA,EAAO,eAAe;AAAA,oBAAA,CAC7B,IACD;AAAA,kBAAA;AAAA,kBAEN;AAAA;AAAA,oBAEE,MAAM;AAAA,oBACN,OAAO,EAAE,yCAAyC;AAAA,oBAClD,OAAO,EAAE,+BAA+BA,EAAO,SAAS,EAAE;AAAA,kBAAA;AAAA;AAAA;AAAA,kBAI5D,GAAImB,IACAe;AAAA,oBAA0Bf;AAAA,oBAAU;AAAA,oBAAG,CAAC9D,MACtC+C,EAAc,OAAO/C,CAAC;AAAA,kBAAA,IAExB,CAAA;AAAA,gBAAC;AAAA,cACP;AAAA,YACF;AAAA,UAAA,IAEA;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGV;AACF;AAEAM,GAAkB,cAAc;"}
|
|
1
|
+
{"version":3,"file":"due-date-calculator-le1z3KpW.js","sources":["../../src/components/due-date-calculator/due-date-calculator.agent.ts","../../src/components/due-date-calculator/due-date-calculator.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — DueDateCalculator. */\n/* */\n/* Estimates the date of delivery from one of three dating methods (LMP / */\n/* conception / IVF transfer) plus current gestational age + trimester. */\n/* The agent surface is the dating inputs plus the computed EDD / GA; the */\n/* handle is the curated `DueDateCalculatorHandle` (the public `ref` */\n/* stays the root <div>, exactly as `slider.tsx` and `bmi-calculator.tsx` */\n/* keep theirs). */\n/* */\n/* Dates cross the boundary as local-time `yyyy-MM-dd` strings, never */\n/* `Date` objects, so nothing shifts a day under JSON/UTC serialisation. */\n/* */\n/* DEPRECATED surface: this component is superseded by PregnancyDating, */\n/* which unifies dating + gestational age. Prefer the `pregnancy-dating` */\n/* adapter for new work — every action here is marked deprecated. */\n/* */\n/* PHI (§7): never exposes patient identity — the slots return the */\n/* operator's own structural dating inputs and the dates derived from */\n/* them. See `src/docs/26-agent-readiness.mdx`. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { DueDateCalculatorHandle } from './due-date-calculator';\n\nconst DEPRECATED = 'Superseded by the `pregnancy-dating` adapter.';\n\n/** Shared JSON Schema fragment for a local calendar date. */\nconst isoDate = {\n type: 'string',\n pattern: '^\\\\d{4}-\\\\d{2}-\\\\d{2}$',\n} as const;\n\nexport const dueDateCalculatorAgent: AgentAdapter<DueDateCalculatorHandle> = {\n id: 'due-date-calculator',\n // set_value → the six `set_*` actions + the `inputs` state slot.\n capabilities: ['set_value'],\n state: {\n inputs: {\n type: '{ method: string, referenceDate: string | null, cycleLength: number | null, embryoAge: 3 | 5, crlMm: number | null, scanDate: string | null, asOfDate: string }',\n descriptionKey: 'ui.agent.dueDateCalculator.state.inputs',\n description:\n 'The dating inputs as entered — method, its reference date, cycle length (LMP), embryo age (IVF), the optional CRL + scan date, and the evaluation date. Dates are `yyyy-MM-dd`. Read this to see which method a reference date will be interpreted under.',\n read: (handle) => handle.getInputs(),\n },\n result: {\n type: '{ dueDate: string, gestationalStart: string, gestationalAge: { weeks: number, days: number, totalDays: number } | null, trimester: string } | null',\n descriptionKey: 'ui.agent.dueDateCalculator.state.result',\n description:\n 'Computed estimated delivery date, the GA day-0 anchor after any CRL re-dating, the gestational age as of the evaluation date, and the trimester band. Null until a reference date is set.',\n read: (handle) => handle.getResult(),\n },\n },\n actions: {\n set_method: {\n // Drives the same local input state a user picks; nothing is persisted\n // to a record, and the choice is reversible in the same UI.\n safety: 'write',\n argsType: \"{ method: 'lmp' | 'conception' | 'ivf' }\",\n argsSchema: {\n type: 'object',\n properties: {\n method: {\n enum: ['lmp', 'conception', 'ivf'],\n description:\n 'Which anchor to date from — last menstrual period, conception, or IVF transfer.',\n },\n },\n required: ['method'],\n additionalProperties: false,\n },\n idempotent: true,\n deprecated: DEPRECATED,\n returns: 'boolean',\n returnsSchema: {\n type: 'boolean',\n description: 'True when the method was applied.',\n },\n errors: [\n 'Returns false for a method outside the three supported anchors.',\n ],\n descriptionKey: 'ui.agent.dueDateCalculator.actions.setMethod',\n description:\n 'Choose which anchor the pregnancy is dated from. The reference date is kept and re-interpreted under the new method, so set the method first.',\n invoke: (handle, args: { method: 'lmp' | 'conception' | 'ivf' }) =>\n handle.setMethod(args.method),\n },\n set_reference_date: {\n safety: 'write',\n argsType: '{ date: string | null }',\n argsSchema: {\n type: 'object',\n properties: {\n date: {\n oneOf: [\n { ...isoDate, description: 'Local calendar date, `yyyy-MM-dd`.' },\n { type: 'null' },\n ],\n description:\n 'The date the active method anchors on — LMP, conception, or transfer — or null to clear it. Must not be in the future.',\n },\n },\n required: ['date'],\n additionalProperties: false,\n },\n idempotent: true,\n deprecated: DEPRECATED,\n returns: 'boolean',\n returnsSchema: {\n type: 'boolean',\n description: 'True when the date was applied.',\n },\n errors: [\n 'Returns false for an unparseable date or a date in the future — the on-screen DatePicker caps at today.',\n ],\n examples: [\n {\n args: { date: '2026-01-12' },\n note: 'Under the default LMP method, a last period starting 12 January.',\n },\n ],\n descriptionKey: 'ui.agent.dueDateCalculator.actions.setReferenceDate',\n description:\n 'Set the reference date for the active method. This is the only required input — the result stays null without it.',\n invoke: (handle, args: { date: string | null }) =>\n handle.setReferenceDate(args.date),\n },\n set_cycle_length: {\n safety: 'write',\n argsType: '{ days: number | null }',\n argsSchema: {\n type: 'object',\n properties: {\n days: {\n oneOf: [\n { type: 'integer', minimum: 20, maximum: 45 },\n { type: 'null' },\n ],\n description:\n 'Average cycle length in days (20–45), or null to fall back to the 28-day default.',\n },\n },\n required: ['days'],\n additionalProperties: false,\n },\n idempotent: true,\n deprecated: DEPRECATED,\n returns: 'boolean',\n returnsSchema: {\n type: 'boolean',\n description: 'True when the value was applied.',\n },\n errors: [\n 'Returns false outside 20–45 days — the same bounds the on-screen NumberInput enforces.',\n 'Applies but changes nothing unless the method is `lmp`, and is ignored once a CRL re-dating is confirmed.',\n ],\n descriptionKey: 'ui.agent.dueDateCalculator.actions.setCycleLength',\n description:\n 'LMP method only — set the average cycle length, which shifts Naegele dating off the 28-day assumption.',\n invoke: (handle, args: { days: number | null }) =>\n handle.setCycleLength(args.days),\n },\n set_embryo_age: {\n safety: 'write',\n argsType: '{ days: 3 | 5 }',\n argsSchema: {\n type: 'object',\n properties: {\n days: {\n enum: [3, 5],\n description:\n 'Embryo age at transfer in days — 3 (cleavage) or 5 (blastocyst).',\n },\n },\n required: ['days'],\n additionalProperties: false,\n },\n idempotent: true,\n deprecated: DEPRECATED,\n returns: 'boolean',\n returnsSchema: {\n type: 'boolean',\n description: 'True when the value was applied.',\n },\n errors: [\n 'Returns false for any value other than 3 or 5.',\n 'Applies but changes nothing unless the method is `ivf`.',\n ],\n descriptionKey: 'ui.agent.dueDateCalculator.actions.setEmbryoAge',\n description:\n 'IVF method only — set the embryo age at transfer, which offsets the transfer date back to a notional LMP.',\n invoke: (handle, args: { days: 3 | 5 }) => handle.setEmbryoAge(args.days),\n },\n set_crl: {\n safety: 'write',\n argsType: '{ crlMm?: number | null, scanDate?: string | null }',\n argsSchema: {\n type: 'object',\n properties: {\n crlMm: {\n oneOf: [{ type: 'number', exclusiveMinimum: 0 }, { type: 'null' }],\n description:\n 'Crown-rump length in millimetres, or null to clear it.',\n },\n scanDate: {\n oneOf: [{ ...isoDate }, { type: 'null' }],\n description:\n 'Date of the CRL scan (`yyyy-MM-dd`, not in the future), or null to clear it.',\n },\n },\n additionalProperties: false,\n },\n idempotent: true,\n deprecated: DEPRECATED,\n returns: 'boolean',\n returnsSchema: {\n type: 'boolean',\n description: 'True when the measurement was applied.',\n },\n errors: [\n 'Returns false and writes nothing when the length is not positive or the scan date is unparseable or in the future — the payload applies all-or-nothing.',\n 'Re-dating only happens under the `lmp` method, and only when both the length and the scan date are set.',\n ],\n examples: [\n {\n args: { crlMm: 42, scanDate: '2026-02-20' },\n note: 'A first-trimester CRL that may re-date the pregnancy per ACOG CO 700.',\n },\n ],\n descriptionKey: 'ui.agent.dueDateCalculator.actions.setCrl',\n description:\n 'LMP method only — set the first-trimester crown-rump length and its scan date. When the two disagree with the LMP beyond the ACOG threshold, the scan re-dates the pregnancy and overrides cycle length.',\n invoke: (\n handle,\n args: { crlMm?: number | null; scanDate?: string | null },\n ) => handle.setCrl(args),\n },\n set_as_of_date: {\n safety: 'write',\n argsType: '{ date: string }',\n argsSchema: {\n type: 'object',\n properties: {\n date: {\n ...isoDate,\n description:\n 'Date to evaluate gestational age and trimester against, `yyyy-MM-dd`. May be in the future to project forward.',\n },\n },\n required: ['date'],\n additionalProperties: false,\n },\n idempotent: true,\n deprecated: DEPRECATED,\n returns: 'boolean',\n returnsSchema: {\n type: 'boolean',\n description: 'True when the date was applied.',\n },\n errors: ['Returns false for an unparseable date.'],\n examples: [\n {\n args: { date: '2026-09-15' },\n note: 'Project gestational age forward to an upcoming appointment.',\n },\n ],\n descriptionKey: 'ui.agent.dueDateCalculator.actions.setAsOfDate',\n description:\n 'Set the date gestational age, trimester and the antenatal schedule are evaluated against. Defaults to today; the estimated delivery date itself does not depend on it.',\n invoke: (handle, args: { date: string }) => handle.setAsOfDate(args.date),\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'due-date-calculator',\n description: 'Marks the DueDateCalculator wrapper.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description:\n 'Sourced from the id prop. Also the registry key — without an `id` the instance does not register and the handle-driven actions/state are unreachable.',\n },\n },\n};\n","/* ------------------------------------------------------------------ */\n/* DueDateCalculator — estimate the date of delivery from one of three */\n/* dating methods, with current gestational age + trimester. */\n/* */\n/* - Maths lives in `./gestation` (pure, separately tested). */\n/* - Three methods: LMP (Naegele, cycle-length adjustable), conception, */\n/* and IVF transfer (Day-3 vs Day-5 embryo). */\n/* - The reference date can't be in the future, so the DatePicker caps */\n/* at today. */\n/* ------------------------------------------------------------------ */\n\nimport { forwardRef, useEffect, useMemo, useRef, useState } from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { format, isAfter, parseISO } from 'date-fns';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { dueDateCalculatorAgent } from './due-date-calculator.agent';\nimport { RadioGroup, Radio } from '../radio-group';\nimport { FormField } from '../form-field';\nimport { DatePicker } from '../date-picker';\nimport { NumberInput } from '../number-input';\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 DueDateMethod,\n type EmbryoAge,\n type DueDateResult,\n computeDueDate,\n redateByCrl,\n DEFAULT_CYCLE_LENGTH,\n TRIMESTER_BADGE_VARIANT,\n trimesterHighlightToken,\n} from '../_shared/obstetrics';\nimport {\n computeAntenatalSchedule,\n type AntenatalScheduleOptions,\n} from '../_shared/antenatal-schedule';\nimport {\n AntenatalScheduleTimeline,\n buildScheduleInsertFields,\n} from '../_shared/antenatal-schedule-timeline';\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\n/** Reference-date i18n key per method. */\nconst DATE_LABEL_KEY: Record<DueDateMethod, string> = {\n lmp: 'dueDateCalculator.lmpDate',\n conception: 'dueDateCalculator.conceptionDate',\n ivf: 'dueDateCalculator.transferDate',\n};\n\n/* ------------------------------------------------------------------ */\n/* Agent boundary */\n/* */\n/* Dates cross the agent boundary as local-time `yyyy-MM-dd` strings, */\n/* never `Date` objects — a Date JSON-serialises to UTC and silently */\n/* shifts the day for anyone east or west of Greenwich. */\n/* ------------------------------------------------------------------ */\n\nconst toIsoDate = (d: Date): string => format(d, 'yyyy-MM-dd');\n\nconst fromIsoDate = (iso: string): Date | null => {\n const d = parseISO(iso);\n return Number.isNaN(d.getTime()) ? null : d;\n};\n\n/** UI input bounds, mirrored by the agent handle so it can't out-type a user. */\nconst CYCLE_LENGTH_RANGE = { min: 20, max: 45 } as const;\n\n/** The dating inputs as entered. */\nexport interface DueDateInputsSnapshot {\n /** Which anchor the pregnancy is dated from. */\n method: DueDateMethod;\n /** The method's reference date (`yyyy-MM-dd`), or null when unset. */\n referenceDate: string | null;\n /** LMP only — average cycle length in days, or null for the 28-day default. */\n cycleLength: number | null;\n /** IVF only — embryo age at transfer, in days. */\n embryoAge: EmbryoAge;\n /** LMP only — crown-rump length in millimetres, or null. */\n crlMm: number | null;\n /** LMP only — date of the CRL scan (`yyyy-MM-dd`), or null. */\n scanDate: string | null;\n /** The date gestational age and trimester are evaluated against. */\n asOfDate: string;\n}\n\n/** `DueDateResult` projected onto the agent boundary — ISO dates, no Dates. */\nexport interface DueDateSnapshot {\n /** Estimated date of delivery, `yyyy-MM-dd`. */\n dueDate: string;\n /** GA day-0 anchor (effective LMP) after any CRL re-dating, `yyyy-MM-dd`. */\n gestationalStart: string;\n /** Gestational age as of the evaluation date; null before conception. */\n gestationalAge: { weeks: number; days: number; totalDays: number } | null;\n /** Trimester band as of the evaluation date. */\n trimester: DueDateResult['trimester'];\n}\n\n/**\n * Curated imperative handle for agent / external automation. Reads the dating\n * inputs and the computed due date, and drives the inputs the way a user\n * would. Never exposes patient identity — only structural dates and numbers.\n * Consumed by `due-date-calculator.agent.ts`; the public `ref` stays the root\n * DOM element.\n */\nexport interface DueDateCalculatorHandle {\n /** The dating inputs as entered. */\n getInputs: () => DueDateInputsSnapshot;\n /** Computed due date, gestational age and trimester, or null until a reference date is set. */\n getResult: () => DueDateSnapshot | null;\n /** Switch the dating method. Keeps the reference date, which is re-interpreted. */\n setMethod: (method: DueDateMethod) => boolean;\n /** Set the method's reference date (`yyyy-MM-dd`, not in the future). */\n setReferenceDate: (isoDate: string | null) => boolean;\n /** LMP only — set the average cycle length in days (20–45). */\n setCycleLength: (days: number | null) => boolean;\n /** IVF only — set the embryo age at transfer (3 or 5 days). */\n setEmbryoAge: (days: EmbryoAge) => boolean;\n /** LMP only — set the CRL measurement and/or its scan date for ACOG re-dating. */\n setCrl: (next: {\n crlMm?: number | null;\n scanDate?: string | null;\n }) => boolean;\n /** Set the date gestational age and trimester are evaluated against. */\n setAsOfDate: (isoDate: string) => boolean;\n}\n\nexport interface DueDateCalculatorProps extends VariantProps<\n typeof rootVariants\n> {\n /** Initial dating method. Defaults to `'lmp'`. */\n defaultMethod?: DueDateMethod;\n /** Fires whenever a due date can be computed (and with `null` when it can't). */\n onResultChange?: (result: DueDateResult | null) => void;\n /** When provided, shows an \"Insert\" button that emits the result for an editor. */\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 → no brand line (and no footer hairline); a string → that custom\n * brand; `false` → no brand line. Brand is opt-in.\n */\n insertBrand?: string | false;\n /**\n * Append the antenatal exam schedule (the time-sensitive screening windows)\n * below the result, dated from the computed gestational start.\n */\n showSchedule?: boolean;\n /**\n * Passthrough options for the appended schedule (national `schedule`,\n * `plurality`, `chorionicity`, `rhNegative`, `gdmRisk`, …). `today` is\n * supplied by the component. Ignored unless `showSchedule` is set.\n */\n scheduleOptions?: Omit<AntenatalScheduleOptions, 'today'>;\n /** Opaque instance id, emitted as `data-component-id`. */\n id?: string;\n /** Extra class names on the wrapper. */\n className?: string;\n}\n\n/**\n * @deprecated Superseded by `PregnancyDating`, which unifies the due-date and\n * gestational-age calculators (any anchor → both EDD and current GA) and adds a\n * manual ±days dating adjustment. This component will be removed in a future\n * release; migrate to `PregnancyDating` (`defaultMethod=\"lmp\"`).\n */\nexport const DueDateCalculator = forwardRef<\n HTMLDivElement,\n DueDateCalculatorProps\n>(\n (\n {\n defaultMethod = 'lmp',\n onResultChange,\n onInsert,\n insertVariant = 'insert',\n onCopy,\n onError,\n insertBrand,\n showSchedule = false,\n scheduleOptions,\n id,\n width,\n className,\n },\n ref,\n ) => {\n const { t, i18n } = useTranslation();\n\n const [method, setMethod] = useState<DueDateMethod>(defaultMethod);\n const [refDate, setRefDate] = useState<Date | undefined>(undefined);\n const [cycleLength, setCycleLength] = useState<number | null>(\n DEFAULT_CYCLE_LENGTH,\n );\n const [embryoAge, setEmbryoAge] = useState<EmbryoAge>(5);\n // Optional first-trimester ultrasound (LMP method only) for ACOG CO700 redating.\n const [crlMm, setCrlMm] = useState<number | null>(null);\n const [scanDate, setScanDate] = useState<Date | undefined>(undefined);\n\n // Real today — caps the date inputs (LMP / ultrasound can't be in the future).\n const today = useMemo(() => new Date(), []);\n // The date GA, trimester and schedule status are evaluated against; defaults\n // to today but can be a future appointment date to project forward. (The EDD\n // itself is dating-anchored and does not depend on this.)\n const [asOfDate, setAsOfDate] = useState<Date>(() => new Date());\n\n // ACOG CO700 CRL redating — only when an LMP, a CRL and a scan date are set.\n const redating = useMemo(() => {\n if (method !== 'lmp' || !refDate || crlMm === null || !scanDate) {\n return null;\n }\n return redateByCrl({ lmp: refDate, scanDate, crlMm });\n }, [method, refDate, crlMm, scanDate]);\n\n const result = useMemo<DueDateResult | null>(() => {\n if (!refDate) return null;\n // A confirmed redating moves the effective LMP to the ultrasound's; the\n // CRL already reflects true gestation, so cycle adjustment no longer applies.\n const effectiveDate =\n method === 'lmp' && redating?.redated\n ? redating.gestationalStart\n : refDate;\n const effectiveCycle =\n method === 'lmp' && redating?.redated\n ? DEFAULT_CYCLE_LENGTH\n : (cycleLength ?? DEFAULT_CYCLE_LENGTH);\n return computeDueDate(\n {\n method,\n date: effectiveDate,\n cycleLength: effectiveCycle,\n embryoAge,\n },\n asOfDate,\n );\n }, [method, refDate, cycleLength, embryoAge, redating, asOfDate]);\n\n const dateFormatter = useMemo(\n () => new Intl.DateTimeFormat(i18n.language, { dateStyle: 'long' }),\n [i18n.language],\n );\n\n useEffect(() => {\n onResultChange?.(result);\n }, [result, onResultChange]);\n\n /* ── Agent handle ────────────────────────────────────────────────── */\n const liveRef = useRef({\n method,\n refDate,\n cycleLength,\n embryoAge,\n crlMm,\n scanDate,\n asOfDate,\n result,\n });\n liveRef.current = {\n method,\n refDate,\n cycleLength,\n embryoAge,\n crlMm,\n scanDate,\n asOfDate,\n result,\n };\n\n const agentHandle = useMemo<DueDateCalculatorHandle>(\n () => ({\n getInputs: () => {\n const live = liveRef.current;\n return {\n method: live.method,\n referenceDate: live.refDate ? toIsoDate(live.refDate) : null,\n cycleLength: live.cycleLength,\n embryoAge: live.embryoAge,\n crlMm: live.crlMm,\n scanDate: live.scanDate ? toIsoDate(live.scanDate) : null,\n asOfDate: toIsoDate(live.asOfDate),\n };\n },\n getResult: () => {\n const r = liveRef.current.result;\n if (!r) return null;\n return {\n dueDate: toIsoDate(r.dueDate),\n gestationalStart: toIsoDate(r.gestationalStart),\n gestationalAge: r.gestationalAge ? { ...r.gestationalAge } : null,\n trimester: r.trimester,\n };\n },\n setMethod: (next) => {\n if (next !== 'lmp' && next !== 'conception' && next !== 'ivf') {\n return false;\n }\n setMethod(next);\n return true;\n },\n setReferenceDate: (isoDate) => {\n if (isoDate === null) {\n setRefDate(undefined);\n return true;\n }\n const parsed = fromIsoDate(isoDate);\n // The DatePicker caps at today; the handle honours the same bound.\n if (!parsed || isAfter(parsed, new Date())) return false;\n setRefDate(parsed);\n return true;\n },\n setCycleLength: (days) => {\n if (\n days !== null &&\n !(\n Number.isFinite(days) &&\n days >= CYCLE_LENGTH_RANGE.min &&\n days <= CYCLE_LENGTH_RANGE.max\n )\n ) {\n return false;\n }\n setCycleLength(days);\n return true;\n },\n setEmbryoAge: (days) => {\n if (days !== 3 && days !== 5) return false;\n setEmbryoAge(days);\n return true;\n },\n setCrl: (next) => {\n const now = new Date();\n let parsedScan: Date | undefined;\n // Validate the whole payload before writing any of it, so a bad\n // value can't leave the form half-updated.\n if ('crlMm' in next) {\n const mm = next.crlMm;\n if (\n mm !== null &&\n mm !== undefined &&\n !(Number.isFinite(mm) && mm > 0)\n ) {\n return false;\n }\n }\n if ('scanDate' in next && next.scanDate != null) {\n const d = fromIsoDate(next.scanDate);\n if (!d || isAfter(d, now)) return false;\n parsedScan = d;\n }\n if ('crlMm' in next) setCrlMm(next.crlMm ?? null);\n if ('scanDate' in next) setScanDate(parsedScan);\n return true;\n },\n setAsOfDate: (isoDate) => {\n const parsed = fromIsoDate(isoDate);\n if (!parsed) return false;\n setAsOfDate(parsed);\n return true;\n },\n }),\n [],\n );\n useAgentRegistration(dueDateCalculatorAgent, agentHandle, id);\n\n const schedule = useMemo(() => {\n if (!showSchedule || !result) return null;\n return computeAntenatalSchedule(result.gestationalStart, {\n ...scheduleOptions,\n today: asOfDate,\n });\n }, [showSchedule, result, asOfDate, scheduleOptions]);\n\n return (\n <div\n ref={ref}\n data-component=\"due-date-calculator\"\n data-component-id={id}\n className={rootVariants({ width, className })}\n >\n <RadioGroup\n label={t('dueDateCalculator.method.label')}\n variant=\"horizontal\"\n value={method}\n onValueChange={(next) => setMethod(next as DueDateMethod)}\n >\n <Radio label={t('dueDateCalculator.method.lmp')} value=\"lmp\" />\n <Radio\n label={t('dueDateCalculator.method.conception')}\n value=\"conception\"\n />\n <Radio label={t('dueDateCalculator.method.ivf')} value=\"ivf\" />\n </RadioGroup>\n\n <div className=\"ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:sm:grid-cols-2\">\n <FormField label={t(DATE_LABEL_KEY[method])}>\n <DatePicker value={refDate} onChange={setRefDate} maxDate={today} />\n </FormField>\n\n {method === 'lmp' && (\n <FormField\n label={t('dueDateCalculator.cycleLength')}\n description={t('dueDateCalculator.cycleLengthHint')}\n >\n <NumberInput\n mode=\"integer\"\n min={CYCLE_LENGTH_RANGE.min}\n max={CYCLE_LENGTH_RANGE.max}\n value={cycleLength}\n onChange={setCycleLength}\n />\n </FormField>\n )}\n\n {method === 'ivf' && (\n <RadioGroup\n label={t('dueDateCalculator.embryoAge')}\n variant=\"horizontal\"\n value={String(embryoAge)}\n onValueChange={(next) => setEmbryoAge(Number(next) as EmbryoAge)}\n >\n <Radio label={t('dueDateCalculator.day3')} value=\"3\" />\n <Radio label={t('dueDateCalculator.day5')} value=\"5\" />\n </RadioGroup>\n )}\n </div>\n\n <FormField\n label={t('dueDateCalculator.asOfDate')}\n description={t('dueDateCalculator.asOfDateHint')}\n >\n <DatePicker value={asOfDate} onChange={(d) => d && setAsOfDate(d)} />\n </FormField>\n\n {method === 'lmp' ? (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\">\n <div className=\"ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:sm:grid-cols-2\">\n <FormField\n label={t('dueDateCalculator.crl')}\n description={t('dueDateCalculator.crlHint')}\n >\n <NumberInput\n mode=\"decimal\"\n min={0}\n step={0.1}\n value={crlMm}\n onChange={setCrlMm}\n />\n </FormField>\n <FormField label={t('dueDateCalculator.scanDate')}>\n <DatePicker\n value={scanDate}\n onChange={setScanDate}\n maxDate={today}\n />\n </FormField>\n </div>\n {redating ? (\n <div className=\"ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]\">\n <Badge variant={redating.redated ? 'warning' : 'success'}>\n {redating.redated\n ? t('dueDateCalculator.redated', {\n days: redating.discrepancyDays,\n })\n : t('dueDateCalculator.datesAgree')}\n </Badge>\n {!redating.crlInRange ? (\n <span className=\"type-meta ds:text-muted-foreground\">\n {t('dueDateCalculator.crlOutOfRange')}\n </span>\n ) : null}\n </div>\n ) : null}\n </div>\n ) : null}\n\n {/* Concise polite announcement when a due date resolves. */}\n <p className=\"ds:sr-only\" role=\"status\" aria-live=\"polite\">\n {result\n ? `${t('dueDateCalculator.result.dueDateLabel')}: ${dateFormatter.format(\n result.dueDate,\n )}. ${t('dueDateCalculator.result.trimesterLabel')}: ${t(\n `dueDateCalculator.trimester.${result.trimester}`,\n )}.`\n : ''}\n </p>\n\n {result ? (\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-3\">\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('dueDateCalculator.result.trimesterLabel')}\n </dt>\n <dd>\n <Badge\n variant={TRIMESTER_BADGE_VARIANT[result.trimester]}\n size=\"lg\"\n >\n {t(`dueDateCalculator.trimester.${result.trimester}`)}\n </Badge>\n </dd>\n </div>\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]\">\n <dt className=\"type-label ds:text-muted-foreground\">\n {t('dueDateCalculator.result.gestationLabel')}\n </dt>\n <dd className=\"type-body ds:text-foreground\">\n {result.gestationalAge\n ? t('dueDateCalculator.result.gestation', {\n weeks: result.gestationalAge.weeks,\n days: result.gestationalAge.days,\n })\n : '—'}\n </dd>\n </div>\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]\">\n <dt className=\"type-label ds:text-muted-foreground\">\n {t('dueDateCalculator.result.dueDateLabel')}\n </dt>\n <dd className=\"type-metric ds:text-foreground\">\n {dateFormatter.format(result.dueDate)}\n </dd>\n </div>\n </dl>\n </Card.Body>\n </Card>\n ) : (\n <p className=\"type-body ds:text-muted-foreground\">\n {t('dueDateCalculator.empty')}\n </p>\n )}\n\n {schedule ? <AntenatalScheduleTimeline events={schedule} /> : null}\n\n {/* One result-action group for the whole result — sits after both the\n due-date card and the schedule, and its payload carries the schedule\n rows when shown (no per-card buttons). */}\n {result && (insertVariant === 'copy' || onInsert) ? (\n <InsertButton\n variant={insertVariant}\n onInsert={onInsert}\n onCopy={onCopy}\n onError={onError}\n card={{\n title: t('insert.title.dueDate'),\n icon: 'calendar-heart',\n highlight: dateFormatter.format(result.dueDate),\n // Chip tinted with the trimester's semantic token so the inserted\n // PNG carries the same clinical-stage colour as the on-screen\n // trimester badge — with the contrast-safe orange override for the\n // `--warning` third trimester.\n highlightToken: trimesterHighlightToken(result.trimester),\n brand: insertBrand,\n fields: [\n {\n // The estimated date of delivery → calendar glyph.\n icon: 'calendar',\n label: t('dueDateCalculator.result.dueDateLabel'),\n value: dateFormatter.format(result.dueDate),\n },\n {\n // Gestational age is an elapsed duration → clock glyph.\n icon: 'clock',\n label: t('dueDateCalculator.result.gestationLabel'),\n value: result.gestationalAge\n ? t('dueDateCalculator.result.gestation', {\n weeks: result.gestationalAge.weeks,\n days: result.gestationalAge.days,\n })\n : '—',\n },\n {\n // Trimester is a clinical-stage classification → tag.\n icon: 'tag',\n label: t('dueDateCalculator.result.trimesterLabel'),\n value: t(`dueDateCalculator.trimester.${result.trimester}`),\n },\n // When the schedule is shown, the single Insert button carries\n // the exam windows too (no second button).\n ...(schedule\n ? buildScheduleInsertFields(schedule, t, (d) =>\n dateFormatter.format(d),\n )\n : []),\n ],\n }}\n />\n ) : null}\n </div>\n );\n },\n);\n\nDueDateCalculator.displayName = 'DueDateCalculator';\n"],"names":["DEPRECATED","isoDate","dueDateCalculatorAgent","handle","args","rootVariants","cva","DATE_LABEL_KEY","toIsoDate","d","format","fromIsoDate","iso","parseISO","CYCLE_LENGTH_RANGE","DueDateCalculator","forwardRef","defaultMethod","onResultChange","onInsert","insertVariant","onCopy","onError","insertBrand","showSchedule","scheduleOptions","id","width","className","ref","i18n","useTranslation","method","setMethod","useState","refDate","setRefDate","cycleLength","setCycleLength","DEFAULT_CYCLE_LENGTH","embryoAge","setEmbryoAge","crlMm","setCrlMm","scanDate","setScanDate","today","useMemo","asOfDate","setAsOfDate","redating","redateByCrl","result","effectiveDate","effectiveCycle","computeDueDate","dateFormatter","useEffect","liveRef","useRef","agentHandle","live","r","next","parsed","isAfter","days","now","parsedScan","mm","useAgentRegistration","schedule","computeAntenatalSchedule","jsxs","RadioGroup","jsx","Radio","FormField","DatePicker","NumberInput","Badge","Card","TRIMESTER_BADGE_VARIANT","AntenatalScheduleTimeline","InsertButton","trimesterHighlightToken","buildScheduleInsertFields"],"mappings":";;;;;;;;;;;;;;;;;AAyBA,MAAMA,IAAa,iDAGbC,IAAU;AAAA,EACd,MAAM;AAAA,EACN,SAAS;AACX,GAEaC,KAAgE;AAAA,EAC3E,IAAI;AAAA;AAAA,EAEJ,cAAc,CAAC,WAAW;AAAA,EAC1B,OAAO;AAAA,IACL,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACC,MAAWA,EAAO,UAAA;AAAA,IAAU;AAAA,IAErC,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACA,MAAWA,EAAO,UAAA;AAAA,IAAU;AAAA,EACrC;AAAA,EAEF,SAAS;AAAA,IACP,YAAY;AAAA;AAAA;AAAA,MAGV,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,YAAY;AAAA,QACV,MAAM;AAAA,QACN,YAAY;AAAA,UACV,QAAQ;AAAA,YACN,MAAM,CAAC,OAAO,cAAc,KAAK;AAAA,YACjC,aACE;AAAA,UAAA;AAAA,QACJ;AAAA,QAEF,UAAU,CAAC,QAAQ;AAAA,QAC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AA,oBAAA,CAC7B,IACD;AAAA,kBAAA;AAAA,kBAEN;AAAA;AAAA,oBAEE,MAAM;AAAA,oBACN,OAAO,EAAE,yCAAyC;AAAA,oBAClD,OAAO,EAAE,+BAA+BA,EAAO,SAAS,EAAE;AAAA,kBAAA;AAAA;AAAA;AAAA,kBAI5D,GAAImB,IACAe;AAAA,oBAA0Bf;AAAA,oBAAU;AAAA,oBAAG,CAAC9D,MACtC+C,EAAc,OAAO/C,CAAC;AAAA,kBAAA,IAExB,CAAA;AAAA,gBAAC;AAAA,cACP;AAAA,YACF;AAAA,UAAA,IAEA;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGV;AACF;AAEAM,GAAkB,cAAc;"}
|
|
@@ -4,7 +4,7 @@ import { c as P } from "./index-D2ZczOXr.js";
|
|
|
4
4
|
import { useTranslation as V } from "react-i18next";
|
|
5
5
|
import { u as _ } from "./registry-DvAUVLHh.js";
|
|
6
6
|
import { F as D } from "./form-field-D1oqYisL.js";
|
|
7
|
-
import { N as q } from "./number-input-
|
|
7
|
+
import { N as q } from "./number-input-CM1q9zvH.js";
|
|
8
8
|
import { C } from "./card-DPmk26CL.js";
|
|
9
9
|
import { B as z } from "./badge-CIt-UFEx.js";
|
|
10
10
|
import { I as G } from "./insert-result-98J1QEp7.js";
|
|
@@ -220,4 +220,4 @@ export {
|
|
|
220
220
|
Y as F,
|
|
221
221
|
Q as e
|
|
222
222
|
};
|
|
223
|
-
//# sourceMappingURL=fetal-weight-
|
|
223
|
+
//# sourceMappingURL=fetal-weight-DXA6ZpMq.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetal-weight-C7JXGg6E.js","sources":["../../src/components/fetal-weight/fetal-weight.agent.ts","../../src/components/fetal-weight/efw.ts","../../src/components/fetal-weight/fetal-weight.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — FetalWeight. */\n/* */\n/* Clinical calculator: ultrasound biometry (BPD / HC / AC / FL, mm) → */\n/* estimated fetal weight in grams via Hadlock. The agent surface is the */\n/* four biometry inputs plus the computed EFW; the handle is the curated */\n/* `FetalWeightHandle` (the public `ref` stays the root <div>, exactly as */\n/* `slider.tsx` and `bmi-calculator.tsx` keep theirs). */\n/* */\n/* PHI (§7): never exposes patient identity — the slots return the */\n/* operator's own structural measurements in millimetres and the weight */\n/* derived from them. See `src/docs/26-agent-readiness.mdx`. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { FetalWeightHandle } from './fetal-weight';\n\n/** JSON Schema fragment for one optional biometry measurement, millimetres. */\nconst measurement = (label: string) => ({\n oneOf: [{ type: 'number', exclusiveMinimum: 0 }, { type: 'null' }],\n description: `${label} in millimetres, or null to clear it.`,\n});\n\nexport const fetalWeightAgent: AgentAdapter<FetalWeightHandle> = {\n id: 'fetal-weight',\n // set_value → the `set_biometry` action + the `biometry` state slot.\n capabilities: ['set_value'],\n state: {\n biometry: {\n type: '{ bpdMm: number | null, hcMm: number | null, acMm: number | null, flMm: number | null }',\n descriptionKey: 'ui.agent.fetalWeight.state.biometry',\n description:\n 'The four ultrasound measurements as entered, in millimetres — biparietal diameter, head circumference, abdominal circumference and femur length. Null where unset. Read this to see why a result is still null.',\n read: (handle) => handle.getBiometry(),\n },\n result: {\n type: \"{ grams: number, method: 'hadlock4' | 'hadlock1' } | null\",\n descriptionKey: 'ui.agent.fetalWeight.state.result',\n description:\n 'Estimated fetal weight in grams and which Hadlock regression produced it — `hadlock4` when all four measurements are present, `hadlock1` from AC + FL alone. Null until AC and FL are both set.',\n read: (handle) => handle.getResult(),\n },\n },\n actions: {\n set_biometry: {\n // Drives the same local input state a user types into; nothing is\n // persisted to a record, and every value is reversible in the same UI.\n safety: 'write',\n argsType:\n '{ bpdMm?: number | null, hcMm?: number | null, acMm?: number | null, flMm?: number | null }',\n argsSchema: {\n type: 'object',\n properties: {\n bpdMm: measurement('Biparietal diameter'),\n hcMm: measurement('Head circumference'),\n acMm: measurement('Abdominal circumference'),\n flMm: measurement('Femur length'),\n },\n additionalProperties: false,\n },\n idempotent: true,\n returns: 'boolean',\n returnsSchema: {\n type: 'boolean',\n description: 'True when the measurements were applied.',\n },\n errors: [\n 'Returns false and writes nothing when any supplied measurement is not a positive number — the payload applies all-or-nothing.',\n ],\n examples: [\n {\n args: { bpdMm: 85, hcMm: 310, acMm: 300, flMm: 62 },\n note: 'Full biometry around 32 weeks → the Hadlock 4-parameter estimate.',\n },\n {\n args: { acMm: 300, flMm: 62 },\n note: 'AC + FL only — the minimum for an estimate, via Hadlock 1.',\n },\n ],\n descriptionKey: 'ui.agent.fetalWeight.actions.setBiometry',\n description:\n 'Set any subset of the ultrasound biometry in millimetres. Omitted measurements are left unchanged; an explicit null clears one. AC and FL are the minimum for an estimate.',\n invoke: (\n handle,\n args: {\n bpdMm?: number | null;\n hcMm?: number | null;\n acMm?: number | null;\n flMm?: number | null;\n },\n ) => handle.setBiometry(args),\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'fetal-weight',\n description:\n 'Marks the FetalWeight calculator (estimated fetal weight from ultrasound biometry).',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description:\n 'Sourced from the id prop. Also the registry key — without an `id` the instance does not register and the handle-driven action/state are unreachable.',\n },\n },\n};\n","/* ------------------------------------------------------------------ */\n/* Estimated fetal weight (EFW) from ultrasound biometry — Hadlock. */\n/* */\n/* Pure, framework-free, unit-testable. Hadlock (1985) regressions on */\n/* log10(weight in grams) from biometry in CENTIMETRES (inputs are taken */\n/* in mm and converted). The 4-parameter formula (BPD+HC+AC+FL) is the */\n/* default; the AC+FL formula is the fallback for partial biometry. */\n/* */\n/* Hadlock FP, Harrist RB, Sharman RS, Deter RL, Park SK. \"Estimation of */\n/* fetal weight with the use of head, body, and femur measurements.\" */\n/* Am J Obstet Gynecol 1985;151:333-7. */\n/* ------------------------------------------------------------------ */\n\nexport interface FetalBiometryInput {\n /** Biparietal diameter, mm. */\n bpdMm?: number | null;\n /** Head circumference, mm. */\n hcMm?: number | null;\n /** Abdominal circumference, mm. */\n acMm?: number | null;\n /** Femur length, mm. */\n flMm?: number | null;\n}\n\n/** Which Hadlock regression produced the estimate. */\nexport type EfwMethod = 'hadlock4' | 'hadlock1';\n\nexport interface EfwResult {\n /** Estimated fetal weight, grams (rounded to the nearest gram). */\n grams: number;\n /** The Hadlock regression used, given the available measurements. */\n method: EfwMethod;\n}\n\n/** A measurement is usable when it is a positive, finite number. */\nfunction cm(mm: number | null | undefined): number | null {\n return typeof mm === 'number' && Number.isFinite(mm) && mm > 0\n ? mm / 10\n : null;\n}\n\n/**\n * Estimate fetal weight from biometry. Uses the Hadlock 4-parameter formula\n * when BPD, HC, AC and FL are all present, else the AC+FL formula. Returns\n * `null` when AC and FL (the minimum) aren't both available.\n */\nexport function estimateFetalWeight(\n input: FetalBiometryInput,\n): EfwResult | null {\n const bpd = cm(input.bpdMm);\n const hc = cm(input.hcMm);\n const ac = cm(input.acMm);\n const fl = cm(input.flMm);\n\n // AC + FL are the minimum for any Hadlock estimate.\n if (ac === null || fl === null) return null;\n\n let log10: number;\n let method: EfwMethod;\n\n if (bpd !== null && hc !== null) {\n // Hadlock 4 (BPD, HC, AC, FL).\n log10 =\n 1.3596 -\n 0.00386 * ac * fl +\n 0.0064 * hc +\n 0.00061 * bpd * ac +\n 0.0424 * ac +\n 0.174 * fl;\n method = 'hadlock4';\n } else {\n // Hadlock 1 (AC, FL).\n log10 = 1.304 + 0.05281 * ac + 0.1938 * fl - 0.004 * ac * fl;\n method = 'hadlock1';\n }\n\n return { grams: Math.round(10 ** log10), method };\n}\n","/* ------------------------------------------------------------------ */\n/* FetalWeight — estimated fetal weight from ultrasound biometry. */\n/* */\n/* Inputs BPD / HC / AC / FL (mm); outputs EFW in grams via Hadlock */\n/* (maths in `./fetal-weight`, pure + tested). */\n/* ------------------------------------------------------------------ */\n\nimport { forwardRef, useEffect, useMemo, useRef, useState } from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { fetalWeightAgent } from './fetal-weight.agent';\nimport { FormField } from '../form-field';\nimport { NumberInput } from '../number-input';\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 { type EfwResult, estimateFetalWeight } from './efw';\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\n/** A biometry figure is usable when it is a positive finite number, or cleared. */\nconst isMeasurement = (n: number | null | undefined): boolean =>\n n === null || n === undefined || (Number.isFinite(n) && n > 0);\n\n/** Canonical biometry snapshot — millimetres, or null where unset. */\nexport interface FetalBiometrySnapshot {\n bpdMm: number | null;\n hcMm: number | null;\n acMm: number | null;\n flMm: number | null;\n}\n\n/**\n * Curated imperative handle for agent / external automation. Reads the four\n * biometry measurements and the Hadlock estimate, and writes the measurements\n * the way a user would type them. Never exposes patient identity — only\n * structural millimetres and the derived weight. Consumed by\n * `fetal-weight.agent.ts`; the public `ref` stays the root DOM element.\n */\nexport interface FetalWeightHandle {\n /** Current biometry in millimetres, or null where unset. */\n getBiometry: () => FetalBiometrySnapshot;\n /** Estimated fetal weight + the regression used, or null below the minimum biometry. */\n getResult: () => EfwResult | null;\n /**\n * Set any subset of the biometry in millimetres. Omitted keys are left\n * unchanged; an explicit `null` clears that measurement. Applies all-or-\n * nothing — returns false and writes nothing if any value is not positive.\n */\n setBiometry: (next: Partial<FetalBiometrySnapshot>) => boolean;\n}\n\nexport interface FetalWeightProps extends VariantProps<typeof rootVariants> {\n /** Fires whenever an estimate can be computed (and `null` when it can't). */\n onResultChange?: (result: EfwResult | null) => void;\n /** When provided, shows the result-action buttons that emit / copy the result. */\n onInsert?: (payload: InsertPayload) => void;\n /** Which verb the result button performs. Defaults to `'insert'`. */\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 /** Brand wordmark printed in the inserted/copied result-card footer. */\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 FetalWeight = forwardRef<HTMLDivElement, FetalWeightProps>(\n (\n {\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 [bpdMm, setBpdMm] = useState<number | null>(null);\n const [hcMm, setHcMm] = useState<number | null>(null);\n const [acMm, setAcMm] = useState<number | null>(null);\n const [flMm, setFlMm] = useState<number | null>(null);\n\n const result = useMemo(\n () => estimateFetalWeight({ bpdMm, hcMm, acMm, flMm }),\n [bpdMm, hcMm, acMm, flMm],\n );\n\n useEffect(() => {\n onResultChange?.(result);\n }, [result, onResultChange]);\n\n /* ── Agent handle ────────────────────────────────────────────────── */\n const liveRef = useRef({ bpdMm, hcMm, acMm, flMm, result });\n liveRef.current = { bpdMm, hcMm, acMm, flMm, result };\n\n const agentHandle = useMemo<FetalWeightHandle>(\n () => ({\n getBiometry: () => {\n const { bpdMm: bpd, hcMm: hc, acMm: ac, flMm: fl } = liveRef.current;\n return { bpdMm: bpd, hcMm: hc, acMm: ac, flMm: fl };\n },\n getResult: () => liveRef.current.result,\n setBiometry: (next) => {\n const entries = [\n ['bpdMm', setBpdMm],\n ['hcMm', setHcMm],\n ['acMm', setAcMm],\n ['flMm', setFlMm],\n ] as const;\n // Validate the whole payload before writing any of it, so a bad\n // value can't leave the form half-updated.\n for (const [key] of entries) {\n if (key in next && !isMeasurement(next[key])) return false;\n }\n for (const [key, set] of entries) {\n if (key in next) set(next[key] ?? null);\n }\n return true;\n },\n }),\n [],\n );\n useAgentRegistration(fetalWeightAgent, agentHandle, id);\n\n const grams = useMemo(\n () => new Intl.NumberFormat(i18n.language, { maximumFractionDigits: 0 }),\n [i18n.language],\n );\n\n const unit = t('fetalWeight.units.mm');\n const efwText = (r: EfwResult): string =>\n t('fetalWeight.efwValue', { grams: grams.format(r.grams) });\n\n const fields: {\n label: string;\n value: number | null;\n onChange: (v: number | null) => void;\n }[] = [\n { label: t('fetalWeight.bpd'), value: bpdMm, onChange: setBpdMm },\n { label: t('fetalWeight.hc'), value: hcMm, onChange: setHcMm },\n { label: t('fetalWeight.ac'), value: acMm, onChange: setAcMm },\n { label: t('fetalWeight.fl'), value: flMm, onChange: setFlMm },\n ];\n\n return (\n <div\n ref={ref}\n data-component=\"fetal-weight\"\n data-component-id={id}\n className={rootVariants({ width, className })}\n >\n <div className=\"ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:sm:grid-cols-2\">\n {fields.map((f) => (\n <FormField key={f.label} label={`${f.label} (${unit})`}>\n <NumberInput\n mode=\"decimal\"\n min={0}\n step={0.1}\n value={f.value}\n onChange={f.onChange}\n />\n </FormField>\n ))}\n </div>\n\n <p className=\"ds:sr-only\" role=\"status\" aria-live=\"polite\">\n {result ? `${t('fetalWeight.efwLabel')}: ${efwText(result)}.` : ''}\n </p>\n\n {result ? (\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('fetalWeight.efwLabel')}\n </dt>\n <dd className=\"type-metric ds:text-foreground\">\n {efwText(result)}\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('fetalWeight.methodLabel')}\n </dt>\n <dd>\n <Badge variant=\"info\">\n {t(`fetalWeight.method.${result.method}`)}\n </Badge>\n </dd>\n </div>\n </dl>\n <p className=\"type-body-sm ds:text-muted-foreground\">\n {t('fetalWeight.disclaimer')}\n </p>\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.fetalWeight'),\n icon: 'scale',\n highlight: efwText(result),\n highlightToken: '--info',\n brand: insertBrand,\n fields: [\n {\n icon: 'scale',\n label: t('fetalWeight.efwLabel'),\n value: efwText(result),\n },\n {\n icon: 'activity',\n label: t('fetalWeight.methodLabel'),\n value: t(`fetalWeight.method.${result.method}`),\n },\n ],\n }}\n />\n ) : null}\n </Card.Body>\n </Card>\n ) : (\n <p className=\"type-body ds:text-muted-foreground\">\n {t('fetalWeight.empty')}\n </p>\n )}\n </div>\n );\n },\n);\n\nFetalWeight.displayName = 'FetalWeight';\n"],"names":["measurement","label","fetalWeightAgent","handle","args","cm","mm","estimateFetalWeight","input","bpd","hc","ac","fl","log10","method","rootVariants","cva","isMeasurement","n","FetalWeight","forwardRef","onResultChange","onInsert","insertVariant","onCopy","onError","insertBrand","id","width","className","ref","i18n","useTranslation","bpdMm","setBpdMm","useState","hcMm","setHcMm","acMm","setAcMm","flMm","setFlMm","result","useMemo","useEffect","liveRef","useRef","agentHandle","next","entries","key","set","useAgentRegistration","grams","unit","efwText","r","fields","jsxs","jsx","f","FormField","NumberInput","Card","Badge","InsertButton"],"mappings":";;;;;;;;;;AAkBA,MAAMA,IAAc,CAACC,OAAmB;AAAA,EACtC,OAAO,CAAC,EAAE,MAAM,UAAU,kBAAkB,KAAK,EAAE,MAAM,QAAQ;AAAA,EACjE,aAAa,GAAGA,CAAK;AACvB,IAEaC,IAAoD;AAAA,EAC/D,IAAI;AAAA;AAAA,EAEJ,cAAc,CAAC,WAAW;AAAA,EAC1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hB;AAAA,kBACP,QAAQ;AAAA,oBACN;AAAA,sBACE,MAAM;AAAA,sBACN,OAAO,EAAE,sBAAsB;AAAA,sBAC/B,OAAO6B,EAAQb,CAAM;AAAA,oBAAA;AAAA,oBAEvB;AAAA,sBACE,MAAM;AAAA,sBACN,OAAO,EAAE,yBAAyB;AAAA,sBAClC,OAAO,EAAE,sBAAsBA,EAAO,MAAM,EAAE;AAAA,oBAAA;AAAA,kBAChD;AAAA,gBACF;AAAA,cACF;AAAA,YAAA,IAEA;AAAA,UAAA,EAAA,CACN,EAAA,CACF,IAEA,gBAAAiB,EAAC,KAAA,EAAE,WAAU,sCACV,UAAA,EAAE,mBAAmB,EAAA,CACxB;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEAxC,EAAY,cAAc;"}
|
|
1
|
+
{"version":3,"file":"fetal-weight-DXA6ZpMq.js","sources":["../../src/components/fetal-weight/fetal-weight.agent.ts","../../src/components/fetal-weight/efw.ts","../../src/components/fetal-weight/fetal-weight.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — FetalWeight. */\n/* */\n/* Clinical calculator: ultrasound biometry (BPD / HC / AC / FL, mm) → */\n/* estimated fetal weight in grams via Hadlock. The agent surface is the */\n/* four biometry inputs plus the computed EFW; the handle is the curated */\n/* `FetalWeightHandle` (the public `ref` stays the root <div>, exactly as */\n/* `slider.tsx` and `bmi-calculator.tsx` keep theirs). */\n/* */\n/* PHI (§7): never exposes patient identity — the slots return the */\n/* operator's own structural measurements in millimetres and the weight */\n/* derived from them. See `src/docs/26-agent-readiness.mdx`. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { FetalWeightHandle } from './fetal-weight';\n\n/** JSON Schema fragment for one optional biometry measurement, millimetres. */\nconst measurement = (label: string) => ({\n oneOf: [{ type: 'number', exclusiveMinimum: 0 }, { type: 'null' }],\n description: `${label} in millimetres, or null to clear it.`,\n});\n\nexport const fetalWeightAgent: AgentAdapter<FetalWeightHandle> = {\n id: 'fetal-weight',\n // set_value → the `set_biometry` action + the `biometry` state slot.\n capabilities: ['set_value'],\n state: {\n biometry: {\n type: '{ bpdMm: number | null, hcMm: number | null, acMm: number | null, flMm: number | null }',\n descriptionKey: 'ui.agent.fetalWeight.state.biometry',\n description:\n 'The four ultrasound measurements as entered, in millimetres — biparietal diameter, head circumference, abdominal circumference and femur length. Null where unset. Read this to see why a result is still null.',\n read: (handle) => handle.getBiometry(),\n },\n result: {\n type: \"{ grams: number, method: 'hadlock4' | 'hadlock1' } | null\",\n descriptionKey: 'ui.agent.fetalWeight.state.result',\n description:\n 'Estimated fetal weight in grams and which Hadlock regression produced it — `hadlock4` when all four measurements are present, `hadlock1` from AC + FL alone. Null until AC and FL are both set.',\n read: (handle) => handle.getResult(),\n },\n },\n actions: {\n set_biometry: {\n // Drives the same local input state a user types into; nothing is\n // persisted to a record, and every value is reversible in the same UI.\n safety: 'write',\n argsType:\n '{ bpdMm?: number | null, hcMm?: number | null, acMm?: number | null, flMm?: number | null }',\n argsSchema: {\n type: 'object',\n properties: {\n bpdMm: measurement('Biparietal diameter'),\n hcMm: measurement('Head circumference'),\n acMm: measurement('Abdominal circumference'),\n flMm: measurement('Femur length'),\n },\n additionalProperties: false,\n },\n idempotent: true,\n returns: 'boolean',\n returnsSchema: {\n type: 'boolean',\n description: 'True when the measurements were applied.',\n },\n errors: [\n 'Returns false and writes nothing when any supplied measurement is not a positive number — the payload applies all-or-nothing.',\n ],\n examples: [\n {\n args: { bpdMm: 85, hcMm: 310, acMm: 300, flMm: 62 },\n note: 'Full biometry around 32 weeks → the Hadlock 4-parameter estimate.',\n },\n {\n args: { acMm: 300, flMm: 62 },\n note: 'AC + FL only — the minimum for an estimate, via Hadlock 1.',\n },\n ],\n descriptionKey: 'ui.agent.fetalWeight.actions.setBiometry',\n description:\n 'Set any subset of the ultrasound biometry in millimetres. Omitted measurements are left unchanged; an explicit null clears one. AC and FL are the minimum for an estimate.',\n invoke: (\n handle,\n args: {\n bpdMm?: number | null;\n hcMm?: number | null;\n acMm?: number | null;\n flMm?: number | null;\n },\n ) => handle.setBiometry(args),\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'fetal-weight',\n description:\n 'Marks the FetalWeight calculator (estimated fetal weight from ultrasound biometry).',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description:\n 'Sourced from the id prop. Also the registry key — without an `id` the instance does not register and the handle-driven action/state are unreachable.',\n },\n },\n};\n","/* ------------------------------------------------------------------ */\n/* Estimated fetal weight (EFW) from ultrasound biometry — Hadlock. */\n/* */\n/* Pure, framework-free, unit-testable. Hadlock (1985) regressions on */\n/* log10(weight in grams) from biometry in CENTIMETRES (inputs are taken */\n/* in mm and converted). The 4-parameter formula (BPD+HC+AC+FL) is the */\n/* default; the AC+FL formula is the fallback for partial biometry. */\n/* */\n/* Hadlock FP, Harrist RB, Sharman RS, Deter RL, Park SK. \"Estimation of */\n/* fetal weight with the use of head, body, and femur measurements.\" */\n/* Am J Obstet Gynecol 1985;151:333-7. */\n/* ------------------------------------------------------------------ */\n\nexport interface FetalBiometryInput {\n /** Biparietal diameter, mm. */\n bpdMm?: number | null;\n /** Head circumference, mm. */\n hcMm?: number | null;\n /** Abdominal circumference, mm. */\n acMm?: number | null;\n /** Femur length, mm. */\n flMm?: number | null;\n}\n\n/** Which Hadlock regression produced the estimate. */\nexport type EfwMethod = 'hadlock4' | 'hadlock1';\n\nexport interface EfwResult {\n /** Estimated fetal weight, grams (rounded to the nearest gram). */\n grams: number;\n /** The Hadlock regression used, given the available measurements. */\n method: EfwMethod;\n}\n\n/** A measurement is usable when it is a positive, finite number. */\nfunction cm(mm: number | null | undefined): number | null {\n return typeof mm === 'number' && Number.isFinite(mm) && mm > 0\n ? mm / 10\n : null;\n}\n\n/**\n * Estimate fetal weight from biometry. Uses the Hadlock 4-parameter formula\n * when BPD, HC, AC and FL are all present, else the AC+FL formula. Returns\n * `null` when AC and FL (the minimum) aren't both available.\n */\nexport function estimateFetalWeight(\n input: FetalBiometryInput,\n): EfwResult | null {\n const bpd = cm(input.bpdMm);\n const hc = cm(input.hcMm);\n const ac = cm(input.acMm);\n const fl = cm(input.flMm);\n\n // AC + FL are the minimum for any Hadlock estimate.\n if (ac === null || fl === null) return null;\n\n let log10: number;\n let method: EfwMethod;\n\n if (bpd !== null && hc !== null) {\n // Hadlock 4 (BPD, HC, AC, FL).\n log10 =\n 1.3596 -\n 0.00386 * ac * fl +\n 0.0064 * hc +\n 0.00061 * bpd * ac +\n 0.0424 * ac +\n 0.174 * fl;\n method = 'hadlock4';\n } else {\n // Hadlock 1 (AC, FL).\n log10 = 1.304 + 0.05281 * ac + 0.1938 * fl - 0.004 * ac * fl;\n method = 'hadlock1';\n }\n\n return { grams: Math.round(10 ** log10), method };\n}\n","/* ------------------------------------------------------------------ */\n/* FetalWeight — estimated fetal weight from ultrasound biometry. */\n/* */\n/* Inputs BPD / HC / AC / FL (mm); outputs EFW in grams via Hadlock */\n/* (maths in `./fetal-weight`, pure + tested). */\n/* ------------------------------------------------------------------ */\n\nimport { forwardRef, useEffect, useMemo, useRef, useState } from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { fetalWeightAgent } from './fetal-weight.agent';\nimport { FormField } from '../form-field';\nimport { NumberInput } from '../number-input';\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 { type EfwResult, estimateFetalWeight } from './efw';\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\n/** A biometry figure is usable when it is a positive finite number, or cleared. */\nconst isMeasurement = (n: number | null | undefined): boolean =>\n n === null || n === undefined || (Number.isFinite(n) && n > 0);\n\n/** Canonical biometry snapshot — millimetres, or null where unset. */\nexport interface FetalBiometrySnapshot {\n bpdMm: number | null;\n hcMm: number | null;\n acMm: number | null;\n flMm: number | null;\n}\n\n/**\n * Curated imperative handle for agent / external automation. Reads the four\n * biometry measurements and the Hadlock estimate, and writes the measurements\n * the way a user would type them. Never exposes patient identity — only\n * structural millimetres and the derived weight. Consumed by\n * `fetal-weight.agent.ts`; the public `ref` stays the root DOM element.\n */\nexport interface FetalWeightHandle {\n /** Current biometry in millimetres, or null where unset. */\n getBiometry: () => FetalBiometrySnapshot;\n /** Estimated fetal weight + the regression used, or null below the minimum biometry. */\n getResult: () => EfwResult | null;\n /**\n * Set any subset of the biometry in millimetres. Omitted keys are left\n * unchanged; an explicit `null` clears that measurement. Applies all-or-\n * nothing — returns false and writes nothing if any value is not positive.\n */\n setBiometry: (next: Partial<FetalBiometrySnapshot>) => boolean;\n}\n\nexport interface FetalWeightProps extends VariantProps<typeof rootVariants> {\n /** Fires whenever an estimate can be computed (and `null` when it can't). */\n onResultChange?: (result: EfwResult | null) => void;\n /** When provided, shows the result-action buttons that emit / copy the result. */\n onInsert?: (payload: InsertPayload) => void;\n /** Which verb the result button performs. Defaults to `'insert'`. */\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 /** Brand wordmark printed in the inserted/copied result-card footer. */\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 FetalWeight = forwardRef<HTMLDivElement, FetalWeightProps>(\n (\n {\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 [bpdMm, setBpdMm] = useState<number | null>(null);\n const [hcMm, setHcMm] = useState<number | null>(null);\n const [acMm, setAcMm] = useState<number | null>(null);\n const [flMm, setFlMm] = useState<number | null>(null);\n\n const result = useMemo(\n () => estimateFetalWeight({ bpdMm, hcMm, acMm, flMm }),\n [bpdMm, hcMm, acMm, flMm],\n );\n\n useEffect(() => {\n onResultChange?.(result);\n }, [result, onResultChange]);\n\n /* ── Agent handle ────────────────────────────────────────────────── */\n const liveRef = useRef({ bpdMm, hcMm, acMm, flMm, result });\n liveRef.current = { bpdMm, hcMm, acMm, flMm, result };\n\n const agentHandle = useMemo<FetalWeightHandle>(\n () => ({\n getBiometry: () => {\n const { bpdMm: bpd, hcMm: hc, acMm: ac, flMm: fl } = liveRef.current;\n return { bpdMm: bpd, hcMm: hc, acMm: ac, flMm: fl };\n },\n getResult: () => liveRef.current.result,\n setBiometry: (next) => {\n const entries = [\n ['bpdMm', setBpdMm],\n ['hcMm', setHcMm],\n ['acMm', setAcMm],\n ['flMm', setFlMm],\n ] as const;\n // Validate the whole payload before writing any of it, so a bad\n // value can't leave the form half-updated.\n for (const [key] of entries) {\n if (key in next && !isMeasurement(next[key])) return false;\n }\n for (const [key, set] of entries) {\n if (key in next) set(next[key] ?? null);\n }\n return true;\n },\n }),\n [],\n );\n useAgentRegistration(fetalWeightAgent, agentHandle, id);\n\n const grams = useMemo(\n () => new Intl.NumberFormat(i18n.language, { maximumFractionDigits: 0 }),\n [i18n.language],\n );\n\n const unit = t('fetalWeight.units.mm');\n const efwText = (r: EfwResult): string =>\n t('fetalWeight.efwValue', { grams: grams.format(r.grams) });\n\n const fields: {\n label: string;\n value: number | null;\n onChange: (v: number | null) => void;\n }[] = [\n { label: t('fetalWeight.bpd'), value: bpdMm, onChange: setBpdMm },\n { label: t('fetalWeight.hc'), value: hcMm, onChange: setHcMm },\n { label: t('fetalWeight.ac'), value: acMm, onChange: setAcMm },\n { label: t('fetalWeight.fl'), value: flMm, onChange: setFlMm },\n ];\n\n return (\n <div\n ref={ref}\n data-component=\"fetal-weight\"\n data-component-id={id}\n className={rootVariants({ width, className })}\n >\n <div className=\"ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:sm:grid-cols-2\">\n {fields.map((f) => (\n <FormField key={f.label} label={`${f.label} (${unit})`}>\n <NumberInput\n mode=\"decimal\"\n min={0}\n step={0.1}\n value={f.value}\n onChange={f.onChange}\n />\n </FormField>\n ))}\n </div>\n\n <p className=\"ds:sr-only\" role=\"status\" aria-live=\"polite\">\n {result ? `${t('fetalWeight.efwLabel')}: ${efwText(result)}.` : ''}\n </p>\n\n {result ? (\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('fetalWeight.efwLabel')}\n </dt>\n <dd className=\"type-metric ds:text-foreground\">\n {efwText(result)}\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('fetalWeight.methodLabel')}\n </dt>\n <dd>\n <Badge variant=\"info\">\n {t(`fetalWeight.method.${result.method}`)}\n </Badge>\n </dd>\n </div>\n </dl>\n <p className=\"type-body-sm ds:text-muted-foreground\">\n {t('fetalWeight.disclaimer')}\n </p>\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.fetalWeight'),\n icon: 'scale',\n highlight: efwText(result),\n highlightToken: '--info',\n brand: insertBrand,\n fields: [\n {\n icon: 'scale',\n label: t('fetalWeight.efwLabel'),\n value: efwText(result),\n },\n {\n icon: 'activity',\n label: t('fetalWeight.methodLabel'),\n value: t(`fetalWeight.method.${result.method}`),\n },\n ],\n }}\n />\n ) : null}\n </Card.Body>\n </Card>\n ) : (\n <p className=\"type-body ds:text-muted-foreground\">\n {t('fetalWeight.empty')}\n </p>\n )}\n </div>\n );\n },\n);\n\nFetalWeight.displayName = 'FetalWeight';\n"],"names":["measurement","label","fetalWeightAgent","handle","args","cm","mm","estimateFetalWeight","input","bpd","hc","ac","fl","log10","method","rootVariants","cva","isMeasurement","n","FetalWeight","forwardRef","onResultChange","onInsert","insertVariant","onCopy","onError","insertBrand","id","width","className","ref","i18n","useTranslation","bpdMm","setBpdMm","useState","hcMm","setHcMm","acMm","setAcMm","flMm","setFlMm","result","useMemo","useEffect","liveRef","useRef","agentHandle","next","entries","key","set","useAgentRegistration","grams","unit","efwText","r","fields","jsxs","jsx","f","FormField","NumberInput","Card","Badge","InsertButton"],"mappings":";;;;;;;;;;AAkBA,MAAMA,IAAc,CAACC,OAAmB;AAAA,EACtC,OAAO,CAAC,EAAE,MAAM,UAAU,kBAAkB,KAAK,EAAE,MAAM,QAAQ;AAAA,EACjE,aAAa,GAAGA,CAAK;AACvB,IAEaC,IAAoD;AAAA,EAC/D,IAAI;AAAA;AAAA,EAEJ,cAAc,CAAC,WAAW;AAAA,EAC1B,OAAO;AAAA,IACL,UAAU;AAAA,MACR,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACC,MAAWA,EAAO,YAAA;AAAA,IAAY;AAAA,IAEvC,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACA,MAAWA,EAAO,UAAA;AAAA,IAAU;AAAA,EACrC;AAAA,EAEF,SAAS;AAAA,IACP,cAAc;AAAA;AAAA;AAAA,MAGZ,QAAQ;AAAA,MACR,UACE;AAAA,MACF,YAAY;AAAA,QACV,MAAM;AAAA,QACN,YAAY;AAAA,UACV,OAAOH,EAAY,qBAAqB;AAAA,UACxC,MAAMA,EAAY,oBAAoB;AAAA,UACtC,MAAMA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xC,EAAY,cAAc;"}
|
|
@@ -16,7 +16,7 @@ import { F as Nt, a as Tt } from "./file-Cwe9VC1A.js";
|
|
|
16
16
|
import { F as Ft } from "./file-text-5yv6r2ls.js";
|
|
17
17
|
import { F as At } from "./file-spreadsheet-DmwyfV4O.js";
|
|
18
18
|
import { C as Dt } from "./chevron-right-I9AeSxH2.js";
|
|
19
|
-
import { A as Rt, d as It, D as Te } from "./actions-cell-renderer-
|
|
19
|
+
import { A as Rt, d as It, D as Te } from "./actions-cell-renderer-BD-jruqA.js";
|
|
20
20
|
import { B as $e } from "./badge-CIt-UFEx.js";
|
|
21
21
|
import { D as Ge } from "./download-CfYKJO_j.js";
|
|
22
22
|
import { P as zt } from "./pen-line-D0De5zdl.js";
|
|
@@ -1756,4 +1756,4 @@ export {
|
|
|
1756
1756
|
yn as F,
|
|
1757
1757
|
Gt as f
|
|
1758
1758
|
};
|
|
1759
|
-
//# sourceMappingURL=file-manager-
|
|
1759
|
+
//# sourceMappingURL=file-manager-BjCM2fZB.js.map
|