@erikey/react 0.3.5 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-Y3WVYSUI.mjs +1150 -0
- package/dist/chunk-Y3WVYSUI.mjs.map +1 -0
- package/dist/index.d.mts +858 -3823
- package/dist/index.mjs +573 -1034
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1039 -81
- package/dist/styles.css.map +1 -1
- package/dist/ui/index.mjs +17230 -908
- package/dist/ui/index.mjs.map +1 -1
- package/dist/ui/style.css +9 -0
- package/dist/ui/style.css.map +1 -0
- package/package.json +30 -9
- package/dist/ui/index.css +0 -797
- package/dist/ui/index.css.map +0 -1
- package/dist/ui/index.d.mts +0 -729
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../node_modules/.pnpm/@better-auth+core@1.4.10_@better-auth+utils@0.3.0_@better-fetch+fetch@1.1.21_better-call@1.1._s4ptmt7cznbdkhj2rfry3i4hxy/node_modules/@better-auth/core/dist/env-DbssmzoK.mjs","../../../../node_modules/.pnpm/@better-auth+core@1.4.10_@better-auth+utils@0.3.0_@better-fetch+fetch@1.1.21_better-call@1.1._s4ptmt7cznbdkhj2rfry3i4hxy/node_modules/@better-auth/core/dist/utils-NloIXYE0.mjs","../../../../node_modules/.pnpm/@better-auth+core@1.4.10_@better-auth+utils@0.3.0_@better-fetch+fetch@1.1.21_better-call@1.1._s4ptmt7cznbdkhj2rfry3i4hxy/node_modules/@better-auth/core/dist/error-RtKwr3Pu.mjs","../../../../node_modules/.pnpm/better-auth@1.4.10_drizzle-kit@0.31.8_drizzle-orm@0.45.1_@cloudflare+workers-types@4.20251119_hirg525kbrpwuqvxcih3czaike/node_modules/better-auth/src/utils/url.ts","../../../../node_modules/.pnpm/better-auth@1.4.10_drizzle-kit@0.31.8_drizzle-orm@0.45.1_@cloudflare+workers-types@4.20251119_hirg525kbrpwuqvxcih3czaike/node_modules/better-auth/src/client/fetch-plugins.ts","../../../../node_modules/.pnpm/better-auth@1.4.10_drizzle-kit@0.31.8_drizzle-orm@0.45.1_@cloudflare+workers-types@4.20251119_hirg525kbrpwuqvxcih3czaike/node_modules/better-auth/src/client/parser.ts","../../../../node_modules/.pnpm/nanostores@1.1.0/node_modules/nanostores/clean-stores/index.js","../../../../node_modules/.pnpm/nanostores@1.1.0/node_modules/nanostores/atom/index.js","../../../../node_modules/.pnpm/nanostores@1.1.0/node_modules/nanostores/lifecycle/index.js","../../../../node_modules/.pnpm/nanostores@1.1.0/node_modules/nanostores/listen-keys/index.js","../../../../node_modules/.pnpm/better-auth@1.4.10_drizzle-kit@0.31.8_drizzle-orm@0.45.1_@cloudflare+workers-types@4.20251119_hirg525kbrpwuqvxcih3czaike/node_modules/better-auth/src/client/query.ts","../../../../node_modules/.pnpm/better-auth@1.4.10_drizzle-kit@0.31.8_drizzle-orm@0.45.1_@cloudflare+workers-types@4.20251119_hirg525kbrpwuqvxcih3czaike/node_modules/better-auth/src/client/broadcast-channel.ts","../../../../node_modules/.pnpm/better-auth@1.4.10_drizzle-kit@0.31.8_drizzle-orm@0.45.1_@cloudflare+workers-types@4.20251119_hirg525kbrpwuqvxcih3czaike/node_modules/better-auth/src/client/focus-manager.ts","../../../../node_modules/.pnpm/better-auth@1.4.10_drizzle-kit@0.31.8_drizzle-orm@0.45.1_@cloudflare+workers-types@4.20251119_hirg525kbrpwuqvxcih3czaike/node_modules/better-auth/src/client/online-manager.ts","../../../../node_modules/.pnpm/better-auth@1.4.10_drizzle-kit@0.31.8_drizzle-orm@0.45.1_@cloudflare+workers-types@4.20251119_hirg525kbrpwuqvxcih3czaike/node_modules/better-auth/src/client/session-refresh.ts","../../../../node_modules/.pnpm/better-auth@1.4.10_drizzle-kit@0.31.8_drizzle-orm@0.45.1_@cloudflare+workers-types@4.20251119_hirg525kbrpwuqvxcih3czaike/node_modules/better-auth/src/client/session-atom.ts","../../../../node_modules/.pnpm/better-auth@1.4.10_drizzle-kit@0.31.8_drizzle-orm@0.45.1_@cloudflare+workers-types@4.20251119_hirg525kbrpwuqvxcih3czaike/node_modules/better-auth/src/client/config.ts","../../../../node_modules/.pnpm/better-auth@1.4.10_drizzle-kit@0.31.8_drizzle-orm@0.45.1_@cloudflare+workers-types@4.20251119_hirg525kbrpwuqvxcih3czaike/node_modules/better-auth/src/utils/is-atom.ts","../../../../node_modules/.pnpm/better-auth@1.4.10_drizzle-kit@0.31.8_drizzle-orm@0.45.1_@cloudflare+workers-types@4.20251119_hirg525kbrpwuqvxcih3czaike/node_modules/better-auth/src/client/proxy.ts","../../../../node_modules/.pnpm/better-auth@1.4.10_drizzle-kit@0.31.8_drizzle-orm@0.45.1_@cloudflare+workers-types@4.20251119_hirg525kbrpwuqvxcih3czaike/node_modules/better-auth/src/client/react/react-store.ts","../../../../node_modules/.pnpm/better-auth@1.4.10_drizzle-kit@0.31.8_drizzle-orm@0.45.1_@cloudflare+workers-types@4.20251119_hirg525kbrpwuqvxcih3czaike/node_modules/better-auth/src/client/react/index.ts"],"sourcesContent":["//#region src/env/env-impl.ts\nconst _envShim = Object.create(null);\nconst _getEnv = (useShim) => globalThis.process?.env || globalThis.Deno?.env.toObject() || globalThis.__env__ || (useShim ? _envShim : globalThis);\nconst env = new Proxy(_envShim, {\n\tget(_, prop) {\n\t\treturn _getEnv()[prop] ?? _envShim[prop];\n\t},\n\thas(_, prop) {\n\t\treturn prop in _getEnv() || prop in _envShim;\n\t},\n\tset(_, prop, value) {\n\t\tconst env$1 = _getEnv(true);\n\t\tenv$1[prop] = value;\n\t\treturn true;\n\t},\n\tdeleteProperty(_, prop) {\n\t\tif (!prop) return false;\n\t\tconst env$1 = _getEnv(true);\n\t\tdelete env$1[prop];\n\t\treturn true;\n\t},\n\townKeys() {\n\t\tconst env$1 = _getEnv(true);\n\t\treturn Object.keys(env$1);\n\t}\n});\nfunction toBoolean(val) {\n\treturn val ? val !== \"false\" : false;\n}\nconst nodeENV = typeof process !== \"undefined\" && process.env && process.env.NODE_ENV || \"\";\n/** Detect if `NODE_ENV` environment variable is `production` */\nconst isProduction = nodeENV === \"production\";\n/** Detect if `NODE_ENV` environment variable is `dev` or `development` */\nconst isDevelopment = () => nodeENV === \"dev\" || nodeENV === \"development\";\n/** Detect if `NODE_ENV` environment variable is `test` */\nconst isTest = () => nodeENV === \"test\" || toBoolean(env.TEST);\n/**\n* Get environment variable with fallback\n*/\nfunction getEnvVar(key, fallback) {\n\tif (typeof process !== \"undefined\" && process.env) return process.env[key] ?? fallback;\n\tif (typeof Deno !== \"undefined\") return Deno.env.get(key) ?? fallback;\n\tif (typeof Bun !== \"undefined\") return Bun.env[key] ?? fallback;\n\treturn fallback;\n}\n/**\n* Get boolean environment variable\n*/\nfunction getBooleanEnvVar(key, fallback = true) {\n\tconst value = getEnvVar(key);\n\tif (!value) return fallback;\n\treturn value !== \"0\" && value.toLowerCase() !== \"false\" && value !== \"\";\n}\n/**\n* Common environment variables used in Better Auth\n*/\nconst ENV = Object.freeze({\n\tget BETTER_AUTH_SECRET() {\n\t\treturn getEnvVar(\"BETTER_AUTH_SECRET\");\n\t},\n\tget AUTH_SECRET() {\n\t\treturn getEnvVar(\"AUTH_SECRET\");\n\t},\n\tget BETTER_AUTH_TELEMETRY() {\n\t\treturn getEnvVar(\"BETTER_AUTH_TELEMETRY\");\n\t},\n\tget BETTER_AUTH_TELEMETRY_ID() {\n\t\treturn getEnvVar(\"BETTER_AUTH_TELEMETRY_ID\");\n\t},\n\tget NODE_ENV() {\n\t\treturn getEnvVar(\"NODE_ENV\", \"development\");\n\t},\n\tget PACKAGE_VERSION() {\n\t\treturn getEnvVar(\"PACKAGE_VERSION\", \"0.0.0\");\n\t},\n\tget BETTER_AUTH_TELEMETRY_ENDPOINT() {\n\t\treturn getEnvVar(\"BETTER_AUTH_TELEMETRY_ENDPOINT\", \"https://telemetry.better-auth.com/v1/track\");\n\t}\n});\n\n//#endregion\n//#region src/env/color-depth.ts\nconst COLORS_2 = 1;\nconst COLORS_16 = 4;\nconst COLORS_256 = 8;\nconst COLORS_16m = 24;\nconst TERM_ENVS = {\n\teterm: COLORS_16,\n\tcons25: COLORS_16,\n\tconsole: COLORS_16,\n\tcygwin: COLORS_16,\n\tdtterm: COLORS_16,\n\tgnome: COLORS_16,\n\thurd: COLORS_16,\n\tjfbterm: COLORS_16,\n\tkonsole: COLORS_16,\n\tkterm: COLORS_16,\n\tmlterm: COLORS_16,\n\tmosh: COLORS_16m,\n\tputty: COLORS_16,\n\tst: COLORS_16,\n\t\"rxvt-unicode-24bit\": COLORS_16m,\n\tterminator: COLORS_16m,\n\t\"xterm-kitty\": COLORS_16m\n};\nconst CI_ENVS_MAP = new Map(Object.entries({\n\tAPPVEYOR: COLORS_256,\n\tBUILDKITE: COLORS_256,\n\tCIRCLECI: COLORS_16m,\n\tDRONE: COLORS_256,\n\tGITEA_ACTIONS: COLORS_16m,\n\tGITHUB_ACTIONS: COLORS_16m,\n\tGITLAB_CI: COLORS_256,\n\tTRAVIS: COLORS_256\n}));\nconst TERM_ENVS_REG_EXP = [\n\t/ansi/,\n\t/color/,\n\t/linux/,\n\t/direct/,\n\t/^con[0-9]*x[0-9]/,\n\t/^rxvt/,\n\t/^screen/,\n\t/^xterm/,\n\t/^vt100/,\n\t/^vt220/\n];\nfunction getColorDepth() {\n\tif (getEnvVar(\"FORCE_COLOR\") !== void 0) switch (getEnvVar(\"FORCE_COLOR\")) {\n\t\tcase \"\":\n\t\tcase \"1\":\n\t\tcase \"true\": return COLORS_16;\n\t\tcase \"2\": return COLORS_256;\n\t\tcase \"3\": return COLORS_16m;\n\t\tdefault: return COLORS_2;\n\t}\n\tif (getEnvVar(\"NODE_DISABLE_COLORS\") !== void 0 && getEnvVar(\"NODE_DISABLE_COLORS\") !== \"\" || getEnvVar(\"NO_COLOR\") !== void 0 && getEnvVar(\"NO_COLOR\") !== \"\" || getEnvVar(\"TERM\") === \"dumb\") return COLORS_2;\n\tif (getEnvVar(\"TMUX\")) return COLORS_16m;\n\tif (\"TF_BUILD\" in env && \"AGENT_NAME\" in env) return COLORS_16;\n\tif (\"CI\" in env) {\n\t\tfor (const { 0: envName, 1: colors } of CI_ENVS_MAP) if (envName in env) return colors;\n\t\tif (getEnvVar(\"CI_NAME\") === \"codeship\") return COLORS_256;\n\t\treturn COLORS_2;\n\t}\n\tif (\"TEAMCITY_VERSION\" in env) return /^(9\\.(0*[1-9]\\d*)\\.|\\d{2,}\\.)/.exec(getEnvVar(\"TEAMCITY_VERSION\")) !== null ? COLORS_16 : COLORS_2;\n\tswitch (getEnvVar(\"TERM_PROGRAM\")) {\n\t\tcase \"iTerm.app\":\n\t\t\tif (!getEnvVar(\"TERM_PROGRAM_VERSION\") || /^[0-2]\\./.exec(getEnvVar(\"TERM_PROGRAM_VERSION\")) !== null) return COLORS_256;\n\t\t\treturn COLORS_16m;\n\t\tcase \"HyperTerm\":\n\t\tcase \"MacTerm\": return COLORS_16m;\n\t\tcase \"Apple_Terminal\": return COLORS_256;\n\t}\n\tif (getEnvVar(\"COLORTERM\") === \"truecolor\" || getEnvVar(\"COLORTERM\") === \"24bit\") return COLORS_16m;\n\tif (getEnvVar(\"TERM\")) {\n\t\tif (/truecolor/.exec(getEnvVar(\"TERM\")) !== null) return COLORS_16m;\n\t\tif (/^xterm-256/.exec(getEnvVar(\"TERM\")) !== null) return COLORS_256;\n\t\tconst termEnv = getEnvVar(\"TERM\").toLowerCase();\n\t\tif (TERM_ENVS[termEnv]) return TERM_ENVS[termEnv];\n\t\tif (TERM_ENVS_REG_EXP.some((term) => term.exec(termEnv) !== null)) return COLORS_16;\n\t}\n\tif (getEnvVar(\"COLORTERM\")) return COLORS_16;\n\treturn COLORS_2;\n}\n\n//#endregion\n//#region src/env/logger.ts\nconst TTY_COLORS = {\n\treset: \"\\x1B[0m\",\n\tbright: \"\\x1B[1m\",\n\tdim: \"\\x1B[2m\",\n\tundim: \"\\x1B[22m\",\n\tunderscore: \"\\x1B[4m\",\n\tblink: \"\\x1B[5m\",\n\treverse: \"\\x1B[7m\",\n\thidden: \"\\x1B[8m\",\n\tfg: {\n\t\tblack: \"\\x1B[30m\",\n\t\tred: \"\\x1B[31m\",\n\t\tgreen: \"\\x1B[32m\",\n\t\tyellow: \"\\x1B[33m\",\n\t\tblue: \"\\x1B[34m\",\n\t\tmagenta: \"\\x1B[35m\",\n\t\tcyan: \"\\x1B[36m\",\n\t\twhite: \"\\x1B[37m\"\n\t},\n\tbg: {\n\t\tblack: \"\\x1B[40m\",\n\t\tred: \"\\x1B[41m\",\n\t\tgreen: \"\\x1B[42m\",\n\t\tyellow: \"\\x1B[43m\",\n\t\tblue: \"\\x1B[44m\",\n\t\tmagenta: \"\\x1B[45m\",\n\t\tcyan: \"\\x1B[46m\",\n\t\twhite: \"\\x1B[47m\"\n\t}\n};\nconst levels = [\n\t\"debug\",\n\t\"info\",\n\t\"success\",\n\t\"warn\",\n\t\"error\"\n];\nfunction shouldPublishLog(currentLogLevel, logLevel) {\n\treturn levels.indexOf(logLevel) >= levels.indexOf(currentLogLevel);\n}\nconst levelColors = {\n\tinfo: TTY_COLORS.fg.blue,\n\tsuccess: TTY_COLORS.fg.green,\n\twarn: TTY_COLORS.fg.yellow,\n\terror: TTY_COLORS.fg.red,\n\tdebug: TTY_COLORS.fg.magenta\n};\nconst formatMessage = (level, message, colorsEnabled) => {\n\tconst timestamp = (/* @__PURE__ */ new Date()).toISOString();\n\tif (colorsEnabled) return `${TTY_COLORS.dim}${timestamp}${TTY_COLORS.reset} ${levelColors[level]}${level.toUpperCase()}${TTY_COLORS.reset} ${TTY_COLORS.bright}[Better Auth]:${TTY_COLORS.reset} ${message}`;\n\treturn `${timestamp} ${level.toUpperCase()} [Better Auth]: ${message}`;\n};\nconst createLogger = (options) => {\n\tconst enabled = options?.disabled !== true;\n\tconst logLevel = options?.level ?? \"error\";\n\tconst colorsEnabled = options?.disableColors !== void 0 ? !options.disableColors : getColorDepth() !== 1;\n\tconst LogFunc = (level, message, args = []) => {\n\t\tif (!enabled || !shouldPublishLog(logLevel, level)) return;\n\t\tconst formattedMessage = formatMessage(level, message, colorsEnabled);\n\t\tif (!options || typeof options.log !== \"function\") {\n\t\t\tif (level === \"error\") console.error(formattedMessage, ...args);\n\t\t\telse if (level === \"warn\") console.warn(formattedMessage, ...args);\n\t\t\telse console.log(formattedMessage, ...args);\n\t\t\treturn;\n\t\t}\n\t\toptions.log(level === \"success\" ? \"info\" : level, message, ...args);\n\t};\n\treturn {\n\t\t...Object.fromEntries(levels.map((level) => [level, (...[message, ...args]) => LogFunc(level, message, args)])),\n\t\tget level() {\n\t\t\treturn logLevel;\n\t\t}\n\t};\n};\nconst logger = createLogger();\n\n//#endregion\nexport { shouldPublishLog as a, env as c, isDevelopment as d, isProduction as f, logger as i, getBooleanEnvVar as l, nodeENV as m, createLogger as n, getColorDepth as o, isTest as p, levels as r, ENV as s, TTY_COLORS as t, getEnvVar as u };","import { i as logger } from \"./env-DbssmzoK.mjs\";\nimport { createRandomStringGenerator } from \"@better-auth/utils/random\";\n\n//#region src/utils/error-codes.ts\nfunction defineErrorCodes(codes) {\n\treturn codes;\n}\n\n//#endregion\n//#region src/utils/id.ts\nconst generateId = (size) => {\n\treturn createRandomStringGenerator(\"a-z\", \"A-Z\", \"0-9\")(size || 32);\n};\n\n//#endregion\n//#region src/utils/json.ts\nfunction safeJSONParse(data) {\n\tfunction reviver(_, value) {\n\t\tif (typeof value === \"string\") {\n\t\t\tif (/^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?Z$/.test(value)) {\n\t\t\t\tconst date = new Date(value);\n\t\t\t\tif (!isNaN(date.getTime())) return date;\n\t\t\t}\n\t\t}\n\t\treturn value;\n\t}\n\ttry {\n\t\tif (typeof data !== \"string\") return data;\n\t\treturn JSON.parse(data, reviver);\n\t} catch (e) {\n\t\tlogger.error(\"Error parsing JSON\", { error: e });\n\t\treturn null;\n\t}\n}\n\n//#endregion\n//#region src/utils/string.ts\nfunction capitalizeFirstLetter(str) {\n\treturn str.charAt(0).toUpperCase() + str.slice(1);\n}\n\n//#endregion\nexport { defineErrorCodes as i, safeJSONParse as n, generateId as r, capitalizeFirstLetter as t };","import { i as defineErrorCodes } from \"./utils-NloIXYE0.mjs\";\n\n//#region src/error/codes.ts\nconst BASE_ERROR_CODES = defineErrorCodes({\n\tUSER_NOT_FOUND: \"User not found\",\n\tFAILED_TO_CREATE_USER: \"Failed to create user\",\n\tFAILED_TO_CREATE_SESSION: \"Failed to create session\",\n\tFAILED_TO_UPDATE_USER: \"Failed to update user\",\n\tFAILED_TO_GET_SESSION: \"Failed to get session\",\n\tINVALID_PASSWORD: \"Invalid password\",\n\tINVALID_EMAIL: \"Invalid email\",\n\tINVALID_EMAIL_OR_PASSWORD: \"Invalid email or password\",\n\tSOCIAL_ACCOUNT_ALREADY_LINKED: \"Social account already linked\",\n\tPROVIDER_NOT_FOUND: \"Provider not found\",\n\tINVALID_TOKEN: \"Invalid token\",\n\tID_TOKEN_NOT_SUPPORTED: \"id_token not supported\",\n\tFAILED_TO_GET_USER_INFO: \"Failed to get user info\",\n\tUSER_EMAIL_NOT_FOUND: \"User email not found\",\n\tEMAIL_NOT_VERIFIED: \"Email not verified\",\n\tPASSWORD_TOO_SHORT: \"Password too short\",\n\tPASSWORD_TOO_LONG: \"Password too long\",\n\tUSER_ALREADY_EXISTS: \"User already exists.\",\n\tUSER_ALREADY_EXISTS_USE_ANOTHER_EMAIL: \"User already exists. Use another email.\",\n\tEMAIL_CAN_NOT_BE_UPDATED: \"Email can not be updated\",\n\tCREDENTIAL_ACCOUNT_NOT_FOUND: \"Credential account not found\",\n\tSESSION_EXPIRED: \"Session expired. Re-authenticate to perform this action.\",\n\tFAILED_TO_UNLINK_LAST_ACCOUNT: \"You can't unlink your last account\",\n\tACCOUNT_NOT_FOUND: \"Account not found\",\n\tUSER_ALREADY_HAS_PASSWORD: \"User already has a password. Provide that to delete the account.\",\n\tCROSS_SITE_NAVIGATION_LOGIN_BLOCKED: \"Cross-site navigation login blocked. This request appears to be a CSRF attack.\",\n\tVERIFICATION_EMAIL_NOT_ENABLED: \"Verification email isn't enabled\",\n\tEMAIL_ALREADY_VERIFIED: \"Email is already verified\",\n\tEMAIL_MISMATCH: \"Email mismatch\",\n\tSESSION_NOT_FRESH: \"Session is not fresh\",\n\tLINKED_ACCOUNT_ALREADY_EXISTS: \"Linked account already exists\",\n\tINVALID_ORIGIN: \"Invalid origin\",\n\tINVALID_CALLBACK_URL: \"Invalid callbackURL\",\n\tINVALID_REDIRECT_URL: \"Invalid redirectURL\",\n\tINVALID_ERROR_CALLBACK_URL: \"Invalid errorCallbackURL\",\n\tINVALID_NEW_USER_CALLBACK_URL: \"Invalid newUserCallbackURL\",\n\tMISSING_OR_NULL_ORIGIN: \"Missing or null Origin\",\n\tCALLBACK_URL_REQUIRED: \"callbackURL is required\",\n\tFAILED_TO_CREATE_VERIFICATION: \"Unable to create verification\",\n\tFIELD_NOT_ALLOWED: \"Field not allowed to be set\",\n\tASYNC_VALIDATION_NOT_SUPPORTED: \"Async validation is not supported\",\n\tVALIDATION_ERROR: \"Validation Error\",\n\tMISSING_FIELD: \"Field is required\"\n});\n\n//#endregion\n//#region src/error/index.ts\nvar BetterAuthError = class extends Error {\n\tconstructor(message, cause) {\n\t\tsuper(message);\n\t\tthis.name = \"BetterAuthError\";\n\t\tthis.message = message;\n\t\tthis.cause = cause;\n\t\tthis.stack = \"\";\n\t}\n};\n\n//#endregion\nexport { BASE_ERROR_CODES as n, BetterAuthError as t };","import { env } from \"@better-auth/core/env\";\nimport { BetterAuthError } from \"@better-auth/core/error\";\n\nfunction checkHasPath(url: string): boolean {\n\ttry {\n\t\tconst parsedUrl = new URL(url);\n\t\tconst pathname = parsedUrl.pathname.replace(/\\/+$/, \"\") || \"/\";\n\t\treturn pathname !== \"/\";\n\t} catch {\n\t\tthrow new BetterAuthError(\n\t\t\t`Invalid base URL: ${url}. Please provide a valid base URL.`,\n\t\t);\n\t}\n}\n\nfunction assertHasProtocol(url: string): void {\n\ttry {\n\t\tconst parsedUrl = new URL(url);\n\t\tif (parsedUrl.protocol !== \"http:\" && parsedUrl.protocol !== \"https:\") {\n\t\t\tthrow new BetterAuthError(\n\t\t\t\t`Invalid base URL: ${url}. URL must include 'http://' or 'https://'`,\n\t\t\t);\n\t\t}\n\t} catch (error) {\n\t\tif (error instanceof BetterAuthError) {\n\t\t\tthrow error;\n\t\t}\n\t\tthrow new BetterAuthError(\n\t\t\t`Invalid base URL: ${url}. Please provide a valid base URL.`,\n\t\t\tString(error),\n\t\t);\n\t}\n}\n\nfunction withPath(url: string, path = \"/api/auth\") {\n\tassertHasProtocol(url);\n\n\tconst hasPath = checkHasPath(url);\n\tif (hasPath) {\n\t\treturn url;\n\t}\n\n\tconst trimmedUrl = url.replace(/\\/+$/, \"\");\n\n\tif (!path || path === \"/\") {\n\t\treturn trimmedUrl;\n\t}\n\n\tpath = path.startsWith(\"/\") ? path : `/${path}`;\n\treturn `${trimmedUrl}${path}`;\n}\n\nfunction validateProxyHeader(header: string, type: \"host\" | \"proto\"): boolean {\n\tif (!header || header.trim() === \"\") {\n\t\treturn false;\n\t}\n\n\tif (type === \"proto\") {\n\t\t// Only allow http and https protocols\n\t\treturn header === \"http\" || header === \"https\";\n\t}\n\n\tif (type === \"host\") {\n\t\tconst suspiciousPatterns = [\n\t\t\t/\\.\\./, // Path traversal\n\t\t\t/\\0/, // Null bytes\n\t\t\t/[\\s]/, // Whitespace (except legitimate spaces that should be trimmed)\n\t\t\t/^[.]/, // Starting with dot\n\t\t\t/[<>'\"]/, // HTML/script injection characters\n\t\t\t/javascript:/i, // Protocol injection\n\t\t\t/file:/i, // File protocol\n\t\t\t/data:/i, // Data protocol\n\t\t];\n\n\t\tif (suspiciousPatterns.some((pattern) => pattern.test(header))) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Basic hostname validation (allows localhost, IPs, and domains with ports)\n\t\t// This is a simple check, not exhaustive RFC validation\n\t\tconst hostnameRegex =\n\t\t\t/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*(:[0-9]{1,5})?$/;\n\n\t\t// Also allow IPv4 addresses\n\t\tconst ipv4Regex = /^(\\d{1,3}\\.){3}\\d{1,3}(:[0-9]{1,5})?$/;\n\n\t\t// Also allow IPv6 addresses in brackets\n\t\tconst ipv6Regex = /^\\[[0-9a-fA-F:]+\\](:[0-9]{1,5})?$/;\n\n\t\t// Allow localhost variations\n\t\tconst localhostRegex = /^localhost(:[0-9]{1,5})?$/i;\n\n\t\treturn (\n\t\t\thostnameRegex.test(header) ||\n\t\t\tipv4Regex.test(header) ||\n\t\t\tipv6Regex.test(header) ||\n\t\t\tlocalhostRegex.test(header)\n\t\t);\n\t}\n\n\treturn false;\n}\n\nexport function getBaseURL(\n\turl?: string,\n\tpath?: string,\n\trequest?: Request,\n\tloadEnv?: boolean,\n\ttrustedProxyHeaders?: boolean | undefined,\n) {\n\tif (url) {\n\t\treturn withPath(url, path);\n\t}\n\n\tif (loadEnv !== false) {\n\t\tconst fromEnv =\n\t\t\tenv.BETTER_AUTH_URL ||\n\t\t\tenv.NEXT_PUBLIC_BETTER_AUTH_URL ||\n\t\t\tenv.PUBLIC_BETTER_AUTH_URL ||\n\t\t\tenv.NUXT_PUBLIC_BETTER_AUTH_URL ||\n\t\t\tenv.NUXT_PUBLIC_AUTH_URL ||\n\t\t\t(env.BASE_URL !== \"/\" ? env.BASE_URL : undefined);\n\n\t\tif (fromEnv) {\n\t\t\treturn withPath(fromEnv, path);\n\t\t}\n\t}\n\n\tconst fromRequest = request?.headers.get(\"x-forwarded-host\");\n\tconst fromRequestProto = request?.headers.get(\"x-forwarded-proto\");\n\tif (fromRequest && fromRequestProto && trustedProxyHeaders) {\n\t\tif (\n\t\t\tvalidateProxyHeader(fromRequestProto, \"proto\") &&\n\t\t\tvalidateProxyHeader(fromRequest, \"host\")\n\t\t) {\n\t\t\ttry {\n\t\t\t\treturn withPath(`${fromRequestProto}://${fromRequest}`, path);\n\t\t\t} catch (_error) {}\n\t\t}\n\t}\n\n\tif (request) {\n\t\tconst url = getOrigin(request.url);\n\t\tif (!url) {\n\t\t\tthrow new BetterAuthError(\n\t\t\t\t\"Could not get origin from request. Please provide a valid base URL.\",\n\t\t\t);\n\t\t}\n\t\treturn withPath(url, path);\n\t}\n\n\tif (typeof window !== \"undefined\" && window.location) {\n\t\treturn withPath(window.location.origin, path);\n\t}\n\treturn undefined;\n}\n\nexport function getOrigin(url: string) {\n\ttry {\n\t\tconst parsedUrl = new URL(url);\n\t\t// For custom URL schemes (like exp://), the origin property returns the string \"null\"\n\t\t// instead of null. We need to handle this case and return null so the fallback logic works.\n\t\treturn parsedUrl.origin === \"null\" ? null : parsedUrl.origin;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nexport function getProtocol(url: string) {\n\ttry {\n\t\tconst parsedUrl = new URL(url);\n\t\treturn parsedUrl.protocol;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nexport function getHost(url: string) {\n\ttry {\n\t\tconst parsedUrl = new URL(url);\n\t\treturn parsedUrl.host;\n\t} catch {\n\t\treturn null;\n\t}\n}\n","import type { BetterFetchPlugin } from \"@better-fetch/fetch\";\n\nexport const redirectPlugin = {\n\tid: \"redirect\",\n\tname: \"Redirect\",\n\thooks: {\n\t\tonSuccess(context) {\n\t\t\tif (context.data?.url && context.data?.redirect) {\n\t\t\t\tif (typeof window !== \"undefined\" && window.location) {\n\t\t\t\t\tif (window.location) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\twindow.location.href = context.data.url;\n\t\t\t\t\t\t} catch {}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t},\n} satisfies BetterFetchPlugin;\n","const PROTO_POLLUTION_PATTERNS = {\n\tproto:\n\t\t/\"(?:_|\\\\u0{2}5[Ff]){2}(?:p|\\\\u0{2}70)(?:r|\\\\u0{2}72)(?:o|\\\\u0{2}6[Ff])(?:t|\\\\u0{2}74)(?:o|\\\\u0{2}6[Ff])(?:_|\\\\u0{2}5[Ff]){2}\"\\s*:/,\n\tconstructor:\n\t\t/\"(?:c|\\\\u0063)(?:o|\\\\u006[Ff])(?:n|\\\\u006[Ee])(?:s|\\\\u0073)(?:t|\\\\u0074)(?:r|\\\\u0072)(?:u|\\\\u0075)(?:c|\\\\u0063)(?:t|\\\\u0074)(?:o|\\\\u006[Ff])(?:r|\\\\u0072)\"\\s*:/,\n\tprotoShort: /\"__proto__\"\\s*:/,\n\tconstructorShort: /\"constructor\"\\s*:/,\n} as const;\n\nconst JSON_SIGNATURE =\n\t/^\\s*[\"[{]|^\\s*-?\\d{1,16}(\\.\\d{1,17})?([Ee][+-]?\\d+)?\\s*$/;\n\nconst SPECIAL_VALUES = {\n\ttrue: true,\n\tfalse: false,\n\tnull: null,\n\tundefined: undefined,\n\tnan: Number.NaN,\n\tinfinity: Number.POSITIVE_INFINITY,\n\t\"-infinity\": Number.NEGATIVE_INFINITY,\n} as const;\n\nconst ISO_DATE_REGEX =\n\t/^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})(?:\\.(\\d{1,7}))?(?:Z|([+-])(\\d{2}):(\\d{2}))$/;\n\ntype ParseOptions = {\n\t/** Throw errors instead of returning the original value */\n\tstrict?: boolean | undefined;\n\t/** Log warnings when suspicious patterns are detected */\n\twarnings?: boolean | undefined;\n\t/** Custom reviver function */\n\treviver?: ((key: string, value: any) => any) | undefined;\n\t/** Automatically convert ISO date strings to Date objects */\n\tparseDates?: boolean | undefined;\n};\n\nfunction isValidDate(date: Date): boolean {\n\treturn date instanceof Date && !isNaN(date.getTime());\n}\n\nfunction parseISODate(value: string): Date | null {\n\tconst match = ISO_DATE_REGEX.exec(value);\n\tif (!match) return null;\n\n\tconst [\n\t\t,\n\t\tyear,\n\t\tmonth,\n\t\tday,\n\t\thour,\n\t\tminute,\n\t\tsecond,\n\t\tms,\n\t\toffsetSign,\n\t\toffsetHour,\n\t\toffsetMinute,\n\t] = match;\n\n\tlet date = new Date(\n\t\tDate.UTC(\n\t\t\tparseInt(year!, 10),\n\t\t\tparseInt(month!, 10) - 1,\n\t\t\tparseInt(day!, 10),\n\t\t\tparseInt(hour!, 10),\n\t\t\tparseInt(minute!, 10),\n\t\t\tparseInt(second!, 10),\n\t\t\tms ? parseInt(ms.padEnd(3, \"0\"), 10) : 0,\n\t\t),\n\t);\n\n\tif (offsetSign) {\n\t\tconst offset =\n\t\t\t(parseInt(offsetHour!, 10) * 60 + parseInt(offsetMinute!, 10)) *\n\t\t\t(offsetSign === \"+\" ? -1 : 1);\n\t\tdate.setUTCMinutes(date.getUTCMinutes() + offset);\n\t}\n\n\treturn isValidDate(date) ? date : null;\n}\n\nfunction betterJSONParse<T = unknown>(\n\tvalue: unknown,\n\toptions: ParseOptions = {},\n): T {\n\tconst {\n\t\tstrict = false,\n\t\twarnings = false,\n\t\treviver,\n\t\tparseDates = true,\n\t} = options;\n\n\tif (typeof value !== \"string\") {\n\t\treturn value as T;\n\t}\n\n\tconst trimmed = value.trim();\n\n\tif (\n\t\ttrimmed.length > 0 &&\n\t\ttrimmed[0] === '\"' &&\n\t\ttrimmed.endsWith('\"') &&\n\t\t!trimmed.slice(1, -1).includes('\"')\n\t) {\n\t\treturn trimmed.slice(1, -1) as T;\n\t}\n\n\tconst lowerValue = trimmed.toLowerCase();\n\tif (lowerValue.length <= 9 && lowerValue in SPECIAL_VALUES) {\n\t\treturn SPECIAL_VALUES[lowerValue as keyof typeof SPECIAL_VALUES] as T;\n\t}\n\n\tif (!JSON_SIGNATURE.test(trimmed)) {\n\t\tif (strict) {\n\t\t\tthrow new SyntaxError(\"[better-json] Invalid JSON\");\n\t\t}\n\t\treturn value as T;\n\t}\n\n\tconst hasProtoPattern = Object.entries(PROTO_POLLUTION_PATTERNS).some(\n\t\t([key, pattern]) => {\n\t\t\tconst matches = pattern.test(trimmed);\n\t\t\tif (matches && warnings) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`[better-json] Detected potential prototype pollution attempt using ${key} pattern`,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn matches;\n\t\t},\n\t);\n\n\tif (hasProtoPattern && strict) {\n\t\tthrow new Error(\n\t\t\t\"[better-json] Potential prototype pollution attempt detected\",\n\t\t);\n\t}\n\n\ttry {\n\t\tconst secureReviver = (key: string, value: any) => {\n\t\t\tif (\n\t\t\t\tkey === \"__proto__\" ||\n\t\t\t\t(key === \"constructor\" &&\n\t\t\t\t\tvalue &&\n\t\t\t\t\ttypeof value === \"object\" &&\n\t\t\t\t\t\"prototype\" in value)\n\t\t\t) {\n\t\t\t\tif (warnings) {\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`[better-json] Dropping \"${key}\" key to prevent prototype pollution`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tif (parseDates && typeof value === \"string\") {\n\t\t\t\tconst date = parseISODate(value);\n\t\t\t\tif (date) {\n\t\t\t\t\treturn date;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn reviver ? reviver(key, value) : value;\n\t\t};\n\n\t\treturn JSON.parse(trimmed, secureReviver);\n\t} catch (error) {\n\t\tif (strict) {\n\t\t\tthrow error;\n\t\t}\n\t\treturn value as T;\n\t}\n}\n\nexport function parseJSON<T = unknown>(\n\tvalue: unknown,\n\toptions: ParseOptions = { strict: true },\n): T {\n\treturn betterJSONParse<T>(value, options);\n}\n","import { cleanTasks } from '../task/index.js'\n\nexport let clean = Symbol('clean')\n\nexport let cleanStores = (...stores) => {\n if (process.env.NODE_ENV === 'production') {\n throw new Error(\n 'cleanStores() can be used only during development or tests'\n )\n }\n cleanTasks()\n for (let $store of stores) {\n if ($store) {\n if ($store.mocked) delete $store.mocked\n if ($store[clean]) $store[clean]()\n }\n }\n}\n","import { clean } from '../clean-stores/index.js'\n\nlet listenerQueue = []\nlet lqIndex = 0\nconst QUEUE_ITEMS_PER_LISTENER = 4\nexport let epoch = 0\n\n/* @__NO_SIDE_EFFECTS__ */\nexport const atom = initialValue => {\n let listeners = []\n let $atom = {\n get() {\n if (!$atom.lc) {\n $atom.listen(() => {})()\n }\n return $atom.value\n },\n lc: 0,\n listen(listener) {\n $atom.lc = listeners.push(listener)\n\n return () => {\n for (\n let i = lqIndex + QUEUE_ITEMS_PER_LISTENER;\n i < listenerQueue.length;\n\n ) {\n if (listenerQueue[i] === listener) {\n listenerQueue.splice(i, QUEUE_ITEMS_PER_LISTENER)\n } else {\n i += QUEUE_ITEMS_PER_LISTENER\n }\n }\n\n let index = listeners.indexOf(listener)\n if (~index) {\n listeners.splice(index, 1)\n if (!--$atom.lc) $atom.off()\n }\n }\n },\n notify(oldValue, changedKey) {\n epoch++\n let runListenerQueue = !listenerQueue.length\n for (let listener of listeners) {\n listenerQueue.push(listener, $atom.value, oldValue, changedKey)\n }\n\n if (runListenerQueue) {\n for (\n lqIndex = 0;\n lqIndex < listenerQueue.length;\n lqIndex += QUEUE_ITEMS_PER_LISTENER\n ) {\n listenerQueue[lqIndex](\n listenerQueue[lqIndex + 1],\n listenerQueue[lqIndex + 2],\n listenerQueue[lqIndex + 3]\n )\n }\n listenerQueue.length = 0\n }\n },\n /* It will be called on last listener unsubscribing.\n We will redefine it in onMount and onStop. */\n off() {},\n set(newValue) {\n let oldValue = $atom.value\n if (oldValue !== newValue) {\n $atom.value = newValue\n $atom.notify(oldValue)\n }\n },\n subscribe(listener) {\n let unbind = $atom.listen(listener)\n listener($atom.value)\n return unbind\n },\n value: initialValue\n }\n\n if (process.env.NODE_ENV !== 'production') {\n $atom[clean] = () => {\n listeners = []\n $atom.lc = 0\n $atom.off()\n }\n }\n\n return $atom\n}\n\nexport const readonlyType = store => store\n","import { clean } from '../clean-stores/index.js'\n\nconst START = 0\nconst STOP = 1\nconst SET = 2\nconst NOTIFY = 3\nconst MOUNT = 5\nconst UNMOUNT = 6\nconst REVERT_MUTATION = 10\n\nexport let on = (object, listener, eventKey, mutateStore) => {\n object.events = object.events || {}\n if (!object.events[eventKey + REVERT_MUTATION]) {\n object.events[eventKey + REVERT_MUTATION] = mutateStore(eventProps => {\n // eslint-disable-next-line no-sequences\n object.events[eventKey].reduceRight((event, l) => (l(event), event), {\n shared: {},\n ...eventProps\n })\n })\n }\n object.events[eventKey] = object.events[eventKey] || []\n object.events[eventKey].push(listener)\n return () => {\n let currentListeners = object.events[eventKey]\n let index = currentListeners.indexOf(listener)\n currentListeners.splice(index, 1)\n if (!currentListeners.length) {\n delete object.events[eventKey]\n object.events[eventKey + REVERT_MUTATION]()\n delete object.events[eventKey + REVERT_MUTATION]\n }\n }\n}\n\nexport let onStart = ($store, listener) =>\n on($store, listener, START, runListeners => {\n let originListen = $store.listen\n $store.listen = arg => {\n if (!$store.lc && !$store.starting) {\n $store.starting = true\n runListeners()\n delete $store.starting\n }\n return originListen(arg)\n }\n return () => {\n $store.listen = originListen\n }\n })\n\nexport let onStop = ($store, listener) =>\n on($store, listener, STOP, runListeners => {\n let originOff = $store.off\n $store.off = () => {\n runListeners()\n originOff()\n }\n return () => {\n $store.off = originOff\n }\n })\n\nexport let onSet = ($store, listener) =>\n on($store, listener, SET, runListeners => {\n let originSet = $store.set\n let originSetKey = $store.setKey\n if ($store.setKey) {\n $store.setKey = (changed, changedValue) => {\n let isAborted\n let abort = () => {\n isAborted = true\n }\n\n runListeners({\n abort,\n changed,\n newValue: { ...$store.value, [changed]: changedValue }\n })\n if (!isAborted) return originSetKey(changed, changedValue)\n }\n }\n $store.set = newValue => {\n let isAborted\n let abort = () => {\n isAborted = true\n }\n\n runListeners({ abort, newValue })\n if (!isAborted) return originSet(newValue)\n }\n return () => {\n $store.set = originSet\n $store.setKey = originSetKey\n }\n })\n\nexport let onNotify = ($store, listener) =>\n on($store, listener, NOTIFY, runListeners => {\n let originNotify = $store.notify\n $store.notify = (oldValue, changed) => {\n let isAborted\n let abort = () => {\n isAborted = true\n }\n\n runListeners({ abort, changed, oldValue })\n if (!isAborted) return originNotify(oldValue, changed)\n }\n return () => {\n $store.notify = originNotify\n }\n })\n\nexport let STORE_UNMOUNT_DELAY = 1000\n\nexport let onMount = ($store, initialize) => {\n let listener = payload => {\n let destroy = initialize(payload)\n if (destroy) $store.events[UNMOUNT].push(destroy)\n }\n return on($store, listener, MOUNT, runListeners => {\n let originListen = $store.listen\n $store.listen = (...args) => {\n if (!$store.lc && !$store.active) {\n $store.active = true\n runListeners()\n }\n return originListen(...args)\n }\n\n let originOff = $store.off\n $store.events[UNMOUNT] = []\n $store.off = () => {\n originOff()\n setTimeout(() => {\n if ($store.active && !$store.lc) {\n $store.active = false\n for (let destroy of $store.events[UNMOUNT]) destroy()\n $store.events[UNMOUNT] = []\n }\n }, STORE_UNMOUNT_DELAY)\n }\n\n if (process.env.NODE_ENV !== 'production') {\n let originClean = $store[clean]\n $store[clean] = () => {\n for (let destroy of $store.events[UNMOUNT]) destroy()\n $store.events[UNMOUNT] = []\n $store.active = false\n originClean()\n }\n }\n\n return () => {\n $store.listen = originListen\n $store.off = originOff\n }\n })\n}\n","export function listenKeys($store, keys, listener) {\n let keysSet = new Set(keys).add(undefined)\n return $store.listen((value, oldValue, changed) => {\n if (keysSet.has(changed)) {\n listener(value, oldValue, changed)\n }\n })\n}\n\nexport function subscribeKeys($store, keys, listener) {\n let unbind = listenKeys($store, keys, listener)\n listener($store.value)\n return unbind\n}\n","import type { ClientFetchOption } from \"@better-auth/core\";\nimport type { BetterFetch, BetterFetchError } from \"@better-fetch/fetch\";\nimport type { PreinitializedWritableAtom } from \"nanostores\";\nimport { atom, onMount } from \"nanostores\";\nimport type { SessionQueryParams } from \"./types\";\n\n// SSR detection\nconst isServer = () => typeof window === \"undefined\";\n\nexport type AuthQueryAtom<T> = PreinitializedWritableAtom<{\n\tdata: null | T;\n\terror: null | BetterFetchError;\n\tisPending: boolean;\n\tisRefetching: boolean;\n\trefetch: (\n\t\tqueryParams?: { query?: SessionQueryParams } | undefined,\n\t) => Promise<void>;\n}>;\n\nexport const useAuthQuery = <T>(\n\tinitializedAtom:\n\t\t| PreinitializedWritableAtom<any>\n\t\t| PreinitializedWritableAtom<any>[],\n\tpath: string,\n\t$fetch: BetterFetch,\n\toptions?:\n\t\t| (\n\t\t\t\t| ((value: {\n\t\t\t\t\t\tdata: null | T;\n\t\t\t\t\t\terror: null | BetterFetchError;\n\t\t\t\t\t\tisPending: boolean;\n\t\t\t\t }) => ClientFetchOption)\n\t\t\t\t| ClientFetchOption\n\t\t )\n\t\t| undefined,\n) => {\n\tconst value: AuthQueryAtom<T> = atom({\n\t\tdata: null,\n\t\terror: null,\n\t\tisPending: true,\n\t\tisRefetching: false,\n\t\trefetch: (queryParams) => fn(queryParams),\n\t});\n\n\tconst fn = async (\n\t\tqueryParams?: { query?: SessionQueryParams } | undefined,\n\t) => {\n\t\treturn new Promise<void>((resolve) => {\n\t\t\tconst opts =\n\t\t\t\ttypeof options === \"function\"\n\t\t\t\t\t? options({\n\t\t\t\t\t\t\tdata: value.get().data,\n\t\t\t\t\t\t\terror: value.get().error,\n\t\t\t\t\t\t\tisPending: value.get().isPending,\n\t\t\t\t\t\t})\n\t\t\t\t\t: options;\n\n\t\t\t$fetch<T>(path, {\n\t\t\t\t...opts,\n\t\t\t\tquery: {\n\t\t\t\t\t...opts?.query,\n\t\t\t\t\t...queryParams?.query,\n\t\t\t\t},\n\t\t\t\tasync onSuccess(context) {\n\t\t\t\t\tvalue.set({\n\t\t\t\t\t\tdata: context.data,\n\t\t\t\t\t\terror: null,\n\t\t\t\t\t\tisPending: false,\n\t\t\t\t\t\tisRefetching: false,\n\t\t\t\t\t\trefetch: value.value.refetch,\n\t\t\t\t\t});\n\t\t\t\t\tawait opts?.onSuccess?.(context);\n\t\t\t\t},\n\t\t\t\tasync onError(context) {\n\t\t\t\t\tconst { request } = context;\n\t\t\t\t\tconst retryAttempts =\n\t\t\t\t\t\ttypeof request.retry === \"number\"\n\t\t\t\t\t\t\t? request.retry\n\t\t\t\t\t\t\t: request.retry?.attempts;\n\t\t\t\t\tconst retryAttempt = request.retryAttempt || 0;\n\t\t\t\t\tif (retryAttempts && retryAttempt < retryAttempts) return;\n\t\t\t\t\tvalue.set({\n\t\t\t\t\t\terror: context.error,\n\t\t\t\t\t\tdata: null,\n\t\t\t\t\t\tisPending: false,\n\t\t\t\t\t\tisRefetching: false,\n\t\t\t\t\t\trefetch: value.value.refetch,\n\t\t\t\t\t});\n\t\t\t\t\tawait opts?.onError?.(context);\n\t\t\t\t},\n\t\t\t\tasync onRequest(context) {\n\t\t\t\t\tconst currentValue = value.get();\n\t\t\t\t\tvalue.set({\n\t\t\t\t\t\tisPending: currentValue.data === null,\n\t\t\t\t\t\tdata: currentValue.data,\n\t\t\t\t\t\terror: null,\n\t\t\t\t\t\tisRefetching: true,\n\t\t\t\t\t\trefetch: value.value.refetch,\n\t\t\t\t\t});\n\t\t\t\t\tawait opts?.onRequest?.(context);\n\t\t\t\t},\n\t\t\t})\n\t\t\t\t.catch((error) => {\n\t\t\t\t\tvalue.set({\n\t\t\t\t\t\terror,\n\t\t\t\t\t\tdata: null,\n\t\t\t\t\t\tisPending: false,\n\t\t\t\t\t\tisRefetching: false,\n\t\t\t\t\t\trefetch: value.value.refetch,\n\t\t\t\t\t});\n\t\t\t\t})\n\t\t\t\t.finally(() => {\n\t\t\t\t\tresolve(void 0);\n\t\t\t\t});\n\t\t});\n\t};\n\tinitializedAtom = Array.isArray(initializedAtom)\n\t\t? initializedAtom\n\t\t: [initializedAtom];\n\tlet isMounted = false;\n\n\tfor (const initAtom of initializedAtom) {\n\t\tinitAtom.subscribe(async () => {\n\t\t\tif (isServer()) {\n\t\t\t\t// On server, don't trigger fetch\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (isMounted) {\n\t\t\t\tawait fn();\n\t\t\t} else {\n\t\t\t\tonMount(value, () => {\n\t\t\t\t\tconst timeoutId = setTimeout(async () => {\n\t\t\t\t\t\tif (!isMounted) {\n\t\t\t\t\t\t\tawait fn();\n\t\t\t\t\t\t\tisMounted = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}, 0);\n\t\t\t\t\treturn () => {\n\t\t\t\t\t\tvalue.off();\n\t\t\t\t\t\tinitAtom.off();\n\t\t\t\t\t\tclearTimeout(timeoutId);\n\t\t\t\t\t};\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n\treturn value;\n};\n","export interface BroadcastMessage {\n\tevent?: \"session\" | undefined;\n\tdata?: { trigger?: \"signout\" | \"getSession\" | \"updateUser\" } | undefined;\n\tclientId: string;\n\ttimestamp: number;\n}\n\nexport type BroadcastListener = (message: BroadcastMessage) => void;\n\nexport const kBroadcastChannel = Symbol.for(\"better-auth:broadcast-channel\");\n\nconst now = () => Math.floor(Date.now() / 1000);\n\nexport interface BroadcastChannel {\n\tpost(message: Record<string, unknown>): void;\n\tsubscribe(listener: BroadcastListener): () => void;\n\tsetup(): () => void;\n}\n\nclass WindowBroadcastChannel implements BroadcastChannel {\n\tlisteners = new Set<BroadcastListener>();\n\tprivate name: string;\n\n\tconstructor(name = \"better-auth.message\") {\n\t\tthis.name = name;\n\t}\n\n\tsubscribe(listener: BroadcastListener) {\n\t\tthis.listeners.add(listener);\n\t\treturn () => {\n\t\t\tthis.listeners.delete(listener);\n\t\t};\n\t}\n\n\tpost(message: Record<string, unknown>) {\n\t\tif (typeof window === \"undefined\") return;\n\t\ttry {\n\t\t\tlocalStorage.setItem(\n\t\t\t\tthis.name,\n\t\t\t\tJSON.stringify({ ...message, timestamp: now() }),\n\t\t\t);\n\t\t} catch {}\n\t}\n\n\tsetup() {\n\t\tif (\n\t\t\ttypeof window === \"undefined\" ||\n\t\t\ttypeof window.addEventListener === \"undefined\"\n\t\t) {\n\t\t\treturn () => {};\n\t\t}\n\n\t\tconst handler = (event: StorageEvent) => {\n\t\t\tif (event.key !== this.name) return;\n\t\t\tconst message: BroadcastMessage = JSON.parse(event.newValue ?? \"{}\");\n\t\t\tif (message?.event !== \"session\" || !message?.data) return;\n\n\t\t\tthis.listeners.forEach((listener) => listener(message));\n\t\t};\n\n\t\twindow.addEventListener(\"storage\", handler);\n\n\t\treturn () => {\n\t\t\twindow.removeEventListener(\"storage\", handler);\n\t\t};\n\t}\n}\n\nexport function getGlobalBroadcastChannel(name = \"better-auth.message\") {\n\tif (!(globalThis as any)[kBroadcastChannel]) {\n\t\t(globalThis as any)[kBroadcastChannel] = new WindowBroadcastChannel(name);\n\t}\n\treturn (globalThis as any)[kBroadcastChannel] as BroadcastChannel;\n}\n","export type FocusListener = (focused: boolean) => void;\n\nexport const kFocusManager = Symbol.for(\"better-auth:focus-manager\");\n\nexport interface FocusManager {\n\tsetFocused(focused: boolean): void;\n\tsubscribe(listener: FocusListener): () => void;\n\tsetup(): () => void;\n}\n\nclass WindowFocusManager implements FocusManager {\n\tlisteners = new Set<FocusListener>();\n\n\tsubscribe(listener: FocusListener) {\n\t\tthis.listeners.add(listener);\n\t\treturn () => {\n\t\t\tthis.listeners.delete(listener);\n\t\t};\n\t}\n\n\tsetFocused(focused: boolean) {\n\t\tthis.listeners.forEach((listener) => listener(focused));\n\t}\n\n\tsetup() {\n\t\tif (\n\t\t\ttypeof window === \"undefined\" ||\n\t\t\ttypeof document === \"undefined\" ||\n\t\t\ttypeof window.addEventListener === \"undefined\"\n\t\t) {\n\t\t\treturn () => {};\n\t\t}\n\n\t\tconst visibilityHandler = () => {\n\t\t\tif (document.visibilityState === \"visible\") {\n\t\t\t\tthis.setFocused(true);\n\t\t\t}\n\t\t};\n\n\t\tdocument.addEventListener(\"visibilitychange\", visibilityHandler, false);\n\n\t\treturn () => {\n\t\t\tdocument.removeEventListener(\n\t\t\t\t\"visibilitychange\",\n\t\t\t\tvisibilityHandler,\n\t\t\t\tfalse,\n\t\t\t);\n\t\t};\n\t}\n}\n\nexport function getGlobalFocusManager() {\n\tif (!(globalThis as any)[kFocusManager]) {\n\t\t(globalThis as any)[kFocusManager] = new WindowFocusManager();\n\t}\n\treturn (globalThis as any)[kFocusManager] as FocusManager;\n}\n","export type OnlineListener = (online: boolean) => void;\n\nexport const kOnlineManager = Symbol.for(\"better-auth:online-manager\");\n\nexport interface OnlineManager {\n\tsetOnline(online: boolean): void;\n\tisOnline: boolean;\n\n\tsubscribe(listener: OnlineListener): () => void;\n\tsetup(): () => void;\n}\n\nclass WindowOnlineManager implements OnlineManager {\n\tlisteners = new Set<OnlineListener>();\n\tisOnline = typeof navigator !== \"undefined\" ? navigator.onLine : true;\n\n\tsubscribe(listener: OnlineListener) {\n\t\tthis.listeners.add(listener);\n\t\treturn () => {\n\t\t\tthis.listeners.delete(listener);\n\t\t};\n\t}\n\n\tsetOnline(online: boolean) {\n\t\tthis.isOnline = online;\n\t\tthis.listeners.forEach((listener) => listener(online));\n\t}\n\n\tsetup() {\n\t\tif (\n\t\t\ttypeof window === \"undefined\" ||\n\t\t\ttypeof window.addEventListener === \"undefined\"\n\t\t) {\n\t\t\treturn () => {};\n\t\t}\n\n\t\tconst onOnline = () => this.setOnline(true);\n\t\tconst onOffline = () => this.setOnline(false);\n\n\t\twindow.addEventListener(\"online\", onOnline, false);\n\t\twindow.addEventListener(\"offline\", onOffline, false);\n\n\t\treturn () => {\n\t\t\twindow.removeEventListener(\"online\", onOnline, false);\n\t\t\twindow.removeEventListener(\"offline\", onOffline, false);\n\t\t};\n\t}\n}\n\nexport function getGlobalOnlineManager() {\n\tif (!(globalThis as any)[kOnlineManager]) {\n\t\t(globalThis as any)[kOnlineManager] = new WindowOnlineManager();\n\t}\n\treturn (globalThis as any)[kOnlineManager] as OnlineManager;\n}\n","import type { BetterAuthClientOptions } from \"@better-auth/core\";\nimport type { Session, User } from \"@better-auth/core/db\";\nimport type { BetterFetch, BetterFetchError } from \"@better-fetch/fetch\";\nimport type { WritableAtom } from \"nanostores\";\nimport { getGlobalBroadcastChannel } from \"./broadcast-channel\";\nimport { getGlobalFocusManager } from \"./focus-manager\";\nimport { getGlobalOnlineManager } from \"./online-manager\";\nimport type { AuthQueryAtom } from \"./query\";\n\nconst now = () => Math.floor(Date.now() / 1000);\n\n/**\n * Rate limit: don't refetch on focus if a session request was made within this many seconds\n */\nconst FOCUS_REFETCH_RATE_LIMIT_SECONDS = 5;\n\nexport interface SessionRefreshOptions {\n\tsessionAtom: AuthQueryAtom<{\n\t\tuser: User;\n\t\tsession: Session;\n\t}>;\n\tsessionSignal: WritableAtom<boolean>;\n\t$fetch: BetterFetch;\n\toptions?: BetterAuthClientOptions | undefined;\n}\n\ninterface SessionRefreshState {\n\tlastSync: number;\n\tlastSessionRequest: number;\n\tcachedSession: any;\n\tpollInterval?: ReturnType<typeof setInterval> | undefined;\n\tunsubscribeBroadcast?: (() => void) | undefined;\n\tunsubscribeFocus?: (() => void) | undefined;\n\tunsubscribeOnline?: (() => void) | undefined;\n}\n\nexport function createSessionRefreshManager(opts: SessionRefreshOptions) {\n\tconst { sessionAtom, sessionSignal, $fetch, options = {} } = opts;\n\n\tconst refetchInterval = options.sessionOptions?.refetchInterval ?? 0;\n\tconst refetchOnWindowFocus =\n\t\toptions.sessionOptions?.refetchOnWindowFocus ?? true;\n\tconst refetchWhenOffline =\n\t\toptions.sessionOptions?.refetchWhenOffline ?? false;\n\n\tconst state: SessionRefreshState = {\n\t\tlastSync: 0,\n\t\tlastSessionRequest: 0,\n\t\tcachedSession: undefined,\n\t};\n\n\tconst shouldRefetch = (): boolean => {\n\t\treturn refetchWhenOffline || getGlobalOnlineManager().isOnline;\n\t};\n\n\tconst triggerRefetch = (\n\t\tevent?:\n\t\t\t| {\n\t\t\t\t\tevent?: \"poll\" | \"visibilitychange\" | \"storage\";\n\t\t\t }\n\t\t\t| undefined,\n\t) => {\n\t\tif (!shouldRefetch()) return;\n\n\t\tif (event?.event === \"storage\") {\n\t\t\tstate.lastSync = now();\n\t\t\tsessionSignal.set(!sessionSignal.get());\n\t\t\treturn;\n\t\t}\n\n\t\tconst currentSession = sessionAtom.get();\n\n\t\tif (event?.event === \"poll\") {\n\t\t\tstate.lastSessionRequest = now();\n\t\t\t$fetch<{\n\t\t\t\tuser: User;\n\t\t\t\tsession: Session;\n\t\t\t}>(\"/get-session\")\n\t\t\t\t.then((res) => {\n\t\t\t\t\tif (res.error) {\n\t\t\t\t\t\tsessionAtom.set({\n\t\t\t\t\t\t\t...currentSession,\n\t\t\t\t\t\t\tdata: null,\n\t\t\t\t\t\t\terror: res.error as BetterFetchError | null,\n\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsessionAtom.set({\n\t\t\t\t\t\t\t...currentSession,\n\t\t\t\t\t\t\tdata: res.data,\n\t\t\t\t\t\t\terror: null,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tstate.lastSync = now();\n\t\t\t\t\tsessionSignal.set(!sessionSignal.get());\n\t\t\t\t})\n\t\t\t\t.catch(() => {});\n\t\t\treturn;\n\t\t}\n\n\t\t// Rate limit: don't refetch on focus if a session request was made recently\n\t\tif (event?.event === \"visibilitychange\") {\n\t\t\tconst timeSinceLastRequest = now() - state.lastSessionRequest;\n\t\t\tif (timeSinceLastRequest < FOCUS_REFETCH_RATE_LIMIT_SECONDS) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tstate.lastSessionRequest = now();\n\t\t}\n\n\t\tif (\n\t\t\tcurrentSession?.data === null ||\n\t\t\tcurrentSession?.data === undefined ||\n\t\t\tevent?.event === \"visibilitychange\"\n\t\t) {\n\t\t\tstate.lastSync = now();\n\t\t\tsessionSignal.set(!sessionSignal.get());\n\t\t}\n\t};\n\n\tconst broadcastSessionUpdate = (\n\t\ttrigger: \"signout\" | \"getSession\" | \"updateUser\",\n\t) => {\n\t\tgetGlobalBroadcastChannel().post({\n\t\t\tevent: \"session\",\n\t\t\tdata: { trigger },\n\t\t\tclientId: Math.random().toString(36).substring(7),\n\t\t});\n\t};\n\n\tconst setupPolling = () => {\n\t\tif (refetchInterval && refetchInterval > 0) {\n\t\t\tstate.pollInterval = setInterval(() => {\n\t\t\t\tconst currentSession = sessionAtom.get();\n\t\t\t\tif (currentSession?.data) {\n\t\t\t\t\ttriggerRefetch({ event: \"poll\" });\n\t\t\t\t}\n\t\t\t}, refetchInterval * 1000);\n\t\t}\n\t};\n\n\tconst setupBroadcast = () => {\n\t\tstate.unsubscribeBroadcast = getGlobalBroadcastChannel().subscribe(() => {\n\t\t\ttriggerRefetch({ event: \"storage\" });\n\t\t});\n\t};\n\n\tconst setupFocusRefetch = () => {\n\t\tif (!refetchOnWindowFocus) return;\n\n\t\tstate.unsubscribeFocus = getGlobalFocusManager().subscribe(() => {\n\t\t\ttriggerRefetch({ event: \"visibilitychange\" });\n\t\t});\n\t};\n\n\tconst setupOnlineRefetch = () => {\n\t\tstate.unsubscribeOnline = getGlobalOnlineManager().subscribe((online) => {\n\t\t\tif (online) {\n\t\t\t\ttriggerRefetch({ event: \"visibilitychange\" });\n\t\t\t}\n\t\t});\n\t};\n\n\tconst init = () => {\n\t\tsetupPolling();\n\t\tsetupBroadcast();\n\t\tsetupFocusRefetch();\n\t\tsetupOnlineRefetch();\n\n\t\tgetGlobalBroadcastChannel().setup();\n\t\tgetGlobalFocusManager().setup();\n\t\tgetGlobalOnlineManager().setup();\n\t};\n\n\tconst cleanup = () => {\n\t\tif (state.pollInterval) {\n\t\t\tclearInterval(state.pollInterval);\n\t\t\tstate.pollInterval = undefined;\n\t\t}\n\t\tif (state.unsubscribeBroadcast) {\n\t\t\tstate.unsubscribeBroadcast();\n\t\t\tstate.unsubscribeBroadcast = undefined;\n\t\t}\n\t\tif (state.unsubscribeFocus) {\n\t\t\tstate.unsubscribeFocus();\n\t\t\tstate.unsubscribeFocus = undefined;\n\t\t}\n\t\tif (state.unsubscribeOnline) {\n\t\t\tstate.unsubscribeOnline();\n\t\t\tstate.unsubscribeOnline = undefined;\n\t\t}\n\t\tstate.lastSync = 0;\n\t\tstate.lastSessionRequest = 0;\n\t\tstate.cachedSession = undefined;\n\t};\n\n\treturn {\n\t\tinit,\n\t\tcleanup,\n\t\ttriggerRefetch,\n\t\tbroadcastSessionUpdate,\n\t};\n}\n","import type { BetterAuthClientOptions } from \"@better-auth/core\";\nimport type { BetterFetch } from \"@better-fetch/fetch\";\nimport { atom, onMount } from \"nanostores\";\nimport type { Session, User } from \"../types\";\nimport type { AuthQueryAtom } from \"./query\";\nimport { useAuthQuery } from \"./query\";\nimport { createSessionRefreshManager } from \"./session-refresh\";\n\nexport type SessionAtom = AuthQueryAtom<{\n\tuser: User;\n\tsession: Session;\n}>;\n\nexport function getSessionAtom(\n\t$fetch: BetterFetch,\n\toptions?: BetterAuthClientOptions | undefined,\n) {\n\tconst $signal = atom<boolean>(false);\n\tconst session: SessionAtom = useAuthQuery<{\n\t\tuser: User;\n\t\tsession: Session;\n\t}>($signal, \"/get-session\", $fetch, {\n\t\tmethod: \"GET\",\n\t});\n\n\tonMount(session, () => {\n\t\tconst refreshManager = createSessionRefreshManager({\n\t\t\tsessionAtom: session,\n\t\t\tsessionSignal: $signal,\n\t\t\t$fetch,\n\t\t\toptions,\n\t\t});\n\n\t\trefreshManager.init();\n\n\t\treturn () => {\n\t\t\trefreshManager.cleanup();\n\t\t};\n\t});\n\n\treturn {\n\t\tsession,\n\t\t$sessionSignal: $signal,\n\t};\n}\n","import type {\n\tBetterAuthClientOptions,\n\tClientAtomListener,\n} from \"@better-auth/core\";\nimport { createFetch } from \"@better-fetch/fetch\";\nimport type { WritableAtom } from \"nanostores\";\nimport { getBaseURL } from \"../utils/url\";\nimport { redirectPlugin } from \"./fetch-plugins\";\nimport { parseJSON } from \"./parser\";\nimport { getSessionAtom } from \"./session-atom\";\n\nexport const getClientConfig = (\n\toptions?: BetterAuthClientOptions | undefined,\n\tloadEnv?: boolean | undefined,\n) => {\n\t/* check if the credentials property is supported. Useful for cf workers */\n\tconst isCredentialsSupported = \"credentials\" in Request.prototype;\n\tconst baseURL =\n\t\tgetBaseURL(options?.baseURL, options?.basePath, undefined, loadEnv) ??\n\t\t\"/api/auth\";\n\tconst pluginsFetchPlugins =\n\t\toptions?.plugins\n\t\t\t?.flatMap((plugin) => plugin.fetchPlugins)\n\t\t\t.filter((pl) => pl !== undefined) || [];\n\tconst lifeCyclePlugin = {\n\t\tid: \"lifecycle-hooks\",\n\t\tname: \"lifecycle-hooks\",\n\t\thooks: {\n\t\t\tonSuccess: options?.fetchOptions?.onSuccess,\n\t\t\tonError: options?.fetchOptions?.onError,\n\t\t\tonRequest: options?.fetchOptions?.onRequest,\n\t\t\tonResponse: options?.fetchOptions?.onResponse,\n\t\t},\n\t};\n\tconst {\n\t\tonSuccess: _onSuccess,\n\t\tonError: _onError,\n\t\tonRequest: _onRequest,\n\t\tonResponse: _onResponse,\n\t\t...restOfFetchOptions\n\t} = options?.fetchOptions || {};\n\tconst $fetch = createFetch({\n\t\tbaseURL,\n\t\t...(isCredentialsSupported ? { credentials: \"include\" } : {}),\n\t\tmethod: \"GET\",\n\t\tjsonParser(text) {\n\t\t\tif (!text) {\n\t\t\t\treturn null as any;\n\t\t\t}\n\t\t\treturn parseJSON(text, {\n\t\t\t\tstrict: false,\n\t\t\t});\n\t\t},\n\t\tcustomFetchImpl: fetch,\n\t\t...restOfFetchOptions,\n\t\tplugins: [\n\t\t\tlifeCyclePlugin,\n\t\t\t...(restOfFetchOptions.plugins || []),\n\t\t\t...(options?.disableDefaultFetchPlugins ? [] : [redirectPlugin]),\n\t\t\t...pluginsFetchPlugins,\n\t\t],\n\t});\n\tconst { $sessionSignal, session } = getSessionAtom($fetch, options);\n\tconst plugins = options?.plugins || [];\n\tlet pluginsActions = {} as Record<string, any>;\n\tlet pluginsAtoms = {\n\t\t$sessionSignal,\n\t\tsession,\n\t} as Record<string, WritableAtom<any>>;\n\tlet pluginPathMethods: Record<string, \"POST\" | \"GET\"> = {\n\t\t\"/sign-out\": \"POST\",\n\t\t\"/revoke-sessions\": \"POST\",\n\t\t\"/revoke-other-sessions\": \"POST\",\n\t\t\"/delete-user\": \"POST\",\n\t};\n\tconst atomListeners: ClientAtomListener[] = [\n\t\t{\n\t\t\tsignal: \"$sessionSignal\",\n\t\t\tmatcher(path) {\n\t\t\t\tconst matchesCommonPaths =\n\t\t\t\t\tpath === \"/sign-out\" ||\n\t\t\t\t\tpath === \"/update-user\" ||\n\t\t\t\t\tpath === \"/sign-up/email\" ||\n\t\t\t\t\tpath === \"/sign-in/email\" ||\n\t\t\t\t\tpath === \"/delete-user\" ||\n\t\t\t\t\tpath === \"/verify-email\" ||\n\t\t\t\t\tpath === \"/revoke-sessions\" ||\n\t\t\t\t\tpath === \"/revoke-session\" ||\n\t\t\t\t\tpath === \"/change-email\";\n\n\t\t\t\treturn matchesCommonPaths;\n\t\t\t},\n\t\t},\n\t];\n\n\tfor (const plugin of plugins) {\n\t\tif (plugin.getAtoms) {\n\t\t\tObject.assign(pluginsAtoms, plugin.getAtoms?.($fetch));\n\t\t}\n\t\tif (plugin.pathMethods) {\n\t\t\tObject.assign(pluginPathMethods, plugin.pathMethods);\n\t\t}\n\t\tif (plugin.atomListeners) {\n\t\t\tatomListeners.push(...plugin.atomListeners);\n\t\t}\n\t}\n\n\tconst $store = {\n\t\tnotify: (\n\t\t\tsignal?: (Omit<string, \"$sessionSignal\"> | \"$sessionSignal\") | undefined,\n\t\t) => {\n\t\t\tpluginsAtoms[signal as keyof typeof pluginsAtoms]!.set(\n\t\t\t\t!pluginsAtoms[signal as keyof typeof pluginsAtoms]!.get(),\n\t\t\t);\n\t\t},\n\t\tlisten: (\n\t\t\tsignal: Omit<string, \"$sessionSignal\"> | \"$sessionSignal\",\n\t\t\tlistener: (value: boolean, oldValue?: boolean | undefined) => void,\n\t\t) => {\n\t\t\tpluginsAtoms[signal as keyof typeof pluginsAtoms]!.subscribe(listener);\n\t\t},\n\t\tatoms: pluginsAtoms,\n\t};\n\n\tfor (const plugin of plugins) {\n\t\tif (plugin.getActions) {\n\t\t\tObject.assign(\n\t\t\t\tpluginsActions,\n\t\t\t\tplugin.getActions?.($fetch, $store, options),\n\t\t\t);\n\t\t}\n\t}\n\treturn {\n\t\tget baseURL() {\n\t\t\treturn baseURL;\n\t\t},\n\t\tpluginsActions,\n\t\tpluginsAtoms,\n\t\tpluginPathMethods,\n\t\tatomListeners,\n\t\t$fetch,\n\t\t$store,\n\t};\n};\n","import type { Atom } from \"nanostores\";\n\nexport function isAtom(value: unknown): value is Atom<unknown> {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\t\"get\" in value &&\n\t\ttypeof (value as any).get === \"function\" &&\n\t\t\"lc\" in value &&\n\t\ttypeof (value as any).lc === \"number\"\n\t);\n}\n","import type {\n\tBetterAuthClientPlugin,\n\tClientAtomListener,\n\tClientFetchOption,\n} from \"@better-auth/core\";\nimport type { BetterFetch } from \"@better-fetch/fetch\";\nimport type { Atom } from \"nanostores\";\nimport { isAtom } from \"../utils/is-atom\";\nimport type { ProxyRequest } from \"./path-to-object\";\n\nfunction getMethod(\n\tpath: string,\n\tknownPathMethods: Record<string, \"POST\" | \"GET\">,\n\targs:\n\t\t| {\n\t\t\t\tfetchOptions?: ClientFetchOption | undefined;\n\t\t\t\tquery?: Record<string, any> | undefined;\n\t\t }\n\t\t| undefined,\n) {\n\tconst method = knownPathMethods[path];\n\tconst { fetchOptions, query: _query, ...body } = args || {};\n\tif (method) {\n\t\treturn method;\n\t}\n\tif (fetchOptions?.method) {\n\t\treturn fetchOptions.method;\n\t}\n\tif (body && Object.keys(body).length > 0) {\n\t\treturn \"POST\";\n\t}\n\treturn \"GET\";\n}\n\nexport function createDynamicPathProxy<T extends Record<string, any>>(\n\troutes: T,\n\tclient: BetterFetch,\n\tknownPathMethods: Record<string, \"POST\" | \"GET\">,\n\tatoms: Record<string, Atom>,\n\tatomListeners: BetterAuthClientPlugin[\"atomListeners\"],\n): T {\n\tfunction createProxy(path: string[] = []): any {\n\t\treturn new Proxy(function () {}, {\n\t\t\tget(_, prop) {\n\t\t\t\tif (typeof prop !== \"string\") {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\tif (prop === \"then\" || prop === \"catch\" || prop === \"finally\") {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\tconst fullPath = [...path, prop];\n\t\t\t\tlet current: any = routes;\n\t\t\t\tfor (const segment of fullPath) {\n\t\t\t\t\tif (current && typeof current === \"object\" && segment in current) {\n\t\t\t\t\t\tcurrent = current[segment];\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcurrent = undefined;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (typeof current === \"function\") {\n\t\t\t\t\treturn current;\n\t\t\t\t}\n\t\t\t\tif (isAtom(current)) {\n\t\t\t\t\treturn current;\n\t\t\t\t}\n\t\t\t\treturn createProxy(fullPath);\n\t\t\t},\n\t\t\tapply: async (_, __, args) => {\n\t\t\t\tconst routePath =\n\t\t\t\t\t\"/\" +\n\t\t\t\t\tpath\n\t\t\t\t\t\t.map((segment) =>\n\t\t\t\t\t\t\tsegment.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`),\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.join(\"/\");\n\t\t\t\tconst arg = (args[0] || {}) as ProxyRequest;\n\t\t\t\tconst fetchOptions = (args[1] || {}) as ClientFetchOption;\n\t\t\t\tconst { query, fetchOptions: argFetchOptions, ...body } = arg;\n\t\t\t\tconst options = {\n\t\t\t\t\t...fetchOptions,\n\t\t\t\t\t...argFetchOptions,\n\t\t\t\t} as ClientFetchOption;\n\t\t\t\tconst method = getMethod(routePath, knownPathMethods, arg);\n\t\t\t\treturn await client(routePath, {\n\t\t\t\t\t...options,\n\t\t\t\t\tbody:\n\t\t\t\t\t\tmethod === \"GET\"\n\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t\t...body,\n\t\t\t\t\t\t\t\t\t...(options?.body || {}),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\tquery: query || options?.query,\n\t\t\t\t\tmethod,\n\t\t\t\t\tasync onSuccess(context) {\n\t\t\t\t\t\tawait options?.onSuccess?.(context);\n\t\t\t\t\t\tif (!atomListeners || options.disableSignal) return;\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * We trigger listeners\n\t\t\t\t\t\t */\n\t\t\t\t\t\tconst matches = atomListeners.filter((s) => s.matcher(routePath));\n\t\t\t\t\t\tif (!matches.length) return;\n\n\t\t\t\t\t\tconst visited = new Set<ClientAtomListener[\"signal\"]>();\n\t\t\t\t\t\tfor (const match of matches) {\n\t\t\t\t\t\t\tconst signal = atoms[match.signal as any];\n\t\t\t\t\t\t\tif (!signal) return;\n\t\t\t\t\t\t\tif (visited.has(match.signal)) {\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvisited.add(match.signal);\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * To avoid race conditions we set the signal in a setTimeout\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\tconst val = signal.get();\n\t\t\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\t\t\t//@ts-expect-error\n\t\t\t\t\t\t\t\tsignal.set(!val);\n\t\t\t\t\t\t\t}, 10);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t},\n\t\t});\n\t}\n\treturn createProxy() as T;\n}\n","import type { Store, StoreValue } from \"nanostores\";\nimport { listenKeys } from \"nanostores\";\nimport type { DependencyList } from \"react\";\nimport { useCallback, useRef, useSyncExternalStore } from \"react\";\n\ntype StoreKeys<T> = T extends { setKey: (k: infer K, v: any) => unknown }\n\t? K\n\t: never;\n\nexport interface UseStoreOptions<SomeStore> {\n\t/**\n\t * @default\n\t * ```ts\n\t * [store, options.keys]\n\t * ```\n\t */\n\tdeps?: DependencyList | undefined;\n\n\t/**\n\t * Will re-render components only on specific key changes.\n\t */\n\tkeys?: StoreKeys<SomeStore>[] | undefined;\n}\n\n/**\n * Subscribe to store changes and get store's value.\n *\n * Can be used with store builder too.\n *\n * ```js\n * import { useStore } from 'nanostores/react'\n *\n * import { router } from '../store/router'\n *\n * export const Layout = () => {\n * let page = useStore(router)\n * if (page.route === 'home') {\n * return <HomePage />\n * } else {\n * return <Error404 />\n * }\n * }\n * ```\n *\n * @param store Store instance.\n * @returns Store value.\n */\nexport function useStore<SomeStore extends Store>(\n\tstore: SomeStore,\n\toptions: UseStoreOptions<SomeStore> = {},\n): StoreValue<SomeStore> {\n\tlet snapshotRef = useRef<StoreValue<SomeStore>>(store.get());\n\n\tconst { keys, deps = [store, keys] } = options;\n\n\tlet subscribe = useCallback((onChange: () => void) => {\n\t\tconst emitChange = (value: StoreValue<SomeStore>) => {\n\t\t\tif (snapshotRef.current === value) return;\n\t\t\tsnapshotRef.current = value;\n\t\t\tonChange();\n\t\t};\n\n\t\temitChange(store.value);\n\t\tif (keys?.length) {\n\t\t\treturn listenKeys(store as any, keys, emitChange);\n\t\t}\n\t\treturn store.listen(emitChange);\n\t}, deps);\n\n\tlet get = () => snapshotRef.current as StoreValue<SomeStore>;\n\n\treturn useSyncExternalStore(subscribe, get, get);\n}\n","import type {\n\tBetterAuthClientOptions,\n\tBetterAuthClientPlugin,\n} from \"@better-auth/core\";\nimport type { BASE_ERROR_CODES } from \"@better-auth/core/error\";\nimport { capitalizeFirstLetter } from \"@better-auth/core/utils\";\nimport type {\n\tBetterFetchError,\n\tBetterFetchResponse,\n} from \"@better-fetch/fetch\";\nimport type { PrettifyDeep, UnionToIntersection } from \"../../types/helper\";\nimport { getClientConfig } from \"../config\";\nimport { createDynamicPathProxy } from \"../proxy\";\nimport type {\n\tInferActions,\n\tInferClientAPI,\n\tInferErrorCodes,\n\tIsSignal,\n\tSessionQueryParams,\n} from \"../types\";\nimport { useStore } from \"./react-store\";\n\nfunction getAtomKey(str: string) {\n\treturn `use${capitalizeFirstLetter(str)}`;\n}\n\ntype InferResolvedHooks<O extends BetterAuthClientOptions> = O extends {\n\tplugins: Array<infer Plugin>;\n}\n\t? UnionToIntersection<\n\t\t\tPlugin extends BetterAuthClientPlugin\n\t\t\t\t? Plugin[\"getAtoms\"] extends (fetch: any) => infer Atoms\n\t\t\t\t\t? Atoms extends Record<string, any>\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t[key in keyof Atoms as IsSignal<key> extends true\n\t\t\t\t\t\t\t\t\t? never\n\t\t\t\t\t\t\t\t\t: key extends string\n\t\t\t\t\t\t\t\t\t\t? `use${Capitalize<key>}`\n\t\t\t\t\t\t\t\t\t\t: never]: () => ReturnType<Atoms[key][\"get\"]>;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: {}\n\t\t\t\t\t: {}\n\t\t\t\t: {}\n\t\t>\n\t: {};\n\nexport function createAuthClient<Option extends BetterAuthClientOptions>(\n\toptions?: Option | undefined,\n) {\n\tconst {\n\t\tpluginPathMethods,\n\t\tpluginsActions,\n\t\tpluginsAtoms,\n\t\t$fetch,\n\t\t$store,\n\t\tatomListeners,\n\t} = getClientConfig(options);\n\tlet resolvedHooks: Record<string, any> = {};\n\tfor (const [key, value] of Object.entries(pluginsAtoms)) {\n\t\tresolvedHooks[getAtomKey(key)] = () => useStore(value);\n\t}\n\n\tconst routes = {\n\t\t...pluginsActions,\n\t\t...resolvedHooks,\n\t\t$fetch,\n\t\t$store,\n\t};\n\tconst proxy = createDynamicPathProxy(\n\t\troutes,\n\t\t$fetch,\n\t\tpluginPathMethods,\n\t\tpluginsAtoms,\n\t\tatomListeners,\n\t);\n\n\ttype ClientAPI = InferClientAPI<Option>;\n\ttype Session = ClientAPI extends {\n\t\tgetSession: () => Promise<infer Res>;\n\t}\n\t\t? Res extends BetterFetchResponse<infer S>\n\t\t\t? S\n\t\t\t: Res\n\t\t: never;\n\treturn proxy as UnionToIntersection<InferResolvedHooks<Option>> &\n\t\tClientAPI &\n\t\tInferActions<Option> & {\n\t\t\tuseSession: () => {\n\t\t\t\tdata: Session;\n\t\t\t\tisPending: boolean;\n\t\t\t\tisRefetching: boolean;\n\t\t\t\terror: BetterFetchError | null;\n\t\t\t\trefetch: (\n\t\t\t\t\tqueryParams?: { query?: SessionQueryParams } | undefined,\n\t\t\t\t) => Promise<void>;\n\t\t\t};\n\t\t\t$Infer: {\n\t\t\t\tSession: NonNullable<Session>;\n\t\t\t};\n\t\t\t$fetch: typeof $fetch;\n\t\t\t$store: typeof $store;\n\t\t\t$ERROR_CODES: PrettifyDeep<\n\t\t\t\tInferErrorCodes<Option> & typeof BASE_ERROR_CODES\n\t\t\t>;\n\t\t};\n}\n\nexport { useStore };\nexport type * from \"@better-fetch/fetch\";\nexport type * from \"nanostores\";\nexport type * from \"../../types/helper\";\nexport type { UnionToIntersection } from \"../../types/helper\";\n"],"mappings":";;;;;AACA,IAAM,WAAW,uBAAO,OAAO,IAAI;AACnC,IAAM,UAAU,CAAC,YAAY,WAAW,SAAS,OAAO,WAAW,MAAM,IAAI,SAAS,KAAK,WAAW,YAAY,UAAU,WAAW;AACvI,IAAM,MAAM,IAAI,MAAM,UAAU;AAAA,EAC/B,IAAI,GAAG,MAAM;AACZ,WAAO,QAAQ,EAAE,IAAI,KAAK,SAAS,IAAI;AAAA,EACxC;AAAA,EACA,IAAI,GAAG,MAAM;AACZ,WAAO,QAAQ,QAAQ,KAAK,QAAQ;AAAA,EACrC;AAAA,EACA,IAAI,GAAG,MAAM,OAAO;AACnB,UAAM,QAAQ,QAAQ,IAAI;AAC1B,UAAM,IAAI,IAAI;AACd,WAAO;AAAA,EACR;AAAA,EACA,eAAe,GAAG,MAAM;AACvB,QAAI,CAAC,KAAM,QAAO;AAClB,UAAM,QAAQ,QAAQ,IAAI;AAC1B,WAAO,MAAM,IAAI;AACjB,WAAO;AAAA,EACR;AAAA,EACA,UAAU;AACT,UAAM,QAAQ,QAAQ,IAAI;AAC1B,WAAO,OAAO,KAAK,KAAK;AAAA,EACzB;AACD,CAAC;AAID,IAAM,UAAU,OAAO,YAAY,eAAe,QAAQ,OAAO,QAAQ,IAAI,YAAY;AAUzF,SAAS,UAAU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,cACA,QACA,QACA,cAAA,IACG,gBAAgB,OAAA;AACpB,MAAIC,gBAAqC,CAAA;AACzC,aAAW,CAAC,KAAK,KAAA,KAAU,OAAO,QAAQ,YAAA,EACzC,eAAc,WAAW,GAAA,CAAI,IAAA,MAAU,SAAS,KAAA;AAyBjD,SAhBc,uBANC;IACd,GAAG;IACH,GAAG;IACH;IACA;KAIA,QACA,mBACA,cACA,aAAA;;","names":["url","value","value: AuthQueryAtom<T>","message: BroadcastMessage","now","state: SessionRefreshState","session: SessionAtom","pluginPathMethods: Record<string, \"POST\" | \"GET\">","atomListeners: ClientAtomListener[]","current: any","resolvedHooks: Record<string, any>"]}
|