<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4859],{4177:(e,t,r)=&gt;{"use strict";r.r(t),r.d(t,{default:()=&gt;f});var s=r(95155),a=r(12115),n=r(35695),i=r(66766),o=r(62523),l=r(30285),d=r(66695),c=r(66688),u=r(79323),m=r(88262);function f(){let[e,t]=(0,a.useState)(""),[r,f]=(0,a.useState)(""),[h,p]=(0,a.useState)(!1),g=(0,n.useRouter)(),{toast:v}=(0,m.d)(),x=async t=&gt;{t.preventDefault(),p(!0);try{let t=await (0,u.$u)(e,r);t?((0,u.wT)(t),g.push("/")):v({variant:"destructive",title:"Authentication failed",description:"Invalid username or PIN"})}catch(e){console.error("Login error:",e),v({variant:"destructive",title:"Authentication error",description:"Something went wrong. Please try again."})}finally{p(!1)}};return(0,s.jsxs)("div",{className:"flex items-center justify-center min-h-screen",children:[(0,s.jsx)("div",{className:"absolute top-4 right-4",children:(0,s.jsx)(c.U,{})}),(0,s.jsxs)(d.Zp,{className:"w-full max-w-md mx-auto shadow-lg rounded-xl overflow-hidden",children:[(0,s.jsxs)(d.aR,{className:"py-4 text-center space-y-2 border-b",children:[(0,s.jsxs)("div",{className:"flex justify-center items-center space-x-3",children:[(0,s.jsx)(i.default,{src:"/logonew.ico",alt:"MGS VIDYALA Logo",width:40,height:40,className:"rounded"}),(0,s.jsx)("h1",{className:"text-2xl font-bold",children:"MGS VIDYALA"})]}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:"Enter your credentials to continue"})]}),(0,s.jsx)(d.Wu,{className:"p-6 space-y-6",children:(0,s.jsxs)("form",{onSubmit:x,className:"space-y-6",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{htmlFor:"username",className:"text-base font-medium",children:"Username"}),(0,s.jsx)(o.p,{id:"username",placeholder:"Enter your username",value:e,onChange:e=&gt;t(e.target.value),className:"h-12",required:!0,disabled:h})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{htmlFor:"pin",className:"text-base font-medium",children:"PIN"}),(0,s.jsx)(o.p,{id:"pin",type:"password",placeholder:"Enter your PIN",value:r,onChange:e=&gt;f(e.target.value),className:"h-12",required:!0,disabled:h})]}),(0,s.jsx)(l.$,{type:"submit",className:"w-full h-12 text-base font-medium mt-6",variant:"default",disabled:h,children:h?"Logging in...":"Login"})]})})]})]})}},25631:(e,t,r)=&gt;{Promise.resolve().then(r.bind(r,4177))},30285:(e,t,r)=&gt;{"use strict";r.d(t,{$:()=&gt;l,r:()=&gt;o});var s=r(95155);r(12115);var a=r(99708),n=r(74466),i=r(59434);let o=(0,n.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&amp;_svg]:pointer-events-none [&amp;_svg:not([class*='size-'])]:size-4 shrink-0 [&amp;_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[&gt;svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[&gt;svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[&gt;svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function l(e){let{className:t,variant:r,size:n,asChild:l=!1,...d}=e,c=l?a.DX:"button";return(0,s.jsx)(c,{"data-slot":"button",className:(0,i.cn)(o({variant:r,size:n,className:t})),...d})}},42099:(e,t,r)=&gt;{"use strict";r.d(t,{N:()=&gt;i});var s=r(10851);let a="https://ywxnuadoeggqwphjyecw.supabase.co",n="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Inl3eG51YWRvZWdncXdwaGp5ZWN3Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NDMyMzkzMjksImV4cCI6MjA1ODgxNTMyOX0.BeKGmrflRckYKdTI_9Tx_2uxlKtX9imy1b7ky4QonNE";if(!a||!n)throw Error("Missing environment variables for Supabase");let i=(0,s.UU)(a,n)},59434:(e,t,r)=&gt;{"use strict";r.d(t,{cn:()=&gt;n});var s=r(52596),a=r(39688);function n(){for(var e=arguments.length,t=Array(e),r=0;r&lt;e;r++)t[r]=arguments[r];return(0,a.QP)((0,s.$)(t))}},62523:(e,t,r)=&gt;{"use strict";r.d(t,{p:()=&gt;i});var s=r(95155),a=r(12115),n=r(59434);let i=a.forwardRef((e,t)=&gt;{let{className:r,type:a,...i}=e;return(0,s.jsx)("input",{type:a,className:(0,n.cn)("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",r),ref:t,...i})});i.displayName="Input"},66688:(e,t,r)=&gt;{"use strict";r.d(t,{U:()=&gt;l});var s=r(95155);r(12115);var a=r(62098),n=r(93509),i=r(51362),o=r(30285);function l(){let{theme:e,setTheme:t}=(0,i.D)();return(0,s.jsxs)(o.$,{variant:"outline",size:"icon",onClick:()=&gt;{t("dark"===e?"light":"dark")},children:[(0,s.jsx)(a.A,{className:"h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),(0,s.jsx)(n.A,{className:"absolute h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"}),(0,s.jsx)("span",{className:"sr-only",children:"Toggle theme"})]})}},66695:(e,t,r)=&gt;{"use strict";r.d(t,{BT:()=&gt;l,Wu:()=&gt;d,ZB:()=&gt;o,Zp:()=&gt;n,aR:()=&gt;i,wL:()=&gt;c});var s=r(95155);r(12115);var a=r(59434);function n(e){let{className:t,...r}=e;return(0,s.jsx)("div",{"data-slot":"card",className:(0,a.cn)("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",t),...r})}function i(e){let{className:t,...r}=e;return(0,s.jsx)("div",{"data-slot":"card-header",className:(0,a.cn)("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",t),...r})}function o(e){let{className:t,...r}=e;return(0,s.jsx)("div",{"data-slot":"card-title",className:(0,a.cn)("leading-none font-semibold",t),...r})}function l(e){let{className:t,...r}=e;return(0,s.jsx)("div",{"data-slot":"card-description",className:(0,a.cn)("text-muted-foreground text-sm",t),...r})}function d(e){let{className:t,...r}=e;return(0,s.jsx)("div",{"data-slot":"card-content",className:(0,a.cn)("px-6",t),...r})}function c(e){let{className:t,...r}=e;return(0,s.jsx)("div",{"data-slot":"card-footer",className:(0,a.cn)("flex items-center px-6 [.border-t]:pt-6",t),...r})}},79323:(e,t,r)=&gt;{"use strict";r.d(t,{$u:()=&gt;n,HW:()=&gt;o,cn:()=&gt;u,dt:()=&gt;l,qc:()=&gt;c,wR:()=&gt;d,wT:()=&gt;i});var s=r(42099),a=r(57383);async function n(e,t){try{let{data:r,error:a}=await s.N.from("users").select("id, username, role, student_id").eq("username",e.toLowerCase()).eq("pin",t).single();if(a||!r)return console.error("Authentication error:",a),null;return"student"===r.role&amp;&amp;r.student_id&amp;&amp;await s.N.from("student_logins").insert([{student_id:r.student_id}]).select(),r}catch(e){return console.error("Authentication error:",e),null}}function i(e){try{l(),sessionStorage.setItem("user",JSON.stringify(e)),a.A.set("auth_session","true",{expires:1,path:"/",sameSite:"strict"}),a.A.set("user_id",e.id.toString(),{expires:1,path:"/",sameSite:"strict"}),a.A.set("user_role",e.role,{expires:1,path:"/",sameSite:"strict"})}catch(e){console.error("Error setting user session:",e),l()}}function o(){try{let e=sessionStorage.getItem("user");if(e)return JSON.parse(e);(a.A.get("auth_session")||a.A.get("user_role"))&amp;&amp;l()}catch(e){console.error("Error getting current user:",e),l()}return null}function l(){try{sessionStorage.removeItem("user"),a.A.remove("auth_session",{path:"/"}),a.A.remove("user_id",{path:"/"}),a.A.remove("user_role",{path:"/"})}catch(e){console.error("Error clearing user session:",e);try{sessionStorage.clear()}catch(e){}}}function d(){return null!==o()}function c(){let e=o();return null!==e&amp;&amp;"admin"===e.role}function u(){let e=o();return null!==e&amp;&amp;"student"===e.role}},88262:(e,t,r)=&gt;{"use strict";r.d(t,{d:()=&gt;m,o:()=&gt;u});var s=r(12115);let a={ADD_TOAST:"ADD_TOAST",UPDATE_TOAST:"UPDATE_TOAST",DISMISS_TOAST:"DISMISS_TOAST",REMOVE_TOAST:"REMOVE_TOAST"},n=0,i=new Map,o=(e,t)=&gt;{switch(t.type){case a.ADD_TOAST:return{...e,toasts:[t.toast,...e.toasts].slice(0,5)};case a.UPDATE_TOAST:return{...e,toasts:e.toasts.map(e=&gt;e.id===t.toast.id?{...e,...t.toast}:e)};case a.DISMISS_TOAST:{let{toastId:r}=t;return r?f(r):e.toasts.forEach(e=&gt;{f(e.id)}),{...e,toasts:e.toasts.map(e=&gt;e.id===r||void 0===r?{...e,open:!1}:e)}}case a.REMOVE_TOAST:if(void 0===t.toastId)return{...e,toasts:[]};return{...e,toasts:e.toasts.filter(e=&gt;e.id!==t.toastId)}}},l=[],d={toasts:[]};function c(e){d=o(d,e),l.forEach(e=&gt;{e(d)})}function u(e){let{...t}=e,r=(n=(n+1)%Number.MAX_VALUE).toString(),s=()=&gt;c({type:a.DISMISS_TOAST,toastId:r});return c({type:a.ADD_TOAST,toast:{...t,id:r,open:!0,onOpenChange:e=&gt;{e||s()}}}),{id:r,dismiss:s,update:e=&gt;c({type:a.UPDATE_TOAST,toast:{...e,id:r}})}}function m(){let[e,t]=s.useState(d);return s.useEffect(()=&gt;(l.push(t),()=&gt;{let e=l.indexOf(t);e&gt;-1&amp;&amp;l.splice(e,1)}),[e]),{...e,toast:u,dismiss:e=&gt;c({type:a.DISMISS_TOAST,toastId:e})}}function f(e){if(i.has(e))return;let t=setTimeout(()=&gt;{i.delete(e),c({type:a.REMOVE_TOAST,toastId:e})},1e3);i.set(e,t)}}},e=&gt;{var t=t=&gt;e(e.s=t);e.O(0,[3455,851,1604,8441,1684,7358],()=&gt;t(25631)),_N_E=e.O()}]);</pre></body></html>