(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5495],{6707:(e,t,r)=>{"use strict";r.d(t,{A:()=>i,AuthProvider:()=>l});var o=r(95155),a=r(12115);let n=(0,a.createContext)(void 0);function l(e){let{children:t}=e,[r,l]=(0,a.useState)(null),[i,s]=(0,a.useState)(null),[c,d]=(0,a.useState)(!0);(0,a.useEffect)(()=>{window.KOMERO=!0;let e=localStorage.getItem("authToken"),t=localStorage.getItem("user");if(e&&t)try{l(JSON.parse(t)),s(e)}catch(e){localStorage.removeItem("authToken"),localStorage.removeItem("user")}d(!1)},[]);let u=async(e,t)=>{try{let r=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e,password:t})});if(!r.ok)return null;let o=await r.json(),a=o.token;return localStorage.setItem("authToken",a),localStorage.setItem("user",JSON.stringify(o.user)),l(o.user),s(a),{user:o.user,token:a}}catch(e){return null}};return(0,o.jsx)(n.Provider,{value:{user:r,token:i,login:u,logout:()=>{l(null),s(null),localStorage.removeItem("user"),localStorage.removeItem("authToken")},isLoading:c,getToken:()=>i||localStorage.getItem("authToken")},children:t})}function i(){let e=(0,a.useContext)(n);if(!e)throw Error("useAuth must be used within an AuthProvider");return e}},18955:(e,t,r)=>{"use strict";r.d(t,{c:()=>n});var o=r(902);function a(e,t){return(...e)=>{try{return t(...e)}catch{throw Error(void 0)}}}let n=a(0,o.c3);a(0,o.kc)},34339:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>d});var o=r(95155),a=r(12115),n=r(73229),l=r(6707),i=r(18955),s=r(95517);let c={bg:"#111111",surface:"#1a1a1a",surface2:"#222222",surface3:"#2a2a2a",border:"#2c2c2c",borderFoc:"#3b97e3",text:"#d0d0d0",muted:"#888",dim:"#4a4a4a",accent:"#3b97e3",danger:"#e34b3b"};function d(){let[e,t]=(0,a.useState)(""),[r,d]=(0,a.useState)(""),[u,p]=(0,a.useState)(""),[f,m]=(0,a.useState)(!1),[g,h]=(0,a.useState)(null),{login:x}=(0,l.A)(),b=(0,n.rd)(),y=(0,i.c)("login"),v=async t=>{t.preventDefault(),p(""),m(!0);try{let t=await x(e.trim(),r);if(!t)return void p(y("invalidCredentials"));let o=(t.user.role||"").toLowerCase();b.push("admin"===o?"/":"/tenants")}catch(e){p(y("errorOccurred"))}finally{m(!1)}};return(0,o.jsxs)("div",{style:{minHeight:"100vh",background:c.bg,display:"flex",alignItems:"center",justifyContent:"center",padding:"24px 16px",position:"relative",overflow:"hidden"},children:[(0,o.jsx)("div",{style:{position:"absolute",inset:0,pointerEvents:"none",backgroundImage:"linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px)",backgroundSize:"32px 32px"}}),(0,o.jsx)("div",{style:{position:"absolute",top:"40%",left:"50%",transform:"translate(-50%, -50%)",width:480,height:320,background:"radial-gradient(ellipse, rgba(59,151,227,0.055) 0%, transparent 70%)",pointerEvents:"none"}}),(0,o.jsx)("div",{style:{position:"absolute",top:14,right:14,zIndex:10},children:(0,o.jsx)("div",{style:{padding:"4px 8px",borderRadius:5,background:c.surface2,border:"1px solid ".concat(c.border)},children:(0,o.jsx)(s.c,{})})}),(0,o.jsxs)("div",{style:{position:"relative",zIndex:1,width:"100%",maxWidth:380,background:c.surface,border:"1px solid ".concat(c.border),borderRadius:10,boxShadow:"0 32px 80px rgba(0,0,0,0.7), 0 2px 0 rgba(255,255,255,0.03) inset",overflow:"hidden",animation:"loginFadeIn 0.25s ease-out forwards"},children:[(0,o.jsx)("div",{style:{height:2,background:"linear-gradient(90deg, transparent, ".concat(c.accent,", transparent)")}}),(0,o.jsxs)("div",{style:{padding:"28px 28px 20px",borderBottom:"1px solid ".concat(c.border),background:c.surface2},children:[(0,o.jsx)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:12},children:(0,o.jsx)("img",{src:"/branding/logo.png",alt:"KOMERO",style:{height:24,width:"auto",objectFit:"contain"},onError:e=>e.currentTarget.style.display="none"})}),(0,o.jsx)("h1",{style:{fontSize:16,fontWeight:700,color:c.text,fontFamily:"monospace",letterSpacing:"0.04em",marginBottom:3},children:y("title")}),(0,o.jsx)("p",{style:{fontSize:11,color:c.muted,fontFamily:"monospace"},children:y("subtitle")})]}),(0,o.jsxs)("form",{onSubmit:v,style:{padding:"22px 28px 28px",display:"flex",flexDirection:"column",gap:16},children:[(0,o.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:5},children:[(0,o.jsx)("label",{style:{fontSize:10,fontWeight:700,fontFamily:"monospace",letterSpacing:"0.1em",textTransform:"uppercase",color:c.dim},children:y("emailLabel")}),(0,o.jsx)("input",{type:"text",value:e,onChange:e=>t(e.target.value),onFocus:()=>h("email"),onBlur:()=>h(null),required:!0,placeholder:y("emailPlaceholder"),style:{padding:"9px 12px",background:c.surface3,border:"1px solid ".concat("email"===g?c.borderFoc:c.border),borderRadius:5,fontSize:12,fontFamily:"monospace",color:c.text,outline:"none",transition:"border-color 0.15s",boxShadow:"email"===g?"0 0 0 3px rgba(59,151,227,0.1)":"none"}})]}),(0,o.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:5},children:[(0,o.jsx)("label",{style:{fontSize:10,fontWeight:700,fontFamily:"monospace",letterSpacing:"0.1em",textTransform:"uppercase",color:c.dim},children:y("passwordLabel")}),(0,o.jsx)("input",{type:"password",value:r,onChange:e=>d(e.target.value),onFocus:()=>h("password"),onBlur:()=>h(null),required:!0,placeholder:y("passwordPlaceholder"),style:{padding:"9px 12px",background:c.surface3,border:"1px solid ".concat("password"===g?c.borderFoc:c.border),borderRadius:5,fontSize:12,fontFamily:"monospace",color:c.text,outline:"none",transition:"border-color 0.15s",boxShadow:"password"===g?"0 0 0 3px rgba(59,151,227,0.1)":"none"}})]}),u&&(0,o.jsx)("div",{style:{padding:"8px 12px",borderRadius:5,background:"rgba(227,75,59,0.08)",border:"1px solid rgba(227,75,59,0.25)",fontSize:11,fontFamily:"monospace",color:c.danger},children:u}),(0,o.jsx)("button",{type:"submit",disabled:f,style:{display:"flex",alignItems:"center",justifyContent:"center",gap:7,padding:"10px 0",borderRadius:5,background:f?c.surface3:c.accent,border:"1px solid ".concat(f?c.border:c.accent),color:f?c.muted:"#fff",fontSize:11,fontWeight:800,fontFamily:"monospace",letterSpacing:"0.1em",textTransform:"uppercase",cursor:f?"not-allowed":"pointer",transition:"opacity 0.15s",opacity:f?.7:1,marginTop:4},children:f?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{style:{width:13,height:13,borderRadius:"50%",border:"2px solid ".concat(c.dim),borderTopColor:c.accent,animation:"loginSpin 0.6s linear infinite",display:"inline-block"}}),y("signingIn")]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,o.jsx)("path",{d:"M15 3h4a2 2 0 012 2v14a2 2 0 01-2 2h-4M10 17l5-5-5-5M15 12H3"})}),y("signIn")]})})]})]}),(0,o.jsx)("style",{children:"\n @keyframes loginFadeIn { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }\n @keyframes loginSpin { to { transform: rotate(360deg); } }\n "})]})}},55251:(e,t,r)=>{"use strict";r.d(t,{A:()=>f});var o=r(20063),a=r(12115),n=r.t(a,2),l=r(902),i=n["use".trim()],s=r(4106),c=r(64707),d=r(85919),u=r(95155),p=r(57301);function f(e){let{Link:t,config:r,getPathname:n,...f}=function(e,t){var r,n,l;let p={...r=t||{},localePrefix:"object"==typeof(l=r.localePrefix)?l:{mode:l||"always"},localeCookie:!!((n=r.localeCookie)??1)&&{name:"NEXT_LOCALE",sameSite:"lax",..."object"==typeof n&&n},localeDetection:r.localeDetection??!0,alternateLinks:r.alternateLinks??!0},f=p.pathnames,m=(0,a.forwardRef)(function({href:t,locale:r,...o},a){let n,l;"object"==typeof t?(n=t.pathname,l=t.params):n=t;let d=(0,s._x)(t),m=e(),h=(0,s.yL)(m)?i(m):m,x=d?g({locale:r||h,href:null==f?n:{pathname:n,params:l},forcePrefix:null!=r||void 0}):n;return(0,u.jsx)(c.default,{ref:a,href:"object"==typeof t?{...t,pathname:x}:x,locale:r,localeCookie:p.localeCookie,...o})});function g(e){let t,{forcePrefix:r,href:o,locale:a}=e;return null==f?"object"==typeof o?(t=o.pathname,o.query&&(t+=(0,d.Zn)(o.query))):t=o:t=(0,d.FP)({locale:a,...(0,d.TK)(o),pathnames:p.pathnames}),(0,d.x3)(t,a,p,r)}function h(e){return function(t,...r){return e(g(t),...r)}}return{config:p,Link:m,redirect:h(o.redirect),permanentRedirect:h(o.permanentRedirect),getPathname:g}}(l.Ym,e);return{...f,Link:t,usePathname:function(){let e=function(e){let t=(0,o.usePathname)(),r=(0,l.Ym)();return(0,a.useMemo)(()=>{if(!t)return t;let o=t,a=(0,s.XP)(r,e.localePrefix);if((0,s.wO)(a,t))o=(0,s.MY)(t,a);else if("never"!==e.localePrefix.mode&&e.localePrefix.prefixes){let e=(0,s.bL)(r);(0,s.wO)(e,t)&&(o=(0,s.MY)(t,e))}return o},[e.localePrefix,r,t])}(r),t=(0,l.Ym)();return(0,a.useMemo)(()=>e&&r.pathnames?(0,d.aM)(t,e,r.pathnames):e,[t,e])},useRouter:function(){let e=(0,o.useRouter)(),t=(0,l.Ym)(),i=(0,o.usePathname)();return(0,a.useMemo)(()=>{function o(e){return function(o,a){let{locale:l,...s}=a||{},c=[n({href:o,locale:l||t,forcePrefix:null!=l||void 0})];Object.keys(s).length>0&&c.push(s),(0,p.A)(r.localeCookie,i,t,l),e(...c)}}return{...e,push:o(e.push),replace:o(e.replace),prefetch:o(e.prefetch)}},[t,i,e])},getPathname:n}}},73229:(e,t,r)=>{"use strict";r.d(t,{N_:()=>n,a8:()=>i,rd:()=>s});var o=r(55251);let a=(0,r(84497).A)({locales:["en","ka"],defaultLocale:"ka",localePrefix:"always"}),{Link:n,redirect:l,usePathname:i,useRouter:s}=(0,o.A)(a)},84497:(e,t,r)=>{"use strict";function o(e){return e}r.d(t,{A:()=>o})},91614:(e,t,r)=>{Promise.resolve().then(r.bind(r,34339))},95517:(e,t,r)=>{"use strict";r.d(t,{c:()=>i});var o=r(95155),a=r(902),n=r(73229),l=r(12115);function i(){let e=(0,a.Ym)(),t=(0,n.rd)(),r=(0,n.a8)(),[i,s]=(0,l.useTransition)();return(0,o.jsx)("div",{className:"flex items-center gap-1",children:[{code:"en",label:"EN"},{code:"ka",label:"KA"}].map(a=>{let n=a.code===e;return(0,o.jsx)("button",{onClick:()=>{var o;(o=a.code)===e||i||s(()=>{t.push(r,{locale:o})})},disabled:i,className:"px-2.5 py-1 text-[12px] font-extrabold rounded-md transition-all duration-200 ".concat(n?"bg-brand-500 text-white shadow-sm":"text-gray-500 hover:text-gray-900 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-800"," ").concat(i?"opacity-50 cursor-not-allowed":""),children:a.label},a.code)})})}}},e=>{e.O(0,[4707,8441,1255,7358],()=>e(e.s=91614)),_N_E=e.O()}]);