@baochunli/flakes 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/auth.d.ts.map +1 -1
- package/dist/commands/auth.js +133 -13
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/host.js +1 -0
- package/dist/commands/host.js.map +1 -1
- package/dist/commands/tasks.js +3 -0
- package/dist/commands/tasks.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +175 -22
- package/dist/index.js.map +1 -1
- package/dist/node_modules/@flakes/auth/package.json +1 -1
- package/dist/node_modules/@flakes/console/.output/nitro.json +1 -1
- package/dist/node_modules/@flakes/console/.output/public/assets/DocumentationPage-DM-ZYPgQ.js +1 -0
- package/dist/node_modules/@flakes/console/.output/public/assets/{RunPage-BC3sGoPN.js → RunPage-i03UqHYF.js} +1 -1
- package/dist/node_modules/@flakes/console/.output/public/assets/{RunsPage-LkYGVvbL.js → RunsPage-u8qbeAoV.js} +1 -1
- package/dist/node_modules/@flakes/console/.output/public/assets/{SandboxesPage-CwWMogj6.js → SandboxesPage-D8D_5kXP.js} +1 -1
- package/dist/node_modules/@flakes/console/.output/public/assets/{TranscriptPage-CTMgJgHp.js → TranscriptPage-ChoFjiPI.js} +1 -1
- package/dist/node_modules/@flakes/console/.output/public/assets/{_-DRcA_CG9.js → _-C4ecJpHe.js} +1 -1
- package/dist/node_modules/@flakes/console/.output/public/assets/{_runId-CO1ozt9P.js → _runId-BZXYFY32.js} +2 -2
- package/dist/node_modules/@flakes/console/.output/public/assets/{_taskId-CcIypX6M.js → _taskId-C28oHEU_.js} +2 -2
- package/dist/node_modules/@flakes/console/.output/public/assets/{account-DKgjbb-C.js → account-B4wDEC7t.js} +1 -1
- package/dist/node_modules/@flakes/console/.output/public/assets/{account-forms-DrHA3zEd.js → account-forms-BLo66Mqa.js} +1 -1
- package/dist/node_modules/@flakes/console/.output/public/assets/{auth-layout-INHonQMf.js → auth-layout-DiUSgtaY.js} +1 -1
- package/dist/node_modules/@flakes/console/.output/public/assets/{device-DOGZUNMB.js → device-NrLWypMd.js} +1 -1
- package/dist/node_modules/@flakes/console/.output/public/assets/{documentation-Dr9Bdqxh.js → documentation-NRDmcDud.js} +1 -1
- package/dist/node_modules/@flakes/console/.output/public/assets/{forgot-password-C7qvwcpm.js → forgot-password--3Mujc8s.js} +1 -1
- package/dist/node_modules/@flakes/console/.output/public/assets/{main-RzjfJZwD.js → main-KBvz0mSQ.js} +21 -87
- package/dist/node_modules/@flakes/console/.output/public/assets/{otp-verification-Cqa6lopR.js → otp-verification-BSXwS5bo.js} +1 -1
- package/dist/node_modules/@flakes/console/.output/public/assets/{reset-password-tImCgEn0.js → reset-password-C7SbNx2J.js} +1 -1
- package/dist/node_modules/@flakes/console/.output/public/assets/{runs-Cuk0VOVi.js → runs-xD4ynllK.js} +2 -2
- package/dist/node_modules/@flakes/console/.output/public/assets/{sandboxes-BBIIbVN8.js → sandboxes-Cfr1Y2Dn.js} +2 -2
- package/dist/node_modules/@flakes/console/.output/public/assets/{security-D3N68cBT.js → security-CCThSJae.js} +1 -1
- package/dist/node_modules/@flakes/console/.output/public/assets/{signin-DylILjyG.js → signin-CYeR3TaY.js} +1 -1
- package/dist/node_modules/@flakes/console/.output/public/assets/{signin-form-DWaa_uwj.js → signin-form-Bp22jPob.js} +1 -1
- package/dist/node_modules/@flakes/console/.output/public/assets/{signup-KmFQL_1g.js → signup-DHhPfohX.js} +1 -1
- package/dist/node_modules/@flakes/console/.output/server/{_-8ZDVkA1O.mjs → _-C-u135Pp.mjs} +3 -3
- package/dist/node_modules/@flakes/console/.output/server/{_-CjpSIsvB.mjs → _-DwPiGKLE.mjs} +3 -3
- package/dist/node_modules/@flakes/console/.output/server/_chunks/router.mjs +5 -5
- package/dist/node_modules/@flakes/console/.output/server/_ssr/{DocumentationPage-D85Budiq.mjs → DocumentationPage-CtBAQbzy.mjs} +4 -4
- package/dist/node_modules/@flakes/console/.output/server/_ssr/{documentation-Do_Mr_e4.mjs → documentation-Bf0VPrnt.mjs} +4 -4
- package/dist/node_modules/@flakes/console/.output/server/_ssr/{documentation-4BCES--X.mjs → documentation-PC93pMWl.mjs} +3 -3
- package/dist/node_modules/@flakes/console/.output/server/_ssr/{router-B3vKkNtv.mjs → router-elhBqT5k.mjs} +4 -4
- package/dist/node_modules/@flakes/console/.output/server/_ssr/ssr.mjs +2 -2
- package/dist/node_modules/@flakes/console/.output/server/{_tanstack-start-manifest_v-llXRWxjT.mjs → _tanstack-start-manifest_v-CR_hZXXv.mjs} +31 -31
- package/dist/node_modules/@flakes/console/package.json +1 -1
- package/dist/node_modules/@flakes/control-plane/package.json +1 -1
- package/dist/node_modules/@flakes/core/package.json +1 -1
- package/dist/node_modules/@flakes/harness-agent/package.json +1 -1
- package/dist/node_modules/@flakes/harness-sdk/package.json +1 -1
- package/dist/node_modules/@flakes/pi-agent/package.json +1 -1
- package/dist/node_modules/@flakes/protocol/package.json +1 -1
- package/dist/node_modules/@flakes/sandbox-runtime/package.json +1 -1
- package/dist/node_modules/@flakes/store/package.json +1 -1
- package/package.json +1 -1
- package/dist/node_modules/@flakes/console/.output/public/assets/DocumentationPage-DrqDulyL.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/signup-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/signup-DHhPfohX.js","assets/react-DtOYBmep.js","assets/link-BsixJinJ.js","assets/react-dom-DrIU40PY.js","assets/utils-CEE0-YEp.js","assets/otp-verification-BSXwS5bo.js","assets/signin-form-Bp22jPob.js","assets/lock-D4OhqEPW.js","assets/user-DK27uFod.js","assets/auth-layout-DiUSgtaY.js","assets/card-DSG3_teC.js","assets/signin-CYeR3TaY.js","assets/sandboxes-Cfr1Y2Dn.js","assets/runs-xD4ynllK.js","assets/reset-password-C7SbNx2J.js","assets/forgot-password--3Mujc8s.js","assets/documentation-NRDmcDud.js","assets/DocumentationPage-DM-ZYPgQ.js","assets/lib-DtfURcG3.js","assets/external-link-BW8lpiMR.js","assets/file-text-DMdy8OfN.js","assets/device-NrLWypMd.js","assets/arrow-right-BMW8fJP5.js","assets/circle-check-B0gtb8OH.js","assets/account-B4wDEC7t.js","assets/account-forms-BLo66Mqa.js","assets/save-1uf5fQff.js","assets/security-CCThSJae.js","assets/_runId-BZXYFY32.js","assets/_-C4ecJpHe.js","assets/_taskId-C28oHEU_.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{a as e,c as t,d as n,f as r,g as i,h as a,i as o,l as s,m as c,n as l,o as u,p as d,s as f,t as p,u as m,v as h}from"./react-DtOYBmep.js";import{_ as g,a as _,c as v,d as y,f as b,g as x,h as S,i as C,l as w,m as E,n as D,o as ee,p as te,r as ne,s as O,t as re,u as ie}from"./link-BsixJinJ.js";import{a as ae,i as k,n as A,r as oe,t as se}from"./redirect-BEm0VK76.js";import{n as ce,t as le}from"./qss-4JXuaDtg.js";import{n as ue,r as j,t as de}from"./matchContext-tJ0VTv5m.js";import{a as fe,c as pe,i as me,l as he,n as ge,r as _e,t as ve}from"./react-dom-DrIU40PY.js";import{r as ye,t as be}from"./utils-CEE0-YEp.js";import{a as xe,i as Se,n as Ce,r as we,t as Te}from"./dist-BtPw3IIV.js";var Ee=new WeakMap,De=new WeakMap,Oe={current:[]},ke=!1,Ae=0,je=new Set,Me=new Map;function Ne(e){let t=Array.from(e).sort((e,t)=>e instanceof Be&&e.options.deps.includes(t)?1:t instanceof Be&&t.options.deps.includes(e)?-1:0);for(let e of t){if(Oe.current.includes(e))continue;Oe.current.push(e),e.recompute();let t=De.get(e);if(t)for(let e of t){let t=Ee.get(e);t&&Ne(t)}}}function Pe(e){let t={prevVal:e.prevState,currentVal:e.state};for(let n of e.listeners)n(t)}function Fe(e){let t={prevVal:e.prevState,currentVal:e.state};for(let n of e.listeners)n(t)}function Ie(e){if(Ae>0&&!Me.has(e)&&Me.set(e,e.prevState),je.add(e),!(Ae>0)&&!ke)try{for(ke=!0;je.size>0;){let e=Array.from(je);je.clear();for(let t of e)t.prevState=Me.get(t)??t.prevState,Pe(t);for(let t of e){let e=Ee.get(t);e&&(Oe.current.push(t),Ne(e))}for(let t of e){let e=Ee.get(t);if(e)for(let t of e)Fe(t)}}}finally{ke=!1,Oe.current=[],Me.clear()}}function Le(e){Ae++;try{e()}finally{if(Ae--,Ae===0){let e=je.values().next().value;e&&Ie(e)}}}function Re(e){return typeof e==`function`}var ze=class{constructor(e,t){this.listeners=new Set,this.subscribe=e=>{var t;this.listeners.add(e);let n=((t=this.options)?.onSubscribe)?.call(t,e,this);return()=>{this.listeners.delete(e),n?.()}},this.prevState=e,this.state=e,this.options=t}setState(e){var t,n;this.prevState=this.state,this.options?.updateFn?this.state=this.options.updateFn(this.prevState)(e):Re(e)?this.state=e(this.prevState):this.state=e,(n=(t=this.options)?.onUpdate)==null||n.call(t),Ie(this)}},Be=class e{constructor(t){this.listeners=new Set,this._subscriptions=[],this.lastSeenDepValues=[],this.getDepVals=()=>{let e=this.options.deps.length,t=Array(e),n=Array(e);for(let r=0;r<e;r++){let e=this.options.deps[r];t[r]=e.prevState,n[r]=e.state}return this.lastSeenDepValues=n,{prevDepVals:t,currDepVals:n,prevVal:this.prevState??void 0}},this.recompute=()=>{var e,t;this.prevState=this.state;let n=this.getDepVals();this.state=this.options.fn(n),(t=(e=this.options).onUpdate)==null||t.call(e)},this.checkIfRecalculationNeededDeeply=()=>{for(let t of this.options.deps)t instanceof e&&t.checkIfRecalculationNeededDeeply();let t=!1,n=this.lastSeenDepValues,{currDepVals:r}=this.getDepVals();for(let e=0;e<r.length;e++)if(r[e]!==n[e]){t=!0;break}t&&this.recompute()},this.mount=()=>(this.registerOnGraph(),this.checkIfRecalculationNeededDeeply(),()=>{this.unregisterFromGraph();for(let e of this._subscriptions)e()}),this.subscribe=e=>{var t;this.listeners.add(e);let n=(t=this.options).onSubscribe?.call(t,e,this);return()=>{this.listeners.delete(e),n?.()}},this.options=t,this.state=t.fn({prevDepVals:void 0,prevVal:void 0,currDepVals:this.getDepVals().currDepVals})}registerOnGraph(t=this.options.deps){for(let n of t)if(n instanceof e)n.registerOnGraph(),this.registerOnGraph(n.options.deps);else if(n instanceof ze){let e=Ee.get(n);e||(e=new Set,Ee.set(n,e)),e.add(this);let t=De.get(this);t||(t=new Set,De.set(this,t)),t.add(n)}}unregisterFromGraph(t=this.options.deps){for(let n of t)if(n instanceof e)this.unregisterFromGraph(n.options.deps);else if(n instanceof ze){let e=Ee.get(n);e&&e.delete(this);let t=De.get(this);t&&t.delete(n)}}},Ve=`__TSR_index`,He=`popstate`,Ue=`beforeunload`;function We(e){let t=e.getLocation(),n=new Set,r=r=>{t=e.getLocation(),n.forEach(e=>e({location:t,action:r}))},i=n=>{e.notifyOnIndexChange??!0?r(n):t=e.getLocation()},a=async({task:n,navigateOpts:r,...i})=>{if(r?.ignoreBlocker??!1){n();return}let a=e.getBlockers?.()??[],o=i.type===`PUSH`||i.type===`REPLACE`;if(typeof document<`u`&&a.length&&o)for(let n of a){let r=Je(i.path,i.state);if(await n.blockerFn({currentLocation:t,nextLocation:r,action:i.type})){e.onBlocked?.();return}}n()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:e=>(n.add(e),()=>{n.delete(e)}),push:(n,i,o)=>{let s=t.state[Ve];i=Ge(s+1,i),a({task:()=>{e.pushState(n,i),r({type:`PUSH`})},navigateOpts:o,type:`PUSH`,path:n,state:i})},replace:(n,i,o)=>{let s=t.state[Ve];i=Ge(s,i),a({task:()=>{e.replaceState(n,i),r({type:`REPLACE`})},navigateOpts:o,type:`REPLACE`,path:n,state:i})},go:(t,n)=>{a({task:()=>{e.go(t),i({type:`GO`,index:t})},navigateOpts:n,type:`GO`})},back:t=>{a({task:()=>{e.back(t?.ignoreBlocker??!1),i({type:`BACK`})},navigateOpts:t,type:`BACK`})},forward:t=>{a({task:()=>{e.forward(t?.ignoreBlocker??!1),i({type:`FORWARD`})},navigateOpts:t,type:`FORWARD`})},canGoBack:()=>t.state[Ve]!==0,createHref:t=>e.createHref(t),block:t=>{if(!e.setBlockers)return()=>{};let n=e.getBlockers?.()??[];return e.setBlockers([...n,t]),()=>{let n=e.getBlockers?.()??[];e.setBlockers?.(n.filter(e=>e!==t))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}function Ge(e,t){t||={};let n=Ye();return{...t,key:n,__TSR_key:n,[Ve]:e}}function Ke(e){let t=e?.window??(typeof document<`u`?window:void 0),n=t.history.pushState,r=t.history.replaceState,i=[],a=()=>i,o=e=>i=e,s=e?.createHref??(e=>e),c=e?.parseLocation??(()=>Je(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=Ye();t.history.replaceState({[Ve]:0,key:e,__TSR_key:e},``)}let l=c(),u,d=!1,f=!1,p=!1,m=!1,h=()=>l,g,_,v=()=>{g&&(C._ignoreSubscribers=!0,(g.isPush?t.history.pushState:t.history.replaceState)(g.state,``,g.href),C._ignoreSubscribers=!1,g=void 0,_=void 0,u=void 0)},y=(e,t,n)=>{let r=s(t);_||(u=l),l=Je(t,n),g={href:r,state:n,isPush:g?.isPush||e===`push`},_||=Promise.resolve().then(()=>v())},b=e=>{l=c(),C.notify({type:e})},x=async()=>{if(f){f=!1;return}let e=c(),n=e.state[Ve]-l.state[Ve],r=n===1,i=n===-1,o=!r&&!i||d;d=!1;let s=o?`GO`:i?`BACK`:`FORWARD`,u=o?{type:`GO`,index:n}:{type:i?`BACK`:`FORWARD`};if(p)p=!1;else{let n=a();if(typeof document<`u`&&n.length){for(let r of n)if(await r.blockerFn({currentLocation:l,nextLocation:e,action:s})){f=!0,t.history.go(1),C.notify(u);return}}}l=c(),C.notify(u)},S=e=>{if(m){m=!1;return}let t=!1,n=a();if(typeof document<`u`&&n.length)for(let e of n){let n=e.enableBeforeUnload??!0;if(n===!0){t=!0;break}if(typeof n==`function`&&n()===!0){t=!0;break}}if(t)return e.preventDefault(),e.returnValue=``},C=We({getLocation:h,getLength:()=>t.history.length,pushState:(e,t)=>y(`push`,e,t),replaceState:(e,t)=>y(`replace`,e,t),back:e=>(e&&(p=!0),m=!0,t.history.back()),forward:e=>{e&&(p=!0),m=!0,t.history.forward()},go:e=>{d=!0,t.history.go(e)},createHref:e=>s(e),flush:v,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(Ue,S,{capture:!0}),t.removeEventListener(He,x)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return t.addEventListener(Ue,S,{capture:!0}),t.addEventListener(He,x),t.history.pushState=function(...e){let r=n.apply(t.history,e);return C._ignoreSubscribers||b(`PUSH`),r},t.history.replaceState=function(...e){let n=r.apply(t.history,e);return C._ignoreSubscribers||b(`REPLACE`),n},C}function qe(e){let t=e.replace(/[\x00-\x1f\x7f]/g,``);return t.startsWith(`//`)&&(t=`/`+t.replace(/^\/+/,``)),t}function Je(e,t){let n=qe(e),r=n.indexOf(`#`),i=n.indexOf(`?`),a=Ye();return{href:n,pathname:n.substring(0,r>0?i>0?Math.min(r,i):r:i>0?i:n.length),hash:r>-1?n.substring(r):``,search:i>-1?n.slice(i,r===-1?void 0:r):``,state:t||{[Ve]:0,key:a,__TSR_key:a}}}function Ye(){return(Math.random()+1).toString(36).substring(7)}function Xe(e){let t;return Le(()=>{t=e()}),t}function Ze(){try{if(typeof window<`u`&&typeof window.sessionStorage==`object`)return window.sessionStorage}catch{}}var Qe=`tsr-scroll-restoration-v1_3`,$e=(e,t)=>{let n;return(...r)=>{n||=setTimeout(()=>{e(...r),n=null},t)}};function et(){let e=Ze();if(!e)return null;let t=e.getItem(Qe),n=t?JSON.parse(t):{};return{state:n,set:t=>{n=s(t,n)||n;try{e.setItem(Qe,JSON.stringify(n))}catch{console.warn(`[ts-router] Could not persist scroll restoration state to sessionStorage.`)}}}}var tt=et(),nt=e=>e.state.__TSR_key||e.href;function rt(e){let t=[],n;for(;n=e.parentNode;)t.push(`${e.tagName}:nth-child(${Array.prototype.indexOf.call(n.children,e)+1})`),e=n;return`${t.reverse().join(` > `)}`.toLowerCase()}var it=!1;function at({storageKey:e,key:t,behavior:n,shouldScrollRestoration:r,scrollToTopSelectors:i,location:a}){let o;try{o=JSON.parse(sessionStorage.getItem(e)||`{}`)}catch(e){console.error(e);return}let s=t||window.history.state?.__TSR_key,c=o[s];it=!0;scroll:{if(r&&c&&Object.keys(c).length>0){for(let e in c){let t=c[e];if(e===`window`)window.scrollTo({top:t.scrollY,left:t.scrollX,behavior:n});else if(e){let n=document.querySelector(e);n&&(n.scrollLeft=t.scrollX,n.scrollTop=t.scrollY)}}break scroll}let e=(a??window.location).hash.split(`#`,2)[1];if(e){let t=window.history.state?.__hashScrollIntoViewOptions??!0;if(t){let n=document.getElementById(e);n&&n.scrollIntoView(t)}break scroll}let t={top:0,left:0,behavior:n};if(window.scrollTo(t),i)for(let e of i){if(e===`window`)continue;let n=typeof e==`function`?e():document.querySelector(e);n&&n.scrollTo(t)}}it=!1}function ot(e,t){if(!tt||((t??e.options.scrollRestoration??!1)&&(e.isScrollRestoring=!0),e.isScrollRestorationSetup||!tt))return;e.isScrollRestorationSetup=!0,it=!1;let n=e.options.getScrollRestorationKey||nt;window.history.scrollRestoration=`manual`,typeof document<`u`&&document.addEventListener(`scroll`,$e(t=>{if(it||!e.isScrollRestoring)return;let r=``;if(t.target===document||t.target===window)r=`window`;else{let e=t.target.getAttribute(`data-scroll-restoration-id`);r=e?`[data-scroll-restoration-id="${e}"]`:rt(t.target)}let i=n(e.state.location);tt.set(e=>{let t=e[i]||={},n=t[r]||={};if(r===`window`)n.scrollX=window.scrollX||0,n.scrollY=window.scrollY||0;else if(r){let e=document.querySelector(r);e&&(n.scrollX=e.scrollLeft||0,n.scrollY=e.scrollTop||0)}return e})},100),!0),e.subscribe(`onRendered`,t=>{let r=n(t.toLocation);if(!e.resetNextScroll){e.resetNextScroll=!0;return}typeof e.options.scrollRestoration==`function`&&!e.options.scrollRestoration({location:e.latestLocation})||(at({storageKey:Qe,key:r,behavior:e.options.scrollRestorationBehavior,shouldScrollRestoration:e.isScrollRestoring,scrollToTopSelectors:e.options.scrollToTopSelectors,location:e.history.location}),e.isScrollRestoring&&tt.set(e=>(e[r]||={},e)))})}function st(e){if(typeof document<`u`&&document.querySelector){let t=e.state.location.state.__hashScrollIntoViewOptions??!0;if(t&&e.state.location.hash!==``){let n=document.getElementById(e.state.location.hash);n&&n.scrollIntoView(t)}}}var ct=ut(JSON.parse),lt=dt(JSON.stringify,JSON.parse);function ut(e){return t=>{t[0]===`?`&&(t=t.substring(1));let n=le(t);for(let t in n){let r=n[t];if(typeof r==`string`)try{n[t]=e(r)}catch{}}return n}}function dt(e,t){let n=typeof t==`function`;function r(r){if(typeof r==`object`&&r)try{return e(r)}catch{}else if(n&&typeof r==`string`)try{return t(r),e(r)}catch{}return r}return e=>{let t=ce(e,r);return t?`?${t}`:``}}var ft=e=>{if(!e.rendered)return e.rendered=!0,e.onReady?.()},pt=(e,t)=>!!(e.preload&&!e.router.state.matches.some(e=>e.id===t)),mt=(e,t,n=!0)=>{let r={...e.router.options.context??{}},i=n?t:t-1;for(let t=0;t<=i;t++){let n=e.matches[t];if(!n)continue;let i=e.router.getMatch(n.id);i&&Object.assign(r,i.__routeContext,i.__beforeLoadContext)}return r},ht=(e,t)=>{let n=e.router.routesById[t.routeId??``]??e.router.routeTree;!n.options.notFoundComponent&&e.router.options?.defaultNotFoundComponent&&(n.options.notFoundComponent=e.router.options.defaultNotFoundComponent),l(n.options.notFoundComponent,`No notFoundComponent found. Please set a notFoundComponent on your route or provide a defaultNotFoundComponent to the router.`);let r=e.matches.find(e=>e.routeId===n.id);l(r,`Could not find match for route: `+n.id),e.updateMatch(r.id,e=>({...e,status:`notFound`,error:t,isFetching:!1})),t.routerCode===`BEFORE_LOAD`&&n.parentRoute&&(t.routeId=n.parentRoute.id,ht(e,t))},gt=(e,t,n)=>{if(!(!se(n)&&!k(n))){if(se(n)&&n.redirectHandled&&!n.options.reloadDocument)throw n;if(t){t._nonReactive.beforeLoadPromise?.resolve(),t._nonReactive.loaderPromise?.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0;let r=se(n)?`redirected`:`notFound`;t._nonReactive.error=n,e.updateMatch(t.id,i=>({...i,status:r,context:mt(e,t.index),isFetching:!1,error:n})),k(n)&&!n.routeId&&(n.routeId=t.routeId),t._nonReactive.loadPromise?.resolve()}throw se(n)?(e.rendered=!0,n.options._fromLocation=e.location,n.redirectHandled=!0,n=e.router.resolveRedirect(n),n):(ht(e,n),n)}},_t=(e,t)=>!!e.router.getMatch(t)._nonReactive.dehydrated,vt=(e,t,n,r)=>{let{id:i,routeId:a}=e.matches[t],o=e.router.looseRoutesById[a];if(n instanceof Promise)throw n;n.routerCode=r,e.firstBadMatchIndex??=t,gt(e,e.router.getMatch(i),n);try{o.options.onError?.(n)}catch(t){n=t,gt(e,e.router.getMatch(i),n)}e.updateMatch(i,e=>(e._nonReactive.beforeLoadPromise?.resolve(),e._nonReactive.beforeLoadPromise=void 0,e._nonReactive.loadPromise?.resolve(),{...e,error:n,status:`error`,isFetching:!1,updatedAt:Date.now(),abortController:new AbortController}))},yt=(e,t,n,r)=>{if(r._nonReactive.pendingTimeout!==void 0)return;let i=n.options.pendingMs??e.router.options.defaultPendingMs;if(e.onReady&&!pt(e,t)&&(n.options.loader||n.options.beforeLoad||kt(n))&&typeof i==`number`&&i!==1/0&&(n.options.pendingComponent??e.router.options?.defaultPendingComponent)){let t=setTimeout(()=>{ft(e)},i);r._nonReactive.pendingTimeout=t}},bt=(e,t,n)=>{let r=e.router.getMatch(t);if(!r._nonReactive.beforeLoadPromise&&!r._nonReactive.loaderPromise)return;yt(e,t,n,r);let i=()=>{let n=e.router.getMatch(t);n.preload&&(n.status===`redirected`||n.status===`notFound`)&>(e,n,n.error)};return r._nonReactive.beforeLoadPromise?r._nonReactive.beforeLoadPromise.then(i):i()},xt=(e,t,n,i)=>{let a=e.router.getMatch(t),s=a._nonReactive.loadPromise;a._nonReactive.loadPromise=o(()=>{s?.resolve()});let{paramsError:c,searchError:l}=a;c&&vt(e,n,c,`PARSE_PARAMS`),l&&vt(e,n,l,`VALIDATE_SEARCH`),yt(e,t,i,a);let u=new AbortController,d=!1,f=()=>{d||(d=!0,e.updateMatch(t,e=>({...e,isFetching:`beforeLoad`,fetchCount:e.fetchCount+1,abortController:u})))},p=()=>{a._nonReactive.beforeLoadPromise?.resolve(),a._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,e=>({...e,isFetching:!1}))};if(!i.options.beforeLoad){Xe(()=>{f(),p()});return}a._nonReactive.beforeLoadPromise=o();let m={...mt(e,n,!1),...a.__routeContext},{search:h,params:g,cause:_}=a,v=pt(e,t),y={search:h,abortController:u,params:g,preload:v,context:m,location:e.location,navigate:t=>e.router.navigate({...t,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:v?`preload`:_,matches:e.matches,routeId:i.id,...e.router.options.additionalContext},b=r=>{if(r===void 0){Xe(()=>{f(),p()});return}(se(r)||k(r))&&(f(),vt(e,n,r,`BEFORE_LOAD`)),Xe(()=>{f(),e.updateMatch(t,e=>({...e,__beforeLoadContext:r})),p()})},x;try{if(x=i.options.beforeLoad(y),r(x))return f(),x.catch(t=>{vt(e,n,t,`BEFORE_LOAD`)}).then(b)}catch(t){f(),vt(e,n,t,`BEFORE_LOAD`)}b(x)},St=(e,t)=>{let{id:n,routeId:i}=e.matches[t],a=e.router.looseRoutesById[i],o=()=>c(),s=()=>xt(e,n,t,a),c=()=>{if(_t(e,n))return;let t=bt(e,n,a);return r(t)?t.then(s):s()};return o()},Ct=(e,t,n)=>{let r=e.router.getMatch(t);if(!r||!n.options.head&&!n.options.scripts&&!n.options.headers)return;let i={ssr:e.router.options.ssr,matches:e.matches,match:r,params:r.params,loaderData:r.loaderData};return Promise.all([n.options.head?.(i),n.options.scripts?.(i),n.options.headers?.(i)]).then(([e,t,n])=>({meta:e?.meta,links:e?.links,headScripts:e?.scripts,headers:n,scripts:t,styles:e?.styles}))},wt=(e,t,n,r)=>{let i=e.matchPromises[n-1],{params:a,loaderDeps:o,abortController:s,cause:c}=e.router.getMatch(t),l=mt(e,n),u=pt(e,t);return{params:a,deps:o,preload:!!u,parentMatchPromise:i,abortController:s,context:l,location:e.location,navigate:t=>e.router.navigate({...t,_fromLocation:e.location}),cause:u?`preload`:c,route:r,...e.router.options.additionalContext}},Tt=async(e,t,n,i)=>{try{let a=e.router.getMatch(t);try{Ot(i);let o=i.options.loader?.(wt(e,t,n,i)),s=i.options.loader&&r(o);if((s||i._lazyPromise||i._componentsPromise||i.options.head||i.options.scripts||i.options.headers||a._nonReactive.minPendingPromise)&&e.updateMatch(t,e=>({...e,isFetching:`loader`})),i.options.loader){let n=s?await o:o;gt(e,e.router.getMatch(t),n),n!==void 0&&e.updateMatch(t,e=>({...e,loaderData:n}))}i._lazyPromise&&await i._lazyPromise;let c=a._nonReactive.minPendingPromise;c&&await c,i._componentsPromise&&await i._componentsPromise,e.updateMatch(t,t=>({...t,error:void 0,context:mt(e,n),status:`success`,isFetching:!1,updatedAt:Date.now()}))}catch(r){let o=r;if(o?.name===`AbortError`){if(a.abortController.signal.aborted){a._nonReactive.loaderPromise?.resolve(),a._nonReactive.loaderPromise=void 0;return}e.updateMatch(t,t=>({...t,status:t.status===`pending`?`success`:t.status,isFetching:!1,context:mt(e,n)}));return}let s=a._nonReactive.minPendingPromise;s&&await s,k(r)&&await i.options.notFoundComponent?.preload?.(),gt(e,e.router.getMatch(t),r);try{i.options.onError?.(r)}catch(n){o=n,gt(e,e.router.getMatch(t),n)}e.updateMatch(t,t=>({...t,error:o,context:mt(e,n),status:`error`,isFetching:!1}))}}catch(n){let r=e.router.getMatch(t);r&&(r._nonReactive.loaderPromise=void 0),gt(e,r,n)}},Et=async(e,t)=>{async function n(n,i,o,c){let l=Date.now()-i.updatedAt,u=n?c.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:c.options.staleTime??e.router.options.defaultStaleTime??0,d=c.options.shouldReload,f=typeof d==`function`?d(wt(e,r,t,c)):d,{status:p,invalid:m}=o;a=p===`success`&&(m||(f??l>u)),n&&c.options.preload===!1||(a&&!e.sync?(s=!0,(async()=>{try{await Tt(e,r,t,c);let n=e.router.getMatch(r);n._nonReactive.loaderPromise?.resolve(),n._nonReactive.loadPromise?.resolve(),n._nonReactive.loaderPromise=void 0}catch(t){se(t)&&await e.router.navigate(t.options)}})()):(p!==`success`||a&&e.sync)&&await Tt(e,r,t,c))}let{id:r,routeId:i}=e.matches[t],a=!1,s=!1,c=e.router.looseRoutesById[i];if(!_t(e,r)){let t=e.router.getMatch(r),i=pt(e,r);if(t._nonReactive.loaderPromise){if(t.status===`success`&&!e.sync&&!t.preload)return t;await t._nonReactive.loaderPromise;let a=e.router.getMatch(r),o=a._nonReactive.error||a.error;o&>(e,a,o),a.status===`pending`&&await n(i,t,a,c)}else{let a=i&&!e.router.state.matches.some(e=>e.id===r),s=e.router.getMatch(r);s._nonReactive.loaderPromise=o(),a!==s.preload&&e.updateMatch(r,e=>({...e,preload:a})),await n(i,t,s,c)}}let l=e.router.getMatch(r);s||(l._nonReactive.loaderPromise?.resolve(),l._nonReactive.loadPromise?.resolve()),clearTimeout(l._nonReactive.pendingTimeout),l._nonReactive.pendingTimeout=void 0,s||(l._nonReactive.loaderPromise=void 0),l._nonReactive.dehydrated=void 0;let u=s?l.isFetching:!1;return u!==l.isFetching||l.invalid!==!1?(e.updateMatch(r,e=>({...e,isFetching:u,invalid:!1})),e.router.getMatch(r)):l};async function Dt(e){let t=Object.assign(e,{matchPromises:[]});t.router.state.matches.some(e=>e._forcePending)&&ft(t);try{for(let e=0;e<t.matches.length;e++){let n=St(t,e);r(n)&&await n}let e=t.firstBadMatchIndex??t.matches.length;for(let n=0;n<e;n++)t.matchPromises.push(Et(t,n));let n=(await Promise.allSettled(t.matchPromises)).filter(e=>e.status===`rejected`).map(e=>e.reason),i;for(let e of n){if(se(e))throw e;!i&&k(e)&&(i=e)}for(let e of t.matches){let{id:n,routeId:r}=e,i=t.router.looseRoutesById[r];try{let e=Ct(t,n,i);if(e){let r=await e;t.updateMatch(n,e=>({...e,...r}))}}catch(e){console.error(`Error executing head for route ${r}:`,e)}}if(i)throw i;let a=ft(t);r(a)&&await a}catch(e){if(k(e)&&!t.preload){let n=ft(t);throw r(n)&&await n,e}if(se(e))throw e}return t.matches}async function Ot(e){if(!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(t=>{let{id:n,...r}=t.options;Object.assign(e.options,r),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0),!e._componentsLoaded&&e._componentsPromise===void 0){let t=()=>{let t=[];for(let n of At){let r=e.options[n]?.preload;r&&t.push(r())}if(t.length)return Promise.all(t).then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0});e._componentsLoaded=!0,e._componentsPromise=void 0};e._componentsPromise=e._lazyPromise?e._lazyPromise.then(t):t()}return e._componentsPromise}function kt(e){for(let t of At)if(e.options[t]?.preload)return!0;return!1}var At=[`component`,`errorComponent`,`pendingComponent`,`notFoundComponent`];function jt(e){return{input:({url:t})=>{for(let n of e)t=Nt(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=Pt(e[n],t);return t}}}function Mt(e){let t=w(e.basepath),n=`/${t}`,r=`${n}/`,i=e.caseSensitive?n:n.toLowerCase(),a=e.caseSensitive?r:r.toLowerCase();return{input:({url:t})=>{let r=e.caseSensitive?t.pathname:t.pathname.toLowerCase();return r===i?t.pathname=`/`:r.startsWith(a)&&(t.pathname=t.pathname.slice(n.length)),t},output:({url:e})=>(e.pathname=O([`/`,t,e.pathname]),e)}}function Nt(e,t){let n=e?.input?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function Pt(e,t){let n=e?.output?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function Ft(e){return e instanceof Error?{name:e.name,message:e.message}:{data:e}}function It(e){let t=e.resolvedLocation,n=e.location;return{fromLocation:t,toLocation:n,pathChanged:t?.pathname!==n.pathname,hrefChanged:t?.href!==n.href,hashChanged:t?.hash!==n.hash}}var Lt=class{constructor(t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.isScrollRestoring=!1,this.isScrollRestorationSetup=!1,this.startTransition=e=>e(),this.update=e=>{e.notFoundRoute&&console.warn(`The notFoundRoute API is deprecated and will be removed in the next major version. See https://tanstack.com/router/v1/docs/framework/react/guide/not-found-errors#migrating-from-notfoundroute for more info.`);let t=this.options,n=this.basepath??t?.basepath??`/`,r=this.basepath===void 0,i=t?.rewrite;if(this.options={...t,...e},this.isServer=this.options.isServer??typeof document>`u`,this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=_(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=Ke()),this.origin=this.options.origin,this.origin||(window?.origin&&window.origin!==`null`?this.origin=window.origin:this.origin=`http://localhost`),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let e;this.resolvePathCache=g(1e3),e=this.buildRouteTree(),this.setRoutes(e)}!this.__store&&this.latestLocation&&(this.__store=new ze(Bt(this.latestLocation),{onUpdate:()=>{this.__store.state={...this.state,cachedMatches:this.state.cachedMatches.filter(e=>![`redirected`].includes(e.status))}}}),ot(this));let a=!1,o=this.options.basepath??`/`,s=this.options.rewrite;if(r||n!==o||i!==s){this.basepath=o;let e=[],t=w(o);t&&t!==`/`&&e.push(Mt({basepath:o})),s&&e.push(s),this.rewrite=e.length===0?void 0:e.length===1?e[0]:jt(e),this.history&&this.updateLatestLocation(),a=!0}a&&this.__store&&(this.__store.state={...this.state,location:this.latestLocation}),typeof window<`u`&&`CSS`in window&&typeof window.CSS?.supports==`function`&&(this.isViewTransitionTypesSupported=window.CSS.supports(`selector(:active-view-transition-type(a)`))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=x(this.routeTree,this.options.caseSensitive,(e,t)=>{e.init({originalIndex:t})});return this.options.routeMasks&&S(this.options.routeMasks,e.processedTree),e},this.subscribe=(e,t)=>{let n={eventType:e,fn:t};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=e=>{this.subscribers.forEach(t=>{t.eventType===e.type&&t.fn(e)})},this.parseLocation=(t,n)=>{let r=({pathname:t,search:r,hash:i,href:a,state:o})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(t)){let s=this.options.parseSearch(r),l=this.options.stringifySearch(s);return{href:t+l+i,publicHref:a,pathname:e(t).path,external:!1,searchStr:l,search:c(n?.search,s),hash:e(i.slice(1)).path,state:c(n?.state,o)}}let s=new URL(a,this.origin),l=Nt(this.rewrite,s),u=this.options.parseSearch(l.search),d=this.options.stringifySearch(u);return l.search=d,{href:l.href.replace(l.origin,``),publicHref:a,pathname:e(l.pathname).path,external:!!this.rewrite&&l.origin!==this.origin,searchStr:d,search:c(n?.search,u),hash:e(l.hash.slice(1)).path,state:c(n?.state,o)}},i=r(t),{__tempLocation:a,__tempKey:o}=i.state;if(a&&(!o||o===this.tempLocationKey)){let e=r(a);return e.state.key=i.state.key,e.state.__TSR_key=i.state.__TSR_key,delete e.state.__tempLocation,{...e,maskedLocation:i}}return i},this.resolvePathWithBase=(e,t)=>v({base:e,to:C(t),trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(e,t,n)=>typeof e==`string`?this.matchRoutesInternal({pathname:e,search:t},n):this.matchRoutesInternal(e,t),this.getMatchedRoutes=e=>Ht({pathname:e,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=e=>{let t=this.getMatch(e);t&&(t.abortController.abort(),clearTimeout(t._nonReactive.pendingTimeout),t._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{let e=this.state.matches.filter(e=>e.status===`pending`),t=this.state.matches.filter(e=>e.isFetching===`loader`);new Set([...this.state.pendingMatches??[],...e,...t]).forEach(e=>{this.cancelMatch(e.id)})},this.buildLocation=t=>{let n=(n={})=>{let r=n._fromLocation||this.pendingBuiltLocation||this.latestLocation,i=this.matchRoutesLightweight(r);n.from;let a=n.unsafeRelative===`path`?r.pathname:n.from??i.fullPath,o=this.resolvePathWithBase(a,`.`),l=i.search,u={...i.params},d=n.to?this.resolvePathWithBase(o,`${n.to}`):this.resolvePathWithBase(o,`.`),p=n.params===!1||n.params===null?{}:(n.params??!0)===!0?u:Object.assign(u,s(n.params,u)),m=ee({path:d,params:p,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath,h=this.getMatchedRoutes(m),g=h.matchedRoutes;(h.foundRoute?h.foundRoute.path!==`/`&&h.routeParams[`**`]:y(m))&&this.options.notFoundRoute&&(g=[...g,this.options.notFoundRoute]);let _=!1;if(Object.keys(p).length>0)for(let e of g){let t=e.options.params?.stringify??e.options.stringifyParams;t&&(_=!0,Object.assign(p,t(p)))}let v=t.leaveParams?d:e(_?ee({path:d,params:p,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath:m).path,b=l;if(t._includeValidateSearch&&this.options.search?.strict){let e={};g.forEach(t=>{if(t.options.validateSearch)try{Object.assign(e,Vt(t.options.validateSearch,{...e,...b}))}catch{}}),b=e}b=Ut({search:b,dest:n,destRoutes:g,_includeValidateSearch:t._includeValidateSearch}),b=c(l,b);let x=this.options.stringifySearch(b),S=n.hash===!0?r.hash:n.hash?s(n.hash,r.hash):void 0,C=S?`#${S}`:``,w=n.state===!0?r.state:n.state?s(n.state,r.state):{};w=c(r.state,w);let E=`${v}${x}${C}`,D,te,ne=!1;if(this.rewrite){let e=new URL(E,this.origin),t=Pt(this.rewrite,e);D=e.href.replace(e.origin,``),t.origin===this.origin?te=t.pathname+t.search+t.hash:(te=t.href,ne=!0)}else D=f(E),te=D;return{publicHref:te,href:D,pathname:v,search:b,searchStr:x,state:w,hash:S??``,external:ne,unmaskOnReload:n.unmaskOnReload}},r=(e={},r)=>{let i=n(e),a=r?n(r):void 0;if(!a){let e={};if(this.options.routeMasks){let o=b(i.pathname,this.processedTree);if(o){Object.assign(e,o.rawParams);let{from:i,params:c,...l}=o.route,u=c===!1||c===null?{}:(c??!0)===!0?e:Object.assign(e,s(c,e));r={from:t.from,...l,params:u},a=n(r)}}}return a&&(i.maskedLocation=a),i};return t.mask?r(t,{from:t.from,...t.mask}):r(t)},this.commitLocation=async({viewTransition:e,ignoreBlocker:t,...n})=>{let r=()=>{let e=[`key`,`__TSR_key`,`__TSR_index`,`__hashScrollIntoViewOptions`];e.forEach(e=>{n.state[e]=this.latestLocation.state[e]});let t=u(n.state,this.latestLocation.state);return e.forEach(e=>{delete n.state[e]}),t},i=y(this.latestLocation.href)===y(n.href),a=this.commitLocationPromise;if(this.commitLocationPromise=o(()=>{a?.resolve()}),i&&r())this.load();else{let{maskedLocation:r,hashScrollIntoView:i,...a}=n;r&&(a={...r,state:{...r.state,__tempKey:void 0,__tempLocation:{...a,search:a.searchStr,state:{...a.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(a.unmaskOnReload??this.options.unmaskOnReload??!1)&&(a.state.__tempKey=this.tempLocationKey)),a.state.__hashScrollIntoViewOptions=i??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=e,this.history[n.replace?`replace`:`push`](a.publicHref,a.state,{ignoreBlocker:t})}return this.resetNextScroll=n.resetScroll??!0,this.history.subscribers.size||this.load(),this.commitLocationPromise},this.buildAndCommitLocation=({replace:e,resetScroll:t,hashScrollIntoView:n,viewTransition:r,ignoreBlocker:i,href:a,...o}={})=>{if(a){let t=this.history.location.state.__TSR_index,n=Je(a,{__TSR_index:e?t:t+1}),r=new URL(n.pathname,this.origin);o.to=Nt(this.rewrite,r).pathname,o.search=this.options.parseSearch(n.search),o.hash=n.hash.slice(1)}let s=this.buildLocation({...o,_includeValidateSearch:!0});this.pendingBuiltLocation=s;let c=this.commitLocation({...s,viewTransition:r,replace:e,resetScroll:t,hashScrollIntoView:n,ignoreBlocker:i});return Promise.resolve().then(()=>{this.pendingBuiltLocation===s&&(this.pendingBuiltLocation=void 0)}),c},this.navigate=async({to:e,reloadDocument:t,href:n,publicHref:r,...i})=>{let a=!1;if(n)try{new URL(`${n}`),a=!0}catch{}if(a&&!t&&(t=!0),t){if(e!==void 0||!n){let t=this.buildLocation({to:e,...i});n??=t.publicHref,r??=t.publicHref}let t=!a&&r?r:n;if(m(t))return Promise.resolve();if(!i.ignoreBlocker){let e=this.history.getBlockers?.()??[];for(let t of e)if(t?.blockerFn&&await t.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:`PUSH`}))return Promise.resolve()}return i.replace?window.location.replace(t):window.location.href=t,Promise.resolve()}return this.buildAndCommitLocation({...i,href:n,to:e,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();let e=this.matchRoutes(this.latestLocation);this.__store.setState(t=>({...t,status:`pending`,statusCode:200,isLoading:!0,location:this.latestLocation,pendingMatches:e,cachedMatches:t.cachedMatches.filter(t=>!e.some(e=>e.id===t.id))}))},this.load=async e=>{let t,n,r;for(r=new Promise(i=>{this.startTransition(async()=>{try{this.beforeLoad();let t=this.latestLocation,n=this.state.resolvedLocation;this.state.redirect||this.emit({type:`onBeforeNavigate`,...It({resolvedLocation:n,location:t})}),this.emit({type:`onBeforeLoad`,...It({resolvedLocation:n,location:t})}),await Dt({router:this,sync:e?.sync,matches:this.state.pendingMatches,location:t,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let e=[],t=[],n=[];Xe(()=>{this.__store.setState(r=>{let i=r.matches,a=r.pendingMatches||r.matches;return e=i.filter(e=>!a.some(t=>t.id===e.id)),t=a.filter(e=>!i.some(t=>t.id===e.id)),n=a.filter(e=>i.some(t=>t.id===e.id)),{...r,isLoading:!1,loadedAt:Date.now(),matches:a,pendingMatches:void 0,cachedMatches:[...r.cachedMatches,...e.filter(e=>e.status!==`error`&&e.status!==`notFound`)]}}),this.clearExpiredCache()}),[[e,`onLeave`],[t,`onEnter`],[n,`onStay`]].forEach(([e,t])=>{e.forEach(e=>{this.looseRoutesById[e.routeId].options[t]?.(e)})})})})}})}catch(e){se(e)?(t=e,this.navigate({...t.options,replace:!0,ignoreBlocker:!0})):k(e)&&(n=e),this.__store.setState(e=>({...e,statusCode:t?t.status:n?404:e.matches.some(e=>e.status===`error`)?500:200,redirect:t}))}this.latestLoadPromise===r&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),i()})}),this.latestLoadPromise=r,await r;this.latestLoadPromise&&r!==this.latestLoadPromise;)await this.latestLoadPromise;let i;this.hasNotFoundMatch()?i=404:this.__store.state.matches.some(e=>e.status===`error`)&&(i=500),i!==void 0&&this.__store.setState(e=>({...e,statusCode:i}))},this.startViewTransition=e=>{let t=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,t&&typeof document<`u`&&`startViewTransition`in document&&typeof document.startViewTransition==`function`){let n;if(typeof t==`object`&&this.isViewTransitionTypesSupported){let r=this.latestLocation,i=this.state.resolvedLocation,a=typeof t.types==`function`?t.types(It({resolvedLocation:i,location:r})):t.types;if(a===!1){e();return}n={update:e,types:a}}else n=e;document.startViewTransition(n)}else e()},this.updateMatch=(e,t)=>{this.startTransition(()=>{let n=this.state.pendingMatches?.some(t=>t.id===e)?`pendingMatches`:this.state.matches.some(t=>t.id===e)?`matches`:this.state.cachedMatches.some(t=>t.id===e)?`cachedMatches`:``;n&&this.__store.setState(r=>({...r,[n]:r[n]?.map(n=>n.id===e?t(n):n)}))})},this.getMatch=e=>{let t=t=>t.id===e;return this.state.cachedMatches.find(t)??this.state.pendingMatches?.find(t)??this.state.matches.find(t)},this.invalidate=e=>{let t=t=>e?.filter?.(t)??!0?{...t,invalid:!0,...e?.forcePending||t.status===`error`||t.status===`notFound`?{status:`pending`,error:void 0}:void 0}:t;return this.__store.setState(e=>({...e,matches:e.matches.map(t),cachedMatches:e.cachedMatches.map(t),pendingMatches:e.pendingMatches?.map(t)})),this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.getParsedLocationHref=e=>e.publicHref||`/`,this.resolveRedirect=e=>{let t=e.headers.get(`Location`);if(!e.options.href||e.options._builtLocation){let t=e.options._builtLocation??this.buildLocation(e.options),n=this.getParsedLocationHref(t);e.options.href=n,e.headers.set(`Location`,n)}else if(t)try{let n=new URL(t);if(this.origin&&n.origin===this.origin){let t=n.pathname+n.search+n.hash;e.options.href=t,e.headers.set(`Location`,t)}}catch{}return e.headers.get(`Location`)||e.headers.set(`Location`,e.options.href),e},this.clearCache=e=>{let t=e?.filter;t===void 0?this.__store.setState(e=>({...e,cachedMatches:[]})):this.__store.setState(e=>({...e,cachedMatches:e.cachedMatches.filter(e=>!t(e))}))},this.clearExpiredCache=()=>{this.clearCache({filter:e=>{let t=this.looseRoutesById[e.routeId];if(!t.options.loader)return!0;let n=(e.preload?t.options.preloadGcTime??this.options.defaultPreloadGcTime:t.options.gcTime??this.options.defaultGcTime)??300*1e3;return e.status===`error`?!0:Date.now()-e.updatedAt>=n}})},this.loadRouteChunk=Ot,this.preloadRoute=async e=>{let t=this.buildLocation(e),n=this.matchRoutes(t,{throwOnError:!0,preload:!0,dest:e}),r=new Set([...this.state.matches,...this.state.pendingMatches??[]].map(e=>e.id)),i=new Set([...r,...this.state.cachedMatches.map(e=>e.id)]);Xe(()=>{n.forEach(e=>{i.has(e.id)||this.__store.setState(t=>({...t,cachedMatches:[...t.cachedMatches,e]}))})});try{return n=await Dt({router:this,matches:n,location:t,preload:!0,updateMatch:(e,t)=>{r.has(e)?n=n.map(n=>n.id===e?t(n):n):this.updateMatch(e,t)}}),n}catch(e){if(se(e))return e.options.reloadDocument?void 0:await this.preloadRoute({...e.options,_fromLocation:t});k(e)||console.error(e);return}},this.matchRoute=(e,t)=>{let n={...e,to:e.to?this.resolvePathWithBase(e.from||``,e.to):void 0,params:e.params||{},leaveParams:!0},r=this.buildLocation(n);if(t?.pending&&this.state.status!==`pending`)return!1;let i=(t?.pending===void 0?!this.state.isLoading:t.pending)?this.latestLocation:this.state.resolvedLocation||this.state.location,a=E(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,i.pathname,this.processedTree);return!a||e.params&&!u(a.rawParams,e.params,{partial:!0})?!1:t?.includeSearch??!0?u(i.search,r.search,{partial:!0})?a.rawParams:!1:a.rawParams},this.hasNotFoundMatch=()=>this.__store.state.matches.some(e=>e.status===`notFound`||e.globalNotFound),this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...t,caseSensitive:t.caseSensitive??!1,notFoundMode:t.notFoundMode??`fuzzy`,stringifySearch:t.stringifySearch??lt,parseSearch:t.parseSearch??ct}),typeof document<`u`&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.__store.state}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;let r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}get looseRoutesById(){return this.routesById}getParentContext(e){return e?.id?e.context??this.options.context??void 0:this.options.context??void 0}matchRoutesInternal(e,t){let n=this.getMatchedRoutes(e.pathname),{foundRoute:r,routeParams:i,parsedParams:a}=n,{matchedRoutes:s}=n,l=!1;(r?r.path!==`/`&&i[`**`]:y(e.pathname))&&(this.options.notFoundRoute?s=[...s,this.options.notFoundRoute]:l=!0);let u=l?Gt(this.options.notFoundMode,s):void 0,d=Array(s.length),f=new Map(this.state.matches.map(e=>[e.routeId,e]));for(let n=0;n<s.length;n++){let r=s[n],l=d[n-1],p,m,h;{let n=l?.search??e.search,i=l?._strictSearch??void 0;try{let e=Vt(r.options.validateSearch,{...n})??void 0;p={...n,...e},m={...i,...e},h=void 0}catch(e){let r=e;if(e instanceof Rt||(r=new Rt(e.message,{cause:e})),t?.throwOnError)throw r;p=n,m={},h=r}}let g=r.options.loaderDeps?.({search:p})??``,_=g?JSON.stringify(g):``,{interpolatedPath:v,usedParams:y}=ee({path:r.fullPath,params:i,decoder:this.pathParamsDecoder,server:this.isServer}),b=r.id+v+_,x=this.getMatch(b),S=f.get(r.id),C=x?._strictParams??y,w;if(!x)try{Kt(r,y,a,C)}catch(e){if(w=k(e)||se(e)?e:new zt(e.message,{cause:e}),t?.throwOnError)throw w}Object.assign(i,C);let E=S?`stay`:`enter`,D;if(x)D={...x,cause:E,params:S?.params??i,_strictParams:C,search:c(S?S.search:x.search,p),_strictSearch:m};else{let e=r.options.loader||r.options.beforeLoad||r.lazyFn||kt(r)?`pending`:`success`;D={id:b,ssr:r.options.ssr,index:n,routeId:r.id,params:S?.params??i,_strictParams:C,pathname:v,updatedAt:Date.now(),search:S?c(S.search,p):p,_strictSearch:m,searchError:void 0,status:e,isFetching:!1,error:void 0,paramsError:w,__routeContext:void 0,_nonReactive:{loadPromise:o()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:E,loaderDeps:S?c(S.loaderDeps,g):g,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:r.options.staticData||{},fullPath:r.fullPath}}t?.preload||(D.globalNotFound=u===r.id),D.searchError=h;let te=this.getParentContext(l);D.context={...te,...D.__routeContext,...D.__beforeLoadContext},d[n]=D}for(let t=0;t<d.length;t++){let n=d[t],r=this.looseRoutesById[n.routeId],a=this.getMatch(n.id),o=f.get(n.routeId);if(n.params=o?c(o.params,i):i,!a){let i=d[t-1],a=this.getParentContext(i);if(r.options.context){let t={deps:n.loaderDeps,params:n.params,context:a??{},location:e,navigate:t=>this.navigate({...t,_fromLocation:e}),buildLocation:this.buildLocation,cause:n.cause,abortController:n.abortController,preload:!!n.preload,matches:d,routeId:r.id};n.__routeContext=r.options.context(t)??void 0}n.context={...a,...n.__routeContext,...n.__beforeLoadContext}}}return d}matchRoutesLightweight(e){let{matchedRoutes:t,routeParams:n,parsedParams:r}=this.getMatchedRoutes(e.pathname),i=d(t),a={...e.search};for(let e of t)try{Object.assign(a,Vt(e.options.validateSearch,a))}catch{}let o=d(this.state.matches),s=o&&o.routeId===i.id&&e.pathname===this.state.location.pathname,c;if(s)c=o.params;else{let e={...n};for(let i of t)try{Kt(i,n,r??{},e)}catch{}c=e}return{matchedRoutes:t,fullPath:i.fullPath,search:a,params:c}}},Rt=class extends Error{},zt=class extends Error{};function Bt(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:`idle`,resolvedLocation:void 0,location:e,matches:[],pendingMatches:[],cachedMatches:[],statusCode:200}}function Vt(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new Rt(`Async validation not supported`);if(n.issues)throw new Rt(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return`parse`in e?e.parse(t):typeof e==`function`?e(t):{}}function Ht({pathname:e,routesById:t,processedTree:n}){let r={},i=y(e),a,o,s=te(i,n,!0);return s&&(a=s.route,Object.assign(r,s.rawParams),o=Object.assign({},s.parsedParams)),{matchedRoutes:s?.branch||[t.__root__],routeParams:r,foundRoute:a,parsedParams:o}}function Ut({search:e,dest:t,destRoutes:n,_includeValidateSearch:r}){return Wt(n)(e,t,r??!1)}function Wt(e){let t={dest:null,_includeValidateSearch:!1,middlewares:[]};for(let n of e)`search`in n.options?n.options.search?.middlewares&&t.middlewares.push(...n.options.search.middlewares):(n.options.preSearchFilters||n.options.postSearchFilters)&&t.middlewares.push(({search:e,next:t})=>{let r=e;`preSearchFilters`in n.options&&n.options.preSearchFilters&&(r=n.options.preSearchFilters.reduce((e,t)=>t(e),e));let i=t(r);return`postSearchFilters`in n.options&&n.options.postSearchFilters?n.options.postSearchFilters.reduce((e,t)=>t(e),i):i}),n.options.validateSearch&&t.middlewares.push(({search:e,next:r})=>{let i=r(e);if(!t._includeValidateSearch)return i;try{return{...i,...Vt(n.options.validateSearch,i)??void 0}}catch{return i}});t.middlewares.push(({search:e})=>{let n=t.dest;return n.search?n.search===!0?e:s(n.search,e):{}});let n=(e,t,r)=>{if(e>=r.length)return t;let i=r[e];return i({search:t,next:t=>n(e+1,t,r)})};return function(e,r,i){return t.dest=r,t._includeValidateSearch=i,n(0,e,t.middlewares)}}function Gt(e,t){if(e!==`root`)for(let e=t.length-1;e>=0;e--){let n=t[e];if(n.children)return n.id}return j}function Kt(e,t,n,r){let i=e.options.params?.parse??e.options.parseParams;if(i)if(e.options.skipRouteOnParseError)for(let e in t)e in n&&(r[e]=n[e]);else{let e=i(r);Object.assign(r,e)}}var qt=Symbol.for(`TSR_DEFERRED_PROMISE`);function Jt(e,t){let n=e;return n[qt]?n:(n[qt]={status:`pending`},n.then(e=>{n[qt].status=`success`,n[qt].data=e}).catch(e=>{n[qt].status=`error`,n[qt].error={data:(t?.serializeError??Ft)(e),__isServerError:!0}}),n)}var Yt=class{constructor(e){if(this.init=e=>{this.originalIndex=e.originalIndex;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=j:this.parentRoute||l(!1,`Child Route instances must pass a 'getParentRoute: () => ParentRoute' option that returns a Route instance.`);let r=n?j:t?.path;r&&r!==`/`&&(r=ie(r));let i=t?.id||r,a=n?j:O([this.parentRoute.id===`__root__`?``:this.parentRoute.id,i]);r===`__root__`&&(r=`/`),a!==`__root__`&&(a=O([`/`,a]));let o=a===`__root__`?`/`:O([this.parentRoute.fullPath,r]);this._path=r,this._id=a,this._fullPath=o,this._to=y(o)},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e==`object`&&e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.redirect=e=>oe({from:this.fullPath,...e}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}},Xt=class extends Yt{constructor(e){super(e)}},Zt=(e=>(e[e.AggregateError=1]=`AggregateError`,e[e.ArrowFunction=2]=`ArrowFunction`,e[e.ErrorPrototypeStack=4]=`ErrorPrototypeStack`,e[e.ObjectAssign=8]=`ObjectAssign`,e[e.BigIntTypedArray=16]=`BigIntTypedArray`,e[e.RegExp=32]=`RegExp`,e))(Zt||{}),Qt=Symbol.asyncIterator,$t=Symbol.hasInstance,en=Symbol.isConcatSpreadable,tn=Symbol.iterator,nn=Symbol.match,rn=Symbol.matchAll,an=Symbol.replace,on=Symbol.search,sn=Symbol.species,cn=Symbol.split,ln=Symbol.toPrimitive,un=Symbol.toStringTag,dn=Symbol.unscopables,fn={[Qt]:0,[$t]:1,[en]:2,[tn]:3,[nn]:4,[rn]:5,[an]:6,[on]:7,[sn]:8,[cn]:9,[ln]:10,[un]:11,[dn]:12},pn={0:Qt,1:$t,2:en,3:tn,4:nn,5:rn,6:an,7:on,8:sn,9:cn,10:ln,11:un,12:dn},M=void 0,mn={2:!0,3:!1,1:M,0:null,4:-0,5:1/0,6:-1/0,7:NaN},hn={0:`Error`,1:`EvalError`,2:`RangeError`,3:`ReferenceError`,4:`SyntaxError`,5:`TypeError`,6:`URIError`},gn={0:Error,1:EvalError,2:RangeError,3:ReferenceError,4:SyntaxError,5:TypeError,6:URIError};function N(e,t,n,r,i,a,o,s,c,l,u,d){return{t:e,i:t,s:n,c:r,m:i,p:a,e:o,a:s,f:c,b:l,o:u,l:d}}function _n(e){return N(2,M,e,M,M,M,M,M,M,M,M,M)}var vn=_n(2),yn=_n(3),bn=_n(1),xn=_n(0),Sn=_n(4),Cn=_n(5),wn=_n(6),Tn=_n(7);function En(e){switch(e){case`"`:return`\\"`;case`\\`:return`\\\\`;case`
|
|
3
3
|
`:return`\\n`;case`\r`:return`\\r`;case`\b`:return`\\b`;case` `:return`\\t`;case`\f`:return`\\f`;case`<`:return`\\x3C`;case`\u2028`:return`\\u2028`;case`\u2029`:return`\\u2029`;default:return M}}function Dn(e){let t=``,n=0,r;for(let i=0,a=e.length;i<a;i++)r=En(e[i]),r&&(t+=e.slice(n,i)+r,n=i+1);return n===0?t=e:t+=e.slice(n),t}function On(e){switch(e){case`\\\\`:return`\\`;case`\\"`:return`"`;case`\\n`:return`
|
|
4
4
|
`;case`\\r`:return`\r`;case`\\b`:return`\b`;case`\\t`:return` `;case`\\f`:return`\f`;case`\\x3C`:return`<`;case`\\u2028`:return`\u2028`;case`\\u2029`:return`\u2029`;default:return e}}function kn(e){return e.replace(/(\\\\|\\"|\\n|\\r|\\b|\\t|\\f|\\u2028|\\u2029|\\x3C)/g,On)}var An=`__SEROVAL_REFS__`,jn=new Map,Mn=new Map;function Nn(e){return jn.has(e)}function Pn(e){return Mn.has(e)}function Fn(e){if(Nn(e))return jn.get(e);throw new Cr(e)}function In(e){if(Pn(e))return Mn.get(e);throw new wr(e)}typeof globalThis<`u`?Object.defineProperty(globalThis,An,{value:Mn,configurable:!0,writable:!1,enumerable:!1}):typeof window<`u`?Object.defineProperty(window,An,{value:Mn,configurable:!0,writable:!1,enumerable:!1}):typeof self<`u`?Object.defineProperty(self,An,{value:Mn,configurable:!0,writable:!1,enumerable:!1}):typeof global<`u`&&Object.defineProperty(global,An,{value:Mn,configurable:!0,writable:!1,enumerable:!1});function Ln(e){return e instanceof EvalError?1:e instanceof RangeError?2:e instanceof ReferenceError?3:e instanceof SyntaxError?4:e instanceof TypeError?5:e instanceof URIError?6:0}function Rn(e){let t=hn[Ln(e)];return e.name===t?e.constructor.name===t?{}:{name:e.constructor.name}:{name:e.name}}function zn(e,t){let n=Rn(e),r=Object.getOwnPropertyNames(e);for(let i=0,a=r.length,o;i<a;i++)o=r[i],o!==`name`&&o!==`message`&&(o===`stack`?t&4&&(n||={},n[o]=e[o]):(n||={},n[o]=e[o]));return n}function Bn(e){return Object.isFrozen(e)?3:Object.isSealed(e)?2:+!Object.isExtensible(e)}function Vn(e){switch(e){case 1/0:return Cn;case-1/0:return wn}return e===e?Object.is(e,-0)?Sn:N(0,M,e,M,M,M,M,M,M,M,M,M):Tn}function Hn(e){return N(1,M,Dn(e),M,M,M,M,M,M,M,M,M)}function Un(e){return N(3,M,``+e,M,M,M,M,M,M,M,M,M)}function Wn(e){return N(4,e,M,M,M,M,M,M,M,M,M,M)}function Gn(e,t){let n=t.valueOf();return N(5,e,n===n?t.toISOString():``,M,M,M,M,M,M,M,M,M)}function Kn(e,t){return N(6,e,M,Dn(t.source),t.flags,M,M,M,M,M,M,M)}function qn(e,t){return N(17,e,fn[t],M,M,M,M,M,M,M,M,M)}function Jn(e,t){return N(18,e,Dn(Fn(t)),M,M,M,M,M,M,M,M,M)}function Yn(e,t,n){return N(25,e,n,Dn(t),M,M,M,M,M,M,M,M)}function Xn(e,t,n){return N(9,e,M,M,M,M,M,n,M,M,Bn(t),M)}function Zn(e,t){return N(21,e,M,M,M,M,M,M,t,M,M,M)}function Qn(e,t,n){return N(15,e,M,t.constructor.name,M,M,M,M,n,t.byteOffset,M,t.length)}function $n(e,t,n){return N(16,e,M,t.constructor.name,M,M,M,M,n,t.byteOffset,M,t.byteLength)}function er(e,t,n){return N(20,e,M,M,M,M,M,M,n,t.byteOffset,M,t.byteLength)}function tr(e,t,n){return N(13,e,Ln(t),M,Dn(t.message),n,M,M,M,M,M,M)}function nr(e,t,n){return N(14,e,Ln(t),M,Dn(t.message),n,M,M,M,M,M,M)}function rr(e,t){return N(7,e,M,M,M,M,M,t,M,M,M,M)}function ir(e,t){return N(28,M,M,M,M,M,M,[e,t],M,M,M,M)}function ar(e,t){return N(30,M,M,M,M,M,M,[e,t],M,M,M,M)}function or(e,t,n){return N(31,e,M,M,M,M,M,n,t,M,M,M)}function sr(e,t){return N(32,e,M,M,M,M,M,M,t,M,M,M)}function cr(e,t){return N(33,e,M,M,M,M,M,M,t,M,M,M)}function lr(e,t){return N(34,e,M,M,M,M,M,M,t,M,M,M)}function ur(e,t,n,r){return N(35,e,n,M,M,M,M,t,M,M,M,r)}var{toString:dr}=Object.prototype,fr={parsing:1,serialization:2,deserialization:3};function pr(e){return`Seroval Error (step: ${fr[e]})`}var mr=(e,t)=>pr(e),hr=class extends Error{constructor(e,t){super(mr(e,t)),this.cause=t}},gr=class extends hr{constructor(e){super(`parsing`,e)}},_r=class extends hr{constructor(e){super(`deserialization`,e)}};function vr(e){return`Seroval Error (specific: ${e})`}var yr=class extends Error{constructor(e){super(vr(1)),this.value=e}},br=class extends Error{constructor(e){super(vr(2))}},xr=class extends Error{constructor(e){super(vr(3))}},Sr=class extends Error{constructor(e){super(vr(4))}},Cr=class extends Error{constructor(e){super(vr(5)),this.value=e}},wr=class extends Error{constructor(e){super(vr(6))}},Tr=class extends Error{constructor(e){super(vr(7))}},Er=class extends Error{constructor(e){super(vr(8))}},Dr=class extends Error{constructor(e){super(vr(9))}},Or=class{constructor(e,t){this.value=e,this.replacement=t}},kr=()=>{let e={p:0,s:0,f:0};return e.p=new Promise((t,n)=>{e.s=t,e.f=n}),e};kr.toString(),((e,t)=>{e.s(t),e.p.s=1,e.p.v=t}).toString(),((e,t)=>{e.f(t),e.p.s=2,e.p.v=t}).toString();var Ar=()=>{let e=[],t=[],n=!0,r=!1,i=0,a=(e,n,r)=>{for(r=0;r<i;r++)t[r]&&t[r][n](e)},o=(t,i,a,o)=>{for(i=0,a=e.length;i<a;i++)o=e[i],!n&&i===a-1?t[r?`return`:`throw`](o):t.next(o)},s=(e,r)=>(n&&(r=i++,t[r]=e),o(e),()=>{n&&(t[r]=t[i],t[i--]=void 0)});return{__SEROVAL_STREAM__:!0,on:e=>s(e),next:t=>{n&&(e.push(t),a(t,`next`))},throw:i=>{n&&(e.push(i),a(i,`throw`),n=!1,r=!1,t.length=0)},return:i=>{n&&(e.push(i),a(i,`return`),n=!1,r=!0,t.length=0)}}};Ar.toString();var jr=e=>t=>()=>{let n=0,r={[e]:()=>r,next:()=>{if(n>t.d)return{done:!0,value:void 0};let e=n++,r=t.v[e];if(e===t.t)throw r;return{done:e===t.d,value:r}}};return r};jr.toString();var Mr=(e,t)=>n=>()=>{let r=0,i=-1,a=!1,o=[],s=[],c=(e=0,t=s.length)=>{for(;e<t;e++)s[e].s({done:!0,value:void 0})};n.on({next:e=>{let t=s.shift();t&&t.s({done:!1,value:e}),o.push(e)},throw:e=>{let t=s.shift();t&&t.f(e),c(),i=o.length,a=!0,o.push(e)},return:e=>{let t=s.shift();t&&t.s({done:!0,value:e}),c(),i=o.length,o.push(e)}});let l={[e]:()=>l,next:()=>{if(i===-1){let e=r++;if(e>=o.length){let e=t();return s.push(e),e.p}return{done:!1,value:o[e]}}if(r>i)return{done:!0,value:void 0};let e=r++,n=o[e];if(e!==i)return{done:!1,value:n};if(a)throw n;return{done:!0,value:n}}};return l};Mr.toString();var Nr=e=>{let t=atob(e),n=t.length,r=new Uint8Array(n);for(let e=0;e<n;e++)r[e]=t.charCodeAt(e);return r.buffer};Nr.toString();function Pr(e){return`__SEROVAL_SEQUENCE__`in e}function Fr(e,t,n){return{__SEROVAL_SEQUENCE__:!0,v:e,t,d:n}}function Ir(e){let t=[],n=-1,r=-1,i=e[tn]();for(;;)try{let e=i.next();if(t.push(e.value),e.done){r=t.length-1;break}}catch(e){n=t.length,t.push(e)}return Fr(t,n,r)}var Lr=jr(tn);function Rr(e){return Lr(e)}var zr={},Br={},Vr={0:{},1:{},2:{},3:{},4:{},5:{}};function Hr(e){return`__SEROVAL_STREAM__`in e}function Ur(){return Ar()}function Wr(e){let t=Ur(),n=e[Qt]();async function r(){try{let e=await n.next();e.done?t.return(e.value):(t.next(e.value),await r())}catch(e){t.throw(e)}}return r().catch(()=>{}),t}var Gr=Mr(Qt,kr);function Kr(e){return Gr(e)}async function qr(e){try{return[1,await e]}catch(e){return[0,e]}}function Jr(e,t){return{plugins:t.plugins,mode:e,marked:new Set,features:63^(t.disabledFeatures||0),refs:t.refs||new Map,depthLimit:t.depthLimit||1e3}}function Yr(e,t){e.marked.add(t)}function Xr(e,t){let n=e.refs.size;return e.refs.set(t,n),n}function Zr(e,t){let n=e.refs.get(t);return n==null?{type:0,value:Xr(e,t)}:(Yr(e,n),{type:1,value:Wn(n)})}function Qr(e,t){let n=Zr(e,t);return n.type===1?n:Nn(t)?{type:2,value:Jn(n.value,t)}:n}function $r(e,t){let n=Qr(e,t);if(n.type!==0)return n.value;if(t in fn)return qn(n.value,t);throw new yr(t)}function ei(e,t){let n=Zr(e,Vr[t]);return n.type===1?n.value:N(26,n.value,t,M,M,M,M,M,M,M,M,M)}function ti(e){let t=Zr(e,zr);return t.type===1?t.value:N(27,t.value,M,M,M,M,M,M,$r(e,tn),M,M,M)}function ni(e){let t=Zr(e,Br);return t.type===1?t.value:N(29,t.value,M,M,M,M,M,[ei(e,1),$r(e,Qt)],M,M,M,M)}function ri(e,t,n,r){return N(n?11:10,e,M,M,M,r,M,M,M,M,Bn(t),M)}function ii(e,t,n,r){return N(8,t,M,M,M,M,{k:n,v:r},M,ei(e,0),M,M,M)}function ai(e,t,n){let r=new Uint8Array(n),i=``;for(let e=0,t=r.length;e<t;e++)i+=String.fromCharCode(r[e]);return N(19,t,Dn(btoa(i)),M,M,M,M,M,ei(e,5),M,M,M)}function oi(e,t){return{base:Jr(e,t),child:void 0}}var si=class{constructor(e,t){this._p=e,this.depth=t}parse(e){return P(this._p,this.depth,e)}};async function ci(e,t,n){let r=[];for(let i=0,a=n.length;i<a;i++)i in n?r[i]=await P(e,t,n[i]):r[i]=0;return r}async function li(e,t,n,r){return Xn(n,r,await ci(e,t,r))}async function ui(e,t,n){let r=Object.entries(n),i=[],a=[];for(let n=0,o=r.length;n<o;n++)i.push(Dn(r[n][0])),a.push(await P(e,t,r[n][1]));return tn in n&&(i.push($r(e.base,tn)),a.push(ir(ti(e.base),await P(e,t,Ir(n))))),Qt in n&&(i.push($r(e.base,Qt)),a.push(ar(ni(e.base),await P(e,t,Wr(n))))),un in n&&(i.push($r(e.base,un)),a.push(Hn(n[un]))),en in n&&(i.push($r(e.base,en)),a.push(n[en]?vn:yn)),{k:i,v:a}}async function di(e,t,n,r,i){return ri(n,r,i,await ui(e,t,r))}async function fi(e,t,n,r){return Zn(n,await P(e,t,r.valueOf()))}async function pi(e,t,n,r){return Qn(n,r,await P(e,t,r.buffer))}async function mi(e,t,n,r){return $n(n,r,await P(e,t,r.buffer))}async function hi(e,t,n,r){return er(n,r,await P(e,t,r.buffer))}async function gi(e,t,n,r){let i=zn(r,e.base.features);return tr(n,r,i?await ui(e,t,i):M)}async function _i(e,t,n,r){let i=zn(r,e.base.features);return nr(n,r,i?await ui(e,t,i):M)}async function vi(e,t,n,r){let i=[],a=[];for(let[n,o]of r.entries())i.push(await P(e,t,n)),a.push(await P(e,t,o));return ii(e.base,n,i,a)}async function yi(e,t,n,r){let i=[];for(let n of r.keys())i.push(await P(e,t,n));return rr(n,i)}async function bi(e,t,n,r){let i=e.base.plugins;if(i)for(let a=0,o=i.length;a<o;a++){let o=i[a];if(o.parse.async&&o.test(r))return Yn(n,o.tag,await o.parse.async(r,new si(e,t),{id:n}))}return M}async function xi(e,t,n,r){let[i,a]=await qr(r);return N(12,n,i,M,M,M,M,M,await P(e,t,a),M,M,M)}function Si(e,t,n,r,i){let a=[],o=n.on({next:n=>{Yr(this.base,t),P(this,e,n).then(e=>{a.push(sr(t,e))},e=>{i(e),o()})},throw:n=>{Yr(this.base,t),P(this,e,n).then(e=>{a.push(cr(t,e)),r(a),o()},e=>{i(e),o()})},return:n=>{Yr(this.base,t),P(this,e,n).then(e=>{a.push(lr(t,e)),r(a),o()},e=>{i(e),o()})}})}async function Ci(e,t,n,r){return or(n,ei(e.base,4),await new Promise(Si.bind(e,t,n,r)))}async function wi(e,t,n,r){let i=[];for(let n=0,a=r.v.length;n<a;n++)i[n]=await P(e,t,r.v[n]);return ur(n,i,r.t,r.d)}async function Ti(e,t,n,r){if(Array.isArray(r))return li(e,t,n,r);if(Hr(r))return Ci(e,t,n,r);if(Pr(r))return wi(e,t,n,r);let i=r.constructor;if(i===Or)return P(e,t,r.replacement);let a=await bi(e,t,n,r);if(a)return a;switch(i){case Object:return di(e,t,n,r,!1);case M:return di(e,t,n,r,!0);case Date:return Gn(n,r);case Error:case EvalError:case RangeError:case ReferenceError:case SyntaxError:case TypeError:case URIError:return gi(e,t,n,r);case Number:case Boolean:case String:case BigInt:return fi(e,t,n,r);case ArrayBuffer:return ai(e.base,n,r);case Int8Array:case Int16Array:case Int32Array:case Uint8Array:case Uint16Array:case Uint32Array:case Uint8ClampedArray:case Float32Array:case Float64Array:return pi(e,t,n,r);case DataView:return hi(e,t,n,r);case Map:return vi(e,t,n,r);case Set:return yi(e,t,n,r);default:break}if(i===Promise||r instanceof Promise)return xi(e,t,n,r);let o=e.base.features;if(o&32&&i===RegExp)return Kn(n,r);if(o&16)switch(i){case BigInt64Array:case BigUint64Array:return mi(e,t,n,r);default:break}if(o&1&&typeof AggregateError<`u`&&(i===AggregateError||r instanceof AggregateError))return _i(e,t,n,r);if(r instanceof Error)return gi(e,t,n,r);if(tn in r||Qt in r)return di(e,t,n,r,!!i);throw new yr(r)}async function Ei(e,t,n){let r=Qr(e.base,n);if(r.type!==0)return r.value;let i=await bi(e,t,r.value,n);if(i)return i;throw new yr(n)}async function P(e,t,n){switch(typeof n){case`boolean`:return n?vn:yn;case`undefined`:return bn;case`string`:return Hn(n);case`number`:return Vn(n);case`bigint`:return Un(n);case`object`:if(n){let r=Qr(e.base,n);return r.type===0?await Ti(e,t+1,r.value,n):r.value}return xn;case`symbol`:return $r(e.base,n);case`function`:return Ei(e,t,n);default:throw new yr(n)}}async function Di(e,t){try{return await P(e,0,t)}catch(e){throw e instanceof gr?e:new gr(e)}}var Oi=(e=>(e[e.Vanilla=1]=`Vanilla`,e[e.Cross=2]=`Cross`,e))(Oi||{});function ki(e){return e}function Ai(e,t){for(let n=0,r=t.length;n<r;n++){let r=t[n];e.has(r)||(e.add(r),r.extends&&Ai(e,r.extends))}}function ji(e){if(e){let t=new Set;return Ai(t,e),[...t]}}function Mi(e){switch(e){case`Int8Array`:return Int8Array;case`Int16Array`:return Int16Array;case`Int32Array`:return Int32Array;case`Uint8Array`:return Uint8Array;case`Uint16Array`:return Uint16Array;case`Uint32Array`:return Uint32Array;case`Uint8ClampedArray`:return Uint8ClampedArray;case`Float32Array`:return Float32Array;case`Float64Array`:return Float64Array;case`BigInt64Array`:return BigInt64Array;case`BigUint64Array`:return BigUint64Array;default:throw new Tr(e)}}var Ni=1e6,Pi=1e4,Fi=2e4;function Ii(e,t){switch(t){case 3:return Object.freeze(e);case 1:return Object.preventExtensions(e);case 2:return Object.seal(e);default:return e}}var Li=1e3;function F(e,t){let n=t.refs||new Map;return`types`in n||Object.assign(n,{types:new Map}),{mode:e,plugins:t.plugins,refs:n,features:t.features??63^(t.disabledFeatures||0),depthLimit:t.depthLimit||Li}}function I(e){return{mode:2,base:F(2,e),child:M}}var Ri=class{constructor(e,t){this._p=e,this.depth=t}deserialize(e){return L(this._p,this.depth,e)}};function zi(e,t){if(t<0||!Number.isFinite(t)||!Number.isInteger(t))throw new Er({t:4,i:t});if(e.refs.has(t))throw Error(`Conflicted ref id: `+t)}function Bi(e,t,n){return zi(e.base,t),e.state.marked.has(t)&&e.base.refs.set(t,n),n}function Vi(e,t,n){return zi(e.base,t),e.base.refs.set(t,n),n}function Hi(e,t,n){return e.mode===1?Bi(e,t,n):Vi(e,t,n)}function Ui(e,t,n){if(Object.hasOwn(t,n))return t[n];throw new Er(e)}function Wi(e,t){return Hi(e,t.i,In(kn(t.s)))}function Gi(e,t,n){let r=n.a,i=r.length,a=Hi(e,n.i,Array(i));for(let n=0,o;n<i;n++)o=r[n],o&&(a[n]=L(e,t,o));return Ii(a,n.o),a}function Ki(e){switch(e){case`constructor`:case`__proto__`:case`prototype`:case`__defineGetter__`:case`__defineSetter__`:case`__lookupGetter__`:case`__lookupSetter__`:return!1;default:return!0}}function qi(e){switch(e){case Qt:case en:case un:case tn:return!0;default:return!1}}function Ji(e,t,n){Ki(t)?e[t]=n:Object.defineProperty(e,t,{value:n,configurable:!0,enumerable:!0,writable:!0})}function Yi(e,t,n,r,i){if(typeof r==`string`)Ji(n,kn(r),L(e,t,i));else{let a=L(e,t,r);switch(typeof a){case`string`:Ji(n,a,L(e,t,i));break;case`symbol`:qi(a)&&(n[a]=L(e,t,i));break;default:throw new Er(r)}}}function Xi(e,t,n){e.base.refs.types.set(t,n)}function Zi(e,t,n,r){if(e.base.refs.types.get(n)!==r)throw new Er(t)}function Qi(e,t,n,r){let i=n.k;if(i.length>0)for(let a=0,o=n.v,s=i.length;a<s;a++)Yi(e,t,r,i[a],o[a]);return r}function $i(e,t,n){let r=Hi(e,n.i,n.t===10?{}:Object.create(null));return Qi(e,t,n.p,r),Ii(r,n.o),r}function ea(e,t){return Hi(e,t.i,new Date(t.s))}function ta(e,t){if(e.base.features&32){let n=kn(t.c);if(n.length>Fi)throw new Er(t);return Hi(e,t.i,new RegExp(n,t.m))}throw new br(t)}function na(e,t,n){let r=Hi(e,n.i,new Set);for(let i=0,a=n.a,o=a.length;i<o;i++)r.add(L(e,t,a[i]));return r}function ra(e,t,n){let r=Hi(e,n.i,new Map);for(let i=0,a=n.e.k,o=n.e.v,s=a.length;i<s;i++)r.set(L(e,t,a[i]),L(e,t,o[i]));return r}function ia(e,t){if(t.s.length>Ni)throw new Er(t);return Hi(e,t.i,Nr(kn(t.s)))}function aa(e,t,n){let r=Mi(n.c),i=L(e,t,n.f),a=n.b??0;if(a<0||a>i.byteLength)throw new Er(n);return Hi(e,n.i,new r(i,a,n.l))}function oa(e,t,n){let r=L(e,t,n.f),i=n.b??0;if(i<0||i>r.byteLength)throw new Er(n);return Hi(e,n.i,new DataView(r,i,n.l))}function sa(e,t,n,r){if(n.p){let i=Qi(e,t,n.p,{});Object.defineProperties(r,Object.getOwnPropertyDescriptors(i))}return r}function ca(e,t,n){return sa(e,t,n,Hi(e,n.i,AggregateError([],kn(n.m))))}function la(e,t,n){let r=Ui(n,gn,n.s);return sa(e,t,n,Hi(e,n.i,new r(kn(n.m))))}function ua(e,t,n){let r=kr(),i=Hi(e,n.i,r.p),a=L(e,t,n.f);return n.s?r.s(a):r.f(a),i}function da(e,t,n){return Hi(e,n.i,Object(L(e,t,n.f)))}function fa(e,t,n){let r=e.base.plugins;if(r){let i=kn(n.c);for(let a=0,o=r.length;a<o;a++){let o=r[a];if(o.tag===i)return Hi(e,n.i,o.deserialize(n.s,new Ri(e,t),{id:n.i}))}}throw new xr(n.c)}function pa(e,t){let n=Hi(e,t.i,Hi(e,t.s,kr()).p);return Xi(e,t.s,22),n}function ma(e,t,n){let r=e.base.refs.get(n.i);if(r)return Zi(e,n,n.i,22),r.s(L(e,t,n.a[1])),M;throw new Sr(`Promise`)}function ha(e,t,n){let r=e.base.refs.get(n.i);if(r)return Zi(e,n,n.i,22),r.f(L(e,t,n.a[1])),M;throw new Sr(`Promise`)}function ga(e,t,n){return L(e,t,n.a[0]),Rr(L(e,t,n.a[1]))}function _a(e,t,n){return L(e,t,n.a[0]),Kr(L(e,t,n.a[1]))}function va(e,t,n){let r=Hi(e,n.i,Ur());Xi(e,n.i,31);let i=n.a,a=i.length;if(a)for(let n=0;n<a;n++)L(e,t,i[n]);return r}function ya(e,t,n){let r=e.base.refs.get(n.i);if(r)return Zi(e,n,n.i,31),r.next(L(e,t,n.f)),M;throw new Sr(`Stream`)}function ba(e,t,n){let r=e.base.refs.get(n.i);if(r)return Zi(e,n,n.i,31),r.throw(L(e,t,n.f)),M;throw new Sr(`Stream`)}function xa(e,t,n){let r=e.base.refs.get(n.i);if(r)return Zi(e,n,n.i,31),r.return(L(e,t,n.f)),M;throw new Sr(`Stream`)}function Sa(e,t,n){return L(e,t,n.f),M}function Ca(e,t,n){return L(e,t,n.a[1]),M}function wa(e,t,n){let r=Hi(e,n.i,Fr([],n.s,n.l));for(let i=0,a=n.a.length;i<a;i++)r.v[i]=L(e,t,n.a[i]);return r}function L(e,t,n){if(t>e.base.depthLimit)throw new Dr(e.base.depthLimit);switch(t+=1,n.t){case 2:return Ui(n,mn,n.s);case 0:return Number(n.s);case 1:return kn(String(n.s));case 3:if(String(n.s).length>Pi)throw new Er(n);return BigInt(n.s);case 4:return e.base.refs.get(n.i);case 18:return Wi(e,n);case 9:return Gi(e,t,n);case 10:case 11:return $i(e,t,n);case 5:return ea(e,n);case 6:return ta(e,n);case 7:return na(e,t,n);case 8:return ra(e,t,n);case 19:return ia(e,n);case 16:case 15:return aa(e,t,n);case 20:return oa(e,t,n);case 14:return ca(e,t,n);case 13:return la(e,t,n);case 12:return ua(e,t,n);case 17:return Ui(n,pn,n.s);case 21:return da(e,t,n);case 25:return fa(e,t,n);case 22:return pa(e,n);case 23:return ma(e,t,n);case 24:return ha(e,t,n);case 28:return ga(e,t,n);case 30:return _a(e,t,n);case 31:return va(e,t,n);case 32:return ya(e,t,n);case 33:return ba(e,t,n);case 34:return xa(e,t,n);case 27:return Sa(e,t,n);case 29:return Ca(e,t,n);case 35:return wa(e,t,n);default:throw new br(n)}}function Ta(e,t){try{return L(e,0,t)}catch(e){throw new _r(e)}}var Ea=(()=>T).toString();/=>/.test(Ea);function Da(e,t){return Ta(I({plugins:ji(t.plugins),refs:t.refs,features:t.features,disabledFeatures:t.disabledFeatures,depthLimit:t.depthLimit}),e)}async function Oa(e,t={}){let n=oi(1,{plugins:ji(t.plugins),disabledFeatures:t.disabledFeatures});return{t:await Di(n,e),f:n.base.features,m:Array.from(n.base.marked)}}function ka(e){return e}function Aa(e){return ki({tag:`$TSR/t/`+e.key,test:e.test,parse:{sync(t,n){return n.parse(e.toSerializable(t))},async async(t,n){return await n.parse(e.toSerializable(t))},stream(t,n){return n.parse(e.toSerializable(t))}},serialize:void 0,deserialize(t,n){return e.fromSerializable(n.deserialize(t))}})}var ja={},Ma=e=>new ReadableStream({start:t=>{e.on({next:e=>{try{t.enqueue(e)}catch{}},throw:e=>{t.error(e)},return:()=>{try{t.close()}catch{}}})}}),Na=ki({tag:`seroval-plugins/web/ReadableStreamFactory`,test(e){return e===ja},parse:{sync(){return ja},async async(){return await Promise.resolve(ja)},stream(){return ja}},serialize(){return Ma.toString()},deserialize(){return ja}});function Pa(e){let t=Ur(),n=e.getReader();async function r(){try{let e=await n.read();e.done?t.return(e.value):(t.next(e.value),await r())}catch(e){t.throw(e)}}return r().catch(()=>{}),t}var Fa=ki({tag:`seroval/plugins/web/ReadableStream`,extends:[Na],test(e){return typeof ReadableStream>`u`?!1:e instanceof ReadableStream},parse:{sync(e,t){return{factory:t.parse(ja),stream:t.parse(Ur())}},async async(e,t){return{factory:await t.parse(ja),stream:await t.parse(Pa(e))}},stream(e,t){return{factory:t.parse(ja),stream:t.parse(Pa(e))}}},serialize(e,t){return`(`+t.serialize(e.factory)+`)(`+t.serialize(e.stream)+`)`},deserialize(e,t){return Ma(t.deserialize(e.stream))}}),Ia=ki({tag:`$TSR/Error`,test(e){return e instanceof Error},parse:{sync(e,t){return{message:t.parse(e.message)}},async async(e,t){return{message:await t.parse(e.message)}},stream(e,t){return{message:t.parse(e.message)}}},serialize(e,t){return`new Error(`+t.serialize(e.message)+`)`},deserialize(e,t){return Error(t.deserialize(e.message))}}),La=class{constructor(e,t){this.stream=e,this.hint=t?.hint??`binary`}},Ra=globalThis.Buffer,za=!!Ra&&typeof Ra.from==`function`;function Ba(e){if(e.length===0)return``;if(za)return Ra.from(e).toString(`base64`);let t=32768,n=[];for(let r=0;r<e.length;r+=t){let i=e.subarray(r,r+t);n.push(String.fromCharCode.apply(null,i))}return btoa(n.join(``))}function Va(e){if(e.length===0)return new Uint8Array;if(za){let t=Ra.from(e,`base64`);return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}var Ha=Object.create(null),Ua=Object.create(null),Wa=e=>new ReadableStream({start(t){e.on({next(e){try{t.enqueue(Va(e))}catch{}},throw(e){t.error(e)},return(){try{t.close()}catch{}}})}}),Ga=new TextEncoder,Ka=e=>new ReadableStream({start(t){e.on({next(e){try{typeof e==`string`?t.enqueue(Ga.encode(e)):t.enqueue(Va(e.$b64))}catch{}},throw(e){t.error(e)},return(){try{t.close()}catch{}}})}}),qa=`(s=>new ReadableStream({start(c){s.on({next(b){try{const d=atob(b),a=new Uint8Array(d.length);for(let i=0;i<d.length;i++)a[i]=d.charCodeAt(i);c.enqueue(a)}catch(_){}},throw(e){c.error(e)},return(){try{c.close()}catch(_){}}})}}))`,Ja=`(s=>{const e=new TextEncoder();return new ReadableStream({start(c){s.on({next(v){try{if(typeof v==='string'){c.enqueue(e.encode(v))}else{const d=atob(v.$b64),a=new Uint8Array(d.length);for(let i=0;i<d.length;i++)a[i]=d.charCodeAt(i);c.enqueue(a)}}catch(_){}},throw(x){c.error(x)},return(){try{c.close()}catch(_){}}})}})})`;function Ya(e){let t=Ur(),n=e.getReader();return(async()=>{try{for(;;){let{done:e,value:r}=await n.read();if(e){t.return(void 0);break}t.next(Ba(r))}}catch(e){t.throw(e)}finally{n.releaseLock()}})(),t}function Xa(e){let t=Ur(),n=e.getReader(),r=new TextDecoder(`utf-8`,{fatal:!0});return(async()=>{try{for(;;){let{done:e,value:i}=await n.read();if(e){try{let e=r.decode();e.length>0&&t.next(e)}catch{}t.return(void 0);break}try{let e=r.decode(i,{stream:!0});e.length>0&&t.next(e)}catch{t.next({$b64:Ba(i)})}}}catch(e){t.throw(e)}finally{n.releaseLock()}})(),t}var Za=ki({tag:`tss/RawStream`,extends:[ki({tag:`tss/RawStreamFactory`,test(e){return e===Ha},parse:{sync(){},async(){return Promise.resolve(void 0)},stream(){}},serialize(){return qa},deserialize(){return Ha}}),ki({tag:`tss/RawStreamFactoryText`,test(e){return e===Ua},parse:{sync(){},async(){return Promise.resolve(void 0)},stream(){}},serialize(){return Ja},deserialize(){return Ua}})],test(e){return e instanceof La},parse:{sync(e,t){let n=e.hint===`text`?Ua:Ha;return{hint:e.hint,factory:t.parse(n),stream:t.parse(Ur())}},async async(e,t){let n=e.hint===`text`?Ua:Ha,r=e.hint===`text`?Xa(e.stream):Ya(e.stream);return{hint:e.hint,factory:await t.parse(n),stream:await t.parse(r)}},stream(e,t){let n=e.hint===`text`?Ua:Ha,r=e.hint===`text`?Xa(e.stream):Ya(e.stream);return{hint:e.hint,factory:t.parse(n),stream:t.parse(r)}}},serialize(e,t){return`(`+t.serialize(e.factory)+`)(`+t.serialize(e.stream)+`)`},deserialize(e,t){let n=t.deserialize(e.stream);return e.hint===`text`?Ka(n):Wa(n)}});function Qa(e){return ki({tag:`tss/RawStream`,test:()=>!1,parse:{},serialize(){throw Error(`RawStreamDeserializePlugin.serialize should not be called. Client only deserializes.`)},deserialize(t){return e(t.streamId)}})}var $a=[Ia,Za,Fa],R=a(),z=h(p(),1);function eo({promise:e}){if(fe)return fe(e);let t=Jt(e);if(t[qt].status===`pending`)throw t;if(t[qt].status===`error`)throw t[qt].error;return t[qt].data}function to(e){let t=(0,R.jsx)(no,{...e});return e.fallback?(0,R.jsx)(z.Suspense,{fallback:e.fallback,children:t}):t}function no(e){let t=eo(e);return e.children(t)}function ro(e){let t=e.errorComponent??ao;return(0,R.jsx)(io,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:r})=>n?z.createElement(t,{error:n,reset:r}):e.children})}var io=class extends z.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromProps(e){return{resetKey:e.getResetKey()}}static getDerivedStateFromError(e){return{error:e}}reset(){this.setState({error:null})}componentDidUpdate(e,t){t.error&&t.resetKey!==this.state.resetKey&&this.reset()}componentDidCatch(e,t){this.props.onCatch&&this.props.onCatch(e,t)}render(){return this.props.children({error:this.state.resetKey===this.props.getResetKey()?this.state.error:null,reset:()=>{this.reset()}})}};function ao({error:e}){let[t,n]=z.useState(!1);return(0,R.jsxs)(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[(0,R.jsx)(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),(0,R.jsx)(`button`,{style:{appearance:`none`,fontSize:`.6em`,border:`1px solid currentColor`,padding:`.1rem .2rem`,fontWeight:`bold`,borderRadius:`.25rem`},onClick:()=>n(e=>!e),children:t?`Hide Error`:`Show Error`})]}),(0,R.jsx)(`div`,{style:{height:`.25rem`}}),t?(0,R.jsx)(`div`,{children:(0,R.jsx)(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e.message?(0,R.jsx)(`code`,{children:e.message}):null})}):null]})}function oo(e){let t=z.useContext(e.from?de:ue);return D({select:n=>{let r=n.matches.find(n=>e.from?e.from===n.routeId:n.id===t);if(l(!((e.shouldThrow??!0)&&!r),`Could not find ${e.from?`an active match from "${e.from}"`:`a nearest match!`}`),r!==void 0)return e.select?e.select(r):r},structuralSharing:e.structuralSharing})}function so(e){return oo({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function co(e){let{select:t,...n}=e;return oo({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function lo(e){return oo({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function uo(e){return oo({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function fo(e){let t=ge();return z.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}var po=class extends Yt{constructor(e){super(e),this.useMatch=e=>oo({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>oo({...e,from:this.id,select:t=>e?.select?e.select(t.context):t.context}),this.useSearch=e=>uo({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>lo({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>co({...e,from:this.id}),this.useLoaderData=e=>so({...e,from:this.id}),this.useNavigate=()=>fo({from:this.fullPath}),this.Link=z.forwardRef((e,t)=>(0,R.jsx)(re,{ref:t,from:this.fullPath,...e})),this.$$typeof=Symbol.for(`react.memo`)}};function B(e){return new po(e)}var V=class extends Xt{constructor(e){super(e),this.useMatch=e=>oo({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>oo({...e,from:this.id,select:t=>e?.select?e.select(t.context):t.context}),this.useSearch=e=>uo({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>lo({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>co({...e,from:this.id}),this.useLoaderData=e=>so({...e,from:this.id}),this.useNavigate=()=>fo({from:this.fullPath}),this.Link=z.forwardRef((e,t)=>(0,R.jsx)(re,{ref:t,from:this.fullPath,...e})),this.$$typeof=Symbol.for(`react.memo`)}};function mo(e){return new V(e)}function ho(e){return typeof e==`object`?new go(e,{silent:!0}).createRoute(e):new go(e,{silent:!0}).createRoute}var go=class{constructor(e,t){this.path=e,this.createRoute=e=>{me(this.silent,`FileRoute is deprecated and will be removed in the next major version. Use the createFileRoute(path)(options) function instead.`);let t=B(e);return t.isRoot=!1,t},this.silent=t?.silent}},_o=class{constructor(e){this.useMatch=e=>oo({select:e?.select,from:this.options.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>oo({from:this.options.id,select:t=>e?.select?e.select(t.context):t.context}),this.useSearch=e=>uo({select:e?.select,structuralSharing:e?.structuralSharing,from:this.options.id}),this.useParams=e=>lo({select:e?.select,structuralSharing:e?.structuralSharing,from:this.options.id}),this.useLoaderDeps=e=>co({...e,from:this.options.id}),this.useLoaderData=e=>so({...e,from:this.options.id}),this.useNavigate=()=>fo({from:ge().routesById[this.options.id].fullPath}),this.options=e,this.$$typeof=Symbol.for(`react.memo`)}};function vo(e){return typeof e==`object`?new _o(e):t=>new _o({id:e,...t})}function yo(e,t){let r,i,a,o,s=()=>(r||=e().then(e=>{r=void 0,i=e[t??`default`]}).catch(e=>{if(a=e,n(a)&&a instanceof Error&&typeof window<`u`&&typeof sessionStorage<`u`){let e=`tanstack_router_reload:${a.message}`;sessionStorage.getItem(e)||(sessionStorage.setItem(e,`1`),o=!0)}}),r),c=function(e){if(o)throw window.location.reload(),new Promise(()=>{});if(a)throw a;if(!i)if(fe)fe(s());else throw s();return z.createElement(i,e)};return c.preload=s,c}function bo(){let e=ge(),t=z.useRef({router:e,mounted:!1}),[n,r]=z.useState(!1),{hasPendingMatches:i,isLoading:a}=D({select:e=>({isLoading:e.isLoading,hasPendingMatches:e.matches.some(e=>e.status===`pending`)}),structuralSharing:!0}),o=he(a),s=a||n||i,c=he(s),l=a||i,u=he(l);return e.startTransition=e=>{r(!0),z.startTransition(()=>{e(),r(!1)})},z.useEffect(()=>{let t=e.history.subscribe(e.load),n=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return y(e.latestLocation.publicHref)!==y(n.publicHref)&&e.commitLocation({...n,replace:!0}),()=>{t()}},[e,e.history]),pe(()=>{typeof window<`u`&&e.ssr||t.current.router===e&&t.current.mounted||(t.current={router:e,mounted:!0},(async()=>{try{await e.load()}catch(e){console.error(e)}})())},[e]),pe(()=>{o&&!a&&e.emit({type:`onLoad`,...It(e.state)})},[o,e,a]),pe(()=>{u&&!l&&e.emit({type:`onBeforeRouteMount`,...It(e.state)})},[l,u,e]),pe(()=>{if(c&&!s){let t=It(e.state);e.emit({type:`onResolved`,...t}),e.__store.setState(e=>({...e,status:`idle`,resolvedLocation:e.location})),t.hrefChanged&&st(e)}},[s,c,e]),null}function xo(e){let t=D({select:e=>`not-found-${e.location.pathname}-${e.status}`});return(0,R.jsx)(ro,{getResetKey:()=>t,onCatch:(t,n)=>{if(k(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(k(t))return e.fallback?.(t);throw t},children:e.children})}function So(){return(0,R.jsx)(`p`,{children:`Not Found`})}function Co(e){return(0,R.jsx)(R.Fragment,{children:e.children})}function wo(e,t,n){return t.options.notFoundComponent?(0,R.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,R.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,R.jsx)(So,{})}function To({children:e}){return ge(),null}function Eo(){let e=ge();if(!e.isScrollRestoring||!0)return null;let n=(e.options.getScrollRestorationKey||nt)(e.latestLocation),r=n===nt(e.latestLocation)?void 0:n,i={storageKey:Qe,shouldScrollRestoration:!0};return r&&(i.key=r),(0,R.jsx)(To,{children:`(${at.toString()})(${t(JSON.stringify(i))})`})}var Do=z.memo(function({matchId:e}){let t=ge(),n=D({select:t=>{let n=t.matches.findIndex(t=>t.id===e),r=t.matches[n];return l(r,`Could not find match for matchId "${e}". Please file an issue!`),{routeId:r.routeId,ssr:r.ssr,_displayPending:r._displayPending,resetKey:t.loadedAt,parentRouteId:t.matches[n-1]?.routeId}},structuralSharing:!0}),r=t.routesById[n.routeId],i=r.options.pendingComponent??t.options.defaultPendingComponent,a=i?(0,R.jsx)(i,{}):null,o=r.options.errorComponent??t.options.defaultErrorComponent,s=r.options.onCatch??t.options.defaultOnCatch,c=r.isRoot?r.options.notFoundComponent??t.options.notFoundRoute?.options.component:r.options.notFoundComponent,u=n.ssr===!1||n.ssr===`data-only`,d=(!r.isRoot||r.options.wrapInSuspense||u)&&(r.options.wrapInSuspense??i??(r.options.errorComponent?.preload||u))?z.Suspense:Co,f=o?ro:Co,p=c?xo:Co;return(0,R.jsxs)(r.isRoot?r.options.shellComponent??Co:Co,{children:[(0,R.jsx)(ue.Provider,{value:e,children:(0,R.jsx)(d,{fallback:a,children:(0,R.jsx)(f,{getResetKey:()=>n.resetKey,errorComponent:o||ao,onCatch:(t,n)=>{if(k(t))throw t;me(!1,`Error in route match: ${e}`),s?.(t,n)},children:(0,R.jsx)(p,{fallback:e=>{if(!c||e.routeId&&e.routeId!==n.routeId||!e.routeId&&!r.isRoot)throw e;return z.createElement(c,e)},children:u||n._displayPending?(0,R.jsx)(ne,{fallback:a,children:(0,R.jsx)(ko,{matchId:e})}):(0,R.jsx)(ko,{matchId:e})})})})}),n.parentRouteId===`__root__`&&t.options.scrollRestoration?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Oo,{}),(0,R.jsx)(Eo,{})]}):null]})});function Oo(){let e=ge(),t=z.useRef(void 0);return(0,R.jsx)(`script`,{suppressHydrationWarning:!0,ref:n=>{n&&(t.current===void 0||t.current.href!==e.latestLocation.href)&&(e.emit({type:`onRendered`,...It(e.state)}),t.current=e.latestLocation)}},e.latestLocation.state.__TSR_key)}var ko=z.memo(function({matchId:e}){let t=ge(),{match:n,key:r,routeId:i}=D({select:n=>{let r=n.matches.find(t=>t.id===e),i=r.routeId,a=(t.routesById[i].options.remountDeps??t.options.defaultRemountDeps)?.({routeId:i,loaderDeps:r.loaderDeps,params:r._strictParams,search:r._strictSearch});return{key:a?JSON.stringify(a):void 0,routeId:i,match:{id:r.id,status:r.status,error:r.error,invalid:r.invalid,_forcePending:r._forcePending,_displayPending:r._displayPending}}},structuralSharing:!0}),a=t.routesById[i],s=z.useMemo(()=>{let e=a.options.component??t.options.defaultComponent;return e?(0,R.jsx)(e,{},r):(0,R.jsx)(Ao,{})},[r,a.options.component,t.options.defaultComponent]);if(n._displayPending)throw t.getMatch(n.id)?._nonReactive.displayPendingPromise;if(n._forcePending)throw t.getMatch(n.id)?._nonReactive.minPendingPromise;if(n.status===`pending`){let e=a.options.pendingMinMs??t.options.defaultPendingMinMs;if(e){let r=t.getMatch(n.id);if(r&&!r._nonReactive.minPendingPromise){let t=o();r._nonReactive.minPendingPromise=t,setTimeout(()=>{t.resolve(),r._nonReactive.minPendingPromise=void 0},e)}}throw t.getMatch(n.id)?._nonReactive.loadPromise}if(n.status===`notFound`)return l(k(n.error),`Expected a notFound error`),wo(t,a,n.error);if(n.status===`redirected`)throw l(se(n.error),`Expected a redirect error`),t.getMatch(n.id)?._nonReactive.loadPromise;if(n.status===`error`)throw n.error;return s}),Ao=z.memo(function(){let e=ge(),t=z.useContext(ue),n=D({select:e=>e.matches.find(e=>e.id===t)?.routeId}),r=e.routesById[n],i=D({select:e=>{let n=e.matches.find(e=>e.id===t);return l(n,`Could not find parent match for matchId "${t}"`),n.globalNotFound}}),a=D({select:e=>{let n=e.matches;return n[n.findIndex(e=>e.id===t)+1]?.id}}),o=e.options.defaultPendingComponent?(0,R.jsx)(e.options.defaultPendingComponent,{}):null;if(i)return wo(e,r,void 0);if(!a)return null;let s=(0,R.jsx)(Do,{matchId:a});return n===`__root__`?(0,R.jsx)(z.Suspense,{fallback:o,children:s}):s});function jo(){let e=ge(),t=e.routesById.__root__.options.pendingComponent??e.options.defaultPendingComponent,n=t?(0,R.jsx)(t,{}):null,r=(0,R.jsxs)(typeof document<`u`&&e.ssr?Co:z.Suspense,{fallback:n,children:[(0,R.jsx)(bo,{}),(0,R.jsx)(Mo,{})]});return e.options.InnerWrap?(0,R.jsx)(e.options.InnerWrap,{children:r}):r}function Mo(){let e=ge(),t=D({select:e=>e.matches[0]?.id}),n=D({select:e=>e.loadedAt}),r=t?(0,R.jsx)(Do,{matchId:t}):null;return(0,R.jsx)(ue.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?r:(0,R.jsx)(ro,{getResetKey:()=>n,errorComponent:ao,onCatch:e=>{me(!1,`The following error wasn't caught by any route! At the very least, consider setting an 'errorComponent' in your RootRoute!`),me(!1,e.message||e.toString())},children:r})})}var No=e=>new Po(e),Po=class extends Lt{constructor(e){super(e)}};typeof globalThis<`u`?(globalThis.createFileRoute=ho,globalThis.createLazyFileRoute=vo):typeof window<`u`&&(window.createFileRoute=ho,window.createLazyFileRoute=vo);function Fo({router:e,children:t,...n}){Object.keys(n).length>0&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=(0,R.jsx)(_e().Provider,{value:e,children:t});return e.options.Wrap?(0,R.jsx)(e.options.Wrap,{children:r}):r}function Io({router:e,...t}){return(0,R.jsx)(Fo,{router:e,...t,children:(0,R.jsx)(jo,{})})}function Lo(e){return D({select:t=>e?.select?e.select(t.location):t.location})}function Ro({tag:e,attrs:t,children:n,nonce:r}){switch(e){case`title`:return(0,R.jsx)(`title`,{...t,suppressHydrationWarning:!0,children:n});case`meta`:return(0,R.jsx)(`meta`,{...t,suppressHydrationWarning:!0});case`link`:return(0,R.jsx)(`link`,{...t,nonce:r,suppressHydrationWarning:!0});case`style`:return(0,R.jsx)(`style`,{...t,dangerouslySetInnerHTML:{__html:n},nonce:r});case`script`:return(0,R.jsx)(zo,{attrs:t,children:n});default:return null}}function zo({attrs:e,children:t}){ge(),z.useEffect(()=>{if(e?.src){let t=(()=>{try{let t=document.baseURI||window.location.href;return new URL(e.src,t).href}catch{return e.src}})();if(Array.from(document.querySelectorAll(`script[src]`)).find(e=>e.src===t))return;let n=document.createElement(`script`);for(let[t,r]of Object.entries(e))t!==`suppressHydrationWarning`&&r!==void 0&&r!==!1&&n.setAttribute(t,typeof r==`boolean`?``:String(r));return document.head.appendChild(n),()=>{n.parentNode&&n.parentNode.removeChild(n)}}if(typeof t==`string`){let n=typeof e?.type==`string`?e.type:`text/javascript`,r=typeof e?.nonce==`string`?e.nonce:void 0;if(Array.from(document.querySelectorAll(`script:not([src])`)).find(e=>{if(!(e instanceof HTMLScriptElement))return!1;let i=e.getAttribute(`type`)??`text/javascript`,a=e.getAttribute(`nonce`)??void 0;return e.textContent===t&&i===n&&a===r}))return;let i=document.createElement(`script`);if(i.textContent=t,e)for(let[t,n]of Object.entries(e))t!==`suppressHydrationWarning`&&n!==void 0&&n!==!1&&i.setAttribute(t,typeof n==`boolean`?``:String(n));return document.head.appendChild(i),()=>{i.parentNode&&i.parentNode.removeChild(i)}}},[e,t]);{let{src:t,...n}=e||{};return(0,R.jsx)(`script`,{suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:``},...n})}return e?.src&&typeof e.src==`string`?(0,R.jsx)(`script`,{...e,suppressHydrationWarning:!0}):typeof t==`string`?(0,R.jsx)(`script`,{...e,dangerouslySetInnerHTML:{__html:t},suppressHydrationWarning:!0}):null}var Bo=()=>{let e=ge(),n=e.options.ssr?.nonce,r=D({select:e=>e.matches.map(e=>e.meta).filter(Boolean)}),i=z.useMemo(()=>{let e=[],i={},a;for(let o=r.length-1;o>=0;o--){let s=r[o];for(let r=s.length-1;r>=0;r--){let o=s[r];if(o)if(o.title)a||={tag:`title`,children:o.title};else if(`script:ld+json`in o)try{let n=JSON.stringify(o[`script:ld+json`]);e.push({tag:`script`,attrs:{type:`application/ld+json`},children:t(n)})}catch{}else{let t=o.name??o.property;if(t){if(i[t])continue;i[t]=!0}e.push({tag:`meta`,attrs:{...o,nonce:n}})}}}return a&&e.push(a),n&&e.push({tag:`meta`,attrs:{property:`csp-nonce`,content:n}}),e.reverse(),e},[r,n]),a=D({select:t=>{let r=t.matches.map(e=>e.links).filter(Boolean).flat(1).map(e=>({tag:`link`,attrs:{...e,nonce:n}})),i=e.ssr?.manifest,a=t.matches.map(e=>i?.routes[e.routeId]?.assets??[]).filter(Boolean).flat(1).filter(e=>e.tag===`link`).map(e=>({tag:`link`,attrs:{...e.attrs,suppressHydrationWarning:!0,nonce:n}}));return[...r,...a]},structuralSharing:!0}),o=D({select:t=>{let r=[];return t.matches.map(t=>e.looseRoutesById[t.routeId]).forEach(t=>e.ssr?.manifest?.routes[t.id]?.preloads?.filter(Boolean).forEach(e=>{r.push({tag:`link`,attrs:{rel:`modulepreload`,href:e,nonce:n}})})),r},structuralSharing:!0}),s=D({select:e=>e.matches.map(e=>e.styles).flat(1).filter(Boolean).map(({children:e,...t})=>({tag:`style`,attrs:{...t,nonce:n},children:e})),structuralSharing:!0}),c=D({select:e=>e.matches.map(e=>e.headScripts).flat(1).filter(Boolean).map(({children:e,...t})=>({tag:`script`,attrs:{...t,nonce:n},children:e})),structuralSharing:!0});return Vo([...i,...o,...a,...s,...c],e=>JSON.stringify(e))};function Vo(e,t){let n=new Set;return e.filter(e=>{let r=t(e);return n.has(r)?!1:(n.add(r),!0)})}function Ho(){let e=Bo(),t=ge().options.ssr?.nonce;return(0,R.jsx)(R.Fragment,{children:e.map(e=>(0,z.createElement)(Ro,{...e,key:`tsr-meta-${JSON.stringify(e)}`,nonce:t}))})}var Uo=()=>{let e=ge(),t=e.options.ssr?.nonce,n=D({select:n=>{let r=[],i=e.ssr?.manifest;return i?(n.matches.map(t=>e.looseRoutesById[t.routeId]).forEach(e=>i.routes[e.id]?.assets?.filter(e=>e.tag===`script`).forEach(e=>{r.push({tag:`script`,attrs:{...e.attrs,nonce:t},children:e.children})})),r):[]},structuralSharing:!0}),{scripts:r}=D({select:e=>({scripts:e.matches.map(e=>e.scripts).flat(1).filter(Boolean).map(({children:e,...n})=>({tag:`script`,attrs:{...n,suppressHydrationWarning:!0,nonce:t},children:e}))}),structuralSharing:!0}),i;e.serverSsr&&(i=e.serverSsr.takeBufferedScripts());let a=[...r,...n];return i&&a.unshift(i),(0,R.jsx)(R.Fragment,{children:a.map((e,t)=>(0,z.createElement)(Ro,{...e,key:`tsr-scripts-${e.tag}-${t}`}))})};function Wo(e){if(Array.isArray(e))return e.flatMap(e=>Wo(e));if(typeof e!=`string`)return[];let t=[],n=0,r,i,a,o,s,c=()=>{for(;n<e.length&&/\s/.test(e.charAt(n));)n+=1;return n<e.length},l=()=>(i=e.charAt(n),i!==`=`&&i!==`;`&&i!==`,`);for(;n<e.length;){for(r=n,s=!1;c();)if(i=e.charAt(n),i===`,`){for(a=n,n+=1,c(),o=n;n<e.length&&l();)n+=1;n<e.length&&e.charAt(n)===`=`?(s=!0,n=o,t.push(e.slice(r,a)),r=n):n=a+1}else n+=1;(!s||n>=e.length)&&t.push(e.slice(r))}return t}function Go(e){return e instanceof Headers?e:Array.isArray(e)||typeof e==`object`?new Headers(e):null}function Ko(...e){return e.reduce((e,t)=>{let n=Go(t);if(!n)return e;for(let[t,r]of n.entries())t===`set-cookie`?Wo(r).forEach(t=>e.append(`set-cookie`,t)):e.set(t,r);return e},new Headers)}function qo(e,t){e.id=t.i,e.__beforeLoadContext=t.b,e.loaderData=t.l,e.status=t.s,e.ssr=t.ssr,e.updatedAt=t.u,e.error=t.e}async function Jo(e){l(window.$_TSR,`Expected to find bootstrap data on window.$_TSR, but we did not. Please file an issue!`);let t=e.options.serializationAdapters;if(t?.length){let e=new Map;t.forEach(t=>{e.set(t.key,t.fromSerializable)}),window.$_TSR.t=e,window.$_TSR.buffer.forEach(e=>e())}window.$_TSR.initialized=!0,l(window.$_TSR.router,`Expected to find a dehydrated data on window.$_TSR.router, but we did not. Please file an issue!`);let{manifest:n,dehydratedData:r,lastMatchId:i}=window.$_TSR.router;e.ssr={manifest:n};let a=document.querySelector(`meta[property="csp-nonce"]`)?.content;e.options.ssr={nonce:a};let s=e.matchRoutes(e.state.location),c=Promise.all(s.map(t=>{let n=e.looseRoutesById[t.routeId];return e.loadRouteChunk(n)}));function u(t){let n=e.looseRoutesById[t.routeId].options.pendingMinMs??e.options.defaultPendingMinMs;if(n){let r=o();t._nonReactive.minPendingPromise=r,t._forcePending=!0,setTimeout(()=>{r.resolve(),e.updateMatch(t.id,e=>(e._nonReactive.minPendingPromise=void 0,{...e,_forcePending:void 0}))},n)}}function d(t){let n=e.looseRoutesById[t.routeId];n&&(n.options.ssr=t.ssr)}let f;s.forEach(e=>{let t=window.$_TSR.router.matches.find(t=>t.i===e.id);if(!t){e._nonReactive.dehydrated=!1,e.ssr=!1,d(e);return}qo(e,t),d(e),e._nonReactive.dehydrated=e.ssr!==!1,(e.ssr===`data-only`||e.ssr===!1)&&f===void 0&&(f=e.index,u(e))}),e.__store.setState(e=>({...e,matches:s})),await e.options.hydrate?.(r),await Promise.all(e.state.matches.map(async t=>{try{let n=e.looseRoutesById[t.routeId],r=e.state.matches[t.index-1]?.context??e.options.context;if(n.options.context){let i={deps:t.loaderDeps,params:t.params,context:r??{},location:e.state.location,navigate:t=>e.navigate({...t,_fromLocation:e.state.location}),buildLocation:e.buildLocation,cause:t.cause,abortController:t.abortController,preload:!1,matches:s,routeId:n.id};t.__routeContext=n.options.context(i)??void 0}t.context={...r,...t.__routeContext,...t.__beforeLoadContext};let i={ssr:e.options.ssr,matches:e.state.matches,match:t,params:t.params,loaderData:t.loaderData},a=await n.options.head?.(i),o=await n.options.scripts?.(i);t.meta=a?.meta,t.links=a?.links,t.headScripts=a?.scripts,t.styles=a?.styles,t.scripts=o}catch(e){if(k(e))t.error={isNotFound:!0},console.error(`NotFound error during hydration for routeId: ${t.routeId}`,e);else throw t.error=e,console.error(`Error during hydration for route ${t.routeId}:`,e),e}}));let p=s[s.length-1].id!==i;if(!s.some(e=>e.ssr===!1)&&!p)return s.forEach(e=>{e._nonReactive.dehydrated=void 0}),c;let m=Promise.resolve().then(()=>e.load()).catch(e=>{console.error(`Error during router hydration:`,e)});if(p){let t=s[1];l(t,`Expected to find a match below the root match in SPA mode.`),u(t),t._displayPending=!0,t._nonReactive.displayPendingPromise=m,m.then(()=>{Xe(()=>{e.__store.state.status===`pending`&&e.__store.setState(e=>({...e,status:`idle`,resolvedLocation:e.location})),e.updateMatch(t.id,e=>({...e,_displayPending:void 0,displayPendingPromise:void 0}))})})}return c}var Yo=`__TSS_CONTEXT`,Xo=Symbol.for(`TSS_SERVER_FUNCTION`),Zo=Symbol.for(`TSS_SERVER_FUNCTION_FACTORY`),Qo=`application/x-tss-framed`,$o={JSON:0,CHUNK:1,END:2,ERROR:3};`${Qo}`;var es=/;\s*v=(\d+)/;function ts(e){let t=e.match(es);return t?parseInt(t[1],10):void 0}function ns(e){let t=ts(e);if(t!==void 0&&t!==1)throw Error(`Incompatible framed protocol version: server=${t}, client=1. Please ensure client and server are using compatible versions.`)}var rs=()=>window.__TSS_START_OPTIONS__;function is(){return[...(rs()?.serializationAdapters)?.map(Aa)??[],...$a]}var as=new TextDecoder,os=new Uint8Array,ss=16*1024*1024,cs=32*1024*1024,ls=1024,us=1e5;function ds(e){let t=new Map,n=new Map,r=new Set,i=!1,a=null,o=0,s,c=new ReadableStream({start(e){s=e},cancel(){i=!0;try{a?.cancel()}catch{}t.forEach(e=>{try{e.error(Error(`Framed response cancelled`))}catch{}}),t.clear(),n.clear(),r.clear()}});function l(e){let i=n.get(e);if(i)return i;if(r.has(e))return new ReadableStream({start(e){e.close()}});if(n.size>=ls)throw Error(`Too many raw streams in framed response (max ${ls})`);let a=new ReadableStream({start(n){t.set(e,n)},cancel(){r.add(e),t.delete(e),n.delete(e)}});return n.set(e,a),a}function u(e){return l(e),t.get(e)}return(async()=>{let n=e.getReader();a=n;let c=[],l=0;function d(){if(l<9)return null;let e=c[0];if(e.length>=9)return{type:e[0],streamId:(e[1]<<24|e[2]<<16|e[3]<<8|e[4])>>>0,length:(e[5]<<24|e[6]<<16|e[7]<<8|e[8])>>>0};let t=new Uint8Array(9),n=0,r=9;for(let e=0;e<c.length&&r>0;e++){let i=c[e],a=Math.min(i.length,r);t.set(i.subarray(0,a),n),n+=a,r-=a}return{type:t[0],streamId:(t[1]<<24|t[2]<<16|t[3]<<8|t[4])>>>0,length:(t[5]<<24|t[6]<<16|t[7]<<8|t[8])>>>0}}function f(e){if(e===0)return os;let t=new Uint8Array(e),n=0,r=e;for(;r>0&&c.length>0;){let e=c[0];if(!e)break;let i=Math.min(e.length,r);t.set(e.subarray(0,i),n),n+=i,r-=i,i===e.length?c.shift():c[0]=e.subarray(i)}return l-=e,t}try{for(;;){let{done:e,value:a}=await n.read();if(i||e)break;if(a){if(l+a.length>cs)throw Error(`Framed response buffer exceeded ${cs} bytes`);for(c.push(a),l+=a.length;;){let e=d();if(!e)break;let{type:n,streamId:i,length:a}=e;if(n!==$o.JSON&&n!==$o.CHUNK&&n!==$o.END&&n!==$o.ERROR)throw Error(`Unknown frame type: ${n}`);if(n===$o.JSON){if(i!==0)throw Error(`Invalid JSON frame streamId (expected 0)`)}else if(i===0)throw Error(`Invalid raw frame streamId (expected non-zero)`);if(a>ss)throw Error(`Frame payload too large: ${a} bytes (max ${ss})`);let c=9+a;if(l<c)break;if(++o>us)throw Error(`Too many frames in framed response (max ${us})`);f(9);let p=f(a);switch(n){case $o.JSON:try{s.enqueue(as.decode(p))}catch{}break;case $o.CHUNK:{let e=u(i);e&&e.enqueue(p);break}case $o.END:{let e=u(i);if(r.add(i),e){try{e.close()}catch{}t.delete(i)}break}case $o.ERROR:{let e=u(i);if(r.add(i),e){let n=as.decode(p);e.error(Error(n)),t.delete(i)}break}}}}}if(l!==0)throw Error(`Incomplete frame at end of framed response`);try{s.close()}catch{}t.forEach(e=>{try{e.close()}catch{}}),t.clear()}catch(e){try{s.error(e)}catch{}t.forEach(t=>{try{t.error(e)}catch{}}),t.clear()}finally{try{n.releaseLock()}catch{}a=null}})(),{getOrCreateStream:l,jsonChunks:c}}var fs=null,ps=Object.prototype.hasOwnProperty;function ms(e){for(let t in e)if(ps.call(e,t))return!0;return!1}async function hs(e,t,n){fs||=is();let r=t[0],i=r.fetch??n,a=r.data instanceof FormData?`formData`:`payload`,o=r.headers?new Headers(r.headers):new Headers;if(o.set(`x-tsr-serverFn`,`true`),a===`payload`&&o.set(`accept`,`${Qo}, application/x-ndjson, application/json`),r.method===`GET`){if(a===`formData`)throw Error(`FormData is not supported with GET requests`);let t=await gs(r);if(t!==void 0){let n=ce({payload:t});e.includes(`?`)?e+=`&${n}`:e+=`?${n}`}}let s;if(r.method===`POST`){let e=await vs(r);e?.contentType&&o.set(`content-type`,e.contentType),s=e?.body}return await ys(async()=>i(e,{method:r.method,headers:o,signal:r.signal,body:s}))}async function gs(e){let t=!1,n={};if(e.data!==void 0&&(t=!0,n.data=e.data),e.context&&ms(e.context)&&(t=!0,n.context=e.context),t)return _s(n)}async function _s(e){return JSON.stringify(await Promise.resolve(Oa(e,{plugins:fs})))}async function vs(e){if(e.data instanceof FormData){let t;return e.context&&ms(e.context)&&(t=await _s(e.context)),t!==void 0&&e.data.set(Yo,t),{body:e.data}}let t=await gs(e);if(t)return{body:t,contentType:`application/json`}}async function ys(e){let t;try{t=await e()}catch(e){if(e instanceof Response)t=e;else throw console.log(e),e}if(t.headers.get(`x-tss-raw`)===`true`)return t;let n=t.headers.get(`content-type`);if(l(n,`expected content-type header to be set`),t.headers.get(`x-tss-serialized`)){let e;if(n.includes(`application/x-tss-framed`)){if(ns(n),!t.body)throw Error(`No response body for framed response`);let{getOrCreateStream:r,jsonChunks:i}=ds(t.body),a=[Qa(r),...fs||[]],o=new Map;e=await xs({jsonStream:i,onMessage:e=>Da(e,{refs:o,plugins:a}),onError(e,t){console.error(e,t)}})}else if(n.includes(`application/x-ndjson`)){let n=new Map;e=await bs({response:t,onMessage:e=>Da(e,{refs:n,plugins:fs}),onError(e,t){console.error(e,t)}})}else n.includes(`application/json`)&&(e=Da(await t.json(),{plugins:fs}));if(l(e,`expected result to be resolved`),e instanceof Error)throw e;return e}if(n.includes(`application/json`)){let e=await t.json(),n=A(e);if(n)throw n;if(k(e))throw e;return e}if(!t.ok)throw Error(await t.text());return t}async function bs({response:e,onMessage:t,onError:n}){if(!e.body)throw Error(`No response body`);let r=e.body.pipeThrough(new TextDecoderStream).getReader(),i=``,a=!1,o;for(;!a;){let{value:e,done:t}=await r.read();if(e&&(i+=e),i.length===0&&t)throw Error(`Stream ended before first object`);if(i.endsWith(`
|
|
@@ -49,7 +49,7 @@ import{a as e,c as t,d as n,f as r,g as i,h as a,i as o,l as s,m as c,n as l,o a
|
|
|
49
49
|
.allow-interactivity-${e} {pointer-events: all;}
|
|
50
50
|
`},nf=0,rf=[];function af(e){var t=z.useRef([]),n=z.useRef([0,0]),r=z.useRef(),i=z.useState(nf++)[0],a=z.useState(Dd)[0],o=z.useRef(e);z.useEffect(function(){o.current=e},[e]),z.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=rd([e.lockRef.current],(e.shards||[]).map($d),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=z.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Zd(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=Wd(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Wd(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return Xd(h,t,e,h===`h`?s:c,!0)},[]),c=z.useCallback(function(e){var n=e;if(!(!rf.length||rf[rf.length-1]!==a)){var r=`deltaY`in n?Qd(n):Zd(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&ef(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map($d).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=z.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:of(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=z.useCallback(function(e){n.current=Zd(e),r.current=void 0},[]),d=z.useCallback(function(t){l(t.type,Qd(t),t.target,s(t,e.lockRef.current))},[]),f=z.useCallback(function(t){l(t.type,Zd(t),t.target,s(t,e.lockRef.current))},[]);z.useEffect(function(){return rf.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,zd),document.addEventListener(`touchmove`,c,zd),document.addEventListener(`touchstart`,u,zd),function(){rf=rf.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,zd),document.removeEventListener(`touchmove`,c,zd),document.removeEventListener(`touchstart`,u,zd)}},[]);var p=e.removeScrollBar,m=e.inert;return z.createElement(z.Fragment,null,m?z.createElement(a,{styles:tf(i)}):null,p?z.createElement(Id,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function of(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var sf=_d(vd,af),cf=z.forwardRef(function(e,t){return z.createElement(Q,td({},e,{ref:t,sideCar:sf}))});cf.classNames=Q.classNames;var lf=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},uf=new WeakMap,df=new WeakMap,ff={},pf=0,mf=function(e){return e&&(e.host||mf(e.parentNode))},hf=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=mf(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},gf=function(e,t,n,r){var i=hf(t,Array.isArray(e)?e:[e]);ff[n]||(ff[n]=new WeakMap);var a=ff[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(uf.get(e)||0)+1,l=(a.get(e)||0)+1;uf.set(e,c),a.set(e,l),o.push(e),c===1&&i&&df.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),pf++,function(){o.forEach(function(e){var t=uf.get(e)-1,i=a.get(e)-1;uf.set(e,t),a.set(e,i),t||(df.has(e)||e.removeAttribute(r),df.delete(e)),i||e.removeAttribute(n)}),pf--,pf||(uf=new WeakMap,uf=new WeakMap,df=new WeakMap,ff={})}},_f=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||lf(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),gf(r,i,n,`aria-hidden`)):function(){return null}};function vf(e){let[t,n]=z.useState(void 0);return nu(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var yf=[`top`,`right`,`bottom`,`left`],bf=Math.min,xf=Math.max,Sf=Math.round,Cf=Math.floor,wf=e=>({x:e,y:e}),Tf={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Ef(e,t,n){return xf(e,bf(t,n))}function Df(e,t){return typeof e==`function`?e(t):e}function Of(e){return e.split(`-`)[0]}function kf(e){return e.split(`-`)[1]}function Af(e){return e===`x`?`y`:`x`}function jf(e){return e===`y`?`height`:`width`}function Mf(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Nf(e){return Af(Mf(e))}function Pf(e,t,n){n===void 0&&(n=!1);let r=kf(e),i=Nf(e),a=jf(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Uf(o)),[o,Uf(o)]}function Ff(e){let t=Uf(e);return[If(e),t,If(t)]}function If(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Lf=[`left`,`right`],Rf=[`right`,`left`],zf=[`top`,`bottom`],Bf=[`bottom`,`top`];function Vf(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Rf:Lf:t?Lf:Rf;case`left`:case`right`:return t?zf:Bf;default:return[]}}function Hf(e,t,n,r){let i=kf(e),a=Vf(Of(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(If)))),a}function Uf(e){let t=Of(e);return Tf[t]+e.slice(t.length)}function Wf(e){return{top:0,right:0,bottom:0,left:0,...e}}function Gf(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Wf(e)}function Kf(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function qf(e,t,n){let{reference:r,floating:i}=e,a=Mf(t),o=Nf(t),s=jf(o),c=Of(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(kf(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function Jf(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=Df(t,e),p=Gf(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Kf(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Kf(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Yf=50,Xf=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Jf},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=qf(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<Yf&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=qf(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Zf=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=Df(e,t)||{};if(l==null)return{};let d=Gf(u),f={x:n,y:r},p=Nf(i),m=jf(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,E=C/2-h[m]/2-1,D=bf(d[_],E),ee=bf(d[v],E),te=D,ne=C-h[m]-ee,O=C/2-h[m]/2+w,re=Ef(te,O,ne),ie=!c.arrow&&kf(i)!=null&&O!==re&&a.reference[m]/2-(O<te?D:ee)-h[m]/2<0,ae=ie?O<te?O-te:O-ne:0;return{[p]:f[p]+ae,data:{[p]:re,centerOffset:O-re-ae,...ie&&{alignmentOffset:ae}},reset:ie}}}),Qf=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=Df(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Of(r),_=Mf(o),v=Of(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Uf(o)]:Ff(o)),x=p!==`none`;!d&&x&&b.push(...Hf(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],E=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Pf(r,a,y);w.push(C[e[0]],C[e[1]])}if(E=[...E,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==Mf(t))||E.every(e=>Mf(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:E},reset:{placement:t}};let n=E.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=E.filter(e=>{if(x){let t=Mf(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function $f(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ep(e){return yf.some(t=>e[t]>=0)}var tp=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=Df(e,t);switch(i){case`referenceHidden`:{let e=$f(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:ep(e)}}}case`escaped`:{let e=$f(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:ep(e)}}}default:return{}}}}},np=new Set([`left`,`top`]);async function rp(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Of(n),s=kf(n),c=Mf(n)===`y`,l=np.has(o)?-1:1,u=a&&c?-1:1,d=Df(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var ip=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await rp(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},ap=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Df(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Mf(Of(i)),p=Af(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=Ef(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=Ef(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},op=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=Df(e,t),u={x:n,y:r},d=Mf(i),f=Af(d),p=u[f],m=u[d],h=Df(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=np.has(Of(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},sp=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=Df(e,t),u=await o.detectOverflow(t,l),d=Of(i),f=kf(i),p=Mf(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=bf(h-u[g],v),x=bf(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=xf(u.left,0),t=xf(u.right,0),n=xf(u.top,0),r=xf(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:xf(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:xf(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let E=await o.getDimensions(s.floating);return m!==E.width||h!==E.height?{reset:{rects:!0}}:{}}}};function cp(){return typeof window<`u`}function lp(e){return fp(e)?(e.nodeName||``).toLowerCase():`#document`}function up(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function dp(e){return((fp(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function fp(e){return cp()?e instanceof Node||e instanceof up(e).Node:!1}function pp(e){return cp()?e instanceof Element||e instanceof up(e).Element:!1}function mp(e){return cp()?e instanceof HTMLElement||e instanceof up(e).HTMLElement:!1}function hp(e){return!cp()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof up(e).ShadowRoot}function gp(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Dp(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function _p(e){return/^(table|td|th)$/.test(lp(e))}function vp(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var yp=/transform|translate|scale|rotate|perspective|filter/,bp=/paint|layout|strict|content/,xp=e=>!!e&&e!==`none`,Sp;function Cp(e){let t=pp(e)?Dp(e):e;return xp(t.transform)||xp(t.translate)||xp(t.scale)||xp(t.rotate)||xp(t.perspective)||!Tp()&&(xp(t.backdropFilter)||xp(t.filter))||yp.test(t.willChange||``)||bp.test(t.contain||``)}function wp(e){let t=kp(e);for(;mp(t)&&!Ep(t);){if(Cp(t))return t;if(vp(t))return null;t=kp(t)}return null}function Tp(){return Sp??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Sp}function Ep(e){return/^(html|body|#document)$/.test(lp(e))}function Dp(e){return up(e).getComputedStyle(e)}function Op(e){return pp(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function kp(e){if(lp(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||hp(e)&&e.host||dp(e);return hp(t)?t.host:t}function Ap(e){let t=kp(e);return Ep(t)?e.ownerDocument?e.ownerDocument.body:e.body:mp(t)&&gp(t)?t:Ap(t)}function jp(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Ap(e),i=r===e.ownerDocument?.body,a=up(r);if(i){let e=Mp(a);return t.concat(a,a.visualViewport||[],gp(r)?r:[],e&&n?jp(e):[])}else return t.concat(r,jp(r,[],n))}function Mp(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Np(e){let t=Dp(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=mp(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Sf(n)!==a||Sf(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Pp(e){return pp(e)?e:e.contextElement}function Fp(e){let t=Pp(e);if(!mp(t))return wf(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Np(t),o=(a?Sf(n.width):n.width)/r,s=(a?Sf(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Ip=wf(0);function Lp(e){let t=up(e);return!Tp()||!t.visualViewport?Ip:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Rp(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==up(e)?!1:t}function zp(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Pp(e),o=wf(1);t&&(r?pp(r)&&(o=Fp(r)):o=Fp(e));let s=Rp(a,n,r)?Lp(a):wf(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=up(a),t=r&&pp(r)?up(r):r,n=e,i=Mp(n);for(;i&&r&&t!==n;){let e=Fp(i),t=i.getBoundingClientRect(),r=Dp(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=up(i),i=Mp(n)}}return Kf({width:u,height:d,x:c,y:l})}function Bp(e,t){let n=Op(e).scrollLeft;return t?t.left+n:zp(dp(e)).left+n}function Vp(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Bp(e,n),y:n.top+t.scrollTop}}function Hp(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=dp(r),s=t?vp(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=wf(1),u=wf(0),d=mp(r);if((d||!d&&!a)&&((lp(r)!==`body`||gp(o))&&(c=Op(r)),d)){let e=zp(r);l=Fp(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Vp(o,c):wf(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Up(e){return Array.from(e.getClientRects())}function Wp(e){let t=dp(e),n=Op(e),r=e.ownerDocument.body,i=xf(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=xf(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Bp(e),s=-n.scrollTop;return Dp(r).direction===`rtl`&&(o+=xf(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var Gp=25;function Kp(e,t){let n=up(e),r=dp(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Tp();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=Bp(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=Gp&&(a-=o)}else l<=Gp&&(a+=l);return{width:a,height:o,x:s,y:c}}function qp(e,t){let n=zp(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=mp(e)?Fp(e):wf(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Jp(e,t,n){let r;if(t===`viewport`)r=Kp(e,n);else if(t===`document`)r=Wp(dp(e));else if(pp(t))r=qp(t,n);else{let n=Lp(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Kf(r)}function Yp(e,t){let n=kp(e);return n===t||!pp(n)||Ep(n)?!1:Dp(n).position===`fixed`||Yp(n,t)}function Xp(e,t){let n=t.get(e);if(n)return n;let r=jp(e,[],!1).filter(e=>pp(e)&&lp(e)!==`body`),i=null,a=Dp(e).position===`fixed`,o=a?kp(e):e;for(;pp(o)&&!Ep(o);){let t=Dp(o),n=Cp(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||gp(o)&&!n&&Yp(e,o))?r=r.filter(e=>e!==o):i=t,o=kp(o)}return t.set(e,r),r}function Zp(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?vp(t)?[]:Xp(t,this._c):[].concat(n),r],o=Jp(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Jp(t,a[e],i);s=xf(n.top,s),c=bf(n.right,c),l=bf(n.bottom,l),u=xf(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Qp(e){let{width:t,height:n}=Np(e);return{width:t,height:n}}function $p(e,t,n){let r=mp(t),i=dp(t),a=n===`fixed`,o=zp(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=wf(0);function l(){c.x=Bp(i)}if(r||!r&&!a)if((lp(t)!==`body`||gp(i))&&(s=Op(t)),r){let e=zp(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?Vp(i,s):wf(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function em(e){return Dp(e).position===`static`}function tm(e,t){if(!mp(e)||Dp(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return dp(e)===n&&(n=n.ownerDocument.body),n}function nm(e,t){let n=up(e);if(vp(e))return n;if(!mp(e)){let t=kp(e);for(;t&&!Ep(t);){if(pp(t)&&!em(t))return t;t=kp(t)}return n}let r=tm(e,t);for(;r&&_p(r)&&em(r);)r=tm(r,t);return r&&Ep(r)&&em(r)&&!Cp(r)?n:r||wp(e)||n}var rm=async function(e){let t=this.getOffsetParent||nm,n=this.getDimensions,r=await n(e.floating);return{reference:$p(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function im(e){return Dp(e).direction===`rtl`}var am={convertOffsetParentRelativeRectToViewportRelativeRect:Hp,getDocumentElement:dp,getClippingRect:Zp,getOffsetParent:nm,getElementRects:rm,getClientRects:Up,getDimensions:Qp,getScale:Fp,isElement:pp,isRTL:im};function om(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function sm(e,t){let n=null,r,i=dp(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=Cf(d),h=Cf(i.clientWidth-(u+f)),g=Cf(i.clientHeight-(d+p)),_=Cf(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:xf(0,bf(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!om(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function cm(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Pp(e),u=i||a?[...l?jp(l):[],...t?jp(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?sm(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?zp(e):null;c&&g();function g(){let t=zp(e);h&&!om(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var lm=ip,um=ap,dm=Qf,fm=sp,pm=tp,mm=Zf,hm=op,gm=(e,t,n)=>{let r=new Map,i={platform:am,...n},a={...i.platform,_c:r};return Xf(e,t,{...i,platform:a})},_m=typeof document<`u`?z.useLayoutEffect:function(){};function vm(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!vm(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!vm(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function ym(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function bm(e,t){let n=ym(e);return Math.round(t*n)/n}function xm(e){let t=z.useRef(e);return _m(()=>{t.current=e}),t}function Sm(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=z.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=z.useState(r);vm(f,r)||p(r);let[m,h]=z.useState(null),[g,_]=z.useState(null),v=z.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=z.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=z.useRef(null),C=z.useRef(null),w=z.useRef(u),E=c!=null,D=xm(c),ee=xm(i),te=xm(l),ne=z.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};ee.current&&(e.platform=ee.current),gm(S.current,C.current,e).then(e=>{let t={...e,isPositioned:te.current!==!1};O.current&&!vm(w.current,t)&&(w.current=t,Xl.flushSync(()=>{d(t)}))})},[f,t,n,ee,te]);_m(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let O=z.useRef(!1);_m(()=>(O.current=!0,()=>{O.current=!1}),[]),_m(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(D.current)return D.current(b,x,ne);ne()}},[b,x,ne,D,E]);let re=z.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),ie=z.useMemo(()=>({reference:b,floating:x}),[b,x]),ae=z.useMemo(()=>{let e={position:n,left:0,top:0};if(!ie.floating)return e;let t=bm(ie.floating,u.x),r=bm(ie.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...ym(ie.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,ie.floating,u.x,u.y]);return z.useMemo(()=>({...u,update:ne,refs:re,elements:ie,floatingStyles:ae}),[u,ne,re,ie,ae])}var Cm=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:mm({element:r.current,padding:i}).fn(n):r?mm({element:r,padding:i}).fn(n):{}}}},wm=(e,t)=>{let n=lm(e);return{name:n.name,fn:n.fn,options:[e,t]}},Tm=(e,t)=>{let n=um(e);return{name:n.name,fn:n.fn,options:[e,t]}},Em=(e,t)=>({fn:hm(e).fn,options:[e,t]}),Dm=(e,t)=>{let n=dm(e);return{name:n.name,fn:n.fn,options:[e,t]}},Om=(e,t)=>{let n=fm(e);return{name:n.name,fn:n.fn,options:[e,t]}},km=(e,t)=>{let n=pm(e);return{name:n.name,fn:n.fn,options:[e,t]}},Am=(e,t)=>{let n=Cm(e);return{name:n.name,fn:n.fn,options:[e,t]}},jm=`Arrow`,Mm=z.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,R.jsx)(Zl.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,R.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Mm.displayName=jm;var Nm=Mm,Pm=`Popper`,[Fm,Im]=$l(Pm),[Lm,Rm]=Fm(Pm),zm=e=>{let{__scopePopper:t,children:n}=e,[r,i]=z.useState(null),[a,o]=z.useState(void 0);return(0,R.jsx)(Lm,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})};zm.displayName=Pm;var Bm=`PopperAnchor`,Vm=z.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=Rm(Bm,n),o=z.useRef(null),s=a.onAnchorChange,c=Se(t,z.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=z.useRef(null);z.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&Zm(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,R.jsx)(Zl.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})});Vm.displayName=Bm;var Hm=`PopperContent`,[Um,Wm]=Fm(Hm),Gm=z.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l,collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=Rm(Hm,n),[_,v]=z.useState(null),y=Se(t,e=>v(e)),[b,x]=z.useState(null),S=vf(b),C=S?.width??0,w=S?.height??0,E=r+(a===`center`?``:`-`+a),D=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},ee=l?Array.isArray(l)?l:[l]:void 0,te=ee!==void 0&&ee.length>0,ne={padding:D,boundary:ee?.filter(Ym),altBoundary:te},{refs:O,floatingStyles:re,placement:ie,isPositioned:ae,middlewareData:k}=Sm({strategy:`fixed`,placement:E,whileElementsMounted:(...e)=>cm(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[wm({mainAxis:i+w,alignmentAxis:o}),c&&Tm({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?Em():void 0,...ne}),c&&Dm({...ne}),Om({...ne,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),b&&Am({element:b,padding:s}),Xm({arrowWidth:C,arrowHeight:w}),f&&km({strategy:`referenceHidden`,...ne})]}),A=g.setPlacementState;nu(()=>(A(ie),()=>{A(void 0)}),[ie,A]);let[oe,se]=Zm(ie),ce=yu(m);nu(()=>{ae&&ce?.()},[ae,ce]);let le=k.arrow?.x,ue=k.arrow?.y,j=k.arrow?.centerOffset!==0,[de,fe]=z.useState();return nu(()=>{_&&fe(window.getComputedStyle(_).zIndex)},[_]),(0,R.jsx)(`div`,{ref:O.setFloating,"data-radix-popper-content-wrapper":``,style:{...re,transform:ae?re.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:de,"--radix-popper-transform-origin":[k.transformOrigin?.x,k.transformOrigin?.y].join(` `),...k.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,R.jsx)(Um,{scope:n,placedSide:oe,placedAlign:se,onArrowChange:x,arrowX:le,arrowY:ue,shouldHideArrow:j,children:(0,R.jsx)(Zl.div,{"data-side":oe,"data-align":se,...h,ref:y,style:{...h.style,animation:ae?void 0:`none`}})})})});Gm.displayName=Hm;var Km=`PopperArrow`,qm={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Jm=z.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=Wm(Km,n),a=qm[i.placedSide];return(0,R.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,R.jsx)(Nm,{...r,ref:t,style:{...r.style,display:`block`}})})});Jm.displayName=Km;function Ym(e){return e!==null}var Xm=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=Zm(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function Zm(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var Qm=zm,$m=Vm,eh=Gm,th=Jm,nh=`rovingFocusGroup.onEntryFocus`,rh={bubbles:!1,cancelable:!0},ih=`RovingFocusGroup`,[ah,oh,sh]=tu(ih),[ch,lh]=$l(ih,[sh]),[uh,dh]=ch(ih),fh=z.forwardRef((e,t)=>(0,R.jsx)(ah.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,R.jsx)(ah.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,R.jsx)(ph,{...e,ref:t})})}));fh.displayName=ih;var ph=z.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=z.useRef(null),p=Se(t,f),m=vu(a),[h,g]=iu({prop:o,defaultProp:s??null,onChange:c,caller:ih}),[_,v]=z.useState(!1),y=yu(l),b=oh(n),x=z.useRef(!1),[S,C]=z.useState(0);return z.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(nh,y),()=>e.removeEventListener(nh,y)},[y]),(0,R.jsx)(uh,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:z.useCallback(e=>g(e),[g]),onItemShiftTab:z.useCallback(()=>v(!0),[]),onFocusableItemAdd:z.useCallback(()=>C(e=>e+1),[]),onFocusableItemRemove:z.useCallback(()=>C(e=>e-1),[]),children:(0,R.jsx)(Zl.div,{tabIndex:_||S===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:X(e.onMouseDown,()=>{x.current=!0}),onFocus:X(e.onFocus,e=>{let t=!x.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(nh,rh);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);yh([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}x.current=!1}),onBlur:X(e.onBlur,()=>v(!1))})})}),mh=`RovingFocusGroupItem`,hh=z.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=gu(),l=a||c,u=dh(mh,n),d=u.currentTabStopId===l,f=oh(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return z.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,R.jsx)(ah.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,R.jsx)(Zl.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:X(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:X(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:X(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=vh(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?bh(n,r+1):n.slice(r+1)}setTimeout(()=>yh(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});hh.displayName=mh;var gh={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function _h(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function vh(e,t,n){let r=_h(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return gh[r]}function yh(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function bh(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var xh=fh,Sh=hh,Ch=[`Enter`,` `],wh=[`ArrowDown`,`PageUp`,`Home`],Th=[`ArrowUp`,`PageDown`,`End`],Eh=[...wh,...Th],Dh={ltr:[...Ch,`ArrowRight`],rtl:[...Ch,`ArrowLeft`]},Oh={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},kh=`Menu`,[Ah,jh,Mh]=tu(kh),[Nh,Ph]=$l(kh,[Mh,Im,lh]),Fh=Im(),Ih=lh(),[Lh,Rh]=Nh(kh),[zh,Bh]=Nh(kh),Vh=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=Fh(t),[c,l]=z.useState(null),u=z.useRef(!1),d=yu(a),f=vu(i);return z.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,R.jsx)(Qm,{...s,children:(0,R.jsx)(Lh,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,R.jsx)(zh,{scope:t,onClose:z.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};Vh.displayName=kh;var Hh=`MenuAnchor`,Uh=z.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Fh(n);return(0,R.jsx)($m,{...i,...r,ref:t})});Uh.displayName=Hh;var Wh=`MenuPortal`,[Gh,Kh]=Nh(Wh,{forceMount:void 0}),qh=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=Rh(Wh,t);return(0,R.jsx)(Gh,{scope:t,forceMount:n,children:(0,R.jsx)(cu,{present:n||a.open,children:(0,R.jsx)(Xu,{asChild:!0,container:i,children:r})})})};qh.displayName=Wh;var Jh=`MenuContent`,[Yh,Xh]=Nh(Jh),Zh=z.forwardRef((e,t)=>{let n=Kh(Jh,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Rh(Jh,e.__scopeMenu),o=Bh(Jh,e.__scopeMenu);return(0,R.jsx)(Ah.Provider,{scope:e.__scopeMenu,children:(0,R.jsx)(cu,{present:r||a.open,children:(0,R.jsx)(Ah.Slot,{scope:e.__scopeMenu,children:o.modal?(0,R.jsx)(Qh,{...i,ref:t}):(0,R.jsx)($h,{...i,ref:t})})})})}),Qh=z.forwardRef((e,t)=>{let n=Rh(Jh,e.__scopeMenu),r=z.useRef(null),i=Se(t,r);return z.useEffect(()=>{let e=r.current;if(e)return _f(e)},[]),(0,R.jsx)(tg,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:X(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),$h=z.forwardRef((e,t)=>{let n=Rh(Jh,e.__scopeMenu);return(0,R.jsx)(tg,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),eg=Ce(`MenuContent.ScrollLock`),tg=z.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=Rh(Jh,n),_=Bh(Jh,n),v=Fh(n),y=Ih(n),b=jh(n),[x,S]=z.useState(null),C=z.useRef(null),w=Se(t,C,g.onContentChange),E=z.useRef(0),D=z.useRef(``),ee=z.useRef(0),te=z.useRef(null),ne=z.useRef(`right`),O=z.useRef(0),re=m?cf:z.Fragment,ie=m?{as:eg,allowPinchZoom:!0}:void 0,ae=e=>{let t=D.current+e,n=b().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=zg(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){D.current=t,window.clearTimeout(E.current),t!==``&&(E.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};z.useEffect(()=>()=>window.clearTimeout(E.current),[]),$u();let k=z.useCallback(e=>ne.current===te.current?.side&&Vg(e,te.current?.area),[]);return(0,R.jsx)(Yh,{scope:n,searchRef:D,onItemEnter:z.useCallback(e=>{k(e)&&e.preventDefault()},[k]),onItemLeave:z.useCallback(e=>{k(e)||(C.current?.focus(),S(null))},[k]),onTriggerLeave:z.useCallback(e=>{k(e)&&e.preventDefault()},[k]),pointerGraceTimerRef:ee,onPointerGraceIntentChange:z.useCallback(e=>{te.current=e},[]),children:(0,R.jsx)(re,{...ie,children:(0,R.jsx)(Ru,{asChild:!0,trapped:i,onMountAutoFocus:X(a,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,R.jsx)(Du,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,R.jsx)(xh,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:x,onCurrentTabStopIdChange:S,onEntryFocus:X(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,R.jsx)(eh,{role:`menu`,"aria-orientation":`vertical`,"data-state":Pg(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:w,style:{outline:`none`,...h.style},onKeyDown:X(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&ae(e.key));let i=C.current;if(e.target!==i||!Eh.includes(e.key))return;e.preventDefault();let a=b().filter(e=>!e.disabled).map(e=>e.ref.current);Th.includes(e.key)&&a.reverse(),Lg(a)}),onBlur:X(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(E.current),D.current=``)}),onPointerMove:X(e.onPointerMove,Hg(e=>{let t=e.target,n=O.current!==e.clientX;e.currentTarget.contains(t)&&n&&(ne.current=e.clientX>O.current?`right`:`left`,O.current=e.clientX)}))})})})})})})});Zh.displayName=Jh;var ng=`MenuGroup`,rg=z.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,R.jsx)(Zl.div,{role:`group`,...r,ref:t})});rg.displayName=ng;var ig=`MenuLabel`,ag=z.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,R.jsx)(Zl.div,{...r,ref:t})});ag.displayName=ig;var og=`MenuItem`,sg=`menu.itemSelect`,cg=z.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=z.useRef(null),o=Bh(og,e.__scopeMenu),s=Xh(og,e.__scopeMenu),c=Se(t,a),l=z.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(sg,{bubbles:!0,cancelable:!0});e.addEventListener(sg,e=>r?.(e),{once:!0}),Ql(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,R.jsx)(lg,{...i,ref:c,disabled:n,onClick:X(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:X(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:X(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||Ch.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});cg.displayName=og;var lg=z.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=Xh(og,n),s=Ih(n),c=z.useRef(null),l=Se(t,c),[u,d]=z.useState(!1),[f,p]=z.useState(``);return z.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,R.jsx)(Ah.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,R.jsx)(Sh,{asChild:!0,...s,focusable:!r,children:(0,R.jsx)(Zl.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:X(e.onPointerMove,Hg(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:X(e.onPointerLeave,Hg(e=>o.onItemLeave(e))),onFocus:X(e.onFocus,()=>d(!0)),onBlur:X(e.onBlur,()=>d(!1))})})})}),ug=`MenuCheckboxItem`,dg=z.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,R.jsx)(yg,{scope:e.__scopeMenu,checked:n,children:(0,R.jsx)(cg,{role:`menuitemcheckbox`,"aria-checked":Fg(n)?`mixed`:n,...i,ref:t,"data-state":Ig(n),onSelect:X(i.onSelect,()=>r?.(Fg(n)?!0:!n),{checkForDefaultPrevented:!1})})})});dg.displayName=ug;var fg=`MenuRadioGroup`,[pg,mg]=Nh(fg,{value:void 0,onValueChange:()=>{}}),hg=z.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=yu(r);return(0,R.jsx)(pg,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,R.jsx)(rg,{...i,ref:t})})});hg.displayName=fg;var gg=`MenuRadioItem`,_g=z.forwardRef((e,t)=>{let{value:n,...r}=e,i=mg(gg,e.__scopeMenu),a=n===i.value;return(0,R.jsx)(yg,{scope:e.__scopeMenu,checked:a,children:(0,R.jsx)(cg,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":Ig(a),onSelect:X(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});_g.displayName=gg;var vg=`MenuItemIndicator`,[yg,bg]=Nh(vg,{checked:!1}),xg=z.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=bg(vg,n);return(0,R.jsx)(cu,{present:r||Fg(a.checked)||a.checked===!0,children:(0,R.jsx)(Zl.span,{...i,ref:t,"data-state":Ig(a.checked)})})});xg.displayName=vg;var Sg=`MenuSeparator`,Cg=z.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,R.jsx)(Zl.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});Cg.displayName=Sg;var wg=`MenuArrow`,Tg=z.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Fh(n);return(0,R.jsx)(th,{...i,...r,ref:t})});Tg.displayName=wg;var Eg=`MenuSub`,[Dg,Og]=Nh(Eg),kg=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=Rh(Eg,t),o=Fh(t),[s,c]=z.useState(null),[l,u]=z.useState(null),d=yu(i);return z.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,R.jsx)(Qm,{...o,children:(0,R.jsx)(Lh,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,R.jsx)(Dg,{scope:t,contentId:gu(),triggerId:gu(),trigger:s,onTriggerChange:c,children:n})})})};kg.displayName=Eg;var Ag=`MenuSubTrigger`,jg=z.forwardRef((e,t)=>{let n=Rh(Ag,e.__scopeMenu),r=Bh(Ag,e.__scopeMenu),i=Og(Ag,e.__scopeMenu),a=Xh(Ag,e.__scopeMenu),o=z.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=z.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return z.useEffect(()=>u,[u]),z.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,R.jsx)(Uh,{asChild:!0,...l,children:(0,R.jsx)(lg,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":n.open?i.contentId:void 0,"data-state":Pg(n.open),...e,ref:we(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:X(e.onPointerMove,Hg(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:X(e.onPointerLeave,Hg(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:X(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||Dh[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});jg.displayName=Ag;var Mg=`MenuSubContent`,Ng=z.forwardRef((e,t)=>{let n=Kh(Jh,e.__scopeMenu),{forceMount:r=n.forceMount,align:i=`start`,...a}=e,o=Rh(Jh,e.__scopeMenu),s=Bh(Jh,e.__scopeMenu),c=Og(Mg,e.__scopeMenu),l=z.useRef(null),u=Se(t,l);return(0,R.jsx)(Ah.Provider,{scope:e.__scopeMenu,children:(0,R.jsx)(cu,{present:r||o.open,children:(0,R.jsx)(Ah.Slot,{scope:e.__scopeMenu,children:(0,R.jsx)(tg,{id:c.contentId,"aria-labelledby":c.triggerId,...a,ref:u,align:i,side:s.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{s.isUsingKeyboardRef.current&&l.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:X(e.onFocusOutside,e=>{e.target!==c.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:X(e.onEscapeKeyDown,e=>{s.onClose(),e.preventDefault()}),onKeyDown:X(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=Oh[s.dir].includes(e.key);t&&n&&(o.onOpenChange(!1),c.trigger?.focus(),e.preventDefault())})})})})})});Ng.displayName=Mg;function Pg(e){return e?`open`:`closed`}function Fg(e){return e===`indeterminate`}function Ig(e){return Fg(e)?`indeterminate`:e?`checked`:`unchecked`}function Lg(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Rg(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function zg(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Rg(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function Bg(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Vg(e,t){return t?Bg({x:e.clientX,y:e.clientY},t):!1}function Hg(e){return t=>t.pointerType===`mouse`?e(t):void 0}var Ug=Vh,Wg=Uh,Gg=qh,Kg=Zh,qg=rg,Jg=ag,Yg=cg,Xg=dg,Zg=hg,Qg=_g,$g=xg,e_=Cg,t_=Tg,n_=jg,r_=Ng,i_=`DropdownMenu`,[a_,o_]=$l(i_,[Ph]),s_=Ph(),[c_,l_]=a_(i_),u_=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=s_(t),l=z.useRef(null),[u,d]=iu({prop:i,defaultProp:a??!1,onChange:o,caller:i_});return(0,R.jsx)(c_,{scope:t,triggerId:gu(),triggerRef:l,contentId:gu(),open:u,onOpenChange:d,onOpenToggle:z.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,R.jsx)(Ug,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};u_.displayName=i_;var d_=`DropdownMenuTrigger`,f_=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=l_(d_,n),o=s_(n);return(0,R.jsx)(Wg,{asChild:!0,...o,children:(0,R.jsx)(Zl.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:we(t,a.triggerRef),onPointerDown:X(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:X(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});f_.displayName=d_;var p_=`DropdownMenuPortal`,m_=e=>{let{__scopeDropdownMenu:t,...n}=e,r=s_(t);return(0,R.jsx)(Gg,{...r,...n})};m_.displayName=p_;var h_=`DropdownMenuContent`,g_=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=l_(h_,n),a=s_(n),o=z.useRef(!1);return(0,R.jsx)(Kg,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:X(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:X(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});g_.displayName=h_;var __=`DropdownMenuGroup`,v_=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=s_(n);return(0,R.jsx)(qg,{...i,...r,ref:t})});v_.displayName=__;var y_=`DropdownMenuLabel`,b_=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=s_(n);return(0,R.jsx)(Jg,{...i,...r,ref:t})});b_.displayName=y_;var x_=`DropdownMenuItem`,S_=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=s_(n);return(0,R.jsx)(Yg,{...i,...r,ref:t})});S_.displayName=x_;var C_=`DropdownMenuCheckboxItem`,w_=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=s_(n);return(0,R.jsx)(Xg,{...i,...r,ref:t})});w_.displayName=C_;var T_=`DropdownMenuRadioGroup`,E_=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=s_(n);return(0,R.jsx)(Zg,{...i,...r,ref:t})});E_.displayName=T_;var D_=`DropdownMenuRadioItem`,O_=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=s_(n);return(0,R.jsx)(Qg,{...i,...r,ref:t})});O_.displayName=D_;var k_=`DropdownMenuItemIndicator`,A_=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=s_(n);return(0,R.jsx)($g,{...i,...r,ref:t})});A_.displayName=k_;var j_=`DropdownMenuSeparator`,M_=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=s_(n);return(0,R.jsx)(e_,{...i,...r,ref:t})});M_.displayName=j_;var N_=`DropdownMenuArrow`,P_=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=s_(n);return(0,R.jsx)(t_,{...i,...r,ref:t})});P_.displayName=N_;var F_=`DropdownMenuSubTrigger`,I_=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=s_(n);return(0,R.jsx)(n_,{...i,...r,ref:t})});I_.displayName=F_;var L_=`DropdownMenuSubContent`,R_=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=s_(n);return(0,R.jsx)(r_,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});R_.displayName=L_;var z_=u_,B_=f_,V_=m_,H_=g_,U_=b_,W_=S_,G_=M_,K_=xe(`inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/90`,destructive:`bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40`,outline:`border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80`,ghost:`hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-9 px-4 py-2 has-[>svg]:px-3`,xs:`h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5`,lg:`h-10 rounded-md px-6 has-[>svg]:px-4`,icon:`size-9`,"icon-xs":`size-6 rounded-md [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-8`,"icon-lg":`size-10`}},defaultVariants:{variant:`default`,size:`default`}});function q_({className:e,variant:t=`default`,size:n=`default`,asChild:r=!1,...i}){return(0,R.jsx)(r?Te:`button`,{"data-slot":`button`,"data-variant":t,"data-size":n,className:be(K_({variant:t,size:n,className:e})),...i})}var J_=`flakes.console.theme`;function Y_(e){document.documentElement.classList.toggle(`dark`,e===`dark`)}function X_(){let e=window.localStorage.getItem(J_)===`light`?`light`:`dark`;return Y_(e),e}function Z_(){return document.documentElement.classList.contains(`dark`)?`dark`:`light`}function Q_(e){let t=e===`dark`?`light`:`dark`;return window.localStorage.setItem(J_,t),Y_(t),t}function $_(){let[e,t]=(0,z.useState)(()=>Z_());return(0,R.jsx)(q_,{variant:`ghost`,size:`icon`,"aria-label":`Toggle theme`,onClick:()=>t(Q_(e)),children:e===`dark`?(0,R.jsx)(W,{className:`size-4`}):(0,R.jsx)(il,{className:`size-4`})})}function ev({...e}){return(0,R.jsx)(z_,{"data-slot":`dropdown-menu`,...e})}function tv({...e}){return(0,R.jsx)(B_,{"data-slot":`dropdown-menu-trigger`,...e})}function nv({className:e,sideOffset:t=4,...n}){return(0,R.jsx)(V_,{children:(0,R.jsx)(H_,{"data-slot":`dropdown-menu-content`,sideOffset:t,className:be(`z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,e),...n})})}function rv({className:e,inset:t,variant:n=`default`,...r}){return(0,R.jsx)(W_,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:be(`relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!`,e),...r})}function iv({className:e,inset:t,...n}){return(0,R.jsx)(U_,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:be(`px-2 py-1.5 text-sm font-medium data-[inset]:pl-8`,e),...n})}function av({className:e,...t}){return(0,R.jsx)(G_,{"data-slot":`dropdown-menu-separator`,className:be(`-mx-1 my-1 h-px bg-border`,e),...t})}var ov=`flakes.console.sidebar`;function sv(e){let t=Lo(),n=hv(`(max-width: 767px)`),[r,i]=(0,z.useState)(()=>window.localStorage.getItem(ov)===`collapsed`),a=r||n,o=()=>{let e=!r;i(e),window.localStorage.setItem(ov,e?`collapsed`:`open`)},s=mv();return(0,R.jsxs)(`div`,{className:`flex h-screen overflow-hidden transition-opacity duration-300 starting:opacity-0`,children:[(0,R.jsxs)(`aside`,{className:be(`flex shrink-0 flex-col border-r bg-sidebar text-sidebar-foreground transition-[width]`,a?`w-14`:`w-[17rem]`),children:[(0,R.jsxs)(`div`,{className:`flex h-14 items-center gap-1.5 border-b border-sidebar-border px-2`,children:[a?(0,R.jsx)(re,{to:`/runs`,"aria-label":`Flakes runs`,className:`mx-auto rounded-md p-1.5 transition-colors hover:bg-sidebar-accent/40`,children:(0,R.jsx)(Jl,{className:`size-[18px]`})}):(0,R.jsx)(re,{to:`/runs`,className:`flex min-w-0 flex-1 items-center gap-2 rounded-md px-2 py-2 transition-colors hover:bg-sidebar-accent/40`,children:(0,R.jsx)(Yl,{})}),a?null:(0,R.jsx)(q_,{variant:`ghost`,size:`icon-sm`,className:`shrink-0`,"aria-label":`Collapse sidebar`,onClick:o,children:(0,R.jsx)(al,{className:`size-4`})})]}),r&&!n?(0,R.jsx)(`div`,{className:`flex justify-center py-1.5`,children:(0,R.jsx)(q_,{variant:`ghost`,size:`icon-sm`,"aria-label":`Expand sidebar`,onClick:o,children:(0,R.jsx)(al,{className:`size-4`})})}):null,(0,R.jsx)(lv,{collapsed:a,pathname:t.pathname}),a?(0,R.jsx)(`div`,{className:`flex-1`}):(0,R.jsx)(yv,{}),(0,R.jsx)(cv,{collapsed:a,pathname:t.pathname})]}),(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,R.jsxs)(`header`,{className:`relative flex h-14 shrink-0 items-center gap-3 overflow-x-clip border-b px-5`,children:[(0,R.jsx)(`div`,{className:`min-w-0 truncate font-mono text-xs text-muted-foreground`,children:(0,R.jsx)(pv,{pathname:t.pathname})}),(0,R.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,R.jsx)(gv,{}),(0,R.jsx)(vv,{state:e.connection,pollKey:s}),(0,R.jsx)($_,{}),(0,R.jsxs)(ev,{children:[(0,R.jsx)(tv,{asChild:!0,children:(0,R.jsx)(q_,{variant:`ghost`,size:`icon`,"aria-label":`Account menu`,children:(0,R.jsx)(uv,{user:e.user})})}),(0,R.jsxs)(nv,{align:`end`,className:`w-64`,children:[(0,R.jsxs)(iv,{className:`flex min-w-0 items-center gap-3`,children:[(0,R.jsx)(uv,{user:e.user}),(0,R.jsxs)(`span`,{className:`min-w-0`,children:[(0,R.jsx)(`span`,{className:`block truncate font-medium`,children:dv(e.user)}),(0,R.jsx)(`span`,{className:`block truncate font-mono text-[11px] text-muted-foreground`,children:e.user.email??`No email recorded`})]})]}),(0,R.jsx)(av,{}),(0,R.jsx)(rv,{asChild:!0,children:(0,R.jsxs)(re,{to:`/account`,children:[(0,R.jsx)(ul,{className:`size-4`}),` Account`]})}),(0,R.jsx)(rv,{asChild:!0,children:(0,R.jsxs)(re,{to:`/account/security`,children:[(0,R.jsx)(cl,{className:`size-4`}),` Security`]})}),(0,R.jsx)(av,{}),(0,R.jsxs)(rv,{variant:`destructive`,onClick:e.onSignOut,children:[(0,R.jsx)(rl,{className:`size-4`}),` Sign out`]})]})]})]}),s>0&&(0,R.jsx)(`div`,{className:`animate-sweep`},s)]}),(0,R.jsx)(`main`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,R.jsx)(`div`,{className:`mx-auto max-w-6xl p-6`,children:e.children})})]})]})}function cv(e){let t=e.pathname.startsWith(`/documentation`);return(0,R.jsx)(`div`,{className:be(`border-t border-sidebar-border p-2`,e.collapsed&&`grid justify-items-center`),children:(0,R.jsxs)(re,{to:`/documentation`,"aria-label":e.collapsed?`Documentation`:void 0,title:e.collapsed?`Documentation`:void 0,className:be(`flex min-w-0 items-center gap-2 rounded-md px-2 py-2 text-sm transition-colors focus-visible:ring-[3px] focus-visible:ring-ring/30 focus-visible:outline-none`,e.collapsed&&`size-9 justify-center px-0`,t?`bg-sidebar-accent text-sidebar-accent-foreground`:`text-muted-foreground hover:bg-sidebar-accent/60 hover:text-sidebar-accent-foreground`),children:[(0,R.jsx)(el,{className:`size-4 shrink-0`,"aria-hidden":`true`}),e.collapsed?null:(0,R.jsxs)(`span`,{className:`min-w-0`,children:[(0,R.jsx)(`span`,{className:`block truncate font-medium`,children:`Documentation`}),(0,R.jsx)(`span`,{className:`block truncate font-mono text-[11px] text-muted-foreground`,children:`Guides and reference`})]})]})})}function lv(e){let t=[{to:`/runs`,label:`Runs`,detail:`Task runs`,icon:tl,active:e.pathname===`/`||e.pathname.startsWith(`/runs`)},{to:`/sandboxes`,label:`Sandboxes`,detail:`Run task placement`,icon:sl,active:e.pathname.startsWith(`/sandboxes`)}];return(0,R.jsx)(`nav`,{"aria-label":`Console sections`,className:be(`grid gap-1 border-b border-sidebar-border p-2`,e.collapsed&&`justify-items-center`),children:t.map(t=>{let n=t.icon;return(0,R.jsxs)(re,{to:t.to,"aria-label":e.collapsed?t.label:void 0,title:e.collapsed?t.label:void 0,className:be(`flex min-w-0 items-center gap-2 rounded-md px-2 py-2 text-sm transition-colors focus-visible:ring-[3px] focus-visible:ring-ring/30 focus-visible:outline-none`,e.collapsed&&`size-9 justify-center px-0`,t.active?`bg-sidebar-accent text-sidebar-accent-foreground`:`text-muted-foreground hover:bg-sidebar-accent/60 hover:text-sidebar-accent-foreground`),children:[(0,R.jsx)(n,{className:`size-4 shrink-0`,"aria-hidden":`true`}),e.collapsed?null:(0,R.jsxs)(`span`,{className:`min-w-0`,children:[(0,R.jsx)(`span`,{className:`block truncate font-medium`,children:t.label}),(0,R.jsx)(`span`,{className:`block truncate font-mono text-[11px] text-muted-foreground`,children:t.detail})]})]},t.to)})})}function uv(e){return e.user.image?(0,R.jsx)(`img`,{src:e.user.image,alt:``,referrerPolicy:`no-referrer`,className:`size-6 rounded-full border object-cover`}):(0,R.jsx)(`span`,{className:`inline-flex size-6 items-center justify-center rounded-full border bg-muted font-mono text-[10px] text-muted-foreground`,children:fv(e.user)})}function dv(e){let t=e.name?.trim();return t&&t.length>0?t:e.email??`Flakes user`}function fv(e){let t=dv(e),n=t.split(/[\s@._-]+/).filter(Boolean);return(n.length>1?`${n[0]?.[0]??``}${n[1]?.[0]??``}`:t.slice(0,2)).toUpperCase()}function pv(e){let t=e.pathname.split(`/`).filter(Boolean);if(t[0]===`account`)return t[1]===`security`?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(re,{to:`/account`,className:`hover:text-foreground`,children:`Account`}),` / `,(0,R.jsx)(`span`,{className:`text-foreground`,children:`Security`})]}):(0,R.jsx)(`span`,{className:`text-foreground`,children:`Account`});if(t[0]===`documentation`)return(0,R.jsx)(`span`,{className:`text-foreground`,children:`Documentation`});if(t[0]===`sandboxes`)return(0,R.jsx)(`span`,{className:`text-foreground`,children:`Sandboxes`});let n=t[0]===`runs`?t[1]:void 0;if(n===void 0)return(0,R.jsx)(`span`,{className:`text-foreground`,children:`Runs`});let r=t[2]===`t`?t[3]:void 0;return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(re,{to:`/runs`,className:`hover:text-foreground`,children:`Runs`}),` / `,r===void 0?(0,R.jsx)(`span`,{className:`text-foreground`,children:n}):(0,R.jsx)(re,{to:`/runs/$runId`,params:{runId:n},className:`hover:text-foreground`,children:n}),r===void 0?null:(0,R.jsxs)(R.Fragment,{children:[` / `,(0,R.jsx)(`span`,{className:`text-foreground`,children:r})]})]})}function mv(){let e=Zc(),t=(0,z.useRef)(!1),[n,r]=(0,z.useState)(0);return(0,z.useEffect)(()=>{t.current&&e===0&&r(e=>e+1),t.current=e>0},[e]),n}function hv(e){let[t,n]=(0,z.useState)(()=>typeof window>`u`?!1:window.matchMedia(e).matches);return(0,z.useEffect)(()=>{let t=window.matchMedia(e),r=()=>n(t.matches);return r(),t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),t}function gv(){let[e,t]=(0,z.useState)(()=>new Date);return(0,z.useEffect)(()=>{let e=setInterval(()=>t(new Date),1e3);return()=>clearInterval(e)},[]),(0,R.jsx)(`span`,{"data-num":!0,className:`font-mono text-xs text-muted-foreground`,children:`${e.toISOString().slice(11,19)}Z`})}var _v={ok:{dot:`bg-primary`,label:`CONNECTED`},degraded:{dot:`bg-status-warn`,label:`DEGRADED`},error:{dot:`bg-status-failed`,label:`UNREACHABLE`},pending:{dot:`bg-status-idle animate-pulse`,label:`CONNECTING`}};function vv(e){let t=_v[e.state];return(0,R.jsxs)(`span`,{className:be(`flex items-center gap-1.5 rounded-full border px-2.5 py-1 font-mono text-[11px] uppercase tracking-[0.08em] text-muted-foreground`,e.state===`degraded`&&`text-status-warn`,e.state===`error`&&`text-status-failed`),children:[(0,R.jsxs)(`span`,{className:`relative size-1.5`,children:[(0,R.jsx)(`span`,{className:be(`absolute inset-0 rounded-full`,t.dot)}),e.state===`ok`&&e.pollKey>0&&(0,R.jsx)(`span`,{className:`blip absolute inset-0 rounded-full border border-primary`},e.pollKey)]}),t.label]})}function yv(){let[e,t]=(0,z.useState)(!1),n=Rl(),r=(n.data?.pages??[]).flatMap(e=>e.runs);if(r.length===0)return(0,R.jsx)(`div`,{className:`min-h-0 flex-1 px-3 py-2 text-xs text-muted-foreground`,children:n.isPending?`Loading sessions…`:`No sessions yet.`});let i=Ev(r),a=i.some(e=>e.project!==null);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{className:`border-b border-sidebar-border p-2`,children:(0,R.jsxs)(`button`,{type:`button`,onClick:()=>t(!0),className:`flex h-8 w-full items-center gap-2 rounded-md border border-sidebar-border bg-background/70 px-2.5 text-left text-sm text-muted-foreground transition-colors hover:bg-sidebar-accent/40 hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/30 focus-visible:outline-none`,children:[(0,R.jsx)(ol,{className:`size-3.5 shrink-0`}),(0,R.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`Search runs`}),(0,R.jsx)(`span`,{className:`font-mono text-[10px] text-muted-foreground`,children:`⌘K`})]})}),(0,R.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-2 py-2`,children:i.map(e=>(0,R.jsxs)(`div`,{className:`mb-3`,children:[e.project!==null||a?(0,R.jsx)(`div`,{className:`console-callout truncate px-2 pt-1 pb-1.5`,children:e.project??`Inbox`}):null,(0,R.jsx)(`div`,{className:`grid gap-0.5`,children:e.runs.map(e=>(0,R.jsx)(xv,{run:e},e.runId))})]},e.project??`__inbox`))}),(0,R.jsx)(bv,{open:e,runs:r,onOpenChange:t})]})}function bv(e){let t=fo(),n=(0,z.useRef)(null),[r,i]=(0,z.useState)(``);if((0,z.useEffect)(()=>{if(!e.open){i(``);return}let t=requestAnimationFrame(()=>n.current?.focus());function r(t){t.key===`Escape`&&e.onOpenChange(!1)}return window.addEventListener(`keydown`,r),()=>{cancelAnimationFrame(t),window.removeEventListener(`keydown`,r)}},[e.open,e.onOpenChange]),(0,z.useEffect)(()=>{function t(t){(t.metaKey||t.ctrlKey)&&t.key.toLowerCase()===`k`&&(t.preventDefault(),e.onOpenChange(!0))}return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e.onOpenChange]),!e.open)return null;let a=Sv(e.runs,r).slice(0,12);return(0,R.jsx)(`div`,{className:`fixed inset-0 z-50 bg-background/65 p-4`,role:`dialog`,"aria-modal":`true`,"aria-label":`Search runs`,onMouseDown:t=>{t.target===t.currentTarget&&e.onOpenChange(!1)},children:(0,R.jsxs)(`div`,{className:`mx-auto mt-[12vh] w-full max-w-xl overflow-hidden rounded-lg border bg-popover shadow-2xl`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 border-b px-3 py-2`,children:[(0,R.jsx)(ol,{className:`size-4 shrink-0 text-muted-foreground`}),(0,R.jsx)(`input`,{ref:n,value:r,onChange:e=>i(e.currentTarget.value),name:`run-search-dialog`,placeholder:`Search runs`,"aria-label":`Search runs`,autoComplete:`off`,className:`h-10 min-w-0 flex-1 bg-transparent text-base outline-none placeholder:text-muted-foreground`}),(0,R.jsx)(`span`,{className:`rounded border px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground`,children:`ESC`})]}),(0,R.jsx)(`div`,{className:`max-h-[26rem] overflow-y-auto p-2`,children:a.length===0?(0,R.jsx)(`div`,{className:`px-3 py-8 text-center text-sm text-muted-foreground`,children:`No matching runs.`}):(0,R.jsx)(`div`,{className:`grid gap-1`,children:a.map(n=>(0,R.jsxs)(`button`,{type:`button`,className:`flex min-w-0 items-start gap-2 rounded-md px-3 py-2 text-left transition-colors hover:bg-accent focus-visible:bg-accent focus-visible:outline-none`,onClick:()=>{e.onOpenChange(!1),t({to:`/runs/$runId`,params:{runId:n.runId}})},children:[(0,R.jsx)(`span`,{className:be(`mt-1.5 size-1.5 shrink-0 rounded-full`,Dv(n.state))}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`span`,{className:`block truncate text-sm font-medium`,children:n.name}),(0,R.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 font-mono text-[11px] text-muted-foreground`,children:[(0,R.jsx)(`span`,{className:`truncate`,children:n.state.toLowerCase()}),(0,R.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,R.jsx)(`span`,{"data-num":!0,children:Cv(n)}),(0,R.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,R.jsx)(`span`,{className:`truncate`,children:n.runId})]})]})]},n.runId))})})]})})}function xv(e){let t=Lo(),n=fo(),r=Y(),i=t.pathname.startsWith(`/runs/${e.run.runId}`),a=Tv.has(e.run.state);async function o(){if(window.confirm(`Delete "${e.run.name}" from run history?`))try{await r.mutateAsync(e.run.runId),i&&n({to:`/runs`})}catch(e){window.alert(e instanceof Error?e.message:`Failed to delete run`)}}return(0,R.jsxs)(`div`,{className:be(`group flex items-center rounded-md transition-colors`,i?`bg-sidebar-accent text-sidebar-accent-foreground`:`text-muted-foreground hover:bg-sidebar-accent/60 hover:text-sidebar-accent-foreground`),children:[(0,R.jsxs)(re,{to:`/runs/$runId`,params:{runId:e.run.runId},title:e.run.name,className:`flex min-w-0 flex-1 items-start gap-2 px-2 py-2 text-sm`,children:[(0,R.jsx)(`span`,{className:be(`mt-1.5 size-1.5 shrink-0 rounded-full`,Dv(e.run.state))}),(0,R.jsxs)(`span`,{className:`min-w-0`,children:[(0,R.jsx)(`span`,{className:`block truncate font-medium leading-5`,children:e.run.name}),(0,R.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 font-mono text-[11px] text-muted-foreground`,children:[(0,R.jsx)(`span`,{className:`truncate`,children:e.run.state.toLowerCase()}),(0,R.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,R.jsx)(`span`,{"data-num":!0,children:Cv(e.run)}),(0,R.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,R.jsx)(`span`,{title:e.run.updatedAt,children:wv(e.run)})]})]})]}),a?(0,R.jsx)(`button`,{type:`button`,"aria-label":`Delete ${e.run.name}`,title:`Delete run`,disabled:r.isPending,onClick:()=>{o()},className:be(`mr-1 rounded p-1 text-muted-foreground opacity-0 transition-opacity hover:bg-destructive/10 hover:text-destructive focus:opacity-100 group-hover:opacity-100`,r.isPending&&`cursor-not-allowed opacity-50`),children:(0,R.jsx)(ll,{className:`size-3.5`})}):null]})}function Sv(e,t){let n=t.trim().toLowerCase();return n.length===0?e:e.filter(e=>[e.name,e.runId,e.state,typeof e.metadata?.project==`string`?e.metadata.project:void 0].some(e=>e?.toLowerCase().includes(n)))}function Cv(e){let t=e.taskStatusCounts;if(t===void 0)return`—`;let n=Object.values(t).reduce((e,t)=>e+t,0),r=(t.SUCCEEDED??0)+(t.FAILED??0)+(t.CANCELLED??0);return n===0?`0/0`:`${r}/${n}`}function wv(e){let t=e.updatedAt,n=Date.now()-Date.parse(t);if(!Number.isFinite(n)||n<0)return`now`;let r=Math.floor(n/1e3);if(r<60)return`${r}s`;let i=Math.floor(r/60);if(i<60)return`${i}m`;let a=Math.floor(i/60);return a<48?`${a}h`:`${Math.floor(a/24)}d`}var Tv=new Set([`SUCCEEDED`,`FAILED`,`CANCELLED`,`STALLED`]);function Ev(e){let t=new Map,n=[];for(let r of e){let e=typeof r.metadata?.project==`string`?r.metadata.project:void 0;if(e!==void 0&&e.length>0){let n=t.get(e)??[];n.push(r),t.set(e,n)}else n.push(r)}let r=[];for(let e of[...t.keys()].sort())r.push({project:e,runs:t.get(e)??[]});return n.length>0&&r.push({project:null,runs:n}),r}function Dv(e){switch(e.toLowerCase()){case`running`:return`bg-status-running`;case`succeeded`:return`bg-status-succeeded`;case`failed`:return`bg-status-failed`;case`cancelled`:case`stalled`:return`bg-status-warn`;case`blocked`:return`bg-status-blocked`;default:return`bg-status-idle`}}var Ov=Object.create(null),kv=e=>({}),Av=new Proxy(Ov,{get(e,t){return kv()[t]??Ov[t]},has(e,t){return t in kv()||t in Ov},set(e,t,n){let r=kv(!0);return r[t]=n,!0},deleteProperty(e,t){if(!t)return!1;let n=kv(!0);return delete n[t],!0},ownKeys(){let e=kv(!0);return Object.keys(e)}});Av.NODE_ENV;function jv(e,t){return typeof process<`u`?{}[e]??t:typeof Deno<`u`?Deno.env.get(e)??t:typeof Bun<`u`?Bun.env[e]??t:t}Object.freeze({get BETTER_AUTH_SECRET(){return jv(`BETTER_AUTH_SECRET`)},get AUTH_SECRET(){return jv(`AUTH_SECRET`)},get BETTER_AUTH_TELEMETRY(){return jv(`BETTER_AUTH_TELEMETRY`)},get BETTER_AUTH_TELEMETRY_ID(){return jv(`BETTER_AUTH_TELEMETRY_ID`)},get NODE_ENV(){return jv(`NODE_ENV`,`development`)},get PACKAGE_VERSION(){return jv(`PACKAGE_VERSION`,`0.0.0`)},get BETTER_AUTH_TELEMETRY_ENDPOINT(){return jv(`BETTER_AUTH_TELEMETRY_ENDPOINT`,``)}});function Mv(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,{code:e,message:t,toString:()=>e}]))}function Nv(){let e=Object.getOwnPropertyDescriptor(Error,`stackTraceLimit`);return e===void 0?Object.isExtensible(Error):Object.prototype.hasOwnProperty.call(e,`writable`)?e.writable:e.set!==void 0}function Pv(e){let t=e.split(`
|
|
51
51
|
at `);return t.length<=1?e:(t.splice(1,1),t.join(`
|
|
52
|
-
at `))}function Fv(e,t){class n extends e{#e;constructor(...e){if(Nv()){let t=Error.stackTraceLimit;Error.stackTraceLimit=0,super(...e),Error.stackTraceLimit=t}else super(...e);let t=Error().stack;t&&(this.#e=Pv(t.replace(/^Error/,this.name)))}get errorStack(){return this.#e}}return Object.defineProperty(n.prototype,"constructor",{get(){return t},enumerable:!1,configurable:!0}),n}var Iv={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};Fv(class extends Error{constructor(e=`INTERNAL_SERVER_ERROR`,t=void 0,n={},r=typeof e==`number`?e:Iv[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}},Error);var Lv=class extends Error{constructor(e,t){super(e,t),this.name=`BetterAuthError`,this.message=e,this.stack=``}},Rv=47;function zv(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===Rv;)t--;return t===e.length?e:e.slice(0,t)}function Bv(e){try{return(zv(new URL(e).pathname)||`/`)!==`/`}catch{throw new Lv(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}function Vv(e){try{let t=new URL(e);if(t.protocol!==`http:`&&t.protocol!==`https:`)throw new Lv(`Invalid base URL: ${e}. URL must include 'http://' or 'https://'`)}catch(t){throw t instanceof Lv?t:new Lv(`Invalid base URL: ${e}. Please provide a valid base URL.`,{cause:t})}}function Hv(e,t=`/api/auth`){if(Vv(e),Bv(e))return e;let n=zv(e);return!t||t===`/`?n:(t=t.startsWith(`/`)?t:`/${t}`,`${n}${t}`)}function Uv(e,t){return!e||e.trim()===``?!1:t===`proto`?e===`http`||e===`https`:t===`host`?[/\.\./,/\0/,/[\s]/,/^[.]/,/[<>'"]/,/javascript:/i,/file:/i,/data:/i].some(t=>t.test(e))?!1:/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*(:[0-9]{1,5})?$/.test(e)||/^(\d{1,3}\.){3}\d{1,3}(:[0-9]{1,5})?$/.test(e)||/^\[[0-9a-fA-F:]+\](:[0-9]{1,5})?$/.test(e)||/^localhost(:[0-9]{1,5})?$/i.test(e):!1}function Wv(e,t,n,r,i){if(e)return Hv(e,t);if(r!==!1){let e=Av.BETTER_AUTH_URL||Av.NEXT_PUBLIC_BETTER_AUTH_URL||Av.PUBLIC_BETTER_AUTH_URL||Av.NUXT_PUBLIC_BETTER_AUTH_URL||Av.NUXT_PUBLIC_AUTH_URL||(Av.BASE_URL===`/`?void 0:Av.BASE_URL);if(e)return Hv(e,t)}let a=n?.headers.get(`x-forwarded-host`),o=n?.headers.get(`x-forwarded-proto`);if(a&&o&&i&&Uv(o,`proto`)&&Uv(a,`host`))try{return Hv(`${o}://${a}`,t)}catch{}if(n){let e=Gv(n.url);if(!e)throw new Lv(`Could not get origin from request. Please provide a valid base URL.`);return Hv(e,t)}if(typeof window<`u`&&window.location)return Hv(window.location.origin,t)}function Gv(e){try{let t=new URL(e);return t.origin===`null`?null:t.origin}catch{return null}}var Kv={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*:/},qv=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,Jv={true:!0,false:!1,null:null,undefined:void 0,nan:NaN,infinity:1/0,"-infinity":-1/0},Yv=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;function Xv(e){return e instanceof Date&&!isNaN(e.getTime())}function Zv(e){let t=Yv.exec(e);if(!t)return null;let[,n,r,i,a,o,s,c,l,u,d]=t,f=new Date(Date.UTC(parseInt(n,10),parseInt(r,10)-1,parseInt(i,10),parseInt(a,10),parseInt(o,10),parseInt(s,10),c?parseInt(c.padEnd(3,`0`),10):0));if(l){let e=(parseInt(u,10)*60+parseInt(d,10))*(l===`+`?-1:1);f.setUTCMinutes(f.getUTCMinutes()+e)}return Xv(f)?f:null}function Qv(e,t={}){let{strict:n=!1,warnings:r=!1,reviver:i,parseDates:a=!0}=t;if(typeof e!=`string`)return e;let o=e.trim(),s=o.toLowerCase();if(s.length<=9&&s in Jv)return Jv[s];if(!qv.test(o)){if(n)throw SyntaxError(`[better-json] Invalid JSON`);return e}if(Object.entries(Kv).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(e===`__proto__`||e===`constructor`&&t&&typeof t==`object`&&`prototype`in t){r&&console.warn(`[better-json] Dropping "${e}" key to prevent prototype pollution`);return}if(a&&typeof t==`string`){let e=Zv(t);if(e)return e}return i?i(e,t):t})}catch(t){if(n)throw t;return e}}function $v(e,t={strict:!0}){return Qv(e,t)}var ey=[`javascript:`,`data:`,`vbscript:`];function ty(e){let t;try{t=new URL(e)}catch{return!0}return!ey.includes(t.protocol)}var ny={id:`redirect`,name:`Redirect`,hooks:{onSuccess(e){if(e.data?.url&&e.data?.redirect&&ty(e.data.url)&&typeof window<`u`&&window.location&&window.location)try{window.location.href=e.data.url}catch{}}}},ry=[],iy=0,ay=4,oy=globalThis.nanostoresGlobal||={epoch:0},sy=e=>{let t=[],n={get(){return n.lc||n.listen(()=>{})(),n.value},init:e,lc:0,listen(e){return n.lc=t.push(e),()=>{for(let t=iy+ay;t<ry.length;)ry[t]===e?ry.splice(t,ay):t+=ay;let r=t.indexOf(e);~r&&(t.splice(r,1),--n.lc||n.off())}},notify(e,r){oy.epoch++;let i=!ry.length;for(let i of t)ry.push(i,n.value,e,r);if(i){for(iy=0;iy<ry.length;iy+=ay)ry[iy](ry[iy+1],ry[iy+2],ry[iy+3]);ry.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},cy=2,ly=5,uy=6,dy=10,fy=(e,t,n,r)=>(e.events=e.events||{},e.events[n+dy]||(e.events[n+dy]=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],i=r.indexOf(t);r.splice(i,1),r.length||(delete e.events[n],e.events[n+dy](),delete e.events[n+dy])}),py=(e,t)=>fy(e,t,cy,t=>{let n=e.set,r=e.setKey;return e.setKey&&=(n,i)=>{let a;if(t({abort:()=>{a=!0},changed:n,newValue:{...e.value,[n]:i}}),!a)return r(n,i)},e.set=e=>{let r;if(t({abort:()=>{r=!0},newValue:e}),!r)return n(e)},()=>{e.set=n,e.setKey=r}}),my=1e3,hy=(e,t)=>fy(e,n=>{let r=t(n);r&&e.events[uy].push(r)},ly,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[uy]=[],e.off=()=>{r(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let t of e.events[uy])t();e.events[uy]=[]}},my)},()=>{e.listen=n,e.off=r}});function gy(e,t,n){let r=new Set(t).add(void 0);return e.listen((e,t,i)=>{r.has(i)&&n(e,t,i)})}function _y(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function vy(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!vy(e[n],t[n]))return!1;return!0}if(_y(e)&&_y(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)||!vy(e[r],t[r]))return!1;return!0}return!1}function yy(e,t){return py(e,({newValue:n,abort:r})=>{t(e.value,n)&&r()})}var by=Symbol.for(`better-auth:broadcast-channel`),xy=()=>Math.floor(Date.now()/1e3),Sy=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:xy()}))}catch{}}setup(){if(typeof window>`u`||window.addEventListener===void 0)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 Cy(e=`better-auth.message`){return globalThis[by]||(globalThis[by]=new Sy(e)),globalThis[by]}var wy=Symbol.for(`better-auth:focus-manager`),Ty=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`||window.addEventListener===void 0)return()=>{};let e=()=>{document.visibilityState===`visible`&&this.setFocused(!0)};return document.addEventListener(`visibilitychange`,e,!1),()=>{document.removeEventListener(`visibilitychange`,e,!1)}}};function Ey(){return globalThis[wy]||(globalThis[wy]=new Ty),globalThis[wy]}var Dy=Symbol.for(`better-auth:online-manager`),Oy=class{listeners=new Set;isOnline=typeof navigator<`u`?navigator.onLine:!0;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setOnline(e){this.isOnline=e,this.listeners.forEach(t=>t(e))}setup(){if(typeof window>`u`||window.addEventListener===void 0)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 ky(){return globalThis[Dy]||(globalThis[Dy]=new Oy),globalThis[Dy]}var Ay=()=>Math.floor(Date.now()/1e3),jy=5;function My(e){let{fetchSession:t,shouldPollSession:n=()=>!0,sessionSignal:r,options:i={}}=e,a=i.sessionOptions?.refetchInterval??0,o=i.sessionOptions?.refetchOnWindowFocus??!0,s=i.sessionOptions?.refetchWhenOffline??!1,c={isInitialized:!1,lastSessionRequest:0},l=()=>s||ky().isOnline,u=e=>{if(l()){if(e?.event===`storage`){t();return}if(e?.event===`poll`){c.lastSessionRequest=Ay(),t();return}if(e?.event===`visibilitychange`){if(Ay()-c.lastSessionRequest<jy)return;c.lastSessionRequest=Ay(),t();return}t()}},d=e=>{Cy().post({event:`session`,data:{trigger:e},clientId:Math.random().toString(36).substring(7)})},f=()=>{a&&a>0&&(c.pollInterval=setInterval(()=>{n()&&u({event:`poll`})},a*1e3))},p=()=>{c.unsubscribeBroadcast=Cy().subscribe(()=>{u({event:`storage`})})},m=()=>{o&&(c.unsubscribeFocus=Ey().subscribe(()=>{u({event:`visibilitychange`})}))},h=()=>{c.unsubscribeOnline=ky().subscribe(e=>{e&&u({event:`visibilitychange`})})},g=()=>{c.unsubscribeSignal=r.listen(()=>{t()})};return{init:()=>{c.isInitialized||(c.isInitialized=!0,f(),p(),m(),h(),g(),c.cleanupBroadcastSetup=Cy().setup(),c.cleanupFocusSetup=Ey().setup(),c.cleanupOnlineSetup=ky().setup())},cleanup:()=>{c.isInitialized&&(c.pollInterval&&=(clearInterval(c.pollInterval),void 0),c.unsubscribeBroadcast&&=(c.unsubscribeBroadcast(),void 0),c.unsubscribeFocus&&=(c.unsubscribeFocus(),void 0),c.unsubscribeOnline&&=(c.unsubscribeOnline(),void 0),c.unsubscribeSignal&&=(c.unsubscribeSignal(),void 0),c.cleanupBroadcastSetup&&=(c.cleanupBroadcastSetup(),void 0),c.cleanupFocusSetup&&=(c.cleanupFocusSetup(),void 0),c.cleanupOnlineSetup&&=(c.cleanupOnlineSetup(),void 0),c.isInitialized=!1,c.lastSessionRequest=0)},triggerRefetch:u,broadcastSessionUpdate:d}}var Ny=()=>typeof window>`u`;function Py(e){return typeof e==`object`&&e&&`data`in e&&`error`in e?e:{data:e,error:null}}function Fy(e){return!e||e.session===null&&e.user===null?null:e}function Iy(e,t){return vy(e.data,t.data)&&e.error===t.error&&e.isPending===t.isPending&&e.isRefetching===t.isRefetching&&e.refetch===t.refetch}function Ly(e,t){let n=sy(!1),r,i=e=>s(e),a=sy({data:null,error:null,isPending:!0,isRefetching:!1,refetch:i});yy(a,Iy);let o=e=>{if(r!==e)return;let t=a.get();r=void 0,!(!t.isPending&&!t.isRefetching)&&a.set({...t,isPending:!1,isRefetching:!1,refetch:i})},s=async t=>{r?.abort();let n=new AbortController;r=n;let s=a.get();a.set({...s,isPending:s.data===null,isRefetching:!0,error:null,refetch:i});try{let r=await e(`/get-session`,{method:`GET`,query:t?.query,signal:n.signal});if(n.signal.aborted){o(n);return}let{data:s,error:c}=Py(r);if(s?.needsRefresh)try{let t=await e(`/get-session`,{method:`POST`,signal:n.signal});if(n.signal.aborted){o(n);return}({data:s,error:c}=Py(t))}catch{if(n.signal.aborted){o(n);return}}if(c){let e=a.get(),t=c?.status===401;a.set({data:t?null:e.data,error:c,isPending:!1,isRefetching:!1,refetch:i});return}let l=Fy(s),u=a.get(),d=u.data!=null&&l!=null&&vy(u.data,l)?u.data:l;a.set({data:d,error:null,isPending:!1,isRefetching:!1,refetch:i})}catch(e){if(n.signal.aborted){o(n);return}let t=a.get();a.set({data:t.data,error:e,isPending:!1,isRefetching:!1,refetch:i})}},c=()=>{};return hy(a,()=>{let e;Ny()||(e=setTimeout(()=>{s()},0));let i=My({fetchSession:s,shouldPollSession:()=>a.get().data!=null,sessionSignal:n,options:t});return i.init(),c=i.broadcastSessionUpdate,()=>{e&&clearTimeout(e);let t=r;t?.abort(),t&&o(t),i.cleanup()}}),{session:a,$sessionSignal:n,broadcastSessionUpdate:e=>c(e)}}function Ry(e){if(typeof e!=`object`||!e)return!1;let 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 zy(e,t,n=`.`,r){if(!Ry(t))return zy(e,{},n,r);let i={...t};for(let t of Object.keys(e)){if(t===`__proto__`||t===`constructor`)continue;let a=e[t];a!=null&&(r&&r(i,t,a,n)||(Array.isArray(a)&&Array.isArray(i[t])?i[t]=[...a,...i[t]]:Ry(a)&&Ry(i[t])?i[t]=zy(a,i[t],(n?`${n}.`:``)+t.toString(),r):i[t]=a))}return i}function By(e){return(...t)=>t.reduce((t,n)=>zy(t,n,``,e),{})}var Vy=By(),Hy=Object.defineProperty,Uy=Object.defineProperties,Wy=Object.getOwnPropertyDescriptors,Gy=Object.getOwnPropertySymbols,Ky=Object.prototype.hasOwnProperty,qy=Object.prototype.propertyIsEnumerable,Jy=(e,t,n)=>t in e?Hy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Yy=(e,t)=>{for(var n in t||={})Ky.call(t,n)&&Jy(e,n,t[n]);if(Gy)for(var n of Gy(t))qy.call(t,n)&&Jy(e,n,t[n]);return e},Xy=(e,t)=>Uy(e,Wy(t)),Zy=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)}},Qy=async(e,t)=>{let n=t||{},r={onRequest:[t?.onRequest],onResponse:[t?.onResponse],onSuccess:[t?.onSuccess],onError:[t?.onError],onRetry:[t?.onRetry]};if(!t||!t?.plugins)return{url:e,options:n,hooks:r};for(let i of t?.plugins||[]){if(i.init){let r=await i.init?.call(i,e.toString(),t);n=r.options||n,e=r.url}r.onRequest.push(i.hooks?.onRequest),r.onResponse.push(i.hooks?.onResponse),r.onSuccess.push(i.hooks?.onSuccess),r.onError.push(i.hooks?.onError),r.onRetry.push(i.hooks?.onRetry)}return{url:e,options:n,hooks:r}},$y=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}},eb=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 tb(e){if(typeof e==`number`)return new $y({type:`linear`,attempts:e,delay:1e3});switch(e.type){case`linear`:return new $y(e);case`exponential`:return new eb(e);default:throw Error(`Invalid retry strategy`)}}var nb=async e=>{let t={},n=async e=>typeof e==`function`?await e():e;if(e?.auth){if(e.auth.type===`Bearer`){let r=await n(e.auth.token);if(!r)return t;t.authorization=`Bearer ${r}`}else if(e.auth.type===`Basic`){let[r,i]=await Promise.all([n(e.auth.username),n(e.auth.password)]);if(!r||!i)return t;t.authorization=`Basic ${btoa(`${r}:${i}`)}`}else if(e.auth.type===`Custom`){let[r,i]=await Promise.all([n(e.auth.prefix),n(e.auth.value)]);if(!i)return t;t.authorization=`${r??``} ${i}`}}return t},rb=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function ib(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 rb.test(r)?`json`:n.has(r)||r.startsWith(`text/`)?`text`:`blob`}function ab(e){try{return JSON.parse(e),!0}catch{return!1}}function ob(e){if(e===void 0)return!1;let t=typeof e;return t===`string`||t===`number`||t===`boolean`||t===null?!0:t===`object`?Array.isArray(e)?!0:e.buffer?!1:e.constructor&&e.constructor.name===`Object`||typeof e.toJSON==`function`:!1}function sb(e){try{return JSON.parse(e)}catch{return e}}function cb(e){return typeof e==`function`}function lb(e){if(e?.customFetchImpl)return e.customFetchImpl;if(typeof globalThis<`u`&&cb(globalThis.fetch))return globalThis.fetch;if(typeof window<`u`&&cb(window.fetch))return window.fetch;throw Error(`No fetch implementation found`)}function ub(...e){let t={};for(let n of e)if(n)if(n instanceof Headers)n.forEach((e,n)=>{t[n]=e});else{let e=Array.isArray(n)?n:Object.entries(n);for(let[n,r]of e)r!=null&&(t[n]=r)}return t}async function db(e){let t=new Headers(ub(e?.headers,await nb(e)));if(!t.has(`content-type`)){let n=fb(e?.body);n&&t.set(`content-type`,n)}return t}function fb(e){return ob(e)?`application/json`:null}function pb(e){let t=e.get(`content-type`);return t?t.split(`;`)[0].trim().toLowerCase():null}function mb(e,t){let{body:n}=e;return n?!ob(n)||typeof n==`string`?n:pb(t)===`application/x-www-form-urlencoded`?new URLSearchParams(n).toString():JSON.stringify(n):null}function hb(e,t){if(t?.method)return t.method.toUpperCase();if(e.startsWith(`@`)){let n=e.split(`@`)[1]?.split(`/`)[0];return yb.includes(n)?n.toUpperCase():t?.body?`POST`:`GET`}return t?.body?`POST`:`GET`}function gb(e,t){let n;return!e?.signal&&e?.timeout&&(n=setTimeout(()=>t?.abort(),e?.timeout)),{abortTimeout:n,clearTimeout:()=>{n&&clearTimeout(n)}}}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 vb(e,t){let n=await e[`~standard`].validate(t);if(n.issues)throw new _b(n.issues);return n.value}var yb=[`get`,`post`,`put`,`patch`,`delete`],bb=e=>({id:`apply-schema`,name:`Apply Schema`,version:`1.0.0`,async init(t,n){let r=e.plugins?.find(e=>e.schema?.config?t.startsWith(e.schema.config.baseURL||``)||t.startsWith(e.schema.config.prefix||``):!1)?.schema||e.schema;if(r){let e=t;r.config?.prefix&&e.startsWith(r.config.prefix)&&(e=e.replace(r.config.prefix,``),r.config.baseURL&&(t=t.replace(r.config.prefix,r.config.baseURL))),r.config?.baseURL&&e.startsWith(r.config.baseURL)&&(e=e.replace(r.config.baseURL,``)),e.startsWith(`/`)&&e.charAt(1)===`@`&&(e=e.substring(1));let i=r.schema[e];if(i){let e=n?.headers;if(i.headers&&!n?.disableValidation){let t={};if(n?.headers){if(n.headers instanceof Headers)n.headers.forEach((e,n)=>{t[n.toLowerCase()]=e});else if(typeof n.headers==`object`)for(let[e,r]of Object.entries(n.headers))r!=null&&(t[e.toLowerCase()]=r)}let r=await vb(i.headers,t),a={};for(let[e,t]of Object.entries(r))a[e.toLowerCase()]=t;e=a}let r=Xy(Yy({},n),{method:i.method,output:i.output,headers:e});return n?.disableValidation||(r=Xy(Yy({},r),{body:i.input?await vb(i.input,n?.body):n?.body,params:i.params?await vb(i.params,n?.params):n?.params,query:i.query?await vb(i.query,n?.query):n?.query})),{url:t,options:r}}}return{url:t,options:n}}}),xb=e=>{async function t(t,n){let r=Xy(Yy(Yy({},e),n),{headers:ub(e?.headers,n?.headers),plugins:[...e?.plugins||[],bb(e||{}),...n?.plugins||[]]});if(e?.catchAllError)try{return await Tb(t,r)}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 Tb(t,r)}return t},Sb=e=>e===`.`||e===`..`;function Cb(e,t){let n=e;for(let[e,r]of t)n=n.replace(e,r);if(Sb(n))throw TypeError(`Path parameters cannot be reserved path segments`);return encodeURIComponent(n)}function wb(e,t){let{baseURL:n,params:r,query:i}=t||{query:{},params:{},baseURL:``},a=e.startsWith(`http`)?e.split(`/`).slice(0,3).join(`/`):n||``;if(e.startsWith(`@`)){let t=e.toString().split(`@`)[1].split(`/`)[0];yb.includes(t)&&(e=e.replace(`@${t}/`,`/`))}a.endsWith(`/`)||(a+=`/`);let[o,s]=e.replace(a,``).split(`?`),c=new URLSearchParams(s);for(let[e,t]of Object.entries(i||{})){if(t==null)continue;let n;if(typeof t==`string`)n=t;else if(Array.isArray(t)){for(let n of t)c.append(e,n);continue}else n=JSON.stringify(t);c.set(e,n)}let l=new Map;if(r)if(Array.isArray(r)){let e=o.split(`/`).filter(e=>e.startsWith(`:`));for(let[t,n]of e.entries()){let e=r[t];l.set(n,String(e))}}else for(let[e,t]of Object.entries(r))l.set(`:${e}`,String(t));o=o.split(`/`).map(e=>Cb(e,l)).join(`/`),o=o.replace(/^\/+/,``);let u=c.toString();return u=u.length>0?`?${u}`.replace(/\+/g,`%20`):``,a.startsWith(`http`)?new URL(`${o}${u}`,a):`${a}${o}${u}`}var Tb=async(e,t)=>{let{hooks:n,url:r,options:i}=await Qy(e,t),a=lb(i),o=new AbortController,s=i.signal??o.signal,c=wb(r,i),l=await db(i),u=mb(i,l),d=hb(r,i),f=Xy(Yy({},i),{url:c,headers:l,body:u,method:d,signal:s});for(let e of n.onRequest)if(e){let t=await e(f);typeof t==`object`&&t&&Object.assign(f,t)}(`pipeTo`in f&&typeof f.pipeTo==`function`||typeof t?.body?.pipe==`function`)&&(`duplex`in f||(f.duplex=`half`));let{clearTimeout:p}=gb(i,o),m=await a(f.url,f);p();let h={response:m,request:f};for(let e of n.onResponse)if(e){let n=await e(Xy(Yy({},h),{response:t?.hookOptions?.cloneResponse?m.clone():m}));n instanceof Response?m=n:typeof n==`object`&&n&&(m=n.response)}if(m.ok){if(f.method===`HEAD`)return{data:``,error:null};let e=ib(m),r={data:null,response:m,request:f};if(e===`json`||e===`text`){let e=await m.text();r.data=await(f.jsonParser??sb)(e)}else r.data=await m[e]();f?.output&&f.output&&!f.disableValidation&&(r.data=await vb(f.output,r.data));for(let e of n.onSuccess)e&&await e(Xy(Yy({},r),{response:t?.hookOptions?.cloneResponse?m.clone():m}));return t?.throw?r.data:{data:r.data,error:null}}let g=t?.jsonParser??sb,_=await m.text(),v=ab(_),y=v?await g(_):null,b={response:m,responseText:_,request:f,error:Xy(Yy({},y),{status:m.status,statusText:m.statusText})};for(let e of n.onError)e&&await e(Xy(Yy({},b),{response:t?.hookOptions?.cloneResponse?m.clone():m}));if(t?.retry){let r=tb(t.retry),i=t.retryAttempt??0;if(await r.shouldAttemptRetry(i,m)){for(let e of n.onRetry)e&&await e(h);let a=r.getDelay(i);return await new Promise(e=>setTimeout(e,a)),await Tb(e,Xy(Yy({},t),{retryAttempt:i+1}))}}if(t?.throw)throw new Zy(m.status,m.statusText,v?y:_);return{data:null,error:Xy(Yy({},y),{status:m.status,statusText:m.statusText})}},Eb=e=>{if(typeof process>`u`)return;let t=e??`/api/auth`;if({}.NEXT_PUBLIC_AUTH_URL)return{}.NEXT_PUBLIC_AUTH_URL;if(typeof window>`u`){if({}.NEXTAUTH_URL)try{return{}.NEXTAUTH_URL}catch{}if({}.VERCEL_URL)try{let e={}.VERCEL_URL.startsWith(`http`)?``:`https://`;return`${new URL(`${e}${{}.VERCEL_URL}`).origin}${t}`}catch{}}},Db=(e,t)=>{let n=`credentials`in Request.prototype,r=Wv(e?.baseURL,e?.basePath,void 0,t)??Eb(e?.basePath)??`/api/auth`,i=e?.plugins?.flatMap(e=>e.fetchPlugins).filter(e=>e!==void 0)||[],a={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:s,onRequest:c,onResponse:l,...u}=e?.fetchOptions||{},d=xb({baseURL:r,...n?{credentials:`include`}:{},method:`GET`,jsonParser(e){return e?$v(e,{strict:!1}):null},customFetchImpl:fetch,...u,plugins:[a,...u.plugins||[],...e?.disableDefaultFetchPlugins?[]:[ny],...i]}),{$sessionSignal:f,session:p,broadcastSessionUpdate:m}=Ly(d,e),h=e?.plugins||[],g={},_={$sessionSignal:f,session:p},v={"/sign-out":`POST`,"/revoke-sessions":`POST`,"/revoke-other-sessions":`POST`,"/delete-user":`POST`},y=[{signal:`$sessionSignal`,matcher(e){return 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`},callback(e){e===`/sign-out`?m(`signout`):(e===`/update-user`||e===`/update-session`)&&m(`updateUser`)}}];for(let e of h)e.getAtoms&&Object.assign(_,e.getAtoms?.(d)),e.pathMethods&&Object.assign(v,e.pathMethods),e.atomListeners&&y.push(...e.atomListeners);let b={notify:e=>{_[e].set(!_[e].get())},listen:(e,t)=>{_[e].subscribe(t)},atoms:_};for(let t of h)t.getActions&&(g=Vy(t.getActions?.(d,b,e)??{},g));return{get baseURL(){return r},pluginsActions:g,pluginsAtoms:_,pluginPathMethods:v,atomListeners:y,$fetch:d,$store:b}};function Ob(e){return typeof e==`object`&&!!e&&`get`in e&&typeof e.get==`function`&&`lc`in e&&typeof e.lc==`number`}function kb(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Ab=/[\p{Ll}\d]+|\p{Lu}+(?!\p{Ll})|\p{Lu}[\p{Ll}\d]+|\p{Lo}+/gu,jb=/['\u2019]/g;function Mb(e){return e.replace(jb,``).match(Ab)??[]}function Nb(e){return Mb(e).map(e=>e.toLowerCase()).join(`-`)}function Pb(e,t,n){let r=t[e],{fetchOptions:i,query:a,...o}=n||{};return r||(i?.method?i.method:o&&Object.keys(o).length>0?`POST`:`GET`)}function Fb(e,t,n,r,i){function a(o=[]){return new Proxy(function(){},{get(t,n){if(typeof n!=`string`||n===`then`||n===`catch`||n===`finally`)return;let r=[...o,n],i=e;for(let e of r)if(i&&typeof i==`object`&&e in i)i=i[e];else{i=void 0;break}return typeof i==`function`||Ob(i)?i:a(r)},apply:async(e,a,s)=>{let c=`/`+o.map(Nb).join(`/`),l=s[0]||{},u=s[1]||{},{query:d,fetchOptions:f,...p}=l,m={...u,...f},h=Pb(c,n,l);return await t(c,{...m,body:h===`GET`?void 0:{...p,...m?.body||{}},query:d||m?.query,method:h,async onSuccess(e){if(await m?.onSuccess?.(e),!i||m.disableSignal)return;let t=i.filter(e=>e.matcher(c));if(!t.length)return;let n=new Set;for(let e of t){let t=r[e.signal];if(!t)return;if(n.has(e.signal))continue;n.add(e.signal);let i=t.get();setTimeout(()=>{t.set(!i)},10),e.callback?.(c)}}})}})}return a()}function Ib(e,t={}){let n=(0,z.useRef)(e.get()),{keys:r,deps:i=[e,r]}=t,a=(0,z.useCallback)(t=>{let i=e=>{n.current!==e&&(n.current=e,t())};return i(e.value),r?.length?gy(e,r,i):e.listen(i)},i),o=()=>n.current;return(0,z.useSyncExternalStore)(a,o,o)}function Lb(e){return`use${kb(e)}`}function Rb(e){let{pluginPathMethods:t,pluginsActions:n,pluginsAtoms:r,$fetch:i,$store:a,atomListeners:o}=Db(e),s={};for(let[e,t]of Object.entries(r))s[Lb(e)]=()=>Ib(t);return Fb({...n,...s,$fetch:i,$store:a},i,t,r,o)}var zb=`1.6.20`,Bb=()=>({id:`device-authorization`,version:zb,$InferServerPlugin:{},pathMethods:{"/device/code":`POST`,"/device/token":`POST`,"/device":`GET`,"/device/approve":`POST`,"/device/deny":`POST`}}),Vb=Mv({OTP_EXPIRED:`OTP expired`,INVALID_OTP:`Invalid OTP`,TOO_MANY_ATTEMPTS:`Too many attempts`}),Hb=()=>({id:`email-otp`,version:zb,$InferServerPlugin:{},atomListeners:[{matcher:e=>e===`/email-otp/verify-email`||e===`/sign-in/email-otp`||e===`/email-otp/request-email-change`,signal:`$sessionSignal`}],$ERROR_CODES:Vb}),Ub=`/console/api/auth`;function Wb(e=globalThis.location){return qb()||(e?`${Gb(e.origin)}${Ub}`:`${Kb}${Ub}`)}function Gb(e){return e.endsWith(`/`)?e.slice(0,-1):e}var Kb=`http://127.0.0.1:3000`;function qb(){let e=Jb(`BETTER_AUTH_URL`)??Jb(`PUBLIC_BETTER_AUTH_URL`)??Yb(`VITE_BETTER_AUTH_URL`);return e?Gb(e):void 0}function Jb(e){return typeof process>`u`?void 0:{}[e]?.trim()||void 0}function Yb(e){return{BASE_URL:`/console/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,TSS_CLIENT_OUTPUT_DIR:`dist/client`,TSS_DEV_SERVER:`false`,TSS_ROUTER_BASEPATH:`console`,TSS_SERVER_FN_BASE:`/console/_serverFn/`}[e]?.trim()||void 0}var Xb=Rb({baseURL:Zb(),plugins:[Bb(),Hb()]});function Zb(){return Wb(globalThis.location===void 0?void 0:globalThis.location)}var Qb=`http://console.invalid`,$b=`/console`,ex=`/runs`,tx=[`/signin`,`/signup`,`/forgot-password`,`/reset-password`,`/device`];function nx(e){let t=sx(e);return tx.some(e=>t===e||t.startsWith(`${e}/`))}function rx(e){let t=sx(e);return!(t.startsWith(`/api/`)||nx(t))}function ix(e){if(e==null)return ex;let t=e.trim();if(!t.startsWith(`/`)||t.startsWith(`//`)||t.includes(`\\`))return ex;let n;try{n=new URL(t,Qb)}catch{return ex}if(n.origin!==Qb)return ex;let r=sx(n.pathname);return!cx(r)||!lx(r)?ex:`${r}${n.search}${n.hash}`}function ax(e){return`${e.pathname}${e.searchStr}`}function ox(e){return`${$b}${ix(e)}`}function sx(e){let t;try{t=new URL(e,Qb).pathname}catch{t=`/`}return t===$b?`/`:t.startsWith(`${$b}/`)?t.slice(8):t||`/`}function cx(e){try{let t=decodeURIComponent(e);return!t.startsWith(`//`)&&!t.startsWith(`/\\`)}catch{return!1}}function lx(e){return rx(e)||e===`/device`}var ux=(0,z.createContext)(null);function dx(){let e=(0,z.useContext)(ux);if(e===null)throw Error(`useConsoleSession must be used inside App`);return e}function fx(e){let t=Ic(),n=Lo(),r=fo(),i=Xb.useSession(),a=i.data?.user,o=ax(n),s=rx(n.pathname),c=nx(n.pathname),l=a==null&&s,[u,d]=(0,z.useState)(!1);(0,z.useEffect)(()=>{i.isPending||d(!0)},[i.isPending]);let f=(0,z.useCallback)(async()=>{await i.refetch()},[i.refetch]),p=(0,z.useCallback)(async()=>{await Xb.signOut(),t.clear(),await r({to:`/signin`,search:{redirect:ix(o)},replace:!0})},[r,o,t]);return(0,z.useEffect)(()=>{i.isPending||!l||r({to:`/signin`,search:{redirect:ix(o)},replace:!0})},[l,r,o,i.isPending]),i.isPending&&!u?null:a==null?l?null:(0,R.jsx)(R.Fragment,{children:e.children}):(0,R.jsx)(ux.Provider,{value:{user:a,refreshSession:f,onSignOut:p},children:c?e.children:(0,R.jsx)(px,{children:e.children})})}function px(e){let{onSignOut:t,user:n}=dx(),r=Rl();return(0,R.jsx)(sv,{connection:r.isError?r.data===void 0?`error`:`degraded`:r.isPending?`pending`:`ok`,user:n,onSignOut:t,children:e.children})}var mx=`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%3e%3ctitle%3eFlakes%3c/title%3e%3cdefs%3e%3ccircle%20id='n'%20cx='12'%20cy='4.2'%20r='1.9'%20fill='%2310b981'/%3e%3c/defs%3e%3cuse%20href='%23n'/%3e%3cuse%20href='%23n'%20transform='rotate(60%2012%2012)'/%3e%3cuse%20href='%23n'%20transform='rotate(120%2012%2012)'/%3e%3cuse%20href='%23n'%20transform='rotate(180%2012%2012)'/%3e%3cuse%20href='%23n'%20transform='rotate(240%2012%2012)'/%3e%3cuse%20href='%23n'%20transform='rotate(300%2012%2012)'/%3e%3ccircle%20cx='12'%20cy='12'%20r='2.4'%20fill='%2310b981'/%3e%3c/svg%3e`,hx=`/console/assets/styles-8wEqfToJ.css`,gx=`modulepreload`,_x=function(e){return`/console/`+e},vx={},yx=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=_x(t,n),t in vx)return;vx[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:gx,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},bx=mo({head:()=>({meta:[{charSet:`utf-8`},{name:`viewport`,content:`width=device-width, initial-scale=1.0`},{title:`flakes console`}],links:[{rel:`stylesheet`,href:hx},{rel:`icon`,type:`image/svg+xml`,href:mx}]}),component:xx});function xx(){let[e,t]=(0,z.useState)(!1);(0,z.useEffect)(()=>{t(!0),X_()},[]);let[n]=(0,z.useState)(wx);return(0,R.jsx)(Sx,{children:(0,R.jsxs)(Lc,{client:n,children:[(0,R.jsx)(fx,{children:(0,R.jsx)(z.Suspense,{fallback:(0,R.jsx)(Cx,{}),children:(0,R.jsx)(Ao,{})})}),null]})})}function Sx({children:e}){return(0,R.jsxs)(`html`,{lang:`en`,suppressHydrationWarning:!0,children:[(0,R.jsx)(`head`,{children:(0,R.jsx)(Ho,{})}),(0,R.jsxs)(`body`,{className:`flex min-h-screen flex-col`,children:[e,(0,R.jsx)(Uo,{})]})]})}function Cx(){return(0,R.jsx)(`section`,{className:`grid min-h-72 place-items-center p-8`,children:(0,R.jsx)(nl,{className:`size-5 animate-spin text-muted-foreground`})})}function wx(){return new Pc({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1,refetchIntervalInBackground:!0}}})}var Tx=ho(`/signup`)({validateSearch:e=>({redirect:ix(typeof e.redirect==`string`?e.redirect:void 0)}),component:yo(()=>yx(()=>import(`./signup-KmFQL_1g.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])),`component`)}),Ex=ho(`/signin`)({validateSearch:e=>({redirect:ix(typeof e.redirect==`string`?e.redirect:void 0)}),component:yo(()=>yx(()=>import(`./signin-DylILjyG.js`),__vite__mapDeps([11,1,2,3,5,4,6,7,9,10])),`component`)}),Dx=ho(`/sandboxes`)({validateSearch:e=>({runId:typeof e.runId==`string`?e.runId:void 0}),component:yo(()=>yx(()=>import(`./sandboxes-BBIIbVN8.js`),__vite__mapDeps([12,1])),`component`)}),Ox=ho(`/runs`)({validateSearch:e=>{let t=e.state;return t===`RUNNING`||t===`SUCCEEDED`||t===`FAILED`?{state:t}:{}},component:yo(()=>yx(()=>import(`./runs-Cuk0VOVi.js`),__vite__mapDeps([13,1])),`component`)}),kx=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function Ax(e){let t=e.email.trim().toLowerCase(),n=e.password,r={};return kx.test(t)||(r.email=`Enter a valid email address.`),n.length===0&&(r.password=`Enter your password.`),Object.keys(r).length>0?{ok:!1,errors:r}:{ok:!0,data:{email:t,password:n}}}function jx(e){let t=e.name.trim(),n=e.email.trim().toLowerCase(),r=e.password,i={};return t.length===0&&(i.name=`Enter your name.`),kx.test(n)||(i.email=`Enter a valid email address.`),r.length<8&&(i.password=`Use at least 8 characters for the password.`),Object.keys(i).length>0?{ok:!1,errors:i}:{ok:!0,data:{name:t,email:n,password:r}}}function Mx(e){let t=e.password,n=e.confirmPassword,r={};return t.length<8&&(r.password=`Use at least 8 characters for the password.`),(n.length===0||n!==t)&&(r.confirmPassword=`Passwords must match.`),Object.keys(r).length>0?{ok:!1,errors:r}:{ok:!0,data:{password:t,confirmPassword:n}}}function Nx(e){let t=e.name.trim(),n={};return t.length===0&&(n.name=`Enter your name.`),Object.keys(n).length>0?{ok:!1,errors:n}:{ok:!0,data:{name:t}}}function Px(e){let t=e.currentPassword,n=e.newPassword,r=e.confirmPassword,i={};return t.length===0&&(i.currentPassword=`Enter your current password.`),n.length<8?i.newPassword=`Use at least 8 characters for the new password.`:n===t&&(i.newPassword=`Choose a different password.`),(r.length===0||r!==n)&&(i.confirmPassword=`Passwords must match.`),Object.keys(i).length>0?{ok:!1,errors:i}:{ok:!0,data:{currentPassword:t,newPassword:n,confirmPassword:r}}}function Fx(e){let t=zx(e.token)??zx(e.code);return t===``?null:t}function Ix(e){let t=Bx(e,`code`).toLowerCase(),n=Bx(e,`statusText`).toLowerCase(),r=Vx(e).toLowerCase();return t===`invalid_token`||n===`invalid_token`||(r.includes(`token`)||r.includes(`link`))&&(r.includes(`invalid`)||r.includes(`expired`)||r.includes(`expire`))}function Lx(e,t=`Authentication failed.`){let n=Vx(e),r=n.toLowerCase();return Rx(e)?`Please verify your email before signing in.`:r.includes(`already exists`)||r.includes(`already registered`)?`An account already exists for that email.`:r.includes(`invalid email or password`)||r.includes(`invalid credentials`)?`Email or password is incorrect.`:n||t}function Rx(e){let t=Vx(e).toLowerCase();return t.includes(`email not verified`)||t.includes(`verify your email`)}function zx(e){return typeof e==`string`?e.trim():null}function Bx(e,t){if(typeof e==`object`&&e&&t in e){let n=e[t];return typeof n==`string`?n:``}return``}function Vx(e){if(typeof e==`object`&&e&&`message`in e){let t=e.message;return typeof t==`string`?t:``}return e instanceof Error?e.message:``}var Hx=ho(`/reset-password`)({validateSearch:e=>({redirect:ix(typeof e.redirect==`string`?e.redirect:void 0),token:Fx(e),error:typeof e.error==`string`?e.error:null}),component:yo(()=>yx(()=>import(`./reset-password-tImCgEn0.js`),__vite__mapDeps([14,1,2,3,4,6,7,9,10])),`component`)}),Ux=ho(`/forgot-password`)({validateSearch:e=>({redirect:ix(typeof e.redirect==`string`?e.redirect:void 0)}),component:yo(()=>yx(()=>import(`./forgot-password-C7qvwcpm.js`),__vite__mapDeps([15,1,2,3,4,6,7,9,10])),`component`)}),Wx=`---
|
|
52
|
+
at `))}function Fv(e,t){class n extends e{#e;constructor(...e){if(Nv()){let t=Error.stackTraceLimit;Error.stackTraceLimit=0,super(...e),Error.stackTraceLimit=t}else super(...e);let t=Error().stack;t&&(this.#e=Pv(t.replace(/^Error/,this.name)))}get errorStack(){return this.#e}}return Object.defineProperty(n.prototype,"constructor",{get(){return t},enumerable:!1,configurable:!0}),n}var Iv={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};Fv(class extends Error{constructor(e=`INTERNAL_SERVER_ERROR`,t=void 0,n={},r=typeof e==`number`?e:Iv[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}},Error);var Lv=class extends Error{constructor(e,t){super(e,t),this.name=`BetterAuthError`,this.message=e,this.stack=``}},Rv=47;function zv(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===Rv;)t--;return t===e.length?e:e.slice(0,t)}function Bv(e){try{return(zv(new URL(e).pathname)||`/`)!==`/`}catch{throw new Lv(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}function Vv(e){try{let t=new URL(e);if(t.protocol!==`http:`&&t.protocol!==`https:`)throw new Lv(`Invalid base URL: ${e}. URL must include 'http://' or 'https://'`)}catch(t){throw t instanceof Lv?t:new Lv(`Invalid base URL: ${e}. Please provide a valid base URL.`,{cause:t})}}function Hv(e,t=`/api/auth`){if(Vv(e),Bv(e))return e;let n=zv(e);return!t||t===`/`?n:(t=t.startsWith(`/`)?t:`/${t}`,`${n}${t}`)}function Uv(e,t){return!e||e.trim()===``?!1:t===`proto`?e===`http`||e===`https`:t===`host`?[/\.\./,/\0/,/[\s]/,/^[.]/,/[<>'"]/,/javascript:/i,/file:/i,/data:/i].some(t=>t.test(e))?!1:/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*(:[0-9]{1,5})?$/.test(e)||/^(\d{1,3}\.){3}\d{1,3}(:[0-9]{1,5})?$/.test(e)||/^\[[0-9a-fA-F:]+\](:[0-9]{1,5})?$/.test(e)||/^localhost(:[0-9]{1,5})?$/i.test(e):!1}function Wv(e,t,n,r,i){if(e)return Hv(e,t);if(r!==!1){let e=Av.BETTER_AUTH_URL||Av.NEXT_PUBLIC_BETTER_AUTH_URL||Av.PUBLIC_BETTER_AUTH_URL||Av.NUXT_PUBLIC_BETTER_AUTH_URL||Av.NUXT_PUBLIC_AUTH_URL||(Av.BASE_URL===`/`?void 0:Av.BASE_URL);if(e)return Hv(e,t)}let a=n?.headers.get(`x-forwarded-host`),o=n?.headers.get(`x-forwarded-proto`);if(a&&o&&i&&Uv(o,`proto`)&&Uv(a,`host`))try{return Hv(`${o}://${a}`,t)}catch{}if(n){let e=Gv(n.url);if(!e)throw new Lv(`Could not get origin from request. Please provide a valid base URL.`);return Hv(e,t)}if(typeof window<`u`&&window.location)return Hv(window.location.origin,t)}function Gv(e){try{let t=new URL(e);return t.origin===`null`?null:t.origin}catch{return null}}var Kv={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*:/},qv=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,Jv={true:!0,false:!1,null:null,undefined:void 0,nan:NaN,infinity:1/0,"-infinity":-1/0},Yv=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;function Xv(e){return e instanceof Date&&!isNaN(e.getTime())}function Zv(e){let t=Yv.exec(e);if(!t)return null;let[,n,r,i,a,o,s,c,l,u,d]=t,f=new Date(Date.UTC(parseInt(n,10),parseInt(r,10)-1,parseInt(i,10),parseInt(a,10),parseInt(o,10),parseInt(s,10),c?parseInt(c.padEnd(3,`0`),10):0));if(l){let e=(parseInt(u,10)*60+parseInt(d,10))*(l===`+`?-1:1);f.setUTCMinutes(f.getUTCMinutes()+e)}return Xv(f)?f:null}function Qv(e,t={}){let{strict:n=!1,warnings:r=!1,reviver:i,parseDates:a=!0}=t;if(typeof e!=`string`)return e;let o=e.trim(),s=o.toLowerCase();if(s.length<=9&&s in Jv)return Jv[s];if(!qv.test(o)){if(n)throw SyntaxError(`[better-json] Invalid JSON`);return e}if(Object.entries(Kv).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(e===`__proto__`||e===`constructor`&&t&&typeof t==`object`&&`prototype`in t){r&&console.warn(`[better-json] Dropping "${e}" key to prevent prototype pollution`);return}if(a&&typeof t==`string`){let e=Zv(t);if(e)return e}return i?i(e,t):t})}catch(t){if(n)throw t;return e}}function $v(e,t={strict:!0}){return Qv(e,t)}var ey=[`javascript:`,`data:`,`vbscript:`];function ty(e){let t;try{t=new URL(e)}catch{return!0}return!ey.includes(t.protocol)}var ny={id:`redirect`,name:`Redirect`,hooks:{onSuccess(e){if(e.data?.url&&e.data?.redirect&&ty(e.data.url)&&typeof window<`u`&&window.location&&window.location)try{window.location.href=e.data.url}catch{}}}},ry=[],iy=0,ay=4,oy=globalThis.nanostoresGlobal||={epoch:0},sy=e=>{let t=[],n={get(){return n.lc||n.listen(()=>{})(),n.value},init:e,lc:0,listen(e){return n.lc=t.push(e),()=>{for(let t=iy+ay;t<ry.length;)ry[t]===e?ry.splice(t,ay):t+=ay;let r=t.indexOf(e);~r&&(t.splice(r,1),--n.lc||n.off())}},notify(e,r){oy.epoch++;let i=!ry.length;for(let i of t)ry.push(i,n.value,e,r);if(i){for(iy=0;iy<ry.length;iy+=ay)ry[iy](ry[iy+1],ry[iy+2],ry[iy+3]);ry.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},cy=2,ly=5,uy=6,dy=10,fy=(e,t,n,r)=>(e.events=e.events||{},e.events[n+dy]||(e.events[n+dy]=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],i=r.indexOf(t);r.splice(i,1),r.length||(delete e.events[n],e.events[n+dy](),delete e.events[n+dy])}),py=(e,t)=>fy(e,t,cy,t=>{let n=e.set,r=e.setKey;return e.setKey&&=(n,i)=>{let a;if(t({abort:()=>{a=!0},changed:n,newValue:{...e.value,[n]:i}}),!a)return r(n,i)},e.set=e=>{let r;if(t({abort:()=>{r=!0},newValue:e}),!r)return n(e)},()=>{e.set=n,e.setKey=r}}),my=1e3,hy=(e,t)=>fy(e,n=>{let r=t(n);r&&e.events[uy].push(r)},ly,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[uy]=[],e.off=()=>{r(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let t of e.events[uy])t();e.events[uy]=[]}},my)},()=>{e.listen=n,e.off=r}});function gy(e,t,n){let r=new Set(t).add(void 0);return e.listen((e,t,i)=>{r.has(i)&&n(e,t,i)})}function _y(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function vy(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!vy(e[n],t[n]))return!1;return!0}if(_y(e)&&_y(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)||!vy(e[r],t[r]))return!1;return!0}return!1}function yy(e,t){return py(e,({newValue:n,abort:r})=>{t(e.value,n)&&r()})}var by=Symbol.for(`better-auth:broadcast-channel`),xy=()=>Math.floor(Date.now()/1e3),Sy=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:xy()}))}catch{}}setup(){if(typeof window>`u`||window.addEventListener===void 0)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 Cy(e=`better-auth.message`){return globalThis[by]||(globalThis[by]=new Sy(e)),globalThis[by]}var wy=Symbol.for(`better-auth:focus-manager`),Ty=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`||window.addEventListener===void 0)return()=>{};let e=()=>{document.visibilityState===`visible`&&this.setFocused(!0)};return document.addEventListener(`visibilitychange`,e,!1),()=>{document.removeEventListener(`visibilitychange`,e,!1)}}};function Ey(){return globalThis[wy]||(globalThis[wy]=new Ty),globalThis[wy]}var Dy=Symbol.for(`better-auth:online-manager`),Oy=class{listeners=new Set;isOnline=typeof navigator<`u`?navigator.onLine:!0;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setOnline(e){this.isOnline=e,this.listeners.forEach(t=>t(e))}setup(){if(typeof window>`u`||window.addEventListener===void 0)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 ky(){return globalThis[Dy]||(globalThis[Dy]=new Oy),globalThis[Dy]}var Ay=()=>Math.floor(Date.now()/1e3),jy=5;function My(e){let{fetchSession:t,shouldPollSession:n=()=>!0,sessionSignal:r,options:i={}}=e,a=i.sessionOptions?.refetchInterval??0,o=i.sessionOptions?.refetchOnWindowFocus??!0,s=i.sessionOptions?.refetchWhenOffline??!1,c={isInitialized:!1,lastSessionRequest:0},l=()=>s||ky().isOnline,u=e=>{if(l()){if(e?.event===`storage`){t();return}if(e?.event===`poll`){c.lastSessionRequest=Ay(),t();return}if(e?.event===`visibilitychange`){if(Ay()-c.lastSessionRequest<jy)return;c.lastSessionRequest=Ay(),t();return}t()}},d=e=>{Cy().post({event:`session`,data:{trigger:e},clientId:Math.random().toString(36).substring(7)})},f=()=>{a&&a>0&&(c.pollInterval=setInterval(()=>{n()&&u({event:`poll`})},a*1e3))},p=()=>{c.unsubscribeBroadcast=Cy().subscribe(()=>{u({event:`storage`})})},m=()=>{o&&(c.unsubscribeFocus=Ey().subscribe(()=>{u({event:`visibilitychange`})}))},h=()=>{c.unsubscribeOnline=ky().subscribe(e=>{e&&u({event:`visibilitychange`})})},g=()=>{c.unsubscribeSignal=r.listen(()=>{t()})};return{init:()=>{c.isInitialized||(c.isInitialized=!0,f(),p(),m(),h(),g(),c.cleanupBroadcastSetup=Cy().setup(),c.cleanupFocusSetup=Ey().setup(),c.cleanupOnlineSetup=ky().setup())},cleanup:()=>{c.isInitialized&&(c.pollInterval&&=(clearInterval(c.pollInterval),void 0),c.unsubscribeBroadcast&&=(c.unsubscribeBroadcast(),void 0),c.unsubscribeFocus&&=(c.unsubscribeFocus(),void 0),c.unsubscribeOnline&&=(c.unsubscribeOnline(),void 0),c.unsubscribeSignal&&=(c.unsubscribeSignal(),void 0),c.cleanupBroadcastSetup&&=(c.cleanupBroadcastSetup(),void 0),c.cleanupFocusSetup&&=(c.cleanupFocusSetup(),void 0),c.cleanupOnlineSetup&&=(c.cleanupOnlineSetup(),void 0),c.isInitialized=!1,c.lastSessionRequest=0)},triggerRefetch:u,broadcastSessionUpdate:d}}var Ny=()=>typeof window>`u`;function Py(e){return typeof e==`object`&&e&&`data`in e&&`error`in e?e:{data:e,error:null}}function Fy(e){return!e||e.session===null&&e.user===null?null:e}function Iy(e,t){return vy(e.data,t.data)&&e.error===t.error&&e.isPending===t.isPending&&e.isRefetching===t.isRefetching&&e.refetch===t.refetch}function Ly(e,t){let n=sy(!1),r,i=e=>s(e),a=sy({data:null,error:null,isPending:!0,isRefetching:!1,refetch:i});yy(a,Iy);let o=e=>{if(r!==e)return;let t=a.get();r=void 0,!(!t.isPending&&!t.isRefetching)&&a.set({...t,isPending:!1,isRefetching:!1,refetch:i})},s=async t=>{r?.abort();let n=new AbortController;r=n;let s=a.get();a.set({...s,isPending:s.data===null,isRefetching:!0,error:null,refetch:i});try{let r=await e(`/get-session`,{method:`GET`,query:t?.query,signal:n.signal});if(n.signal.aborted){o(n);return}let{data:s,error:c}=Py(r);if(s?.needsRefresh)try{let t=await e(`/get-session`,{method:`POST`,signal:n.signal});if(n.signal.aborted){o(n);return}({data:s,error:c}=Py(t))}catch{if(n.signal.aborted){o(n);return}}if(c){let e=a.get(),t=c?.status===401;a.set({data:t?null:e.data,error:c,isPending:!1,isRefetching:!1,refetch:i});return}let l=Fy(s),u=a.get(),d=u.data!=null&&l!=null&&vy(u.data,l)?u.data:l;a.set({data:d,error:null,isPending:!1,isRefetching:!1,refetch:i})}catch(e){if(n.signal.aborted){o(n);return}let t=a.get();a.set({data:t.data,error:e,isPending:!1,isRefetching:!1,refetch:i})}},c=()=>{};return hy(a,()=>{let e;Ny()||(e=setTimeout(()=>{s()},0));let i=My({fetchSession:s,shouldPollSession:()=>a.get().data!=null,sessionSignal:n,options:t});return i.init(),c=i.broadcastSessionUpdate,()=>{e&&clearTimeout(e);let t=r;t?.abort(),t&&o(t),i.cleanup()}}),{session:a,$sessionSignal:n,broadcastSessionUpdate:e=>c(e)}}function Ry(e){if(typeof e!=`object`||!e)return!1;let 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 zy(e,t,n=`.`,r){if(!Ry(t))return zy(e,{},n,r);let i={...t};for(let t of Object.keys(e)){if(t===`__proto__`||t===`constructor`)continue;let a=e[t];a!=null&&(r&&r(i,t,a,n)||(Array.isArray(a)&&Array.isArray(i[t])?i[t]=[...a,...i[t]]:Ry(a)&&Ry(i[t])?i[t]=zy(a,i[t],(n?`${n}.`:``)+t.toString(),r):i[t]=a))}return i}function By(e){return(...t)=>t.reduce((t,n)=>zy(t,n,``,e),{})}var Vy=By(),Hy=Object.defineProperty,Uy=Object.defineProperties,Wy=Object.getOwnPropertyDescriptors,Gy=Object.getOwnPropertySymbols,Ky=Object.prototype.hasOwnProperty,qy=Object.prototype.propertyIsEnumerable,Jy=(e,t,n)=>t in e?Hy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Yy=(e,t)=>{for(var n in t||={})Ky.call(t,n)&&Jy(e,n,t[n]);if(Gy)for(var n of Gy(t))qy.call(t,n)&&Jy(e,n,t[n]);return e},Xy=(e,t)=>Uy(e,Wy(t)),Zy=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)}},Qy=async(e,t)=>{let n=t||{},r={onRequest:[t?.onRequest],onResponse:[t?.onResponse],onSuccess:[t?.onSuccess],onError:[t?.onError],onRetry:[t?.onRetry]};if(!t||!t?.plugins)return{url:e,options:n,hooks:r};for(let i of t?.plugins||[]){if(i.init){let r=await i.init?.call(i,e.toString(),t);n=r.options||n,e=r.url}r.onRequest.push(i.hooks?.onRequest),r.onResponse.push(i.hooks?.onResponse),r.onSuccess.push(i.hooks?.onSuccess),r.onError.push(i.hooks?.onError),r.onRetry.push(i.hooks?.onRetry)}return{url:e,options:n,hooks:r}},$y=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}},eb=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 tb(e){if(typeof e==`number`)return new $y({type:`linear`,attempts:e,delay:1e3});switch(e.type){case`linear`:return new $y(e);case`exponential`:return new eb(e);default:throw Error(`Invalid retry strategy`)}}var nb=async e=>{let t={},n=async e=>typeof e==`function`?await e():e;if(e?.auth){if(e.auth.type===`Bearer`){let r=await n(e.auth.token);if(!r)return t;t.authorization=`Bearer ${r}`}else if(e.auth.type===`Basic`){let[r,i]=await Promise.all([n(e.auth.username),n(e.auth.password)]);if(!r||!i)return t;t.authorization=`Basic ${btoa(`${r}:${i}`)}`}else if(e.auth.type===`Custom`){let[r,i]=await Promise.all([n(e.auth.prefix),n(e.auth.value)]);if(!i)return t;t.authorization=`${r??``} ${i}`}}return t},rb=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function ib(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 rb.test(r)?`json`:n.has(r)||r.startsWith(`text/`)?`text`:`blob`}function ab(e){try{return JSON.parse(e),!0}catch{return!1}}function ob(e){if(e===void 0)return!1;let t=typeof e;return t===`string`||t===`number`||t===`boolean`||t===null?!0:t===`object`?Array.isArray(e)?!0:e.buffer?!1:e.constructor&&e.constructor.name===`Object`||typeof e.toJSON==`function`:!1}function sb(e){try{return JSON.parse(e)}catch{return e}}function cb(e){return typeof e==`function`}function lb(e){if(e?.customFetchImpl)return e.customFetchImpl;if(typeof globalThis<`u`&&cb(globalThis.fetch))return globalThis.fetch;if(typeof window<`u`&&cb(window.fetch))return window.fetch;throw Error(`No fetch implementation found`)}function ub(...e){let t={};for(let n of e)if(n)if(n instanceof Headers)n.forEach((e,n)=>{t[n]=e});else{let e=Array.isArray(n)?n:Object.entries(n);for(let[n,r]of e)r!=null&&(t[n]=r)}return t}async function db(e){let t=new Headers(ub(e?.headers,await nb(e)));if(!t.has(`content-type`)){let n=fb(e?.body);n&&t.set(`content-type`,n)}return t}function fb(e){return ob(e)?`application/json`:null}function pb(e){let t=e.get(`content-type`);return t?t.split(`;`)[0].trim().toLowerCase():null}function mb(e,t){let{body:n}=e;return n?!ob(n)||typeof n==`string`?n:pb(t)===`application/x-www-form-urlencoded`?new URLSearchParams(n).toString():JSON.stringify(n):null}function hb(e,t){if(t?.method)return t.method.toUpperCase();if(e.startsWith(`@`)){let n=e.split(`@`)[1]?.split(`/`)[0];return yb.includes(n)?n.toUpperCase():t?.body?`POST`:`GET`}return t?.body?`POST`:`GET`}function gb(e,t){let n;return!e?.signal&&e?.timeout&&(n=setTimeout(()=>t?.abort(),e?.timeout)),{abortTimeout:n,clearTimeout:()=>{n&&clearTimeout(n)}}}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 vb(e,t){let n=await e[`~standard`].validate(t);if(n.issues)throw new _b(n.issues);return n.value}var yb=[`get`,`post`,`put`,`patch`,`delete`],bb=e=>({id:`apply-schema`,name:`Apply Schema`,version:`1.0.0`,async init(t,n){let r=e.plugins?.find(e=>e.schema?.config?t.startsWith(e.schema.config.baseURL||``)||t.startsWith(e.schema.config.prefix||``):!1)?.schema||e.schema;if(r){let e=t;r.config?.prefix&&e.startsWith(r.config.prefix)&&(e=e.replace(r.config.prefix,``),r.config.baseURL&&(t=t.replace(r.config.prefix,r.config.baseURL))),r.config?.baseURL&&e.startsWith(r.config.baseURL)&&(e=e.replace(r.config.baseURL,``)),e.startsWith(`/`)&&e.charAt(1)===`@`&&(e=e.substring(1));let i=r.schema[e];if(i){let e=n?.headers;if(i.headers&&!n?.disableValidation){let t={};if(n?.headers){if(n.headers instanceof Headers)n.headers.forEach((e,n)=>{t[n.toLowerCase()]=e});else if(typeof n.headers==`object`)for(let[e,r]of Object.entries(n.headers))r!=null&&(t[e.toLowerCase()]=r)}let r=await vb(i.headers,t),a={};for(let[e,t]of Object.entries(r))a[e.toLowerCase()]=t;e=a}let r=Xy(Yy({},n),{method:i.method,output:i.output,headers:e});return n?.disableValidation||(r=Xy(Yy({},r),{body:i.input?await vb(i.input,n?.body):n?.body,params:i.params?await vb(i.params,n?.params):n?.params,query:i.query?await vb(i.query,n?.query):n?.query})),{url:t,options:r}}}return{url:t,options:n}}}),xb=e=>{async function t(t,n){let r=Xy(Yy(Yy({},e),n),{headers:ub(e?.headers,n?.headers),plugins:[...e?.plugins||[],bb(e||{}),...n?.plugins||[]]});if(e?.catchAllError)try{return await Tb(t,r)}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 Tb(t,r)}return t},Sb=e=>e===`.`||e===`..`;function Cb(e,t){let n=e;for(let[e,r]of t)n=n.replace(e,r);if(Sb(n))throw TypeError(`Path parameters cannot be reserved path segments`);return encodeURIComponent(n)}function wb(e,t){let{baseURL:n,params:r,query:i}=t||{query:{},params:{},baseURL:``},a=e.startsWith(`http`)?e.split(`/`).slice(0,3).join(`/`):n||``;if(e.startsWith(`@`)){let t=e.toString().split(`@`)[1].split(`/`)[0];yb.includes(t)&&(e=e.replace(`@${t}/`,`/`))}a.endsWith(`/`)||(a+=`/`);let[o,s]=e.replace(a,``).split(`?`),c=new URLSearchParams(s);for(let[e,t]of Object.entries(i||{})){if(t==null)continue;let n;if(typeof t==`string`)n=t;else if(Array.isArray(t)){for(let n of t)c.append(e,n);continue}else n=JSON.stringify(t);c.set(e,n)}let l=new Map;if(r)if(Array.isArray(r)){let e=o.split(`/`).filter(e=>e.startsWith(`:`));for(let[t,n]of e.entries()){let e=r[t];l.set(n,String(e))}}else for(let[e,t]of Object.entries(r))l.set(`:${e}`,String(t));o=o.split(`/`).map(e=>Cb(e,l)).join(`/`),o=o.replace(/^\/+/,``);let u=c.toString();return u=u.length>0?`?${u}`.replace(/\+/g,`%20`):``,a.startsWith(`http`)?new URL(`${o}${u}`,a):`${a}${o}${u}`}var Tb=async(e,t)=>{let{hooks:n,url:r,options:i}=await Qy(e,t),a=lb(i),o=new AbortController,s=i.signal??o.signal,c=wb(r,i),l=await db(i),u=mb(i,l),d=hb(r,i),f=Xy(Yy({},i),{url:c,headers:l,body:u,method:d,signal:s});for(let e of n.onRequest)if(e){let t=await e(f);typeof t==`object`&&t&&Object.assign(f,t)}(`pipeTo`in f&&typeof f.pipeTo==`function`||typeof t?.body?.pipe==`function`)&&(`duplex`in f||(f.duplex=`half`));let{clearTimeout:p}=gb(i,o),m=await a(f.url,f);p();let h={response:m,request:f};for(let e of n.onResponse)if(e){let n=await e(Xy(Yy({},h),{response:t?.hookOptions?.cloneResponse?m.clone():m}));n instanceof Response?m=n:typeof n==`object`&&n&&(m=n.response)}if(m.ok){if(f.method===`HEAD`)return{data:``,error:null};let e=ib(m),r={data:null,response:m,request:f};if(e===`json`||e===`text`){let e=await m.text();r.data=await(f.jsonParser??sb)(e)}else r.data=await m[e]();f?.output&&f.output&&!f.disableValidation&&(r.data=await vb(f.output,r.data));for(let e of n.onSuccess)e&&await e(Xy(Yy({},r),{response:t?.hookOptions?.cloneResponse?m.clone():m}));return t?.throw?r.data:{data:r.data,error:null}}let g=t?.jsonParser??sb,_=await m.text(),v=ab(_),y=v?await g(_):null,b={response:m,responseText:_,request:f,error:Xy(Yy({},y),{status:m.status,statusText:m.statusText})};for(let e of n.onError)e&&await e(Xy(Yy({},b),{response:t?.hookOptions?.cloneResponse?m.clone():m}));if(t?.retry){let r=tb(t.retry),i=t.retryAttempt??0;if(await r.shouldAttemptRetry(i,m)){for(let e of n.onRetry)e&&await e(h);let a=r.getDelay(i);return await new Promise(e=>setTimeout(e,a)),await Tb(e,Xy(Yy({},t),{retryAttempt:i+1}))}}if(t?.throw)throw new Zy(m.status,m.statusText,v?y:_);return{data:null,error:Xy(Yy({},y),{status:m.status,statusText:m.statusText})}},Eb=e=>{if(typeof process>`u`)return;let t=e??`/api/auth`;if({}.NEXT_PUBLIC_AUTH_URL)return{}.NEXT_PUBLIC_AUTH_URL;if(typeof window>`u`){if({}.NEXTAUTH_URL)try{return{}.NEXTAUTH_URL}catch{}if({}.VERCEL_URL)try{let e={}.VERCEL_URL.startsWith(`http`)?``:`https://`;return`${new URL(`${e}${{}.VERCEL_URL}`).origin}${t}`}catch{}}},Db=(e,t)=>{let n=`credentials`in Request.prototype,r=Wv(e?.baseURL,e?.basePath,void 0,t)??Eb(e?.basePath)??`/api/auth`,i=e?.plugins?.flatMap(e=>e.fetchPlugins).filter(e=>e!==void 0)||[],a={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:s,onRequest:c,onResponse:l,...u}=e?.fetchOptions||{},d=xb({baseURL:r,...n?{credentials:`include`}:{},method:`GET`,jsonParser(e){return e?$v(e,{strict:!1}):null},customFetchImpl:fetch,...u,plugins:[a,...u.plugins||[],...e?.disableDefaultFetchPlugins?[]:[ny],...i]}),{$sessionSignal:f,session:p,broadcastSessionUpdate:m}=Ly(d,e),h=e?.plugins||[],g={},_={$sessionSignal:f,session:p},v={"/sign-out":`POST`,"/revoke-sessions":`POST`,"/revoke-other-sessions":`POST`,"/delete-user":`POST`},y=[{signal:`$sessionSignal`,matcher(e){return 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`},callback(e){e===`/sign-out`?m(`signout`):(e===`/update-user`||e===`/update-session`)&&m(`updateUser`)}}];for(let e of h)e.getAtoms&&Object.assign(_,e.getAtoms?.(d)),e.pathMethods&&Object.assign(v,e.pathMethods),e.atomListeners&&y.push(...e.atomListeners);let b={notify:e=>{_[e].set(!_[e].get())},listen:(e,t)=>{_[e].subscribe(t)},atoms:_};for(let t of h)t.getActions&&(g=Vy(t.getActions?.(d,b,e)??{},g));return{get baseURL(){return r},pluginsActions:g,pluginsAtoms:_,pluginPathMethods:v,atomListeners:y,$fetch:d,$store:b}};function Ob(e){return typeof e==`object`&&!!e&&`get`in e&&typeof e.get==`function`&&`lc`in e&&typeof e.lc==`number`}function kb(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Ab=/[\p{Ll}\d]+|\p{Lu}+(?!\p{Ll})|\p{Lu}[\p{Ll}\d]+|\p{Lo}+/gu,jb=/['\u2019]/g;function Mb(e){return e.replace(jb,``).match(Ab)??[]}function Nb(e){return Mb(e).map(e=>e.toLowerCase()).join(`-`)}function Pb(e,t,n){let r=t[e],{fetchOptions:i,query:a,...o}=n||{};return r||(i?.method?i.method:o&&Object.keys(o).length>0?`POST`:`GET`)}function Fb(e,t,n,r,i){function a(o=[]){return new Proxy(function(){},{get(t,n){if(typeof n!=`string`||n===`then`||n===`catch`||n===`finally`)return;let r=[...o,n],i=e;for(let e of r)if(i&&typeof i==`object`&&e in i)i=i[e];else{i=void 0;break}return typeof i==`function`||Ob(i)?i:a(r)},apply:async(e,a,s)=>{let c=`/`+o.map(Nb).join(`/`),l=s[0]||{},u=s[1]||{},{query:d,fetchOptions:f,...p}=l,m={...u,...f},h=Pb(c,n,l);return await t(c,{...m,body:h===`GET`?void 0:{...p,...m?.body||{}},query:d||m?.query,method:h,async onSuccess(e){if(await m?.onSuccess?.(e),!i||m.disableSignal)return;let t=i.filter(e=>e.matcher(c));if(!t.length)return;let n=new Set;for(let e of t){let t=r[e.signal];if(!t)return;if(n.has(e.signal))continue;n.add(e.signal);let i=t.get();setTimeout(()=>{t.set(!i)},10),e.callback?.(c)}}})}})}return a()}function Ib(e,t={}){let n=(0,z.useRef)(e.get()),{keys:r,deps:i=[e,r]}=t,a=(0,z.useCallback)(t=>{let i=e=>{n.current!==e&&(n.current=e,t())};return i(e.value),r?.length?gy(e,r,i):e.listen(i)},i),o=()=>n.current;return(0,z.useSyncExternalStore)(a,o,o)}function Lb(e){return`use${kb(e)}`}function Rb(e){let{pluginPathMethods:t,pluginsActions:n,pluginsAtoms:r,$fetch:i,$store:a,atomListeners:o}=Db(e),s={};for(let[e,t]of Object.entries(r))s[Lb(e)]=()=>Ib(t);return Fb({...n,...s,$fetch:i,$store:a},i,t,r,o)}var zb=`1.6.20`,Bb=()=>({id:`device-authorization`,version:zb,$InferServerPlugin:{},pathMethods:{"/device/code":`POST`,"/device/token":`POST`,"/device":`GET`,"/device/approve":`POST`,"/device/deny":`POST`}}),Vb=Mv({OTP_EXPIRED:`OTP expired`,INVALID_OTP:`Invalid OTP`,TOO_MANY_ATTEMPTS:`Too many attempts`}),Hb=()=>({id:`email-otp`,version:zb,$InferServerPlugin:{},atomListeners:[{matcher:e=>e===`/email-otp/verify-email`||e===`/sign-in/email-otp`||e===`/email-otp/request-email-change`,signal:`$sessionSignal`}],$ERROR_CODES:Vb}),Ub=`/console/api/auth`;function Wb(e=globalThis.location){return qb()||(e?`${Gb(e.origin)}${Ub}`:`${Kb}${Ub}`)}function Gb(e){return e.endsWith(`/`)?e.slice(0,-1):e}var Kb=`http://127.0.0.1:3000`;function qb(){let e=Jb(`BETTER_AUTH_URL`)??Jb(`PUBLIC_BETTER_AUTH_URL`)??Yb(`VITE_BETTER_AUTH_URL`);return e?Gb(e):void 0}function Jb(e){return typeof process>`u`?void 0:{}[e]?.trim()||void 0}function Yb(e){return{BASE_URL:`/console/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,TSS_CLIENT_OUTPUT_DIR:`dist/client`,TSS_DEV_SERVER:`false`,TSS_ROUTER_BASEPATH:`console`,TSS_SERVER_FN_BASE:`/console/_serverFn/`}[e]?.trim()||void 0}var Xb=Rb({baseURL:Zb(),plugins:[Bb(),Hb()]});function Zb(){return Wb(globalThis.location===void 0?void 0:globalThis.location)}var Qb=`http://console.invalid`,$b=`/console`,ex=`/runs`,tx=[`/signin`,`/signup`,`/forgot-password`,`/reset-password`,`/device`];function nx(e){let t=sx(e);return tx.some(e=>t===e||t.startsWith(`${e}/`))}function rx(e){let t=sx(e);return!(t.startsWith(`/api/`)||nx(t))}function ix(e){if(e==null)return ex;let t=e.trim();if(!t.startsWith(`/`)||t.startsWith(`//`)||t.includes(`\\`))return ex;let n;try{n=new URL(t,Qb)}catch{return ex}if(n.origin!==Qb)return ex;let r=sx(n.pathname);return!cx(r)||!lx(r)?ex:`${r}${n.search}${n.hash}`}function ax(e){return`${e.pathname}${e.searchStr}`}function ox(e){return`${$b}${ix(e)}`}function sx(e){let t;try{t=new URL(e,Qb).pathname}catch{t=`/`}return t===$b?`/`:t.startsWith(`${$b}/`)?t.slice(8):t||`/`}function cx(e){try{let t=decodeURIComponent(e);return!t.startsWith(`//`)&&!t.startsWith(`/\\`)}catch{return!1}}function lx(e){return rx(e)||e===`/device`}var ux=(0,z.createContext)(null);function dx(){let e=(0,z.useContext)(ux);if(e===null)throw Error(`useConsoleSession must be used inside App`);return e}function fx(e){let t=Ic(),n=Lo(),r=fo(),i=Xb.useSession(),a=i.data?.user,o=ax(n),s=rx(n.pathname),c=nx(n.pathname),l=a==null&&s,[u,d]=(0,z.useState)(!1);(0,z.useEffect)(()=>{i.isPending||d(!0)},[i.isPending]);let f=(0,z.useCallback)(async()=>{await i.refetch()},[i.refetch]),p=(0,z.useCallback)(async()=>{await Xb.signOut(),t.clear(),await r({to:`/signin`,search:{redirect:ix(o)},replace:!0})},[r,o,t]);return(0,z.useEffect)(()=>{i.isPending||!l||r({to:`/signin`,search:{redirect:ix(o)},replace:!0})},[l,r,o,i.isPending]),i.isPending&&!u?null:a==null?l?null:(0,R.jsx)(R.Fragment,{children:e.children}):(0,R.jsx)(ux.Provider,{value:{user:a,refreshSession:f,onSignOut:p},children:c?e.children:(0,R.jsx)(px,{children:e.children})})}function px(e){let{onSignOut:t,user:n}=dx(),r=Rl();return(0,R.jsx)(sv,{connection:r.isError?r.data===void 0?`error`:`degraded`:r.isPending?`pending`:`ok`,user:n,onSignOut:t,children:e.children})}var mx=`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%3e%3ctitle%3eFlakes%3c/title%3e%3cdefs%3e%3ccircle%20id='n'%20cx='12'%20cy='4.2'%20r='1.9'%20fill='%2310b981'/%3e%3c/defs%3e%3cuse%20href='%23n'/%3e%3cuse%20href='%23n'%20transform='rotate(60%2012%2012)'/%3e%3cuse%20href='%23n'%20transform='rotate(120%2012%2012)'/%3e%3cuse%20href='%23n'%20transform='rotate(180%2012%2012)'/%3e%3cuse%20href='%23n'%20transform='rotate(240%2012%2012)'/%3e%3cuse%20href='%23n'%20transform='rotate(300%2012%2012)'/%3e%3ccircle%20cx='12'%20cy='12'%20r='2.4'%20fill='%2310b981'/%3e%3c/svg%3e`,hx=`/console/assets/styles-8wEqfToJ.css`,gx=`modulepreload`,_x=function(e){return`/console/`+e},vx={},yx=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=_x(t,n),t in vx)return;vx[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:gx,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},bx=mo({head:()=>({meta:[{charSet:`utf-8`},{name:`viewport`,content:`width=device-width, initial-scale=1.0`},{title:`flakes console`}],links:[{rel:`stylesheet`,href:hx},{rel:`icon`,type:`image/svg+xml`,href:mx}]}),component:xx});function xx(){let[e,t]=(0,z.useState)(!1);(0,z.useEffect)(()=>{t(!0),X_()},[]);let[n]=(0,z.useState)(wx);return(0,R.jsx)(Sx,{children:(0,R.jsxs)(Lc,{client:n,children:[(0,R.jsx)(fx,{children:(0,R.jsx)(z.Suspense,{fallback:(0,R.jsx)(Cx,{}),children:(0,R.jsx)(Ao,{})})}),null]})})}function Sx({children:e}){return(0,R.jsxs)(`html`,{lang:`en`,suppressHydrationWarning:!0,children:[(0,R.jsx)(`head`,{children:(0,R.jsx)(Ho,{})}),(0,R.jsxs)(`body`,{className:`flex min-h-screen flex-col`,children:[e,(0,R.jsx)(Uo,{})]})]})}function Cx(){return(0,R.jsx)(`section`,{className:`grid min-h-72 place-items-center p-8`,children:(0,R.jsx)(nl,{className:`size-5 animate-spin text-muted-foreground`})})}function wx(){return new Pc({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1,refetchIntervalInBackground:!0}}})}var Tx=ho(`/signup`)({validateSearch:e=>({redirect:ix(typeof e.redirect==`string`?e.redirect:void 0)}),component:yo(()=>yx(()=>import(`./signup-DHhPfohX.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])),`component`)}),Ex=ho(`/signin`)({validateSearch:e=>({redirect:ix(typeof e.redirect==`string`?e.redirect:void 0)}),component:yo(()=>yx(()=>import(`./signin-CYeR3TaY.js`),__vite__mapDeps([11,1,2,3,5,4,6,7,9,10])),`component`)}),Dx=ho(`/sandboxes`)({validateSearch:e=>({runId:typeof e.runId==`string`?e.runId:void 0}),component:yo(()=>yx(()=>import(`./sandboxes-Cfr1Y2Dn.js`),__vite__mapDeps([12,1])),`component`)}),Ox=ho(`/runs`)({validateSearch:e=>{let t=e.state;return t===`RUNNING`||t===`SUCCEEDED`||t===`FAILED`?{state:t}:{}},component:yo(()=>yx(()=>import(`./runs-xD4ynllK.js`),__vite__mapDeps([13,1])),`component`)}),kx=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function Ax(e){let t=e.email.trim().toLowerCase(),n=e.password,r={};return kx.test(t)||(r.email=`Enter a valid email address.`),n.length===0&&(r.password=`Enter your password.`),Object.keys(r).length>0?{ok:!1,errors:r}:{ok:!0,data:{email:t,password:n}}}function jx(e){let t=e.name.trim(),n=e.email.trim().toLowerCase(),r=e.password,i={};return t.length===0&&(i.name=`Enter your name.`),kx.test(n)||(i.email=`Enter a valid email address.`),r.length<8&&(i.password=`Use at least 8 characters for the password.`),Object.keys(i).length>0?{ok:!1,errors:i}:{ok:!0,data:{name:t,email:n,password:r}}}function Mx(e){let t=e.password,n=e.confirmPassword,r={};return t.length<8&&(r.password=`Use at least 8 characters for the password.`),(n.length===0||n!==t)&&(r.confirmPassword=`Passwords must match.`),Object.keys(r).length>0?{ok:!1,errors:r}:{ok:!0,data:{password:t,confirmPassword:n}}}function Nx(e){let t=e.name.trim(),n={};return t.length===0&&(n.name=`Enter your name.`),Object.keys(n).length>0?{ok:!1,errors:n}:{ok:!0,data:{name:t}}}function Px(e){let t=e.currentPassword,n=e.newPassword,r=e.confirmPassword,i={};return t.length===0&&(i.currentPassword=`Enter your current password.`),n.length<8?i.newPassword=`Use at least 8 characters for the new password.`:n===t&&(i.newPassword=`Choose a different password.`),(r.length===0||r!==n)&&(i.confirmPassword=`Passwords must match.`),Object.keys(i).length>0?{ok:!1,errors:i}:{ok:!0,data:{currentPassword:t,newPassword:n,confirmPassword:r}}}function Fx(e){let t=zx(e.token)??zx(e.code);return t===``?null:t}function Ix(e){let t=Bx(e,`code`).toLowerCase(),n=Bx(e,`statusText`).toLowerCase(),r=Vx(e).toLowerCase();return t===`invalid_token`||n===`invalid_token`||(r.includes(`token`)||r.includes(`link`))&&(r.includes(`invalid`)||r.includes(`expired`)||r.includes(`expire`))}function Lx(e,t=`Authentication failed.`){let n=Vx(e),r=n.toLowerCase();return Rx(e)?`Please verify your email before signing in.`:r.includes(`already exists`)||r.includes(`already registered`)?`An account already exists for that email.`:r.includes(`invalid email or password`)||r.includes(`invalid credentials`)?`Email or password is incorrect.`:n||t}function Rx(e){let t=Vx(e).toLowerCase();return t.includes(`email not verified`)||t.includes(`verify your email`)}function zx(e){return typeof e==`string`?e.trim():null}function Bx(e,t){if(typeof e==`object`&&e&&t in e){let n=e[t];return typeof n==`string`?n:``}return``}function Vx(e){if(typeof e==`object`&&e&&`message`in e){let t=e.message;return typeof t==`string`?t:``}return e instanceof Error?e.message:``}var Hx=ho(`/reset-password`)({validateSearch:e=>({redirect:ix(typeof e.redirect==`string`?e.redirect:void 0),token:Fx(e),error:typeof e.error==`string`?e.error:null}),component:yo(()=>yx(()=>import(`./reset-password-C7SbNx2J.js`),__vite__mapDeps([14,1,2,3,4,6,7,9,10])),`component`)}),Ux=ho(`/forgot-password`)({validateSearch:e=>({redirect:ix(typeof e.redirect==`string`?e.redirect:void 0)}),component:yo(()=>yx(()=>import(`./forgot-password--3Mujc8s.js`),__vite__mapDeps([15,1,2,3,4,6,7,9,10])),`component`)}),Wx=`---
|
|
53
53
|
title: Concepts
|
|
54
54
|
description: Core vocabulary for runs, tasks, hosts, sandboxes, and task outputs.
|
|
55
55
|
---
|
|
@@ -291,63 +291,37 @@ Host credentials are separate from user CLI credentials:
|
|
|
291
291
|
The web console in the browser is for operating and observing Flakes. It should
|
|
292
292
|
not expose raw host credential setup or rotation flows.
|
|
293
293
|
`,Kx=`---
|
|
294
|
-
title:
|
|
295
|
-
description:
|
|
294
|
+
title: Installing and Authorizing the CLI
|
|
295
|
+
description: Installing and authorizing the Flakes CLI.
|
|
296
296
|
---
|
|
297
297
|
|
|
298
|
-
|
|
299
|
-
\`https://flakes.dev\`, and decide whether you need to connect user-supplied host
|
|
300
|
-
capacity before running work.
|
|
298
|
+
You may start by signing up for a new account and signing in to the [Flakes console](https://flakes.dev/console). Once you signed in, the console is where you review runs, watch task activity, inspect workpads and artifacts, respond to permission requests, and send live input.
|
|
301
299
|
|
|
302
|
-
|
|
300
|
+
To install the Flakes CLI, run:
|
|
303
301
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
## 1. Sign In To The Console
|
|
302
|
+
\`\`\`sh
|
|
303
|
+
npm install -g @baochunli/flakes
|
|
304
|
+
\`\`\`
|
|
309
305
|
|
|
310
|
-
|
|
311
|
-
is where you review runs, watch task activity, inspect workpads and artifacts,
|
|
312
|
-
respond to permission requests, and send live input.
|
|
306
|
+
Or if you use \`bun\`:
|
|
313
307
|
|
|
314
|
-
|
|
308
|
+
\`\`\`sh
|
|
309
|
+
bun install -g @baochunli/flakes
|
|
310
|
+
\`\`\`
|
|
315
311
|
|
|
316
|
-
|
|
312
|
+
Then authorize the CLI using your Flakes account:
|
|
317
313
|
|
|
318
314
|
\`\`\`sh
|
|
319
315
|
flakes auth login
|
|
320
316
|
\`\`\`
|
|
321
317
|
|
|
322
|
-
The command starts a device authorization flow. Approve the request in the
|
|
323
|
-
browser while signed in to the console. After approval, the CLI stores a Better
|
|
324
|
-
Auth credential for \`https://flakes.dev\` in the local CLI credential store.
|
|
318
|
+
The command starts a device authorization flow. Approve the request in the browser while signed in to the console. After approval, the CLI stores your Flakes credential locally for future use.
|
|
325
319
|
|
|
326
320
|
Check the stored CLI credential:
|
|
327
321
|
|
|
328
322
|
\`\`\`sh
|
|
329
323
|
flakes auth status
|
|
330
324
|
\`\`\`
|
|
331
|
-
|
|
332
|
-
Run, task, artifact, and host setup commands use that stored CLI credential
|
|
333
|
-
automatically. You should not need to handle a raw hosted API credential during
|
|
334
|
-
normal first-run setup.
|
|
335
|
-
|
|
336
|
-
## 3. Confirm Host Capacity
|
|
337
|
-
|
|
338
|
-
Flakes runs task work on host capacity connected to your account. If a host is
|
|
339
|
-
already online for your account, continue to [Run Work](/docs/run-work).
|
|
340
|
-
|
|
341
|
-
If you need to connect a user-supplied host, continue to
|
|
342
|
-
[Connect A Host](/docs/connect-a-host). Host setup is a CLI flow that uses your
|
|
343
|
-
stored CLI credential to create a host and first host-scoped credential, writes
|
|
344
|
-
that credential locally, and then starts the host agent.
|
|
345
|
-
|
|
346
|
-
## 4. Keep The Console Open
|
|
347
|
-
|
|
348
|
-
The console is the primary operating surface after the CLI is authorized. Use it
|
|
349
|
-
to follow the first run, inspect task history, and steer work while the host
|
|
350
|
-
agent stays connected.
|
|
351
325
|
`,qx=`---
|
|
352
326
|
title: Harnesses
|
|
353
327
|
description: Author durable parent tasks that spawn, wait for, and resume child work.
|
|
@@ -554,54 +528,14 @@ labels, and promotion labels should come from stable workflow input, not random
|
|
|
554
528
|
values or current time.
|
|
555
529
|
`,Jx=`---
|
|
556
530
|
title: Overview
|
|
557
|
-
description:
|
|
531
|
+
description: What is Flakes?
|
|
558
532
|
---
|
|
559
533
|
|
|
560
|
-
Flakes
|
|
561
|
-
agent work on user-supplied host capacity. The console at
|
|
562
|
-
\`https://flakes.dev/console\` is the primary operating surface: use it to review
|
|
563
|
-
runs, inspect task state, read transcripts and artifacts, respond to permission
|
|
564
|
-
requests, and steer running work.
|
|
565
|
-
|
|
566
|
-
Flakes keeps durable task history in the hosted control plane while work runs on
|
|
567
|
-
hosts you provide. A host advertises one or more pools, Flakes matches ready
|
|
568
|
-
tasks to compatible capacity, and the console remains the place to see what
|
|
569
|
-
happened even when machines, sandboxes, or task runners disconnect and return
|
|
570
|
-
later.
|
|
571
|
-
|
|
572
|
-
## What Flakes Does
|
|
573
|
-
|
|
574
|
-
- Coordinates long-running agent tasks as durable runs instead of throwaway
|
|
575
|
-
local sessions.
|
|
576
|
-
- Lets users authorize the CLI against the hosted API without handling raw
|
|
577
|
-
service credentials.
|
|
578
|
-
- Connects user-supplied hosts that run the host agent and advertise sanitized
|
|
579
|
-
pool capacity.
|
|
580
|
-
- Preserves task activity, workpads, transcripts, artifacts, and permission
|
|
581
|
-
events for review in the console.
|
|
582
|
-
|
|
583
|
-
## First-Run Path
|
|
584
|
-
|
|
585
|
-
The hosted product path is:
|
|
586
|
-
|
|
587
|
-
1. Sign in at \`https://flakes.dev/console\`.
|
|
588
|
-
|
|
589
|
-
2. Authorize the CLI with \`flakes auth login\`.
|
|
590
|
-
|
|
591
|
-
3. Connect a user-supplied host with \`flakes host setup\` and
|
|
592
|
-
\`flakes host run\`.
|
|
593
|
-
|
|
594
|
-
4. Create runs, save tasks with dependencies, admit ready work, and close a run
|
|
595
|
-
when no more top-level tasks should be added.
|
|
596
|
-
|
|
597
|
-
5. Use the console to inspect task activity, live input, permission requests,
|
|
598
|
-
transcripts, workpads, and artifacts.
|
|
534
|
+
[Flakes](https://flakes.dev) is a hosted harness runtime for distributed agent workflows. Workflows run within sandbox environments, and across hosts that are supplied by the user. The [console](https://flakes.dev/console) is the primary user interface for interacting with Flakes: use it to review runs, inspect task state, read transcripts and artifacts, respond to permission requests, and steer running tasks.
|
|
599
535
|
|
|
600
|
-
|
|
601
|
-
capacity, continue to [Connect A Host](/docs/connect-a-host).
|
|
536
|
+
Flakes keeps all the transcripts, inputs, outputs and artifacts _durable_ in its control plane console. and _observable_ using its console, while workflows run on hosts you provide. A user-supplied host advertises one or more _pools_, which represents the capabilities and resources, such as GPUs, that the host supports. Flakes then matches ready tasks to compatible capabilities, and the console is the place for the user to observe what happened even when machines, sandboxes, or task runners disconnect (and return later).
|
|
602
537
|
|
|
603
|
-
|
|
604
|
-
this first-read product path.
|
|
538
|
+
Start with [Get Started](/docs/get-started). To bring your own hosts, continue to [Connect A Host](/docs/connect-a-host).
|
|
605
539
|
`,Yx=`---
|
|
606
540
|
title: Observe And Steer
|
|
607
541
|
description: Inspect runs in the console, read task history, and send live input.
|
|
@@ -716,7 +650,7 @@ For scheduling issues, start with the run Timeline and By Sandbox views. For
|
|
|
716
650
|
agent behavior, start with task Activity, Workpad, and Agent transcript. For
|
|
717
651
|
human intervention, use Follow up, Steer, and the permission response path
|
|
718
652
|
available in your deployment.
|
|
719
|
-
`,Xx='---\ntitle: Reference\ndescription: CLI commands, host configuration, selected API routes, and integrator exports for hosted Flakes.\n---\n\nUse this page after you understand the main workflows. It is a lookup for the\nhosted console at `https://flakes.dev`, the `flakes` CLI, user-supplied hosts,\nand selected integration surfaces.\n\nFor first-run steps, start with [Get Started](/docs/get-started). For host\nsetup, see [Connect A Host](/docs/connect-a-host).\n\n## CLI Command Reference\n\nCLI commands target the hosted control plane at `https://flakes.dev`. Most\ncommands use the stored credential from `flakes auth login`; commands that also\naccept `--token` are mainly for trusted automation.\n\n### Auth\n\n| Command | Use |\n| --- | --- |\n| `flakes auth login` | Start device authorization, open the browser approval page, and save the CLI credential. |\n| `flakes auth login --no-open` | Print the verification URL and user code without opening a browser. Useful on remote shells. |\n| `flakes auth login --timeout-ms 600000` | Wait longer for browser approval. |\n| `flakes auth status` | Show whether the stored CLI credential is authenticated, expired, or missing. |\n| `flakes auth logout` | Remove the stored CLI credential. |\n\n### Host Setup And Operation\n\n| Command | Use |\n| --- | --- |\n| `flakes host setup --config <host.toml>` | Create a host and first host-scoped credential through direct CLI user auth, then write the host config. |\n| `flakes host setup --config <host.toml> --credential-file <path> --state-dir <dir> --host-name <name>` | Override the credential file, state directory, or displayed host name. |\n| `flakes host setup --config <host.toml> --json` | Emit structured setup output with redacted host and credential summaries. The raw credential is not printed. |\n| `flakes host rotate --config <host.toml>` | Request a new host credential, write it to the configured credential file, and retire the replaced credential. Restart the host process afterward. |\n| `flakes host rotate --config <host.toml> --json` | Emit structured rotation output, including the new credential summary and next steps. The raw credential is not printed. |\n| `flakes host run --config <host.toml>` | Start the host runtime and connect capacity to Flakes. This process should stay running. |\n| `flakes host status --config <host.toml>` | Validate local config and, when a CLI credential is available, read remote host, pool, and credential status. |\n| `flakes host status --config <host.toml> --json` | Emit structured local and remote status. |\n\nSetup writes new files only when the target config and credential file do not\nalready exist. Setup and rotation require an authenticated CLI user credential\nfor the same hosted origin; they are direct user bearer auth flows, not console\nproxy flows.\n\n### Runs\n\n| Command | Use |\n| --- | --- |\n| `flakes runs create --key <run-key> --name "Release notes"` | Create or reuse a run identified by a stable run key. |\n| `flakes runs close <run-key>` | Close the run so no more top-level tasks can be admitted. |\n| `flakes runs close <run-key> --wait --timeout-ms 600000` | Close the run and poll until the run reaches a terminal state or the timeout expires. |\n| `flakes inspect <run-id-or-key>` | Read a run. A non-`run_` value is treated as a run key. |\n| `flakes inspect <task-id> --task` | Read a task explicitly. |\n| `flakes logs <task-id> --after <cursor> --limit <n>` | Read bounded task logs. |\n| `flakes metrics <run-id>` | Read run metrics. |\n\n### Tasks\n\n| Command | Use |\n| --- | --- |\n| `flakes tasks save --run <run-key> --key <task-key> --title "Draft" --adapter pi --body "Write the draft."` | Save or update a not-yet-admitted task. |\n| `flakes tasks save --run <run-key> --key <task-key> --title "Draft" --adapter pi --body-file prompt.md --required-capability pi --depends-on outline` | Save a task with a file body, capability requirement, and dependency. |\n| `flakes tasks save --run <run-key> --key <task-key> --title "Plan" --adapter harness --harness-file harnesses/paper-writer.ts --tool-grant flakes.tasks.spawn` | Submit a harness module as a normal task. |\n| `flakes tasks admit --run <run-key> <task-key>` | Admit specific saved tasks for scheduling. |\n| `flakes tasks admit --run <run-key> --all` | Admit all saved tasks that are ready for admission. |\n\nTask save accepts `--acceptance`, `--depends-on`, `--required-capability`, and\n`--tool-grant` more than once. `--harness-file` requires `--adapter harness`.\n\n### Workpads And File Reservations\n\n| Command | Use |\n| --- | --- |\n| `flakes tasks workpad show <task-id>` | Read a task workpad as JSON. |\n| `flakes tasks workpad show <task-id> --raw` | Print only the Markdown body. |\n| `flakes tasks workpad save <task-id> --file <workpad.md> --base-version <version>` | Save a workpad with an optimistic version check. |\n| `flakes tasks workpad template <task-id> -o <workpad.md>` | Create a local Markdown template for editing. |\n| `flakes tasks workpad pull` | Inside a running Flakes task, pull the assignment-local workpad into the thread state directory. |\n| `flakes tasks workpad push` | Inside a running Flakes task, push the assignment-local workpad with its saved base version. |\n| `flakes tasks files reserve <path...> --reason "editing" --json` | Inside a running task, reserve assignment-scoped file paths before editing. |\n| `flakes tasks files release <path...> --json` | Release assignment-scoped file reservations. |\n| `flakes tasks files release --all --json` | Release all reservations owned by the current assignment. |\n| `flakes tasks files list --json` | List current assignment file reservations. |\n| `flakes tasks files check <path...> --json` | Check whether paths conflict with existing reservations. |\n\nThe `pull`, `push`, and `files` commands are attached to a running task through\nthread-local environment variables. They fail outside a running Flakes task.\n\n### Messages And Permissions\n\nMessages and permission responses do not have standalone top-level CLI commands.\nUse the console controls when available, or call the selected API routes:\n\n| Route | Use |\n| --- | --- |\n| `POST /v1/tasks/:taskId/messages` | Send a `follow_up` or `steer` message to a running task. |\n| `POST /v1/tasks/:taskId/permissions/:permissionRequestId/respond` | Answer a task permission request with `approved` or `denied`. |\n\nBoth routes require the task to be running on a connected sandbox. See\n[Observe And Steer](/docs/observe-and-steer) for user-facing behavior.\n\n### Harness Checks\n\n| Command | Use |\n| --- | --- |\n| `flakes harness init --template paper --dir harnesses` | Create a starter harness module. |\n| `flakes harness init --template review-revise --dir harnesses --file review.ts --force` | Write a specific template and overwrite the target file. |\n| `flakes harness check harnesses/paper-writer.ts` | Typecheck and validate a harness module before submission. |\n| `flakes harness check harnesses/paper-writer.ts --defaults harnesses/defaults.json --json` | Check with adapter/agent defaults and emit structured diagnostics. |\n\nCurrent template names are `paper`, `review-revise`, `fanout-fanin`,\n`autowrite`, and `autoresearch`.\n\n### Artifacts\n\n| Command | Use |\n| --- | --- |\n| `flakes artifacts create --file artifact.json` | Create artifact metadata, optionally with inline bytes in the JSON payload. |\n| `flakes artifacts get <artifact-id>` | Read artifact metadata. |\n| `flakes artifacts fetch <artifact-id> -o <file>` | Fetch artifact bytes to a file. |\n| `flakes artifacts fetch <artifact-id> --raw` | Write exact artifact bytes to stdout. |\n\n## Host Config Reference\n\n`flakes host setup` writes a starter Host config TOML file. Add at least one\npool before running `flakes host run`.\n\n```toml\ncontrolPlaneUrl = "https://flakes.dev"\nhostId = "host_abc123"\ncredentialFile = "/Users/me/.config/flakes/host.credential"\nstateDir = "/Users/me/.config/flakes/state"\n\n[[pools]]\npoolKey = "mac-coding"\nmatchlockImage = "registry.example/flakes/macos:latest"\nworkspace = "/Users/me/flakes-workspaces"\nmounts = ["/Users/me/.cache/flakes:/cache"]\nadapter = "pi"\nmaxInstances = 2\nmaxConcurrency = 1\nadvertisedCapabilities = ["pi", "node", "mac"]\n\n[pools.resourceBounds]\nmemoryMb = 8192\ncpus = 4\n\n[pools.env]\nEXAMPLE = "value"\n\n[pools.executablePaths]\nmatchlock = "/usr/local/bin/matchlock"\nflakes = "/usr/local/bin/flakes"\n```\n\n### Top-Level Fields\n\n| Field | Required | Meaning |\n| --- | --- | --- |\n| `controlPlaneUrl` | Yes | Hosted API origin. Host setup writes `https://flakes.dev`. |\n| `hostId` | Yes | Host identity returned by setup. It must be a non-empty identifier. |\n| `credentialFile` | Yes | Absolute path to the host-scoped credential file. `credentialFile must be an absolute path`; it must be a regular file owned by the current user, not a symlink, with `0600` permissions. |\n| `stateDir` | No | Absolute private directory for host runtime state. When omitted, it defaults beside the credential file. The runtime also creates a generated sandbox config directory under this state directory. |\n| `pools` | Yes | One to 64 pool definitions. A config with no pools is invalid for `flakes host run`. |\n\n### Pool Fields\n\n| Field | Required | Meaning |\n| --- | --- | --- |\n| `poolKey` | Yes | Stable pool identifier advertised to Flakes. Must be unique within the host config. |\n| `provider` | Implied | The current provider is `matchlock`. It is advertised as `provider: "matchlock"`; it is not a required TOML field. |\n| `matchlockImage` | Yes | Local MatchLock image or template used by the host to launch sandboxes. This is local-only and is not sent in the sanitized pool advertisement. |\n| `workspace` | Yes | Absolute local directory used as the pool workspace. It must exist and must be a directory. This is local-only. |\n| `mounts` | No | Local mount strings passed to the provider. These stay on the host. |\n| `adapter` | Yes | Adapter the sandbox should run, such as `pi` or `harness`. This is advertised for scheduling. |\n| `maxInstances` | Yes | Positive integer limit for provider instances in the pool. |\n| `maxConcurrency` | Yes | Positive integer limit for concurrent work in each advertised sandbox config. |\n| `advertisedCapabilities` | Yes | Up to 64 scheduling capability strings, such as `pi`, `node`, or `mac`. These become advertised as `capabilities`. |\n| `resourceBounds` | No | Small sanitized record for scheduler-facing bounds, such as CPU or memory. Oversized or unsafe records are rejected. |\n| `env` | No | Local environment variables for provider startup. These are local-only and are not advertised. |\n| `executablePaths.matchlock` | Yes | Absolute path to the MatchLock executable. It must exist, be a file, be executable, and not be a symlink. |\n| `executablePaths.<name>` | No | Additional executable paths, for example `flakes`. These are local-only. |\n\n### Sanitized Pool Advertisement\n\nThe host sends only a sanitized pool advertisement to the control plane:\n\n- `poolKey`\n- `provider`\n- `adapter`\n- `maxInstances`\n- `maxConcurrency`\n- `capabilities`\n- sanitized `resourceBounds`, when present\n\nLocal-only fields stay on the host: `matchlockImage`, `workspace`, `mounts`,\n`env`, `credentialFile`, `stateDir`, and `executablePaths`. Do not rely on\nthose fields appearing in the console or API pool responses.\n\n## Selected API Reference\n\nThis section is for integrators. Ordinary users should prefer the console and\nCLI workflows above. Unless noted otherwise, routes use `/v1`, require a user\nbearer credential for the same hosted origin, and are scoped to the authenticated\nowner.\n\n### Runs And Tasks\n\n| Route | Use |\n| --- | --- |\n| `PUT /v1/runs/:runKey` | Create or idempotently read a run by stable key. Body includes `name`; optional `metadata` is stored with the run key. |\n| `GET /v1/runs?state=<state>&cursor=<cursor>&limit=<n>` | List owned runs. |\n| `GET /v1/runs/:runId` | Read one owned run by run ID. |\n| `DELETE /v1/runs/:runId` | Delete an owned run after cancel delivery is attempted for live tasks. |\n| `POST /v1/runs/:runKey/close` | Close a run so no more top-level work can be admitted. |\n| `GET /v1/runs/:runId/tasks` | List tasks with workpad metadata for console task overview screens. |\n| `PUT /v1/runs/:runKey/tasks/:taskKey` | Save a task before admission. Body includes task metadata, target adapter, input, dependencies, capabilities, and grants. |\n| `POST /v1/runs/:runKey/tasks/admit` | Admit selected task keys or all saved tasks. |\n| `GET /v1/tasks/:taskId` | Read one task. |\n| `POST /v1/tasks/:taskId/cancel` | Request cancellation for a live task and record task state. |\n| `GET /v1/tasks/:taskId/logs` | Read bounded task logs. |\n| `GET /v1/tasks/:taskId/activity` | Read activity events such as workpad updates, human input, and permission events. |\n\n### Workpads, Messages, And Permissions\n\n| Route | Use |\n| --- | --- |\n| `GET /v1/tasks/:taskId/workpad` | Read the current task workpad. |\n| `PUT /v1/tasks/:taskId/workpad` | Save Markdown with `bodyMarkdown` and `baseVersion`. A stale version returns `workpad_version_conflict` with the current workpad. Workpads are limited to 512 KiB. |\n| `POST /v1/tasks/:taskId/messages` | Queue `follow_up` or `steer` input for a running task. Messages must be non-empty and at most 20000 characters. |\n| `POST /v1/tasks/:taskId/permissions/:permissionRequestId/respond` | Send `approved` or `denied` for a permission request. A request accepts only one answer and must still belong to the active assignment. |\n| `GET /v1/tasks/:taskId/rounds/:roundKey/outputs/:outputKey/fetch` | Read a bounded JSON or text live-round output. |\n| `GET /v1/tasks/:taskId/rounds/:roundKey/outputs/:outputKey/workspace` | Resolve a live-round workspace output handle. |\n\n### Hosts\n\n| Route | Use |\n| --- | --- |\n| `GET /v1/hosts` | List owned hosts. |\n| `POST /v1/hosts` | Create a host record directly for integrator workflows that do not need the CLI to mint a local host credential. |\n| `POST /v1/hosts/setup` | Create a host and its first host-scoped credential in one transaction. Requires direct user bearer auth and returns the raw credential exactly once for CLI persistence. |\n| `GET /v1/hosts/:hostId` | Read one owned host. |\n| `PATCH /v1/hosts/:hostId` | Update safe display fields and user metadata. Runtime, adapter, path, env, image, provider, and status metadata keys are rejected. |\n| `POST /v1/hosts/:hostId/disable` | Disable a host. Disabled hosts cannot claim new work. |\n| `DELETE /v1/hosts/:hostId` | Delete a host only when active lifecycle state no longer blocks deletion. |\n| `GET /v1/hosts/:hostId/pools` | Read pools synced from the running host. There is no user-facing pool write route; edit host TOML and restart or reconnect the host. |\n| `GET /v1/hosts/:hostId/credentials` | List redacted host credential summaries. |\n| `GET /v1/hosts/:hostId/credentials/:hostCredentialId` | Read one redacted host credential summary. |\n| `POST /v1/hosts/:hostId/credentials/rotate` | Rotate a host credential. Requires direct user bearer auth and returns the raw replacement credential once. |\n| `POST /v1/hosts/:hostId/credentials/:hostCredentialId/revoke` | Revoke a host credential. |\n\nHost setup and credential rotation require direct user bearer auth. Do not send\nthose requests through the browser console proxy.\n\n### Artifacts And Run Outputs\n\n| Route | Use |\n| --- | --- |\n| `POST /v1/artifacts` | Create artifact metadata and optional inline bytes. |\n| `GET /v1/artifacts/:artifactId` | Read artifact metadata. |\n| `GET /v1/artifacts/:artifactId/fetch` | Fetch artifact bytes. |\n| `GET /v1/runs/:runId/artifacts` | List artifacts associated with a run. |\n| `GET /v1/runs/:runId/history.jsonl` | Export redacted run history as JSONL. |\n| `GET /v1/runs/:runId/file-reservations` | List file reservations visible for the run. |\n| `GET /v1/runs/:runId/metrics` | Read evaluation metrics for the run. |\n\nSandbox-scoped workspace, group, and live-round routes are runtime surfaces for\nadapters and harness execution. Integrators should normally use the CLI,\nselected client routes, or Harness SDK helpers instead of calling those routes\ndirectly.\n\n## Relevant Exports\n\nThe hosted API and CLI are the primary user boundary. These exports are useful\nonly for integrations, harness modules, adapters, or repository-local tooling.\n\n| Export | Use |\n| --- | --- |\n| `@flakes/harness-sdk` | Harness authors import `defineHarness`, use `HarnessContext`, and call helpers such as `ctx.group(...)`, `ctx.groups.open(...)`, `ctx.output.json(...)`, `ctx.outputs.readJson(...)`, `ctx.workpads.read(...)`, `ctx.workspace.commit(...)`, `ctx.workspace.promote(...)`, and `ctx.liveTasks.send(...)`. |\n| `@flakes/core` | Integrators that build typed payloads can reuse schemas and types for run/task IDs, saved tasks, task metadata, task groups, task spawn requests, workpads, file reservations, and workspace handles. Common names include `WorkspaceHandle`, `WorkspaceHandleSchema`, `TaskProductMetadataSchema`, and `TaskWorkpadPutRequestSchema`. |\n| `@flakes/protocol` | Runtime implementers can parse and validate sandbox and host stream messages with protocol schemas and safe parse helpers. Ordinary API clients do not need these types. |\n| `@flakes/cli` | Test harnesses or wrappers can call `runCli(...)` with injected IO and transport dependencies instead of shelling out. The installed binary remains `flakes`. |\n\nDo not treat this table as a package architecture guide. It lists only the\nexports a user, harness author, or integrator might reasonably need.\n',Zx=`---
|
|
653
|
+
`,Xx='---\ntitle: Reference\ndescription: CLI commands, host configuration, selected API routes, and integrator exports for hosted Flakes.\n---\n\nUse this page after you understand the main workflows. It is a lookup for the\nhosted console at `https://flakes.dev`, the `flakes` CLI, user-supplied hosts,\nand selected integration surfaces.\n\nFor first-run steps, start with [Get Started](/docs/get-started). For host\nsetup, see [Connect A Host](/docs/connect-a-host).\n\n## CLI Command Reference\n\nCLI commands target the hosted control plane at `https://flakes.dev`. Most\ncommands use the stored credential from `flakes auth login`; commands that also\naccept `--token` are mainly for trusted automation.\n\n### Auth\n\n| Command | Use |\n| --- | --- |\n| `flakes auth login` | Start device authorization, open the browser approval page, and save the CLI credential. |\n| `flakes auth login --no-open` | Print the verification URL and user code without opening a browser. Useful on remote shells. |\n| `flakes auth login --timeout-ms 600000` | Wait longer for browser approval. |\n| `flakes auth login --json` | Emit the device-code and authenticated records as newline-delimited JSON for automation. |\n| `flakes auth status` | Show whether the stored CLI credential is authenticated, expired, or missing. |\n| `flakes auth status --json` | Emit structured credential status. |\n| `flakes auth logout` | Remove the stored CLI credential. |\n| `flakes auth logout --json` | Emit structured logout output. |\n\n### Local Runtime And Config\n\nThese commands are mostly for local development, smoke checks, or authoring\nruntime config files. The hosted path usually starts with auth and host setup.\n\n| Command | Use |\n| --- | --- |\n| `flakes init --database-url <url>` | Write starter local server/sandbox config, env snippets, and copyable startup commands. |\n| `flakes init --database-url <url> --dir <dir> --root-dir <dir> --port <port> --adapter pi` | Override generated paths, server port, and starter adapter. `--adapter harness` is also supported. |\n| `flakes init --database-url <url> --force --json` | Overwrite existing generated files and emit structured output. |\n| `flakes server --config <server.toml>` | Validate config, open the PostgreSQL store, and start the control-plane server. `-c` is also accepted. |\n| `flakes server --config <server.toml> --host 127.0.0.1 --port 7733 --dry-run` | Validate server config and print a redacted JSON summary without starting the daemon. |\n| `flakes sandbox --config <sandbox.toml>` | Validate config, load adapters, and start the sandbox daemon. `-c` is also accepted. |\n| `flakes sandbox --config <sandbox.toml> --dry-run` | Validate sandbox config and print the daemon descriptor without opening a control-plane stream. |\n| `flakes up --server-config <server.toml> --sandbox-config <sandbox.toml>` | Start a local tmux session with the server and one or more sandbox daemons. Pass `--sandbox-config` more than once for multiple sandboxes. |\n| `flakes up --server-config <server.toml> --sandbox-config <sandbox.toml> --host 127.0.0.1 --port 7733 --session flakes --ready-timeout-ms 15000 --dry-run --json` | Preview or start local runtime commands with explicit listen settings, tmux session name, readiness timeout, and structured output. |\n| `flakes down --session flakes --dry-run --json` | Stop or preview stopping a local tmux runtime session. |\n| `flakes config schema` | Print annotated TOML examples for server and sandbox config. |\n| `flakes config schema server` | Print only the server config example. `sandbox` is also supported. |\n\n### Host Setup And Operation\n\n| Command | Use |\n| --- | --- |\n| `flakes host setup --config <host.toml>` | Create a host and first host-scoped credential through direct CLI user auth, then write the host config. |\n| `flakes host setup --config <host.toml> --credential-file <path> --state-dir <dir> --host-name <name>` | Override the credential file, state directory, or displayed host name. |\n| `flakes host setup --config <host.toml> --no-open --timeout-ms 600000` | Run setup on a remote shell and let the embedded device-login flow wait longer for approval. |\n| `flakes host setup --config <host.toml> --json` | Emit structured setup output with redacted host and credential summaries. The raw credential is not printed. |\n| `flakes host rotate --config <host.toml>` | Request a new host credential, write it to the configured credential file, and retire the replaced credential. Restart the host process afterward. |\n| `flakes host rotate --config <host.toml> --json` | Emit structured rotation output, including the new credential summary and next steps. The raw credential is not printed. |\n| `flakes host run --config <host.toml>` | Start the host runtime and connect capacity to Flakes. This process should stay running. |\n| `flakes host status --config <host.toml>` | Validate local config and, when a CLI credential is available, read remote host, pool, and credential status. |\n| `flakes host status --config <host.toml> --json` | Emit structured local and remote status. |\n\nSetup writes new files only when the target config and credential file do not\nalready exist. Setup and rotation require an authenticated CLI user credential\nfor the same hosted origin; they are direct user bearer auth flows, not console\nproxy flows.\n\n### Runs\n\n| Command | Use |\n| --- | --- |\n| `flakes runs create --key <run-key> --name "Release notes"` | Create or reuse a run identified by a stable run key. |\n| `flakes runs create --key <run-key> --name "Release notes" --token <token>` | Create a run using an explicit automation bearer token instead of the stored CLI credential. `-t` is also accepted. |\n| `flakes runs close <run-key>` | Close the run so no more top-level tasks can be admitted. |\n| `flakes runs close <run-key> --wait --timeout-ms 600000` | Close the run and poll until the run reaches a terminal state or the timeout expires. |\n| `flakes runs close <run-key> --token <token>` | Close a run using an explicit automation bearer token. `-t` is also accepted. |\n| `flakes inspect <run-id-or-key>` | Read a run. A non-`run_` value is treated as a run key. |\n| `flakes inspect <task-id> --task` | Read a task explicitly. |\n| `flakes logs <task-id> --after <cursor> --limit <n>` | Read bounded task logs. |\n| `flakes metrics <run-id>` | Read run metrics. |\n\n`runs`, `inspect`, `logs`, and `metrics` accept `--token <token>` or `-t\n<token>` when trusted automation should bypass the stored CLI credential.\n\n### Tasks\n\n| Command | Use |\n| --- | --- |\n| `flakes tasks save --run <run-key> --key <task-key> --title "Draft" --adapter pi --body "Write the draft."` | Save or update a not-yet-admitted task. |\n| `flakes tasks save --run <run-key> --key <task-key> --title "Draft" --adapter pi --body-file prompt.md --required-capability pi --depends-on outline` | Save a task with a file body, capability requirement, and dependency. |\n| `flakes tasks save --run <run-key> --key <task-key> --title "Plan" --adapter harness --harness-file harnesses/paper-writer.ts --tool-grant flakes.tasks.spawn` | Submit a harness module as a normal task. |\n| `flakes tasks admit --run <run-key> <task-key>` | Admit specific saved tasks for scheduling. |\n| `flakes tasks admit --run <run-key> --all` | Admit all saved tasks that are ready for admission. |\n\nTask save accepts `--acceptance`, `--depends-on`, `--required-capability`, and\n`--tool-grant` more than once. `--harness-file` requires `--adapter harness`.\nTask commands that call the hosted API accept `--token <token>` or `-t <token>`\nfor trusted automation.\n\n### Workpads And File Reservations\n\n| Command | Use |\n| --- | --- |\n| `flakes tasks workpad show <task-id>` | Read a task workpad as JSON. |\n| `flakes tasks workpad show <task-id> --raw` | Print only the Markdown body. |\n| `flakes tasks workpad save <task-id> --file <workpad.md> --base-version <version>` | Save a workpad with an optimistic version check. `-f` is also accepted for `--file`. |\n| `flakes tasks workpad template <task-id> --output <workpad.md>` | Create a local Markdown template for editing. `-o` is also accepted. |\n| `flakes tasks workpad pull` | Inside a running Flakes task, pull the assignment-local workpad into the thread state directory. |\n| `flakes tasks workpad push` | Inside a running Flakes task, push the assignment-local workpad with its saved base version. |\n| `flakes tasks files reserve <path...> --reason "editing" --json` | Inside a running task, reserve assignment-scoped file paths before editing. |\n| `flakes tasks files reserve <path...> --prefix --json` | Reserve path prefixes instead of exact paths. |\n| `flakes tasks files release <path...> --json` | Release assignment-scoped file reservations. |\n| `flakes tasks files release <path...> --prefix --json` | Release prefix reservations instead of exact-path reservations. |\n| `flakes tasks files release --all --json` | Release all reservations owned by the current assignment. |\n| `flakes tasks files list --json` | List current assignment file reservations. |\n| `flakes tasks files check <path...> --json` | Check whether paths conflict with existing reservations. |\n| `flakes tasks files check <path...> --prefix --json` | Check prefix selectors for conflicts. |\n\nThe `pull`, `push`, and `files` commands are attached to a running task through\nthread-local environment variables. They fail outside a running Flakes task.\n\n### Messages And Permissions\n\nMessages and permission responses do not have standalone top-level CLI commands.\nUse the console controls when available, or call the selected API routes:\n\n| Route | Use |\n| --- | --- |\n| `POST /v1/tasks/:taskId/messages` | Send a `follow_up` or `steer` message to a running task. |\n| `POST /v1/tasks/:taskId/permissions/:permissionRequestId/respond` | Answer a task permission request with `approved` or `denied`. |\n\nBoth routes require the task to be running on a connected sandbox. See\n[Observe And Steer](/docs/observe-and-steer) for user-facing behavior.\n\n### Harness Checks\n\n| Command | Use |\n| --- | --- |\n| `flakes harness init --template paper --dir harnesses` | Create a starter harness module. |\n| `flakes harness init --template review-revise --dir harnesses --file review.ts --force` | Write a specific template and overwrite the target file. |\n| `flakes harness check harnesses/paper-writer.ts` | Typecheck and validate a harness module before submission. |\n| `flakes harness check harnesses/paper-writer.ts --defaults harnesses/defaults.json --json` | Check with adapter/agent defaults and emit structured diagnostics. |\n\nCurrent template names are `paper`, `review-revise`, `fanout-fanin`,\n`autowrite`, and `autoresearch`.\n\n### Artifacts\n\n| Command | Use |\n| --- | --- |\n| `flakes artifacts create --file artifact.json` | Create artifact metadata, optionally with inline bytes in the JSON payload. `-f` is also accepted. |\n| `flakes artifacts get <artifact-id>` | Read artifact metadata. |\n| `flakes artifacts fetch <artifact-id> --location-id <location-id>` | Fetch a specific artifact location when more than one location is available. |\n| `flakes artifacts fetch <artifact-id> --output <file>` | Fetch artifact bytes to a file. `-o` is also accepted. |\n| `flakes artifacts fetch <artifact-id> --raw` | Write exact artifact bytes to stdout. |\n\nArtifact commands accept `--token <token>` or `-t <token>` for trusted\nautomation.\n\n## Host Config Reference\n\n`flakes host setup` writes a starter Host config TOML file. Add at least one\npool before running `flakes host run`.\n\n```toml\ncontrolPlaneUrl = "https://flakes.dev"\nhostId = "host_abc123"\ncredentialFile = "/Users/me/.config/flakes/host.credential"\nstateDir = "/Users/me/.config/flakes/state"\n\n[[pools]]\npoolKey = "mac-coding"\nmatchlockImage = "registry.example/flakes/macos:latest"\nworkspace = "/Users/me/flakes-workspaces"\nmounts = ["/Users/me/.cache/flakes:/cache"]\nadapter = "pi"\nmaxInstances = 2\nmaxConcurrency = 1\nadvertisedCapabilities = ["pi", "node", "mac"]\n\n[pools.resourceBounds]\nmemoryMb = 8192\ncpus = 4\n\n[pools.env]\nEXAMPLE = "value"\n\n[pools.executablePaths]\nmatchlock = "/usr/local/bin/matchlock"\nflakes = "/usr/local/bin/flakes"\n```\n\n### Top-Level Fields\n\n| Field | Required | Meaning |\n| --- | --- | --- |\n| `controlPlaneUrl` | Yes | Hosted API origin. Host setup writes `https://flakes.dev`. |\n| `hostId` | Yes | Host identity returned by setup. It must be a non-empty identifier. |\n| `credentialFile` | Yes | Absolute path to the host-scoped credential file. `credentialFile must be an absolute path`; it must be a regular file owned by the current user, not a symlink, with `0600` permissions. |\n| `stateDir` | No | Absolute private directory for host runtime state. When omitted, it defaults beside the credential file. The runtime also creates a generated sandbox config directory under this state directory. |\n| `pools` | Yes | One to 64 pool definitions. A config with no pools is invalid for `flakes host run`. |\n\n### Pool Fields\n\n| Field | Required | Meaning |\n| --- | --- | --- |\n| `poolKey` | Yes | Stable pool identifier advertised to Flakes. Must be unique within the host config. |\n| `provider` | Implied | The current provider is `matchlock`. It is advertised as `provider: "matchlock"`; it is not a required TOML field. |\n| `matchlockImage` | Yes | Local MatchLock image or template used by the host to launch sandboxes. This is local-only and is not sent in the sanitized pool advertisement. |\n| `workspace` | Yes | Absolute local directory used as the pool workspace. It must exist and must be a directory. This is local-only. |\n| `mounts` | No | Local mount strings passed to the provider. These stay on the host. |\n| `adapter` | Yes | Adapter the sandbox should run, such as `pi` or `harness`. This is advertised for scheduling. |\n| `maxInstances` | Yes | Positive integer limit for provider instances in the pool. |\n| `maxConcurrency` | Yes | Positive integer limit for concurrent work in each advertised sandbox config. |\n| `advertisedCapabilities` | Yes | Up to 64 scheduling capability strings, such as `pi`, `node`, or `mac`. These become advertised as `capabilities`. |\n| `resourceBounds` | No | Small sanitized record for scheduler-facing bounds, such as CPU or memory. Oversized or unsafe records are rejected. |\n| `env` | No | Local environment variables for provider startup. These are local-only and are not advertised. |\n| `executablePaths.matchlock` | Yes | Absolute path to the MatchLock executable. It must exist, be a file, be executable, and not be a symlink. |\n| `executablePaths.<name>` | No | Additional executable paths, for example `flakes`. These are local-only. |\n\n### Sanitized Pool Advertisement\n\nThe host sends only a sanitized pool advertisement to the control plane:\n\n- `poolKey`\n- `provider`\n- `adapter`\n- `maxInstances`\n- `maxConcurrency`\n- `capabilities`\n- sanitized `resourceBounds`, when present\n\nLocal-only fields stay on the host: `matchlockImage`, `workspace`, `mounts`,\n`env`, `credentialFile`, `stateDir`, and `executablePaths`. Do not rely on\nthose fields appearing in the console or API pool responses.\n\n## Selected API Reference\n\nThis section is for integrators. Ordinary users should prefer the console and\nCLI workflows above. Unless noted otherwise, routes use `/v1`, require a user\nbearer credential for the same hosted origin, and are scoped to the authenticated\nowner.\n\n### Runs And Tasks\n\n| Route | Use |\n| --- | --- |\n| `PUT /v1/runs/:runKey` | Create or idempotently read a run by stable key. Body includes `name`; optional `metadata` is stored with the run key. |\n| `GET /v1/runs?state=<state>&cursor=<cursor>&limit=<n>` | List owned runs. |\n| `GET /v1/runs/:runId` | Read one owned run by run ID. |\n| `DELETE /v1/runs/:runId` | Delete an owned run after cancel delivery is attempted for live tasks. |\n| `POST /v1/runs/:runKey/close` | Close a run so no more top-level work can be admitted. |\n| `GET /v1/runs/:runId/tasks` | List tasks with workpad metadata for console task overview screens. |\n| `PUT /v1/runs/:runKey/tasks/:taskKey` | Save a task before admission. Body includes task metadata, target adapter, input, dependencies, capabilities, and grants. |\n| `POST /v1/runs/:runKey/tasks/admit` | Admit selected task keys or all saved tasks. |\n| `GET /v1/tasks/:taskId` | Read one task. |\n| `POST /v1/tasks/:taskId/cancel` | Request cancellation for a live task and record task state. |\n| `GET /v1/tasks/:taskId/logs` | Read bounded task logs. |\n| `GET /v1/tasks/:taskId/activity` | Read activity events such as workpad updates, human input, and permission events. |\n\n### Workpads, Messages, And Permissions\n\n| Route | Use |\n| --- | --- |\n| `GET /v1/tasks/:taskId/workpad` | Read the current task workpad. |\n| `PUT /v1/tasks/:taskId/workpad` | Save Markdown with `bodyMarkdown` and `baseVersion`. A stale version returns `workpad_version_conflict` with the current workpad. Workpads are limited to 512 KiB. |\n| `POST /v1/tasks/:taskId/messages` | Queue `follow_up` or `steer` input for a running task. Messages must be non-empty and at most 20000 characters. |\n| `POST /v1/tasks/:taskId/permissions/:permissionRequestId/respond` | Send `approved` or `denied` for a permission request. A request accepts only one answer and must still belong to the active assignment. |\n| `GET /v1/tasks/:taskId/rounds/:roundKey/outputs/:outputKey/fetch` | Read a bounded JSON or text live-round output. |\n| `GET /v1/tasks/:taskId/rounds/:roundKey/outputs/:outputKey/workspace` | Resolve a live-round workspace output handle. |\n\n### Hosts\n\n| Route | Use |\n| --- | --- |\n| `GET /v1/hosts` | List owned hosts. |\n| `POST /v1/hosts` | Create a host record directly for integrator workflows that do not need the CLI to mint a local host credential. |\n| `POST /v1/hosts/setup` | Create a host and its first host-scoped credential in one transaction. Requires direct user bearer auth and returns the raw credential exactly once for CLI persistence. |\n| `GET /v1/hosts/:hostId` | Read one owned host. |\n| `PATCH /v1/hosts/:hostId` | Update safe display fields and user metadata. Runtime, adapter, path, env, image, provider, and status metadata keys are rejected. |\n| `POST /v1/hosts/:hostId/disable` | Disable a host. Disabled hosts cannot claim new work. |\n| `DELETE /v1/hosts/:hostId` | Delete a host only when active lifecycle state no longer blocks deletion. |\n| `GET /v1/hosts/:hostId/pools` | Read pools synced from the running host. There is no user-facing pool write route; edit host TOML and restart or reconnect the host. |\n| `GET /v1/hosts/:hostId/credentials` | List redacted host credential summaries. |\n| `GET /v1/hosts/:hostId/credentials/:hostCredentialId` | Read one redacted host credential summary. |\n| `POST /v1/hosts/:hostId/credentials/rotate` | Rotate a host credential. Requires direct user bearer auth and returns the raw replacement credential once. |\n| `POST /v1/hosts/:hostId/credentials/:hostCredentialId/revoke` | Revoke a host credential. |\n\nHost setup and credential rotation require direct user bearer auth. Do not send\nthose requests through the browser console proxy.\n\n### Artifacts And Run Outputs\n\n| Route | Use |\n| --- | --- |\n| `POST /v1/artifacts` | Create artifact metadata and optional inline bytes. |\n| `GET /v1/artifacts/:artifactId` | Read artifact metadata. |\n| `GET /v1/artifacts/:artifactId/fetch` | Fetch artifact bytes. |\n| `GET /v1/runs/:runId/artifacts` | List artifacts associated with a run. |\n| `GET /v1/runs/:runId/history.jsonl` | Export redacted run history as JSONL. |\n| `GET /v1/runs/:runId/file-reservations` | List file reservations visible for the run. |\n| `GET /v1/runs/:runId/metrics` | Read evaluation metrics for the run. |\n\nSandbox-scoped workspace, group, and live-round routes are runtime surfaces for\nadapters and harness execution. Integrators should normally use the CLI,\nselected client routes, or Harness SDK helpers instead of calling those routes\ndirectly.\n\n## Relevant Exports\n\nThe hosted API and CLI are the primary user boundary. These exports are useful\nonly for integrations, harness modules, adapters, or repository-local tooling.\n\n| Export | Use |\n| --- | --- |\n| `@flakes/harness-sdk` | Harness authors import `defineHarness`, use `HarnessContext`, and call helpers such as `ctx.group(...)`, `ctx.groups.open(...)`, `ctx.output.json(...)`, `ctx.outputs.readJson(...)`, `ctx.workpads.read(...)`, `ctx.workspace.commit(...)`, `ctx.workspace.promote(...)`, and `ctx.liveTasks.send(...)`. |\n| `@flakes/core` | Integrators that build typed payloads can reuse schemas and types for run/task IDs, saved tasks, task metadata, task groups, task spawn requests, workpads, file reservations, and workspace handles. Common names include `WorkspaceHandle`, `WorkspaceHandleSchema`, `TaskProductMetadataSchema`, and `TaskWorkpadPutRequestSchema`. |\n| `@flakes/protocol` | Runtime implementers can parse and validate sandbox and host stream messages with protocol schemas and safe parse helpers. Ordinary API clients do not need these types. |\n| `@flakes/cli` | Test harnesses or wrappers can call `runCli(...)` with injected IO and transport dependencies instead of shelling out. The installed binary remains `flakes`. |\n\nDo not treat this table as a package architecture guide. It lists only the\nexports a user, harness author, or integrator might reasonably need.\n',Zx=`---
|
|
720
654
|
title: Run Work
|
|
721
655
|
description: Create runs, save tasks, admit ready work, and close durable workflows.
|
|
722
656
|
---
|
|
@@ -1110,7 +1044,7 @@ flakes tasks workpad save <task-id> --file <workpad.md> --base-version <latest-v
|
|
|
1110
1044
|
Inside a running task, \`flakes tasks workpad push\` writes the latest conflicting
|
|
1111
1045
|
body and version to \`workpad.current.md\` and \`workpad.current.version\`. Merge
|
|
1112
1046
|
those changes before retrying.
|
|
1113
|
-
`,$x={title:`Flakes`,pages:[`index`,`get-started`,`connect-a-host`,`run-work`,`observe-and-steer`,`harnesses`,`concepts`,`reference`,`troubleshooting`]},eS={title:`Reference`,pages:[`index`]},tS=Object.assign({"../../../../docs/content/docs/concepts.mdx":Wx,"../../../../docs/content/docs/connect-a-host.mdx":Gx,"../../../../docs/content/docs/get-started.mdx":Kx,"../../../../docs/content/docs/harnesses.mdx":qx,"../../../../docs/content/docs/index.mdx":Jx,"../../../../docs/content/docs/observe-and-steer.mdx":Yx,"../../../../docs/content/docs/reference/index.mdx":Xx,"../../../../docs/content/docs/run-work.mdx":Zx,"../../../../docs/content/docs/troubleshooting.mdx":Qx}),nS=Object.assign({"../../../../docs/content/docs/meta.json":$x,"../../../../docs/content/docs/reference/meta.json":eS}),rS=new Map(Object.entries(tS).map(([e,t])=>[_S(e),t])),iS=new Map(Object.entries(nS).map(([e,t])=>[vS(e),t])),aS=pS(),oS=new Map(aS.map(e=>[e.path,e])),sS=mS(``);aS[0]?.slug;var cS=aS[0]?.path??``;function lS(e){return aS.find(t=>t.slug===e||t.path===yS(e))}function uS(e){return oS.get(yS(e??``))}function dS(e){return typeof e==`string`?(uS(e)??lS(e))?.path??cS:cS}function fS(e){if(e===void 0)return;let[t]=e.split(/[?#]/);if(t===void 0||t.startsWith(`#`)||t.startsWith(`http`))return;let n=yS(t);return oS.has(n)?n:void 0}function pS(){let e=[],t=new Set;function n(n,r){if(t.has(n))return;let i=rS.get(n);if(i===void 0)return;let a=CS(i),o=SS(n,e);e.push({slug:o,path:n,title:a.frontmatter.title??ES(n),description:a.frontmatter.description??``,body:a.body,...r?{groupTitle:r}:{}}),t.add(n)}function r(e){let t=iS.get(e),i=e?t?.title:void 0,a=t?.pages??hS(e);for(let t of a){let a=bS(e,t);n(t===`index`?e:a,i),t!==`index`&&iS.has(a)&&r(a)}}r(``);for(let e of[...rS.keys()].sort((e,t)=>e.localeCompare(t)))n(e,xS(e));return e}function mS(e){let t=iS.get(e)?.pages??hS(e),n=[];for(let r of t){let t=bS(e,r),i=r===`index`?e:t,a=oS.get(i);if(a!==void 0){n.push({type:`page`,page:a});continue}if(iS.has(t)){let e=mS(t);e.length>0&&n.push({type:`folder`,key:`folder-${t}`,path:t,title:iS.get(t)?.title??ES(t),children:e})}}return n}function hS(e){let t=e?`${e}/`:``,n=new Set;for(let e of rS.keys()){if(!e.startsWith(t))continue;let r=e.slice(t.length);if(!r){n.add(`index`);continue}n.add(r.split(`/`)[0]??r)}for(let r of iS.keys()){if(!r.startsWith(t)||r===e)continue;let i=r.slice(t.length);n.add(i.split(`/`)[0]??i)}return[...n].sort((e,t)=>e.localeCompare(t))}function gS(e){let t=e.replace(/\\/g,`/`),n=t.indexOf(`docs/content/docs/`);return n===-1?t:t.slice(n+18)}function _S(e){return yS(gS(e).replace(/\.mdx$/,``))}function vS(e){return yS(gS(e).replace(/\/?meta\.json$/,``))}function yS(e){let t=e.replace(/\\/g,`/`).replace(/^\/docs\/?/,``).replace(/^docs\/?/,``).replace(/^\/+/,``).replace(/\/+$/,``);return t===``||t===`index`||t===`overview`?``:t.replace(/\/index$/,``)}function bS(e,t){return e?`${e}/${t}`:t}function xS(e){let t=e.split(`/`).slice(0,-1).join(`/`);return t?iS.get(t)?.title:void 0}function SS(e,t){let n=e===``?`overview`:e.split(`/`).at(-1)??e;if(!t.some(e=>e.slug===n))return n;let r=e.replaceAll(`/`,`-`)||`overview`;if(!t.some(e=>e.slug===r))return r;let i=2;for(;t.some(e=>e.slug===`${r}-${i}`);)i+=1;return`${r}-${i}`}function CS(e){let t=/^---\r?\n([\s\S]*?)\r?\n---\r?\n?/.exec(e);return t===null?{frontmatter:{},body:e.trim()}:{frontmatter:wS(t[1]??``),body:e.slice(t[0].length).trim()}}function wS(e){let t={};for(let n of e.split(/\r?\n/)){let e=n.indexOf(`:`);if(e===-1)continue;let r=n.slice(0,e).trim();r!==`title`&&r!==`description`||(t[r]=TS(n.slice(e+1).trim()))}return t}function TS(e){return e.startsWith(`"`)&&e.endsWith(`"`)||e.startsWith(`'`)&&e.endsWith(`'`)?e.slice(1,-1):e}function ES(e){return(e===``?`overview`:e.split(`/`).at(-1)??e).split(`-`).map(e=>`${e.slice(0,1).toUpperCase()}${e.slice(1)}`).join(` `)}var DS=ho(`/documentation`)({validateSearch:e=>typeof e.doc==`string`?{doc:e.doc}:{},beforeLoad:({search:e})=>{if(e.doc===void 0)return;let t=lS(e.doc)??lS(dS(e.doc));throw t===void 0||t.path===cS?oe({to:`/documentation`,replace:!0}):oe({to:`/documentation/$`,params:{_splat:t.path},replace:!0})},component:yo(()=>yx(()=>import(`./documentation-Dr9Bdqxh.js`),__vite__mapDeps([16,1,17,2,3,18,4,19,20])),`component`)}),OS=ho(`/device`)({validateSearch:e=>({user_code:typeof e.user_code==`string`?e.user_code:``}),component:yo(()=>yx(()=>import(`./device-DOGZUNMB.js`),__vite__mapDeps([21,1,2,3,4,5,22,6,7,23,8,9,10])),`component`)}),kS=ho(`/$`)({beforeLoad:()=>{throw oe({to:`/runs`,replace:!0})}}),AS=ho(`/`)({beforeLoad:()=>{throw oe({to:`/runs`,replace:!0})}}),jS=ho(`/account/`)({component:yo(()=>yx(()=>import(`./account-DKgjbb-C.js`),__vite__mapDeps([24,1,25,6,2,3,4,7,23,26,8,10])),`component`)}),MS=ho(`/account/security`)({component:yo(()=>yx(()=>import(`./security-D3N68cBT.js`),__vite__mapDeps([27,1,25,6,2,3,4,7,23,26,8,10])),`component`)}),NS=ho(`/runs/$runId`)({validateSearch:e=>{let t={},n=e.tab;(n===`artifacts`||n===`metrics`||n===`files`)&&(t.tab=n);let r=e.view;return(r===`timeline`||r===`sandboxes`)&&(t.view=r),t},component:yo(()=>yx(()=>import(`./_runId-CO1ozt9P.js`),__vite__mapDeps([28,1])),`component`)}),PS=ho(`/documentation/$`)({loader:({params:e})=>{let t=uS(e._splat);if(t===void 0)throw ae();return{path:t.path}},component:yo(()=>yx(()=>import(`./_-DRcA_CG9.js`),__vite__mapDeps([29,1,17,2,3,18,4,19,20])),`component`)}),FS=ho(`/runs/$runId/t/$taskId`)({validateSearch:e=>e.transcript===`raw`?{transcript:`raw`}:{},component:yo(()=>yx(()=>import(`./_taskId-CcIypX6M.js`),__vite__mapDeps([30,1])),`component`)}),IS=Tx.update({id:`/signup`,path:`/signup`,getParentRoute:()=>bx}),LS=Ex.update({id:`/signin`,path:`/signin`,getParentRoute:()=>bx}),RS=Dx.update({id:`/sandboxes`,path:`/sandboxes`,getParentRoute:()=>bx}),zS=Ox.update({id:`/runs`,path:`/runs`,getParentRoute:()=>bx}),BS=Hx.update({id:`/reset-password`,path:`/reset-password`,getParentRoute:()=>bx}),VS=Ux.update({id:`/forgot-password`,path:`/forgot-password`,getParentRoute:()=>bx}),HS=DS.update({id:`/documentation`,path:`/documentation`,getParentRoute:()=>bx}),US=OS.update({id:`/device`,path:`/device`,getParentRoute:()=>bx}),WS=kS.update({id:`/$`,path:`/$`,getParentRoute:()=>bx}),GS=AS.update({id:`/`,path:`/`,getParentRoute:()=>bx}),KS=jS.update({id:`/account/`,path:`/account/`,getParentRoute:()=>bx}),qS=MS.update({id:`/account/security`,path:`/account/security`,getParentRoute:()=>bx}),JS=NS.update({id:`/$runId`,path:`/$runId`,getParentRoute:()=>zS}),YS=PS.update({id:`/$`,path:`/$`,getParentRoute:()=>HS}),XS=FS.update({id:`/t/$taskId`,path:`/t/$taskId`,getParentRoute:()=>JS}),ZS={DocumentationSplatRoute:YS},QS=HS._addFileChildren(ZS),$S={RunsRunIdTTaskIdRoute:XS},eC={RunsRunIdRoute:JS._addFileChildren($S)},tC={IndexRoute:GS,SplatRoute:WS,DeviceRoute:US,DocumentationRoute:QS,ForgotPasswordRoute:VS,ResetPasswordRoute:BS,RunsRoute:zS._addFileChildren(eC),SandboxesRoute:RS,SigninRoute:LS,SignupRoute:IS,AccountSecurityRoute:qS,AccountIndexRoute:KS},nC=bx._addFileChildren(tC);function rC(){return No({routeTree:nC,basepath:`/console`,defaultPreload:`intent`,scrollRestoration:!0})}async function iC(){let e=await rC(),t=[];return window.__TSS_START_OPTIONS__={serializationAdapters:t},t.push(Cs),e.options.serializationAdapters&&t.push(...e.options.serializationAdapters),e.update({basepath:`console`,serializationAdapters:t}),e.state.matches.length||await Jo(e),e}async function aC(){let e=await iC();return window.$_TSR?.h(),e}var oC;function sC(){return oC||=aC(),(0,R.jsx)(to,{promise:oC,children:e=>(0,R.jsx)(Io,{router:e})})}var cC=i((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,te());else{var t=n(l);t!==null&&re(x,t.startTime-e)}}var S=!1,C=-1,w=5,E=-1;function D(){return g?!0:!(e.unstable_now()-E<w)}function ee(){if(g=!1,S){var t=e.unstable_now();E=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&D());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&re(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?te():S=!1}}}var te;if(typeof y==`function`)te=function(){y(ee)};else if(typeof MessageChannel<`u`){var ne=new MessageChannel,O=ne.port2;ne.port1.onmessage=ee,te=function(){O.postMessage(null)}}else te=function(){_(ee,0)};function re(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,re(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,te()))),r},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),lC=i(((e,t)=>{t.exports=cC()})),uC=i((e=>{var t=lC(),n=p(),r=ve();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}var f=Object.assign,m=Symbol.for(`react.element`),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),E=Symbol.for(`react.memo`),D=Symbol.for(`react.lazy`),ee=Symbol.for(`react.activity`),te=Symbol.for(`react.memo_cache_sentinel`),ne=Symbol.iterator;function O(e){return typeof e!=`object`||!e?null:(e=ne&&e[ne]||e[`@@iterator`],typeof e==`function`?e:null)}var re=Symbol.for(`react.client.reference`);function ie(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===re?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case ee:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case E:return t=e.displayName||null,t===null?ie(e.type)||`Memo`:t;case D:t=e._payload,e=e._init;try{return ie(e(t))}catch{}}return null}var ae=Array.isArray,k=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,A=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,oe={pending:!1,data:null,method:null,action:null},se=[],ce=-1;function le(e){return{current:e}}function ue(e){0>ce||(e.current=se[ce],se[ce]=null,ce--)}function j(e,t){ce++,se[ce]=e.current,e.current=t}var de=le(null),fe=le(null),pe=le(null),me=le(null);function he(e,t){switch(j(pe,t),j(fe,e),j(de,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}ue(de),j(de,e)}function ge(){ue(de),ue(fe),ue(pe)}function _e(e){e.memoizedState!==null&&j(me,e);var t=de.current,n=Hd(t,e.type);t!==n&&(j(fe,e),j(de,n))}function ye(e){fe.current===e&&(ue(de),ue(fe)),me.current===e&&(ue(me),Qf._currentValue=oe)}var be,xe;function Se(e){if(be===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);be=t&&t[1]||``,xe=-1<e.stack.indexOf(`
|
|
1047
|
+
`,$x={title:`Flakes`,pages:[`index`,`get-started`,`connect-a-host`,`run-work`,`observe-and-steer`,`harnesses`,`concepts`,`reference`,`troubleshooting`]},eS={title:`Reference`,pages:[`index`]},tS=Object.assign({"../../../../docs/content/docs/concepts.mdx":Wx,"../../../../docs/content/docs/connect-a-host.mdx":Gx,"../../../../docs/content/docs/get-started.mdx":Kx,"../../../../docs/content/docs/harnesses.mdx":qx,"../../../../docs/content/docs/index.mdx":Jx,"../../../../docs/content/docs/observe-and-steer.mdx":Yx,"../../../../docs/content/docs/reference/index.mdx":Xx,"../../../../docs/content/docs/run-work.mdx":Zx,"../../../../docs/content/docs/troubleshooting.mdx":Qx}),nS=Object.assign({"../../../../docs/content/docs/meta.json":$x,"../../../../docs/content/docs/reference/meta.json":eS}),rS=new Map(Object.entries(tS).map(([e,t])=>[_S(e),t])),iS=new Map(Object.entries(nS).map(([e,t])=>[vS(e),t])),aS=pS(),oS=new Map(aS.map(e=>[e.path,e])),sS=mS(``);aS[0]?.slug;var cS=aS[0]?.path??``;function lS(e){return aS.find(t=>t.slug===e||t.path===yS(e))}function uS(e){return oS.get(yS(e??``))}function dS(e){return typeof e==`string`?(uS(e)??lS(e))?.path??cS:cS}function fS(e){if(e===void 0)return;let[t]=e.split(/[?#]/);if(t===void 0||t.startsWith(`#`)||t.startsWith(`http`))return;let n=yS(t);return oS.has(n)?n:void 0}function pS(){let e=[],t=new Set;function n(n,r){if(t.has(n))return;let i=rS.get(n);if(i===void 0)return;let a=CS(i),o=SS(n,e);e.push({slug:o,path:n,title:a.frontmatter.title??ES(n),description:a.frontmatter.description??``,body:a.body,...r?{groupTitle:r}:{}}),t.add(n)}function r(e){let t=iS.get(e),i=e?t?.title:void 0,a=t?.pages??hS(e);for(let t of a){let a=bS(e,t);n(t===`index`?e:a,i),t!==`index`&&iS.has(a)&&r(a)}}r(``);for(let e of[...rS.keys()].sort((e,t)=>e.localeCompare(t)))n(e,xS(e));return e}function mS(e){let t=iS.get(e)?.pages??hS(e),n=[];for(let r of t){let t=bS(e,r),i=r===`index`?e:t,a=oS.get(i);if(a!==void 0){n.push({type:`page`,page:a});continue}if(iS.has(t)){let e=mS(t);e.length>0&&n.push({type:`folder`,key:`folder-${t}`,path:t,title:iS.get(t)?.title??ES(t),children:e})}}return n}function hS(e){let t=e?`${e}/`:``,n=new Set;for(let e of rS.keys()){if(!e.startsWith(t))continue;let r=e.slice(t.length);if(!r){n.add(`index`);continue}n.add(r.split(`/`)[0]??r)}for(let r of iS.keys()){if(!r.startsWith(t)||r===e)continue;let i=r.slice(t.length);n.add(i.split(`/`)[0]??i)}return[...n].sort((e,t)=>e.localeCompare(t))}function gS(e){let t=e.replace(/\\/g,`/`),n=t.indexOf(`docs/content/docs/`);return n===-1?t:t.slice(n+18)}function _S(e){return yS(gS(e).replace(/\.mdx$/,``))}function vS(e){return yS(gS(e).replace(/\/?meta\.json$/,``))}function yS(e){let t=e.replace(/\\/g,`/`).replace(/^\/docs\/?/,``).replace(/^docs\/?/,``).replace(/^\/+/,``).replace(/\/+$/,``);return t===``||t===`index`||t===`overview`?``:t.replace(/\/index$/,``)}function bS(e,t){return e?`${e}/${t}`:t}function xS(e){let t=e.split(`/`).slice(0,-1).join(`/`);return t?iS.get(t)?.title:void 0}function SS(e,t){let n=e===``?`overview`:e.split(`/`).at(-1)??e;if(!t.some(e=>e.slug===n))return n;let r=e.replaceAll(`/`,`-`)||`overview`;if(!t.some(e=>e.slug===r))return r;let i=2;for(;t.some(e=>e.slug===`${r}-${i}`);)i+=1;return`${r}-${i}`}function CS(e){let t=/^---\r?\n([\s\S]*?)\r?\n---\r?\n?/.exec(e);return t===null?{frontmatter:{},body:e.trim()}:{frontmatter:wS(t[1]??``),body:e.slice(t[0].length).trim()}}function wS(e){let t={};for(let n of e.split(/\r?\n/)){let e=n.indexOf(`:`);if(e===-1)continue;let r=n.slice(0,e).trim();r!==`title`&&r!==`description`||(t[r]=TS(n.slice(e+1).trim()))}return t}function TS(e){return e.startsWith(`"`)&&e.endsWith(`"`)||e.startsWith(`'`)&&e.endsWith(`'`)?e.slice(1,-1):e}function ES(e){return(e===``?`overview`:e.split(`/`).at(-1)??e).split(`-`).map(e=>`${e.slice(0,1).toUpperCase()}${e.slice(1)}`).join(` `)}var DS=ho(`/documentation`)({validateSearch:e=>typeof e.doc==`string`?{doc:e.doc}:{},beforeLoad:({search:e})=>{if(e.doc===void 0)return;let t=lS(e.doc)??lS(dS(e.doc));throw t===void 0||t.path===cS?oe({to:`/documentation`,replace:!0}):oe({to:`/documentation/$`,params:{_splat:t.path},replace:!0})},component:yo(()=>yx(()=>import(`./documentation-NRDmcDud.js`),__vite__mapDeps([16,1,17,2,3,18,4,19,20])),`component`)}),OS=ho(`/device`)({validateSearch:e=>({user_code:typeof e.user_code==`string`?e.user_code:``}),component:yo(()=>yx(()=>import(`./device-NrLWypMd.js`),__vite__mapDeps([21,1,2,3,4,5,22,6,7,23,8,9,10])),`component`)}),kS=ho(`/$`)({beforeLoad:()=>{throw oe({to:`/runs`,replace:!0})}}),AS=ho(`/`)({beforeLoad:()=>{throw oe({to:`/runs`,replace:!0})}}),jS=ho(`/account/`)({component:yo(()=>yx(()=>import(`./account-B4wDEC7t.js`),__vite__mapDeps([24,1,25,6,2,3,4,7,23,26,8,10])),`component`)}),MS=ho(`/account/security`)({component:yo(()=>yx(()=>import(`./security-CCThSJae.js`),__vite__mapDeps([27,1,25,6,2,3,4,7,23,26,8,10])),`component`)}),NS=ho(`/runs/$runId`)({validateSearch:e=>{let t={},n=e.tab;(n===`artifacts`||n===`metrics`||n===`files`)&&(t.tab=n);let r=e.view;return(r===`timeline`||r===`sandboxes`)&&(t.view=r),t},component:yo(()=>yx(()=>import(`./_runId-BZXYFY32.js`),__vite__mapDeps([28,1])),`component`)}),PS=ho(`/documentation/$`)({loader:({params:e})=>{let t=uS(e._splat);if(t===void 0)throw ae();return{path:t.path}},component:yo(()=>yx(()=>import(`./_-C4ecJpHe.js`),__vite__mapDeps([29,1,17,2,3,18,4,19,20])),`component`)}),FS=ho(`/runs/$runId/t/$taskId`)({validateSearch:e=>e.transcript===`raw`?{transcript:`raw`}:{},component:yo(()=>yx(()=>import(`./_taskId-C28oHEU_.js`),__vite__mapDeps([30,1])),`component`)}),IS=Tx.update({id:`/signup`,path:`/signup`,getParentRoute:()=>bx}),LS=Ex.update({id:`/signin`,path:`/signin`,getParentRoute:()=>bx}),RS=Dx.update({id:`/sandboxes`,path:`/sandboxes`,getParentRoute:()=>bx}),zS=Ox.update({id:`/runs`,path:`/runs`,getParentRoute:()=>bx}),BS=Hx.update({id:`/reset-password`,path:`/reset-password`,getParentRoute:()=>bx}),VS=Ux.update({id:`/forgot-password`,path:`/forgot-password`,getParentRoute:()=>bx}),HS=DS.update({id:`/documentation`,path:`/documentation`,getParentRoute:()=>bx}),US=OS.update({id:`/device`,path:`/device`,getParentRoute:()=>bx}),WS=kS.update({id:`/$`,path:`/$`,getParentRoute:()=>bx}),GS=AS.update({id:`/`,path:`/`,getParentRoute:()=>bx}),KS=jS.update({id:`/account/`,path:`/account/`,getParentRoute:()=>bx}),qS=MS.update({id:`/account/security`,path:`/account/security`,getParentRoute:()=>bx}),JS=NS.update({id:`/$runId`,path:`/$runId`,getParentRoute:()=>zS}),YS=PS.update({id:`/$`,path:`/$`,getParentRoute:()=>HS}),XS=FS.update({id:`/t/$taskId`,path:`/t/$taskId`,getParentRoute:()=>JS}),ZS={DocumentationSplatRoute:YS},QS=HS._addFileChildren(ZS),$S={RunsRunIdTTaskIdRoute:XS},eC={RunsRunIdRoute:JS._addFileChildren($S)},tC={IndexRoute:GS,SplatRoute:WS,DeviceRoute:US,DocumentationRoute:QS,ForgotPasswordRoute:VS,ResetPasswordRoute:BS,RunsRoute:zS._addFileChildren(eC),SandboxesRoute:RS,SigninRoute:LS,SignupRoute:IS,AccountSecurityRoute:qS,AccountIndexRoute:KS},nC=bx._addFileChildren(tC);function rC(){return No({routeTree:nC,basepath:`/console`,defaultPreload:`intent`,scrollRestoration:!0})}async function iC(){let e=await rC(),t=[];return window.__TSS_START_OPTIONS__={serializationAdapters:t},t.push(Cs),e.options.serializationAdapters&&t.push(...e.options.serializationAdapters),e.update({basepath:`console`,serializationAdapters:t}),e.state.matches.length||await Jo(e),e}async function aC(){let e=await iC();return window.$_TSR?.h(),e}var oC;function sC(){return oC||=aC(),(0,R.jsx)(to,{promise:oC,children:e=>(0,R.jsx)(Io,{router:e})})}var cC=i((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,te());else{var t=n(l);t!==null&&re(x,t.startTime-e)}}var S=!1,C=-1,w=5,E=-1;function D(){return g?!0:!(e.unstable_now()-E<w)}function ee(){if(g=!1,S){var t=e.unstable_now();E=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&D());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&re(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?te():S=!1}}}var te;if(typeof y==`function`)te=function(){y(ee)};else if(typeof MessageChannel<`u`){var ne=new MessageChannel,O=ne.port2;ne.port1.onmessage=ee,te=function(){O.postMessage(null)}}else te=function(){_(ee,0)};function re(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,re(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,te()))),r},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),lC=i(((e,t)=>{t.exports=cC()})),uC=i((e=>{var t=lC(),n=p(),r=ve();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}var f=Object.assign,m=Symbol.for(`react.element`),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),E=Symbol.for(`react.memo`),D=Symbol.for(`react.lazy`),ee=Symbol.for(`react.activity`),te=Symbol.for(`react.memo_cache_sentinel`),ne=Symbol.iterator;function O(e){return typeof e!=`object`||!e?null:(e=ne&&e[ne]||e[`@@iterator`],typeof e==`function`?e:null)}var re=Symbol.for(`react.client.reference`);function ie(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===re?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case ee:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case E:return t=e.displayName||null,t===null?ie(e.type)||`Memo`:t;case D:t=e._payload,e=e._init;try{return ie(e(t))}catch{}}return null}var ae=Array.isArray,k=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,A=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,oe={pending:!1,data:null,method:null,action:null},se=[],ce=-1;function le(e){return{current:e}}function ue(e){0>ce||(e.current=se[ce],se[ce]=null,ce--)}function j(e,t){ce++,se[ce]=e.current,e.current=t}var de=le(null),fe=le(null),pe=le(null),me=le(null);function he(e,t){switch(j(pe,t),j(fe,e),j(de,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}ue(de),j(de,e)}function ge(){ue(de),ue(fe),ue(pe)}function _e(e){e.memoizedState!==null&&j(me,e);var t=de.current,n=Hd(t,e.type);t!==n&&(j(fe,e),j(de,n))}function ye(e){fe.current===e&&(ue(de),ue(fe)),me.current===e&&(ue(me),Qf._currentValue=oe)}var be,xe;function Se(e){if(be===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);be=t&&t[1]||``,xe=-1<e.stack.indexOf(`
|
|
1114
1048
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
1115
1049
|
`+be+e+xe}var Ce=!1;function we(e,t){if(!e||Ce)return``;Ce=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
1116
1050
|
`),l=s.split(`
|