1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3557],{93557:(e,t,n)=>{n.d(t,{M:()=>ep});var r=n(95704);let o=Object.create(null),i=e=>globalThis.process?.env||globalThis.Deno?.env.toObject()||globalThis.__env__||(e?o:globalThis),s=new Proxy(o,{get:(e,t)=>i()[t]??o[t],has:(e,t)=>t in i()||t in o,set:(e,t,n)=>(i(!0)[t]=n,!0),deleteProperty(e,t){if(!t)return!1;let n=i(!0);return delete n[t],!0},ownKeys:()=>Object.keys(i(!0))});function l(e,t){return void 0!==r&&r.env?r.env[e]??t:"undefined"!=typeof Deno?Deno.env.get(e)??t:"undefined"!=typeof Bun?Bun.env[e]??t:t}s.NODE_ENV,Object.freeze({get BETTER_AUTH_SECRET(){return l("BETTER_AUTH_SECRET")},get AUTH_SECRET(){return l("AUTH_SECRET")},get BETTER_AUTH_TELEMETRY(){return l("BETTER_AUTH_TELEMETRY")},get BETTER_AUTH_TELEMETRY_ID(){return l("BETTER_AUTH_TELEMETRY_ID")},get NODE_ENV(){return l("NODE_ENV","development")},get PACKAGE_VERSION(){return l("PACKAGE_VERSION","0.0.0")},get BETTER_AUTH_TELEMETRY_ENDPOINT(){return l("BETTER_AUTH_TELEMETRY_ENDPOINT","")}});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 u=class extends Error{status;body;headers;statusCode;constructor(e="INTERNAL_SERVER_ERROR",t,n={},r="number"==typeof e?e:a[e]){super(t?.message,t?.cause?{cause:t.cause}:void 0),this.status=e,this.body=t,this.headers=n,this.statusCode=r,this.name="APIError",this.status=e,this.headers=n,this.statusCode=r,this.body=t}};Symbol.for("better-call:api-error-headers"),function(e,t){class n 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}()){let t=Error.stackTraceLimit;Error.stackTraceLimit=0,super(...e),Error.stackTraceLimit=t}else super(...e);let 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}}Object.defineProperty(n.prototype,"constructor",{get:()=>t,enumerable:!1,configurable:!0})}(u,Error);var c=class extends Error{constructor(e,t){super(e,t),this.name="BetterAuthError",this.message=e,this.stack=""}};function f(e){let t=e.length;for(;t>0&&47===e.charCodeAt(t-1);)t--;return t===e.length?e:e.slice(0,t)}function d(e,t="/api/auth"){try{let t=new URL(e);if("http:"!==t.protocol&&"https:"!==t.protocol)throw new c(`Invalid base URL: ${e}. URL must include 'http://' or 'https://'`)}catch(t){if(t instanceof c)throw t;throw new c(`Invalid base URL: ${e}. Please provide a valid base URL.`,{cause:t})}if(function(e){try{return"/"!==(f(new URL(e).pathname)||"/")}catch{throw new c(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}(e))return e;let n=f(e);return t&&"/"!==t?(t=t.startsWith("/")?t:`/${t}`,`${n}${t}`):n}let p={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*:/},h=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,y={true:!0,false:!1,null:null,undefined:void 0,nan:NaN,infinity:1/0,"-infinity":-1/0},E=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/,v=["javascript:","data:","vbscript:"],b={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!v.includes(t.protocol)}(e.data.url)&&"undefined"!=typeof window&&window.location&&window.location)try{window.location.href=e.data.url}catch{}}}},g=(e,t,n,r)=>(e.events=e.events||{},e.events[n+10]||(e.events[n+10]=r(t=>{e.events[n].reduceRight((e,t)=>(t(e),e),{shared:{},...t})})),e.events[n]=e.events[n]||[],e.events[n].push(t),()=>{let r=e.events[n],o=r.indexOf(t);~o&&(r.splice(o,1),r.length||(e.events[n+10](),delete e.events[n+10]))});function T(e){if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function m(e,t){if(e===t)return!0;
1if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!m(e[n],t[n]))return!1;return!0}if(T(e)&&T(t)){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!(r in t)||!m(e[r],t[r]))return!1;return!0}return!1}let w=Symbol.for("better-auth:broadcast-channel");var O=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("undefined"!=typeof window)try{localStorage.setItem(this.name,JSON.stringify({...e,timestamp:Math.floor(Date.now()/1e3)}))}catch{}}setup(){if("undefined"==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 R(e="better-auth.message"){return globalThis[w]||(globalThis[w]=new O(e)),globalThis[w]}let S=Symbol.for("better-auth:focus-manager");var _=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("undefined"==typeof window||"undefined"==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 A(){return globalThis[S]||(globalThis[S]=new _),globalThis[S]}let L=Symbol.for("better-auth:online-manager");var U=class{listeners=new Set;isOnline="undefined"==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("undefined"==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 I(){return globalThis[L]||(globalThis[L]=new U),globalThis[L]}let P=()=>Math.floor(Date.now()/1e3),N=[],j=0,D=globalThis.nanostoresGlobal||={epoch:0},C=e=>{let t=[],n={eq:Object.is,get:()=>(n.lc||n.listen(()=>{})(),n.value),init:e,lc:0,listen:e=>(n.lc=t.push(e),()=>{for(let t=j;t<N.length;)N[t]===e?N.splice(t,4):t+=4;let r=t.indexOf(e);~r&&(t.splice(r,1),--n.lc||n.off())}),notify(e,r){D.epoch++;let o=!N.length;for(let o of t)N.push(o,n,e,r);o&&(()=>{let e,t;for(;j<N.length;){t=j,j+=4;try{N[t](N[t+1].value,N[t+2],N[t+3])}catch(t){e=t}}if(N.length=j=0,e)throw e})()},off(){},set(e){let t=n.value;n.eq(t,e)||(n.value=e,n.notify(t))},subscribe(e){let t=n.listen(e);return e(n.value),t},value:e};return n};function k(e){return"object"==typeof e&&null!==e&&"data"in e&&"error"in e?e:{data:e,error:null}}function q(e,t){return m(e.data,t.data)&&e.error===t.error&&e.isPending===t.isPending&&e.isRefetching===t.isRefetching&&e.refetch===t.refetch}function B(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 x(e){return(...t)=>t.reduce((t,n)=>(function e(t,n,r=".",o){if(!B(n))return e(t,{},r,o);let i={...n};for(let n of Object.keys(t)){if("__proto__"===n||"constructor"===n)continue;let s=t[n];null!=s&&(o&&o(i,n,s,r)||(Array.isArray(s)&&Array.isArray(i[n])?i[n]=[...s,...i[n]]:B(s)&&B(i[n])?i[n]=e(s,i[n],(r?`${r}.`:"")+n.toString(),o):i[n]=s))}return i})(t,n,"",e),{})}let F=x();x((e,t,n)=>{if(void 0!==e[t]&&"function"==typeof n)return e[t]=n(e[t]),!0}),x((e,t,n)=>{if(Array.isArray(e[t])&&"function"==typeof n)return e[t]=n(e[t]),!0});var M=class extends Error{constructor(e,t,n){super(t||e.toString(),{cause:n}),this.status=e,this.statusText=t,this.error=n,Error.captureStackTrace(this,this.constructor)}};let $=async(e,t)=>{let n=t||{},r={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:n,hooks:r};for(let c of(null==t?void 0:t.plugins)||[]){var o,i,s,l,a,u;if(c.init){let t=await (null==(u=c.init)?void 0:u.call(c,e.toString(),n));n=t.options||n,e=t.url}r.onRequest.push(null==(o=c.hooks)?void 0:o.onRequest),r.onResponse.push(null==(i=c.hooks)?void 0:i.onResponse),r.onSuccess.push(null==(s=c.hooks)?void 0:s.onSuccess),r.onError.push(null==(l=c.hooks)?void 0:l.onError),r.onRetry.push(null==(a=c.hooks)?void 0:a.onRetry)}return{url:e,options:n,hooks:r}};var H=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}},V=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)}};let G=["get","post","put","patch","delete"];function W(e){if(!e.startsWith("@"))return{method:void 0,path:e};let t=e.indexOf("/"),n=e.slice(1,-1===t?void 0:t);return G.includes(n)?{method:n,path:-1===t?e:e.slice(t+1)}:{method:void 0,path:e}}let Y=async e=>{let t={},n=async e=>"function"==typeof e?await e():e;
1if(null==e?void 0:e.auth){if("Bearer"===e.auth.type){let r=await n(e.auth.token);if(!r)return t;t.authorization=`Bearer ${r}`}else if("Basic"===e.auth.type){let[r,o]=await Promise.all([n(e.auth.username),n(e.auth.password)]);if(!r||!o)return t;t.authorization=`Basic ${btoa(`${r}:${o}`)}`}else if("Custom"===e.auth.type){let[r,o]=await Promise.all([n(e.auth.prefix),n(e.auth.value)]);if(!o)return t;t.authorization=`${null!=r?r:""} ${o}`}}return t},Q=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function J(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 K(e){try{return JSON.parse(e)}catch(t){return e}}function X(e){return"function"==typeof e}function z(...e){let t={};for(let n of e)if(n)if(n instanceof Headers)n.forEach((e,n)=>{t[n]=e});else for(let[e,r]of Array.isArray(n)?n:Object.entries(n))null!=r&&(t[e]=r);return t}async function Z(e){let t=new Headers(z(null==e?void 0:e.headers,await Y(e)));if(!t.has("content-type")){let n=J(null==e?void 0:e.body)?"application/json":null;n&&t.set("content-type",n)}return t}var ee=class e extends Error{constructor(t,n){super(n||JSON.stringify(t,null,2)),this.issues=t,Object.setPrototypeOf(this,e.prototype)}};async function et(e,t){let n=await e["~standard"].validate(t);if(n.issues)throw new ee(n.issues);return n.value}function en(e){return(en="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function er(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function eo(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?er(Object(n),!0).forEach(function(t){!function(e,t,n){var r;(r=function(e,t){if("object"!=en(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=en(r))return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==en(r)?r:r+"")in e)?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):er(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}let ei=async(e,t)=>{var n,r,o,i,s,l,a,u;let{hooks:c,url:f,options:d}=await $(e,t),p=function(e){if(null==e?void 0:e.customFetchImpl)return e.customFetchImpl;if("undefined"!=typeof globalThis&&X(globalThis.fetch))return globalThis.fetch;if("undefined"!=typeof window&&X(window.fetch))return window.fetch;throw Error("No fetch implementation found")}(d),h=new AbortController,y=null!=(n=d.signal)?n:h.signal,E=function(e,t){let{baseURL:n,params:r,query:o}=t||{query:{},params:{},baseURL:""},i=e.startsWith("http")?e.split("/").slice(0,3).join("/"):n||"",{path:s}=W(e);s!==e&&(e=`/${s}`),i.endsWith("/")||(i+="/");let[l,a]=e.replace(i,"").split("?"),u=new URLSearchParams(a);for(let[e,t]of Object.entries(o||{})){let n;if(null!=t){if("string"==typeof t)n=t;else if(Array.isArray(t)){for(let n of t)u.append(e,n);continue}else n=JSON.stringify(t);u.set(e,n)}}let c=new Map;if(r)if(Array.isArray(r))for(let[e,t]of l.split("/").filter(e=>e.startsWith(":")).entries()){let n=r[e];c.set(t,String(n))}else for(let[e,t]of Object.entries(r))c.set(`:${e}`,String(t));l=(l=l.split("/").map(e=>(function(e,t){let n=t.get(e);if(void 0===n)return e.split(":").map(e=>encodeURIComponent(e)).join(":");if("."===n||".."===n)throw TypeError("Path parameters cannot be reserved path segments");return encodeURIComponent(n)})(e,c)).join("/")).replace(/^\/+/,"");let f=u.toString();return(f=f.length>0?`?${f}`.replace(/\+/g,"%20"):"",i.startsWith("http"))?new URL(`${l}${f}`,i):`${i}${l}${f}`}(f,d),v=await Z(d),b=function(e,t){let{body:n}=e;return n?J(n)&&"string"!=typeof n?"application/x-www-form-urlencoded"===function(e){let t=e.get("content-type");return t?t.split(";")[0].trim().toLowerCase():null}(t)?new URLSearchParams(n).toString():JSON.stringify(n):n:null}(d,v),g=function(e,t){if(null==t?void 0:t.method)return t.method.toUpperCase();let{method:n}=W(e);return n?n.toUpperCase():(null==t?void 0:t.body)?"POST":"GET"}(f,d),T=eo(eo({},d),{},{url:E,headers:v,body:b,method:g,signal:y});for(let e of c.onRequest)if(e){let t=await e(T);"object"==typeof t&&null!==t&&Object.assign(T,t)}("pipeTo"in T&&"function"==typeof T.pipeTo||"function"==typeof(null==t||null==(r=t.body)?void 0:r.pipe))&&!("duplex"in T)&&(T.duplex="half");let{clearTimeout:m}=function(e,t){let n;return!(null==e?void 0:e.signal)&&(null==e?void 0:e.timeout)&&(n=setTimeout(()=>null==t?void 0:t.abort(),null==e?void 0:e.timeout)),{abortTimeout:n,clearTimeout:()=>{n&&clearTimeout(n)}}}(d,h),w=await p(T.url,T);m();let O={response:w,request:T};for(let e of c.onResponse)if(e){let n=await e(eo(eo({},O),{},{response:(null==t||null==(i=t.hookOptions)?void 0:i.cloneResponse)?w.clone():w}));n instanceof Response?w=n:"object"==typeof n&&null!==n&&(w=n.response)}if(w.ok){if("HEAD"===T.method)return{data:"",error:null};let e=function(e){let t=e.headers.get("content-type"),n=new Set(["image/svg","application/xml","application/xhtml","application/html"]);if(!t)return"json";let r=t.split(";").shift()||"";return Q.test(r)?"json":n.has(r)||r.startsWith("text/")?"text":"blob"}(w),n={data:null,response:w,request:T};if("json"===e||"text"===e){let e=await w.text();n.data=await (null!=(s=T.jsonParser)?s:K)(e)}else n.data=await w[e]();for(let e of((null==T?void 0:T.output)&&T.output&&!T.disableValidation&&(n.data=await et(T.output,n.data)),c.onSuccess))e&&await e(eo(eo({},n),{},{response:(null==t||null==(l=t.hookOptions)?void 0:l.cloneResponse)?w.clone():w}));return(null==t?void 0:t.throw)?n.data:{data:n.data,error:null}}let R=null!=(o=null==t?void 0:t.jsonParser)?o:K,S=await w.text(),_=function(e){try{return JSON.parse(e),!0}catch(e){return!1}}(S),A=_?await R(S):null,L={response:w,responseText:S,request:T,error:eo(eo({},A),{},{status:w.status,statusText:w.statusText})};for(let e of c.onError)e&&await e(eo(eo({},L),{},{response:(null==t||null==(a=t.hookOptions)?void 0:a.cloneResponse)?w.clone():w}));if(null==t?void 0:t.retry){let n=function(e){if("number"==typeof e)return new H({type:"linear",attempts:e,delay:1e3});switch(e.type){case"linear":return new H(e);case"exponential":return new V(e);default:throw Error("Invalid retry strategy")}}(t.retry),r=null!=(u=t.retryAttempt)?u:0;
1if(await n.shouldAttemptRetry(r,w)){for(let e of c.onRetry)e&&await e(O);let o=n.getDelay(r);return await new Promise(e=>setTimeout(e,o)),await ei(e,eo(eo({},t),{},{retryAttempt:r+1}))}}if(null==t?void 0:t.throw)throw new M(w.status,w.statusText,_?A:S);return{data:null,error:eo(eo({},A),{},{status:w.status,statusText:w.statusText})}};var es=n(95704);let el=/[\p{Ll}\d]+|\p{Lu}+(?!\p{Ll})|\p{Lu}[\p{Ll}\d]+|\p{Lo}+/gu,ea=/['\u2019]/g;function eu(e){return(e.replace(ea,"").match(el)??[]).map(e=>e.toLowerCase()).join("-")}function ec(e,t){let n=t.split(".").flatMap(e=>(function e(t){if(ef.test(t)){let[,n,r]=t.match(ef);return[...e(n),r]}return[t]})(e)),r=e;for(let e of n){if(null==r)return;r=r[e]}return r}let ef=/(.*)\[(\d+)\]/;var ed=n(12115);function ep(e){var t;let{pluginPathMethods:n,pluginsActions:r,pluginsAtoms:o,hydrateSession:i,$fetch:l,$store:a,atomListeners:u}=((e,t)=>{let n,r="credentials"in Request.prototype,o=function(e,t,n,r,o){if(e)return d(e,t);if(!1!==r){let e=s.BETTER_AUTH_URL||s.NEXT_PUBLIC_BETTER_AUTH_URL||s.PUBLIC_BETTER_AUTH_URL||s.NUXT_PUBLIC_BETTER_AUTH_URL||s.NUXT_PUBLIC_AUTH_URL||("/"!==s.BASE_URL?s.BASE_URL:void 0);if(e)return d(e,t)}n?.headers.get("x-forwarded-host"),n?.headers.get("x-forwarded-proto");if(n){let e=function(e){try{let t=new URL(e);return"null"===t.origin?null:t.origin}catch{return null}}(n.url);if(!e)throw new c("Could not get origin from request. Please provide a valid base URL.");return d(e,t)}if("undefined"!=typeof window&&window.location)return d(window.location.origin,t)}(e?.baseURL,e?.basePath,void 0,t)??(e=>{if(void 0!==es){if(es.env.NEXT_PUBLIC_AUTH_URL)return es.env.NEXT_PUBLIC_AUTH_URL;if("undefined"==typeof window){if(es.env.NEXTAUTH_URL)try{return es.env.NEXTAUTH_URL}catch{}if(es.env.VERCEL_URL)try{let t=es.env.VERCEL_URL.startsWith("http")?"":"https://";return`${new URL(`${t}${es.env.VERCEL_URL}`).origin}${e??"/api/auth"}`}catch{}}}})(e?.basePath)??"/api/auth",i=e?.plugins?.flatMap(e=>e.fetchPlugins).filter(e=>void 0!==e)||[],l={id:"lifecycle-hooks",name:"lifecycle-hooks",hooks:{onSuccess:e?.fetchOptions?.onSuccess,onError:e?.fetchOptions?.onError,onRequest:e?.fetchOptions?.onRequest,onResponse:e?.fetchOptions?.onResponse}},{onSuccess:a,onError:u,onRequest:f,onResponse:v,...T}=e?.fetchOptions||{},w=(n={baseURL:o,...r?{credentials:"include"}:{},method:"GET",jsonParser:e=>e?function(e,t={strict:!0}){return function(e,t={}){let{strict:n=!1,warnings:r=!1,reviver:o,parseDates:i=!0}=t;if("string"!=typeof e)return e;let s=e.trim(),l=s.toLowerCase();if(l.length<=9&&l in y)return y[l];if(!h.test(s)){if(n)throw SyntaxError("[better-json] Invalid JSON");return e}if(Object.entries(p).some(([e,t])=>{let n=t.test(s);return n&&r&&console.warn(`[better-json] Detected potential prototype pollution attempt using ${e} pattern`),n})&&n)throw Error("[better-json] Potential prototype pollution attempt detected");try{return JSON.parse(s,(e,t)=>{if("__proto__"===e||"constructor"===e&&t&&"object"==typeof t&&"prototype"in t){r&&console.warn(`[better-json] Dropping "${e}" key to prevent prototype pollution`);return}if(i&&"string"==typeof t){let e=function(e){let t=E.exec(e);if(!t)return null;let[,n,r,o,i,s,l,a,u,c,f]=t,d=new Date(Date.UTC(parseInt(n,10),parseInt(r,10)-1,parseInt(o,10),parseInt(i,10),parseInt(s,10),parseInt(l,10),a?parseInt(a.padEnd(3,"0"),10):0));if(u){let e=(60*parseInt(c,10)+parseInt(f,10))*("+"===u?-1:1);d.setUTCMinutes(d.getUTCMinutes()+e)}return d instanceof Date&&!isNaN(d.getTime())?d:null}(t);if(e)return e}return o?o(e,t):t})}catch(t){if(n)throw t;return e}}(e,t)}(e,{strict:!1}):null,customFetchImpl:fetch,...T,plugins:[l,...T.plugins||[],...e?.disableDefaultFetchPlugins?[]:[b],...i]},async function(e,t){let r,o=eo(eo(eo({},n),t),{},{headers:z(null==n?void 0:n.headers,null==t?void 0:t.headers),plugins:[...(null==n?void 0:n.plugins)||[],(r=n||{},{id:"apply-schema",name:"Apply Schema",version:"1.0.0",async init(e,t){var n,o,i,s;let l=eo(eo({},t),void 0!==r.query&&{query:eo(eo({},r.query),null==t?void 0:t.query)}),a=(null==(n=r.plugins)||null==(n=n.find(t=>{var n;return null!=(n=t.schema)&&!!n.config&&(e.startsWith(t.schema.config.baseURL||"")||e.startsWith(t.schema.config.prefix||""))}
1))?void 0:n.schema)||r.schema;if(a){let n=e;(null==(o=a.config)?void 0:o.prefix)&&n.startsWith(a.config.prefix)&&(n=n.replace(a.config.prefix,""),a.config.baseURL&&(e=e.replace(a.config.prefix,a.config.baseURL))),(null==(i=a.config)?void 0:i.baseURL)&&n.startsWith(a.config.baseURL)&&(n=n.replace(a.config.baseURL,"")),n.startsWith("/")&&"@"===n.charAt(1)&&(n=n.substring(1));let u=a.schema[n];if(u){let{method:o,path:i}=W(n);o&&(e=e.slice(0,e.length-n.length)+i);let a=null==t?void 0:t.headers;if(u.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,n)=>{e[n.toLowerCase()]=t});else if("object"==typeof t.headers)for(let[n,r]of Object.entries(t.headers))null!=r&&(e[n.toLowerCase()]=r)}let n=await et(u.headers,e),r={};for(let[e,t]of Object.entries(n))r[e.toLowerCase()]=t;a=r}let c=null!=(s=u.method)?s:o;if(l=eo(eo(eo(eo({},l),void 0!==c&&{method:c}),void 0!==u.output&&{output:u.output}),void 0!==a&&{headers:a}),!(null==t?void 0:t.disableValidation)){if(u.query&&(l.query=await et(u.query,null==t?void 0:t.query),null!==l.query&&"object"==typeof l.query)){let e=eo({},r.query);for(let n of Object.keys(e))(null==t?void 0:t.query)&&Object.prototype.hasOwnProperty.call(t.query,n)&&(e[n]=t.query[n]);l.query=eo(eo({},e),l.query)}l=eo(eo({},l),{},{body:u.input?await et(u.input,null==t?void 0:t.body):null==t?void 0:t.body,params:u.params?await et(u.params,null==t?void 0:t.params):null==t?void 0:t.params})}return{url:e,options:l}}}return eo({url:e},(void 0!==t||void 0!==r.query)&&{options:l})}}),...(null==t?void 0:t.plugins)||[]]});if(null==n?void 0:n.catchAllError)try{return await ei(e,o)}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 ei(e,o)}),{$sessionSignal:O,session:S,broadcastSessionUpdate:_}=function(e,t){var n;let r,o=C(!1),i=0,s=0;o.listen(()=>{s++,i=0});let l=e=>c(e),a=C({data:null,error:null,isPending:!0,isRefetching:!1,refetch:l});g(a,({newValue:e,abort:t})=>{q(a.value,e)&&t()},2,e=>{let t=a.set,n=a.setKey;return a.setKey&&(a.setKey=(t,r)=>{let o;if(e({abort:()=>{o=!0},changed:t,newValue:{...a.value,[t]:r}}),!o)return n(t,r)}),a.set=n=>{let r;if(e({abort:()=>{r=!0},newValue:n}),!r)return t(n)},()=>{a.set=t,a.setKey=n}});let u=async(t,n)=>{let r=a.value;if(a.set({...r,isPending:null===r.data,isRefetching:!0,error:null,refetch:l}),t.aborted)return"aborted";try{var o;let r=await e("/get-session",{method:"GET",query:n?.query,signal:t});if(t.aborted)return"aborted";let{data:i,error:s}=k(r),u="fresh";if(i?.needsRefresh)try{let n=await e("/get-session",{method:"POST",signal:t});if(t.aborted)return"aborted";({data:i,error:s}=k(n))}catch{if(t.aborted)return"aborted";u="stale"}if(s){let e=a.value,t=s?.status===401;return a.set({data:t?null:e.data,error:s,isPending:!1,isRefetching:!1,refetch:l}),"failed"}let c=(o=i)&&(null!==o.session||null!==o.user)?o:null,f=a.value,d=null!=f.data&&null!=c&&m(f.data,c)?f.data:c;return a.set({data:d,error:null,isPending:!1,isRefetching:!1,refetch:l}),u}catch(n){if(t.aborted)return"aborted";let e=a.value;return a.set({data:e.data,error:n,isPending:!1,isRefetching:!1,refetch:l}),"failed"}},c=e=>{i=0,r?.cancel();let t=new AbortController,n={cancel:()=>t.abort(),promise:Promise.resolve().then(()=>t.signal.aborted?"aborted":u(t.signal,e)),revision:s};r=n;let o=e=>{r===n&&(r=void 0,"fresh"===e&&n.revision===s&&(i=(()=>{let e=a.value.data?.session?.expiresAt,t=e instanceof Date?e.getTime():1/0;return Math.min(Date.now()+1e3,t)})()))};return n.promise.then(o,()=>o("failed")),n.promise.then(()=>void 0)},f=()=>{};return n=()=>{let e;"undefined"!=typeof window&&(e=setTimeout(()=>{r?.revision===s?r.promise.then(()=>void 0):Date.now()<i?Promise.resolve():c()},0));let n=function(e){let{fetchSession:t,shouldPollSession:n=()=>!0,sessionSignal:r,options:o={}}=e,i=o.sessionOptions?.refetchInterval??0,s=o.sessionOptions?.refetchOnWindowFocus??!0,l=o.sessionOptions?.refetchWhenOffline??!1,a={isInitialized:!1,lastSessionRequest:0},u=e=>{if(l||I().isOnline){if(e?.event==="storage")return void t();if(e?.event==="poll"){a.lastSessionRequest=P(),t();return}if(e?.event==="visibilitychange"){if(P()-a.lastSessionRequest<5)return;a.lastSessionRequest=P(),t();return}t()}};return{init:()=>{a.isInitialized||(a.isInitialized=!0,i&&i>0&&(a.pollInterval=setInterval(()=>{n()&&u({event:"poll"})},1e3*i)),a.unsubscribeBroadcast=R().subscribe(()=>{u({event:"storage"})}),s&&(a.unsubscribeFocus=A().subscribe(()=>{u({event:"visibilitychange"})})),a.unsubscribeOnline=I().subscribe(e=>{e&&u({event:"visibilitychange"})}),a.unsubscribeSignal=r.listen(()=>{t()}),a.cleanupBroadcastSetup=R().setup(),a.cleanupFocusSetup=A().setup(),a.cleanupOnlineSetup=I().setup())},cleanup:()=>{a.isInitialized&&(a.pollInterval&&(clearInterval(a.pollInterval),a.pollInterval=void 0),a.unsubscribeBroadcast&&(a.unsubscribeBroadcast(),a.unsubscribeBroadcast=void 0),a.unsubscribeFocus&&(a.unsubscribeFocus(),a.unsubscribeFocus=void 0),a.unsubscribeOnline&&(a.unsubscribeOnline(),a.unsubscribeOnline=void 0),a.unsubscribeSignal&&(a.unsubscribeSignal(),a.unsubscribeSignal=void 0),a.cleanupBroadcastSetup&&(a.cleanupBroadcastSetup(),a.cleanupBroadcastSetup=void 0),a.cleanupFocusSetup&&(a.cleanupFocusSetup(),a.cleanupFocusSetup=void 0),a.cleanupOnlineSetup&&(a.cleanupOnlineSetup(),a.cleanupOnlineSetup=void 0),a.isInitialized=!1,a.lastSessionRequest=0)},triggerRefetch:u,broadcastSessionUpdate:e=>{R().post({event:"session",data:{trigger:e},clientId:Math.random().toString(36).substring(7)})}}}({fetchSession:c,shouldPollSession:()=>null!=a.value.data,sessionSignal:o,options:t});return n.init(),f=n.broadcastSessionUpdate,()=>{e&&clearTimeout(e),n.cleanup()}},g(a,e=>{let t=n(e);t&&a.events[6].push(t)},5,e=>{let t=a.listen;a.listen=(...n)=>(a.lc||a.active||(a.active=!0,e()),t(...n));let n=a.off;return a.events[6]=[],a.off=()=>{n(),setTimeout(()=>
1{if(a.active&&!a.lc){for(let e of(a.active=!1,a.events[6]))e();a.events[6]=[]}},1e3)},()=>{a.listen=t,a.off=n}}),{session:a,$sessionSignal:o,broadcastSessionUpdate:e=>f(e)}}(w,e),L=!1,U=e?.plugins||[],N={},j={$sessionSignal:O,session:S},D={"/sign-out":"POST","/revoke-sessions":"POST","/revoke-other-sessions":"POST","/delete-user":"POST"},B=[{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?_("signout"):("/update-user"===e||"/update-session"===e)&&_("updateUser")}}];for(let e of U)e.getAtoms&&Object.assign(j,e.getAtoms?.(w)),e.pathMethods&&Object.assign(D,e.pathMethods),e.atomListeners&&B.push(...e.atomListeners);let x={notify:e=>{j[e].set(!j[e].get())},listen:(e,t)=>{j[e].subscribe(t)},atoms:j};for(let t of U)t.getActions&&(N=F(t.getActions?.(w,x,e)??{},N));return{get baseURL(){return o},pluginsActions:N,pluginsAtoms:j,pluginPathMethods:D,atomListeners:B,hydrateSession:e=>{L||null===e||(L=!0,function(e,t){if("undefined"==typeof window)return;let n=e.get();null===n.data&&null!==t&&e.set({...n,data:t,error:null,isPending:!1})}(S,e))},$sessionSignal:O,$fetch:w,$store:x}})(e),f={};for(let[e,t]of Object.entries(o))f[function(e){return`use${e.charAt(0).toUpperCase()+e.slice(1)}`}(e)]=()=>(function(e,t={}){let n=(0,ed.useRef)(e.get()),{keys:r,deps:o=[e,r]}=t,i=(0,ed.useCallback)(t=>{let o=e=>{n.current!==e&&(n.current=e,t())};if(o(e.value),r?.length){let t;return t=new Set(r),e.listen((e,n,i)=>{(void 0===i?r.some(t=>void 0===n||e[t]!==n[t]||ec(e,t)!==ec(n,t)):t.has(i)||t.has(i.split(/\.|\[/)[0]))&&o(e,n,i)})}return e.listen(o)},o),s=()=>n.current;return(0,ed.useSyncExternalStore)(i,s,s)})(t);return t={...r,...f,hydrateSession:i,$fetch:l,$store:a},function e(r=[]){return new Proxy(function(){},{get(n,o){var i;if("string"!=typeof o||"then"===o||"catch"===o||"finally"===o)return;let s=[...r,o],l=t;for(let e of s)if(l&&"object"==typeof l&&e in l)l=l[e];else{l=void 0;break}return"function"==typeof l?l:"object"==typeof(i=l)&&null!==i&&"get"in i&&"function"==typeof i.get&&"lc"in i&&"number"==typeof i.lc?l:e(s)},apply:async(e,t,i)=>{let s="/"+r.map(eu).join("/"),a=i[0]||{},c=i[1]||{},{query:f,fetchOptions:d,...p}=a,h={...c,...d},y=function(e,t,n){let r=t[e],{fetchOptions:o,query:i,...s}=n||{};return r||(o?.method?o.method:s&&Object.keys(s).length>0?"POST":"GET")}(s,n,a);return await l(s,{...h,body:"GET"===y?void 0:{...p,...h?.body||{}},query:f||h?.query,method:y,async onSuccess(e){if(await h?.onSuccess?.(e),!u||h.disableSignal)return;let t=u.filter(e=>e.matcher(s));if(!t.length)return;let n=new Set;for(let e of t){let t=o[e.signal];if(!t)return;if(n.has(e.signal))continue;n.add(e.signal);let r=t.get();setTimeout(()=>{t.set(!r)},10),e.callback?.(s)}}})}})}()}}}]);
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.