import { defineComponent as v, unref as r, computed as g, renderSlot as y } from "vue";
import { isUndefined as b } from "lodash-unified";
import "../hooks/index.mjs";
import { useProvideCheckCard as S } from "./context.mjs";
import { useControllableValue as B } from "../hooks/useControllableValue.mjs";
const P = /* @__PURE__ */ v({
  name: "CheckCardGroup",
  __name: "group",
  props: {
    bordered: { type: Boolean, default: void 0 },
    disabled: { type: Boolean, default: void 0 },
    loading: { type: Boolean, default: void 0 },
    size: { default: void 0 },
    stopPropagation: { type: [Boolean, Function], default: void 0 },
    indicatorSize: { default: void 0 },
    style: { default: void 0 },
    multiple: { type: Boolean, default: !1 },
    defaultValue: { type: [String, Number, Boolean, Array], default: void 0 },
    value: { type: [String, Number, Boolean, Array], default: void 0 },
    "onUpdate:value": {}
  },
  emits: ["update:value"],
  setup(n, { emit: u }) {
    const t = n, s = u, { value: a, updateValue: d } = B(t, s), l = /* @__PURE__ */ new Map();
    function p(e) {
      if (!t.multiple) {
        if (r(a) === e)
          return;
        d(e);
        return;
      }
      let o = [...r(a) || []];
      const c = o.find((i) => i === e);
      b(c) ? o.push(e) : o = o.filter((i) => i !== e).filter((i) => l.has(i)), d(o);
    }
    function f(e) {
      l.set(e, !0);
    }
    function m(e) {
      l.delete(e);
    }
    return S(
      g(() => ({
        toggleOption: p,
        registerValue: f,
        cancelValue: m,
        disabled: t.disabled,
        size: t.size,
        bordered: t.bordered,
        loading: t.loading,
        value: r(a),
        multiple: t.multiple,
        stopPropagation: t.stopPropagation,
        style: t.style,
        indicatorSize: t.indicatorSize
      }))
    ), (e, o) => y(e.$slots, "default");
  }
});
export {
  P as default
};
