(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,39110,e=>{"use strict";var t=e.i(22152),a=e.i(2732),l=e.i(52313),s=e.i(28175);let r="seller_token_v1",o="seller_session_v1";async function i(e){try{let t=await e.json();return t?.message||t?.error||""}catch{try{return await e.text()}catch{return""}}}function n(){let e=(0,s.useRouter)(),n=(0,l.useMemo)(()=>t.default.env.NEXT_PUBLIC_API_BASE||"http://localhost:5000",[]),[d,c]=(0,l.useState)(""),[m,u]=(0,l.useState)(""),[h,x]=(0,l.useState)(""),[g,w]=(0,l.useState)(!1),p=async()=>{x("");let t=d.trim().toLowerCase(),a=m.trim();if(!t||!a)return x("Email এবং Password দিন");w(!0);try{let l=await fetch(`${n}/api/sellers/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:t,password:a})});if(!l.ok){let e=await i(l);throw Error(e||"Wrong Email / Password")}let s=await l.json();if(!s?.token)throw Error("Token পাওয়া যায়নি");localStorage.setItem(r,s.token),localStorage.setItem(o,JSON.stringify({sellerId:s.seller?.id,name:s.seller?.name,email:s.seller?.email,ts:new Date().toISOString()}));try{document.cookie=`${r}=${encodeURIComponent(s.token)}; Max-Age=2592000; Path=/; SameSite=Lax`,document.cookie=`${o}=${encodeURIComponent(JSON.stringify({sellerId:s.seller?.id,name:s.seller?.name}))}; Max-Age=2592000; Path=/; SameSite=Lax`}catch{}e.replace("/seller")}catch(e){x(e?.message||"Login failed")}finally{w(!1)}};return(0,a.jsx)("div",{className:"min-h-screen bg-[#0f0f0f] flex items-center justify-center px-4",children:(0,a.jsxs)("div",{className:"w-full max-w-[520px] bg-[#1b1b1b] border border-white/10 rounded-3xl p-8",children:[(0,a.jsx)("div",{className:"text-white text-2xl font-bold",children:"Seller Login"}),(0,a.jsx)("div",{className:"text-gray-400 text-sm mt-2",children:"Login with your Email and Password"}),(0,a.jsxs)("div",{className:"mt-8 space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-gray-300 text-sm",children:"Email"}),(0,a.jsx)("input",{value:d,onChange:e=>c(e.target.value),placeholder:"seller@email.com",className:"mt-2 w-full rounded-2xl px-5 py-3 bg-[#2a2a2a] text-white outline-none border border-white/10 focus:border-white/30"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-gray-300 text-sm",children:"Password"}),(0,a.jsx)("input",{value:m,onChange:e=>u(e.target.value),placeholder:"password",type:"password",className:"mt-2 w-full rounded-2xl px-5 py-3 bg-[#2a2a2a] text-white outline-none border border-white/10 focus:border-white/30",onKeyDown:e=>{"Enter"===e.key&&p()}})]}),h&&(0,a.jsx)("div",{className:"text-red-400 text-sm",children:h}),(0,a.jsx)("button",{onClick:p,disabled:g,className:"mt-2 w-full rounded-2xl py-3 bg-white text-black font-semibold hover:opacity-90 active:scale-[0.99] transition disabled:opacity-60",children:g?"Logging in...":"Login"})]})]})})}e.s(["default",()=>n])}]);