/**
* # react/HonestChart — human candlesticks over the Frame `json` Rendering (ADR-0052 §3)
*
* A standard human candlestick chart whose ONLY input is the typed Frame `json` Rendering
* ({@link ../frame/render-json.ts FrameJson}) — there is NO generic-OHLC entry point, by doctrine: a
* chart that cannot prove it invented nothing defeats the honest-chart claim. Three honesty rules,
* all enforced here on the reading side:
*
* - **UNKNOWN renders as a GAP.** A tape bucket with any UNKNOWN of {open,high,low,close} draws NO
* candle — a dashed time-axis tick marks that the bucket exists but its price is unknown. Never an
* interpolated candle, never a zero, never a neighbour carried forward.
* - **MODEL Fields are BADGED with their receipt.** The kernel's predictor/regime claims are `MODEL`
* Fields; each renders a badge whose `
` exposes the receipt (source + model version +
* confidence) on inspection. Provenance is never hidden.
* - **Fail-closed on a degraded MODEL Field.** A claim whose `MODEL` Field arrives WITHOUT its
* receipt is REFUSED ({@link assertModelReceipt}) — the chart throws rather than draw an
* unattributable model value.
*
* Rendered as pure SVG (no chart library, no runtime dep beyond the optional `react` peer). PURE +
* deterministic: the same {@link FrameJson} yields byte-identical markup (no wall clock, no RNG) —
* `React hosts Renderings; it never produces them`.
*/
import { createElement, type ReactElement } from "react";
import type { FrameJson, MarketJson, TapeRowJson } from "../frame/render-json.ts";
import { assertModelReceipt, isUnknown, valueOr } from "./frame-fields.ts";
// ── Fixed, deterministic layout geometry ─────────────────────────────────────
const M = { top: 40, right: 16, bottom: 28, left: 48 } as const;
const UP = "#16a34a";
const DOWN = "#dc2626";
/** 2-decimal fixed string — stable SVG coordinates (no float noise across platforms/runs). */
function r2(n: number): string {
return n.toFixed(2);
}
export interface HonestChartProps {
/** The typed Frame `json` Rendering — the ONLY data source (no generic-OHLC props, ADR-0052 §3). */
readonly frame: FrameJson;
/** Presentation only (not data): the SVG canvas size. Defaults 640×320. */
readonly width?: number;
readonly height?: number;
/** Presentation only: a class on the root `