/** * traceToCsv — convert a TraceSnapshot to RFC 4180-compliant CSV. * * WHY here rather than in apps/sim: * This is a pure data transformation with no DOM/React/Next.js dependencies. * Co-locating it in simcore lets tests run in Node without a browser harness, * and keeps the CSV format close to the data structure that produced it. * * WHY RFC 4180 quoting: * Channel labels are user-supplied (net IDs or human renames). A user may * name a net "V(in,out)" which contains a comma — RFC 4180 double-quote * wrapping handles that without inventing a custom escaping scheme. * * WHY String(v) instead of toFixed: * Full-precision round-trip fidelity. The simulation engine works at * IEEE 754 double precision; rounding to e.g. 6 decimal places would * silently destroy information for values like 1.234567890123456e-5. * The consumer (a spreadsheet or script) can always round; we cannot * recover lost precision after the fact. */ import type { TraceSnapshot } from "../sim/trace-recorder.js"; /** * Convert a TraceSnapshot to a CSV string. * * Header row: time_s, then one column per channel (using label if provided, * otherwise the channel key). * Data rows: one per sample, full IEEE 754 numeric precision. * * An empty snapshot (no samples) returns a header-only string (one line + LF). * A snapshot with no channels returns just "time_s\r\n" rows — degenerate but * valid so callers do not need to special-case it. * * @param snapshot The captured trace data from TraceRecorder.snapshot(). * @param labels Optional channel-key → display-label map for the header. * Keys not found in this map fall back to the channel key. */ export declare function traceToCsv(snapshot: TraceSnapshot, labels?: Record): string;