1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,578938,882985,e=>{"use strict";let t,n,r;var s=e.i(969569);let i=Object.create(null),o=e=>globalThis.process?.env||globalThis.Deno?.env.toObject()||globalThis.__env__||(e?i:globalThis),l=new Proxy(i,{get:(e,t)=>o()[t]??i[t],has:(e,t)=>t in o()||t in i,set:(e,t,n)=>(o(!0)[t]=n,!0),deleteProperty(e,t){if(!t)return!1;let n=o(!0);return delete n[t],!0},ownKeys:()=>Object.keys(o(!0))});function a(e,t){return void 0!==s.default&&s.default.env?s.default.env[e]??t:"undefined"!=typeof Deno?Deno.env.get(e)??t:"undefined"!=typeof Bun?Bun.env[e]??t:t}void 0!==s.default&&s.default.env,Object.freeze({get BETTER_AUTH_SECRET(){return a("BETTER_AUTH_SECRET")},get AUTH_SECRET(){return a("AUTH_SECRET")},get BETTER_AUTH_TELEMETRY(){return a("BETTER_AUTH_TELEMETRY")},get BETTER_AUTH_TELEMETRY_ID(){return a("BETTER_AUTH_TELEMETRY_ID")},get NODE_ENV(){return a("NODE_ENV","development")},get PACKAGE_VERSION(){return a("PACKAGE_VERSION","0.0.0")},get BETTER_AUTH_TELEMETRY_ENDPOINT(){return a("BETTER_AUTH_TELEMETRY_ENDPOINT","https://telemetry.better-auth.com/v1/track")}});let u={eterm:4,cons25:4,console:4,cygwin:4,dtterm:4,gnome:4,hurd:4,jfbterm:4,konsole:4,kterm:4,mlterm:4,mosh:24,putty:4,st:4,"rxvt-unicode-24bit":24,terminator:24,"xterm-kitty":24},c=new Map(Object.entries({APPVEYOR:8,BUILDKITE:8,CIRCLECI:24,DRONE:8,GITEA_ACTIONS:24,GITHUB_ACTIONS:24,GITLAB_CI:8,TRAVIS:8})),d=[/ansi/,/color/,/linux/,/direct/,/^con[0-9]*x[0-9]/,/^rxvt/,/^screen/,/^xterm/,/^vt100/,/^vt220/],f="\x1b[0m",p="\x1b[31m",h="\x1b[32m",v="\x1b[33m",m="\x1b[34m",g="\x1b[35m",y=["debug","info","success","warn","error"],b={info:m,success:h,warn:v,error:p,debug:g};t=(void 0)??"error",n=1!==function(){if(void 0!==a("FORCE_COLOR"))switch(a("FORCE_COLOR")){case"":case"1":case"true":return 4;case"2":return 8;case"3":return 24;default:return 1}if(void 0!==a("NODE_DISABLE_COLORS")&&""!==a("NODE_DISABLE_COLORS")||void 0!==a("NO_COLOR")&&""!==a("NO_COLOR")||"dumb"===a("TERM"))return 1;if(a("TMUX"))return 24;if("TF_BUILD"in l&&"AGENT_NAME"in l)return 4;if("CI"in l){for(let{0:e,1:t}of c)if(e in l)return t;return"codeship"===a("CI_NAME")?8:1}if("TEAMCITY_VERSION"in l)return null!==/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.exec(a("TEAMCITY_VERSION"))?4:1;switch(a("TERM_PROGRAM")){case"iTerm.app":if(!a("TERM_PROGRAM_VERSION")||null!==/^[0-2]\./.exec(a("TERM_PROGRAM_VERSION")))return 8;return 24;case"HyperTerm":case"MacTerm":return 24;case"Apple_Terminal":return 8}if("truecolor"===a("COLORTERM")||"24bit"===a("COLORTERM"))return 24;if(a("TERM")){if(null!==/truecolor/.exec(a("TERM")))return 24;if(null!==/^xterm-256/.exec(a("TERM")))return 8;let e=a("TERM").toLowerCase();if(u[e])return u[e];if(d.some(t=>null!==t.exec(e)))return 4}return a("COLORTERM")?4:1}(),Object.fromEntries(y.map(e=>[e,(...[r,...s])=>((e,r,s=[])=>{let i;if(!(y.indexOf(e)>=y.indexOf(t)))return;let o=(i=new Date().toISOString(),n?`\x1b[2m${i}${f} ${b[e]}${e.toUpperCase()}${f} \x1b[1m[Better Auth]:${f} ${r}`:`${i} ${e.toUpperCase()} [Better Auth]: ${r}`);"error"===e?console.error(o,...s):"warn"===e?console.warn(o,...s):console.log(o,...s)})(e,r,s)]));var w=class extends Error{constructor(e,t){super(e),this.name="BetterAuthError",this.message=e,this.cause=t,this.stack=""}};function R(e,t="/api/auth"){try{let t=new URL(e);if("http:"!==t.protocol&&"https:"!==t.protocol)throw new w(`Invalid base URL: ${e}. URL must include 'http://' or 'https://'`)}catch(t){if(t instanceof w)throw t;throw new w(`Invalid base URL: ${e}. Please provide a valid base URL.`,String(t))}if(function(e){try{return"/"!==(new URL(e).pathname.replace(/\/+$/,"")||"/")}catch(t){throw new w(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}(e))return e;let n=e.replace(/\/+$/,"");return t&&"/"!==t?(t=t.startsWith("/")?t:`/${t}`,`${n}${t}`):n}let T={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*:/},E=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,O={true:!0,false:!1,null:null,undefined:void 0,nan:NaN,infinity:1/0,"-infinity":-1/0},S=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/,_=[],A=0,L=0,I=e=>{let t=[],n={get:()=>(n.lc||n.listen(()=>{})(),n.value),lc:0,listen:e=>(n.lc=t.push(e),()=>{for(let t=A+4;t<_.length;)_[t]===e?_.splice(t,4):t+=4;let r=t.indexOf(e);~r&&(t.splice(r,1),--n.lc||n.off())}),notify(e,r){L++;let s=!_.length;for(let s of t)_.push(s,n.value,e,r);
1if(s){for(A=0;A<_.length;A+=4)_[A](_[A+1],_[A+2],_[A+3]);_.length=0}},off(){},set(e){let t=n.value;t!==e&&(n.value=e,n.notify(t))},subscribe(e){let t=n.listen(e);return e(n.value),t},value:e};return n},U=(e,t)=>{var n,r;return n=n=>{let r=t(n);r&&e.events[6].push(r)},r=t=>{let n=e.listen;e.listen=(...r)=>(e.lc||e.active||(e.active=!0,t()),n(...r));let r=e.off;return e.events[6]=[],e.off=()=>{r(),setTimeout(()=>{if(e.active&&!e.lc){for(let t of(e.active=!1,e.events[6]))t();e.events[6]=[]}},1e3)},()=>{e.listen=n,e.off=r}},e.events=e.events||{},e.events[15]||(e.events[15]=r(t=>{e.events[5].reduceRight((e,t)=>(t(e),e),{shared:{},...t})})),e.events[5]=e.events[5]||[],e.events[5].push(n),()=>{let t=e.events[5],r=t.indexOf(n);t.splice(r,1),t.length||(delete e.events[5],e.events[15](),delete e.events[15])}};var P=Object.defineProperty,x=Object.defineProperties,C=Object.getOwnPropertyDescriptors,$=Object.getOwnPropertySymbols,j=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable,B=(e,t,n)=>t in e?P(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,M=(e,t)=>{for(var n in t||(t={}))j.call(t,n)&&B(e,n,t[n]);if($)for(var n of $(t))N.call(t,n)&&B(e,n,t[n]);return e},D=(e,t)=>x(e,C(t)),k=class extends Error{constructor(e,t,n){super(t||e.toString(),{cause:n}),this.status=e,this.statusText=t,this.error=n}},q=async(e,t)=>{var n,r,s,i,o,l;let a=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:a,hooks:u};for(let c of(null==t?void 0:t.plugins)||[]){if(c.init){let r=await (null==(n=c.init)?void 0:n.call(c,e.toString(),t));a=r.options||a,e=r.url}u.onRequest.push(null==(r=c.hooks)?void 0:r.onRequest),u.onResponse.push(null==(s=c.hooks)?void 0:s.onResponse),u.onSuccess.push(null==(i=c.hooks)?void 0:i.onSuccess),u.onError.push(null==(o=c.hooks)?void 0:o.onError),u.onRetry.push(null==(l=c.hooks)?void 0:l.onRetry)}return{url:e,options:a,hooks:u}},F=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}},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(e){return Math.min(this.options.maxDelay,this.options.baseDelay*2**e)}},G=async e=>{let t={},n=async e=>"function"==typeof e?await e():e;if(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=n(e.auth.username),s=n(e.auth.password);if(!r||!s)return t;t.authorization=`Basic ${btoa(`${r}:${s}`)}`}else if("Custom"===e.auth.type){let r=n(e.auth.value);if(!r)return t;t.authorization=`${n(e.auth.prefix)} ${r}`}}return t},W=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function V(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 z(e){try{return JSON.parse(e)}catch(t){return e}}function Y(e){return"function"==typeof e}async function J(e){let t=new Headers(null==e?void 0:e.headers);for(let[n,r]of Object.entries(await G(e)||{}))t.set(n,r);if(!t.has("content-type")){let n=V(null==e?void 0:e.body)?"application/json":null;n&&t.set("content-type",n)}return t}var K=class e extends Error{constructor(t,n){super(n||JSON.stringify(t,null,2)),this.issues=t,Object.setPrototypeOf(this,e.prototype)}};async function X(e,t){let n=await e["~standard"].validate(t);if(n.issues)throw new K(n.issues);return n.value}var Z=["get","post","put","patch","delete"],Q=async(e,t)=>{var n,r,s,i,o,l,a,u;let c,{hooks:d,url:f,options:p}=await q(e,t),h=function(e){if(null==e?void 0:e.customFetchImpl)return e.customFetchImpl;if("undefined"!=typeof globalThis&&Y(globalThis.fetch))return globalThis.fetch;if("undefined"!=typeof window&&Y(window.fetch))return window.fetch;throw Error("No fetch implementation found")}(p),v=new AbortController,m=null!=(n=p.signal)?n:v.signal,g=function(e,t){let{baseURL:n,params:r,query:s}=t||{query:{},params:{},baseURL:""},i=e.startsWith("http")?e.split("/").slice(0,3).join("/"):n||"";if(e.startsWith("@")){let t=e.toString().split("@")[1].split("/")[0];Z.includes(t)&&(e=e.replace(`@${t}/`,"/"))}i.endsWith("/")||(i+="/");let[o,l]=e.replace(i,"").split("?"),a=new URLSearchParams(l);for(let[e,t]of Object.entries(s||{}))null!=t&&a.set(e,String(t));if(r)if(Array.isArray(r))for(let[e,t]of o.split("/").filter(e=>e.startsWith(":")).entries()){let n=r[e];o=o.replace(t,n)}else for(let[e,t]of Object.entries(r))o=o.replace(`:${e}`,String(t));(o=o.split("/").map(encodeURIComponent).join("/")).startsWith("/")&&(o=o.slice(1));let u=a.toString();return(u=u.length>0?`?${u}`.replace(/\+/g,"%20"):"",i.startsWith("http"))?new URL(`${o}${u}`,i):`${i}${o}${u}`}(f,p),y=function(e){if(!(null==e?void 0:e.body))return null;let t=new Headers(null==e?void 0:e.headers);if(V(e.body)&&!t.has("content-type")){for(let[t,n]of Object.entries(null==e?void 0:e.body))n instanceof Date&&(e.body[t]=n.toISOString());return JSON.stringify(e.body)}return e.body}(p),b=await J(p),w=function(e,t){var n;if(null==t?void 0:t.method)return t.method.toUpperCase();if(e.startsWith("@")){let r=null==(n=e.split("@")[1])?void 0:n.split("/")[0];return Z.includes(r)?r.toUpperCase():(null==t?void 0:t.body)?"POST":"GET"}return(null==t?void 0:t.body)?"POST":"GET"}(f,p),R=D(M({},p),{url:g,headers:b,body:y,method:w,signal:m});for(let e of d.onRequest)if(e){let t=await e(R);t instanceof Object&&(R=t)}("pipeTo"in R&&"function"==typeof R.pipeTo||"function"==typeof(null==(r=null==t?void 0:t.body)?void 0:r.pipe))&&!("duplex"in R)&&(R.duplex="half");let{clearTimeout:T}=(!(null==p?void 0:p.signal)&&(null==p?void 0:p.timeout)&&(c=setTimeout(()=>null==v?void 0:v.abort(),null==p?void 0:p.timeout)),{abortTimeout:c,clearTimeout:()=>{c&&clearTimeout(c)}}),E=await h(R.url,R);T();let O={response:E,request:R};for(let e of d.onResponse)if(e){let n=await e(D(M({},O),{response:(null==(s=null==t?void 0:t.hookOptions)?void 0:s.cloneResponse)?E.clone():E}
1));n instanceof Response?E=n:n instanceof Object&&(E=n.response)}if(E.ok){if("HEAD"===R.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 W.test(r)?"json":n.has(r)||r.startsWith("text/")?"text":"blob"}(E),n={data:"",response:E,request:R};if("json"===e||"text"===e){let e=await E.text(),t=null!=(i=R.jsonParser)?i:z;n.data=await t(e)}else n.data=await E[e]();for(let e of((null==R?void 0:R.output)&&R.output&&!R.disableValidation&&(n.data=await X(R.output,n.data)),d.onSuccess))e&&await e(D(M({},n),{response:(null==(o=null==t?void 0:t.hookOptions)?void 0:o.cloneResponse)?E.clone():E}));return(null==t?void 0:t.throw)?n.data:{data:n.data,error:null}}let S=null!=(l=null==t?void 0:t.jsonParser)?l:z,_=await E.text(),A=function(e){try{return JSON.parse(e),!0}catch(e){return!1}}(_),L=A?await S(_):null,I={response:E,responseText:_,request:R,error:D(M({},L),{status:E.status,statusText:E.statusText})};for(let e of d.onError)e&&await e(D(M({},I),{response:(null==(a=null==t?void 0:t.hookOptions)?void 0:a.cloneResponse)?E.clone():E}));if(null==t?void 0:t.retry){let n=function(e){if("number"==typeof e)return new F({type:"linear",attempts:e,delay:1e3});switch(e.type){case"linear":return new F(e);case"exponential":return new H(e);default:throw Error("Invalid retry strategy")}}(t.retry),r=null!=(u=t.retryAttempt)?u:0;if(await n.shouldAttemptRetry(r,E)){for(let e of d.onRetry)e&&await e(O);let s=n.getDelay(r);return await new Promise(e=>setTimeout(e,s)),await Q(e,D(M({},t),{retryAttempt:r+1}))}}if(null==t?void 0:t.throw)throw new k(E.status,E.statusText,A?L:_);return{data:null,error:D(M({},L),{status:E.status,statusText:E.statusText})}};let ee=Symbol.for("better-auth:broadcast-channel");var et=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 en(e="better-auth.message"){return globalThis[ee]||(globalThis[ee]=new et(e)),globalThis[ee]}let er=Symbol.for("better-auth:focus-manager");var es=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 ei(){return globalThis[er]||(globalThis[er]=new es),globalThis[er]}let eo=Symbol.for("better-auth:online-manager");var el=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 ea(){return globalThis[eo]||(globalThis[eo]=new el),globalThis[eo]}let eu=()=>"undefined"==typeof window,ec=()=>Math.floor(Date.now()/1e3),ed={id:"redirect",name:"Redirect",hooks:{onSuccess(e){if(e.data?.url&&e.data?.redirect&&"undefined"!=typeof window&&window.location&&window.location)try{window.location.href=e.data.url}catch{}}}};function ef(e){return{newRole:e=>{var t;return{authorize(e,n="AND"){let r=!1;for(let[s,i]of Object.entries(e)){let e=t[s];if(!e)return{success:!1,error:`You are not allowed to access resource: ${s}`};if(Array.isArray(i))r=i.every(t=>e.includes(t));else if("object"==typeof i)r="OR"===i.connector?i.actions.some(t=>e.includes(t)):i.actions.every(t=>e.includes(t));else throw new w("Invalid access control request");
1if(r&&"OR"===n)return{success:r};if(!r&&"AND"===n)return{success:!1,error:`unauthorized to access resource "${s}"`}}return r?{success:r}:{success:!1,error:"Not authorized"}},statements:t=e}},statements:e}}let ep=ef({user:["create","list","set-role","ban","impersonate","delete","set-password","get","update"],session:["list","revoke","delete"]}),eh=ep.newRole({user:["create","list","set-role","ban","impersonate","delete","set-password","get","update"],session:["list","revoke","delete"]}),ev=ep.newRole({user:[],session:[]}),em={admin:eh,user:ev},eg=ef({organization:["update","delete"],member:["create","update","delete"],invitation:["create","cancel"],team:["create","update","delete"],ac:["create","read","update","delete"]});eg.newRole({organization:["update"],invitation:["create","cancel"],member:["create","update","delete"],team:["create","update","delete"],ac:["create","read","update","delete"]}),eg.newRole({organization:["update","delete"],member:["create","update","delete"],invitation:["create","cancel"],team:["create","update","delete"],ac:["create","read","update","delete"]}),eg.newRole({organization:[],member:[],invitation:[],team:[],ac:["read"]});var ey=e.i(78186);function eb(){return"https://www.happy-horse.studio"}function ew(e){return`https://dashboard.stripe.com/customers/${e}`}e.i(744705),e.s(["getBaseUrl",()=>eb,"getStripeDashboardCustomerUrl",()=>ew],882985);let eR=function(e){var t,n;let{pluginPathMethods:r,pluginsActions:s,pluginsAtoms:i,$fetch:o,$store:a,atomListeners:u}=((e,t)=>{var n;let r,s,i="credentials"in Request.prototype,o=function(e,t,n,r,s){if(e)return R(e,t);if(!1!==r){let e=l.BETTER_AUTH_URL||l.NEXT_PUBLIC_BETTER_AUTH_URL||l.PUBLIC_BETTER_AUTH_URL||l.NUXT_PUBLIC_BETTER_AUTH_URL||l.NUXT_PUBLIC_AUTH_URL||("/"!==l.BASE_URL?l.BASE_URL:void 0);if(e)return R(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(e){return null}}(n.url);if(!e)throw new w("Could not get origin from request. Please provide a valid base URL.");return R(e,t)}if("undefined"!=typeof window&&window.location)return R(window.location.origin,t)}(e?.baseURL,e?.basePath,void 0,void 0)??"/api/auth",a=e?.plugins?.flatMap(e=>e.fetchPlugins).filter(e=>void 0!==e)||[],u={id:"lifecycle-hooks",name:"lifecycle-hooks",hooks:{onSuccess:e?.fetchOptions?.onSuccess,onError:e?.fetchOptions?.onError,onRequest:e?.fetchOptions?.onRequest,onResponse:e?.fetchOptions?.onResponse}},{onSuccess:c,onError:d,onRequest:f,onResponse:p,...h}=e?.fetchOptions||{},v=(n={baseURL:o,...i?{credentials:"include"}:{},method:"GET",jsonParser:e=>e?function(e,t={strict:!0}){return function(e,t={}){let{strict:n=!1,warnings:r=!1,reviver:s,parseDates:i=!0}=t;if("string"!=typeof e)return e;let o=e.trim();if(o.length>0&&'"'===o[0]&&o.endsWith('"')&&!o.slice(1,-1).includes('"'))return o.slice(1,-1);let l=o.toLowerCase();if(l.length<=9&&l in O)return O[l];if(!E.test(o)){if(n)throw SyntaxError("[better-json] Invalid JSON");return e}if(Object.entries(T).some(([e,t])=>{let n=t.test(o);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(o,(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=S.exec(e);if(!t)return null;let[,n,r,s,i,o,l,a,u,c,d]=t,f=new Date(Date.UTC(parseInt(n,10),parseInt(r,10)-1,parseInt(s,10),parseInt(i,10),parseInt(o,10),parseInt(l,10),a?parseInt(a.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(n)throw t;return e}}(e,t)}(e,{strict:!1}):null,customFetchImpl:fetch,...h,plugins:[u,...h.plugins||[],...e?.disableDefaultFetchPlugins?[]:[ed],...a]},async function(e,t){let r,s=D(M(M({},n),t),{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,s,i,o;let l=(null==(s=null==(n=r.plugins)?void 0: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:s.schema)||r.schema;if(l){let n=e;(null==(i=l.config)?void 0:i.prefix)&&n.startsWith(l.config.prefix)&&(n=n.replace(l.config.prefix,""),l.config.baseURL&&(e=e.replace(l.config.prefix,l.config.baseURL))),(null==(o=l.config)?void 0:o.baseURL)&&n.startsWith(l.config.baseURL)&&(n=n.replace(l.config.baseURL,""));let r=l.schema[n];if(r){let n=D(M({},t),{method:r.method,output:r.output});return(null==t?void 0:t.disableValidation)||(n=D(M({},n),{body:r.input?await X(r.input,null==t?void 0:t.body):null==t?void 0:t.body,params:r.params?await X(r.params,null==t?void 0:t.params):null==t?void 0:t.params,query:r.query?await X(r.query,null==t?void 0:t.query):null==t?void 0:t.query})),{url:e,options:n}}}return{url:e,options:t}}})]});if(null==n?void 0:n.catchAllError)try{return await Q(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 Q(e,s)}),{$sessionSignal:m,session:g}=(s=((e,t,n,r)=>{let s=I({data:null,error:null,isPending:!0,isRefetching:!1,refetch:e=>i(e)}),i=async e=>new Promise(i=>{let o="function"==typeof r?r({data:s.get().data,error:s.get().error,isPending:s.get().isPending}):r;n(t,{...o,query:{...o?.query,...e?.query},async onSuccess(e){s.set({data:e.data,error:null,isPending:!1,isRefetching:!1,refetch:s.value.refetch}),await o?.onSuccess?.(e)},async onError(e){let{request:t}=e,n="number"==typeof t.retry?t.retry:t.retry?.attempts,r=t.retryAttempt||0;n&&r<n||(s.set({error:e.error,data:null,isPending:!1,isRefetching:!1,refetch:s.value.refetch}),await o?.onError?.(e))},async onRequest(e){let t=s.get();s.set({isPending:null===t.data,data:t.data,error:null,isRefetching:!0,refetch:s.value.refetch}),await o?.onRequest?.(e)}}).catch(e=>{s.set({error:e,data:null,isPending:!1,isRefetching:!1,refetch:s.value.refetch})}).finally(()=>{i(void 0)})});e=Array.isArray(e)?e:[e];let o=!1;for(let t of e)t.subscribe(async()=>{eu()||(o?await i():U(s,()=>{let e=setTimeout(async()=>{o||(await i(),o=!0)},0);return()=>{s.off(),t.off(),clearTimeout(e)}}))});return s})(r=I(!1),"/get-session",v,{method:"GET"}),U(s,()=>{let t=function(e){let{sessionAtom:t,sessionSignal:n,$fetch:r,options:s={}}=e,i=s.sessionOptions?.refetchInterval??0,o=s.sessionOptions?.refetchOnWindowFocus??!0,l=s.sessionOptions?.refetchWhenOffline??!1,a={lastSync:0,lastSessionRequest:0,cachedSession:void 0},u=e=>{if(!(l||ea().isOnline))return;if(e?.event==="storage"){a.lastSync=ec(),n.set(!n.get());return}let s=t.get();if(e?.event==="poll"){a.lastSessionRequest=ec(),r("/get-session").then(e=>{t.set({...s,data:e.data,error:e.error||null}),a.lastSync=ec(),n.set(!n.get())}).catch(()=>{});return}e?.event==="visibilitychange"&&ec()-a.lastSessionRequest<5&&s?.data!==null&&s?.data!==void 0||(s?.data===null||s?.data===void 0||e?.event==="visibilitychange")&&(e?.event==="visibilitychange"&&(a.lastSessionRequest=ec()),a.lastSync=ec(),n.set(!n.get()))};return{init:()=>{i&&i>0&&(a.pollInterval=setInterval(()=>{t.get()?.data&&u({event:"poll"})},1e3*i)),a.unsubscribeBroadcast=en().subscribe(()=>{u({event:"storage"})}),o&&(a.unsubscribeFocus=ei().subscribe(()=>{u({event:"visibilitychange"})})),a.unsubscribeOnline=ea().subscribe(e=>{e&&u({event:"visibilitychange"})}),en().setup(),ei().setup(),ea().setup()},cleanup:()=>{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.lastSync=0,a.lastSessionRequest=0,a.cachedSession=void 0},triggerRefetch:u,broadcastSessionUpdate:e=>{en().post({event:"session",data:{trigger:e},clientId:Math.random().toString(36).substring(7)})}}}({sessionAtom:s,sessionSignal:r,$fetch:v,options:e});return t.init(),()=>{t.cleanup()}}),{session:s,$sessionSignal:r}),y=e?.plugins||[],b={},_={$sessionSignal:m,session:g},A={"/sign-out":"POST","/revoke-sessions":"POST","/revoke-other-sessions":"POST","/delete-user":"POST"},L=[{signal:"$sessionSignal",matcher:e=>"/sign-out"===e||"/update-user"===e||"/sign-up/email"===e||"/sign-in/email"===e||"/delete-user"===e||"/verify-email"===e||"/revoke-sessions"===e||"/revoke-session"===e||"/change-email"===e}];for(let e of y)e.getAtoms&&Object.assign(_,e.getAtoms?.(v)),e.pathMethods&&Object.assign(A,e.pathMethods),e.atomListeners&&L.push(...e.atomListeners);let P={notify:e=>{_[e].set(!_[e].get())},listen:(e,t)=>{_[e].subscribe(t)},atoms:_};for(let t of y)t.getActions&&Object.assign(b,t.getActions?.(v,P,e));return{get baseURL(){return o},pluginsActions:b,pluginsAtoms:_,pluginPathMethods:A,atomListeners:L,$fetch:v,$store:P}})(e),c={};for(let[e,t]of Object.entries(i)){c[`use${(n=e).charAt(0).toUpperCase()+n.slice(1)}`]=()=>(function(e,t={}){let n=(0,ey.useRef)(e.get()),{keys:r,deps:s=[e,r]}=t,i=(0,ey.useCallback)(t=>{let s=e=>{n.current!==e&&(n.current=e,t())};if(s(e.value),r?.length){let t;return t=new Set(r).add(void 0),e.listen((e,n,r)=>{t.has(r)&&s(e,n,r)})}return e.listen(s)},s),o=()=>n.current;
1return(0,ey.useSyncExternalStore)(i,o,o)})(t)}return t={...s,...c,$fetch:o,$store:a},function e(n=[]){return new Proxy(function(){},{get(r,s){var i;if("string"!=typeof s||"then"===s||"catch"===s||"finally"===s)return;let o=[...n,s],l=t;for(let e of o)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(o)},apply:async(e,t,s)=>{let l="/"+n.map(e=>e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)).join("/"),a=s[0]||{},c=s[1]||{},{query:d,fetchOptions:f,...p}=a,h={...c,...f},v=function(e,t,n){let r=t[e],{fetchOptions:s,query:i,...o}=n||{};return r||(s?.method?s.method:o&&Object.keys(o).length>0?"POST":"GET")}(l,r,a);return await o(l,{...h,body:"GET"===v?void 0:{...p,...h?.body||{}},query:d||h?.query,method:v,async onSuccess(e){if(await h?.onSuccess?.(e),!u||h.disableSignal)return;let t=u.filter(e=>e.matcher(l));if(t.length)for(let e of t){let t=i[e.signal];if(!t)return;let n=t.get();setTimeout(()=>{t.set(!n)},10)}}})}})}()}({baseURL:eb(),plugins:[(r={admin:eh,user:ev,...void 0},{id:"admin-client",$InferServerPlugin:{},getActions:()=>({admin:{checkRolePermission:e=>(e=>{if(e.userId&&e.options?.adminUserIds?.includes(e.userId))return!0;if(!e.permissions&&!e.permission)return!1;let t=(e.role||e.options?.defaultRole||"user").split(","),n=e.options?.roles||em;for(let r of t)if(n[r]?.authorize(e.permission??e.permissions)?.success)return!0;return!1})({role:e.role,options:{ac:void 0,roles:r},permissions:e.permissions??e.permission})}}),pathMethods:{"/admin/list-users":"GET","/admin/stop-impersonating":"POST"}}),{id:"email-otp",$InferServerPlugin:{},atomListeners:[{matcher:e=>"/email-otp/verify-email"===e||"/sign-in/email-otp"===e,signal:"$sessionSignal"}]},{id:"additional-fields-client",$InferServerPlugin:{}}]});e.s(["authClient",0,eR],578938)}]);
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.