import { e as buildAssetsURL } from '../_/nitro.mjs';
import { u } from './Skeleton-Bnk8IDLx.mjs';
import { mergeProps, ref, watch, computed, unref, useSSRContext, withCtx, createVNode, toDisplayString } 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, e as Zt, c as gn, _ as An } from './server.mjs';
import { b } from './breadcrumb-DkL96a0m.mjs';
import { h, S, I } from './Cash-Cj5-adXy.mjs';
import { g } from './SvgIcon-C2791tkm.mjs';
import { $ } from './ProductCard-DemAn2DX.mjs';
import { a } from './NoData-S35t_fLa.mjs';
import { A as A$1 } 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 R = {};
const A = R.setup;
R.setup = (e2, s2) => {
  const l2 = useSSRContext();
  return (l2.modules || (l2.modules = /* @__PURE__ */ new Set())).add("components/Shared/CartSkelton.vue"), A ? A(e2, s2) : undefined;
};
const N = uf(R, [["ssrRender", function(t2, l2, a2, d2) {
  const i2 = u;
  l2(`<div${ssrRenderAttrs(mergeProps({ class: "space-y-10" }, d2))}>`), l2(ssrRenderComponent(i2, { class: "h-[16px] w-[120px]" }, null, a2)), l2(ssrRenderComponent(i2, { class: "h-[24px] w-[160px] mb-4" }, null, a2)), l2('<div class="grid grid-cols-1 lg:grid-cols-12 gap-10"><div class="space-y-4 lg:col-span-8"><!--[-->'), ssrRenderList(4, (e2) => {
    l2('<div class="flex items-start gap-4">'), l2(ssrRenderComponent(i2, { class: "h-[100px] w-[80px]" }, null, a2)), l2('<div class="flex-1 space-y-2">'), l2(ssrRenderComponent(i2, { class: "h-[14px] w-[60%]" }, null, a2)), l2(ssrRenderComponent(i2, { class: "h-[14px] w-[40%]" }, null, a2)), l2(ssrRenderComponent(i2, { class: "h-[14px] w-[30%]" }, null, a2)), l2('</div><div class="flex flex-col items-center space-y-2">'), l2(ssrRenderComponent(i2, { class: "h-[32px] w-[80px] rounded" }, null, a2)), l2(ssrRenderComponent(i2, { class: "h-[24px] w-[24px] rounded-full" }, null, a2)), l2("</div></div>");
  }), l2('<!--]--></div><div class="space-y-6 lg:col-span-4"><div class="bg-[#F9F9F9] p-4 h-fit space-y-3">'), l2(ssrRenderComponent(i2, { class: "h-[20px] w-[100px]" }, null, a2)), l2(ssrRenderComponent(i2, { class: "h-[14px] w-[80%]" }, null, a2)), l2(ssrRenderComponent(i2, { class: "h-[14px] w-[80%]" }, null, a2)), l2(ssrRenderComponent(i2, { class: "h-[14px] w-[80%]" }, null, a2)), l2(ssrRenderComponent(i2, { class: "h-[14px] w-[80%]" }, null, a2)), l2(ssrRenderComponent(i2, { class: "h-[14px] w-[80%]" }, null, a2)), l2(ssrRenderComponent(i2, { class: "h-[14px] w-[80%]" }, null, a2)), l2(ssrRenderComponent(i2, { class: "h-[40px] w-full" }, null, a2)), l2('</div><div class="space-y-2 bg-[#F9F9F9] p-4">'), l2(ssrRenderComponent(i2, { class: "h-[20px] w-[150px]" }, null, a2)), l2('<div class="flex gap-2"><!--[-->'), ssrRenderList(3, (e2) => {
    l2(ssrRenderComponent(i2, { class: "h-[32px] w-[112px]", key: e2 }, null, a2));
  }), l2('<!--]--></div></div></div></div><div class="space-y-4">'), l2(ssrRenderComponent(i2, { class: "h-[20px] w-[200px]" }, null, a2)), l2('<div class="flex justify-between gap-4 overflow-x-auto"><!--[-->'), ssrRenderList(5, (e2) => {
    l2('<div class="w-[300px] space-y-2">'), l2(ssrRenderComponent(i2, { class: "h-[180px] w-full" }, null, a2)), l2(ssrRenderComponent(i2, { class: "h-[14px] w-[60px]" }, null, a2)), l2(ssrRenderComponent(i2, { class: "h-[16px] w-[90%]" }, null, a2)), l2(ssrRenderComponent(i2, { class: "h-[14px] w-[40%]" }, null, a2)), l2(ssrRenderComponent(i2, { class: "h-[14px] w-[80%]" }, null, a2)), l2(ssrRenderComponent(i2, { class: "h-[24px] w-[24px] rounded-full ms-auto" }, null, a2)), l2("</div>");
  }), l2("<!--]--></div></div></div>");
}]]), U = "" + buildAssetsURL("cart-empty.ChzVmTJz.png"), q = { __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 v2 = (e3) => {
    const t3 = c2.value.indexOf(e3);
    -1 !== t3 ? c2.value.splice(t3, 1) : c2.value.push(e3), h2("updateCartWithSelected", c2.value);
  }, h2 = t2;
  return (t3, s3, l2, a2) => {
    var h3, f2, b2;
    const w2 = I, $2 = An;
    s3(`<div${ssrRenderAttrs(a2)}><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 == (f2 = null == (h3 = e2.data.data) ? undefined : h3.items) ? undefined : f2.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: v2, selectedProducts: unref(c2) }, null, l2));
    }), s3("<!--]--></div>")) : (s3(`<div class="!min-h-[320px]"><div class="my-2 flex flex-col items-center justify-center gap-2"><img${ssrRenderAttr("src", U)} 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><div class="flex w-full justify-center items-center gap-4">`), s3(ssrRenderComponent($2, { to: t3.localePath("/categories"), class: "flex-1 lg:flex-none" }, { default: withCtx((e3, s4, l3, a3) => {
      if (!s4) return [createVNode("button", { class: "base-btn w-full lg:w-[220px] !text-sm lg:!text-lg outline-none lg:!h-14 !h-11" }, toDisplayString(t3.$t("TITLES.shopNow")), 1)];
      s4(`<button class="base-btn w-full lg:w-[220px] !text-sm lg:!text-lg outline-none lg:!h-14 !h-11"${a3}>${ssrInterpolate(t3.$t("TITLES.shopNow"))}</button>`);
    }), _: 1 }, l2)), s3(ssrRenderComponent($2, { to: t3.localePath("/auth/login"), class: "flex-1 lg:flex-none" }, { default: withCtx((e3, s4, l3, a3) => {
      if (!s4) return [createVNode("button", { class: "base-btn w-full lg:w-[220px] !text-sm !bg-white !text-primary !border-primary border lg:!text-lg outline-none lg:!h-14 !h-11" }, toDisplayString(t3.$t("TITLES.signInRegister")), 1)];
      s4(`<button class="base-btn w-full lg:w-[220px] !text-sm !bg-white !text-primary !border-primary border lg:!text-lg outline-none lg:!h-14 !h-11"${a3}>${ssrInterpolate(t3.$t("TITLES.signInRegister"))}</button>`);
    }), _: 1 }, l2)), s3("</div></div></div>")), s3("</div>");
  };
} }, Y = q.setup;
q.setup = (e2, s2) => {
  const l2 = useSSRContext();
  return (l2.modules || (l2.modules = /* @__PURE__ */ new Set())).add("components/Shared/Cart.vue"), Y ? Y(e2, s2) : undefined;
};
const D = { __name: "ForYou", __ssrInlineRender: true, props: { data: { type: Object, required: true } }, setup: (e2) => (Qs(), (t2, s2, l2, a2) => {
  const d2 = $;
  e2.data ? (s2(`<section${ssrRenderAttrs(a2)}><div class="grid grid-cols-2 md:grid-cols-3 xl:grid-cols-5 lg:grid-cols-4 gap-4 lg:gap-x-6 gap-y-8"><!--[-->`), ssrRenderList(e2.data, (e3) => {
    s2("<div>"), s2(ssrRenderComponent(d2, { onAddedToCart: (e4) => t2.$emit("addedToCart"), product: e3 }, null, l2)), s2("</div>");
  }), s2("<!--]--></div>"), s2("<!---->"), s2("</section>")) : s2("<!---->");
}) }, O = D.setup;
D.setup = (e2, s2) => {
  const l2 = useSSRContext();
  return (l2.modules || (l2.modules = /* @__PURE__ */ new Set())).add("components/Section/ForYou.vue"), O ? O(e2, s2) : undefined;
};
const z = { __name: "cart", __ssrInlineRender: true, setup(e2) {
  const t2 = Qt().$axios, { t: s2 } = Qs();
  au();
  const i2 = $a(), o2 = Ma(), r2 = ref([{ name: s2("NAV.home"), to: "/" }, { name: s2("NAV.cart"), to: "/cart" }]), u2 = ref([]), h2 = ref(false), g2 = ref(new URLSearchParams()), { data: j2, status: F2, refresh: R2 } = wn("cart", () => t2.get("cart", { params: g2.value }).then((e3) => e3.data).catch((e3) => e3.response.data));
  watch(() => j2.value, () => {
    var e3, t3, s3, l2, a2;
    (null == (t3 = null == (e3 = j2.value.data) ? undefined : e3.items) ? undefined : t3.length) && !o2.query.selected && (u2.value = (null == (a2 = null == (l2 = null == (s3 = j2.value) ? undefined : s3.data) ? undefined : l2.items) ? undefined : a2.map((e4) => e4.product_cart_id)) || []);
  }, { deep: true });
  const A2 = (e3) => {
    if (!e3 || !e3.length) return u2.value = [], g2.value = new URLSearchParams(), U2(), void R2();
    g2.value = new URLSearchParams(), e3.forEach((e4, t3) => {
      g2.value.append(`product_cart_ids[${t3}]`, e4);
    }), u2.value = e3, U2(), R2();
  }, U2 = () => {
    i2.replace({ query: { ...o2.query, selected: u2.value } });
  }, { public: { tokenName: Y2 } } = Zt();
  return computed(() => gn(Y2).value), (e3, t3, s3, l2) => {
    var _a;
    const a2 = N, i3 = b, o3 = q, c2 = g, g3 = D, f2 = a;
    t3(`<div${ssrRenderAttrs(l2)}>`), "pending" === unref(F2) ? (t3('<div class="container my-10">'), t3(ssrRenderComponent(a2, null, null, s3)), t3("</div>")) : "success" === unref(F2) ? (t3('<div class="my-6 lg:my-10">'), t3(ssrRenderComponent(i3, { "data-aos": "fade-right", items: unref(r2), class: "mb-14 container" }, null, s3)), unref(j2) ? (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(o3, { data: unref(j2), onUpdateCart: unref(R2), onUpdateCartWithSelected: A2, selectedProducts: unref(u2) }, 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(j2).sub_total)} ${ssrInterpolate(e3.$t("TITLES.egp"))}</div></div><div class="flex font-semibold xl:text-xl mb-4 items-center gap-4 justify-between"><h4>${ssrInterpolate(e3.$t("TITLES.vat_price"))}</h4><div class="font-bold text-xl">${ssrInterpolate(unref(j2).vat_price || 0)} ${ssrInterpolate(e3.$t("TITLES.egp"))}</div></div><div class="flex font-medium text-lg mb-4 items-center gap-4 justify-between pb-4 border-b-[1.5px] border-dashed border-[#D7D7E0]"><h4 class="text-[#797979]">${ssrInterpolate(e3.$t("TITLES.shipping"))} :</h4><div class="xl:text-xl">${ssrInterpolate((_a = unref(j2).shipping_price) != null ? _a : 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(j2).total_price || 0)} ${ssrInterpolate(e3.$t("TITLES.egp"))}</div></div></div><button${ssrIncludeBooleanAttr(!unref(j2).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$1)} alt="visa"></div><div class="w-[112px] h-[56px] flex items-center justify-center bg-white flex-col"><img${ssrRenderAttr("src", S)} alt="Cash" class="mx-auto"><p class="text-[#339966] font-semibold">Cash</p></div></div></div></div></div><div class="my-14 py-6 lg: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(c2, { name: "like" }, null, s3)), t3(`<span>${ssrInterpolate(e3.$t("TITLES.recommended_products"))}</span></h2>`), t3(ssrRenderComponent(g3, { onAddedToCart: unref(R2), data: unref(j2).recommended_products }, null, s3)), t3("</div></div>"), unref(h2) ? (t3('<div class="fixed lg:block hidden end-2 bottom-2 z-[999]"><button class="rounded-full hover:bg-primary hover:text-white transition-all duration-300 bg-white border border-primary flex items-center justify-center w-12 h-12">'), t3(ssrRenderComponent(c2, { name: "arrow-up", class: "scale-[60%]" }, null, s3)), t3("</button></div>")) : t3("<!---->"), t3("<!--]-->")) : t3(ssrRenderComponent(f2, { class: "!min-h-[320px]" }, null, s3)), t3("</div>")) : t3("<!---->"), t3("</div>");
  };
} }, V = z.setup;
z.setup = (e2, s2) => {
  const l2 = useSSRContext();
  return (l2.modules || (l2.modules = /* @__PURE__ */ new Set())).add("pages/cart.vue"), V ? V(e2, s2) : undefined;
};

export { z as default };
//# sourceMappingURL=cart-CvG19jmV.mjs.map
