1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8288],{18288:(e,t,r)=>{r.d(t,{b:()=>y});var a=r(95155),s=r(93509),n=r(62098),o=r(15163),i=r(84616),l=r(70306),d=r(71007),c=r(381),u=r(94788),m=r(34835),h=r(97168),f=r(69663),v=r(66766),g=r(6874),x=r.n(g),p=r(67133),b=r(99304),j=r(35695),w=r(12115),N=r(76052);function y(e){var t;let{onQuickNote:r,onToggleSidebar:g}=e,{theme:y,setTheme:k,resolvedTheme:E}=(0,b.D)(),S=(0,j.useRouter)(),{signOut:_}=(0,N.A)(),{user:A,loading:z}=(0,N.A)(),[C,L]=(0,w.useState)(!1),[I,P]=(0,w.useState)(!1),[U,q]=(0,w.useState)(null);(0,w.useEffect)(()=>{L(!0)},[]),(0,w.useEffect)(()=>{if(!A){q(null);return}let e=!0;(async()=>{try{let t=await fetch("/api/user",{method:"GET",credentials:"include"});if(!t.ok)return;let r=await t.json();e&&q(r.avatar_url||null)}catch(e){}})();let t=t=>{let r=t.detail;e&&q((null==r?void 0:r.avatarUrl)||null)};return window.addEventListener("velanote-profile-updated",t),()=>{e=!1,window.removeEventListener("velanote-profile-updated",t)}},[A]);let B=!!A,T=async()=>{if(!I)try{P(!0),await _(),S.push("/auth/login")}finally{P(!1)}};return(0,a.jsxs)("header",{className:"flex h-14 items-center justify-between border-b border-border bg-card px-3 transition-colors duration-500 md:h-16 md:px-6",children:[(0,a.jsxs)(x(),{href:"/",className:"flex items-center gap-2 rounded-lg transition-opacity hover:opacity-80",children:[(0,a.jsx)(v.default,{src:"/logo.jpg",alt:"
1VelaNote Logo",width:32,height:32,className:"animate-leaf-float md:h-9 md:w-9"}),(0,a.jsx)("h1",{className:"hidden text-xl font-semibold text-foreground sm:block",children:"VelaNote"})]}),(0,a.jsxs)("div",{className:"flex flex-1 items-center justify-end gap-2 md:gap-3",children:[B?(0,a.jsxs)(h.$,{onClick:r,className:"h-9 rounded-full bg-gradient-to-r from-primary to-accent px-3 text-sm hover:shadow-md transition-all duration-200 md:h-10 md:px-4",children:[(0,a.jsx)(i.A,{className:"mr-0 h-4 w-4 md:mr-2"}),(0,a.jsx)("span",{className:"hidden md:inline",children:"Quick Note"})]}):(0,a.jsx)(h.$,{variant:"outline",onClick:()=>S.push("/auth/register"),className:"h-9 rounded-full px-3 text-sm hover:shadow-md transition-all duration-200 md:h-10 md:px-4",children:"Sign Up"}),!B&&(0,a.jsxs)(h.$,{variant:"ghost",size:"sm",onClick:()=>S.push("/auth/login"),className:"rounded-full gap-1.5 px-2.5 md:gap-2 md:px-3",children:[(0,a.jsx)(l.A,{className:"h-4 w-4"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"Login"})]}),(0,a.jsx)(h.$,{variant:"ghost",size:"icon",onClick:()=>{"light"===y?k("dark"):"dark"===y?k("auto"):k("light")},className:"h-9 w-9 rounded-full transition-all duration-300 md:h-10 md:w-10",title:"Theme: ".concat(y),children:C?"dark"===y?(0,a.jsx)(s.A,{className:"h-5 w-5"}):"light"===y?(0,a.jsx)(n.A,{className:"h-5 w-5"}):(0,a.jsx)(o.A,{className:"h-5 w-5"}):(0,a.jsx)("div",{className:"w-5 h-5"})}),(0,a.jsxs)(p.rI,{children:[(0,a.jsx)(p.ty,{asChild:!0,children:(0,a.jsx)("div",{className:"relative inline-flex h-9 w-9 cursor-pointer items-center justify-center rounded-full p-0 transition-all duration-300 hover:bg-transparent md:h-10 md:w-10",children:(0,a.jsxs)(f.eu,{className:"h-9 w-9 border border-border transition-all duration-300 hover:border-primary/30 hover:shadow-sm hover:shadow-primary/10 md:h-10 md:w-10",children:[(0,a.jsx)(f.BK,{src:U||void 0,alt:(null==A?void 0:A.email)||"User"}),(0,a.jsx)(f.q5,{className:"bg-gradient-to-br from-primary/10 via-primary/5 to-background text-primary",children:(null==A?void 0:A.email)?A.email.charAt(0).toUpperCase():"U"})]})})}),(0,a.jsxs)(p.SQ,{className:"w-64 mt-2 shadow-lg border-border/50",align:"end",forceMount:!0,sideOffset:8,children:[(0,a.jsx)(p.lp,{className:"font-normal py-3",children:(0,a.jsxs)("div",{className:"flex flex-col space-y-2",children:[(0,a.jsx)("p",{className:"text-sm font-medium leading-none text-foreground",children:(null==A?void 0:null===(t=A.email)||void 0===t?void 0:t.split("@")[0])||"User"}),(0,a.jsx)("p",{className:"text-xs leading-relaxed text-muted-foreground",children:(null==A?void 0:A.email)||"No email"})]})}),(0,a.jsx)(p.mB,{className:"bg-border/50"}),(0,a.jsxs)("div",{className:"py-1",children:[(0,a.jsxs)(p._2,{className:"cursor-pointer py-2.5 focus:bg-accent/50 transition-colors",onSelect:()=>S.push("/profile"),children:[(0,a.jsx)(d.A,{className:"mr-3 h-4 w-4 text-muted-foreground"}),(0,a.jsx)("span",{className:"text-sm",children:"Profile"})]}),(0,a.jsxs)(p._2,{className:"cursor-pointer py-2.5 focus:bg-accent/50 transition-colors",onSelect:()=>S.push("/settings"),children:[(0,a.jsx)(c.A,{className:"mr-3 h-4 w-4 text-muted-foreground"}),(0,a.jsx)("span",{className:"text-sm",children:"Settings"})]}),(0,a.jsxs)(p._2,{className:"cursor-pointer py-2.5 focus:bg-accent/50 transition-colors",children:[(0,a.jsx)(u.A,{className:"mr-3 h-4 w-4 text-muted-foreground"}),(0,a.jsx)("span",{className:"text-sm",children:"Help & Support"})]})]}),(0,a.jsx)(p.mB,{className:"bg-border/50"}),(0,a.jsx)("div",{className:"py-1",children:(0,a.jsxs)(p._2,{onClick:T,disabled:I,className:"cursor-pointer py-2.5 text-muted-foreground hover:text-destructive focus:text-destructive focus:bg-destructive/5 transition-colors",children:[(0,a.jsx)(m.A,{className:"mr-3 h-4 w-4"}),(0,a.jsx)("span",{className:"text-sm",children:I?"Logging out...":"Log out"})]})})]})]})]})]})}},46414:(e,t,r)=>{r.d(t,{U:()=>s});var a=r(64161);function s(){return(0,a.createBrowserClient)("https://tcktqazywiqrdhvdrmls.supabase.co","sb_publishable_zoO5rcWto5n-iIEclFbHxA_MBDaqEHj")}},53999:(e,t,r)=>{r.d(t,{cn:()=>n});var a=r(52596),s=r(39688);function n(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,s.QP)((0,a.$)(t))}},67133:(e,t,r)=>{r.d(t,{SQ:()=>l,_2:()=>d,lp:()=>c,mB:()=>u,rI:()=>o,ty:()=>i});var a=r(95155);r(12115);var s=r(41647),n=r(53999);function o(e){let{...t}=e;return(0,a.jsx)(s.bL,{"data-slot":"dropdown-menu",...t})}function i(e){let{...t}=e;return(0,a.jsx)(s.l9,{"data-slot":"dropdown-menu-trigger",...t})}function l(e){let{className:t,sideOffset:r=4,...o}=e;return(0,a.jsx)(s.ZL,{children:(0,a.jsx)(s.UC,{"data-slot":"dropdown-menu-content",sideOffset:r,className:(0,n.cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:sli
1de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",t),...o})})}function d(e){let{className:t,inset:r,variant:o="default",...i}=e;return(0,a.jsx)(s.q7,{"data-slot":"dropdown-menu-item","data-inset":r,"data-variant":o,className:(0,n.cn)("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...i})}function c(e){let{className:t,inset:r,...o}=e;return(0,a.jsx)(s.JU,{"data-slot":"dropdown-menu-label","data-inset":r,className:(0,n.cn)("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",t),...o})}function u(e){let{className:t,...r}=e;return(0,a.jsx)(s.wv,{"data-slot":"dropdown-menu-separator",className:(0,n.cn)("bg-border -mx-1 my-1 h-px",t),...r})}},69663:(e,t,r)=>{r.d(t,{BK:()=>i,eu:()=>o,q5:()=>l});var a=r(95155);r(12115);var s=r(78513),n=r(53999);function o(e){let{className:t,...r}=e;return(0,a.jsx)(s.bL,{"data-slot":"avatar",className:(0,n.cn)("relative flex size-8 shrink-0 overflow-hidden rounded-full",t),...r})}function i(e){let{className:t,...r}=e;return(0,a.jsx)(s._V,{"data-slot":"avatar-image",className:(0,n.cn)("aspect-square size-full",t),...r})}function l(e){let{className:t,...r}=e;return(0,a.jsx)(s.H4,{"data-slot":"avatar-fallback",className:(0,n.cn)("bg-muted flex size-full items-center justify-center rounded-full",t),...r})}},76052:(e,t,r)=>{r.d(t,{A:()=>l,AuthProvider:()=>i});var a=r(95155),s=r(12115),n=r(46414);let o=(0,s.createContext)(void 0);function i(e){let{children:t}
1=e,[r,i]=(0,s.useState)(null),[l,d]=(0,s.useState)(null),[c,u]=(0,s.useState)(!0),[m,h]=(0,s.useState)(null),f=(0,s.useCallback)(async e=>{if(!e)return null;try{let e=await fetch("/api/user",{method:"GET",credentials:"include"});if(!e.ok){let t=await e.text();return console.error("Error fetching profile from API:",e.status,t),null}return await e.json()}catch(e){return console.error("Error in createOrGetUserProfile:",e),null}},[]);(0,s.useEffect)(()=>{let e=(0,n.U)();h(e),(async()=>{try{let{data:{session:t},error:r}=await e.auth.getSession();r?console.error("Error getting session:",r):(null==t?void 0:t.user)&&(d(t),i(t.user),await f(t.user))}catch(e){console.error("Error getting initial session:",e)}finally{u(!1)}})();let{data:{subscription:t}}=e.auth.onAuthStateChange(async(e,t)=>{var r;if(d(t),i(null!==(r=null==t?void 0:t.user)&&void 0!==r?r:null),"SIGNED_IN"===e&&(null==t?void 0:t.user))try{let e=await f(t.user);console.log("Profile ensured:",e?"exists/created":"failed to create")}catch(e){console.error("Error in profile handling:",e)}u(!1)});return()=>t.unsubscribe()},[f]);let v=async()=>{if(m)try{await m.auth.signOut()}catch(e){console.error("Error signing out:",e)}};return(0,a.jsx)(o.Provider,{value:{user:r,session:l,loading:c,signOut:v},children:t})}function l(){let e=(0,s.useContext)(o);if(void 0===e)throw Error("useAuth must be used within an AuthProvider");return e}},97168:(e,t,r)=>{r.d(t,{$:()=>l});var a=r(95155);r(12115);var s=r(99708),n=r(74466),o=r(53999);let i=(0,n.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors cursor-pointer disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_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 hover:bg-primary/90",destructive:"bg-destructive text-white 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 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-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function l(e){let{className:t,variant:r,size:n,asChild:l=!1,...d}=e,c=l?s.DX:"button";return(0,a.jsx)(c,{"data-slot":"button",className:(0,o.cn)(i({variant:r,size:n,className:t})),...d})}},99304:(e,t,r)=>{r.d(t,{D:()=>i,ThemeProvider:()=>o});var a=r(95155),s=r(12115);let n=(0,s.createContext)(void 0);function o(e){let{children:t}
1=e,[r,o]=(0,s.useState)("auto"),[i,l]=(0,s.useState)("green"),[d,c]=(0,s.useState)("light"),u=()=>{let e=new Date().getHours();return e>=6&&e<18?"light":"dark"};return(0,s.useEffect)(()=>{let e=localStorage.getItem("velanote-theme"),t=localStorage.getItem("velanote-color-scheme");e&&o(e),t&&l(t)},[]),(0,s.useEffect)(()=>{let e=()=>{let e;c(e="auto"===r?u():r);let t=document.documentElement;t.classList.remove("light","dark"),t.classList.add(e)};if(e(),"auto"===r){let t=setInterval(e,6e4);return()=>clearInterval(t)}},[r]),(0,s.useEffect)(()=>{let e=document.documentElement;e.classList.remove("theme-slate","theme-green"),"slate"===i?e.classList.add("theme-slate"):e.classList.add("theme-green")},[i]),(0,a.jsx)(n.Provider,{value:{theme:r,colorScheme:i,resolvedTheme:d,setTheme:e=>{o(e),localStorage.setItem("velanote-theme",e)},setColorScheme:e=>{l(e),localStorage.setItem("velanote-color-scheme",e)}},children:t})}function i(){let e=(0,s.useContext)(n);if(!e)throw Error("useTheme must be used within ThemeProvider");return e}}}]);
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.