import { defineComponent, openBlock, createBlock, unref, createElementBlock, normalizeClass, createElementVNode, renderSlot, withDirectives, createVNode, vShow, createTextVNode, toDisplayString, ref, watchEffect, isRef, withCtx, createCommentVNode } from "vue";
import { ActionSheet } from "vant";
import WlSvg from "@wltech/svg";
const __default__$2 = {
  name: "WlSvgIcon"
};
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
  ...__default__$2,
  props: {
    type: { default: "" },
    color: { default: "var(--wl-text-color-title-1)" },
    width: { default: "16" },
    height: { default: "16" }
  },
  setup(__props) {
    const sub = location.origin;
    return (_ctx, _cache) => {
      return openBlock(), createBlock(unref(WlSvg), {
        type: __props.type,
        width: __props.width,
        height: __props.height,
        color: __props.color,
        sub: unref(sub)
      }, null, 8, ["type", "width", "height", "color", "sub"]);
    };
  }
});
const _hoisted_1 = { class: "z-2 flex uno-min-w-44 uno-max-w-88" };
const _hoisted_2 = { class: "uno-elli-1 z-1 box-border flex-middle-center absolute text-center uno-l-44 uno-r-44" };
const _hoisted_3 = { class: "relative z-2 flex-middle-center uno-min-w-44" };
const __default__$1 = {
  name: "WlHeader"
};
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
  ...__default__$1,
  props: {
    title: { default: "" },
    showBack: { type: Boolean, default: false },
    showClose: { type: Boolean, default: false },
    needAutoBack: { type: Boolean, default: true },
    needBottomBorder: { type: Boolean, default: false }
  },
  emits: ["onBack", "onClose"],
  setup(__props, { emit }) {
    const props = __props;
    const onBackPage = () => {
      if (props.needAutoBack) {
        history.back();
      } else {
        emit("onBack");
      }
    };
    const onClose = () => {
      emit("onClose");
    };
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: normalizeClass(`uno-fs-16 uno-h-44 relative font-medium box-border text-base-color bg-white flex-between ${__props.needBottomBorder ? "border-bottom" : " "}`)
      }, [
        createElementVNode("div", _hoisted_1, [
          renderSlot(_ctx.$slots, "header_part_left", {}, () => [
            withDirectives(createElementVNode("div", {
              class: "box-content flex-middle-center cursor-pointer uno-h-44 uno-w-44",
              onClick: onBackPage
            }, [
              createVNode(_sfc_main$2, {
                type: "arrowTipLeft",
                width: "22",
                height: "22",
                color: "#000"
              })
            ], 512), [
              [vShow, __props.showBack]
            ])
          ])
        ]),
        createElementVNode("div", _hoisted_2, [
          renderSlot(_ctx.$slots, "default", {}, () => [
            createTextVNode(toDisplayString(__props.title), 1)
          ])
        ]),
        createElementVNode("div", _hoisted_3, [
          renderSlot(_ctx.$slots, "header_part_right", {}, () => [
            withDirectives(createElementVNode("div", {
              class: "box-content flex-middle-center cursor-pointer uno-h-44 uno-w-44",
              onClick: onClose
            }, [
              createVNode(_sfc_main$2, {
                type: "close",
                width: "22",
                height: "22",
                color: "#000"
              })
            ], 512), [
              [vShow, __props.showClose]
            ])
          ])
        ])
      ], 2);
    };
  }
});
const __default__ = {
  name: "WlActionSheet"
};
const _sfc_main = /* @__PURE__ */ defineComponent({
  ...__default__,
  props: {
    title: { default: "" },
    cancelText: { default: "\u53D6\u6D88" },
    modelValue: { type: Boolean, default: false },
    showClose: { type: Boolean, default: true },
    showBack: { type: Boolean, default: false },
    headerVisible: { type: Boolean, default: false },
    actions: { default: () => [] },
    teleport: { default: "" }
  },
  emits: ["update:modelValue", "onClose", "onSelect"],
  setup(__props, { emit }) {
    const props = __props;
    let actionSheetVisible = ref(false);
    const onClose = () => {
      emit("update:modelValue", false);
      emit("onClose");
    };
    const onSelect = (val) => {
      emit("onSelect", val);
      onClose();
    };
    watchEffect(() => {
      actionSheetVisible.value = props.modelValue;
    });
    return (_ctx, _cache) => {
      return openBlock(), createBlock(unref(ActionSheet), {
        show: unref(actionSheetVisible),
        "onUpdate:show": _cache[0] || (_cache[0] = ($event) => isRef(actionSheetVisible) ? actionSheetVisible.value = $event : actionSheetVisible = $event),
        "cancel-text": __props.cancelText,
        "close-on-click-action": "",
        "close-on-popstate": "",
        actions: __props.actions,
        teleport: __props.teleport,
        onCancel: onClose,
        onClickOverlay: onClose,
        onSelect
      }, {
        default: withCtx(() => [
          __props.headerVisible ? (openBlock(), createBlock(_sfc_main$1, {
            key: 0,
            title: __props.title,
            showClose: __props.showClose,
            showBack: __props.showBack,
            onOnClose: onClose
          }, null, 8, ["title", "showClose", "showBack"])) : createCommentVNode("", true),
          renderSlot(_ctx.$slots, "default")
        ]),
        _: 3
      }, 8, ["show", "cancel-text", "actions", "teleport"]);
    };
  }
});
var __uno = "";
_sfc_main.install = (app) => {
  app.component(_sfc_main.name, _sfc_main);
};
export { _sfc_main as default };
