PageSourceSearch

https://app.lexsee.ai/_next/static/immutable/chunks/1-5xi6_xdxlfd.js

js lexsee.ai collected 2026-10-05 14:57:13 UTC 49,728 bytes, 1 lines download raw bytes

1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,636097,e=>{"use strict";let t,r,n,s,o="1.7.2";function i(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,{code:e,message:t,toString:()=>e}]))}i({USER_NOT_FOUND:"User not found",FAILED_TO_CREATE_USER:"Failed to create user",FAILED_TO_CREATE_SESSION:"Failed to create session",FAILED_TO_UPDATE_USER:"Failed to update user",FAILED_TO_GET_SESSION:"Failed to get session",INVALID_PASSWORD:"Invalid password",INVALID_EMAIL:"Invalid email",INVALID_EMAIL_OR_PASSWORD:"Invalid email or password",INVALID_USER:"Invalid user",SOCIAL_ACCOUNT_ALREADY_LINKED:"Social account already linked",PROVIDER_NOT_FOUND:"Provider not found",INVALID_TOKEN:"Invalid token",TOKEN_EXPIRED:"Token expired",ID_TOKEN_NOT_SUPPORTED:"id_token not supported",FAILED_TO_GET_USER_INFO:"Failed to get user info",USER_EMAIL_NOT_FOUND:"User email not found",EMAIL_NOT_VERIFIED:"Email not verified",PASSWORD_TOO_SHORT:"Password too short",PASSWORD_TOO_LONG:"Password too long",USER_ALREADY_EXISTS:"User already exists.",USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL:"User already exists. Use another email.",EMAIL_CAN_NOT_BE_UPDATED:"Email can not be updated",CHANGE_EMAIL_DISABLED:"Change email is disabled",CREDENTIAL_ACCOUNT_NOT_FOUND:"Credential account not found",SESSION_EXPIRED:"Session expired. Re-authenticate to perform this action.",FAILED_TO_UNLINK_LAST_ACCOUNT:"You can't unlink your last account",ACCOUNT_NOT_FOUND:"Account not found",USER_ALREADY_HAS_PASSWORD:"User already has a password. Provide that to delete the account.",CROSS_SITE_NAVIGATION_LOGIN_BLOCKED:"Cross-site navigation login blocked. This request appears to be a CSRF attack.",VERIFICATION_EMAIL_NOT_ENABLED:"Verification email isn't enabled",EMAIL_ALREADY_VERIFIED:"Email is already verified",EMAIL_MISMATCH:"Email mismatch",SESSION_NOT_FRESH:"Session is not fresh",LINKED_ACCOUNT_ALREADY_EXISTS:"Linked account already exists",INVALID_ORIGIN:"Invalid origin",INVALID_CALLBACK_URL:"Invalid callbackURL",INVALID_REDIRECT_URL:"Invalid redirectURL",INVALID_ERROR_CALLBACK_URL:"Invalid errorCallbackURL",INVALID_
1NEW_USER_CALLBACK_URL:"Invalid newUserCallbackURL",MISSING_OR_NULL_ORIGIN:"Missing or null Origin",CALLBACK_URL_REQUIRED:"callbackURL is required",FAILED_TO_CREATE_VERIFICATION:"Unable to create verification",FIELD_NOT_ALLOWED:"Field not allowed to be set",ASYNC_VALIDATION_NOT_SUPPORTED:"Async validation is not supported",VALIDATION_ERROR:"Validation Error",MISSING_FIELD:"Field is required",METHOD_NOT_ALLOWED_DEFER_SESSION_REQUIRED:"POST method requires deferSessionRefresh to be enabled in session config",BODY_MUST_BE_AN_OBJECT:"Body must be an object",PASSWORD_ALREADY_SET:"User already has a password set"});let a={OK:200,CREATED:201,ACCEPTED:202,NO_CONTENT:204,MULTIPLE_CHOICES:300,MOVED_PERMANENTLY:301,FOUND:302,SEE_OTHER:303,NOT_MODIFIED:304,TEMPORARY_REDIRECT:307,BAD_REQUEST:400,UNAUTHORIZED:401,PAYMENT_REQUIRED:402,FORBIDDEN:403,NOT_FOUND:404,METHOD_NOT_ALLOWED:405,NOT_ACCEPTABLE:406,PROXY_AUTHENTICATION_REQUIRED:407,REQUEST_TIMEOUT:408,CONFLICT:409,GONE:410,LENGTH_REQUIRED:411,PRECONDITION_FAILED:412,PAYLOAD_TOO_LARGE:413,URI_TOO_LONG:414,UNSUPPORTED_MEDIA_TYPE:415,RANGE_NOT_SATISFIABLE:416,EXPECTATION_FAILED:417,"I'M_A_TEAPOT":418,MISDIRECTED_REQUEST:421,UNPROCESSABLE_ENTITY:422,LOCKED:423,FAILED_DEPENDENCY:424,TOO_EARLY:425,UPGRADE_REQUIRED:426,PRECONDITION_REQUIRED:428,TOO_MANY_REQUESTS:429,REQUEST_HEADER_FIELDS_TOO_LARGE:431,UNAVAILABLE_FOR_LEGAL_REASONS:451,INTERNAL_SERVER_ERROR:500,NOT_IMPLEMENTED:501,BAD_GATEWAY:502,SERVICE_UNAVAILABLE:503,GATEWAY_TIMEOUT:504,HTTP_VERSION_NOT_SUPPORTED:505,VARIANT_ALSO_NEGOTIATES:506,INSUFFICIENT_STORAGE:507,LOOP_DETECTED:508,NOT_EXTENDED:510,NETWORK_AUTHENTICATION_REQUIRED:511};var l,u=class extends Error{status;body;headers;statusCode;constructor(e="INTERNAL_SERVER_ERROR",t,r={},n="number"==typeof e?e:a[e]){super(t?.message,t?.cause?{cause:t.cause}:void 0),this.status=e,this.body=t,this.headers=r,this.statusCode=n,this.name="APIError",this.status=e,this.headers=r,this.statusCode=n,this.body=t}},c=class extends u{message;issues;constructor(e,t){super(400,{message:e,code:"VALIDATION_ERROR"}),this.message=e,this.issues=t,this.issues=t}},d=class extends Error{constructor(e){super(e),this.name="BetterCallError"}};let f=Symbol.for("better-call:api-error-headers"),p=function(e,t){class r extends e{#e;constructor(...e){if(function(){let e=Object.getOwnPropertyDescriptor(Error,"stackTraceLimit");return void 0===e?Object.isExtensible(Error):Object.prototype.hasOwnProperty.call(e,"writable")?e.writable:void 0!==e.set}()){const t=Error.stackTraceLimit;Error.stackTraceLimit=0,super(...e),Error.stackTraceLimit=t}else super(...e);const t=Error().stack;t&&(this.#e=function(e){let t=e.split("\n    at ");return t.length<=1?e:(t.splice(1,1),t.join("\n    at "))}(t.replace(/^Error/,this.name)))}get errorStack(){return this.#e}}return Object.defineProperty(r.prototype,"constructor",{get:()=>t,enumerable:!1,configurable:!0}),r}(u,Error);var h=class extends Error{constructor(e,t){super(e,t),this.name="BetterAuthError",this.message=e,this.stack=""}},E=class e extends p{constructor(...e){super(...e)}static fromStatus(t,r){return new e(t,r)}static from(t,r){return new e(t,{message:r.message,code:r.code})}};function _(e){return"OR"===e?"OR":"AND"}function g(e){return Array.isArray(e)}function y(e,t){return"string"==typeof t&&e.includes(t)}let O=e=>{var t;return{authorize(e,r="AND"){let n=!1;for(let[s,o]of Object.entries(e)){let e=t[s];if(!e){if("AND"===r)return{success:!1,error:`You are not allowed to access resource: ${s}`};continue}let i=function(e,{actions:t,connector:r}){return 0!==t.length&&("OR"===r?t.some(t=>y(e,t)):t.every(t=>y(e,t)))}(e,function(e){if(g(e))return{actions:e,connector:"AND"};if(!e||"object"!=typeof e)throw new h("Invalid access control request");let{actions:t,connector:r}=e;return g(t)?{actions:t,connector:_(r)}:{actions:[],connector:_(r)}}(o));if(i&&(n=!0),i&&"OR"===r)return{success:!0};if(!i&&"AND"===r)return{success:!1,error:`unauthorized to access resource "${s}"`}}return n?{success:!0}:{success:!1,error:"Not authorized"}},statements:t=e}},T=O({user:["create","list","set-role","ban","impersonate","delete","set-password","set-email","get","update"],session:["list","revoke","delete"]}),R=O({user:[],session:[]}),b={admin:T,user:R},m=i({FAILED_TO_CREATE_USER:"Failed to create user",USER_ALREADY_EXISTS:"User already exists.",USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL:"User already exists. Use another email.",YOU_CANNOT_BAN_YOURSELF:"You cannot ban yourself",YOU_ARE_NOT_ALLOWED_TO_CHANGE_USERS_ROLE:"You are not allowed to change users role",YOU_ARE_NOT_ALLOWED_TO_CREATE_USERS:"You are not allowed to create users",YOU_ARE_NOT_ALLOWED_TO_LIST_USERS:"You are not allowed to list users",YOU_ARE_NOT_ALLOWED_TO_LIST_USERS_SESSIONS:"You are not allowed to list users sessions",YOU_ARE_NOT_ALLOWED_TO_BAN_USERS:"You are not allowed to ban users",YOU_ARE_NOT_ALLOWED_TO_IMPERSONATE_USERS:"You are not allowed to impersonate users",YOU_ARE_NOT_ALLOWED_TO_REVOKE_USERS_SESSIONS:"You are not allowed to revoke users sessions",YOU_ARE_NOT_ALLOWED_TO_DELETE_USERS:"You are not allowed to delete users",YOU_ARE_NOT_ALLOWED_TO_SET_USERS_PASSWORD:"You are not allowed to set users password",BANNED_USER:"You have been banned from this application",YOU_ARE_NOT_ALLOWED_TO_GET_USER:"You are not allowed to get user",NO_DATA_TO_UPDATE:"No data to update",YOU_ARE_NOT_ALLOWED_TO_UPDATE_USERS:"You are not allowed to update users",YOU_CANNOT_REMOVE_YOURSELF:"You cannot remove yourself",YOU_ARE_NOT_ALLOWED_TO_SET_NON_EXISTENT_VALUE:"You are not allowed to set a non-existent role value",YOU_CANNOT_IMPERSONATE_ADMINS:"You cannot impersonate admins",INVALID_ROLE_TYPE:"Invalid role type",YOU_ARE_NOT_ALLOWED_TO_SET_USERS_EMAIL:"You are not allowed to update users email",PASSWORD_CANNOT_BE_UPDATED_VIA_UPDATE_USER:"Password cannot be updated through update-user. Use the set-user-password endpoint instead"}),S=Symbol.for("better-auth:global"),A=null,v={},w="1.7.2";function L(){return globalThis[S]||(globalThis[S]={version:w,epoch:1,context:v},A=globalThis[S]),(A=globalThis[S]).version!==w&&(A.version=w,A.epoch++),globalThis[S]}var I=class{#t=void 0;run(e,t){let r=this.#t;this.#t=e;let n=t();return n instanceof Promise?n.finally(()=>{this.#t=r}):(this.#t=r,n)}getStore(){return this.#t}};let U=Promise.resolve().then(()=>"AsyncLocalStorage"in globalThis?globalThis.AsyncLocalStorage:I);async function N(){let e=await U;if(null!==e)return e;throw Error("getAsyncLocalStorage is only available in server code")}let D=async()=>{let e=L(),t=e.context.requestStateAsyncStorage;if(t)return t;let r=await N();return e.context.requestStateAsyncStorage??=new r,e.context.requestStateAsyncStorage};async function C(){let e=(await D()).getStore();if(!e)throw Error("No request state found. Please make sure you are calling this function within a `runWithRequestState` callback.");return e}let{get:P,set:x}=(l=()=>!1,r=Object.freeze({}),{get ref(){return r},async get(){let e=await C();if(!e.has(r)){let t=await l();return e.set(r,t),t}return e.get(r)},async set(e){(await C()).set(r,e)}}),k=async()=>{let e=L().context.endpointContextAsyncStorage;if(e)return e;let t=await N(),r=L().context;return r.endpointContextAsyncStorage??=new t};async function j(e,t){return(await k()).run(e,t)}function H(){let e="u">typeof globalThis&&globalThis.crypto;if(e&&"object"==typeof e.subtle&&null!=e.subtle)return e.subtle;throw Error("crypto.subtle must be defined")}let F={name:"HMAC",hash:"SHA-256"},Y=async e=>{let t="string"==typeof e?new TextEncoder().encode(e):e;return await H().importKey("raw",t,F,!1,["sign","verify"])},M=async(e,t,r)=>{try{let n=atob(e),s=new Uint8Array(n.length);for(let e=0,t=n.length;e<t;e++)s[e]=n.charCodeAt(e);return await H().verify(F,r,s,new TextEncoder().encode(t))}catch{return!1}},B=async(e,t)=>{let r=await Y(t);return btoa(String.fromCharCode(...new Uint8Array(await H().sign(F.name,r,new TextEncoder().encode(e)))))},q=async(e,t)=>{let r=await B(e,t);return encodeURIComponent(e=`${e}.${r}`)};function $(e){return e instanceof p||e?.name==="APIError"}async function W(e){try{return{data:await e,error:null}}catch(e){return{data:null,error:e}}}let V=(e,t)=>{let r=e;if(t)if("secure"===t)r="__Secure-"+e;else{if("host"!==t)return;r="__Host-"+e}return r},G=(e,t,r={})=>{let n;if(n=r?.prefix==="secure"?`__Secure-${e}=${t}`:r?.prefix==="host"?`__Host-${e}=${t}`:`${e}=${t}`,e.startsWith("__Secure-")&&!r.secure&&(r.secure=!0),e.startsWith("__Host-")&&(r.secure||(r.secure=!0),"/"!==r.path&&(r.path="/"),r.domain&&(r.domain=void 0)),r&&"number"==typeof r.maxAge&&r.maxAge>=0){if(r.maxAge>3456e4)throw Error("Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.");n+=`; Max-Age=${Math.floor(r.maxAge)}`}if(r.domain&&"host"!==r.prefix&&(n+=`; Domain=${r.domain}`),r.path&&(n+=`; Path=${r.path}`),r.expires){if(r.expires.getTime()-Date.now()>3456e7)throw Error("Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future.");n+=`; Expires=${r.expires.toUTCString()}`}return r.httpOnly&&(n+="; HttpOnly"),r.secure&&(n+="; Secure"),r.sameSite&&(n+=`; SameSite=${r.sameSite.charAt(0).toUpperCase()+r.sameSite.slice(1)}`),r.partitioned&&(r.secure||(r.secure=!0),n+="; Partitioned"),n},K=async(e,t,r,n)=>G(e,t=await q(t,r),n);async function X(e,t={}){let r={body:t.body,query:t.query};if(e.body){let n=await e.body["~standard"].validate(t.body);if(n.issues)return{data:null,error:z(n.issues,"body")};r.body=n.value}if(e.query){let n=await e.query["~standard"].validate(t.query);if(n.issues)return{data:null,error:z(n.issues,"query")};r.query=n.value}return e.requireHeaders&&!t.headers?{data:null,error:{message:"Headers is required",issues:[]}}:e.requireRequest&&!t.request?{data:null,error:{message:"Request is required",issues:[]}}:{data:r,error:null}}function z(e,t){return{message:e.map(e=>`[${e.path?.length?`${t}.`+e.path.map(e=>"object"==typeof e?e.key:e).join("."):t}] ${e.message}`).join("; "),issues:e}}let J=async(e,{options:t,path:r})=>{var n;let s,o=new Headers,{data:i,error:a}=await X(t,e);if(a)throw new c(a.message,a.issues);let l="headers"in e?e.headers instanceof Headers?e.headers:new Headers(e.headers):"request"in e&&((n=e.request)instanceof Request||"[object Request]"===Object.prototype.toString.call(n))?e.request.headers:null,u=l?.get("cookie"),d=u?function(e){if("string"!=typeof e)throw TypeError("argument str must be a string");let t=new Map,r=0;for(;r<e.length;){let n=e.indexOf("=",r);
1if(-1===n)break;let s=e.indexOf(";",r);if(-1===s)s=e.length;else if(s<n){r=e.lastIndexOf(";",n-1)+1;continue}let o=e.slice(r,n).trim();if(!t.has(o)){let r=e.slice(n+1,s).trim();34===r.codePointAt(0)&&(r=r.slice(1,-1)),t.set(o,function(e){try{return e.includes("%")?decodeURIComponent(e):e}catch{return e}}(r))}r=s+1}return t}(u):void 0,f={...e,body:i.body,query:i.query,path:e.path||r||"virtual:",context:"context"in e&&e.context?e.context:{},returned:void 0,headers:e?.headers,request:e?.request,params:"params"in e?e.params:void 0,method:e.method??(Array.isArray(t.method)?t.method[0]:"*"===t.method?"GET":t.method),setHeader:(e,t)=>{o.set(e,t)},getHeader:e=>l?l.get(e):null,getCookie:(e,t)=>{let r=V(e,t);return r&&d?.get(r)||null},getSignedCookie:async(e,t,r)=>{let n=V(e,r);if(!n)return null;let s=d?.get(n);if(!s)return null;let o=s.lastIndexOf(".");if(o<1)return null;let i=s.substring(0,o),a=s.substring(o+1);return 44===a.length&&a.endsWith("=")?!!await M(a,i,await Y(t))&&i:null},setCookie:(e,t,r)=>{var n;let s=G(e,n=encodeURIComponent(n=t),r);return o.append("set-cookie",s),s},setSignedCookie:async(e,t,r,n)=>{let s=await K(e,t,r,n);return o.append("set-cookie",s),s},redirect:e=>(o.set("location",e),new p("FOUND",void 0,o)),error:(e,t,r)=>new p(e,t,r),setStatus:e=>{s=e},json:(t,r)=>e.asResponse?{body:r?.body||t,routerResponse:r,_flag:"json"}:t,responseHeaders:o,get responseStatus(){return s}};for(let e of t.use||[]){let t=await e({...f,returnHeaders:!0,asResponse:!1});t.response&&Object.assign(f.context,t.response),t.headers&&t.headers.forEach((e,t)=>{f.responseHeaders.set(t,e)})}return f},Q=new Set(["host","user-agent","referer","from","expect","authorization","proxy-authorization","cookie","origin","accept-charset","accept-encoding","accept-language","if-match","if-none-match","if-modified-since","if-unmodified-since","if-range","range","max-forwards","connection","keep-alive","transfer-encoding","te","upgrade","trailer","proxy-connection","content-length"]);function Z(e){for(let t of Q)e.delete(t)}function ee(e,t){if(t)for(let[r,n]of new Headers(t).entries())"set-cookie"===r.toLowerCase()?e.append(r,n):e.set(r,n)}function et(e,t,r){let n="string"==typeof e?e:void 0,s="object"==typeof t?t:e,o="function"==typeof t?t:r;if(("GET"===s.method||"HEAD"===s.method)&&s.body)throw new d("Body is not allowed with GET or HEAD methods");if(n&&/\/{2,}/.test(n))throw new d("Path cannot contain consecutive slashes");let i=async(...e)=>{let t=e[0]||{},{data:r,error:i}=await W(J(t,{options:s,path:n}));if(i){if(!(i instanceof c))throw i;throw s.onValidationError&&await s.onValidationError({message:i.message,issues:i.issues}),new p(400,{message:i.message,code:"VALIDATION_ERROR"})}let a=await o(r).catch(async e=>{if($(e)){let r=s.onAPIError;if(r&&await r(e),t.asResponse)return e}throw e}),l=r.responseHeaders,u=r.responseStatus;return t.asResponse?function e(t,r){if(t instanceof Response){if(r?.headers){let e=new Headers(r.headers);Z(e),ee(t.headers,e)}return t}if(t&&"object"==typeof t&&"_flag"in t&&"json"===t._flag){let e=t.body,n=t.routerResponse;if(n instanceof Response)return n;let s=new Headers;if(ee(s,n?.headers),ee(s,t.headers),r?.headers){let e=new Headers(r.headers);Z(e),ee(s,e)}return s.set("Content-Type","application/json"),new Response(JSON.stringify(e),{...n,headers:s,status:t.status??r?.status??n?.status,statusText:r?.statusText??n?.statusText})}if($(t))return e(t.body,{status:r?.status??t.statusCode,statusText:t.status.toString(),headers:r?.headers||t.headers});let n=t,s=new Headers(r?.headers);if(Z(s),t){if("string"==typeof t)n=t,s.set("Content-Type","text/plain");else if(t instanceof ArrayBuffer||ArrayBuffer.isView(t))n=t,s.set("Content-Type","application/octet-stream");else if(t instanceof Blob)n=t,s.set("Content-Type",t.type||"application/octet-stream");else if(t instanceof FormData)n=t;else if(t instanceof URLSearchParams)n=t,s.set("Content-Type","application/x-www-form-urlencoded");else if(t instanceof ReadableStream)n=t,s.set("Content-Type","application/octet-stream");else if(function(e){if(void 0===e)return!1;let t=typeof e;return"string"===t||"number"===t||"boolean"===t||null===t||"object"===t&&(!!Array.isArray(e)||!e.buffer&&(e.constructor&&"Object"===e.constructor.name||"function"==typeof e.toJSON))}(t)){let e,r,o;e=new WeakMap,r=new WeakMap,o=0,n=JSON.stringify(t,function(t,n){if("bigint"==typeof n)return n.toString();if("object"==typeof n&&null!==n){if(((t,r)=>{let n=r;for(;n;){if(n===t)return!0;n=e.get(n)}return!1})(n,this))return`[Circular ref-${r.get(n)}]`;e.set(n,this),r.has(n)||r.set(n,o++)}return n}),s.set("Content-Type","application/json")}}else null===t&&(n=JSON.stringify(null)),s.set("content-type","application/json");return new Response(n,{...r,headers:s})}(a,{headers:l,status:u}):t.returnHeaders?t.returnStatus?{headers:l,response:a,status:u}:{headers:l,response:a}:t.returnStatus?{response:a,status:u}:a};return i.options=s,i.path=n,i}function er(e,t){return[...e??[],...t??[]]}function en(e,t){let r=async r=>{let n="function"==typeof e?e:t,s=await J(r,{options:"function"==typeof e?{}:e,path:"/"});if(!n)throw Error("handler must be defined");try{let e=await n(s),t=s.responseHeaders;return r.returnHeaders?{headers:t,response:e}:e}
1catch(e){throw $(e)&&Object.defineProperty(e,f,{enumerable:!1,configurable:!0,get:()=>s.responseHeaders}),e}};return r.options="function"==typeof e?{}:e,r}et.create=e=>function(...t){if(3===t.length){let[r,n,s]=t;return et(r,{...n,use:er(n.use,e?.use)},s)}let[r,n]=t;return et({...r,use:er(r.use,e?.use)},n)},en.create=e=>function(t,r){if("function"==typeof t)return en({use:e?.use},t);if(!r)throw Error("Middleware handler is required");return en({...t,method:"*",use:[...e?.use||[],...t.use||[]]},r)},e.i(298296);let es={"Cache-Control":"no-store",Pragma:"no-cache"},eo=en(async()=>({})),ei=en.create({use:[eo,en(async()=>({}))]}),ea=et.create({use:[eo]});function el(e,t){let r=t.metadata?.noStore===!0;return async t=>{if(r)for(let[e,r]of Object.entries(es))t.setHeader(e,r);try{return await j(t,()=>e(t))}catch(e){var n=t.responseHeaders;throw(e instanceof p||e instanceof E||e?.name==="APIError")&&n&&Object.defineProperty(e,f,{enumerable:!1,configurable:!0,value:n,writable:!1}),e}}}function eu(...e){if(3===e.length){let[t,r,n]=e;return ea(t,r,el(n,r))}let[t,r]=e;return ea(t,el(r,t))}eu.serverOnly=(e,t)=>eu({...e,metadata:{...e.metadata,SERVER_ONLY:!0}},t);let ec=()=>t??=e.A(598068).catch(e=>{throw t=void 0,e});var ed=e.i(8372);let ef=Object.create(null),ep=e=>globalThis.process?.env||globalThis.Deno?.env.toObject()||globalThis.__env__||(e?ef:globalThis),eh=new Proxy(ef,{get:(e,t)=>ep()[t]??ef[t],has:(e,t)=>t in ep()||t in ef,set:(e,t,r)=>(ep(!0)[t]=r,!0),deleteProperty(e,t){if(!t)return!1;let r=ep(!0);return delete r[t],!0},ownKeys:()=>Object.keys(ep(!0))});function eE(e,t){return void 0!==ed.default&&ed.default.env?ed.default.env[e]??t:"u">typeof Deno?Deno.env.get(e)??t:"u">typeof Bun?Bun.env[e]??t:t}function e_(e){let t=e.length;for(;t>0&&47===e.charCodeAt(t-1);)t--;return t===e.length?e:e.slice(0,t)}function eg(e,t="/api/auth"){try{let t=new URL(e);if("http:"!==t.protocol&&"https:"!==t.protocol)throw new h(`Invalid base URL: ${e}. URL must include 'http://' or 'https://'`)}catch(t){if(t instanceof h)throw t;throw new h(`Invalid base URL: ${e}. Please provide a valid base URL.`,{cause:t})}if(function(e){try{return"/"!==(e_(new URL(e).pathname)||"/")}catch{throw new h(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}(e))return e;let r=e_(e);return t&&"/"!==t?(t=t.startsWith("/")?t:`/${t}`,`${r}${t}`):r}eh.NODE_ENV,Object.freeze({get BETTER_AUTH_SECRET(){return eE("BETTER_AUTH_SECRET")},get AUTH_SECRET(){return eE("AUTH_SECRET")},get BETTER_AUTH_TELEMETRY(){return eE("BETTER_AUTH_TELEMETRY")},get BETTER_AUTH_TELEMETRY_ID(){return eE("BETTER_AUTH_TELEMETRY_ID")},get NODE_ENV(){return eE("NODE_ENV","development")},get PACKAGE_VERSION(){return eE("PACKAGE_VERSION","0.0.0")},get BETTER_AUTH_TELEMETRY_ENDPOINT(){return eE("BETTER_AUTH_TELEMETRY_ENDPOINT","")}});let ey={proto:/"(?:_|\\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*:/,constructor:/"(?: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*:/,protoShort:/"__proto__"\s*:/,constructorShort:/"constructor"\s*:/},eO=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,eT={true:!0,false:!1,null:null,undefined:void 0,nan:NaN,infinity:1/0,"-infinity":-1/0},eR=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/,eb=["javascript:","data:","vbscript:"],em={id:"redirect",name:"Redirect",hooks:{onSuccess(e){if(e.data?.url&&e.data?.redirect&&function(e){let t;try{t=new URL(e)}catch{return!0}return!eb.includes(t.protocol)}(e.data.url)&&"u">typeof window&&window.location&&window.location)try{window.location.href=e.data.url}catch{}}}},eS=(e,t,r,n)=>(e.events=e.events||{},e.events[r+10]||(e.events[r+10]=n(t=>{e.events[r].reduceRight((e,t)=>(t(e),e),{shared:{},...t})})),e.events[r]=e.events[r]||[],e.events[r].push(t),()=>{let n=e.events[r],s=n.indexOf(t);n.splice(s,1),n.length||(delete e.events[r],e.events[r+10](),delete e.events[r+10])});function eA(e){if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function ev(e,t){if(e===t)return!0;
1if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!ev(e[r],t[r]))return!1;return!0}if(eA(e)&&eA(t)){let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let n of r)if(!(n in t)||!ev(e[n],t[n]))return!1;return!0}return!1}let ew=Symbol.for("better-auth:broadcast-channel");var eL=class{listeners=new Set;name;constructor(e="better-auth.message"){this.name=e}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}post(e){if("u">typeof window)try{localStorage.setItem(this.name,JSON.stringify({...e,timestamp:Math.floor(Date.now()/1e3)}))}catch{}}setup(){if("u"<typeof window||void 0===window.addEventListener)return()=>{};let e=e=>{if(e.key!==this.name)return;let t=JSON.parse(e.newValue??"{}");t?.event==="session"&&t?.data&&this.listeners.forEach(e=>e(t))};return window.addEventListener("storage",e),()=>{window.removeEventListener("storage",e)}}};function eI(e="better-auth.message"){return globalThis[ew]||(globalThis[ew]=new eL(e)),globalThis[ew]}let eU=Symbol.for("better-auth:focus-manager");var eN=class{listeners=new Set;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setFocused(e){this.listeners.forEach(t=>t(e))}setup(){if("u"<typeof window||"u"<typeof document||void 0===window.addEventListener)return()=>{};let e=()=>{"visible"===document.visibilityState&&this.setFocused(!0)};return document.addEventListener("visibilitychange",e,!1),()=>{document.removeEventListener("visibilitychange",e,!1)}}};function eD(){return globalThis[eU]||(globalThis[eU]=new eN),globalThis[eU]}let eC=Symbol.for("better-auth:online-manager");var eP=class{listeners=new Set;isOnline="u"<typeof navigator||navigator.onLine;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setOnline(e){this.isOnline=e,this.listeners.forEach(t=>t(e))}setup(){if("u"<typeof window||void 0===window.addEventListener)return()=>{};let e=()=>this.setOnline(!0),t=()=>this.setOnline(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",t,!1),()=>{window.removeEventListener("online",e,!1),window.removeEventListener("offline",t,!1)}}};function ex(){return globalThis[eC]||(globalThis[eC]=new eP),globalThis[eC]}let ek=()=>Math.floor(Date.now()/1e3),ej=[],eH=0,eF=globalThis.nanostoresGlobal||={epoch:0},eY=e=>{let t=[],r={get:()=>(r.lc||r.listen(()=>{})(),r.value),init:e,lc:0,listen:e=>(r.lc=t.push(e),()=>{for(let t=eH+4;t<ej.length;)ej[t]===e?ej.splice(t,4):t+=4;let n=t.indexOf(e);~n&&(t.splice(n,1),--r.lc||r.off())}),notify(e,n){eF.epoch++;let s=!ej.length;for(let s of t)ej.push(s,r.value,e,n);if(s){for(eH=0;eH<ej.length;eH+=4)ej[eH](ej[eH+1],ej[eH+2],ej[eH+3]);ej.length=0}},off(){},set(e){let t=r.value;t!==e&&(r.value=e,r.notify(t))},subscribe(e){let t=r.listen(e);return e(r.value),t},value:e};return r};function eM(e){return"object"==typeof e&&null!==e&&"data"in e&&"error"in e?e:{data:e,error:null}}function eB(e,t){return ev(e.data,t.data)&&e.error===t.error&&e.isPending===t.isPending&&e.isRefetching===t.isRefetching&&e.refetch===t.refetch}function eq(e){if(null===e||"object"!=typeof e)return!1;let t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&!(Symbol.iterator in e)&&(!(Symbol.toStringTag in e)||"[object Module]"===Object.prototype.toString.call(e))}function e$(e){return(...t)=>t.reduce((t,r)=>(function e(t,r,n=".",s){if(!eq(r))return e(t,{},n,s);let o={...r};for(let r of Object.keys(t)){if("__proto__"===r||"constructor"===r)continue;let i=t[r];null!=i&&(s&&s(o,r,i,n)||(Array.isArray(i)&&Array.isArray(o[r])?o[r]=[...i,...o[r]]:eq(i)&&eq(o[r])?o[r]=e(i,o[r],(n?`${n}.`:"")+r.toString(),s):o[r]=i))}return o})(t,r,"",e),{})}let eW=e$();e$((e,t,r)=>{if(void 0!==e[t]&&"function"==typeof r)return e[t]=r(e[t]),!0}),e$((e,t,r)=>{if(Array.isArray(e[t])&&"function"==typeof r)return e[t]=r(e[t]),!0});var eV=Object.defineProperty,eG=Object.defineProperties,eK=Object.getOwnPropertyDescriptors,eX=Object.getOwnPropertySymbols,ez=Object.prototype.hasOwnProperty,eJ=Object.prototype.propertyIsEnumerable,eQ=(e,t,r)=>t in e?eV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,eZ=(e,t)=>{for(var r in t||(t={}))ez.call(t,r)&&eQ(e,r,t[r]);if(eX)for(var r of eX(t))eJ.call(t,r)&&eQ(e,r,t[r]);return e},e0=(e,t)=>
1eG(e,eK(t)),e1=class extends Error{constructor(e,t,r){super(t||e.toString(),{cause:r}),this.status=e,this.statusText=t,this.error=r,Error.captureStackTrace(this,this.constructor)}},e4=async(e,t)=>{var r,n,s,o,i,a;let l=t||{},u={onRequest:[null==t?void 0:t.onRequest],onResponse:[null==t?void 0:t.onResponse],onSuccess:[null==t?void 0:t.onSuccess],onError:[null==t?void 0:t.onError],onRetry:[null==t?void 0:t.onRetry]};if(!t||!(null==t?void 0:t.plugins))return{url:e,options:l,hooks:u};for(let c of(null==t?void 0:t.plugins)||[]){if(c.init){let n=await (null==(r=c.init)?void 0:r.call(c,e.toString(),t));l=n.options||l,e=n.url}u.onRequest.push(null==(n=c.hooks)?void 0:n.onRequest),u.onResponse.push(null==(s=c.hooks)?void 0:s.onResponse),u.onSuccess.push(null==(o=c.hooks)?void 0:o.onSuccess),u.onError.push(null==(i=c.hooks)?void 0:i.onError),u.onRetry.push(null==(a=c.hooks)?void 0:a.onRetry)}return{url:e,options:l,hooks:u}},e2=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(){return this.options.delay}},e3=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(e){return Math.min(this.options.maxDelay,this.options.baseDelay*2**e)}},e6=async e=>{let t={},r=async e=>"function"==typeof e?await e():e;if(null==e?void 0:e.auth){if("Bearer"===e.auth.type){let n=await r(e.auth.token);if(!n)return t;t.authorization=`Bearer ${n}`}else if("Basic"===e.auth.type){let[n,s]=await Promise.all([r(e.auth.username),r(e.auth.password)]);if(!n||!s)return t;t.authorization=`Basic ${btoa(`${n}:${s}`)}`}else if("Custom"===e.auth.type){let[n,s]=await Promise.all([r(e.auth.prefix),r(e.auth.value)]);if(!s)return t;t.authorization=`${null!=n?n:""} ${s}`}}return t},e5=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function e7(e){if(void 0===e)return!1;let t=typeof e;return"string"===t||"number"===t||"boolean"===t||null===t||"object"===t&&(!!Array.isArray(e)||!e.buffer&&(e.constructor&&"Object"===e.constructor.name||"function"==typeof e.toJSON))}function e9(e){try{return JSON.parse(e)}catch(t){return e}}function e8(e){return"function"==typeof e}function te(...e){let t={};for(let r of e)if(r)if(r instanceof Headers)r.forEach((e,r)=>{t[r]=e});else for(let[e,n]of Array.isArray(r)?r:Object.entries(r))null!=n&&(t[e]=n);return t}async function tt(e){let t=new Headers(te(null==e?void 0:e.headers,await e6(e)));if(!t.has("content-type")){let r=e7(null==e?void 0:e.body)?"application/json":null;r&&t.set("content-type",r)}return t}var tr=class e extends Error{constructor(t,r){super(r||JSON.stringify(t,null,2)),this.issues=t,Object.setPrototypeOf(this,e.prototype)}};async function tn(e,t){let r=await e["~standard"].validate(t);if(r.issues)throw new tr(r.issues);return r.value}var ts=["get","post","put","patch","delete"],to=async(e,t)=>{var r,n,s,o,i,a,l,u;let c,{hooks:d,url:f,options:p}=await e4(e,t),h=function(e){if(null==e?void 0:e.customFetchImpl)return e.customFetchImpl;if("u">typeof globalThis&&e8(globalThis.fetch))return globalThis.fetch;if("u">typeof window&&e8(window.fetch))return window.fetch;throw Error("No fetch implementation found")}(p),E=new AbortController,_=null!=(r=p.signal)?r:E.signal,g=function(e,t){let{baseURL:r,params:n,query:s}=t||{query:{},params:{},baseURL:""},o=e.startsWith("http")?e.split("/").slice(0,3).join("/"):r||"";if(e.startsWith("@")){let t=e.toString().split("@")[1].split("/")[0];ts.includes(t)&&(e=e.replace(`@${t}/`,"/"))}o.endsWith("/")||(o+="/");let[i,a]=e.replace(o,"").split("?"),l=new URLSearchParams(a);for(let[e,t]of Object.entries(s||{})){let r;if(null!=t){if("string"==typeof t)r=t;else if(Array.isArray(t)){for(let r of t)l.append(e,r);continue}else r=JSON.stringify(t);l.set(e,r)}}let u=new Map;if(n)if(Array.isArray(n))for(let[e,t]of i.split("/").filter(e=>e.startsWith(":")).entries()){let r=n[e];u.set(t,String(r))}else for(let[e,t]of Object.entries(n))u.set(`:${e}`,String(t));i=(i=i.split("/").map(e=>(function(e,t){let r,n=e;for(let[e,r]of t)n=n.replace(e,r);if("."===(r=n)||".."===r)throw TypeError("Path parameters cannot be reserved path segments");return encodeURIComponent(n)})(e,u)).join("/")).replace(/^\/+/,"");let c=l.toString();return(c=c.length>0?`?${c}`.replace(/\+/g,"%20"):"",o.startsWith("http"))?new URL(`${i}${c}`,o):`${o}${i}${c}`}(f,p),y=await tt(p),O=function(e,t){let r,{body:n}=e;return n?e7(n)&&"string"!=typeof n?"application/x-www-form-urlencoded"===((r=t.get("content-type"))?r.split(";")[0].trim().toLowerCase():null)?new URLSearchParams(n).toString():JSON.stringify(n):n:null}(p,y),T=function(e,t){var r;if(null==t?void 0:t.method)return t.method.toUpperCase();if(e.startsWith("@")){let n=null==(r=e.split("@")[1])?void 0:r.split("/")[0];return ts.includes(n)?n.toUpperCase():(null==t?void 0:t.body)?"POST":"GET"}return(null==t?void 0:t.body)?"POST":"GET"}(f,p),R=e0(eZ({},p),{url:g,headers:y,body:O,method:T,signal:_});for(let e of d.onRequest)if(e){let t=await e(R);"object"==typeof t&&null!==t&&Object.assign(R,t)}("pipeTo"in R&&"function"==typeof R.pipeTo||"function"==typeof(null==(n=null==t?void 0:t.body)?void 0:n.pi
1pe))&&!("duplex"in R)&&(R.duplex="half");let{clearTimeout:b}=(!(null==p?void 0:p.signal)&&(null==p?void 0:p.timeout)&&(c=setTimeout(()=>null==E?void 0:E.abort(),null==p?void 0:p.timeout)),{abortTimeout:c,clearTimeout:()=>{c&&clearTimeout(c)}}),m=await h(R.url,R);b();let S={response:m,request:R};for(let e of d.onResponse)if(e){let r=await e(e0(eZ({},S),{response:(null==(s=null==t?void 0:t.hookOptions)?void 0:s.cloneResponse)?m.clone():m}));r instanceof Response?m=r:"object"==typeof r&&null!==r&&(m=r.response)}if(m.ok){if("HEAD"===R.method)return{data:"",error:null};let e=function(e){let t=e.headers.get("content-type"),r=new Set(["image/svg","application/xml","application/xhtml","application/html"]);if(!t)return"json";let n=t.split(";").shift()||"";return e5.test(n)?"json":r.has(n)||n.startsWith("text/")?"text":"blob"}(m),r={data:null,response:m,request:R};if("json"===e||"text"===e){let e=await m.text(),t=null!=(o=R.jsonParser)?o:e9;r.data=await t(e)}else r.data=await m[e]();for(let e of((null==R?void 0:R.output)&&R.output&&!R.disableValidation&&(r.data=await tn(R.output,r.data)),d.onSuccess))e&&await e(e0(eZ({},r),{response:(null==(i=null==t?void 0:t.hookOptions)?void 0:i.cloneResponse)?m.clone():m}));return(null==t?void 0:t.throw)?r.data:{data:r.data,error:null}}let A=null!=(a=null==t?void 0:t.jsonParser)?a:e9,v=await m.text(),w=function(e){try{return JSON.parse(e),!0}catch(e){return!1}}(v),L=w?await A(v):null,I={response:m,responseText:v,request:R,error:e0(eZ({},L),{status:m.status,statusText:m.statusText})};for(let e of d.onError)e&&await e(e0(eZ({},I),{response:(null==(l=null==t?void 0:t.hookOptions)?void 0:l.cloneResponse)?m.clone():m}));if(null==t?void 0:t.retry){let r=function(e){if("number"==typeof e)return new e2({type:"linear",attempts:e,delay:1e3});switch(e.type){case"linear":return new e2(e);case"exponential":return new e3(e);default:throw Error("Invalid retry strategy")}}(t.retry),n=null!=(u=t.retryAttempt)?u:0;if(await r.shouldAttemptRetry(n,m)){for(let e of d.onRetry)e&&await e(S);let s=r.getDelay(n);return await new Promise(e=>setTimeout(e,s)),await to(e,e0(eZ({},t),{retryAttempt:n+1}))}}if(null==t?void 0:t.throw)throw new e1(m.status,m.statusText,w?L:v);return{data:null,error:e0(eZ({},L),{status:m.status,statusText:m.statusText})}};let ti=/[\p{Ll}\d]+|\p{Lu}+(?!\p{Ll})|\p{Lu}[\p{Ll}\d]+|\p{Lo}+/gu,ta=/['\u2019]/g;function tl(e){return(e.replace(ta,"").match(ti)??[]).map(e=>e.toLowerCase()).join("-")}var tu=e.i(999161);let tc=function(e){var t;let{pluginPathMethods:r,pluginsActions:n,pluginsAtoms:s,hydrateSession:o,$fetch:i,$store:a,atomListeners:l}=(e=>{var t,r;let n,s,o,i,a,l,u,c,d,f="credentials"in Request.prototype,p=function(e,t,r,n){if(e)return eg(e,t);if(!1!==n){let e=eh.BETTER_AUTH_URL||eh.NEXT_PUBLIC_BETTER_AUTH_URL||eh.PUBLIC_BETTER_AUTH_URL||eh.NUXT_PUBLIC_BETTER_AUTH_URL||eh.NUXT_PUBLIC_AUTH_URL||("/"!==eh.BASE_URL?eh.BASE_URL:void 0);if(e)return eg(e,t)}r?.headers.get("x-forwarded-host"),r?.headers.get("x-forwarded-proto");if(r){let e=function(e){try{let t=new URL(e);return"null"===t.origin?null:t.origin}catch{return null}}(r.url);if(!e)throw new h("Could not get origin from request. Please provide a valid base URL.");return eg(e,t)}if("u">typeof window&&window.location)return eg(window.location.origin,t)}(e?.baseURL,e?.basePath,void 0,void 0)??(e=>{if(void 0!==ed.default){if(ed.default.env.NEXT_PUBLIC_AUTH_URL)return ed.default.env.NEXT_PUBLIC_AUTH_URL;if("u"<typeof window){if(ed.default.env.NEXTAUTH_URL)try{return ed.default.env.NEXTAUTH_URL}catch{}if(ed.default.env.VERCEL_URL)try{let t=ed.default.env.VERCEL_URL.startsWith("http")?"":"https://";return`${new URL(`${t}${ed.default.env.VERCEL_URL}`).origin}${e??"/api/auth"}`}catch{}}}})(e?.basePath)??"/api/auth",E=e?.plugins?.flatMap(e=>e.fetchPlugins).filter(e=>void 0!==e)||[],_={id:"lifecycle-hooks",name:"lifecycle-hooks",hooks:{onSuccess:e?.fetchOptions?.onSuccess,onError:e?.fetchOptions?.onError,onRequest:e?.fetchOptions?.onRequest,onResponse:e?.fetchOptions?.onResponse}},{onSuccess:g,onError:y,onRequest:O,onResponse:T,...R}=e?.fetchOptions||{},b=(t={baseURL:p,...f?{credentials:"include"}:{},method:"GET",jsonParser:e=>e?function(e,t={strict:!0}){return function(e,t={}){let{strict:r=!1,warnings:n=!1,reviver:s,parseDates:o=!0}=t;if("string"!=typeof e)return e;let i=e.trim(),a=i.toLowerCase();if(a.length<=9&&a in eT)return eT[a];
1if(!eO.test(i)){if(r)throw SyntaxError("[better-json] Invalid JSON");return e}if(Object.entries(ey).some(([e,t])=>{let r=t.test(i);return r&&n&&console.warn(`[better-json] Detected potential prototype pollution attempt using ${e} pattern`),r})&&r)throw Error("[better-json] Potential prototype pollution attempt detected");try{return JSON.parse(i,(e,t)=>{if("__proto__"===e||"constructor"===e&&t&&"object"==typeof t&&"prototype"in t){n&&console.warn(`[better-json] Dropping "${e}" key to prevent prototype pollution`);return}if(o&&"string"==typeof t){let e=function(e){let t=eR.exec(e);if(!t)return null;let[,r,n,s,o,i,a,l,u,c,d]=t,f=new Date(Date.UTC(parseInt(r,10),parseInt(n,10)-1,parseInt(s,10),parseInt(o,10),parseInt(i,10),parseInt(a,10),l?parseInt(l.padEnd(3,"0"),10):0));if(u){let e=(60*parseInt(c,10)+parseInt(d,10))*("+"===u?-1:1);f.setUTCMinutes(f.getUTCMinutes()+e)}return f instanceof Date&&!isNaN(f.getTime())?f:null}(t);if(e)return e}return s?s(e,t):t})}catch(t){if(r)throw t;return e}}(e,t)}(e,{strict:!1}):null,customFetchImpl:fetch,...R,plugins:[_,...R.plugins||[],...e?.disableDefaultFetchPlugins?[]:[em],...E]},async function(e,r){let n,s=e0(eZ(eZ({},t),r),{headers:te(null==t?void 0:t.headers,null==r?void 0:r.headers),plugins:[...(null==t?void 0:t.plugins)||[],(n=t||{},{id:"apply-schema",name:"Apply Schema",version:"1.0.0",async init(e,t){var r,s,o,i;let a=(null==(s=null==(r=n.plugins)?void 0:r.find(t=>{var r;return null!=(r=t.schema)&&!!r.config&&(e.startsWith(t.schema.config.baseURL||"")||e.startsWith(t.schema.config.prefix||""))}))?void 0:s.schema)||n.schema;if(a){let r=e;(null==(o=a.config)?void 0:o.prefix)&&r.startsWith(a.config.prefix)&&(r=r.replace(a.config.prefix,""),a.config.baseURL&&(e=e.replace(a.config.prefix,a.config.baseURL))),(null==(i=a.config)?void 0:i.baseURL)&&r.startsWith(a.config.baseURL)&&(r=r.replace(a.config.baseURL,"")),r.startsWith("/")&&"@"===r.charAt(1)&&(r=r.substring(1));let n=a.schema[r];if(n){let r=null==t?void 0:t.headers;if(n.headers&&!(null==t?void 0:t.disableValidation)){let e={};if(null==t?void 0:t.headers){if(t.headers instanceof Headers)t.headers.forEach((t,r)=>{e[r.toLowerCase()]=t});else if("object"==typeof t.headers)for(let[r,n]of Object.entries(t.headers))null!=n&&(e[r.toLowerCase()]=n)}let s=await tn(n.headers,e),o={};for(let[e,t]of Object.entries(s))o[e.toLowerCase()]=t;r=o}let s=e0(eZ({},t),{method:n.method,output:n.output,headers:r});return(null==t?void 0:t.disableValidation)||(s=e0(eZ({},s),{body:n.input?await tn(n.input,null==t?void 0:t.body):null==t?void 0:t.body,params:n.params?await tn(n.params,null==t?void 0:t.params):null==t?void 0:t.params,query:n.query?await tn(n.query,null==t?void 0:t.query):null==t?void 0:t.query})),{url:e,options:s}}}return{url:e,options:t}}}),...(null==r?void 0:r.plugins)||[]]});if(null==t?void 0:t.catchAllError)try{return await to(e,s)}catch(e){return{data:null,error:{status:500,statusText:"Fetch Error",message:"Fetch related error. Captured by catchAllError option. See error property for more details.",error:e}}}return await to(e,s)}),{$sessionSignal:m,session:S,broadcastSessionUpdate:A}=(s=eY(!1),o=0,i=0,s.listen(()=>{i++,o=0}),l=eY({data:null,error:null,isPending:!0,isRefetching:!1,refetch:a=e=>c(e)}),eS(l,({newValue:e,abort:t})=>{eB(l.value,e)&&t()},2,e=>{let t=l.set,r=l.setKey;return l.setKey&&(l.setKey=(t,n)=>{let s;if(e({abort:()=>{s=!0},changed:t,newValue:{...l.value,[t]:n}}),!s)return r(t,n)}),l.set=r=>{let n;if(e({abort:()=>{n=!0},newValue:r}),!n)return t(r)},()=>{l.set=t,l.setKey=r}}),u=async(e,t)=>{let r=l.value;if(l.set({...r,isPending:null===r.data,isRefetching:!0,error:null,refetch:a}),e.aborted)return"aborted";try{var n;let r=await b("/get-session",{method:"GET",query:t?.query,signal:e});if(e.aborted)return"aborted";let{data:s,error:o}=eM(r),i="fresh";if(s?.needsRefresh)try{let t=await b("/get-session",{method:"POST",signal:e});if(e.aborted)return"aborted";({data:s,error:o}=eM(t))}catch{if(e.aborted)return"aborted";i="stale"}if(o){let e=l.value,t=o?.status===401;return l.set({data:t?null:e.data,error:o,isPending:!1,isRefetching:!1,refetch:a}),"failed"}let u=(n=s)&&(null!==n.session||null!==n.user)?n:null,c=l.value,d=null!=c.data&&null!=u&&ev(c.data,u)?c.data:u;return l.set({data:d,error:null,isPending:!1,isRefetching:!1,refetch:a}),i}catch(r){if(e.aborted)return"aborted";let t=l.value;return l.set({data:t.data,error:r,isPending:!1,isRefetching:!1,refetch:a}),"failed"}},c=e=>{o=0,n?.cancel();let t=new AbortController,r={cancel:()=>t.abort(),promise:Promise.resolve().then(()=>t.signal.aborted?"aborted":u(t.signal,e)),revision:i};n=r;let s=e=>{if(n===r){let t,s;n=void 0,"fresh"===e&&r.revision===i&&(s=(t=l.value.data?.session?.expiresAt)instanceof Date?t.getTime():1/0,o=Math.min(Date.now()+1e3,s))}};return r.promise.then(s,()=>s("failed")),r.promise.then(()=>void 0)},d=()=>{},r=()=>{let t;"u"<typeof window||(t=setTimeout(()=>
1{n?.revision===i?n.promise.then(()=>void 0):Date.now()<o?Promise.resolve():c()},0));let r=function(e){let{fetchSession:t,shouldPollSession:r=()=>!0,sessionSignal:n,options:s={}}=e,o=s.sessionOptions?.refetchInterval??0,i=s.sessionOptions?.refetchOnWindowFocus??!0,a=s.sessionOptions?.refetchWhenOffline??!1,l={isInitialized:!1,lastSessionRequest:0},u=e=>{if(a||ex().isOnline){if(e?.event==="storage")return void t();if(e?.event==="poll"){l.lastSessionRequest=ek(),t();return}if(e?.event==="visibilitychange"){if(ek()-l.lastSessionRequest<5)return;l.lastSessionRequest=ek(),t();return}t()}};return{init:()=>{l.isInitialized||(l.isInitialized=!0,o&&o>0&&(l.pollInterval=setInterval(()=>{r()&&u({event:"poll"})},1e3*o)),l.unsubscribeBroadcast=eI().subscribe(()=>{u({event:"storage"})}),i&&(l.unsubscribeFocus=eD().subscribe(()=>{u({event:"visibilitychange"})})),l.unsubscribeOnline=ex().subscribe(e=>{e&&u({event:"visibilitychange"})}),l.unsubscribeSignal=n.listen(()=>{t()}),l.cleanupBroadcastSetup=eI().setup(),l.cleanupFocusSetup=eD().setup(),l.cleanupOnlineSetup=ex().setup())},cleanup:()=>{l.isInitialized&&(l.pollInterval&&(clearInterval(l.pollInterval),l.pollInterval=void 0),l.unsubscribeBroadcast&&(l.unsubscribeBroadcast(),l.unsubscribeBroadcast=void 0),l.unsubscribeFocus&&(l.unsubscribeFocus(),l.unsubscribeFocus=void 0),l.unsubscribeOnline&&(l.unsubscribeOnline(),l.unsubscribeOnline=void 0),l.unsubscribeSignal&&(l.unsubscribeSignal(),l.unsubscribeSignal=void 0),l.cleanupBroadcastSetup&&(l.cleanupBroadcastSetup(),l.cleanupBroadcastSetup=void 0),l.cleanupFocusSetup&&(l.cleanupFocusSetup(),l.cleanupFocusSetup=void 0),l.cleanupOnlineSetup&&(l.cleanupOnlineSetup(),l.cleanupOnlineSetup=void 0),l.isInitialized=!1,l.lastSessionRequest=0)},triggerRefetch:u,broadcastSessionUpdate:e=>{eI().post({event:"session",data:{trigger:e},clientId:Math.random().toString(36).substring(7)})}}}({fetchSession:c,shouldPollSession:()=>null!=l.value.data,sessionSignal:s,options:e});return r.init(),d=r.broadcastSessionUpdate,()=>{t&&clearTimeout(t),r.cleanup()}},eS(l,e=>{let t=r();t&&l.events[6].push(t)},5,e=>{let t=l.listen;l.listen=(...r)=>(l.lc||l.active||(l.active=!0,e()),t(...r));let r=l.off;return l.events[6]=[],l.off=()=>{r(),setTimeout(()=>{if(l.active&&!l.lc){for(let e of(l.active=!1,l.events[6]))e();l.events[6]=[]}},1e3)},()=>{l.listen=t,l.off=r}}),{session:l,$sessionSignal:s,broadcastSessionUpdate:e=>d(e)}),v=!1,w=e?.plugins||[],L={},I={$sessionSignal:m,session:S},U={"/sign-out":"POST","/revoke-sessions":"POST","/revoke-other-sessions":"POST","/delete-user":"POST"},N=[{signal:"$sessionSignal",matcher:e=>"/sign-out"===e||"/update-user"===e||"/update-session"===e||"/sign-up/email"===e||"/sign-in/email"===e||"/delete-user"===e||"/verify-email"===e||"/revoke-sessions"===e||"/revoke-session"===e||"/revoke-other-sessions"===e||"/change-email"===e||"/change-password"===e,callback(e){"/sign-out"===e?A("signout"):("/update-user"===e||"/update-session"===e)&&A("updateUser")}}];for(let e of w)e.getAtoms&&Object.assign(I,e.getAtoms?.(b)),e.pathMethods&&Object.assign(U,e.pathMethods),e.atomListeners&&N.push(...e.atomListeners);let D={notify:e=>{I[e].set(!I[e].get())},listen:(e,t)=>{I[e].subscribe(t)},atoms:I};for(let t of w)t.getActions&&(L=eW(t.getActions?.(b,D,e)??{},L));return{get baseURL(){return p},pluginsActions:L,pluginsAtoms:I,pluginPathMethods:U,atomListeners:N,hydrateSession:e=>{v||null===e||(v=!0,function(e,t){if("u"<typeof window)return;let r=e.get();null===r.data&&null!==t&&e.set({...r,data:t,error:null,isPending:!1})}(S,e))},$fetch:b,$store:D}})(e),u={};for(let[e,t]of Object.entries(s))u[function(e){return`use${e.charAt(0).toUpperCase()+e.slice(1)}`}(e)]=()=>(function(e,t={}){let r=(0,tu.useRef)(e.get()),{keys:n,deps:s=[e,n]}=t,o=(0,tu.useCallback)(t=>{let s=e=>{r.current!==e&&(r.current=e,t())};if(s(e.value),n?.length){let t;return t=new Set(n).add(void 0),e.listen((e,r,n)=>{t.has(n)&&s(e)})}return e.listen(s)},s),i=()=>r.current;return(0,tu.useSyncExternalStore)(o,i,i)})(t);return t={...n,...u,hydrateSession:o,$fetch:i,$store:a},function e(n=[]){return new Proxy(function(){},{get(r,s){var o;if("string"!=typeof s||"then"===s||"catch"===s||"finally"===s)return;let i=[...n,s],a=t;for(let e of i)if(a&&"object"==typeof a&&e in a)a=a[e];else{a=void 0;break}return"function"==typeof a?a:"object"==typeof(o=a)&&null!==o&&"get"in o&&"function"==typeof o.get&&"lc"in o&&"number"==typeof o.lc?a:e(i)},apply:async(e,t,o)=>{let a="/"+n.map(tl).join("/"),u=o[0]||{},c=o[1]||{},{query:d,fetchOptions:f,...p}=u,h={...c,...f},E=function(e,t,r){let n=t[e],{fetchOptions:s,query:o,...i}=r||{};return n||(s?.method?s.method:i&&Object.keys(i).length>0?"POST":"GET")}(a,r,u);return await i(a,{...h,body:"GET"===E?void 0:{...p,...h?.body||{}},query:d||h?.query,method:E,async onSuccess(e){if(await h?.onSuccess?.(e),!l||h.disableSignal)return;let t=l.filter(e=>e.matcher(a));if(!t.length)return;let r=new Set;for(let e of t){let t=s[e.signal];if(!t)return;if(r.has(e.signal))continue;r.add(e.signal);let n=t.get();setTimeout(()=>{t.set(!n)},10),e.callback?.(a)}}})}})}()}({baseURL:window.location.origin,basePath:"/api/auth",plugins:[{id:"magic-link",version:o,$InferServerPlugin:{}},(n={admin:T,user:R,...void 0},{id:"admin-client",version:o,$InferServerPlugin:{},getActions:()=>({admin:{checkRolePermission:e=>(e=>
1{if(e.userId&&e.options?.adminUserIds?.includes(e.userId))return!0;if(!e.permissions)return!1;let t=(e.role||e.options?.defaultRole||"user").split(","),r=e.options?.roles||b;for(let n of t)if(r[n]?.authorize(e.permissions)?.success)return!0;return!1})({role:e.role,options:{ac:void 0,roles:n},permissions:e.permissions})}}),pathMethods:{"/admin/list-users":"GET","/admin/impersonate-user":"POST","/admin/stop-impersonating":"POST"},atomListeners:[{matcher:e=>"/admin/impersonate-user"===e||"/admin/stop-impersonating"===e,signal:"$sessionSignal"}],$ERROR_CODES:m}),{id:"infer-server-plugin",version:o,$InferServerPlugin:{}},(s=!1,{id:"next-cookies",version:o,hooks:{before:[{matcher:e=>"/get-session"===e.path,handler:ei(async e=>{let t;if(s||(!function(e,t){let r=e.options.plugins||[];if(0===r.length)return;let n=r.findIndex(e=>e.id===t);-1===n||r.slice(n+1).some(e=>e.hooks&&Array.isArray(e.hooks.after)&&e.hooks.after.length>0)&&e.logger.warn(`[better-auth] Cookie integration plugin "${t}" should be placed last in the plugins array. Plugins with \`hooks.after\` running after it may set cookies that are not forwarded to the framework cookie store. Move your cookie integration plugin to the end of the \`plugins\` array to avoid missing \`Set-Cookie\` headers.`)}(e.context,"next-cookies"),s=!0),"_flag"in e&&"router"===e._flag)return;try{let{headers:e}=await ec();t=await e()}catch{return}let r="1"===t.get("RSC"),n=!!t.get("next-action");r&&!n&&await x(!0)})}],after:[{matcher:e=>!0,handler:ei(async e=>{let t=e.context.responseHeaders;if((!("_flag"in e)||"router"!==e._flag)&&t instanceof Headers){let e,r,n=t?.get("set-cookie");if(!n)return;let s=(r=new Map,(function(e){if(!e)return[];let t=[],r=0,n=0;for(;n<e.length;){if(","===e[n]){let s=n+1;for(;s<e.length&&" "===e[s];)s++;for(;s<e.length&&"="!==e[s]&&";"!==e[s]&&","!==e[s];)s++;if(s<e.length&&"="===e[s]){let s=e.slice(r,n).trim();for(s&&t.push(s),r=n+1;r<e.length&&" "===e[r];)r++;n=r;continue}}n++}let s=e.slice(r).trim();return s&&t.push(s),t})(n).forEach(e=>{var t;let[n,...s]=e.split(";").map(e=>e.trim()),[o,...i]=(n||"").split("="),a=!((t=i.join("=")).length<2)&&t.startsWith('"')&&t.endsWith('"')?t.slice(1,-1):t;if(!o)return;let l={value:function(e){if(-1===e.indexOf("%"))return e;try{return decodeURIComponent(e)}catch{return e}}(a)};s.forEach(e=>{let[t,...r]=e.split("="),n=r.join("="),s=t.trim().toLowerCase();switch(s){case"max-age":l["max-age"]=n?parseInt(n.trim(),10):void 0;break;case"expires":l.expires=n?new Date(n.trim()):void 0;break;case"domain":l.domain=n?n.trim():void 0;break;case"path":l.path=n?n.trim():void 0;break;case"secure":l.secure=!0;break;case"httponly":l.httponly=!0;break;case"samesite":l.samesite=n?n.trim().toLowerCase():void 0;break;case"partitioned":l.partitioned=!0;break;default:l[s]=!n||n.trim()}}),r.set(o,l)}),r);try{let{cookies:t}=await ec();e=await t()}catch(e){if(e instanceof Error&&(e.message.startsWith("`cookies` was called outside a request scope.")||e.message.includes("Cannot find module")))return;throw e}s.forEach((t,r)=>{if(r)try{e.set(r,t.value,{maxAge:t["max-age"],expires:t.expires,domain:t.domain,path:t.path,secure:t.secure,httpOnly:t.httponly,sameSite:t.samesite,partitioned:t.partitioned})}catch{}});return}})}]}})]});e.s(["authClient",0,tc],636097)}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.