import e from "./UiWidget.js";
import { Fragment as t } from "react";
import { jsx as n } from "react/jsx-runtime";
//#region src/components/ui-widgets/UiActions.tsx
var r = ({ actions: r, availableTransitions: i, currentPlace: a, disabled: o, onSubmit: s, isLoading: c }) => /* @__PURE__ */ n("div", {
	className: "flex w-full flex-col items-end gap-4",
	children: r.map((r, l) => {
		let { enabledWhen: u } = r, d = r.options?.transition, f = o || u !== void 0 && (!a || !u.includes(a)) || d !== void 0 && !i.includes(d);
		return /* @__PURE__ */ n(t, { children: /* @__PURE__ */ n(e, {
			config: r,
			onSubmit: (e) => {
				if (console.log("[UiActions] handleSubmit called", {
					transition: d,
					data: e,
					isDisabled: f,
					currentPlace: a,
					availableTransitions: i
				}), !d) {
					console.error(`[UiActions] Widget "${r.widget}" has no transition configured.`);
					return;
				}
				s(d, e);
			},
			disabled: f,
			isLoading: c
		}) }, `ui-widget-${l}-${d ?? r.widget}`);
	})
});
//#endregion
export { r as default };
