@trieoh/identityx-sdk-ts 0.12.6 → 0.12.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/react.js CHANGED
@@ -1,3 +1,3 @@
1
- import {createContext,useRef,useSyncExternalStore,useEffect,useCallback,useMemo,useContext,useState}from'react';import {logger,createDefaultFetchClient,simpleFetch}from'@trieoh/envoy-fetch-ts';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {RiEyeCloseLine,RiEyeLine}from'react-icons/ri';import {GoPerson}from'react-icons/go';import {ImExit}from'react-icons/im';import {FaDesktop,FaTabletAlt,FaMobileAlt,FaTrashAlt}from'react-icons/fa';import {UAParser}from'ua-parser-js';import {FiCheck,FiInfo}from'react-icons/fi';function we(e,r){if(r.startsWith("http"))return r;let t=e.replace(/\/$/,""),o=r.replace(/^\//,"");return `${t}/${o}`}var j={isAuthenticated:false,isInitializing:true},xe=new Set,De=()=>xe.forEach(e=>e()),_={subscribe:e=>(xe.add(e),()=>xe.delete(e)),getSnapshot:()=>j,getServerSnapshot:()=>j,set:e=>{j={...j,...e},De();},reset:()=>{j={isAuthenticated:false,isInitializing:false},De();}};typeof window<"u"&&window.addEventListener("storage",e=>{if(e.key==="trieoh_access_expiry")if(!e.newValue)_.reset();else {let r=Number(e.newValue),t=!isNaN(r)&&r>Date.now();_.set({isAuthenticated:t,isInitializing:false});}});var I={getItem:e=>typeof window<"u"?localStorage.getItem(e):null,setItem:(e,r)=>{typeof window<"u"&&localStorage.setItem(e,r);},removeItem:e=>{typeof window<"u"&&localStorage.removeItem(e);}},K={getItem:e=>typeof window<"u"?sessionStorage.getItem(e):null,setItem:(e,r)=>{typeof window<"u"&&sessionStorage.setItem(e,r);},removeItem:e=>{typeof window<"u"&&sessionStorage.removeItem(e);}},z={get:e=>{if(typeof window>"u")return null;let r=e+"=",t=document.cookie.split(";");for(let o=0;o<t.length;o++){let i=t[o];for(;i.charAt(0)===" ";)i=i.substring(1,i.length);if(i.indexOf(r)===0)return i.substring(r.length,i.length)}return null},set:(e,r,t={})=>{if(typeof window>"u")return;let{expires:o,path:i="/",domain:s,secure:n=window.location.protocol==="https:",sameSite:l=n?"None":"Lax"}=t,a=window.location.hostname==="localhost",c=[`${e}=${r}`,s&&!a?`Domain=${s}`:"",`Path=${i}`,`SameSite=${l}`,n?"Secure":"",o?`expires=${o}`:""];document.cookie=c.filter(Boolean).join("; ");},remove:(e,r)=>{z.set(e,"",{expires:"Thu, 01 Jan 1970 00:00:00 GMT",domain:r||void 0});}};var ne="trieoh_access_token",M={getAccessToken:()=>K.getItem(ne),setAccessToken:e=>{e?K.setItem(ne,e):K.removeItem(ne);},clear:()=>{K.removeItem(ne);}};var Y=null,be="trieoh_access_expiry",le="trieoh_refresh_expiry",ae="trieoh_refresh_domain";function Oe(e){if(typeof window>"u")return null;let r=window.location.hostname;if(r==="localhost"||r==="127.0.0.1"||r.includes("localhost"))return null;if(e)try{let o=e;return o.startsWith("http")&&(o=new URL(o).hostname),r===o||r.endsWith("."+o)?o:r}catch{return r}return r}function Me(e){try{let r=e.split(".")[1];if(!r)return null;let t=r.replace(/-/g,"+").replace(/_/g,"/");for(;t.length%4;)t+="=";let o=decodeURIComponent(atob(t).split("").map(i=>"%"+("00"+i.charCodeAt(0).toString(16)).slice(-2)).join(""));return JSON.parse(o)}catch(r){return logger.error("Error decoding JWT:",r),null}}function W(e){let{access_token_string:r,refresh_token_string:t,access_expires_at:o,refresh_expires_at:i}=e,s=Me(r);if(!s){logger.error("Failed to decode tokens");return}M.setAccessToken(r);let n=new Date(i).getTime(),l=new Date(o).getTime(),a=Oe(e.domain);z.set("refresh_token",t,{expires:new Date(n).toUTCString(),domain:a}),Y={access_data:s,refresh_expiry_date:n},I.setItem(be,String(l)),I.setItem(le,String(n)),a?I.setItem(ae,a):I.removeItem(ae),_.set({isAuthenticated:true,isInitializing:false}),logger.log("Auth session saved");}function X(){if(Y)return Y;let e=M.getAccessToken();if(!e)return null;let r=Me(e);if(!r||r.exp*1e3<=Date.now())return null;let t=I.getItem(le);if(!t)return null;let o=Number(t);if(isNaN(o))return null;let i={access_data:r,refresh_expiry_date:o};return Y=i,i}function Be(e,r){try{let t=I.getItem(e);if(!t)return !0;let o=Number(t);return isNaN(o)?!0:o-Date.now()<=r*1e3}catch(t){return logger.warn("Error reading expiry:",t),true}}var ye=(e=30)=>Be(be,e),ce=(e=10)=>Be(le,e);function Q(){Y=null,M.clear(),I.removeItem(be),I.removeItem(le);let e=I.getItem(ae)||Oe();z.remove("refresh_token",e),I.removeItem(ae),_.reset(),logger.log("Auth tokens and claims cleared");}function Fe(){let e=X();return e?e.access_data.sub:null}function it(){let e=typeof window>"u",r=typeof import.meta<"u"&&import.meta.env?import.meta.env:{},t=typeof process<"u"?process.env:{},o=r.VITE_TRIEOH_AUTH_PROJECT_ID||t.NEXT_PUBLIC_TRIEOH_AUTH_PROJECT_ID||t.PUBLIC_TRIEOH_AUTH_PROJECT_ID||"",i=e&&t.TRIEOH_AUTH_API_KEY||"";return {PROJECT_ID:o,API_KEY:i,BASE_URL:"https://api.trieauth.trieoh.com"}}var ue=null,Re={};function Ue(e){Re={...Re,...e},ue=null;}function Se(){return ue||(ue={...it(),...Re}),ue}var b={get PROJECT_ID(){return Se().PROJECT_ID},get BASE_URL(){return Se().BASE_URL}};var me=class{constructor(r){this.isRefreshing=false;this.refreshPromise=null;this.baseURL=r?.baseURL||b.BASE_URL,this.authBaseURL=r?.authBaseURL||this.baseURL,this.onTokenRefreshed=r?.onTokenRefreshed,this.onRefreshFailed=r?.onRefreshFailed;}async refreshToken(){return this.isRefreshing&&this.refreshPromise?this.refreshPromise:(this.isRefreshing=true,this.refreshPromise=(async()=>{let r=true;try{let t=await simpleFetch(we(this.authBaseURL,"/auth/refresh"),{method:"POST",credentials:"include"});if(t.code!==200||!t.data)throw r=t.code!==503,new Error(t.message||"Failed to refresh token");W(t.data);let o=X();o&&this.onTokenRefreshed?.(o),logger.log("Token refreshed successfully");}catch(t){throw logger.warn("Failed to refresh token:",t),r&&Q(),this.onRefreshFailed?.(t),t}finally{this.isRefreshing=false,this.refreshPromise=null;}})(),this.refreshPromise)}async beforeRequest(){if(ce()){Q();return}if(!!!M.getAccessToken()||ye(30))try{await this.refreshToken();}catch(t){logger.warn("Proactive refresh failed:",t);}}async fetch(r,t){let o=t?.requiresAuth!==false,i=r.includes("/auth/refresh");o&&!i&&!t?.skipRefresh&&await this.beforeRequest();let s=we(this.baseURL,r),n=async()=>{let a=M.getAccessToken(),c=new Headers(t?.headers);return o&&a&&c.set("Authorization",`Bearer ${a}`),c.has("Content-Type")||c.set("Content-Type","application/json"),fetch(s,{...t,headers:c,credentials:"include"})},l=await n();if(l.status===401&&o&&!i){let a=!!z.get("refresh_token"),c=ye(30);if(a&&c){logger.log("401 detected and token is expiring/expired, attempting refresh...");try{await this.refreshToken(),l=await n();}catch{logger.error("Retry failed after refresh error");}}}return l}};function B(e){if(!e)return;let{requiresAuth:r,skipRefresh:t,...o}=e,i={};return r!==void 0&&(i.requiresAuth=r),t!==void 0&&(i.skipRefresh=t),{...o,adapterInit:{...o.adapterInit,...i}}}var de=class{constructor(r,t,o,i){this.interceptor=new me({baseURL:r,authBaseURL:t,onTokenRefreshed:o}),this.client=createDefaultFetchClient({...i,adapter:this.interceptor.fetch.bind(this.interceptor)});}request(r,t){return this.client.request(r,B(t))}get(r,t){return this.client.get(r,B(t))}post(r,t,o){return this.client.post(r,t,B(o))}put(r,t,o){return this.client.put(r,t,B(o))}patch(r,t,o){return this.client.patch(r,t,B(o))}delete(r,t,o){return this.client.delete(r,t,B(o))}query(r,t){return this.client.query(r,B(t))}};var V=()=>{if(!b.PROJECT_ID||b.PROJECT_ID.trim()==="")throw new Error("[TRIEOH SDK] Project ID is missing. Please set PUBLIC_TRIEOH_AUTH_PROJECT_ID, NEXT_PUBLIC_TRIEOH_AUTH_PROJECT_ID or VITE_TRIEOH_AUTH_PROJECT_ID.")};var He=(e,r)=>({login:async(t,o)=>{b.PROJECT_ID&&V();let i=`/auth/login${b.PROJECT_ID?`?project_id=${b.PROJECT_ID}`:""}`,s=await e.post(i,{email:t,password:o},{requiresAuth:false});return s.success&&(W(s.data),r?.onLogin?.(s)),s},register:async(t,o)=>{let i={requiresAuth:false},s=`/auth/register${b.PROJECT_ID?`?project_id=${b.PROJECT_ID}`:""}`;b.PROJECT_ID&&V();let n=await e.post(s,{email:t,password:o},i);return n.success&&r?.onRegister?.(n),n},logout:async t=>{let o=`/auth/logout${b.PROJECT_ID?`?project_id=${b.PROJECT_ID}`:""}`,i=await e.post(o);return (i.success||t?.forceLogout)&&Q(),i},refresh:async()=>{let t=await e.post("/auth/refresh",void 0,{skipRefresh:true});return t.success&&(W(t.data),r?.onRefresh?.(t)),t},sessions:async()=>e.get("/sessions"),currentSession:async()=>e.get("/sessions/me"),revokeASession:async t=>e.delete(`/sessions/${t}`),revokeSessions:async(t=false)=>{let o=t?"/sessions":"/sessions/others";return e.delete(o)},profile:()=>Fe(),sendForgotPassword:async t=>{let o={requiresAuth:false};return b.PROJECT_ID?(V(),e.post("/account/forgot-password",{email:t,project_id:b.PROJECT_ID},o)):e.post("/account/forgot-password",{email:t},o)},resetPassword:async(t,o)=>{let i=await e.post(`/account/reset-password?token=${t}`,{new_password:o},{requiresAuth:false});return i.success&&r?.onResetPassword?.(i),i},verifyEmail:async t=>{let o=`/account/verify?token=${t}`,i=await e.post(o);return i.success&&r?.onVerify?.(i),i},resendVerifyEmail:async()=>e.post("/account/verify/resend"),health:async()=>e.get("/health",{requiresAuth:false}),authHealth:async()=>e.get("/protected/health")});var Ve=createContext(null);function Hr({children:e,baseURL:r,projectId:t,isProjectMode:o=true,fallback:i,waitSession:s=true,clientConfig:n,onLogin:l,onResetPassword:a,onRegister:c,onVerify:f,onRefresh:h}){let g=useRef(false),{isAuthenticated:p,isInitializing:u}=useSyncExternalStore(_.subscribe,_.getSnapshot,_.getServerSnapshot);useEffect(()=>{Ue({...t?{PROJECT_ID:t}:{},...r?{BASE_URL:r}:{}});},[t,r]);let S=useCallback(D=>{_.set({isAuthenticated:!!D.access_data,isInitializing:false}),h?.();},[h]),R=useMemo(()=>new de(r,void 0,S,n),[r,S,n]),x=useMemo(()=>He(R,{onLogin:l,onResetPassword:a,onRegister:c,onVerify:f,onRefresh:h}),[R,l,a,c,f,h]);useEffect(()=>{o&&V(),(async()=>{if(!g.current){if(g.current=true,X()){_.set({isAuthenticated:true,isInitializing:false});return}if(ce()){_.reset(),_.set({isInitializing:false});return}logger.log("No cached claims, attempting silent refresh...");try{await R.interceptor.refreshToken(),logger.log("Session restored.");}catch{_.reset(),logger.warn("Could not restore session (offline?).");}finally{_.set({isInitializing:false});}}})();},[x,o]);let A=useMemo(()=>({auth:x,isAuthenticated:p,isInitializing:u,isProjectMode:o}),[x,p,u,o]);return s&&u?i??null:jsx(Ve.Provider,{value:A,children:e})}function y(){let e=useContext(Ve);if(!e)throw new Error("useAuth must be used inside <AuthProvider>");return e}function ke(e,{insertAt:r}={}){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css",r==="top"&&t.firstChild?t.insertBefore(o,t.firstChild):t.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e));}ke(`/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */@layer properties;@layer theme,base,components,utilities;@layer theme{:root,:host{--font-sans: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--spacing: .25rem;--font-weight-extralight: 200;--font-weight-light: 300;--font-weight-normal: 400;--font-weight-medium: 500;--font-weight-semibold: 600;--radius-lg: .5rem;--ease-in-out: cubic-bezier(.4, 0, .2, 1);--animate-spin: spin 1s linear infinite;--default-transition-duration: .15s;--default-transition-timing-function: cubic-bezier(.4, 0, .2, 1);--default-font-family: var(--font-sans);--default-mono-font-family: var(--font-mono);--color-trieoh-primary: oklch(.1139 .0789 264.05);--color-trieoh-secondary: oklch(.7975 .1018 262.7);--color-trieoh-neutral1: oklch(.9702 0 0);--color-trieoh-neutral2: oklch(.1944 .0051 248.09);--radius-trieoh-full: 50%;--font-inter: "Inter", sans-serif}}@layer base{*,:after,:before,::backdrop,::file-selector-button{box-sizing:border-box;margin:0;padding:0;border:0 solid}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;tab-size:4;font-family:var(--default-font-family, ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings, normal);font-variation-settings:var(--default-font-variation-settings, normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings, normal);font-variation-settings:var(--default-mono-font-variation-settings, normal);font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea,::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;border-radius:0;background-color:transparent;opacity:1}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not (-webkit-appearance: -apple-pay-button)) or (contain-intrinsic-size: 1px){::placeholder{color:currentcolor;@supports (color: color-mix(in lab,red,red)){color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit,::-webkit-datetime-edit-year-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-second-field,::-webkit-datetime-edit-millisecond-field,::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]),::file-selector-button{appearance:button}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer utilities{.\\@container{container-type:inline-size}.trieoh-button-loading{&:after{content:"";position:absolute;top:0;left:-150%;width:150%;height:100%;background:linear-gradient(120deg,transparent 0%,var(--trieoh-neutral2) 40%,transparent 80%);@supports (color: color-mix(in lab,red,red)){background:linear-gradient(120deg,transparent 0%,color-mix(in oklab,var(--trieoh-neutral2) 40%,white 15%) 40%,transparent 80%)}animation:trieoh-shine 1.5s infinite}}.absolute{position:absolute}.relative{position:relative}.top-0{top:calc(var(--spacing) * 0)}.right-0{right:calc(var(--spacing) * 0)}.m-0{margin:calc(var(--spacing) * 0)}.m-2{margin:calc(var(--spacing) * 2)}.m-\\[0\\.125rem\\]{margin:.125rem}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-\\[0\\.625rem\\]{margin-bottom:.625rem}.box-border{box-sizing:border-box}.block{display:block}.contents{display:contents}.flex{display:flex}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.h-12{height:calc(var(--spacing) * 12)}.h-16{height:calc(var(--spacing) * 16)}.h-\\[3\\.25rem\\]{height:3.25rem}.h-\\[64px\\]{height:64px}.h-auto{height:auto}.h-full{height:100%}.max-h-\\[max\\(75dvh\\,32rem\\)\\]{max-height:max(75dvh,32rem)}.min-h-screen{min-height:100vh}.w-12{width:calc(var(--spacing) * 12)}.w-16{width:calc(var(--spacing) * 16)}.w-\\[64px\\]{width:64px}.w-full{width:100%}.max-w-\\[14rem\\]{max-width:14rem}.max-w-\\[25rem\\]{max-width:25rem}.max-w-\\[30rem\\]{max-width:30rem}.min-w-0{min-width:calc(var(--spacing) * 0)}.min-w-\\[10rem\\]{min-width:10rem}.min-w-\\[15rem\\]{min-width:15rem}.min-w-\\[20rem\\]{min-width:20rem}.flex-1{flex:1}.flex-\\[0_1_auto\\]{flex:0 1 auto}.flex-\\[1_1_auto\\]{flex:1 1 auto}.shrink-0{flex-shrink:0}.animate-spin{animation:var(--animate-spin)}.cursor-pointer{cursor:pointer}.appearance-none{appearance:none}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-1{gap:calc(var(--spacing) * 1)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-5{gap:calc(var(--spacing) * 5)}.gap-6{gap:calc(var(--spacing) * 6)}.gap-8{gap:calc(var(--spacing) * 8)}.gap-\\[0\\.625rem\\]{gap:.625rem}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded-\\[0\\.25rem\\]{border-radius:.25rem}.rounded-full{border-radius:calc(infinity * 1px)}.rounded-lg{border-radius:var(--radius-lg)}.rounded-trieoh-full{border-radius:var(--radius-trieoh-full)}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-none{--tw-border-style: none;border-style:none}.\\!border-\\[\\#e53935\\]{border-color:#e53935!important}.border-\\[rgba\\(0\\,0\\,0\\,0\\.3\\)\\]{border-color:#0000004d}.border-trieoh-neutral2{border-color:var(--color-trieoh-neutral2)}.border-trieoh-secondary{border-color:var(--color-trieoh-secondary)}.bg-\\[oklch\\(0\\.8853_0_0\\/30\\%\\)\\]{background-color:#d9d9d94d}.bg-transparent{background-color:transparent}.bg-trieoh-neutral1{background-color:var(--color-trieoh-neutral1)}.bg-trieoh-secondary\\/10{background-color:color-mix(in srgb,oklch(.7975 .1018 262.7) 10%,transparent);@supports (color: color-mix(in lab,red,red)){background-color:color-mix(in oklab,var(--color-trieoh-secondary) 10%,transparent)}}.p-2{padding:calc(var(--spacing) * 2)}.p-6{padding:calc(var(--spacing) * 6)}.p-\\[0\\.625rem\\]{padding:.625rem}.p-\\[1\\.5rem_0\\.5rem\\]{padding:1.5rem .5rem}.p-\\[1\\.25rem_0\\.75rem\\]{padding:1.25rem .75rem}.p-\\[1\\.25rem_1\\.5rem\\]{padding:1.25rem 1.5rem}.p-\\[1rem_0\\]{padding:1rem 0}.px-\\[0\\.75rem\\]{padding-inline:.75rem}.px-\\[0\\.625rem\\]{padding-inline:.625rem}.px-\\[1\\.5rem\\]{padding-inline:1.5rem}.py-4{padding-block:calc(var(--spacing) * 4)}.py-\\[0\\.125rem\\]{padding-block:.125rem}.py-\\[0\\.0625rem\\]{padding-block:.0625rem}.text-center{text-align:center}.font-inter{font-family:var(--font-inter)}.text-\\[0\\.75rem\\]{font-size:.75rem}.text-\\[0\\.875rem\\]{font-size:.875rem}.text-\\[1rem\\]{font-size:1rem}.font-extralight{--tw-font-weight: var(--font-weight-extralight);font-weight:var(--font-weight-extralight)}.font-light{--tw-font-weight: var(--font-weight-light);font-weight:var(--font-weight-light)}.font-medium{--tw-font-weight: var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight: var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight: var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.text-\\[\\#6b7280\\]{color:#6b7280}.text-\\[\\#10b981\\]{color:#10b981}.text-\\[\\#e53935\\]{color:#e53935}.text-\\[oklch\\(0\\.628_0\\.2577_29\\.23\\)\\]{color:red}.text-trieoh-neutral2{color:var(--color-trieoh-neutral2)}.text-trieoh-primary{color:var(--color-trieoh-primary)}.text-trieoh-secondary{color:var(--color-trieoh-secondary)}.line-through{text-decoration-line:line-through}.opacity-50{opacity:50%}.opacity-60{opacity:60%}.opacity-95{opacity:95%}.opacity-100{opacity:100%}.\\!shadow-none{--tw-shadow: 0 0 #0000 !important;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)!important}.shadow-\\[0_0\\.25rem_0\\.25rem_0_rgba\\(0\\,0\\,0\\,0\\.25\\)\\]{--tw-shadow: 0 .25rem .25rem 0 var(--tw-shadow-color, rgba(0,0,0,.25));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\\[0_0\\.25rem_1rem_rgba\\(0\\,0\\,0\\,0\\.25\\)\\]{--tw-shadow: 0 .25rem 1rem var(--tw-shadow-color, rgba(0,0,0,.25));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.transition-\\[color\\,text-decoration\\,opacity\\]{transition-property:color,text-decoration,opacity;transition-timing-function:var(--tw-ease, var(--default-transition-timing-function));transition-duration:var(--tw-duration, var(--default-transition-duration))}.transition-\\[opacity\\,transform\\]{transition-property:opacity,transform;transition-timing-function:var(--tw-ease, var(--default-transition-timing-function));transition-duration:var(--tw-duration, var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease, var(--default-transition-timing-function));transition-duration:var(--tw-duration, var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease, var(--default-transition-timing-function));transition-duration:var(--tw-duration, var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease, var(--default-transition-timing-function));transition-duration:var(--tw-duration, var(--default-transition-duration))}.duration-150{--tw-duration: .15s;transition-duration:.15s}.duration-200{--tw-duration: .2s;transition-duration:.2s}.duration-500{--tw-duration: .5s;transition-duration:.5s}.duration-\\[120ms\\]{--tw-duration: .12s;transition-duration:.12s}.ease-in-out{--tw-ease: var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.outline-none{--tw-outline-style: none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.hover\\:scale-\\[1\\.02\\]{&:hover{@media(hover:hover){scale:1.02}}}.hover\\:scale-\\[1\\.05\\]{&:hover{@media(hover:hover){scale:1.05}}}.hover\\:text-trieoh-primary{&:hover{@media(hover:hover){color:var(--color-trieoh-primary)}}}.hover\\:opacity-100{&:hover{@media(hover:hover){opacity:100%}}}.active\\:scale-\\[0\\.95\\]{&:active{scale:.95}}.active\\:scale-\\[0\\.98\\]{&:active{scale:.98}}.active\\:scale-\\[0\\.99\\]{&:active{scale:.99}}.disabled\\:\\!transform-none{&:disabled{transform:none!important}}.disabled\\:cursor-not-allowed{&:disabled{cursor:not-allowed}}.disabled\\:opacity-60{&:disabled{opacity:60%}}.\\@\\[640px\\]\\:flex-row{@container (width >= 640px){flex-direction:row}}.\\@\\[640px\\]\\:items-center{@container (width >= 640px){align-items:center}}.\\@\\[640px\\]\\:justify-between{@container (width >= 640px){justify-content:space-between}}.\\@\\[640px\\]\\:gap-2{@container (width >= 640px){gap:calc(var(--spacing) * 2)}}.\\@\\[640px\\]\\:gap-4{@container (width >= 640px){gap:calc(var(--spacing) * 4)}}.\\@\\[640px\\]\\:gap-8{@container (width >= 640px){gap:calc(var(--spacing) * 8)}}.\\@\\[640px\\]\\:text-left{@container (width >= 640px){text-align:left}}}@import url(https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap);@property --tw-border-style{syntax: "*"; inherits: false; initial-value: solid;}@property --tw-font-weight{syntax: "*"; inherits: false;}@property --tw-shadow{syntax: "*"; inherits: false; initial-value: 0 0 #0000;}@property --tw-shadow-color{syntax: "*"; inherits: false;}@property --tw-shadow-alpha{syntax: "<percentage>"; inherits: false; initial-value: 100%;}@property --tw-inset-shadow{syntax: "*"; inherits: false; initial-value: 0 0 #0000;}@property --tw-inset-shadow-color{syntax: "*"; inherits: false;}@property --tw-inset-shadow-alpha{syntax: "<percentage>"; inherits: false; initial-value: 100%;}@property --tw-ring-color{syntax: "*"; inherits: false;}@property --tw-ring-shadow{syntax: "*"; inherits: false; initial-value: 0 0 #0000;}@property --tw-inset-ring-color{syntax: "*"; inherits: false;}@property --tw-inset-ring-shadow{syntax: "*"; inherits: false; initial-value: 0 0 #0000;}@property --tw-ring-inset{syntax: "*"; inherits: false;}@property --tw-ring-offset-width{syntax: "<length>"; inherits: false; initial-value: 0px;}@property --tw-ring-offset-color{syntax: "*"; inherits: false; initial-value: #fff;}@property --tw-ring-offset-shadow{syntax: "*"; inherits: false; initial-value: 0 0 #0000;}@property --tw-duration{syntax: "*"; inherits: false;}@property --tw-ease{syntax: "*"; inherits: false;}@keyframes spin{to{transform:rotate(360deg)}}@keyframes trieoh-shine{0%{left:-150%}to{left:150%}}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style: solid;--tw-font-weight: initial;--tw-shadow: 0 0 #0000;--tw-shadow-color: initial;--tw-shadow-alpha: 100%;--tw-inset-shadow: 0 0 #0000;--tw-inset-shadow-color: initial;--tw-inset-shadow-alpha: 100%;--tw-ring-color: initial;--tw-ring-shadow: 0 0 #0000;--tw-inset-ring-color: initial;--tw-inset-ring-shadow: 0 0 #0000;--tw-ring-inset: initial;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-offset-shadow: 0 0 #0000;--tw-duration: initial;--tw-ease: initial}}}
2
- `);function E({name:e,label:r,placeholder:t,type:o="text",value:i,onValueChange:s,onBlur:n,autoComplete:l,rulesStatus:a=[],submitted:c=false,inputRef:f}){let[h,g]=useState(false),p=a.some(u=>!u.passed);return jsxs("div",{className:"font-inter relative w-full flex flex-col gap-1 text-trieoh-neutral2",children:[jsx("label",{htmlFor:e,className:"text-[1rem] font-semibold",children:r}),jsxs("div",{className:`flex justify-between items-center px-[0.625rem] py-[0.0625rem] gap-[0.625rem] border-b-2 border-trieoh-neutral2 ${p&&c?"!border-[#e53935]":""}`,children:[jsx("input",{type:h?"text":o,name:e,id:e,placeholder:t,value:i,onChange:u=>s&&s(u.target.value),onBlur:n,autoComplete:l,"aria-invalid":p&&c,ref:f,className:"min-w-[10rem] flex-1 text-trieoh-base font-light text-trieoh-neutral2 appearance-none bg-transparent outline-none border-none !shadow-none py-[0.125rem]"}),o==="password"&&(h?jsx(RiEyeCloseLine,{className:"cursor-pointer shrink-0 select-none",size:24,onClick:()=>g(false)}):jsx(RiEyeLine,{className:"cursor-pointer shrink-0 select-none",size:24,onClick:()=>g(true)}))]}),jsx("div",{className:"text-[0.75rem] text-[#6b7280] transition-opacity duration-200 ease-in-out",children:a.map((u,S)=>{let R=["transition-[color,text-decoration,opacity] duration-[120ms] ease opacity-95 m-[0.125rem]",u.passed?"line-through opacity-60 text-[#10b981]":"",!u.passed&&c?"text-[#e53935] font-semibold opacity-100":""].filter(Boolean).join(" ");return jsx("p",{className:R,children:u.message},u.id??S)})})]})}function k({label:e,onSubmit:r,loading:t}){return jsx("button",{type:"submit",onClick:r,disabled:t,className:`font-inter w-full h-[3.25rem] text-trieoh-xl font-semibold outline-none bg-transparent relative overflow-hidden min-w-[10rem] shrink-0 border-2 border-trieoh-neutral2 text-trieoh-neutral2 cursor-pointer px-[1.5rem] transition-transform duration-500 rounded-[0.25rem] hover:scale-[1.02] active:scale-[0.99] disabled:opacity-60 disabled:cursor-not-allowed disabled:!transform-none ${t?"trieoh-button-loading":""}`,children:e})}function T({mainText:e,subText:r}){return jsxs("div",{className:"font-inter flex flex-col items-center",children:[jsx("div",{className:"flex justify-center items-center p-2 bg-[oklch(0.8853_0_0/30%)] rounded-trieoh-full mb-[0.625rem]",children:jsx(GoPerson,{className:"w-[64px] h-[64px] p-[0.625rem] bg-trieoh-neutral1 rounded-trieoh-full shadow-[0_0.25rem_1rem_rgba(0,0,0,0.25)]",size:70})}),jsx("h3",{className:"text-center text-trieoh-xl font-medium m-0",children:e}),jsx("span",{className:"text-center text-[0.875rem] font-light opacity-60",children:r})]})}function C(e,r){return e.map(t=>({id:t.id,message:t.message,passed:!!t.test(r)}))}function xt({onSuccess:e,onFailed:r,signUpRedirect:t,forgotPasswordRedirect:o,emailRules:i}){let[s,n]=useState(""),[l,a]=useState(""),[c,f]=useState(false),[h,g]=useState(false),p=useRef(null),u=useRef(null),{auth:S}=y(),R={email:i||[{message:"Digite um e-mail v\xE1lido, ex: exemplo@dominio.com",test:w=>/\S+@\S+\.\S+/.test(w)}],password:[]},x=C(R.email,s),A=C(R.password,l);return jsxs("form",{className:"font-inter flex flex-col w-full max-w-[30rem] min-w-[15rem] max-h-[max(75dvh,32rem)] overflow-hidden gap-5 items-center bg-trieoh-neutral1 text-trieoh-neutral2 p-[1.25rem_1.5rem] shadow-[0_0.25rem_0.25rem_0_rgba(0,0,0,0.25)] transition-transform duration-150 ease-in-out rounded-[0.25rem]",children:[jsx(T,{mainText:"Fa\xE7a login na sua conta",subText:"Insira seus dados para fazer login"}),jsxs("div",{className:"w-full flex flex-col gap-[0.625rem] flex-[1_1_auto] overflow-y-auto mb-2",children:[jsx(E,{label:"Email",name:"email",placeholder:"teste@gmail.com",autoComplete:"email",type:"email",value:s,onValueChange:n,inputRef:p,rulesStatus:x,submitted:c}),jsx(E,{label:"Senha",name:"password",placeholder:"**********",autoComplete:"current-password",type:"password",value:l,onValueChange:a,inputRef:u,rulesStatus:A,submitted:c})]}),jsx(k,{label:"Entrar",onSubmit:async w=>{w.preventDefault(),f(true);let U=x.some(v=>!v.passed),H=A.some(v=>!v.passed);if(U){p.current?.focus();return}if(H){u.current?.focus();return}g(true);let N=await S.login(s,l);N.success?e&&await e(N.message):r&&await r(N.message,N.trace),g(false);},loading:h}),o&&jsx("span",{className:"text-trieoh-sm font-semibold text-center cursor-pointer",children:jsx("span",{className:"cursor-pointer text-trieoh-secondary transition-colors duration-200 hover:text-trieoh-primary",onClick:o,children:"Esqueceu sua senha?"})}),t&&jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center gap-[0.625rem] w-full text-trieoh-base font-semibold opacity-60",children:[jsx("hr",{className:"flex-1"}),"OU",jsx("hr",{className:"flex-1"})]}),jsxs("span",{className:"text-trieoh-sm font-semibold",children:["Ainda n\xE3o possui uma conta? ",jsx("span",{className:"cursor-pointer text-trieoh-secondary transition-colors duration-200 hover:text-trieoh-primary",onClick:t,children:"Cadastra-se"})]})]})]})}function yt({onSuccess:e,onFailed:r,loginRedirect:t,emailRules:o,passwordRules:i}){let[s,n]=useState(""),[l,a]=useState(""),[c,f]=useState(""),[h,g]=useState(false),[p,u]=useState(false),S=useRef(null),R=useRef(null),x=useRef(null),{auth:A}=y(),D={email:o||[{message:"Digite um e-mail v\xE1lido, ex: exemplo@dominio.com",test:v=>/\S+@\S+\.\S+/.test(v)}],password:i||[{message:"M\xEDnimo de 8 caracteres.",test:v=>v.length>=8},{message:"Deve conter uma letra mai\xFAscula.",test:v=>/[A-Z]/.test(v)},{message:"Inclua pelo menos um caractere especial, ex: ! @ # $ % & * . ,",test:v=>/[!@#$%^&*(),.?":{}|<>_\-+=~`;/\\[\]]/.test(v)},{message:"Deve conter um n\xFAmero.",test:v=>/\d/.test(v)}],confirmPassword:[{message:"Senhas n\xE3o conferem.",test:v=>v===l}]},w=C(D.email,s),U=C(D.password,l),H=C(D.confirmPassword,c);return jsxs("form",{className:"font-inter flex flex-col w-full max-w-[30rem] min-w-[15rem] max-h-[max(75dvh,32rem)] overflow-hidden gap-5 items-center bg-trieoh-neutral1 text-trieoh-neutral2 p-[1.25rem_1.5rem] shadow-[0_0.25rem_0.25rem_0_rgba(0,0,0,0.25)] transition-transform duration-150 ease-in-out rounded-[0.25rem]",children:[jsx(T,{mainText:"Crie sua conta",subText:"Insira seus dados para come\xE7ar"}),jsxs("div",{className:"w-full flex flex-col gap-[0.625rem] flex-[1_1_auto] overflow-y-auto mb-2",children:[jsx(E,{label:"Email",name:"email",placeholder:"teste@gmail.com",autoComplete:"email",type:"email",value:s,onValueChange:n,inputRef:S,rulesStatus:w,submitted:h}),jsx(E,{label:"Senha",name:"password",placeholder:"**********",autoComplete:"new-password",type:"password",value:l,onValueChange:a,inputRef:R,rulesStatus:U,submitted:h}),jsx(E,{label:"Confirme a Senha",name:"confirm-password",placeholder:"**********",autoComplete:"new-password",type:"password",value:c,onValueChange:f,inputRef:x,rulesStatus:H,submitted:h})]}),jsx(k,{label:"Criar Conta",onSubmit:async v=>{v.preventDefault(),g(true);let tt=w.some(J=>!J.passed),rt=U.some(J=>!J.passed),ot=H.some(J=>!J.passed);if(tt){S.current?.focus();return}if(rt){R.current?.focus();return}if(ot){x.current?.focus();return}u(true);let se=await A.register(s,l);se.success?e&&await e(se.message):r&&await r(se.message,se.trace),u(false);},loading:p}),t&&jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center gap-[0.625rem] w-full text-trieoh-base font-semibold opacity-60",children:[jsx("hr",{className:"flex-1"}),"OU",jsx("hr",{className:"flex-1"})]}),jsxs("span",{className:"text-trieoh-sm font-semibold",children:["J\xE1 possui uma conta? ",jsx("span",{className:"cursor-pointer text-trieoh-secondary transition-colors duration-200 hover:text-trieoh-primary",onClick:t,children:"Entre"})]})]})]})}var Rt={xs:"text-trieoh-sm",sm:"text-trieoh-base",md:"text-trieoh-xl",lg:"text-trieoh-2xl",xl:"text-trieoh-3xl","2xl":"text-trieoh-6xl"};function _t({size:e}){let r=e?Rt[e]:"text-trieoh-xl";return jsxs("span",{className:`font-inter font-medium ${r}`,children:["\xA9 ",new Date().getFullYear()," TrieOH"]})}function Ct({onSuccess:e,onFailed:r,forceLogout:t}){let{auth:o}=y(),[i,s]=useState(false);return jsxs("button",{onClick:async l=>{if(l.preventDefault(),i)return;s(true);let a=await o.logout({forceLogout:t});a.success?e&&await e(a.message):r&&await r(a.message,a.trace),s(false);},type:"button",disabled:i,className:"font-inter border-none bg-transparent cursor-pointer flex items-end gap-1 text-trieoh-base font-medium text-[oklch(0.628_0.2577_29.23)] transition-transform duration-200 hover:scale-[1.05] active:scale-[0.98] disabled:opacity-60 disabled:cursor-not-allowed disabled:!transform-none",children:[jsx(ImExit,{size:24})," ",jsx("span",{children:"Log out"})]})}var je={mobile:FaMobileAlt,tablet:FaTabletAlt,desktop:FaDesktop};function Ke(e){let{device:r,os:t,browser:o}=UAParser(e);return {deviceType:r.type??"desktop",os:t.name,browser:o.name}}function Ye(e){let r=Ke(e);return {device:Dt(r.deviceType),os:r.os,browser:r.browser}}function Dt(e){if(!e)return "desktop";switch(e){case "mobile":return "mobile";case "tablet":return "tablet";default:return "desktop"}}function Ge(e){let r=Date.now()-new Date(e).getTime(),t=Math.floor(r/1e3),o=Math.floor(t/60),i=Math.floor(o/60),s=Math.floor(i/24),n=Math.floor(s/7);return t<60?"agora mesmo":o<60?`${o} minutos atr\xE1s`:i<24?`${i} horas atr\xE1s`:s<7?`${s} dias atr\xE1s`:`${n} semanas atr\xE1s`}function Ce({is_current:e,session_id:r,user_agent:t,issued_at:o,user_ip:i,onClick:s}){let n=Ye(t),l=je[n.device];return jsx("div",{className:"border-t border-[rgba(0,0,0,0.3)] p-[1.25rem_0.75rem] text-trieoh-neutral2",children:jsxs("div",{className:"relative flex flex-col items-center gap-2 flex-1 text-center @[640px]:flex-row @[640px]:items-center @[640px]:gap-4 @[640px]:text-left",children:[jsx(l,{size:40}),jsxs("div",{className:"flex flex-col min-w-0",children:[jsxs("h3",{className:"text-trieoh-base font-semibold m-0",children:[n.browser," - ",n.os]}),jsxs("span",{className:"inline-flex flex-col text-trieoh-sm font-extralight @[640px]:flex-row @[640px]:gap-2 @[640px]:items-center",children:[e&&jsx("strong",{className:"text-trieoh-primary font-normal",children:"\u2022 Sess\xE3o Atual \u2022"}),jsx("span",{children:`${i} - ${Ge(o)}`})]})]}),!e&&jsx(FaTrashAlt,{size:20,color:"red",onClick:a=>s(a,r),className:"absolute top-0 right-0 cursor-pointer opacity-60 transition-[opacity,transform] duration-200 hover:opacity-100 hover:scale-[1.05] active:scale-[0.95]"})]})})}function Bt({revokeAll:e=false,onSuccess:r}){let{auth:t}=y(),[o,i]=useState(false),[s,n]=useState([]),l=async()=>{let f=await t.sessions();if(f.success){let h=t.profile()?.session_id,g=f.data.sort((p,u)=>p.session_id===h?-1:u.session_id===h?1:0);n(g);}};useEffect(()=>{l();},[]);let a=async(f,h)=>{f.preventDefault();let g=s.find(p=>p.session_id===h);if(g){n(s.filter(p=>p.session_id!==h));try{(await t.revokeASession(h)).success||n(u=>[...u,g]);}catch{n(p=>[...p,g]);}}};return jsxs("div",{className:"font-inter w-full min-w-[20rem] m-2 @container bg-trieoh-neutral1 text-trieoh-neutral2 p-[1.5rem_0.5rem] rounded-lg",children:[jsxs("div",{className:"w-full flex flex-wrap items-center justify-center text-center gap-4 box-border px-[0.75rem] @[640px]:justify-between @[640px]:text-left @[640px]:gap-8",children:[jsxs("div",{className:"flex-[0_1_auto] max-w-[25rem]",children:[jsx("h3",{className:"font-semibold text-trieoh-2xl m-0 mb-1",children:"Navegadores e Dispositivos"}),jsx("p",{className:"font-extralight text-trieoh-base m-0",children:"Esses navegadores e dispositivos est\xE3o atualmente conectados \xE0 sua conta. Remova quaisquer dispositivos n\xE3o autorizados."})]}),jsx("button",{type:"submit",onClick:async f=>{if(f.preventDefault(),o)return;i(true);let h=await t.revokeSessions(e),g=t.profile()?.session_id;h.success&&(n(e?[]:s.filter(p=>p.session_id===g)),r&&r(h.message)),i(false);},disabled:o,className:`font-inter w-full max-w-[14rem] p-[1rem_0] h-auto text-trieoh-base font-semibold outline-none bg-transparent relative overflow-hidden shrink-0 border-2 border-trieoh-neutral2 text-trieoh-neutral2 cursor-pointer transition-transform duration-500 rounded-[0.25rem] hover:scale-[1.02] active:scale-[0.99] disabled:opacity-60 disabled:cursor-not-allowed disabled:!transform-none ${o?"trieoh-button-loading":""}`,children:"Revogar todas as sess\xF5es"})]}),jsx("div",{className:"mt-4",children:s.length>0?s.map(f=>jsx(Ce,{...f,is_current:t.profile()?.session_id===f.session_id,onClick:a},f.session_id)):jsx("span",{className:"block border-t border-[rgba(0,0,0,0.3)] p-[1.25rem_0.75rem] text-center font-semibold",children:"Nenhuma Sess\xE3o Dispon\xEDvel"})})]})}function Xe({onSuccess:e,onFailed:r,loginRedirect:t,emailRules:o}){let[i,s]=useState(""),[n,l]=useState(false),[a,c]=useState(false),f=useRef(null),{auth:h}=y(),p=C({email:o||[{message:"Digite um e-mail v\xE1lido, ex: exemplo@dominio.com",test:S=>/\S+@\S+\.\S+/.test(S)}]}.email,i);return jsxs("form",{className:"font-inter flex flex-col w-full max-w-[30rem] min-w-[15rem] max-h-[max(75dvh,32rem)] overflow-hidden gap-5 items-center bg-trieoh-neutral1 text-trieoh-neutral2 p-[1.25rem_1.5rem] shadow-[0_0.25rem_0.25rem_0_rgba(0,0,0,0.25)] transition-transform duration-150 ease-in-out rounded-[0.25rem]",children:[jsx(T,{mainText:"Esqueci a senha",subText:"Insira seu e-mail para receber um link de redefini\xE7\xE3o."}),jsx("div",{className:"w-full flex flex-col gap-[0.625rem] flex-[1_1_auto] overflow-y-auto mb-2",children:jsx(E,{label:"Email",name:"email",placeholder:"teste@gmail.com",autoComplete:"email",type:"email",value:i,onValueChange:s,inputRef:f,rulesStatus:p,submitted:n})}),jsx(k,{label:a?"Enviando...":"Enviar link de redefini\xE7\xE3o",onSubmit:async S=>{if(S.preventDefault(),l(true),p.some(A=>!A.passed)){f.current?.focus();return}c(true);let x=await h.sendForgotPassword(i);x.success?e&&await e(x.message):r&&await r(x.message,x.trace),c(false);},loading:a}),t&&jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center gap-[0.625rem] w-full text-trieoh-base font-semibold opacity-60",children:[jsx("hr",{className:"flex-1"}),"OU",jsx("hr",{className:"flex-1"})]}),jsxs("span",{className:"text-trieoh-sm font-semibold",children:["Lembrou-se da sua senha? ",jsx("span",{className:"cursor-pointer text-trieoh-secondary transition-colors duration-200 hover:text-trieoh-primary",onClick:t,children:"Login"})]})]})]})}function Ht({token:e,onSuccess:r,onFailed:t,loginRedirect:o,passwordRules:i}){let[s,n]=useState(""),[l,a]=useState(""),[c,f]=useState(false),[h,g]=useState(false),p=useRef(null),u=useRef(null),{auth:S}=y(),R={password:i||[{message:"M\xEDnimo de 8 caracteres.",test:w=>w.length>=8},{message:"Deve conter uma letra mai\xFAscula.",test:w=>/[A-Z]/.test(w)},{message:"Inclua pelo menos um caractere especial, ex: ! @ # $ % & * . ,",test:w=>/[!@#$%^&*(),.?":{}|<>_\-+=~`;/\\[\]]/.test(w)},{message:"Deve conter um n\xFAmero.",test:w=>/\d/.test(w)}],confirmPassword:[{message:"Senhas n\xE3o conferem.",test:w=>w===s}]},x=C(R.password,s),A=C(R.confirmPassword,l);return jsxs("form",{className:"font-inter flex flex-col w-full max-w-[30rem] min-w-[15rem] max-h-[max(75dvh,32rem)] overflow-hidden gap-5 items-center bg-trieoh-neutral1 text-trieoh-neutral2 p-[1.25rem_1.5rem] shadow-[0_0.25rem_0.25rem_0_rgba(0,0,0,0.25)] transition-transform duration-150 ease-in-out rounded-[0.25rem]",children:[jsx(T,{mainText:"Redefinir Senha",subText:"Crie uma nova senha para sua conta"}),jsxs("div",{className:"w-full flex flex-col gap-[0.625rem] flex-[1_1_auto] overflow-y-auto mb-2",children:[jsx(E,{label:"Nova Senha",name:"password",placeholder:"**********",autoComplete:"new-password",type:"password",value:s,onValueChange:n,inputRef:p,rulesStatus:x,submitted:c}),jsx(E,{label:"Confirme a Nova Senha",name:"confirm-password",placeholder:"**********",autoComplete:"new-password",type:"password",value:l,onValueChange:a,inputRef:u,rulesStatus:A,submitted:c})]}),jsx(k,{label:"Redefinir Senha",onSubmit:async w=>{w.preventDefault(),f(true);let U=x.some(v=>!v.passed),H=A.some(v=>!v.passed);if(U){p.current?.focus();return}if(H){u.current?.focus();return}g(true);let N=await S.resetPassword(e,s);N.success?r&&await r(N.message):t&&await t(N.message,N.trace),g(false);},loading:h}),o&&jsxs("span",{className:"text-trieoh-sm font-semibold",children:["Lembrou-se da sua senha? ",jsx("span",{className:"cursor-pointer text-trieoh-secondary transition-colors duration-200 hover:text-trieoh-primary",onClick:o,children:"Login"})]})]})}function Jt(e,r,t){let[o,i]=useState(true),[s,n]=useState("verifying"),[l,a]=useState("Verificando seu e-mail..."),{auth:c}=y(),f=useRef(false),h=async()=>{if(!f.current){f.current=true,i(true),n("verifying");try{if(c.profile()?.is_verified){n("already_verified"),a("Seu e-mail j\xE1 est\xE1 verificado."),i(!1);return}let u=await c.verifyEmail(e);u.success?(await c.refresh(),n("success"),a(u.message||"E-mail verificado com sucesso!"),r&&await r(u.message)):(n("error"),a(u.message||"Falha na verifica\xE7\xE3o do e-mail."),t&&await t(u.message,u.trace));}catch{n("error"),a("Ocorreu um erro inesperado durante a verifica\xE7\xE3o.");}finally{i(false);}}};return useEffect(()=>{e&&!f.current&&h();},[e]),{loading:o,status:s,message:l,onRetry:p=>{p.preventDefault(),f.current=false,h();},setStatus:n,setLoading:i,setMessage:a}}function jt({token:e,onSuccess:r,onFailed:t}){let{loading:o,status:i,message:s,onRetry:n}=Jt(e,r,t);return jsx("div",{className:"font-inter flex flex-col w-full h-full min-h-screen items-center justify-center bg-trieoh-neutral1 text-trieoh-neutral2 p-6",children:jsxs("div",{className:"w-full max-w-[30rem] flex flex-col gap-8 items-center bg-trieoh-neutral1 text-trieoh-neutral2 p-[1.25rem_1.5rem] shadow-[0_0.25rem_0.25rem_0_rgba(0,0,0,0.25)] rounded-[0.25rem]",children:[jsx(T,{mainText:i==="verifying"?"Verificando...":i==="error"?"Ops! Falha na verifica\xE7\xE3o":"Tudo pronto!",subText:s}),i==="verifying"&&jsx("div",{className:"w-full flex justify-center py-4",children:jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-trieoh-secondary"})}),i==="error"&&jsx("div",{className:"w-full flex flex-col gap-6 items-center",children:jsx("div",{className:"w-full mt-2",children:jsx(k,{label:"Tentar novamente",onSubmit:n,loading:o})})}),(i==="success"||i==="already_verified")&&jsxs("div",{className:"w-full flex flex-col gap-4 items-center",children:[jsx("div",{className:"w-16 h-16 flex items-center justify-center rounded-full bg-trieoh-secondary/10 text-trieoh-secondary",children:i==="success"?jsx(FiCheck,{size:40}):jsx(FiInfo,{size:40})}),jsx("p",{className:"text-trieoh-sm font-semibold opacity-50 text-center",children:"Voc\xEA j\xE1 pode fechar esta janela ou continuar navegando em sua conta."})]})]})})}function Kt({onSuccess:e,onFailed:r}){let[t,o]=useState(false),[i,s]=useState(false),{auth:n}=y();return jsxs("div",{className:"font-inter flex flex-col w-full max-w-[30rem] min-w-[15rem] max-h-[max(75dvh,32rem)] overflow-hidden gap-5 items-center bg-trieoh-neutral1 text-trieoh-neutral2 p-[1.25rem_1.5rem] shadow-[0_0.25rem_0.25rem_0_rgba(0,0,0,0.25)] transition-transform duration-150 ease-in-out rounded-[0.25rem]",children:[jsx(T,{mainText:"Reenviar Verifica\xE7\xE3o",subText:"N\xE3o recebeu o e-mail de verifica\xE7\xE3o? Clique no bot\xE3o abaixo para reenviar."}),jsx(k,{label:i?"E-mail Reenviado":"Reenviar E-mail de Verifica\xE7\xE3o",onSubmit:async()=>{o(true);let a=await n.resendVerifyEmail();a.success?(s(true),e&&await e(a.message)):r&&await r(a.message,a.trace),o(false);},loading:t}),i&&jsx("p",{className:"text-trieoh-sm font-semibold text-trieoh-secondary",children:"Um novo link de verifica\xE7\xE3o foi enviado para seu e-mail."})]})}export{Hr as AuthProvider,E as BasicInputField,Ct as BasicLogoutButton,_t as Copyright,Xe as ForgotPassword,Kt as ResendVerifyEmail,Ht as ResetPassword,Bt as Sessions,xt as SignIn,yt as SignUp,jt as VerifyEmail,y as useAuth};//# sourceMappingURL=react.js.map
1
+ import {createContext,forwardRef,useState,useId,useRef,useSyncExternalStore,useEffect,useCallback,useMemo,useContext}from'react';import {logger,createDefaultFetchClient,simpleFetch}from'@trieoh/envoy-fetch-ts';import {jsxs,jsx,Fragment}from'react/jsx-runtime';import {EyeOff,Eye,LogOut,Check,Info,Loader2,ArrowRight,CheckCircle2,XCircle,Sparkles,User,FolderOpen,Key,Mail,Monitor,Tablet,Smartphone,Trash2,Copy}from'lucide-react';import {UAParser}from'ua-parser-js';import {toast}from'sonner';import {useForm}from'react-hook-form';import {zodResolver}from'@hookform/resolvers/zod';import {z}from'zod';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {motion,AnimatePresence}from'motion/react';import {cva}from'class-variance-authority';function $e(e,r){if(r.startsWith("http"))return r;let t=e.replace(/\/$/,""),o=r.replace(/^\//,"");return `${t}/${o}`}var ne={isAuthenticated:false,isInitializing:true},je=new Set,St=()=>je.forEach(e=>e()),T={subscribe:e=>(je.add(e),()=>je.delete(e)),getSnapshot:()=>ne,getServerSnapshot:()=>ne,set:e=>{ne={...ne,...e},St();},reset:()=>{ne={isAuthenticated:false,isInitializing:false},St();}};typeof window<"u"&&window.addEventListener("storage",e=>{if(e.key==="trieoh_access_expiry")if(!e.newValue)T.reset();else {let r=Number(e.newValue),t=!isNaN(r)&&r>Date.now();T.set({isAuthenticated:t,isInitializing:false});}});var U={getItem:e=>typeof window<"u"?localStorage.getItem(e):null,setItem:(e,r)=>{typeof window<"u"&&localStorage.setItem(e,r);},removeItem:e=>{typeof window<"u"&&localStorage.removeItem(e);}},le={getItem:e=>typeof window<"u"?sessionStorage.getItem(e):null,setItem:(e,r)=>{typeof window<"u"&&sessionStorage.setItem(e,r);},removeItem:e=>{typeof window<"u"&&sessionStorage.removeItem(e);}};var Ae="trieoh_access_token",X={getAccessToken:()=>le.getItem(Ae),setAccessToken:e=>{e?le.setItem(Ae,e):le.removeItem(Ae);},clear:()=>{le.removeItem(Ae);}};var ce=null,Je="trieoh_access_expiry",Re="trieoh_refresh_expiry",Ke="trieoh_refresh_token";function Et(e){try{let r=e.split(".")[1];if(!r)return null;let t=r.replace(/-/g,"+").replace(/_/g,"/");for(;t.length%4;)t+="=";let o=decodeURIComponent(atob(t).split("").map(a=>"%"+("00"+a.charCodeAt(0).toString(16)).slice(-2)).join(""));return JSON.parse(o)}catch(r){return logger.error("Error decoding JWT:",r),null}}function G(e){let{access_token:r,refresh_token:t,access_expires_at:o,refresh_expires_at:a}=e,i=Et(r);if(!i){logger.error("Failed to decode tokens");return}X.setAccessToken(r);let s=new Date(a).getTime(),n=new Date(o).getTime();U.setItem(Ke,t),U.setItem(Je,String(n)),U.setItem(Re,String(s)),ce={access_data:i,refresh_expiry_date:s},T.set({isAuthenticated:true,isInitializing:false}),logger.log("Auth session saved");}function Ye(){return U.getItem(Ke)}function pe(){if(ce)return ce;let e=X.getAccessToken();if(!e)return null;let r=Et(e);if(!r||r.exp*1e3<=Date.now())return null;let t=U.getItem(Re);if(!t)return null;let o=Number(t);if(isNaN(o))return null;let a={access_data:r,refresh_expiry_date:o};return ce=a,a}function At(e,r){try{let t=U.getItem(e);if(!t)return !0;let o=Number(t);return isNaN(o)?!0:o-Date.now()<=r*1e3}catch(t){return logger.warn("Error reading expiry:",t),true}}var Xe=(e=30)=>At(Je,e),Pe=(e=10)=>At(Re,e);function me(){ce=null,X.clear(),U.removeItem(Je),U.removeItem(Re),U.removeItem(Ke),T.reset(),logger.log("Auth tokens and claims cleared");}function Rt(){let e=pe();return e?e.access_data.sub:null}function er(){let e=typeof window>"u",r=typeof import.meta<"u"&&import.meta.env?import.meta.env:{},t=typeof process<"u"?process.env:{},o=r.VITE_TRIEOH_AUTH_PROJECT_ID||t.NEXT_PUBLIC_TRIEOH_AUTH_PROJECT_ID||t.PUBLIC_TRIEOH_AUTH_PROJECT_ID||"",a=e&&t.TRIEOH_AUTH_API_KEY||"";return {PROJECT_ID:o,API_KEY:a,BASE_URL:"https://api.trieauth.trieoh.com"}}var Te=null,We={};function Pt(e){We={...We,...e},Te=null;}function Ge(){return Te||(Te={...er(),...We}),Te}var E={get PROJECT_ID(){return Ge().PROJECT_ID},get BASE_URL(){return Ge().BASE_URL}};var Ce=class{constructor(r){this.isRefreshing=false;this.refreshPromise=null;this.baseURL=r?.baseURL||E.BASE_URL,this.authBaseURL=r?.authBaseURL||this.baseURL,this.onTokenRefreshed=r?.onTokenRefreshed,this.onRefreshFailed=r?.onRefreshFailed;}async refreshToken(){return this.isRefreshing&&this.refreshPromise?this.refreshPromise:(this.isRefreshing=true,this.refreshPromise=(async()=>{let r=true;try{let t=Ye();if(!t)throw r=!0,new Error("No refresh token available");let o=await simpleFetch($e(this.authBaseURL,"/auth/refresh"),{method:"POST",credentials:"omit",headers:{refresh_token:t}});if(o.code!==200||!o.data)throw r=o.code!==503,new Error(o.message||"Failed to refresh token");G(o.data);let a=pe();a&&this.onTokenRefreshed?.(a),logger.log("Token refreshed successfully");}catch(t){throw logger.warn("Failed to refresh token:",t),r&&me(),this.onRefreshFailed?.(t),t}finally{this.isRefreshing=false,this.refreshPromise=null;}})(),this.refreshPromise)}async beforeRequest(){if(Pe()){me();return}if(!!!X.getAccessToken()||Xe(30))try{await this.refreshToken();}catch(t){logger.warn("Proactive refresh failed:",t);}}async fetch(r,t){let o=t?.requiresAuth!==false,a=r.includes("/auth/refresh");o&&!a&&!t?.skipRefresh&&await this.beforeRequest();let i=$e(this.baseURL,r),s=async()=>{let l=X.getAccessToken(),d=new Headers(t?.headers);return o&&l&&d.set("Authorization",`Bearer ${l}`),d.has("Content-Type")||d.set("Content-Type","application/json"),fetch(i,{...t,headers:d,credentials:"omit"})},n=await s();if(n.status===401&&o&&!a){let l=!!Ye(),d=Xe(30);if(l&&d){logger.log("401 detected and token is expiring/expired, attempting refresh...");try{await this.refreshToken(),n=await s();}catch{logger.error("Retry failed after refresh error");}}}return n}};function W(e){if(!e)return;let{requiresAuth:r,skipRefresh:t,...o}=e,a={};return r!==void 0&&(a.requiresAuth=r),t!==void 0&&(a.skipRefresh=t),{...o,adapterInit:{...o.adapterInit,...a}}}var Ne=class{constructor(r,t,o,a){this.interceptor=new Ce({baseURL:r,authBaseURL:t,onTokenRefreshed:o}),this.client=createDefaultFetchClient({...a,adapter:this.interceptor.fetch.bind(this.interceptor)});}request(r,t){return this.client.request(r,W(t))}get(r,t){return this.client.get(r,W(t))}post(r,t,o){return this.client.post(r,t,W(o))}put(r,t,o){return this.client.put(r,t,W(o))}patch(r,t,o){return this.client.patch(r,t,W(o))}delete(r,t,o){return this.client.delete(r,t,W(o))}query(r,t){return this.client.query(r,W(t))}};var Q=()=>{if(!E.PROJECT_ID||E.PROJECT_ID.trim()==="")throw new Error("[TRIEOH SDK] Project ID is missing. Please set PUBLIC_TRIEOH_AUTH_PROJECT_ID, NEXT_PUBLIC_TRIEOH_AUTH_PROJECT_ID or VITE_TRIEOH_AUTH_PROJECT_ID.")};var Tt=(e,r)=>({isSetupDone:async()=>e.get("/auth/setup",{requiresAuth:false}),setup:async(t,o)=>{E.PROJECT_ID&&Q();let a=`/auth/setup${E.PROJECT_ID?`?project_id=${E.PROJECT_ID}`:""}`,i=await e.post(a,{email:t,password:o},{requiresAuth:false});return i.success&&(G(i.data),r?.onSetup?.(i)),i},login:async(t,o)=>{E.PROJECT_ID&&Q();let a=`/auth/login${E.PROJECT_ID?`?project_id=${E.PROJECT_ID}`:""}`,i=await e.post(a,{email:t,password:o},{requiresAuth:false});return i.success&&(G(i.data),r?.onLogin?.(i)),i},loginWithProvider:async t=>{let o=`/auth/${t}/connect`;return await e.get(o,{requiresAuth:false})},completeProviderLogin:async(t,o)=>{let a=`/auth/${t}/callback?code=${o}`,i=await e.get(a,{requiresAuth:false});return i.success&&(G(i.data),r?.onLogin?.(i)),i},register:async(t,o)=>{let a={requiresAuth:false},i=`/auth/register${E.PROJECT_ID?`?project_id=${E.PROJECT_ID}`:""}`;E.PROJECT_ID&&Q();let s=await e.post(i,{email:t,password:o},a);return s.success&&r?.onRegister?.(s),s},logout:async t=>{let o=`/auth/logout${E.PROJECT_ID?`?project_id=${E.PROJECT_ID}`:""}`,a=await e.post(o);return (a.success||t?.forceLogout)&&me(),a},refresh:async()=>{let t=await e.post("/auth/refresh",void 0,{skipRefresh:true});return t.success&&(G(t.data),r?.onRefresh?.(t)),t},sessions:async()=>e.get("/sessions"),currentSession:async()=>e.get("/sessions/me"),revokeASession:async t=>e.delete(`/sessions/${t}`),revokeSessions:async(t=false)=>{let o=t?"/sessions":"/sessions/others";return e.delete(o)},profile:()=>Rt(),sendForgotPassword:async t=>{let o={requiresAuth:false};return E.PROJECT_ID?(Q(),e.post("/account/forgot-password",{email:t,project_id:E.PROJECT_ID},o)):e.post("/account/forgot-password",{email:t},o)},resetPassword:async(t,o)=>{let a=await e.post(`/account/reset-password?token=${t}`,{new_password:o},{requiresAuth:false});return a.success&&r?.onResetPassword?.(a),a},verifyEmail:async t=>{let o=`/account/verify?token=${t}`,a=await e.post(o);return a.success&&r?.onVerify?.(a),a},resendVerifyEmail:async()=>e.post("/account/verify/resend"),introspect:async()=>e.get("/auth/introspect"),health:async()=>e.get("/health",{requiresAuth:false}),authHealth:async()=>e.get("/protected/health")});var Nt=createContext(null);function ii({children:e,baseURL:r,projectId:t,isProjectMode:o=true,fallback:a,waitSession:i=true,clientConfig:s,onLogin:n,onSetup:l,onResetPassword:d,onRegister:p,onVerify:c,onRefresh:h}){let g=useRef(false),{isAuthenticated:f,isInitializing:v}=useSyncExternalStore(T.subscribe,T.getSnapshot,T.getServerSnapshot);useEffect(()=>{Pt({...t?{PROJECT_ID:t}:{},...r?{BASE_URL:r}:{}});},[t,r]);let b=useCallback(y=>{T.set({isAuthenticated:!!y.access_data,isInitializing:false}),h?.();},[h]),S=useMemo(()=>new Ne(r,void 0,b,s),[r,b,s]),N=useMemo(()=>Tt(S,{onLogin:n,onSetup:l,onResetPassword:d,onRegister:p,onVerify:c,onRefresh:h}),[S,n,l,d,p,c,h]);useEffect(()=>{o&&Q(),(async()=>{if(!g.current){if(g.current=true,pe()){T.set({isAuthenticated:true,isInitializing:false});return}if(Pe()){T.reset(),T.set({isInitializing:false});return}logger.log("No cached claims, attempting silent refresh...");try{await S.interceptor.refreshToken(),logger.log("Session restored.");}catch{T.reset(),logger.warn("Could not restore session (offline?).");}finally{T.set({isInitializing:false});}}})();},[N,o]);let Y=useMemo(()=>({auth:N,isAuthenticated:f,isInitializing:v,isProjectMode:o}),[N,f,v,o]);return i&&v?a??null:jsx(Nt.Provider,{value:Y,children:e})}function w(){let e=useContext(Nt);if(!e)throw new Error("useAuth must be used inside <AuthProvider>");return e}function et(e,{insertAt:r}={}){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css",r==="top"&&t.firstChild?t.insertBefore(o,t.firstChild):t.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e));}et(`/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */@layer properties;@layer theme,base,components,utilities;@layer theme,base,components,utilities;@layer theme{:root,:host{--font-sans: var(--font-sans, "Inter", sans-serif);--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-green-500: oklch(72.3% .219 149.579);--color-green-600: oklch(62.7% .194 149.214);--spacing: .25rem;--container-md: 28rem;--text-xs: .75rem;--text-xs--line-height: calc(1 / .75);--text-sm: .875rem;--text-sm--line-height: calc(1.25 / .875);--text-base: 1rem;--text-base--line-height: 1.5 ;--text-lg: 1.125rem;--text-lg--line-height: calc(1.75 / 1.125);--text-xl: 1.25rem;--text-xl--line-height: calc(1.75 / 1.25);--text-2xl: 1.5rem;--text-2xl--line-height: calc(2 / 1.5);--text-3xl: 1.875rem;--text-3xl--line-height: 1.2 ;--text-4xl: 2.25rem;--text-4xl--line-height: calc(2.5 / 2.25);--font-weight-extralight: 200;--font-weight-light: 300;--font-weight-normal: 400;--font-weight-medium: 500;--font-weight-semibold: 600;--font-weight-bold: 700;--tracking-tighter: -.05em;--tracking-tight: -.025em;--tracking-normal: 0em;--tracking-wide: .025em;--tracking-wider: .05em;--tracking-widest: .1em;--radius-sm: calc(var(--radius, .625rem) - 4px);--radius-md: calc(var(--radius, .625rem) - 2px);--radius-lg: var(--radius, .625rem);--radius-2xl: 1rem;--ease-out: cubic-bezier(0, 0, .2, 1);--ease-in-out: cubic-bezier(.4, 0, .2, 1);--animate-spin: spin 1s linear infinite;--blur-sm: 8px;--blur-3xl: 64px;--default-transition-duration: .15s;--default-transition-timing-function: cubic-bezier(.4, 0, .2, 1);--default-font-family: var(--font-sans);--default-mono-font-family: var(--font-mono);--color-background: var(--background, oklch(.9702 0 0));--color-foreground: var(--foreground, oklch(.1944 .0051 248.09));--color-primary: var(--primary, oklch(.7975 .1018 262.7));--color-primary-foreground: var(--primary-foreground, oklch(.9702 0 0));--color-secondary: var(--secondary, oklch(.1139 .0789 264.05));--color-secondary-foreground: var(--secondary-foreground, oklch(.9702 0 0));--color-muted: var(--muted, oklch(.9569 .0026 248.09));--color-muted-foreground: var(--muted-foreground, oklch(.5278 0 0));--color-border: var(--border, oklch(.869 .0093 248.09));--color-input: var(--input, oklch(.9145 .0062 248.09));--color-destructive: var(--destructive, oklch(.6373 .1718 28.92));--color-destructive-foreground: var(--destructive-foreground, oklch(.9851 0 0));--color-ring: var(--ring, oklch(.7975 .1018 262.7));--color-accent: var(--accent, oklch(.9326 .0313 262.7));--color-accent-foreground: var(--accent-foreground, oklch(.1944 .0051 248.09));--radius-full: 9999px}}@layer base{*,:after,:before,::backdrop,::file-selector-button{box-sizing:border-box;margin:0;padding:0;border:0 solid}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;tab-size:4;font-family:var(--default-font-family, ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings, normal);font-variation-settings:var(--default-font-variation-settings, normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings, normal);font-variation-settings:var(--default-mono-font-variation-settings, normal);font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea,::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;border-radius:0;background-color:transparent;opacity:1}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not (-webkit-appearance: -apple-pay-button)) or (contain-intrinsic-size: 1px){::placeholder{color:currentcolor;@supports (color: color-mix(in lab,red,red)){color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit,::-webkit-datetime-edit-year-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-second-field,::-webkit-datetime-edit-millisecond-field,::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]),::file-selector-button{appearance:button}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer utilities{.\\@container{container-type:inline-size}.pointer-events-none{pointer-events:none}.button-loading{&:after{content:"";position:absolute;top:0;left:-150%;width:150%;height:100%;background:linear-gradient(120deg,transparent 0%,var(--color-foreground) 40%,transparent 80%);@supports (color: color-mix(in lab,red,red)){background:linear-gradient(120deg,transparent 0%,color-mix(in oklab,var(--color-foreground) 40%,white 15%) 40%,transparent 80%)}animation:shine 1.5s infinite}}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.inset-0{inset:calc(var(--spacing) * 0)}.top-0{top:calc(var(--spacing) * 0)}.top-1\\.5{top:calc(var(--spacing) * 1.5)}.top-1\\/2{top:50%}.top-\\[-10\\%\\]{top:-10%}.right-0{right:calc(var(--spacing) * 0)}.right-3{right:calc(var(--spacing) * 3)}.right-\\[-10\\%\\]{right:-10%}.bottom-\\[-10\\%\\]{bottom:-10%}.left-3\\.5{left:calc(var(--spacing) * 3.5)}.left-\\[-10\\%\\]{left:-10%}.z-10{z-index:10}.m-0{margin:calc(var(--spacing) * 0)}.m-2{margin:calc(var(--spacing) * 2)}.m-\\[0\\.125rem\\]{margin:.125rem}.mx-1\\.5{margin-inline:calc(var(--spacing) * 1.5)}.mx-auto{margin-inline:auto}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-8{margin-top:calc(var(--spacing) * 8)}.mb-0\\.5{margin-bottom:calc(var(--spacing) * .5)}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-2\\.5{margin-bottom:calc(var(--spacing) * 2.5)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-6{margin-bottom:calc(var(--spacing) * 6)}.mb-10{margin-bottom:calc(var(--spacing) * 10)}.box-border{box-sizing:border-box}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.h-1{height:calc(var(--spacing) * 1)}.h-3\\.5{height:calc(var(--spacing) * 3.5)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.h-11{height:calc(var(--spacing) * 11)}.h-12{height:calc(var(--spacing) * 12)}.h-13{height:calc(var(--spacing) * 13)}.h-16{height:calc(var(--spacing) * 16)}.h-\\[40\\%\\]{height:40%}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.max-h-\\[max\\(75dvh\\,32rem\\)\\]{max-height:max(75dvh,32rem)}.min-h-80{min-height:calc(var(--spacing) * 80)}.min-h-112{min-height:calc(var(--spacing) * 112)}.min-h-screen{min-height:100vh}.w-3\\.5{width:calc(var(--spacing) * 3.5)}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-10{width:calc(var(--spacing) * 10)}.w-12{width:calc(var(--spacing) * 12)}.w-16{width:calc(var(--spacing) * 16)}.w-\\[40\\%\\]{width:40%}.w-full{width:100%}.max-w-56{max-width:calc(var(--spacing) * 56)}.max-w-100{max-width:calc(var(--spacing) * 100)}.max-w-120{max-width:calc(var(--spacing) * 120)}.max-w-\\[320px\\]{max-width:320px}.max-w-md{max-width:var(--container-md)}.min-w-0{min-width:calc(var(--spacing) * 0)}.min-w-40{min-width:calc(var(--spacing) * 40)}.min-w-60{min-width:calc(var(--spacing) * 60)}.min-w-\\[20rem\\]{min-width:20rem}.flex-1{flex:1}.flex-\\[0_1_auto\\]{flex:0 1 auto}.flex-\\[1_1_auto\\]{flex:1 1 auto}.shrink-0{flex-shrink:0}.-translate-y-1\\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.animate-spin{animation:var(--animate-spin)}.cursor-pointer{cursor:pointer}.appearance-none{appearance:none}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-5{gap:calc(var(--spacing) * 5)}.gap-6{gap:calc(var(--spacing) * 6)}.gap-8{gap:calc(var(--spacing) * 8)}.space-y-1{:where(&>:not(:last-child)){--tw-space-y-reverse: 0;margin-block-start:calc(calc(var(--spacing) * 1) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1) * calc(1 - var(--tw-space-y-reverse)))}}.space-y-4{:where(&>:not(:last-child)){--tw-space-y-reverse: 0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}}.space-y-5{:where(&>:not(:last-child)){--tw-space-y-reverse: 0;margin-block-start:calc(calc(var(--spacing) * 5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 5) * calc(1 - var(--tw-space-y-reverse)))}}.divide-x{:where(&>:not(:last-child)){--tw-divide-x-reverse: 0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(1px * var(--tw-divide-x-reverse));border-inline-end-width:calc(1px * calc(1 - var(--tw-divide-x-reverse)))}}.divide-border\\/60{:where(&>:not(:last-child)){border-color:var(--color-border);@supports (color: color-mix(in lab,red,red)){border-color:color-mix(in oklab,var(--color-border) 60%,transparent)}}}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-\\[14px\\]{border-radius:14px}.rounded-full{border-radius:var(--radius-full)}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-none{--tw-border-style: none;border-style:none}.border-border{border-color:var(--color-border)}.border-border\\/40{border-color:var(--color-border);@supports (color: color-mix(in lab,red,red)){border-color:color-mix(in oklab,var(--color-border) 40%,transparent)}}.border-border\\/50{border-color:var(--color-border);@supports (color: color-mix(in lab,red,red)){border-color:color-mix(in oklab,var(--color-border) 50%,transparent)}}.border-border\\/60{border-color:var(--color-border);@supports (color: color-mix(in lab,red,red)){border-color:color-mix(in oklab,var(--color-border) 60%,transparent)}}.border-destructive\\!{border-color:var(--color-destructive)!important}.border-destructive\\/50{border-color:var(--color-destructive);@supports (color: color-mix(in lab,red,red)){border-color:color-mix(in oklab,var(--color-destructive) 50%,transparent)}}.border-foreground{border-color:var(--color-foreground)}.border-input{border-color:var(--color-input)}.border-primary{border-color:var(--color-primary)}.border-secondary\\/20{border-color:var(--color-secondary);@supports (color: color-mix(in lab,red,red)){border-color:color-mix(in oklab,var(--color-secondary) 20%,transparent)}}.bg-background{background-color:var(--color-background)}.bg-border{background-color:var(--color-border)}.bg-destructive{background-color:var(--color-destructive)}.bg-destructive\\/5{background-color:var(--color-destructive);@supports (color: color-mix(in lab,red,red)){background-color:color-mix(in oklab,var(--color-destructive) 5%,transparent)}}.bg-foreground\\/10{background-color:var(--color-foreground);@supports (color: color-mix(in lab,red,red)){background-color:color-mix(in oklab,var(--color-foreground) 10%,transparent)}}.bg-muted{background-color:var(--color-muted)}.bg-muted\\/30{background-color:var(--color-muted);@supports (color: color-mix(in lab,red,red)){background-color:color-mix(in oklab,var(--color-muted) 30%,transparent)}}.bg-muted\\/40{background-color:var(--color-muted);@supports (color: color-mix(in lab,red,red)){background-color:color-mix(in oklab,var(--color-muted) 40%,transparent)}}.bg-muted\\/50{background-color:var(--color-muted);@supports (color: color-mix(in lab,red,red)){background-color:color-mix(in oklab,var(--color-muted) 50%,transparent)}}.bg-primary{background-color:var(--color-primary)}.bg-primary\\/10{background-color:var(--color-primary);@supports (color: color-mix(in lab,red,red)){background-color:color-mix(in oklab,var(--color-primary) 10%,transparent)}}.bg-primary\\/20{background-color:var(--color-primary);@supports (color: color-mix(in lab,red,red)){background-color:color-mix(in oklab,var(--color-primary) 20%,transparent)}}.bg-primary\\/40{background-color:var(--color-primary);@supports (color: color-mix(in lab,red,red)){background-color:color-mix(in oklab,var(--color-primary) 40%,transparent)}}.bg-secondary{background-color:var(--color-secondary)}.bg-transparent{background-color:transparent}.p-1{padding:calc(var(--spacing) * 1)}.p-1\\.5{padding:calc(var(--spacing) * 1.5)}.p-2{padding:calc(var(--spacing) * 2)}.p-2\\.5{padding:calc(var(--spacing) * 2.5)}.p-6{padding:calc(var(--spacing) * 6)}.p-\\[1\\.5rem_0\\.5rem\\]{padding:1.5rem .5rem}.p-\\[1\\.25rem_0\\.75rem\\]{padding:1.25rem .75rem}.p-\\[1\\.25rem_1\\.5rem\\]{padding:1.25rem 1.5rem}.p-\\[1rem_0\\]{padding:1rem 0}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-3\\.5{padding-inline:calc(var(--spacing) * 3.5)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.px-6{padding-inline:calc(var(--spacing) * 6)}.px-8{padding-inline:calc(var(--spacing) * 8)}.py-0\\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-1\\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-px{padding-block:1px}.pt-2\\.5{padding-top:calc(var(--spacing) * 2.5)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pr-10{padding-right:calc(var(--spacing) * 10)}.pb-1{padding-bottom:calc(var(--spacing) * 1)}.pb-3\\.5{padding-bottom:calc(var(--spacing) * 3.5)}.text-center{text-align:center}.font-mono{font-family:var(--font-mono)}.font-sans{font-family:var(--font-sans)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading, var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading, var(--text-3xl--line-height))}.text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading, var(--text-4xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading, var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading, var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading, var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading, var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading, var(--text-xs--line-height))}.text-\\[10px\\]{font-size:10px}.text-\\[11px\\]{font-size:11px}.text-\\[12px\\]{font-size:12px}.leading-none{--tw-leading: 1;line-height:1}.font-bold{--tw-font-weight: var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-extralight{--tw-font-weight: var(--font-weight-extralight);font-weight:var(--font-weight-extralight)}.font-light{--tw-font-weight: var(--font-weight-light);font-weight:var(--font-weight-light)}.font-medium{--tw-font-weight: var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight: var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight: var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking: var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-tighter{--tw-tracking: var(--tracking-tighter);letter-spacing:var(--tracking-tighter)}.tracking-wide{--tw-tracking: var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking: var(--tracking-wider);letter-spacing:var(--tracking-wider)}.tracking-widest{--tw-tracking: var(--tracking-widest);letter-spacing:var(--tracking-widest)}.whitespace-nowrap{white-space:nowrap}.text-destructive{color:var(--color-destructive)}.text-destructive-foreground{color:var(--color-destructive-foreground)}.text-destructive\\/80{color:var(--color-destructive);@supports (color: color-mix(in lab,red,red)){color:color-mix(in oklab,var(--color-destructive) 80%,transparent)}}.text-foreground{color:var(--color-foreground)}.text-green-500{color:var(--color-green-500)}.text-green-600{color:var(--color-green-600)}.text-muted-foreground{color:var(--color-muted-foreground)}.text-primary{color:var(--color-primary)}.text-primary-foreground{color:var(--color-primary-foreground)}.text-primary\\/70{color:var(--color-primary);@supports (color: color-mix(in lab,red,red)){color:color-mix(in oklab,var(--color-primary) 70%,transparent)}}.text-secondary-foreground{color:var(--color-secondary-foreground)}.uppercase{text-transform:uppercase}.line-through{text-decoration-line:line-through}.underline-offset-4{text-underline-offset:4px}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.opacity-0{opacity:0%}.opacity-50{opacity:50%}.opacity-60{opacity:60%}.opacity-95{opacity:95%}.opacity-100{opacity:100%}.shadow-\\[0_0\\.25rem_0\\.25rem_0_rgba\\(0\\,0\\,0\\,0\\.25\\)\\]{--tw-shadow: 0 .25rem .25rem 0 var(--tw-shadow-color, rgba(0,0,0,.25));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\\[0_0\\.25rem_1rem_rgba\\(0\\,0\\,0\\,0\\.25\\)\\]{--tw-shadow: 0 .25rem 1rem var(--tw-shadow-color, rgba(0,0,0,.25));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px var(--tw-shadow-color, rgb(0 0 0 / .1)), 0 4px 6px -4px var(--tw-shadow-color, rgb(0 0 0 / .1));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-none\\!{--tw-shadow: 0 0 #0000 !important;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)!important}.shadow-sm{--tw-shadow: 0 1px 3px 0 var(--tw-shadow-color, rgb(0 0 0 / .1)), 0 1px 2px -1px var(--tw-shadow-color, rgb(0 0 0 / .1));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-1{--tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-primary\\/10{--tw-shadow-color: var(--color-primary);@supports (color: color-mix(in lab,red,red)){--tw-shadow-color: color-mix(in oklab, color-mix(in oklab, var(--color-primary) 10%, transparent) var(--tw-shadow-alpha), transparent)}}.ring-destructive\\/20{--tw-ring-color: var(--color-destructive);@supports (color: color-mix(in lab,red,red)){--tw-ring-color: color-mix(in oklab, var(--color-destructive) 20%, transparent)}}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur-3xl{--tw-blur: blur(var(--blur-3xl));filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.backdrop-blur-sm{--tw-backdrop-blur: blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease, var(--default-transition-timing-function));transition-duration:var(--tw-duration, var(--default-transition-duration))}.transition-\\[color\\,text-decoration\\,opacity\\]{transition-property:color,text-decoration,opacity;transition-timing-function:var(--tw-ease, var(--default-transition-timing-function));transition-duration:var(--tw-duration, var(--default-transition-duration))}.transition-\\[opacity\\,transform\\]{transition-property:opacity,transform;transition-timing-function:var(--tw-ease, var(--default-transition-timing-function));transition-duration:var(--tw-duration, var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease, var(--default-transition-timing-function));transition-duration:var(--tw-duration, var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease, var(--default-transition-timing-function));transition-duration:var(--tw-duration, var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease, var(--default-transition-timing-function));transition-duration:var(--tw-duration, var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease, var(--default-transition-timing-function));transition-duration:var(--tw-duration, var(--default-transition-duration))}.duration-150{--tw-duration: .15s;transition-duration:.15s}.duration-200{--tw-duration: .2s;transition-duration:.2s}.duration-500{--tw-duration: .5s;transition-duration:.5s}.duration-\\[120ms\\]{--tw-duration: .12s;transition-duration:.12s}.ease-in-out{--tw-ease: var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.ease-out{--tw-ease: var(--ease-out);transition-timing-function:var(--ease-out)}.outline-none{--tw-outline-style: none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.group-hover\\:translate-x-1{&:is(:where(.group):hover *){@media(hover:hover){--tw-translate-x: calc(var(--spacing) * 1);translate:var(--tw-translate-x) var(--tw-translate-y)}}}.group-hover\\:opacity-100{&:is(:where(.group):hover *){@media(hover:hover){opacity:100%}}}.peer-placeholder-shown\\:top-3\\.5{&:is(:where(.peer):placeholder-shown~*){top:calc(var(--spacing) * 3.5)}}.peer-placeholder-shown\\:text-\\[15px\\]{&:is(:where(.peer):placeholder-shown~*){font-size:15px}}.peer-placeholder-shown\\:font-normal{&:is(:where(.peer):placeholder-shown~*){--tw-font-weight: var(--font-weight-normal);font-weight:var(--font-weight-normal)}}.peer-placeholder-shown\\:tracking-normal{&:is(:where(.peer):placeholder-shown~*){--tw-tracking: var(--tracking-normal);letter-spacing:var(--tracking-normal)}}.peer-placeholder-shown\\:text-destructive\\/60{&:is(:where(.peer):placeholder-shown~*){color:var(--color-destructive);@supports (color: color-mix(in lab,red,red)){color:color-mix(in oklab,var(--color-destructive) 60%,transparent)}}}.peer-placeholder-shown\\:text-muted-foreground{&:is(:where(.peer):placeholder-shown~*){color:var(--color-muted-foreground)}}.peer-focus\\:top-1\\.5{&:is(:where(.peer):focus~*){top:calc(var(--spacing) * 1.5)}}.peer-focus\\:text-\\[10px\\]{&:is(:where(.peer):focus~*){font-size:10px}}.peer-focus\\:font-semibold{&:is(:where(.peer):focus~*){--tw-font-weight: var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}}.peer-focus\\:tracking-wider{&:is(:where(.peer):focus~*){--tw-tracking: var(--tracking-wider);letter-spacing:var(--tracking-wider)}}.peer-focus\\:text-destructive\\/80{&:is(:where(.peer):focus~*){color:var(--color-destructive);@supports (color: color-mix(in lab,red,red)){color:color-mix(in oklab,var(--color-destructive) 80%,transparent)}}}.peer-focus\\:text-primary\\/70{&:is(:where(.peer):focus~*){color:var(--color-primary);@supports (color: color-mix(in lab,red,red)){color:color-mix(in oklab,var(--color-primary) 70%,transparent)}}}.selection\\:bg-primary\\/10{& *::selection{background-color:var(--color-primary);@supports (color: color-mix(in lab,red,red)){background-color:color-mix(in oklab,var(--color-primary) 10%,transparent)}}&::selection{background-color:var(--color-primary);@supports (color: color-mix(in lab,red,red)){background-color:color-mix(in oklab,var(--color-primary) 10%,transparent)}}}.selection\\:text-primary{& *::selection{color:var(--color-primary)}&::selection{color:var(--color-primary)}}.placeholder\\:text-transparent{&::placeholder{color:transparent}}.hover\\:scale-\\[1\\.02\\]{&:hover{@media(hover:hover){scale:1.02}}}.hover\\:scale-\\[1\\.05\\]{&:hover{@media(hover:hover){scale:1.05}}}.hover\\:bg-accent{&:hover{@media(hover:hover){background-color:var(--color-accent)}}}.hover\\:bg-muted{&:hover{@media(hover:hover){background-color:var(--color-muted)}}}.hover\\:bg-muted\\/50{&:hover{@media(hover:hover){background-color:var(--color-muted);@supports (color: color-mix(in lab,red,red)){background-color:color-mix(in oklab,var(--color-muted) 50%,transparent)}}}}.hover\\:bg-muted\\/60{&:hover{@media(hover:hover){background-color:var(--color-muted);@supports (color: color-mix(in lab,red,red)){background-color:color-mix(in oklab,var(--color-muted) 60%,transparent)}}}}.hover\\:text-accent-foreground{&:hover{@media(hover:hover){color:var(--color-accent-foreground)}}}.hover\\:text-foreground{&:hover{@media(hover:hover){color:var(--color-foreground)}}}.hover\\:text-primary\\/70{&:hover{@media(hover:hover){color:var(--color-primary);@supports (color: color-mix(in lab,red,red)){color:color-mix(in oklab,var(--color-primary) 70%,transparent)}}}}.hover\\:underline{&:hover{@media(hover:hover){text-decoration-line:underline}}}.hover\\:opacity-80{&:hover{@media(hover:hover){opacity:80%}}}.hover\\:opacity-90{&:hover{@media(hover:hover){opacity:90%}}}.hover\\:opacity-100{&:hover{@media(hover:hover){opacity:100%}}}.focus\\:bg-muted\\/60{&:focus{background-color:var(--color-muted);@supports (color: color-mix(in lab,red,red)){background-color:color-mix(in oklab,var(--color-muted) 60%,transparent)}}}.focus\\:outline-none{&:focus{--tw-outline-style: none;outline-style:none}}.focus-visible\\:ring-0{&:focus-visible{--tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}.focus-visible\\:ring-1{&:focus-visible{--tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}.focus-visible\\:ring-ring{&:focus-visible{--tw-ring-color: var(--color-ring)}}.focus-visible\\:outline-none{&:focus-visible{--tw-outline-style: none;outline-style:none}}.active\\:scale-\\[0\\.95\\]{&:active{scale:.95}}.active\\:scale-\\[0\\.98\\]{&:active{scale:.98}}.active\\:scale-\\[0\\.99\\]{&:active{scale:.99}}.disabled\\:pointer-events-none{&:disabled{pointer-events:none}}.disabled\\:transform-none\\!{&:disabled{transform:none!important}}.disabled\\:cursor-not-allowed{&:disabled{cursor:not-allowed}}.disabled\\:opacity-50{&:disabled{opacity:50%}}.disabled\\:opacity-60{&:disabled{opacity:60%}}.\\@\\[640px\\]\\:flex-row{@container (width >= 640px){flex-direction:row}}.\\@\\[640px\\]\\:items-center{@container (width >= 640px){align-items:center}}.\\@\\[640px\\]\\:justify-between{@container (width >= 640px){justify-content:space-between}}.\\@\\[640px\\]\\:gap-2{@container (width >= 640px){gap:calc(var(--spacing) * 2)}}.\\@\\[640px\\]\\:gap-4{@container (width >= 640px){gap:calc(var(--spacing) * 4)}}.\\@\\[640px\\]\\:gap-8{@container (width >= 640px){gap:calc(var(--spacing) * 8)}}.\\@\\[640px\\]\\:text-left{@container (width >= 640px){text-align:left}}}@import url(https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap);@layer base{button:not(:disabled),[role=button]:not(:disabled){cursor:pointer}}@property --tw-translate-x{syntax: "*"; inherits: false; initial-value: 0;}@property --tw-translate-y{syntax: "*"; inherits: false; initial-value: 0;}@property --tw-translate-z{syntax: "*"; inherits: false; initial-value: 0;}@property --tw-space-y-reverse{syntax: "*"; inherits: false; initial-value: 0;}@property --tw-divide-x-reverse{syntax: "*"; inherits: false; initial-value: 0;}@property --tw-border-style{syntax: "*"; inherits: false; initial-value: solid;}@property --tw-leading{syntax: "*"; inherits: false;}@property --tw-font-weight{syntax: "*"; inherits: false;}@property --tw-tracking{syntax: "*"; inherits: false;}@property --tw-shadow{syntax: "*"; inherits: false; initial-value: 0 0 #0000;}@property --tw-shadow-color{syntax: "*"; inherits: false;}@property --tw-shadow-alpha{syntax: "<percentage>"; inherits: false; initial-value: 100%;}@property --tw-inset-shadow{syntax: "*"; inherits: false; initial-value: 0 0 #0000;}@property --tw-inset-shadow-color{syntax: "*"; inherits: false;}@property --tw-inset-shadow-alpha{syntax: "<percentage>"; inherits: false; initial-value: 100%;}@property --tw-ring-color{syntax: "*"; inherits: false;}@property --tw-ring-shadow{syntax: "*"; inherits: false; initial-value: 0 0 #0000;}@property --tw-inset-ring-color{syntax: "*"; inherits: false;}@property --tw-inset-ring-shadow{syntax: "*"; inherits: false; initial-value: 0 0 #0000;}@property --tw-ring-inset{syntax: "*"; inherits: false;}@property --tw-ring-offset-width{syntax: "<length>"; inherits: false; initial-value: 0px;}@property --tw-ring-offset-color{syntax: "*"; inherits: false; initial-value: #fff;}@property --tw-ring-offset-shadow{syntax: "*"; inherits: false; initial-value: 0 0 #0000;}@property --tw-outline-style{syntax: "*"; inherits: false; initial-value: solid;}@property --tw-blur{syntax: "*"; inherits: false;}@property --tw-brightness{syntax: "*"; inherits: false;}@property --tw-contrast{syntax: "*"; inherits: false;}@property --tw-grayscale{syntax: "*"; inherits: false;}@property --tw-hue-rotate{syntax: "*"; inherits: false;}@property --tw-invert{syntax: "*"; inherits: false;}@property --tw-opacity{syntax: "*"; inherits: false;}@property --tw-saturate{syntax: "*"; inherits: false;}@property --tw-sepia{syntax: "*"; inherits: false;}@property --tw-drop-shadow{syntax: "*"; inherits: false;}@property --tw-drop-shadow-color{syntax: "*"; inherits: false;}@property --tw-drop-shadow-alpha{syntax: "<percentage>"; inherits: false; initial-value: 100%;}@property --tw-drop-shadow-size{syntax: "*"; inherits: false;}@property --tw-backdrop-blur{syntax: "*"; inherits: false;}@property --tw-backdrop-brightness{syntax: "*"; inherits: false;}@property --tw-backdrop-contrast{syntax: "*"; inherits: false;}@property --tw-backdrop-grayscale{syntax: "*"; inherits: false;}@property --tw-backdrop-hue-rotate{syntax: "*"; inherits: false;}@property --tw-backdrop-invert{syntax: "*"; inherits: false;}@property --tw-backdrop-opacity{syntax: "*"; inherits: false;}@property --tw-backdrop-saturate{syntax: "*"; inherits: false;}@property --tw-backdrop-sepia{syntax: "*"; inherits: false;}@property --tw-duration{syntax: "*"; inherits: false;}@property --tw-ease{syntax: "*"; inherits: false;}@keyframes spin{to{transform:rotate(360deg)}}@keyframes shine{0%{left:-150%}to{left:150%}}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x: 0;--tw-translate-y: 0;--tw-translate-z: 0;--tw-space-y-reverse: 0;--tw-divide-x-reverse: 0;--tw-border-style: solid;--tw-leading: initial;--tw-font-weight: initial;--tw-tracking: initial;--tw-shadow: 0 0 #0000;--tw-shadow-color: initial;--tw-shadow-alpha: 100%;--tw-inset-shadow: 0 0 #0000;--tw-inset-shadow-color: initial;--tw-inset-shadow-alpha: 100%;--tw-ring-color: initial;--tw-ring-shadow: 0 0 #0000;--tw-inset-ring-color: initial;--tw-inset-ring-shadow: 0 0 #0000;--tw-ring-inset: initial;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-offset-shadow: 0 0 #0000;--tw-outline-style: solid;--tw-blur: initial;--tw-brightness: initial;--tw-contrast: initial;--tw-grayscale: initial;--tw-hue-rotate: initial;--tw-invert: initial;--tw-opacity: initial;--tw-saturate: initial;--tw-sepia: initial;--tw-drop-shadow: initial;--tw-drop-shadow-color: initial;--tw-drop-shadow-alpha: 100%;--tw-drop-shadow-size: initial;--tw-backdrop-blur: initial;--tw-backdrop-brightness: initial;--tw-backdrop-contrast: initial;--tw-backdrop-grayscale: initial;--tw-backdrop-hue-rotate: initial;--tw-backdrop-invert: initial;--tw-backdrop-opacity: initial;--tw-backdrop-saturate: initial;--tw-backdrop-sepia: initial;--tw-duration: initial;--tw-ease: initial}}}
2
+ `);function C({name:e,label:r,placeholder:t,type:o="text",value:a,onValueChange:i,onBlur:s,autoComplete:n,rulesStatus:l=[],submitted:d=false,inputRef:p}){let[c,h]=useState(false),g=l.some(f=>!f.passed);return jsxs("div",{className:"font-sans relative w-full flex flex-col gap-1 text-foreground",children:[jsx("label",{htmlFor:e,className:"text-base font-semibold",children:r}),jsxs("div",{className:`flex justify-between items-center px-2.5 py-px gap-2.5 border-b-2 border-foreground ${g&&d?"border-destructive!":""}`,children:[jsx("input",{type:c?"text":o,name:e,id:e,placeholder:t,value:a,onChange:f=>i&&i(f.target.value),onBlur:s,autoComplete:n,"aria-invalid":g&&d,ref:p,className:"min-w-40 flex-1 text-base font-light text-foreground appearance-none bg-transparent outline-none border-none shadow-none! py-0.5"}),o==="password"&&(c?jsx(EyeOff,{className:"cursor-pointer shrink-0 select-none",size:24,onClick:()=>h(false)}):jsx(Eye,{className:"cursor-pointer shrink-0 select-none",size:24,onClick:()=>h(true)}))]}),jsx("div",{className:"text-xs text-muted-foreground transition-opacity duration-200 ease-in-out",children:l.map((f,v)=>{let b=["transition-[color,text-decoration,opacity] duration-[120ms] ease opacity-95 m-[0.125rem]",f.passed?"line-through opacity-60 text-green-500":"",!f.passed&&d?"text-destructive font-semibold opacity-100":""].filter(Boolean).join(" ");return jsx("p",{className:b,children:f.message},f.id??v)})})]})}function I({label:e,onSubmit:r,loading:t}){return jsx("button",{type:"submit",onClick:r,disabled:t,className:`font-sans w-full h-13 text-xl font-semibold outline-none bg-transparent relative overflow-hidden min-w-40 shrink-0 border-2 border-foreground text-foreground cursor-pointer px-6 transition-transform duration-500 rounded-lg hover:scale-[1.02] active:scale-[0.99] disabled:opacity-60 disabled:cursor-not-allowed disabled:transform-none! ${t?"button-loading":""}`,children:e})}function _({mainText:e,subText:r}){return jsxs("div",{className:"font-sans flex flex-col items-center",children:[jsx("div",{className:"flex justify-center items-center p-2 bg-foreground/10 rounded-full mb-2.5",children:jsx(User,{className:"w-16 h-16 p-2.5 bg-background rounded-full shadow-[0_0.25rem_1rem_rgba(0,0,0,0.25)]",size:70})}),jsx("h3",{className:"text-center text-xl font-medium m-0",children:e}),jsx("span",{className:"text-center text-sm font-light opacity-60",children:r})]})}function F(e,r){return e.map(t=>({id:t.id,message:t.message,passed:!!t.test(r)}))}function gr({onSuccess:e,onFailed:r,signUpRedirect:t,forgotPasswordRedirect:o,emailRules:a}){let[i,s]=useState(""),[n,l]=useState(""),[d,p]=useState(false),[c,h]=useState(false),g=useRef(null),f=useRef(null),{auth:v}=w(),b={email:a||[{message:"Digite um e-mail v\xE1lido, ex: exemplo@dominio.com",test:y=>/\S+@\S+\.\S+/.test(y)}],password:[]},S=F(b.email,i),N=F(b.password,n);return jsxs("form",{className:"font-sans flex flex-col w-full max-w-120 min-w-60 max-h-[max(75dvh,32rem)] overflow-hidden gap-5 items-center bg-background text-foreground p-[1.25rem_1.5rem] shadow-[0_0.25rem_0.25rem_0_rgba(0,0,0,0.25)] transition-transform duration-150 ease-in-out rounded-lg",children:[jsx(_,{mainText:"Fa\xE7a login na sua conta",subText:"Insira seus dados para fazer login"}),jsxs("div",{className:"w-full flex flex-col gap-2.5 flex-[1_1_auto] overflow-y-auto mb-2",children:[jsx(C,{label:"Email",name:"email",placeholder:"teste@gmail.com",autoComplete:"email",type:"email",value:i,onValueChange:s,inputRef:g,rulesStatus:S,submitted:d}),jsx(C,{label:"Senha",name:"password",placeholder:"**********",autoComplete:"current-password",type:"password",value:n,onValueChange:l,inputRef:f,rulesStatus:N,submitted:d})]}),jsx(I,{label:"Entrar",onSubmit:async y=>{y.preventDefault(),p(true);let ee=S.some(k=>!k.passed),te=N.some(k=>!k.passed);if(ee){g.current?.focus();return}if(te){f.current?.focus();return}h(true);let V=await v.login(i,n);V.success?e&&await e(V.message):r&&await r(V.message,V.trace),h(false);},loading:c}),o&&jsx("span",{className:"text-sm font-semibold text-center cursor-pointer",children:jsx("span",{className:"cursor-pointer text-primary transition-colors duration-200 hover:opacity-80",onClick:o,children:"Esqueceu sua senha?"})}),t&&jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center gap-2.5 w-full text-base font-semibold opacity-60",children:[jsx("hr",{className:"flex-1"}),"OU",jsx("hr",{className:"flex-1"})]}),jsxs("span",{className:"text-sm font-semibold",children:["Ainda n\xE3o possui uma conta? ",jsx("span",{className:"cursor-pointer text-primary transition-colors duration-200 hover:opacity-80",onClick:t,children:"Cadastra-se"})]})]})]})}function vr({onSuccess:e,onFailed:r,loginRedirect:t,emailRules:o,passwordRules:a}){let[i,s]=useState(""),[n,l]=useState(""),[d,p]=useState(""),[c,h]=useState(false),[g,f]=useState(false),v=useRef(null),b=useRef(null),S=useRef(null),{auth:N}=w(),Y={email:o||[{message:"Digite um e-mail v\xE1lido, ex: exemplo@dominio.com",test:k=>/\S+@\S+\.\S+/.test(k)}],password:a||[{message:"M\xEDnimo de 8 caracteres.",test:k=>k.length>=8},{message:"Deve conter uma letra mai\xFAscula.",test:k=>/[A-Z]/.test(k)},{message:"Inclua pelo menos um caractere especial, ex: ! @ # $ % & * . ,",test:k=>/[!@#$%^&*(),.?":{}|<>_\-+=~`;/\\[\]]/.test(k)},{message:"Deve conter um n\xFAmero.",test:k=>/\d/.test(k)}],confirmPassword:[{message:"Senhas n\xE3o conferem.",test:k=>k===n}]},y=F(Y.email,i),ee=F(Y.password,n),te=F(Y.confirmPassword,d);return jsxs("form",{className:"font-sans flex flex-col w-full max-w-120 min-w-60 max-h-[max(75dvh,32rem)] overflow-hidden gap-5 items-center bg-background text-foreground p-[1.25rem_1.5rem] shadow-[0_0.25rem_0.25rem_0_rgba(0,0,0,0.25)] transition-transform duration-150 ease-in-out rounded-lg",children:[jsx(_,{mainText:"Crie sua conta",subText:"Insira seus dados para come\xE7ar"}),jsxs("div",{className:"w-full flex flex-col gap-2.5 flex-[1_1_auto] overflow-y-auto mb-2",children:[jsx(C,{label:"Email",name:"email",placeholder:"teste@gmail.com",autoComplete:"email",type:"email",value:i,onValueChange:s,inputRef:v,rulesStatus:y,submitted:c}),jsx(C,{label:"Senha",name:"password",placeholder:"**********",autoComplete:"new-password",type:"password",value:n,onValueChange:l,inputRef:b,rulesStatus:ee,submitted:c}),jsx(C,{label:"Confirme a Senha",name:"confirm-password",placeholder:"**********",autoComplete:"new-password",type:"password",value:d,onValueChange:p,inputRef:S,rulesStatus:te,submitted:c})]}),jsx(I,{label:"Criar Conta",onSubmit:async k=>{k.preventDefault(),h(true);let Wt=y.some(se=>!se.passed),Qt=ee.some(se=>!se.passed),Zt=te.some(se=>!se.passed);if(Wt){v.current?.focus();return}if(Qt){b.current?.focus();return}if(Zt){S.current?.focus();return}f(true);let Ee=await N.register(i,n);Ee.success?e&&await e(Ee.message):r&&await r(Ee.message,Ee.trace),f(false);},loading:g}),t&&jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center gap-2.5 w-full text-base font-semibold opacity-60",children:[jsx("hr",{className:"flex-1"}),"OU",jsx("hr",{className:"flex-1"})]}),jsxs("span",{className:"text-sm font-semibold",children:["J\xE1 possui uma conta? ",jsx("span",{className:"cursor-pointer text-primary transition-colors duration-200 hover:opacity-80",onClick:t,children:"Entre"})]})]})]})}var br={xs:"text-xs",sm:"text-sm",md:"text-base",lg:"text-lg",xl:"text-xl","2xl":"text-2xl"};function xr({size:e}){let r=e?br[e]:"text-base";return jsxs("span",{className:`font-sans font-medium ${r}`,children:["\xA9 ",new Date().getFullYear()," TrieOH"]})}function Er({onSuccess:e,onFailed:r,forceLogout:t}){let{auth:o}=w(),[a,i]=useState(false);return jsxs("button",{onClick:async n=>{if(n.preventDefault(),a)return;i(true);let l=await o.logout({forceLogout:t});l.success?e&&await e(l.message):r&&await r(l.message,l.trace),i(false);},type:"button",disabled:a,className:"font-sans border-none bg-transparent cursor-pointer flex items-end gap-1 text-base font-medium text-destructive transition-transform duration-200 hover:scale-[1.05] active:scale-[0.98] disabled:opacity-60 disabled:cursor-not-allowed disabled:transform-none!",children:[jsx(LogOut,{size:24})," ",jsx("span",{children:"Log out"})]})}var Ft={mobile:Smartphone,tablet:Tablet,desktop:Monitor};function Bt(e){let{device:r,os:t,browser:o}=UAParser(e);return {deviceType:r.type??"desktop",os:t.name,browser:o.name}}function Mt(e){let r=Bt(e);return {device:Nr(r.deviceType),os:r.os,browser:r.browser}}function Nr(e){if(!e)return "desktop";switch(e){case "mobile":return "mobile";case "tablet":return "tablet";default:return "desktop"}}function Ot(e){let r=Date.now()-new Date(e).getTime(),t=Math.floor(r/1e3),o=Math.floor(t/60),a=Math.floor(o/60),i=Math.floor(a/24),s=Math.floor(i/7);return t<60?"agora mesmo":o<60?`${o} minutos atr\xE1s`:a<24?`${a} horas atr\xE1s`:i<7?`${i} dias atr\xE1s`:`${s} semanas atr\xE1s`}function rt({is_current:e,session_id:r,user_agent:t,issued_at:o,user_ip:a,onClick:i}){let s=Mt(t),n=Ft[s.device];return jsx("div",{className:"border-t border-border p-[1.25rem_0.75rem] text-foreground",children:jsxs("div",{className:"relative flex flex-col items-center gap-2 flex-1 text-center @[640px]:flex-row @[640px]:items-center @[640px]:gap-4 @[640px]:text-left",children:[jsx(n,{size:40}),jsxs("div",{className:"flex flex-col min-w-0",children:[jsxs("h3",{className:"text-base font-semibold m-0",children:[s.browser," - ",s.os]}),jsxs("span",{className:"inline-flex flex-col text-sm font-extralight @[640px]:flex-row @[640px]:gap-2 @[640px]:items-center",children:[e&&jsx("strong",{className:"text-primary font-normal",children:"\u2022 Sess\xE3o Atual \u2022"}),jsx("span",{children:`${a} - ${Ot(o)}`})]})]}),!e&&jsx(Trash2,{size:20,className:"absolute top-0 right-0 cursor-pointer text-destructive opacity-60 transition-[opacity,transform] duration-200 hover:opacity-100 hover:scale-[1.05] active:scale-[0.95]",onClick:l=>i(l,r)})]})})}function Lr({revokeAll:e=false,onSuccess:r}){let{auth:t}=w(),[o,a]=useState(false),[i,s]=useState([]),n=async()=>{let p=await t.sessions();if(p.success){let c=t.profile()?.session_id,h=p.data.sort((g,f)=>g.session_id===c?-1:f.session_id===c?1:0);s(h);}};useEffect(()=>{n();},[]);let l=async(p,c)=>{p.preventDefault();let h=i.find(g=>g.session_id===c);if(h){s(i.filter(g=>g.session_id!==c));try{(await t.revokeASession(c)).success||s(f=>[...f,h]);}catch{s(g=>[...g,h]);}}};return jsxs("div",{className:"font-sans w-full min-w-[20rem] m-2 @container bg-background text-foreground p-[1.5rem_0.5rem] rounded-lg",children:[jsxs("div",{className:"w-full flex flex-wrap items-center justify-center text-center gap-4 box-border px-3 @[640px]:justify-between @[640px]:text-left @[640px]:gap-8",children:[jsxs("div",{className:"flex-[0_1_auto] max-w-100",children:[jsx("h3",{className:"font-semibold text-2xl m-0 mb-1",children:"Navegadores e Dispositivos"}),jsx("p",{className:"font-extralight text-base m-0",children:"Esses navegadores e dispositivos est\xE3o atualmente conectados \xE0 sua conta. Remova quaisquer dispositivos n\xE3o autorizados."})]}),jsx("button",{type:"submit",onClick:async p=>{if(p.preventDefault(),o)return;a(true);let c=await t.revokeSessions(e),h=t.profile()?.session_id;c.success&&(s(e?[]:i.filter(g=>g.session_id===h)),r&&r(c.message)),a(false);},disabled:o,className:`font-sans w-full max-w-56 p-[1rem_0] h-auto text-base font-semibold outline-none bg-transparent relative overflow-hidden shrink-0 border-2 border-foreground text-foreground cursor-pointer transition-transform duration-500 rounded-lg hover:scale-[1.02] active:scale-[0.99] disabled:opacity-60 disabled:cursor-not-allowed disabled:transform-none! ${o?"button-loading":""}`,children:"Revogar todas as sess\xF5es"})]}),jsx("div",{className:"mt-4",children:i.length>0?i.map(p=>jsx(rt,{...p,is_current:t.profile()?.session_id===p.session_id,onClick:l},p.session_id)):jsx("span",{className:"block border-t border-border p-[1.25rem_0.75rem] text-center font-semibold",children:"Nenhuma Sess\xE3o Dispon\xEDvel"})})]})}function zt({onSuccess:e,onFailed:r,loginRedirect:t,emailRules:o}){let[a,i]=useState(""),[s,n]=useState(false),[l,d]=useState(false),p=useRef(null),{auth:c}=w(),g=F({email:o||[{message:"Digite um e-mail v\xE1lido, ex: exemplo@dominio.com",test:v=>/\S+@\S+\.\S+/.test(v)}]}.email,a);return jsxs("form",{className:"font-sans flex flex-col w-full max-w-120 min-w-60 max-h-[max(75dvh,32rem)] overflow-hidden gap-5 items-center bg-background text-foreground p-[1.25rem_1.5rem] shadow-[0_0.25rem_0.25rem_0_rgba(0,0,0,0.25)] transition-transform duration-150 ease-in-out rounded-lg",children:[jsx(_,{mainText:"Esqueci a senha",subText:"Insira seu e-mail para receber um link de redefini\xE7\xE3o."}),jsx("div",{className:"w-full flex flex-col gap-2.5 flex-[1_1_auto] overflow-y-auto mb-2",children:jsx(C,{label:"Email",name:"email",placeholder:"teste@gmail.com",autoComplete:"email",type:"email",value:a,onValueChange:i,inputRef:p,rulesStatus:g,submitted:s})}),jsx(I,{label:l?"Enviando...":"Enviar link de redefini\xE7\xE3o",onSubmit:async v=>{if(v.preventDefault(),n(true),g.some(N=>!N.passed)){p.current?.focus();return}d(true);let S=await c.sendForgotPassword(a);S.success?e&&await e(S.message):r&&await r(S.message,S.trace),d(false);},loading:l}),t&&jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center gap-2.5 w-full text-base font-semibold opacity-60",children:[jsx("hr",{className:"flex-1"}),"OU",jsx("hr",{className:"flex-1"})]}),jsxs("span",{className:"text-sm font-semibold",children:["Lembrou-se da sua senha? ",jsx("span",{className:"cursor-pointer text-primary transition-colors duration-200 hover:opacity-80",onClick:t,children:"Login"})]})]})]})}function Mr({token:e,onSuccess:r,onFailed:t,loginRedirect:o,passwordRules:a}){let[i,s]=useState(""),[n,l]=useState(""),[d,p]=useState(false),[c,h]=useState(false),g=useRef(null),f=useRef(null),{auth:v}=w(),b={password:a||[{message:"M\xEDnimo de 8 caracteres.",test:y=>y.length>=8},{message:"Deve conter uma letra mai\xFAscula.",test:y=>/[A-Z]/.test(y)},{message:"Inclua pelo menos um caractere especial, ex: ! @ # $ % & * . ,",test:y=>/[!@#$%^&*(),.?":{}|<>_\-+=~`;/\\[\]]/.test(y)},{message:"Deve conter um n\xFAmero.",test:y=>/\d/.test(y)}],confirmPassword:[{message:"Senhas n\xE3o conferem.",test:y=>y===i}]},S=F(b.password,i),N=F(b.confirmPassword,n);return jsxs("form",{className:"font-sans flex flex-col w-full max-w-120 min-w-60 max-h-[max(75dvh,32rem)] overflow-hidden gap-5 items-center bg-background text-foreground p-[1.25rem_1.5rem] shadow-[0_0.25rem_0.25rem_0_rgba(0,0,0,0.25)] transition-transform duration-150 ease-in-out rounded-lg",children:[jsx(_,{mainText:"Redefinir Senha",subText:"Crie uma nova senha para sua conta"}),jsxs("div",{className:"w-full flex flex-col gap-2.5 flex-[1_1_auto] overflow-y-auto mb-2",children:[jsx(C,{label:"Nova Senha",name:"password",placeholder:"**********",autoComplete:"new-password",type:"password",value:i,onValueChange:s,inputRef:g,rulesStatus:S,submitted:d}),jsx(C,{label:"Confirme a Nova Senha",name:"confirm-password",placeholder:"**********",autoComplete:"new-password",type:"password",value:n,onValueChange:l,inputRef:f,rulesStatus:N,submitted:d})]}),jsx(I,{label:"Redefinir Senha",onSubmit:async y=>{y.preventDefault(),p(true);let ee=S.some(k=>!k.passed),te=N.some(k=>!k.passed);if(ee){g.current?.focus();return}if(te){f.current?.focus();return}h(true);let V=await v.resetPassword(e,i);V.success?r&&await r(V.message):t&&await t(V.message,V.trace),h(false);},loading:c}),o&&jsxs("span",{className:"text-sm font-semibold",children:["Lembrou-se da sua senha? ",jsx("span",{className:"cursor-pointer text-primary transition-colors duration-200 hover:opacity-80",onClick:o,children:"Login"})]})]})}function Ur(e,r,t){let[o,a]=useState(true),[i,s]=useState("verifying"),[n,l]=useState("Verificando seu e-mail..."),{auth:d}=w(),p=useRef(false),c=async()=>{if(!p.current){p.current=true,a(true),s("verifying");try{if(d.profile()?.is_verified){s("already_verified"),l("Seu e-mail j\xE1 est\xE1 verificado."),a(!1);return}let f=await d.verifyEmail(e);f.success?(await d.refresh(),s("success"),l(f.message||"E-mail verificado com sucesso!"),r&&await r(f.message)):(s("error"),l(f.message||"Falha na verifica\xE7\xE3o do e-mail."),t&&await t(f.message,f.trace));}catch{s("error"),l("Ocorreu um erro inesperado durante a verifica\xE7\xE3o.");}finally{a(false);}}};return useEffect(()=>{e&&!p.current&&c();},[e]),{loading:o,status:i,message:n,onRetry:g=>{g.preventDefault(),p.current=false,c();},setStatus:s,setLoading:a,setMessage:l}}function Hr({token:e,onSuccess:r,onFailed:t}){let{loading:o,status:a,message:i,onRetry:s}=Ur(e,r,t);return jsx("div",{className:"font-sans flex flex-col w-full h-full min-h-screen items-center justify-center bg-background text-foreground p-6",children:jsxs("div",{className:"w-full max-w-120 flex flex-col gap-8 items-center bg-background text-foreground p-[1.25rem_1.5rem] shadow-[0_0.25rem_0.25rem_0_rgba(0,0,0,0.25)] rounded-lg",children:[jsx(_,{mainText:a==="verifying"?"Verificando...":a==="error"?"Ops! Falha na verifica\xE7\xE3o":"Tudo pronto!",subText:i}),a==="verifying"&&jsx("div",{className:"w-full flex justify-center py-4",children:jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary"})}),a==="error"&&jsx("div",{className:"w-full flex flex-col gap-6 items-center",children:jsx("div",{className:"w-full mt-2",children:jsx(I,{label:"Tentar novamente",onSubmit:s,loading:o})})}),(a==="success"||a==="already_verified")&&jsxs("div",{className:"w-full flex flex-col gap-4 items-center",children:[jsx("div",{className:"w-16 h-16 flex items-center justify-center rounded-full bg-primary/10 text-primary",children:a==="success"?jsx(Check,{size:40}):jsx(Info,{size:40})}),jsx("p",{className:"text-sm font-semibold opacity-50 text-center",children:"Voc\xEA j\xE1 pode fechar esta janela ou continuar navegando em sua conta."})]})]})})}function qr({onSuccess:e,onFailed:r}){let[t,o]=useState(false),[a,i]=useState(false),{auth:s}=w();return jsxs("div",{className:"font-sans flex flex-col w-full max-w-120 min-w-60 max-h-[max(75dvh,32rem)] overflow-hidden gap-5 items-center bg-background text-foreground p-[1.25rem_1.5rem] shadow-[0_0.25rem_0.25rem_0_rgba(0,0,0,0.25)] transition-transform duration-150 ease-in-out rounded-lg",children:[jsx(_,{mainText:"Reenviar Verifica\xE7\xE3o",subText:"N\xE3o recebeu o e-mail de verifica\xE7\xE3o? Clique no bot\xE3o abaixo para reenviar."}),jsx(I,{label:a?"E-mail Reenviado":"Reenviar E-mail de Verifica\xE7\xE3o",onSubmit:async()=>{o(true);let l=await s.resendVerifyEmail();l.success?(i(true),e&&await e(l.message)):r&&await r(l.message,l.trace),o(false);},loading:t}),a&&jsx("p",{className:"text-sm font-semibold text-primary",children:"Um novo link de verifica\xE7\xE3o foi enviado para seu e-mail."})]})}function O(...e){return twMerge(clsx(e))}var qt=forwardRef(({label:e,id:r,type:t="text",error:o,className:a,value:i,onChange:s,onFocus:n,onBlur:l,...d},p)=>{let[c,h]=useState(false),g=useId(),f=r??g,v=t==="password";return jsxs("div",{className:"w-full font-body group relative",children:[jsx("input",{ref:p,id:f,type:v?c?"text":"password":t,value:i,placeholder:" ",onChange:s,onFocus:n,onBlur:l,className:O("peer h-13 w-full rounded-sm text-sm text-foreground outline-none","border border-secondary/20 bg-muted/40 transition-all duration-200","placeholder:text-transparent focus-visible:ring-0 focus:bg-muted/60","px-3.5 pt-4 pb-1",v&&"pr-10",o&&"bg-destructive/5 ring-1 ring-destructive/20 border-destructive/50",a),...d}),jsx("label",{htmlFor:f,className:O("pointer-events-none absolute transition-all duration-200 ease-out left-3.5","top-1.5 text-[10px] font-semibold tracking-wider text-primary/70","peer-placeholder-shown:top-3.5 peer-placeholder-shown:text-[15px] peer-placeholder-shown:font-normal peer-placeholder-shown:tracking-normal peer-placeholder-shown:text-muted-foreground","peer-focus:top-1.5 peer-focus:text-[10px] peer-focus:font-semibold peer-focus:tracking-wider peer-focus:text-primary/70",o&&"text-destructive/80",o&&"peer-placeholder-shown:text-destructive/60",o&&"peer-focus:text-destructive/80"),children:e}),v&&jsx("button",{type:"button",tabIndex:-1,onClick:()=>{h(S=>!S);},className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground transition-colors hover:text-primary/70 focus:outline-none","aria-label":c?"Ocultar senha":"Mostrar senha",children:c?jsx(EyeOff,{size:16}):jsx(Eye,{size:16})})]})});qt.displayName="FormInput";var R=qt;var to=({message:e,className:r})=>jsx(AnimatePresence,{children:e&&jsx(motion.p,{initial:{opacity:0,height:0,marginTop:0},animate:{opacity:1,height:"auto",marginTop:6},exit:{opacity:0,height:0,marginTop:0},transition:{duration:.2,ease:"easeOut"},className:O("text-[11px] font-medium text-destructive tracking-tight leading-none px-1 overflow-hidden",r),children:e})}),P=to;var oo=cva("inline-flex items-center justify-center whitespace-nowrap rounded-sm text-sm font-semibold transition-all focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 active:scale-[0.98]",{variants:{variant:{default:"bg-primary text-primary-foreground hover:opacity-90",destructive:"bg-destructive text-destructive-foreground hover:opacity-90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:opacity-80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-12 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),L=({className:e,variant:r,size:t,...o})=>jsx("button",{className:O(oo({variant:r,size:t,className:e})),...o});function jt(){return jsxs("div",{className:"flex items-center gap-3 py-1",children:[jsx("div",{className:"flex-1 h-px bg-border"}),jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-widest select-none",children:"ou"}),jsx("div",{className:"flex-1 h-px bg-border"})]})}var so={google:{label:"Google",icon:jsxs("svg",{viewBox:"0 0 24 24",className:"w-5 h-5","aria-hidden":"true",children:[jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z",fill:"#4285F4"}),jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]})},github:{label:"GitHub",icon:jsx("svg",{viewBox:"0 0 24 24",className:"w-5 h-5",fill:"currentColor","aria-hidden":"true",children:jsx("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12z"})})}};function Jt({provider:e,onClick:r,isLoading:t}){let o=so[e];return jsxs("button",{type:"button",onClick:r,disabled:t,className:O("w-full flex items-center justify-center gap-2.5 h-12 px-4 rounded-sm text-sm font-semibold","border border-input bg-background hover:bg-muted/60 transition-all","disabled:opacity-50 disabled:pointer-events-none active:scale-[0.98]"),children:[o.icon,jsxs("span",{children:["Continuar com ",o.label]})]})}var mo=z.object({email:z.email("E-mail inv\xE1lido"),password:z.string().min(1,"A senha \xE9 obrigat\xF3ria")});function pt({onSuccess:e,onFailed:r,signUpRedirect:t,forgotPasswordRedirect:o,providers:a}){let[i,s]=useState(false),[n,l]=useState(null),{auth:d}=w(),p=async v=>{l(v);try{let b=await d.loginWithProvider(v);b.success&&b.data?.url?window.location.href=b.data.url:r?await r(b.message||"Falha na autentica\xE7\xE3o"):toast.error("Falha ao conectar com provedor");}catch{toast.error("Ocorreu um erro inesperado");}finally{l(null);}},{register:c,handleSubmit:h,formState:{errors:g}}=useForm({resolver:zodResolver(mo),defaultValues:{email:"",password:""}});return jsxs("form",{onSubmit:h(async v=>{s(true);try{let b=await d.login(v.email,v.password);b.success?e?await e(b.message):toast.success("Login realizado com sucesso!"):r?await r(b.message,b.trace):toast.error(b.message||"Erro ao entrar");}catch{toast.error("Ocorreu um erro inesperado");}finally{s(false);}}),className:"space-y-4",children:[jsxs("div",{className:"space-y-1",children:[jsx(R,{label:"E-mail",type:"email",autoComplete:"email",error:!!g.email,...c("email")}),jsx(P,{message:g.email?.message})]}),jsxs("div",{className:"space-y-1",children:[jsx(R,{label:"Senha",type:"password",autoComplete:"current-password",error:!!g.password,...c("password")}),jsx(P,{message:g.password?.message})]}),o&&jsx("div",{className:"flex justify-end",children:jsx("button",{type:"button",onClick:o,className:"text-xs text-primary hover:underline font-medium",children:"Esqueceu a senha?"})}),jsx(L,{type:"submit",disabled:i,className:"w-full flex items-center justify-center gap-2",children:i?jsx(Loader2,{className:"w-5 h-5 animate-spin"}):jsxs(Fragment,{children:["Entrar",jsx(ArrowRight,{className:"w-4 h-4"})]})}),a&&a.length>0&&jsxs(Fragment,{children:[jsx(jt,{}),jsx("div",{className:"flex flex-col gap-2",children:a.map(v=>jsx(Jt,{provider:v,onClick:()=>p(v),isLoading:n===v},v))})]})]})}var wo=z.object({email:z.email("E-mail inv\xE1lido"),password:z.string().min(6,"A senha deve ter pelo menos 6 caracteres"),confirmPassword:z.string()}).refine(e=>e.password===e.confirmPassword,{message:"As senhas n\xE3o coincidem",path:["confirmPassword"]});function ut({onSuccess:e,onFailed:r,signInRedirect:t}){let[o,a]=useState(false),{auth:i}=w(),{register:s,handleSubmit:n,formState:{errors:l}}=useForm({resolver:zodResolver(wo),defaultValues:{email:"",password:"",confirmPassword:""}});return jsxs("form",{onSubmit:n(async p=>{a(true);try{let c=await i.register(p.email,p.password);c.success?e?await e(c.message):(toast.success("Conta criada com sucesso!"),t&&t()):r?await r(c.message,c.trace):toast.error(c.message||"Erro ao criar conta");}catch{toast.error("Ocorreu um erro inesperado");}finally{a(false);}}),className:"space-y-4",children:[jsxs("div",{className:"space-y-1",children:[jsx(R,{label:"E-mail",type:"email",autoComplete:"email",error:!!l.email,...s("email")}),jsx(P,{message:l.email?.message})]}),jsxs("div",{className:"space-y-1",children:[jsx(R,{label:"Senha",type:"password",autoComplete:"new-password",error:!!l.password,...s("password")}),jsx(P,{message:l.password?.message})]}),jsxs("div",{className:"space-y-1",children:[jsx(R,{label:"Confirmar Senha",type:"password",autoComplete:"new-password",error:!!l.confirmPassword,...s("confirmPassword")}),jsx(P,{message:l.confirmPassword?.message})]}),jsx(L,{type:"submit",disabled:o,className:"w-full flex items-center justify-center gap-2",children:o?jsx(Loader2,{className:"w-5 h-5 animate-spin"}):jsxs(Fragment,{children:["Criar Conta",jsx(ArrowRight,{className:"w-4 h-4"})]})})]})}var Ao=z.object({email:z.email("E-mail inv\xE1lido")});function ht({onSuccess:e,onFailed:r,signInRedirect:t}){let[o,a]=useState(false),{auth:i}=w(),{register:s,handleSubmit:n,formState:{errors:l}}=useForm({resolver:zodResolver(Ao),defaultValues:{email:""}});return jsxs("form",{onSubmit:n(async p=>{a(true);try{let c=await i.sendForgotPassword(p.email);c.success?e?await e(c.message):toast.success("Link de redefini\xE7\xE3o enviado com sucesso!"):r?await r(c.message,c.trace):toast.error(c.message||"Erro ao enviar link");}catch{toast.error("Ocorreu um erro inesperado");}finally{a(false);}}),className:"space-y-4",children:[jsxs("div",{className:"space-y-1",children:[jsx(R,{label:"E-mail",type:"email",autoComplete:"email",error:!!l.email,...s("email")}),jsx(P,{message:l.email?.message})]}),jsx(L,{type:"submit",disabled:o,className:"w-full flex items-center justify-center gap-2",children:o?jsx(Loader2,{className:"w-5 h-5 animate-spin"}):jsxs(Fragment,{children:["Enviar link",jsx(ArrowRight,{className:"w-4 h-4"})]})})]})}var Lo=z.object({password:z.string().min(6,"A senha deve ter pelo menos 6 caracteres"),confirmPassword:z.string()}).refine(e=>e.password===e.confirmPassword,{message:"As senhas n\xE3o coincidem",path:["confirmPassword"]});function Fo({token:e,onSuccess:r,onFailed:t,signInRedirect:o}){let[a,i]=useState(false),{auth:s}=w(),{register:n,handleSubmit:l,formState:{errors:d}}=useForm({resolver:zodResolver(Lo),defaultValues:{password:"",confirmPassword:""}}),p=async c=>{i(true);try{let h=await s.resetPassword(e,c.password);h.success?r?await r(h.message):toast.success("Senha redefinida com sucesso!"):t?await t(h.message,h.trace):toast.error(h.message||"Erro ao redefinir senha");}catch{toast.error("Ocorreu um erro inesperado");}finally{i(false);}};return jsxs("div",{className:"w-full max-w-md z-10 flex flex-col antialiased selection:bg-primary/10 selection:text-primary",children:[jsxs("div",{className:"text-center mb-6",children:[jsx(motion.h1,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"font-heading text-3xl font-bold tracking-tight mb-2",children:"Redefinir Senha"}),jsx("p",{className:"text-muted-foreground text-sm mb-4",children:"Crie uma nova senha para sua conta"})]}),jsxs("form",{onSubmit:l(p),className:"space-y-4",children:[jsxs("div",{className:"space-y-1",children:[jsx(R,{label:"Nova Senha",type:"password",autoComplete:"new-password",error:!!d.password,...n("password")}),jsx(P,{message:d.password?.message})]}),jsxs("div",{className:"space-y-1",children:[jsx(R,{label:"Confirmar Nova Senha",type:"password",autoComplete:"new-password",error:!!d.confirmPassword,...n("confirmPassword")}),jsx(P,{message:d.confirmPassword?.message})]}),jsx(L,{type:"submit",disabled:a,className:"w-full flex items-center justify-center gap-2",children:a?jsx(Loader2,{className:"w-5 h-5 animate-spin"}):jsxs(Fragment,{children:["Redefinir Senha",jsx(ArrowRight,{className:"w-4 h-4"})]})}),o&&jsx("div",{className:"text-center mt-4",children:jsx("button",{type:"button",onClick:o,className:"text-xs text-primary font-semibold hover:underline",children:"Voltar para o login"})})]})]})}function Ho({token:e,onSuccess:r,onFailed:t,signInRedirect:o}){let[a,i]=useState("verifying"),[s,n]=useState("Verificando seu e-mail..."),[l,d]=useState(true),{auth:p}=w(),c=useRef(false),h=async()=>{if(!c.current){c.current=true,d(true),i("verifying");try{if(p.profile()?.is_verified){i("already_verified"),n("Seu e-mail j\xE1 est\xE1 verificado."),d(!1);return}let f=await p.verifyEmail(e);f.success?(await p.refresh(),i("success"),n(f.message||"E-mail verificado com sucesso!"),r&&await r(f.message)):(i("error"),n(f.message||"Falha na verifica\xE7\xE3o do e-mail."),t&&await t(f.message,f.trace));}catch{i("error"),n("Ocorreu um erro inesperado durante a verifica\xE7\xE3o.");}finally{d(false);}}};return useEffect(()=>{e&&!c.current&&h();},[e]),jsx("div",{className:"w-full max-w-md z-10 flex flex-col antialiased selection:bg-primary/10 selection:text-primary",children:jsxs("div",{className:"text-center mb-6",children:[jsxs(motion.div,{initial:{scale:.8,opacity:0},animate:{scale:1,opacity:1},className:"flex justify-center mb-4",children:[a==="verifying"&&jsx(Loader2,{className:"w-12 h-12 text-primary animate-spin"}),(a==="success"||a==="already_verified")&&jsx(CheckCircle2,{className:"w-12 h-12 text-green-500"}),a==="error"&&jsx(XCircle,{className:"w-12 h-12 text-destructive"})]}),jsx(motion.h1,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"font-heading text-3xl font-bold tracking-tight mb-2",children:a==="verifying"?"Verificando...":a==="error"?"Falha na verifica\xE7\xE3o":"E-mail Verificado!"}),jsx("p",{className:"text-muted-foreground text-sm mb-6",children:s}),a==="error"&&jsx(L,{onClick:()=>{c.current=false,h();},disabled:l,className:"w-full flex items-center justify-center gap-2",children:"Tentar novamente"}),(a==="success"||a==="already_verified")&&jsxs("div",{className:"space-y-4",children:[jsx("p",{className:"text-xs text-muted-foreground",children:"Voc\xEA j\xE1 pode continuar navegando em sua conta."}),o&&jsxs(L,{onClick:o,className:"w-full flex items-center justify-center gap-2",children:["Ir para o login",jsx(ArrowRight,{className:"w-4 h-4"})]})]})]})})}function ze({children:e,className:r,backLink:t}){return jsxs("main",{className:O("bg-background h-full text-foreground min-h-screen relative overflow-hidden","flex flex-col px-4","antialiased selection:bg-primary/10 selection:text-primary",r),children:[jsx("div",{className:"absolute top-[-10%] left-[-10%] w-[40%] h-[40%] bg-primary/20 rounded-full blur-3xl pointer-events-none"}),jsx("div",{className:"absolute bottom-[-10%] right-[-10%] w-[40%] h-[40%] bg-primary/20 rounded-full blur-3xl pointer-events-none"}),t&&jsx("div",{className:"relative z-10 pt-4",children:t}),jsx("div",{className:"relative z-10 flex-1 flex justify-center items-center",children:e})]})}var Go=z.object({email:z.string().email("E-mail inv\xE1lido"),password:z.string().min(8,"A senha deve ter pelo menos 8 caracteres"),confirmPassword:z.string().min(1,"A confirma\xE7\xE3o de senha \xE9 obrigat\xF3ria")}).refine(e=>e.password===e.confirmPassword,{message:"As senhas n\xE3o coincidem",path:["confirmPassword"]});function Wo({onSuccess:e,onFailed:r,backLink:t}){let[o,a]=useState(false),{auth:i}=w(),{register:s,handleSubmit:n,formState:{errors:l}}=useForm({resolver:zodResolver(Go),defaultValues:{email:"",password:"",confirmPassword:""}}),d=async p=>{a(true);try{let c=await i.setup(p.email,p.password);c.success?e?await e(c.message):toast.success("Configura\xE7\xE3o inicial realizada com sucesso!"):r?await r(c.message,c.trace):toast.error(c.message||"Erro ao realizar setup");}catch(c){console.error(c),toast.error("Ocorreu um erro inesperado");}finally{a(false);}};return jsx(ze,{backLink:t,children:jsxs("div",{className:"w-full max-w-md z-10 flex flex-col",children:[jsxs("div",{className:"mb-10 text-center",children:[jsxs(motion.div,{initial:{opacity:0,y:-20},animate:{opacity:1,y:0},className:"inline-flex items-center gap-2 px-3 py-1 rounded-full bg-primary/10 text-primary text-xs font-bold uppercase tracking-widest mb-4",children:[jsx(Sparkles,{size:14}),"Setup Inicial"]}),jsx("h1",{className:"font-heading text-4xl font-bold tracking-tight mb-3",children:"Bem-vindo ao IdentityX"}),jsx("p",{className:"text-muted-foreground text-base max-w-[320px] mx-auto",children:"Vamos come\xE7ar criando sua conta de administrador mestre."})]}),jsx(motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},transition:{delay:.1},className:"bg-card/50 backdrop-blur-sm border border-border/40 p-1 rounded-2xl",children:jsx("div",{className:"bg-background rounded-[14px] p-6 shadow-sm",children:jsxs("form",{onSubmit:n(d),className:"space-y-5",children:[jsxs("div",{className:"space-y-1",children:[jsx(R,{label:"E-mail do Administrador",type:"email",autoComplete:"email",error:!!l.email,...s("email")}),jsx(P,{message:l.email?.message})]}),jsxs("div",{className:"space-y-1",children:[jsx(R,{label:"Senha",type:"password",autoComplete:"new-password",error:!!l.password,...s("password")}),jsx(P,{message:l.password?.message})]}),jsxs("div",{className:"space-y-1",children:[jsx(R,{label:"Confirmar Senha",type:"password",autoComplete:"new-password",error:!!l.confirmPassword,...s("confirmPassword")}),jsx(P,{message:l.confirmPassword?.message})]}),jsx(L,{type:"submit",disabled:o,className:"w-full flex items-center justify-center gap-2 h-13 mt-4 text-base font-bold shadow-lg shadow-primary/10 group",children:o?jsx(Loader2,{className:"w-5 h-5 animate-spin"}):jsxs(Fragment,{children:["Finalizar Configura\xE7\xE3o",jsx(ArrowRight,{className:"w-4 h-4 transition-transform group-hover:translate-x-1"})]})})]})})}),jsxs("div",{className:"mt-8 text-center",children:[jsx("div",{className:"h-1 w-full bg-muted/30 rounded-full overflow-hidden",children:jsx(motion.div,{initial:{width:0},animate:{width:"100%"},transition:{duration:1.5,ease:"easeInOut"},className:"h-full bg-primary/40"})}),jsx("p",{className:"text-[10px] text-muted-foreground mt-2 font-medium uppercase tracking-tighter",children:"Passo 1 de 1 \u2022 Configurando ambiente"})]})]})})}var ta={signin:{title:"Bem-vindo de volta",subtitle:"Entre com suas credenciais para acessar a plataforma",toggleLabel:"Ainda n\xE3o tem uma conta?",toggleAction:"Cadastre-se",toggleTo:"signup"},signup:{title:"Criar sua conta",subtitle:"Preencha os dados abaixo para se cadastrar",toggleLabel:"J\xE1 possui uma conta?",toggleAction:"Fa\xE7a login",toggleTo:"signin"},"forgot-password":{title:"Recuperar senha",subtitle:"Digite seu e-mail para receber instru\xE7\xF5es",toggleLabel:"Lembrou da senha?",toggleAction:"Voltar ao login",toggleTo:"signin"}};function ra({initialView:e="signin",onLoginSuccess:r,onSignUpSuccess:t,onFailed:o,backLink:a,providers:i}){let[s,n]=useState(e),l=async p=>{n("signin"),t&&await t(p);},d=ta[s];return jsx(ze,{backLink:a,children:jsxs("div",{className:"w-full max-w-md z-10 flex flex-col",children:[jsxs("div",{className:"text-center mb-6",children:[jsx(motion.h1,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},className:"font-heading text-3xl font-bold tracking-tight mb-2",children:d.title},s+"-h1"),jsx("p",{className:"text-muted-foreground text-sm mb-4",children:d.subtitle}),jsxs("div",{className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-muted/50 border border-border/50 text-xs font-medium text-muted-foreground",children:[d.toggleLabel,jsx("button",{type:"button",onClick:()=>n(d.toggleTo),className:"text-primary font-semibold hover:underline",children:d.toggleAction})]})]}),jsx("div",{className:`relative ${i&&i.length>0?"min-h-112":"min-h-80"}`,children:jsxs(AnimatePresence,{mode:"wait",children:[s==="signin"&&jsx(motion.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},exit:{opacity:0,x:10},transition:{duration:.2},className:"absolute inset-0",children:jsx(pt,{onSuccess:r,onFailed:o,signUpRedirect:()=>n("signup"),forgotPasswordRedirect:()=>n("forgot-password"),providers:i})},"signin"),s==="signup"&&jsx(motion.div,{initial:{opacity:0,x:10},animate:{opacity:1,x:0},exit:{opacity:0,x:-10},transition:{duration:.2},className:"absolute inset-0",children:jsx(ut,{onSuccess:l,onFailed:o,signInRedirect:()=>n("signin")})},"signup"),s==="forgot-password"&&jsx(motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.2},className:"absolute inset-0",children:jsx(ht,{onFailed:o,signInRedirect:()=>n("signin")})},"forgot-password")]})})]})})}var pa={0:"...",1:"...",2:"...",3:"...",4:"..."},ma={human:{gradient:"linear-gradient(135deg, #7F77DD, #AFA9EC)",orbBg:"#EEEDFE",orbText:"#534AB7",pillBg:"#EEEDFE",pillText:"#3C3489",pillBorder:"#AFA9EC",capBg:"#EEEDFE",capText:"#534AB7",capBorder:"#AFA9EC"},service:{gradient:"linear-gradient(135deg, #1D9E75, #5DCAA5)",orbBg:"#E1F5EE",orbText:"#0F6E56",pillBg:"#E1F5EE",pillText:"#085041",pillBorder:"#5DCAA5",capBg:"#E1F5EE",capText:"#0F6E56",capBorder:"#5DCAA5"},machine:{gradient:"linear-gradient(135deg, #BA7517, #EF9F27)",orbBg:"#FAEEDA",orbText:"#854F0B",pillBg:"#FAEEDA",pillText:"#412402",pillBorder:"#EF9F27",capBg:"#FAEEDA",capText:"#854F0B",capBorder:"#EF9F27"}};function ua({value:e}){let[r,t]=useState(false);return jsx("button",{onClick:()=>{!e||e==="\u2014"||navigator.clipboard.writeText(e).then(()=>{t(true),setTimeout(()=>t(false),2e3);});},"aria-label":"Copiar valor",className:"opacity-0 group-hover:opacity-100 transition-all duration-150 p-1.5 rounded-md hover:bg-muted text-muted-foreground hover:text-foreground",children:jsx(AnimatePresence,{mode:"wait",initial:false,children:r?jsx(motion.span,{initial:{scale:.7,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.7,opacity:0},transition:{duration:.15},children:jsx(Check,{className:"w-3.5 h-3.5 text-green-600"})},"check"):jsx(motion.span,{initial:{scale:.7,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.7,opacity:0},transition:{duration:.15},children:jsx(Copy,{className:"w-3.5 h-3.5"})},"copy")})})}function qe({icon:e,label:r,value:t}){let o=t||"\u2014";return jsxs("div",{className:"group flex items-center justify-between px-5 py-2.5 gap-3 rounded-md mx-1.5 hover:bg-muted/50 transition-colors",children:[jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[jsx(e,{className:"w-3.5 h-3.5 text-muted-foreground shrink-0"}),jsx("span",{className:"text-[11px] text-muted-foreground w-12 shrink-0",children:r}),jsx("span",{className:"text-[12px] font-mono text-foreground truncate",title:o,children:o})]}),jsx(ua,{value:o})]})}function fa({data:e}){let{sub:r,cred:t}=e,o=r.type??"human",a=ma[o],i=r.capabilities??[],s=i.map(n=>pa[n]??String(n));return jsxs(motion.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.3,ease:"easeOut"},className:"w-full rounded-2xl border border-border/60 overflow-hidden bg-card shadow-sm",children:[jsxs("div",{className:"px-5 pt-2.5 pb-3.5 border-b border-border/60",children:[jsx("p",{className:"text-base font-semibold text-foreground truncate",children:r.id??"unknown_actor"}),jsx("p",{className:"text-[12px] text-muted-foreground mb-2 truncate",children:r.email??"\u2014"}),jsxs("div",{className:"flex gap-1.5 flex-wrap",children:[jsx("span",{className:"text-[10px] font-medium uppercase tracking-wide px-2 py-0.5 rounded-full border",style:{background:a.pillBg,color:a.pillText,borderColor:a.pillBorder},children:o}),jsx("span",{className:"text-[10px] font-medium uppercase tracking-wide px-2 py-0.5 rounded-full border border-border bg-muted text-muted-foreground",children:t.type??"token"})]})]}),jsx("div",{className:"grid grid-cols-3 border-b border-border/60 divide-x divide-border/60",children:[{label:"Capabilities",value:i.length},{label:"Metadata",value:(r.metadata??[]).length},{label:"Project",value:r.project_id?.split("_")[1]?.slice(0,4)??"\u2014"}].map(n=>jsxs("div",{className:"py-3 text-center",children:[jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wide mb-0.5",children:n.label}),jsx("p",{className:"text-sm font-medium font-mono text-foreground",children:n.value})]},n.label))}),jsxs("div",{className:"py-1.5 border-b border-border/60",children:[jsx(qe,{icon:User,label:"sub id",value:r.id}),jsx(qe,{icon:FolderOpen,label:"project",value:r.project_id}),jsx(qe,{icon:Key,label:"cred id",value:t.id}),jsx(qe,{icon:Mail,label:"email",value:r.email})]}),s.length>0&&jsxs("div",{className:"px-5 py-3 border-b border-border/60",children:[jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wide mb-2",children:"Capabilities"}),jsx("div",{className:"flex flex-wrap gap-1.5",children:s.map(n=>jsx("span",{className:"text-[11px] font-mono px-2.5 py-1 rounded-full border",style:{background:a.capBg,color:a.capText,borderColor:a.capBorder},children:n},n))})]})]})}export{ii as AuthProvider,C as BasicInputField,Er as BasicLogoutButton,xr as Copyright,zt as ForgotPassword,ra as ModernAuth,ht as ModernForgotPassword,fa as ModernIntrospect,Fo as ModernResetPassword,Wo as ModernSetup,pt as ModernSignIn,ut as ModernSignUp,Ho as ModernVerifyEmail,qr as ResendVerifyEmail,Mr as ResetPassword,Lr as Sessions,gr as SignIn,vr as SignUp,Hr as VerifyEmail,w as useAuth};//# sourceMappingURL=react.js.map
3
3
  //# sourceMappingURL=react.js.map