import { e as buildAssetsURL } from '../_/nitro.mjs';
import { u } from './Skeleton-DfjdyTna.mjs';
import { mergeProps, ref, computed, watch, unref, useSSRContext, withCtx, createVNode, toDisplayString } from 'vue';
import { ssrRenderAttrs, ssrRenderComponent, ssrRenderList, ssrInterpolate, ssrIncludeBooleanAttr, ssrRenderAttr } from 'vue/server-renderer';
import { f as cf, u as Qt, d as gs, g as ws, h as $a, i as Ma, c as tf, e as _n, a as Ts, b as Zt, _ as Ds } from './server.mjs';
import { v } from './breadcrumb-DGU_YuMK.mjs';
import { E, F } from './Mastercard-CCGR90qu.mjs';
import { g } from './SvgIcon-YE_5uJaI.mjs';
import { $ } from './ProductCard-BoLfosCH.mjs';
import { a } from './NoData-IIg4-CUc.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 U = R.setup;
R.setup = (e2, s2) => {
  const l2 = useSSRContext();
  return (l2.modules || (l2.modules = /* @__PURE__ */ new Set())).add("components/Shared/CartSkelton.vue"), U ? U(e2, s2) : undefined;
};
const A = cf(R, [["ssrRender", function(t2, l2, a2, i2) {
  const d2 = u;
  l2(`<div${ssrRenderAttrs(mergeProps({ class: "space-y-10" }, i2))}>`), l2(ssrRenderComponent(d2, { class: "h-[16px] w-[120px]" }, null, a2)), l2(ssrRenderComponent(d2, { 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(d2, { class: "h-[100px] w-[80px]" }, null, a2)), l2('<div class="flex-1 space-y-2">'), l2(ssrRenderComponent(d2, { class: "h-[14px] w-[60%]" }, null, a2)), l2(ssrRenderComponent(d2, { class: "h-[14px] w-[40%]" }, null, a2)), l2(ssrRenderComponent(d2, { class: "h-[14px] w-[30%]" }, null, a2)), l2('</div><div class="flex flex-col items-center space-y-2">'), l2(ssrRenderComponent(d2, { class: "h-[32px] w-[80px] rounded" }, null, a2)), l2(ssrRenderComponent(d2, { 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(d2, { class: "h-[20px] w-[100px]" }, null, a2)), l2(ssrRenderComponent(d2, { class: "h-[14px] w-[80%]" }, null, a2)), l2(ssrRenderComponent(d2, { class: "h-[14px] w-[80%]" }, null, a2)), l2(ssrRenderComponent(d2, { class: "h-[14px] w-[80%]" }, null, a2)), l2(ssrRenderComponent(d2, { class: "h-[14px] w-[80%]" }, null, a2)), l2(ssrRenderComponent(d2, { class: "h-[14px] w-[80%]" }, null, a2)), l2(ssrRenderComponent(d2, { class: "h-[14px] w-[80%]" }, null, a2)), l2(ssrRenderComponent(d2, { class: "h-[40px] w-full" }, null, a2)), l2('</div><div class="space-y-2 bg-[#F9F9F9] p-4">'), l2(ssrRenderComponent(d2, { class: "h-[20px] w-[150px]" }, null, a2)), l2('<div class="flex gap-2"><!--[-->'), ssrRenderList(3, (e2) => {
    l2(ssrRenderComponent(d2, { class: "h-[32px] w-[112px]", key: e2 }, null, a2));
  }), l2('<!--]--></div></div></div></div><div class="space-y-4">'), l2(ssrRenderComponent(d2, { 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(d2, { class: "h-[180px] w-full" }, null, a2)), l2(ssrRenderComponent(d2, { class: "h-[14px] w-[60px]" }, null, a2)), l2(ssrRenderComponent(d2, { class: "h-[16px] w-[90%]" }, null, a2)), l2(ssrRenderComponent(d2, { class: "h-[14px] w-[40%]" }, null, a2)), l2(ssrRenderComponent(d2, { class: "h-[14px] w-[80%]" }, null, a2)), l2(ssrRenderComponent(d2, { class: "h-[24px] w-[24px] rounded-full ms-auto" }, null, a2)), l2("</div>");
  }), l2("<!--]--></div></div></div>");
}]]), N = "" + 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, { public: { tokenName: v2 } } = Zt(), h2 = computed(() => _n(v2).value), w2 = ref(s2.selectedProducts || []);
  watch(() => s2.selectedProducts, (e3) => {
    w2.value = e3 || [];
  }, { deep: true });
  const y2 = (e3) => {
    const t3 = w2.value.indexOf(e3);
    -1 !== t3 ? w2.value.splice(t3, 1) : w2.value.push(e3), $2("updateCartWithSelected", w2.value);
  }, $2 = t2;
  return (t3, s3, l2, a2) => {
    var i2, v3, g2;
    const f2 = F, $3 = Ds;
    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 == (v3 = null == (i2 = e2.data.data) ? undefined : i2.items) ? undefined : v3.length) ? (s3('<div class="flex flex-col gap-10"><!--[-->'), ssrRenderList(null == (g2 = e2.data.data) ? undefined : g2.items, (e3) => {
      s3(ssrRenderComponent(f2, { key: e3.product_cart_id, product: e3, onUpdateCart: (e4) => t3.$emit("updateCart"), onUpdateSelected: y2, selectedProducts: unref(w2) }, 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", N)} 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($3, { 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)), unref(h2) ? s3("<!---->") : s3(ssrRenderComponent($3, { 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) => (gs(), (t2, s2, l2, a2) => {
  const i2 = $;
  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(i2, { onAddedToCart: (e4) => t2.$emit("addedToCart"), product: e3 }, null, l2)), s2("</div>");
  }), s2("<!--]--></div>"), s2("<!---->"), s2("</section>")) : s2("<!---->");
}) }, V = D.setup;
D.setup = (e2, s2) => {
  const l2 = useSSRContext();
  return (l2.modules || (l2.modules = /* @__PURE__ */ new Set())).add("components/Section/ForYou.vue"), V ? V(e2, s2) : undefined;
};
const W = { __name: "cart", __ssrInlineRender: true, setup(e2) {
  const t2 = Qt().$axios, { t: s2 } = gs();
  ws();
  const r2 = $a(), o2 = Ma(), n2 = tf(), p2 = ref([{ name: s2("NAV.home"), to: "/" }, { name: s2("NAV.cart"), to: "/cart" }]), h2 = computed(() => _n("yumaii_country_id").value), b2 = ref([]), I2 = ref(false), F2 = ref(new URLSearchParams()), { data: R2, status: U2, refresh: N2 } = Ts("cart", () => t2.get("cart", { params: F2.value }).then((e3) => e3.data).catch((e3) => e3.response.data));
  watch(() => R2.value, () => {
    var e3, t3, s3, l2, a2;
    (null == (t3 = null == (e3 = R2.value.data) ? undefined : e3.items) ? undefined : t3.length) && !o2.query.selected && (b2.value = (null == (a2 = null == (l2 = null == (s3 = R2.value) ? undefined : s3.data) ? undefined : l2.items) ? undefined : a2.map((e4) => e4.product_cart_id)) || []);
  }, { deep: true });
  const Y2 = (e3) => {
    if (!e3 || !e3.length) return b2.value = [], F2.value = new URLSearchParams(), V2(), void N2();
    F2.value = new URLSearchParams(), e3.forEach((e4, t3) => {
      F2.value.append(`product_cart_ids[${t3}]`, e4);
    }), b2.value = e3, V2(), N2();
  }, V2 = () => {
    r2.replace({ query: { ...o2.query, selected: b2.value } });
  }, { public: { tokenName: W2 } } = Zt();
  return computed(() => _n(W2).value), (e3, t3, s3, l2) => {
    var _a;
    var a2, i2, r3, o3, g2, f2, w2, y2, $2;
    const _2 = A, T2 = v, S2 = q, j2 = g, F3 = D, V3 = a;
    t3(`<div${ssrRenderAttrs(l2)}>`), "pending" === unref(U2) ? (t3('<div class="container my-10">'), t3(ssrRenderComponent(_2, null, null, s3)), t3("</div>")) : "success" === unref(U2) ? (t3('<div class="my-6 lg:my-10">'), t3(ssrRenderComponent(T2, { "data-aos": "fade-right", items: unref(p2), class: "mb-14 container" }, null, s3)), unref(R2) ? (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(S2, { data: unref(R2), onUpdateCart: unref(N2), onUpdateCartWithSelected: Y2, selectedProducts: unref(b2) }, 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-xl mb-6">${ssrInterpolate(e3.$t("TITLES.order_summary"))}</h3><div class="border mb-6 border-[#E4E7ED] p-4"><div class="flex font-semibold text-lg mb-4 items-center gap-4 justify-between"><h4>${ssrInterpolate(e3.$t("TITLES.sub_total"))} <span class="!text-xs">(${ssrInterpolate(e3.$t("TITLES.icluding_vat"))})</span></h4><div class="font-bold text-lg">${ssrInterpolate(unref(R2).sub_total)} ${ssrInterpolate((null == (i2 = null == (a2 = unref(n2).countries) ? undefined : a2.find((e4) => e4.id == unref(h2))) ? undefined : i2.currency) || (null == (r3 = unref(n2).countries[0]) ? undefined : r3.currency))}</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-lg">${ssrInterpolate((_a = unref(R2).shipping_price) != null ? _a : 0)} ${ssrInterpolate((null == (g2 = null == (o3 = unref(n2).countries) ? undefined : o3.find((e4) => e4.id == unref(h2))) ? undefined : g2.currency) || (null == (f2 = unref(n2).countries[0]) ? undefined : f2.currency))}</div></div><div class="flex font-semibold text-lg mb-4 items-center gap-4 justify-between"><h4>${ssrInterpolate(e3.$t("TITLES.total_price"))}</h4><div class="font-bold text-lg">${ssrInterpolate(unref(R2).total_price || 0)} ${ssrInterpolate((null == (y2 = null == (w2 = unref(n2).countries) ? undefined : w2.find((e4) => e4.id == unref(h2))) ? undefined : y2.currency) || (null == ($2 = unref(n2).countries[0]) ? undefined : $2.currency))}</div></div></div><button${ssrIncludeBooleanAttr(!unref(R2).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-xl 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", E)} 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></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-xl font-semibold animate-fade-in">`), t3(ssrRenderComponent(j2, { name: "like" }, null, s3)), t3(`<span>${ssrInterpolate(e3.$t("TITLES.recommended_products"))}</span></h2>`), t3(ssrRenderComponent(F3, { onAddedToCart: unref(N2), data: unref(R2).recommended_products }, null, s3)), t3("</div></div>"), unref(I2) ? (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(j2, { name: "arrow-up", class: "scale-[60%]" }, null, s3)), t3("</button></div>")) : t3("<!---->"), t3("<!--]-->")) : t3(ssrRenderComponent(V3, { class: "!min-h-[320px]" }, null, s3)), t3("</div>")) : t3("<!---->"), t3("</div>");
  };
} }, z = W.setup;
W.setup = (e2, s2) => {
  const l2 = useSSRContext();
  return (l2.modules || (l2.modules = /* @__PURE__ */ new Set())).add("pages/cart.vue"), z ? z(e2, s2) : undefined;
};

export { W as default };
//# sourceMappingURL=cart-Dhwk3j7X.mjs.map
