(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6716],{65531:function(e,t,r){"use strict";r.d(t,{Z:function(){return i}});var a=r(2265);/**
 * @license lucide-react v0.446.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let s=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),o=(...e)=>e.filter((e,t,r)=>!!e&&r.indexOf(e)===t).join(" ");/**
 * @license lucide-react v0.446.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */var l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
 * @license lucide-react v0.446.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let n=(0,a.forwardRef)(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:s,className:n="",children:i,iconNode:c,...d},u)=>(0,a.createElement)("svg",{ref:u,...l,width:t,height:t,stroke:e,strokeWidth:s?24*Number(r)/Number(t):r,className:o("lucide",n),...d},[...c.map(([e,t])=>(0,a.createElement)(e,t)),...Array.isArray(i)?i:[i]])),i=(e,t)=>{let r=(0,a.forwardRef)(({className:r,...l},i)=>(0,a.createElement)(n,{ref:i,iconNode:t,className:o(`lucide-${s(e)}`,r),...l}));return r.displayName=`${e}`,r}},63715:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});var a=r(65531);/**
 * @license lucide-react v0.446.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let s=(0,a.Z)("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},1295:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});var a=r(65531);/**
 * @license lucide-react v0.446.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let s=(0,a.Z)("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]])},36844:function(e,t,r){Promise.resolve().then(r.bind(r,85986))},85986:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return w}});var a=r(57437),s=r(2265),o=r(16691),l=r.n(o),n=r(24033),i=r(82749),c=r(61865),d=r(38110),u=r(74578),p=r(1295),m=r(65531);/**
 * @license lucide-react v0.446.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let x=(0,m.Z)("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);var f=r(63715),h=r(62621);let v=s.forwardRef((e,t)=>{let{label:r,placeholder:o,icon:l,className:n,...i}=e,[c,d]=(0,s.useState)({x:0,y:0}),[u,p]=(0,s.useState)(!1);return(0,a.jsxs)("div",{className:"w-full relative",children:[r&&(0,a.jsx)("label",{className:"block mb-2 text-sm text-[var(--color-text-primary)]",children:r}),(0,a.jsxs)("div",{className:"relative w-full",children:[(0,a.jsx)("input",{ref:t,type:i.type||"text",className:"peer relative z-10 border-2 border-[var(--color-border)] h-12 w-full rounded-md bg-[var(--color-surface)] pl-10 pr-4 font-thin outline-none drop-shadow-sm transition-all duration-200 ease-in-out focus:bg-[var(--color-bg)] focus:border-[var(--color-text-primary)] placeholder:font-medium placeholder:text-[var(--color-text-secondary)] text-[var(--color-text-primary)] ".concat(n),placeholder:o,onMouseMove:e=>{let t=e.currentTarget.getBoundingClientRect();d({x:e.clientX-t.left,y:e.clientY-t.top})},onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),...i}),u&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"absolute pointer-events-none top-0 left-0 right-0 h-[2px] z-20 rounded-t-md overflow-hidden",style:{background:"radial-gradient(30px circle at ".concat(c.x,"px 0px, var(--color-text-primary) 0%, transparent 70%)")}}),(0,a.jsx)("div",{className:"absolute pointer-events-none bottom-0 left-0 right-0 h-[2px] z-20 rounded-b-md overflow-hidden",style:{background:"radial-gradient(30px circle at ".concat(c.x,"px 2px, var(--color-text-primary) 0%, transparent 70%)")}})]}),l&&(0,a.jsx)("div",{className:"absolute left-3 top-1/2 -translate-y-1/2 z-20 text-[var(--color-text-secondary)] peer-focus:text-[var(--color-text-primary)] transition-colors duration-200",children:l})]})]})});v.displayName="AppInput";let y=u.Ry({email:u.Z_().email("Invalid email address"),password:u.Z_().min(1,"Password is required")});var w=()=>{let e=(0,n.useRouter)(),t=(0,n.useSearchParams)(),r=t.get("callbackUrl")||"/admin/dashboard",{toast:o}=(0,h.pm)(),[u,m]=(0,s.useState)(!1),[w,b]=(0,s.useState)({x:0,y:0}),[g,j]=(0,s.useState)(!1),{register:N,handleSubmit:_,formState:{errors:S}}=(0,c.cI)({resolver:(0,d.F)(y),defaultValues:{email:"",password:""}}),k=async t=>{m(!0);try{let a=await (0,i.signIn)("credentials",{email:t.email,password:t.password,redirect:!1});(null==a?void 0:a.error)?o({variant:"destructive",title:"Authentication failed",description:"Invalid email or password"}):(o({title:"Welcome back!",description:"You have successfully signed in."}),e.push(r),e.refresh())}catch(e){o({variant:"destructive",title:"Error",description:"Something went wrong. Please try again."})}finally{m(!1)}};return(0,a.jsx)("div",{className:"h-screen w-full bg-[var(--color-bg)] flex items-center justify-center p-4 font-sans text-[var(--color-text-primary)]",children:(0,a.jsxs)("div",{className:"card w-full max-w-[1000px] flex rounded-2xl overflow-hidden shadow-2xl bg-[var(--color-surface)] h-[600px] border border-[var(--color-border)]",children:[(0,a.jsxs)("div",{className:"w-full lg:w-1/2 p-8 md:p-12 relative overflow-hidden flex flex-col justify-center",onMouseMove:e=>{let t=e.currentTarget.getBoundingClientRect();b({x:e.clientX-t.left,y:e.clientY-t.top})},onMouseEnter:()=>{j(!0)},onMouseLeave:()=>{j(!1)},children:[(0,a.jsx)("div",{className:"absolute pointer-events-none w-[500px] h-[500px] bg-gradient-to-r from-yellow-500/20 via-orange-500/20 to-yellow-600/20 rounded-full blur-3xl transition-opacity duration-200 ".concat(g?"opacity-100":"opacity-0"),style:{transform:"translate(".concat(w.x-250,"px, ").concat(w.y-250,"px)"),transition:"transform 0.1s ease-out"}}),(0,a.jsxs)("div",{className:"relative z-10 w-full max-w-sm mx-auto",children:[(0,a.jsxs)("div",{className:"text-center mb-8",children:[(0,a.jsx)("h1",{className:"text-3xl md:text-4xl font-extrabold text-[var(--color-heading)] mb-2",children:"Sign in"}),(0,a.jsx)("p",{className:"text-[var(--color-text-secondary)] text-sm",children:"Access your MusaFoods dashboard"})]}),(0,a.jsxs)("form",{onSubmit:_(k),className:"space-y-4",children:[(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(v,{placeholder:"Email",type:"email",icon:(0,a.jsx)(p.Z,{className:"w-5 h-5"}),...N("email")}),S.email&&(0,a.jsx)("p",{className:"text-red-400 text-xs mt-1 ml-1",children:S.email.message})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(v,{placeholder:"Password",type:"password",icon:(0,a.jsx)(x,{className:"w-5 h-5"}),...N("password")}),S.password&&(0,a.jsx)("p",{className:"text-red-400 text-xs mt-1 ml-1",children:S.password.message})]})]}),(0,a.jsxs)("div",{className:"flex justify-between items-center text-xs mt-2",children:[(0,a.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer text-[var(--color-text-secondary)] hover:text-[var(--color-text-primary)]",children:[(0,a.jsx)("input",{type:"checkbox",className:"rounded border-[var(--color-border)] bg-[var(--color-muted-surface)] accent-[var(--color-heading)]"}),"Remember me"]}),(0,a.jsx)("a",{href:"#",className:"text-[var(--color-text-primary)] hover:underline hover:text-[var(--color-heading)]",children:"Forgot password?"})]}),(0,a.jsxs)("button",{type:"submit",disabled:u,className:"w-full mt-6 group relative flex justify-center items-center overflow-hidden rounded-md bg-[var(--color-heading)] px-4 py-3 text-sm font-bold text-black transition-all duration-300 ease-in-out hover:shadow-lg hover:shadow-yellow-500/20 disabled:opacity-70 disabled:cursor-not-allowed",children:[(0,a.jsx)("div",{className:"absolute inset-0 flex h-full w-full justify-center [transform:skew(-13deg)_translateX(-100%)] group-hover:duration-1000 group-hover:[transform:skew(-13deg)_translateX(100%)]",children:(0,a.jsx)("div",{className:"relative h-full w-8 bg-white/40"})}),u?(0,a.jsx)(f.Z,{className:"w-5 h-5 animate-spin mr-2"}):(0,a.jsx)("span",{children:"Sign In"})]})]})]})]}),(0,a.jsxs)("div",{className:"hidden lg:flex w-1/2 relative bg-[var(--color-bg)] items-center justify-center p-12",children:[(0,a.jsx)(l(),{src:"https://musafoods.ca/wp-content/uploads/2024/05/Add-a-little-bit-of-body-text.svg",alt:"Musa Foods Logo",width:400,height:400,className:"object-contain w-full h-auto drop-shadow-2xl",priority:!0}),(0,a.jsx)("div",{className:"absolute inset-0 bg-gradient-to-t from-[var(--color-bg)] via-transparent to-transparent opacity-40 pointer-events-none"})]})]})})}},62621:function(e,t,r){"use strict";r.d(t,{pm:function(){return p}});var a=r(2265);let s=0,o=new Map,l=e=>{if(o.has(e))return;let t=setTimeout(()=>{o.delete(e),d({type:"REMOVE_TOAST",toastId:e})},1e6);o.set(e,t)},n=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,1)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case"DISMISS_TOAST":{let{toastId:r}=t;return r?l(r):e.toasts.forEach(e=>{l(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===r||void 0===r?{...e,open:!1}:e)}}case"REMOVE_TOAST":if(void 0===t.toastId)return{...e,toasts:[]};return{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}},i=[],c={toasts:[]};function d(e){c=n(c,e),i.forEach(e=>{e(c)})}function u(e){let{...t}=e,r=(s=(s+1)%Number.MAX_SAFE_INTEGER).toString(),a=()=>d({type:"DISMISS_TOAST",toastId:r});return d({type:"ADD_TOAST",toast:{...t,id:r,open:!0,onOpenChange:e=>{e||a()}}}),{id:r,dismiss:a,update:e=>d({type:"UPDATE_TOAST",toast:{...e,id:r}})}}function p(){let[e,t]=a.useState(c);return a.useEffect(()=>(i.push(t),()=>{let e=i.indexOf(t);e>-1&&i.splice(e,1)}),[e]),{...e,toast:u,dismiss:e=>d({type:"DISMISS_TOAST",toastId:e})}}},67650:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"RouterContext",{enumerable:!0,get:function(){return o}});let a=r(21024),s=a._(r(2265)),o=s.default.createContext(null)},30622:function(e,t,r){"use strict";/**
 * @license React
 * react-jsx-runtime.production.min.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var a=r(2265),s=Symbol.for("react.element"),o=Symbol.for("react.fragment"),l=Object.prototype.hasOwnProperty,n=a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function c(e,t,r){var a,o={},c=null,d=null;for(a in void 0!==r&&(c=""+r),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(d=t.ref),t)l.call(t,a)&&!i.hasOwnProperty(a)&&(o[a]=t[a]);if(e&&e.defaultProps)for(a in t=e.defaultProps)void 0===o[a]&&(o[a]=t[a]);return{$$typeof:s,type:e,key:c,ref:d,props:o,_owner:n.current}}t.Fragment=o,t.jsx=c,t.jsxs=c},57437:function(e,t,r){"use strict";e.exports=r(30622)},24033:function(e,t,r){e.exports=r(20290)}},function(e){e.O(0,[389,2749,329,2971,7864,1744],function(){return e(e.s=36844)}),_N_E=e.O()}]);