@ciromaciel/auth-react 1.0.0

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/identitySwitch.js","../src/authSdk.js","../src/redirect.js","../src/authStore.js","../src/components/ImpersonationBanner.jsx","../src/AuthProvider.jsx","../src/Protect.jsx","../src/GuestOnly.jsx","../src/components/AuthCard.jsx","../src/components/SocialButtons.jsx","../src/components/Wordmark.jsx","../src/components/SignIn.jsx","../src/components/UserProfile.jsx","../src/components/UserInformation.jsx","../src/components/control/SignedIn.jsx","../src/components/control/SignedOut.jsx","../src/components/control/AuthLoading.jsx","../src/components/control/AuthLoaded.jsx","../src/components/unstyled/SignInButton.jsx","../src/components/unstyled/SignOutButton.jsx"],"sourcesContent":["/**\n * The identity switch — when the panel stops being one person and becomes\n * another in the middle of a live session.\n *\n * It happens in both directions of an impersonation: entering (the response\n * carries a `Set-Cookie` that changes who the server sees in that instant) and\n * leaving (by the button, by the clock, or because another tab ended it). In\n * every case the panel stays mounted for a short interval until the navigation\n * — and during that interval the mounted screens refetch holding the old\n * identity.\n *\n * The server answers those calls with 403 and 401, and it is right to: they are\n * another person's resources, or a session that stopped being valid. What is\n * wrong is SHOWING it — on screen it read as \"Acesso negado: Sem permissão para\n * esta organização\" in the middle of a switch that was working.\n *\n * The flag lives on `window` because whoever sets it (the SDK) and whoever reads\n * it (each panel's HTTP client) do not share a module. It is never turned off:\n * the whole page is replaced right after, and `window` dies with it.\n *\n * Exported by the package so any panel can mark its own switches — the Auth\n * panel marks the START of an impersonation, a moment only it knows about.\n */\n\nconst FLAG = '__riligarSwitchingIdentity'\n\n/**\n * The event that announces: the person behind this session changed.\n *\n * The SDK knows WHEN the identity switches, but not what each panel keeps — and\n * they all keep something account-shaped. The Auth panel persists the selected\n * organization, and it was that persistence surviving the reload that made the\n * panel ask for `/applications/<the operator's organization>` already as the\n * target. The server refused with 403, correctly, and the screen showed \"Acesso\n * negado\" AFTER the switch had finished — outside any transition window, which\n * is why silencing the interceptor never fixed it.\n *\n * Each panel listens and clears what is its own. The SDK needs to know no key,\n * and a new panel that persists something solves its own case without touching\n * this file.\n *\n * Fired by `markIdentitySwitching`, which every identity switch already goes\n * through — so a client of this package gets it by listening, with no call of\n * its own to make and no knowledge of when a switch happens.\n */\nexport const IDENTITY_CHANGED_EVENT = 'riligar:identity-changed'\n\n/**\n * Announces the switch, giving listeners a chance to clear before the reload.\n *\n * Synchronous on purpose: `dispatchEvent` only returns once every listener has\n * run, so the caller can reload on the next line knowing storage is already\n * clean.\n */\nexport function announceIdentityChange(detail) {\n try {\n window.dispatchEvent(new CustomEvent(IDENTITY_CHANGED_EVENT, { detail }))\n } catch {\n // No `window` (SSR, tests): there is no panel to notify.\n }\n}\n\n/**\n * Everything a panel remembers about an account, wiped on every switch.\n *\n * ALLOWLIST, NOT BLOCKLIST — and that is the whole point.\n *\n * The seven panels each persist something account-shaped, under names that\n * follow no single pattern: `organizations` (the selected company),\n * `hoster:pinned`, `rlg-payments-project-storage`,\n * `riligar_storage_active_tenant`, per-product API keys. Listing them would be\n * a blocklist, and a blocklist is wrong here in the way that hurts: a panel\n * that persists something new is silently left out, and the next person to open\n * that tab sees another account's data with nobody's name on it.\n *\n * So the rule is inverted. Everything goes, except the few keys that are about\n * the BROWSER rather than about the person — the session token, which the SDK\n * manages itself and rewrites on the next load, and per-device preferences that\n * carry no account data.\n *\n * Dropping the rest costs a refetch. Keeping it costs showing one person's data\n * under another person's name, which cannot be undone after it is on screen.\n */\nconst KEEP = new Set([\n // The SDK's own slot: cleared where it must be (ending an impersonation),\n // and rewritten from the shared cookie on the next load. Wiping it here too\n // would sign the operator out of a tab that only needed to forget the\n // target's lists.\n 'auth:token',\n // Cross-tab logout beacon. It is a timestamp, not account data, and clearing\n // it would break the very synchronisation this file exists to serve.\n 'auth:logout',\n // The switch beacon: a timestamp the sibling tabs listen for. Wiping it\n // would make the NEXT write look unchanged to the browser in some cases,\n // and the event that carries the switch would not fire.\n 'auth:identity-switched',\n])\n\nfunction dropStoredAccountState() {\n try {\n const doomed = []\n for (let i = 0; i < window.localStorage.length; i++) {\n const k = window.localStorage.key(i)\n if (k && !KEEP.has(k)) doomed.push(k)\n }\n for (const k of doomed) window.localStorage.removeItem(k)\n\n // `sessionStorage` too: it survives a reload in the same tab, which is\n // exactly the window this function exists to close.\n window.sessionStorage?.clear()\n } catch {\n // No storage (SSR, private window, blocked cookies): there is nothing\n // persisted to leak.\n }\n}\n\n/**\n * The beacon sibling tabs listen for.\n *\n * `storage` only fires in OTHER tabs of the same origin, and only when a value\n * actually changes — so a timestamp is what turns \"this tab switched identity\"\n * into an event the siblings receive. The SDK writes it, the SDK reads it\n * (`AuthProvider`), and every panel that mounts the provider follows along\n * without writing a line: that is what makes it work for our own seven panels\n * and for anyone else's app on the same footing.\n *\n * It cannot reach ANOTHER origin — no browser mechanism can. Those tabs catch up\n * through the poll, which asks the server on its own schedule.\n */\nconst SWITCH_BEACON = 'auth:identity-switched'\n\nexport function markIdentitySwitching() {\n try {\n window[FLAG] = true\n } catch {\n // No `window` (SSR, tests): there is no panel to notify.\n }\n\n try {\n // Written BEFORE the wipe below, because the wipe removes it again —\n // and it is the write itself, not the value, that the siblings hear.\n window.localStorage.setItem(SWITCH_BEACON, String(Date.now()))\n } catch {\n // No storage: the sibling tabs fall back to the poll.\n }\n // Applies to EVERY identity switch — entering and leaving an impersonation —\n // because in both directions everything remembered starts belonging to\n // another account.\n dropStoredAccountState()\n\n /*\n * Wiping storage is not enough on its own: a store that keeps its state in\n * MEMORY and only mirrors it to storage — every `zustand/persist` store is\n * one — survives the wipe untouched, and rewrites the old value on its next\n * `set()`. That is the whole bug this event exists for: the Auth panel's\n * selected organization stayed in memory across the switch, and the screen\n * asked for `/applications/<the target's organization>` as the operator,\n * which the server refused with 403 — correctly.\n *\n * Announced LAST, so a listener that reads storage sees it already clean.\n */\n announceIdentityChange({ reason: 'switch' })\n}\n\nexport function clearIdentitySwitching() {\n try {\n window[FLAG] = false\n } catch {\n // Same reasoning as above.\n }\n}\n\nexport function isIdentitySwitching() {\n try {\n return Boolean(window[FLAG])\n } catch {\n return false\n }\n}\n\n/**\n * Should a 401 sign the person out — or is it the expected 401 of a switch?\n *\n * Every panel's HTTP client reacts to a 401 by signing out. On the server that\n * `signOut` deletes EVERY session of the person's e-mail across all products\n * (one account, one e-mail, many application rows) — the right thing for a real\n * \"sign out everywhere\", and a catastrophe for a transient 401.\n *\n * Leaving an impersonation keeps the panel mounted for a moment while it\n * reloads, and calls already in flight carry the dying impersonation token. The\n * server answers 401, correctly. Acting on THAT 401 signed the operator out of\n * everything — the account came back for a second and was then wiped by its own\n * panel. Exiting from the Auth tab happened to dodge it; exiting from Functions,\n * Monitors or Hoster did not, which is why it looked panel-specific.\n *\n * Pure and exported so each panel shares one decision instead of three copies of\n * an inline `&& !isIdentitySwitching()`, and so a single test covers all of\n * them. Pass the flag in (do not read it here) to keep it testable without a\n * `window`.\n */\nexport function shouldSignOutOn401(switching) {\n return !switching\n}\n","import { markIdentitySwitching } from './identitySwitch.js'\n\n// The default this package resolves to when an integration does not pass a URL.\n// It ships inside the published bundle, so a stale value here fails on the\n// customer's machine, not on ours.\nlet API_BASE = 'https://auth.worker.myinfrastructure.click'\nlet API_KEY = null\nlet INTERNAL_MODE = false // Internal mode: no API key required (same-domain apps)\n\n// Permite configurar API key e modo interno externamente (chamado pelo AuthProvider)\nexport function configure({ apiKey, apiUrl, internal = false }) {\n if (apiKey) API_KEY = apiKey\n if (apiUrl) API_BASE = apiUrl.endsWith('/') ? apiUrl.slice(0, -1) : apiUrl\n INTERNAL_MODE = internal\n}\n\nexport const isInternal = () => INTERNAL_MODE\n\n/** A URL da API de autenticação em uso. É a origem confiável por definição. */\nexport const getApiUrl = () => API_BASE\n\n/** A chave onde o token de sessão é guardado. Exposta para quem precisa lê-lo. */\nexport const TOKEN_STORAGE_KEY = 'auth:token'\n\n// Cache para JWKS\nlet jwksCache = null\nlet jwksCacheExpiry = 0\n\n// helper fetch pré-configurado\nasync function api(route, opts = {}) {\n // Garante que a rota comece com /\n const cleanRoute = route.startsWith('/') ? route : `/${route}`\n\n // Constrói URL completa (API_BASE já teve trailing slash removido no configure)\n const url = `${API_BASE}${cleanRoute}`\n\n const token = getStoredToken()\n const headers = {\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n ...opts.headers,\n }\n\n // Adiciona Authorization header se tiver token\n if (token) {\n headers.Authorization = `Bearer ${token}`\n }\n\n // Adiciona API Key se configurada e não estiver em modo interno\n if (API_KEY && !INTERNAL_MODE) {\n headers['X-API-Key'] = API_KEY\n }\n\n const res = await fetch(url, {\n headers,\n credentials: 'include', // Required for sending session cookies\n ...opts,\n })\n\n // Converte JSON automaticamente e lança erro legível\n const data = res.status !== 204 ? await res.json().catch(() => ({})) : null\n\n if (!res.ok) {\n /*\n * O contrato: `{error: {code, message, details?}}`.\n *\n * `code` é o identificador estável — programe contra ele. `message` é\n * a frase para o humano e pode mudar de redação a qualquer momento.\n * `details` traz o que dá para agir (o limite estourado, o campo que\n * faltou), e vai no Error para quem trata sem precisar do corpo.\n */\n const payloadError = data?.error\n const failure = new Error(payloadError?.message || res.statusText)\n failure.res = res\n failure.data = data\n failure.status = res.status\n failure.code = payloadError?.code ?? null\n failure.details = payloadError?.details ?? null\n failure.retriable = Boolean(payloadError?.retriable)\n throw failure\n }\n return data\n}\n\n// Gerenciamento de token no localStorage\nfunction getStoredToken() {\n if (typeof window === 'undefined') return null\n return window.localStorage.getItem(TOKEN_STORAGE_KEY)\n}\n\n// Exportada: o store precisa DESCARTAR o token quando o servidor não\n// reconhece a sessão. Sem isso, um valor obsoleto sobrevive no localStorage e\n// o handoff do OAuth o envia no `#token=`, derrubando a autorização.\nexport function setStoredToken(token) {\n if (typeof window === 'undefined') return\n if (token) {\n window.localStorage.setItem(TOKEN_STORAGE_KEY, token)\n } else {\n window.localStorage.removeItem(TOKEN_STORAGE_KEY)\n }\n}\n// Helper para processar resposta de autenticação e salvar token\nfunction handleAuthResponse(result) {\n // Tenta encontrar o token em vários lugares possíveis\n const token = result.token || result.session?.token || result.session?.sessionToken\n\n if (token) {\n setStoredToken(token)\n }\n\n return result\n}\n// Busca JWKS do servidor\nasync function fetchJWKS() {\n const now = Date.now()\n if (jwksCache && now < jwksCacheExpiry) {\n return jwksCache\n }\n\n try {\n const response = await fetch(`${API_BASE}/.well-known/jwks.json`)\n const jwks = await response.json()\n jwksCache = jwks\n jwksCacheExpiry = now + 5 * 60 * 1000 // Cache por 5 minutos\n return jwks\n } catch (error) {\n console.error('Erro ao buscar JWKS:', error)\n return null\n }\n}\n\n// Decodifica JWT (apenas payload, sem verificação de assinatura)\nexport function decodeJWT(token) {\n try {\n const parts = token.split('.')\n if (parts.length !== 3) return null\n\n // Safe base64 decode\n const base64Url = parts[1]\n const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/')\n\n // Verifica ambiente para decodificar\n const jsonPayload = typeof window !== 'undefined' ? window.atob(base64) : Buffer.from(base64, 'base64').toString()\n\n return JSON.parse(jsonPayload)\n } catch {\n return null\n }\n}\n\n// Verifica se o token está expirado\nfunction isTokenExpired(token) {\n const payload = decodeJWT(token)\n\n // Se não for um JWT válido (payload null), assumimos que é um token opaco (session token)\n // Nesse caso, deixamos o servidor validar via 401\n if (!payload) return false\n\n if (!payload.exp) return false\n\n const now = Date.now()\n const exp = payload.exp * 1000\n const isExpired = now >= exp\n\n if (isExpired) {\n console.log('[AuthSDK] Token expired:', { now, exp, diff: exp - now })\n }\n\n return isExpired\n}\n\n// Verifica se o usuário está autenticado\nexport function isAuthenticated() {\n const token = getStoredToken()\n const valid = token && !isTokenExpired(token)\n return valid\n}\n\n// Obtém dados do usuário do token\nexport function getCurrentUser() {\n const token = getStoredToken()\n if (!token || isTokenExpired(token)) return null\n\n const payload = decodeJWT(token)\n return payload\n ? {\n id: payload.sub,\n email: payload.email,\n name: payload.name,\n ...payload,\n }\n : null\n}\n\n/*--- sign in: ask for the code, trade the code ----*/\n//\n// These are the only two calls that authenticate. There is no separate sign-up:\n// someone who never signed in and someone who already did walk exactly the same\n// path, and `requestCode`'s answer is the same in both cases — it does not tell\n// whether the email already had an account.\n\n/**\n * Asks for the sign-in code. The email goes out right away; the response does\n * not wait for it.\n *\n * @param {string} email\n * @param {{ name?: string }} [options] Name used only if the account is created now.\n * @returns {Promise<{ sent: boolean, expiresIn: number, interval: number, deviceCode: string }>}\n */\nexport const requestCode = async (email, { name } = {}) => {\n return await api('/auth/code/start', {\n method: 'POST',\n body: JSON.stringify({ email, ...(name ? { name } : {}) }),\n })\n}\n\n/**\n * Trades the code for the session. This is the whole sign-in.\n *\n * @param {string} email The same email that asked for the code.\n * @param {string} code As the person typed it — case, spaces and the hyphen are optional.\n * @returns {Promise<{ user: object, token: string, session: object }>}\n */\nexport const verifyCode = async (email, code) => {\n const result = await api('/auth/code/verify', {\n method: 'POST',\n body: JSON.stringify({ email, code }),\n })\n\n return handleAuthResponse(result)\n}\n\n/**\n * Variant for whoever CANNOT read the email — an agent waiting for someone else\n * to present the code. Returns `{ pending: true, interval }` while nobody has\n * approved; in the browser, use `verifyCode`.\n *\n * @param {string} deviceCode The value returned by `requestCode`.\n */\nexport const pollCode = async deviceCode => {\n try {\n const result = await api('/auth/code/poll', {\n method: 'POST',\n body: JSON.stringify({ deviceCode }),\n })\n return handleAuthResponse(result)\n } catch (error) {\n // 428/429 are not failures: they mean \"not yet\" and \"slow down\".\n // Whoever polls needs to tell those apart from a dead code, which is a\n // real error.\n if (error?.status === 428 || error?.status === 429) {\n return { pending: true, interval: error?.details?.interval ?? 5 }\n }\n throw error\n }\n}\n\nexport const signOut = async () => {\n try {\n await api('/auth/sign-out', { method: 'POST' })\n } catch {\n // Ignores sign-out errors on the server\n } finally {\n setStoredToken(null)\n }\n}\n\nexport const refreshToken = async () => {\n try {\n const result = await api('/auth/refresh', { method: 'POST' })\n return handleAuthResponse(result)\n } catch (error) {\n setStoredToken(null)\n throw error\n }\n}\n\n/*--- Impersonation ------------------------------*/\n/*\n * Encerra a impersonação em curso.\n *\n * Não manda token nem id de sessão: o cookie de impersonação viaja sozinho\n * (`credentials: 'include'`) e é ele que autoriza. Quem está dentro da\n * impersonação é, por definição, quem pode fechá-la.\n *\n * O servidor responde limpando o cookie; depois disso o painel volta a ser o\n * operador sozinho, e um reload basta para a tela acompanhar.\n */\nexport const endImpersonation = async impersonationId => api(`/impersonation/${impersonationId}/end`, { method: 'POST' })\n\n/*--- Session ------------------------------------*/\n// O cookie `riligar.session_token` é compartilhado por `.myinfrastructure.click`, então\n// um painel recém-aberto autentica aqui SEM ter nada no localStorage (que é\n// isolado por origem). Nesse caso semeamos o token local a partir da resposta:\n// `isAuthenticated()` e o refresh em background leem do localStorage, e sem\n// isto o painel ficaria autenticado no servidor mas \"deslogado\" no cliente —\n// e o token venceria sem nunca ser renovado naquela origem.\n// A gravação é INCONDICIONAL, e não só quando o slot está vazio. A chave é\n// fixa por origem, então um token de sessão já encerrada sobrevive a logout,\n// troca de conta e expiração — e `if (!getStoredToken())` nunca o substituía.\n// O servidor acabou de dizer qual é a sessão desta requisição; ele é a\n// autoridade, e o valor local que discorda dele é resíduo.\n//\n// Importa além do painel: o handoff do OAuth lê ESTE valor para montar o\n// `#token=`, então um resíduo aqui derruba a autorização inteira com\n// \"Sessão inválida ou expirada\", num ponto que não aponta para a causa.\nexport const getSession = async () => {\n const result = await api('/auth/session')\n\n const token = result?.token || result?.session?.token\n if (token && token !== getStoredToken()) setStoredToken(token)\n\n return result\n}\n\nexport const listSessions = async () => {\n // As SESSÕES, não o envelope: a assinatura sempre devolveu a lista, e é a\n // ergonomia certa para quem só quer renderizá-las.\n const body = await api('/auth/list-sessions')\n return Array.isArray(body?.items) ? body.items : []\n}\n\nexport const revokeSession = async id => {\n return await api('/auth/revoke-session-by-id', {\n method: 'POST',\n body: JSON.stringify({ id }),\n })\n}\n\nexport const revokeOtherSessions = async () => {\n return await api('/auth/revoke-other-sessions', {\n method: 'POST',\n })\n}\n\n/*--- Application Info ----------------------------*/\nexport const getApplicationInfo = async () => {\n try {\n // O recurso vem na RAIZ.\n return (await api('/application/by-api-key')) || null\n } catch (error) {\n console.warn('[AuthSDK] Failed to fetch application info:', error.message)\n return null\n }\n}\n\n/*--- Profile Management ---------------------------*/\nexport const updateProfile = async data => {\n return await api('/auth/update-user', {\n method: 'POST',\n body: JSON.stringify(data),\n })\n}\n\n/*--- Social sign-in -------------------------------------------------------*/\n\n/**\n * The providers this application has enabled.\n *\n * Public: it answers a screen where nobody is signed in yet. It carries only\n * `{ provider, name }` — never the client id, which identifies the owner's\n * project at Google.\n *\n * Returns `[]` on failure rather than throwing: a sign-in screen that cannot\n * reach this endpoint must still render the email field, which is the path that\n * always works.\n */\nexport const getSocialProviders = async () => {\n try {\n const response = await api('/auth/providers')\n return response?.items || []\n } catch (error) {\n console.warn('[AuthSDK] Failed to fetch social providers:', error.message)\n return []\n }\n}\n\n/**\n * Leaves for the provider.\n *\n * A full-page navigation, not `fetch`: the person has to SEE Google's consent\n * screen, and an XHR would be blocked by CORS anyway. The API key travels in the\n * query string because a redirect carries no headers — it is the public `pu_`,\n * which is already in the bundle.\n *\n * `redirect` is where to come back to; the worker validates it against the\n * application's allowlist BEFORE leaving, and stores the validated value. It\n * defaults to the current page.\n */\nexport const startSocialSignIn = (provider, { redirect } = {}) => {\n const destination = redirect || window.location.href.split('#')[0]\n const url = new URL(`${API_BASE}/auth/sign-in/${provider}`)\n url.searchParams.set('redirect', destination)\n if (API_KEY && !INTERNAL_MODE) url.searchParams.set('api_key', API_KEY)\n\n window.location.assign(url.toString())\n}\n\n/**\n * Reads the token the callback left in the fragment, and cleans the URL.\n *\n * The token comes back after `#` precisely so it never reaches a server, a log\n * or a `Referer`. Once read it is removed from the address bar with\n * `replaceState`, so a copied URL does not carry a live session.\n *\n * Returns the token when there was one, `null` otherwise.\n */\nexport const consumeSocialToken = () => {\n if (typeof window === 'undefined' || !window.location.hash) return null\n\n const params = new URLSearchParams(window.location.hash.slice(1))\n const token = params.get('token')\n if (!token) return null\n\n /*\n * A social sign-in can land on a tab that already belongs to SOMEBODY ELSE.\n *\n * Coming back from Google replaces the session, and the person behind it may\n * not be the one who left: signing in with a Google account whose email has\n * no user here creates a NEW user, with an organization of its own.\n *\n * Swapping the token alone is not enough. Every panel keeps account-shaped\n * state — the Auth panel persists the selected organization — and a\n * `zustand/persist` store holds it in MEMORY, where clearing storage does\n * not reach. The stale organization then rides the NEW token into the next\n * request, and the server answers 403 \"Sem permissão para esta organização\"\n * — correctly, about a switch that actually worked.\n *\n * That is the exact failure `markIdentitySwitching` exists for, and which\n * impersonation already routes through. Social sign-in is one more identity\n * switch and has to go through it too.\n *\n * Compared by `sub`, not by token string: a refresh rotates the token for\n * the SAME person, and treating that as a switch would wipe their panel\n * state for nothing.\n */\n const previous = getStoredToken()\n if (previous && previous !== token) {\n const before = decodeJWT(previous)?.sub\n const after = decodeJWT(token)?.sub\n // Only when we can read both and they disagree. An unreadable token is\n // not evidence of a switch, and guessing here would clear state on a\n // malformed value.\n if (before && after && before !== after) markIdentitySwitching()\n }\n\n setStoredToken(token)\n\n params.delete('token')\n const rest = params.toString()\n window.history.replaceState(null, '', `${window.location.pathname}${window.location.search}${rest ? `#${rest}` : ''}`)\n\n return token\n}\n\n/**\n * The failure the callback reported, if any. Also clears it from the URL.\n *\n * The worker sends a short opaque code — never the provider's own error text,\n * which echoes back parts of our request. Phrasing lives here, next to the other\n * user-facing strings.\n */\nexport const consumeSocialError = () => {\n if (typeof window === 'undefined') return null\n\n const params = new URLSearchParams(window.location.search)\n const reason = params.get('social_error')\n if (!reason) return null\n\n params.delete('social_error')\n const rest = params.toString()\n window.history.replaceState(null, '', `${window.location.pathname}${rest ? `?${rest}` : ''}${window.location.hash}`)\n\n return reason\n}\n\n/** Starts linking a provider to the account of the CURRENT session. */\nexport const startSocialLink = async (provider, { redirect } = {}) => {\n const destination = redirect || window.location.href.split('#')[0]\n const response = await api(`/auth/link/${provider}`, { method: 'POST', body: JSON.stringify({ redirect: destination }) })\n if (response?.authorizeUrl) window.location.assign(response.authorizeUrl)\n return response\n}\n\nexport const unlinkSocialProvider = async provider => {\n return await api(`/auth/unlink/${provider}`, { method: 'POST' })\n}\n\n/** The providers linked to the current session's user. */\nexport const getLinkedProviders = async () => {\n const response = await api('/auth/linked-providers')\n return response?.items || []\n}\n","// ============================================================================\n// REDIRECT PÓS-LOGIN\n// ============================================================================\n//\n// Quem inicia um fluxo OAuth (o servidor MCP, por exemplo) manda o usuário ao\n// painel com `?redirect=` apontando de volta. Sem tratar esse parâmetro, o\n// login termina na home do painel e a autorização fica órfã.\n//\n// A lógica vive aqui, e não em cada aplicação, porque ela tem duas armadilhas\n// que não se quer reimplementar três vezes:\n//\n// 1. `redirect` sem allowlist transforma a tela de login em open redirect —\n// um link `?redirect=https://phishing.example` levaria o usuário para lá\n// logo após ele digitar a senha, num domínio que ele confia.\n//\n// 2. O token vive em `localStorage`, que é isolado POR ORIGEM. O worker do\n// Auth (auth.worker.*) não consegue lê-lo do painel (produto.dashboard.*),\n// então ele precisa ser entregue — e o fragmento (`#token=`) é o único\n// canal que não chega ao servidor nem entra em log de acesso.\n// ============================================================================\n\nimport { getApiUrl, TOKEN_STORAGE_KEY } from './authSdk'\n\n/**\n * Origens para as quais é seguro redirecionar após o login.\n *\n * A origem da própria API entra sempre: é para lá que o fluxo OAuth volta, e\n * o SDK já a conhece por `configure({ apiUrl })`. A origem atual também, por\n * ser a mesma página. `extraOrigins` cobre o resto (um site institucional que\n * inicie o login, por exemplo).\n */\nfunction allowedOrigins(extraOrigins = []) {\n const list = []\n\n try {\n list.push(new URL(getApiUrl()).origin)\n } catch {}\n\n if (typeof window !== 'undefined') list.push(window.location.origin)\n\n for (const raw of extraOrigins) {\n try {\n list.push(new URL(raw).origin)\n } catch {}\n }\n\n return list\n}\n\nconst isLocalhost = hostname => hostname === 'localhost' || hostname === '127.0.0.1'\n\n/**\n * Valida o `redirect` recebido e devolve o destino, ou `null`.\n *\n * Caminho interno (`/algo`) passa sempre — não sai do domínio. URL absoluta só\n * passa se a origem constar na allowlist e for HTTPS: aceitar `http://` num\n * host permitido exporia o token em trânsito.\n */\nexport function resolveRedirect(raw, extraOrigins = []) {\n if (!raw || typeof raw !== 'string') return null\n\n // `//` seria protocol-relative, que sai do domínio apesar de parecer path.\n if (raw.startsWith('/') && !raw.startsWith('//')) return raw\n\n let url\n try {\n url = new URL(raw)\n } catch {\n return null\n }\n\n // Localhost passa em desenvolvimento: o destino é a máquina do próprio\n // usuário, não um servidor de terceiro.\n if (isLocalhost(url.hostname)) return raw\n\n if (url.protocol !== 'https:') return null\n return allowedOrigins(extraOrigins).includes(url.origin) ? raw : null\n}\n\n/**\n * Executa o redirect pós-login.\n *\n * Devolve `true` quando assumiu a navegação — o chamador então não deve\n * navegar por conta própria. `false` significa \"não havia redirect válido,\n * siga o seu fluxo normal\".\n *\n * @param {string|null} target destino já validado por `resolveRedirect`\n * @param {(path: string) => void} navigate roteador da aplicação, para paths internos\n * @param {boolean} withToken anexar o token no fragmento (necessário quando o\n * destino é outra origem que precisa da sessão, como o handoff do OAuth)\n */\nexport function applyRedirect(target, navigate, { withToken = true } = {}) {\n if (!target) return false\n\n // Caminho interno: o roteador resolve, sem recarregar a página.\n if (target.startsWith('/')) {\n navigate?.(target, { replace: true })\n return true\n }\n\n if (typeof window === 'undefined') return false\n\n let finalUrl = target\n if (withToken) {\n const token = window.localStorage.getItem(TOKEN_STORAGE_KEY)\n // O fragmento nunca é enviado ao servidor: não aparece em log de\n // acesso nem no Referer. É o canal certo para um token.\n if (token) finalUrl = `${target}#token=${encodeURIComponent(token)}`\n }\n\n window.location.replace(finalUrl)\n return true\n}\n\n/**\n * Vai para o destino fixo do app depois de um callback (magic link, verificação\n * de e-mail).\n *\n * Caminho interno vai pelo ROTEADOR, não por `window.location`. Trocar o\n * `location` recarrega o documento inteiro: o React remonta, o `AuthProvider`\n * refaz `/auth/session`, e quem acabou de entrar vê o painel montar duas vezes.\n * Como o painel normalmente também navega no `onSuccess`, o efeito era o\n * primeiro destino aparecer e ~2s depois a página \"dar refresh\" sozinha.\n *\n * URL absoluta continua trocando o `location`: é outra origem, e o roteador\n * desta aplicação não a alcança.\n *\n * @param {string} target destino (`/algo` ou URL absoluta)\n * @param {(path: string, opts?: object) => void} navigate roteador da aplicação\n */\nexport function goToAppDestination(target, navigate) {\n if (!target || typeof window === 'undefined') return\n\n if (target.startsWith('/') && !target.startsWith('//') && navigate) {\n navigate(target, { replace: true })\n return\n }\n\n window.location.href = target\n}\n\n/**\n * Lê o `redirect` da URL atual, valida e devolve o destino (ou `null`).\n *\n * Atalho para o caso comum: o componente não precisa mexer em `URLSearchParams`\n * nem lembrar o nome do parâmetro.\n */\nexport function getRedirectFromLocation(extraOrigins = [], paramName = 'redirect') {\n if (typeof window === 'undefined') return null\n const raw = new URLSearchParams(window.location.search).get(paramName)\n return resolveRedirect(raw, extraOrigins)\n}\n","import { create } from 'zustand'\nimport * as api from './authSdk.js'\nimport { markIdentitySwitching } from './identitySwitch.js'\n\n// Shortest gap between two focus-driven session reads.\nconst REVALIDATE_THROTTLE_MS = 5000\n\n// Estado: { user, loading, error }\nexport const useAuthStore = create((set, get) => ({\n user: null,\n loading: true,\n error: null,\n\n // Timestamp of the last focus revalidation, for throttling.\n lastRevalidatedAt: 0,\n\n // Session management\n sessions: [],\n currentSession: null,\n\n // Loading states granulares\n loadingStates: {\n requestCode: false,\n verifyCode: false,\n signOut: false,\n updateProfile: false,\n listSessions: false,\n revokeSession: null, // null or sessionId being revoked\n },\n\n // Application info (logo, nome, etc)\n applicationInfo: null,\n\n /*\n * Preenchido quando ESTA sessão é emprestada — `/auth/session` devolve\n * `{ actor, expiresAt }`. É o que a barra lê para avisar, em qualquer painel,\n * que quem está logado não é quem está olhando.\n */\n impersonation: null,\n\n // Helper para atualizar loading states\n setLoading: (key, value) =>\n set(state => ({\n loadingStates: { ...state.loadingStates, [key]: value },\n })),\n\n // Buscar informações da aplicação\n fetchApplicationInfo: async () => {\n try {\n const appInfo = await api.getApplicationInfo()\n set({ applicationInfo: appInfo })\n } catch (error) {\n console.warn('[AuthStore] Failed to fetch application info:', error)\n set({ applicationInfo: null })\n }\n },\n\n /*\n * Reads the session from the server and mirrors it into the store.\n *\n * Shared by `init` (on mount) and `revalidate` (on focus). `trusted` says\n * whether a failure is allowed to sign the user out: on mount there is\n * nothing to lose, but on a revalidation the user is already signed in and\n * a flaky network must not drop them.\n */\n syncSession: async ({ trusted }) => {\n try {\n // Busca a sessão (que agora também traz applicationInfo)\n const sessionData = await api.getSession()\n\n // Se veio aplicação no redirecionamento/sessão, salva no store\n if (sessionData?.application) {\n set({ applicationInfo: sessionData.application })\n }\n\n // `?? null` e não `|| undefined`: a ausência do campo é a resposta\n // normal (ninguém impersonando) e tem que LIMPAR o estado anterior,\n // senão a barra sobrevive ao encerramento.\n set({ impersonation: sessionData?.impersonation ?? null })\n\n const user = sessionData?.user ?? null\n if (sessionData?.session) {\n set({ currentSession: sessionData.session })\n }\n\n // Se não encontrou sessão via cookies, verifica localStorage token (JWT)\n //\n // `isAuthenticated()` só confere o `exp` do JWT — não fala com o\n // servidor. Uma sessão revogada tem `exp` no futuro e passaria por\n // aqui: o painel se mostraria logado com um token que o servidor já\n // não reconhece. Como o handoff do OAuth envia ESTE token no\n // `#token=`, o resíduo derrubava a autorização com \"Sessão inválida\n // ou expirada\" — longe da causa.\n //\n // O servidor acabou de responder sem sessão; ele é a autoridade.\n if (!user) {\n /*\n * \"No user\" WITH a stored token is not a logout — it is a token\n * that stopped being valid. The right answer is to ask again,\n * without it.\n *\n * This is the path of whoever ended the impersonation in ANOTHER\n * tab. `/auth/session` with a dead token answers 200 and WITHOUT\n * a user (not 401: a session that does not exist is the normal\n * \"nobody signed in\" path). This branch then concluded \"logged\n * out\" and stopped there — while the operator's session was\n * alive in the cookie, shared across the zone and never touched.\n *\n * The retry goes without `Authorization`, the cookie speaks, and\n * the operator becomes themselves again. One attempt only: if\n * this one also comes back without a user, there is no session\n * behind it and logging out is correct.\n */\n if (api.isAuthenticated()) {\n api.setStoredToken(null)\n\n const semToken = await api.getSession().catch(() => null)\n if (semToken?.user) {\n const anterior = get().user\n const trocou = anterior && anterior.id !== semToken.user.id\n\n set({\n user: semToken.user,\n currentSession: semToken.session ?? null,\n impersonation: semToken.impersonation ?? null,\n loading: false,\n })\n\n if (trocou && typeof window !== 'undefined') {\n markIdentitySwitching()\n window.location.reload()\n }\n return\n }\n }\n\n set({ user: null, currentSession: null, impersonation: null, loading: false })\n return\n }\n\n /*\n * THE IDENTITY CHANGED UNDER THE SCREEN: drop everything and reload.\n *\n * This is the guard that makes the server the single truth. The\n * seven panels hold data in memory and in their own stores —\n * projects, lists, counters — and none of them knows when the person\n * behind the session stopped being the same one.\n *\n * It happens for real when an impersonation is ended in ANOTHER tab:\n * `localStorage` is per origin, so Hoster never learns that Functions\n * ended it. On the next focus it revalidates, the server answers with\n * the operator — and the screen was left with one person's footer and\n * another's list, two people's data at once.\n *\n * Swapping `user` in the store would not be enough: whoever already\n * read the list does not read it again. Reloading is the only way to\n * guarantee that NOTHING of the previous identity survives — and it\n * is cheap, because it only happens on the transition.\n *\n * `previous` comes from the state, not from a module variable: under\n * SSR and in tests the module is shared, and the comparison has to be\n * per store.\n */\n const previous = get().user\n const identityChanged = previous && previous.id !== user.id\n\n if (identityChanged && typeof window !== 'undefined') {\n /*\n * Mark the switch BEFORE reloading.\n *\n * The reload is not instantaneous: in-flight calls finish, and\n * mounted screens still fire their own. All of them carry the old\n * identity and get 403 — which surfaced as \"Acesso negado: Sem\n * permissão para esta organização\" in the middle of a switch that\n * was working.\n *\n * This guard reloaded without marking, and was the last place the\n * notification escaped through.\n */\n markIdentitySwitching()\n set({ user, loading: false })\n window.location.reload()\n return\n }\n\n set({ user, loading: false })\n } catch (error) {\n // Só descartamos o token quando o SERVIDOR o recusou (401). Uma\n // falha de rede não diz nada sobre a validade da sessão, e limpar\n // aqui deslogaria quem só perdeu conexão por um instante.\n const rejected = error?.res?.status === 401\n\n /*\n * Token refused: drop it AND ASK AGAIN, without it.\n *\n * Clearing alone was not enough, and that is what made the operator\n * lose their account when ending an impersonation in ANOTHER tab.\n * `localStorage` is per origin: ending in Functions does not remove\n * the target's token stored in Hoster and Auth. Coming back to that\n * tab, it revalidated with a dead token, took a 401, cleared it — and\n * stopped there, concluding \"logged out\".\n *\n * But the operator's session is alive in the cookie, shared across\n * the zone and never touched. The second attempt goes without\n * `Authorization`, the cookie speaks, and they become themselves\n * again — which is what the person expected when ending it in any of\n * the tabs.\n *\n * One attempt only: if this one fails too, there is no session\n * behind it, and the path below (logging out) is correct.\n */\n if (rejected) {\n api.setStoredToken(null)\n try {\n const semToken = await api.getSession()\n if (semToken?.user) {\n /*\n * This path ALSO swaps the identity on screen.\n *\n * It is the one taken when the impersonation is ended in\n * another tab: the target's token is refused, the cookie\n * returns the operator — but the screen stays mounted\n * with the target's lists, which nobody will re-read.\n *\n * Same guard as the ordinary revalidation: mark the\n * switch to silence the in-flight 403s, and reload so\n * nothing of the previous identity survives.\n */\n const anterior = get().user\n const trocou = anterior && anterior.id !== semToken.user.id\n\n set({\n user: semToken.user,\n currentSession: semToken.session ?? null,\n impersonation: semToken.impersonation ?? null,\n loading: false,\n })\n\n if (trocou && typeof window !== 'undefined') {\n markIdentitySwitching()\n window.location.reload()\n }\n return\n }\n } catch {\n // Sem sessão atrás do token morto: segue para o caminho\n // normal e desloga, que é o comportamento correto.\n }\n }\n\n // An unreachable server says nothing about an established session.\n // On a revalidation the user is already signed in: keep them, and\n // try again on the next focus.\n if (!rejected && !trusted) {\n console.warn('[AuthStore] Revalidação falhou, mantendo a sessão:', error)\n return\n }\n\n console.error('Erro na inicialização:', error)\n set({ user: null, currentSession: null, loading: false })\n }\n },\n\n /* Init ao montar o Provider */\n init: async () => {\n await get().syncSession({ trusted: true })\n },\n\n /*\n * Re-reads the session when the tab regains focus.\n *\n * `init` runs once, so a tab opened BEFORE the user signed in elsewhere\n * stays on `user: null` until a manual refresh. The session cookie is\n * shared across the zone, and localStorage is not — it is per origin — so\n * the `storage` event never crosses between two dashboards. Asking the\n * server on focus is what carries a sign-in (and a sign-out) between them.\n *\n * Throttled: `focus` and `visibilitychange` fire together, and alt-tabbing\n * would otherwise turn into a burst of `/auth/session` calls.\n */\n revalidate: async ({ force = false } = {}) => {\n const now = Date.now()\n // `force` skips the floor between reads: a caller on its own interval\n // (the impersonation poll) already controls the frequency, and the floor\n // exists for focus, which fires several times in a row when windows\n // change.\n if (!force && now - get().lastRevalidatedAt < REVALIDATE_THROTTLE_MS) return\n set({ lastRevalidatedAt: now })\n await get().syncSession({ trusted: false })\n },\n\n /* Ações de Autenticação */\n /* Sign in — ask for the code and trade it for the session. No third step. */\n\n requestCode: async (email, options) => {\n const { setLoading } = get()\n setLoading('requestCode', true)\n set({ error: null })\n\n try {\n return await api.requestCode(email, options)\n } catch (err) {\n set({ error: err })\n throw err\n } finally {\n setLoading('requestCode', false)\n }\n },\n\n verifyCode: async (email, code) => {\n const { setLoading } = get()\n setLoading('verifyCode', true)\n set({ error: null })\n\n try {\n const result = await api.verifyCode(email, code)\n\n // The session comes with the response; without it the \"this device\"\n // badge cannot identify the current session.\n if (result.session) set({ currentSession: result.session })\n\n set({ user: result.user || null, loading: false })\n return result\n } catch (err) {\n set({ error: err })\n throw err\n } finally {\n setLoading('verifyCode', false)\n }\n },\n\n signOut: async () => {\n const { setLoading } = get()\n setLoading('signOut', true)\n\n try {\n await api.signOut()\n set({ user: null })\n // Sincronizar logout entre abas\n if (typeof window !== 'undefined') {\n window.localStorage.setItem('auth:logout', Date.now())\n }\n } finally {\n setLoading('signOut', false)\n }\n },\n\n /* Session */\n getSession: async () => {\n try {\n const sessionData = await api.getSession()\n // Store current session for comparison (includes id)\n if (sessionData?.session) {\n set({ currentSession: sessionData.session })\n }\n return sessionData\n } catch (err) {\n set({ error: err })\n throw err\n }\n },\n\n listSessions: async () => {\n const { setLoading } = get()\n setLoading('listSessions', true)\n set({ error: null })\n\n try {\n const result = await api.listSessions()\n set({ sessions: result || [] })\n setLoading('listSessions', false)\n return result\n } catch (err) {\n set({ error: err, sessions: [] })\n setLoading('listSessions', false)\n throw err\n }\n },\n\n revokeSession: async sessionId => {\n const { setLoading, currentSession, sessions, signOut } = get()\n setLoading('revokeSession', sessionId)\n set({ error: null })\n\n try {\n // Detect if current session OR last remaining session\n const isCurrent = sessionId === currentSession?.id\n const isLast = sessions.length === 1 && sessions[0].id === sessionId\n\n // Se for a sessão atual ou a última, faz logout normal\n if (isCurrent || isLast) {\n await signOut()\n // signOut já limpa loading states e erros no finally, mas\n // como estamos dentro do fluxo deste método, garantimos:\n setLoading('revokeSession', null)\n return\n }\n\n await api.revokeSession(sessionId)\n\n // Remove a sessão revogada da lista local\n set(state => ({\n sessions: state.sessions.filter(s => s.id !== sessionId),\n }))\n\n setLoading('revokeSession', null)\n } catch (err) {\n set({ error: err })\n setLoading('revokeSession', null)\n throw err\n }\n },\n\n revokeOtherSessions: async () => {\n const { setLoading, listSessions } = get()\n setLoading('revokeSession', 'all')\n set({ error: null })\n\n try {\n await api.revokeOtherSessions()\n // Refresh sessions list after revocation\n await listSessions()\n setLoading('revokeSession', null)\n } catch (err) {\n set({ error: err })\n setLoading('revokeSession', null)\n throw err\n }\n },\n\n /* Refresh do token em background */\n startRefresh: () => {\n if (typeof window === 'undefined') return\n\n const refreshInterval = setInterval(\n async () => {\n try {\n // Se o usuário está autenticado mas o token está próximo do vencimento\n if (api.isAuthenticated()) {\n const token = window.localStorage.getItem('auth:token')\n if (token) {\n // Usa o decoder oficial do SDK que é mais seguro\n const payload = api.decodeJWT(token)\n\n // Se não for um JWT ou não tiver expiração, não fazemos refresh em background\n // O backend cuidará da expiração da sessão opaca via 401 nas requisições normais\n if (!payload || !payload.exp) return\n\n const now = Date.now() / 1000\n const timeUntilExpiry = payload.exp - now\n\n // Se o token expira em menos de 5 minutos, tenta o refresh\n if (timeUntilExpiry < 300) {\n try {\n const refreshed = await api.refreshToken()\n const user = api.getCurrentUser()\n set({ user })\n // O refresh rotaciona o token mantendo o mesmo id de sessão.\n if (refreshed?.session) set({ currentSession: refreshed.session })\n } catch (refreshErr) {\n console.warn('[AuthStore] Falha ao renovar token:', refreshErr)\n // Só desloga se for um erro de autenticação explícito (401)\n if (refreshErr.res?.status === 401) {\n set({ user: null })\n window.localStorage.removeItem('auth:token')\n }\n }\n }\n }\n }\n } catch (error) {\n // Erros de processamento interno não devem deslogar o usuário\n console.error('[AuthStore] Erro no ciclo de refresh automático:', error)\n }\n },\n 4 * 60 * 1000\n ) // Verifica a cada 4 minutos\n\n // Limpa o intervalo quando necessário\n if (typeof window !== 'undefined') {\n window.addEventListener('beforeunload', () => {\n clearInterval(refreshInterval)\n })\n }\n },\n\n /* Verifica se o token ainda é válido */\n checkTokenValidity: () => {\n if (!api.isAuthenticated()) {\n set({ user: null })\n return false\n }\n return true\n },\n\n /* Atualizar usuário manualmente */\n setUser: user => set({ user }),\n\n /* Profile Management */\n updateProfile: async data => {\n const { setLoading } = get()\n setLoading('updateProfile', true)\n set({ error: null })\n\n try {\n const result = await api.updateProfile(data)\n // Atualiza o user no store com os novos dados\n set(state => ({\n user: state.user ? { ...state.user, ...data } : null,\n }))\n setLoading('updateProfile', false)\n return result\n } catch (err) {\n set({ error: err })\n setLoading('updateProfile', false)\n throw err\n }\n },\n}))\n","import { useCallback, useEffect, useState } from 'react'\nimport { useAuthStore } from '../authStore.js'\nimport { endImpersonation, setStoredToken } from '../authSdk.js'\nimport { markIdentitySwitching } from '../identitySwitch.js'\n\n/*\n * The bar that says: whoever is signed in is not whoever is looking.\n *\n * It lives in the SDK, not in the dashboard-kit, for a simple reason: the SDK is\n * what knows the session is borrowed (`/auth/session` answers `impersonation`),\n * and it is what all seven panels already load because of Auth. In the kit the\n * bar would have to receive that state from outside — and every panel would wire\n * it by hand, which is exactly how one panel gets left out and nobody notices.\n *\n * The risk of this feature is not authorization; it is the operator FORGETTING\n * they are inside someone else's account. Hence a bar that is fixed, spans the\n * full width, and carries the countdown.\n *\n * INLINE STYLES, ON PURPOSE\n *\n * The SDK ships no CSS and does not depend on Mantine — the panels that consume\n * it have their own themes, and a `<link>` or a global class would collide with\n * them. These are few rules and they do not change with the theme: dark ink,\n * white text.\n *\n * It renders nothing when there is no impersonation, so it can sit at the top of\n * the app with no condition around it.\n */\n\nfunction remaining(expiresAt) {\n if (!expiresAt) return null\n const ms = new Date(expiresAt).getTime() - Date.now()\n if (ms <= 0) return null\n const totalSeconds = Math.floor(ms / 1000)\n return `${Math.floor(totalSeconds / 60)}:${String(totalSeconds % 60).padStart(2, '0')}`\n}\n\n/*\n * A FLOATING PILL, NOT A STRIP AT THE TOP — and this is a layout decision, not\n * a cosmetic one.\n *\n * The bar used to be `position: sticky; top: 0`, rendered just above the panel's\n * own tree. That takes vertical space in the document flow, and all seven panels\n * lay themselves out with Mantine's `AppShell`, which positions its Header and\n * Navbar at offsets it computes from its OWN props (`header={{ height }}`, and\n * that height is responsive — 56 on mobile, 0 on desktop in some panels). The\n * strip pushed that whole construction down: the panel's header ended up under\n * the bar, and the sidebar got clipped.\n *\n * The SDK cannot fix that by measuring: it would have to know each panel's\n * header height, at every breakpoint, and stay in sync with seven layouts it\n * does not own. Any number it picks is wrong somewhere.\n *\n * So the bar stops competing for the top of the page. `position: fixed` with\n * `inset: auto 0 20px` takes it out of the flow entirely — it reserves no\n * space, displaces nothing, and floats over the content at the BOTTOM, where no\n * panel puts a fixed header. The visibility that the feature depends on is\n * preserved: it is always on screen, centred, and impossible to scroll away\n * from. The risk this component exists to cover is the operator FORGETTING they\n * are inside someone else's account, and a floating pill answers that as well\n * as a strip did — without breaking the screen underneath.\n *\n * `pointerEvents` is handled in two layers: the full-width wrapper lets clicks\n * through (it spans the viewport and would otherwise swallow a row of the UI),\n * and the pill itself takes them back so the button stays clickable.\n */\nconst styles = {\n wrap: {\n position: 'fixed',\n left: 0,\n right: 0,\n bottom: 20,\n zIndex: 2147483647,\n display: 'flex',\n justifyContent: 'center',\n // The strip spans the viewport; without this it would eat clicks on\n // whatever sits behind it for the full width of the screen.\n pointerEvents: 'none',\n // Mobile: never let the pill run under the home indicator.\n paddingLeft: 'max(12px, env(safe-area-inset-left))',\n paddingRight: 'max(12px, env(safe-area-inset-right))',\n },\n bar: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n flexWrap: 'wrap',\n gap: 10,\n padding: '10px 16px',\n borderRadius: 999,\n // The brand's black. It stands out by INVERSION, not by an alert\n // colour: red would say \"something went wrong\", and the state is\n // \"you are borrowed\".\n background: '#11181C',\n color: '#FFFFFF',\n fontSize: 13,\n fontFamily: 'inherit',\n lineHeight: 1.4,\n maxWidth: '100%',\n // Detaches the pill from the content it floats over, which a flat strip\n // did not need because it had an edge to sit against.\n boxShadow: '0 8px 24px rgba(0, 0, 0, 0.28)',\n pointerEvents: 'auto',\n },\n strong: { fontWeight: 700 },\n clock: { fontVariantNumeric: 'tabular-nums', opacity: 0.75 },\n button: {\n marginLeft: 4,\n padding: '4px 12px',\n border: 0,\n borderRadius: 999,\n background: '#FFFFFF',\n color: '#11181C',\n font: 'inherit',\n fontSize: 12,\n fontWeight: 700,\n cursor: 'pointer',\n },\n}\n\nexport default function ImpersonationBanner() {\n const impersonation = useAuthStore(s => s.impersonation)\n const user = useAuthStore(s => s.user)\n const [left, setLeft] = useState(() => remaining(impersonation?.expiresAt))\n const [ending, setEnding] = useState(false)\n\n /*\n * Encerrar recarrega a página.\n *\n * The whole panel is already mounted with the target's data — lists,\n * stores, caches. Swapping the identity underneath would leave half the\n * screen with one person's data and half with another's. Reloading is the\n * simplest way to make everything come back coherent, and it happens once,\n * at the end of the session.\n */\n /*\n * O vencimento, sem clique.\n *\n * It does not call `/impersonation/:id/end`: the session is already gone,\n * and the route would answer 403 (\"belongs to another session\") because the\n * presented token died. What is left to do is local — drop the target's\n * token — and let the server say who the person is on the next load.\n *\n * The impersonation cookie needs no explicit clearing: it was issued with a\n * `Max-Age` equal to the session TTL, so the browser discards it on its own.\n * And even if it lingered a moment, `requireAuth` tries the candidates in\n * order and falls through to the operator's session.\n */\n const endedByTimer = useCallback(() => {\n markIdentitySwitching()\n setStoredToken(null)\n window.location.assign('/')\n }, [])\n\n const handleEnd = async () => {\n if (!impersonation?.id) return\n setEnding(true)\n markIdentitySwitching()\n try {\n await endImpersonation(impersonation.id)\n\n /*\n * The TARGET's token is in localStorage — the SDK wrote it there\n * so the other products would send the right header. Ending without\n * dropping it would leave the panel presenting itself as the target\n * in every product that reads that key, even with the cookie gone.\n *\n * The reload below asks for the session again, and the operator's\n * session cookie (never touched) rewrites the correct value.\n */\n setStoredToken(null)\n } catch {\n // If it fails, the session expires on its own within minutes.\n // Reloading anyway avoids leaving the operator stuck in a bar that\n // does not answer.\n }\n /*\n * Goes to the panel's ROOT, instead of reloading the current URL.\n *\n * The URL where an impersonation ends usually belongs to the TARGET — a\n * project of theirs in Hoster, an application of theirs in Auth.\n * Reloading there returns the operator to a route that may not be\n * theirs, and the screen answers 403 or sits in a skeleton forever.\n *\n * `/` is the home of every panel in the suite, and the only route that\n * answers for any identity. Each product decides what it means.\n */\n window.location.assign('/')\n }\n\n useEffect(() => {\n if (!impersonation) return\n\n const timer = setInterval(() => {\n const restante = remaining(impersonation.expiresAt)\n setLeft(restante)\n\n /*\n * Vencido: a tela tem que acompanhar, e sem ninguém clicar em nada.\n *\n * Until now the clock hit zero and nothing else happened: the bar\n * stayed on screen, `localStorage` kept the target's dead token, and\n * every product answered 401 — which panels read as the end of a\n * session and handle by signing out. The operator lost their own\n * account because a borrowed session expired.\n *\n * `endedByTimer` walks the same path as the button: drop the\n * target's token and go to the root. What decides who shows up next\n * is the SERVER — the operator's session cookie was never touched,\n * so if it is alive the home loads as them; if there is no session\n * behind it, `/auth/session` answers without a user and the panel\n * sends them to the login, which is correct. There is nothing to\n * guess here.\n */\n if (!restante) endedByTimer()\n }, 1000)\n\n return () => clearInterval(timer)\n }, [impersonation, endedByTimer])\n\n if (!impersonation) return null\n\n // Durante o primeiro segundo `left` ainda é o valor de outra impersonação\n // (ou nulo); derivar aqui evita um setState no corpo do efeito só para isso.\n const clock = left ?? remaining(impersonation.expiresAt)\n\n return (\n <div style={styles.wrap}>\n <div\n style={styles.bar}\n role=\"status\"\n >\n <span>\n Você está vendo como <span style={styles.strong}>{user?.name || user?.email}</span>\n {impersonation.actor ? <> · sessão aberta por {impersonation.actor}</> : null}\n </span>\n {clock ? <span style={styles.clock}>encerra em {clock}</span> : null}\n {impersonation.id ? (\n <button\n type=\"button\"\n style={styles.button}\n onClick={handleEnd}\n disabled={ending}\n >\n {ending ? 'Encerrando…' : 'Encerrar'}\n </button>\n ) : null}\n </div>\n </div>\n )\n}\n","import { createContext, useEffect, useMemo } from 'react'\nimport { useShallow } from 'zustand/react/shallow'\nimport { useAuthStore } from './authStore.js'\nimport { consumeSocialToken, configure } from './authSdk.js'\nimport ImpersonationBanner from './components/ImpersonationBanner.jsx'\nimport { markIdentitySwitching } from './identitySwitch.js'\n\nconst AuthContext = createContext() // só para ter o Provider em JSX\n\n// How often a tab asks the server who it is. Short enough for an identity\n// switch to surface on its own, long enough not to weigh on an idle panel.\nconst IMPERSONATION_POLL_MS = 10 * 1000\n\nexport function AuthProvider({\n children,\n apiKey, // API Key para header X-API-Key (obrigatória exceto em modo internal)\n apiUrl, // URL do manager (opcional, padrão: http://auth.worker.myinfrastructure.click)\n internal = false, // Modo interno: não exige API Key (para aplicações same-domain como dashboard)\n onError, // Callback de erro global\n}) {\n // Validação de props obrigatórias\n // apiKey só é obrigatória se não estiver em modo internal\n if (!internal && !apiKey) {\n throw new Error('[@ciromaciel/auth-react] apiKey é obrigatória no AuthProvider. ' + 'Obtenha sua API Key no dashboard em https://auth.dashboard.myinfrastructure.click')\n }\n\n const init = useAuthStore(s => s.init)\n const startRefresh = useAuthStore(s => s.startRefresh)\n const revalidate = useAuthStore(s => s.revalidate)\n const checkTokenValidity = useAuthStore(s => s.checkTokenValidity)\n\n // Configura SDK com apiKey, apiUrl e modo interno\n // Usamos useMemo para garantir que a configuração ocorra ANTES dos efeitos dos componentes filhos\n useMemo(() => {\n configure({ apiKey, apiUrl, internal })\n\n /*\n * A social sign-in landing here brings its token in the fragment.\n *\n * It is consumed in this `useMemo`, BEFORE `init()` runs in the effect\n * below: `init` reads the stored token to resolve the session, so a\n * token still sitting in the URL at that moment would be missed, and the\n * person would land signed out on the page they just signed into.\n *\n * Reading it also strips it from the address bar, so a copied URL never\n * carries a live session.\n */\n consumeSocialToken()\n }, [apiKey, apiUrl, internal])\n\n useEffect(() => {\n init()\n startRefresh()\n }, [init, startRefresh])\n\n // Sincronização entre abas - escuta logout e mudanças no token\n useEffect(() => {\n if (typeof window === 'undefined') return\n\n const handleStorageChange = event => {\n if (event.key === 'auth:logout') {\n // Limpa o user do store - a aplicação redireciona automaticamente quando user é null\n useAuthStore.setState({ user: null, currentSession: null, sessions: [] })\n }\n /*\n * Another tab of this origin switched identity.\n *\n * It clears its own storage and reloads, but each tab has its own\n * mounted screens — lists and counters that belong to whoever was\n * signed in a moment ago. Wiping here and reloading is what makes a\n * sibling tab follow along instead of showing the previous person's\n * data under the new person's name.\n *\n * This is the SDK's job, not each app's: every consumer of\n * `AuthProvider` gets it without writing anything, ours and our\n * customers' alike.\n */\n if (event.key === 'auth:identity-switched') {\n markIdentitySwitching()\n window.location.assign('/')\n return\n }\n\n // The token changed in another tab of THIS origin.\n //\n // `checkTokenValidity` only reads the stored JWT's `exp`, which\n // cannot tell a different person from the same one — and after an\n // impersonation starts or ends, a different person is exactly what\n // it is. Asking the server is what makes the sibling tab follow the\n // switch instead of sitting on the previous identity's data.\n //\n // `force` skips the focus throttle: this is an event, not a stream,\n // and a background tab may never get focus to catch up.\n if (event.key === 'auth:token') {\n revalidate({ force: true })\n }\n }\n\n // Escuta evento de sessão revogada (quando o usuário revoga sua própria sessão)\n const handleSessionRevoked = () => {\n // Limpa o usuário do store\n useAuthStore.setState({ user: null, currentSession: null, sessions: [] })\n // Dispara evento de logout para sincronizar entre abas\n localStorage.setItem('auth:logout', Date.now())\n }\n\n window.addEventListener('storage', handleStorageChange)\n window.addEventListener('auth:session-revoked', handleSessionRevoked)\n return () => {\n window.removeEventListener('storage', handleStorageChange)\n window.removeEventListener('auth:session-revoked', handleSessionRevoked)\n }\n }, [revalidate])\n\n // Revalidate the session when the tab regains focus.\n //\n // `init` runs once: a tab opened BEFORE the user signed in on another\n // dashboard stays on `user: null` until a manual refresh. The session\n // cookie belongs to the zone, but localStorage is per origin — so the\n // `storage` event never crosses from one dashboard to another. Asking the\n // server on focus is what carries a sign-in (and a sign-out) between them.\n useEffect(() => {\n if (typeof window === 'undefined') return\n\n const handleFocus = () => {\n if (document.visibilityState === 'visible') revalidate()\n }\n\n document.addEventListener('visibilitychange', handleFocus)\n window.addEventListener('focus', handleFocus)\n return () => {\n document.removeEventListener('visibilitychange', handleFocus)\n window.removeEventListener('focus', handleFocus)\n }\n }, [revalidate])\n\n // Verifica validade do token periodicamente\n useEffect(() => {\n if (typeof window === 'undefined') return\n\n const interval = setInterval(() => {\n checkTokenValidity()\n }, 30 * 1000) // Verifica a cada 30 segundos\n\n return () => clearInterval(interval)\n }, [checkTokenValidity])\n\n // Ask the server every so often — even with the tab in the background, and\n // WITHOUT depending on knowing an impersonation is open.\n //\n // `checkTokenValidity` above only reads the `exp` of the stored JWT, and a\n // target's token has an `exp` in the future: it stays \"valid\" after the\n // impersonation ended. Focus revalidation does not help a tab nobody\n // touched. That is what left Functions showing the target after ending\n // elsewhere: nothing in that tab had a reason to ask again.\n //\n // Gating this on `impersonation` was the obvious move and the wrong one: it\n // makes the recovery depend on the very state that goes stale. When the\n // store lost `impersonation` while still holding the target as `user` — the\n // bar disappeared and the data did not — the poll stopped with it, and the\n // tab had no way back at all.\n //\n // Unconditional, the tab always has a way back. One request every ten\n // seconds against a route that answers from the session is cheap; being\n // stuck as another person is not.\n useEffect(() => {\n if (typeof window === 'undefined') return\n const interval = setInterval(() => revalidate({ force: true }), IMPERSONATION_POLL_MS)\n return () => clearInterval(interval)\n }, [revalidate])\n\n // Contexto com onError callback\n const contextValue = useMemo(() => ({ onError }), [onError])\n\n /*\n * The impersonation bar ships WITH the Provider.\n *\n * That is what makes all seven panels warn without any of them being\n * changed: they all already wrap the app in `AuthProvider`. Letting each\n * panel mount it by hand is how one of them gets left out — and the panel\n * left out is precisely where the operator forgets whose account they are\n * in.\n *\n * It renders nothing when no impersonation is open, so it costs nothing in\n * the normal case.\n */\n return (\n <AuthContext.Provider value={contextValue}>\n <ImpersonationBanner />\n {children}\n </AuthContext.Provider>\n )\n}\n\n/* Hooks \"facade\" que a app vai usar */\nexport const useAuth = () =>\n useAuthStore(\n useShallow(s => ({\n user: s.user,\n loading: s.loading,\n error: s.error,\n isAuthenticated: s.user !== null,\n requestCode: s.requestCode,\n verifyCode: s.verifyCode,\n signOut: s.signOut,\n }))\n )\n\n/**\n * Sign in: the two steps, and nothing else.\n *\n * `requestCode(email, { name })` sends the code. `verifyCode(email, code)`\n * returns the session. There is no separate sign-up — the first entry creates\n * the account.\n */\nexport const useSignIn = () =>\n useAuthStore(\n useShallow(s => ({\n requestCode: s.requestCode,\n verifyCode: s.verifyCode,\n sending: s.loadingStates.requestCode,\n verifying: s.loadingStates.verifyCode,\n error: s.error,\n }))\n )\n\n// Auth Actions\nexport const useSignOut = () => useAuthStore(s => s.signOut)\nexport const useCheckToken = () => useAuthStore(s => s.checkTokenValidity)\n\n// Session Hook\nexport const useSession = () =>\n useAuthStore(\n useShallow(s => ({\n getSession: s.getSession,\n user: s.user,\n setUser: s.setUser,\n }))\n )\n\n// Loading States Hook\nexport const useAuthLoading = () => useAuthStore(s => s.loadingStates)\n\n// Profile Management Hook (novo nome estilo Clerk)\nexport const useUser = () =>\n useAuthStore(\n useShallow(s => ({\n user: s.user,\n updateProfile: s.updateProfile,\n loadingUpdateProfile: s.loadingStates.updateProfile,\n error: s.error,\n }))\n )\n\n// Alias deprecado para backwards compatibility\nexport const useProfile = useUser\n\n// Sessions Management Hook\nexport const useSessions = () =>\n useAuthStore(\n useShallow(s => ({\n currentSession: s.currentSession,\n sessions: s.sessions,\n getSession: s.getSession,\n listSessions: s.listSessions,\n revokeSession: s.revokeSession,\n revokeOtherSessions: s.revokeOtherSessions,\n loadingListSessions: s.loadingStates.listSessions,\n loadingRevokeSession: s.loadingStates.revokeSession,\n error: s.error,\n }))\n )\n\n/**\n * The impersonation in progress, or `null`.\n *\n * Exposed so a panel can adapt what it OFFERS while the session is borrowed.\n * The banner already says whose account this is; this is for the screens that\n * would otherwise invite the target to do something only an administrator does\n * — \"create your first company\" makes no sense for an end user being looked at.\n *\n * Returns the record (`{ id, actor, expiresAt }`), so a screen can name who\n * opened the session without a second call.\n */\nexport const useImpersonation = () => useAuthStore(s => s.impersonation)\n\n// Application Logo Hook\nexport const useApplicationLogo = () => {\n const applicationInfo = useAuthStore(s => s.applicationInfo)\n // Retorna o logo da aplicação ou null (componentes usam fallback padrão)\n return applicationInfo?.image || null\n}\n","import { Navigate, Outlet } from 'react-router-dom'\nimport { useAuth } from './AuthProvider.jsx'\n\nexport default function Protect({ fallback = <p>⌛ Carregando...</p>, redirectTo = '/login' }) {\n const { user, loading } = useAuth()\n\n if (loading) return fallback\n if (!user)\n return (\n <Navigate\n to={redirectTo}\n replace\n />\n )\n\n return <Outlet />\n}\n","import { Navigate, Outlet } from 'react-router-dom'\nimport { useAuth } from './AuthProvider.jsx'\nimport { getRedirectFromLocation } from './redirect.js'\n\n/**\n * O par do `<Protect>`: a rota pública que quem JÁ tem sessão não deveria ver.\n *\n * `<Protect>` cobria metade da porta — tira de dentro quem não está logado, mas\n * nada tirava da tela de login quem está, e essa tela é pública justamente para\n * não depender de sessão. Chegar em `/auth/signin` autenticado renderizava o\n * formulário, e só um F5 saía dele: no recarregamento o `init()` roda,\n * `/auth/session` responde com o usuário, e aí a navegação acontece.\n *\n * ESPERAR O `loading` É A PARTE QUE IMPORTA. Enquanto ele for `true` o store\n * ainda não perguntou nada ao servidor e `user` é `null` — indistinguível de\n * \"não está logado\". Renderizar o formulário nessa janela é o mesmo bug, só que\n * mais curto. Por isso o `fallback` existe: passe o MESMO esqueleto que vai no\n * `<Protect>`, e a pessoa vê uma tela só até a resposta chegar.\n *\n * O `?redirect=` ganha do `redirectTo`: quem veio de uma autorização OAuth\n * volta para ela, não para a home do painel. `getRedirectFromLocation` valida\n * contra a allowlist, então um destino forjado devolve `null` — sem isso a tela\n * de login vira open redirect.\n *\n * Aceita os dois formatos de rota, porque os dois existem nos painéis:\n *\n * <Route path=\"signin\" element={<GuestOnly fallback={<AuthLoader />}><SignIn /></GuestOnly>} />\n *\n * <Route element={<GuestOnly fallback={<AuthLoader />} />}>\n * <Route path=\"signin\" element={<SignIn />} />\n * </Route>\n */\nexport default function GuestOnly({ children, fallback = null, redirectTo = '/', extraOrigins = [] }) {\n const { user, loading } = useAuth()\n\n if (loading) return fallback\n if (!user) return children ?? <Outlet />\n\n const to = getRedirectFromLocation(extraOrigins) || redirectTo\n\n // `//alvo` parece caminho e sai do domínio: é externo, e o roteador desta\n // aplicação não o alcança.\n const isInternal = to.startsWith('/') && !to.startsWith('//')\n if (!isInternal) {\n window.location.replace(to)\n return fallback\n }\n\n return (\n <Navigate\n to={to}\n replace\n />\n )\n}\n","import { Paper, Stack, Image, Title, Text, Modal, Box, Divider, ThemeIcon, Group } from '@mantine/core'\n\n/**\n * Container wrapper para componentes de autenticação\n * Suporta renderização como Card (Paper) ou Modal\n *\n * @param {object} props\n * @param {string|React.ReactNode} [props.logo] - URL da imagem ou nó React (ex.: <Wordmark />)\n * @param {'card'|'modal'} [props.variant='card'] - Modo de renderização\n * @param {boolean} [props.opened] - Controla visibilidade do modal (apenas para variant=\"modal\")\n * @param {function} [props.onClose] - Callback ao fechar modal (apenas para variant=\"modal\")\n * @param {object} [props.modalProps] - Props adicionais para o Modal\n */\nexport default function AuthCard({\n children,\n title,\n subtitle,\n logo,\n logoWidth = 133,\n width = 350,\n\n // Variant props\n variant = 'card',\n opened,\n onClose,\n modalProps = {},\n\n ...props\n}) {\n // Conteúdo interno compartilhado entre Card e Modal\n const content = (\n <Stack gap=\"sm\">\n {(logo || title || subtitle) && (\n <Stack\n gap={6}\n align=\"center\"\n ta=\"center\"\n >\n {logo &&\n (typeof logo === 'string' ? (\n <Image\n src={logo}\n alt=\"Auth\"\n mx=\"auto\"\n w={logoWidth}\n fit=\"contain\"\n />\n ) : (\n logo\n ))}\n\n {title && (\n <Title\n order={3}\n ta=\"center\"\n >\n {title}\n </Title>\n )}\n\n {subtitle && (\n <Text\n size=\"sm\"\n c=\"dimmed\"\n ta=\"center\"\n >\n {subtitle}\n </Text>\n )}\n </Stack>\n )}\n\n {children}\n </Stack>\n )\n\n // Renderizar como Modal\n if (variant === 'modal') {\n return (\n <Modal\n opened={opened}\n onClose={onClose}\n size={width + 50}\n withCloseButton\n radius={0}\n overlayProps={{ backgroundOpacity: 0.55, blur: 3 }}\n title={\n <Group\n gap=\"sm\"\n wrap=\"nowrap\"\n >\n {logo &&\n (typeof logo === 'string' ? (\n <Image\n src={logo}\n alt=\"Auth\"\n h={logoWidth}\n fit=\"contain\"\n />\n ) : (\n logo\n ))}\n {title && <Title order={4}>{title}</Title>}\n </Group>\n }\n {...modalProps}\n >\n {/* Quando em modal, não repetir logo/title no content */}\n <Stack gap=\"sm\">\n {subtitle && (\n <Text\n size=\"sm\"\n c=\"dimmed\"\n >\n {subtitle}\n </Text>\n )}\n {children}\n </Stack>\n </Modal>\n )\n }\n\n // Renderizar como Card (default)\n return (\n <Paper\n withBorder\n shadow=\"none\"\n p={24}\n /*\n * `w` fixo nao encolhe: num celular de 375px o cartao de 350px\n * mais o padding da pagina estourava a tela e a coluna da direita\n * ficava cortada. `maw` mantem a MESMA largura onde ela cabe e\n * cede onde nao cabe.\n */\n w=\"100%\"\n maw={width}\n radius={0}\n {...props}\n >\n {content}\n </Paper>\n )\n}\n","import { useEffect, useState } from 'react'\nimport { Button, Divider, Group, Stack, Text } from '@mantine/core'\nimport { IconBrandGoogle } from '@tabler/icons-react'\n\nimport { getSocialProviders, startSocialSignIn } from '../authSdk.js'\n\n/*\n * The provider marks.\n *\n * Tabler outlines at stroke 1.5, like every other icon in the system — not the\n * providers' full-colour logos.\n *\n * That is a deliberate departure from what Google's brand guidelines ask for,\n * and the reason is that colour MEANS something here: it is reserved for state\n * (a semaphore reading as a semaphore, a notification as a warning). Four brand\n * colours on a sign-in button spend that signal on decoration, and the button\n * next to it — the one that actually submits — would read as less important\n * than the one that just leaves.\n *\n * A remote logo would also be a third-party request that can hang, leaving a\n * hole in the button at the exact moment someone is deciding to trust the page.\n */\nconst MARKS = { google: IconBrandGoogle }\n\n/**\n * The social sign-in buttons, driven by what the APPLICATION has enabled.\n *\n * WHY THE LIST IS FETCHED AND NOT PASSED IN\n *\n * The owner configures Google in the Auth panel. Asking the integrator to ALSO\n * declare it in code would be two sources for one fact, and they would drift:\n * turning the provider off in the panel would leave a button that fails. So the\n * component asks the worker which providers are live.\n *\n * It renders NOTHING while it does not know, and nothing when the answer is\n * empty — an application with no social provider sees no divider, no gap, no\n * trace of this component.\n */\nexport default function SocialButtons({ labels = {}, redirect, disabled = false }) {\n const [providers, setProviders] = useState(null)\n const [leaving, setLeaving] = useState(null)\n\n useEffect(() => {\n let active = true\n getSocialProviders().then(list => {\n // The screen may have unmounted while the request was in flight.\n if (active) setProviders(list)\n })\n return () => {\n active = false\n }\n }, [])\n\n // `null` is \"still asking\", `[]` is \"asked, and there are none\". Both render\n // nothing, but only the second is a final answer.\n if (!providers || providers.length === 0) return null\n\n return (\n <Stack gap=\"md\">\n <Divider\n label={labels.socialDivider || 'ou'}\n labelPosition=\"center\"\n />\n\n {providers.map(provider => {\n const Mark = MARKS[provider.provider]\n\n return (\n <Button\n key={provider.provider}\n variant=\"default\"\n fullWidth\n size=\"md\"\n /*\n * `aria-disabled`, not `disabled`: Mantine's `disabled`\n * repaints the button grey and hides its label, and this\n * button is what the person is trying to click. The\n * handler below is what actually refuses.\n */\n aria-disabled={disabled || leaving !== null}\n loading={leaving === provider.provider}\n onClick={() => {\n if (disabled || leaving !== null) return\n // Kept in state so a double click does not fire two\n // navigations — the second would orphan the first\n // `oauth_states` row.\n setLeaving(provider.provider)\n startSocialSignIn(provider.provider, { redirect })\n }}\n >\n <Group\n gap={10}\n wrap=\"nowrap\"\n justify=\"center\"\n >\n {Mark && (\n <Mark\n size={16}\n stroke={1.5}\n />\n )}\n <Text\n fz={14}\n fw={700}\n >\n {labels.socialButton ? labels.socialButton(provider.name) : `Entrar com ${provider.name}`}\n </Text>\n </Group>\n </Button>\n )\n })}\n </Stack>\n )\n}\n","import { Text } from '@mantine/core'\n\n/**\n * Wordmark tipográfico — a marca no padrão Zen da RiLiGar.\n *\n * Substitui o antigo logotipo em bitmap como identidade padrão dos cards de\n * autenticação. Tipografia é nítida em qualquer densidade de tela, herda a cor\n * do tema e acompanha o dark mode — coisas que um .webp não faz.\n *\n * Escala Small Caps (fw 800, lts 1.5px, gray.4): a marca é o \"anúncio\" acima\n * do título, nunca um segundo título. Quem carrega o peso é o <Title>.\n *\n * Aplicações com logo próprio continuam passando `logo` ou configurando a\n * imagem no painel; nesse caso o wordmark não aparece.\n */\nexport function Wordmark({ fz = 11, c = 'gray.4', ...props }) {\n return (\n <Text\n component=\"span\"\n display=\"block\"\n ta=\"center\"\n fz={fz}\n fw={800}\n lh={1}\n tt=\"uppercase\"\n lts=\"1.5px\"\n c={c}\n {...props}\n >\n Auth\n </Text>\n )\n}\n\nexport default Wordmark\n","import { useState, useEffect } from 'react'\nimport { TextInput, Button, Stack, Anchor, Center, Text, Loader, Group } from '@mantine/core'\nimport { useForm } from '@mantine/form'\nimport { useNavigate } from 'react-router-dom'\nimport { getRedirectFromLocation, applyRedirect } from '../redirect'\nimport { IconArrowRight } from '@tabler/icons-react'\nimport { useAuthStore } from '../authStore.js'\nimport { useApplicationLogo } from '../AuthProvider.jsx'\nimport AuthCard from './AuthCard.jsx'\nimport SocialButtons from './SocialButtons.jsx'\n\nimport { Wordmark } from './Wordmark.jsx'\n\n// Where the terms live. Hardcoded on purpose, like `API_BASE` in authSdk.js:\n// this ships inside the published bundle, and the seven panels must all point\n// at the same document. `termsUrl` overrides it for whoever hosts their own.\nconst TERMS_URL = 'https://myinfrastructure.click/legal/terms'\n\n/**\n * The terms notice under the first step.\n *\n * It sits on step ONE and nowhere else: the account is born on the first\n * `verify` and there is no separate sign-up screen to put it on — this form IS\n * the sign-up for whoever has never entered. On step two the person already\n * agreed by asking for the code; repeating it there would only push the code\n * field down.\n */\nfunction TermsNotice({ url, text, linkText }) {\n if (!url) return null\n\n return (\n <Text\n size=\"xs\"\n c=\"dimmed\"\n ta=\"center\"\n /*\n * Tighter than the `gap=\"md\"` of the Stack around it, and a hair\n * tighter than default leading. This is fine print under the action,\n * not a third step of the form — spaced like the field and the\n * button it would read as one more thing to do.\n */\n mt={-4}\n lh={1.4}\n /*\n * Two short lines instead of one full-width line plus an orphan.\n * At the card's 350px the sentence wrapped as \"…todos os / nossos\n * termos e condições\", splitting the phrase away from the words that\n * govern it. Balanced, the break falls where the meaning does.\n */\n style={{ textWrap: 'balance' }}\n >\n {text}{' '}\n <Anchor\n href={url}\n target=\"_blank\"\n /*\n * `noopener noreferrer` with `target=\"_blank\"`: the same pair the\n * footers of the house use for anything leaving the origin\n * (`site-chrome.jsx`, `ProductLayout.jsx`). Opening in a new tab\n * is not decoration here — the person is mid-sign-in, and\n * navigating away would throw the typed email out.\n */\n rel=\"noopener noreferrer\"\n /*\n * `inherit` takes the size and weight of the sentence around it,\n * so the link does not turn into a bold island inside the fine\n * print — but it also takes the COLOR, and in the Zen palette\n * `primaryColor: 'gray'` paints the Anchor near-black. Against\n * dimmed text that reads as emphasis, not as something to click.\n *\n * The underline is what says \"link\" here: it survives whatever\n * `primaryColor` each panel sets, and it is the only affordance\n * left once the colour matches the sentence.\n */\n inherit\n c=\"inherit\"\n underline=\"always\"\n >\n {linkText}\n </Anchor>\n .\n </Text>\n )\n}\n\n// The OAuth flow's pass-through screen.\n//\n// The panel is not the destination here: the user is authorizing an MCP client\n// and only passes through this origin because it is where the token lives. A\n// blank screen during the detour looks like a freeze; this one says what is\n// happening.\nfunction AuthTransition({ label = 'Conectando…' }) {\n return (\n <Center style={{ minHeight: '60vh' }}>\n <Stack\n align=\"center\"\n gap=\"sm\"\n >\n <Loader size=\"xs\" />\n <Text\n size=\"sm\"\n c=\"dimmed\"\n >\n {label}\n </Text>\n </Stack>\n </Center>\n )\n}\n\n/**\n * Sign in — the only path there is.\n *\n * Two steps: the email receives a code, the code becomes a session. There is no\n * password, magic link, sign-up or recovery — first-time arrivals and returning\n * people walk exactly this screen, and the account is born on the first entry.\n *\n * Nothing here builds a callback URL. The code is typed in this very tab, so\n * there is no destination to validate — which is why the family of\n * origin/redirect bugs does not reach this flow.\n *\n * @param {object} props\n * @param {'card'|'modal'} [props.variant='card'] - Rendering mode\n * @param {boolean} [props.opened] - Visibility (only for variant=\"modal\")\n * @param {function} [props.onClose] - Close callback (only for variant=\"modal\")\n */\nexport default function SignIn({\n // Configuration\n logo, // No default: it is computed below\n logoWidth = 133,\n title = 'Entrar',\n subtitle = 'Enviaremos um código para o seu e-mail',\n\n // Variant\n variant = 'card',\n opened,\n onClose,\n modalProps = {},\n\n // Where to send someone who ALREADY has a session and lands on this screen.\n // The landings link straight to /auth/signin without knowing a session\n // exists; without this, a signed-in user faced the form again. `null`\n // disables the detour.\n authenticatedRedirect = '/',\n\n // Shown while the session is being resolved and during the detour of an\n // already authenticated person. Avoids flashing the form to someone who\n // should never see it.\n redirectingFallback = null,\n\n // Callbacks\n onSuccess,\n // Post-sign-in redirect: by default the component honours `?redirect=` from\n // the URL, validating against the API's origin and the current one.\n // `redirectOrigins` adds domains; `handleRedirect={false}` hands control back\n // to the app.\n handleRedirect = true,\n redirectOrigins = [],\n onError,\n onCodeSent,\n\n // Custom labels\n labels = {},\n\n // The terms notice under the first step. `null` removes it — an internal\n // panel behind a VPN has no one to present terms to.\n termsUrl = TERMS_URL,\n\n /*\n * Social sign-in buttons.\n *\n * `'auto'` — the default — shows whatever the APPLICATION enabled in the\n * Auth panel, and nothing at all when it enabled none. It is additive: an\n * application with no provider configured renders exactly what it rendered\n * before this prop existed, so the default does not break anyone.\n *\n * `false` opts out entirely, for a screen that wants the emailed code only.\n */\n socialLogin = 'auto',\n\n ...cardProps\n}) {\n const user = useAuthStore(s => s.user)\n const authLoading = useAuthStore(s => s.loading)\n const requestCode = useAuthStore(s => s.requestCode)\n const verifyCode = useAuthStore(s => s.verifyCode)\n const sending = useAuthStore(s => s.loadingStates.requestCode)\n const verifying = useAuthStore(s => s.loadingStates.verifyCode)\n\n // Which step we are on. The email is kept because the second step has to\n // present it again: it is the (email, code) pair the server validates.\n const [sentTo, setSentTo] = useState(null)\n const [code, setCode] = useState('')\n const [codeError, setCodeError] = useState(null)\n\n // Hook that fetches the application's logo\n const applicationLogo = useApplicationLogo()\n const finalLogo = logo || applicationLogo || <Wordmark />\n\n const navigate = useNavigate()\n\n const form = useForm({\n initialValues: {\n email: '',\n },\n validate: {\n email: value => (/^\\S+@\\S+$/.test(value) ? null : labels.invalidEmail || 'Email inválido'),\n },\n })\n\n // Whoever already has a session must not see the form. The landings point\n // to /auth/signin unconditionally, and since the session became shared\n // across `.myinfrastructure.click` (domain cookie) it is common to arrive here\n // already authenticated — the panel used to learn that only after a\n // redundant sign-in.\n //\n // It waits for `authLoading`: the provider's `init` resolves the session\n // asynchronously (cookie → /auth/session). Deciding before that would flash\n // the form to someone already signed in, or worse, redirect based on a\n // `user` that has not loaded yet.\n // `redirectOrigins` defaults to `[]` — a new array on every render. Used raw\n // as a dependency, it would re-run the effect in a loop.\n const redirectOriginsKey = JSON.stringify(redirectOrigins)\n\n useEffect(() => {\n if (authLoading || !user) return\n\n // `?redirect=` takes priority: whoever arrived through an OAuth flow\n // needs to go back there, not to the panel's home. Same decision as the\n // post-sign-in one, with the same origin validation.\n const target = (handleRedirect ? getRedirectFromLocation(redirectOrigins) : null) || authenticatedRedirect\n\n // `authenticatedRedirect={null}` disables the courtesy detour for\n // someone already signed in — but NOT the return of an OAuth flow, which\n // is an authorization in progress, not a convenience. The guard above\n // used to block both together.\n if (!target) return\n\n applyRedirect(target, navigate)\n // eslint-disable-next-line react-hooks/exhaustive-deps -- redirectOrigins enters through the serialized key above\n }, [authLoading, user, authenticatedRedirect, handleRedirect, redirectOriginsKey, navigate])\n\n // Step 1 — ask for the code.\n const handleRequest = async values => {\n if (sending) return\n try {\n await requestCode(values.email)\n setSentTo(values.email)\n setCode('')\n setCodeError(null)\n onCodeSent?.(values.email)\n } catch (error) {\n onError?.(error)\n }\n }\n\n // Step 2 — trade the code for the session.\n //\n // The redirect is decided AND EXECUTED before onSuccess.\n //\n // Deciding beforehand was not enough: the app usually calls `navigate('/')`\n // inside onSuccess, so that navigation happened first and the following\n // `applyRedirect` ran with the route already changed. `redirectHandled`\n // protected against that, but only for whoever remembered to honour it — and\n // half the panels did not, which made the OAuth handoff lose the `#token=`\n // and end in \"Sessão inválida ou expirada\".\n //\n // Executing here, the OAuth flow's destination no longer depends on each\n // application getting the contract right. `onSuccess` is still always called\n // (the app still shows its notification), and `redirectHandled` still\n // signals that navigation was taken over — now as information, not as a\n // trap.\n const handleVerify = async value => {\n setCodeError(null)\n try {\n const result = await verifyCode(sentTo, value)\n\n const target = handleRedirect ? getRedirectFromLocation(redirectOrigins) : null\n\n if (target) applyRedirect(target, navigate)\n\n onSuccess?.(result?.user ?? null, { result, redirectHandled: !!target })\n } catch (error) {\n // The code error belongs to the field, not to the global\n // notification: the person is looking at the eight characters they\n // just typed.\n setCodeError(error?.message || labels.invalidCode || 'Código inválido.')\n setCode('')\n onError?.(error)\n }\n }\n\n // Does not render the form for someone who already has a session: the effect\n // above is redirecting, and showing the fields in that window would flash\n // the screen \"in between\" — the symptom the landing linking straight here\n // exposed. `authLoading` covers the instant before the cookie resolves.\n //\n // `?redirect=` counts on its own. In an OAuth flow the panel is a\n // PASS-THROUGH, not a destination: the token lives in this origin's\n // localStorage and the worker cannot reach it, so the browser has to come\n // through here — but the user should not notice. Without this part of the\n // condition, whoever arrived with an unresolved session still saw the panel\n // screen before the detour.\n const oauthPending = handleRedirect && !!getRedirectFromLocation(redirectOrigins)\n const willRedirect = (!!authenticatedRedirect || oauthPending) && (authLoading || !!user)\n if (willRedirect) return oauthPending ? (redirectingFallback ?? <AuthTransition />) : redirectingFallback\n\n return (\n <AuthCard\n logo={finalLogo}\n logoWidth={logoWidth}\n title={title}\n subtitle={sentTo ? labels.codeSent || 'Digite o código que enviamos' : subtitle}\n variant={variant}\n opened={opened}\n onClose={onClose}\n modalProps={modalProps}\n {...cardProps}\n >\n {!sentTo ? (\n <form onSubmit={form.onSubmit(handleRequest)}>\n <Stack gap=\"md\">\n <TextInput\n label={labels.email || 'Email'}\n placeholder={labels.emailPlaceholder || 'seu@email.com'}\n type=\"email\"\n autoFocus\n autoComplete=\"email\"\n {...form.getInputProps('email')}\n /*\n * `readOnly`, not `disabled`: Mantine's `disabled`\n * fades the field while the request is in flight, and\n * the value the person just typed is what they are\n * looking at. `readOnly` locks editing and leaves the\n * field legible.\n */\n readOnly={sending}\n />\n\n <Button\n type=\"submit\"\n fullWidth\n /*\n * `aria-disabled`, never `disabled`: `disabled`\n * repaints the button grey, and the white Loader\n * vanishes inside it — the action IN PROGRESS ends up\n * weighing less on screen than a button standing\n * still. With `aria-disabled` the button stays black,\n * the spinner shows, and the guard on submit blocks\n * the repeated click.\n *\n * And the spinner goes in `leftSection`: Mantine's\n * `loading` prop hides the label, and a button with\n * no word does not say what is happening.\n */\n aria-disabled={sending}\n leftSection={\n sending ? (\n <Loader\n size={14}\n color=\"gray.0\"\n />\n ) : null\n }\n rightSection={<IconArrowRight size={16} />}\n >\n {sending ? labels.sendingCode || 'Enviando…' : labels.sendCodeButton || 'Enviar código'}\n </Button>\n\n {/*\n * Step ONE only. On step two the person already asked\n * for a code and is looking for the field to type it\n * into; offering another way in there is noise at the\n * worst possible moment.\n */}\n {socialLogin !== false && (\n <SocialButtons\n labels={labels}\n disabled={sending}\n />\n )}\n\n <TermsNotice\n url={termsUrl}\n text={labels.termsNotice || 'Criando uma conta, você concorda com todos os nossos'}\n linkText={labels.termsLink || 'termos e condições'}\n />\n </Stack>\n </form>\n ) : (\n <Stack gap=\"md\">\n <TextInput\n label={labels.codeLabel || 'Código de acesso'}\n /*\n * The email is the field's description, not the subtitle:\n * as a subtitle it wrapped onto two lines and competed for\n * weight with the title. Here it sits where the person\n * checks it — right above what they are about to type.\n */\n description={`${labels.codeSentTo || 'Enviado para'} ${sentTo}`}\n placeholder=\"ABCD-EFGH\"\n /*\n * One field, not eight boxes. Eight boxes is the numeric\n * OTP pattern; this code is alphanumeric and dictated\n * aloud — in a single field paste works, the screen reader\n * reads one thing, and the hyphen the person types is\n * accepted (`normalizeUserCode` in the worker drops it).\n */\n value={code}\n onChange={event => {\n setCode(event.currentTarget.value)\n if (codeError) setCodeError(null)\n }}\n onKeyDown={event => {\n if (event.key === 'Enter' && code.trim()) handleVerify(code)\n }}\n autoFocus\n autoComplete=\"one-time-code\"\n readOnly={verifying}\n error={codeError}\n />\n\n <Button\n type=\"button\"\n fullWidth\n // Same reason as the previous step: `disabled` would fade\n // the button exactly while signing in happens. With no\n // code typed it stays genuinely disabled — there is no\n // action in progress to hide there.\n aria-disabled={verifying}\n disabled={!code.trim()}\n onClick={verifying ? undefined : () => handleVerify(code)}\n leftSection={\n verifying ? (\n <Loader\n size={14}\n color=\"gray.0\"\n />\n ) : null\n }\n rightSection={<IconArrowRight size={16} />}\n >\n {verifying ? labels.verifyingCode || 'Entrando…' : labels.confirmCode || 'Confirmar'}\n </Button>\n\n <Group\n justify=\"space-between\"\n gap=\"xs\"\n >\n <Anchor\n size=\"sm\"\n c=\"dimmed\"\n onClick={() => {\n setSentTo(null)\n setCode('')\n setCodeError(null)\n }}\n >\n {labels.changeEmail || 'Usar outro e-mail'}\n </Anchor>\n\n <Anchor\n size=\"sm\"\n c=\"dimmed\"\n onClick={sending ? undefined : () => handleRequest({ email: sentTo })}\n >\n {sending ? labels.sendingCode || 'Enviando…' : labels.resendCode || 'Reenviar código'}\n </Anchor>\n </Group>\n </Stack>\n )}\n </AuthCard>\n )\n}\n","import { useState, useEffect } from 'react'\nimport { Modal, Group, Stack, Text, Avatar, Box, Anchor, ThemeIcon, Title, Divider, TextInput, Button, Collapse, Tooltip, Paper, Image, Badge, FileButton } from '@mantine/core'\nimport { useForm } from '@mantine/form'\n// notifications removed\nimport { IconUser, IconShield, IconUserCircle, IconMail, IconCheck, IconPhoto, IconPencil, IconTrash, IconDevices, IconDeviceMobile, IconLogout } from '@tabler/icons-react'\n\nimport { useUser, useSessions } from '../AuthProvider.jsx'\n\n/**\n * Componente de gerenciamento de conta do usuário\n * Permite editar avatar e nome, e gerenciar as sessões ativas\n * Suporta renderização como Card ou Modal\n *\n * @param {object} props\n * @param {'card'|'modal'} [props.variant='modal'] - Modo de renderização\n * @param {boolean} [props.opened] - Controla visibilidade (apenas para variant=\"modal\")\n * @param {function} [props.onClose] - Callback ao fechar (apenas para variant=\"modal\")\n */\nexport default function UserProfile({\n // Variant\n variant = 'modal',\n opened,\n onClose,\n\n // Callbacks\n onProfileUpdate,\n onSessionRevoked,\n onOtherSessionsRevoked,\n onError,\n\n // Features toggle\n showAvatar = true,\n showName = true,\n showEmail = true,\n showSessions = true,\n\n // Customização\n labels = {},\n title = 'Account',\n subtitle = 'Manage your account info.',\n logo,\n logoHeight = 28,\n width = 500,\n\n // Avatar config\n maxAvatarSize = 500 * 1024, // 500KB\n\n // Custom sections (React nodes to render after built-in sections)\n customSections,\n\n ...containerProps\n}) {\n // Local state - which section is expanded\n const [editingSection, setEditingSection] = useState(null) // 'password' | 'email' | 'name' | 'avatar' | null\n\n // Hook para profile\n const { user, updateProfile, loadingUpdateProfile } = useUser()\n\n // Hook para sessions\n const { currentSession, sessions, listSessions, getSession, revokeSession, revokeOtherSessions, loadingListSessions, loadingRevokeSession } = useSessions()\n\n // Load sessions when opened (modal) or component mounts (card), and when sessions section is opened\n useEffect(() => {\n if (showSessions && (variant === 'card' || opened)) {\n // Fetch current session first to get the session ID, then list all sessions\n getSession().catch(err => console.warn('Failed to get current session:', err))\n listSessions().catch(err => console.warn('Failed to load sessions:', err))\n }\n }, [opened, showSessions, variant])\n\n // Helper to parse user agent string\n const parseUserAgent = ua => {\n if (!ua) return { browser: 'Unknown Browser', os: 'Unknown OS' }\n\n let browser = 'Unknown Browser'\n let os = 'Unknown OS'\n\n // Detect browser\n if (ua.includes('Chrome') && !ua.includes('Edg')) browser = 'Chrome'\n else if (ua.includes('Firefox')) browser = 'Firefox'\n else if (ua.includes('Safari') && !ua.includes('Chrome')) browser = 'Safari'\n else if (ua.includes('Edg')) browser = 'Edge'\n else if (ua.includes('Opera') || ua.includes('OPR')) browser = 'Opera'\n\n // Detect OS\n if (ua.includes('Windows')) os = 'Windows'\n else if (ua.includes('Mac OS')) os = 'macOS'\n else if (ua.includes('Linux')) os = 'Linux'\n else if (ua.includes('Android')) os = 'Android'\n else if (ua.includes('iPhone') || ua.includes('iPad')) os = 'iOS'\n\n return { browser, os }\n }\n\n // Session handlers\n const handleRevokeSession = async sessionId => {\n // Check if revoking current session\n const isCurrentSession = sessionId === currentSession?.id || sessions.length === 1\n\n // If revoking current session, handle logout immediately after revocation\n if (isCurrentSession) {\n try {\n await revokeSession(sessionId)\n onSessionRevoked?.(sessionId)\n } catch (error) {\n onError?.(error)\n // Even if it fails, we're revoking our own session, so just logout\n // The server already revoked our session\n }\n // Clear auth state and redirect\n localStorage.removeItem('auth:token')\n window.dispatchEvent(new CustomEvent('auth:session-revoked'))\n if (variant === 'modal') onClose?.()\n return\n }\n\n // Revoking another session\n try {\n await revokeSession(sessionId)\n onSessionRevoked?.(sessionId)\n } catch (error) {\n // Check for 401 error (our SDK uses error.res, axios uses error.response)\n const status = error.res?.status || error.response?.status\n if (status === 401) {\n // This means our session was revoked, not the target one - do logout\n localStorage.removeItem('auth:token')\n window.dispatchEvent(new CustomEvent('auth:session-revoked'))\n if (variant === 'modal') onClose?.()\n return\n }\n\n onError?.(error)\n }\n }\n\n const handleRevokeOtherSessions = async () => {\n try {\n await revokeOtherSessions()\n onOtherSessionsRevoked?.()\n } catch (error) {\n onError?.(error)\n }\n }\n\n // Name form\n const nameForm = useForm({\n initialValues: {\n name: '',\n },\n validate: {\n name: v => (!v ? labels.nameRequired || 'Nome obrigatório' : null),\n },\n })\n\n // Avatar state (base64)\n const [avatarPreview, setAvatarPreview] = useState(null)\n const [avatarFile, setAvatarFile] = useState(null)\n\n // Handle file selection and convert to base64\n const handleAvatarFileChange = file => {\n if (!file) {\n setAvatarPreview(null)\n setAvatarFile(null)\n return\n }\n\n // Validate file type\n if (!file.type.startsWith('image/')) {\n onError?.(new Error(labels.avatarInvalidType || 'Por favor, selecione uma imagem válida'))\n return\n }\n\n // Validate file size\n if (file.size > maxAvatarSize) {\n onError?.(new Error(labels.avatarTooLarge || `Imagem muito grande. Máximo ${Math.round(maxAvatarSize / 1024)}KB.`))\n return\n }\n\n setAvatarFile(file)\n\n // Convert to base64\n const reader = new FileReader()\n reader.onloadend = () => {\n setAvatarPreview(reader.result)\n }\n reader.readAsDataURL(file)\n }\n\n // Populate forms when user data is available or section opens\n useEffect(() => {\n if (editingSection === 'name' && user?.name) {\n nameForm.setValues({ name: user.name })\n }\n if (editingSection === 'avatar' && user?.image) {\n setAvatarPreview(user.image)\n }\n }, [editingSection, user])\n\n const handleToggleSection = section => {\n if (editingSection === section) {\n setEditingSection(null)\n nameForm.reset()\n setAvatarPreview(null)\n setAvatarFile(null)\n } else {\n setEditingSection(section)\n }\n }\n\n const handleChangeName = async values => {\n try {\n await updateProfile({ name: values.name })\n nameForm.reset()\n setEditingSection(null)\n onProfileUpdate?.({ name: values.name })\n } catch (error) {\n onError?.(error)\n }\n }\n\n const handleChangeAvatar = async () => {\n if (!avatarPreview) {\n // Optionally handle this validation error via callback or just return?\n // Since it's a validation error before async call, we might want to expose it too?\n // The original code used notifications. Let's send to onError for consistency or just return if it's UI state.\n // Actually, for validation within the component, maybe we can just let it be silent or use form error if applicable?\n // But this is outside form context. Let's use onError with a custom error object.\n onError?.(new Error(labels.avatarRequired || 'Selecione uma imagem'))\n return\n }\n\n try {\n await updateProfile({ image: avatarPreview })\n setAvatarPreview(null)\n setAvatarFile(null)\n setEditingSection(null)\n onProfileUpdate?.({ image: avatarPreview })\n } catch (error) {\n onError?.(error)\n }\n }\n\n const handleRemoveAvatar = async () => {\n try {\n await updateProfile({ image: '' })\n setAvatarPreview(null)\n setAvatarFile(null)\n setEditingSection(null)\n onProfileUpdate?.({ image: '' })\n } catch (error) {\n onError?.(error)\n }\n }\n\n // Reusable Section Header\n const SectionHeader = ({ icon: Icon, sectionTitle, description }) => (\n <Group\n gap=\"sm\"\n mb=\"lg\"\n >\n <ThemeIcon\n size={36}\n variant=\"subtle\"\n color=\"gray\"\n >\n <Icon\n size={28}\n stroke={1.5}\n />\n </ThemeIcon>\n <Stack gap={0}>\n <Text\n fw={600}\n size=\"sm\"\n >\n {sectionTitle}\n </Text>\n {description && (\n <Text\n size=\"xs\"\n c=\"dimmed\"\n >\n {description}\n </Text>\n )}\n </Stack>\n </Group>\n )\n\n // Reusable Row component\n const SettingRow = ({ label, children, action, actionLabel, onClick, expanded }) => (\n <Box py=\"xs\">\n <Group\n justify=\"space-between\"\n wrap=\"nowrap\"\n align=\"center\"\n >\n <Group\n gap=\"xl\"\n wrap=\"nowrap\"\n flex={1}\n >\n <Text\n size=\"sm\"\n c=\"dimmed\"\n w={100}\n >\n {label}\n </Text>\n <Box flex={1}>{children}</Box>\n </Group>\n {action && (\n <Tooltip\n label={actionLabel || action}\n position=\"left\"\n >\n <Anchor\n size=\"xs\"\n fw={300}\n onClick={onClick}\n c=\"gray\"\n underline=\"none\"\n >\n {expanded ? labels.cancel || 'Cancel' : action}\n </Anchor>\n </Tooltip>\n )}\n </Group>\n </Box>\n )\n\n // Conteúdo interno compartilhado\n const profileContent = (\n <>\n {/* Profile Section */}\n {(showAvatar || showName || showEmail) && (\n <Box mb=\"lg\">\n <SectionHeader\n icon={IconUser}\n sectionTitle={labels.profileSection || 'Profile'}\n description={labels.profileDescription || 'Your personal information'}\n />\n <Stack gap=\"sm\">\n {/* Avatar Row */}\n {showAvatar && (\n <>\n <SettingRow\n label={labels.avatar || 'Avatar'}\n action={labels.update || 'Update'}\n actionLabel={labels.updateAvatar || 'Update your profile picture'}\n onClick={() => handleToggleSection('avatar')}\n expanded={editingSection === 'avatar'}\n >\n <Group gap=\"md\">\n <Avatar\n src={user?.image}\n name={user?.name || user?.email}\n size={48}\n radius=\"xl\"\n // color=\"initials\"\n />\n </Group>\n </SettingRow>\n\n {/* Avatar Change Form */}\n <Collapse in={editingSection === 'avatar'}>\n <Paper\n p=\"sm\"\n withBorder\n radius=\"sm\"\n >\n <Stack\n gap=\"md\"\n align=\"center\"\n >\n <FileButton\n onChange={handleAvatarFileChange}\n accept=\"image/*\"\n >\n {props => (\n <Tooltip\n label={labels.clickToChange || 'Clique para alterar'}\n position=\"bottom\"\n >\n <Box\n {...props}\n pos=\"relative\"\n style={{ cursor: 'pointer' }}\n >\n <Avatar\n src={avatarPreview || user?.image}\n name={user?.name || user?.email}\n size={80}\n radius={80}\n color=\"gray\"\n />\n <ThemeIcon\n size={26}\n radius=\"xl\"\n color=\"gray\"\n pos=\"absolute\"\n bottom={0}\n right={0}\n bd=\"2px solid body\"\n >\n <IconPhoto\n size={14}\n stroke={1.5}\n />\n </ThemeIcon>\n </Box>\n </Tooltip>\n )}\n </FileButton>\n\n <Text\n size=\"xs\"\n c=\"dimmed\"\n ta=\"center\"\n >\n {labels.avatarHint || `Máximo ${Math.round(maxAvatarSize / 1024)}KB • JPG, PNG, GIF, WebP`}\n </Text>\n\n <Group\n justify=\"center\"\n gap=\"xs\"\n >\n {user?.image && (\n <Button\n variant=\"subtle\"\n color=\"gray\"\n size=\"xs\"\n onClick={handleRemoveAvatar}\n loading={loadingUpdateProfile}\n loaderProps={{ size: 12 }}\n leftSection={\n <IconTrash\n size={14}\n stroke={1.5}\n />\n }\n >\n {labels.remove || 'Remover'}\n </Button>\n )}\n <Button\n variant=\"default\"\n size=\"xs\"\n onClick={() => handleToggleSection('avatar')}\n >\n {labels.cancel || 'Cancelar'}\n </Button>\n <Button\n size=\"xs\"\n loading={loadingUpdateProfile}\n loaderProps={{ size: 12 }}\n leftSection={\n <IconCheck\n size={14}\n stroke={1.5}\n />\n }\n onClick={handleChangeAvatar}\n disabled={!avatarPreview || avatarPreview === user?.image}\n >\n {labels.save || 'Salvar'}\n </Button>\n </Group>\n </Stack>\n </Paper>\n </Collapse>\n </>\n )}\n\n {/* Name Row */}\n {showName && (\n <>\n <SettingRow\n label={labels.name || 'Nome'}\n action={labels.change || 'Change'}\n actionLabel={labels.changeName || 'Change your display name'}\n onClick={() => handleToggleSection('name')}\n expanded={editingSection === 'name'}\n >\n <Group gap=\"xs\">\n <IconPencil\n size={18}\n stroke={1.5}\n color=\"var(--mantine-color-dimmed)\"\n />\n <Text size=\"sm\">{user?.name || labels.notDefined || 'Não definido'}</Text>\n </Group>\n </SettingRow>\n\n {/* Name Change Form */}\n <Collapse in={editingSection === 'name'}>\n <Paper\n p=\"sm\"\n withBorder\n radius=\"sm\"\n >\n <form onSubmit={nameForm.onSubmit(handleChangeName)}>\n <Stack gap=\"sm\">\n <TextInput\n label={labels.name || 'Nome'}\n placeholder={labels.namePlaceholder || 'Digite seu nome'}\n leftSection={\n <IconUser\n size={16}\n stroke={1.5}\n />\n }\n {...nameForm.getInputProps('name')}\n />\n <Group\n justify=\"flex-end\"\n gap=\"xs\"\n >\n <Button\n variant=\"default\"\n size=\"xs\"\n onClick={() => handleToggleSection('name')}\n >\n {labels.cancel || 'Cancelar'}\n </Button>\n <Button\n type=\"submit\"\n size=\"xs\"\n loading={loadingUpdateProfile}\n loaderProps={{ size: 12 }}\n leftSection={\n <IconCheck\n size={14}\n stroke={1.5}\n />\n }\n >\n {labels.save || 'Salvar'}\n </Button>\n </Group>\n </Stack>\n </form>\n </Paper>\n </Collapse>\n </>\n )}\n\n {/* Email Row — somente leitura */}\n {/*\n * The email is not edited here: it is where the sign-in\n * code arrives, so changing it means changing identity,\n * and that requires proving possession of the new inbox\n * — the same code, through the sign-in flow. An editable\n * field here promised a change the API never performed.\n */}\n {showEmail && (\n <SettingRow label={labels.email || 'Email'}>\n <Group gap=\"xs\">\n <IconMail\n size={18}\n stroke={1.5}\n color=\"var(--mantine-color-dimmed)\"\n />\n <Text size=\"sm\">{user?.email || 'email@exemplo.com'}</Text>\n </Group>\n </SettingRow>\n )}\n </Stack>\n </Box>\n )}\n\n {/* Security Section */}\n {showSessions && (\n <Box mb=\"md\">\n <SectionHeader\n icon={IconShield}\n sectionTitle={labels.securitySection || 'Security'}\n description={labels.securityDescription || 'Protect your account'}\n />\n <Stack gap=\"sm\">\n {/* Active Sessions Row */}\n {showSessions && (\n <>\n <SettingRow\n label={labels.sessions || 'Sessions'}\n action={editingSection === 'sessions' ? labels.close || 'Close' : labels.manage || 'Manage'}\n actionLabel={labels.manageSessions || 'Manage your active sessions'}\n onClick={() => handleToggleSection('sessions')}\n expanded={editingSection === 'sessions'}\n >\n <Group gap=\"xs\">\n <IconDevices\n size={18}\n stroke={1.5}\n color=\"var(--mantine-color-dimmed)\"\n />\n <Text\n size=\"sm\"\n c=\"dimmed\"\n >\n {sessions.length > 0 ? `${sessions.length} active session${sessions.length > 1 ? 's' : ''}` : loadingListSessions ? 'Loading...' : 'No sessions'}\n </Text>\n </Group>\n </SettingRow>\n\n {/* Sessions List */}\n <Collapse in={editingSection === 'sessions'}>\n <Paper\n p=\"sm\"\n withBorder\n radius=\"sm\"\n >\n <Stack gap=\"xs\">\n {loadingListSessions ? (\n <Text\n size=\"xs\"\n c=\"dimmed\"\n ta=\"center\"\n py=\"md\"\n >\n {labels.loadingSessions || 'Carregando sessões...'}\n </Text>\n ) : sessions.length === 0 ? (\n <Text\n size=\"xs\"\n c=\"dimmed\"\n ta=\"center\"\n py=\"md\"\n >\n {labels.noSessionsFound || 'Nenhuma sessão encontrada'}\n </Text>\n ) : (\n <>\n {sessions.map(sessionItem => {\n const isCurrentSession = sessionItem.id === currentSession?.id\n const deviceInfo = parseUserAgent(sessionItem.userAgent)\n const createdDate = new Date(sessionItem.createdAt)\n\n return (\n <Paper\n key={sessionItem.id}\n p=\"xs\"\n withBorder={isCurrentSession}\n bd={isCurrentSession ? '1px solid gray' : undefined}\n radius=\"sm\"\n >\n <Group\n justify=\"space-between\"\n wrap=\"nowrap\"\n align=\"center\"\n >\n <Group\n gap=\"sm\"\n wrap=\"nowrap\"\n flex={1}\n >\n <ThemeIcon\n size={32}\n variant=\"subtle\"\n color=\"gray\"\n >\n <IconDeviceMobile\n size={18}\n stroke={1.5}\n />\n </ThemeIcon>\n <Box flex={1}>\n <Group gap=\"xs\">\n <Text\n size=\"xs\"\n fw={600}\n >\n {deviceInfo.browser}\n </Text>\n {isCurrentSession && (\n <Badge\n size=\"xs\"\n variant=\"light\"\n color=\"gray\"\n >\n {labels.thisDevice || 'Este dispositivo'}\n </Badge>\n )}\n </Group>\n <Text\n size=\"xs\"\n c=\"dimmed\"\n >\n {deviceInfo.os} • {sessionItem.ipAddress || labels.unknownIP || 'IP desconhecido'}\n </Text>\n <Text\n size=\"xs\"\n c=\"dimmed\"\n >\n {labels.createdAt || 'Criada em'} {createdDate.toLocaleDateString('pt-BR')} {labels.at || 'às'}{' '}\n {createdDate.toLocaleTimeString('pt-BR', { hour: '2-digit', minute: '2-digit' })}\n </Text>\n </Box>\n </Group>\n <Tooltip label={isCurrentSession ? labels.signOutAndEnd || 'Encerrar e sair' : labels.endSession || 'Encerrar sessão'}>\n <Button\n variant=\"subtle\"\n color=\"gray\"\n size=\"xs\"\n onClick={() => handleRevokeSession(sessionItem.id)}\n loading={loadingRevokeSession === sessionItem.id}\n loaderProps={{ size: 12 }}\n leftSection={\n <IconLogout\n size={14}\n stroke={1.5}\n />\n }\n >\n {labels.end || 'Encerrar'}\n </Button>\n </Tooltip>\n </Group>\n </Paper>\n )\n })}\n\n {sessions.length > 1 && (\n <Group\n justify=\"flex-end\"\n mt=\"xs\"\n >\n <Button\n variant=\"subtle\"\n color=\"gray\"\n size=\"xs\"\n onClick={handleRevokeOtherSessions}\n loading={loadingRevokeSession === 'all'}\n loaderProps={{ size: 12 }}\n leftSection={\n <IconLogout\n size={14}\n stroke={1.5}\n />\n }\n >\n {labels.endOtherSessions || 'Encerrar todas as outras sessões'}\n </Button>\n </Group>\n )}\n </>\n )}\n </Stack>\n </Paper>\n </Collapse>\n </>\n )}\n </Stack>\n </Box>\n )}\n\n {/* Custom Sections */}\n {customSections}\n </>\n )\n\n // Renderizar como Modal\n if (variant === 'modal') {\n return (\n <Modal\n opened={opened}\n onClose={onClose}\n size={width}\n withCloseButton\n radius=\"md\"\n overlayProps={{ backgroundOpacity: 0.5, blur: 4 }}\n title={\n <Group gap=\"sm\">\n <ThemeIcon\n size={32}\n variant=\"subtle\"\n color=\"gray\"\n >\n <IconUserCircle\n size={24}\n stroke={1.5}\n />\n </ThemeIcon>\n <Stack gap={0}>\n <Title\n order={5}\n fw={600}\n >\n {title}\n </Title>\n <Text\n size=\"xs\"\n c=\"dimmed\"\n >\n {subtitle}\n </Text>\n </Stack>\n </Group>\n }\n {...containerProps}\n >\n <Divider mb=\"md\" />\n {profileContent}\n </Modal>\n )\n }\n\n // Renderizar como Card\n return (\n <Paper\n withBorder\n // shadow=\"md\"\n p=\"md\"\n w={width}\n radius=\"md\"\n {...containerProps}\n >\n <Stack gap=\"sm\">\n {/* Header */}\n <Group gap=\"sm\">\n {logo ? (\n <Image\n src={logo}\n alt=\"Auth\"\n h={logoHeight}\n fit=\"contain\"\n />\n ) : (\n <ThemeIcon\n size={32}\n variant=\"subtle\"\n color=\"gray\"\n >\n <IconUserCircle\n size={24}\n stroke={1.5}\n />\n </ThemeIcon>\n )}\n <Stack gap={0}>\n <Title\n order={5}\n fw={600}\n >\n {title}\n </Title>\n <Text\n size=\"xs\"\n c=\"dimmed\"\n >\n {subtitle}\n </Text>\n </Stack>\n </Group>\n\n <Divider />\n\n {profileContent}\n </Stack>\n </Paper>\n )\n}\n","import { Avatar, Text, Group, Stack, Button, ActionIcon, Box, rem } from '@mantine/core'\nimport { IconLogout, IconSettings, IconCreditCard, IconShieldCheck } from '@tabler/icons-react'\n\n/**\n * UserInformation Component\n *\n * A versatile component to display user details and actions (account management, billing, sign out).\n * Commonly used inside Popovers, Modals, or as a standalone section in a Sidebar.\n *\n * @component\n * @example\n * ```jsx\n * <UserInformation\n * user={user}\n * signOut={signOut}\n * onAccountClick={() => navigate('/profile')}\n * onBillingClick={() => navigate('/billing')}\n * />\n * ```\n *\n * @param {Object} props - Component props\n * @param {Object} props.user - The user object containing name, email, and imageUrl\n * @param {Function} props.signOut - Function to handle user sign out\n * @param {Function} props.onAccountClick - Callback for clicking the \"Account\" button\n * @param {Function} props.onBillingClick - Callback for clicking the \"Billing\" button\n * @param {string} [props.accountLabel='Conta'] - Custom label for the account button\n * @param {string} [props.billingLabel='Assinatura'] - Custom label for the billing button\n * @param {boolean} [props.padded=true] - Whether to include padding around the component\n * @param {'sm' | 'md' | 'lg'} [props.size='sm'] - Size variant of the component\n * @param {Object} [props.style] - Custom styles to apply to the container\n */\nexport function UserInformation({ user, signOut, onAccountClick, onBillingClick, accountLabel = 'Conta', billingLabel = 'Assinatura', padded = true, size = 'sm', style, ...others }) {\n if (!user) return null\n\n // Size mappings\n const avatarSizeMap = { sm: 32, md: 40, lg: 48 }\n const fontSizeTitleMap = { sm: 'sm', md: 'md', lg: 'lg' }\n const fontSizeEmailMap = { sm: '10px', md: 'xs', lg: 'sm' }\n const btnSizeMap = { sm: 'xs', md: 'sm', lg: 'md' }\n const gapMap = { sm: 'xs', md: 'sm', lg: 'md' }\n const widthMap = { sm: 280, md: 320, lg: 400 }\n\n const name = user.fullName || user.name || 'User'\n const email = user.primaryEmailAddress || user.email || ''\n const initials = name\n .split(' ')\n .map(n => n[0])\n .join('')\n .toUpperCase()\n .slice(0, 2)\n\n return (\n <Box\n p={padded ? gapMap[size] : 0}\n w={widthMap[size]}\n style={style}\n {...others}\n >\n <Stack gap={gapMap[size]}>\n <Group\n wrap=\"nowrap\"\n gap=\"xs\"\n >\n <Avatar\n src={user.imageUrl || user.image}\n size={avatarSizeMap[size]}\n radius=\"xl\"\n bg=\"gray.1\"\n c=\"gray.6\"\n styles={{\n placeholder: { fontSize: rem(avatarSizeMap[size] / 2.2), fontWeight: 600 },\n }}\n >\n {initials || 'CC'}\n </Avatar>\n <Box style={{ flex: 1, overflow: 'hidden' }}>\n <Text\n size={fontSizeTitleMap[size]}\n fw={700}\n truncate=\"end\"\n c=\"dark.9\"\n lh={1.1}\n >\n {name}\n </Text>\n <Text\n size={fontSizeEmailMap[size]}\n c=\"gray.5\"\n truncate=\"end\"\n lh={1.1}\n >\n {email}\n </Text>\n </Box>\n <ActionIcon\n size={btnSizeMap[size]}\n onClick={signOut}\n >\n <IconLogout\n size={16}\n stroke={1.5}\n />\n </ActionIcon>\n </Group>\n\n <Group grow>\n <Button\n variant=\"default\"\n size={btnSizeMap[size]}\n leftSection={\n <IconSettings\n size={16}\n stroke={1.5}\n />\n }\n onClick={onAccountClick}\n >\n {accountLabel}\n </Button>\n\n <Button\n variant=\"default\"\n size={btnSizeMap[size]}\n leftSection={\n <IconCreditCard\n size={16}\n stroke={1.5}\n />\n }\n onClick={onBillingClick}\n >\n {billingLabel}\n </Button>\n </Group>\n\n <Group\n justify=\"center\"\n gap={4}\n opacity={0.3}\n >\n <Text\n size=\"10px\"\n c=\"gray.6\"\n fw={600}\n >\n Secured by\n </Text>\n <Group gap={2}>\n <IconShieldCheck\n size={10}\n stroke={2}\n />\n <Text\n size=\"10px\"\n fw={800}\n c=\"dark.9\"\n >\n Auth\n </Text>\n </Group>\n </Group>\n </Stack>\n </Box>\n )\n}\n","import { useAuth } from '../../AuthProvider.jsx'\n\n/**\n * Renderiza children apenas quando o usuário está autenticado\n * Equivalente ao <SignedIn> do Clerk\n */\nexport function SignedIn({ children }) {\n const { user, loading } = useAuth()\n if (loading || !user) return null\n return children\n}\n\nexport default SignedIn\n","import { useAuth } from '../../AuthProvider.jsx'\n\n/**\n * Renderiza children apenas quando o usuário NÃO está autenticado\n * Equivalente ao <SignedOut> do Clerk\n */\nexport function SignedOut({ children }) {\n const { user, loading } = useAuth()\n if (loading || user) return null\n return children\n}\n\nexport default SignedOut\n","import { useAuth } from '../../AuthProvider.jsx'\n\n/**\n * Renderiza children enquanto a autenticação está carregando\n * Equivalente ao <ClerkLoading> do Clerk\n */\nexport function AuthLoading({ children }) {\n const { loading } = useAuth()\n if (!loading) return null\n return children\n}\n\nexport default AuthLoading\n","import { useAuth } from '../../AuthProvider.jsx'\n\n/**\n * Renderiza children quando a autenticação terminou de carregar\n * Equivalente ao <ClerkLoaded> do Clerk\n */\nexport function AuthLoaded({ children }) {\n const { loading } = useAuth()\n if (loading) return null\n return children\n}\n\nexport default AuthLoaded\n","import { useNavigate } from 'react-router-dom'\n\n/**\n * Botão unstyled para navegação para página de login\n * Equivalente ao <SignInButton> do Clerk\n */\nexport function SignInButton({ children, redirectTo = '/login', ...props }) {\n const navigate = useNavigate()\n\n return (\n <button\n onClick={() => navigate(redirectTo)}\n {...props}\n >\n {children || 'Sign In'}\n </button>\n )\n}\n\nexport default SignInButton\n","import { useSignOut } from '../../AuthProvider.jsx'\n\n/**\n * Botão unstyled para fazer logout\n * Equivalente ao <SignOutButton> do Clerk\n */\nexport function SignOutButton({ children, onSignOut, ...props }) {\n const signOut = useSignOut()\n\n const handleClick = async () => {\n await signOut()\n onSignOut?.()\n }\n\n return (\n <button\n onClick={handleClick}\n {...props}\n >\n {children || 'Sign Out'}\n </button>\n )\n}\n\nexport default SignOutButton\n"],"names":["FLAG","IDENTITY_CHANGED_EVENT","announceIdentityChange","detail","window","dispatchEvent","CustomEvent","KEEP","Set","dropStoredAccountState","doomed","i","localStorage","length","k","key","has","push","removeItem","sessionStorage","clear","SWITCH_BEACON","markIdentitySwitching","setItem","String","Date","now","reason","clearIdentitySwitching","isIdentitySwitching","Boolean","shouldSignOutOn401","switching","API_BASE","API_KEY","INTERNAL_MODE","configure","apiKey","apiUrl","internal","endsWith","slice","isInternal","getApiUrl","TOKEN_STORAGE_KEY","api","route","opts","cleanRoute","startsWith","url","token","getStoredToken","headers","Accept","Authorization","res","fetch","credentials","data","status","json","catch","ok","payloadError","error","failure","Error","message","statusText","code","details","retriable","getItem","setStoredToken","handleAuthResponse","result","session","sessionToken","decodeJWT","parts","split","base64Url","base64","replace","jsonPayload","atob","Buffer","from","toString","JSON","parse","isTokenExpired","payload","exp","isExpired","console","log","diff","isAuthenticated","valid","getCurrentUser","id","sub","email","name","requestCode","method","body","stringify","verifyCode","pollCode","deviceCode","pending","interval","signOut","refreshToken","endImpersonation","impersonationId","getSession","listSessions","Array","isArray","items","revokeSession","revokeOtherSessions","getApplicationInfo","warn","updateProfile","getSocialProviders","response","startSocialSignIn","provider","redirect","destination","location","href","URL","searchParams","set","assign","consumeSocialToken","hash","params","URLSearchParams","get","previous","before","after","delete","rest","history","replaceState","pathname","search","consumeSocialError","startSocialLink","authorizeUrl","unlinkSocialProvider","getLinkedProviders","allowedOrigins","extraOrigins","list","origin","raw","isLocalhost","hostname","resolveRedirect","protocol","includes","applyRedirect","target","navigate","withToken","finalUrl","encodeURIComponent","getRedirectFromLocation","paramName","REVALIDATE_THROTTLE_MS","useAuthStore","create","user","loading","lastRevalidatedAt","sessions","currentSession","loadingStates","applicationInfo","impersonation","setLoading","value","state","fetchApplicationInfo","appInfo","syncSession","trusted","sessionData","application","semToken","anterior","trocou","reload","identityChanged","rejected","init","revalidate","force","options","err","sessionId","isCurrent","isLast","filter","s","startRefresh","refreshInterval","setInterval","timeUntilExpiry","refreshed","refreshErr","addEventListener","clearInterval","checkTokenValidity","setUser","remaining","expiresAt","ms","getTime","totalSeconds","Math","floor","padStart","styles","wrap","position","left","right","bottom","zIndex","display","justifyContent","pointerEvents","paddingLeft","paddingRight","bar","alignItems","flexWrap","gap","padding","borderRadius","background","color","fontSize","fontFamily","lineHeight","maxWidth","boxShadow","strong","fontWeight","clock","fontVariantNumeric","opacity","button","marginLeft","border","font","cursor","ImpersonationBanner","setLeft","useState","ending","setEnding","endedByTimer","useCallback","handleEnd","useEffect","timer","restante","_jsx","style","children","_jsxs","role","actor","_Fragment","type","onClick","disabled","AuthContext","createContext","IMPERSONATION_POLL_MS","AuthProvider","onError","useMemo","handleStorageChange","event","setState","handleSessionRevoked","removeEventListener","handleFocus","document","visibilityState","contextValue","Provider","useAuth","useShallow","useSignIn","sending","verifying","useSignOut","useCheckToken","useSession","useAuthLoading","useUser","loadingUpdateProfile","useSessions","loadingListSessions","loadingRevokeSession","useImpersonation","useApplicationLogo","image","Protect","fallback","redirectTo","Navigate","to","Outlet","GuestOnly","AuthCard","title","subtitle","logo","logoWidth","width","variant","opened","onClose","modalProps","props","content","Stack","align","ta","Image","src","alt","mx","w","fit","Title","order","Text","size","c","Modal","withCloseButton","radius","overlayProps","backgroundOpacity","blur","Group","h","Paper","withBorder","shadow","p","maw","MARKS","google","IconBrandGoogle","SocialButtons","labels","providers","setProviders","leaving","setLeaving","active","then","Divider","label","socialDivider","labelPosition","map","Mark","Button","fullWidth","justify","stroke","fz","fw","socialButton","Wordmark","component","lh","tt","lts","TERMS_URL","TermsNotice","text","linkText","mt","textWrap","Anchor","rel","inherit","underline","AuthTransition","Center","minHeight","Loader","SignIn","authenticatedRedirect","redirectingFallback","onSuccess","handleRedirect","redirectOrigins","onCodeSent","termsUrl","socialLogin","cardProps","authLoading","sentTo","setSentTo","setCode","codeError","setCodeError","applicationLogo","finalLogo","useNavigate","form","useForm","initialValues","validate","test","invalidEmail","redirectOriginsKey","handleRequest","values","handleVerify","redirectHandled","invalidCode","oauthPending","willRedirect","codeSent","onSubmit","TextInput","placeholder","emailPlaceholder","autoFocus","autoComplete","getInputProps","readOnly","leftSection","rightSection","IconArrowRight","sendingCode","sendCodeButton","termsNotice","termsLink","codeLabel","description","codeSentTo","onChange","currentTarget","onKeyDown","trim","undefined","verifyingCode","confirmCode","changeEmail","resendCode","UserProfile","onProfileUpdate","onSessionRevoked","onOtherSessionsRevoked","showAvatar","showName","showEmail","showSessions","logoHeight","maxAvatarSize","customSections","containerProps","editingSection","setEditingSection","parseUserAgent","ua","browser","os","handleRevokeSession","isCurrentSession","handleRevokeOtherSessions","nameForm","v","nameRequired","avatarPreview","setAvatarPreview","avatarFile","setAvatarFile","handleAvatarFileChange","file","avatarInvalidType","avatarTooLarge","round","reader","FileReader","onloadend","readAsDataURL","setValues","handleToggleSection","section","reset","handleChangeName","handleChangeAvatar","avatarRequired","handleRemoveAvatar","SectionHeader","icon","Icon","sectionTitle","mb","ThemeIcon","SettingRow","action","actionLabel","expanded","Box","py","flex","Tooltip","cancel","profileContent","IconUser","profileSection","profileDescription","avatar","update","updateAvatar","Avatar","Collapse","in","FileButton","accept","clickToChange","pos","bd","IconPhoto","avatarHint","loaderProps","IconTrash","remove","IconCheck","save","change","changeName","IconPencil","notDefined","namePlaceholder","IconMail","IconShield","securitySection","securityDescription","close","manage","manageSessions","IconDevices","loadingSessions","noSessionsFound","sessionItem","deviceInfo","userAgent","createdDate","createdAt","IconDeviceMobile","Badge","thisDevice","ipAddress","unknownIP","toLocaleDateString","at","toLocaleTimeString","hour","minute","signOutAndEnd","endSession","IconLogout","end","endOtherSessions","IconUserCircle","UserInformation","onAccountClick","onBillingClick","accountLabel","billingLabel","padded","others","avatarSizeMap","sm","md","lg","fontSizeTitleMap","fontSizeEmailMap","btnSizeMap","gapMap","widthMap","fullName","primaryEmailAddress","initials","n","join","toUpperCase","imageUrl","bg","rem","overflow","truncate","ActionIcon","grow","IconSettings","IconCreditCard","IconShieldCheck","SignedIn","SignedOut","AuthLoading","AuthLoaded","SignInButton","SignOutButton","onSignOut","handleClick"],"mappings":";;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;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