import { defineComponent as i, computed as f, ref as g, onMounted as _, nextTick as w, resolveComponent as t, createBlock as l, openBlock as r, withCtx as n, createElementBlock as y, Fragment as h, renderList as k, createElementVNode as C } from "vue";
import { register as b } from "swiper/element/bundle";
import { nanoid as u } from "nanoid";
import { upgradeCarousel as x } from "./version.mjs";
import { useWatch as B } from "./hooks/useWatch.mjs";
const E = ["src"], L = i({ name: "ShjCarousel" }), F = /* @__PURE__ */ i({
  ...L,
  props: {
    option: {},
    sources: {},
    useEvents: {}
  },
  setup(a, { expose: c }) {
    b();
    const e = f(() => x(a.option)), s = g(u()), o = () => {
      s.value = u();
    };
    return _(() => {
      w(() => {
        o();
      });
    }), B({ option: e.value, sources: a.sources }, o), c({
      refresh: () => o(),
      refreshView: () => o(),
      refreshData: () => o()
    }), (M, V) => {
      const p = t("swiper-slide"), d = t("swiper-container");
      return r(), l(d, {
        key: s.value,
        class: "carousel",
        direction: e.value.carousel.direction,
        speed: e.value.carousel.speed,
        "round-lengths": e.value.carousel.roundLengths,
        "grab-cursor": e.value.carousel.grabCursor,
        rewind: e.value.carousel.rewind,
        loop: e.value.carousel.loop,
        "slides-per-view": e.value.carousel.slidesPerView,
        "space-between": e.value.carousel.spaceBetween,
        autoplay: e.value.carousel.autoplay,
        delay: e.value.carousel.delay,
        "stop-on-last-slide": e.value.carousel.stopOnLastSlide,
        "reverse-direction": e.value.carousel.reverseDirection,
        "pause-on-mouse-enter": e.value.carousel.pauseOnMouseEnter,
        "free-mode": e.value.carousel.freeMode,
        effect: e.value.carousel.effect,
        pagination: e.value.carousel.pagination,
        "pagination-type": e.value.carousel.paginationType
      }, {
        default: n(() => [
          (r(!0), y(h, null, k(e.value.carousel.photoGallery, (v, m) => (r(), l(p, { key: m }, {
            default: n(() => [
              C("img", {
                class: "image",
                src: v.url,
                alt: ""
              }, null, 8, E)
            ]),
            _: 2
          }, 1024))), 128))
        ]),
        _: 1
      }, 8, ["direction", "speed", "round-lengths", "grab-cursor", "rewind", "loop", "slides-per-view", "space-between", "autoplay", "delay", "stop-on-last-slide", "reverse-direction", "pause-on-mouse-enter", "free-mode", "effect", "pagination", "pagination-type"]);
    };
  }
});
export {
  F as default
};
