1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4326],{86498:function(e,t,n){Promise.resolve().then(n.bind(n,784))},99376:function(e,t,n){"use strict";var r=n(35475);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}})},784:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return y}});var r=n(57437),a=n(2265),l=n(27648),s=n(99376),o=n(32052),i=n(52870),u=n(25172),c=n(56857),d=n(92408),f=n(12381),p=n(79820),m=n(40279),h=n(75060);function v(){let{login:e}=(0,o.a)(),t=(0,s.useRouter)(),n=(0,s.useSearchParams)(),[v,y]=(0,a.useState)(""),[x,g]=(0,a.useState)(""),[b,w]=(0,a.useState)(""),j=async r=>{r.preventDefault(),w("");try{await e(v,x);let r=n.get("next");if(r&&r.startsWith("/")&&!r.startsWith("//"))t.push(r);else{var a;t.push(null!==(a=(0,i.wb)())&&void 0!==a?a:await (0,u.G)())}}catch(e){w("Invalid email or password")}};return(0,r.jsx)("div",{className:"min-h-screen account-gradient flex items-center justify-center",children:(0,r.jsx)(p.Zb,{className:"w-full max-w-sm rounded-xl shadow-lg",children:(0,r.jsxs)(p.aY,{className:"px-8 py-2",children:[(0,r.jsx)("div",{className:"flex items-center gap-2 mb-8 justify-center",children:(0,r.jsx)(d.Z,{height:32})}),(0,r.jsxs)("form",{onSubmit:j,className:"space-y-5",children:[(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)(h._,{htmlFor:"username",children:"Email"}),(0,r.jsx)(m.I,{id:"username",type:"text",value:v,onChange:e=>y(e.target.value),required:!0,autoFocus:!0,tabIndex:1})]}),(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)(h._,{htmlFor:"password",children:"Password"}),(0,r.jsx)(m.I,{id:"password",type:"password",value:x,onChange:e=>g(e.target.value),required:!0,tabIndex:2})]}),b&&(0,r.jsxs)("div",{className:"text-sm space-y-1",children:[(0,r.jsx)("p",{className:"text-destructive",children:b}),(0,r.jsx)("p",{className:"text-muted-foreground",children:"If you signed up with Google, use âContinue with Googleâ below."})]}),(0,r.jsx)(f.z,{type:"submit",className:"w-full",tabIndex:3,children:"Sign In"})]}),(0,r.jsx)(c.Z,{next:n.get("next"),tabIndex:4}),(0,r.jsxs)("div",{className:"mt-5 flex items-center justify-between text-sm",children:[(0,r.jsx)(l.default,{href:"/account/forgot-password",className:"text-accent hover:underline",tabIndex:6,children:"Forgot password?"}),(0,r.jsx)(l.default,{href:"/account/register",className:"text-accent hover:underline",tabIndex:5,children:"Create account"})]})]})})})}function y(){return(0,r.jsx)(a.Suspense,{children:(0,r.jsx)(v,{})})}},5240:function(e,t,n){"use strict";n.d(t,{AuthProvider:function(){return d},V:function(){return c}});var r=n(57437),a=n(2265),l=n(43577),s=n(46214),o=n(85554),i=n(81221),u=n(25172);let c=(0,a.createContext)({user:null,token:null,login:async()=>{},logout:()=>{},loading:!0});function d(e){let{children:t}=e,[n,d]=(0,a.useState)(null),[f,p]=(0,a.useState)(null),[m,h]=(0,a.useState)(!0),v=(0,a.useCallback)(async()=>{var e,t;try{let t=await i.ZP.get("/api/v2/users/me");d({...t.data,username:null!==(e=t.data.username)&&void 0!==e?e:t.data.email}),t.data.id&&s.ZP.identify(t.data.id,{email:t.data.email})}catch(e){d(null),(0,l.IZ)(e)&&(null===(t=e.response)||void 0===t?void 0:t.status)===401&&(p(null),localStorage.removeItem("access_token"),localStorage.removeItem("refresh_token"),(0,i.xV)())}},[]);(0,a.useEffect)(()=>{let e=localStorage.getItem("access_token");e?(p(e),v().finally(()=>h(!1))):(0,i.Ji)()?(0,i.jb)().then(async e=>{e&&(p(e),await v())}).catch(()=>{}).finally(()=>h(!1)):h(!1)},[v]);let y=async(e,t)=>{let n=new URLSearchParams;n.append("username",e),n.append("password",t);let r=(await i.ZP.post("/api/v2/auth/login",n,{headers:{"Content-Type":"application/x-www-form-urlencoded"}})).data.access_token;localStorage.setItem("access_token",r),p(r),await (0,u.i)(),await v()};return(0,r.jsx)(c.Provider,{value:{user:n,token:f,login:y,logout:()=>{let e=localStorage.getItem("refresh_token");i.ZP.post("/api/v2/auth/revoke",e?{refresh_token:e}:{},{withCredentials:!0}).catch(()=>{}),localStorage.removeItem("access_token"),localStorage.removeItem("refresh_token"),(0,i.xV)(),p(null),d(null),s.ZP.reset(),(0,o.IG)()},loading:m},children:t})}},32052:function(e,t,n){"use strict";n.d(t,{a:function(){return l}});var r=n(2265),a=n(5240);function l(){return(0,r.useContext)(a.V)}},25172:function(e,t,n){"use strict";n.d(t,{G:function(){return l},i:function(){return a}});var r=n(81221);async function a(){try{await r.ZP.post("/api/v2/auth/sessions",null,{withCredentials:!0}),(0,r.sh)()}catch(e){}}async function l(){try{return(await r.ZP.get("/api/v2/users/me/preferences")).data.show_welcome?"/dashboard/welcome":"/dashboard/notes"}catch(e){return"/dashboard/notes"}}},98575:function(e,t,n){"use strict";n.d(t,{e:function(){return i}});var r=n(2265),a=Object.defineProperty,l=(e,t)=>
1a(e,"name",{value:t,configurable:!0});function s(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function o(...e){return t=>{let n=!1,r=e.map(e=>{let r=s(e,t);return n||"function"!=typeof r||(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];"function"==typeof n?n():s(e[t],null)}}}}function i(...e){return r.useCallback(o(...e),e)}l(s,"setRef"),l(o,"composeRefs"),l(i,"useComposedRefs")},66840:function(e,t,n){"use strict";n.d(t,{WV:function(){return i},jH:function(){return u}});var r=n(2265),a=n(54887),l=n(37053),s=n(57437),o=Object.defineProperty,i=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let n=(0,l.Z8)(`Primitive.${t}`),a=r.forwardRef((e,r)=>{let{asChild:a,...l}=e,o=a?n:t;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,s.jsx)(o,{...l,ref:r})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{});function u(e,t){e&&a.flushSync(()=>e.dispatchEvent(t))}o(u,"name",{value:"dispatchDiscreteCustomEvent",configurable:!0})},37053:function(e,t,n){"use strict";n.d(t,{Z8:function(){return i},fC:function(){return u},sA:function(){return d}});var r,a=n(2265),l=n(98575),s=Object.defineProperty,o=(e,t)=>s(e,"name",{value:t,configurable:!0});function i(e){let t=a.forwardRef((t,n)=>{let{children:r,...s}=t,o=null,i=!1,u=[];y(r)&&"function"==typeof w&&(r=w(r._payload)),a.Children.forEach(r,e=>{if(h(e)){i=!0;let t="child"in e.props?e.props.child:e.props.children;y(t)&&"function"==typeof w&&(t=w(t._payload)),o=f(e,t),u.push(o?.props?.children)}else u.push(e)}),o?o=a.cloneElement(o,void 0,u):!i&&1===a.Children.count(r)&&a.isValidElement(r)&&(o=r);let c=o?m(o):void 0,d=(0,l.e)(n,c);if(!o){if(r||0===r)throw Error(i?b(e):g(e));return r}let v=p(s,o.props??{});return o.type!==a.Fragment&&(v.ref=n?d:c),a.cloneElement(o,v)});return t.displayName=`${e}.Slot`,t}o(i,"createSlot");var u=i("Slot"),c=Symbol.for("radix.slottable");function d(e){let t=o(e=>"child"in e?e.children(e.child):e.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=c,t}o(d,"createSlottable");var f=o((e,t)=>{if("child"in e.props){let t=e.props.child;return a.isValidElement(t)?a.cloneElement(t,void 0,e.props.children(t.props.children)):null}return a.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function p(e,t){let n={...t};for(let r in t){let a=e[r],l=t[r];/^on[A-Z]/.test(r)?a&&l?n[r]=(...e)=>{let t=l(...e);return a(...e),t}:a&&(n[r]=a):"style"===r?n[r]={...a,...l}:"className"===r&&(n[r]=[a,l].filter(Boolean).join(" "))}return{...e,...n}}function m(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(n=(t=Object.getOwnPropertyDescriptor(e,"ref")?.get)&&"isReactWarning"in t&&t.isReactWarning)?e.props.ref:e.props.ref||e.ref}function h(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===c}o(p,"mergeProps"),o(m,"getElementRef"),o(h,"isSlottable");var v=Symbol.for("react.lazy");function y(e){return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===v&&"_payload"in e&&x(e._payload)}function x(e){return"object"==typeof e&&null!==e&&"then"in e}o(y,"isLazyComponent"),o(x,"isPromiseLike");var g=o(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),b=o(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),w=(r||(r=n.t(a,2)))[" use ".trim().toString()]},90535:function(e,t,n){"use strict";n.d(t,{j:function(){return s}});var r=n(61994);let a=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,l=r.W,s=(e,t)=>n=>{var r;if((null==t?void 0:t.variants)==null)return l(e,null==n?void 0:n.class,null==n?void 0:n.className);let{variants:s,defaultVariants:o}=t,i=Object.keys(s).map(e=>{let t=null==n?void 0:n[e],r=null==o?void 0:o[e];if(null===t)return null;let l=a(t)||a(r);return s[e][l]}),u=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return void 0===r||(e[n]=r),e},{});return l(e,i,null==t?void 0:null===(r=t.compoundVariants)||void 0===r?void 0:r.reduce((e,t)=>
1{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...o,...u}[t]):({...o,...u})[t]===n})?[...e,n,r]:e},[]),null==n?void 0:n.class,null==n?void 0:n.className)}}},function(e){e.O(0,[5878,5657,5258,5337,5554,4604,2971,2117,1744],function(){return e(e.s=86498)}),_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.