import { aX as v, b9 as oe, ba as h, r as c, bb as m } from "./index-6wLGsgHc.js";
var S = Object.freeze({
  default: "default",
  toggle: "toggle",
  // maintaining key with aliased value to assist in transition to v11 but will be removed soon after release
  toggle_round: "toggle"
}), ve = Object.freeze({
  top: "top",
  right: "right",
  bottom: "bottom",
  left: "left"
});
function _(e, r) {
  var o = Object.keys(e);
  if (Object.getOwnPropertySymbols) {
    var t = Object.getOwnPropertySymbols(e);
    r && (t = t.filter(function(s) {
      return Object.getOwnPropertyDescriptor(e, s).enumerable;
    })), o.push.apply(o, t);
  }
  return o;
}
function x(e) {
  for (var r = 1; r < arguments.length; r++) {
    var o = arguments[r] != null ? arguments[r] : {};
    r % 2 ? _(Object(o), !0).forEach(function(t) {
      U(e, t, o[t]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(o)) : _(Object(o)).forEach(function(t) {
      Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(o, t));
    });
  }
  return e;
}
function U(e, r, o) {
  return r in e ? Object.defineProperty(e, r, {
    value: o,
    enumerable: !0,
    configurable: !0,
    writable: !0
  }) : e[r] = o, e;
}
function ie(e) {
  var r = e.$disabled, o = e.$checked, t = e.$error, s = e.$isIndeterminate, i = e.$theme, n = e.$isFocusVisible, a = i.colors;
  return r ? a.tickFillDisabled : o || s ? "transparent" : t ? a.borderNegative : n ? a.borderSelected : a.tickBorder;
}
function ne(e) {
  var r = e.$labelPlacement, o = r === void 0 ? "" : r, t = e.$theme, s = t.sizing, i = s.scale300, n;
  switch (o) {
    case "top":
      n = "Bottom";
      break;
    case "bottom":
      n = "Top";
      break;
    case "left":
      n = "Right";
      break;
    default:
    case "right":
      n = "Left";
      break;
  }
  return t.direction === "rtl" && n === "Left" ? n = "Right" : t.direction === "rtl" && n === "Right" && (n = "Left"), U({}, "padding".concat(n), i);
}
function ae(e) {
  var r = e.$disabled, o = e.$checked, t = e.$isIndeterminate, s = e.$error, i = e.$isHovered, n = e.$isActive, a = e.$theme, l = a.colors;
  return r ? o || t ? l.tickFillDisabled : l.tickFill : s && (t || o) ? n ? l.tickFillErrorSelectedHoverActive : i ? l.tickFillErrorSelectedHover : l.tickFillErrorSelected : s ? n ? l.tickFillErrorHoverActive : i ? l.tickFillErrorHover : l.tickFillError : t || o ? n ? l.tickFillSelectedHoverActive : i ? l.tickFillSelectedHover : l.tickFillSelected : n ? l.tickFillActive : i ? l.tickFillHover : l.tickFill;
}
function le(e) {
  var r = e.$disabled, o = e.$theme, t = o.colors;
  return r ? t.contentSecondary : t.contentPrimary;
}
var L = v("label", function(e) {
  var r = e.$disabled, o = e.$labelPlacement;
  return {
    flexDirection: o === "top" || o === "bottom" ? "column" : "row",
    display: "flex",
    alignItems: o === "top" || o === "bottom" ? "center" : "flex-start",
    cursor: r ? "not-allowed" : "pointer",
    userSelect: "none"
  };
});
L.displayName = "Root";
L.displayName = "Root";
var T = v("span", function(e) {
  var r = e.$checked, o = e.$disabled, t = e.$error, s = e.$isIndeterminate, i = e.$theme, n = e.$isFocusVisible, a = i.sizing, l = i.animation, y = o ? i.colors.tickMarkFillDisabled : t ? i.colors.tickMarkFillError : i.colors.tickMarkFill, k = encodeURIComponent(`
    <svg width="14" height="4" viewBox="0 0 14 4" fill="none" xmlns="http://www.w3.org/2000/svg">
      <path d="M14 0.5H0V3.5H14V0.5Z" fill="`.concat(y, `"/>
    </svg>
  `)), $ = encodeURIComponent(`
    <svg width="17" height="13" viewBox="0 0 17 13" fill="none" xmlns="http://www.w3.org/2000/svg">
      <path d="M6.50002 12.6L0.400024 6.60002L2.60002 4.40002L6.50002 8.40002L13.9 0.900024L16.1 3.10002L6.50002 12.6Z" fill="`.concat(y, `"/>
    </svg>
  `)), f = i.borders.checkboxBorderRadius, b = ie(e);
  return {
    flex: "0 0 auto",
    transitionDuration: l.timing200,
    transitionTimingFunction: l.easeOutCurve,
    transitionProperty: "background-image, border-color, background-color",
    width: a.scale700,
    height: a.scale700,
    left: "4px",
    top: "4px",
    boxSizing: "border-box",
    borderLeftStyle: "solid",
    borderRightStyle: "solid",
    borderTopStyle: "solid",
    borderBottomStyle: "solid",
    borderLeftWidth: "3px",
    borderRightWidth: "3px",
    borderTopWidth: "3px",
    borderBottomWidth: "3px",
    borderLeftColor: b,
    borderRightColor: b,
    borderTopColor: b,
    borderBottomColor: b,
    borderTopLeftRadius: f,
    borderTopRightRadius: f,
    borderBottomRightRadius: f,
    borderBottomLeftRadius: f,
    outline: n && r ? "3px solid ".concat(i.colors.accent) : "none",
    display: "inline-block",
    verticalAlign: "middle",
    backgroundImage: s ? "url('data:image/svg+xml,".concat(k, "');") : r ? "url('data:image/svg+xml,".concat($, "');") : null,
    backgroundColor: ae(e),
    backgroundRepeat: "no-repeat",
    backgroundPosition: "center",
    backgroundSize: "contain",
    marginTop: i.sizing.scale0,
    marginBottom: i.sizing.scale0,
    marginLeft: i.sizing.scale0,
    marginRight: i.sizing.scale0
  };
});
T.displayName = "Checkmark";
T.displayName = "Checkmark";
var j = v("div", function(e) {
  var r = e.$theme, o = r.typography;
  return x(x(x({
    verticalAlign: "middle"
  }, ne(e)), {}, {
    color: le(e)
  }, o.LabelMedium), {}, {
    lineHeight: "24px"
  });
});
j.displayName = "Label";
j.displayName = "Label";
var M = v("input", {
  opacity: 0,
  width: 0,
  height: 0,
  overflow: "hidden",
  margin: 0,
  padding: 0,
  position: "absolute"
});
M.displayName = "Input";
M.displayName = "Input";
var B = v("div", function(e) {
  var r = e.$theme.colors.toggleFill;
  return e.$disabled ? r = e.$theme.colors.toggleFillDisabled : e.$checked && e.$error ? r = e.$theme.colors.tickFillErrorSelected : e.$checked && (r = e.$theme.colors.toggleFillChecked), {
    backgroundColor: r,
    borderTopLeftRadius: "50%",
    borderTopRightRadius: "50%",
    borderBottomRightRadius: "50%",
    borderBottomLeftRadius: "50%",
    boxShadow: e.$isFocusVisible ? "0 0 0 3px ".concat(e.$theme.colors.accent) : e.$isHovered && !e.$disabled ? e.$theme.lighting.shadow500 : e.$theme.lighting.shadow400,
    outline: "none",
    height: e.$theme.sizing.scale700,
    width: e.$theme.sizing.scale700,
    transform: e.$checked ? "translateX(".concat(e.$theme.direction === "rtl" ? "-100%" : "100%", ")") : null,
    transition: "transform ".concat(e.$theme.animation.timing200)
  };
});
B.displayName = "Toggle";
B.displayName = "Toggle";
var C = v("div", function(e) {
  var r = e.$theme.colors.toggleTrackFill;
  return e.$disabled ? r = e.$theme.colors.toggleTrackFillDisabled : e.$error && e.$checked && (r = e.$theme.colors.tickFillError), {
    alignItems: "center",
    backgroundColor: r,
    borderTopLeftRadius: "7px",
    borderTopRightRadius: "7px",
    borderBottomRightRadius: "7px",
    borderBottomLeftRadius: "7px",
    display: "flex",
    height: e.$theme.sizing.scale550,
    marginTop: e.$theme.sizing.scale200,
    marginBottom: e.$theme.sizing.scale100,
    marginLeft: e.$theme.sizing.scale200,
    marginRight: e.$theme.sizing.scale100,
    width: e.$theme.sizing.scale1000
  };
});
C.displayName = "ToggleTrack";
C.displayName = "ToggleTrack";
function P(e) {
  "@babel/helpers - typeof";
  return P = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(r) {
    return typeof r;
  } : function(r) {
    return r && typeof Symbol == "function" && r.constructor === Symbol && r !== Symbol.prototype ? "symbol" : typeof r;
  }, P(e);
}
function p() {
  return p = Object.assign ? Object.assign.bind() : function(e) {
    for (var r = 1; r < arguments.length; r++) {
      var o = arguments[r];
      for (var t in o) Object.prototype.hasOwnProperty.call(o, t) && (e[t] = o[t]);
    }
    return e;
  }, p.apply(this, arguments);
}
function se(e, r) {
  if (!(e instanceof r)) throw new TypeError("Cannot call a class as a function");
}
function ce(e, r) {
  for (var o = 0; o < r.length; o++) {
    var t = r[o];
    t.enumerable = t.enumerable || !1, t.configurable = !0, "value" in t && (t.writable = !0), Object.defineProperty(e, t.key, t);
  }
}
function ue(e, r, o) {
  return r && ce(e.prototype, r), Object.defineProperty(e, "prototype", {
    writable: !1
  }), e;
}
function de(e, r) {
  if (typeof r != "function" && r !== null) throw new TypeError("Super expression must either be null or a function");
  e.prototype = Object.create(r && r.prototype, {
    constructor: {
      value: e,
      writable: !0,
      configurable: !0
    }
  }), Object.defineProperty(e, "prototype", {
    writable: !1
  }), r && E(e, r);
}
function E(e, r) {
  return E = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(o, t) {
    return o.__proto__ = t, o;
  }, E(e, r);
}
function pe(e) {
  var r = be();
  return function() {
    var o = w(e), t;
    if (r) {
      var s = w(this).constructor;
      t = Reflect.construct(o, arguments, s);
    } else t = o.apply(this, arguments);
    return fe(this, t);
  };
}
function fe(e, r) {
  if (r && (P(r) === "object" || typeof r == "function")) return r;
  if (r !== void 0) throw new TypeError("Derived constructors may only return object or undefined");
  return u(e);
}
function u(e) {
  if (e === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  return e;
}
function be() {
  if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham) return !1;
  if (typeof Proxy == "function") return !0;
  try {
    return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    })), !0;
  } catch {
    return !1;
  }
}
function w(e) {
  return w = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(r) {
    return r.__proto__ || Object.getPrototypeOf(r);
  }, w(e);
}
function d(e, r, o) {
  return r in e ? Object.defineProperty(e, r, {
    value: o,
    enumerable: !0,
    configurable: !0,
    writable: !0
  }) : e[r] = o, e;
}
var ge = function(e) {
  return e.stopPropagation();
}, he = /* @__PURE__ */ (function(e) {
  de(o, e);
  var r = pe(o);
  function o() {
    var t;
    se(this, o);
    for (var s = arguments.length, i = new Array(s), n = 0; n < s; n++) i[n] = arguments[n];
    return t = r.call.apply(r, [this].concat(i)), d(u(t), "state", {
      isFocused: t.props.autoFocus || !1,
      isFocusVisible: !1,
      isHovered: !1,
      isActive: !1
    }), d(u(t), "onMouseEnter", function(a) {
      t.setState({
        isHovered: !0
      }), t.props.onMouseEnter(a);
    }), d(u(t), "onMouseLeave", function(a) {
      t.setState({
        isHovered: !1,
        isActive: !1
      }), t.props.onMouseLeave(a);
    }), d(u(t), "onMouseDown", function(a) {
      t.setState({
        isActive: !0
      }), t.props.onMouseDown(a);
    }), d(u(t), "onMouseUp", function(a) {
      t.setState({
        isActive: !1
      }), t.props.onMouseUp(a);
    }), d(u(t), "onFocus", function(a) {
      t.setState({
        isFocused: !0
      }), t.props.onFocus(a), oe(a) && t.setState({
        isFocusVisible: !0
      });
    }), d(u(t), "onBlur", function(a) {
      t.setState({
        isFocused: !1
      }), t.props.onBlur(a), t.state.isFocusVisible !== !1 && t.setState({
        isFocusVisible: !1
      });
    }), t;
  }
  return ue(o, [{
    key: "componentDidMount",
    value: function() {
      var t = this.props, s = t.autoFocus, i = t.inputRef;
      s && i.current && i.current.focus();
    }
  }, {
    key: "render",
    value: function() {
      var t = this.props, s = t.overrides, i = s === void 0 ? {} : s, n = t.onChange, a = t.labelPlacement, l = a === void 0 ? this.props.checkmarkType === S.toggle ? "left" : "right" : a, y = t.inputRef, k = t.isIndeterminate, $ = t.error, f = t.disabled, b = t.value, q = t.name, W = t.type, F = t.checked, O = t.children, R = t.required, X = t.title, D = i.Root, z = i.Checkmark, H = i.Label, I = i.Input, A = i.Toggle, N = i.ToggleTrack, Z = h(D) || L, G = h(z) || T, J = h(H) || j, K = h(I) || M, Q = h(A) || B, Y = h(N) || C, ee = {
        onChange: n,
        onFocus: this.onFocus,
        onBlur: this.onBlur
      }, te = {
        onMouseEnter: this.onMouseEnter,
        onMouseLeave: this.onMouseLeave,
        onMouseDown: this.onMouseDown,
        onMouseUp: this.onMouseUp
      }, g = {
        $isFocused: this.state.isFocused,
        $isFocusVisible: this.state.isFocusVisible,
        $isHovered: this.state.isHovered,
        $isActive: this.state.isActive,
        $error: $,
        $checked: F,
        $isIndeterminate: k,
        $required: R,
        $disabled: f,
        $value: b
      }, V = O && /* @__PURE__ */ c.createElement(J, p({
        $labelPlacement: l
      }, g, m(H)), this.props.containsInteractiveElement ? (
        // Prevents the event from bubbling up to the label and moving focus to the radio button
        // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
        /* @__PURE__ */ c.createElement("div", {
          onClick: function(re) {
            return re.preventDefault();
          }
        }, O)
      ) : O);
      return /* @__PURE__ */ c.createElement(Z, p({
        "data-baseweb": "checkbox",
        title: X || null,
        $labelPlacement: l
      }, g, te, m(D)), (l === "top" || l === "left") && V, this.props.checkmarkType === S.toggle ? /* @__PURE__ */ c.createElement(Y, p({}, g, m(N)), /* @__PURE__ */ c.createElement(Q, p({}, g, m(A)))) : /* @__PURE__ */ c.createElement(G, p({}, g, m(z))), /* @__PURE__ */ c.createElement(K, p({
        value: b,
        name: q,
        checked: F,
        required: R,
        "aria-label": this.props["aria-label"] || this.props.ariaLabel,
        "aria-checked": k ? "mixed" : F,
        "aria-describedby": this.props["aria-describedby"],
        "aria-errormessage": this.props["aria-errormessage"],
        "aria-invalid": $ || null,
        "aria-required": R || null,
        disabled: f,
        type: W,
        ref: y,
        onClick: ge
      }, g, ee, m(I))), (l === "bottom" || l === "right") && V);
    }
  }]), o;
})(c.Component);
d(he, "defaultProps", {
  overrides: {},
  // todo(flow->ts): missing field in flow types
  checked: !1,
  containsInteractiveElement: !1,
  disabled: !1,
  autoFocus: !1,
  isIndeterminate: !1,
  inputRef: /* @__PURE__ */ c.createRef(),
  error: !1,
  type: "checkbox",
  checkmarkType: S.default,
  onChange: function() {
  },
  onMouseEnter: function() {
  },
  onMouseLeave: function() {
  },
  onMouseDown: function() {
  },
  onMouseUp: function() {
  },
  onFocus: function() {
  },
  onBlur: function() {
  }
});
export {
  S as T,
  he as v,
  ve as y
};
//# sourceMappingURL=checkbox-i_07yegq-Ddxf-k8R.js.map
