"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const index$1 = require("../../../hooks/use-locale/index.js");
const index = require("../../../hooks/use-namespace/index.js");
const index$2 = require("../../icon/index.js");
const carousel = require("./carousel.js");
const useCarousel = require("./use-carousel.js");
const index$3 = require("../../../../../@element-plus/icons-vue/dist/index.js");
const Vue = require("vue");
const _hoisted_1 = ["aria-label"];
const _hoisted_2 = ["aria-label"];
const _hoisted_3 = ["onMouseenter", "onClick"];
const _hoisted_4 = ["aria-label"];
const _hoisted_5 = { key: 0 };
const _hoisted_6 = {
  key: 2,
  xmlns: "http://www.w3.org/2000/svg",
  version: "1.1",
  style: { "display": "none" }
};
const COMPONENT_NAME = "ElCarousel";
var carousel_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ Vue.defineComponent({
  name: COMPONENT_NAME,
  __name: "carousel",
  props: carousel.carouselProps,
  emits: carousel.carouselEmits,
  setup(__props, { expose: __expose, emit: __emit }) {
    const props = __props;
    const { root, activeIndex, exposeActiveIndex, arrowDisplay, hasLabel, hover, isCardType, items, isVertical, containerStyle, handleButtonEnter, handleButtonLeave, handleIndicatorClick, handleMouseEnter, handleMouseLeave, setActiveItem, prev, next, PlaceholderItem, isTwoLengthShow, ItemsSorter, throttledArrowClick, throttledIndicatorHover } = useCarousel.useCarousel(props, __emit, COMPONENT_NAME);
    const ns = index.useNamespace("carousel");
    const { t } = index$1.useLocale();
    const carouselClasses = Vue.computed(() => {
      const classes = [ns.b(), ns.m(props.direction)];
      if (Vue.unref(isCardType)) classes.push(ns.m("card"));
      classes.push(ns.is("vertical-outside", Vue.unref(isVertical) && props.indicatorPosition === "outside"));
      return classes;
    });
    const indicatorsClasses = Vue.computed(() => {
      const classes = [ns.e("indicators"), ns.em("indicators", props.direction)];
      if (Vue.unref(hasLabel)) classes.push(ns.em("indicators", "labels"));
      if (props.indicatorPosition === "outside") classes.push(ns.em("indicators", "outside"));
      if (Vue.unref(isVertical)) classes.push(ns.em("indicators", "right"));
      return classes;
    });
    function handleTransitionStart(e) {
      if (!props.motionBlur) return;
      const kls = Vue.unref(isVertical) ? `${ns.namespace.value}-transitioning-vertical` : `${ns.namespace.value}-transitioning`;
      e.currentTarget.classList.add(kls);
    }
    function handleTransitionEnd(e) {
      if (!props.motionBlur) return;
      const kls = Vue.unref(isVertical) ? `${ns.namespace.value}-transitioning-vertical` : `${ns.namespace.value}-transitioning`;
      e.currentTarget.classList.remove(kls);
    }
    __expose({
      activeIndex: exposeActiveIndex,
      setActiveItem,
      prev,
      next
    });
    return (_ctx, _cache) => {
      return Vue.openBlock(), Vue.createElementBlock("div", {
        ref_key: "root",
        ref: root,
        class: Vue.normalizeClass(carouselClasses.value),
        onMouseenter: _cache[6] || (_cache[6] = Vue.withModifiers((...args) => Vue.unref(handleMouseEnter) && Vue.unref(handleMouseEnter)(...args), ["stop"])),
        onMouseleave: _cache[7] || (_cache[7] = Vue.withModifiers((...args) => Vue.unref(handleMouseLeave) && Vue.unref(handleMouseLeave)(...args), ["stop"]))
      }, [
        Vue.unref(arrowDisplay) ? (Vue.openBlock(), Vue.createBlock(Vue.Transition, {
          key: 0,
          name: "carousel-arrow-left",
          persisted: ""
        }, {
          default: Vue.withCtx(() => [Vue.withDirectives(Vue.createElementVNode("button", {
            type: "button",
            class: Vue.normalizeClass([Vue.unref(ns).e("arrow"), Vue.unref(ns).em("arrow", "left")]),
            "aria-label": Vue.unref(t)("el.carousel.leftArrow"),
            onMouseenter: _cache[0] || (_cache[0] = ($event) => Vue.unref(handleButtonEnter)("left")),
            onMouseleave: _cache[1] || (_cache[1] = (...args) => Vue.unref(handleButtonLeave) && Vue.unref(handleButtonLeave)(...args)),
            onClick: _cache[2] || (_cache[2] = Vue.withModifiers(($event) => Vue.unref(throttledArrowClick)(Vue.unref(activeIndex) - 1), ["stop"]))
          }, [Vue.createVNode(Vue.unref(index$2.ElIcon), null, {
            default: Vue.withCtx(() => [Vue.createVNode(Vue.unref(index$3.ArrowLeft))]),
            _: 1
          })], 42, _hoisted_1), [[Vue.vShow, (__props.arrow === "always" || Vue.unref(hover)) && (__props.loop || Vue.unref(activeIndex) > 0)]])]),
          _: 1
        })) : Vue.createCommentVNode("v-if", true),
        Vue.unref(arrowDisplay) ? (Vue.openBlock(), Vue.createBlock(Vue.Transition, {
          key: 1,
          name: "carousel-arrow-right",
          persisted: ""
        }, {
          default: Vue.withCtx(() => [Vue.withDirectives(Vue.createElementVNode("button", {
            type: "button",
            class: Vue.normalizeClass([Vue.unref(ns).e("arrow"), Vue.unref(ns).em("arrow", "right")]),
            "aria-label": Vue.unref(t)("el.carousel.rightArrow"),
            onMouseenter: _cache[3] || (_cache[3] = ($event) => Vue.unref(handleButtonEnter)("right")),
            onMouseleave: _cache[4] || (_cache[4] = (...args) => Vue.unref(handleButtonLeave) && Vue.unref(handleButtonLeave)(...args)),
            onClick: _cache[5] || (_cache[5] = Vue.withModifiers(($event) => Vue.unref(throttledArrowClick)(Vue.unref(activeIndex) + 1), ["stop"]))
          }, [Vue.createVNode(Vue.unref(index$2.ElIcon), null, {
            default: Vue.withCtx(() => [Vue.createVNode(Vue.unref(index$3.ArrowRight))]),
            _: 1
          })], 42, _hoisted_2), [[Vue.vShow, (__props.arrow === "always" || Vue.unref(hover)) && (__props.loop || Vue.unref(activeIndex) < Vue.unref(items).length - 1)]])]),
          _: 1
        })) : Vue.createCommentVNode("v-if", true),
        Vue.createElementVNode("div", {
          class: Vue.normalizeClass(Vue.unref(ns).e("container")),
          style: Vue.normalizeStyle(Vue.unref(containerStyle)),
          onTransitionstart: handleTransitionStart,
          onTransitionend: handleTransitionEnd
        }, [Vue.createVNode(Vue.unref(PlaceholderItem)), Vue.renderSlot(_ctx.$slots, "default")], 38),
        Vue.createVNode(Vue.unref(ItemsSorter), null, {
          default: Vue.withCtx(() => [__props.indicatorPosition !== "none" ? (Vue.openBlock(), Vue.createElementBlock("ul", {
            key: 0,
            class: Vue.normalizeClass(indicatorsClasses.value)
          }, [(Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(Vue.unref(items), (item, index2) => {
            return Vue.withDirectives((Vue.openBlock(), Vue.createElementBlock("li", {
              key: index2,
              class: Vue.normalizeClass([
                Vue.unref(ns).e("indicator"),
                Vue.unref(ns).em("indicator", __props.direction),
                Vue.unref(ns).is("active", index2 === Vue.unref(activeIndex))
              ]),
              onMouseenter: ($event) => Vue.unref(throttledIndicatorHover)(index2),
              onClick: Vue.withModifiers(($event) => Vue.unref(handleIndicatorClick)(index2), ["stop"])
            }, [Vue.createElementVNode("button", {
              class: Vue.normalizeClass(Vue.unref(ns).e("button")),
              "aria-label": Vue.unref(t)("el.carousel.indicator", { index: index2 + 1 })
            }, [Vue.unref(hasLabel) ? (Vue.openBlock(), Vue.createElementBlock("span", _hoisted_5, Vue.toDisplayString(item.props.label), 1)) : Vue.createCommentVNode("v-if", true)], 10, _hoisted_4)], 42, _hoisted_3)), [[Vue.vShow, Vue.unref(isTwoLengthShow)(index2)]]);
          }), 128))], 2)) : Vue.createCommentVNode("v-if", true)]),
          _: 1
        }),
        __props.motionBlur ? (Vue.openBlock(), Vue.createElementBlock("svg", _hoisted_6, [..._cache[8] || (_cache[8] = [Vue.createElementVNode("defs", null, [Vue.createElementVNode("filter", { id: "elCarouselHorizontal" }, [Vue.createElementVNode("feGaussianBlur", {
          in: "SourceGraphic",
          stdDeviation: "12,0"
        })]), Vue.createElementVNode("filter", { id: "elCarouselVertical" }, [Vue.createElementVNode("feGaussianBlur", {
          in: "SourceGraphic",
          stdDeviation: "0,10"
        })])], -1)])])) : Vue.createCommentVNode("v-if", true)
      ], 34);
    };
  }
});
exports.default = carousel_vue_vue_type_script_setup_true_lang_default;
