import { e as buildAssetsURL } from '../_/nitro.mjs';
import { d } from './Skeleton-BBJiWBrY.mjs';
import { mergeProps, ref, watch, unref, useSSRContext, withCtx, createVNode, toDisplayString, openBlock, createBlock, Fragment, renderList } from 'vue';
import { ssrRenderAttrs, ssrRenderComponent, ssrRenderList, ssrInterpolate, ssrIncludeBooleanAttr, ssrRenderAttr } from 'vue/server-renderer';
import { d as uf, a as Qt, b as Qs, f as au, g as $a, h as Ma, i as wn, _ as An } from './server.mjs';
import { d as d$1 } from './breadcrumb-gjE702oE.mjs';
import { h, B as B$1, I } from './Cash-DnR6pEke.mjs';
import { g } from './SvgIcon-BAPcdaJk.mjs';
import { $ } from './ProductCard-D5uurgVG.mjs';
import { h as he, A as A$1, z as z$1, g as ge } from './swiper-vue-DHAv4051.mjs';
import { a } from './NoData-sJRPgl_N.mjs';
import { A } from './visa-YBBZ6mho.mjs';
import 'node:http';
import 'node:https';
import 'node:fs';
import 'node:url';
import 'node:path';
import 'unhead';
import '@unhead/shared';
import 'vue-router';
import 'vue-rate';
import 'date-fns';
import '@hennge/vue3-pagination';
import 'axios';
import 'vue-social-sharing';
import './star-mqjJGHgV.mjs';

const q = {};
const D = q.setup;
q.setup = (e2, s2) => {
  const a2 = useSSRContext();
  return (a2.modules || (a2.modules = /* @__PURE__ */ new Set())).add("components/Shared/CartSkelton.vue"), D ? D(e2, s2) : undefined;
};
const Y = uf(q, [["ssrRender", function(t2, a2, l2, d2) {
  const o2 = d;
  a2(`<div${ssrRenderAttrs(mergeProps({ class: "space-y-10" }, d2))}>`), a2(ssrRenderComponent(o2, { class: "h-[16px] w-[120px]" }, null, l2)), a2(ssrRenderComponent(o2, { class: "h-[24px] w-[160px] mb-4" }, null, l2)), a2('<div class="grid grid-cols-1 lg:grid-cols-12 gap-10"><div class="space-y-4 lg:col-span-8"><!--[-->'), ssrRenderList(4, (e2) => {
    a2('<div class="flex items-start gap-4">'), a2(ssrRenderComponent(o2, { class: "h-[100px] w-[80px] rounded-md" }, null, l2)), a2('<div class="flex-1 space-y-2">'), a2(ssrRenderComponent(o2, { class: "h-[14px] w-[60%]" }, null, l2)), a2(ssrRenderComponent(o2, { class: "h-[14px] w-[40%]" }, null, l2)), a2(ssrRenderComponent(o2, { class: "h-[14px] w-[30%]" }, null, l2)), a2('</div><div class="flex flex-col items-center space-y-2">'), a2(ssrRenderComponent(o2, { class: "h-[32px] w-[80px] rounded" }, null, l2)), a2(ssrRenderComponent(o2, { class: "h-[24px] w-[24px] rounded-full" }, null, l2)), a2("</div></div>");
  }), a2('<!--]--></div><div class="space-y-6 lg:col-span-4"><div class="bg-[#F9F9F9] p-4 h-fit rounded-md space-y-3">'), a2(ssrRenderComponent(o2, { class: "h-[20px] w-[100px]" }, null, l2)), a2(ssrRenderComponent(o2, { class: "h-[14px] w-[80%]" }, null, l2)), a2(ssrRenderComponent(o2, { class: "h-[14px] w-[80%]" }, null, l2)), a2(ssrRenderComponent(o2, { class: "h-[14px] w-[80%]" }, null, l2)), a2(ssrRenderComponent(o2, { class: "h-[14px] w-[80%]" }, null, l2)), a2(ssrRenderComponent(o2, { class: "h-[14px] w-[80%]" }, null, l2)), a2(ssrRenderComponent(o2, { class: "h-[14px] w-[80%]" }, null, l2)), a2(ssrRenderComponent(o2, { class: "h-[40px] w-full rounded-md" }, null, l2)), a2('</div><div class="space-y-2 bg-[#F9F9F9] p-4">'), a2(ssrRenderComponent(o2, { class: "h-[20px] w-[150px]" }, null, l2)), a2('<div class="flex gap-2"><!--[-->'), ssrRenderList(3, (e2) => {
    a2(ssrRenderComponent(o2, { class: "h-[32px] w-[112px] rounded-md", key: e2 }, null, l2));
  }), a2('<!--]--></div></div></div></div><div class="space-y-4">'), a2(ssrRenderComponent(o2, { class: "h-[20px] w-[200px]" }, null, l2)), a2('<div class="flex justify-between gap-4 overflow-x-auto"><!--[-->'), ssrRenderList(5, (e2) => {
    a2('<div class="w-[300px] space-y-2">'), a2(ssrRenderComponent(o2, { class: "h-[180px] w-full rounded-md" }, null, l2)), a2(ssrRenderComponent(o2, { class: "h-[14px] w-[60px]" }, null, l2)), a2(ssrRenderComponent(o2, { class: "h-[16px] w-[90%]" }, null, l2)), a2(ssrRenderComponent(o2, { class: "h-[14px] w-[40%]" }, null, l2)), a2(ssrRenderComponent(o2, { class: "h-[14px] w-[80%]" }, null, l2)), a2(ssrRenderComponent(o2, { class: "h-[24px] w-[24px] rounded-full ms-auto" }, null, l2)), a2("</div>");
  }), a2("<!--]--></div></div></div>");
}]]), O = "" + buildAssetsURL("cart-empty.ChzVmTJz.png"), M = { __name: "Cart", __ssrInlineRender: true, props: { data: { type: Object, required: true }, selectedProducts: { type: Array, required: false, default: () => [] } }, emits: ["updateCart", "updateCartWithSelected"], setup(e2, { emit: t2 }) {
  const s2 = e2, c2 = ref(s2.selectedProducts || []);
  watch(() => s2.selectedProducts, (e3) => {
    c2.value = e3 || [];
  }, { deep: true });
  const n2 = (e3) => {
    const t3 = c2.value.indexOf(e3);
    -1 !== t3 ? c2.value.splice(t3, 1) : c2.value.push(e3), p2("updateCartWithSelected", c2.value);
  }, p2 = t2;
  return (t3, s3, a2, l2) => {
    var p3, u2, b2;
    const w2 = I, y2 = An;
    s3(`<div${ssrRenderAttrs(l2)}><div class="flex font-bold text-xl sm:text-2xl mb-10 items-center gap-4 justify-between"><h2>${ssrInterpolate(t3.$t("TITLES.added_products"))}</h2><span>(${ssrInterpolate(e2.data.count_of_cart)})</span></div>`), (null == (u2 = null == (p3 = e2.data.data) ? undefined : p3.items) ? undefined : u2.length) ? (s3('<div class="flex flex-col gap-10"><!--[-->'), ssrRenderList(null == (b2 = e2.data.data) ? undefined : b2.items, (e3) => {
      s3(ssrRenderComponent(w2, { key: e3.product_cart_id, product: e3, onUpdateCart: (e4) => t3.$emit("updateCart"), onUpdateSelected: n2, selectedProducts: unref(c2) }, null, a2));
    }), s3("<!--]--></div>")) : (s3(`<div class="!min-h-[300px]"><div class="my-2 flex flex-col items-center justify-center gap-2"><img${ssrRenderAttr("src", O)} alt="cart-empty" width="240" height="250" class="w-[240px] h-[250px]"><p class="text-xl my-4 font-bold">${ssrInterpolate(t3.$t("TITLES.yourCartIsEmpty"))}</p><p class="text-base text-center mb-6 text-gray-500">${ssrInterpolate(t3.$t("TITLES.itLooksLikeYouHaveNotAddedAnythingToYourCartYet"))}</p>`), s3(ssrRenderComponent(y2, { to: t3.localePath("/categories") }, { default: withCtx((e3, s4, a3, l3) => {
      if (!s4) return [createVNode("button", { class: "base-btn lg:!text-lg w-[200px] lg:w-[260px] outline-none lg:!h-14 !h-12" }, toDisplayString(t3.$t("TITLES.shopNow")), 1)];
      s4(`<button class="base-btn lg:!text-lg w-[200px] lg:w-[260px] outline-none lg:!h-14 !h-12"${l3}>${ssrInterpolate(t3.$t("TITLES.shopNow"))}</button>`);
    }), _: 1 }, a2)), s3("</div></div>")), s3("</div>");
  };
} }, W = M.setup;
M.setup = (e2, s2) => {
  const a2 = useSSRContext();
  return (a2.modules || (a2.modules = /* @__PURE__ */ new Set())).add("components/Shared/Cart.vue"), W ? W(e2, s2) : undefined;
};
const z = { __name: "ForYou", __ssrInlineRender: true, props: { data: { type: Object, required: true } }, setup: (e2) => (Qs(), (t2, s2, a2, l2) => {
  const i2 = $;
  e2.data ? (s2(`<section${ssrRenderAttrs(l2)}>`), s2(ssrRenderComponent(unref(he), { modules: ["SwiperAutoplay" in t2 ? t2.SwiperAutoplay : unref(A$1), "SwiperFreeMode" in t2 ? t2.SwiperFreeMode : unref(z$1)], "slides-per-view": 1.3, "free-mode": true, "space-between": 24, autoplay: { delay: 5e3, disableOnInteraction: false }, breakpoints: { 0: { slidesPerView: 1.1 }, 576: { slidesPerView: 2 }, 768: { slidesPerView: 3 }, 1024: { slidesPerView: 4 }, 1280: { slidesPerView: 5 } }, class: "mySwiper mb-10" }, { default: withCtx((s3, a3, l3, m2) => {
    if (!a3) return [(openBlock(true), createBlock(Fragment, null, renderList(e2.data, (e3) => (openBlock(), createBlock(unref(ge), { key: e3.id }, { default: withCtx(() => [createVNode(i2, { onAddedToCart: (e4) => t2.$emit("addedToCart"), product: e3 }, null, 8, ["onAddedToCart", "product"])]), _: 2 }, 1024))), 128))];
    a3("<!--[-->"), ssrRenderList(e2.data, (e3) => {
      a3(ssrRenderComponent(unref(ge), { key: e3.id }, { default: withCtx((s4, a4, l4, d2) => {
        if (!a4) return [createVNode(i2, { onAddedToCart: (e4) => t2.$emit("addedToCart"), product: e3 }, null, 8, ["onAddedToCart", "product"])];
        a4(ssrRenderComponent(i2, { onAddedToCart: (e4) => t2.$emit("addedToCart"), product: e3 }, null, l4, d2));
      }), _: 2 }, l3, m2));
    }), a3("<!--]-->");
  }), _: 1 }, a2)), s2("<!---->"), s2("</section>")) : s2("<!---->");
}) }, B = z.setup;
z.setup = (e2, s2) => {
  const a2 = useSSRContext();
  return (a2.modules || (a2.modules = /* @__PURE__ */ new Set())).add("components/Section/ForYou.vue"), B ? B(e2, s2) : undefined;
};
const H = { __name: "cart", __ssrInlineRender: true, setup(e2) {
  const t2 = Qt().$axios, { t: s2 } = Qs();
  au();
  const o2 = $a(), r2 = Ma(), i2 = ref([{ name: s2("NAV.home"), to: "/" }, { name: s2("NAV.cart"), to: "/cart" }]), c2 = ref([]), n2 = ref(new URLSearchParams()), { data: p2, status: u2, refresh: v2 } = wn("cart", () => t2.get("cart", { params: n2.value }).then((e3) => e3.data).catch((e3) => e3.response.data));
  watch(() => p2.value, () => {
    var e3, t3, s3, a2, l2;
    (null == (t3 = null == (e3 = p2.value.data) ? undefined : e3.items) ? undefined : t3.length) && !r2.query.selected && (c2.value = (null == (l2 = null == (a2 = null == (s3 = p2.value) ? undefined : s3.data) ? undefined : a2.items) ? undefined : l2.map((e4) => e4.product_cart_id)) || []);
  }, { deep: true });
  const w2 = (e3) => {
    if (!e3 || !e3.length) return c2.value = [], n2.value = new URLSearchParams(), g2(), void v2();
    n2.value = new URLSearchParams(), e3.forEach((e4, t3) => {
      n2.value.append(`product_cart_ids[${t3}]`, e4);
    }), c2.value = e3, g2(), v2();
  }, g2 = () => {
    o2.replace({ query: { ...r2.query, selected: c2.value } });
  };
  return (e3, t3, s3, a2) => {
    const l2 = Y, o3 = d$1, r3 = M, n3 = g, g3 = z, y2 = a;
    t3(`<div${ssrRenderAttrs(a2)}>`), "pending" === unref(u2) ? (t3('<div class="container my-10">'), t3(ssrRenderComponent(l2, null, null, s3)), t3("</div>")) : "success" === unref(u2) ? (t3('<div class="my-10">'), t3(ssrRenderComponent(o3, { "data-aos": "fade-right", items: unref(i2), class: "mb-14 container" }, null, s3)), unref(p2) ? (t3('<!--[--><div class="grid container grid-cols-1 lg:grid-cols-12 gap-10"><div data-aos="fade-right" class="lg:col-span-8">'), t3(ssrRenderComponent(r3, { data: unref(p2), onUpdateCart: unref(v2), onUpdateCartWithSelected: w2, selectedProducts: unref(c2) }, null, s3)), t3(`</div><div data-aos="fade-left" class="lg:col-span-4"><div class="bg-[#F9F9F9] px-6 pt-6 mb-10 pb-10"><h3 class="font-bold text-xl sm:text-2xl mb-6">${ssrInterpolate(e3.$t("TITLES.order_summary"))}</h3><div class="border mb-6 border-[#E4E7ED] p-4"><div class="flex font-semibold text-xl mb-4 items-center gap-4 justify-between"><h4>${ssrInterpolate(e3.$t("TITLES.sub_total"))}</h4><div class="font-bold text-xl">${ssrInterpolate(unref(p2).sub_total)} ${ssrInterpolate(e3.$t("TITLES.egp"))}</div></div><div class="flex font-semibold text-xl mb-4 pb-4 border-b-[1.5px] border-dashed border-[#D7D7E0] items-center gap-4 justify-between"><h4>${ssrInterpolate(e3.$t("TITLES.vat_price"))}</h4><div class="font-bold text-xl">${ssrInterpolate(unref(p2).vat_price || 0)} ${ssrInterpolate(e3.$t("TITLES.egp"))}</div></div><div class="flex font-semibold text-xl mb-4 items-center gap-4 justify-between"><h4>${ssrInterpolate(e3.$t("TITLES.total_price"))}</h4><div class="font-bold text-xl">${ssrInterpolate(unref(p2).total_price || 0)} ${ssrInterpolate(e3.$t("TITLES.egp"))}</div></div></div><button${ssrIncludeBooleanAttr(!unref(p2).data) ? " disabled" : ""} class="base-btn block w-full">${ssrInterpolate(e3.$t("TITLES.checkout"))}</button></div><div class="bg-[#F9F9F9] p-6"><h3 class="font-bold text-xl sm:text-2xl mb-6">${ssrInterpolate(e3.$t("TITLES.our_payment_methods"))}</h3><div class="flex items-center justify-center gap-6"><div class="w-[112px] h-[56px] flex items-center justify-center bg-white"><img${ssrRenderAttr("src", h)} alt="mastercard"></div><div class="w-[112px] h-[56px] flex items-center justify-center bg-white"><img${ssrRenderAttr("src", A)} alt="visa"></div><div class="w-[112px] h-[56px] flex items-center justify-center bg-white flex-col"><img${ssrRenderAttr("src", B$1)} alt="Cash" class="mx-auto"><p class="text-[#339966] font-semibold">Cash</p></div></div></div></div></div><div class="my-14 py-14 bg-[#F9FBFE]"><div class="container"><h2 data-aos="fade-up" class="mb-10 flex items-center gap-2 text-center text-xl sm:text-2xl font-semibold animate-fade-in">`), t3(ssrRenderComponent(n3, { name: "like" }, null, s3)), t3(`<span>${ssrInterpolate(e3.$t("TITLES.recommended_products"))}</span></h2>`), t3(ssrRenderComponent(g3, { onAddedToCart: unref(v2), data: unref(p2).recommended_products }, null, s3)), t3('</div></div><div class="container pb-14"><button class="rounded-full bg-white border border-primary flex items-center justify-center w-16 h-16">'), t3(ssrRenderComponent(n3, { name: "arrow-up", class: "scale-75" }, null, s3)), t3("</button></div><!--]-->")) : t3(ssrRenderComponent(y2, { class: "!min-h-[300px]" }, null, s3)), t3("</div>")) : t3("<!---->"), t3("</div>");
  };
} }, J = H.setup;
H.setup = (e2, s2) => {
  const a2 = useSSRContext();
  return (a2.modules || (a2.modules = /* @__PURE__ */ new Set())).add("pages/cart.vue"), J ? J(e2, s2) : undefined;
};

export { H as default };
//# sourceMappingURL=cart-DbAl0eml.mjs.map
