import { _ as __nuxt_component_49 } from './MainLoader-BFnVrwHB.mjs';
import { u as useI18n, c as useHead, g as useRoute, l as useAsyncData, r as refreshNuxtData, f as useRuntimeConfig, j as _sfc_main$3$1, h as useRouter, i as useLocalePath, k as __nuxt_component_0$2, _ as _sfc_main$g } from './server.mjs';
import { _ as _sfc_main$4 } from './BlogWhatsHappening-Cce5xsjg.mjs';
import { ref, withAsyncContext, watch, unref, withCtx, createVNode, toDisplayString, useSSRContext, mergeProps, createTextVNode } from 'vue';
import { ssrRenderAttrs, ssrRenderComponent, ssrInterpolate, ssrRenderList, ssrRenderAttr, ssrRenderClass } from 'vue/server-renderer';
import { _ as _sfc_main$5 } from './GeneralPagination-CkoRkEli.mjs';
import { u as useAPIFetch } from './useAPIFetch-Bdd4OwYk.mjs';
import '../_/nitro.mjs';
import 'node:http';
import 'node:https';
import 'node:fs';
import 'node:url';
import 'ipx';
import 'node:path';
import 'unhead';
import '@unhead/shared';
import 'vue-router';
import 'vue-social-sharing';
import 'axios';
import '@headlessui/vue';
import 'yup';
import 'vue3-carousel/dist/carousel';
import './BlogCard-z4kvdhKV.mjs';
import '@hennge/vue3-pagination';

const _sfc_main$3 = {
  __name: "BlogCardVertical",
  __ssrInlineRender: true,
  props: {
    item: {
      required: true
    }
  },
  setup(__props) {
    const localePath = useLocalePath();
    return (_ctx, _push, _parent, _attrs) => {
      var _a;
      const _component_nuxt_link = __nuxt_component_0$2;
      const _component_nuxt_img = _sfc_main$g;
      _push(`<div${ssrRenderAttrs(mergeProps({ class: "p-3 grid gap-3 grid-cols-3 bg-[#F9F9F9] rounded-xl" }, _attrs))}>`);
      _push(ssrRenderComponent(_component_nuxt_link, {
        to: unref(localePath)(`/articles/${__props.item.slug}`),
        class: "col-span-3 lg:h-[170px] lg:col-span-1"
      }, {
        default: withCtx((_, _push2, _parent2, _scopeId) => {
          if (_push2) {
            _push2(ssrRenderComponent(_component_nuxt_img, {
              format: "webp",
              width: "300",
              class: "w-full h-full rounded-xl object-cover",
              height: "300",
              src: __props.item.image,
              srcset: `${__props.item.image} 480w, ${__props.item.image} 1080w`,
              alt: "",
              loading: "lazy"
            }, null, _parent2, _scopeId));
          } else {
            return [
              createVNode(_component_nuxt_img, {
                format: "webp",
                width: "300",
                class: "w-full h-full rounded-xl object-cover",
                height: "300",
                src: __props.item.image,
                srcset: `${__props.item.image} 480w, ${__props.item.image} 1080w`,
                alt: "",
                loading: "lazy"
              }, null, 8, ["src", "srcset"])
            ];
          }
        }),
        _: 1
      }, _parent));
      _push(`<div class="col-span-3 lg:col-span-2"><div class="flex gap-2 py-2 text-primary text-sm"><p><i class="fas fa-calendar"></i> ${ssrInterpolate(__props.item.published_at)}</p><p><i class="fas fa-eye"></i> ${ssrInterpolate(__props.item.views)}</p></div><div>`);
      _push(ssrRenderComponent(_component_nuxt_link, {
        to: unref(localePath)(`/articles/${__props.item.slug}`),
        class: "line-clamp-1 text-text font-bold text-lg mb-3"
      }, {
        default: withCtx((_, _push2, _parent2, _scopeId) => {
          if (_push2) {
            _push2(`${ssrInterpolate(__props.item.title)}`);
          } else {
            return [
              createTextVNode(toDisplayString(__props.item.title), 1)
            ];
          }
        }),
        _: 1
      }, _parent));
      _push(`<div class="line-clamp-2 overflow-hidden mb-3">${(_a = __props.item.description.replace(/<[^>]*>/g, "")) != null ? _a : ""}</div></div><div class="flex items-center justify-end mt-2">`);
      _push(ssrRenderComponent(_component_nuxt_link, {
        class: "text-primary flex items-center text-sm font-medium gap-1",
        to: unref(localePath)(`/articles/${__props.item.slug}`)
      }, {
        default: withCtx((_, _push2, _parent2, _scopeId) => {
          if (_push2) {
            _push2(`${ssrInterpolate(_ctx.$t("BUTTONS.viewDetails"))} <i class="${ssrRenderClass(
              _ctx.$i18n.locale == "en" ? "fas fa-arrow-right" : "fas fa-arrow-left"
            )}"${_scopeId}></i>`);
          } else {
            return [
              createTextVNode(toDisplayString(_ctx.$t("BUTTONS.viewDetails")) + " ", 1),
              createVNode("i", {
                class: _ctx.$i18n.locale == "en" ? "fas fa-arrow-right" : "fas fa-arrow-left"
              }, null, 2)
            ];
          }
        }),
        _: 1
      }, _parent));
      _push(`</div></div></div>`);
    };
  }
};
const _sfc_setup$3 = _sfc_main$3.setup;
_sfc_main$3.setup = (props, ctx) => {
  const ssrContext = useSSRContext();
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("components/blog/card/BlogCardVertical.vue");
  return _sfc_setup$3 ? _sfc_setup$3(props, ctx) : void 0;
};
const _sfc_main$2 = {
  __name: "BlogContent",
  __ssrInlineRender: true,
  props: {
    item: {
      required: true
    }
  },
  setup(__props) {
    return (_ctx, _push, _parent, _attrs) => {
      const _component_blog_card_vertical = _sfc_main$3;
      _push(`<div${ssrRenderAttrs(mergeProps({ class: "space-y-5" }, _attrs))}><!--[-->`);
      ssrRenderList(__props.item, (content) => {
        _push(ssrRenderComponent(_component_blog_card_vertical, {
          item: content,
          key: content.id
        }, null, _parent));
      });
      _push(`<!--]--></div>`);
    };
  }
};
const _sfc_setup$2 = _sfc_main$2.setup;
_sfc_main$2.setup = (props, ctx) => {
  const ssrContext = useSSRContext();
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("components/blog/BlogContent.vue");
  return _sfc_setup$2 ? _sfc_setup$2(props, ctx) : void 0;
};
const _sfc_main$1 = {
  __name: "BlogFilter",
  __ssrInlineRender: true,
  props: {
    item: {
      required: true
    }
  },
  setup(__props) {
    useRouter();
    const route = useRoute();
    const search = ref(route.query.search || "");
    const tabText = ref(route.query.key || "all");
    return (_ctx, _push, _parent, _attrs) => {
      _push(`<div${ssrRenderAttrs(_attrs)}><div class="input_wrapper icon relative"><i class="fa-solid fa-magnifying-glass 2"></i><label class="d-none" for="searchh"></label><input class="ps-5" id="searchh" type="text"${ssrRenderAttr("value", unref(search))}${ssrRenderAttr("placeholder", _ctx.$t("FORMS.Placeholders.searchBlog"))}></div><ul class="categories"><li><button type="button" class="${ssrRenderClass({
        active: unref(tabText) === "all"
      })}">${ssrInterpolate(_ctx.$t("TITLES.all"))}</button></li><!--[-->`);
      ssrRenderList(__props.item, (cat) => {
        _push(`<li><button type="button" class="${ssrRenderClass({
          active: unref(tabText) === cat.type_key
        })}">${ssrInterpolate(cat.type)}</button></li>`);
      });
      _push(`<!--]--></ul></div>`);
    };
  }
};
const _sfc_setup$1 = _sfc_main$1.setup;
_sfc_main$1.setup = (props, ctx) => {
  const ssrContext = useSSRContext();
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("components/blog/BlogFilter.vue");
  return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0;
};
const _sfc_main = {
  __name: "index",
  __ssrInlineRender: true,
  async setup(__props) {
    let __temp, __restore;
    const { t, locale } = useI18n();
    useHead({
      title: t("NAV.blog")
    });
    const config = useRuntimeConfig();
    const route = useRoute();
    const blogs = ref(null);
    const pagination = ref(null);
    const loading = ref(true);
    const notFound = ref(false);
    const { data: pageData } = useAPIFetch(`blog`, {
      lazy: true,
      server: false,
      cache: "no-cache"
    });
    [__temp, __restore] = withAsyncContext(() => useAsyncData(`blog_second_section`, () => {
      var _a, _b;
      $fetch(`blog_second_section`, {
        method: "GET",
        baseURL: config.public.baseURL,
        headers: {
          "Accept-Language": locale.value
        },
        params: {
          page: (_a = route.query.page) != null ? _a : 1,
          key: route.query.key ? route.query.key == "all" ? "" : route.query.key : "",
          search: (_b = route.query.search) != null ? _b : ""
        }
      }).then((res) => {
        blogs.value = res.data;
        pagination.value = {
          page: res.meta.current_page,
          per_page: res.meta.per_page,
          pages: res.meta.last_page,
          total: res.meta.last_page
        };
        loading.value = false;
      }).catch((err) => {
        if (err.response.status == 404) {
          notFound.value = true;
        }
        loading.value = false;
      });
    })), await __temp, __restore();
    watch(
      () => route.query,
      (newVal) => {
        if (newVal) {
          const section = (void 0).getElementById("blog_section_content");
          refreshNuxtData();
          section.scrollIntoView({ behavior: "smooth" });
        }
      }
    );
    return (_ctx, _push, _parent, _attrs) => {
      const _component_MainLoader = __nuxt_component_49;
      const _component_NotFound = _sfc_main$3$1;
      const _component_blog_whats_happening = _sfc_main$4;
      const _component_blog_content = _sfc_main$2;
      const _component_blog_filter = _sfc_main$1;
      const _component_general_pagination = _sfc_main$5;
      _push(`<div${ssrRenderAttrs(_attrs)}>`);
      if (unref(loading)) {
        _push(ssrRenderComponent(_component_MainLoader, null, null, _parent));
      } else {
        _push(`<!---->`);
      }
      if (unref(notFound)) {
        _push(ssrRenderComponent(_component_NotFound, null, null, _parent));
      } else {
        _push(`<!---->`);
      }
      if (unref(pageData)) {
        _push(ssrRenderComponent(_component_blog_whats_happening, {
          items: unref(pageData).data.first_blogs
        }, {
          header: withCtx((_, _push2, _parent2, _scopeId) => {
            if (_push2) {
              _push2(`<p class="text-primary mb-2 font-semibold"${_scopeId}>${ssrInterpolate(_ctx.$t("Subtitle.SomeBlogsSection"))}</p><h2 class="text-4xl md:text-5xl text-text font-bold mb-7"${_scopeId}>${ssrInterpolate(_ctx.$t("TITLES.whatHappend"))}</h2>`);
            } else {
              return [
                createVNode("p", { class: "text-primary mb-2 font-semibold" }, toDisplayString(_ctx.$t("Subtitle.SomeBlogsSection")), 1),
                createVNode("h2", { class: "text-4xl md:text-5xl text-text font-bold mb-7" }, toDisplayString(_ctx.$t("TITLES.whatHappend")), 1)
              ];
            }
          }),
          _: 1
        }, _parent));
      } else {
        _push(`<!---->`);
      }
      _push(`<div class="container mt-11" id="blog_section_content"><h2 class="text-4xl md:text-5xl text-text font-bold mb-7">${ssrInterpolate(_ctx.$t("TITLES.readMore"))}</h2><div class="grid grid-cols-3 gap-3"><div class="col-span-3 md:col-span-2 order-2 md:order-1">`);
      if (unref(blogs)) {
        _push(ssrRenderComponent(_component_blog_content, { item: unref(blogs) }, null, _parent));
      } else {
        _push(`<!---->`);
      }
      _push(`</div><div class="col-span-3 md:col-span-1 order-1 md:order-2">`);
      if (unref(pageData)) {
        _push(ssrRenderComponent(_component_blog_filter, {
          item: unref(pageData).data.categories
        }, null, _parent));
      } else {
        _push(`<!---->`);
      }
      _push(`</div></div>`);
      if (unref(pagination)) {
        _push(ssrRenderComponent(_component_general_pagination, { pagination: unref(pagination) }, null, _parent));
      } else {
        _push(`<!---->`);
      }
      _push(`</div></div>`);
    };
  }
};
const _sfc_setup = _sfc_main.setup;
_sfc_main.setup = (props, ctx) => {
  const ssrContext = useSSRContext();
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("pages/articles/index.vue");
  return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};

export { _sfc_main as default };
//# sourceMappingURL=index-DCTuyU5M.mjs.map
