"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[530],{677:(e,r,t)=>{t.d(r,{ToastProvider:()=>f,dj:()=>p});var n=t(5155),i=t(2115),a=t(7650),o=t(646),s=t(4861),l=t(5339),c=t(1284),d=t(8250);let u=(0,i.createContext)(void 0);function p(){let e=(0,i.useContext)(u);if(!e)throw Error("useToast must be used within a ToastProvider");return e}function g(e){let{toast:r,onRemove:t,children:a,...u}=e,[p,g]=(0,i.useState)(!1),[v,F]=(0,i.useState)(!1);(0,i.useEffect)(()=>{if(!r)return null;let e=setTimeout(()=>g(!0),50);return()=>clearTimeout(e)},[r]),(0,i.useEffect)(()=>{if(0!==r.duration){let e=setTimeout(()=>{f()},r.duration||5e3);return()=>clearTimeout(e)}},[r.duration]);let f=()=>{F(!0),setTimeout(()=>t(r.id),300)},h=(()=>{var e,t,n,i,a,u,p,g,v,F,f,h,m,b,E,x,y,w,P,C,A,B,j,T,I,D,S,_,k,N,U,R,z;let L={success:{bg:null!==(y=null===(e=d.T.success)||void 0===e?void 0:e[50])&&void 0!==y?y:"#f0fdf4",border:null!==(w=null===(t=d.T.success)||void 0===t?void 0:t[200])&&void 0!==w?w:"#bbf7d0",icon:null!==(P=null===(n=d.T.success)||void 0===n?void 0:n[600])&&void 0!==P?P:"#16a34a",text:null!==(C=null===(i=d.T.success)||void 0===i?void 0:i[800])&&void 0!==C?C:"#166534",IconComponent:o.A},error:{bg:null!==(A=null===(a=d.T.danger)||void 0===a?void 0:a[50])&&void 0!==A?A:"#fef2f2",border:null!==(B=null===(u=d.T.danger)||void 0===u?void 0:u[200])&&void 0!==B?B:"#fecaca",icon:null!==(j=null===(p=d.T.danger)||void 0===p?void 0:p[600])&&void 0!==j?j:"#dc2626",text:null!==(T=null===(g=d.T.danger)||void 0===g?void 0:g[800])&&void 0!==T?T:"#991b1b",IconComponent:s.A},warning:{bg:null!==(I=null===(v=d.T.warning)||void 0===v?void 0:v[50])&&void 0!==I?I:"#fffbeb",border:null!==(D=null===(F=d.T.warning)||void 0===F?void 0:F[200])&&void 0!==D?D:"#fed7aa",icon:null!==(S=null===(f=d.T.warning)||void 0===f?void 0:f[600])&&void 0!==S?S:"#d97706",text:null!==(_=null===(h=d.T.warning)||void 0===h?void 0:h[800])&&void 0!==_?_:"#9a3412",IconComponent:l.A},info:{bg:null!==(k=null===(m=d.T.primary)||void 0===m?void 0:m[50])&&void 0!==k?k:"#eff6ff",border:null!==(N=null===(b=d.T.primary)||void 0===b?void 0:b[200])&&void 0!==N?N:"#bfdbfe",icon:null!==(U=null===(E=d.T.primary)||void 0===E?void 0:E[600])&&void 0!==U?U:"#2563eb",text:null!==(R=null===(x=d.T.primary)||void 0===x?void 0:x[800])&&void 0!==R?R:"#1e40af",IconComponent:c.A}};return null!==(z=L[r.type])&&void 0!==z?z:L.info})(),{IconComponent:m}=h,b=window.innerWidth>768?"420px":"calc(100vw - 40px)";return(0,n.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:"12px",padding:"16px",backgroundColor:h.bg,border:"1px solid ".concat(h.border),borderRadius:"12px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06)",marginBottom:"12px",minWidth:"280px",maxWidth:"calc(100vw - 40px)",width:"100%",maxWidth:b,transform:v?"translateX(100%)":p?"translateX(0)":"translateX(100%)",opacity:v?0:+!!p,transition:"all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",cursor:"pointer",position:"relative",overflow:"hidden",boxSizing:"border-box"},onClick:f,...u,children:[0!==r.duration&&(0,n.jsx)("div",{style:{position:"absolute",bottom:0,left:0,height:"3px",backgroundColor:h.icon,borderRadius:"0 0 12px 12px",animation:"toast-progress ".concat(r.duration||5e3,"ms linear forwards"),transformOrigin:"left"}}),(0,n.jsx)("div",{style:{flexShrink:0,marginTop:"2px"},children:(0,n.jsx)(m,{size:20,color:h.icon})}),a||(0,n.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,n.jsx)("h4",{style:{margin:"0 0 4px 0",fontSize:"14px",fontWeight:"600",color:h.text,lineHeight:"1.4"},children:r.title}),(r.message||r.description)&&(0,n.jsx)("p",{style:{margin:0,fontSize:"13px",color:h.text,opacity:.8,lineHeight:"1.4"},children:r.message||r.description})]}),(0,n.jsx)("style",{dangerouslySetInnerHTML:{__html:"\n @keyframes toast-progress {\n from {\n width: 100%;\n }\n to {\n width: 0%;\n }\n }\n "}})]})}function v(e){let{toast:r,onRemove:t}=e;return(0,n.jsx)(g,{toast:r,onRemove:t})}function F(e){let{toasts:r,onRemove:t}=e;return"undefined"==typeof document?null:(0,a.createPortal)((0,n.jsx)("div",{style:{position:"fixed",top:"20px",right:"20px",left:"20px",zIndex:9999,pointerEvents:"none",display:"flex",flexDirection:"column",alignItems:"flex-end",maxWidth:"100vw",boxSizing:"border-box"},children:(0,n.jsx)("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-end",pointerEvents:"auto"},children:r.map(e=>(0,n.jsx)(v,{toast:e,onRemove:t},e.id))})}),document.body)}function f(e){let{children:r}=e,[t,a]=(0,i.useState)([]),o=e=>{a(r=>r.filter(r=>r.id!==e))};return(0,n.jsxs)(u.Provider,{value:{toasts:t,addToast:e=>{let r={id:Math.random().toString(36).substr(2,9),duration:5e3,...e};a(e=>[...e,r])},removeToast:o},children:[r,(0,n.jsx)(F,{toasts:t,onRemove:o})]})}},7531:(e,r,t)=>{t.d(r,{ch:()=>n});let n=e=>{let r=(null==e?void 0:e.code)||(null==e?void 0:e.message)||"";switch(r){case"auth/invalid-credential":case"auth/user-not-found":case"auth/wrong-password":return"Invalid email or password. Please check your credentials and try again.";case"auth/invalid-email":return"Please enter a valid email address.";case"auth/user-disabled":return"This account has been disabled. Please contact support for assistance.";case"auth/too-many-requests":return"Too many failed attempts. Please wait a few minutes before trying again.";case"auth/email-already-in-use":return"An account with this email already exists. Please sign in instead.";case"auth/weak-password":return"Password is too weak. Please choose a stronger password with at least 6 characters.";case"auth/operation-not-allowed":return"Email/password accounts are not enabled. Please contact support.";case"auth/network-request-failed":return"Network error. Please check your internet connection and try again.";case"auth/requires-recent-login":return"Please sign out and sign back in to complete this action.";case"auth/popup-closed-by-user":case"auth/cancelled-popup-request":return"Sign-in was cancelled. Please try again.";case"auth/popup-blocked":return"Pop-up was blocked by your browser. Please allow pop-ups and try again.";default:if(r.includes("Firebase:")||r.includes("auth/"))return"Authentication failed. Please try again or contact support if the problem persists.";return r||"An unexpected error occurred. Please try again."}}},8250:(e,r,t)=>{t.d(r,{T:()=>n});let n={primary:{darkNavy:"#2D2D44",vibrantPurple:"#8B5CF6",electricBlue:"#3B82F6",50:"#F0F4FF",100:"#E0ECFF",200:"#C7DBFF",300:"#A4C2FF",400:"#8B5CF6",500:"#3B82F6",600:"#2563EB",700:"#1D4ED8",800:"#1E40AF",900:"#1E3A8A",surface:"#FFFFFF",surfaceVariant:"#F8FAFC",background:"#FAFBFC"},gray:{50:"#F9FAFB",100:"#F3F4F6",200:"#E5E7EB",300:"#D1D5DB",400:"#9CA3AF",500:"#6B7280",600:"#4B5563",700:"#374151",800:"#1F2937",900:"#111827"},text:{primary:"#2D2D44",secondary:"#9CA3AF",accent:"#8B5CF6"},success:{50:"#F0FDF4",100:"#DCFCE7",200:"#BBF7D0",300:"#86EFAC",400:"#4ADE80",500:"#22C55E",600:"#16A34A",700:"#15803D",800:"#166534"},danger:{50:"#FEF2F2",100:"#FEE2E2",200:"#FECACA",300:"#FCA5A5",400:"#F87171",500:"#EF4444",600:"#DC2626",700:"#B91C1C",800:"#991B1B"},warning:{50:"#FFFBEB",100:"#FEF3C7",200:"#FDE68A",300:"#FCD34D",400:"#FBBF24",500:"#F59E0B",600:"#D97706",700:"#B45309",800:"#92400E"},gradients:{main:"linear-gradient(135deg, #E5E7EB 0%, #8B5CF6 50%, #3B82F6 100%)",secondary:"linear-gradient(135deg, #F3F4F6 0%, #8B5CF6 100%)",hero:"linear-gradient(135deg, #8B5CF6 0%, #3B82F6 100%)",background:"linear-gradient(135deg, #F9FAFB 0%, #F3F4F6 100%)",card:"linear-gradient(135deg, #FFFFFF 0%, #F8FAFC 100%)"}}},8915:(e,r,t)=>{t.d(r,{IG:()=>v,db:()=>g,j2:()=>p,jD:()=>F});var n=t(3915),i=t(1906),a=t(5404),o=t(5317),s=t(7505),l=t(9509);let c={apiKey:l.env.NEXT_PUBLIC_FIREBASE_API_KEY||"AIzaSyDrq1DV-EaCRIbZ0buHTriPk-KUG8074Oc",authDomain:l.env.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN||"evently-dc631.firebaseapp.com",projectId:l.env.NEXT_PUBLIC_FIREBASE_PROJECT_ID||"evently-dc631",storageBucket:l.env.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET||"evently-dc631.firebasestorage.app",messagingSenderId:l.env.NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID||"560979122393",appId:l.env.NEXT_PUBLIC_FIREBASE_APP_ID||"1:560979122393:web:4c80fcc23555ab964986c8",measurementId:l.env.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID||"G-1PYT1S0LF8"},d=Object.values(c).every(e=>""!==e),u=null,p=null,g=null,v=null;if(d)try{u=0===(0,n.Dk)().length?(0,n.Wp)(c):(0,n.Sx)(),p=(0,a.xI)(u),g=(0,o.aU)(u),v=(0,s.c7)(u),c.measurementId&&(0,i.P5)(u)}catch(e){console.error("Error initializing Firebase:",e)}else p={currentUser:null,onAuthStateChanged:e=>(e(null),()=>{}),signInWithEmailAndPassword:()=>Promise.reject(Error("Firebase not configured")),createUserWithEmailAndPassword:()=>Promise.reject(Error("Firebase not configured")),signOut:()=>Promise.reject(Error("Firebase not configured")),updateProfile:()=>Promise.reject(Error("Firebase not configured"))},g={collection:()=>({doc:()=>({get:()=>Promise.reject(Error("Firebase not configured")),set:()=>Promise.reject(Error("Firebase not configured")),update:()=>Promise.reject(Error("Firebase not configured")),delete:()=>Promise.reject(Error("Firebase not configured"))})})},v={ref:()=>({put:()=>Promise.reject(Error("Firebase not configured")),getDownloadURL:()=>Promise.reject(Error("Firebase not configured"))})};let F=d},9350:(e,r,t)=>{t.d(r,{A:()=>d,AuthProvider:()=>c});var n=t(5155),i=t(2115),a=t(5404),o=t(8915),s=t(7531);let l=(0,i.createContext)({user:null,signUp:async()=>({success:!1}),signIn:async()=>({success:!1}),signOutUser:async()=>{},updateUserProfile:async()=>{},loading:!0,isFirebaseConfigured:!1}),c=e=>{let{children:r}=e,[c,d]=(0,i.useState)(null),[u,p]=(0,i.useState)(!0);(0,i.useEffect)(()=>{if(!o.jD){p(!1);return}let e=(0,a.hg)(o.j2,e=>{d(e),p(!1)},e=>{console.error("Auth state change error:",e),p(!1)});return()=>e()},[]);let g=async e=>{if(!o.jD||!c)throw Error("Service is not available or user not authenticated.");try{await (0,a.r7)(c,{displayName:e}),d({...c,displayName:e})}catch(e){throw console.error("Error updating profile:",e),Error((0,s.ch)(e))}},v={user:c,signUp:async(e,r,n)=>{if(!o.jD)return{success:!1,error:"Service is not available. Please contact support."};try{let i=await (0,a.eJ)(o.j2,e,r);if(i.user){await (0,a.r7)(i.user,{displayName:n});let{sanitizeSlug:r,findAvailableSlug:o}=await t.e(315).then(t.bind(t,2315)),s=r(n),l=await o(s),{initializeUserData:c}=await t.e(595).then(t.bind(t,2595)),d=await c(i.user.uid,n,e,l);if(d.success)return console.log("Account created successfully with username:",l),{success:!0};return console.error("Failed to initialize user data:",d.error),{success:!1,error:"Failed to set up user profile. Please try again."}}return{success:!1,error:"Failed to create account. Please try again."}}catch(e){return console.error("Error signing up:",e),{success:!1,error:(0,s.ch)(e)}}},signIn:async(e,r)=>{if(!o.jD)return{success:!1,error:"Service is not available. Please contact support."};try{return await (0,a.x9)(o.j2,e,r),{success:!0}}catch(e){return console.error("Error signing in:",e),{success:!1,error:(0,s.ch)(e)}}},signOutUser:async()=>{if(!o.jD)throw Error("Service is not available. Please contact support.");try{await (0,a.CI)(o.j2)}catch(e){throw console.error("Error signing out:",e),Error((0,s.ch)(e))}},updateUserProfile:g,loading:u,isFirebaseConfigured:o.jD};return(0,n.jsx)(l.Provider,{value:v,children:o.jD?!u&&r:(0,n.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-yellow-50",children:(0,n.jsxs)("div",{className:"text-center p-8 bg-white rounded-lg shadow-lg max-w-md",children:[(0,n.jsx)("h2",{className:"text-xl font-bold text-yellow-600 mb-4",children:"Service Unavailable"}),(0,n.jsx)("p",{className:"text-gray-700 mb-4",children:"The authentication service is currently unavailable."}),(0,n.jsx)("p",{className:"text-sm text-gray-500",children:"Please contact support if this issue persists."})]})})})},d=()=>(0,i.useContext)(l)}}]);