import { useEffect, useMemo, useState } from "react";
import * as Option from "effect/Option";
import * as Schema from "effect/Schema";
import { safeSchemaValueLabel } from "./schema-explorer";
import { Input } from "./input";
import { Switch } from "./switch";
import { NativeSelect, NativeSelectOption } from "./native-select";
import { Label } from "./label";
import { Textarea } from "./textarea";
import { Button } from "./button";
import { Badge } from "./badge";
import { cn } from "../lib/utils";
// ---------------------------------------------------------------------------
// JsonSchemaForm — a dynamic form built from a tool's input JSON Schema. The
// single source of truth is the parent's args object (controlled `value`); this
// renders a pure view and emits a fully-rebuilt object on every edit. Anything
// the renderer can't express as a typed control falls back to a raw-JSON subtree
// editor, so no input shape is ever un-editable.
//
// Constraints honored: only wrapped design-system components (never raw
// /