1import{r as Q,j as T}from"./chunk-OIYGIGL5-gwPc8tBz.js";import{D as Le,i as Ie}from"./tooltip-BIt4K4VP.js";import{$ as we,c as D}from"./cx-JWMrrZN5.js";import{c as Ue,d as Ce,e as Me,f as le,g as De}from"./Dialog-Cbo2mfOd.js";var $e={},fe={};const z=Object.create(null),q=e=>$e||globalThis.Deno?.env.toObject()||globalThis.__env__||(e?z:globalThis),E=new Proxy(z,{get(e,t){return q()[t]??z[t]},has(e,t){return t in q()||t in z},set(e,t,n){const r=q(!0);return r[t]=n,!0},deleteProperty(e,t){if(!t)return!1;const n=q(!0);return delete n[t],!0},ownKeys(){const e=q(!0);return Object.keys(e)}});function m(e,t){return typeof process<"u"&&fe?fe[e]??t:typeof Deno<"u"?Deno.env.get(e)??t:typeof Bun<"u"?Bun.env[e]??t:t}const F=1,y=4,A=8,_=24,de={eterm:y,cons25:y,console:y,cygwin:y,dtterm:y,gnome:y,hurd:y,jfbterm:y,konsole:y,kterm:y,mlterm:y,mosh:_,putty:y,st:y,"rxvt-unicode-24bit":_,terminator:_,"xterm-kitty":_},je=new Map(Object.entries({APPVEYOR:A,BUILDKITE:A,CIRCLECI:_,DRONE:A,GITEA_ACTIONS:_,GITHUB_ACTIONS:_,GITLAB_CI:A,TRAVIS:A})),Be=[/ansi/,/color/,/linux/,/direct/,/^con[0-9]*x[0-9]/,/^rxvt/,/^screen/,/^xterm/,/^vt100/,/^vt220/];function qe(){if(m("FORCE_COLOR")!==void 0)switch(m("FORCE_COLOR")){case"":case"1":case"true":return y;case"2":return A;case"3":return _;default:return F}if(m("NODE_DISABLE_COLORS")!==void 0&&m("NODE_DISABLE_COLORS")!==""||m("NO_COLOR")!==void 0&&m("NO_COLOR")!==""||m("TERM")==="dumb")return F;if(m("TMUX"))return _;if("TF_BUILD"in E&&"AGENT_NAME"in E)return y;if("CI"in E){for(const{0:e,1:t}of je)if(e in E)return t;return m("CI_NAME")==="codeship"?A:F}if("TEAMCITY_VERSION"in E)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.exec(m("TEAMCITY_VERSION"))!==null?y:F;switch(m("TERM_PROGRAM")){case"iTerm.app":return!m("TERM_PROGRAM_VERSION")||/^[0-2]\./.exec(m("TERM_PROGRAM_VERSION"))!==null?A:_;case"HyperTerm":case"MacTerm":return _;case"Apple_Terminal":return A}if(m("COLORTERM")==="truecolor"||m("COLORTERM")==="24bit")return _;if(m("TERM")){if(/truecolor/.exec(m("TERM"))!==null)return _;if(/^xterm-256/.exec(m("TERM"))!==null)return A;const e=m("TERM").toLowerCase();if(de[e])return de[e];if(Be.some(t=>t.exec(e)!==null))return y}return m("COLORTERM")?y:F}const L={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",fg:{red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m"}},oe=["debug","info","success","warn","error"];function Fe(e,t){return oe.indexOf(t)>=oe.indexOf(e)}const ke={info:L.fg.blue,success:L.fg.green,warn:L.fg.yellow,error:L.fg.red,debug:L.fg.magenta},Ve=(e,t,n)=>{const r=new Date().toISOString();return n?`${L.dim}${r}${L.reset} ${ke[e]}${e.toUpperCase()}${L.reset} ${L.bright}[Better Auth]:${L.reset} ${t}`:`${r} ${e.toUpperCase()} [Better Auth]: ${t}`},He=e=>{const t="warn",n=qe()!==1,r=(s,i,o=[])=>{if(!Fe(t,s))return;const f=Ve(s,i,n);{s==="error"?console.error(f,...o):s==="warn"?console.warn(f,...o):console.log(f,...o);return}};return{...Object.fromEntries(oe.map(s=>[s,(...[i,...o])=>r(s,i,o)])),get level(){return t}}};He();function Ge(e){return e.charAt(0).toUpperCase()+e.slice(1)}var k=class extends Error{constructor(e,t){super(e,t),this.name="BetterAuthError",this.message=e,this.stack=""}};function We(e){return{authorize(t,n="AND"){let r=!1;for(const[s,i]of Object.entries(t)){const o=e[s];if(!o)return{success:!1,error:`You are not allowed to access resource: ${s}`};if(Array.isArray(i))r=i.every(f=>o.includes(f));else if(typeof i=="object"){const f=i;f.connector==="OR"?r=f.actions.some(a=>o.includes(a)):r=f.actions.every(a=>o.includes(a))}else throw new k("Invalid access control request");if(r&&n==="OR")return{success:r};if(!r&&n==="AND")return{success:!1,error:`unauthorized to access resource "${s}"`}}return r?{success:r}:{success:!1,error:"Not authorized"}},statements:e}}function Je(e){return{newRole(t){return We(t)},statements:e}}const ze={user:["create","list","set-role","ban","impersonate","delete","set-password","get","update"],session:["list","revoke","delete"]},Re=Je(ze),Oe=Re.newRole({user:["create","list","set-role","ban","impersonate","delete","set-password","get","update"],session:["list","revoke","delete"]}),_e=Re.newRole({user:[],session:[]}),Ye={admin:Oe,user:_e},Xe=e=>
1{if(e.userId&&e.options?.adminUserIds?.includes(e.userId))return!0;if(!e.permissions&&!e.permission)return!1;const t=(e.role||e.options?.defaultRole||"user").split(","),n=e.options?.roles||Ye;for(const r of t)if(n[r]?.authorize(e.permission??e.permissions)?.success)return!0;return!1},Qe=e=>{const t={admin:Oe,user:_e,...e?.roles};return{id:"admin-client",$InferServerPlugin:{},getActions:()=>({admin:{checkRolePermission:n=>Xe({role:n.role,options:{ac:e?.ac,roles:t},permissions:n.permissions??n.permission})}}),pathMethods:{"/admin/list-users":"GET","/admin/stop-impersonating":"POST"}}};let x=[],j=0;const G=4,Se=e=>{let t=[],n={get(){return n.lc||n.listen(()=>{})(),n.value},lc:0,listen(r){return n.lc=t.push(r),()=>{for(let i=j+G;i<x.length;)x[i]===r?x.splice(i,G):i+=G;let s=t.indexOf(r);~s&&(t.splice(s,1),--n.lc||n.off())}},notify(r,s){let i=!x.length;for(let o of t)x.push(o,n.value,r,s);if(i){for(j=0;j<x.length;j+=G)x[j](x[j+1],x[j+2],x[j+3]);x.length=0}},off(){},set(r){let s=n.value;s!==r&&(n.value=r,n.notify(s))},subscribe(r){let s=n.listen(r);return r(n.value),s},value:e};return n},Ze=5,W=6,J=10;let Ke=(e,t,n,r)=>(e.events=e.events||{},e.events[n+J]||(e.events[n+J]=r(s=>{e.events[n].reduceRight((i,o)=>(o(i),i),{shared:{},...s})})),e.events[n]=e.events[n]||[],e.events[n].push(t),()=>{let s=e.events[n],i=s.indexOf(t);s.splice(i,1),s.length||(delete e.events[n],e.events[n+J](),delete e.events[n+J])}),et=1e3,Ee=(e,t)=>Ke(e,r=>{let s=t(r);s&&e.events[W].push(s)},Ze,r=>{let s=e.listen;e.listen=(...o)=>(!e.lc&&!e.active&&(e.active=!0,r()),s(...o));let i=e.off;return e.events[W]=[],e.off=()=>{i(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let o of e.events[W])o();e.events[W]=[]}},et)},()=>{e.listen=s,e.off=i}});function tt(e,t,n){let r=new Set(t).add(void 0);return e.listen((s,i,o)=>{r.has(o)&&n(s,i,o)})}const nt=()=>typeof window>"u",rt=(e,t,n,r)=>{const s=Se({data:null,error:null,isPending:!0,isRefetching:!1,refetch:f=>i(f)}),i=async f=>new Promise(a=>{const u=typeof r=="function"?r({data:s.get().data,error:s.get().error,isPending:s.get().isPending}):r;n(t,{...u,query:{...u?.query,...f?.query},async onSuccess(c){s.set({data:c.data,error:null,isPending:!1,isRefetching:!1,refetch:s.value.refetch}),await u?.onSuccess?.(c)},async onError(c){const{request:d}=c,h=typeof d.retry=="number"?d.retry:d.retry?.attempts,g=d.retryAttempt||0;h&&g<h||(s.set({error:c.error,data:null,isPending:!1,isRefetching:!1,refetch:s.value.refetch}),await u?.onError?.(c))},async onRequest(c){const d=s.get();s.set({isPending:d.data===null,data:d.data,error:null,isRefetching:!0,refetch:s.value.refetch}),await u?.onRequest?.(c)}}).catch(c=>{s.set({error:c,data:null,isPending:!1,isRefetching:!1,refetch:s.value.refetch})}).finally(()=>{a(void 0)})});e=Array.isArray(e)?e:[e];let o=!1;for(const f of e)f.subscribe(async()=>{nt()||(o?await i():Ee(s,()=>{const a=setTimeout(async()=>{o||(await i(),o=!0)},0);return()=>{s.off(),f.off(),clearTimeout(a)}}))});return s},Z=Symbol.for("better-auth:broadcast-channel"),st=()=>Math.floor(Date.now()/1e3);var ot=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(!(typeof window>"u"))try{localStorage.setItem(this.name,JSON.stringify({...e,timestamp:st()}))}catch{}}setup(){if(typeof window>"u"||typeof window.addEventListener>"u")return()=>{};const e=t=>{if(t.key!==this.name)return;const n=JSON.parse(t.newValue??"{}");n?.event!=="session"||!n?.data||this.listeners.forEach(r=>r(n))};return window.addEventListener("storage",e),()=>{window.removeEventListener("storage",e)}}};function K(e="better-auth.message"){return globalThis[Z]||(globalThis[Z]=new ot(e)),globalThis[Z]}const ee=Symbol.for("better-auth:focus-manager");var it=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(typeof window>"u"||typeof document>"u"||typeof window.addEventListener>"u")return()=>{};const e=()=>{document.visibilityState==="visible"&&this.setFocused(!0)};return document.addEventListener("visibilitychange",e,!1),()=>{document.removeEventListener("visibilitychange",e,!1)}}};function he(){return globalThis[ee]||(globalThis[ee]=new it),globalThis[ee]}const te=Symbol.for("better-auth:online-manager");var at=class{listeners=new Set;isOnline=typeof navigator<"u"?navigator.onLine:!0;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}
1setOnline(e){this.isOnline=e,this.listeners.forEach(t=>t(e))}setup(){if(typeof window>"u"||typeof window.addEventListener>"u")return()=>{};const 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 ne(){return globalThis[te]||(globalThis[te]=new at),globalThis[te]}const B=()=>Math.floor(Date.now()/1e3),ct=5;function ut(e){const{sessionAtom:t,sessionSignal:n,$fetch:r,options:s={}}=e,i=s.sessionOptions?.refetchInterval??0,o=s.sessionOptions?.refetchOnWindowFocus??!0,f=s.sessionOptions?.refetchWhenOffline??!1,a={lastSync:0,lastSessionRequest:0,cachedSession:void 0},u=()=>f||ne().isOnline,c=b=>{if(!u())return;if(b?.event==="storage"){a.lastSync=B(),n.set(!n.get());return}const R=t.get();if(b?.event==="poll"){a.lastSessionRequest=B(),r("/get-session").then(l=>{l.error?t.set({...R,data:null,error:l.error}):t.set({...R,data:l.data,error:null}),a.lastSync=B(),n.set(!n.get())}).catch(()=>{});return}if(b?.event==="visibilitychange"){if(B()-a.lastSessionRequest<ct)return;a.lastSessionRequest=B()}(R?.data===null||R?.data===void 0||b?.event==="visibilitychange")&&(a.lastSync=B(),n.set(!n.get()))},d=b=>{K().post({event:"session",data:{trigger:b},clientId:Math.random().toString(36).substring(7)})},h=()=>{i&&i>0&&(a.pollInterval=setInterval(()=>{t.get()?.data&&c({event:"poll"})},i*1e3))},g=()=>{a.unsubscribeBroadcast=K().subscribe(()=>{c({event:"storage"})})},O=()=>{o&&(a.unsubscribeFocus=he().subscribe(()=>{c({event:"visibilitychange"})}))},I=()=>{a.unsubscribeOnline=ne().subscribe(b=>{b&&c({event:"visibilitychange"})})};return{init:()=>{h(),g(),O(),I(),K().setup(),he().setup(),ne().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:c,broadcastSessionUpdate:d}}function lt(e){try{return(new URL(e).pathname.replace(/\/+$/,"")||"/")!=="/"}catch{throw new k(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}function ft(e){try{const t=new URL(e);if(t.protocol!=="http:"&&t.protocol!=="https:")throw new k(`Invalid base URL: ${e}. URL must include 'http://' or 'https://'`)}catch(t){throw t instanceof k?t:new k(`Invalid base URL: ${e}. Please provide a valid base URL.`,{cause:t})}}function re(e,t="/api/auth"){if(ft(e),lt(e))return e;const n=e.replace(/\/+$/,"");return!t||t==="/"?n:(t=t.startsWith("/")?t:`/${t}`,`${n}${t}`)}function dt(e,t,n,r,s){if(e)return re(e,t);{const i=E.BETTER_AUTH_URL||E.NEXT_PUBLIC_BETTER_AUTH_URL||E.PUBLIC_BETTER_AUTH_URL||E.NUXT_PUBLIC_BETTER_AUTH_URL||E.NUXT_PUBLIC_AUTH_URL||(E.BASE_URL!=="/"?E.BASE_URL:void 0);if(i)return re(i,t)}if(typeof window<"u"&&window.location)return re(window.location.origin,t)}const ht={id:"redirect",name:"Redirect",hooks:{onSuccess(e){if(e.data?.url&&e.data?.redirect&&typeof window<"u"&&window.location&&window.location)try{window.location.href=e.data.url}catch{}}}},pt={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*:/},mt=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,pe={true:!0,false:!1,null:null,undefined:void 0,nan:NaN,infinity:Number.POSITIVE_INFINITY,"-infinity":Number.NEGATIVE_INFINITY},yt=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;function gt(e){return e instanceof Date&&!isNaN(e.getTime())}function bt(e){const t=yt.exec(e);if(!t)return null;const[,n,r,s,i,o,f,a,u,c,d]=t,h=new Date(Date.UTC(parseInt(n,10),parseInt(r,10)-1,parseInt(s,10),parseInt(i,10),parseInt(o,10),parseInt(f,10),a?parseInt(a.padEnd(3,"0"),10):0));if(u){const g=(parseInt(c,10)*60+parseInt(d,10))*(u==="+"?-1:1);h.setUTCMinutes(h.getUTCMinutes()+g)}return gt(h)?h:null}function vt(e,t={}){const{strict:n=!1,warnings:r=!1,reviver:s,parseDates:i=!0}=t;if(typeof e!="string")return e;const o=e.trim();if(o.length>0&&o[0]==='"'&&o.endsWith('"')&&!o.slice(1,-1).includes('"'))return o.slice(1,-1);const f=o.toLowerCase();if(f.length<=9&&f in pe)return pe[f];if(!mt.test(o)){if(n)throw new SyntaxError("[better-json] Invalid JSON");return e}if(Object.entries(pt).some(([a,u])=>{const c=u.test(o);return c&&r&&console.warn(`[better-json] Detected potential prototype pollution attempt using ${a} pattern`),c})&&n)throw new Error("[better-json] Potential prototype pollution attempt detected");try{return JSON.parse(o,(u,c)=>{if(u==="__proto__"||u==="constructor"&&c&&typeof c=="object"&&"prototype"in c){r&&console.warn(`[better-json] Dropping "${u}" key to prevent prototype pollution`);return}if(i&&typeof c=="string"){const d=bt(c);if(d)return d}return s?s(u,c):c})}catch(a){if(n)throw a;return e}}function wt(e,t={strict:!0}){return vt(e,t)}function Rt(e,t){const n=Se(!1),r=rt(n,"/get-session",e,{method:"GET"});return Ee(r,()=>{const s=ut({sessionAtom:r,sessionSignal:n,$fetch:e,options:t});return s.init(),()=>{s.cleanup()}}),{session:r,$sessionSignal:n}}function se(e){if(e===null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null||Symbol.iterator in e?!1:Symbol.toStringTag in e?Object.prototype.toString.call(e)==="[object Module]":!0}function ie(e,t,n=".",r){if(!se(t))return ie(e,{},n,r);const s=Object.assign({},t);for(const i in e){if(i==="__proto__"||i==="constructor")continue;const o=e[i];o!=null&&(r&&r(s,i,o,n)||(Array.isArray(o)&&Array.isArray(s[i])?s[i]=[...o,...s[i]]:se(o)&&se(s[i])?s[i]=ie(o,s[i],(n?`${n}.`:"")+i.toString(),r):s[i]=o))}return s}function Ot(e){return(...t)=>t.reduce((n,r)=>ie(n,r,"",e),{})}const _t=Ot();var St=Object.defineProperty,Et=Object.defineProperties,Tt=Object.getOwnPropertyDescriptors,me=Object.getOwnPropertySymbols,xt=Object.prototype.hasOwnProperty,Pt=Object.prototype.propertyIsEnumerable,ye=(e,t,n)=>t in e?St(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,P=(e,t)=>{for(var n in t||(t={}))xt.call(t,n)&&ye(e,n,t[n]);if(me)for(var n of me(t))Pt.call(t,n)&&ye(e,n,t[n]);return e},N=(e,t)=>
1Et(e,Tt(t)),Nt=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)}},At=async(e,t)=>{var n,r,s,i,o,f;let a=t||{};const u={onRequest:[t?.onRequest],onResponse:[t?.onResponse],onSuccess:[t?.onSuccess],onError:[t?.onError],onRetry:[t?.onRetry]};if(!t||!t?.plugins)return{url:e,options:a,hooks:u};for(const c of t?.plugins||[]){if(c.init){const d=await((n=c.init)==null?void 0:n.call(c,e.toString(),t));a=d.options||a,e=d.url}u.onRequest.push((r=c.hooks)==null?void 0:r.onRequest),u.onResponse.push((s=c.hooks)==null?void 0:s.onResponse),u.onSuccess.push((i=c.hooks)==null?void 0:i.onSuccess),u.onError.push((o=c.hooks)==null?void 0:o.onError),u.onRetry.push((f=c.hooks)==null?void 0:f.onRetry)}return{url:e,options:a,hooks:u}},ge=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}},Lt=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)}};function It(e){if(typeof e=="number")return new ge({type:"linear",attempts:e,delay:1e3});switch(e.type){case"linear":return new ge(e);case"exponential":return new Lt(e);default:throw new Error("Invalid retry strategy")}}var Ut=async e=>{const t={},n=async r=>typeof r=="function"?await r():r;if(e?.auth){if(e.auth.type==="Bearer"){const r=await n(e.auth.token);if(!r)return t;t.authorization=`Bearer ${r}`}else if(e.auth.type==="Basic"){const[r,s]=await Promise.all([n(e.auth.username),n(e.auth.password)]);if(!r||!s)return t;t.authorization=`Basic ${btoa(`${r}:${s}`)}`}else if(e.auth.type==="Custom"){const[r,s]=await Promise.all([n(e.auth.prefix),n(e.auth.value)]);if(!s)return t;t.authorization=`${r??""} ${s}`}}return t},Ct=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function Mt(e){const t=e.headers.get("content-type"),n=new Set(["image/svg","application/xml","application/xhtml","application/html"]);if(!t)return"json";const r=t.split(";").shift()||"";return Ct.test(r)?"json":n.has(r)||r.startsWith("text/")?"text":"blob"}function Dt(e){try{return JSON.parse(e),!0}catch{return!1}}function ae(e){if(e===void 0)return!1;const t=typeof e;return t==="string"||t==="number"||t==="boolean"||t===null?!0:t!=="object"?!1:Array.isArray(e)?!0:e.buffer?!1:e.constructor&&e.constructor.name==="Object"||typeof e.toJSON=="function"}function be(e){try{return JSON.parse(e)}catch{return e}}function ve(e){return typeof e=="function"}function $t(e){if(e?.customFetchImpl)return e.customFetchImpl;if(typeof globalThis<"u"&&ve(globalThis.fetch))return globalThis.fetch;if(typeof window<"u"&&ve(window.fetch))return window.fetch;throw new Error("No fetch implementation found")}async function jt(e){const t=new Headers(e?.headers),n=await Ut(e);for(const[r,s]of Object.entries(n||{}))t.set(r,s);if(!t.has("content-type")){const r=Bt(e?.body);r&&t.set("content-type",r)}return t}function Bt(e){return ae(e)?"application/json":null}function qt(e){if(!e?.body)return null;const t=new Headers(e?.headers);if(ae(e.body)&&!t.has("content-type")){for(const[n,r]of Object.entries(e?.body))r instanceof Date&&(e.body[n]=r.toISOString());return JSON.stringify(e.body)}return t.has("content-type")&&t.get("content-type")==="application/x-www-form-urlencoded"&&ae(e.body)?new URLSearchParams(e.body).toString():e.body}function Ft(e,t){var n;if(t?.method)return t.method.toUpperCase();if(e.startsWith("@")){const r=(n=e.split("@")[1])==null?void 0:n.split("/")[0];return xe.includes(r)?r.toUpperCase():t?.body?"POST":"GET"}return t?.body?"POST":"GET"}function kt(e,t){let n;return!e?.signal&&e?.timeout&&(n=setTimeout(()=>t?.abort(),e?.timeout)),{abortTimeout:n,clearTimeout:()=>{n&&clearTimeout(n)}}}var Vt=class Te extends Error{constructor(t,n){super(n||JSON.stringify(t,null,2)),this.issues=t,Object.setPrototypeOf(this,Te.prototype)}};async function Y(e,t){const n=await e["~standard"].validate(t);if(n.issues)throw new Vt(n.issues);return n.value}var xe=["get","post","put","patch","delete"],Ht=e=>({id:"apply-schema",name:"Apply Schema",version:"1.0.0",async init(t,n){var r,s,i,o;const f=((s=(r=e.plugins)==null?void 0:r.find(a=>{var u;return(u=a.schema)!=null&&u.config?t.startsWith(a.schema.config.baseURL||"")||t.startsWith(a.schema.config.prefix||""):!1}))==null?void 0:s.schema)||e.schema;if(f){let a=t;(i=f.config)!=null&&i.prefix&&a.startsWith(f.config.prefix)&&(a=a.replace(f.config.prefix,""),f.config.baseURL&&(t=t.replace(f.config.prefix,f.config.baseURL))),(o=f.config)!=null&&o.baseURL&&a.startsWith(f.config.baseURL)&&(a=a.replace(f.config.baseURL,""));const u=f.schema[a];if(u){let c=N(P({},n),{method:u.method,output:u.output});return n?.disableValidation||(c=N(P({},c),{body:u.input?await Y(u.input,n?.body):n?.body,params:u.params?await Y(u.params,n?.params):n?.params,query:u.query?await Y(u.query,n?.query):n?.query}
1)),{url:t,options:c}}}return{url:t,options:n}}}),Gt=e=>{async function t(n,r){const s=N(P(P({},e),r),{plugins:[...e?.plugins||[],Ht(e||{}),...r?.plugins||[]]});if(e?.catchAllError)try{return await ce(n,s)}catch(i){return{data:null,error:{status:500,statusText:"Fetch Error",message:"Fetch related error. Captured by catchAllError option. See error property for more details.",error:i}}}return await ce(n,s)}return t};function Wt(e,t){const{baseURL:n,params:r,query:s}=t||{query:{},params:{},baseURL:""};let i=e.startsWith("http")?e.split("/").slice(0,3).join("/"):n||"";if(e.startsWith("@")){const d=e.toString().split("@")[1].split("/")[0];xe.includes(d)&&(e=e.replace(`@${d}/`,"/"))}i.endsWith("/")||(i+="/");let[o,f]=e.replace(i,"").split("?");const a=new URLSearchParams(f);for(const[d,h]of Object.entries(s||{})){if(h==null)continue;let g;if(typeof h=="string")g=h;else if(Array.isArray(h)){for(const O of h)a.append(d,O);continue}else g=JSON.stringify(h);a.set(d,g)}if(r)if(Array.isArray(r)){const d=o.split("/").filter(h=>h.startsWith(":"));for(const[h,g]of d.entries()){const O=r[h];o=o.replace(g,O)}}else for(const[d,h]of Object.entries(r))o=o.replace(`:${d}`,String(h));o=o.split("/").map(encodeURIComponent).join("/"),o.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}`}var ce=async(e,t)=>{var n,r,s,i,o,f,a,u;const{hooks:c,url:d,options:h}=await At(e,t),g=$t(h),O=new AbortController,I=(n=h.signal)!=null?n:O.signal,w=Wt(d,h),$=qt(h),b=await jt(h),R=Ft(d,h);let l=N(P({},h),{url:w,headers:b,body:$,method:R,signal:I});for(const S of c.onRequest)if(S){const v=await S(l);typeof v=="object"&&v!==null&&(l=v)}("pipeTo"in l&&typeof l.pipeTo=="function"||typeof((r=t?.body)==null?void 0:r.pipe)=="function")&&("duplex"in l||(l.duplex="half"));const{clearTimeout:U}=kt(h,O);let p=await g(l.url,l);U();const V={response:p,request:l};for(const S of c.onResponse)if(S){const v=await S(N(P({},V),{response:(s=t?.hookOptions)!=null&&s.cloneResponse?p.clone():p}));v instanceof Response?p=v:typeof v=="object"&&v!==null&&(p=v.response)}if(p.ok){if(!(l.method!=="HEAD"))return{data:"",error:null};const v=Mt(p),C={data:null,response:p,request:l};if(v==="json"||v==="text"){const M=await p.text(),Ae=(i=l.jsonParser)!=null?i:be;C.data=await Ae(M)}else C.data=await p[v]();l?.output&&l.output&&!l.disableValidation&&(C.data=await Y(l.output,C.data));for(const M of c.onSuccess)M&&await M(N(P({},C),{response:(o=t?.hookOptions)!=null&&o.cloneResponse?p.clone():p}));return t?.throw?C.data:{data:C.data,error:null}}const Pe=(f=t?.jsonParser)!=null?f:be,H=await p.text(),ue=Dt(H),X=ue?await Pe(H):null,Ne={response:p,responseText:H,request:l,error:N(P({},X),{status:p.status,statusText:p.statusText})};for(const S of c.onError)S&&await S(N(P({},Ne),{response:(a=t?.hookOptions)!=null&&a.cloneResponse?p.clone():p}));if(t?.retry){const S=It(t.retry),v=(u=t.retryAttempt)!=null?u:0;if(await S.shouldAttemptRetry(v,p)){for(const M of c.onRetry)M&&await M(V);const C=S.getDelay(v);return await new Promise(M=>setTimeout(M,C)),await ce(e,N(P({},t),{retryAttempt:v+1}))}}if(t?.throw)throw new Nt(p.status,p.statusText,ue?X:H);return{data:null,error:N(P({},X),{status:p.status,statusText:p.statusText})}};const Jt=(e,t)=>{const n="credentials"in Request.prototype,r=dt(e?.baseURL,e?.basePath)??"/api/auth",s=e?.plugins?.flatMap(l=>l.fetchPlugins).filter(l=>l!==void 0)||[],i={id:"lifecycle-hooks",name:"lifecycle-hooks",hooks:{onSuccess:e?.fetchOptions?.onSuccess,onError:e?.fetchOptions?.onError,onRequest:e?.fetchOptions?.onRequest,onResponse:e?.fetchOptions?.onResponse}},{onSuccess:o,onError:f,onRequest:a,onResponse:u,...c}=e?.fetchOptions||{},d=Gt({baseURL:r,...n?{credentials:"include"}:{},method:"GET",jsonParser(l){return l?wt(l,{strict:!1}):null},customFetchImpl:fetch,...c,plugins:[i,...c.plugins||[],...e?.disableDefaultFetchPlugins?[]:[ht],...s]}),{$sessionSignal:h,session:g}=Rt(d,e),O=e?.plugins||[];let I={};const w={$sessionSignal:h,session:g}
1,$={"/sign-out":"POST","/revoke-sessions":"POST","/revoke-other-sessions":"POST","/delete-user":"POST"},b=[{signal:"$sessionSignal",matcher(l){return l==="/sign-out"||l==="/update-user"||l==="/sign-up/email"||l==="/sign-in/email"||l==="/delete-user"||l==="/verify-email"||l==="/revoke-sessions"||l==="/revoke-session"||l==="/change-email"}}];for(const l of O)l.getAtoms&&Object.assign(w,l.getAtoms?.(d)),l.pathMethods&&Object.assign($,l.pathMethods),l.atomListeners&&b.push(...l.atomListeners);const R={notify:l=>{w[l].set(!w[l].get())},listen:(l,U)=>{w[l].subscribe(U)},atoms:w};for(const l of O)l.getActions&&(I=_t(l.getActions?.(d,R,e)??{},I));return{get baseURL(){return r},pluginsActions:I,pluginsAtoms:w,pluginPathMethods:$,atomListeners:b,$fetch:d,$store:R}};function zt(e){return typeof e=="object"&&e!==null&&"get"in e&&typeof e.get=="function"&&"lc"in e&&typeof e.lc=="number"}function Yt(e,t,n){const r=t[e],{fetchOptions:s,query:i,...o}=n||{};return r||(s?.method?s.method:o&&Object.keys(o).length>0?"POST":"GET")}function Xt(e,t,n,r,s){function i(o=[]){return new Proxy(function(){},{get(f,a){if(typeof a!="string"||a==="then"||a==="catch"||a==="finally")return;const u=[...o,a];let c=e;for(const d of u)if(c&&typeof c=="object"&&d in c)c=c[d];else{c=void 0;break}return typeof c=="function"||zt(c)?c:i(u)},apply:async(f,a,u)=>{const c="/"+o.map(b=>b.replace(/[A-Z]/g,R=>`-${R.toLowerCase()}`)).join("/"),d=u[0]||{},h=u[1]||{},{query:g,fetchOptions:O,...I}=d,w={...h,...O},$=Yt(c,n,d);return await t(c,{...w,body:$==="GET"?void 0:{...I,...w?.body||{}},query:g||w?.query,method:$,async onSuccess(b){if(await w?.onSuccess?.(b),!s||w.disableSignal)return;const R=s.filter(U=>U.matcher(c));if(!R.length)return;const l=new Set;for(const U of R){const p=r[U.signal];if(!p)return;if(l.has(U.signal))continue;l.add(U.signal);const V=p.get();setTimeout(()=>{p.set(!V)},10)}}})}})}return i()}function Qt(e,t={}){const n=Q.useRef(e.get()),{keys:r,deps:s=[e,r]}=t,i=Q.useCallback(f=>{const a=u=>{n.current!==u&&(n.current=u,f())};return a(e.value),r?.length?tt(e,r,a):e.listen(a)},s),o=()=>n.current;return Q.useSyncExternalStore(i,o,o)}function Zt(e){return`use${Ge(e)}`}function Kt(e){const{pluginPathMethods:t,pluginsActions:n,pluginsAtoms:r,$fetch:s,$store:i,atomListeners:o}=Jt(e),f={};for(const[a,u]of Object.entries(r))f[Zt(a)]=()=>Qt(u);return Xt({...n,...f,$fetch:s,$store:i},s,t,r,o)}const ln=Kt({plugins:[Qe()]}),en=({label:e,children:t,addon:n,icon:r,unstyled:s,...i})=>s?T.jsx(le,{id:e,textValue:e,...i}):T.jsx(le,{...i,className:o=>D("group block cursor-pointer px-1.5 py-px outline-hidden",o.isDisabled&&"cursor-not-allowed",typeof i.className=="function"?i.className(o):i.className),children:o=>T.jsxs("div",{className:D("outline-focus-ring relative flex items-center rounded-md px-2.5 py-2 transition duration-100 ease-linear",!o.isDisabled&&"group-hover:bg-primary_hover",o.isFocused&&"bg-primary_hover",o.isFocusVisible&&"outline-2 -outline-offset-2"),children:[r&&T.jsx(r,{"aria-hidden":"true",className:D("mr-2 size-4 shrink-0 stroke-[2.25px]",o.isDisabled?"text-fg-disabled":"text-fg-quaternary")}),T.jsx("span",{className:D("grow truncate text-sm font-semibold",o.isDisabled?"text-disabled":"text-secondary",o.isFocused&&"text-secondary_hover"),children:e||(typeof t=="function"?t(o):t)}),n&&T.jsx("span",{className:D("ring-secondary ml-3 shrink-0 rounded px-1 py-px text-xs font-medium ring-1 ring-inset",o.isDisabled?"text-disabled":"text-quaternary"),children:n})]})}),tn=e=>T.jsx(Me,{disallowEmptySelection:!0,selectionMode:"single",...e,className:t=>D("h-min overflow-y-auto py-1 outline-hidden select-none",typeof e.className=="function"?e.className(t):e.className)}),nn=e=>T.jsx(Ce,{placement:"bottom right",...e,className:t=>D("bg-primary ring-secondary_alt w-62 origin-(--trigger-anchor-point) overflow-auto rounded-lg shadow-lg ring-1 will-change-transform",t.isEntering&&"animate-in fade-in placement-right:slide-in-from-left-0.5 placement-top:slide-in-from-bottom-0.5 placement-bottom:slide-in-from-top-0.5 duration-150 ease-out",t.isExiting&&"animate-out fade-out placement-right:slide-out-to-left-0.5 placement-top:slide-out-to-bottom-0.5 placement-bottom:slide-out-to-top-0.5 duration-100 ease-in",typeof e.className=="function"?e.className(t):e.className),children:e.children}),rn=e=>T.jsx(we,{...e,"aria-label":"Open menu",className:t=>D("text-fg-quaternary outline-focus-ring cursor-pointer rounded-md transition duration-100 ease-linear",(t.isPressed||t.isHovered)&&"text-fg-quaternary_hover",(t.isPressed||t.isFocusVisible)&&"outline-2 outline-offset-2",typeof e.className=="function"?e.className(t):e.className),children:T.jsx(Le,{className:"transition-inherit-all size-5"})}),sn=e=>T.jsx(we,{...e,"aria-label":"Open menu",className:t=>D("text-fg-quaternary outline-focus-ring cursor-pointer rounded-md transition duration-100 ease-linear",(t.isPressed||t.isHovered)&&"text-fg-quaternary_hover",(t.isPressed||t.isFocusVisible)&&"outline-2 outline-offset-2",typeof e.className=="function"?e.className(t):e.className),children:T.jsx(Ie,{className:"transition-inherit-all size-5"})}),fn={Root:Ue,Popover:nn,Menu:tn,Section:De,Item:en,DotsButton:rn,DotsHorizontalButton:sn};
1export{fn as D,ln as a}; 2//# sourceMappingURL=dropdown-Du7Ttld0.js.map
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.