PageSourceSearch

https://www.bagchee.com/static/js/8488.8a8d111d.chunk.js

js bagchee.com collected 2026-10-02 11:14:55 UTC 24,934 bytes, 3 lines download raw bytes

1/*! For license information please see 8488.8a8d111d.chunk.js.LICENSE.txt */
2"use strict";(self.webpackChunkui=self.webpackChunkui||[]).push([[8488],{2522(e,t,s){s.d(t,{j:()=>r});const r=(e,t)=>{var s,r,a,i;if(!e)return 0;const n=e=>Math.max(0,Number(e)||0);switch(t){case"EUR":return n(null!==(s=e.priceEur)&&void 0!==s?s:e.price_eur);case"GBP":return n(null!==(r=e.priceGbp)&&void 0!==r?r:e.price_gbp);case"INR":return n(null!==(a=e.priceInr)&&void 0!==a?a:e.price_inr);default:return n(null!==(i=e.priceUsd)&&void 0!==i?i:e.price_usd)}}},2629(e,t,s){s.d(t,{A:()=>r});const r=(0,s(7784).A)("crown",[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]])},4285(e,t,s){s.d(t,{A:()=>r});const r=(0,s(7784).A)("truck",[["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2",key:"wrbu53"}],["path",{d:"M15 18H9",key:"1lyqi6"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14",key:"lysw3i"}],["circle",{cx:"17",cy:"18",r:"2",key:"332jqn"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}]])},5196(e,t,s){s.d(t,{gX:()=>a,ag:()=>i});const r=s.p+"static/media/no-image.f3304f94cebd58816f43.jpg",a=r,i=function(e){let{width:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e||"object"!==typeof e)return"";const s=function(e){let{width:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e&&"object"===typeof e&&(e=e.defaultImage||e.image||e.picture||""),!e||"string"!==typeof e)return"";if(e.startsWith("http"))return e.includes("res.cloudinary.com")&&e.includes("/upload/")?((e,t)=>{const s=t?"f_auto,q_auto,w_".concat(t):"f_auto,q_auto";return e.replace("/upload/","/upload/".concat(s,"/"))})(e,t):e;const s=e.replace(/^\//,"");return s.startsWith("uploads/")?"".concat("https://www.bagchee.com/api","/").concat(s):/^[a-f0-9]+-/i.test(s)?"".concat("https://www.bagchee.com/assets/images/sliders","/").concat(s):""}(e,{width:t});if(s)return s;const r=e.isbn13||e.isbn10;return r?"https://books.google.com/books/content?vid=ISBN".concat(r,"&printsec=frontcover&img=1&zoom=1"):""}},5347(e,t,s){s.d(t,{A:()=>r});const r=(0,s(7784).A)("award",[["path",{d:"m15.477 12.89 1.515 8.526a.5.5 0 0 1-.81.47l-3.58-2.687a1 1 0 0 0-1.197 0l-3.586 2.686a.5.5 0 0 1-.81-.469l1.514-8.526",key:"1yiouv"}],["circle",{cx:"12",cy:"8",r:"6",key:"1vp47v"}]])},5469(e,t,s){s.d(t,{A:()=>r});const r=(0,s(7784).A)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]])},6693(e,t,s){s.r(t),s.d(t,{default:()=>A});var r=s(5043),a=s(7874),i=s(5469),n=s(5347),l=s(2629),c=s(7095),o=s(3944),d=s(9350),m=s(4285),x=s(614),p=s(2603),u=s(416),h=s(3046),b=s(2339),f=s(5196),g=s(2522),v=s(9711),y=s(2595),j=s(1944),N=s(6756),w=s(9045),k=s(579);const _=new Set([3,5]),A=()=>{const e=(0,a.Zp)(),{cart:t,removeFromCart:s,updateQuantity:A,cartTotal:C,appliedCoupon:M,setAppliedCoupon:E,appliedShipping:S,setAppliedShipping:D,membershipAdded:P,setMembershipAdded:R}=(0,p._)(),{currency:T,formatPrice:I,symbols:q,exchangeRates:z}=(0,r.useContext)(u.d),[U,O]=(0,r.useState)(M?M.code:""),[F,H]=(0,r.useState)([]),[L,V]=(0,r.useState)(null),[B,G]=(0,r.useState)([]),[W,X]=(0,r.useState)(!0),[Y,Q]=(0,r.useState)(!1),[J,K]=(0,r.useState)(null),Z="https://www.bagchee.com/api";(0,r.useEffect)(()=>{const e=localStorage.getItem("auth");if(e)try{var t;const s=JSON.parse(e);K(s.userDetails),"active"===(null===s||void 0===s||null===(t=s.userDetails)||void 0===t?void 0:t.membership)&&P&&R(!1)}catch(s){}},[]),(0,r.useEffect)(()=>{(async()=>{try{X(!0);const[e,t,s]=await Promise.all([h.A.get("".concat(Z,"/shipping-options/list")),h.A.get("".concat(Z,"/settings/public")),h.A.get("".concat(Z,"/coupons/active"))]);if(e.data.status){const t=e.data.data.filter(e=>e.active||e.isActive).sort((e,t)=>{var s,r,a,i,n,l,c,o;return Number(null!==(s=null!==(r=e.ord)&&void 0!==r?r:e.order)&&void 0!==s?s:0)-Number(null!==(a=null!==(i=t.ord)&&void 0!==i?i:t.order)&&void 0!==a?a:0)||(null!==(n=null!==(l=e.id)&&void 0!==l?l:e._id)&&void 0!==n?n:0)-(null!==(c=null!==(o=t.id)&&void 0!==o?o:t._id)&&void 0!==c?c:0)});if(H(t),t.length>0){const e=S&&t.find(e=>{var t,s;return(null!==(t=e.id)&&void 0!==t?t:e._id)===(null!==(s=S.id)&&void 0!==s?s:S._id)})||t[0];D(e)}}t.data.status&&t.data.data&&V(t.data.data),s.data.status&&G(s.data.data)}catch(e){console.error("Cart fetch error:",e)}finally{X(!1)}})()},[Z]);const $=()=>L?{usd:L.membership_cost||L.membershipCartPrice||0,inr:L.membership_cart_price||L.membershipCartPriceInr||0,eur
2:L.membership_cost_eur||L.membershipCartPriceEur||0}:{usd:0,inr:0,eur:0},ee=(L&&("EUR"===T?L.freeShippingOverEur:L.freeShippingOver||L.free_shipping_over),L?"EUR"===T?L.showPromoOverEur||0:L.showPromoOverUsd||0:0),te=t.reduce((e,t)=>"gift_card"===t.itemType?e:e+t.quantity,0),se=t.filter(e=>"gift_card"!==e.itemType).reduce((e,t)=>{const s=String(t.shipDays||t.ship_days||"0").split("-").map(Number).filter(e=>!isNaN(e)),r=s.length>0?Math.max(...s):0;return r>e?r:e},0)+Number((null===L||void 0===L?void 0:L.maxShippingDays)||(null===L||void 0===L?void 0:L.max_shipping_days)||0),re=t.reduce((e,t)=>e+t.price*t.quantity,0),ae=t.reduce((e,t)=>{var s,r;return e+(null!==(s=null!==(r=t.inrPrice)&&void 0!==r?r:t.inr_price)&&void 0!==s?s:0)*t.quantity},0),ie=t.reduce((e,t)=>{var s,r;const a=null!==(s=null!==(r=t.realPrice)&&void 0!==r?r:t.real_price)&&void 0!==s?s:0,i=a>0?a:t.price||0;return e+Number(i)*t.quantity},0),ne=t.length>0&&0===te,le=ie,ce=!ne&&le>=50,oe=50-le,de=null===S||void 0===S?void 0:S.id,me=_.has(de),xe=ne||!S||!me&&ce?0:(0,g.j)(S,T),pe="USD"===T?1:Number(null===z||void 0===z?void 0:z[T])||("EUR"===T?.92:"GBP"===T?.78:"INR"===T?84:1),ue=pe?xe/pe:xe,he=!!J&&"active"===J.membership,be=P&&!he,fe=be&&$().usd||0,ge=Number((null===L||void 0===L?void 0:L.member_discount)||(null===L||void 0===L?void 0:L.memberDiscount))||10,ve=be||he?Math.round(ie*(ge/100)*100)/100:0,ye=ie+fe-ve+ue,je=I(re,ae,ie),Ne=$(),we=be?I(Ne.usd,Ne.inr,Ne.usd):null,ke=M?"fixed"===M.discountType?Number(M.discount)||0:Math.round(le*(Number(M.discount)/100)*100)/100:0,_e=()=>{R(!0),b.Ay.success("Membership added to cart!")},Ae=()=>{R(!1),b.Ay.success("Membership removed from cart")},Ce=e=>e?e.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-"):"book",Me=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return(0,k.jsx)("div",{className:"flex items-center gap-0.5",children:[1,2,3,4,5].map(t=>(0,k.jsx)(o.A,{size:13,className:t<=e?"text-accent fill-accent":"text-gray-300 fill-gray-200"},t))})};return 0===t.length?(0,k.jsx)("div",{className:"min-h-screen bg-cream-50 pt-10 md:pt-16 lg:pt-24 w-full overflow-x-hidden",children:(0,k.jsx)("div",{className:"w-full  mx-auto px-3 pt-[90px] md:pt-[120px] lg:pt-[170px] text-center",children:(0,k.jsxs)("div",{className:"bg-white rounded-lg p-12 border border-gray-200",children:[(0,k.jsx)("div",{className:"w-24 h-24 bg-gray-100 rounded-full mx-auto mb-6 flex items-center justify-center",children:(0,k.jsx)(c.A,{className:"text-gray-400",size:48})}),(0,k.jsx)("h2",{className:"text-2xl font-display font-bold text-text-main mb-2",children:"Your cart is empty"}),(0,k.jsx)("p",{className:"text-gray-500 mb-8",children:"Looks like you haven't added any items to your cart yet"}),(0,k.jsxs)(a.N_,{to:"/",className:"inline-flex items-center gap-2 bg-primary text-white px-8 py-3 rounded hover:bg-primary-dark transition-colors font-montserrat font-bold uppercase text-sm",children:[(0,k.jsx)(i.A,{size:18}),"Continue Shopping"]})]})})}):(0,k.jsx)("div",{className:"min-h-screen bg-cream-50 w-full overflow-x-hidden relative",children:(0,k.jsx)("div",{className:"w-full mx-auto px-3 sm:px-4 pb-6",children:(0,k.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 pt-5",children:[(0,k.jsxs)("div",{className:"lg:col-span-2 space-y-5",children:[(0,k.jsx)("h1",{className:"text-2xl font-display font-bold text-text-main uppercase tracking-wide text-left mb-4 ",children:"YOUR CART"}),(0,k.jsx)("div",{className:"bg-cream-100 border border-gray-200 shadow-sm",children:(0,k.jsxs)("div",{className:"divide-y divide-gray-100",children:[P&&(0,k.jsxs)("div",{className:"p-5 flex gap-4",children:[(0,k.jsxs)("div",{className:"shrink-0 w-20 h-28 rounded-lg bg-gradient-to-br from-primary to-primary-dark flex flex-col items-center justify-center shadow",children:[(0,k.jsx)(l.A,{size:28,className:"text-white mb-1"}),(0,k.jsx)("span",{className:"text-white font-bold text-[10px] uppercase font-montserrat",children:"Member"})]}),(0,k.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,k.jsxs)("div",{className:"flex justify-between gap-2 mb-1",children:[(0,k.jsx)("p",{className:"font-semibold text-text-main",children:"Bagchee Membership"}),(0,k.jsx)("p",{className:"text-xl font-bold text-text-main shrink-0",children:I(Ne.usd,Ne.inr,Ne.usd)})]}),(0,k.jsxs)("p",{className:"text-xs text-gray-500 mb-3",children:["Annual membership \u2014 save ",(null===L||void 0===L?void 0:L.member_discount)||(null===L||void 0===L?void 0:L.memberDiscount)||10,"% on all orders"]}),(0,k.jsxs)("button",{onClick:Ae,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-md bg-red-50 text-red-600 hover:bg-red-600 hover:text-white transition-all duration-300 text-[11px] font-bold uppercase font-montserrat shadow-sm active:scale-95",children:[(0,k.jsx)(x.A,{size:14}),"REMOVE"]})]})]}),t.map(e=>{var r,i,l,c,o,d,m;return(0,k.jsx)("div",{className:"p-5",children:"gift_card"===e.itemType?(0,k.jsxs)("div",{className:"flex gap-4",children:[(0,k.jsxs)("div",{className:"shrink-0 w-20 h-28 rounded-lg bg-gradient-to-br from-primary via-primary to-secondary flex flex-col items-center justify-center shadow",children:[(0,k.jsx)("span",{className:"text-white font-display font-bold text-xs",children:"BAGCHEE"}),(0,k.jsx)("span",{className:"text-white text-[10px] mt-1 opacity-80",children:"Gift Card"})]}),(0,k.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,k.jsxs)("div",{className:"flex justify-between gap-2 mb-2",children:[(0,k.jsx)("p",{className:"font-semibold text-text-main",children:e.title}),(0,k.jsxs)("p",{className:"text-xl font-bold text-text-main shrink-0",children:["$",parseFloat(e.price).toFixed(2)]})]}),(0,k.jsxs)("p",{className:"text-xs text-gray-500",children:["To: ",(0,k.jsx)("span",{className:"font-medium text-text-main",children:e.recipientName})," (",e.recipientEmail,")"]}),(0,k.jsxs)("p",{className:"text-xs text-gray-500",children:["From: ",(0,k.jsx)("span",{className:"font-medium text-text-main",children:e.senderName})]}),e.message&&(0,k.jsxs)("p",{className:"text-xs text-gray-400 italic mt-1",children:['"',e.message,'"']}),(0,k.jsx)("button",{onClick:()=>s(e.id),className:"mt-3 text-xs text-red-500 hover:text-red-700 transition-colors",children:"Remove"})]})]}):(0,k.jsxs)("div",{className:"flex gap-4",children:[(0,k.jsx)(a.N_,{to:"/books/".concat(e.bagcheeId||e._id,"/").concat(e.slug||Ce(e.name||e.title)),className:"shrink-0",children:(0,k.jsx)("img",{src:(m=e.defaultImage||e.default_image||(null===(r=e.related_images)||void 0===r?void 0:r[0]),m?m.startsWith("http")?m:"".concat(Z).concat(m):f.gX),alt:e.name||e.title,className:"w-20 h-28 object-cover border border-gray-200",onError:e=>{e.target.src=f.gX}})}),(0,k.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,k.jsxs)("div",{className:"flex justify-between gap-2 mb-1",children:[(0,k.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,k.jsx)(a.N_,{to:"/books/".concat(e.bagcheeId||e._id,"/").concat(e.slug||Ce(e.name||e.title)),className:"font-semibold text-text-main hover:text-primary transition-colors leading-snug block",children:e.name||e.title}),e.author&&(0,k.jsxs)("p",{className:"text-sm text-gray-500 mt-0.5",children:["by"," ","object"===typeof e.author?"".concat(e.author.firstName||e.author.first_name||""," ").concat(e.author.lastName||e.author.last_name||"").trim():e.author]})]}),(0,k.jsx)("div",{className:"text-right shrink-0",children:(0,k.jsx)("p",{className:"text-xl font-bold text-text-main",children:I((e.price||0)*e.quantity,(null!==(i=null!==(l=e.inrPrice)&&void 0!==l?l:e.inr_price)&&void 0!==i?i:0)*e.quantity,((null!==(c=null!==(o=e.realPrice)&&void 0!==o?o:e.real_price)&&void 0!==c?c:0)>0?null!==(d=e.realPrice)&&void 0!==d?d:e.real_price:e.price||0)*e.quantity)})})]}),(0,k.jsx)("div",{className:"mb-3",children:Me(e.rating||0)}),(0,k.jsxs)("div",{className:"flex items-center gap-4 mt-4 pt-3 border-t border-gray-100 flex-wrap",children:[(0,k.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,k.jsx)("span",{className:"text-[10px] font-bold text-text-muted uppercase font-montserrat",children:"Qty:"}),(0,k.jsx)("select",{value:e.quantity,onChange:s=>((e,s)=>{const r=t.find(t=>(t.id||t._id)===e);if(!r)return;const a=s-r.quantity;if(a>0)for(let t=0;t<a;t++)A(e,"inc");else if(a<0)for(let t=0;t<Math.abs(a);t++)A(e,"dec")})(e.id||e._id,parseInt(s.target.value,10)),className:"border border-gray-200 rounded-md px-2 py-1 text-sm font-bold text-text-main bg-white focus:outline-none focus:border-primary curs
2or-pointer hover:border-gray-300 transition-colors",children:Array.from({length:Math.max(e.quantity||1,Number(e.stock)>0?Math.min(Number(e.stock),10):10)},(e,t)=>t+1).map(e=>(0,k.jsx)("option",{value:e,children:e},e))})]}),(0,k.jsxs)("div",{className:"flex flex-wrap items-center gap-2 ml-0 sm:ml-auto w-full sm:w-auto justify-start sm:justify-end",children:[(0,k.jsxs)("button",{onClick:()=>{return t=e.id||e._id,s(t),void b.Ay.success("Item removed from cart");var t},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-md bg-red-50 text-red-600 hover:bg-red-600 hover:text-white transition-all duration-300 text-[11px] font-bold uppercase font-montserrat group shadow-sm active:scale-95 whitespace-nowrap",children:[(0,k.jsx)(x.A,{size:14,className:"group-hover:rotate-90 transition-transform duration-300"}),"REMOVE"]}),(0,k.jsxs)("button",{className:"flex items-center gap-1.5 px-3 py-1.5 rounded-md bg-blue-50 text-primary hover:bg-primary hover:text-white transition-all duration-300 text-[11px] font-bold uppercase font-montserrat shadow-sm active:scale-95 whitespace-nowrap",children:[(0,k.jsx)(n.A,{size:14}),"SAVE FOR LATER"]})]})]})]})]})},e.id||e._id)})]})}),(!J||"active"!==J.membership)&&L&&(0,k.jsx)("div",{className:"bg-cream-100 border border-gray-200 shadow-sm overflow-hidden",children:(0,k.jsxs)("div",{className:"p-4 flex flex-col sm:flex-row sm:flex-wrap sm:items-center gap-3",children:[(0,k.jsx)("div",{className:"bg-primary text-white text-[10px] font-bold uppercase px-3 py-2 font-montserrat tracking-wider shrink-0 self-start sm:self-auto",children:"MEMBERSHIP"}),(0,k.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer sm:flex-1 min-w-0",children:[(0,k.jsx)("input",{type:"radio",name:"membership",checked:P,onChange:()=>!P&&_e(),className:"w-4 h-4 text-primary border-gray-300 focus:ring-primary shrink-0"}),(0,k.jsxs)("span",{className:"text-sm text-text-main",children:["Become a member and save ",(null===L||void 0===L?void 0:L.member_discount)||(null===L||void 0===L?void 0:L.memberDiscount)||10,"% now"]})]}),(0,k.jsxs)("div",{className:"flex items-center justify-between w-full sm:contents gap-3",children:[(0,k.jsx)("span",{className:"text-xl font-bold text-text-main",children:I(Ne.usd,Ne.inr,Ne.usd)}),P?(0,k.jsx)("button",{onClick:Ae,className:"bg-gray-200 text-gray-700 text-xs font-bold uppercase px-5 py-2 hover:bg-gray-300 transition-colors font-montserrat shrink-0",children:"REMOVE"}):(0,k.jsx)("button",{onClick:_e,className:"bg-primary text-white text-xs font-bold uppercase px-5 py-2 hover:bg-primary-dark transition-colors font-montserrat shrink-0",children:"ADD TO CART"})]})]})})]}),(0,k.jsxs)("div",{className:"lg:col-span-1",children:[(0,k.jsx)("div",{className:"h-[32px] mb-4 invisible lg:block hidden"}),(0,k.jsx)("div",{className:"bg-cream-100 border border-gray-200 shadow-sm",children:(0,k.jsxs)("div",{className:"p-5 space-y-5",children:[!ne&&(0,k.jsx)("div",{className:"mb-4",children:ce?(0,k.jsx)("div",{className:"bg-green-50 border border-green-200 rounded-xl p-3 text-center shadow-sm animate-fadeIn",children:(0,k.jsx)("span",{className:"text-green-700 font-black text-sm",children:"\ud83c\udf89 Congratulations! You've unlocked Free Shipping!"})}):(0,k.jsxs)("div",{className:"bg-blue-50/50 border border-blue-200 rounded-xl p-4 text-center space-y-3 shadow-sm",children:[(0,k.jsxs)("p",{className:"text-blue-900 text-sm font-medium font-body",children:["Add ",(0,k.jsx)("span",{className:"font-black text-primary text-base",children:I(oe,oe*((null===z||void 0===z?void 0:z.INR)||83),oe)})," more to unlock ",(0,k.jsx)("span",{className:"font-bold",children:"Free Shipping"}),"!"]}),(0,k.jsx)("div",{className:"w-full bg-blue-100 rounded-full h-2.5 overflow-hidden",children:(0,k.jsx)("div",{className:"bg-primary h-2.5 rounded-full transition-all duration-500 ease-out",style:{width:"".concat(Math.min(le/50*100,100),"%")}})})]})}),(0,k.jsxs)("div",{className:"flex justify-between items-baseline",children:[(0,k.jsxs)("span",{className:"text-sm text-gray-600",children:["Cart total ",t.length]}),(0,k.jsx)("span",{className:"text-xl font-bold text-text-main",children:je})]}),(0===ee||le>=ee)&&(0,k.jsxs)("div",{className:"border-t border-gray-200 pt-4",children:[(0,k.jsx)("p",{className:"text-sm font-bold text-primary text-center mb-3",children:"Use a promotion Code"}),M?(0,k.jsxs)("div",{className:"flex items-center justify-between p-2.5 bg-green-50 border border-green-200",children:[(0,k.jsxs)("div",{className:"flex items-center gap-2",children:[(0,k.jsx)(d.A,{className:"text-green-600 shrink-0",size:16}),(0,k.jsxs)("span",{className:"text-sm font-bold text-green-800",children:[M.code," (","fixed"===M.discountType?I(M.discount):"".concat(M.discount,"% off"),")"]})]}),(0,k.jsx)("button",{onClick:()=>{E(null),O(""),b.Ay.success("Coupon removed")},className:"text-green-600 hover:text-green-800 ml-2",children:(0,k.jsx)(x.A,{size:16})})]}):(0,k.jsxs)("div",{className:"flex gap-0",children:[(0,k.jsx)("input",{type:"text",value:U,onChange:e=>O(e.target.value.toUpperCase()),placeholder:"Enter promo code",className:"flex-1 px-3 py-2 border border-gray-300 text-sm focus:outline-none focus:border-primary"}),(0,k.jsx)("button",{onClick:async()=>
2{if(U.trim()){Q(!0);try{const e=U.trim().toUpperCase(),t=B.find(t=>t.code.toUpperCase()===e);if(!t)return void b.Ay.error("Invalid or inactive coupon code");if("active"===t.members_only&&(!J||"active"!==J.membership))return void b.Ay.error("This coupon is for members only");if(t.minimum_buy&&le<t.minimum_buy)return void b.Ay.error("Minimum order of ".concat(I(t.minimum_buy)," required for this coupon"));const s=new Date;if(t.valid_from&&new Date(t.valid_from)>s)return void b.Ay.error("This coupon is not yet valid");if(t.valid_to&&new Date(t.valid_to)<s)return void b.Ay.error("This coupon has expired");const r="active"===t.fix_amount?"fixed":"pct";E({code:t.code,discount:t.amount,discountType:r,couponId:t._id}),b.Ay.success("Coupon applied successfully!")}catch(e){b.Ay.error("Failed to validate coupon")}finally{Q(!1)}}else b.Ay.error("Please enter a coupon code")},disabled:Y,className:"bg-primary text-white px-5 py-2 text-sm font-bold hover:bg-primary-dark transition-colors disabled:opacity-70 font-montserrat uppercase",children:Y?"...":"Apply"})]})]}),(0,k.jsxs)("div",{className:"space-y-2",children:[(0,k.jsxs)("p",{className:"text-xs text-gray-500 font-semibold uppercase tracking-wide flex items-center gap-1",children:[(0,k.jsx)(m.A,{size:13})," Shipping (",te," ",1===te?"book":"books",")"]}),F.map(e=>{const t=e.id||e._id,s=_.has(t),r=Number(e.priceUsd||e.price_usd)||12,a=s||!ce?r:0,i=((null===S||void 0===S?void 0:S.id)||(null===S||void 0===S?void 0:S._id))===t,n=Number(e.maxDayLimit||e.max_day_limit)||0,l=n>0||se>0?(()=>{const e=new Date;return e.setDate(e.getDate()+n+se),e.toLocaleDateString("en-US",{day:"numeric",month:"short"})})():null,c=(0,g.j)(e,T),o=0===a?"Free":"".concat((null===q||void 0===q?void 0:q[T])||T+" ").concat(c.toFixed(2));return(0,k.jsxs)("label",{className:"flex items-start justify-between p-3 cursor-pointer rounded border transition-colors ".concat(i?"bg-primary/5 border-primary/30":"border-gray-100 hover:border-gray-200"),children:[(0,k.jsxs)("div",{className:"flex items-start gap-2 min-w-0 flex-1",children:[(0,k.jsx)("input",{type:"radio",name:"shipping",checked:i,onChange:()=>D(e),className:"w-4 h-4 text-primary mt-1 shrink-0"}),(0,k.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,k.jsx)("span",{className:"text-sm font-semibold text-text-main block truncate sm:whitespace-normal",children:e.title}),l&&(0,k.jsxs)("span",{className:"text-[10px] text-gray-400 block",children:["Estimated delivery by ",l]}),0===a&&(0,k.jsx)("span",{className:"text-[10px] text-green-600 font-bold",children:"FREE"})]})]}),(0,k.jsx)("span",{className:"text-sm font-bold shrink-0 ml-2 ".concat(0===a?"text-green-600":"text-primary"),children:o})]},t)})]}),(0,k.jsxs)("div",{className:"border-t border-gray-200 pt-4 space-y-2",children:[be&&(0,k.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,k.jsx)("span",{className:"text-gray-600",children:"Membership"}),(0,k.jsx)("span",{className:"font-medium text-text-main",children:we})]}),ve>0&&(0,k.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,k.jsxs)("span",{className:"text-green-600",children:["Member Discount (",ge,"%)"]}),(0,k.jsxs)("span",{className:"font-medium text-green-600",children:["-",I(ve,null,ve)]})]}),M&&(0,k.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,k.jsxs)("span",{className:"text-green-600",children:["Discount (",M.code,")"]}),(0,k.jsxs)("span",{className:"font-medium text-green-600",children:["-",I(ke,null,ke)]})]}),S&&(0,k.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,k.jsx)("span",{className:"text-gray-600",children:"Shipping"}),(0,k.jsx)("span",{className:"font-medium ".concat(0===ue?"text-green-600":"text-text-main"),children:0===ue?"Free":I(ue,null,ue)})]}),(0,k.jsxs)("div",{className:"flex justify-between items-baseline pt-2 border-t border-gray-100",children:[(0,k.jsx)("span",{className:"text-sm text-gray-600",children:"Total (tax incl.)"}),(0,k.jsx)("span",{className:"text-2xl font-bold text-text-main",children:I(ye,null,ye)})]})]}),(0,k.jsx)("button",{onClick:()=>{e("/checkout")},className:"w-full bg-primary text-white py-3 font-bold text-sm uppercase tracking-wider hover:bg-primary-dark transition-colors font-montserrat",children:"PROCEED TO CHECKOUT"})]})}),(0,k.jsxs)("div",{className:"mt-4 text-center",children:[(0,k.jsxs)("p",{className:"text-sm text-gray-600 mb-2 flex items-center justify-center gap-1.5 flex-wrap px-2",children:[(0,k.jsx)("span",{children:"\ud83d\udd12"})," 100% Secure Payment"]}),(0,k.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,k.jsx)("div",{className:"h-7 w-11 bg-white border border-gray-200 rounded flex items-center justify-center overflow-hidden shadow-sm",children:(0,k.jsx)("img",{src:v.A,alt:"Visa",className:"h-3.5 object-contain"})}),(0,k.jsx)("div",{className:"h-7 w-11 bg-white border border-gray-200 rounded flex items-center justify-center overflow-hidden shadow-sm",children:(0,k.jsx)("img",{src:N.A,alt:"Mastercard",className:"h-3.5 object-contain"})}),(0,k.jsx)("div",{className:"h-7 w-11 bg-white border border-gray-200 rounded flex items-center justify-center overflow-hidden shadow-sm",children:(0,k.jsx)("img",{src:j,alt:"Discover",className:"h-3.5 object-contain"})}),(0,k.jsx)("div",{className:"h-7 w-11 bg-white border border-gray-200 rounded flex items-center justify-center overflow-hidden shadow-sm",children:(0,k.jsx)("img",{src:y,alt:"Amex",className:"h-3.5 object-contain"})}),(0,k.jsx)("div",{className:"h-7 w-11 bg-white border border-gray-200 rounded flex items-center justify-center overflow-hidden shadow-sm",children:(0,k.jsx)("img",{src:w.A,alt:"PayPal",className:"h-3.5 object-contain"})})]})]})]})]})})})}},7095(e,t,s){s.d(t,{A:()=>r});const r=(0,s(7784).A)("shopping-bag",[["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}],["path",{d:"M3.103 6.034h17.794",key:"awc11p"}],["path",{d:"M3.4 5.467a2 2 0 0 0-.4 1.2V20a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6.667a2 2 0 0 0-.4-1.2l-2-2.667A2 2 0 0 0 17 2H7
2a2 2 0 0 0-1.6.8z",key:"o988cm"}]])},9350(e,t,s){s.d(t,{A:()=>r});const r=(0,s(7784).A)("tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]])}}]);
3//# sourceMappingURL=8488.8a8d111d.chunk.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.