module.exports=[63024,a=>{"use strict";a.s(["default",()=>f]);var b=a.i(87924),c=a.i(32886),d=a.i(38246),e=a.i(46271);let f=({data:a})=>{let f="ar"===(0,c.useLocale)();return(0,b.jsxs)(e.motion.section,{initial:{opacity:0,y:40},animate:{opacity:1,y:0},transition:{duration:.8,ease:"easeOut"},className:"w-full px-16 py-10 h-[200px] cc bg-gradient-to-r from-[#2F537D] to-[#1d3f83] relative overflow-hidden",children:[(0,b.jsx)(e.motion.div,{className:"absolute inset-0 bg-[radial-gradient(circle_at_30%_30%,rgba(255,255,255,0.1),transparent_60%)]",animate:{backgroundPosition:["0% 0%","100% 100%","0% 0%"]},transition:{duration:10,repeat:1/0,ease:"linear"}}),(0,b.jsxs)(e.motion.p,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.3,duration:.6},className:"relative text-sm md:text-md text-white font-medium",children:[(0,b.jsx)(d.default,{className:"hover:text-blue-200 duration-200",href:"/",children:f?"الرئيسية":"Home Page"})," ",a.title]}),(0,b.jsx)(e.motion.h1,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.5,duration:.8},className:"relative text-2xl max-md:text-lg md:text-5xl font-[500] text-white mt-3 drop-shadow-md",children:a.title})]})}},5666,a=>{"use strict";a.s(["default",()=>f]);var b=a.i(87924),c=a.i(32886),d=a.i(72131),e=a.i(8560);let f=({placeholder:a,onSearch:f})=>{let g="ar"===(0,c.useLocale)(),[h,i]=(0,d.useState)("");return(0,b.jsxs)("div",{className:"flex items-center gap-2 w-full",children:[(0,b.jsxs)("div",{className:"relative flex-1",children:[(0,b.jsx)("span",{className:`absolute top-1/2 -translate-y-1/2 text-gray-400 ${g?"right-3":"left-3"}`,children:(0,b.jsx)(e.CiSearch,{size:20})}),(0,b.jsx)("input",{className:`w-full h-10 rounded-xl outline-none border border-gray-200 shadow-sm text-sm ${g?"pr-10 pl-4 text-right":"pl-10 pr-4 text-left"}`,type:"text",placeholder:a||(g?"بحث عن كوبون أو عرض":"Search for coupon or offer"),value:h,onChange:a=>{let b=a.target.value;i(b),f(b)}})]}),(0,b.jsx)("button",{className:"w-10 h-10 rounded-xl bg-[#2F537D] text-white flex items-center justify-center cursor-pointer hover:bg-[#2f537dd1]",onClick:()=>f(h),children:(0,b.jsx)(e.CiSearch,{size:20})})]})}},61212,a=>{"use strict";a.s(["default",()=>v],61212);var b=a.i(87924),c=a.i(63024),d=a.i(72131),e=a.i(27965),f=a.i(32886),g=a.i(9610),h=a.i(38246),i=a.i(31173),j=a.i(71682),k=a.i(46964),l=a.i(46271),m=a.i(62036);let n=({onFilterChange:a})=>{let c="ar"===(0,f.useLocale)(),e=(0,g.useTranslations)("coupons.filter"),{data:n,isLoading:o}=(0,k.useGetAllCountries)(),[p,q]=(0,d.useState)(),[r,s]=(0,d.useState)(),[t,u]=(0,d.useState)(),{data:v,isLoading:w}=(0,k.useGetAllStates)(p),{data:x,isLoading:y}=(0,k.useGetAllCities)(r),z=n?.data||[],A=v?.data||[],B=x?.data||[],C=(0,d.useCallback)(()=>{a({countryId:p,stateId:r,cityId:t})},[p,r,t,a]);(0,d.useEffect)(()=>{C()},[C]);let D=({label:a,icon:c,options:f,value:g,onChange:h,placeholder:j,disabled:k})=>{let[n,o]=(0,d.useState)(!1),p=(0,d.useRef)(null);(0,d.useEffect)(()=>{let a=a=>{p.current&&!p.current.contains(a.target)&&o(!1)};return document.addEventListener("mousedown",a),()=>{document.removeEventListener("mousedown",a)}},[]);let q=f.find(a=>a.id===g);return(0,b.jsxs)("div",{className:"relative w-56",ref:p,children:[(0,b.jsx)("label",{className:"block mb-1 text-sm font-medium text-gray-700",children:a}),(0,b.jsxs)("div",{onClick:()=>!k&&o(a=>!a),className:`flex items-center justify-between rounded-xl px-3 py-3 h-12 cursor-pointer transition-all border
            ${k?"bg-gray-100 text-gray-400 cursor-not-allowed border-gray-200":"bg-white border-gray-300 hover:shadow-sm"}`,children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 w-full overflow-hidden",children:[(0,b.jsx)("span",{className:"text-[#85A5E0] flex-shrink-0",children:c}),(0,b.jsx)("span",{className:`truncate block w-full ${!q?"text-gray-400":""}`,children:q?q.name:j})]}),(0,b.jsx)(i.IoIosArrowDown,{className:`flex-shrink-0 transition-transform duration-300 text-gray-500 ${n?"rotate-180":"rotate-0"}`})]}),(0,b.jsx)(m.AnimatePresence,{children:n&&(0,b.jsx)(l.motion.div,{initial:{opacity:0,y:-10,scaleY:.95},animate:{opacity:1,y:0,scaleY:1},exit:{opacity:0,y:-10,scaleY:.95},transition:{duration:.2,ease:"easeOut"},className:"absolute left-0 right-0 mt-2 bg-white rounded-xl shadow-xl z-30 origin-top overflow-hidden border border-gray-100",children:0===f.length?(0,b.jsx)("div",{className:"px-4 py-3 text-gray-400 text-sm text-center",children:e("noData")}):(0,b.jsx)("div",{className:"max-h-60 overflow-y-auto custom-scroll",children:f.map(a=>(0,b.jsx)("div",{onClick:()=>{h(a.id),o(!1)},className:`px-4 py-3 text-sm cursor-pointer truncate transition-all 
                        ${a.id===g?"bg-[#DAE5F1] text-[#2F537D]":"hover:bg-gray-100"}`,children:a.name},a.id))})},"dropdown")})]})};return(0,b.jsxs)("section",{className:"w-full flex flex-col md:flex-row items-center justify-between py-5 gap-5",children:[(0,b.jsxs)("p",{className:"flex justify-center text-[#3469CC] items-center text-lg gap-2",children:[c?(0,b.jsx)(i.IoIosArrowRoundForward,{size:25}):(0,b.jsx)(i.IoIosArrowRoundBack,{size:25}),(0,b.jsx)(h.default,{href:"/",children:e("breadcrumbHome")})]}),(0,b.jsxs)("div",{className:"flex justify-center items-center gap-5 flex-wrap",children:[(0,b.jsx)(D,{label:e("country"),icon:(0,b.jsx)(j.FaGlobe,{}),options:z,value:p,onChange:a=>{q(a),s(void 0),u(void 0)},placeholder:o?e("loading"):e("selectCountry"),disabled:o}),(0,b.jsx)(D,{label:e("region"),icon:(0,b.jsx)(j.FaMapMarkedAlt,{}),options:A,value:r,onChange:a=>{s(a),u(void 0)},placeholder:w?e("loading"):e("selectRegion"),disabled:!p||w}),(0,b.jsx)(D,{label:e("city"),icon:(0,b.jsx)(j.FaCity,{}),options:B,value:t,onChange:u,placeholder:y?e("loading"):e("selectCity"),disabled:!r||y})]})]})};var o=a.i(56973),p=a.i(5666),q=a.i(71987);let r=({src:a,alt:c,onClick:d})=>(0,b.jsx)("div",{onClick:d,className:"rounded-xl max-h-[200px] hover:scale-105 duration-300 overflow-hidden cursor-pointer",children:(0,b.jsx)(q.default,{src:a,alt:c,width:450,height:180})}),s=({tabs:a,activeTab:c,onTabChange:d,Arabic:e=!1})=>{let f=a.findIndex(a=>a.key===c),g=100/a.length;return(0,b.jsxs)("div",{className:"w-full flex flex-col items-center mb-6",children:[(0,b.jsx)("div",{className:"w-full flex justify-center gap-5",children:a.map(a=>{let e=c===a.key;return(0,b.jsx)("button",{onClick:()=>d(a.key),className:`w-full h-12 rounded-2xl cursor-pointer transition-all duration-300 
                ${e?"bg-[#DAE5F1] text-[#2F537D]":"bg-gray-100 text-gray-700 hover:bg-gray-200"}`,children:a.label},a.key)})}),(0,b.jsx)("div",{className:"relative w-full h-[4px] mt-2 rounded-full overflow-hidden bg-[#DAE5F1]",children:(0,b.jsx)("div",{className:"absolute top-0 h-full rounded-full transition-all duration-500 ease-in-out",style:{[e?"right":"left"]:`${f*g}%`,width:`${g}%`,background:e?"linear-gradient(to left, #2F537D, #DAE5F1)":"linear-gradient(to right, #2F537D, #DAE5F1)"}})})]})};var t=a.i(48617);let u=({title:a,desc:c,discount:d,expiry_date:e,image_url:f,shop:g,onClose:h})=>(0,b.jsx)(m.AnimatePresence,{children:(0,b.jsx)(l.motion.div,{className:"fixed inset-0 bg-black/50 backdrop-blur-sm  flex justify-center items-center z-50",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},children:(0,b.jsxs)(l.motion.div,{initial:{scale:.8,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.8,opacity:0},transition:{duration:.3,ease:"easeOut"},className:"bg-white rounded-2xl px-10 shadow-2xl w-[90%] max-w-3xl overflow-hidden relative mt-8",children:[(0,b.jsx)("button",{onClick:h,className:"absolute top-3 left-3 text-gray-600 hover:text-black text-2xl",children:"✕"}),(0,b.jsxs)("div",{className:"p-6 flex flex-col gap-4 mt-10",children:[(0,b.jsx)("div",{className:"flex justify-between items-center flex-wrap gap-2",children:(0,b.jsx)("h2",{className:"text-2xl font-bold text-gray-800",children:a})}),(0,b.jsxs)("div",{className:"flex items-center  justify-between gap-2 text-gray-600",children:[(0,b.jsx)("span",{className:"font-medium",children:"ينتهي في:"}),(0,b.jsxs)("div",{className:"flex items-center gap-1 text-gray-700",children:[(0,b.jsx)(t.IoCalendarOutline,{size:18}),(0,b.jsx)("span",{children:e||"غير محدد"})]})]})]}),(0,b.jsx)("div",{className:" pt-0",children:(0,b.jsx)(q.default,{src:f||"/hero.png",alt:a,width:800,height:400,className:"w-full h-72 object-cover rounded-xl"})})]})})}),v=()=>{let a="ar"===(0,f.useLocale)(),h=(0,g.useTranslations)("coupons"),[i,j]=(0,d.useState)("copon"),[l,m]=(0,d.useState)({}),[q,t]=(0,d.useState)(""),[v,w]=(0,d.useState)(null),{data:x,isLoading:y,error:z,isFetching:A}=(0,k.useGetOffers)({...l,type:"copon"===i?void 0:i}),B=(0,d.useMemo)(()=>x?.data?x.data.map(a=>({id:a.id,src:a.image_url||"/hero.png",alt:a.title||"Offer",title:a.title||"",offerId:a.id,type:"const"===a.type?"copon":"offer"})):[],[x]),C=(0,d.useMemo)(()=>{let a=B;if("copon"!==i&&(a=a.filter(a=>a.type===i)),""!==q.trim()){let b=q.toLowerCase();a=a.filter(a=>a.title.toLowerCase().includes(b))}return a},[B,i,q]),D=(0,d.useCallback)(a=>{m({country_id:a.countryId,state_id:a.stateId,city_id:a.cityId})},[]);return(0,b.jsxs)("section",{className:"w-full min-h-[80vh] bg-gray-50",children:[(0,b.jsx)(c.default,{data:{title:h("title")}}),(0,b.jsx)("div",{className:"px-16 max-md:px-8 bg-gray-100 pb-10 py-10 max-lg:px-8",children:(0,b.jsx)(e.default,{slides:C})}),(0,b.jsxs)("div",{className:"w-full min-h-[40vh] px-16 max-md:px-8 py-10",children:[(0,b.jsx)(n,{onFilterChange:D}),(0,b.jsxs)("section",{className:"w-full flex-wrap flex justify-between",children:[(0,b.jsx)("div",{children:(0,b.jsxs)("p",{className:"flex justify-center max-lg:py-5 items-center text-lg gap-2",children:[(0,b.jsx)(o.BsHandbag,{size:20,color:"#3469CC"}),h("couponsAndOffers")]})}),(0,b.jsx)("div",{children:(0,b.jsx)(p.default,{onSearch:t,placeholder:a?"ابحث عن عرض أو كوبون":"Search for an offer or coupon"})})]}),(0,b.jsxs)("section",{className:"w-full py-10",children:[(0,b.jsx)(s,{Arabic:a,tabs:[{key:"copon",label:h("tabs.coupon")},{key:"offer",label:h("tabs.offer")}],activeTab:i,onTabChange:a=>j(a)}),A&&(0,b.jsx)("div",{className:"text-center py-2",children:(0,b.jsx)("p",{className:"text-blue-500",children:h("updating")})}),(0,b.jsx)("hr",{}),(0,b.jsx)("div",{className:"   grid    gap-6    mt-8    grid-cols-1    sm:grid-cols-2    lg:grid-cols-3    place-items-center   ",children:y?(0,b.jsx)("div",{className:"col-span-full text-center py-10",children:(0,b.jsx)("p",{children:h("loading")})}):z?(0,b.jsx)("div",{className:"col-span-full text-center py-10",children:(0,b.jsx)("p",{className:"text-red-500",children:h("error")})}):C.length>0?C.map(a=>{let c=x?.data.find(b=>b.id===a.id);return(0,b.jsx)(r,{src:a.src,alt:a.alt,onClick:()=>w(c)},a.id)}):(0,b.jsx)("div",{className:"col-span-full text-center py-10",children:(0,b.jsx)("p",{className:"text-lg text-gray-500",children:h("noData")})})})]})]}),v&&(0,b.jsx)(u,{title:v.title,desc:v.desc,discount:v.discount_type,expiry_date:v.expiry_date,image_url:v.image_url,shop:v.shop,onClose:()=>w(null)})]})}}];

//# sourceMappingURL=src_b1c9dec6._.js.map