{"version":3,"file":"HeaderNavBar_1.BSyANvbf.mjs","names":["useState","NavBar"],"sources":["https:/framerusercontent.com/modules/v4Y4MoHd9CuMvUCxt4gO/qzoqryPLk7KEBaUaQlHZ/HeaderNavBar_1.js"],"sourcesContent":["// @ts-nocheck\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useState,startTransition}from\"react\";import{createPortal}from\"react-dom\";import{addPropertyControls,ControlType}from\"framer\";import NavBar from\"https://framer.com/m/Nav-Bar-jXp2.js\";// Dynamic Firebase Loader\nconst firebaseAppUrl=\"https://www.gstatic.com/firebasejs/10.13.0/firebase-app.js\";const firebaseAuthUrl=\"https://www.gstatic.com/firebasejs/10.13.0/firebase-auth.js\";const firebaseConfig={apiKey:\"AIzaSyAD3p3IwIfl9B8v-ycIemf6rhVyaqIyQbQ\",authDomain:\"paathshala-bf93b.firebaseapp.com\",projectId:\"paathshala-bf93b\",storageBucket:\"paathshala-bf93b.appspot.com\",messagingSenderId:\"144773839129\",appId:\"1:144773839129:web:04efd90489924cb3d66d88\",measurementId:\"G-97C8TYB9K6\"};export default function HeaderNavBar(props){const{primaryColor=\"#0033CA\",buttonRadius=100,apiHost=\"https://paathshala-server-825590928224.asia-south1.run.app\"}=props;const[firebaseUser,setFirebaseUser]=useState(null);const[userProfile,setUserProfile]=useState(null);const[authInitialized,setAuthInitialized]=useState(false);const[isLoggedIn,setIsLoggedIn]=useState(false);const[cachedAvatar,setCachedAvatar]=useState(\"\");useEffect(()=>{if(typeof window!==\"undefined\"){const loggedIn=localStorage.getItem(\"userLoggedIn\")===\"true\";if(loggedIn){setIsLoggedIn(true);setCachedAvatar(localStorage.getItem(\"userPhotoUrl\")||\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\");}}},[]);useEffect(()=>{let active=true;async function loadFirebase(){try{const{initializeApp,getApps,getApp}=await import(firebaseAppUrl);const{getAuth,onAuthStateChanged}=await import(firebaseAuthUrl);if(!active)return;let app;const apps=getApps();if(apps.length===0){app=initializeApp(firebaseConfig);}else{app=getApp();}const auth=getAuth(app);const unsubscribe=onAuthStateChanged(auth,async user=>{if(user){if(active){startTransition(()=>{setFirebaseUser(user);});}if(typeof window!==\"undefined\"){localStorage.setItem(\"userLoggedIn\",\"true\");if(!localStorage.getItem(\"userPhotoUrl\")){localStorage.setItem(\"userPhotoUrl\",user.photoURL||\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\");}}try{const token=await user.getIdToken();const res=await fetch(`${apiHost}/api/v1/user`,{headers:{Authorization:`Bearer ${token}`}});if(res.ok){const json=await res.json();const profile=json.data||json;if(active){startTransition(()=>{setUserProfile(profile);});}if(typeof window!==\"undefined\"){localStorage.setItem(\"userPhotoUrl\",user.photoURL||profile?.pictureUrl||\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\");}}}catch(e){console.error(\"Error fetching profile in HeaderNavBar:\",e);}}else{if(active){startTransition(()=>{setFirebaseUser(null);setUserProfile(null);});}if(typeof window!==\"undefined\"){localStorage.removeItem(\"userLoggedIn\");localStorage.removeItem(\"userPhotoUrl\");}}if(active){startTransition(()=>{setAuthInitialized(true);});}});return()=>unsubscribe();}catch(err){console.error(\"Error loading Firebase in HeaderNavBar:\",err);}}loadFirebase();return()=>{active=false;};},[apiHost]);const[desktopContainer,setDesktopContainer]=useState(null);const[tabletContainer,setTabletContainer]=useState(null);const[mobileContainer,setMobileContainer]=useState(null);useEffect(()=>{let active=true;const findContainers=()=>{if(!active)return;const dt=document.querySelector('.nav-desktop-only [class*=\"-container\"]');const tabContainer=document.querySelector('.nav-tablet-only [class*=\"-container\"]');const tab=tabContainer||document.querySelector(\".nav-tablet-only > div\");const mobContainer=document.querySelector('.nav-phone-only [class*=\"-container\"]');const mob=mobContainer||document.querySelector(\".nav-phone-only > div\");if(dt)setDesktopContainer(dt);if(tab)setTabletContainer(tab);if(mob)setMobileContainer(mob);};findContainers();const timer=setTimeout(findContainers,1500);const interval=setInterval(findContainers,3e3);return()=>{active=false;clearTimeout(timer);clearInterval(interval);};},[authInitialized]);const renderNavBarActions=device=>{const dashboardUrl=\"/dashboard\";const loginUrl=\"/teacher-signup\";const isUserLoggedIn=authInitialized&&firebaseUser||!authInitialized&&isLoggedIn;const avatarUrl=authInitialized&&firebaseUser?userProfile?.pictureUrl||firebaseUser.photoURL||cachedAvatar||\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\":cachedAvatar;const overlayClass=device===\"desktop\"?\"navbar-actions-overlay-desktop\":device===\"tablet\"?\"navbar-actions-overlay-tablet\":\"navbar-actions-overlay-mobile\";return /*#__PURE__*/_jsx(\"div\",{className:overlayClass,children:isUserLoggedIn?/*#__PURE__*/_jsx(\"a\",{href:dashboardUrl,children:/*#__PURE__*/_jsx(\"img\",{src:avatarUrl,alt:\"Profile\",className:\"navbar-profile-avatar\"})}):/*#__PURE__*/_jsx(\"a\",{href:loginUrl,className:\"navbar-btn-login\",children:\"Log In\"})});};return /*#__PURE__*/_jsxs(\"div\",{className:\"navbar-container-outer\",children:[/*#__PURE__*/_jsx(\"style\",{dangerouslySetInnerHTML:{__html:`\n                @import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@700;800&family=Poppins:wght@400;500;600;700&display=swap');\n                \n                /* Smooth base transitions for the entire outer container */\n                .navbar-container-outer {\n                    width: 100%;\n                    max-width: 1200px;\n                    margin: 0 auto;\n                    padding: 0 16px;\n                    box-sizing: border-box;\n                    font-family: 'Poppins', sans-serif;\n                    transition: all 0.3s ease-in-out;\n                }\n                \n                /* Hide standard children of download container but keep the container layout */\n                .navbar-container-outer [class*=\"-container\"] > :not(.navbar-actions-overlay-desktop):not(.navbar-actions-overlay-tablet):not(.navbar-actions-overlay-mobile) {\n                    display: none !important;\n                }\n                \n                /* Ensure container is visible, flex-based, and prevents text wrapping */\n                .navbar-container-outer [class*=\"-container\"] {\n                    display: flex !important;\n                    align-items: center !important;\n                    justify-content: flex-end !important;\n                    pointer-events: auto !important;\n                    width: auto !important;\n                    height: auto !important;\n                    min-width: max-content !important;\n                    flex-wrap: nowrap !important;\n                    white-space: nowrap !important;\n                }\n                \n                /* Custom Dynamic Navbar Overlays */\n                .navbar-actions-overlay-desktop {\n                    display: flex;\n                    align-items: center;\n                    justify-content: center;\n                    width: auto;\n                    height: 100%;\n                    pointer-events: auto;\n                    white-space: nowrap !important;\n                }\n                \n                .navbar-actions-overlay-tablet,\n                .navbar-actions-overlay-mobile {\n                    display: flex !important;\n                    align-items: center !important;\n                    justify-content: center !important;\n                    pointer-events: auto !important;\n                    white-space: nowrap !important;\n                }\n                \n                /* CRITICAL FIX: Prevent overlaps by forcing the parent div to leave \n                   empty space on the right side for the absolutely positioned buttons.\n                */\n                .nav-phone-only > div,\n                .nav-tablet-only > div {\n                    position: relative !important;\n                    padding-right: 140px !important; /* Reserves space for 110px button + margin */\n                    box-sizing: border-box !important;\n                    transition: padding 0.3s ease-in-out;\n                }\n                \n                .nav-phone-only > div > .navbar-actions-overlay-mobile {\n                    position: absolute !important;\n                    right: 16px !important;\n                    top: 50% !important;\n                    transform: translateY(-50%) !important;\n                    z-index: 1000 !important;\n                }\n                \n                .nav-tablet-only > div > .navbar-actions-overlay-tablet {\n                    position: absolute !important;\n                    right: 24px !important;\n                    top: 50% !important;\n                    transform: translateY(-50%) !important;\n                    z-index: 1000 !important;\n                }\n                \n                /* Hide links wrapper on phone to make room for Logo and Login button */\n                .nav-phone-only > div > div:nth-child(2) {\n                    display: none !important;\n                }\n\n                /* Strictly constrain the button to one line */\n                .navbar-btn-login {\n                    background: ${primaryColor} !important;\n                    color: white !important;\n                    border: none !important;\n                    border-radius: ${buttonRadius}px !important;\n                    font-weight: 700 !important;\n                    font-size: 0.85rem !important;\n                    cursor: pointer !important;\n                    text-decoration: none !important;\n                    transition: all 0.2s ease !important;\n                    display: inline-flex !important;\n                    align-items: center !important;\n                    justify-content: center !important;\n                    box-shadow: 0 4px 14px rgba(0, 51, 202, 0.15) !important;\n                    white-space: nowrap !important; /* Prevents 2 lines */\n                    overflow: hidden !important;\n                    text-overflow: ellipsis !important;\n                    flex-shrink: 0 !important; /* Prevents squishing */\n                    min-width: 110px !important;\n                    width: 110px !important;\n                    height: 38px !important;\n                    box-sizing: border-box !important;\n                }\n                \n                .navbar-btn-login:hover {\n                    opacity: 0.95 !important;\n                    transform: translateY(-1px) !important;\n                    box-shadow: 0 6px 20px rgba(0, 51, 202, 0.25) !important;\n                }\n                \n                .navbar-profile-avatar {\n                    width: 38px !important;\n                    height: 38px !important;\n                    border-radius: 50% !important;\n                    object-fit: cover !important;\n                    border: 2px solid ${primaryColor} !important;\n                    cursor: pointer !important;\n                    transition: transform 0.2s ease, box-shadow 0.2s ease !important;\n                    display: block !important;\n                    flex-shrink: 0 !important;\n                }\n                \n                .navbar-profile-avatar:hover {\n                    transform: scale(1.05) !important;\n                    box-shadow: 0 4px 12px rgba(0, 51, 202, 0.15) !important;\n                }\n                \n                /* Breakpoint Visibility Controls */\n                .nav-desktop-only,\n                .nav-tablet-only,\n                .nav-phone-only {\n                    width: 100% !important;\n                    transition: opacity 0.3s ease-in-out;\n                }\n                \n                .nav-desktop-only {\n                    display: flex !important;\n                    justify-content: center !important;\n                    align-items: center !important;\n                }\n                \n                .nav-tablet-only,\n                .nav-phone-only {\n                    display: none;\n                }\n\n                @media (max-width: 1439.98px) and (min-width: 600px) {\n                    .nav-desktop-only { display: none !important; }\n                    .nav-tablet-only {\n                        display: flex !important;\n                        justify-content: center !important;\n                        align-items: center !important;\n                    }\n                }\n\n                @media (max-width: 599.98px) {\n                    .nav-desktop-only,\n                    .nav-tablet-only { display: none !important; }\n                    .nav-phone-only {\n                        display: flex !important;\n                        justify-content: center !important;\n                        align-items: center !important;\n                    }\n                }\n            `}}),/*#__PURE__*/_jsxs(\"div\",{className:\"nav-desktop-only\",style:{position:\"relative\",width:\"100%\"},children:[/*#__PURE__*/_jsx(NavBar,{variant:\"QlwippDSs\",width:\"100%\"}),desktopContainer&&/*#__PURE__*/createPortal(renderNavBarActions(\"desktop\"),desktopContainer)]}),/*#__PURE__*/_jsxs(\"div\",{className:\"nav-tablet-only\",style:{position:\"relative\",width:\"100%\"},children:[/*#__PURE__*/_jsx(NavBar,{variant:\"Gh4kM_PVO\",width:\"100%\"}),tabletContainer&&/*#__PURE__*/createPortal(renderNavBarActions(\"tablet\"),tabletContainer)]}),/*#__PURE__*/_jsxs(\"div\",{className:\"nav-phone-only\",style:{position:\"relative\",width:\"100%\"},children:[/*#__PURE__*/_jsx(NavBar,{variant:\"WW2XL7OwL\",width:\"100%\"}),mobileContainer&&/*#__PURE__*/createPortal(renderNavBarActions(\"mobile\"),mobileContainer)]})]});}addPropertyControls(HeaderNavBar,{primaryColor:{type:ControlType.Color,title:\"Primary Color\",defaultValue:\"#0033CA\"},buttonRadius:{type:ControlType.Number,title:\"Button Radius\",defaultValue:100,min:0,max:100},apiHost:{type:ControlType.String,title:\"API Host\",defaultValue:\"https://paathshala-server-825590928224.asia-south1.run.app\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"HeaderNavBar\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./HeaderNavBar_1.map"],"mappings":"mTAEsd,SAAwB,EAAa,EAAM,CAAC,GAAK,CAAC,eAAa,UAAU,eAAa,IAAI,UAAQ,8DAA8D,EAAW,CAAC,EAAa,GAAiBA,EAAS,KAAK,CAAM,CAAC,EAAY,GAAgBA,EAAS,KAAK,CAAM,CAAC,EAAgB,GAAoBA,EAAS,GAAM,CAAM,CAAC,EAAW,GAAeA,EAAS,GAAM,CAAM,CAAC,EAAa,GAAiBA,EAAS,GAAG,CAAC,MAAc,CAAW,IAAS,QAA4B,aAAa,QAAQ,eAAe,GAAG,SAAoB,EAAc,GAAK,CAAC,EAAgB,aAAa,QAAQ,eAAe,EAAE,sEAAsE,G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