import _sfc_main$1 from './EmptyState-CWK2sm1Q.mjs';
import { a as __nuxt_component_1, _ as _sfc_main$9 } from './TestimonialsCard-en9WoMcd.mjs';
import { _ as __nuxt_component_2$1, a as __nuxt_component_1$1 } from './GradientFullArrowRight-B3gaunpf.mjs';
import { defineComponent, computed, ref, mergeProps, unref, useSSRContext } from 'vue';
import { ssrRenderAttrs, ssrRenderComponent, ssrRenderAttr, ssrRenderList, ssrRenderClass } from 'vue/server-renderer';
import { a as _export_sfc, d as useI18n } from './server.mjs';
import { u as useSwiper } from './useSwiper.client-B39wiisS.mjs';
import '../_/nitro.mjs';
import 'node:http';
import 'node:https';
import 'node:events';
import 'node:buffer';
import 'nitropack/dist/runtime/plugin';
import 'packrup';
import 'consola';
import 'node:fs';
import 'node:url';
import '@iconify/utils';
import 'node:crypto';
import 'ipx';
import 'node:path';
import 'pinia';
import '@pinia/colada';
import 'vue-router';
import '@unhead/schema-org/vue';
import 'deep-pick-omit';
import '@iconify/vue';
import '../routes/renderer.mjs';
import 'vue-bundle-renderer/runtime';
import 'unhead/server';
import 'devalue';
import 'unhead/plugins';
import 'unhead/utils';
import './Skeleton-CRkCoUmX.mjs';
import './utils-H80jjgLf.mjs';
import 'clsx';
import 'tailwind-merge';
import './CardTitle-CK392g0A.mjs';
import './CardDescription-SL_8-N0k.mjs';
import './index-m9AqQ9dr.mjs';
import 'reka-ui';
import 'class-variance-authority';

const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "HorizontalCarouselWithControls",
  __ssrInlineRender: true,
  props: {
    testimonials: {}
  },
  setup(__props) {
    const props = __props;
    const { locale } = useI18n();
    const dir = computed(() => locale.value === "ar" ? "rtl" : "ltr");
    const swiperRef = ref(null);
    const currentSlide = ref(0);
    ref(0);
    const playingId = ref(null);
    const cardResetTokens = ref({});
    ref(0);
    const incResetToken = (id) => {
      const key = String(id);
      cardResetTokens.value[key] = (cardResetTokens.value[key] || 0) + 1;
    };
    const handlePlay = (id) => {
      var _a, _b;
      if (playingId.value !== null && playingId.value !== id) {
        incResetToken(playingId.value);
      }
      playingId.value = id;
      (_b = (_a = swiper.instance.value) == null ? void 0 : _a.autoplay) == null ? void 0 : _b.stop();
    };
    const handlePause = (id) => {
      var _a, _b;
      if (playingId.value === id) {
        playingId.value = null;
      }
      (_b = (_a = swiper.instance.value) == null ? void 0 : _a.autoplay) == null ? void 0 : _b.start();
    };
    props.testimonials ? props.testimonials.length : 0;
    const swiper = useSwiper(swiperRef, {});
    return (_ctx, _push, _parent, _attrs) => {
      const _component_EmptyState = _sfc_main$1;
      const _component_TestimonialsCard = __nuxt_component_1;
      const _component_SkeletonsTestimonialCardSkeleton = _sfc_main$9;
      const _component_SvgGradientFullArrowLeft = __nuxt_component_2$1;
      const _component_SvgGradientFullArrowRight = __nuxt_component_1$1;
      _push(`<div${ssrRenderAttrs(mergeProps({ class: "relative" }, _attrs))} data-v-e9fc413a>`);
      if (_ctx.testimonials && _ctx.testimonials.length === 0) {
        _push(`<div class="container mx-auto flex items-center justify-center" data-v-e9fc413a>`);
        _push(ssrRenderComponent(_component_EmptyState, null, null, _parent));
        _push(`</div>`);
      } else {
        _push(`<div class="min-h-[430.78px]" data-v-e9fc413a>`);
        if (_ctx.testimonials) {
          _push(`<swiper-container${ssrRenderAttr("dir", unref(dir))}${ssrRenderAttr("init", false)} data-v-e9fc413a><!--[-->`);
          ssrRenderList(_ctx.testimonials, (testimonial) => {
            _push(`<swiper-slide data-v-e9fc413a>`);
            _push(ssrRenderComponent(_component_TestimonialsCard, {
              id: testimonial.id,
              "full-name": testimonial.full_name,
              "job-position": testimonial.job_position,
              image: testimonial.image,
              "audio-url": testimonial.audio_url,
              "video-url": testimonial.video_url,
              comment: testimonial.comment,
              "video-reset-token": unref(cardResetTokens)[String(testimonial.id)] || 0,
              "audio-reset-token": unref(cardResetTokens)[String(testimonial.id)] || 0,
              onPlay: ($event) => handlePlay(testimonial.id),
              onPause: ($event) => handlePause(testimonial.id)
            }, null, _parent));
            _push(`</swiper-slide>`);
          });
          _push(`<!--]--></swiper-container>`);
        } else {
          _push(`<swiper-container${ssrRenderAttr("dir", unref(dir))}${ssrRenderAttr("init", false)} data-v-e9fc413a><!--[-->`);
          ssrRenderList(6, (i) => {
            _push(`<swiper-slide data-v-e9fc413a>`);
            _push(ssrRenderComponent(_component_SkeletonsTestimonialCardSkeleton, {
              id: i,
              class: "w-full"
            }, null, _parent));
            _push(`</swiper-slide>`);
          });
          _push(`<!--]--></swiper-container>`);
        }
        _push(`</div>`);
      }
      if (_ctx.testimonials && _ctx.testimonials.length > 0) {
        _push(`<div class="mt-6 flex items-center justify-center gap-6" data-v-e9fc413a><button class="prev-button-latest-models bg-surface-background border-surface-border rounded-ws-rounded flex-shrink-0 cursor-pointer border p-3"${ssrRenderAttr("aria-label", _ctx.$t("ariaLabels.prevBtn"))} data-v-e9fc413a>`);
        _push(ssrRenderComponent(_component_SvgGradientFullArrowLeft, { class: "rtl:scale-x-[-1]" }, null, _parent));
        _push(`</button>`);
        if (_ctx.testimonials) {
          _push(`<div class="custom-pagination-container" data-v-e9fc413a><!--[-->`);
          ssrRenderList(_ctx.testimonials, (testimonial, index) => {
            _push(`<div class="${ssrRenderClass([{ active: unref(currentSlide) === index }, "pagination-dot"])}" data-v-e9fc413a></div>`);
          });
          _push(`<!--]--></div>`);
        } else {
          _push(`<!---->`);
        }
        _push(`<button${ssrRenderAttr("aria-label", _ctx.$t("ariaLabels.nextBtn"))} class="next-button-latest-models bg-surface-background border-surface-border rounded-ws-rounded flex-shrink-0 cursor-pointer border p-3" data-v-e9fc413a>`);
        _push(ssrRenderComponent(_component_SvgGradientFullArrowRight, { class: "rtl:scale-x-[-1]" }, null, _parent));
        _push(`</button></div>`);
      } else {
        _push(`<!---->`);
      }
      _push(`</div>`);
    };
  }
});
const _sfc_setup = _sfc_main.setup;
_sfc_main.setup = (props, ctx) => {
  const ssrContext = useSSRContext();
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("components/global/HorizontalCarouselWithControls.vue");
  return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
const __nuxt_component_2 = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-e9fc413a"]]);

export { __nuxt_component_2 as default };
//# sourceMappingURL=HorizontalCarouselWithControls-BnGcAouy.mjs.map
