import { jsxs, jsx } from "react/jsx-runtime";
import { forwardRef, useMemo } from "react";
/* empty css                   */
import Switch$1 from "../../node_modules/@mui/material/Switch/Switch.js";
const Switch = forwardRef(
  ({
    value = false,
    leftLabel = "",
    rightLabel = "",
    disabled = false,
    onChange,
    className = "",
    "aria-label": ariaLabel,
    "aria-labelledby": ariaLabelledBy,
    ...args
  }, ref) => {
    const switchClassName = useMemo(() => {
      let retVal = `ia-styles ia-switch ${className}`;
      if (disabled) {
        retVal += " ia-switch-disabled";
      }
      if (!value) {
        retVal += " ia-switch-off";
      }
      return retVal.trim();
    }, [disabled, value, className]);
    const labelClassName = useMemo(() => {
      let retVal = "ia-styles ia-switch-label";
      if (disabled) {
        retVal += " ia-switch-disabled";
      }
      return retVal;
    }, [disabled]);
    const leftLabelStyle = {
      color: value && !disabled ? "#1f2b4d" : void 0
    };
    const rightLabelStyle = {
      color: value && !disabled ? "#1F2B4D" : void 0
    };
    const computedAriaLabel = ariaLabel ?? (leftLabel || rightLabel ? `${leftLabel} ${rightLabel}`.trim() : void 0);
    return /* @__PURE__ */ jsxs("div", { className: "ia-styles ia-switch-container", children: [
      leftLabel ? /* @__PURE__ */ jsx("span", { className: labelClassName, style: leftLabelStyle, children: leftLabel }) : null,
      /* @__PURE__ */ jsx("div", { style: { display: "flex", alignItems: "center" }, children: /* @__PURE__ */ jsx(
        Switch$1,
        {
          ref,
          disableRipple: true,
          checked: value,
          className: switchClassName,
          disabled,
          inputProps: {
            "aria-label": computedAriaLabel,
            "aria-labelledby": ariaLabelledBy
          },
          onChange,
          ...args
        }
      ) }),
      rightLabel ? /* @__PURE__ */ jsx("span", { className: labelClassName, style: rightLabelStyle, children: rightLabel }) : null
    ] });
  }
);
Switch.displayName = "Switch";
export {
  Switch
};
