import { defineComponent as i, computed as f, ref as v, onMounted as _, resolveComponent as t, createBlock as l, openBlock as r, withCtx as n, createElementBlock as w, Fragment as g, renderList as y, createElementVNode as h } from "vue";
import { register as k } from "swiper/element/bundle";
import { upgradeIframeCarousel as x } from "./version.mjs";
import { useWatch as b } from "./hooks/useWatch.mjs";
import { nanoid as u } from "nanoid";
import { nextTick as C } from "process";
const B = ["src"], E = i({ name: "ShjIframeCarousel" }), F = /* @__PURE__ */ i({
  ...E,
  props: {
    option: {}
  },
  setup(c, { expose: p }) {
    k();
    const e = f(() => x(c.option)), a = v(u()), o = () => {
      a.value = u();
    };
    return _(() => {
      C(() => {
        o();
      });
    }), b({ option: e.value, sources: [] }, o), p({
      refresh: () => o(),
      refreshView: () => o(),
      refreshData: () => o()
    }), (L, M) => {
      const d = t("swiper-slide"), m = t("swiper-container");
      return r(), l(m, {
        key: a.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), w(g, null, y(e.value.carousel.iframes, (s, V) => (r(), l(d, { key: s }, {
            default: n(() => [
              h("iframe", {
                src: s.url,
                class: "iframe-slide",
                sandbox: "allow-scripts allow-same-origin"
              }, null, 8, B)
            ]),
            _: 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
};
