1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="77401d6c-42e4-4127-b4d1-db77d16c0a45",e._sentryDebugIdIdentifier="sentry-dbid-77401d6c-42e4-4127-b4d1-db77d16c0a45")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9231],{3639:(e,t,n)=>{n.d(t,{X:()=>r});let r=e=>({id:"stripe-client",$InferServerPlugin:{},pathMethods:{"/subscription/billing-portal":"POST","/subscription/restore":"POST"}})},6826:(e,t,n)=>{n.d(t,{X:()=>l});var r=n(49087),o=n(92606),i=n(58741);let s=()=>Math.floor(Date.now()/1e3);function l(e){let{sessionAtom:t,sessionSignal:n,$fetch:l,options:a={}}=e,u=a.sessionOptions?.refetchInterval??0,c=a.sessionOptions?.refetchOnWindowFocus??!0,d=a.sessionOptions?.refetchWhenOffline??!1,f={lastSync:0,lastSessionRequest:0,cachedSession:void 0},p=e=>{if(!(d||(0,i.Y)().isOnline))return;if(e?.event==="storage"){f.lastSync=s(),n.set(!n.get());return}let r=t.get();if(e?.event==="poll"){f.lastSessionRequest=s(),l("/get-session").then(e=>{e.error?t.set({...r,data:null,error:e.error}):t.set({...r,data:e.data,error:null}),f.lastSync=s(),n.set(!n.get())}).catch(()=>{});return}if(e?.event==="visibilitychange"){if(s()-f.lastSessionRequest<5)return;f.lastSessionRequest=s()}(r?.data===null||r?.data===void 0||e?.event==="visibilitychange")&&(f.lastSync=s(),n.set(!n.get()))};return{init:()=>{u&&u>0&&(f.pollInterval=setInterval(()=>{t.get()?.data&&p({event:"poll"})},1e3*u)),f.unsubscribeBroadcast=(0,r.i)().subscribe(()=>{p({event:"storage"})}),c&&(f.unsubscribeFocus=(0,o.x)().subscribe(()=>{p({event:"visibilitychange"})})),f.unsubscribeOnline=(0,i.Y)().subscribe(e=>{e&&p({event:"visibilitychange"})}),(0,r.i)().setup(),(0,o.x)().setup(),(0,i.Y)().setup()},cleanup:()=>{f.pollInterval&&(clearInterval(f.pollInterval),f.pollInterval=void 0),f.unsubscribeBroadcast&&(f.unsubscribeBroadcast(),f.unsubscribeBroadcast=void 0),f.unsubscribeFocus&&(f.unsubscribeFocus(),f.unsubscribeFocus=void 0),f.unsubscribeOnline&&(f.unsubscribeOnline(),f.unsubscribeOnline=void 0),f.lastSync=0,f.lastSessionRequest=0,f.cachedSession=void 0},triggerRefetch:p,broadcastSessionUpdate:e=>{(0,r.i)().post({event:"session",data:{trigger:e},clientId:Math.random().toString(36).substring(7)})}}}},8798:(e,t,n)=>{n.d(t,{_K:()=>r._K});var r=n(23528);n(85447),n(29400)},20368:(e,t,n)=>{n.d(t,{a:()=>o});var r=n(56980);function o(e){return{newRole:e=>{var t;return{authorize(e,n="AND"){let o=!1;for(let[i,s]of Object.entries(e)){let e=t[i];if(!e)return{success:!1,error:`You are not allowed to access resource: ${i}`};if(Array.isArray(s))o=s.every(t=>e.includes(t));else if("object"==typeof s)o="OR"===s.connector?s.actions.some(t=>e.includes(t)):s.actions.every(t=>e.includes(t));else throw new r.$("Invalid access control request");if(o&&"OR"===n)return{success:o};if(!o&&"AND"===n)return{success:!1,error:`unauthorized to access resource "${i}"`}}return o?{success:o}:{success:!1,error:"Not authorized"}},statements:t=e}},statements:e}}},22525:(e,t,n)=>{n.d(t,{M:()=>s});var r=n(63922),o=n(12115),i=n(37719);function s(e){var t;let{pluginPathMethods:n,pluginsActions:s,pluginsAtoms:l,$fetch:a,$store:u,atomListeners:c}=(0,r.i)(e),d={};for(let[e,t]of Object.entries(l))d[`use${(0,i.Zr)(e)}`]=()=>(function(e,t={}){let n=(0,o.useRef)(e.get()),{keys:r,deps:i=[e,r]}=t,s=(0,o.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).add(void 0),e.listen((e,n,r)=>{t.has(r)&&o(e,n,r)})}return e.listen(o)},i),l=()=>n.current;return(0,o.useSyncExternalStore)(s,l,l)})(t);return t={...s,...d,$fetch:a,$store:u},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,o)=>{let i="/"+r.map(e=>e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)).join("/"),s=o[0]||{},u=o[1]||{},{query:d,fetchOptions:f,...p}=s,h={...u,...f},v=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")}(i,n,s);return await a(i,{...h,body:"GET"===v?void 0:{...p,...h?.body||{}},query:d||h?.query,method:v,async onSuccess(e){if(await h?.onSuccess?.(e),!c||h.disableSignal)return;let t=c.filter(e=>e.matcher(i));if(!t.length)return;let n=new Set;for(let e of t){let t=l[e.signal];if(!t)return;if(n.has(e.signal))continue;n.add(e.signal);let r=t.get();setTimeout(()=>{t.set(!r)},10)}}})}})}()}}
1,23528:(e,t,n)=>{n.d(t,{_K:()=>s,lh:()=>l});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}void 0!==r&&r.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","")}})},23859:(e,t,n)=>{n.d(t,{Hc:()=>a,KW:()=>o,MH:()=>s,U6:()=>l});var r=n(20368);n(57968);let o={user:["create","list","set-role","ban","impersonate","delete","set-password","get","update"],session:["list","revoke","delete"]},i=(0,r.a)(o),s=i.newRole({user:["create","list","set-role","ban","impersonate","delete","set-password","get","update"],session:["list","revoke","delete"]}),l=i.newRole({user:[],session:[]}),a={admin:s,user:l}},29400:(e,t,n)=>{var r=n(85447);let o={reset:"\x1b[0m",bright:"\x1b[1m",dim:"\x1b[2m",fg:{black:"\x1b[30m",red:"\x1b[31m",green:"\x1b[32m",yellow:"\x1b[33m",blue:"\x1b[34m",magenta:"\x1b[35m",cyan:"\x1b[36m",white:"\x1b[37m"}},i=["debug","info","success","warn","error"],s={info:o.fg.blue,success:o.fg.green,warn:o.fg.yellow,error:o.fg.red,debug:o.fg.magenta};(e=>{let t=(void 0)??"warn",n=e?.disableColors!==void 0?!e.disableColors:1!==(0,r.t)();return{...Object.fromEntries(i.map(r=>[r,(...[l,...a])=>((r,l,a=[])=>{if(!(i.indexOf(r)>=i.indexOf(t)))return;let u=((e,t,n)=>{let r=new Date().toISOString();return n?`${o.dim}${r}${o.reset} ${s[e]}${e.toUpperCase()}${o.reset} ${o.bright}[Better Auth]:${o.reset} ${t}`:`${r} ${e.toUpperCase()} [Better Auth]: ${t}`})(r,l,n);if(!e||"function"!=typeof e.log)return void("error"===r?console.error(u,...a):"warn"===r?console.warn(u,...a):console.log(u,...a));e.log("success"===r?"info":r,l,...a)})(r,l,a)])),get level(){return t}}})()},37719:(e,t,n)=>{function r(e){return e.charAt(0).toUpperCase()+e.slice(1)}n.d(t,{Zr:()=>r}),n(29400),n(8798)},49087:(e,t,n)=>{n.d(t,{i:()=>i});let r=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 i(e="better-auth.message"){return globalThis[r]||(globalThis[r]=new o(e)),globalThis[r]}},56980:(e,t,n)=>{n.d(t,{$:()=>r}),n(37719);var r=class extends Error{constructor(e,t){super(e,t),this.name="BetterAuthError",this.message=e,this.stack=""}}},57968:(e,t,n)=>{n.d(t,{a:()=>r.a});var r=n(20368)},58741:(e,t,n)=>{n.d(t,{Y:()=>i});let r=Symbol.for("better-auth:online-manager");var o=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[r]||(globalThis[r]=new o),globalThis[r]}}
1,63112:(e,t,n)=>{n.d(t,{KW:()=>r.KW});var r=n(23859)},63922:(e,t,n)=>{n.d(t,{i:()=>K});var r=n(8798),o=n(56980);function i(e,t="/api/auth"){try{let t=new URL(e);if("http:"!==t.protocol&&"https:"!==t.protocol)throw new o.$(`Invalid base URL: ${e}. URL must include 'http://' or 'https://'`)}catch(t){if(t instanceof o.$)throw t;throw new o.$(`Invalid base URL: ${e}. Please provide a valid base URL.`,{cause:t})}if(function(e){try{return"/"!==(new URL(e).pathname.replace(/\/+$/,"")||"/")}catch{throw new o.$(`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 s={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{}}}},l={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*:/},a=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,u={true:!0,false:!1,null:null,undefined:void 0,nan:NaN,infinity:1/0,"-infinity":-1/0},c=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/,d=[],f=0,p=0,h=e=>{let t=[],n={get:()=>(n.lc||n.listen(()=>{})(),n.value),init:e,lc:0,listen:e=>(n.lc=t.push(e),()=>{for(let t=f+4;t<d.length;)d[t]===e?d.splice(t,4):t+=4;let r=t.indexOf(e);~r&&(t.splice(r,1),--n.lc||n.off())}),notify(e,r){p++;let o=!d.length;for(let o of t)d.push(o,n.value,e,r);if(o){for(f=0;f<d.length;f+=4)d[f](d[f+1],d[f+2],d[f+3]);d.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},v=(e,t)=>((e,t,n,r)=>(e.events=e.events||{},e.events[15]||(e.events[15]=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);r.splice(o,1),r.length||(delete e.events[n],e.events[n+10](),delete e.events[n+10])}))(e,n=>{let r=t(n);r&&e.events[6].push(r)},5,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}}),y=()=>"undefined"==typeof window;var b=n(6826);function g(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 m(e){return(...t)=>t.reduce((t,n)=>(function e(t,n,r=".",o){if(!g(n))return e(t,{},r,o);let i=Object.assign({},n);for(let n in 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]]:g(s)&&g(i[n])?i[n]=e(s,i[n],(r?`${r}.`:"")+n.toString(),o):i[n]=s))}return i})(t,n,"",e),{})}let w=m();m((e,t,n)=>{if(void 0!==e[t]&&"function"==typeof n)return e[t]=n(e[t]),!0}),m((e,t,n)=>{if(Array.isArray(e[t])&&"function"==typeof n)return e[t]=n(e[t]),!0});var T=Object.defineProperty,R=Object.defineProperties,E=Object.getOwnPropertyDescriptors,O=Object.getOwnPropertySymbols,S=Object.prototype.hasOwnProperty,_=Object.prototype.propertyIsEnumerable,A=(e,t,n)=>t in e?T(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,I=(e,t)=>{for(var n in t||(t={}))S.call(t,n)&&A(e,n,t[n]);if(O)for(var n of O(t))_.call(t,n)&&A(e,n,t[n]);return e},L=(e,t)=>R(e,E(t)),U=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)}},x=async(e,t)=>{var n,r,o,i,s,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==(o=c.hooks)?void 0:o.onResponse),u.onSuccess.push(null==(i=c.hooks)?void 0:i.onSuccess),u.onError.push(null==(s=c.hooks)?void 0:s.onError),u.onRetry.push(null==(l=c.hooks)?void 0:l.onRetry)}return{url:e,options:a,hooks:u}},P=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}},$=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)}},j=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},C=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function N(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 M(e){try{return JSON.parse(e)}catch(t){return e}}function k(e){return"function"==typeof e}async function D(e){let t=new Headers(null==e?void 0:e.headers);for(let[n,r]of Object.entries(await j(e)||{}))t.set(n,r);if(!t.has("content-type")){let n=N(null==e?void 0:e.body)?"application/json":null;n&&t.set("content-type",n)}return t}var B=class e extends Error{constructor(t,n){super(n||JSON.stringify(t,null,2)),this.issues=t,Object.setPrototypeOf(this,e.prototype)}};async function q(e,t){let n=await e["~standard"].validate(t);if(n.issues)throw new B(n.issues);return n.value}var H=["get","post","put","patch","delete"],F=async(e,t)=>{var n,r,o,i,s,l,a,u;let{hooks:c,url:d,options:f}=await x(e,t),p=function(e){if(null==e?void 0:e.customFetchImpl)return e.customFetchImpl;if("undefined"!=typeof globalThis&&k(globalThis.fetch))return globalThis.fetch;if("undefined"!=typeof window&&k(window.fetch))return window.fetch;throw Error("No fetch implementation found")}(f),h=new AbortController,v=null!=(n=f.signal)?n:h.signal,y=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||"";if(e.startsWith("@")){let t=e.toString().split("@")[1].split("/")[0];H.includes(t)&&(e=e.replace(`@${t}/`,"/"))}i.endsWith("/")||(i+="/");let[s,l]=e.replace(i,"").split("?"),a=new URLSearchParams(l);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)a.append(e,n);continue}else n=JSON.stringify(t);a.set(e,n)}}if(r)if(Array.isArray(r))for(let[e,t]of s.split("/").filter(e=>e.startsWith(":")).entries()){let n=r[e];s=s.replace(t,n)}else for(let[e,t]of Object.entries(r))s=s.replace(`:${e}`,String(t));(s=s.split("/").map(encodeURIComponent).join("/")).startsWith("/")&&(s=s.slice(1));let u=a.toString();return(u=u.length>0?`?${u}`.replace(/\+/g,"%20"):"",i.startsWith("http"))?new URL(`${s}${u}`,i):`${i}${s}${u}`}(d,f),b=function(e){if(!(null==e?void 0:e.body))return null;let t=new Headers(null==e?void 0:e.headers);if(N(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 t.has("content-type")&&"application/x-www-form-urlencoded"===t.get("content-type")&&N(e.body)?new URLSearchParams(e.body).toString():e.body}(f),g=await D(f),m=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 H.includes(r)?r.toUpperCase():(null==t?void 0:t.body)?"POST":"GET"}return(null==t?void 0:t.body)?"POST":"GET"}(d,f),w=L(I({},f),{url:y,headers:g,body:b,method:m,signal:v});for(let e of c.onRequest)if(e){let t=await e(w);"object"==typeof t&&null!==t&&(w=t)}("pipeTo"in w&&"function"==typeof w.pipeTo||"function"==typeof(null==(r=null==t?void 0:t.body)?void 0:r.pipe))&&!("duplex"in w)&&(w.duplex="half");let{clearTimeout:T}=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)}}}(f,h),R=await p(w.url,w);T();let E={response:R,request:w};for(let e of c.onResponse)if(e){let n=await e(L(I({},E),{response:(null==(o=null==t?void 0:t.hookOptions)?void 0:o.cloneResponse)?R.clone():R}));n instanceof Response?R=n:"object"==typeof n&&null!==n&&(R=n.response)}if(R.ok){if("HEAD"===w.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 C.test(r)?"json":n.has(r)||r.startsWith("text/")?"text":"blob"}(R),n={data:null,response:R,request:w};if("json"===e||"text"===e){let e=await R.text(),t=null!=(i=w.jsonParser)?i:M;n.data=await t(e)}else n.data=await R[e]();for(let e of((null==w?void 0:w.output)&&w.output&&!w.disableValidation&&(n.data=await q(w.output,n.data)),c.onSuccess))e&&await e(L(I({},n),{response:(null==(s=null==t?void 0:t.hookOptions)?void 0:s.cloneResponse)?R.clone():R}));return(null==t?void 0:t.throw)?n.data:{data:n.data,error:null}}let O=null!=(l=null==t?void 0:t.jsonParser)?l:M,S=await R.text(),_=function(e){try{return JSON.parse(e),!0}catch(e){return!1}}(S),A=_?await O(S):null,j={response:R,responseText:S,request:w,error:L(I({},A),{status:R.status,statusText:R.statusText})};for(let e of c.onError)e&&await e(L(I({},j),{response:(null==(a=null==t?void 0:t.hookOptions)?void 0:a.cloneResponse)?R.clone():R}));if(null==t?void 0:t.retry){let n=function(e){if("number"==typeof e)return new P({type:"linear",attempts:e,delay:1e3});switch(e.type){case"linear":return new P(e);case"exponential":return new $(e);default:throw Error("Invalid retry strategy")}}(t.retry),r=null!=(u=t.retryAttempt)?u:0;
1if(await n.shouldAttemptRetry(r,R)){for(let e of c.onRetry)e&&await e(E);let o=n.getDelay(r);return await new Promise(e=>setTimeout(e,o)),await F(e,L(I({},t),{retryAttempt:r+1}))}}if(null==t?void 0:t.throw)throw new U(R.status,R.statusText,_?A:S);return{data:null,error:L(I({},A),{status:R.status,statusText:R.statusText})}};let K=(e,t)=>{let n="credentials"in Request.prototype,d=function(e,t,n,s,l){if(e)return i(e,t);if(!1!==s){let e=r._K.BETTER_AUTH_URL||r._K.NEXT_PUBLIC_BETTER_AUTH_URL||r._K.PUBLIC_BETTER_AUTH_URL||r._K.NUXT_PUBLIC_BETTER_AUTH_URL||r._K.NUXT_PUBLIC_AUTH_URL||("/"!==r._K.BASE_URL?r._K.BASE_URL:void 0);if(e)return i(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 o.$("Could not get origin from request. Please provide a valid base URL.");return i(e,t)}if("undefined"!=typeof window&&window.location)return i(window.location.origin,t)}(e?.baseURL,e?.basePath,void 0,t)??"/api/auth",f=e?.plugins?.flatMap(e=>e.fetchPlugins).filter(e=>void 0!==e)||[],p={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:m,onRequest:T,onResponse:R,...E}=e?.fetchOptions||{},O=(e=>async function(t,n){let r,o=L(I(I({},e),n),{plugins:[...(null==e?void 0:e.plugins)||[],(r=e||{},{id:"apply-schema",name:"Apply Schema",version:"1.0.0",async init(e,t){var n,o,i,s;let l=(null==(o=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||""))}))?void 0:o.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==(s=l.config)?void 0:s.baseURL)&&n.startsWith(l.config.baseURL)&&(n=n.replace(l.config.baseURL,""));let r=l.schema[n];if(r){let n=L(I({},t),{method:r.method,output:r.output});return(null==t?void 0:t.disableValidation)||(n=L(I({},n),{body:r.input?await q(r.input,null==t?void 0:t.body):null==t?void 0:t.body,params:r.params?await q(r.params,null==t?void 0:t.params):null==t?void 0:t.params,query:r.query?await q(r.query,null==t?void 0:t.query):null==t?void 0:t.query})),{url:e,options:n}}}return{url:e,options:t}}}),...(null==n?void 0:n.plugins)||[]]});if(null==e?void 0:e.catchAllError)try{return await F(t,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 F(t,o)})({baseURL:d,...n?{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();if(s.length>0&&'"'===s[0]&&s.endsWith('"')&&!s.slice(1,-1).includes('"'))return s.slice(1,-1);let d=s.toLowerCase();if(d.length<=9&&d in u)return u[d];if(!a.test(s)){if(n)throw SyntaxError("[better-json] Invalid JSON");return e}if(Object.entries(l).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=c.exec(e);if(!t)return null;let[,n,r,o,i,s,l,a,u,d,f]=t,p=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(d,10)+parseInt(f,10))*("+"===u?-1:1);p.setUTCMinutes(p.getUTCMinutes()+e)}
1return p instanceof Date&&!isNaN(p.getTime())?p: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,...E,plugins:[p,...E.plugins||[],...e?.disableDefaultFetchPlugins?[]:[s],...f]}),{$sessionSignal:S,session:_}=function(e,t){let n=h(!1),r=((e,t,n,r)=>{let o=h({data:null,error:null,isPending:!0,isRefetching:!1,refetch:e=>i(e)}),i=async e=>new Promise(i=>{let s="function"==typeof r?r({data:o.get().data,error:o.get().error,isPending:o.get().isPending}):r;n(t,{...s,query:{...s?.query,...e?.query},async onSuccess(e){o.set({data:e.data,error:null,isPending:!1,isRefetching:!1,refetch:o.value.refetch}),await s?.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||(o.set({error:e.error,data:null,isPending:!1,isRefetching:!1,refetch:o.value.refetch}),await s?.onError?.(e))},async onRequest(e){let t=o.get();o.set({isPending:null===t.data,data:t.data,error:null,isRefetching:!0,refetch:o.value.refetch}),await s?.onRequest?.(e)}}).catch(e=>{o.set({error:e,data:null,isPending:!1,isRefetching:!1,refetch:o.value.refetch})}).finally(()=>{i(void 0)})});e=Array.isArray(e)?e:[e];let s=!1;for(let t of e)t.subscribe(async()=>{y()||(s?await i():v(o,()=>{let e=setTimeout(async()=>{s||(await i(),s=!0)},0);return()=>{o.off(),t.off(),clearTimeout(e)}}))});return o})(n,"/get-session",e,{method:"GET"});return v(r,()=>{let o=(0,b.X)({sessionAtom:r,sessionSignal:n,$fetch:e,options:t});return o.init(),()=>{o.cleanup()}}),{session:r,$sessionSignal:n}}(O,e),A=e?.plugins||[],U={},x={$sessionSignal:S,session:_},P={"/sign-out":"POST","/revoke-sessions":"POST","/revoke-other-sessions":"POST","/delete-user":"POST"},$=[{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 A)e.getAtoms&&Object.assign(x,e.getAtoms?.(O)),e.pathMethods&&Object.assign(P,e.pathMethods),e.atomListeners&&$.push(...e.atomListeners);let j={notify:e=>{x[e].set(!x[e].get())},listen:(e,t)=>{x[e].subscribe(t)},atoms:x};for(let t of A)t.getActions&&(U=w(t.getActions?.(O,j,e)??{},U));return{get baseURL(){return d},pluginsActions:U,pluginsAtoms:x,pluginPathMethods:P,atomListeners:$,$fetch:O,$store:j}}},85447:(e,t,n)=>{n.d(t,{t:()=>l});var r=n(23528);let o={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},i=new Map(Object.entries({APPVEYOR:8,BUILDKITE:8,CIRCLECI:24,DRONE:8,GITEA_ACTIONS:24,GITHUB_ACTIONS:24,GITLAB_CI:8,TRAVIS:8})),s=[/ansi/,/color/,/linux/,/direct/,/^con[0-9]*x[0-9]/,/^rxvt/,/^screen/,/^xterm/,/^vt100/,/^vt220/];function l(){if(void 0!==(0,r.lh)("FORCE_COLOR"))switch((0,r.lh)("FORCE_COLOR")){case"":case"1":case"true":return 4;case"2":return 8;case"3":return 24;default:return 1}if(void 0!==(0,r.lh)("NODE_DISABLE_COLORS")&&""!==(0,r.lh)("NODE_DISABLE_COLORS")||void 0!==(0,r.lh)("NO_COLOR")&&""!==(0,r.lh)("NO_COLOR")||"dumb"===(0,r.lh)("TERM"))return 1;if((0,r.lh)("TMUX"))return 24;if("TF_BUILD"in r._K&&"AGENT_NAME"in r._K)return 4;if("CI"in r._K){for(let{0:e,1:t}of i)if(e in r._K)return t;return"codeship"===(0,r.lh)("CI_NAME")?8:1}if("TEAMCITY_VERSION"in r._K)return null!==/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.exec((0,r.lh)("TEAMCITY_VERSION"))?4:1;switch((0,r.lh)("TERM_PROGRAM")){case"iTerm.app":if(!(0,r.lh)("TERM_PROGRAM_VERSION")||null!==/^[0-2]\./.exec((0,r.lh)("TERM_PROGRAM_VERSION")))return 8;return 24;case"HyperTerm":case"MacTerm":return 24;case"Apple_Terminal":return 8}if("truecolor"===(0,r.lh)("COLORTERM")||"24bit"===(0,r.lh)("COLORTERM"))return 24;if((0,r.lh)("TERM")){if(null!==/truecolor/.exec((0,r.lh)("TERM")))return 24;if(null!==/^xterm-256/.exec((0,r.lh)("TERM")))return 8;let e=(0,r.lh)("TERM").toLowerCase();if(o[e])return o[e];if(s.some(t=>null!==t.exec(e)))return 4}return(0,r.lh)("COLORTERM")?4:1}},92606:(e,t,n)=>{n.d(t,{x:()=>i});let r=Symbol.for("better-auth:focus-manager");var o=class{listeners=new Set;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}
1setFocused(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 i(){return globalThis[r]||(globalThis[r]=new o),globalThis[r]}},98833:(e,t,n)=>{n.d(t,{px:()=>i,Zn:()=>r,tT:()=>s});let r=e=>({id:"additional-fields-client",$InferServerPlugin:{}});var o=n(23859);n(63112);let i=e=>{let t={admin:o.MH,user:o.U6,...e?.roles};return{id:"admin-client",$InferServerPlugin:{},getActions:()=>({admin:{checkRolePermission:n=>(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||o.Hc;for(let r of t)if(n[r]?.authorize(e.permission??e.permissions)?.success)return!0;return!1})({role:n.role,options:{ac:e?.ac,roles:t},permissions:n.permissions??n.permission})}}),pathMethods:{"/admin/list-users":"GET","/admin/stop-impersonating":"POST"}}},s=()=>({id:"magic-link",$InferServerPlugin:{}});n(49087),n(92606),n(58741),n(6826),n(63922),n(37719);var l=n(20368);n(57968);let a=(0,l.a)({organization:["update","delete"],member:["create","update","delete"],invitation:["create","cancel"],team:["create","update","delete"],ac:["create","read","update","delete"]});a.newRole({organization:["update"],invitation:["create","cancel"],member:["create","update","delete"],team:["create","update","delete"],ac:["create","read","update","delete"]}),a.newRole({organization:["update","delete"],member:["create","update","delete"],invitation:["create","cancel"],team:["create","update","delete"],ac:["create","read","update","delete"]}),a.newRole({organization:[],member:[],invitation:[],team:[],ac:["read"]})}}]);
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.