@alfadocs/ui-kit-debug 0.43.0 → 0.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/{bmi-calculator-DuVSFDuw.js → bmi-calculator-DFPWL2OJ.js} +92 -78
- package/dist/_chunks/bmi-calculator-DFPWL2OJ.js.map +1 -0
- package/dist/_chunks/{calculator-dialog-DdexHrTP.js → calculator-dialog-D-nfvteH.js} +2 -2
- package/dist/_chunks/{calculator-dialog-DdexHrTP.js.map → calculator-dialog-D-nfvteH.js.map} +1 -1
- package/dist/_chunks/{cycle-calculator-Dln-y1k_.js → cycle-calculator-ChHBcjet.js} +58 -50
- package/dist/_chunks/cycle-calculator-ChHBcjet.js.map +1 -0
- package/dist/_chunks/dialog-BTpZV6It.js +223 -0
- package/dist/_chunks/dialog-BTpZV6It.js.map +1 -0
- package/dist/_chunks/{due-date-calculator-Cc4dRqTI.js → due-date-calculator-CYXKLoof.js} +50 -38
- package/dist/_chunks/due-date-calculator-CYXKLoof.js.map +1 -0
- package/dist/_chunks/gestational-age-calculator-sRmoqgVr.js +190 -0
- package/dist/_chunks/gestational-age-calculator-sRmoqgVr.js.map +1 -0
- package/dist/_chunks/insert-result-CoC1oo6R.js +334 -0
- package/dist/_chunks/insert-result-CoC1oo6R.js.map +1 -0
- package/dist/_chunks/{pregnancy-weight-gain-zZL5Ir2-.js → pregnancy-weight-gain-C5YhfYnL.js} +66 -57
- package/dist/_chunks/pregnancy-weight-gain-C5YhfYnL.js.map +1 -0
- package/dist/_chunks/{unit-converter-CuXCXJhK.js → unit-converter-Ds9jalbN.js} +78 -67
- package/dist/_chunks/unit-converter-Ds9jalbN.js.map +1 -0
- package/dist/agent-catalog.json +1 -1
- package/dist/components/_shared/index.d.ts +1 -1
- package/dist/components/_shared/index.d.ts.map +1 -1
- package/dist/components/_shared/insert-result.d.ts +100 -10
- package/dist/components/_shared/insert-result.d.ts.map +1 -1
- package/dist/components/bmi-calculator/bmi-calculator.d.ts +6 -0
- package/dist/components/bmi-calculator/bmi-calculator.d.ts.map +1 -1
- package/dist/components/bmi-calculator/index.js +1 -1
- package/dist/components/calculator-dialog/index.js +1 -1
- package/dist/components/cycle-calculator/cycle-calculator.d.ts +6 -0
- package/dist/components/cycle-calculator/cycle-calculator.d.ts.map +1 -1
- package/dist/components/cycle-calculator/index.js +1 -1
- package/dist/components/dialog/dialog.d.ts +1 -0
- package/dist/components/dialog/dialog.d.ts.map +1 -1
- package/dist/components/dialog/index.js +1 -1
- package/dist/components/due-date-calculator/due-date-calculator.d.ts +6 -0
- package/dist/components/due-date-calculator/due-date-calculator.d.ts.map +1 -1
- package/dist/components/due-date-calculator/index.js +1 -1
- package/dist/components/gestational-age-calculator/gestational-age-calculator.d.ts +6 -0
- package/dist/components/gestational-age-calculator/gestational-age-calculator.d.ts.map +1 -1
- package/dist/components/gestational-age-calculator/index.js +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/pregnancy-weight-gain/index.js +1 -1
- package/dist/components/pregnancy-weight-gain/pregnancy-weight-gain.d.ts +6 -0
- package/dist/components/pregnancy-weight-gain/pregnancy-weight-gain.d.ts.map +1 -1
- package/dist/components/unit-converter/index.js +1 -1
- package/dist/components/unit-converter/unit-converter.d.ts +6 -0
- package/dist/components/unit-converter/unit-converter.d.ts.map +1 -1
- package/dist/index.js +494 -493
- package/dist/tokens.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/bmi-calculator-DuVSFDuw.js.map +0 -1
- package/dist/_chunks/cycle-calculator-Dln-y1k_.js.map +0 -1
- package/dist/_chunks/dialog-DOYgd75U.js +0 -224
- package/dist/_chunks/dialog-DOYgd75U.js.map +0 -1
- package/dist/_chunks/due-date-calculator-Cc4dRqTI.js.map +0 -1
- package/dist/_chunks/gestational-age-calculator-ZMSrzkRW.js +0 -179
- package/dist/_chunks/gestational-age-calculator-ZMSrzkRW.js.map +0 -1
- package/dist/_chunks/insert-result-DisOY2G-.js +0 -243
- package/dist/_chunks/insert-result-DisOY2G-.js.map +0 -1
- package/dist/_chunks/pregnancy-weight-gain-zZL5Ir2-.js.map +0 -1
- package/dist/_chunks/unit-converter-CuXCXJhK.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insert-result-CoC1oo6R.js","sources":["../../node_modules/lucide-react/dist/esm/icons/layers.js","../../node_modules/lucide-react/dist/esm/icons/type.js","../../src/components/_shared/insert-result.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.8.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z\",\n key: \"zw3jo\"\n }\n ],\n [\n \"path\",\n {\n d: \"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12\",\n key: \"1wduqc\"\n }\n ],\n [\n \"path\",\n {\n d: \"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17\",\n key: \"kqbvx6\"\n }\n ]\n];\nconst Layers = createLucideIcon(\"layers\", __iconNode);\n\nexport { __iconNode, Layers as default };\n//# sourceMappingURL=layers.js.map\n","/**\n * @license lucide-react v1.8.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst __iconNode = [\n [\"path\", { d: \"M12 4v16\", key: \"1654pz\" }],\n [\"path\", { d: \"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2\", key: \"e0r10z\" }],\n [\"path\", { d: \"M9 20h6\", key: \"s66wpe\" }]\n];\nconst Type = createLucideIcon(\"type\", __iconNode);\n\nexport { __iconNode, Type as default };\n//# sourceMappingURL=type.js.map\n","/* ------------------------------------------------------------------ */\n/* InsertButton — shared \"use this result\" control for the calculator */\n/* toolset. */\n/* */\n/* Two variants, one set of payload builders: */\n/* */\n/* • `insert` (default) — editor-extension context. Each button hands */\n/* the built InsertPayload to `onInsert`, who drops it into whatever */\n/* editor they use. The kit never touches an editor. */\n/* */\n/* • `copy` — app-shell context. Each button writes the chosen */\n/* representation(s) to the clipboard as a multi-format ClipboardItem */\n/* so a single copy serves any paste target. The image format is a */\n/* REAL raster PNG (the SVG card rasterised to a canvas) — clipboards */\n/* reject SVG as an image, so copying the data-URI as text is the */\n/* exact \"copied text without the image\" bug this variant fixes. */\n/* */\n/* Three inline buttons, one per mode (text / image / text + image). */\n/* */\n/* The SVG card embeds CONCRETE colours so it renders standalone as an */\n/* <img>. To stay within the \"no hardcoded colours\" rule, those colours */\n/* are sampled at click time from hidden probe spans that carry the */\n/* token utility classes — i.e. resolved from the live theme, never */\n/* written as literals in source. */\n/* ------------------------------------------------------------------ */\n\nimport { forwardRef, useRef } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { cva } from 'class-variance-authority';\nimport { Type, Image as ImageIcon, Layers } from 'lucide-react';\nimport { Button, type ButtonProps } from '../button';\n\nexport type InsertMode = 'text' | 'image' | 'text-image';\n\nexport type InsertVariant = 'insert' | 'copy';\n\nexport interface InsertCardField {\n label: string;\n value: string;\n}\n\n/**\n * Optional radial gauge, drawn as a hand-rolled native-SVG donut (track\n * `<circle>` + value arc via `stroke-dasharray`) so it survives the\n * `<img>` → `<canvas>` → `toBlob` raster. No `<foreignObject>`, no charting lib.\n */\nexport interface InsertCardGauge {\n /** Big number rendered in the gauge centre (e.g. `'22.4'`). */\n value: string;\n /**\n * Filled fraction of the ring, `0`–`1`. Takes precedence when supplied;\n * otherwise derived from a `value`/`max` numeric parse (falling back to a\n * full ring when neither is numeric).\n */\n fraction?: number;\n /** Denominator used to derive `fraction` when `fraction` is omitted. */\n max?: number;\n /**\n * Number of evenly-spaced segment gaps to notch into the ring (e.g. `4` for\n * a quartered dial). `0`/omitted draws a continuous arc.\n */\n segments?: number;\n /**\n * DS token NAME for the arc colour — e.g. `'--success'`, `'--warning'`,\n * `'--destructive'`, `'--info'`, or the light-orange overweight override.\n * Resolved to a concrete colour from a probe span at raster time; never a\n * hex literal in source.\n */\n colorToken: string;\n /** Small category label under the value inside the ring. */\n label?: string;\n}\n\nexport interface InsertCardData {\n /** Card heading. */\n title: string;\n /** Key/value rows. */\n fields: InsertCardField[];\n /** Optional highlighted line, rendered as a category chip (pill). */\n highlight?: string;\n /**\n * DS token NAME for the highlight chip fill. Defaults to the accent token\n * (`--primary`). The chip text uses the matching `<token>-foreground` when it\n * resolves, else falls back to the card background for contrast.\n */\n highlightToken?: string;\n /** Optional radial gauge drawn natively in the card. */\n gauge?: InsertCardGauge;\n /**\n * Brand wordmark printed in the card footer.\n *\n * - omitted → the default `'AlfaDocs'` wordmark.\n * - a string → that custom wordmark.\n * - `false` → no brand line at all.\n *\n * A `brand` passed to {@link SvgCardToPngOptions} overrides this per-render.\n */\n brand?: string | false;\n}\n\nexport interface InsertPayload {\n /** Which button the user chose. */\n mode: InsertMode;\n /** Plain-text summary. Always present. */\n text: string;\n /** Rich HTML summary (heading + list). Always present. */\n html: string;\n /**\n * Branded SVG result-card markup. Empty for mode `'text'`.\n *\n * Kept for back-compat and for callers that need the live, copy-pasteable\n * vector. NOTE: SVG can carry `<script>` and is routinely stripped by\n * rich-text sanitisers, so it is NOT the format to insert into an editor —\n * use {@link InsertPayload.pngDataUri} for that.\n */\n svg: string;\n /**\n * SVG as an `image/svg+xml` data URI for `<img src>`. Empty for `'text'`.\n *\n * Same caveat as {@link InsertPayload.svg}: fine for a preview `<img>`, but a\n * sanitiser-stripped vector once it reaches an editor. Prefer\n * {@link InsertPayload.pngDataUri}.\n */\n imageDataUri: string;\n /**\n * Async thunk that resolves the result-card raster — the format intended for\n * editor insertion. PNG is a flat raster: it carries no script and survives\n * the rich-text sanitiser that strips SVG.\n *\n * Resolves to `{ dataUri, width, height }` where `width`/`height` are the\n * **logical (un-scaled) CSS pixel** dimensions: set them on the inserted\n * `<img width height>` and the supersampled (`>= 2×`) PNG renders crisp with\n * no consumer-side shim. For mode `'text'` resolves to an empty\n * `{ dataUri: '', width: 0, height: 0 }`. Rendered lazily so the synchronous\n * payload stays cheap; `await payload.pngDataUri()` only when you need it.\n *\n * @since 0.43.0 — this return shape changed from a bare `Promise<string>` to\n * `Promise<{ dataUri; width; height }>` (see CHANGELOG).\n */\n pngDataUri: () => Promise<InsertPngResult>;\n}\n\n/** Resolved PNG raster plus its logical (un-scaled) `<img>` dimensions. */\nexport interface InsertPngResult {\n /** `image/png` data URI, or `''` for the text-only mode. */\n dataUri: string;\n /** Logical (CSS px) width to set on the inserted `<img>`. `0` when empty. */\n width: number;\n /** Logical (CSS px) height to set on the inserted `<img>`. `0` when empty. */\n height: number;\n}\n\nexport interface InsertButtonProps {\n /** Structured result used to build every payload representation. */\n card: InsertCardData;\n /**\n * Verb the buttons perform. Defaults to `'insert'`.\n *\n * - `'insert'` — fires `onInsert(payload)` (editor-extension context).\n * - `'copy'` — writes the chosen representation(s) to the clipboard as a\n * multi-format `ClipboardItem` (app-shell context).\n */\n variant?: InsertVariant;\n /**\n * Receives the built payload when a button is pressed.\n *\n * Required for the `insert` variant; optional (and ignored) for `copy`.\n */\n onInsert?: (payload: InsertPayload) => void;\n /** `copy` variant only — fired after a successful clipboard write. */\n onCopy?: (mode: InsertMode) => void;\n /** `copy` variant only — fired if the clipboard write can't proceed. */\n onError?: (error: unknown) => void;\n /** Trigger size. Defaults to `'sm'`. */\n size?: 'sm' | 'md' | 'lg';\n /**\n * Visual intent of the three trigger buttons (text / image / text+image).\n * Mirrors the `Button` `intent` prop and applies to every trigger uniformly\n * so the three stay visually consistent. Defaults to `'primary'`.\n */\n intent?: ButtonProps['intent'];\n}\n\ninterface ThemeColours {\n fg: string;\n muted: string;\n accent: string;\n border: string;\n bg: string;\n font: string;\n /**\n * Concrete colours resolved from arbitrary DS token names, keyed by the token\n * name the caller passed (e.g. `'--success'`). Populated for the gauge arc\n * and the highlight chip; consulted by {@link buildResultCardSvg} via\n * {@link resolveToken}.\n */\n tokens?: Record<string, string>;\n}\n\n/* Fixed probe keys → the resolved colour they sample. */\nconst PROBE_KEYS = ['fg', 'muted', 'accent', 'border', 'bg'] as const;\n\n/** Default DS token names driving the chip and the on-token text colours. */\nconst DEFAULT_HIGHLIGHT_TOKEN = '--primary';\n\nconst SVG_W = 380;\n\n/** Strip a leading `--`/whitespace so a token name is a safe class/probe id. */\nconst tokenName = (token: string): string => token.trim().replace(/^--/, '');\n\n/**\n * Extra `<token>` → resolved-colour probes a given card needs beyond the five\n * fixed keys: the gauge arc colour, the highlight chip fill, and each token's\n * `-foreground` companion (for contrasting on-token text).\n */\nfunction extraTokensForCard(card: InsertCardData): string[] {\n const wanted = new Set<string>();\n if (card.highlight) {\n const fill = card.highlightToken ?? DEFAULT_HIGHLIGHT_TOKEN;\n wanted.add(fill);\n wanted.add(`${fill}-foreground`);\n }\n if (card.gauge) wanted.add(card.gauge.colorToken);\n return [...wanted];\n}\n\nfunction readThemeColours(\n probe: HTMLElement | null,\n extraTokens: string[] = [],\n): ThemeColours {\n const fallback: ThemeColours = {\n fg: 'currentColor',\n muted: 'currentColor',\n accent: 'currentColor',\n border: 'currentColor',\n bg: 'transparent',\n font: 'sans-serif',\n tokens: {},\n };\n if (!probe) return fallback;\n const read = (key: string): string => {\n const el = probe.querySelector<HTMLElement>(`[data-k=\"${key}\"]`);\n if (!el) return 'currentColor';\n return getComputedStyle(el).color || 'currentColor';\n };\n const tokens: Record<string, string> = {};\n for (const token of extraTokens) {\n const el = probe.querySelector<HTMLElement>(\n `[data-token=\"${tokenName(token)}\"]`,\n );\n if (el) {\n const colour = getComputedStyle(el).color;\n if (colour) tokens[token] = colour;\n }\n }\n return {\n fg: read('fg'),\n muted: read('muted'),\n accent: read('accent'),\n border: read('border'),\n bg: read('bg'),\n font: getComputedStyle(probe).fontFamily || 'sans-serif',\n tokens,\n };\n}\n\n/**\n * Internal resolved-colour shape, re-exported for tests that construct a card\n * raster without a live DOM probe. Not part of the public component API.\n */\nexport type ThemeColoursForTest = ThemeColours;\n\n/** Resolve a token NAME to a concrete colour, or a fallback when unsampled. */\nfunction resolveToken(\n c: ThemeColours,\n token: string | undefined,\n fallback: string,\n): string {\n if (!token) return fallback;\n return c.tokens?.[token] ?? fallback;\n}\n\nconst escapeXml = (s: string): string =>\n s\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\"/g, '"');\n\nexport function buildResultText(card: InsertCardData): string {\n const lines = [card.title];\n if (card.highlight) lines.push(card.highlight);\n for (const f of card.fields) lines.push(`• ${f.label}: ${f.value}`);\n return lines.join('\\n');\n}\n\nexport function buildResultHtml(card: InsertCardData): string {\n const items = card.fields\n .map((f) => `<li>${escapeXml(f.label)}: ${escapeXml(f.value)}</li>`)\n .join('');\n const highlight = card.highlight\n ? `<p><strong>${escapeXml(card.highlight)}</strong></p>`\n : '';\n return `<p><strong>${escapeXml(card.title)}</strong></p>${highlight}<ul>${items}</ul>`;\n}\n\n/** Default brand wordmark printed in the footer when none is specified. */\nconst DEFAULT_BRAND = 'AlfaDocs';\n\n/* Layout constants — shared by the height calc and the markup builder. */\nconst PAD = 20;\nconst TITLE_BASELINE = PAD + 18;\nconst CHIP_H = 22;\nconst CHIP_GAP = 10;\nconst ROW_H = 22;\nconst FIELDS_GAP = 16;\nconst FOOTER_GAP = 12;\nconst FOOTER_H = 12;\nconst GAUGE_R = 34; // outer radius\nconst GAUGE_STROKE = 9;\nconst GAUGE_BOX = (GAUGE_R + GAUGE_STROKE) * 2; // gauge group bounding box\n\n/** Resolve the brand line for a render: option override wins over card field. */\nfunction resolveBrand(\n card: InsertCardData,\n override: string | false | undefined,\n): string | false {\n const value = override !== undefined ? override : card.brand;\n if (value === false) return false;\n if (typeof value === 'string') return value;\n return DEFAULT_BRAND;\n}\n\n/** Filled fraction `0`–`1` for a gauge, from `fraction` or `value`/`max`. */\nfunction gaugeFraction(gauge: InsertCardGauge): number {\n if (typeof gauge.fraction === 'number') {\n return Math.min(1, Math.max(0, gauge.fraction));\n }\n const v = parseFloat(gauge.value);\n if (Number.isFinite(v) && typeof gauge.max === 'number' && gauge.max > 0) {\n return Math.min(1, Math.max(0, v / gauge.max));\n }\n return 1;\n}\n\ninterface CardLayout {\n hasChip: boolean;\n chipY: number;\n firstFieldY: number;\n fieldsEndY: number;\n footerY: number;\n height: number;\n}\n\n/** Compute the vertical layout once; reused by height + markup. */\nfunction layoutCard(card: InsertCardData, hasBrand: boolean): CardLayout {\n const hasChip = Boolean(card.highlight);\n const chipY = TITLE_BASELINE + CHIP_GAP; // chip top\n const firstFieldY =\n (hasChip ? chipY + CHIP_H + FIELDS_GAP : TITLE_BASELINE + FIELDS_GAP) +\n ROW_H -\n 6;\n const fieldsEndY = firstFieldY + Math.max(0, card.fields.length - 1) * ROW_H;\n // Keep the body at least as tall as the gauge so the donut never clips.\n const bodyTop = hasChip ? chipY : TITLE_BASELINE;\n const gaugeFloor = card.gauge ? bodyTop + GAUGE_BOX : 0;\n const contentBottom = Math.max(fieldsEndY, gaugeFloor);\n const footerY = hasBrand\n ? contentBottom + FOOTER_GAP + FOOTER_H - 4\n : contentBottom;\n const height = Math.round(footerY + (hasBrand ? FOOTER_GAP : PAD));\n return { hasChip, chipY, firstFieldY, fieldsEndY, footerY, height };\n}\n\n/** Result-card SVG height for a given card — kept in sync with the markup. */\nfunction svgHeight(card: InsertCardData, brand: string | false): number {\n return layoutCard(card, brand !== false).height;\n}\n\n/**\n * Build the gauge group: a track `<circle>` plus a value arc drawn with\n * `stroke-dasharray`/`stroke-dashoffset` (optionally notched into `segments`),\n * a centred value + label, and a `<title>` accessible name. Pure native SVG —\n * never `<foreignObject>`.\n */\nfunction buildGauge(\n gauge: InsertCardGauge,\n c: ThemeColours,\n font: string,\n cx: number,\n cy: number,\n): string {\n const r = GAUGE_R;\n const circumference = 2 * Math.PI * r;\n const frac = gaugeFraction(gauge);\n const arc = resolveToken(c, gauge.colorToken, c.accent);\n const segments =\n typeof gauge.segments === 'number' && gauge.segments > 1\n ? gauge.segments\n : 0;\n // Notch the ring into evenly-spaced segments via a dasharray pattern.\n const gap = segments ? 3 : 0;\n const segLen = segments ? circumference / segments - gap : circumference;\n const trackDash = segments ? `${segLen} ${gap}` : '';\n const valueDash = `${circumference * frac} ${circumference}`;\n const rotate = `transform=\"rotate(-90 ${cx} ${cy})\"`;\n const title = escapeXml(\n gauge.label ? `${gauge.value} — ${gauge.label}` : gauge.value,\n );\n const track = `<circle cx=\"${cx}\" cy=\"${cy}\" r=\"${r}\" fill=\"none\" stroke=\"${c.border}\" stroke-width=\"${GAUGE_STROKE}\"${\n trackDash ? ` stroke-dasharray=\"${trackDash}\"` : ''\n } ${rotate}/>`;\n const valueArc = `<circle cx=\"${cx}\" cy=\"${cy}\" r=\"${r}\" fill=\"none\" stroke=\"${arc}\" stroke-width=\"${GAUGE_STROKE}\" stroke-linecap=\"round\" stroke-dasharray=\"${valueDash}\" ${rotate}/>`;\n const centreValue = `<text x=\"${cx}\" y=\"${cy + 1}\" text-anchor=\"middle\" dominant-baseline=\"middle\" font-family=\"${font}\" font-size=\"16\" font-weight=\"700\" fill=\"${c.fg}\">${escapeXml(\n gauge.value,\n )}</text>`;\n const centreLabel = gauge.label\n ? `<text x=\"${cx}\" y=\"${cy + 15}\" text-anchor=\"middle\" dominant-baseline=\"middle\" font-family=\"${font}\" font-size=\"9\" fill=\"${c.muted}\">${escapeXml(\n gauge.label,\n )}</text>`\n : '';\n return `<g role=\"img\" aria-label=\"${title}\"><title>${title}</title>${track}${valueArc}${centreValue}${centreLabel}</g>`;\n}\n\n/** Build the highlight chip: rounded `<rect>` pill + centred `<text>`. */\nfunction buildChip(\n card: InsertCardData,\n c: ThemeColours,\n font: string,\n y: number,\n): string {\n const text = card.highlight as string;\n const fillToken = card.highlightToken ?? DEFAULT_HIGHLIGHT_TOKEN;\n const fill = resolveToken(c, fillToken, c.accent);\n const textColour = resolveToken(c, `${fillToken}-foreground`, c.bg);\n // Rough monospace-free width estimate: glyph ≈ 7.2px at 12px + 28px padding.\n const chipW = Math.round(text.length * 7.2 + 28);\n const textX = PAD + chipW / 2;\n const textY = y + CHIP_H / 2 + 1;\n return `<rect x=\"${PAD}\" y=\"${y}\" width=\"${chipW}\" height=\"${CHIP_H}\" rx=\"${\n CHIP_H / 2\n }\" fill=\"${fill}\"/><text x=\"${textX}\" y=\"${textY}\" text-anchor=\"middle\" dominant-baseline=\"middle\" font-family=\"${font}\" font-size=\"12\" font-weight=\"600\" fill=\"${textColour}\">${escapeXml(\n text,\n )}</text>`;\n}\n\nexport function buildResultCardSvg(\n card: InsertCardData,\n c: ThemeColours,\n brand: string | false = DEFAULT_BRAND,\n): string {\n const W = SVG_W;\n const L = layoutCard(card, brand !== false);\n const H = L.height;\n const font = escapeXml(c.font);\n\n // Fields flow on the inline-start edge; when a gauge is present it sits on\n // the inline-end edge so the rows don't run under it.\n const fieldsRightEdge = card.gauge ? W - PAD - GAUGE_BOX - 12 : W - PAD;\n const rows = card.fields\n .map((f, i) => {\n const y = L.firstFieldY + i * ROW_H;\n return `<text x=\"${PAD}\" y=\"${y}\" font-family=\"${font}\" font-size=\"13\"><tspan fill=\"${c.muted}\">${escapeXml(\n f.label,\n )}: </tspan><tspan fill=\"${c.fg}\">${escapeXml(f.value)}</tspan></text>`;\n })\n .join('');\n\n const chip = L.hasChip ? buildChip(card, c, font, L.chipY) : '';\n\n const gauge = card.gauge\n ? buildGauge(\n card.gauge,\n c,\n font,\n W - PAD - GAUGE_BOX / 2,\n (L.hasChip ? L.chipY : TITLE_BASELINE) + GAUGE_BOX / 2,\n )\n : '';\n\n const footer =\n brand !== false\n ? `<text x=\"${PAD}\" y=\"${L.footerY}\" font-family=\"${font}\" font-size=\"10\" fill=\"${c.muted}\">${escapeXml(\n brand,\n )}</text>`\n : '';\n\n // `fieldsRightEdge` is reserved for future wrapping; referenced to keep the\n // intent explicit even though rows are single-line today.\n void fieldsRightEdge;\n\n return `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${W}\" height=\"${H}\" viewBox=\"0 0 ${W} ${H}\" role=\"img\" aria-label=\"${escapeXml(\n card.title,\n )}\"><rect x=\"0.5\" y=\"0.5\" width=\"${W - 1}\" height=\"${H - 1}\" rx=\"12\" fill=\"${c.bg}\" stroke=\"${c.border}\"/><text x=\"${PAD}\" y=\"${TITLE_BASELINE}\" font-family=\"${font}\" font-size=\"16\" font-weight=\"700\" fill=\"${c.fg}\">${escapeXml(\n card.title,\n )}</text>${chip}${gauge}${rows}${footer}</svg>`;\n}\n\n/* ------------------------------------------------------------------ */\n/* Clipboard helpers (copy variant) */\n/* ------------------------------------------------------------------ */\n\n/** True when a multi-format clipboard write is reachable in this context. */\nfunction canWriteRichClipboard(): boolean {\n return (\n typeof navigator !== 'undefined' &&\n typeof navigator.clipboard?.write === 'function' &&\n typeof ClipboardItem !== 'undefined'\n );\n}\n\n/**\n * Rasterise the result-card SVG data-URI to a PNG Blob. Clipboards reject\n * SVG as an image, so we load the SVG into an <img>, paint it onto a canvas\n * at the SVG's intrinsic size, and read the canvas back as `image/png`.\n */\nfunction rasteriseSvgToPng(\n imageDataUri: string,\n width: number,\n height: number,\n): Promise<Blob> {\n return new Promise<Blob>((resolve, reject) => {\n const img = new Image();\n img.decoding = 'async';\n img.onload = () => {\n const canvas = document.createElement('canvas');\n canvas.width = width;\n canvas.height = height;\n const ctx = canvas.getContext('2d');\n if (!ctx) {\n reject(new Error('2D canvas context unavailable'));\n return;\n }\n ctx.drawImage(img, 0, 0, width, height);\n canvas.toBlob((blob) => {\n if (blob) resolve(blob);\n else reject(new Error('canvas.toBlob produced no PNG'));\n }, 'image/png');\n };\n img.onerror = () => reject(new Error('SVG failed to decode as an image'));\n img.src = imageDataUri;\n });\n}\n\n/** Options for {@link svgCardToPngDataUri}. */\nexport interface SvgCardToPngOptions {\n /**\n * Resolved theme colours to paint into the card. When omitted, the card\n * renders with `currentColor` / transparent fallbacks (see\n * {@link buildResultCardSvg}) — pass sampled colours for a branded raster.\n */\n colours?: ThemeColours;\n /**\n * Device-pixel scale factor for the raster. `2` yields a retina-sharp PNG.\n * Defaults to `Math.max(2, devicePixelRatio)` so the inserted image is crisp\n * without a consumer-side supersampling shim.\n */\n scale?: number;\n /**\n * Brand wordmark for the footer. Omitted → the card's own `brand` (then the\n * default `'AlfaDocs'`); a string overrides it; `false` removes it.\n */\n brand?: string | false;\n}\n\n/** dpr-aware default raster scale — never below 2× so the PNG stays crisp. */\nfunction defaultRasterScale(): number {\n const dpr =\n typeof window !== 'undefined' && typeof window.devicePixelRatio === 'number'\n ? window.devicePixelRatio\n : 1;\n return Math.max(2, dpr);\n}\n\n/**\n * Render an {@link InsertCardData} result card to an `image/png` data URI.\n *\n * This is the format intended for editor insertion: a flat raster carries no\n * `<script>` and survives the rich-text sanitiser that strips inline SVG. The\n * card is built as SVG, loaded into an `<img>`, painted onto a canvas at the\n * card's intrinsic size (optionally scaled), and read back as `image/png`.\n *\n * Browser-only — relies on `Image`, `<canvas>`, and `canvas.toBlob`. Throws if\n * called in a non-DOM context or if the SVG fails to decode.\n */\nexport async function svgCardToPngDataUri(\n card: InsertCardData,\n opts: SvgCardToPngOptions = {},\n): Promise<string> {\n return (await svgCardToPng(card, opts)).dataUri;\n}\n\n/**\n * Like {@link svgCardToPngDataUri} but also returns the **logical (un-scaled)**\n * card dimensions so consumers can size the inserted `<img width height>` and\n * drop their own supersampling shim. The PNG itself is rasterised at `scale`\n * (default `Math.max(2, devicePixelRatio)`) for crispness.\n */\nexport async function svgCardToPng(\n card: InsertCardData,\n opts: SvgCardToPngOptions = {},\n): Promise<InsertPngResult> {\n const { colours, scale = defaultRasterScale() } = opts;\n const resolved: ThemeColours = colours ?? readThemeColours(null);\n const brand = resolveBrand(card, opts.brand);\n const svg = buildResultCardSvg(card, resolved, brand);\n const imageDataUri = `data:image/svg+xml,${encodeURIComponent(svg)}`;\n const logicalW = SVG_W;\n const logicalH = svgHeight(card, brand);\n const blob = await rasteriseSvgToPng(\n imageDataUri,\n Math.round(logicalW * scale),\n Math.round(logicalH * scale),\n );\n const dataUri = await blobToDataUri(blob);\n return { dataUri, width: logicalW, height: logicalH };\n}\n\n/** Read a Blob back as a `data:` URI string. */\nfunction blobToDataUri(blob: Blob): Promise<string> {\n return new Promise<string>((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => resolve(String(reader.result));\n reader.onerror = () =>\n reject(reader.error ?? new Error('FileReader error'));\n reader.readAsDataURL(blob);\n });\n}\n\n/** Build the per-mode ClipboardItem contents map for a copy. */\nasync function buildClipboardItem(\n mode: InsertMode,\n card: InsertCardData,\n colours: ThemeColours,\n): Promise<ClipboardItem> {\n const text = buildResultText(card);\n const textBlob = new Blob([text], { type: 'text/plain' });\n\n if (mode === 'text') {\n return new ClipboardItem({ 'text/plain': textBlob });\n }\n\n const brand = resolveBrand(card, undefined);\n const svg = buildResultCardSvg(card, colours, brand);\n const imageDataUri = `data:image/svg+xml,${encodeURIComponent(svg)}`;\n const scale = defaultRasterScale();\n const pngBlob = await rasteriseSvgToPng(\n imageDataUri,\n Math.round(SVG_W * scale),\n Math.round(svgHeight(card, brand) * scale),\n );\n\n if (mode === 'image') {\n return new ClipboardItem({ 'image/png': pngBlob, 'text/plain': textBlob });\n }\n\n const htmlBlob = new Blob([buildResultHtml(card)], { type: 'text/html' });\n return new ClipboardItem({\n 'text/html': htmlBlob,\n 'image/png': pngBlob,\n 'text/plain': textBlob,\n });\n}\n\n/* ------------------------------------------------------------------ */\n/* Component */\n/* ------------------------------------------------------------------ */\n\nconst rowVariants = cva(\n 'ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]',\n {\n variants: {\n variant: {\n insert: '',\n copy: '',\n },\n },\n defaultVariants: { variant: 'insert' },\n },\n);\n\nconst MODES: readonly InsertMode[] = ['text', 'image', 'text-image'] as const;\n\nconst MODE_ICON: Record<InsertMode, React.ReactNode> = {\n text: <Type aria-hidden />,\n image: <ImageIcon aria-hidden />,\n 'text-image': <Layers aria-hidden />,\n};\n\n/* i18n leaf keys per variant × mode — bare keys against the `ui` namespace. */\nconst LABEL_KEY: Record<InsertVariant, Record<InsertMode, string>> = {\n insert: {\n text: 'insert.text',\n image: 'insert.image',\n 'text-image': 'insert.textImage',\n },\n copy: {\n text: 'insert.copyText',\n image: 'insert.copyImage',\n 'text-image': 'insert.copyTextImage',\n },\n};\n\nexport const InsertButton = forwardRef<HTMLDivElement, InsertButtonProps>(\n function InsertButton(\n {\n card,\n variant = 'insert',\n onInsert,\n onCopy,\n onError,\n size = 'sm',\n intent = 'primary',\n },\n ref,\n ) {\n const { t } = useTranslation();\n const probeRef = useRef<HTMLSpanElement>(null);\n\n const buildPayload = (mode: InsertMode): InsertPayload => {\n const text = buildResultText(card);\n const html = buildResultHtml(card);\n let svg = '';\n let imageDataUri = '';\n // Sample the live theme once, at click time (including any gauge/chip\n // token colours the card needs), so both the SVG fields and the lazy PNG\n // thunk paint with the same resolved colours.\n const colours =\n mode === 'text'\n ? null\n : readThemeColours(probeRef.current, extraTokensForCard(card));\n if (colours) {\n svg = buildResultCardSvg(card, colours, resolveBrand(card, undefined));\n imageDataUri = `data:image/svg+xml,${encodeURIComponent(svg)}`;\n }\n const pngDataUri = (): Promise<InsertPngResult> =>\n colours\n ? svgCardToPng(card, { colours })\n : Promise.resolve({ dataUri: '', width: 0, height: 0 });\n return { mode, text, html, svg, imageDataUri, pngDataUri };\n };\n\n const handleInsert = (mode: InsertMode): void => {\n onInsert?.(buildPayload(mode));\n };\n\n const handleCopy = (mode: InsertMode): void => {\n if (!canWriteRichClipboard()) {\n onError?.(new Error('Clipboard write unavailable in this context'));\n return;\n }\n const colours = readThemeColours(\n probeRef.current,\n extraTokensForCard(card),\n );\n void (async () => {\n try {\n const item = await buildClipboardItem(mode, card, colours);\n await navigator.clipboard.write([item]);\n onCopy?.(mode);\n } catch (error) {\n onError?.(error);\n }\n })();\n };\n\n const onActivate = variant === 'copy' ? handleCopy : handleInsert;\n\n return (\n <div\n ref={ref}\n data-component=\"insert-result\"\n data-variant={variant}\n className={rowVariants({ variant })}\n >\n {/* Hidden colour probes — sampled at click time so the SVG card uses\n the live theme's resolved colours (no literals in source). The\n fixed five plus any per-card gauge/chip token colours. */}\n <span ref={probeRef} aria-hidden className=\"ds:sr-only\">\n {PROBE_KEYS.map((k) => (\n <span\n key={k}\n data-k={k}\n className={\n k === 'fg'\n ? 'ds:text-foreground'\n : k === 'muted'\n ? 'ds:text-muted-foreground'\n : k === 'accent'\n ? 'ds:text-[color:var(--primary)]'\n : k === 'border'\n ? 'ds:text-[color:var(--border)]'\n : 'ds:text-[color:var(--card)]'\n }\n />\n ))}\n {extraTokensForCard(card).map((token) => (\n <span\n key={token}\n data-token={tokenName(token)}\n className={`ds:text-[color:var(${token})]`}\n />\n ))}\n </span>\n {MODES.map((mode) => (\n <Button\n key={mode}\n type=\"button\"\n intent={intent}\n size={size}\n startIcon={MODE_ICON[mode]}\n aria-label={t(LABEL_KEY[variant][mode])}\n onClick={() => onActivate(mode)}\n >\n {t(LABEL_KEY[variant][mode])}\n </Button>\n ))}\n </div>\n );\n },\n);\n\nInsertButton.displayName = 'InsertButton';\n"],"names":["__iconNode","Layers","createLucideIcon","Type","PROBE_KEYS","DEFAULT_HIGHLIGHT_TOKEN","SVG_W","tokenName","token","extraTokensForCard","card","wanted","fill","readThemeColours","probe","extraTokens","fallback","read","key","el","tokens","colour","resolveToken","c","_a","escapeXml","s","buildResultText","lines","f","buildResultHtml","items","highlight","DEFAULT_BRAND","PAD","TITLE_BASELINE","CHIP_H","CHIP_GAP","ROW_H","FIELDS_GAP","FOOTER_GAP","FOOTER_H","GAUGE_R","GAUGE_STROKE","GAUGE_BOX","resolveBrand","override","value","gaugeFraction","gauge","v","layoutCard","hasBrand","hasChip","chipY","firstFieldY","fieldsEndY","bodyTop","gaugeFloor","contentBottom","footerY","height","svgHeight","brand","buildGauge","font","cx","cy","r","circumference","frac","arc","segments","gap","segLen","trackDash","valueDash","rotate","title","track","valueArc","centreValue","centreLabel","buildChip","y","text","fillToken","textColour","chipW","textX","textY","buildResultCardSvg","W","L","H","rows","i","chip","footer","canWriteRichClipboard","rasteriseSvgToPng","imageDataUri","width","resolve","reject","img","canvas","ctx","blob","defaultRasterScale","dpr","svgCardToPngDataUri","opts","svgCardToPng","colours","scale","resolved","svg","logicalW","logicalH","blobToDataUri","reader","buildClipboardItem","mode","textBlob","pngBlob","htmlBlob","rowVariants","cva","MODES","MODE_ICON","jsx","ImageIcon","LABEL_KEY","InsertButton","forwardRef","variant","onInsert","onCopy","onError","size","intent","ref","t","useTranslation","probeRef","useRef","buildPayload","html","onActivate","item","error","jsxs","k","Button"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB;AAAA,IACE;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH,KAAK;AAAA,IACX;AAAA,EACA;AAAA,EACE;AAAA,IACE;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH,KAAK;AAAA,IACX;AAAA,EACA;AAAA,EACE;AAAA,IACE;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH,KAAK;AAAA,IACX;AAAA,EACA;AACA,GACMC,KAASC,EAAiB,UAAUF,EAAU;AChCpD;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB,CAAC,QAAQ,EAAE,GAAG,YAAY,KAAK,SAAQ,CAAE;AAAA,EACzC,CAAC,QAAQ,EAAE,GAAG,2CAA2C,KAAK,SAAQ,CAAE;AAAA,EACxE,CAAC,QAAQ,EAAE,GAAG,WAAW,KAAK,SAAQ,CAAE;AAC1C,GACMG,KAAOD,EAAiB,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YAAA;AAAA,YARtBA;AAAA,UAAA,CAUR;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AAEAW,GAAa,cAAc;","x_google_ignoreList":[0,1]}
|
package/dist/_chunks/{pregnancy-weight-gain-zZL5Ir2-.js → pregnancy-weight-gain-C5YhfYnL.js}
RENAMED
|
@@ -1,89 +1,94 @@
|
|
|
1
1
|
import { jsxs as s, jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as A, useState as f, useMemo as
|
|
3
|
-
import { c as
|
|
4
|
-
import { useTranslation as
|
|
2
|
+
import { forwardRef as A, useState as f, useMemo as w, useEffect as F } from "react";
|
|
3
|
+
import { c as R } from "./index-D2ZczOXr.js";
|
|
4
|
+
import { useTranslation as k } from "react-i18next";
|
|
5
5
|
import { F as y } from "./form-field-BOm9hK35.js";
|
|
6
6
|
import { N as x } from "./number-input-Dj5L3pXK.js";
|
|
7
|
-
import { C as
|
|
8
|
-
import { B as
|
|
9
|
-
import { I as
|
|
7
|
+
import { C as $ } from "./card-DPmk26CL.js";
|
|
8
|
+
import { B as C } from "./badge-zsf5i5bH.js";
|
|
9
|
+
import { I as H } from "./insert-result-CoC1oo6R.js";
|
|
10
10
|
import { b as M, e as j } from "./bmi-BxD-tFzU.js";
|
|
11
|
-
const
|
|
11
|
+
const L = {
|
|
12
12
|
underweight: { min: 12.5, max: 18 },
|
|
13
13
|
normal: { min: 11.5, max: 16 },
|
|
14
14
|
overweight: { min: 7, max: 11.5 },
|
|
15
15
|
obese: { min: 5, max: 9 }
|
|
16
|
-
},
|
|
16
|
+
}, O = {
|
|
17
17
|
underweight: { min: 0.44, max: 0.58 },
|
|
18
18
|
normal: { min: 0.35, max: 0.5 },
|
|
19
19
|
overweight: { min: 0.23, max: 0.33 },
|
|
20
20
|
obese: { min: 0.17, max: 0.27 }
|
|
21
21
|
}, G = { min: 0.5, max: 2 }, v = 13;
|
|
22
|
-
function
|
|
22
|
+
function U(t, i) {
|
|
23
23
|
if (i <= 0) return { min: 0, max: 0 };
|
|
24
24
|
if (i <= v) {
|
|
25
|
-
const
|
|
25
|
+
const c = i / v;
|
|
26
26
|
return {
|
|
27
|
-
min: G.min *
|
|
28
|
-
max: G.max *
|
|
27
|
+
min: G.min * c,
|
|
28
|
+
max: G.max * c
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
-
const
|
|
31
|
+
const l = Math.min(i, 40) - v, r = O[t];
|
|
32
32
|
return {
|
|
33
|
-
min: G.min + r.min *
|
|
34
|
-
max: G.max + r.max *
|
|
33
|
+
min: G.min + r.min * l,
|
|
34
|
+
max: G.max + r.max * l
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
const i = M(t.prePregnancyBmi),
|
|
37
|
+
function z(t) {
|
|
38
|
+
const i = M(t.prePregnancyBmi), l = L[i], r = U(
|
|
39
39
|
i,
|
|
40
40
|
t.gestationalWeeks
|
|
41
|
-
),
|
|
42
|
-
return { category: i, totalRange:
|
|
41
|
+
), c = t.currentWeightKg - t.prePregnancyWeightKg, W = c < r.min ? "below" : c > r.max ? "above" : "within";
|
|
42
|
+
return { category: i, totalRange: l, recommendedToDate: r, actualGainKg: c, status: W };
|
|
43
43
|
}
|
|
44
|
-
const
|
|
44
|
+
const V = R("ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]", {
|
|
45
45
|
variants: {
|
|
46
46
|
width: { full: "ds:w-full", auto: "ds:inline-flex" }
|
|
47
47
|
},
|
|
48
48
|
defaultVariants: { width: "full" }
|
|
49
|
-
}),
|
|
49
|
+
}), q = {
|
|
50
50
|
below: "warning",
|
|
51
51
|
within: "success",
|
|
52
52
|
above: "warning"
|
|
53
|
-
},
|
|
53
|
+
}, J = {
|
|
54
|
+
below: "--warning",
|
|
55
|
+
within: "--success",
|
|
56
|
+
above: "--warning"
|
|
57
|
+
}, Q = A(
|
|
54
58
|
({
|
|
55
59
|
onResultChange: t,
|
|
56
60
|
onInsert: i,
|
|
57
|
-
insertVariant:
|
|
61
|
+
insertVariant: l = "insert",
|
|
58
62
|
onCopy: r,
|
|
59
|
-
onError:
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
+
onError: c,
|
|
64
|
+
insertBrand: W,
|
|
65
|
+
id: K,
|
|
66
|
+
width: P,
|
|
67
|
+
className: S
|
|
63
68
|
}, B) => {
|
|
64
|
-
const { t: e, i18n:
|
|
69
|
+
const { t: e, i18n: b } = k(), [N, D] = f(null), [m, I] = f(null), [g, E] = f(null), [u, _] = f(null), p = j(m, N), n = w(() => p === null || m === null || g === null || u === null ? null : z({
|
|
65
70
|
prePregnancyBmi: p,
|
|
66
|
-
prePregnancyWeightKg:
|
|
71
|
+
prePregnancyWeightKg: m,
|
|
67
72
|
currentWeightKg: g,
|
|
68
73
|
gestationalWeeks: u
|
|
69
|
-
}), [p,
|
|
70
|
-
() => new Intl.NumberFormat(
|
|
74
|
+
}), [p, m, g, u]), d = w(
|
|
75
|
+
() => new Intl.NumberFormat(b.language, {
|
|
71
76
|
minimumFractionDigits: 1,
|
|
72
77
|
maximumFractionDigits: 1
|
|
73
78
|
}),
|
|
74
|
-
[
|
|
79
|
+
[b.language]
|
|
75
80
|
);
|
|
76
81
|
F(() => {
|
|
77
82
|
t == null || t(n);
|
|
78
83
|
}, [n, t]);
|
|
79
|
-
const
|
|
84
|
+
const o = e("pregnancyWeightGain.units.kg"), h = (T) => `${d.format(T.min)} – ${d.format(T.max)} ${o}`;
|
|
80
85
|
return /* @__PURE__ */ s(
|
|
81
86
|
"div",
|
|
82
87
|
{
|
|
83
88
|
ref: B,
|
|
84
89
|
"data-component": "pregnancy-weight-gain",
|
|
85
|
-
"data-component-id":
|
|
86
|
-
className:
|
|
90
|
+
"data-component-id": K,
|
|
91
|
+
className: V({ width: P, className: S }),
|
|
87
92
|
children: [
|
|
88
93
|
/* @__PURE__ */ s("div", { className: "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:sm:grid-cols-2", children: [
|
|
89
94
|
/* @__PURE__ */ a(
|
|
@@ -96,7 +101,7 @@ const U = _("ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]", {
|
|
|
96
101
|
mode: "decimal",
|
|
97
102
|
min: 0,
|
|
98
103
|
step: 0.5,
|
|
99
|
-
value:
|
|
104
|
+
value: N,
|
|
100
105
|
onChange: D
|
|
101
106
|
}
|
|
102
107
|
)
|
|
@@ -105,15 +110,15 @@ const U = _("ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]", {
|
|
|
105
110
|
/* @__PURE__ */ a(
|
|
106
111
|
y,
|
|
107
112
|
{
|
|
108
|
-
label: `${e("pregnancyWeightGain.prePregnancyWeight")} (${
|
|
113
|
+
label: `${e("pregnancyWeightGain.prePregnancyWeight")} (${o})`,
|
|
109
114
|
children: /* @__PURE__ */ a(
|
|
110
115
|
x,
|
|
111
116
|
{
|
|
112
117
|
mode: "decimal",
|
|
113
118
|
min: 0,
|
|
114
119
|
step: 0.1,
|
|
115
|
-
value:
|
|
116
|
-
onChange:
|
|
120
|
+
value: m,
|
|
121
|
+
onChange: I
|
|
117
122
|
}
|
|
118
123
|
)
|
|
119
124
|
}
|
|
@@ -121,7 +126,7 @@ const U = _("ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]", {
|
|
|
121
126
|
/* @__PURE__ */ a(
|
|
122
127
|
y,
|
|
123
128
|
{
|
|
124
|
-
label: `${e("pregnancyWeightGain.currentWeight")} (${
|
|
129
|
+
label: `${e("pregnancyWeightGain.currentWeight")} (${o})`,
|
|
125
130
|
children: /* @__PURE__ */ a(
|
|
126
131
|
x,
|
|
127
132
|
{
|
|
@@ -141,14 +146,14 @@ const U = _("ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]", {
|
|
|
141
146
|
min: 0,
|
|
142
147
|
max: 42,
|
|
143
148
|
value: u,
|
|
144
|
-
onChange:
|
|
149
|
+
onChange: _
|
|
145
150
|
}
|
|
146
151
|
) })
|
|
147
152
|
] }),
|
|
148
153
|
/* @__PURE__ */ a("p", { className: "ds:sr-only", role: "status", "aria-live": "polite", children: n ? `${e("pregnancyWeightGain.actualGain")}: ${d.format(
|
|
149
154
|
n.actualGainKg
|
|
150
|
-
)} ${
|
|
151
|
-
n ? /* @__PURE__ */ a(
|
|
155
|
+
)} ${o}. ${e(`pregnancyWeightGain.status.${n.status}`)}.` : "" }),
|
|
156
|
+
n ? /* @__PURE__ */ a($, { variant: "elevated", children: /* @__PURE__ */ s($.Body, { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
|
|
152
157
|
/* @__PURE__ */ s("dl", { className: "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:sm:grid-cols-2", children: [
|
|
153
158
|
/* @__PURE__ */ s("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
|
|
154
159
|
/* @__PURE__ */ a("dt", { className: "type-label ds:text-muted-foreground", children: e("pregnancyWeightGain.prePregnancyBmi") }),
|
|
@@ -165,9 +170,9 @@ const U = _("ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]", {
|
|
|
165
170
|
/* @__PURE__ */ s("span", { className: "type-metric ds:text-foreground", children: [
|
|
166
171
|
d.format(n.actualGainKg),
|
|
167
172
|
" ",
|
|
168
|
-
|
|
173
|
+
o
|
|
169
174
|
] }),
|
|
170
|
-
/* @__PURE__ */ a(
|
|
175
|
+
/* @__PURE__ */ a(C, { variant: q[n.status], size: "lg", children: e(`pregnancyWeightGain.status.${n.status}`) })
|
|
171
176
|
] })
|
|
172
177
|
] }),
|
|
173
178
|
/* @__PURE__ */ s("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
|
|
@@ -180,20 +185,24 @@ const U = _("ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]", {
|
|
|
180
185
|
] })
|
|
181
186
|
] }),
|
|
182
187
|
/* @__PURE__ */ a("p", { className: "type-body-sm ds:text-muted-foreground", children: e("pregnancyWeightGain.disclaimer") }),
|
|
183
|
-
|
|
184
|
-
|
|
188
|
+
l === "copy" || i ? /* @__PURE__ */ a(
|
|
189
|
+
H,
|
|
185
190
|
{
|
|
186
191
|
onInsert: i,
|
|
187
|
-
variant:
|
|
192
|
+
variant: l,
|
|
188
193
|
onCopy: r,
|
|
189
|
-
onError:
|
|
194
|
+
onError: c,
|
|
190
195
|
card: {
|
|
191
196
|
title: e("insert.title.weightGain"),
|
|
192
197
|
highlight: e(`pregnancyWeightGain.status.${n.status}`),
|
|
198
|
+
// Chip shares the gain-status semantic token so the
|
|
199
|
+
// inserted PNG chip matches the on-screen status badge.
|
|
200
|
+
highlightToken: J[n.status],
|
|
201
|
+
brand: W,
|
|
193
202
|
fields: [
|
|
194
203
|
{
|
|
195
204
|
label: e("pregnancyWeightGain.actualGain"),
|
|
196
|
-
value: `${d.format(n.actualGainKg)} ${
|
|
205
|
+
value: `${d.format(n.actualGainKg)} ${o}`
|
|
197
206
|
},
|
|
198
207
|
{
|
|
199
208
|
label: e("pregnancyWeightGain.recommendedToDate"),
|
|
@@ -213,12 +222,12 @@ const U = _("ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]", {
|
|
|
213
222
|
);
|
|
214
223
|
}
|
|
215
224
|
);
|
|
216
|
-
|
|
225
|
+
Q.displayName = "PregnancyWeightGain";
|
|
217
226
|
export {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
227
|
+
Q as P,
|
|
228
|
+
O as R,
|
|
229
|
+
L as T,
|
|
230
|
+
z as a,
|
|
231
|
+
U as r
|
|
223
232
|
};
|
|
224
|
-
//# sourceMappingURL=pregnancy-weight-gain-
|
|
233
|
+
//# sourceMappingURL=pregnancy-weight-gain-C5YhfYnL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pregnancy-weight-gain-C5YhfYnL.js","sources":["../../src/components/pregnancy-weight-gain/weight-gain.ts","../../src/components/pregnancy-weight-gain/pregnancy-weight-gain.tsx"],"sourcesContent":["/* ------------------------------------------------------------------ */\n/* Pregnancy weight-gain guidance — pure, framework-free, testable. */\n/* */\n/* Recommended ranges follow the US IOM (2009) guidelines for a */\n/* SINGLETON pregnancy, keyed off pre-pregnancy BMI category. The */\n/* \"to date\" estimate adds a small first-trimester gain (≤13 wk) to a */\n/* per-week rate applied across the 2nd/3rd trimesters. */\n/* */\n/* Guidance only — not a substitute for clinical judgement. */\n/* ------------------------------------------------------------------ */\n\nimport { type BmiCategory, bmiCategory } from '../bmi-calculator/bmi';\n\nexport interface GainBand {\n /** Lower bound, kg. */\n min: number;\n /** Upper bound, kg. */\n max: number;\n}\n\nexport type GainStatus = 'below' | 'within' | 'above';\n\n/** IOM (2009) total recommended gain for a singleton pregnancy, kg. */\nexport const TOTAL_GAIN_BANDS: Record<BmiCategory, GainBand> = {\n underweight: { min: 12.5, max: 18 },\n normal: { min: 11.5, max: 16 },\n overweight: { min: 7, max: 11.5 },\n obese: { min: 5, max: 9 },\n};\n\n/** IOM (2009) mean rate of gain in the 2nd/3rd trimester, kg per week. */\nexport const RATE_BANDS: Record<BmiCategory, GainBand> = {\n underweight: { min: 0.44, max: 0.58 },\n normal: { min: 0.35, max: 0.5 },\n overweight: { min: 0.23, max: 0.33 },\n obese: { min: 0.17, max: 0.27 },\n};\n\n/** First-trimester total gain band, kg (category-independent in IOM). */\nexport const FIRST_TRIMESTER_GAIN: GainBand = { min: 0.5, max: 2 };\n/** Completed weeks counted as the first trimester for gain purposes. */\nexport const FIRST_TRIMESTER_WEEKS = 13;\n\nexport interface WeightGainInput {\n /** Pre-pregnancy BMI (kg/m²) — drives the category. */\n prePregnancyBmi: number;\n /** Pre-pregnancy weight, kg. */\n prePregnancyWeightKg: number;\n /** Current weight, kg. */\n currentWeightKg: number;\n /** Completed gestational weeks. */\n gestationalWeeks: number;\n}\n\nexport interface WeightGainResult {\n category: BmiCategory;\n /** Recommended TOTAL gain across the whole pregnancy. */\n totalRange: GainBand;\n /** Recommended gain accumulated by the current gestational week. */\n recommendedToDate: GainBand;\n /** Actual gain so far (current − pre-pregnancy), kg. */\n actualGainKg: number;\n /** Where the actual gain sits against the to-date recommendation. */\n status: GainStatus;\n}\n\n/** Recommended cumulative gain by a given gestational week. */\nexport function recommendedGainToDate(\n category: BmiCategory,\n weeks: number,\n): GainBand {\n if (weeks <= 0) return { min: 0, max: 0 };\n if (weeks <= FIRST_TRIMESTER_WEEKS) {\n const frac = weeks / FIRST_TRIMESTER_WEEKS;\n return {\n min: FIRST_TRIMESTER_GAIN.min * frac,\n max: FIRST_TRIMESTER_GAIN.max * frac,\n };\n }\n const extraWeeks = Math.min(weeks, 40) - FIRST_TRIMESTER_WEEKS;\n const rate = RATE_BANDS[category];\n return {\n min: FIRST_TRIMESTER_GAIN.min + rate.min * extraWeeks,\n max: FIRST_TRIMESTER_GAIN.max + rate.max * extraWeeks,\n };\n}\n\nexport function assessWeightGain(input: WeightGainInput): WeightGainResult {\n const category = bmiCategory(input.prePregnancyBmi);\n const totalRange = TOTAL_GAIN_BANDS[category];\n const recommendedToDate = recommendedGainToDate(\n category,\n input.gestationalWeeks,\n );\n const actualGainKg = input.currentWeightKg - input.prePregnancyWeightKg;\n const status: GainStatus =\n actualGainKg < recommendedToDate.min\n ? 'below'\n : actualGainKg > recommendedToDate.max\n ? 'above'\n : 'within';\n return { category, totalRange, recommendedToDate, actualGainKg, status };\n}\n","/* ------------------------------------------------------------------ */\n/* PregnancyWeightGain — actual vs IOM-recommended gestational weight */\n/* gain, keyed off pre-pregnancy BMI. */\n/* */\n/* Composes the BMI maths from bmi-calculator and the IOM bands in */\n/* `./weight-gain` (both pure, separately tested). Metric only. */\n/* ------------------------------------------------------------------ */\n\nimport { forwardRef, useEffect, useMemo, useState } from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\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 { computeBmi } from '../bmi-calculator/bmi';\nimport {\n type WeightGainResult,\n type GainStatus,\n type GainBand,\n assessWeightGain,\n} from './weight-gain';\n\nconst rootVariants = cva('ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]', {\n variants: {\n width: { full: 'ds:w-full', auto: 'ds:inline-flex' },\n },\n defaultVariants: { width: 'full' },\n});\n\nconst STATUS_BADGE: Record<GainStatus, 'info' | 'success' | 'warning'> = {\n below: 'warning',\n within: 'success',\n above: 'warning',\n};\n\n/**\n * DS token NAME backing each gain-status chip — the solid-fill companion of the\n * on-screen `STATUS_BADGE` variant (Badge `warning` fills `--warning`,\n * `success` fills `--success`). Passed as the card's `highlightToken` so the\n * inserted PNG chip matches the on-screen status badge; `InsertButton` resolves\n * the name to a concrete colour at raster time.\n */\nconst STATUS_HIGHLIGHT_TOKEN: Record<GainStatus, string> = {\n below: '--warning',\n within: '--success',\n above: '--warning',\n};\n\nexport interface PregnancyWeightGainProps extends VariantProps<\n typeof rootVariants\n> {\n /** Fires whenever a result can be computed (and `null` when it can't). */\n onResultChange?: (result: WeightGainResult | null) => void;\n /** When provided, shows the result-action buttons that emit / copy the result. */\n onInsert?: (payload: InsertPayload) => void;\n /**\n * Verb the result-action buttons perform. Defaults to `'insert'` (editor\n * extension). Pass `'copy'` from an app shell to copy the result to the\n * clipboard instead.\n */\n insertVariant?: InsertVariant;\n /** `copy` variant only — fired after a successful clipboard write. */\n onCopy?: (mode: InsertMode) => void;\n /** `copy` variant only — fired if the clipboard write can't proceed. */\n onError?: (error: unknown) => void;\n /**\n * Brand wordmark printed in the inserted/copied result-card footer.\n * Omitted → the default `'AlfaDocs'` wordmark; a string overrides it;\n * `false` removes the brand line.\n */\n insertBrand?: string | false;\n /** Opaque instance id, emitted as `data-component-id`. */\n id?: string;\n /** Extra class names on the wrapper. */\n className?: string;\n}\n\nexport const PregnancyWeightGain = forwardRef<\n HTMLDivElement,\n PregnancyWeightGainProps\n>(\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 [heightCm, setHeightCm] = useState<number | null>(null);\n const [prePregnancyKg, setPrePregnancyKg] = useState<number | null>(null);\n const [currentKg, setCurrentKg] = useState<number | null>(null);\n const [weeks, setWeeks] = useState<number | null>(null);\n\n const prePregnancyBmi = computeBmi(prePregnancyKg, heightCm);\n\n const result = useMemo<WeightGainResult | null>(() => {\n if (\n prePregnancyBmi === null ||\n prePregnancyKg === null ||\n currentKg === null ||\n weeks === null\n ) {\n return null;\n }\n return assessWeightGain({\n prePregnancyBmi,\n prePregnancyWeightKg: prePregnancyKg,\n currentWeightKg: currentKg,\n gestationalWeeks: weeks,\n });\n }, [prePregnancyBmi, prePregnancyKg, currentKg, weeks]);\n\n const kg = useMemo(\n () =>\n new Intl.NumberFormat(i18n.language, {\n minimumFractionDigits: 1,\n maximumFractionDigits: 1,\n }),\n [i18n.language],\n );\n\n useEffect(() => {\n onResultChange?.(result);\n }, [result, onResultChange]);\n\n const unit = t('pregnancyWeightGain.units.kg');\n const band = (b: GainBand): string =>\n `${kg.format(b.min)} – ${kg.format(b.max)} ${unit}`;\n\n return (\n <div\n ref={ref}\n data-component=\"pregnancy-weight-gain\"\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 <FormField\n label={`${t('pregnancyWeightGain.height')} (${t('pregnancyWeightGain.units.cm')})`}\n >\n <NumberInput\n mode=\"decimal\"\n min={0}\n step={0.5}\n value={heightCm}\n onChange={setHeightCm}\n />\n </FormField>\n <FormField\n label={`${t('pregnancyWeightGain.prePregnancyWeight')} (${unit})`}\n >\n <NumberInput\n mode=\"decimal\"\n min={0}\n step={0.1}\n value={prePregnancyKg}\n onChange={setPrePregnancyKg}\n />\n </FormField>\n <FormField\n label={`${t('pregnancyWeightGain.currentWeight')} (${unit})`}\n >\n <NumberInput\n mode=\"decimal\"\n min={0}\n step={0.1}\n value={currentKg}\n onChange={setCurrentKg}\n />\n </FormField>\n <FormField label={t('pregnancyWeightGain.gestationalWeeks')}>\n <NumberInput\n mode=\"integer\"\n min={0}\n max={42}\n value={weeks}\n onChange={setWeeks}\n />\n </FormField>\n </div>\n\n <p className=\"ds:sr-only\" role=\"status\" aria-live=\"polite\">\n {result\n ? `${t('pregnancyWeightGain.actualGain')}: ${kg.format(\n result.actualGainKg,\n )} ${unit}. ${t(`pregnancyWeightGain.status.${result.status}`)}.`\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-2\">\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]\">\n <dt className=\"type-label ds:text-muted-foreground\">\n {t('pregnancyWeightGain.prePregnancyBmi')}\n </dt>\n <dd className=\"type-body ds:text-foreground\">\n {kg.format(prePregnancyBmi ?? 0)} ·{' '}\n {t(`pregnancyWeightGain.category.${result.category}`)}\n </dd>\n </div>\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('pregnancyWeightGain.actualGain')}\n </dt>\n <dd className=\"ds:flex ds:flex-col ds:items-start ds:gap-[var(--spacing-xs)]\">\n <span className=\"type-metric ds:text-foreground\">\n {kg.format(result.actualGainKg)} {unit}\n </span>\n <Badge variant={STATUS_BADGE[result.status]} size=\"lg\">\n {t(`pregnancyWeightGain.status.${result.status}`)}\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('pregnancyWeightGain.recommendedToDate')}\n </dt>\n <dd className=\"type-body ds:text-foreground\">\n {band(result.recommendedToDate)}\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('pregnancyWeightGain.recommendedTotal')}\n </dt>\n <dd className=\"type-body ds:text-foreground\">\n {band(result.totalRange)}\n </dd>\n </div>\n </dl>\n <p className=\"type-body-sm ds:text-muted-foreground\">\n {t('pregnancyWeightGain.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.weightGain'),\n highlight: t(`pregnancyWeightGain.status.${result.status}`),\n // Chip shares the gain-status semantic token so the\n // inserted PNG chip matches the on-screen status badge.\n highlightToken: STATUS_HIGHLIGHT_TOKEN[result.status],\n brand: insertBrand,\n fields: [\n {\n label: t('pregnancyWeightGain.actualGain'),\n value: `${kg.format(result.actualGainKg)} ${unit}`,\n },\n {\n label: t('pregnancyWeightGain.recommendedToDate'),\n value: band(result.recommendedToDate),\n },\n {\n label: t('pregnancyWeightGain.recommendedTotal'),\n value: band(result.totalRange),\n },\n ],\n }}\n />\n ) : null}\n </Card.Body>\n </Card>\n ) : (\n <p className=\"type-body ds:text-muted-foreground\">\n {t('pregnancyWeightGain.empty')}\n </p>\n )}\n </div>\n );\n },\n);\n\nPregnancyWeightGain.displayName = 'PregnancyWeightGain';\n"],"names":["TOTAL_GAIN_BANDS","RATE_BANDS","FIRST_TRIMESTER_GAIN","FIRST_TRIMESTER_WEEKS","recommendedGainToDate","category","weeks","frac","extraWeeks","rate","assessWeightGain","input","bmiCategory","totalRange","recommendedToDate","actualGainKg","status","rootVariants","cva","STATUS_BADGE","STATUS_HIGHLIGHT_TOKEN","PregnancyWeightGain","forwardRef","onResultChange","onInsert","insertVariant","onCopy","onError","insertBrand","id","width","className","ref","t","i18n","useTranslation","heightCm","setHeightCm","useState","prePregnancyKg","setPrePregnancyKg","currentKg","setCurrentKg","setWeeks","prePregnancyBmi","computeBmi","result","useMemo","kg","useEffect","unit","band","b","jsxs","jsx","FormField","NumberInput","Card","Badge","InsertButton"],"mappings":";;;;;;;;;;AAuBO,MAAMA,IAAkD;AAAA,EAC7D,aAAa,EAAE,KAAK,MAAM,KAAK,GAAA;AAAA,EAC/B,QAAQ,EAAE,KAAK,MAAM,KAAK,GAAA;AAAA,EAC1B,YAAY,EAAE,KAAK,GAAG,KAAK,KAAA;AAAA,EAC3B,OAAO,EAAE,KAAK,GAAG,KAAK,EAAA;AACxB,GAGaC,IAA4C;AAAA,EACvD,aAAa,EAAE,KAAK,MAAM,KAAK,KAAA;AAAA,EAC/B,QAAQ,EAAE,KAAK,MAAM,KAAK,IAAA;AAAA,EAC1B,YAAY,EAAE,KAAK,MAAM,KAAK,KAAA;AAAA,EAC9B,OAAO,EAAE,KAAK,MAAM,KAAK,KAAA;AAC3B,GAGaC,IAAiC,EAAE,KAAK,KAAK,KAAK,EAAA,GAElDC,IAAwB;AA0B9B,SAASC,EACdC,GACAC,GACU;AACV,MAAIA,KAAS,EAAG,QAAO,EAAE,KAAK,GAAG,KAAK,EAAA;AACtC,MAAIA,KAASH,GAAuB;AAClC,UAAMI,IAAOD,IAAQH;AACrB,WAAO;AAAA,MACL,KAAKD,EAAqB,MAAMK;AAAA,MAChC,KAAKL,EAAqB,MAAMK;AAAA,IAAA;AAAA,EAEpC;AACA,QAAMC,IAAa,KAAK,IAAIF,GAAO,EAAE,IAAIH,GACnCM,IAAOR,EAAWI,CAAQ;AAChC,SAAO;AAAA,IACL,KAAKH,EAAqB,MAAMO,EAAK,MAAMD;AAAA,IAC3C,KAAKN,EAAqB,MAAMO,EAAK,MAAMD;AAAA,EAAA;AAE/C;AAEO,SAASE,EAAiBC,GAA0C;AACzE,QAAMN,IAAWO,EAAYD,EAAM,eAAe,GAC5CE,IAAab,EAAiBK,CAAQ,GACtCS,IAAoBV;AAAA,IACxBC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