/* empty css                                               */
/* empty css                                                     */
/* empty css                                                     */
/* empty css                                                */
/* empty css                                               */
/* empty css                                                  */
/* empty css                                                 */
import { createBlock, openBlock, withCtx, createVNode, renderSlot } from "vue";
/* empty css           */
import _export_sfc from "../../../../../../_virtual/_plugin-vue_export-helper.mjs";
/* empty css                                                     */
/* empty css                                                            */
/* empty css                                                  */
/* empty css                                                */
/* empty css                                                 */
import { SwipeCell } from "../../../../node_modules/vant/es/swipe-cell/index.mjs";
import { showConfirmDialog } from "../../../../node_modules/vant/es/dialog/function-call.mjs";
import "../../../../node_modules/vant/es/dialog/index.mjs";
import { CellGroup } from "../../../../node_modules/vant/es/cell-group/index.mjs";
import { Button } from "../../../../node_modules/vant/es/button/index.mjs";
const _sfc_main = {
  __name: "Card",
  props: {
    swipeDelete: {
      type: Boolean,
      default: false
    }
  },
  emits: ["delete"],
  setup(__props, { emit: __emit }) {
    const emit = __emit;
    const beforeClose = ({ position }) => {
      switch (position) {
        case "left":
        case "cell":
        case "outside":
          return true;
        case "right":
          return new Promise((resolve) => {
            showConfirmDialog({
              title: "确定删除吗？"
            }).then(() => {
              emit("delete");
              resolve(true);
            }).catch(() => resolve(false));
          });
      }
    };
    return (_ctx, _cache) => {
      const _component_van_button = Button;
      const _component_van_swipe_cell = SwipeCell;
      const _component_van_cell_group = CellGroup;
      return openBlock(), createBlock(_component_van_cell_group, {
        class: "fec-card",
        inset: true,
        border: true
      }, {
        default: withCtx(() => [
          createVNode(_component_van_swipe_cell, {
            disabled: !__props.swipeDelete,
            "before-close": beforeClose
          }, {
            right: withCtx(() => [
              createVNode(_component_van_button, {
                square: "",
                text: "删除",
                type: "danger",
                class: "fec-swipe-delete-button"
              })
            ]),
            default: withCtx(() => [
              renderSlot(_ctx.$slots, "default", {}, void 0, true)
            ]),
            _: 3
          }, 8, ["disabled"])
        ]),
        _: 3
      });
    };
  }
};
const _Card = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-dc24b95f"]]);
export {
  _Card as default
};
