import { cn } from "../../lib/utils.js";
import { ArrayController } from "./ArrayController.js";
import { FormElementHeader } from "./FormElementHeader.js";
import { InputController } from "./InputController.js";
import { ObjectController } from "./ObjectController.js";
import { c } from "react/compiler-runtime";
import React from "react";
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
const FormElement = (d) => {
	let f = c(14), { schema: p, disabled: m } = d, h = p, g = !!h?.hidden, _ = h.type, v;
	f[0] === _ ? v = f[1] : (v = Array.isArray(_) ? _.filter(_temp).shift() : _, f[0] = _, f[1] = v);
	let y = v, b;
	f[2] !== m || f[3] !== d || f[4] !== y || f[5] !== h.title ? (b = () => {
		switch (y) {
			case "object": return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(FormElementHeader, {
				title: h.title,
				disabled: m
			}), /* @__PURE__ */ jsx(ObjectController, { ...d })] });
			case "array": return /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx("div", {
				className: "mt-3",
				children: /* @__PURE__ */ jsx(ArrayController, { ...d })
			}) });
			default: return /* @__PURE__ */ jsx(InputController, {
				...d,
				name: d.name ?? ""
			});
		}
	}, f[2] = m, f[3] = d, f[4] = y, f[5] = h.title, f[6] = b) : b = f[6];
	let x = b, S = g ? "hidden" : "block", C;
	f[7] === S ? C = f[8] : (C = cn(S), f[7] = S, f[8] = C);
	let w;
	f[9] === x ? w = f[10] : (w = x(), f[9] = x, f[10] = w);
	let T;
	return f[11] !== C || f[12] !== w ? (T = /* @__PURE__ */ jsx("div", {
		className: C,
		children: w
	}), f[11] = C, f[12] = w, f[13] = T) : T = f[13], T;
};
function _temp(t) {
	return t !== "null";
}
export { FormElement };
