1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4005],{15239:(e,t,n)=>{"use strict";n.d(t,{default:()=>a.a});var r=n(54652),a=n.n(r)},20063:(e,t,n)=>{"use strict";var r=n(47260);n.o(r,"useParams")&&n.d(t,{useParams:function(){return r.useParams}}),n.o(r,"usePathname")&&n.d(t,{usePathname:function(){return r.usePathname}}),n.o(r,"useRouter")&&n.d(t,{useRouter:function(){return r.useRouter}}),n.o(r,"useSearchParams")&&n.d(t,{useSearchParams:function(){return r.useSearchParams}})},35758:(e,t,n)=>{Promise.resolve().then(n.bind(n,54664))},39922:(e,t,n)=>{"use strict";n.d(t,{Bv:()=>l,In:()=>s,be:()=>a});let r="https://api.darlingtonsocks.com/api",a={free_shipping_threshold:1500,metro_manila_shipping_fee:80,provincial_shipping_fee:100,shipping_banner_text:"Free shipping nationwide for orders P1,500 above!"};function i(e,t){if("number"==typeof e)return Number.isFinite(e)?e:t;if("string"==typeof e){let n=Number.parseFloat(e);return Number.isFinite(n)?n:t}return t}async function s(){try{var e;let t=await fetch("".concat(r,"/website-settings/current/"),{method:"GET",cache:"no-store"});if(!t.ok)throw Error("Failed to fetch website settings: ".concat(t.status));return e=await t.json(),{free_shipping_threshold:i(null==e?void 0:e.free_shipping_threshold,a.free_shipping_threshold),metro_manila_shipping_fee:i(null==e?void 0:e.metro_manila_shipping_fee,a.metro_manila_shipping_fee),provincial_shipping_fee:i(null==e?void 0:e.provincial_shipping_fee,a.provincial_shipping_fee),shipping_banner_text:(null==e?void 0:e.shipping_banner_text)||a.shipping_banner_text}}catch(e){return a}}async function l(e,t){let n=await fetch("".concat(r,"/website-settings/update_settings/"),{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(t)},body:JSON.stringify(e)});if(!n.ok){let e=await n.json().catch(()=>null);throw Error((null==e?void 0:e.detail)||"Failed to update shipping settings")}return n.json()}},54652:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{default:function(){return o},getImageProps:function(){return l}});let r=n(28140),a=n(75040),i=n(81356),s=r._(n(71124));function l(e){let{props:t}=(0,a.getImgProps)(e,{defaultLoader:s.default,imgConf:{deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[16,32,48,64,96,128,256,384],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1}});for(let[e,n]of Object.entries(t))void 0===n&&delete t[e];return{props:t}}let o=i.Image},54664:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>h});var r=n(95155),a=n(12115),i=n(15239),s=n(52619),l=n.n(s),o=n(20063),c=n(70405),d=n(54901),p=n(83804);function u(e){let{quantity:t,stock:n,onUpdate:i,isLoading:s=!1}=e,[l,o]=(0,a.useState)(t);(0,a.useEffect)(()=>{o(t)},[t]);let c=async e=>{o(e);try{await i(e)}catch(e){console.error("Failed to update quantity:",e),o(t)}};return(0,r.jsxs)("div",{className:"flex items-center border border-gray-300 rounded-md overflow-hidden w-fit bg-white",children:[(0,r.jsx)("button",{onClick:()=>{t>1&&c(t-1)},disabled:t<=1||s,className:"w-10 h-10 flex items-center justify-center text-gray-600 hover:text-black hover:bg-gray-200 disabled:opacity-50 disabled:hover:bg-transparent border-r border-gray-300 transition-colors focus:outline-none",type:"button","aria-label":"Decrease quantity",children:"â"}),(0,r.jsx)("input",{type:"number",inputMode:"numeric",min:"1",max:n,value:0===l?"":l,onChange:e=>{let t=e.target.value;if(""===t)return void o("");let r=t;r.startsWith("0")&&r.length>1&&"."!==r[1]&&(r=r.replace(/^0+/,"")||"0");let a=parseInt(r,10);if(!isNaN(a)){if(void 0!==n&&a>n)return void c(n);a<1||c(a)}},onBlur:()=>{if(""===l||0===l)o(t);else{let e="string"==typeof l?parseInt(l,10):l;isNaN(e)||e<1?o(t):(void 0!==n&&e>n&&(e=n),e!==t&&c(e))}},onKeyDown:e=>{["e","E","-","+","."].includes(e.key)&&e.preventDefault(),"Enter"===e.key&&e.currentTarget.blur()},className:"w-12 h-10 text-center font-poppins text-black border-none focus:ring-0 p-0 text-base [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none focus:outline-none",placeholder:"","aria-label":"Quantity"}),(0,r.jsx)("button",{onClick:()=>{(void 0===n||t<n)&&c(t+1)},disabled:void 0!==n&&t>=n||s,className:"w-10 h-10 flex items-center justify-center text-gray-600 hover:text-black hover:bg-gray-200 disabled:opacity-50 disabled:hover:bg-transparent border-l border-gray-300 transition-colors focus:outline-none",type:"button","aria-label":"Increase quantity",children:"+"})]})}var m=n(39922);function h(){var e;let t=(0,o.useRouter)(),{cartItems:n,removeFromCart:s,updateQuantity:h}=(0,c._)(),{user:x}=(0,d.A)(),[f,g]=(0,a.useState)(new Set),[b,v]=(0,a.useState)(m.be);(0,a.useEffect)(()=>{(async()=>{v(await (0,m.In)())})()},[]);let j=(0,a.useMemo)(()=>new Set(n.map(e=>e.id)),[n]),y=(0,a.useMemo)(()=>{let e=new Set([...f].filter(e=>j.has(e)));return new Set([...j].filter(t=>!e.has(t)))},[j,f]),N=(0,a.useCallback)(e=>{let t="function"==typeof e?e(y):e;g(new Set([...j].filter(e=>!t.has(e))))},[j,y]),_=(0,a.useMemo)(()=>n.length>0&&n.every(e=>y.has(e.id)),[n,y]),w=n.filter(e=>y.has(e.id)).reduce((e,t)=>
1e+(t.product.price?parseFloat(t.product.price):0)*t.quantity,0),k=b.free_shipping_threshold,S=b.metro_manila_shipping_fee,C=b.provincial_shipping_fee,F=(null==x||null==(e=x.province)?void 0:e.trim().toLowerCase())||"",E=!!F,R=F.includes("metro manila")||F.includes("ncr")||"national capital region"===F,B=E&&R?S:C,P=w>=k,q=k-w,z=w>0&&q>0&&q<=300,M=Math.min(w/k*100,100),L=w>0&&!P?B:0,V=w+L;return 0===n.length?(0,r.jsx)("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center px-4 py-12",children:(0,r.jsxs)("div",{className:"text-center max-w-md",children:[(0,r.jsx)("div",{className:"mb-4",children:(0,r.jsx)("svg",{className:"w-16 h-16 mx-auto text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M16 11V7a4 4 0 00-8 0v4M5 9h14l1 12H4L5 9z"})})}),(0,r.jsx)("h1",{className:"text-2xl font-josefin font-bold text-gray-900 mb-2",children:"Your cart is empty"}),(0,r.jsx)("p",{className:"text-gray-600 mb-6",children:"Add some products to get started!"}),(0,r.jsx)(l(),{href:"/products",className:"inline-block bg-[#751217] text-white font-medium px-8 py-3 rounded-md hover:bg-red-700 transition",children:"Continue Shopping"})]})}):(0,r.jsx)("div",{className:"min-h-screen bg-white",children:(0,r.jsxs)("div",{className:"max-w-[1920px] mx-auto px-6 sm:px-8 md:px-12 lg:px-20 xl:px-[231px] py-6 md:py-12 pb-32 md:pb-12",children:[(0,r.jsx)("nav",{className:"mb-4 md:mb-8",children:(0,r.jsxs)("p",{className:"text-sm sm:text-lg md:text-2xl font-normal text-[#7E7E7E] font-josefin",children:[(0,r.jsx)(l(),{href:"/",className:"hover:text-black",children:"Home"})," ","/ ",(0,r.jsx)("span",{children:"Shopping Cart"})]})}),(0,r.jsx)("h1",{className:"text-2xl sm:text-3xl md:text-4xl lg:text-[55.5px] font-normal leading-[1em] text-black font-josefin mb-8 md:mb-12",children:"Shopping Cart"}),(0,r.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-5 gap-8 lg:gap-[60px]",children:[(0,r.jsxs)("div",{className:"lg:col-span-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 mb-6 pb-4 border-b border-gray-300",children:[(0,r.jsx)("input",{type:"checkbox",id:"select-all",checked:_,onChange:()=>{_?N(new Set):N(new Set(n.map(e=>e.id)))},className:"w-5 h-5 rounded border-gray-300 text-[#751217] focus:ring-[#751217] cursor-pointer accent-[#751217]"}),(0,r.jsxs)("label",{htmlFor:"select-all",className:"font-poppins text-gray-700 cursor-pointer select-none",children:["Select All (",y.size," of ",n.length," items selected)"]})]}),(0,r.jsx)("div",{className:"space-y-6 md:space-y-8",children:n.map(e=>{var t,n,a,o,c,d;let m=e.product.price?parseFloat(e.product.price):0;e.quantity;let x=y.has(e.id),f=(()=>{if(e.selectedVariant){if(e.selectedVariant.bundleColors&&e.selectedVariant.bundleColors.length>0)return Array.from(new Map(e.selectedVariant.bundleColors.map(e=>[e.name,e])).values()).map(e=>e.name).join(" / ");let{color1Name:t,color2Name:n}=e.selectedVariant;if(t&&n)return"".concat(t," / ").concat(n);if(t)return t}if(e.product.color_variants&&e.product.color_variants.length>0){let t=e.product.color_variants[0];return t.color_name&&t.color2_name?"".concat(t.color_name," / ").concat(t.color2_name):t.color_name||null}return e.product.color?e.product.color.name:"BUNDLE_PRESET"===e.product.product_type?"Bundle Set":null})();return(0,r.jsxs)("div",{className:"flex gap-4 md:gap-6 border-b border-gray-200 pb-6 md:pb-8 transition-opacity ".concat(x?"":"opacity-60"),children:[(0,r.jsx)("div",{className:"flex-shrink-0 flex items-start pt-2",children:(0,r.jsx)("input",{type:"checkbox",checked:x,onChange:()=>{var t;return t=e.id,void N(e=>{let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n})},className:"w-5 h-5 rounded border-gray-300 text-[#751217] focus:ring-[#751217] cursor-pointer accent-[#751217]"})}),(0,r.jsx)(l(),{href:(0,p.F5)(e.product),className:"flex-shrink-0 w-20 h-20 md:w-24 md:h-24 lg:w-32 lg:h-32 relative bg-gray-100 rounded-lg overflow-hidden border border-black hover:opacity-80 transition-opacity",children:(0,r.jsx)(i.default,{src:(0,p.ag)(e.product,0,"thumbnail",(null==(t=e.selectedVariant)?void 0:t.bundleTemplateId)||null==(n=e.selectedVariant)?void 0:n.variantId,null==(a=e.selectedVariant)?void 0:a.bundleTemplateId),alt:e.product.name,fill:!0,sizes:"(max-width: 768px) 80px, (max-width: 1024px) 96px, 128px",className:"object-cover"})}),(0,r.jsxs)("div",{className:"flex-1 flex flex-col justify-between",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)(l(),{href:(0,p.F5)(e.product),children:(0,r.jsx)("h3",{className:"text-lg md:text-xl lg:text-2xl font-normal text-black font-josefin mb-1 hover:text-[#751217] transition-colors cursor-pointer",children:e.product.name})}),(f||(null==(o=e.selectedVariant)?void 0:o.size))&&(0,r.jsxs)("p",{className:"text-sm md:text-base text-gray-500 font-poppins mb-2",children:[f&&(0,r.jsxs)(r.Fragment,{children:["Variant: ",(0,r.jsx)("span",{className:"text-gray-700",children:f})]}),f&&(null==(c=e.selectedVariant)?void 0:c.size)&&(0,r.jsx)("span",{className:"text-gray-400",children:" | "}),(null==(d=e.selectedVariant)?void 0:d.size)&&(0,r.jsxs)(r.Fragment,{children:["Size:"," ",(0,r.jsx)("span",{className:"text-gray-700",children:e.selectedVariant.size})]})]}),(0,r.jsxs)("p",{className:"text-lg md:text-xl font-medium text-black font-poppins mb-3",children:["â±",m.toFixed(2)]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[(0,r.jsx)(u,{quantity:e.quantity,stock:e.product.stock,onUpdate:async t=>{try{await h(e.id,t)}catch(e){alert(e.message||"Failed to update quantity")}}}),(0,r.jsx)("button",{onClick:()=>s(e.id),className:"text-red-600 hover:text-red-800 font-poppins text-sm md:text-base",children:"Remove"})]})]})]},e.id)})}),(0,r.jsx)("div",{className:"mt-8",children:(0,r.jsx)(l(),{href:"/products",className:"text-black font-poppins hover:underline text-base md:text-lg",children:"â Continue Shopping"})})]}),(0,r.jsx)("div",{className:"lg:col-span-2",children:(0,r.jsxs)("div",{className:"bg-gray-50 rounded-lg p-6 md:p-8 border border-gray-200 sticky top-4",children:[(0,r.jsx)("h2",{className:"text-2xl font-normal font-josefin text-black mb-6",children:"Order Summary"}),w>0&&(0,r.jsx)("div",{className:"mb-6",children:P?(0,r.jsxs)("div",{className:"bg-green-50 border border-green-200 rounded-lg p-3 flex items-center gap-2",children:[(0,r.jsx)("svg",{className:"w-5 h-5 text-green-600 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),(0,r.jsx)("span",{className:"text-green-700 font-poppins text-sm font-medium",children:"You qualify for FREE shipping!"})]}):z?(0,r.jsxs)("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,r.jsx)("svg",{className:"w-5 h-5 text-amber-600 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,r.jsxs)("span",{className:"text-amber-700 font-poppins text-sm font-medium",children:["Add â±",q.toFixed(2)," more for FREE shipping!"]})]}),(0,r.jsx)("div",{className:"w-full bg-amber-200 rounded-full h-2",children:(0,r.jsx)("div",{className:"bg-amber-500 h-2 rounded-full transition-all duration-300",style:{width:"".concat(M,"%")}
1})})]}):(0,r.jsxs)("p",{className:"text-gray-500 font-poppins text-sm text-center",children:["Free shipping on orders â±",k.toLocaleString(),"+"]})}),(0,r.jsxs)("div",{className:"space-y-4 mb-6",children:[(0,r.jsxs)("div",{className:"flex justify-between items-center",children:[(0,r.jsx)("span",{className:"font-poppins text-gray-600",children:"Subtotal"}),(0,r.jsxs)("span",{className:"font-poppins font-medium",children:["â±",w.toFixed(2)]})]}),(0,r.jsxs)("div",{className:"flex justify-between items-center",children:[(0,r.jsx)("span",{className:"font-poppins text-gray-600",children:"Shipping"}),P?(0,r.jsx)("span",{className:"font-poppins font-medium text-green-600",children:"FREE"}):E?(0,r.jsxs)("div",{className:"text-right",children:[(0,r.jsxs)("span",{className:"font-poppins font-medium",children:["â±",B.toFixed(2)]}),(0,r.jsx)("p",{className:"font-poppins text-xs text-gray-400",children:"Based on your saved address"})]}):(0,r.jsxs)("div",{className:"text-right",children:[(0,r.jsxs)("span",{className:"font-poppins font-medium",children:["â±",B.toFixed(2)]}),(0,r.jsx)("p",{className:"font-poppins text-xs text-gray-400",children:"Estimated (exact fee shown at checkout)"})]})]}),(0,r.jsx)("div",{className:"h-px bg-gray-300"}),(0,r.jsxs)("div",{className:"flex justify-between items-center pt-4",children:[(0,r.jsx)("span",{className:"font-josefin text-lg font-normal text-black",children:"Total"}),(0,r.jsxs)("span",{className:"font-josefin text-2xl font-normal text-black",children:["â±",V.toFixed(2)]})]})]}),(0,r.jsxs)("button",{onClick:()=>{let e=Array.from(y).join(",");t.push("/checkout?items=".concat(e))},disabled:0===y.size,className:"w-full bg-[#B50303] text-white font-poppins py-3 rounded-lg hover:bg-red-700 transition font-medium text-lg mb-3 disabled:opacity-50 disabled:cursor-not-allowed flex flex-col items-center justify-center leading-tight gap-1",children:[(0,r.jsx)("span",{children:"Proceed to Checkout"}),(0,r.jsxs)("span",{className:"text-sm font-normal",children:["(",y.size," ",1===y.size?"item":"items",")"]})]}),x&&V>0&&(0,r.jsxs)("p",{className:"text-sm text-center text-gray-600 font-poppins mb-3",children:["Complete this purchase to earn up to"," ",(0,r.jsxs)("span",{className:"font-semibold text-[#751217]",children:[Math.floor(.01*V)," points"]}),"!"]}),(0,r.jsx)(l(),{href:"/products",className:"block w-full text-center text-black font-poppins py-3 border border-black rounded-lg hover:bg-gray-100 transition font-medium",children:"Continue Shopping"})]})})]})]})})}},83386:(e,t,n)=>{"use strict";n.d(t,{BR:()=>a});let r={thumbnail:{width:150,quality:80},productCard:{width:400,quality:85},productDetail:{width:800,quality:90},hero:{width:1200,quality:85},fullSize:{width:1920,quality:90}};function a(e,t){return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e)return null;if(!e.includes("supabase.co/storage"))return e;let n=new URLSearchParams;if(t.width&&n.append("width",t.width.toString()),t.height&&n.append("height",t.height.toString()),t.quality&&n.append("quality",Math.min(100,Math.max(1,t.quality)).toString()),t.format&&n.append("format",t.format),""===n.toString())return e;let r=e.includes("?")?"&":"?";return"".concat(e).concat(r).concat(n.toString())}(e,r[t])}},83804:(e,t,n)=>{"use strict";n.d(t,{F5:()=>c,Lb:()=>l,_M:()=>o,ag:()=>i,kq:()=>s});var r=n(83386);function a(e){return"/assets/product-main-image.png"}function i(e){var t,n,i,s;let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2?arguments[2]:void 0,c=arguments.length>3?arguments[3]:void 0,d=arguments.length>4?arguments[4]:void 0;if(void 0!==d&&e.bundle_templates&&e.bundle_templates.length>0){let t=e.bundle_templates.find(e=>e.id===d);if(null==t?void 0:t.image){let e=t.image;return o&&(0,r.BR)(e,o)||e}return a(e.id)}if(c&&e.color_variants&&e.color_variants.length>0){let t=e.color_variants.find(e=>e.id===c);if((null==t?void 0:t.images)&&t.images.length>0&&(null==(i=t.images[0])?void 0:i.image)){let e=t.images[0].image;return o&&(0,r.BR)(e,o)||e}return a(e.id)}if(("BUNDLE_PRESET"===e.product_type||"BUNDLE_CUSTOM"===e.product_type)&&e.bundle_templates&&e.bundle_templates.length>0){let t=e.bundle_templates[0];if(null==t?void 0:t.image){let e=t.image;return o&&(0,r.BR)(e,o)||e}}if(0===l&&(null==(t=e.primary_image)?void 0:t.image)){let t=e.primary_image.image;return o&&(0,r.BR)(t,o)||t}if(e.images&&(null==(n=e.images[l])?void 0:n.image)){let t=e.images[l].image;return o&&(0,r.BR)(t,o)||t}if(e.color_variants&&e.color_variants.length>0){for(let t of e.color_variants)if(t.images&&t.images.length>0&&(null==(s=t.images[0])?void 0:s.image)){let e=t.images[0].image;if(o)return(0,r.BR)(e,o)||e;return e}}return a(e.id)}function s(e,t,n){var i,s;let l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4?arguments[4]:void 0;if(e&&(null==(i=e[l])?void 0:i.image)){let t=e[l].image;return o&&(0,r.BR)(t,o)||t}if(t&&(null==(s=t[l])?void 0:s.image)){let e=t[l].image;return o&&(0,r.BR)(e,o)||e}return a(n)}function l(e){if(!e)return"";if(e.startsWith("http://")||e.startsWith("https://"))return e;if(!e.startsWith("/")){let t="https://api.darlingtonsocks.com/api".replace("/api","");return"".concat(t,"/media/").concat(e)}return e}function o(e,t){if(!e||!t)return null;let n=parseFloat(String(e)),r=parseFloat(String(t));if(isNaN(n)||isNaN(r)||n<=0||r>=n)return null;let a=Math.round((n-r)/n*100);return a>0?a:null}function c(e){let t=e.sku||"".concat(e.id),n=e.slug;return(!n&&e.name&&(n=e.name.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")),n)?"/product/".concat(encodeURIComponent(t),"/").concat(encodeURIComponent(n)):"/product/".concat(encodeURIComponent(t))}}},e=>{e.O(0,[2619,8490,1356,5183,858,405,8441,1255,7358],()=>e(e.s=35758)),_N_E=e.O()}]);
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.