import React from "react"; import type { ClaimDetail } from "@/types"; type RawSegmentsPanelProps = { rawSegments: ClaimDetail["rawSegments"]; }; /** * Format a single segment by joining its elements with `*` (the X12 * element separator). Trailing/leading whitespace inside individual * elements is preserved — these strings come straight off the parser * and any trimming would change the visible byte-for-byte content. */ function formatSegment(elements: string[]): string { return elements.join("*"); } /** * Raw-segments debug section of the claim detail drawer (SP4). * * Renders the exact X12 segment strings the parser saw, collapsed by * default behind a native
/ so the user can opt in * to a wall of monospace when they're debugging. Element separator is * `*` and segment terminator is implicit at the end of each line — * matches what the parser produces. This is a read-only diagnostic; * the plan keeps it intentionally simple (no copy button for v1). */ export function RawSegmentsPanel({ rawSegments }: RawSegmentsPanelProps) { return (

Raw Segments ({rawSegments.length})

{rawSegments.length === 0 ? `Show raw segments` : `Show ${rawSegments.length} raw segment${rawSegments.length === 1 ? "" : "s"}`} {rawSegments.length === 0 ? (

No segments

) : (
            {rawSegments.map((segment, i) => (
              
                {i > 0 ? "\n" : null}
                {formatSegment(segment)}
              
            ))}
          
)}
); }