1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[626],{4480:function(e,t,n){Promise.resolve().then(n.bind(n,7902))},7902:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return h}});var r=n(7437),a=n(2265),s=n(6463),l=n(3259),i=n(1154),u=n(7934);let c=(0,u.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"}]]),o=(0,u.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 d=n(7296),m=n(919);function h(){let e=(0,s.useRouter)(),{user:t,loading:n,signIn:u,signOut:h,isAdmin:x,partnerSlug:f,clients:p,role:g}=(0,l.a)(),[y,w]=(0,a.useState)(""),[b,v]=(0,a.useState)(""),[j,N]=(0,a.useState)(null),[k,I]=(0,a.useState)(!1),[S,C]=(0,a.useState)(!1),[z,A]=(0,a.useState)(null);function _(e){return!e||!e.startsWith("/")||e.startsWith("//")||e.startsWith("/\\")?null:e}function R(e,t){return e?"/legacy":t?"/"+t:"/"}async function Z(e){e.preventDefault(),N(null),C(!1),I(!0);try{if(!z&&!y.endsWith("@bizspring.co.kr")){N("ê´ë¦¬ì ê³ì (@bizspring.co.kr)ë§ ë¡ê·¸ì¸í ì ììµëë¤."),I(!1);return}let e=await u(y,b);if(e.error){N(e.error.includes("Invalid login")?"ì´ë©ì¼ ëë ë¹ë°ë²í¸ê° ì¬ë°ë¥´ì§ ììµëë¤.":e.error),I(!1);return}if(e.noRole){C(!0),I(!1);return}let n=new URLSearchParams(window.location.search),r=_(n.get("redirect"));if(r)window.location.href=r;else if(z)window.location.href="/";else{var t;window.location.href=R(!!e.isAdmin,null!==(t=e.partnerSlug)&&void 0!==t?t:null)}}catch(e){N("ë¡ê·¸ì¸ ì¤ ì¤ë¥ê° ë°ìíìµëë¤. ë¤ì ìëí´ì£¼ì¸ì."),I(!1)}}return(0,a.useEffect)(()=>{let e=new URLSearchParams(window.location.search).get("partner");if(e){A(e);return}let t=window.location.hostname;for(let e of["bmp.ai","brand-hub-six.vercel.app"])if(t.endsWith("."+e)){let n=t.replace("."+e,"").split(".").pop();if(n&&"www"!==n){A(n);return}}},[]),((0,a.useEffect)(()=>{if(!n&&t&&g){let t=_(new URLSearchParams(window.location.search).get("redirect"));t?e.replace(t):z?e.replace("/"):e.replace(R(x,f))}},[n,t,g,x,f,z]),n)?(0,r.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-gray-50",children:(0,r.jsx)(i.Z,{className:"w-8 h-8 animate-spin text-gray-400"})}):(0,r.jsx)("div",{className:"min-h-screen bg-gradient-to-br from-gray-900 via-gray-800 to-gray-900 flex items-center justify-center px-4",children:(0,r.jsxs)("div",{className:"w-full max-w-sm",children:[(0,r.jsxs)("div",{className:"text-center mb-8",children:[(0,r.jsx)("div",{className:"inline-flex items-center justify-center w-14 h-14 rounded-2xl bg-white/10 backdrop-blur mb-4",children:(0,r.jsx)("span",{className:"text-lg font-black tracking-tight text-white",children:"bmp"})}),(0,r.jsx)("h1",{className:"text-2xl font-bold text-white",children:"Brand Hub"}),(0,r.jsx)("p",{className:"text-sm text-gray-400 mt-1",children:z?(({hahmshout:"í¨ì¤ì°í¸ê¸ë¡ë²",mplanit:"ì íë«ì",frameout:"íë ììì",mprd:"mprd"})[z]||z)+" ì ì©":"ê´ë¦¬ì ë¡ê·¸ì¸"})]}),(0,r.jsxs)("div",{className:"bg-white rounded-2xl shadow-2xl p-6",children:[(0,r.jsxs)("form",{onSubmit:Z,className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1.5",children:"ì´ë©ì¼"}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)(c,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),(0,r.jsx)("input",{type:"email",value:y,onChange:e=>w(e.target.value),placeholder:z?"[email protected]":"[email protected]",required:!0,autoFocus:!0,className:"w-full pl-10 pr-4 py-2.5 border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-[#a5514a] focus:border-transparent"})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1.5",children:"ë¹ë°ë²í¸"}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)(o,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),(0,r.jsx)("input",{type:"password",value:b,onChange:e=>v(e.target.value),placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢",required:!0,className:"w-full pl-10 pr-4 py-2.5 border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-[#a5514a] focu
1s:border-transparent"})]})]}),j&&(0,r.jsxs)("div",{className:"flex items-center gap-2 text-red-600 text-sm bg-red-50 rounded-lg px-3 py-2",children:[(0,r.jsx)(d.Z,{className:"w-4 h-4 flex-shrink-0"}),j]}),S&&(0,r.jsxs)("div",{className:"text-sm bg-amber-50 border border-amber-200 rounded-lg px-3 py-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 text-amber-700 font-medium mb-1",children:[(0,r.jsx)(d.Z,{className:"w-4 h-4 flex-shrink-0"}),"ì ê·¼ ê¶íì´ ììµëë¤"]}),(0,r.jsx)("p",{className:"text-amber-600 text-xs leading-relaxed",children:"ë¡ê·¸ì¸ì ì±ê³µíì§ë§ Brand Hub ì ê·¼ ê¶íì´ í ë¹ëì§ ìììµëë¤."}),(0,r.jsxs)("p",{className:"text-amber-500 text-[10px] mt-1 font-mono",children:[(null==t?void 0:t.email)||"no-user"," | role=",g||"null"]}),(0,r.jsx)("button",{type:"button",onClick:()=>{h(),C(!1),N(null)},className:"mt-2 text-xs text-amber-700 underline hover:text-amber-900",children:"ë¤ë¥¸ ê³ì ì¼ë¡ ë¡ê·¸ì¸"})]}),(0,r.jsx)("button",{type:"submit",disabled:k,className:"w-full flex items-center justify-center gap-2 bg-gray-900 text-white py-2.5 rounded-lg text-sm font-medium hover:bg-gray-800 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:k?(0,r.jsx)(i.Z,{className:"w-4 h-4 animate-spin"}):(0,r.jsxs)(r.Fragment,{children:["ë¡ê·¸ì¸",(0,r.jsx)(m.Z,{className:"w-4 h-4"})]})})]}),(0,r.jsx)("p",{className:"text-center text-xs text-gray-400 mt-4",children:"ê³ì ì´ ìì¼ì ê°ì? ê´ë¦¬ììê² ë¬¸ìíì¸ì."})]}),(0,r.jsxs)("p",{className:"text-center text-xs text-gray-500 mt-6",children:["Powered by ",(0,r.jsx)("span",{className:"text-gray-400 font-medium",children:"BizSpring"})," \xd7 GEOcare.AI"]})]})})}},3259:function(e,t,n){"use strict";n.d(t,{AuthProvider:function(){return i},a:function(){return u}});var r=n(7437),a=n(2265),s=n(4802);let l=(0,a.createContext)({user:null,role:null,partnerSlug:null,isAdmin:!1,displayName:null,clients:[],loading:!0,signIn:async()=>({error:null,noRole:!1,isAdmin:!1,partnerSlug:null}),signOut:async()=>{},canAccess:()=>!1});function i(e){let{children:t}=e,[n,i]=(0,a.useState)(null),[u,c]=(0,a.useState)(null),[o,d]=(0,a.useState)(null),[m,h]=(0,a.useState)(!1),[x,f]=(0,a.useState)(null),[p,g]=(0,a.useState)([]),[y,w]=(0,a.useState)(!0),[b]=(0,a.useState)(()=>(0,s.e)());async function v(e){try{let n=e;if(!n){let{data:{session:e}}=await b.auth.getSession();n=null==e?void 0:e.access_token}if(!n)return null;let r=new AbortController,a=setTimeout(()=>r.abort(),5e3),s=await fetch("https://nntuztaehnywdbttrajy.supabase.co/rest/v1/rpc/fn_bmp_get_my_role",{method:"POST",headers:{apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im5udHV6dGFlaG55d2RidHRyYWp5Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NDc5ODg3MzEsImV4cCI6MjA2MzU2NDczMX0.Y78rW4wgHFU_QaKCIdBRCqgJggiPlDk3cDM5ANfVKYw",Authorization:"Bearer "+n,"Content-Type":"application/json"},body:"{}",signal:r.signal});clearTimeout(a);let l=await s.json();if(null==l?void 0:l.authorized){var t;return c(l.role),d(l.partner_slug),h(l.is_admin),f(l.display_name),g(l.clients||[]),{isAdmin:!!l.is_admin,partnerSlug:null!==(t=l.partner_slug)&&void 0!==t?t:null}}return c(null),d(null),h(!1),f(null),g([]),null}catch(e){return c(null),d(null),h(!1),f(null),g([]),null}}async function j(e,t){var n,r,a,s;let{data:l,error:u}=await b.auth.signInWithPassword({email:e,password:t});if(u)return{error:u.message,noRole:!1};i(null!==(a=null===(n=l.session)||void 0===n?void 0:n.user)&&void 0!==a?a:null);let c=null===(r=l.session)||void 0===r?void 0:r.access_token,o=await v(c);return{error:null,noRole:!o,isAdmin:!!(null==o?void 0:o.isAdmin),partnerSlug:null!==(s=null==o?void 0:o.partnerSlug)&&void 0!==s?s:null}}async function N(){await b.auth.signOut(),i(null),c(null),d(null),h(!1),g([])}return(0,a.useEffect)(()=>{let e=!0,t=setTimeout(()=>{e&&y&&(console.warn("[Auth] Loading timeout - force release"),w(!1))},8e3);b.auth.getSession().then(async t=>{let{data:{session:n}}=t;e&&((null==n?void 0:n.user)?(i(n.user),await v(n.access_token)):i(null),e&&w(!1))}).catch(()=>{e&&w(!1)});let{data:{subscription:n}}=b.auth.onAuthStateChange(async(t,n)=>{var r;e&&(i(null!==(r=null==n?void 0:n.user)&&void 0!==r?r:null),(null==n?void 0:n.user)?await v(n.access_token):(c(null),d(null),h(!1),f(null),g([])))});return()=>{e=!1,clearTimeout(t),n.unsubscribe()}},[]),(0,r.jsx)(l.Provider,{value:{user:n,role:u,partnerSlug:o,isAdmin:m,dis
1playName:x,clients:p,loading:y,signIn:j,signOut:N,canAccess:function(e,t){return!!n&&!!u&&(!!m||o===e&&(!t||p.some(n=>n.partner_slug===e&&n.client_slug===t)))}},children:t})}let u=()=>(0,a.useContext)(l)},4802:function(e,t,n){"use strict";n.d(t,{e:function(){return a}});var r=n(6038);function a(){return(0,r.createBrowserClient)("https://nntuztaehnywdbttrajy.supabase.co","eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im5udHV6dGFlaG55d2RidHRyYWp5Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NDc5ODg3MzEsImV4cCI6MjA2MzU2NDczMX0.Y78rW4wgHFU_QaKCIdBRCqgJggiPlDk3cDM5ANfVKYw")}},6463:function(e,t,n){"use strict";var r=n(1169);n.o(r,"useParams")&&n.d(t,{useParams:function(){return r.useParams}}),n.o(r,"usePathname")&&n.d(t,{usePathname:function(){return r.usePathname}}),n.o(r,"useRouter")&&n.d(t,{useRouter:function(){return r.useRouter}}),n.o(r,"useSearchParams")&&n.d(t,{useSearchParams:function(){return r.useSearchParams}})},7934:function(e,t,n){"use strict";n.d(t,{Z:function(){return l}});var r=n(2265),a={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"};let s=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();var l=(e,t)=>
1{let n=(0,r.forwardRef)((n,l)=>{let{color:i="currentColor",size:u=24,strokeWidth:c=2,absoluteStrokeWidth:o,children:d,...m}=n;return(0,r.createElement)("svg",{ref:l,...a,width:u,height:u,stroke:i,strokeWidth:o?24*Number(c)/Number(u):c,className:"lucide lucide-".concat(s(e)),...m},[...t.map(e=>{let[t,n]=e;return(0,r.createElement)(t,n)}),...(Array.isArray(d)?d:[d])||[]])});return n.displayName="".concat(e),n}},7296:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(7934).Z)("AlertCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},919:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(7934).Z)("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]])},1154:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(7934).Z)("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])}},function(e){e.O(0,[38,971,23,744],function(){return e(e.s=4480)}),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.