import { createChangeEvent } from "./utils/formEvents.mjs";
import { c } from "react-compiler-runtime";
import React from "react";
import { UdpFluentSwitch } from "udp-react-stencil-component-library";
//#region src/UI/fluent-web-components/UdpSwitch.tsx
const UdpSwitch = (t0) => {
	const $ = c(18);
	let checked;
	let error;
	let helperText;
	let hint;
	let name;
	let onChange;
	let props;
	if ($[0] !== t0) {
		({onChange, name, checked, error, helperText, hint, ...props} = t0);
		$[0] = t0;
		$[1] = checked;
		$[2] = error;
		$[3] = helperText;
		$[4] = hint;
		$[5] = name;
		$[6] = onChange;
		$[7] = props;
	} else {
		checked = $[1];
		error = $[2];
		helperText = $[3];
		hint = $[4];
		name = $[5];
		onChange = $[6];
		props = $[7];
	}
	let t1;
	if ($[8] !== name || $[9] !== onChange) {
		t1 = (e) => {
			onChange?.(createChangeEvent(e.detail, name, "switch"));
		};
		$[8] = name;
		$[9] = onChange;
		$[10] = t1;
	} else t1 = $[10];
	const handleValueChanged = t1;
	const hintStr = typeof hint === "string" ? hint : void 0;
	let normalizedError;
	let normalizedHint;
	if (typeof error === "string") {
		normalizedError = error;
		normalizedHint = hintStr;
	} else if (typeof error === "boolean") {
		normalizedError = error ? helperText || "" : void 0;
		normalizedHint = !error ? helperText || hintStr : hintStr;
	} else normalizedHint = hintStr ?? helperText;
	let t2;
	if ($[11] !== checked || $[12] !== handleValueChanged || $[13] !== name || $[14] !== normalizedError || $[15] !== normalizedHint || $[16] !== props) {
		t2 = /* @__PURE__ */ React.createElement(UdpFluentSwitch, {
			...props,
			name,
			checked,
			error: normalizedError,
			hint: normalizedHint,
			onValueChanged: handleValueChanged
		});
		$[11] = checked;
		$[12] = handleValueChanged;
		$[13] = name;
		$[14] = normalizedError;
		$[15] = normalizedHint;
		$[16] = props;
		$[17] = t2;
	} else t2 = $[17];
	return t2;
};
//#endregion
export { UdpSwitch };

//# sourceMappingURL=UdpSwitch.mjs.map