import { defineComponent, resolveComponent, openBlock, createElementBlock, normalizeStyle, normalizeClass, withModifiers, renderSlot, createVNode } from 'vue';
import '../../../hooks/index.mjs';
import { useOption } from './useOption.mjs';
import { OptionProps } from './defaults.mjs';
import { ElCheckbox } from '../../checkbox/index.mjs';
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';

const _sfc_main = defineComponent({
  props: OptionProps,
  components: {
    ElCheckbox
  },
  emits: ["select", "hover"],
  setup(props, { emit }) {
    const ns = useNamespace("select");
    const onSelectCheckbox = (index) => {
      emit("select", index);
    };
    const { hoverItem, selectOptionClick } = useOption(props, { emit });
    return {
      ns,
      hoverItem,
      onSelectCheckbox,
      selectOptionClick
    };
  }
});
const _hoisted_1 = ["aria-selected"];
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  const _component_el_checkbox = resolveComponent("el-checkbox");
  return openBlock(), createElementBlock("li", {
    "aria-selected": _ctx.selected,
    style: normalizeStyle(_ctx.style),
    class: normalizeClass([
      _ctx.ns.be("dropdown", "option-item"),
      _ctx.ns.is("selected", _ctx.selected),
      _ctx.ns.is("disabled", _ctx.disabled),
      _ctx.ns.is("created", _ctx.created),
      { hover: _ctx.hovering }
    ]),
    onMouseenter: _cache[3] || (_cache[3] = (...args) => _ctx.hoverItem && _ctx.hoverItem(...args)),
    onClick: _cache[4] || (_cache[4] = withModifiers(() => {
      _ctx.item.checked = !_ctx.item.checked;
      _ctx.onSelectCheckbox(_ctx.index);
    }, ["stop"]))
  }, [
    renderSlot(_ctx.$slots, "default", {
      item: _ctx.item,
      index: _ctx.index,
      disabled: _ctx.disabled
    }, () => [
      createVNode(_component_el_checkbox, {
        onClick: _cache[0] || (_cache[0] = withModifiers(() => {
        }, ["stop"])),
        onChange: _cache[1] || (_cache[1] = ($event) => _ctx.onSelectCheckbox(_ctx.index)),
        modelValue: _ctx.item.checked,
        "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => _ctx.item.checked = $event),
        label: _ctx.item.label
      }, null, 8, ["modelValue", "label"])
    ])
  ], 46, _hoisted_1);
}
var OptionItemCheckbox = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/Users/st/Desktop/vue/nxx-ui/packages/components/select-v2/src/option-item-checkbox.vue"]]);

export { OptionItemCheckbox as default };
//# sourceMappingURL=option-item-checkbox.mjs.map
