import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, unref, withModifiers, normalizeStyle, createTextVNode, toDisplayString, renderSlot, useCssVars, ref, watchEffect, createElementVNode, Fragment, createBlock, createCommentVNode, resolveComponent, createVNode, withCtx, renderList } from "vue";
import { _ as _sfc_main$3 } from "./index7.js";
import { o as onDebounce } from "./index4.js";
import WlSvg from "@wltech/svg";
import "vant";
import "./index5.js";
var index_vue_vue_type_style_index_0_lang$2 = "";
const __default__$2 = {
  name: "WlButton"
};
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
  ...__default__$2,
  props: {
    text: { default: "" },
    disabled: { type: Boolean, default: false },
    type: { default: "primary" },
    size: { default: "normal" },
    shape: { default: "default" },
    styleExtra: { default: null },
    plain: { type: Boolean, default: false },
    color: { default: "" }
  },
  emits: ["onClick"],
  setup(__props, { emit }) {
    const props = __props;
    const btnClass = computed(() => {
      return {
        [`btn-plain-${props.type}`]: props.plain,
        [`btn-type-${props.type}`]: !props.plain,
        [`btn-shape-${props.shape}`]: true,
        [`btn-size-${props.size}`]: true,
        disabled: props.disabled
      };
    });
    const btnStyle = computed(() => {
      let colorStyle = {};
      if (props.plain && props.color) {
        colorStyle = {
          "border-color": props.color,
          color: props.color
        };
      } else if (!props.plain && props.color) {
        colorStyle = {
          "background-color": props.color,
          "border-color": props.color
        };
      }
      return {
        ...props.styleExtra,
        ...colorStyle
      };
    });
    const onButtonClick = onDebounce(() => {
      if (props.disabled)
        return;
      emit("onClick");
    }, 500);
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: normalizeClass([unref(btnClass), "btn"]),
        onClick: _cache[0] || (_cache[0] = withModifiers(
          (...args) => unref(onButtonClick) && unref(onButtonClick)(...args),
          ["stop"]
        )),
        style: normalizeStyle(unref(btnStyle)),
        "data-weiling-mobile-ui-wl-button": ""
      }, [
        createTextVNode(toDisplayString(__props.text) + " ", 1),
        renderSlot(_ctx.$slots, "default")
      ], 6);
    };
  }
});
var index_vue_vue_type_style_index_0_lang$1 = "";
const _hoisted_1$1 = ["onClick"];
const _hoisted_2$1 = {
  key: 1,
  class: "dot"
};
const _hoisted_3$1 = {
  key: 2,
  class: "count"
};
const _hoisted_4$1 = {
  key: 0,
  class: "uno-pl-8"
};
const __default__$1 = {
  name: "WlRadioIcon"
};
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
  ...__default__$1,
  props: {
    isChoosed: { type: Boolean, default: false },
    disabled: { type: Boolean, default: false },
    size: { default: 18 },
    color: { default: "var(--wl-primary-color)" },
    count: { default: 1 },
    type: { default: "hook" },
    iconType: { default: "" },
    text: { default: "" }
  },
  emits: ["onClick"],
  setup(__props, { emit }) {
    const props = __props;
    useCssVars((_ctx) => ({
      "4d335b1a": unref(iconSize),
      "272de063": __props.color
    }));
    const isChecked = ref(false);
    const iconSize = computed(() => props.size + "px");
    const svgType = computed(
      () => props.type === "hook" ? "successFill" : props.iconType
    );
    const radioWrapClass = computed(() => {
      return `radio-wrap ${isChecked.value ? "" : "checked"}`;
    });
    const onClick = () => {
      if (props.disabled)
        return;
      emit("onClick", isChecked.value);
    };
    watchEffect(() => {
      isChecked.value = props.isChoosed;
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: "radio-icon-wrap",
        onClick: withModifiers(onClick, ["stop"]),
        "data-weiling-mobile-ui-wl-radio-icon": ""
      }, [
        createElementVNode("div", {
          class: normalizeClass(unref(radioWrapClass))
        }, [
          isChecked.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
            ["hook", "icon"].includes(__props.type) ? (openBlock(), createBlock(unref(WlSvg), {
              key: 0,
              type: unref(svgType),
              color: "var(--wl-primary-color)",
              height: unref(iconSize),
              width: unref(iconSize)
            }, null, 8, ["type", "height", "width"])) : __props.type === "dot" ? (openBlock(), createElementBlock("p", _hoisted_2$1)) : __props.type === "count" ? (openBlock(), createElementBlock("p", _hoisted_3$1, toDisplayString(__props.count), 1)) : createCommentVNode("", true)
          ], 64)) : createCommentVNode("", true)
        ], 2),
        __props.text ? (openBlock(), createElementBlock("p", _hoisted_4$1, toDisplayString(__props.text), 1)) : createCommentVNode("", true)
      ], 8, _hoisted_1$1);
    };
  }
});
var index_vue_vue_type_style_index_0_lang = "";
const _hoisted_1 = { class: "mul-rf-select-wrap" };
const _hoisted_2 = {
  class: "mult-select",
  "data-weiling-mobile-ui-rf-mul-select-popup": ""
};
const _hoisted_3 = {
  key: 0,
  class: "header"
};
const _hoisted_4 = { class: "content" };
const _hoisted_5 = ["onClick"];
const _hoisted_6 = { class: "text" };
const _hoisted_7 = { class: "footer" };
const _hoisted_8 = /* @__PURE__ */ createTextVNode("\u786E\u8BA4\u9009\u62E9");
const __default__ = {
  name: "RfMulSelect"
};
const _sfc_main = /* @__PURE__ */ defineComponent({
  ...__default__,
  props: {
    modelValue: { default: () => [] },
    options: { default: () => [] },
    title: null
  },
  emits: ["onSelect", "update:modelValue", "onSubmit"],
  setup(__props, { emit }) {
    const props = __props;
    const popUpVisible = ref(false);
    const choosedKey = ref([]);
    const valueText = ref("");
    const onClose = () => {
      popUpVisible.value = false;
    };
    const onShow = () => popUpVisible.value = true;
    const onSubmit = () => {
      emit("update:modelValue", unref(choosedKey));
      onClose();
    };
    const onSelect = (item) => {
      const index = choosedKey.value.indexOf(item.key);
      if (index === -1) {
        choosedKey.value.push(item.key);
      } else {
        choosedKey.value.splice(index, 1);
      }
      emit("onSelect", item);
    };
    watchEffect(() => {
      choosedKey.value = props.modelValue.map((ele) => ele);
      valueText.value = props.options.reduce((pre, cur) => {
        if (props.modelValue.includes(cur.key)) {
          return pre + (pre ? "," + cur.value : cur.value);
        } else {
          return pre;
        }
      }, "");
    });
    return (_ctx, _cache) => {
      const _component_WlHeader = resolveComponent("WlHeader");
      return openBlock(), createElementBlock("div", _hoisted_1, [
        createElementVNode("div", {
          class: "mul-rf-select",
          onClick: onShow
        }, toDisplayString(valueText.value), 1),
        createVNode(_sfc_main$3, {
          position: "bottom",
          round: "",
          style: { "height": "50%" },
          onClose,
          modelValue: popUpVisible.value,
          "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => popUpVisible.value = $event)
        }, {
          default: withCtx(() => [
            createElementVNode("div", _hoisted_2, [
              __props.title ? (openBlock(), createElementBlock("div", _hoisted_3, [
                createVNode(_component_WlHeader, {
                  showClose: "",
                  onOnClose: _cache[0] || (_cache[0] = ($event) => popUpVisible.value = false)
                }, {
                  default: withCtx(() => [
                    createTextVNode(toDisplayString(__props.title), 1)
                  ]),
                  _: 1
                })
              ])) : createCommentVNode("", true),
              createElementVNode("div", _hoisted_4, [
                (openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (item) => {
                  return openBlock(), createElementBlock("div", {
                    key: item.key
                  }, [
                    createElementVNode("div", {
                      class: "item",
                      onClick: withModifiers(($event) => onSelect(item), ["stop"])
                    }, [
                      createElementVNode("p", _hoisted_6, toDisplayString(item.value), 1),
                      createVNode(_sfc_main$1, {
                        isChoosed: choosedKey.value.includes(item.key),
                        isHookType: true,
                        onOnClick: ($event) => onSelect(item)
                      }, null, 8, ["isChoosed", "onOnClick"])
                    ], 8, _hoisted_5)
                  ]);
                }), 128))
              ]),
              createElementVNode("div", _hoisted_7, [
                createVNode(_sfc_main$2, {
                  type: "primary",
                  block: "",
                  onOnClick: onSubmit
                }, {
                  default: withCtx(() => [
                    _hoisted_8
                  ]),
                  _: 1
                })
              ])
            ])
          ]),
          _: 1
        }, 8, ["modelValue"])
      ]);
    };
  }
});
export { _sfc_main as default };
