import { defineComponent, computed, openBlock, createElementBlock, Fragment, renderList, createElementVNode, renderSlot, createTextVNode, toDisplayString, createVNode, unref, createCommentVNode, mergeProps, withCtx } from 'vue';
import { ElDivider, ElPopover } from 'element-plus';

"use strict";
const _hoisted_1 = { class: "me-text-separator" };
const _hoisted_2 = { class: "text-item" };
const _hoisted_3 = {
  key: 0,
  class: "separator"
};
const _hoisted_4 = { class: "separator" };
const _hoisted_5 = { class: "suffix-trigger" };
const _hoisted_6 = { class: "popover-list" };
const __default__ = defineComponent({
  name: "me-text-separator"
});
var script = /* @__PURE__ */ defineComponent({
  ...__default__,
  props: {
    data: { type: Array, required: false, default: () => [] },
    maxCount: { type: Number, required: false, default: 3 },
    borderStyle: { type: null, required: false, default: "solid" },
    popoverPlacement: { type: String, required: false, default: "bottom" }
  },
  setup(__props) {
    const props = __props;
    const visibleData = computed(() => props.data.slice(0, props.maxCount));
    const hasMore = computed(() => props.data.length > props.maxCount);
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1, [
        (openBlock(true), createElementBlock(
          Fragment,
          null,
          renderList(visibleData.value, (item, index) => {
            return openBlock(), createElementBlock(
              Fragment,
              { key: index },
              [
                createElementVNode("span", _hoisted_2, [
                  renderSlot(_ctx.$slots, "default", {
                    item,
                    index
                  }, () => [
                    createTextVNode(
                      toDisplayString(item),
                      1
                      /* TEXT */
                    )
                  ])
                ]),
                index < visibleData.value.length - 1 ? (openBlock(), createElementBlock("div", _hoisted_3, [
                  renderSlot(_ctx.$slots, "separator", { index }, () => [
                    createVNode(unref(ElDivider), {
                      direction: "vertical",
                      "border-style": __props.borderStyle
                    }, null, 8, ["border-style"])
                  ])
                ])) : createCommentVNode("v-if", true)
              ],
              64
              /* STABLE_FRAGMENT */
            );
          }),
          128
          /* KEYED_FRAGMENT */
        )),
        hasMore.value ? (openBlock(), createElementBlock(
          Fragment,
          { key: 0 },
          [
            createElementVNode("div", _hoisted_4, [
              renderSlot(_ctx.$slots, "separator", {
                index: visibleData.value.length
              }, () => [
                createVNode(unref(ElDivider), {
                  direction: "vertical",
                  "border-style": __props.borderStyle
                }, null, 8, ["border-style"])
              ])
            ]),
            createVNode(unref(ElPopover), mergeProps({ placement: __props.popoverPlacement }, _ctx.$attrs), {
              reference: withCtx(() => [
                createElementVNode("span", _hoisted_5, [
                  renderSlot(_ctx.$slots, "suffix", {}, () => [
                    _cache[0] || (_cache[0] = createTextVNode(
                      "...",
                      -1
                      /* CACHED */
                    ))
                  ])
                ])
              ]),
              default: withCtx(() => [
                createElementVNode("div", _hoisted_6, [
                  (openBlock(true), createElementBlock(
                    Fragment,
                    null,
                    renderList(__props.data, (item, index) => {
                      return openBlock(), createElementBlock("div", {
                        key: index,
                        class: "popover-list-item"
                      }, [
                        renderSlot(_ctx.$slots, "popover-item", {
                          item,
                          index
                        }, () => [
                          createTextVNode(
                            toDisplayString(item),
                            1
                            /* TEXT */
                          )
                        ])
                      ]);
                    }),
                    128
                    /* KEYED_FRAGMENT */
                  ))
                ])
              ]),
              _: 3
              /* FORWARDED */
            }, 16, ["placement"])
          ],
          64
          /* STABLE_FRAGMENT */
        )) : createCommentVNode("v-if", true)
      ]);
    };
  }
});

export { script as default };
//# sourceMappingURL=text-separator.vue2.mjs.map
