import { Button } from "../../../../components/ui/button.js";
import Form_default from "../../../../components/dynamic-form/Form.js";
import HeaderSection_default from "./HeaderSection.js";
import { c } from "react/compiler-runtime";
import { jsx, jsxs } from "react/jsx-runtime";
import { Loader2, Zap } from "lucide-react";
import { useForm } from "react-hook-form";
var ArgumentsView_default = (u) => {
	let d = c(27), { config: f, hasArguments: p, isLoading: m, onBack: h, onSubmit: g } = u, _;
	d[0] === Symbol.for("react.memo_cache_sentinel") ? (_ = {
		defaultValues: {},
		mode: "onChange"
	}, d[0] = _) : _ = d[0];
	let v = useForm(_), y;
	d[1] === g ? y = d[2] : (y = (r) => (l) => {
		console.log("handleSubmit"), g(r, l);
	}, d[1] = g, d[2] = y);
	let b = y, x;
	d[3] !== v || d[4] !== b ? (x = (r) => {
		v.handleSubmit(b(r))();
	}, d[3] = v, d[4] = b, d[5] = x) : x = d[5];
	let S = x, C;
	d[6] === Symbol.for("react.memo_cache_sentinel") ? (C = /* @__PURE__ */ jsx(Zap, { className: "h-5 w-5" }), d[6] = C) : C = d[6];
	let w = f?.title || f?.blockName || "", T = f?.description, E;
	d[7] !== h || d[8] !== w || d[9] !== T ? (E = /* @__PURE__ */ jsx(HeaderSection_default, {
		icon: C,
		title: w,
		description: T,
		showBack: !0,
		onBack: h
	}), d[7] = h, d[8] = w, d[9] = T, d[10] = E) : E = d[10];
	let D;
	d[11] !== f || d[12] !== v || d[13] !== p ? (D = /* @__PURE__ */ jsx("div", {
		className: "border-border mb-6 max-h-100 overflow-y-auto rounded-md border p-4",
		children: p && f && f.schema ? /* @__PURE__ */ jsx(Form_default, {
			form: v,
			schema: f.schema,
			ui: f.ui,
			disabled: !1,
			viewOnly: !1
		}) : /* @__PURE__ */ jsx("div", {
			className: "flex items-center justify-center py-12",
			children: /* @__PURE__ */ jsx("p", {
				className: "text-muted-foreground",
				children: "No additional configuration required."
			})
		})
	}), d[11] = f, d[12] = v, d[13] = p, d[14] = D) : D = d[14];
	let O;
	d[15] === S ? O = d[16] : (O = () => S(""), d[15] = S, d[16] = O);
	let k;
	d[17] === m ? k = d[18] : (k = m && /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" }), d[17] = m, d[18] = k);
	let A;
	d[19] !== m || d[20] !== k || d[21] !== O ? (A = /* @__PURE__ */ jsx("div", {
		className: "flex justify-end",
		children: /* @__PURE__ */ jsxs(Button, {
			variant: "default",
			disabled: m,
			onClick: O,
			size: "lg",
			className: "font-medium",
			children: [k, "Run Now"]
		})
	}), d[19] = m, d[20] = k, d[21] = O, d[22] = A) : A = d[22];
	let j;
	return d[23] !== A || d[24] !== E || d[25] !== D ? (j = /* @__PURE__ */ jsxs("div", {
		className: "flex flex-col",
		children: [
			E,
			D,
			A
		]
	}), d[23] = A, d[24] = E, d[25] = D, d[26] = j) : j = d[26], j;
};
export { ArgumentsView_default as default };
