;
{
  try {
    let e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
    n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "29db0988-5842-4adb-ab31-61314cb0554b", e._sentryDebugIdIdentifier = "sentry-dbid-29db0988-5842-4adb-ab31-61314cb0554b");
  } catch (e) {
  }
}
;
import { jsxs, Fragment, jsx } from "preact/jsx-runtime";
import cx from "classnames";
import { p as useAnalyticsContext } from "./StoreProvider-CqQrndhS.js";
function Checkbox({
  id,
  name,
  value,
  className,
  label,
  isInvalid,
  onChange,
  helper,
  checked,
  readonly,
  disabled,
  enableTracking = false,
  "aria-required": ariaRequired,
  "aria-invalid": ariaInvalid,
  "aria-describedby": ariaDescribedBy
}) {
  const userEvents = useAnalyticsContext();
  const handleChange = (newValue) => {
    if (enableTracking) {
      userEvents.addFieldEvent("Interacted with form field", {
        actionType: "input",
        field: name,
        returnValue: String(newValue)
      });
    }
    onChange(newValue);
  };
  const helperId = `${id}-helper`;
  const ariaDescribedById = `${helper ? helperId : ""} ${ariaDescribedBy ?? ""}`.trim();
  return /* @__PURE__ */ jsxs(Fragment, { children: [
    /* @__PURE__ */ jsx(
      "input",
      {
        id,
        name,
        value,
        "aria-describedby": ariaDescribedById,
        "aria-invalid": ariaInvalid || isInvalid,
        "aria-required": ariaRequired,
        readOnly: readonly,
        disabled,
        checked,
        className: cx([
          "adyen-kyc-checkbox__input",
          [className],
          { "adyen-kyc-checkbox__input--invalid": isInvalid }
        ]),
        type: "checkbox",
        onClick: (event) => {
          event.stopPropagation();
          handleChange(!checked);
        }
      }
    ),
    /* @__PURE__ */ jsx("label", { htmlFor: id, className: "adyen-kyc-checkbox__label", children: label }),
    helper && /* @__PURE__ */ jsx("span", { id: helperId, className: "adyen-kyc-checkbox__helper-text", children: helper })
  ] });
}
export {
  Checkbox as C
};
