From e0acb707622d3e3e3cf06e16b31c0eb5ca46508e Mon Sep 17 00:00:00 2001 From: Blake Bauman Date: Thu, 13 Aug 2026 16:30:50 -0700 Subject: [PATCH 1/2] docs: link to pages that exist MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Every documentation link this console emitted was a 404. They carried a version segment — docs.fold.run/1.10/configuration/ — on the reasoning that the docs an operator opens from a running gateway should be the docs for that gateway. That is a good idea, and it is borrowed from tools whose documentation is published per release. fold's is one unversioned Starlight site, so the prefix matched nothing. Three of the topic slugs (federation, policy, observability) did not exist under any prefix either; I had invented them from the console's own section names rather than reading the docs. Verified against the live site rather than assumed this time: /configuration/ 200 /1.10/configuration/ 404 /operations/ 200 /federation/ 404 /discovery/ /tenancy/ 200 /policy/ 404 /security/ 200 /observability/ 404 Topics now map to real pages, with anchors where the page is broad and the question is narrow — the Governance cards go to configuration#policy rather than the top of a reference that opens on upstreams. The anchors are checked against ids on the live pages. `federation` becomes `upstreams`, pointing at the block an operator on that page is actually asking about. The version parameter is gone, along with minorLine, which existed only to build the segment. WHY NOTHING CAUGHT IT They are external navigations. The CSP never sees them, no unit test renders an href it did not itself supply, and a plausible URL reads as correct until somebody clicks it. The only check with power here is the one that asks the internet, so tests/docs-links.spec.ts fetches every URL the console can produce and asserts 200 — plus, for anchored links, that the id exists, because a wrong anchor does not 404. It silently lands at the top of the page, which is the failure mode that looks like success. It runs under the contract config, with the gateway contract: both talk to something outside this repo, and neither belongs in an e2e run that has to stay answerable to the code in the pull request. Verified the check fails on both shapes — a restored version prefix, and an anchor changed to #policies — rather than trusting a green first run. Co-Authored-By: Claude Opus 5 (1M context) --- dist/app.js | 6 ++-- docs/design.md | 11 ++++++-- playwright.contract.config.ts | 5 +++- src/components/DocsLink.tsx | 5 ++-- src/lib/docs.ts | 53 +++++++++++++++++++++++------------ src/lib/version.ts | 6 ---- src/routes/overview.tsx | 8 +++--- src/routes/upstreams.tsx | 2 +- tests/docs-links.spec.ts | 45 +++++++++++++++++++++++++++++ 9 files changed, 103 insertions(+), 38 deletions(-) create mode 100644 tests/docs-links.spec.ts diff --git a/dist/app.js b/dist/app.js index a7d11cf..6caffe5 100644 --- a/dist/app.js +++ b/dist/app.js @@ -1,4 +1,4 @@ -var kt,E,fi,ge,Zr,pi,_i,Tn,zt,dt,mi,gr,Hn,qn,gi,nn={},rn=[],ya=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,xt=Array.isArray;function ae(e,t){for(var n in t)e[n]=t[n];return e}function yr(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function z(e,t,n){var r,s,i,a={};for(i in t)i=="key"?r=t[i]:i=="ref"?s=t[i]:a[i]=t[i];if(arguments.length>2&&(a.children=arguments.length>3?kt.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)a[i]===void 0&&(a[i]=e.defaultProps[i]);return ft(e,a,r,s,null)}function ft(e,t,n,r,s){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:s??++fi,__i:-1,__u:0};return s==null&&E.vnode!=null&&E.vnode(i),i}function yi(){return{current:null}}function M(e){return e.children}function Z(e,t){this.props=e,this.context=t}function Le(e,t){if(t==null)return e.__?Le(e.__,e.__i+1):null;for(var n;tt&&ge.sort(_i),e=ge.shift(),t=ge.length,va(e)}finally{ge.length=sn.__r=0}}function bi(e,t,n,r,s,i,a,o,l,c,d){var u,h,p,m,_,g,v=r&&r.__k||rn,y=t.length;for(l=ba(n,t,v,l,y),u=0;u0?a=e.__k[i]=ft(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[i]=a,l=i+h,a.__=e,a.__b=e.__b+1,o=null,(c=a.__i=wa(a,n,l,u))!=-1&&(u--,(o=n[c])&&(o.__u|=2)),o==null||o.__v==null?(c==-1&&(s>d?h--:sl?h--:h++,a.__u|=4))):e.__k[i]=null;if(u)for(i=0;i(d?1:0)){for(s=n-1,i=n+1;s>=0||i=0?s--:i++])!=null&&(2&c.__u)==0&&o==c.key&&l==c.type)return a}return-1}function es(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||ya.test(t)?n:n+"px"}function Ut(e,t,n,r,s){var i,a;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||es(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||es(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")i=t!=(t=t.replace(mi,"$1")),a=t.toLowerCase(),t=a in e||t=="onFocusOut"||t=="onFocusIn"?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r?n[dt]=r[dt]:(n[dt]=gr,e.addEventListener(t,i?qn:Hn,i)):e.removeEventListener(t,i?qn:Hn,i);else{if(s=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function ts(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[zt]==null)t[zt]=gr++;else if(t[zt]0?e:xt(e)?e.map(Ci):e.constructor!==void 0?null:ae({},e)}function Sa(e,t,n,r,s,i,a,o,l){var c,d,u,h,p,m,_,g=n.props||nn,v=t.props,y=t.type;if(y=="svg"?s="http://www.w3.org/2000/svg":y=="math"?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),i!=null){for(c=0;c2&&(o.children=arguments.length>3?kt.call(arguments,2):n),ft(e.type,o,r||e.key,s||e.ref,null)}function ne(e){function t(n){var r,s;return this.getChildContext||(r=new Set,(s={})[t.__c]=this,this.getChildContext=function(){return s},this.componentWillUnmount=function(){r=null},this.shouldComponentUpdate=function(i){this.props.value!=i.value&&r.forEach(function(a){a.__e=!0,Wn(a)})},this.sub=function(i){r.add(i);var a=i.componentWillUnmount;i.componentWillUnmount=function(){r&&r.delete(i),a&&a.call(i)}}),n.children}return t.__c="__cC"+gi++,t.__=e,t.Provider=t.__l=(t.Consumer=function(n,r){return n.children(r)}).contextType=t,t}kt=rn.slice,E={__e:function(e,t,n,r){for(var s,i,a;t=t.__;)if((s=t.__c)&&!s.__)try{if((i=s.constructor)&&i.getDerivedStateFromError!=null&&(s.setState(i.getDerivedStateFromError(e)),a=s.__d),s.componentDidCatch!=null&&(s.componentDidCatch(e,r||{}),a=s.__d),a)return s.__E=s}catch(o){e=o}throw e}},fi=0,Z.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=ae({},this.state),typeof e=="function"&&(e=e(ae({},n),this.props)),e&&ae(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Wn(this))},Z.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Wn(this))},Z.prototype.render=M,ge=[],pi=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,_i=function(e,t){return e.__v.__b-t.__v.__b},sn.__r=0,Tn=Math.random().toString(8),zt="__d"+Tn,dt="__a"+Tn,mi=/(PointerCapture)$|Capture$/i,gr=0,Hn=ts(!1),qn=ts(!0),gi=0;var Ra=0;function f(e,t,n,r,s,i){t||(t={});var a,o,l=t;if("ref"in l)for(o in l={},t)o=="ref"?a=t[o]:l[o]=t[o];var c={type:e,props:l,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Ra,__i:-1,__u:0,__source:s,__self:i};if(typeof e=="function"&&(a=e.defaultProps))for(o in a)l[o]===void 0&&(l[o]=a[o]);return E.vnode&&E.vnode(c),c}var Tt=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ka=class extends Tt{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<"u"&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},wr=new ka,xa={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Ta=class{#e=xa;#t=!1;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}},Oe=new Ta;function Ea(e){setTimeout(e,0)}var Oa=typeof window>"u"||"Deno"in globalThis;function V(){}function Ia(e,t){return typeof e=="function"?e(t):e}function Vn(e){return typeof e=="number"&&e>=0&&e!==1/0}function xi(e,t){return Math.max(e+(t||0)-Date.now(),0)}function ve(e,t){return typeof e=="function"?e(t):e}function J(e,t){return typeof e=="function"?e(t):e}function ns(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:i,queryKey:a,stale:o}=e;if(a){if(r){if(t.queryHash!==Sr(a,t.options))return!1}else if(!Ze(t.queryKey,a))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof o=="boolean"&&t.isStale()!==o||s&&s!==t.state.fetchStatus||i&&!i(t))}function rs(e,t){const{exact:n,status:r,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(mt(t.options.mutationKey)!==mt(i))return!1}else if(!Ze(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function Sr(e,t){return(t?.queryKeyHashFn||mt)(e)}function mt(e){return JSON.stringify(e,(t,n)=>Kn(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function Ze(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(Array.isArray(e)&&Array.isArray(t)){for(let r=0;r500)return t;const r=ss(e)&&ss(t);if(!r&&!(Kn(e)&&Kn(t)))return t;const i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,l=r?new Array(o):{};let c=0;for(let d=0;d{Oe.setTimeout(t,e)})}function zn(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?Ti(e,t):t}function $a(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function Fa(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Pr=Symbol();function Ei(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Pr?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Oi(e,t){return typeof e=="function"?e(...t):!!e}function Da(e,t,n){let r=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??=t(),r||(r=!0,s.aborted?n():s.addEventListener("abort",n,{once:!0})),s)}),e}var gt=(()=>{let e=()=>Oa;return{isServer(){return e()},setIsServer(t){e=t}}})();function Gn(){let e,t;const n=new Promise((s,i)=>{e=s,t=i});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),e(s)},n.reject=s=>{r({status:"rejected",reason:s}),t(s)},n}var Aa=Ea;function Na(){let e=[],t=0,n=o=>{o()},r=o=>{o()},s=Aa;const i=o=>{t?e.push(o):s(()=>{n(o)})},a=()=>{const o=e;e=[],o.length&&s(()=>{r(()=>{o.forEach(l=>{n(l)})})})};return{batch:o=>{let l;t++;try{l=o()}finally{t--,t||a()}return l},batchCalls:o=>(...l)=>{i(()=>{o(...l)})},schedule:i,setNotifyFunction:o=>{n=o},setBatchNotifyFunction:o=>{r=o},setScheduler:o=>{s=o}}}var U=Na(),Ua=class extends Tt{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<"u"&&window.addEventListener){const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(n=>{n(e)}))}isOnline(){return this.#e}},on=new Ua;function Ba(e){return Math.min(1e3*2**e,3e4)}function Ii(e){return(e??"online")==="online"?on.isOnline():!0}var Jn=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function Li(e){let t=!1,n=0,r;const s=Gn(),i=()=>s.status!=="pending",a=_=>{if(!i()){const g=new Jn(_);h(g),e.onCancel?.(g)}},o=()=>{t=!0},l=()=>{t=!1},c=()=>wr.isFocused()&&(e.networkMode==="always"||on.isOnline())&&e.canRun(),d=()=>Ii(e.networkMode)&&e.canRun(),u=_=>{i()||(r?.(),s.resolve(_))},h=_=>{i()||(r?.(),s.reject(_))},p=()=>new Promise(_=>{r=g=>{(i()||c())&&_(g)},e.onPause?.()}).then(()=>{r=void 0,i()||e.onContinue?.()}),m=()=>{if(i())return;let _;const g=n===0?e.initialPromise:void 0;try{_=g??e.fn()}catch(v){_=Promise.reject(v)}Promise.resolve(_).then(u).catch(v=>{if(i())return;const y=e.retry??(gt.isServer()?0:3),S=e.retryDelay??Ba,b=typeof S=="function"?S(n,v):S,R=y===!0||typeof y=="number"&&nc()?void 0:p()).then(()=>{t?h(v):m()})})};return{promise:s,status:()=>s.status,cancel:a,continue:()=>(r?.(),s),cancelRetry:o,continueRetry:l,canStart:d,start:()=>(d()?m():p().then(m),s)}}var Mi=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Vn(this.gcTime)&&(this.#e=Oe.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(gt.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(Oe.clearTimeout(this.#e),this.#e=void 0)}};function ja(e){return{onFetch:(t,n)=>{const r=t.options,s=t.fetchOptions?.meta?.fetchMore?.direction,i=t.state.data?.pages||[],a=t.state.data?.pageParams||[];let o={pages:[],pageParams:[]},l=0;const c=async()=>{let d=!1;const u=m=>{Da(m,()=>t.signal,()=>d=!0)},h=Ei(t.options,t.fetchOptions),p=async(m,_,g)=>{if(d)return Promise.reject(t.signal.reason);if(_==null&&m.pages.length)return Promise.resolve(m);const y=(()=>{const P={client:t.client,queryKey:t.queryKey,pageParam:_,direction:g?"backward":"forward",meta:t.options.meta};return u(P),P})(),S=await h(y),{maxPages:b}=t.options,R=g?Fa:$a;return{pages:R(m.pages,S,b),pageParams:R(m.pageParams,_,b)}};if(s&&i.length){const m=s==="backward",_=m?Ha:os,g={pages:i,pageParams:a},v=_(r,g);o=await p(g,v,m)}else{const m=e??i.length;do{const _=l===0?a[0]??r.initialPageParam:os(r,o);if(l>0&&_==null)break;o=await p(o,_),l++}while(lt.options.persister?.(c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=c}}}function os(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Ha(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var qa=class extends Mi{#e;#t;#n;#r;#i;#s;#a;#o;constructor(e){super(),this.#o=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=cs(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#s?.promise}setOptions(e){if(this.options={...this.#a,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const t=cs(this.options);t.data!==void 0&&(this.setState(as(t.data,t.dataUpdatedAt)),this.#t=t)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#r.remove(this)}setData(e,t){const n=zn(this.state.data,e,this.options);return this.#c({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:"setState",state:e})}cancel(e){const t=this.#s?.promise;return this.#s?.cancel(e),t?t.then(V).catch(V):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>J(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Pr||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>ve(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!xi(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#s?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#s?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#s&&(this.#o||this.#u()?this.#s.cancel({revert:!0}):this.#s.cancelRetry()),this.scheduleGc()),this.#r.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}#u(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"}invalidate(){this.state.isInvalidated||this.#c({type:"invalidate"})}async fetch(e,t){if(this.state.fetchStatus!=="idle"&&this.#s?.status()!=="rejected"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#s)return this.#s.continueRetry(),this.#s.promise}if(e&&this.setOptions(e),!this.options.queryFn){const l=this.observers.find(c=>c.options.queryFn);l&&this.setOptions(l.options)}const n=new AbortController,r=l=>{Object.defineProperty(l,"signal",{enumerable:!0,get:()=>(this.#o=!0,n.signal)})},s=()=>{const l=Ei(this.options,t),d=(()=>{const u={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(u),u})();return this.#o=!1,this.options.persister?this.options.persister(l,d,this):l(d)},a=(()=>{const l={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:s};return r(l),l})();(this.#e==="infinite"?ja(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:"fetch",meta:a.fetchOptions?.meta}),this.#s=Li({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:l=>{l instanceof Jn&&l.revert&&this.setState({...this.#n,fetchStatus:"idle"}),n.abort()},onFail:(l,c)=>{this.#c({type:"failed",failureCount:l,error:c})},onPause:()=>{this.#c({type:"pause"})},onContinue:()=>{this.#c({type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{const l=await this.#s.start();if(l===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(l),this.#r.config.onSuccess?.(l,this),this.#r.config.onSettled?.(l,this.state.error,this),l}catch(l){if(l instanceof Jn){if(l.silent)return this.#s.promise;if(l.revert){if(this.state.data===void 0)throw l;return this.state.data}}throw this.#c({type:"error",error:l}),this.#r.config.onError?.(l,this),this.#r.config.onSettled?.(this.state.data,l,this),l}finally{this.scheduleGc()}}#c(e){const t=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...$i(n.data,this.options),fetchMeta:e.meta??null};case"success":const r={...n,...as(e.data,e.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?r:void 0,r;case"error":const s=e.error;return{...n,error:s,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=t(this.state),U.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),this.#r.notify({query:this,type:"updated",action:e})})}};function $i(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ii(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function as(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function cs(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Wa=class extends Tt{constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.#a=Gn(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#s;#a;#o;#u;#c;#p;#h;#d;#l;#_=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),ls(this.#t,this.options)?this.#f():this.updateResult(),this.#v())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Yn(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Yn(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#w(),this.#t.removeObserver(this)}setOptions(e){const t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof J(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#S(),this.#t.setOptions(this.options),t._defaulted&&!Qn(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const r=this.hasListeners();r&&us(this.#t,n,this.options,t)&&this.#f(),this.updateResult(),r&&(this.#t!==n||J(this.options.enabled,this.#t)!==J(t.enabled,this.#t)||ve(this.options.staleTime,this.#t)!==ve(t.staleTime,this.#t))&&this.#m();const s=this.#g();r&&(this.#t!==n||J(this.options.enabled,this.#t)!==J(t.enabled,this.#t)||s!==this.#l)&&this.#y(s)}getOptimisticResult(e){const t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return Qa(this,n)&&(this.#r=n,this.#s=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(n,r)=>(this.trackProp(r),t?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#a.status==="pending"&&this.#a.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,r))})}trackProp(e){this.#_.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#f({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#f(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(V)),t}#m(){this.#b();const e=ve(this.options.staleTime,this.#t);if(gt.isServer()||this.#r.isStale||!Vn(e))return;const n=xi(this.#r.dataUpdatedAt,e)+1;this.#h=Oe.setTimeout(()=>{this.#r.isStale||this.updateResult()},n)}#g(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#y(e){this.#w(),this.#l=e,!(gt.isServer()||J(this.options.enabled,this.#t)===!1||!Vn(this.#l)||this.#l===0)&&(this.#d=Oe.setInterval(()=>{(this.options.refetchIntervalInBackground||wr.isFocused())&&this.#f()},this.#l))}#v(){this.#m(),this.#y(this.#g())}#b(){this.#h!==void 0&&(Oe.clearTimeout(this.#h),this.#h=void 0)}#w(){this.#d!==void 0&&(Oe.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){const n=this.#t,r=this.options,s=this.#r,i=this.#i,a=this.#s,l=e!==n?e.state:this.#n,{state:c}=e;let d={...c},u=!1,h;if(t._optimisticResults){const C=this.hasListeners(),k=!C&&ls(e,t),T=C&&us(e,n,t,r);(k||T)&&(d={...d,...$i(c.data,e.options)}),t._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:p,errorUpdatedAt:m,status:_}=d;h=d.data;let g=!1;if(t.placeholderData!==void 0&&h===void 0&&_==="pending"){let C;s?.isPlaceholderData&&t.placeholderData===a?.placeholderData?(C=s.data,g=!0):C=typeof t.placeholderData=="function"?t.placeholderData(this.#p?.state.data,this.#p):t.placeholderData,C!==void 0&&(_="success",h=zn(s?.data,C,t),u=!0)}if(t.select&&h!==void 0&&!g)if(s&&h===i?.data&&t.select===this.#u)h=this.#c;else try{this.#u=t.select,h=t.select(h),h=zn(s?.data,h,t),this.#c=h,this.#o=null}catch(C){this.#o=C}this.#o&&(p=this.#o,h=this.#c,m=Date.now(),_="error");const v=d.fetchStatus==="fetching",y=_==="pending",S=_==="error",b=y&&v,R=h!==void 0,w={status:_,fetchStatus:d.fetchStatus,isPending:y,isSuccess:_==="success",isError:S,isInitialLoading:b,isLoading:b,data:h,dataUpdatedAt:d.dataUpdatedAt,error:p,errorUpdatedAt:m,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:d.dataUpdateCount>l.dataUpdateCount||d.errorUpdateCount>l.errorUpdateCount,isFetching:v,isRefetching:v&&!y,isLoadingError:S&&!R,isPaused:d.fetchStatus==="paused",isPlaceholderData:u,isRefetchError:S&&R,isStale:Cr(e,t),refetch:this.refetch,promise:this.#a,isEnabled:J(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const C=w.data!==void 0,k=w.status==="error"&&!C,T=$=>{k?$.reject(w.error):C&&$.resolve(w.data)},x=()=>{const $=this.#a=w.promise=Gn();T($)},O=this.#a;switch(O.status){case"pending":e.queryHash===n.queryHash&&T(O);break;case"fulfilled":(k||w.data!==O.value)&&x();break;case"rejected":(!k||w.error!==O.reason)&&x();break}}return w}updateResult(){const e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#s=this.options,this.#i.data!==void 0&&(this.#p=this.#t),Qn(t,e))return;this.#r=t;const n=()=>{if(!e)return!0;const{notifyOnChangeProps:r}=this.options,s=typeof r=="function"?r():r;if(s==="all"||!s&&!this.#_.size)return!0;const i=new Set(s??this.#_);return this.options.throwOnError&&i.add("error"),Object.keys(this.#r).some(a=>{const o=a;return this.#r[o]!==e[o]&&i.has(o)})};this.#P({listeners:n()})}#S(){const e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;const t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#v()}#P(e){U.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function Va(e,t){return J(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&J(t.retryOnMount,e)===!1)}function ls(e,t){return Va(e,t)||e.state.data!==void 0&&Yn(e,t,t.refetchOnMount)}function Yn(e,t,n){if(J(t.enabled,e)!==!1&&ve(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Cr(e,t)}return!1}function us(e,t,n,r){return(e!==t||J(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Cr(e,n)}function Cr(e,t){return J(t.enabled,e)!==!1&&e.isStaleByTime(ve(t.staleTime,e))}function Qa(e,t){return!Qn(e.getCurrentResult(),t)}var Ka=class extends Mi{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||za(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#i({type:"continue"})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=Li({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(new Error("No mutationFn found")),onFail:(i,a)=>{this.#i({type:"failed",failureCount:i,error:a})},onPause:()=>{this.#i({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});const r=this.state.status==="pending",s=!this.#r.canStart();try{if(r)t();else{this.#i({type:"pending",variables:e,isPaused:s}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);const a=await this.options.onMutate?.(e,n);a!==this.state.context&&this.#i({type:"pending",context:a,variables:e,isPaused:s})}const i=await this.#r.start();return await this.#n.config.onSuccess?.(i,e,this.state.context,this,n),await this.options.onSuccess?.(i,e,this.state.context,n),await this.#n.config.onSettled?.(i,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(i,null,e,this.state.context,n),this.#i({type:"success",data:i}),i}catch(i){try{await this.#n.config.onError?.(i,e,this.state.context,this,n)}catch(a){Promise.reject(a)}try{await this.options.onError?.(i,e,this.state.context,n)}catch(a){Promise.reject(a)}try{await this.#n.config.onSettled?.(void 0,i,this.state.variables,this.state.context,this,n)}catch(a){Promise.reject(a)}try{await this.options.onSettled?.(void 0,i,e,this.state.context,n)}catch(a){Promise.reject(a)}throw this.#i({type:"error",error:i}),i}finally{this.#n.runNext(this)}}#i(e){const t=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),U.batch(()=>{this.#t.forEach(n=>{n.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}};function za(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Ga=class extends Tt{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){const r=new Ka({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);const t=Bt(e);if(typeof t=="string"){const n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){const t=Bt(e);if(typeof t=="string"){const n=this.#t.get(t);if(n)if(n.length>1){const r=n.indexOf(e);r!==-1&&n.splice(r,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=Bt(e);if(typeof t=="string"){const r=this.#t.get(t)?.find(s=>s.state.status==="pending");return!r||r===e}else return!0}runNext(e){const t=Bt(e);return typeof t=="string"?this.#t.get(t)?.find(r=>r!==e&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){U.batch(()=>{this.#e.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){const t={exact:!0,...e};return this.getAll().find(n=>rs(t,n))}findAll(e={}){return this.getAll().filter(t=>rs(e,t))}notify(e){U.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return U.batch(()=>Promise.all(e.map(t=>t.continue().catch(V))))}};function Bt(e){return e.options.scope?.id}var Ja=class extends Tt{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){const r=t.queryKey,s=t.queryHash??Sr(r,t);let i=this.get(s);return i||(i=new qa({client:e,queryKey:r,queryHash:s,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(i)),i}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){U.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(n=>ns(t,n))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(n=>ns(e,n)):t}notify(e){U.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){U.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){U.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Ya=class{#e;#t;#n;#r;#i;#s;#a;#o;constructor(e={}){this.#e=e.queryCache||new Ja,this.#t=e.mutationCache||new Ga,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#s=0}mount(){this.#s++,this.#s===1&&(this.#a=wr.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#o=on.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#s--,this.#s===0&&(this.#a?.(),this.#a=void 0,this.#o?.(),this.#o=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#t.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(ve(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=Ia(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return U.batch(()=>this.#e.findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){const t=this.#e;U.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=this.#e;return U.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=U.batch(()=>this.#e.findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(V).catch(V)}invalidateQueries(e,t={}){return U.batch(()=>(this.#e.findAll(e).forEach(n=>{n.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=U.batch(()=>this.#e.findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,n);return n.throwOnError||(i=i.catch(V)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(V)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=this.#e.build(this,t);return n.isStaleByTime(ve(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(V).catch(V)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(V).catch(V)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return on.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(mt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#r.values()],n={};return t.forEach(r=>{Ze(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(mt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#i.values()],n={};return t.forEach(r=>{Ze(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Sr(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Pr&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},fe,L,En,hs,et=0,Fi=[],D=E,ds=D.__b,fs=D.__r,ps=D.diffed,_s=D.__c,ms=D.unmount,gs=D.__;function De(e,t){D.__h&&D.__h(L,e,et||t),et=0;var n=L.__H||(L.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function A(e){return et=1,_n(Di,e)}function _n(e,t,n){var r=De(fe++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Di(void 0,t),function(o){var l=r.__N?r.__N[0]:r.__[0],c=r.t(l,o);l!==c&&(r.__N=[c,r.__[1]],r.__c.setState({}))}],r.__c=L,!L.__f)){var s=function(o,l,c){if(!r.__c.__H)return!0;var d=!1,u=r.__c.props!==o;if(r.__c.__H.__.some(function(p){if(p.__N){d=!0;var m=p.__[0];p.__=p.__N,p.__N=void 0,m!==p.__[0]&&(u=!0)}}),i){var h=i.call(this,o,l,c);return d?h||u:h}return!d||u};L.__f=!0;var i=L.shouldComponentUpdate,a=L.componentWillUpdate;L.componentWillUpdate=function(o,l,c){if(this.__e){var d=i;i=void 0,s(o,l,c),i=d}a&&a.call(this,o,l,c)},L.shouldComponentUpdate=s}return r.__N||r.__}function W(e,t){var n=De(fe++,3);!D.__s&&xr(n.__H,t)&&(n.__=e,n.u=t,L.__H.__h.push(n))}function Ae(e,t){var n=De(fe++,4);!D.__s&&xr(n.__H,t)&&(n.__=e,n.u=t,L.__h.push(n))}function H(e){return et=5,q(function(){return{current:e}},[])}function mn(e,t,n){et=6,Ae(function(){if(typeof e=="function"){var r=e(t());return function(){e(null),r&&typeof r=="function"&&r()}}if(e)return e.current=t(),function(){return e.current=null}},n==null?n:n.concat(e))}function q(e,t){var n=De(fe++,7);return xr(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function j(e,t){return et=8,q(function(){return e},t)}function ee(e){var t=L.context[e.__c],n=De(fe++,9);return n.c=e,t?(n.__==null&&(n.__=!0,t.sub(L)),t.props.value):e.__}function Rr(e,t){D.useDebugValue&&D.useDebugValue(t?t(e):e)}function Xa(e){var t=De(fe++,10),n=A();return t.__=e,L.componentDidCatch||(L.componentDidCatch=function(r,s){t.__&&t.__(r,s),n[1](r)}),[n[0],function(){n[1](void 0)}]}function kr(){var e=De(fe++,11);if(!e.__){for(var t=L.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__="P"+n[0]+"-"+n[1]++}return e.__}function Za(){for(var e;e=Fi.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Gt),t.__h.some(Xn),t.__h=[]}catch(n){t.__h=[],D.__e(n,e.__v)}}}D.__b=function(e){L=null,ds&&ds(e)},D.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),gs&&gs(e,t)},D.__r=function(e){fs&&fs(e),fe=0;var t=(L=e.__c).__H;t&&(En===L?(t.__h=[],L.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(Gt),t.__h.some(Xn),t.__h=[],fe=0)),En=L},D.diffed=function(e){ps&&ps(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Fi.push(t)!==1&&hs===D.requestAnimationFrame||((hs=D.requestAnimationFrame)||ec)(Za)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),En=L=null},D.__c=function(e,t){t.some(function(n){try{n.__h.some(Gt),n.__h=n.__h.filter(function(r){return!r.__||Xn(r)})}catch(r){t.some(function(s){s.__h&&(s.__h=[])}),t=[],D.__e(r,n.__v)}}),_s&&_s(e,t)},D.unmount=function(e){ms&&ms(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(r){try{Gt(r)}catch(s){t=s}}),n.__H=void 0,t&&D.__e(t,n.__v))};var ys=typeof requestAnimationFrame=="function";function ec(e){var t,n=function(){clearTimeout(r),ys&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);ys&&(t=requestAnimationFrame(n))}function Gt(e){var t=L,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),L=t}function Xn(e){var t=L;e.__c=e.__(),L=t}function xr(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function Di(e,t){return typeof t=="function"?t(e):t}function Ai(e,t){for(var n in t)e[n]=t[n];return e}function Zn(e,t){for(var n in e)if(n!=="__source"&&!(n in t))return!0;for(var r in t)if(r!=="__source"&&e[r]!==t[r])return!0;return!1}function st(e,t){var n=t(),r=A({t:{__:n,u:t}}),s=r[0].t,i=r[1];return Ae(function(){s.__=n,s.u=t,On(s)&&i({t:s})},[e,n,t]),W(function(){return On(s)&&i({t:s}),e(function(){On(s)&&i({t:s})})},[e]),n}function On(e){try{return!((t=e.__)===(n=e.u())&&(t!==0||1/t==1/n)||t!=t&&n!=n)}catch{return!0}var t,n}function gn(e){e()}function Tr(e){return e}function Er(){return[!1,gn]}var Or=Ae;function an(e,t){this.props=e,this.context=t}function Et(e,t){function n(s){var i=this.props.ref;return i!=s.ref&&i&&(typeof i=="function"?i(null):i.current=null),t?!t(this.props,s)||i!=s.ref:Zn(this.props,s)}function r(s){return this.shouldComponentUpdate=n,z(e,s)}return r.displayName="Memo("+(e.displayName||e.name)+")",r.__f=r.prototype.isReactComponent=!0,r.type=e,r}(an.prototype=new Z).isPureReactComponent=!0,an.prototype.shouldComponentUpdate=function(e,t){return Zn(this.props,e)||Zn(this.state,t)};var vs=E.__b;E.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),vs&&vs(e)};var tc=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function Ir(e){function t(n){var r=Ai({},n);return delete r.ref,e(r,n.ref||null)}return t.$$typeof=tc,t.render=e,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var bs=function(e,t){return e==null?null:de(de(e).map(t))},Ni={map:bs,forEach:bs,count:function(e){return e?de(e).length:0},only:function(e){var t=de(e);if(t.length!==1)throw"Children.only";return t[0]},toArray:de},nc=E.__e;E.__e=function(e,t,n,r){if(e.then){for(var s,i=t;i=i.__;)if((s=i.__c)&&s.__c)return t.__e==null&&(t.__e=n.__e,t.__k=n.__k||[]),s.__c(e,t)}nc(e,t,n,r)};var ws=E.unmount;function Ui(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),e.__c.__H=null),(e=Ai({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return Ui(r,t,n)})),e}function Bi(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return Bi(r,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function be(){this.__u=0,this.o=null,this.__b=null}function ji(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function Hi(e){var t,n,r,s=null;function i(a){if(t||(t=e()).then(function(o){o&&(s=o.default||o),r=!0},function(o){n=o,r=!0}),n)throw n;if(!r)throw t;return s?z(s,a):null}return i.displayName="Lazy",i.__f=!0,i}function Ve(){this.i=null,this.l=null}E.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),ws&&ws(e)},(be.prototype=new Z).__c=function(e,t){var n=t.__c,r=this;r.o==null&&(r.o=[]),r.o.push(n);var s=ji(r.__v),i=!1,a=function(){i||r.__z||(i=!0,n.__R=null,s?s(l):l())};n.__R=a;var o=n.__P;n.__P=null;var l=function(){if(!--r.__u){if(r.state.__a){var c=r.state.__a;r.__v.__k[0]=Bi(c,c.__c.__P,c.__c.__O)}var d;for(r.setState({__a:r.__b=null});d=r.o.pop();)d.__P=o,d.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(a,a)},be.prototype.componentWillUnmount=function(){this.o=[]},be.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=Ui(this.__b,n,r.__O=r.__P)}this.__b=null}var s=t.__a&&z(M,null,e.fallback);return s&&(s.__u&=-33),[z(M,null,t.__a?null:e.children),s]};var Ss=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]>>1,1),t.h.removeChild(s)}}}Xe(z(rc,{context:t.context},e.__v),t.v)}function qi(e,t){var n=z(sc,{__v:e,h:t});return n.containerInfo=t,n}(Ve.prototype=new Z).__a=function(e){var t=this,n=ji(t.__v),r=t.l.get(e);return r[0]++,function(s){var i=function(){t.props.revealOrder?(r.push(s),Ss(t,e,r)):s()};n?n(i):i()}},Ve.prototype.render=function(e){this.i=null,this.l=new Map;var t=de(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},Ve.prototype.componentDidUpdate=Ve.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){Ss(e,n,t)})};var Wi=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,ic=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,oc=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,ac=/[A-Z0-9]/g,cc=typeof document<"u",lc=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};function Vi(e,t,n){return t.__k==null&&(t.textContent=""),Xe(e,t),typeof n=="function"&&n(),e?e.__c:null}function Qi(e,t,n){return ki(e,t),typeof n=="function"&&n(),e?e.__c:null}Z.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(Z.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Ps=E.event;E.event=function(e){return Ps&&(e=Ps(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var Lr,uc={configurable:!0,get:function(){return this.class}},Cs=E.vnode;E.vnode=function(e){typeof e.type=="string"&&(function(t){var n=t.props,r=t.type,s={},i=r.indexOf("-")==-1;for(var a in n){var o=n[a];if(!(a==="value"&&"defaultValue"in n&&o==null||cc&&a==="children"&&r==="noscript"||a==="class"||a==="className")){var l=a.toLowerCase();a==="defaultValue"&&"value"in n&&n.value==null?a="value":a==="download"&&o===!0?o="":l==="translate"&&o==="no"?o=!1:l[0]==="o"&&l[1]==="n"?l==="ondoubleclick"?a="ondblclick":l!=="onchange"||r!=="input"&&r!=="textarea"||lc(n.type)?l==="onfocus"?a="onfocusin":l==="onblur"?a="onfocusout":oc.test(a)&&(a=l):l=a="oninput":i&&ic.test(a)?a=a.replace(ac,"-$&").toLowerCase():o===null&&(o=void 0),l==="oninput"&&s[a=l]&&(a="oninputCapture"),s[a]=o}}r=="select"&&(s.multiple&&Array.isArray(s.value)&&(s.value=de(n.children).forEach(function(c){c.props.selected=s.value.indexOf(c.props.value)!=-1})),s.defaultValue!=null&&(s.value=de(n.children).forEach(function(c){c.props.selected=s.multiple?s.defaultValue.indexOf(c.props.value)!=-1:s.defaultValue==c.props.value}))),n.class&&!n.className?(s.class=n.class,Object.defineProperty(s,"className",uc)):n.className&&(s.class=s.className=n.className),t.props=s})(e),e.$$typeof=Wi,Cs&&Cs(e)};var Rs=E.__r;E.__r=function(e){Rs&&Rs(e),Lr=e.__c};var ks=E.diffed;E.diffed=function(e){ks&&ks(e);var t=e.props,n=e.__e;n!=null&&e.type==="textarea"&&"value"in t&&t.value!==n.value&&(n.value=t.value==null?"":t.value),Lr=null};var Ki={ReactCurrentDispatcher:{current:{readContext:function(e){return Lr.__n[e.__c].props.value},useCallback:j,useContext:ee,useDebugValue:Rr,useDeferredValue:Tr,useEffect:W,useId:kr,useImperativeHandle:mn,useInsertionEffect:Or,useLayoutEffect:Ae,useMemo:q,useReducer:_n,useRef:H,useState:A,useSyncExternalStore:st,useTransition:Er}}},hc="18.3.1";function zi(e){return z.bind(null,e)}function Ot(e){return!!e&&e.$$typeof===Wi}function Gi(e){return Ot(e)&&e.type===M}function Ji(e){return!!e&&typeof e.displayName=="string"&&e.displayName.indexOf("Memo(")==0}function Yi(e){return Ot(e)?Ca.apply(null,arguments):e}function Xi(e){return!!e.__k&&(Xe(null,e),!0)}function Zi(e){return e&&(e.base||e.nodeType===1&&e)||null}var eo=function(e,t){return e(t)},Mr=function(e,t){var n,r=E.debounceRendering;E.debounceRendering=function(i){n=i};try{var s=e(t);return n&&n(),s}finally{E.debounceRendering=r}},to=Ot,It={useState:A,useId:kr,useReducer:_n,useEffect:W,useLayoutEffect:Ae,useInsertionEffect:Or,useTransition:Er,useDeferredValue:Tr,useSyncExternalStore:st,startTransition:gn,useRef:H,useImperativeHandle:mn,useMemo:q,useCallback:j,useContext:ee,useDebugValue:Rr,version:"18.3.1",Children:Ni,render:Vi,hydrate:Qi,unmountComponentAtNode:Xi,createPortal:qi,createElement:z,createContext:ne,createFactory:zi,cloneElement:Yi,createRef:yi,Fragment:M,isValidElement:Ot,isElement:to,isFragment:Gi,isMemo:Ji,findDOMNode:Zi,Component:Z,PureComponent:an,memo:Et,forwardRef:Ir,flushSync:Mr,unstable_batchedUpdates:eo,StrictMode:M,Suspense:be,SuspenseList:Ve,lazy:Hi,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Ki};const dc=Object.freeze(Object.defineProperty({__proto__:null,Children:Ni,Component:Z,Fragment:M,PureComponent:an,StrictMode:M,Suspense:be,SuspenseList:Ve,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Ki,cloneElement:Yi,createContext:ne,createElement:z,createFactory:zi,createPortal:qi,createRef:yi,default:It,findDOMNode:Zi,flushSync:Mr,forwardRef:Ir,hydrate:Qi,isElement:to,isFragment:Gi,isMemo:Ji,isValidElement:Ot,lazy:Hi,memo:Et,render:Vi,startTransition:gn,unmountComponentAtNode:Xi,unstable_batchedUpdates:eo,useCallback:j,useContext:ee,useDebugValue:Rr,useDeferredValue:Tr,useEffect:W,useErrorBoundary:Xa,useId:kr,useImperativeHandle:mn,useInsertionEffect:Or,useLayoutEffect:Ae,useMemo:q,useReducer:_n,useRef:H,useState:A,useSyncExternalStore:st,useTransition:Er,version:hc},Symbol.toStringTag,{value:"Module"}));var no=ne(void 0),ro=e=>{const t=ee(no);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},fc=({client:e,children:t})=>(W(()=>(e.mount(),()=>{e.unmount()}),[e]),f(no.Provider,{value:e,children:t})),so=ne(!1),pc=()=>ee(so);so.Provider;function _c(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var mc=ne(_c()),gc=()=>ee(mc),yc=(e,t,n)=>{const r=n?.state.error&&typeof e.throwOnError=="function"?Oi(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},vc=e=>{W(()=>{e.clearReset()},[e])},bc=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||Oi(n,[e.error,r])),wc=e=>{if(e.suspense){const n=s=>s==="static"?s:Math.max(s??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...s)=>n(r(...s)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Sc=(e,t)=>e.isLoading&&e.isFetching&&!t,Pc=(e,t)=>e?.suspense&&t.isPending,xs=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Cc(e,t,n){const r=pc(),s=gc(),i=ro(),a=i.defaultQueryOptions(e);i.getDefaultOptions().queries?._experimental_beforeQuery?.(a);const o=i.getQueryCache().get(a.queryHash),l=e.subscribed!==!1;a._optimisticResults=r?"isRestoring":l?"optimistic":void 0,wc(a),yc(a,s,o),vc(s);const c=!i.getQueryCache().get(a.queryHash),[d]=A(()=>new t(i,a)),u=d.getOptimisticResult(a),h=!r&&l;if(st(j(p=>{const m=h?d.subscribe(U.batchCalls(p)):V;return d.updateResult(),m},[d,h]),()=>d.getCurrentResult()),W(()=>{d.setOptions(a)},[a,d]),Pc(a,u))throw xs(a,d,s);if(bc({result:u,errorResetBoundary:s,throwOnError:a.throwOnError,query:o,suspense:a.suspense}))throw u.error;return i.getDefaultOptions().queries?._experimental_afterQuery?.(a,u),a.experimental_prefetchInRender&&!gt.isServer()&&Sc(u,r)&&(c?xs(a,d,s):o?.promise)?.catch(V).finally(()=>{d.updateResult()}),a.notifyOnChangeProps?u:d.trackResult(u)}function Ts(e,t){return Cc(e,Wa)}const Rc=!1;var io=Ae;function kc(e,t,n={},r){W(()=>{if(!e.current||r||typeof IntersectionObserver!="function")return;const s=new IntersectionObserver(([i])=>{t(i)},n);return s.observe(e.current),()=>{s.disconnect()}},[t,r,n,e])}function xc(e){const t=H(null);return mn(e,()=>t.current,[]),t}function yt(e){return e[e.length-1]}function Tc(e){return typeof e=="function"}function tt(e,t){return Tc(e)?e(t):e}const oo=Object.prototype.hasOwnProperty,Ec=Object.prototype.propertyIsEnumerable;function ao(e){for(const t in e)if(oo.call(e,t))return!0;return!1}const Oc=()=>Object.create(null),ke=(e,t)=>Ie(e,t,Oc);function Ie(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;const s=t,i=Is(e)&&Is(s);if(!i&&!(cn(e)&&cn(s)))return s;const a=i?e:Es(e);if(!a)return s;const o=i?s:Es(s);if(!o)return s;const l=a.length,c=o.length,d=i?new Array(c):n();let u=0;for(let h=0;h"u")return!0;const n=t.prototype;return!(!Os(n)||!n.hasOwnProperty("isPrototypeOf"))}function Os(e){return Object.prototype.toString.call(e)==="[object Object]"}function Is(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function we(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,s=e.length;rs||!we(e[a],t[a],n)))return!1;return s===i}return!1}const Ic=/[\x00-\x1f\x7f"<>`{}]/g;function Lc(e){return e.replace(Ic,t=>"%"+t.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0"))}function Ls(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,n=>{try{return decodeURI(n)}catch{return n}})}return Lc(t)}const Mc=["http:","https:","mailto:","tel:"];function ln(e,t){if(!e)return!1;try{const n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function ct(e){if(!e)return{path:e,handledProtocolRelativeURL:!1};if(!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith("//"))return{path:e,handledProtocolRelativeURL:!1};const t=/%25|%5C/gi;let n=0,r="",s;for(;(s=t.exec(e))!==null;)r+=Ls(e.slice(n,s.index))+s[0],n=t.lastIndex;r=r+Ls(n?e.slice(n):e);let i=!1;return r.startsWith("//")&&(i=!0,r="/"+r.replace(/^\/+/,"")),{path:r,handledProtocolRelativeURL:i}}function $c(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Fc(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n{i.next&&(i.prev?(i.prev.next=i.next,i.next.prev=i.prev,i.next=void 0,r&&(r.next=i,i.prev=r)):(i.next.prev=void 0,n=i.next,i.next=void 0,r&&(i.prev=r,r.next=i)),r=i)};return{get(i){const a=t.get(i);if(a)return s(a),a.value},set(i,a){if(t.size>=e&&n){const l=n;t.delete(l.key),l.next&&(n=l.next,l.next.prev=void 0),l===r&&(r=void 0)}const o=t.get(i);if(o)o.value=a,s(o);else{const l={key:i,value:a,prev:r};r&&(r.next=l),r=l,n||(n=l),t.set(i,l)}},clear(){t.clear(),n=void 0,r=void 0}}}const ye=4,co=5;function Dc(e){const t=e.indexOf("{");if(t===-1)return null;const n=e.indexOf("}",t);return n===-1||t+1>=e.length?null:[t,n]}function lo(e,t,n=new Uint16Array(6)){const r=e.indexOf("/",t),s=r===-1?e.length:r,i=e.substring(t,s);if(!i||!i.includes("$"))return n[0]=0,n[1]=t,n[2]=t,n[3]=s,n[4]=s,n[5]=s,n;if(i==="$"){const o=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=o,n[4]=o,n[5]=o,n}if(i.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=s,n[4]=s,n[5]=s,n;const a=Dc(i);if(a){const[o,l]=a,c=i.charCodeAt(o+1);if(c===45){if(o+2!x.parse&&x.caseSensitive===P&&x.prefix===w&&x.suffix===C);if(T)g=T;else{const x=Ac(S,c,P,w,C);g=x,x.parent=s,x.depth=i;let O;S===1?O=s.dynamic??=[]:S===3?O=s.optional??=[]:O=s.wildcard??=[],O.push(x),O.length===2&&a?.push(O)}break}}s=g}if(p&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf("/")+1)===95){const _=Ke(c);_.kind=co,_.parent=s,i++,_.depth=i,s.pathless??=[],s.pathless.push(_),s=_}const m=(n.path||!n.children)&&!n.isRoot;if(m&&c.endsWith("/")){const _=Ke(c);_.kind=ye,_.parent=s,i++,_.depth=i,s.index=_,s=_}s.parse=p??null,s.priority=d?.params?.priority??0,m&&!s.route&&(s.route=n,s.fullPath=c)}if(n.children)for(const c of n.children)yn(e,t,c,l,s,i,a,o)}function uo(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function Ke(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,priority:0}}function Ac(e,t,n,r,s){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:s}}function Nc(e,t){const n=Ke("/"),r=new Uint16Array(6),s=[];for(const i of e)yn(!1,r,i,1,n,0,s);for(const i of s)i.sort(uo);t.masksTree=n,t.flatCache=un(1e3)}function Uc(e,t){e||="/";const n=t.flatCache.get(e);if(n)return n;const r=Fr(e,t.masksTree);return t.flatCache.set(e,r),r}function Bc(e,t,n,r,s){e||="/",r||="/";const i=t?`case\0${e}`:e;let a=s.singleCache.get(i);return a||(a=Ke("/"),yn(t,new Uint16Array(6),{from:e},1,a,0),s.singleCache.set(i,a)),Fr(r,a,n)}function jc(e,t,n=!1){const r=n?e:`nofuzz\0${e}`,s=t.matchCache.get(r);if(s!==void 0)return s;e||="/";let i;try{i=Fr(e,t.segmentTree,n)}catch(a){if(a instanceof URIError)i=null;else throw a}return i&&(i.branch=fo(i.route)),t.matchCache.set(r,i),i}function Hc(e){return e==="/"?e:e.replace(/\/{1,}$/,"")}function qc(e,t=!1,n){const r=Ke(e.fullPath),s=new Uint16Array(6),i=[],a={},o={};let l=0;yn(t,s,e,1,r,0,i,c=>{if(n?.(c,l),c.id in a&&$r(),a[c.id]=c,l!==0&&c.path){const d=Hc(c.fullPath);(!o[d]||c.fullPath.endsWith("/"))&&(o[d]=c)}l++});for(const c of i)c.sort(uo);return{processedTree:{segmentTree:r,singleCache:un(1e3),matchCache:un(1e3),flatCache:null,masksTree:null},routesById:a,routesByPath:o}}function Fr(e,t,n=!1){const r=e.split("/"),s=Vc(e,r,t,n);if(!s)return null;const[i]=ho(e,r,s);return{route:s.node.route,rawParams:i}}function ho(e,t,n){const r=Wc(n.node);let s=null;const i=Object.create(null);let a=n.extract?.part??0,o=n.extract?.node??0,l=n.extract?.path??0,c=n.extract?.segment??0;for(;o=0;P--){const w=u.wildcard[P],{prefix:C,suffix:k}=w;if(!(C&&(S||!(w.caseSensitive?b:R??=b.toLowerCase()).startsWith(C)))){if(k){if(S)continue;const T=t.slice(h).join("/").slice(-k.length);if((w.caseSensitive?T:T.toLowerCase())!==k)continue}o.push({node:w,index:a,skipped:p,statics:m,dynamics:_,optionals:g,extract:v,rawParams:y})}}if(u.optional){const P=p|1<=0;w--){const C=u.optional[w];o.push({node:C,index:h,skipped:P,statics:m,dynamics:_,optionals:g,extract:v,rawParams:y})}if(!S)for(let w=u.optional.length-1;w>=0;w--){const C=u.optional[w],{prefix:k,suffix:T}=C;if(k||T){const x=C.caseSensitive?b:R??=b.toLowerCase();if(k&&!x.startsWith(k)||T&&!x.endsWith(T))continue}o.push({node:C,index:h+1,skipped:p,statics:m,dynamics:_,optionals:g+jt(a,h),extract:v,rawParams:y})}}if(!S&&u.dynamic&&b)for(let P=u.dynamic.length-1;P>=0;P--){const w=u.dynamic[P],{prefix:C,suffix:k}=w;if(C||k){const T=w.caseSensitive?b:R??=b.toLowerCase();if(C&&!T.startsWith(C)||k&&!T.endsWith(k))continue}o.push({node:w,index:h+1,skipped:p,statics:m,dynamics:_+jt(a,h),optionals:g,extract:v,rawParams:y})}if(!S&&u.staticInsensitive){const P=u.staticInsensitive.get(R??=b.toLowerCase());P&&o.push({node:P,index:h+1,skipped:p,statics:m+jt(a,h),dynamics:_,optionals:g,extract:v,rawParams:y})}if(!S&&u.static){const P=u.static.get(b);P&&o.push({node:P,index:h+1,skipped:p,statics:m+jt(a,h),dynamics:_,optionals:g,extract:v,rawParams:y})}if(u.pathless)for(let P=u.pathless.length-1;P>=0;P--){const w=u.pathless[P];o.push({node:w,index:h,skipped:p,statics:m,dynamics:_,optionals:g,extract:v,rawParams:y})}}if(c)return c;if(r&&l){let d=l.index;for(let h=0;he.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===ye)>(e.node.kind===ye)||t.node.kind===ye==(e.node.kind===ye)&&t.node.depth>e.node.depth))):!0}function Jt(e){return Dr(e.filter(t=>t!==void 0).join("/"))}function Dr(e){return e.replace(/\/{2,}/g,"/")}function po(e){return e==="/"?e:e.replace(/^\/{1,}/,"")}function ue(e){const t=e.length;return t>1&&e[t-1]==="/"?e.replace(/\/{1,}$/,""):e}function _o(e){return ue(po(e))}function hn(e,t){return e?.endsWith("/")&&e!=="/"&&e!==`${t}/`?e.slice(0,-1):e}function Kc(e,t,n){return hn(e,n)===hn(t,n)}function zc({base:e,to:t,trailingSlash:n="never",cache:r}){const s=t===".",i=t.startsWith("/");let a;if(r){a=i?t:s?e:e+"\0"+t;const c=r.get(a);if(c)return c}let o;if(s)o=e.split("/");else if(i)o=t.split("/");else{for(o=e.split("/");o.length>1&&yt(o)==="";)o.pop();const c=t.split("/");for(let d=0,u=c.length;d1?o.pop():o=[""]:h==="."||o.push(h)}}o.length>1&&(yt(o)===""?n==="never"&&o.pop():n==="always"&&o.push(""));const l=Dr(o.join("/"))||"/";return a&&r&&r.set(a,l),l}function Gc(e){const t=new Map(e.map(s=>[encodeURIComponent(s),s])),n=Array.from(t.keys()).map(s=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),r=new RegExp(n,"g");return s=>s.replace(r,i=>t.get(i)??i)}function In(e,t,n){const r=t[e];return typeof r!="string"?r:e==="_splat"?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split("/").map(s=>Fs(s,n)).join("/"):Fs(r,n)}function $s({path:e,params:t,decoder:n,...r}){let s=!1;const i=Object.create(null);if(!e||e==="/")return{interpolatedPath:"/",usedParams:i,isMissingParams:s};if(!e.includes("$"))return{interpolatedPath:e,usedParams:i,isMissingParams:s};const a=e.length;let o=0,l,c="";for(;oe.state.__TSR_key||e.href;function tl(e){const t=e.getAttribute(Ds);if(t)return`[${Ds}="${t}"]`;let n="",r=e,s;for(;s=r.parentNode;){let i=1,a=r;for(;a=a.previousElementSibling;)i++;const o=`${r.localName}:nth-child(${i})`;n=n?`${o} > ${n}`:o,r=s}return n}let qt=!1;const Yt="window";function er(e){try{return typeof e=="function"?e():document.querySelector(e)}catch{}}function As(e){const t=new Set;for(const n of e){if(n===Yt)continue;const r=er(n);r&&t.add(r)}return t}function nl(e,t){const n=e.options.scrollRestoration,r=e._scroll;n&&(r.restoring=!0);const s=e.options.getScrollRestorationKey||el,i=new Set,a=o=>{const l=qe[o]||={};for(const c of i)c===document?l[Yt]={scrollX,scrollY}:c.isConnected&&(l[tl(c)]={scrollX:c.scrollLeft,scrollY:c.scrollTop})};n&&!r.restoration&&(r.restoration=!0,qt=!1,history.scrollRestoration="manual",document.addEventListener("scroll",o=>{qt||i.add(o.target)},!0),e.subscribe("onBeforeLoad",o=>{o.fromLocation&&a(s(o.fromLocation)),i.clear()}),addEventListener("pagehide",()=>{a(s(e.stores.resolvedLocation.get()??e.stores.location.get())),Zc()})),!r.reset&&(r.reset=!0,e.subscribe("onRendered",o=>{const l=e.options.scrollRestorationBehavior,c=e.options.scrollToTopSelectors,d=r.next,u=r.hash;let h;if(i.clear(),r.next=!0,r.hash=!1,typeof e.options.scrollRestoration=="function"&&!e.options.scrollRestoration({location:e.latestLocation}))return;const p=s(o.toLocation),m=o.fromLocation&&s(o.fromLocation);if(r.restoring&&m&&m!==p){const _=qe[m];if(_){let g=qe[p];for(const v in _){if(v===Yt){if(d)continue}else{const y=er(v);if(!y||d&&c&&(h??=As(c),h.has(y)))continue}g||(g=qe[p]={}),g[v]??=_[v]}}}qt=!0;try{const _=o.toLocation.hash,g=o.toLocation.state.__hashScrollIntoViewOptions??!0;let v=!1;if(d){!_&&c&&(h??=As(c));const y=_&&g&&u,S=r.restoring?qe[p]:void 0;if(S)for(const b in S){const{scrollX:R,scrollY:P}=S[b];if(b===Yt){if(y)continue;scrollTo({top:P,left:R,behavior:l}),v=!0}else{const w=er(b);w&&(w.scrollLeft=R,w.scrollTop=P,h?.delete(w))}}if(!_){const b={top:0,left:0,behavior:l};if(v||scrollTo(b),h)for(const R of h)R.scrollTo(b)}}!v&&_&&g&&document.getElementById(_)?.scrollIntoView(g)}finally{qt=!1}}))}function rl(e,t=String){const n=new URLSearchParams;for(const r in e){const s=e[r];s!==void 0&&n.set(r,t(s))}return n.toString()}function Ln(e){return e?e==="false"?!1:e==="true"?!0:+e*0===0&&+e+""===e?+e:e:""}function sl(e){const t=new URLSearchParams(e),n=Object.create(null);for(const[r,s]of t.entries()){const i=n[r];i==null?n[r]=Ln(s):Array.isArray(i)?i.push(Ln(s)):n[r]=[i,Ln(s)]}return n}const il=/^(?:\s|["[{\d-]|fa|nu|tr)/,ol=cl(JSON.parse),al=ll(JSON.stringify,JSON.parse);function cl(e){return t=>{t[0]==="?"&&(t=t.substring(1));const n=sl(t);for(const r in n){const s=n[r];if(typeof s=="string")try{n[r]=e(s)}catch{}}return n}}function ll(e,t){const n=t===JSON.parse;function r(s){if(s&&typeof s=="object")try{return e(s)}catch{}else if(t&&typeof s=="string"){if(n&&!il.test(s))return s;try{return t(s),e(s)}catch{}}return s}return s=>{const i=rl(s,r);return i?`?${i}`:""}}const ze="__root__";function ul(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&!e.reloadDocument&&typeof e.href=="string")try{new URL(e.href),e.reloadDocument=!0}catch{}const t=new Headers(e.headers);e.href&&t.get("Location")===null&&t.set("Location",e.href);const n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function Ar(e){return e instanceof Response&&!!e.options}function hl(e){return{input:({url:t})=>{for(const n of e)t=tr(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=go(e[n],t);return t}}}function dl(e){const t=_o(e.basepath),n=`/${t}`,r=e.caseSensitive?n:n.toLowerCase(),s=`${r}/`;return{input:({url:i})=>{const a=e.caseSensitive?i.pathname:i.pathname.toLowerCase();return a===r?i.pathname="/":a.startsWith(s)&&(i.pathname=i.pathname.slice(n.length)),i},output:({url:i})=>(i.pathname=Jt(["/",t,i.pathname]),i)}}function tr(e,t){const n=e?.input?.({url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function go(e,t){const n=e?.output?.({url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function fl(e,t){const{createMutableStore:n,createReadonlyStore:r,batch:s}=t,i=new Map,a=n("idle"),o=n(e),l=n(void 0),c=n([]),d=r(()=>c.get().map(_=>i.get(_).get())),u=r(()=>({status:a.get(),isLoading:a.get()==="pending",matches:d.get(),location:o.get(),resolvedLocation:l.get()}));function h(_){let g=i.get(_);return g||(g=n(void 0),i.set(_,g)),g}const p={status:a,location:o,resolvedLocation:l,ids:c,matches:d,byRoute:i,__store:u,getMatchStore:h,setMatches:m};function m(_){const g=c.get(),v=_.map(y=>y.routeId);s(()=>{Fc(g,v)||c.set(v);for(const y of g)v.includes(y)||i.get(y).set(()=>{});for(const y of _){const S=h(y.routeId);S.get()!==y&&S.set(y)}})}return p}var Se="__TSR_index",Ns="popstate",Us="beforeunload";function pl(e){let t=e.getLocation();const n=new Set,r=a=>{t=e.getLocation(),n.forEach(o=>o({location:t,action:a}))},s=a=>{e.notifyOnIndexChange??!0?r(a):t=e.getLocation()},i=async({task:a,navigateOpts:o,...l})=>{if(o?.ignoreBlocker??!1){a();return}const c=e.getBlockers?.()??[],d=l.type==="PUSH"||l.type==="REPLACE";if(typeof document<"u"&&c.length&&d)for(const u of c){const h=vt(l.path,l.state);if(await u.blockerFn({currentLocation:t,nextLocation:h,action:l.type})){e.onBlocked?.();return}}a()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:a=>(n.add(a),()=>{n.delete(a)}),push:(a,o,l)=>{const c=t.state[Se];o=Bs(c+1,o),i({task:()=>{e.pushState(a,o),r({type:"PUSH"})},navigateOpts:l,type:"PUSH",path:a,state:o})},replace:(a,o,l)=>{const c=t.state[Se];o=Bs(c,o),i({task:()=>{e.replaceState(a,o),r({type:"REPLACE"})},navigateOpts:l,type:"REPLACE",path:a,state:o})},go:(a,o)=>{i({task:()=>{e.go(a),s({type:"GO",index:a})},navigateOpts:o,type:"GO"})},back:a=>{i({task:()=>{e.back(a?.ignoreBlocker??!1),s({type:"BACK"})},navigateOpts:a,type:"BACK"})},forward:a=>{i({task:()=>{e.forward(a?.ignoreBlocker??!1),s({type:"FORWARD"})},navigateOpts:a,type:"FORWARD"})},canGoBack:()=>t.state[Se]!==0,createHref:a=>e.createHref(a),block:a=>{if(!e.setBlockers)return()=>{};const o=e.getBlockers?.()??[];return e.setBlockers([...o,a]),()=>{const l=e.getBlockers?.()??[];e.setBlockers?.(l.filter(c=>c!==a))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}function Bs(e,t){t||(t={});const n=Nr();return{...t,key:n,__TSR_key:n,[Se]:e}}function yo(e){const t=e?.window??(typeof document<"u"?window:void 0),n=t.history.pushState,r=t.history.replaceState;let s=[];const i=()=>s,a=w=>s=w,o=e?.createHref??(w=>w),l=e?.parseLocation??(()=>vt(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){const w=Nr();t.history.replaceState({[Se]:0,key:w,__TSR_key:w},"")}let c=l(),d,u=!1,h=!1,p=!1,m=!1;const _=()=>c;let g;const v=()=>{g&&(P._ignoreSubscribers=!0,(g[2]?t.history.pushState:t.history.replaceState)(g[1],"",g[0]),P._ignoreSubscribers=!1,g=void 0,d=void 0)},y=(w,C,k)=>{const T=o(C),x=!!g;x||(d=c),c=vt(C,k),g=[T,k,g?.[2]||w],x||queueMicrotask(()=>v())},S=w=>{c=l(),P.notify({type:w})},b=async()=>{if(h){h=!1;return}const w=l(),C=w.state[Se]-c.state[Se],k=C===1,T=C===-1,x=!k&&!T||u;u=!1;const O=x?"GO":T?"BACK":"FORWARD",$=x?{type:"GO",index:C}:{type:T?"BACK":"FORWARD"};if(p)p=!1;else{const ot=i();if(typeof document<"u"&&ot.length){for(const se of ot)if(await se.blockerFn({currentLocation:c,nextLocation:w,action:O})){h=!0,t.history.go(1),P.notify($);return}}}c=l(),P.notify($)},R=w=>{if(m){m=!1;return}let C=!1;const k=i();if(typeof document<"u"&&k.length)for(const T of k){const x=T.enableBeforeUnload??!0;if(x===!0){C=!0;break}if(typeof x=="function"&&x()===!0){C=!0;break}}if(C)return w.preventDefault(),w.returnValue=""},P=pl({getLocation:_,getLength:()=>t.history.length,pushState:(w,C)=>y(!0,w,C),replaceState:(w,C)=>y(!1,w,C),back:w=>(w&&(p=!0),m=!0,t.history.back()),forward:w=>{w&&(p=!0),m=!0,t.history.forward()},go:w=>{u=!0,t.history.go(w)},createHref:w=>o(w),flush:v,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(Us,R,{capture:!0}),t.removeEventListener(Ns,b)},onBlocked:()=>{d&&c!==d&&(c=d)},getBlockers:i,setBlockers:a,notifyOnIndexChange:!1});return t.addEventListener(Us,R,{capture:!0}),t.addEventListener(Ns,b),t.history.pushState=function(...w){const C=n.apply(t.history,w);return P._ignoreSubscribers||S("PUSH"),C},t.history.replaceState=function(...w){const C=r.apply(t.history,w);return P._ignoreSubscribers||S("REPLACE"),C},P}function _l(e){const t=typeof document<"u"?window:void 0;return yo({window:t,parseLocation:()=>{const n=t.location.hash.split("#").slice(1),r=n[0]??"/",s=t.location.search,i=n.slice(1);return vt(`${r}${s}${i.length===0?"":`#${i.join("#")}`}`,t.history.state)},createHref:n=>`${t.location.pathname}${t.location.search}#${n}`})}function ml(e){let t=e.replace(/[\x00-\x1f\x7f]/g,"");return t.startsWith("//")&&(t="/"+t.replace(/^\/+/,"")),t}function vt(e,t){const n=ml(e),r=n.indexOf("#"),s=n.indexOf("?"),i=Nr();return{href:n,pathname:n.substring(0,r>0?s>0?Math.min(r,s):r:s>0?s:n.length),hash:r>-1?n.substring(r):"",search:s>-1?n.slice(s,r===-1?void 0:r):"",state:t||{[Se]:0,key:i,__TSR_key:i}}}function Nr(){return(Math.random()+1).toString(36).substring(7)}function js(e){return e.options.loader||e.options.beforeLoad||e.lazyFn||e.options.component?.preload||e.options.pendingComponent?.preload}function vn(e,t){return{fromLocation:t,toLocation:e,pathChanged:t?.pathname!==e.pathname,hrefChanged:t?.href!==e.href,hashChanged:t?.hash!==e.hash}}function Hs({key:e,__TSR_key:t,__TSR_index:n,__hashScrollIntoViewOptions:r,...s}){return s}function gl(e,t,n,r){for(const s of t){if(r?.()===!1)return;n.some(i=>i.routeId===s.routeId)||e.routesById[s.routeId].options.onLeave?.(s)}for(const s of n){if(r?.()===!1)return;e.routesById[s.routeId].options[t.some(i=>i.routeId===s.routeId)?"onStay":"onEnter"]?.(s)}}var yl=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={next:!0},this.subscribers=new Set,this._cache=new Map,this._committed=[],this.routeBranchCache=new WeakMap,this.lightweightCache=new WeakMap,this.startTransition=async n=>(n(),!1),this.update=n=>{const r=this.options,s=this.basepath??r?.basepath??"/",i=this.basepath===void 0,a=r?.rewrite;if(this.options={...r,...n},this.isServer=this.options.isServer??Rc??typeof document>"u",this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=Gc(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=yo()),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 c;this.resolvePathCache=un(1e3),c=this.buildRouteTree(),this.setRoutes(c)}if(!this.stores&&this.latestLocation){const c=this.getStoreConfig(this);this.batch=c.batch,this.stores=fl(this.latestLocation,c),nl(this)}const o=this.options.basepath??"/",l=this.options.rewrite;if(i||s!==o||a!==l){this.basepath=o;const c=[],d=_o(o);d&&d!=="/"&&c.push(dl({basepath:o})),l&&c.push(l),this.rewrite=c.length===0?void 0:c.length===1?c[0]:hl(c),this.history&&this.updateLatestLocation(),this.stores&&this.stores.location.set(this.latestLocation)}},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{const n=qc(this.routeTree,this.options.caseSensitive,(r,s)=>{r.init({originalIndex:s})});return this.options.routeMasks&&Nc(this.options.routeMasks,n.processedTree),n},this.subscribe=(n,r)=>{const s={eventType:n,fn:r};return this.subscribers.add(s),()=>{this.subscribers.delete(s)}},this.emit=n=>{for(const r of this.subscribers)if(r.eventType===n.type)try{r.fn(n)}catch(s){console.error(s)}},this.parseLocation=(n,r)=>{const s=({pathname:l,search:c,hash:d,href:u,state:h})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(l)){const v=this.options.parseSearch(c),y=this.options.stringifySearch(v);return{href:l+y+d,publicHref:l+y+d,pathname:ct(l).path,external:!1,searchStr:y,search:ke(r?.search,v),hash:ct(d.slice(1)).path,state:Ie(r?.state,h)}}const p=new URL(u,this.origin),m=tr(this.rewrite,p),_=this.options.parseSearch(m.search),g=this.options.stringifySearch(_);return m.search=g,{href:m.href.replace(m.origin,""),publicHref:u,pathname:ct(m.pathname).path,external:!!this.rewrite&&m.origin!==this.origin,searchStr:g,search:ke(r?.search,_),hash:ct(m.hash.slice(1)).path,state:Ie(r?.state,h)}},i=s(n),{__tempLocation:a,__tempKey:o}=i.state;if(a&&(!o||o===this.tempLocationKey)){const l=s(a);return l.state.key=i.state.key,l.state.__TSR_key=i.state.__TSR_key,delete l.state.__tempLocation,{...l,maskedLocation:i}}return i},this.resolvePathWithBase=(n,r)=>zc({base:n,to:r.includes("//")?Dr(r):r,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(n,r,s)=>typeof n=="string"?this.matchRoutesInternal({pathname:n,search:r},s):this.matchRoutesInternal(n,r),this.getMatchedRoutes=n=>{const r=Object.create(null),s=jc(ue(n),this.processedTree,!0);return s&&Object.assign(r,s.rawParams),[s?.branch||[this.routesById.__root__],r,s?.route]},this.buildLocation=n=>{const r=(i={})=>{const a=i._fromLocation||this._pendingLocation||this.latestLocation,o=this.matchRoutesLightweight(a);i.from;const l=i.unsafeRelative==="path"?a.pathname:i.from??o[1],c=i.to?`${i.to}`:void 0,d=o[2],u=Object.assign(Object.create(null),o[3]),h=c?.charCodeAt(0)===47?"/":this.resolvePathWithBase(l,"."),p=c?this.resolvePathWithBase(h,c):h,m=qs(i.params,u),_=this.routesByPath[ue(p)];let g;if(_)g=this.getRouteBranch(_);else if(p.includes("$"))g=[];else{const[x,O,$]=this.getMatchedRoutes(p);g=x,this.options.notFoundRoute&&(!$||$.path!=="/"&&O["**"])&&(g=[...g,this.options.notFoundRoute])}if(g.length&&ao(m))for(const x of g){const O=x.options.params?.stringify??x.options.stringifyParams;if(O)try{Object.assign(m,O(m))}catch{}}const v=n.leaveParams?p:ct($s({path:p,params:m,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path;let y=d;if(n._includeValidateSearch&&this.options.search?.strict){const x={};g.forEach(O=>{if(O.options.validateSearch)try{Object.assign(x,Xt(O.options.validateSearch,{...x,...y}))}catch{}}),y=x}y=bl(y,i,g,n._includeValidateSearch),y=ke(d,y);const S=this.options.stringifySearch(y),b=i.hash===!0?a.hash:i.hash?tt(i.hash,a.hash):void 0,R=b?`#${b}`:"";let P=i.state===!0?a.state:i.state?tt(i.state,a.state):{};P=Ie(a.state,P);const w=`${v}${S}${R}`;let C,k,T=!1;if(this.rewrite){const x=new URL(w,this.origin),O=go(this.rewrite,x);C=x.href.replace(x.origin,""),O.origin!==this.origin?(k=O.href,T=!0):k=O.pathname+O.search+O.hash}else C=$c(w),k=C;return{publicHref:k,href:C,pathname:v,search:y,searchStr:S,state:P,hash:b??"",external:T,unmaskOnReload:i.unmaskOnReload}},s=(i={},a)=>{const o=r(i);let l=a?r(a):void 0;if(!l){const c=Object.create(null);if(this.options.routeMasks){const d=Uc(o.pathname,this.processedTree);if(d){Object.assign(c,d.rawParams);const{from:u,params:h,...p}=d.route,m=qs(h,c);a={from:n.from,...p,params:m},l=r(a)}}}return l&&(o.maskedLocation=l),o};return n.mask?s(n,{from:n.from,...n.mask}):s(n)},this.commitLocation=async({viewTransition:n,ignoreBlocker:r,...s})=>{let i;const a=ue(this.latestLocation.href)===ue(s.href)&&we(Hs(s.state),Hs(this.latestLocation.state)),o=this._commitPromise;let l;const c=new Promise(d=>{l=d});if(c.resolve=()=>{l(),o?.resolve()},this._commitPromise=c,a)this.load();else{let{maskedLocation:d,hashScrollIntoView:u,...h}=s;d&&(h={...d,state:{...d.state,__tempKey:void 0,__tempLocation:{...h,search:h.searchStr,state:{...h.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(h.unmaskOnReload??this.options.unmaskOnReload??!1)&&(h.state.__tempKey=this.tempLocationKey)),h.state.__hashScrollIntoViewOptions=u??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=n,i=s.replace?"REPLACE":"PUSH",this.history[i==="REPLACE"?"replace":"push"](h.publicHref,h.state,{ignoreBlocker:r}),this.history.subscribers.size||this.load({action:{type:i}})}return this._scroll.next=s.resetScroll??!0,this._commitPromise},this.buildAndCommitLocation=({replace:n,resetScroll:r,hashScrollIntoView:s,viewTransition:i,ignoreBlocker:a,_redirects:o,href:l,...c}={})=>{if(l){const h=this.history.location.state.__TSR_index,p=vt(l,{__TSR_index:n?h:h+1}),m=new URL(p.pathname,this.origin);c.to=tr(this.rewrite,m).pathname,c.search=this.options.parseSearch(p.search),c.hash=p.hash.slice(1)}const d=this.buildLocation({...c,_includeValidateSearch:!0});o&&(d._redirects=o),this._pendingLocation=d;const u=this.commitLocation({...d,viewTransition:i,replace:n,resetScroll:r,hashScrollIntoView:s,ignoreBlocker:a});return queueMicrotask(()=>{this._pendingLocation===d&&(this._pendingLocation=void 0)}),u},this.navigate=async({to:n,reloadDocument:r,href:s,publicHref:i,...a})=>{let o=!1;if(s)try{new URL(`${s}`),o=!0}catch{}if(o&&!r&&(r=!0),r){if(n!==void 0||!s){const c=this.buildLocation({to:n,...a});s=s??c.publicHref,i=i??c.publicHref}const l=!o&&i?i:s;if(ln(l,this.protocolAllowlist))return;if(!a.ignoreBlocker){const c=this.history.getBlockers?.()??[];for(const d of c)if(d?.blockerFn&&await d.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:"PUSH"}))return}a.replace?window.location.replace(l):window.location.href=l;return}return this.buildAndCommitLocation({...a,href:s,to:n,_isNavigate:!0})},this.load=async n=>{this.updateLatestLocation(),n?.action&&(this._scroll.hash=n.action.type==="PUSH"||n.action.type==="REPLACE"),await El(this,n)},this.startViewTransition=n=>{const r=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,r&&typeof document.startViewTransition=="function"){let s;if(typeof r=="object"&&window.CSS?.supports?.("selector(:active-view-transition-type(a))")){const i=this.latestLocation,a=this.stores.resolvedLocation.get(),o=typeof r.types=="function"?r.types(vn(i,a)):r.types;if(o===!1)return n();s={update:n,types:o}}else s=n;return document.startViewTransition(s).updateCallbackDone}return n()},this.invalidate=n=>{const r=this._committed,s=n?.filter,i=this._preloads,a=new Set([...r,...this._cache.values(),...[...i?.values()??[]].flat(),...this._tx?.[3]??[]].filter(c=>!s||s(c)).map(c=>c.id)),o=[];for(const[c,d]of i??[])d.some(u=>a.has(u.id))&&(i.delete(c),o.push(c));const l=c=>{if(a.has(c.id)){const d=this.routesById[c.routeId],u={...c,invalid:!0,...(n?.forcePending||c.status==="error"||c.status==="notFound")&&js(d)?{status:"pending",error:void 0}:void 0};return c._flight=void 0,u}return c};this._committed=r.map(l);for(const[c,d]of this._cache)a.has(c)&&(d.invalid=!0,n?.forcePending&&(d.status="pending"));for(const c of a)this._flights?.delete(c);for(const c of o)c.abort();return this.shouldViewTransition=!1,this.load({sync:n?.sync})},this.resolveRedirect=n=>{const r=n.headers.get("Location");if(!n.options.href||n.options._builtLocation){const s=(n.options._builtLocation??this.buildLocation(n.options)).publicHref||"/";n.options.href=s,n.headers.set("Location",s)}else if(r)try{const s=new URL(r);if(this.origin&&s.origin===this.origin){const i=s.pathname+s.search+s.hash;n.options.href=i,n.headers.set("Location",i)}}catch{}if(n.options.href&&!n.options._builtLocation&&ln(n.options.href,this.protocolAllowlist))throw new Error("Redirect blocked: unsafe protocol");return n.headers.get("Location")||n.headers.set("Location",n.options.href),n},this.clearCache=n=>{const r=this._cache,s=this._preloads,i=n?.filter,a=[],o=[];for(const[c,d]of r)(!i||i(d))&&(o.push(c),a.push(d));const l=[];for(const[c,d]of s??[])(!i||d.some(i))&&(l.push(c),a.push(...d));for(const c of o)r.delete(c);for(const c of l)s.delete(c);for(const c of a){const d=c._flight;c._flight=void 0,d&&!--d[2]&&(this._flights?.get(c.id)===d&&this._flights.delete(c.id),l.push(d[1]))}for(const c of l)c.abort()},this.loadRouteChunk=Ge,this.preloadRoute=n=>Eo(this,n),this.matchRoute=(n,r)=>{const s={...n,to:n.to?this.resolvePathWithBase(n.from||"",n.to):void 0,params:n.params||{},leaveParams:!0},i=this.buildLocation(s),a=this.stores.status.get()==="pending";if(r?.pending&&!a)return!1;const o=r?.pending??!a?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),l=Bc(i.pathname,r?.caseSensitive??!1,r?.fuzzy??!1,o.pathname,this.processedTree);return!l||n.params&&!we(l.rawParams,n.params,{partial:!0})?!1:r?.includeSearch??!0?we(o.search,i.search,{partial:!0})?l.rawParams:!1:l.rawParams},this.getStoreConfig=t,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??"fuzzy",stringifySearch:e.stringifySearch??al,parseSearch:e.parseSearch??ol,protocolAllowlist:e.protocolAllowlist??Mc}),self.__TSR_ROUTER__=this}isShell(){return!!this.options.isShell}get state(){return this.stores.__store.get()}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;const r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}getRouteBranch(e){let t=this.routeBranchCache.get(e);return t||(t=fo(e),this.routeBranchCache.set(e,t)),t}matchRoutesInternal(e,t){const[n,r,s]=this.getMatchedRoutes(e.pathname);let i=n,a=!1;(s?s.path!=="/"&&r["**"]:ue(e.pathname))&&(this.options.notFoundRoute?i=[...i,this.options.notFoundRoute]:a=!0);const o=a?wl(this.options.notFoundMode,i):void 0,l=new Array(i.length),c=this._committed,d=(h,p)=>{const m=c[p];return m?.routeId===h.id?m:h===this.options.notFoundRoute?c.find(_=>_.routeId===h.id):void 0};let u;for(let h=0;h{const h=u(o.preSearchFilters?o.preSearchFilters.reduce((p,m)=>m(p),d):d);return o.postSearchFilters?o.postSearchFilters.reduce((p,m)=>m(p),h):h};s.push(c)}const l=o.validateSearch;if(l){const c=({search:d,next:u,meta:h})=>{const p=u(d);if(r)try{const m=Xt(l,p);if(h&&m)for(const _ in m)_ in p||(h.defaulted||=new Map).set(_,m[_]);return{...p,...m}}catch{}return p};s.push(c)}}const i=(a,o,l)=>{if(a>=s.length){if(!t.search)return{};if(t.search===!0)return o;const d=tt(t.search,o);return l&&(l.explicit=d),d}const c=(d,u)=>{if(u){const h=l||{};return{search:i(a+1,d,h),meta:h}}return i(a+1,d,l)};return s[a]({search:o,next:c,meta:l})};return i(0,e)}function wl(e,t){if(e!=="root"){let n;for(let r=t.length-1;r>=0;r--){const s=t[r];if(s.options.notFoundComponent)return s.id;n||=s.children&&s.id}if(n)return n}return ze}function qs(e,t){return e===!1||e===null?Object.create(null):(e??!0)===!0?t:Object.assign(t,tt(e,t))}function Ws(e,t){const n=e.options.params?.parse??e.options.parseParams;n&&Object.assign(t,n(t))}function nr(e,t){return e.options[t]?.preload?.()}function Sl(e,t){const n=nr(e,"component"),r=nr(e,"pendingComponent"),s=t&&r?r.then(t):r;return t&&!r&&t(),n&&s?Promise.all([n,s]).then(()=>{}):n??s}function Ge(e,t,n){const r=()=>t===!1?void 0:t?nr(e,t):Sl(e,n),s=e._lazy;if(s)return s===!0?r():s.then(r);if(!e.lazyFn)return r();const i=e.lazyFn().then(a=>{{const{id:o,...l}=a.options;Object.assign(e.options,l),e._lazy=!0}},a=>{throw e._lazy=void 0,a});return e._lazy=i,i.then(r)}function vo(e){const t=e.findIndex(n=>n.status!=="success"||n._notFound)+1;return t&&t{const s=()=>r(t);t.addEventListener("abort",s,{once:!0}),Promise.resolve(e).then(n,r).finally(()=>t.removeEventListener("abort",s))})}function Ne(e,t){return e.routesById[t.routeId]}function wt(e,t,n){return Ar(e)?[X,e]:Me(e)?(e.routeId||=n,[bn,e]):(t&&typeof e?.then=="function"&&(e=new Error("A Promise was thrown",{cause:e})),t?[Pe,e]:[ce,e])}function bo(e,t){let n=wt(t,!0,e.id);if(n[0]!==Pe)return n;try{e.options.onError?.(n[1])}catch(r){n=wt(r,!0,e.id)}return n}function pt(e,t,n){return n[0].signal.aborted||!n[2]()?(n[0].abort(),[$e]):bo(e,t)}function wo(e,t){return n=>e.navigate({...n,_fromLocation:t})}async function Pl(e,t,n,r,s,i){const[a,o]=t,l=n[0].signal,c=!!n[4];for(let d=n[7]??0;d=i&&(u.status="pending"),n[8]?.();try{St(e,u,"beforeLoad",n[0]);const b=await Ce(v(y),l);if(!n[2]())return n[0].abort(),[d,[$e]];const R=wt(b,!1,h.id);if(R[0]!==ce)return he(e,u),[d,R];u.context={..._,...b}}catch(b){return he(e,u),[d,pt(h,b,n)]}finally{S==="success"&&u.status==="pending"&&(u.status="success"),St(e,u,!1,n[0])}}s()}function Ur(e,t,n){if(!(!n||--n[2])){if(e._flights?.get(t.id)===n){const r=e._tx;if(r&&!r[0].signal.aborted&&!r[3].includes(t)&&r[3].some(s=>s.id===t.id)&&r[3].some(s=>s.isFetching==="beforeLoad"))return;e._flights.delete(t.id)}return n[1]}}function he(e,t){const n=t._flight;t._flight=void 0,Ur(e,t,n)?.abort()}function K(e,t,n,r){const s=[];for(const i of t)if(!n?.includes(i)){const a=i._flight;if(i._flight=void 0,r&&a?.[2]===1&&e._flights?.get(i.id)===a&&n?.some(o=>o.id===i.id))a[2]=0;else{const o=Ur(e,i,a);o&&s.push(o)}}for(const i of s)i.abort()}function Br(e){for(const t of e){const n=t._flight;n&&n[2]++}}function St(e,t,n,r){if(t.isFetching=n,r&&e._tx?.[0]!==r)return;const s=e.stores.byRoute.get(t.routeId),i=s?.get();i?.id===t.id&&s.set({...i,isFetching:n})}function So(e,t,n,r,s,i,a){const o=t[0];return{params:n.params,location:o,navigate:wo(e,o),cause:a?"preload":n.cause,abortController:s,preload:a,deps:n.loaderDeps,parentMatchPromise:i,context:n.context,route:r,...e.options.additionalContext}}async function Vs(e,t,n,r,s,i,a,o){const l=o.signal;if(l.aborted)return[$e];if(!s)return[ce,void 0];let c=n._flight;St(e,n,"loader",o);try{if(!c){const d=new AbortController;c=[Promise.resolve().then(()=>s(So(e,t,n,r,d,i,a))).then(u=>wt(u,!1,r.id),u=>wt(u,!0,r.id)).then(u=>(u[0]!==ce&&e._flights?.get(n.id)===c&&(e._flights.delete(n.id),c[2]||d.abort()),u[0]===Pe&&c[2]?bo(r,u[1]):u)),d,1],(e._flights??=new Map).set(n.id,c)}return n._flight=c,n.abortController=c[1],await Ce(c[0],l)}catch(d){if(d!==l)throw d;return he(e,n),[$e]}finally{St(e,n,!1,o)}}function Qs(e,t,n){t[0]===ce?(e.loaderData=t[1],e.error=void 0,e.status="success",e.invalid=!1,e.updatedAt=Date.now(),e.preload=n):t[0]!==X&&(e.status="success",e.error=void 0,e.invalid=!0)}function Cl(e,t,n){const r=e._cache.get(t.id);if(r!==n||e._committed.some(i=>i.id===t.id&&i._flight===t._flight))return;const s={...t,_notFound:void 0,context:{}};s._flight&&s._flight[2]++,e._cache.set(t.id,s),r&&he(e,r)}function Ks(e,t){return t[0]===Pe||t[0]===bn?{...e,status:t[0]===Pe?"error":"notFound",error:t[1],_flight:void 0}:e}function Rl(e,t,n,r,s,i,a){const o=t[1][n],l=Ne(e,o),c=!!i[4],d=c?e._cache.get(o.id):void 0;let u,h=!1,p;try{if(o.status==="success"&&(u=l.options.shouldReload,typeof u=="function"&&(u=u(So(e,t,o,l,i[0],s,c))),i[2]()||(i[0].abort(),p=[$e])),!p)if(o.status!=="success")h=!0;else{const k=i[4]||o.preload?l.options.preloadStaleTime??e.options.defaultPreloadStaleTime??3e4:l.options.staleTime??e.options.defaultStaleTime??0;h=!!(o.invalid||u||u===void 0&&Date.now()-o.updatedAt>=k&&(i[6]||o.cause==="enter"||i[3].some(T=>T.routeId===o.routeId&&T.id!==o.id)))}}catch(k){o.invalid=!0,he(e,o),p=pt(l,k,i)}const m=l.options.loader,_=typeof m=="function"?m:m?.handler;let g=(!c||l.options.preload!==!1)&&m?e._flights?.get(o.id):void 0;g===o._flight||p?g=void 0:g&&!h&&!c&&u===void 0?h=!0:h||(g=void 0);const v=!!(m&&h&&o.status==="success"&&!c&&!i[5]&&((typeof m=="function"?void 0:m?.staleReloadMode)??e.options.defaultStaleReloadMode)!=="blocking"),y=h&&(!c||l.options.preload!==!1),S=y&&!v&&(o.status!=="success"||!!m),b=l.lazyFn&&l._lazy!==!0?i[8]:void 0;if(y&&!m&&(o.invalid=!1,o.updatedAt=Date.now()),g&&g[2]++,S){const k=o._flight;o._flight=g,Ur(e,o,k)?.abort(),o.status==="success"&&n>=a&&(o.status="pending"),i[8]?.()}y||(o.isFetching=!1);const R=(p?Promise.resolve(p):S?Vs(e,t,o,l,_,s,c,i[0]):Promise.resolve([ce,o.loaderData])).then(k=>(S&&(Qs(o,k,c),k[0]===ce&&(c&&m&&!i[0].signal.aborted&&Cl(e,o,d),o.status="pending")),k)),P=Ce(Promise.resolve().then(()=>Ge(l,void 0,b)),i[0].signal).then(()=>{},k=>[n,pt(l,k,i)]).then(k=>R.then(T=>(S&&!k&&T[0]===ce&&o.status==="pending"&&i[2]()&&(o.status="success",i[8]?.()),k)));if(r.push([n,R,P]),!v)return R.then(k=>Ks(o,k));const w={...o,status:"pending",preload:!1,_flight:g};o.invalid=!1,o.isFetching="loader";const C=Vs(e,t,w,l,_,s,!1,i[0]).then(k=>(o.isFetching=!1,Qs(w,k,!1),k));return(t[2]??=[]).push([n,C,P,w]),C.then(k=>Ks(w,k))}async function rr(e,t,n,r,s=0){const i=n?.[1][1];let a=i?.routeId?t.findIndex(o=>o.routeId===i.routeId):n?.[0]??t.length-1;a<0&&(a=0);for(let o=a;o>=0;o--){const l=Ne(e,t[o]),c=Ge(l,!1);if(c)try{await Ce(c,r)}catch(d){if(d===r)throw d}if(l.options.notFoundComponent)return o}return i?.routeId?a:s}function Je(e,t){t[2]&&(K(e,t[2].map(n=>n[3])),t[2]=void 0)}async function zs(e,t,n,r){let s;try{await Promise.all(e.map(i=>i[1].then(async a=>{const o=i[0];if(!(r&&o>=await r)){if(a[0]>=X)throw[o,a];!s&&a[0]!==ce&&(s=[o,a],await Promise.all((n??[]).map(l=>{if(!(l[0]<=o))return l[1].then(c=>{if(c[0]===X)throw[l[0],c]})})))}})))}catch(i){return i}return t??s}async function Po(e,t,n,r,s,i,a){const o=t[1];let l=await i,c=!1;const d=o.findIndex(m=>m._notFound),u=m=>m[1][0]===bn?rr(e,o,m,r.signal):m[0];let h=d<0?o.length:d;if((l?.[1][0]??0)>=X)h=0;else if(l){h=l[2]??=await u(l);for(const m of n){if(m[0]>=h)break;const _=await m[1];if(_[0]!==ce&&_[0]=h)break;const _=await m[2];if(_){l=_;break}}if((l?.[1][0]??0)>=X){const m=l[1];if(m[0]!==X||m[1].options.reloadDocument||s<20)return Je(e,t),m;c=!0,l=[0,[Pe,new Error("Too many redirects")]]}const p=l?l[2]??await u(l):d;if(p>=0){const m=l?.[1],_=m?.[0],g=o[p],v=m?.[1],y=()=>{m&&(g._notFound=void 0,_===Pe?g.status="error":(v.routeId=g.routeId,g.routeId===e.routeTree.id?(g.status="success",g._notFound=!0):g.status="notFound"),g.error=v,g.isFetching=!1)};y();const S=Ne(e,g);try{await Ce(m?Promise.resolve().then(()=>Ge(S,_===Pe?"errorComponent":"notFoundComponent")):Promise.all([Ge(S),Ge(S,"notFoundComponent")]),r.signal)}catch(b){if(b===r.signal)return Je(e,t),[$e]}m?c&&(r.abort(),await Promise.all([...n.map(b=>b[1]),...n.map(b=>b[2]),...(t[2]??[]).map(b=>b[1])]),Je(e,t),K(e,o),y()):(g.status="success",a?.())}return t}async function Co(e,t,n,r=0,s=t[1].length){const i=t[1];for(let a=r;a_._notFound);if(e.options.notFoundMode!=="root"&&a>=0){const _=await rr(e,s[1],void 0,r[0].signal,a);_!==a&&(n[a]._notFound=void 0,n[_]._notFound=!0),a=_}let o=a<0?n.length:a+1,l=0;for(;l{for(let _=d;_=X&&(o=0),h()),r[2]()&&!r[4]){const _=[];for(const[g,v]of e._flights??[])v[2]||(e._flights.delete(g),_.push(v[1]));for(const g of _)g.abort()}let m;try{const _=Po(e,s,c,r[0],r[1],zs(c,p,s[2]),r[8]);s[2]?.length&&(s[3]=zs(s[2],void 0,void 0,_.then(g=>bt(g)?0:vo(g[1]).length,()=>0))),m=await _}catch(_){throw Je(e,s),_}return bt(m)?m:Co(e,m,r[0].signal,r[7]===m[1].length?r[7]:0)}function sr(e,t){if(e._tx!==t)return;let n=e._pending,r=!1;const s=n?.[0][3][n[1]]?.id;n?.[0]!==t&&(n&&t[3][n[1]]?.id===s?(n[0]=t,r=!0):(clearTimeout(n?.[3]),e._pending=n=void 0));const i=t[3],a=e.stores.matches.get();let o=-1,l,c,d,u=!1;for(let _=0;_0){n[3]=setTimeout(()=>sr(e,t),_);return}n[2]=0}const p=i.map(_=>({..._,_flight:void 0}));p[o].status="pending";const m=e.startTransition(()=>e.stores.setMatches(p),p).then(_=>(_&&e._pending===n&&n[4]===m&&!n[2]&&(n[2]=Date.now()+c),_));n[4]=m}function Zt(e,t){const n=e._pending;n?.[0]===t&&(clearTimeout(n[3]),e._pending=void 0)}function ko(e,t){e._committed=t,e.stores.setMatches(t)}function Gs(e,t){K(e,t[1]),Je(e,t)}function kl(e,t,n,r){const s=e._committed,i=e._cache;for(const c of n)c.preload=!1,r&&(c._assetEnd=void 0);const a=vo(n).length,o=new Map,l=Date.now();for(const c of[...s,...i.values()]){if(c.status!=="success"||n.some((u,h)=>u.id===c.id&&(h=(c.preload?d.options.preloadGcTime??e.options.defaultPreloadGcTime??3e5:d.options.gcTime??e.options.defaultGcTime??3e5)||o.set(c.id,i.get(c.id)===c?c:{...c,_flight:void 0,isFetching:!1,context:{}})}t[3]=[],e._cache=o,ko(e,n),K(e,[...i.values(),...s],[...n,...o.values()]),gl(e,s,n,()=>e._tx===t)}async function xe(e,t){let n=e._tx;for(;n&&n!==t;){if(await n[5],e._tx===n)return;n=e._tx}}async function xo(e,t,n){await e.navigate({...n.options,replace:!0,ignoreBlocker:!0,_redirects:t[1]+1})}function To(e,t){Zt(e,t),t[0].abort(),K(e,t[3]),t[3]=[],e._tx===t&&(e.batch(()=>{e.stores.status.set("idle"),e.stores.setMatches(e._committed)}),e._tx===t&&(e._commitPromise?.resolve(),e._commitPromise=void 0))}async function xl(e,t,n,r,s){const i=n.map(c=>({...c}));Br(i);for(const c of r)he(e,i[c[0]]),i[c[0]]=c[3];const a=[t[2],i];let o;try{o=await Po(e,a,r,t[0],t[1],s)}catch(c){throw K(e,i),c}if(bt(o)){K(e,i),o[0]===X&&e._tx===t&&e._committed===n&&await xo(e,t,o[1]);return}const l=await Co(e,o,t[0].signal);if(e._tx!==t||e._committed!==n){K(e,l[1]);return}for(const c of l[1]){const d=e._cache.get(c.id);d?._flight&&d._flight===c._flight&&(e._cache.delete(c.id),he(e,d))}ko(e,l[1]),K(e,n,l[1])}async function Tl(e,t,n,r,s,i){const a=[t[0],t[1],()=>e._tx===t&&!!t[3].length,e._committed,void 0,s,n,i,r],o=await Ro(e,t[2],t[3],a);if(bt(o)){o[0]===X&&e._tx===t?(Zt(e,t),K(e,t[3]),t[3]=[],e._tx===t&&await xo(e,t,o[1])):To(e,t);return}const l=e._pending;if(l?.[0]===t&&(clearTimeout(l[3]),l[4])){const h=t[0].signal;let p=!1;try{p=await Ce(l[4],h)}catch(m){if(m!==h)throw m}if(p&&e._pending===l&&l[0]===t){const m=l[2]-Date.now();if(m>0){try{await Ce(new Promise(_=>{l[3]=setTimeout(_,m)}),h)}catch{}clearTimeout(l[3])}}}if(e._tx!==t){Zt(e,t),Gs(e,o);return}const c=t[2],d=vn(c,e.stores.resolvedLocation.get()),u=o[2];await e.startViewTransition(async()=>{if(e._tx!==t){Gs(e,o);return}const h=()=>{Zt(e,t),kl(e,t,o[1],i),e._tx===t&&(e.emit({type:"onLoad",...d}),e._tx===t&&e.emit({type:"onBeforeRouteMount",...d}))},p=await e.startTransition(h,o[1]);if(e._tx!==t){Je(e,o);return}u?.length&&xl(e,t,o[1],u,o[3]).catch(console.error),e.batch(()=>{e.stores.resolvedLocation.set(c),e.stores.status.set("idle"),e._tx===t&&e.emit({type:"onResolved",...d}),p&&e._tx===t&&e.emit({type:"onRendered",...d})}),e._tx===t&&(e._commitPromise?.resolve(),e._commitPromise=void 0)})}async function El(e,t){const n=e._tx,r=e.stores.resolvedLocation.get(),s=r??e.stores.location.get(),i=e.latestLocation,a=e._pendingLocation,o=a?.href===i.href?a._redirects??0:0,l=e._handoff,c=l?.[0](),d=new AbortController,u=e._preflight;if(e._preflight=d,c||l?.[1](),u?.abort(),d.signal.aborted){await xe(e,n);return}const h=vn(i,r);if(e.emit({type:"onBeforeNavigate",...h}),d.signal.aborted||e.emit({type:"onBeforeLoad",...h}),d.signal.aborted){await xe(e,n);return}const p=s.href===i.href;let m,_=d;try{m=e.matchRoutes(i,{_controller:d}),Br(m)}catch(y){if(d.abort(),!Ar(y)){await xe(e),e._commitPromise?.resolve(),e._commitPromise=void 0;return}await e.navigate({...y.options,replace:!0,ignoreBlocker:!0}),await xe(e,n);return}const g=c?l[1](m):void 0;if(g?_=c:c?.abort(),d.signal.aborted){K(e,m),await xe(e,n);return}e._preflight=void 0;const v=[_,o,i,m,Date.now(),Promise.resolve().then(()=>Tl(e,v,p,()=>sr(e,v),t?.sync,g)).catch(()=>{e._tx===v&&To(e,v)})];if(e._tx=v,n){for(const y of e.stores.matches.get()){if(e._tx!==v)break;y.isFetching&&St(e,y,!1)}n[0].abort(),K(e,n[3],v[3],!0)}if(e._tx!==v){K(e,v[3]),v[3]=[],await xe(e,v);return}e.batch(()=>{e.stores.status.set("pending"),e.stores.location.set(i)}),!r&&!m.some(y=>y._notFound)&&sr(e,v);try{await v[5]}finally{await xe(e,v)}}async function Eo(e,t,n=0){if(n>20)return;const r=t._builtLocation??e.buildLocation(t),s=e._committed,i=new AbortController;let a;try{a=e.matchRoutes(r,{_controller:i}),Br(a)}catch(l){i.abort(),Me(l)||console.error(l);return}(e._preloads??=new Map).set(i,a);let o;try{let l;try{l=await Ro(e,r,a,[i,n,()=>!0,s,!0])}finally{o=e._preloads.delete(i),K(e,a),i.abort()}if(!bt(l))return l[1];if(o&&l[0]===X&&!l[1].options.reloadDocument)return Eo(e,{...l[1].options,_fromLocation:r},n+1)}catch(l){Me(l)||console.error(l)}}const Ol="Error preloading route! ☝️";var Oo=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=t=>{this.originalIndex=t.originalIndex;const n=this.options,r=!n?.path&&!n?.id;this.parentRoute=this.options.getParentRoute?.(),r?this._path=ze:this.parentRoute||$r();let s=r?ze:n?.path;s&&s!=="/"&&(s=po(s));const i=n?.id||s;let a=r?ze:Jt([this.parentRoute.id==="__root__"?"":this.parentRoute.id,i]);s==="__root__"&&(s="/"),a!=="__root__"&&(a=Jt(["/",a]));const o=a==="__root__"?"/":Jt([this.parentRoute.fullPath,s]);this._path=s,this._id=a,this._fullPath=o,this._to=ue(o)},this.addChildren=t=>this._addFileChildren(t),this._addFileChildren=t=>(Array.isArray(t)&&(this.children=t),typeof t=="object"&&t!==null&&(this.children=Object.values(t)),this),this._addFileTypes=()=>this,this.updateLoader=t=>(Object.assign(this.options,t),this),this.update=t=>(Object.assign(this.options,t),this),this.lazy=t=>(this.lazyFn=t,this),this.redirect=t=>ul({from:this.fullPath,...t}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw new Error("Route cannot have both an 'id' and a 'path' option.")}},Il=class extends Oo{constructor(e){super(e)}};function jr(e){return f(Ll,{...e})}var Ll=class extends Z{constructor(...e){super(...e),this.state={error:null},this.reset=()=>{this.setState({error:null})}}static getDerivedStateFromProps(e,t){const n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:null}:{resetKey:n}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.props.onCatch?.(e,t)}render(){const e=this.state.error;return e?z(this.props.errorComponent??Ml,{error:e,reset:this.reset}):this.props.children}};function Ml({error:e}){const[t,n]=A(!1);return f("div",{style:{padding:".5rem",maxWidth:"100%"},children:[f("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[f("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),f("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>n(r=>!r),children:t?"Hide Error":"Show Error"})]}),f("div",{style:{height:".25rem"}}),t?f("div",{children:f("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:e.message?f("code",{children:e.message}):null})}):null]})}function $l({children:e,fallback:t=null}){return f(It.Fragment,{children:Io()?e:t})}function Io(){return It.useSyncExternalStore(Fl,()=>!0,()=>!1)}function Fl(){return()=>{}}var Lo=ne(null);function re(e){return ee(Lo)}var wn=ne(void 0),Dl=ne(void 0),F=(e=>(e[e.None=0]="None",e[e.Mutable=1]="Mutable",e[e.Watching=2]="Watching",e[e.RecursedCheck=4]="RecursedCheck",e[e.Recursed=8]="Recursed",e[e.Dirty=16]="Dirty",e[e.Pending=32]="Pending",e))(F||{});function Al({update:e,notify:t,unwatched:n}){return{link:r,unlink:s,propagate:i,checkDirty:a,shallowPropagate:o};function r(c,d,u){const h=d.depsTail;if(h!==void 0&&h.dep===c)return;const p=h!==void 0?h.nextDep:d.deps;if(p!==void 0&&p.dep===c){p.version=u,d.depsTail=p;return}const m=c.subsTail;if(m!==void 0&&m.version===u&&m.sub===d)return;const _=d.depsTail=c.subsTail={version:u,dep:c,sub:d,prevDep:h,nextDep:p,prevSub:m,nextSub:void 0};p!==void 0&&(p.prevDep=_),h!==void 0?h.nextDep=_:d.deps=_,m!==void 0?m.nextSub=_:c.subs=_}function s(c,d=c.sub){const u=c.dep,h=c.prevDep,p=c.nextDep,m=c.nextSub,_=c.prevSub;return p!==void 0?p.prevDep=h:d.depsTail=h,h!==void 0?h.nextDep=p:d.deps=p,m!==void 0?m.prevSub=_:u.subsTail=_,_!==void 0?_.nextSub=m:(u.subs=m)===void 0&&n(u),p}function i(c){let d=c.nextSub,u;e:do{const h=c.sub;let p=h.flags;if(p&60?p&12?p&4?!(p&48)&&l(c,h)?(h.flags=p|40,p&=1):p=0:h.flags=p&-9|32:p=0:h.flags=p|32,p&2&&t(h),p&1){const m=h.subs;if(m!==void 0){const _=(c=m).nextSub;_!==void 0&&(u={value:d,prev:u},d=_);continue}}if((c=d)!==void 0){d=c.nextSub;continue}for(;u!==void 0;)if(c=u.value,u=u.prev,c!==void 0){d=c.nextSub;continue e}break}while(!0)}function a(c,d){let u,h=0,p=!1;e:do{const m=c.dep,_=m.flags;if(d.flags&16)p=!0;else if((_&17)===17){if(e(m)){const g=m.subs;g.nextSub!==void 0&&o(g),p=!0}}else if((_&33)===33){(c.nextSub!==void 0||c.prevSub!==void 0)&&(u={value:c,prev:u}),c=m.deps,d=m,++h;continue}if(!p){const g=c.nextDep;if(g!==void 0){c=g;continue}}for(;h--;){const g=d.subs,v=g.nextSub!==void 0;if(v?(c=u.value,u=u.prev):c=g,p){if(e(d)){v&&o(g),d=c.sub;continue}p=!1}else d.flags&=-33;d=c.sub;const y=c.nextDep;if(y!==void 0){c=y;continue e}}return p}while(!0)}function o(c){do{const d=c.sub,u=d.flags;(u&48)===32&&(d.flags=u|16,(u&6)===2&&t(d))}while((c=c.nextSub)!==void 0)}function l(c,d){let u=d.depsTail;for(;u!==void 0;){if(u===c)return!0;u=u.prevDep}return!1}}function Nl(e,t,n){const r=typeof e=="object",s=r?e:void 0;return{next:(r?e.next:e)?.bind(s),error:(r?e.error:t)?.bind(s),complete:(r?e.complete:n)?.bind(s)}}const ir=[];let en=0;const{link:Js,unlink:Ul,propagate:Bl,checkDirty:Mo,shallowPropagate:Ys}=Al({update(e){return e._update()},notify(e){ir[or++]=e,e.flags&=~F.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=F.Mutable|F.Dirty,fn(e))}});let Wt=0,or=0,oe,ar=0;function jl(e){try{++ar,e()}finally{--ar||$o()}}function fn(e){const t=e.depsTail;let n=t!==void 0?t.nextDep:e.deps;for(;n!==void 0;)n=Ul(n,e)}function $o(){if(!(ar>0)){for(;Wt{s.get(),o.current?a.next?.(s._snapshot):o.current=!0});return{unsubscribe:()=>{l.stop()}}},_update(i){const a=oe,o=t?.compare??Object.is;if(n)oe=s,++en,s.depsTail=void 0;else if(i===void 0)return!1;n&&(s.flags=F.Mutable|F.RecursedCheck);try{const l=s._snapshot,c=typeof i=="function"?i(l):i===void 0&&n?r(l):i;return l===void 0||!o(l,c)?(s._snapshot=c,!0):!1}finally{oe=a,n&&(s.flags&=~F.RecursedCheck),fn(s)}}};return n?(s.flags=F.Mutable|F.Dirty,s.get=function(){const i=s.flags;if(i&F.Dirty||i&F.Pending&&Mo(s.deps,s)){if(s._update()){const a=s.subs;a!==void 0&&Ys(a)}}else i&F.Pending&&(s.flags=i&~F.Pending);return oe!==void 0&&Js(s,oe,en),s._snapshot}):s.set=function(i){if(s._update(i)){const a=s.subs;a!==void 0&&(Bl(a),Ys(a),$o())}},s}function Hl(e){const t=()=>{const r=oe;oe=n,++en,n.depsTail=void 0,n.flags=F.Watching|F.RecursedCheck;try{return e()}finally{oe=r,n.flags&=~F.RecursedCheck,fn(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:F.Watching|F.RecursedCheck,notify(){const r=this.flags;r&F.Dirty||r&F.Pending&&Mo(this.deps,this)?t():this.flags=F.Watching},stop(){this.flags=F.None,this.depsTail=void 0,fn(this)}};return t(),n}function ql(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function r(){var s=!1;try{s=this instanceof r}catch{}return s?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:function(){return e[r]}})}),n}var Mn={exports:{}},$n={};const Fo=ql(dc);var Fn={exports:{}},Dn={};var Zs;function Wl(){if(Zs)return Dn;Zs=1;var e=Fo;function t(u,h){return u===h&&(u!==0||1/u===1/h)||u!==u&&h!==h}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,s=e.useEffect,i=e.useLayoutEffect,a=e.useDebugValue;function o(u,h){var p=h(),m=r({inst:{value:p,getSnapshot:h}}),_=m[0].inst,g=m[1];return i(function(){_.value=p,_.getSnapshot=h,l(_)&&g({inst:_})},[u,p,h]),s(function(){return l(_)&&g({inst:_}),u(function(){l(_)&&g({inst:_})})},[u]),a(p),p}function l(u){var h=u.getSnapshot;u=u.value;try{var p=h();return!n(u,p)}catch{return!0}}function c(u,h){return h()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:o;return Dn.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:d,Dn}var ei;function Vl(){return ei||(ei=1,Fn.exports=Wl()),Fn.exports}var ti;function Ql(){if(ti)return $n;ti=1;var e=Fo,t=Vl();function n(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}var r=typeof Object.is=="function"?Object.is:n,s=t.useSyncExternalStore,i=e.useRef,a=e.useEffect,o=e.useMemo,l=e.useDebugValue;return $n.useSyncExternalStoreWithSelector=function(c,d,u,h,p){var m=i(null);if(m.current===null){var _={hasValue:!1,value:null};m.current=_}else _=m.current;m=o(function(){function v(P){if(!y){if(y=!0,S=P,P=h(P),p!==void 0&&_.hasValue){var w=_.value;if(p(w,P))return b=w}return b=P}if(w=b,r(S,P))return w;var C=h(P);return p!==void 0&&p(w,C)?(S=P,w):(S=P,b=C)}var y=!1,S,b,R=u===void 0?null:u;return[function(){return v(d())},R===null?void 0:function(){return v(R())}]},[d,u,h,p]);var g=s(c,m[0],m[1]);return a(function(){_.hasValue=!0,_.value=g},[g]),l(g),g},$n}var ni;function Kl(){return ni||(ni=1,Mn.exports=Ql()),Mn.exports}var zl=Kl();function Gl(e,t){return e===t}function pe(e,t,n=Gl){const r=j(a=>{if(!e)return()=>{};const{unsubscribe:o}=e.subscribe(a);return o},[e]),s=j(()=>e?.get(),[e]);return zl.useSyncExternalStoreWithSelector(r,s,s,t,n)}var ri={};function Do(e,t){const n=H();return r=>{const s=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=Ie(n.current,s):s}}function Ue(e){const t=re(),n=ee(e.from?Dl:wn),r=e.from??n,s=t.stores.getMatchStore(r),i=Do(e,t),a=pe(s,o=>o?i(o):ri);if(a!==ri)return a;(e.shouldThrow??!0)&&$r()}function Ao(e){return Ue({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function No(e){const{select:t,...n}=e;return Ue({...n,select:r=>t?t(r.loaderDeps):r.loaderDeps})}function Uo(e){return Ue({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{const n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function Bo(e){return Ue({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Lt(e){const t=re();return j(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function jo(e){return Ue({...e,select:t=>e.select?e.select(t.context):t.context})}function An(e){const t=H(e);return we(t.current,e,{ignoreUndefined:!1})||(t.current=e),t.current}function Jl(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function Yl(e,t,n){if(e?.external)return ln(e.href,n)?void 0:e.href;if(!ou(t)&&!(typeof t!="string"||t.indexOf(":")===-1))try{return new URL(t),ln(t,n)?void 0:t}catch{}}function Xl(e,t,n,r,s,i){if(i)return!1;if(n?.exact){if(!Kc(e.pathname,t.pathname,r))return!1}else{const a=hn(e.pathname,r),o=hn(t.pathname,r);if(!(a.startsWith(o)&&(a.length===o.length||a[o.length]==="/")))return!1}return(n?.includeSearch??!0)&&!we(e.search,t.search,{partial:!n?.exact,ignoreUndefined:!n?.explicitUndefined})?!1:n?.includeHash?s&&e.hash===t.hash:!0}function Zl(e,t){const n=re(),r=xc(t),{activeProps:s,inactiveProps:i,activeOptions:a,to:o,preload:l,preloadDelay:c,preloadIntentProximity:d,hashScrollIntoView:u,replace:h,startTransition:p,resetScroll:m,viewTransition:_,children:g,target:v,disabled:y,style:S,className:b,onClick:R,onBlur:P,onFocus:w,onMouseEnter:C,onMouseLeave:k,onTouchStart:T,ignoreBlocker:x,params:O,search:$,hash:ot,state:se,mask:Ft,reloadDocument:Ih,unsafeRelative:Lh,from:Mh,_fromLocation:$h,...Vr}=e,Cn=Io(),ha=An(e.search),da=An(e.params),Qr=An(a),at=q(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,ha,da,e.state,e.mask,e.unsafeRelative]),fa=j(N=>{const B=n.buildLocation({_fromLocation:N,...at}),ie=iu(B.maskedLocation?B.maskedLocation.publicHref:B.publicHref,B.maskedLocation?B.maskedLocation.external:B.external,n.history,y),Nt=Yl(ie,o,n.protocolAllowlist);return[ie?.href,Nt,Xl(N,B,Qr,n.basepath,Cn,Nt!==void 0)]},[Qr,y,Cn,at,n,o]),[pa,Rn,kn]=pe(n.stores.location,fa,Jl),Dt=kn?tt(s,{})??eu:Nn,At=kn?Nn:tt(i,{})??Nn,Kr=[b,Dt.className,At.className].filter(Boolean).join(" "),zr=(S||Dt.style||At.style)&&{...S,...Dt.style,...At.style},[_a,Gr]=A(!1),Jr=H(!1),Be=e.reloadDocument||Rn?!1:l??n.options.defaultPreload,xn=c??n.options.defaultPreloadDelay??0,Re=j(()=>{n.preloadRoute(at).catch(N=>{console.warn(N),console.warn(Ol)})},[n,at]);kc(r,j(N=>{N?.isIntersecting&&Re()},[Re]),su,!!y||Be!=="viewport"),W(()=>{Jr.current||!y&&Be==="render"&&(Re(),Jr.current=!0)},[y,Re,Be]);const ma=N=>{const B=N.currentTarget.getAttribute("target"),ie=v!==void 0?v:B;if(!y&&!au(N)&&!N.defaultPrevented&&(!ie||ie==="_self")&&N.button===0){N.preventDefault(),Mr(()=>{Gr(!0)});const Nt=n.subscribe("onResolved",()=>{Nt(),Gr(!1)});n.navigate({...at,replace:h,resetScroll:m,hashScrollIntoView:u,startTransition:p,viewTransition:_,ignoreBlocker:x})}};if(Rn)return{...Vr,ref:r,href:Rn,...g&&{children:g},...v&&{target:v},...y&&{disabled:y},...S&&{style:S},...b&&{className:b},...R&&{onClick:R},...P&&{onBlur:P},...w&&{onFocus:w},...C&&{onMouseEnter:C},...k&&{onMouseLeave:k},...T&&{onTouchStart:T}};const Yr=N=>{if(y||Be!=="intent")return;if(!xn){Re();return}const B=N.currentTarget;if(lt.has(B))return;const ie=setTimeout(()=>{lt.delete(B),Re()},xn);lt.set(B,ie)},ga=N=>{y||Be!=="intent"||Re()},Xr=N=>{if(y||!Be||!xn)return;const B=N.currentTarget,ie=lt.get(B);ie&&(clearTimeout(ie),lt.delete(B))};return{...Vr,...Dt,...At,href:pa,ref:r,onClick:je([R,ma]),onBlur:je([P,Xr]),onFocus:je([w,Yr]),onMouseEnter:je([C,Yr]),onMouseLeave:je([k,Xr]),onTouchStart:je([T,ga]),disabled:!!y,target:v,...zr&&{style:zr},...Kr&&{className:Kr},...y&&tu,...kn&&nu,...Cn&&_a&&ru}}var Nn={},eu={className:"active"},tu={role:"link","aria-disabled":!0},nu={"data-status":"active","aria-current":"page"},ru={"data-transitioning":"transitioning"},lt=new WeakMap,su={rootMargin:"100px"},je=e=>t=>{for(const n of e)if(n){if(t.defaultPrevented)return;n(t)}};function iu(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||"/",external:!1}}function ou(e){if(typeof e!="string")return!1;const t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var te=Ir((e,t)=>{const{_asChild:n,...r}=e,{type:s,...i}=Zl(r,t),a=typeof r.children=="function"?r.children({isActive:i["data-status"]==="active"}):r.children;if(!n){const{disabled:o,...l}=i;return z("a",l,a)}return z(n,i,a)});function au(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var cu=class extends Oo{constructor(e){super(e),this.useMatch=t=>Ue({select:t?.select,from:this.id,structuralSharing:t?.structuralSharing}),this.useRouteContext=t=>jo({...t,from:this.id}),this.useSearch=t=>Bo({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useParams=t=>Uo({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useLoaderDeps=t=>No({...t,from:this.id}),this.useLoaderData=t=>Ao({...t,from:this.id}),this.useNavigate=()=>Lt({from:this.fullPath}),this.Link=It.forwardRef((t,n)=>f(te,{ref:n,from:this.fullPath,...t}))}};function Mt(e){return new cu(e)}var lu=class extends Il{constructor(e){super(e),this.useMatch=t=>Ue({select:t?.select,from:this.id,structuralSharing:t?.structuralSharing}),this.useRouteContext=t=>jo({...t,from:this.id}),this.useSearch=t=>Bo({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useParams=t=>Uo({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useLoaderDeps=t=>No({...t,from:this.id}),this.useLoaderData=t=>Ao({...t,from:this.id}),this.useNavigate=()=>Lt({from:this.fullPath}),this.Link=It.forwardRef((t,n)=>f(te,{ref:n,from:this.fullPath,...t}))}};function uu(e){return new lu(e)}function hu(e){const t=re(),n=`not-found-${pe(t.stores.location,r=>r.pathname)}-${pe(t.stores.status,r=>r)}`;return f(jr,{getResetKey:()=>n,onCatch:(r,s)=>{if(Me(r))e.onCatch?.(r,s);else throw r},errorComponent:({error:r})=>{if(Me(r))return e.fallback?.(r);throw r},children:e.children})}function du(){return f("p",{children:"Not Found"})}function We(e){return f(M,{children:e.children})}function Ho(e,t,n){return t.options.notFoundComponent?f(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?f(e.options.defaultNotFoundComponent,{...n}):f(du,{})}function Sn(e,t){const n=t?.options.pendingComponent??e.options.defaultPendingComponent;return n?f(n,{}):null}var fu=(e,t)=>e[0]===t[0]&&e[1]===t[1],qo=Et(function({routeId:t}){const n=re();return f(pu,{router:n,match:pe(n.stores.getMatchStore(t),r=>r)})});function pu({router:e,match:t}){const n=e.routesById[t.routeId],r=Sn(e,n),s=n.options.errorComponent??e.options.defaultErrorComponent,i=n.options.onCatch??e.options.defaultOnCatch,a=n.isRoot?n.options.notFoundComponent??e.options.notFoundRoute?.options.component:n.options.notFoundComponent,o=t.ssr===!1||t.ssr==="data-only",l=n.options.wrapInSuspense??r??(n.options.errorComponent?.preload||o)?be:We,c=s?jr:We,d=a?hu:We;return f(n.isRoot?n.options.shellComponent??We:We,{children:[f(wn.Provider,{value:t.routeId,children:f(l,{fallback:r,children:f(c,{getResetKey:()=>t,errorComponent:s,onCatch:(u,h)=>{if(Me(u))throw u.routeId??=t.routeId,u;i?.(u,h)},children:f(d,{fallback:u=>{if(u.routeId??=t.routeId,u.routeId!==t.routeId)throw u;return z(a,u)},children:o?f($l,{fallback:r,children:f(si,{match:t})}):f(si,{match:t})})})})}),null]})}var si=Et(function({match:t}){const n=re(),r=t.routeId,s=n.routesById[r],i=q(()=>{const o=(s.options.remountDeps??n.options.defaultRemountDeps)?.({routeId:r,loaderDeps:t.loaderDeps,params:t._strictParams,search:t._strictSearch});return o?JSON.stringify(o):void 0},[r,t.loaderDeps,t._strictParams,t._strictSearch,s.options.remountDeps,n.options.defaultRemountDeps]),a=q(()=>{const o=s.options.component??n.options.defaultComponent;return o?f(o,{},i):f(Wo,{})},[i,s.options.component,n.options.defaultComponent]);if(t.status==="pending"){if(n._tx)throw n._tx[5];return Sn(n,s)}if(t.status==="notFound")return Ho(n,s,t.error);if(t.status==="error")throw t.error;return a}),Wo=Et(function(){const t=re(),n=ee(wn);let r,s,i;{const o=t.stores.getMatchStore(n);[r,s]=pe(o,l=>[!!l._notFound,l.error],fu),i=pe(t.stores.ids,l=>l[l.indexOf(n)+1])}if(r)return Ho(t,t.routesById[n],s);if(!i)return null;const a=f(qo,{routeId:i});return n===ze?f(be,{fallback:Sn(t),children:a}):a});function Vo(e,t){const n=e[1];e.length=0,n?.(t)}function _u({t:e}){const t=re(),n=t._rendered??=[];return t.startTransition=(r,s)=>new Promise((i,a)=>{Vo(n,!1),n.push(s,i),e(t),gn(()=>{try{r()}catch(o){n[1]===i&&(n.length=0),a(o)}})}),io(()=>{const r=t.history.subscribe(t.load);t.updateLatestLocation();const s=t.latestLocation,i=t.buildLocation({to:s.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});if(ue(s.publicHref)!==ue(i.publicHref))return t.commitLocation({...i,replace:!0,ignoreBlocker:!0}),r;const a=t.stores.resolvedLocation.get();return a?.href===s.href&&a.state.__TSR_key===s.state.__TSR_key?n.push(t.stores.matches.get(),o=>{o&&t.emit({type:"onRendered",...vn(a,a)})}):t._tx||t.load().catch(console.error),r},[t,t.history]),null}function mu(){const e=re(),t=e.routesById[ze],n=Sn(e,t),r=e.ssr?We:be,s=f(M,{children:[f(_u,{t:A()[1]}),f(r,{fallback:n,children:f(gu,{})})]});return e.options.InnerWrap?f(e.options.InnerWrap,{children:s}):s}function gu(){const e=re(),t=e._rendered,n=pe(e.stores.matches,a=>t[0]??a),r=n[0],s=r?.routeId;io(()=>{t[0]===n&&Vo(t,!0)},[t,n]);const i=s?f(qo,{routeId:s}):null;return f(wn.Provider,{value:s,children:e.options.disableGlobalCatchBoundary?i:f(jr,{getResetKey:()=>r,onCatch:void 0,children:i})})}var yu=e=>({createMutableStore:Xs,createReadonlyStore:Xs,batch:jl}),vu=e=>new bu(e),bu=class extends yl{constructor(e){super(e,yu)}};function wu({router:e,children:t,...n}){ao(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});const r=f(Lo.Provider,{value:e,children:t});return e.options.Wrap?f(e.options.Wrap,{children:r}):r}function Su({router:e,...t}){return f(wu,{router:e,...t,children:f(mu,{})})}function Qo(e){const t=re({warn:e?.router===void 0}),n=e?.router||t;return pe(n.stores.__store,Do(e,n))}const pn={width:3997,height:1467},Ko="M105 1467V670H0V405H105V248L372 0H868V265H548V1467ZM615 670 618 405H868V670ZM1104 1467 839 1202V670L1104 405H1401V670H1286V1219H1401V1467ZM1471 1467V1219H1581V670H1471V405H1767L2032 670V1202L1767 1467ZM2419 1467 2171 1219V0H2613V1202H2811V1467ZM3555 1467V0H3997V1467ZM3069 1467 2830 1228V644L3069 405H3485V670H3272V1219H3485V1362L3380 1467Z";function Pu(e,t,n){const r=n/pn.width,s=e-n/2,i=t-pn.height*r/2;return`translate(${s.toFixed(2)} ${i.toFixed(2)}) scale(${r.toFixed(5)})`}function ii({title:e,descriptor:t,className:n}){return f("span",{class:n?`wordmark ${n}`:"wordmark",children:[f("svg",{class:"wordmark-glyphs",viewBox:`0 0 ${pn.width} ${pn.height}`,fill:"currentColor",role:e?"img":void 0,"aria-label":e,"aria-hidden":e?void 0:"true",focusable:"false",children:[e?f("title",{children:e}):null,f("path",{d:Ko})]}),t?f(M,{children:[f("span",{class:"wordmark-rule","aria-hidden":"true"}),f("span",{class:"wordmark-descriptor",children:t})]}):null]})}const Cu=45e3;function Ru(e){const t=Math.max(0,Math.round(e/1e3));if(t<5)return"just now";if(t<60)return`${t}s ago`;const n=Math.round(t/60);return n<60?`${n}m ago`:`${Math.round(n/60)}h ago`}function ku({updatedAt:e,fetching:t,failed:n}){const[r,s]=A(()=>Date.now());if(W(()=>{const l=setInterval(()=>s(Date.now()),5e3);return()=>clearInterval(l)},[]),!e&&!n)return null;const i=r-e,a=n?"failed":t?"fetching":i>Cu?"stale":"live",o=a==="failed"?"not updating":a==="fetching"?"refreshing":Ru(i);return f("p",{class:"freshness","data-state":a,children:[f("span",{class:"dot","aria-hidden":"true"}),f("span",{class:"visually-hidden",children:a==="failed"?"The federation snapshot is not updating.":`Federation snapshot ${a==="fetching"?"refreshing now":`last updated ${o}`}.`}),f("span",{"aria-hidden":"true",children:o})]})}let Pt={token:"",state:"anonymous"};const cr=new Set;function zo(){for(const e of cr)e()}function xu(){return Pt}function Go(e,t="pasted"){const n=e.trim();Pt={token:n,state:n?t:"anonymous"},zo()}function Tu(){Pt={token:"",state:"anonymous"},zo()}function Jo(){return Pt.token?{Authorization:`Bearer ${Pt.token}`}:{}}function Eu(e){return cr.add(e),()=>{cr.delete(e)}}function Hr(){return st(Eu,xu)}const oi="1.9.0",Ou={consoleSource:"1.9.0",tenantGovernance:"1.9.0"};function Ct(e){if(!e)return null;const t=/^v?(\d+)\.(\d+)(?:\.(\d+))?/.exec(e.trim());return t?[Number(t[1]),Number(t[2]),Number(t[3]??0)]:null}function Yo(e,t){const n=Ct(e),r=Ct(t);if(!n||!r)return 0;for(let s=0;s<3;s++){const i=(n[s]??0)-(r[s]??0);if(i!==0)return i<0?-1:1}return 0}function ai(e,t){return Ct(e)?Yo(e,Ou[t])>=0:!0}function Iu(e){return!Ct(e)||Yo(e,oi)>=0?null:`This console needs fold ${oi} or newer; the gateway reports ${e}. Parts of this page will be empty. Upgrade the gateway, or use the console bundled with it.`}function Lu(e){const t=Ct(e);return t?`${t[0]}.${t[1]}`:"latest"}function Mu(e){return e?/^\d/.test(e)?`v${e}`:e:""}const $u=[{to:"/",label:"Overview"},{to:"/upstreams",label:"Upstreams"},{to:"/catalog",label:"Catalog"},{to:"/test",label:"Test console"}];function Fu({version:e,authRequired:t,hint:n,onSignIn:r,onRefresh:s,refreshing:i,updatedAt:a,failed:o,section:l,children:c}){const d=Hr(),[u,h]=A(""),p=Qo({select:y=>y.location.pathname}),m=H(null),_=d.state==="signed-in",g=!_&&t!==!1,v=()=>{Go(u),s()};return f("div",{class:"shell",children:[f("button",{type:"button",class:"skip",onClick:()=>m.current?.focus(),children:"Skip to content"}),f("header",{class:"topbar",children:[f(te,{to:"/",className:"brand","aria-label":"fold console, overview",children:[f(ii,{title:"fold",descriptor:"Console"}),e?f("span",{class:"version muted",children:Mu(e)}):null]}),f("div",{class:"auth",children:[f(ku,{updatedAt:a,fetching:i,failed:o}),n?.oauth&&!_?f("button",{type:"button",onClick:r,children:"Sign in"}):null,_?f("button",{type:"button",onClick:()=>{Tu(),s()},children:"Sign out"}):null,g?f("input",{type:"password",value:u,autocomplete:"off",spellcheck:!1,"aria-label":"Bearer token",placeholder:n?.oauth?"…or paste a Bearer token":"Bearer token",onInput:y=>h(y.currentTarget.value),onBlur:v,onKeyDown:y=>{y.key==="Enter"&&v()}}):null,f("button",{type:"button",onClick:s,disabled:i,children:"Refresh"})]})]}),f("div",{class:"body",children:[f("nav",{class:"sidebar","aria-label":"Console sections",children:f("ul",{children:$u.map(y=>f("li",{children:f(te,{to:y.to,className:ci(p,y.to)?"nav-link active":"nav-link","aria-current":ci(p,y.to)?"page":void 0,children:y.label})},y.to))})}),f("main",{id:"main",ref:m,tabIndex:-1,children:c})]}),f(Du,{section:l}),f("footer",{children:f("div",{class:"foot",children:[f("span",{class:"legal",children:[f(ii,{}),"© fold.run · the enterprise MCP gateway"]}),f("nav",{"aria-label":"fold project",children:[f("a",{href:"https://fold.run/",rel:"noopener",children:"fold.run"}),f("a",{href:"https://docs.fold.run/",rel:"noopener",children:"Docs"}),f("a",{href:"https://github.com/fold-run/fold",rel:"noopener",children:"GitHub"}),f("a",{href:"https://fold.run/status/",rel:"noopener",children:"Status"})]})]})})]})}function Du({section:e}){const[t,n]=A(""),r=H(!0);return W(()=>{if(r.current){r.current=!1;return}n(`${e} page`)},[e]),f("p",{class:"visually-hidden",role:"status","aria-live":"polite",children:t})}function ci(e,t){return t==="/"?e==="/":e===t||e.startsWith(`${t}/`)}function Un({tone:e="bad",children:t}){return f("p",{class:`banner ${e}`,role:"alert",children:t})}const Fe={tools:{list:"tools/list",listKey:"tools",call:"tools/call",verb:"Call tool",args:!0,label:"Tools"},prompts:{list:"prompts/list",listKey:"prompts",call:"prompts/get",verb:"Get prompt",args:!0,label:"Prompts"},resources:{list:"resources/list",listKey:"resources",call:"resources/read",verb:"Read resource",args:!1,label:"Resources"}},$t=["tools","prompts","resources"],tn={tools:[],prompts:[],resources:[]};function G(e,t){return(e==="resources"?t.uri:t.name)??""}class Au{constructor(t,n){this.path=t,this.clientVersion=n}path;clientVersion;sessionId=null;protocolVersion=null;nextId=0;wire=[];wireSeq=0;listeners=new Set;subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});getWire=()=>this.wire;clearWire=()=>{this.wire=[],this.emit()};emit(){for(const t of this.listeners)t()}log(t,n){const r=this.wire.concat({id:this.wireSeq++,direction:t,message:n});this.wire=r.length>400?r.slice(r.length-400):r,this.emit()}async rpc(t,n,r=!1){const s={jsonrpc:"2.0",method:t};n!==void 0&&(s.params=n),r||(s.id=++this.nextId),this.log("→",s);const i={"Content-Type":"application/json",Accept:"application/json, text/event-stream",...Jo()};this.sessionId&&(i["Mcp-Session-Id"]=this.sessionId),this.protocolVersion&&(i["MCP-Protocol-Version"]=this.protocolVersion);const a=await fetch(this.path,{method:"POST",headers:i,body:JSON.stringify(s)}),o=a.headers.get("mcp-session-id");if(o&&(this.sessionId=o),a.status===202)return null;if(!a.ok){const d=await a.text();throw new Error(`HTTP ${a.status}${d?`: ${d.slice(0,300)}`:""}`)}const l=a.headers.get("content-type")??"";let c=null;if(l.includes("text/event-stream")){const d=await a.text();for(const u of d.split(/\r?\n\r?\n/)){const h=u.split(/\r?\n/).filter(m=>m.startsWith("data:")).map(m=>m.slice(5).replace(/^ /,"")).join(` -`);if(!h)continue;let p;try{p=JSON.parse(h)}catch{continue}this.log("←",p),!r&&p.id===s.id&&(c=p)}}else c=await a.json(),this.log("←",c);if(r)return null;if(!c)throw new Error(`no response for request ${s.id} on the stream`);if(c.error)throw new Error(`JSON-RPC ${c.error.code}: ${c.error.message}`);return c.result}async fetchList(t){const n=Fe[t],r=[];let s;for(let i=0;i<25;i++){let a;try{a=await this.rpc(n.list,s?{cursor:s}:{})}catch(o){if(/-32601/.test(o.message))return[];throw o}if(r.push(...a[n.listKey]??[]),s=a.nextCursor,!s)break}return r}async connect(){this.sessionId=null,this.protocolVersion=null,this.nextId=0;const t=await this.rpc("initialize",{protocolVersion:"2025-06-18",capabilities:{},clientInfo:{name:"fold-console",version:this.clientVersion}});this.protocolVersion=t.protocolVersion??null,await this.rpc("notifications/initialized",void 0,!0);const n={tools:[],prompts:[],resources:[]};for(const r of $t)n[r]=await this.fetchList(r);return n}async invoke(t,n,r){const s=t==="resources"?{uri:n}:{name:n,arguments:r};return this.rpc(Fe[t].call,s)}}function Nu(e){const t=e?.inputSchema;if(t?.properties){const n=new Set(t.required??[]),r={};for(const[s,i]of Object.entries(t.properties))n.size&&!n.has(s)||(r[s]=Uu(i));if(Object.keys(r).length)return JSON.stringify(r,null,2)}if(e?.arguments?.length){const n={};for(const r of e.arguments)r.required!==!1&&(n[r.name]="");if(Object.keys(n).length)return JSON.stringify(n,null,2)}return""}function Uu(e){if(e.default!==void 0)return e.default;if(e.enum?.length)return e.enum[0];switch(e.type){case"number":case"integer":return 0;case"boolean":return!1;case"array":return[];case"object":return{};default:return""}}const _t=()=>{},Xo=ne({status:"idle",error:null,catalog:tn,client:null,connect:_t,disconnect:_t,wire:[],clearWire:_t});function Zo(){return ee(Xo)}function Bu(e){const t=e&&e.trim()?e:"/mcp";return new URL(`..${t.startsWith("/")?t:`/${t}`}`,location.href).pathname}function ju({mcpPath:e,gatewayVersion:t,children:n}){const[r,s]=A("idle"),[i,a]=A(null),[o,l]=A(tn),[c,d]=A(null),{token:u}=Hr(),h=H(0),p=j(()=>{const y=++h.current,S=new Au(Bu(e),t??"dev");d(S),s("connecting"),a(null),l(tn),S.connect().then(b=>{y===h.current&&(l(b),s("ready"))}).catch(b=>{y===h.current&&(a(`MCP connect failed: ${b.message}`),s("error"))})},[e,t]),m=j(()=>{h.current++,d(null),l(tn),s("idle"),a(null)},[]),_=H(u);_.current!==u&&(_.current=u,r!=="idle"&&queueMicrotask(m));const g=st(c?c.subscribe:()=>_t,c?c.getWire:()=>Hu),v=q(()=>({status:r,error:i,catalog:o,client:c,connect:p,disconnect:m,wire:g,clearWire:c?c.clearWire:_t}),[r,i,o,c,p,m,g]);return f(Xo.Provider,{value:v,children:n})}const Hu=[];function Y({title:e,hint:t}){return f("div",{class:"empty",children:[f("p",{class:"empty-title",children:e}),t?f("p",{class:"muted",children:t}):null]})}class Qe extends Error{status;terminal;constructor(t,n,r=!1){super(n),this.name="ApiError",this.status=t,this.terminal=r}}const qu="../api/federation",Wu="../api/auth-hint";async function Vu(e){let t;try{t=await fetch(qu,{headers:Jo(),signal:e})}catch(n){throw new Qe(0,`Could not reach the gateway: ${n.message}`)}if(t.status===401)throw new Qe(401,"Unauthorized. Sign in, or paste a valid Bearer token: the same one /mcp accepts.",!0);if(t.status===403)throw new Qe(403,"This principal is not in the introspection viewer allowlist (server.introspection.groups). The denial was audited.",!0);if(!t.ok)throw new Qe(t.status,`The gateway refused the read: HTTP ${t.status}.`);return await t.json()}const Qu={queryKey:["federation"],queryFn:({signal:e})=>Vu(e),refetchInterval:15e3,retry:(e,t)=>!(t instanceof Qe&&t.terminal)},lr="fold-console-pkce";function Bn(e){return btoa(String.fromCharCode(...e)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function ea(){try{const e=await fetch(Wu);return e.ok?await e.json():null}catch{return null}}async function Ku(e){const t=e.replace(/\/$/,""),n=new URL(t),r=[`${t}/.well-known/openid-configuration`,`${n.origin}/.well-known/oauth-authorization-server${n.pathname.replace(/\/$/,"")}`];for(const s of r)try{const i=await fetch(s);if(!i.ok)continue;const a=await i.json();if(a.authorization_endpoint&&a.token_endpoint)return{authorization_endpoint:a.authorization_endpoint,token_endpoint:a.token_endpoint}}catch{}throw new Error(`could not discover authorization server metadata for ${e}`)}function ta(){return location.origin+location.pathname}async function zu(e){if(!e.oauth)throw new Error("this gateway does not advertise an OAuth issuer");const t=await Ku(e.oauth.issuer),n=Bn(crypto.getRandomValues(new Uint8Array(32))),r=Bn(crypto.getRandomValues(new Uint8Array(16))),s=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(n));sessionStorage.setItem(lr,JSON.stringify({verifier:n,state:r,tokenEndpoint:t.token_endpoint}));const i=new URL(t.authorization_endpoint);i.searchParams.set("response_type","code"),i.searchParams.set("client_id",e.oauth.clientId),i.searchParams.set("redirect_uri",ta()),i.searchParams.set("code_challenge",Bn(new Uint8Array(s))),i.searchParams.set("code_challenge_method","S256"),i.searchParams.set("state",r),e.oauth.scopes?.length&&i.searchParams.set("scope",e.oauth.scopes.join(" ")),e.resource&&i.searchParams.set("resource",e.resource),location.assign(i)}async function Gu(e){const t=new URLSearchParams(location.search);if(!t.has("code")&&!t.has("error"))return null;const n=sessionStorage.getItem(lr);if(sessionStorage.removeItem(lr),history.replaceState(null,"",location.pathname+location.hash),t.has("error")){const i=t.get("error_description");return`Sign-in failed: ${t.get("error")}${i?`. ${i}`:""}`}let r=null;try{r=JSON.parse(n??"null")}catch{}if(!r?.state||r.state!==t.get("state"))return"Sign-in failed: state mismatch. Start again from this page.";if(!e?.oauth||!r.tokenEndpoint||!r.verifier)return"Sign-in failed: the gateway no longer advertises the issuer this flow started against.";const s=new URLSearchParams({grant_type:"authorization_code",code:t.get("code")??"",redirect_uri:ta(),client_id:e.oauth.clientId,code_verifier:r.verifier});e.resource&&s.set("resource",e.resource);try{const i=await fetch(r.tokenEndpoint,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s}),a=await i.json();if(!i.ok||!a.access_token){const o=a.error_description?`: ${a.error_description}`:"";return`Token exchange failed: ${a.error??`HTTP ${i.status}`}${o}`}return Go(a.access_token,"signed-in"),null}catch(i){return`Token exchange failed: ${i.message}`}}let na=null;function Ju(e,t){na=t}const Yu=()=>na,ra=["auth-hint"],sa=ne({state:void 0,error:null,isPending:!0});function Pn(){return ee(sa)}const Xu={"/":"Overview","/upstreams":"Upstreams","/catalog":"Catalog","/test":"Test console"};function Zu(e){return Xu[e]??(e.startsWith("/upstreams/")?"Upstream":"Not found")}function eh(){const e=ro(),t=Hr(),[n,r]=A(Yu()),{data:s=null}=Ts({queryKey:ra,queryFn:ea,staleTime:1/0}),i=Ts({...Qu,queryKey:["federation",t.token?"authed":"anon"]}),a=i.error instanceof Qe?i.error:null,o=j(()=>{r(null),e.invalidateQueries({queryKey:["federation"]})},[e]),l=j(()=>{r(null),zu(s).catch(h=>r(`Sign-in failed: ${h.message}`))},[s]),c=Qo({select:h=>h.location.pathname}),d=Zu(c);W(()=>{document.title=`${d} · fold console`},[d]);const u=Iu(i.data?.version);return f(sa.Provider,{value:{state:i.data,error:a,isPending:i.isPending},children:f(ju,{mcpPath:i.data?.mcpPath,gatewayVersion:i.data?.version,children:f(Fu,{version:i.data?.version,authRequired:i.data?.authRequired,hint:s,onSignIn:l,onRefresh:o,refreshing:i.isFetching,updatedAt:i.dataUpdatedAt,failed:!!a,section:d,children:[n?f(Un,{children:n}):null,a?f(Un,{children:a.message}):null,u?f(Un,{tone:"warn",children:u}):null,a?.terminal?f(Y,{title:"No federation snapshot",hint:"The gateway answered, but not with data this principal may read."}):f(Wo,{})]})})})}function th(){return f(Y,{title:"No such page",hint:"That route is not part of the console. Pick a section from the sidebar."})}const it=uu({component:eh,notFoundComponent:th});function I({label:e,value:t,tone:n,wrap:r}){return f("div",{class:"card",children:[f("span",{class:"label",children:e}),f("b",{class:[n,r?"wrap":""].filter(Boolean).join(" ")||void 0,children:t})]})}function le({title:e,children:t,action:n}){return f("section",{class:"group","aria-label":e,children:[f("div",{class:"group-head",children:[f("h2",{children:e}),n]}),f("div",{class:"cards",children:t})]})}function nt({title:e,back:t,lede:n,actions:r,children:s}){return f("header",{class:"page-head",children:[t,f("div",{class:"page-head-row",children:[f("h1",{children:e}),r?f("div",{class:"page-actions",children:r}):null]}),n?f("p",{class:"muted lede",children:n}):null,s]})}const ia=ne(()=>{});function nh(){return ee(ia)}const rh=3200;function sh({children:e}){const[t,n]=A([]),r=H(0),s=H(new Set),i=j((o,l="ok")=>{const c=r.current++;n(u=>u.concat({id:c,message:o,tone:l}));const d=setTimeout(()=>{n(u=>u.filter(h=>h.id!==c)),s.current.delete(d)},rh);s.current.add(d)},[]);W(()=>{const o=s.current;return()=>{for(const l of o)clearTimeout(l);o.clear()}},[]);const a=q(()=>i,[i]);return f(ia.Provider,{value:a,children:[e,f("div",{class:"toasts",role:"status","aria-live":"polite",children:t.map(o=>f("div",{class:`toast ${o.tone}`,children:o.message},o.id))})]})}function Ye({value:e,label:t,className:n}){const r=nh(),s=async()=>{try{if(!navigator.clipboard)throw new Error("needs a secure context (https or localhost)");await navigator.clipboard.writeText(e),r(`${t} copied`)}catch(i){r(`Copy failed: ${i.message}`,"bad")}};return f("button",{type:"button",class:n?`copy ${n}`:"copy",onClick:s,disabled:!e,title:`Copy ${t.toLowerCase()}`,"aria-label":`Copy ${t.toLowerCase()}`,children:"Copy"})}const ih="https://docs.fold.run",oh={configuration:"configuration",federation:"federation",policy:"policy",auth:"auth",observability:"observability",tenancy:"tenancy",discovery:"discovery"};function ah(e,t){return`${ih}/${Lu(t)}/${oh[e]}/`}function ut({topic:e,version:t,children:n}){return f("a",{class:"group-action",href:ah(e,t),rel:"noopener",children:[n," →"]})}function li({count:e=4}){return f("div",{class:"cards","aria-hidden":"true",children:Array.from({length:e},(t,n)=>f("div",{class:"card skeleton-card",children:[f("span",{class:"skeleton skeleton-label"}),f("span",{class:"skeleton skeleton-value"})]},n))})}function ch({columns:e,rows:t=3}){return f(M,{children:Array.from({length:t},(n,r)=>f("tr",{"aria-hidden":"true",children:Array.from({length:e},(s,i)=>f("td",{children:f("span",{class:"skeleton skeleton-cell"})},i))},r))})}const rt="—";function Q(e){return e==null||e===""?rt:String(e)}function Rt(e){return e===void 0?rt:e<1e3?`${e} ms`:`${(e/1e3).toFixed(2)} s`}function ur(e){if(!e)return rt;const t=[e.org,e.team].filter(Boolean);return t.length?t.join(" / "):rt}function lh(e){if(!e)return rt;const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{year:"numeric",month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}function uh(e){return e?e%1e3===0?`${e/1e3} s`:`${e} ms`:"30 s (default)"}function hr(e){try{return JSON.stringify(e,null,2)??String(e)}catch{return String(e)}}function oa(e,t){const n=t.trim().toLowerCase();return n?e.some(r=>r?.toLowerCase().includes(n)):!0}function hh(){const{state:e,isPending:t}=Pn();if(!e)return t?f(M,{children:[f(nt,{title:"Overview"}),f("section",{class:"group","aria-label":"Loading",children:[f("p",{class:"visually-hidden",role:"status",children:"Reading the federation snapshot."}),f(li,{count:5})]}),f("section",{class:"group","aria-hidden":"true",children:f(li,{count:3})})]}):f(Y,{title:"No federation snapshot",hint:"Check that server.introspection.enabled is set on the gateway."});const n=e.upstreams.filter(s=>s.connected).length,r=e.upstreams.length;return f(M,{children:[f(nt,{title:"Overview",lede:"The gateway's own view of its configuration and federation.",actions:f(ut,{topic:"configuration",version:e.version,children:"Configuration"})}),f(le,{title:"Gateway",children:[f(I,{label:"version",value:Q(e.version)}),f(I,{label:"endpoint",value:f(M,{children:[e.mcpPath,f(Ye,{value:e.mcpPath,label:"MCP path"})]})}),f(I,{label:"auth",value:(e.authRequired?"required":"disabled")+(e.emaEnabled?" + EMA":""),tone:e.authRequired?void 0:"warn"}),f(I,{label:"state",value:e.sharedState?"shared (Redis)":"in-process"}),e.passthrough?f(I,{label:"mode",value:"passthrough",tone:"warn"}):null,ai(e.version,"consoleSource")&&e.consoleSource?f(I,{label:"console build",value:e.consoleSource.slice(0,12)}):null]}),f(le,{title:"Federation",action:f(te,{to:"/upstreams",className:"group-action",children:"All upstreams →"}),children:[f(I,{label:"upstreams",value:`${e.staticUpstreams} static + ${e.discoveredUpstreams} discovered`}),f(I,{label:"connected",value:`${n} / ${r}`,tone:r===0?"warn":n===r?"ok":"bad"}),f(I,{label:"routing",value:`sep ${e.namespaceSeparator} · ${e.pageSize?`page size ${e.pageSize}`:"no pagination"}`})]}),f(le,{title:"Governance",action:f(ut,{topic:"policy",version:e.version,children:"Policy docs"}),children:[f(I,{label:"policy",value:`${e.policyDefaultDecision}, ${e.policyRules} rule(s)`,tone:e.policyDefaultDecision==="deny"?void 0:"warn"}),e.globalRequestsPerMinute?f(I,{label:"rate limit",value:`${e.globalRequestsPerMinute}/min global`+(e.perPrincipalRequestsPerMinute?` · ${e.perPrincipalRequestsPerMinute}/min per principal`:"")}):null,e.viewerGroups?.length?f(I,{label:"viewers",value:e.viewerGroups.join(", "),wrap:!0}):null]}),e.tenant&&ai(e.version,"tenantGovernance")?f(le,{title:"Your tenant",children:[f(I,{label:"tenant",value:e.tenant}),e.tenantRequestsPerMinute?f(I,{label:"requests",value:`${e.tenantRequestsPerMinute}/min`}):null,e.tenantUpstreamCalls?f(I,{label:"budget",value:`${e.tenantUpstreamCalls} calls/${Q(e.tenantBudgetPeriod)}`}):null]}):null,f(le,{title:"Observability",action:f(ut,{topic:"observability",version:e.version,children:"Observability docs"}),children:[f(I,{label:"audit",value:e.auditSinks.length?e.auditSinks.join(" + "):"none",tone:e.auditSinks.length?void 0:"warn"}),f(I,{label:"tracing",value:e.tracingEnabled?"OTLP":"off"})]}),e.discovery?f(le,{title:"Discovery",action:f(ut,{topic:"discovery",version:e.version,children:"Discovery docs"}),children:[f(I,{label:"source",value:e.discovery.url,wrap:!0}),f(I,{label:"interval",value:uh(e.discovery.intervalMs)}),e.discovery.lastOutcome?f(I,{label:"last sync",value:`${e.discovery.lastOutcome} · ${lh(e.discovery.lastSyncAt)}`,tone:e.discovery.lastOutcome==="applied"||e.discovery.lastOutcome==="unchanged"?"ok":"bad",wrap:!0}):f(I,{label:"last sync",value:"not yet run",tone:"warn"})]}):null]})}const dh=Mt({getParentRoute:()=>it,path:"/",component:hh});function aa(e,t,n,r="asc"){const s=t.find(a=>a.key===n);if(!s)return e;const i=r==="desc"?-1:1;return e.slice().sort((a,o)=>{const l=s.value(a),c=s.value(o);return typeof l=="number"&&typeof c=="number"?(l-c)*i:String(l).localeCompare(String(c),void 0,{numeric:!0})*i})}function qr({columns:e,rows:t,rowKey:n,sort:r,dir:s="asc",onSort:i,empty:a,caption:o,loading:l}){return f("div",{class:"tablewrap",children:f("table",{children:[o?f("caption",{class:"visually-hidden",children:o}):null,f("thead",{children:f("tr",{children:e.map(c=>{const d=r===c.key,u=i&&c.sortable!==!1;return f("th",{"aria-sort":d?s==="asc"?"ascending":"descending":void 0,children:c.headerHidden?f("span",{class:"visually-hidden",children:c.header}):u?f("button",{type:"button",class:"th-sort",onClick:()=>i(c.key),children:[c.header,f("span",{class:"sort-mark","aria-hidden":"true",children:d?s==="asc"?"↑":"↓":""})]}):c.header},c.key)})})}),f("tbody",{children:l?f(ch,{columns:e.length}):t.length===0?f("tr",{children:f("td",{class:"empty-cell",colSpan:e.length,children:a})}):t.map(c=>f("tr",{children:e.map(d=>f("td",{class:[d.tone?.(c),d.wrap?"wrap":""].filter(Boolean).join(" ")||void 0,children:d.render?d.render(c):d.value(c)},d.key))},n(c)))})]})})}function Wr({options:e,value:t,onChange:n,label:r}){return f("div",{class:"seg",role:"group","aria-label":r,children:e.map(s=>f("button",{type:"button",class:s.value===t?"active":void 0,"aria-pressed":s.value===t,disabled:s.disabled,onClick:()=>n(s.value),children:[s.label,s.count===void 0?null:f("span",{class:"seg-count",children:s.count})]},s.value))})}const jn=980,ui=20,Ee=34,ca=12,He=Ee+ca,me=268,dr=300,_e=26,Te=108,ht=76,hi=me+dr+18,fh=40;function ph(e,t,n){if(t<2)return n;const r=ht-26;return n-r/2+r*e/(t-1)}const _h=.6;function Vt(e,t,n){const r=Math.floor(t/(n*_h));return e.length<=r?e:`${e.slice(0,Math.max(1,r-1))}…`}function Qt(e){return e.connected&&(e.breaker==="closed"||!e.breaker)?"live":!e.connected||e.breaker==="open"?"down":"idle"}function di(e){const t=e.connected?"connected":"not connected",n=e.breaker?`, breaker ${e.breaker}`:"",r=e.connected?`, ${Rt(e.latencyMs)}`:e.error?`, ${e.error}`:"";return`${e.id}: ${t}${n}${r}`}function mh({state:e,upstreams:t}){const n=t.slice(0,fh),r=t.length-n.length,s=n.length*He-ca,i=Math.max(s,ht),a=i+ui*2,o=ui+(i-s)/2,l=a/2,c=_e+Te/2,d=t.filter(h=>Qt(h)==="live").length,u=`${t.length} upstream${t.length===1?"":"s"} behind one gateway endpoint at ${e.mcpPath}; ${d} connected. Every route crosses the gateway's auth, policy and audit boundary.`;return f("figure",{class:"topology",children:[f("p",{class:"visually-hidden",children:[u," Each upstream links to its detail page; the same data is in the table view."]}),f("div",{class:"topology-scroll",children:f("svg",{class:"topology-svg",viewBox:`0 0 ${jn} ${a}`,width:jn,height:a,children:[n.map((h,p)=>{const m=o+p*He+Ee/2,_=ph(p,n.length,l),g=`M ${_e+Te} ${_} C ${_e+Te+64} ${_}, ${me-64} ${m}, ${me} ${m}`,v=Qt(h);return f("path",{class:v==="live"?"fold-active":v==="down"?"fold-broken":"fold-dash",d:g},h.id)}),n.map((h,p)=>Qt(h)==="live"?f("path",{class:"fold-arrow",d:`M ${me-12} ${o+p*He+Ee/2-6} L ${me} ${o+p*He+Ee/2} L ${me-12} ${o+p*He+Ee/2+6} Z`},`a-${h.id}`):null),f("path",{class:"fold-notch",d:`M ${_e-8} ${l-8} v 16 M ${_e-4} ${l-11} v 22`}),f("path",{class:"fold-notch",d:`M ${_e+Te+4} ${l-11} v 22 M ${_e+Te+8} ${l-8} v 16`}),f("g",{children:[f("title",{children:`fold gateway, ${e.mcpPath}`}),f("rect",{class:"fold-gate",x:_e,y:l-ht/2,width:Te,height:ht,rx:"2"}),f("path",{class:"fold-node-mark",d:Ko,transform:Pu(c,l-8,56)}),f("text",{class:"fold-anno",x:c,y:l+18,"text-anchor":"middle",children:Vt(e.mcpPath,Te-12,11)})]}),f("text",{class:"fold-anno",x:c,y:l+ht/2+16,"text-anchor":"middle",children:Vt(`${e.policyDefaultDecision} · ${e.policyRules} rules`,150,11)}),n.map((h,p)=>{const m=o+p*He,_=m+Ee/2,g=Qt(h),v=h.namespace?`${h.namespace}${e.namespaceSeparator}*`:h.id,y=h.connected?h.breaker&&h.breaker!=="closed"?`${Rt(h.latencyMs)} · breaker ${h.breaker}`:Rt(h.latencyMs):h.error??"not connected";return f("a",{class:"fold-link",href:`#/upstreams/${encodeURIComponent(h.id)}`,"aria-label":di(h),children:[f("title",{children:di(h)}),f("rect",{class:"fold-node",x:me,y:m,width:dr,height:Ee,rx:"2"}),f("text",{class:"fold-node-label",x:me+14,y:_+5,children:Vt(v,dr-28,14)}),f("text",{class:`fold-anno ${g==="down"?"is-down":""}`,x:hi,y:_+4,children:Vt(y,jn-hi-8,11)})]},h.id)})]})}),f("figcaption",{class:"muted topology-caption",children:[d," of ",t.length," connected",r>0?` · ${r} more not drawn, see the table`:""," · every route crosses auth, policy and audit"]})]})}function gh(e){const t=(s,i)=>typeof s=="string"&&i.includes(s)?s:void 0,n=typeof e.q=="string"&&e.q?e.q:void 0,r=typeof e.sort=="string"&&e.sort?e.sort:void 0;return{...e.view==="map"?{view:"map"}:{},...n?{q:n}:{},...r?{sort:r}:{},...t(e.source,["static","discovered"])?{source:t(e.source,["static","discovered"])}:{},...t(e.status,["connected","disconnected"])?{status:t(e.status,["connected","disconnected"])}:{},...t(e.dir,["asc","desc"])?{dir:t(e.dir,["asc","desc"])}:{}}}const yh=e=>e.breaker==="closed"?"ok":e.breaker==="open"?"bad":"warn";function vh(){const{state:e,isPending:t}=Pn(),n=fr.useSearch(),r=Lt({from:fr.fullPath}),s=u=>{r({search:h=>({...h,...u}),replace:!0})},i=q(()=>[{key:"id",header:"Upstream",value:u=>u.id,render:u=>f(te,{to:"/upstreams/$id",params:{id:u.id},className:"cell-link",children:u.id})},{key:"namespace",header:"Namespace",value:u=>u.namespace??"",render:u=>Q(u.namespace)},{key:"source",header:"Source",value:u=>u.source??"",render:u=>Q(u.source)},{key:"auth",header:"Auth",value:u=>u.authStrategy??"",render:u=>Q(u.authStrategy)},{key:"connected",header:"Connected",value:u=>u.connected?1:0,render:u=>u.connected?"yes":"no",tone:u=>u.connected?"ok":"bad"},{key:"breaker",header:"Breaker",value:u=>u.breaker??"",render:u=>Q(u.breaker),tone:u=>u.breaker==="closed"?void 0:yh(u)},{key:"latency",header:"Latency",value:u=>u.connected?u.latencyMs??0:Number.MAX_SAFE_INTEGER,render:u=>u.connected?Rt(u.latencyMs):Q(u.error),tone:u=>u.connected?void 0:"warn",wrap:!0},{key:"owner",header:"Owner",value:u=>ur(u.owner),render:u=>ur(u.owner)}],[]),a=e?.upstreams??[],o=q(()=>{const u=a.filter(h=>n.source&&h.source!==n.source||n.status==="connected"&&!h.connected||n.status==="disconnected"&&h.connected?!1:oa([h.id,h.namespace,h.url,h.authStrategy,h.owner?.org,h.owner?.team,...Object.entries(h.labels??{}).map(([p,m])=>`${p}=${m}`)],n.q??""));return aa(u,i,n.sort,n.dir??"asc")},[a,i,n.q,n.source,n.status,n.sort,n.dir]),l=u=>{n.sort===u?s({dir:n.dir==="asc"?"desc":"asc"}):s({sort:u,dir:"asc"})},c=!!(n.q||n.source||n.status),d=n.view==="map"?"map":"table";return f(M,{children:[f(nt,{title:"Upstreams",lede:"Every MCP server this gateway federates, as the gateway last saw it.",actions:f(ut,{topic:"federation",version:e?.version,children:"Federation docs"}),children:f("div",{class:"filters",children:[f(Wr,{label:"View",value:d,onChange:u=>s({view:u==="map"?"map":void 0}),options:[{value:"table",label:"Table"},{value:"map",label:"Map"}]}),f("input",{type:"search",class:"filter-text",placeholder:"Filter by id, namespace, URL, owner, label…","aria-label":"Filter upstreams",value:n.q??"",onInput:u=>s({q:u.target.value||void 0})}),f("select",{class:"filter-select","aria-label":"Source",value:n.source??"",onChange:u=>s({source:u.target.value||void 0}),children:[f("option",{value:"",children:"Any source"}),f("option",{value:"static",children:"Static"}),f("option",{value:"discovered",children:"Discovered"})]}),f("select",{class:"filter-select","aria-label":"Connection status",value:n.status??"",onChange:u=>s({status:u.target.value||void 0}),children:[f("option",{value:"",children:"Any status"}),f("option",{value:"connected",children:"Connected"}),f("option",{value:"disconnected",children:"Disconnected"})]}),f("output",{class:"muted count","aria-live":"polite",children:[o.length," of ",a.length]})]})}),d==="map"&&e&&o.length>0?f(mh,{state:e,upstreams:o}):f(qr,{caption:"Federated upstreams",columns:i,rows:o,rowKey:u=>u.id,sort:n.sort,dir:n.dir??"asc",onSort:l,loading:t,empty:c?f(Y,{title:"No upstream matches this filter",hint:f("button",{type:"button",class:"linkish",onClick:()=>s({q:void 0,source:void 0,status:void 0}),children:"Clear the filter"})}):f(Y,{title:"No upstreams in the federation",hint:"Add one under `upstreams` in the gateway config, or enable discovery."})})]})}const fr=Mt({getParentRoute:()=>it,path:"/upstreams",validateSearch:gh,component:vh});function pr({title:e,text:t,placeholder:n,tall:r,copyLabel:s,actions:i,follow:a}){const o=H(null),l=H(!0),c=()=>{const d=o.current;d&&(l.current=d.scrollHeight-d.scrollTop-d.clientHeight<48)};return W(()=>{const d=o.current;!a||!d||!l.current||(d.scrollTop=d.scrollHeight)},[a,t]),f("section",{class:"pane-block","aria-label":e,children:[f("div",{class:"pane-head",children:[f("h3",{children:e}),f("div",{class:"pane-actions",children:[i,f(Ye,{value:t,label:s??e})]})]}),f("pre",{ref:o,class:r?"pane tall":"pane",tabIndex:0,onScroll:a?c:void 0,children:t||n})]})}const bh=[{key:"url",header:"Endpoint",value:e=>e.url??"",render:e=>Q(e.url),wrap:!0},{key:"healthy",header:"Health",value:e=>e.healthy?1:0,render:e=>e.healthy?"healthy":"unhealthy",tone:e=>e.healthy?"ok":"bad",sortable:!1}];function wh(){const{id:e}=la.useParams(),{state:t,isPending:n}=Pn();if(!t)return f(Y,{title:n?"Reading the federation snapshot…":"No federation snapshot"});const r=t.upstreams.find(i=>i.id===e);if(!r)return f(Y,{title:`No upstream "${e}" in this federation`,hint:f(M,{children:["It may have been removed, or it may sit outside the visibility your tenant is granted."," ",f(te,{to:"/upstreams",children:"Back to upstreams"})]})});const s=Object.entries(r.labels??{});return f(M,{children:[f(nt,{title:r.id,back:f(te,{to:"/upstreams",className:"back",children:"← Upstreams"}),actions:f(Ye,{value:r.id,label:"Upstream ID"})}),f(le,{title:"Status",children:[f(I,{label:"connected",value:r.connected?"yes":"no",tone:r.connected?"ok":"bad"}),f(I,{label:"breaker",value:Q(r.breaker),tone:r.breaker==="closed"?"ok":r.breaker==="open"?"bad":"warn"}),f(I,{label:"latency",value:r.connected?Rt(r.latencyMs):rt}),r.error?f(I,{label:"error",value:r.error,tone:"bad",wrap:!0}):null]}),f(le,{title:"Configuration",children:[f(I,{label:"namespace",value:Q(r.namespace)}),f(I,{label:"source",value:Q(r.source)}),f(I,{label:"auth strategy",value:Q(r.authStrategy)}),r.url?f(I,{label:"url",value:f(M,{children:[r.url,f(Ye,{value:r.url,label:"Upstream URL"})]}),wrap:!0}):null]}),f(le,{title:"Ownership",children:[f(I,{label:"owner",value:ur(r.owner)}),r.owner?.contact?f(I,{label:"contact",value:f(M,{children:[r.owner.contact,f(Ye,{value:r.owner.contact,label:"Contact"})]}),wrap:!0}):null]}),f("section",{class:"group",children:[f("div",{class:"group-head",children:f("h2",{children:"Labels"})}),s.length?f("div",{class:"chips",children:s.map(([i,a])=>f("span",{class:"chip",children:[i,"=",a]},i))}):f("p",{class:"muted",children:"No labels on this upstream."})]}),f("section",{class:"group",children:[f("div",{class:"group-head",children:f("h2",{children:"Endpoints"})}),f(qr,{caption:`Endpoints for ${r.id}`,columns:bh,rows:r.endpoints??[],rowKey:i=>i.url??"endpoint",empty:f(Y,{title:"Single endpoint",hint:"This upstream is not load-balanced, so the balancer reports no per-replica view."})})]}),f(pr,{title:"Raw record",copyLabel:"Raw record",text:hr(r),placeholder:""})]})}const la=Mt({getParentRoute:()=>it,path:"/upstreams/$id",component:wh});function Sh(e){const t=$t.includes(e.mode)?e.mode:void 0,n=typeof e.q=="string"&&e.q?e.q:void 0,r=typeof e.sort=="string"&&e.sort?e.sort:void 0,s=e.dir==="asc"||e.dir==="desc"?e.dir:void 0;return{...t?{mode:t}:{},...n?{q:n}:{},...r?{sort:r}:{},...s?{dir:s}:{}}}function Kt(e,t){const n=t?e.indexOf(t):-1;return n<=0?{namespace:"",local:e}:{namespace:e.slice(0,n),local:e.slice(n+t.length)}}function Ph(){const{state:e}=Pn(),t=Zo(),n=_r.useSearch(),r=Lt({from:_r.fullPath}),s=n.mode??"tools",i=e?.namespaceSeparator??"",a=u=>{r({search:h=>({...h,...u}),replace:!0})},o=q(()=>[{key:"name",header:s==="resources"?"URI":"Name",value:u=>Kt(G(s,u),i).local,render:u=>f(te,{to:"/test",search:{mode:s,item:G(s,u)},className:"cell-link",title:G(s,u),children:Kt(G(s,u),i).local})},{key:"namespace",header:"Namespace",value:u=>Kt(G(s,u),i).namespace,render:u=>Q(Kt(G(s,u),i).namespace)},{key:"description",header:"Description",value:u=>u.description??u.title??"",render:u=>Q(u.description??u.title),wrap:!0},{key:"copy",header:"Copy",headerHidden:!0,value:()=>"",sortable:!1,render:u=>f(Ye,{value:G(s,u),label:s==="resources"?"URI":"Name"})}],[s,i]),l=t.catalog[s],c=q(()=>{const u=l.filter(h=>oa([G(s,h),h.title,h.description,h.mimeType],n.q??""));return aa(u,o,n.sort,n.dir??"asc")},[l,o,s,n.q,n.sort,n.dir]),d=u=>{n.sort===u?a({dir:n.dir==="asc"?"desc":"asc"}):a({sort:u,dir:"asc"})};return f(M,{children:[f(nt,{title:"Catalog",lede:"Tools, prompts and resources visible to this principal: the same list any MCP client would receive.",actions:f("button",{type:"button",class:t.status==="ready"?void 0:"primary",onClick:t.connect,disabled:t.status==="connecting",children:t.status==="connecting"?"Connecting…":t.status==="ready"?"Reload catalog":"Connect & list"}),children:f("div",{class:"filters",children:[f(Wr,{label:"Capability",value:s,onChange:u=>a({mode:u,sort:void 0,dir:void 0}),options:$t.map(u=>({value:u,label:Fe[u].label,count:t.status==="ready"?t.catalog[u].length:void 0}))}),f("input",{type:"search",class:"filter-text",placeholder:"Filter by name, description, namespace…","aria-label":"Filter catalog",value:n.q??"",disabled:t.status!=="ready",onInput:u=>a({q:u.target.value||void 0})}),t.status==="ready"?f("output",{class:"muted count","aria-live":"polite",children:[c.length," of ",l.length]}):null]})}),f(qr,{caption:`${Fe[s].label} visible to this principal`,columns:o,rows:t.status==="ready"?c:[],rowKey:u=>G(s,u),sort:n.sort,dir:n.dir??"asc",onSort:d,empty:Ch(t.status,t.error,l.length,!!n.q,s)})]})}function Ch(e,t,n,r,s){return e==="connecting"?"Connecting to the gateway…":e==="error"?f(Y,{title:"Could not list the catalog",hint:t??void 0}):e==="idle"?f(Y,{title:"Not connected",hint:"Connect to open an MCP session against the gateway and list what this principal may see."}):r&&n?f(Y,{title:"Nothing matches this filter"}):f(Y,{title:`No ${Fe[s].label.toLowerCase()} visible`,hint:"Either no federated server exposes any, or policy denies this principal every one of them."})}const _r=Mt({getParentRoute:()=>it,path:"/catalog",validateSearch:Sh,component:Ph});function Rh(e){const t=$t.includes(e.mode)?e.mode:void 0,n=typeof e.item=="string"&&e.item?e.item:void 0;return{...t?{mode:t}:{},...n?{item:n}:{}}}function kh(){const e=Zo(),t=mr.useSearch(),n=Lt({from:mr.fullPath}),r=t.mode??"tools",s=Fe[r],i=e.catalog[r],a=t.item&&i.some(b=>G(r,b)===t.item)?t.item:i[0]?G(r,i[0]):"",o=i.find(b=>G(r,b)===a),[l,c]=A(""),[d,u]=A(""),[h,p]=A(null),[m,_]=A(!1);W(()=>{c(s.args?Nu(o):""),u(""),p(null)},[r,a,s.args,o]);const g=b=>{n({search:R=>({...R,...b}),replace:!0})},v=q(()=>e.wire.map(b=>`${b.direction} ${hr(b.message)}`).join(` +var Rt,E,fi,ge,Zr,pi,_i,Tn,Kt,dt,mi,gr,Hn,qn,gi,tn={},nn=[],ya=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,kt=Array.isArray;function ae(e,t){for(var n in t)e[n]=t[n];return e}function yr(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function z(e,t,n){var r,s,i,a={};for(i in t)i=="key"?r=t[i]:i=="ref"?s=t[i]:a[i]=t[i];if(arguments.length>2&&(a.children=arguments.length>3?Rt.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)a[i]===void 0&&(a[i]=e.defaultProps[i]);return ft(e,a,r,s,null)}function ft(e,t,n,r,s){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:s??++fi,__i:-1,__u:0};return s==null&&E.vnode!=null&&E.vnode(i),i}function yi(){return{current:null}}function M(e){return e.children}function Z(e,t){this.props=e,this.context=t}function Le(e,t){if(t==null)return e.__?Le(e.__,e.__i+1):null;for(var n;tt&&ge.sort(_i),e=ge.shift(),t=ge.length,va(e)}finally{ge.length=rn.__r=0}}function bi(e,t,n,r,s,i,a,o,l,c,d){var u,h,p,m,_,g,v=r&&r.__k||nn,y=t.length;for(l=ba(n,t,v,l,y),u=0;u0?a=e.__k[i]=ft(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[i]=a,l=i+h,a.__=e,a.__b=e.__b+1,o=null,(c=a.__i=wa(a,n,l,u))!=-1&&(u--,(o=n[c])&&(o.__u|=2)),o==null||o.__v==null?(c==-1&&(s>d?h--:sl?h--:h++,a.__u|=4))):e.__k[i]=null;if(u)for(i=0;i(d?1:0)){for(s=n-1,i=n+1;s>=0||i=0?s--:i++])!=null&&(2&c.__u)==0&&o==c.key&&l==c.type)return a}return-1}function es(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||ya.test(t)?n:n+"px"}function Nt(e,t,n,r,s){var i,a;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||es(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||es(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")i=t!=(t=t.replace(mi,"$1")),a=t.toLowerCase(),t=a in e||t=="onFocusOut"||t=="onFocusIn"?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r?n[dt]=r[dt]:(n[dt]=gr,e.addEventListener(t,i?qn:Hn,i)):e.removeEventListener(t,i?qn:Hn,i);else{if(s=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function ts(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Kt]==null)t[Kt]=gr++;else if(t[Kt]0?e:kt(e)?e.map(Ci):e.constructor!==void 0?null:ae({},e)}function Sa(e,t,n,r,s,i,a,o,l){var c,d,u,h,p,m,_,g=n.props||tn,v=t.props,y=t.type;if(y=="svg"?s="http://www.w3.org/2000/svg":y=="math"?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),i!=null){for(c=0;c2&&(o.children=arguments.length>3?Rt.call(arguments,2):n),ft(e.type,o,r||e.key,s||e.ref,null)}function ne(e){function t(n){var r,s;return this.getChildContext||(r=new Set,(s={})[t.__c]=this,this.getChildContext=function(){return s},this.componentWillUnmount=function(){r=null},this.shouldComponentUpdate=function(i){this.props.value!=i.value&&r.forEach(function(a){a.__e=!0,Wn(a)})},this.sub=function(i){r.add(i);var a=i.componentWillUnmount;i.componentWillUnmount=function(){r&&r.delete(i),a&&a.call(i)}}),n.children}return t.__c="__cC"+gi++,t.__=e,t.Provider=t.__l=(t.Consumer=function(n,r){return n.children(r)}).contextType=t,t}Rt=nn.slice,E={__e:function(e,t,n,r){for(var s,i,a;t=t.__;)if((s=t.__c)&&!s.__)try{if((i=s.constructor)&&i.getDerivedStateFromError!=null&&(s.setState(i.getDerivedStateFromError(e)),a=s.__d),s.componentDidCatch!=null&&(s.componentDidCatch(e,r||{}),a=s.__d),a)return s.__E=s}catch(o){e=o}throw e}},fi=0,Z.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=ae({},this.state),typeof e=="function"&&(e=e(ae({},n),this.props)),e&&ae(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Wn(this))},Z.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Wn(this))},Z.prototype.render=M,ge=[],pi=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,_i=function(e,t){return e.__v.__b-t.__v.__b},rn.__r=0,Tn=Math.random().toString(8),Kt="__d"+Tn,dt="__a"+Tn,mi=/(PointerCapture)$|Capture$/i,gr=0,Hn=ts(!1),qn=ts(!0),gi=0;var Ra=0;function f(e,t,n,r,s,i){t||(t={});var a,o,l=t;if("ref"in l)for(o in l={},t)o=="ref"?a=t[o]:l[o]=t[o];var c={type:e,props:l,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Ra,__i:-1,__u:0,__source:s,__self:i};if(typeof e=="function"&&(a=e.defaultProps))for(o in a)l[o]===void 0&&(l[o]=a[o]);return E.vnode&&E.vnode(c),c}var xt=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ka=class extends xt{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<"u"&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},wr=new ka,xa={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Ta=class{#e=xa;#t=!1;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}},Oe=new Ta;function Ea(e){setTimeout(e,0)}var Oa=typeof window>"u"||"Deno"in globalThis;function V(){}function Ia(e,t){return typeof e=="function"?e(t):e}function Vn(e){return typeof e=="number"&&e>=0&&e!==1/0}function xi(e,t){return Math.max(e+(t||0)-Date.now(),0)}function ve(e,t){return typeof e=="function"?e(t):e}function J(e,t){return typeof e=="function"?e(t):e}function ns(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:i,queryKey:a,stale:o}=e;if(a){if(r){if(t.queryHash!==Sr(a,t.options))return!1}else if(!Ze(t.queryKey,a))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof o=="boolean"&&t.isStale()!==o||s&&s!==t.state.fetchStatus||i&&!i(t))}function rs(e,t){const{exact:n,status:r,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(mt(t.options.mutationKey)!==mt(i))return!1}else if(!Ze(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function Sr(e,t){return(t?.queryKeyHashFn||mt)(e)}function mt(e){return JSON.stringify(e,(t,n)=>Kn(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function Ze(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(Array.isArray(e)&&Array.isArray(t)){for(let r=0;r500)return t;const r=ss(e)&&ss(t);if(!r&&!(Kn(e)&&Kn(t)))return t;const i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,l=r?new Array(o):{};let c=0;for(let d=0;d{Oe.setTimeout(t,e)})}function zn(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?Ti(e,t):t}function $a(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function Fa(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Pr=Symbol();function Ei(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Pr?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Oi(e,t){return typeof e=="function"?e(...t):!!e}function Da(e,t,n){let r=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??=t(),r||(r=!0,s.aborted?n():s.addEventListener("abort",n,{once:!0})),s)}),e}var gt=(()=>{let e=()=>Oa;return{isServer(){return e()},setIsServer(t){e=t}}})();function Gn(){let e,t;const n=new Promise((s,i)=>{e=s,t=i});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),e(s)},n.reject=s=>{r({status:"rejected",reason:s}),t(s)},n}var Aa=Ea;function Na(){let e=[],t=0,n=o=>{o()},r=o=>{o()},s=Aa;const i=o=>{t?e.push(o):s(()=>{n(o)})},a=()=>{const o=e;e=[],o.length&&s(()=>{r(()=>{o.forEach(l=>{n(l)})})})};return{batch:o=>{let l;t++;try{l=o()}finally{t--,t||a()}return l},batchCalls:o=>(...l)=>{i(()=>{o(...l)})},schedule:i,setNotifyFunction:o=>{n=o},setBatchNotifyFunction:o=>{r=o},setScheduler:o=>{s=o}}}var U=Na(),Ua=class extends xt{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<"u"&&window.addEventListener){const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(n=>{n(e)}))}isOnline(){return this.#e}},sn=new Ua;function Ba(e){return Math.min(1e3*2**e,3e4)}function Ii(e){return(e??"online")==="online"?sn.isOnline():!0}var Jn=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function Li(e){let t=!1,n=0,r;const s=Gn(),i=()=>s.status!=="pending",a=_=>{if(!i()){const g=new Jn(_);h(g),e.onCancel?.(g)}},o=()=>{t=!0},l=()=>{t=!1},c=()=>wr.isFocused()&&(e.networkMode==="always"||sn.isOnline())&&e.canRun(),d=()=>Ii(e.networkMode)&&e.canRun(),u=_=>{i()||(r?.(),s.resolve(_))},h=_=>{i()||(r?.(),s.reject(_))},p=()=>new Promise(_=>{r=g=>{(i()||c())&&_(g)},e.onPause?.()}).then(()=>{r=void 0,i()||e.onContinue?.()}),m=()=>{if(i())return;let _;const g=n===0?e.initialPromise:void 0;try{_=g??e.fn()}catch(v){_=Promise.reject(v)}Promise.resolve(_).then(u).catch(v=>{if(i())return;const y=e.retry??(gt.isServer()?0:3),S=e.retryDelay??Ba,b=typeof S=="function"?S(n,v):S,R=y===!0||typeof y=="number"&&nc()?void 0:p()).then(()=>{t?h(v):m()})})};return{promise:s,status:()=>s.status,cancel:a,continue:()=>(r?.(),s),cancelRetry:o,continueRetry:l,canStart:d,start:()=>(d()?m():p().then(m),s)}}var Mi=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Vn(this.gcTime)&&(this.#e=Oe.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(gt.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(Oe.clearTimeout(this.#e),this.#e=void 0)}};function ja(e){return{onFetch:(t,n)=>{const r=t.options,s=t.fetchOptions?.meta?.fetchMore?.direction,i=t.state.data?.pages||[],a=t.state.data?.pageParams||[];let o={pages:[],pageParams:[]},l=0;const c=async()=>{let d=!1;const u=m=>{Da(m,()=>t.signal,()=>d=!0)},h=Ei(t.options,t.fetchOptions),p=async(m,_,g)=>{if(d)return Promise.reject(t.signal.reason);if(_==null&&m.pages.length)return Promise.resolve(m);const y=(()=>{const P={client:t.client,queryKey:t.queryKey,pageParam:_,direction:g?"backward":"forward",meta:t.options.meta};return u(P),P})(),S=await h(y),{maxPages:b}=t.options,R=g?Fa:$a;return{pages:R(m.pages,S,b),pageParams:R(m.pageParams,_,b)}};if(s&&i.length){const m=s==="backward",_=m?Ha:os,g={pages:i,pageParams:a},v=_(r,g);o=await p(g,v,m)}else{const m=e??i.length;do{const _=l===0?a[0]??r.initialPageParam:os(r,o);if(l>0&&_==null)break;o=await p(o,_),l++}while(lt.options.persister?.(c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=c}}}function os(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Ha(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var qa=class extends Mi{#e;#t;#n;#r;#i;#s;#a;#o;constructor(e){super(),this.#o=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=cs(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#s?.promise}setOptions(e){if(this.options={...this.#a,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const t=cs(this.options);t.data!==void 0&&(this.setState(as(t.data,t.dataUpdatedAt)),this.#t=t)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#r.remove(this)}setData(e,t){const n=zn(this.state.data,e,this.options);return this.#c({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:"setState",state:e})}cancel(e){const t=this.#s?.promise;return this.#s?.cancel(e),t?t.then(V).catch(V):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>J(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Pr||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>ve(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!xi(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#s?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#s?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#s&&(this.#o||this.#u()?this.#s.cancel({revert:!0}):this.#s.cancelRetry()),this.scheduleGc()),this.#r.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}#u(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"}invalidate(){this.state.isInvalidated||this.#c({type:"invalidate"})}async fetch(e,t){if(this.state.fetchStatus!=="idle"&&this.#s?.status()!=="rejected"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#s)return this.#s.continueRetry(),this.#s.promise}if(e&&this.setOptions(e),!this.options.queryFn){const l=this.observers.find(c=>c.options.queryFn);l&&this.setOptions(l.options)}const n=new AbortController,r=l=>{Object.defineProperty(l,"signal",{enumerable:!0,get:()=>(this.#o=!0,n.signal)})},s=()=>{const l=Ei(this.options,t),d=(()=>{const u={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(u),u})();return this.#o=!1,this.options.persister?this.options.persister(l,d,this):l(d)},a=(()=>{const l={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:s};return r(l),l})();(this.#e==="infinite"?ja(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:"fetch",meta:a.fetchOptions?.meta}),this.#s=Li({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:l=>{l instanceof Jn&&l.revert&&this.setState({...this.#n,fetchStatus:"idle"}),n.abort()},onFail:(l,c)=>{this.#c({type:"failed",failureCount:l,error:c})},onPause:()=>{this.#c({type:"pause"})},onContinue:()=>{this.#c({type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{const l=await this.#s.start();if(l===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(l),this.#r.config.onSuccess?.(l,this),this.#r.config.onSettled?.(l,this.state.error,this),l}catch(l){if(l instanceof Jn){if(l.silent)return this.#s.promise;if(l.revert){if(this.state.data===void 0)throw l;return this.state.data}}throw this.#c({type:"error",error:l}),this.#r.config.onError?.(l,this),this.#r.config.onSettled?.(this.state.data,l,this),l}finally{this.scheduleGc()}}#c(e){const t=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...$i(n.data,this.options),fetchMeta:e.meta??null};case"success":const r={...n,...as(e.data,e.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?r:void 0,r;case"error":const s=e.error;return{...n,error:s,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=t(this.state),U.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),this.#r.notify({query:this,type:"updated",action:e})})}};function $i(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ii(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function as(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function cs(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Wa=class extends xt{constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.#a=Gn(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#s;#a;#o;#u;#c;#p;#h;#d;#l;#_=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),ls(this.#t,this.options)?this.#f():this.updateResult(),this.#v())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Yn(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Yn(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#w(),this.#t.removeObserver(this)}setOptions(e){const t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof J(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#S(),this.#t.setOptions(this.options),t._defaulted&&!Qn(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const r=this.hasListeners();r&&us(this.#t,n,this.options,t)&&this.#f(),this.updateResult(),r&&(this.#t!==n||J(this.options.enabled,this.#t)!==J(t.enabled,this.#t)||ve(this.options.staleTime,this.#t)!==ve(t.staleTime,this.#t))&&this.#m();const s=this.#g();r&&(this.#t!==n||J(this.options.enabled,this.#t)!==J(t.enabled,this.#t)||s!==this.#l)&&this.#y(s)}getOptimisticResult(e){const t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return Qa(this,n)&&(this.#r=n,this.#s=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(n,r)=>(this.trackProp(r),t?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#a.status==="pending"&&this.#a.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,r))})}trackProp(e){this.#_.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#f({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#f(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(V)),t}#m(){this.#b();const e=ve(this.options.staleTime,this.#t);if(gt.isServer()||this.#r.isStale||!Vn(e))return;const n=xi(this.#r.dataUpdatedAt,e)+1;this.#h=Oe.setTimeout(()=>{this.#r.isStale||this.updateResult()},n)}#g(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#y(e){this.#w(),this.#l=e,!(gt.isServer()||J(this.options.enabled,this.#t)===!1||!Vn(this.#l)||this.#l===0)&&(this.#d=Oe.setInterval(()=>{(this.options.refetchIntervalInBackground||wr.isFocused())&&this.#f()},this.#l))}#v(){this.#m(),this.#y(this.#g())}#b(){this.#h!==void 0&&(Oe.clearTimeout(this.#h),this.#h=void 0)}#w(){this.#d!==void 0&&(Oe.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){const n=this.#t,r=this.options,s=this.#r,i=this.#i,a=this.#s,l=e!==n?e.state:this.#n,{state:c}=e;let d={...c},u=!1,h;if(t._optimisticResults){const C=this.hasListeners(),k=!C&&ls(e,t),T=C&&us(e,n,t,r);(k||T)&&(d={...d,...$i(c.data,e.options)}),t._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:p,errorUpdatedAt:m,status:_}=d;h=d.data;let g=!1;if(t.placeholderData!==void 0&&h===void 0&&_==="pending"){let C;s?.isPlaceholderData&&t.placeholderData===a?.placeholderData?(C=s.data,g=!0):C=typeof t.placeholderData=="function"?t.placeholderData(this.#p?.state.data,this.#p):t.placeholderData,C!==void 0&&(_="success",h=zn(s?.data,C,t),u=!0)}if(t.select&&h!==void 0&&!g)if(s&&h===i?.data&&t.select===this.#u)h=this.#c;else try{this.#u=t.select,h=t.select(h),h=zn(s?.data,h,t),this.#c=h,this.#o=null}catch(C){this.#o=C}this.#o&&(p=this.#o,h=this.#c,m=Date.now(),_="error");const v=d.fetchStatus==="fetching",y=_==="pending",S=_==="error",b=y&&v,R=h!==void 0,w={status:_,fetchStatus:d.fetchStatus,isPending:y,isSuccess:_==="success",isError:S,isInitialLoading:b,isLoading:b,data:h,dataUpdatedAt:d.dataUpdatedAt,error:p,errorUpdatedAt:m,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:d.dataUpdateCount>l.dataUpdateCount||d.errorUpdateCount>l.errorUpdateCount,isFetching:v,isRefetching:v&&!y,isLoadingError:S&&!R,isPaused:d.fetchStatus==="paused",isPlaceholderData:u,isRefetchError:S&&R,isStale:Cr(e,t),refetch:this.refetch,promise:this.#a,isEnabled:J(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const C=w.data!==void 0,k=w.status==="error"&&!C,T=$=>{k?$.reject(w.error):C&&$.resolve(w.data)},x=()=>{const $=this.#a=w.promise=Gn();T($)},O=this.#a;switch(O.status){case"pending":e.queryHash===n.queryHash&&T(O);break;case"fulfilled":(k||w.data!==O.value)&&x();break;case"rejected":(!k||w.error!==O.reason)&&x();break}}return w}updateResult(){const e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#s=this.options,this.#i.data!==void 0&&(this.#p=this.#t),Qn(t,e))return;this.#r=t;const n=()=>{if(!e)return!0;const{notifyOnChangeProps:r}=this.options,s=typeof r=="function"?r():r;if(s==="all"||!s&&!this.#_.size)return!0;const i=new Set(s??this.#_);return this.options.throwOnError&&i.add("error"),Object.keys(this.#r).some(a=>{const o=a;return this.#r[o]!==e[o]&&i.has(o)})};this.#P({listeners:n()})}#S(){const e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;const t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#v()}#P(e){U.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function Va(e,t){return J(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&J(t.retryOnMount,e)===!1)}function ls(e,t){return Va(e,t)||e.state.data!==void 0&&Yn(e,t,t.refetchOnMount)}function Yn(e,t,n){if(J(t.enabled,e)!==!1&&ve(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Cr(e,t)}return!1}function us(e,t,n,r){return(e!==t||J(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Cr(e,n)}function Cr(e,t){return J(t.enabled,e)!==!1&&e.isStaleByTime(ve(t.staleTime,e))}function Qa(e,t){return!Qn(e.getCurrentResult(),t)}var Ka=class extends Mi{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||za(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#i({type:"continue"})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=Li({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(new Error("No mutationFn found")),onFail:(i,a)=>{this.#i({type:"failed",failureCount:i,error:a})},onPause:()=>{this.#i({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});const r=this.state.status==="pending",s=!this.#r.canStart();try{if(r)t();else{this.#i({type:"pending",variables:e,isPaused:s}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);const a=await this.options.onMutate?.(e,n);a!==this.state.context&&this.#i({type:"pending",context:a,variables:e,isPaused:s})}const i=await this.#r.start();return await this.#n.config.onSuccess?.(i,e,this.state.context,this,n),await this.options.onSuccess?.(i,e,this.state.context,n),await this.#n.config.onSettled?.(i,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(i,null,e,this.state.context,n),this.#i({type:"success",data:i}),i}catch(i){try{await this.#n.config.onError?.(i,e,this.state.context,this,n)}catch(a){Promise.reject(a)}try{await this.options.onError?.(i,e,this.state.context,n)}catch(a){Promise.reject(a)}try{await this.#n.config.onSettled?.(void 0,i,this.state.variables,this.state.context,this,n)}catch(a){Promise.reject(a)}try{await this.options.onSettled?.(void 0,i,e,this.state.context,n)}catch(a){Promise.reject(a)}throw this.#i({type:"error",error:i}),i}finally{this.#n.runNext(this)}}#i(e){const t=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),U.batch(()=>{this.#t.forEach(n=>{n.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}};function za(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Ga=class extends xt{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){const r=new Ka({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);const t=Ut(e);if(typeof t=="string"){const n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){const t=Ut(e);if(typeof t=="string"){const n=this.#t.get(t);if(n)if(n.length>1){const r=n.indexOf(e);r!==-1&&n.splice(r,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=Ut(e);if(typeof t=="string"){const r=this.#t.get(t)?.find(s=>s.state.status==="pending");return!r||r===e}else return!0}runNext(e){const t=Ut(e);return typeof t=="string"?this.#t.get(t)?.find(r=>r!==e&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){U.batch(()=>{this.#e.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){const t={exact:!0,...e};return this.getAll().find(n=>rs(t,n))}findAll(e={}){return this.getAll().filter(t=>rs(e,t))}notify(e){U.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return U.batch(()=>Promise.all(e.map(t=>t.continue().catch(V))))}};function Ut(e){return e.options.scope?.id}var Ja=class extends xt{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){const r=t.queryKey,s=t.queryHash??Sr(r,t);let i=this.get(s);return i||(i=new qa({client:e,queryKey:r,queryHash:s,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(i)),i}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){U.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(n=>ns(t,n))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(n=>ns(e,n)):t}notify(e){U.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){U.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){U.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Ya=class{#e;#t;#n;#r;#i;#s;#a;#o;constructor(e={}){this.#e=e.queryCache||new Ja,this.#t=e.mutationCache||new Ga,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#s=0}mount(){this.#s++,this.#s===1&&(this.#a=wr.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#o=sn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#s--,this.#s===0&&(this.#a?.(),this.#a=void 0,this.#o?.(),this.#o=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#t.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(ve(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=Ia(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return U.batch(()=>this.#e.findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){const t=this.#e;U.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=this.#e;return U.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=U.batch(()=>this.#e.findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(V).catch(V)}invalidateQueries(e,t={}){return U.batch(()=>(this.#e.findAll(e).forEach(n=>{n.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=U.batch(()=>this.#e.findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,n);return n.throwOnError||(i=i.catch(V)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(V)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=this.#e.build(this,t);return n.isStaleByTime(ve(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(V).catch(V)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(V).catch(V)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return sn.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(mt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#r.values()],n={};return t.forEach(r=>{Ze(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(mt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#i.values()],n={};return t.forEach(r=>{Ze(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Sr(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Pr&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},fe,L,En,hs,et=0,Fi=[],D=E,ds=D.__b,fs=D.__r,ps=D.diffed,_s=D.__c,ms=D.unmount,gs=D.__;function De(e,t){D.__h&&D.__h(L,e,et||t),et=0;var n=L.__H||(L.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function A(e){return et=1,_n(Di,e)}function _n(e,t,n){var r=De(fe++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Di(void 0,t),function(o){var l=r.__N?r.__N[0]:r.__[0],c=r.t(l,o);l!==c&&(r.__N=[c,r.__[1]],r.__c.setState({}))}],r.__c=L,!L.__f)){var s=function(o,l,c){if(!r.__c.__H)return!0;var d=!1,u=r.__c.props!==o;if(r.__c.__H.__.some(function(p){if(p.__N){d=!0;var m=p.__[0];p.__=p.__N,p.__N=void 0,m!==p.__[0]&&(u=!0)}}),i){var h=i.call(this,o,l,c);return d?h||u:h}return!d||u};L.__f=!0;var i=L.shouldComponentUpdate,a=L.componentWillUpdate;L.componentWillUpdate=function(o,l,c){if(this.__e){var d=i;i=void 0,s(o,l,c),i=d}a&&a.call(this,o,l,c)},L.shouldComponentUpdate=s}return r.__N||r.__}function W(e,t){var n=De(fe++,3);!D.__s&&xr(n.__H,t)&&(n.__=e,n.u=t,L.__H.__h.push(n))}function Ae(e,t){var n=De(fe++,4);!D.__s&&xr(n.__H,t)&&(n.__=e,n.u=t,L.__h.push(n))}function H(e){return et=5,q(function(){return{current:e}},[])}function mn(e,t,n){et=6,Ae(function(){if(typeof e=="function"){var r=e(t());return function(){e(null),r&&typeof r=="function"&&r()}}if(e)return e.current=t(),function(){return e.current=null}},n==null?n:n.concat(e))}function q(e,t){var n=De(fe++,7);return xr(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function j(e,t){return et=8,q(function(){return e},t)}function ee(e){var t=L.context[e.__c],n=De(fe++,9);return n.c=e,t?(n.__==null&&(n.__=!0,t.sub(L)),t.props.value):e.__}function Rr(e,t){D.useDebugValue&&D.useDebugValue(t?t(e):e)}function Xa(e){var t=De(fe++,10),n=A();return t.__=e,L.componentDidCatch||(L.componentDidCatch=function(r,s){t.__&&t.__(r,s),n[1](r)}),[n[0],function(){n[1](void 0)}]}function kr(){var e=De(fe++,11);if(!e.__){for(var t=L.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__="P"+n[0]+"-"+n[1]++}return e.__}function Za(){for(var e;e=Fi.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(zt),t.__h.some(Xn),t.__h=[]}catch(n){t.__h=[],D.__e(n,e.__v)}}}D.__b=function(e){L=null,ds&&ds(e)},D.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),gs&&gs(e,t)},D.__r=function(e){fs&&fs(e),fe=0;var t=(L=e.__c).__H;t&&(En===L?(t.__h=[],L.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(zt),t.__h.some(Xn),t.__h=[],fe=0)),En=L},D.diffed=function(e){ps&&ps(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Fi.push(t)!==1&&hs===D.requestAnimationFrame||((hs=D.requestAnimationFrame)||ec)(Za)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),En=L=null},D.__c=function(e,t){t.some(function(n){try{n.__h.some(zt),n.__h=n.__h.filter(function(r){return!r.__||Xn(r)})}catch(r){t.some(function(s){s.__h&&(s.__h=[])}),t=[],D.__e(r,n.__v)}}),_s&&_s(e,t)},D.unmount=function(e){ms&&ms(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(r){try{zt(r)}catch(s){t=s}}),n.__H=void 0,t&&D.__e(t,n.__v))};var ys=typeof requestAnimationFrame=="function";function ec(e){var t,n=function(){clearTimeout(r),ys&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);ys&&(t=requestAnimationFrame(n))}function zt(e){var t=L,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),L=t}function Xn(e){var t=L;e.__c=e.__(),L=t}function xr(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function Di(e,t){return typeof t=="function"?t(e):t}function Ai(e,t){for(var n in t)e[n]=t[n];return e}function Zn(e,t){for(var n in e)if(n!=="__source"&&!(n in t))return!0;for(var r in t)if(r!=="__source"&&e[r]!==t[r])return!0;return!1}function st(e,t){var n=t(),r=A({t:{__:n,u:t}}),s=r[0].t,i=r[1];return Ae(function(){s.__=n,s.u=t,On(s)&&i({t:s})},[e,n,t]),W(function(){return On(s)&&i({t:s}),e(function(){On(s)&&i({t:s})})},[e]),n}function On(e){try{return!((t=e.__)===(n=e.u())&&(t!==0||1/t==1/n)||t!=t&&n!=n)}catch{return!0}var t,n}function gn(e){e()}function Tr(e){return e}function Er(){return[!1,gn]}var Or=Ae;function on(e,t){this.props=e,this.context=t}function Tt(e,t){function n(s){var i=this.props.ref;return i!=s.ref&&i&&(typeof i=="function"?i(null):i.current=null),t?!t(this.props,s)||i!=s.ref:Zn(this.props,s)}function r(s){return this.shouldComponentUpdate=n,z(e,s)}return r.displayName="Memo("+(e.displayName||e.name)+")",r.__f=r.prototype.isReactComponent=!0,r.type=e,r}(on.prototype=new Z).isPureReactComponent=!0,on.prototype.shouldComponentUpdate=function(e,t){return Zn(this.props,e)||Zn(this.state,t)};var vs=E.__b;E.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),vs&&vs(e)};var tc=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function Ir(e){function t(n){var r=Ai({},n);return delete r.ref,e(r,n.ref||null)}return t.$$typeof=tc,t.render=e,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var bs=function(e,t){return e==null?null:de(de(e).map(t))},Ni={map:bs,forEach:bs,count:function(e){return e?de(e).length:0},only:function(e){var t=de(e);if(t.length!==1)throw"Children.only";return t[0]},toArray:de},nc=E.__e;E.__e=function(e,t,n,r){if(e.then){for(var s,i=t;i=i.__;)if((s=i.__c)&&s.__c)return t.__e==null&&(t.__e=n.__e,t.__k=n.__k||[]),s.__c(e,t)}nc(e,t,n,r)};var ws=E.unmount;function Ui(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),e.__c.__H=null),(e=Ai({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return Ui(r,t,n)})),e}function Bi(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return Bi(r,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function be(){this.__u=0,this.o=null,this.__b=null}function ji(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function Hi(e){var t,n,r,s=null;function i(a){if(t||(t=e()).then(function(o){o&&(s=o.default||o),r=!0},function(o){n=o,r=!0}),n)throw n;if(!r)throw t;return s?z(s,a):null}return i.displayName="Lazy",i.__f=!0,i}function Ve(){this.i=null,this.l=null}E.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),ws&&ws(e)},(be.prototype=new Z).__c=function(e,t){var n=t.__c,r=this;r.o==null&&(r.o=[]),r.o.push(n);var s=ji(r.__v),i=!1,a=function(){i||r.__z||(i=!0,n.__R=null,s?s(l):l())};n.__R=a;var o=n.__P;n.__P=null;var l=function(){if(!--r.__u){if(r.state.__a){var c=r.state.__a;r.__v.__k[0]=Bi(c,c.__c.__P,c.__c.__O)}var d;for(r.setState({__a:r.__b=null});d=r.o.pop();)d.__P=o,d.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(a,a)},be.prototype.componentWillUnmount=function(){this.o=[]},be.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=Ui(this.__b,n,r.__O=r.__P)}this.__b=null}var s=t.__a&&z(M,null,e.fallback);return s&&(s.__u&=-33),[z(M,null,t.__a?null:e.children),s]};var Ss=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]>>1,1),t.h.removeChild(s)}}}Xe(z(rc,{context:t.context},e.__v),t.v)}function qi(e,t){var n=z(sc,{__v:e,h:t});return n.containerInfo=t,n}(Ve.prototype=new Z).__a=function(e){var t=this,n=ji(t.__v),r=t.l.get(e);return r[0]++,function(s){var i=function(){t.props.revealOrder?(r.push(s),Ss(t,e,r)):s()};n?n(i):i()}},Ve.prototype.render=function(e){this.i=null,this.l=new Map;var t=de(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},Ve.prototype.componentDidUpdate=Ve.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){Ss(e,n,t)})};var Wi=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,ic=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,oc=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,ac=/[A-Z0-9]/g,cc=typeof document<"u",lc=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};function Vi(e,t,n){return t.__k==null&&(t.textContent=""),Xe(e,t),typeof n=="function"&&n(),e?e.__c:null}function Qi(e,t,n){return ki(e,t),typeof n=="function"&&n(),e?e.__c:null}Z.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(Z.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Ps=E.event;E.event=function(e){return Ps&&(e=Ps(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var Lr,uc={configurable:!0,get:function(){return this.class}},Cs=E.vnode;E.vnode=function(e){typeof e.type=="string"&&(function(t){var n=t.props,r=t.type,s={},i=r.indexOf("-")==-1;for(var a in n){var o=n[a];if(!(a==="value"&&"defaultValue"in n&&o==null||cc&&a==="children"&&r==="noscript"||a==="class"||a==="className")){var l=a.toLowerCase();a==="defaultValue"&&"value"in n&&n.value==null?a="value":a==="download"&&o===!0?o="":l==="translate"&&o==="no"?o=!1:l[0]==="o"&&l[1]==="n"?l==="ondoubleclick"?a="ondblclick":l!=="onchange"||r!=="input"&&r!=="textarea"||lc(n.type)?l==="onfocus"?a="onfocusin":l==="onblur"?a="onfocusout":oc.test(a)&&(a=l):l=a="oninput":i&&ic.test(a)?a=a.replace(ac,"-$&").toLowerCase():o===null&&(o=void 0),l==="oninput"&&s[a=l]&&(a="oninputCapture"),s[a]=o}}r=="select"&&(s.multiple&&Array.isArray(s.value)&&(s.value=de(n.children).forEach(function(c){c.props.selected=s.value.indexOf(c.props.value)!=-1})),s.defaultValue!=null&&(s.value=de(n.children).forEach(function(c){c.props.selected=s.multiple?s.defaultValue.indexOf(c.props.value)!=-1:s.defaultValue==c.props.value}))),n.class&&!n.className?(s.class=n.class,Object.defineProperty(s,"className",uc)):n.className&&(s.class=s.className=n.className),t.props=s})(e),e.$$typeof=Wi,Cs&&Cs(e)};var Rs=E.__r;E.__r=function(e){Rs&&Rs(e),Lr=e.__c};var ks=E.diffed;E.diffed=function(e){ks&&ks(e);var t=e.props,n=e.__e;n!=null&&e.type==="textarea"&&"value"in t&&t.value!==n.value&&(n.value=t.value==null?"":t.value),Lr=null};var Ki={ReactCurrentDispatcher:{current:{readContext:function(e){return Lr.__n[e.__c].props.value},useCallback:j,useContext:ee,useDebugValue:Rr,useDeferredValue:Tr,useEffect:W,useId:kr,useImperativeHandle:mn,useInsertionEffect:Or,useLayoutEffect:Ae,useMemo:q,useReducer:_n,useRef:H,useState:A,useSyncExternalStore:st,useTransition:Er}}},hc="18.3.1";function zi(e){return z.bind(null,e)}function Et(e){return!!e&&e.$$typeof===Wi}function Gi(e){return Et(e)&&e.type===M}function Ji(e){return!!e&&typeof e.displayName=="string"&&e.displayName.indexOf("Memo(")==0}function Yi(e){return Et(e)?Ca.apply(null,arguments):e}function Xi(e){return!!e.__k&&(Xe(null,e),!0)}function Zi(e){return e&&(e.base||e.nodeType===1&&e)||null}var eo=function(e,t){return e(t)},Mr=function(e,t){var n,r=E.debounceRendering;E.debounceRendering=function(i){n=i};try{var s=e(t);return n&&n(),s}finally{E.debounceRendering=r}},to=Et,Ot={useState:A,useId:kr,useReducer:_n,useEffect:W,useLayoutEffect:Ae,useInsertionEffect:Or,useTransition:Er,useDeferredValue:Tr,useSyncExternalStore:st,startTransition:gn,useRef:H,useImperativeHandle:mn,useMemo:q,useCallback:j,useContext:ee,useDebugValue:Rr,version:"18.3.1",Children:Ni,render:Vi,hydrate:Qi,unmountComponentAtNode:Xi,createPortal:qi,createElement:z,createContext:ne,createFactory:zi,cloneElement:Yi,createRef:yi,Fragment:M,isValidElement:Et,isElement:to,isFragment:Gi,isMemo:Ji,findDOMNode:Zi,Component:Z,PureComponent:on,memo:Tt,forwardRef:Ir,flushSync:Mr,unstable_batchedUpdates:eo,StrictMode:M,Suspense:be,SuspenseList:Ve,lazy:Hi,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Ki};const dc=Object.freeze(Object.defineProperty({__proto__:null,Children:Ni,Component:Z,Fragment:M,PureComponent:on,StrictMode:M,Suspense:be,SuspenseList:Ve,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Ki,cloneElement:Yi,createContext:ne,createElement:z,createFactory:zi,createPortal:qi,createRef:yi,default:Ot,findDOMNode:Zi,flushSync:Mr,forwardRef:Ir,hydrate:Qi,isElement:to,isFragment:Gi,isMemo:Ji,isValidElement:Et,lazy:Hi,memo:Tt,render:Vi,startTransition:gn,unmountComponentAtNode:Xi,unstable_batchedUpdates:eo,useCallback:j,useContext:ee,useDebugValue:Rr,useDeferredValue:Tr,useEffect:W,useErrorBoundary:Xa,useId:kr,useImperativeHandle:mn,useInsertionEffect:Or,useLayoutEffect:Ae,useMemo:q,useReducer:_n,useRef:H,useState:A,useSyncExternalStore:st,useTransition:Er,version:hc},Symbol.toStringTag,{value:"Module"}));var no=ne(void 0),ro=e=>{const t=ee(no);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},fc=({client:e,children:t})=>(W(()=>(e.mount(),()=>{e.unmount()}),[e]),f(no.Provider,{value:e,children:t})),so=ne(!1),pc=()=>ee(so);so.Provider;function _c(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var mc=ne(_c()),gc=()=>ee(mc),yc=(e,t,n)=>{const r=n?.state.error&&typeof e.throwOnError=="function"?Oi(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},vc=e=>{W(()=>{e.clearReset()},[e])},bc=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||Oi(n,[e.error,r])),wc=e=>{if(e.suspense){const n=s=>s==="static"?s:Math.max(s??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...s)=>n(r(...s)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Sc=(e,t)=>e.isLoading&&e.isFetching&&!t,Pc=(e,t)=>e?.suspense&&t.isPending,xs=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Cc(e,t,n){const r=pc(),s=gc(),i=ro(),a=i.defaultQueryOptions(e);i.getDefaultOptions().queries?._experimental_beforeQuery?.(a);const o=i.getQueryCache().get(a.queryHash),l=e.subscribed!==!1;a._optimisticResults=r?"isRestoring":l?"optimistic":void 0,wc(a),yc(a,s,o),vc(s);const c=!i.getQueryCache().get(a.queryHash),[d]=A(()=>new t(i,a)),u=d.getOptimisticResult(a),h=!r&&l;if(st(j(p=>{const m=h?d.subscribe(U.batchCalls(p)):V;return d.updateResult(),m},[d,h]),()=>d.getCurrentResult()),W(()=>{d.setOptions(a)},[a,d]),Pc(a,u))throw xs(a,d,s);if(bc({result:u,errorResetBoundary:s,throwOnError:a.throwOnError,query:o,suspense:a.suspense}))throw u.error;return i.getDefaultOptions().queries?._experimental_afterQuery?.(a,u),a.experimental_prefetchInRender&&!gt.isServer()&&Sc(u,r)&&(c?xs(a,d,s):o?.promise)?.catch(V).finally(()=>{d.updateResult()}),a.notifyOnChangeProps?u:d.trackResult(u)}function Ts(e,t){return Cc(e,Wa)}const Rc=!1;var io=Ae;function kc(e,t,n={},r){W(()=>{if(!e.current||r||typeof IntersectionObserver!="function")return;const s=new IntersectionObserver(([i])=>{t(i)},n);return s.observe(e.current),()=>{s.disconnect()}},[t,r,n,e])}function xc(e){const t=H(null);return mn(e,()=>t.current,[]),t}function yt(e){return e[e.length-1]}function Tc(e){return typeof e=="function"}function tt(e,t){return Tc(e)?e(t):e}const oo=Object.prototype.hasOwnProperty,Ec=Object.prototype.propertyIsEnumerable;function ao(e){for(const t in e)if(oo.call(e,t))return!0;return!1}const Oc=()=>Object.create(null),ke=(e,t)=>Ie(e,t,Oc);function Ie(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;const s=t,i=Is(e)&&Is(s);if(!i&&!(an(e)&&an(s)))return s;const a=i?e:Es(e);if(!a)return s;const o=i?s:Es(s);if(!o)return s;const l=a.length,c=o.length,d=i?new Array(c):n();let u=0;for(let h=0;h"u")return!0;const n=t.prototype;return!(!Os(n)||!n.hasOwnProperty("isPrototypeOf"))}function Os(e){return Object.prototype.toString.call(e)==="[object Object]"}function Is(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function we(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,s=e.length;rs||!we(e[a],t[a],n)))return!1;return s===i}return!1}const Ic=/[\x00-\x1f\x7f"<>`{}]/g;function Lc(e){return e.replace(Ic,t=>"%"+t.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0"))}function Ls(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,n=>{try{return decodeURI(n)}catch{return n}})}return Lc(t)}const Mc=["http:","https:","mailto:","tel:"];function cn(e,t){if(!e)return!1;try{const n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function ct(e){if(!e)return{path:e,handledProtocolRelativeURL:!1};if(!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith("//"))return{path:e,handledProtocolRelativeURL:!1};const t=/%25|%5C/gi;let n=0,r="",s;for(;(s=t.exec(e))!==null;)r+=Ls(e.slice(n,s.index))+s[0],n=t.lastIndex;r=r+Ls(n?e.slice(n):e);let i=!1;return r.startsWith("//")&&(i=!0,r="/"+r.replace(/^\/+/,"")),{path:r,handledProtocolRelativeURL:i}}function $c(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Fc(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n{i.next&&(i.prev?(i.prev.next=i.next,i.next.prev=i.prev,i.next=void 0,r&&(r.next=i,i.prev=r)):(i.next.prev=void 0,n=i.next,i.next=void 0,r&&(i.prev=r,r.next=i)),r=i)};return{get(i){const a=t.get(i);if(a)return s(a),a.value},set(i,a){if(t.size>=e&&n){const l=n;t.delete(l.key),l.next&&(n=l.next,l.next.prev=void 0),l===r&&(r=void 0)}const o=t.get(i);if(o)o.value=a,s(o);else{const l={key:i,value:a,prev:r};r&&(r.next=l),r=l,n||(n=l),t.set(i,l)}},clear(){t.clear(),n=void 0,r=void 0}}}const ye=4,co=5;function Dc(e){const t=e.indexOf("{");if(t===-1)return null;const n=e.indexOf("}",t);return n===-1||t+1>=e.length?null:[t,n]}function lo(e,t,n=new Uint16Array(6)){const r=e.indexOf("/",t),s=r===-1?e.length:r,i=e.substring(t,s);if(!i||!i.includes("$"))return n[0]=0,n[1]=t,n[2]=t,n[3]=s,n[4]=s,n[5]=s,n;if(i==="$"){const o=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=o,n[4]=o,n[5]=o,n}if(i.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=s,n[4]=s,n[5]=s,n;const a=Dc(i);if(a){const[o,l]=a,c=i.charCodeAt(o+1);if(c===45){if(o+2!x.parse&&x.caseSensitive===P&&x.prefix===w&&x.suffix===C);if(T)g=T;else{const x=Ac(S,c,P,w,C);g=x,x.parent=s,x.depth=i;let O;S===1?O=s.dynamic??=[]:S===3?O=s.optional??=[]:O=s.wildcard??=[],O.push(x),O.length===2&&a?.push(O)}break}}s=g}if(p&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf("/")+1)===95){const _=Ke(c);_.kind=co,_.parent=s,i++,_.depth=i,s.pathless??=[],s.pathless.push(_),s=_}const m=(n.path||!n.children)&&!n.isRoot;if(m&&c.endsWith("/")){const _=Ke(c);_.kind=ye,_.parent=s,i++,_.depth=i,s.index=_,s=_}s.parse=p??null,s.priority=d?.params?.priority??0,m&&!s.route&&(s.route=n,s.fullPath=c)}if(n.children)for(const c of n.children)yn(e,t,c,l,s,i,a,o)}function uo(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function Ke(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,priority:0}}function Ac(e,t,n,r,s){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:s}}function Nc(e,t){const n=Ke("/"),r=new Uint16Array(6),s=[];for(const i of e)yn(!1,r,i,1,n,0,s);for(const i of s)i.sort(uo);t.masksTree=n,t.flatCache=ln(1e3)}function Uc(e,t){e||="/";const n=t.flatCache.get(e);if(n)return n;const r=Fr(e,t.masksTree);return t.flatCache.set(e,r),r}function Bc(e,t,n,r,s){e||="/",r||="/";const i=t?`case\0${e}`:e;let a=s.singleCache.get(i);return a||(a=Ke("/"),yn(t,new Uint16Array(6),{from:e},1,a,0),s.singleCache.set(i,a)),Fr(r,a,n)}function jc(e,t,n=!1){const r=n?e:`nofuzz\0${e}`,s=t.matchCache.get(r);if(s!==void 0)return s;e||="/";let i;try{i=Fr(e,t.segmentTree,n)}catch(a){if(a instanceof URIError)i=null;else throw a}return i&&(i.branch=fo(i.route)),t.matchCache.set(r,i),i}function Hc(e){return e==="/"?e:e.replace(/\/{1,}$/,"")}function qc(e,t=!1,n){const r=Ke(e.fullPath),s=new Uint16Array(6),i=[],a={},o={};let l=0;yn(t,s,e,1,r,0,i,c=>{if(n?.(c,l),c.id in a&&$r(),a[c.id]=c,l!==0&&c.path){const d=Hc(c.fullPath);(!o[d]||c.fullPath.endsWith("/"))&&(o[d]=c)}l++});for(const c of i)c.sort(uo);return{processedTree:{segmentTree:r,singleCache:ln(1e3),matchCache:ln(1e3),flatCache:null,masksTree:null},routesById:a,routesByPath:o}}function Fr(e,t,n=!1){const r=e.split("/"),s=Vc(e,r,t,n);if(!s)return null;const[i]=ho(e,r,s);return{route:s.node.route,rawParams:i}}function ho(e,t,n){const r=Wc(n.node);let s=null;const i=Object.create(null);let a=n.extract?.part??0,o=n.extract?.node??0,l=n.extract?.path??0,c=n.extract?.segment??0;for(;o=0;P--){const w=u.wildcard[P],{prefix:C,suffix:k}=w;if(!(C&&(S||!(w.caseSensitive?b:R??=b.toLowerCase()).startsWith(C)))){if(k){if(S)continue;const T=t.slice(h).join("/").slice(-k.length);if((w.caseSensitive?T:T.toLowerCase())!==k)continue}o.push({node:w,index:a,skipped:p,statics:m,dynamics:_,optionals:g,extract:v,rawParams:y})}}if(u.optional){const P=p|1<=0;w--){const C=u.optional[w];o.push({node:C,index:h,skipped:P,statics:m,dynamics:_,optionals:g,extract:v,rawParams:y})}if(!S)for(let w=u.optional.length-1;w>=0;w--){const C=u.optional[w],{prefix:k,suffix:T}=C;if(k||T){const x=C.caseSensitive?b:R??=b.toLowerCase();if(k&&!x.startsWith(k)||T&&!x.endsWith(T))continue}o.push({node:C,index:h+1,skipped:p,statics:m,dynamics:_,optionals:g+Bt(a,h),extract:v,rawParams:y})}}if(!S&&u.dynamic&&b)for(let P=u.dynamic.length-1;P>=0;P--){const w=u.dynamic[P],{prefix:C,suffix:k}=w;if(C||k){const T=w.caseSensitive?b:R??=b.toLowerCase();if(C&&!T.startsWith(C)||k&&!T.endsWith(k))continue}o.push({node:w,index:h+1,skipped:p,statics:m,dynamics:_+Bt(a,h),optionals:g,extract:v,rawParams:y})}if(!S&&u.staticInsensitive){const P=u.staticInsensitive.get(R??=b.toLowerCase());P&&o.push({node:P,index:h+1,skipped:p,statics:m+Bt(a,h),dynamics:_,optionals:g,extract:v,rawParams:y})}if(!S&&u.static){const P=u.static.get(b);P&&o.push({node:P,index:h+1,skipped:p,statics:m+Bt(a,h),dynamics:_,optionals:g,extract:v,rawParams:y})}if(u.pathless)for(let P=u.pathless.length-1;P>=0;P--){const w=u.pathless[P];o.push({node:w,index:h,skipped:p,statics:m,dynamics:_,optionals:g,extract:v,rawParams:y})}}if(c)return c;if(r&&l){let d=l.index;for(let h=0;he.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===ye)>(e.node.kind===ye)||t.node.kind===ye==(e.node.kind===ye)&&t.node.depth>e.node.depth))):!0}function Gt(e){return Dr(e.filter(t=>t!==void 0).join("/"))}function Dr(e){return e.replace(/\/{2,}/g,"/")}function po(e){return e==="/"?e:e.replace(/^\/{1,}/,"")}function ue(e){const t=e.length;return t>1&&e[t-1]==="/"?e.replace(/\/{1,}$/,""):e}function _o(e){return ue(po(e))}function un(e,t){return e?.endsWith("/")&&e!=="/"&&e!==`${t}/`?e.slice(0,-1):e}function Kc(e,t,n){return un(e,n)===un(t,n)}function zc({base:e,to:t,trailingSlash:n="never",cache:r}){const s=t===".",i=t.startsWith("/");let a;if(r){a=i?t:s?e:e+"\0"+t;const c=r.get(a);if(c)return c}let o;if(s)o=e.split("/");else if(i)o=t.split("/");else{for(o=e.split("/");o.length>1&&yt(o)==="";)o.pop();const c=t.split("/");for(let d=0,u=c.length;d1?o.pop():o=[""]:h==="."||o.push(h)}}o.length>1&&(yt(o)===""?n==="never"&&o.pop():n==="always"&&o.push(""));const l=Dr(o.join("/"))||"/";return a&&r&&r.set(a,l),l}function Gc(e){const t=new Map(e.map(s=>[encodeURIComponent(s),s])),n=Array.from(t.keys()).map(s=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),r=new RegExp(n,"g");return s=>s.replace(r,i=>t.get(i)??i)}function In(e,t,n){const r=t[e];return typeof r!="string"?r:e==="_splat"?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split("/").map(s=>Fs(s,n)).join("/"):Fs(r,n)}function $s({path:e,params:t,decoder:n,...r}){let s=!1;const i=Object.create(null);if(!e||e==="/")return{interpolatedPath:"/",usedParams:i,isMissingParams:s};if(!e.includes("$"))return{interpolatedPath:e,usedParams:i,isMissingParams:s};const a=e.length;let o=0,l,c="";for(;oe.state.__TSR_key||e.href;function tl(e){const t=e.getAttribute(Ds);if(t)return`[${Ds}="${t}"]`;let n="",r=e,s;for(;s=r.parentNode;){let i=1,a=r;for(;a=a.previousElementSibling;)i++;const o=`${r.localName}:nth-child(${i})`;n=n?`${o} > ${n}`:o,r=s}return n}let Ht=!1;const Jt="window";function er(e){try{return typeof e=="function"?e():document.querySelector(e)}catch{}}function As(e){const t=new Set;for(const n of e){if(n===Jt)continue;const r=er(n);r&&t.add(r)}return t}function nl(e,t){const n=e.options.scrollRestoration,r=e._scroll;n&&(r.restoring=!0);const s=e.options.getScrollRestorationKey||el,i=new Set,a=o=>{const l=qe[o]||={};for(const c of i)c===document?l[Jt]={scrollX,scrollY}:c.isConnected&&(l[tl(c)]={scrollX:c.scrollLeft,scrollY:c.scrollTop})};n&&!r.restoration&&(r.restoration=!0,Ht=!1,history.scrollRestoration="manual",document.addEventListener("scroll",o=>{Ht||i.add(o.target)},!0),e.subscribe("onBeforeLoad",o=>{o.fromLocation&&a(s(o.fromLocation)),i.clear()}),addEventListener("pagehide",()=>{a(s(e.stores.resolvedLocation.get()??e.stores.location.get())),Zc()})),!r.reset&&(r.reset=!0,e.subscribe("onRendered",o=>{const l=e.options.scrollRestorationBehavior,c=e.options.scrollToTopSelectors,d=r.next,u=r.hash;let h;if(i.clear(),r.next=!0,r.hash=!1,typeof e.options.scrollRestoration=="function"&&!e.options.scrollRestoration({location:e.latestLocation}))return;const p=s(o.toLocation),m=o.fromLocation&&s(o.fromLocation);if(r.restoring&&m&&m!==p){const _=qe[m];if(_){let g=qe[p];for(const v in _){if(v===Jt){if(d)continue}else{const y=er(v);if(!y||d&&c&&(h??=As(c),h.has(y)))continue}g||(g=qe[p]={}),g[v]??=_[v]}}}Ht=!0;try{const _=o.toLocation.hash,g=o.toLocation.state.__hashScrollIntoViewOptions??!0;let v=!1;if(d){!_&&c&&(h??=As(c));const y=_&&g&&u,S=r.restoring?qe[p]:void 0;if(S)for(const b in S){const{scrollX:R,scrollY:P}=S[b];if(b===Jt){if(y)continue;scrollTo({top:P,left:R,behavior:l}),v=!0}else{const w=er(b);w&&(w.scrollLeft=R,w.scrollTop=P,h?.delete(w))}}if(!_){const b={top:0,left:0,behavior:l};if(v||scrollTo(b),h)for(const R of h)R.scrollTo(b)}}!v&&_&&g&&document.getElementById(_)?.scrollIntoView(g)}finally{Ht=!1}}))}function rl(e,t=String){const n=new URLSearchParams;for(const r in e){const s=e[r];s!==void 0&&n.set(r,t(s))}return n.toString()}function Ln(e){return e?e==="false"?!1:e==="true"?!0:+e*0===0&&+e+""===e?+e:e:""}function sl(e){const t=new URLSearchParams(e),n=Object.create(null);for(const[r,s]of t.entries()){const i=n[r];i==null?n[r]=Ln(s):Array.isArray(i)?i.push(Ln(s)):n[r]=[i,Ln(s)]}return n}const il=/^(?:\s|["[{\d-]|fa|nu|tr)/,ol=cl(JSON.parse),al=ll(JSON.stringify,JSON.parse);function cl(e){return t=>{t[0]==="?"&&(t=t.substring(1));const n=sl(t);for(const r in n){const s=n[r];if(typeof s=="string")try{n[r]=e(s)}catch{}}return n}}function ll(e,t){const n=t===JSON.parse;function r(s){if(s&&typeof s=="object")try{return e(s)}catch{}else if(t&&typeof s=="string"){if(n&&!il.test(s))return s;try{return t(s),e(s)}catch{}}return s}return s=>{const i=rl(s,r);return i?`?${i}`:""}}const ze="__root__";function ul(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&!e.reloadDocument&&typeof e.href=="string")try{new URL(e.href),e.reloadDocument=!0}catch{}const t=new Headers(e.headers);e.href&&t.get("Location")===null&&t.set("Location",e.href);const n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function Ar(e){return e instanceof Response&&!!e.options}function hl(e){return{input:({url:t})=>{for(const n of e)t=tr(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=go(e[n],t);return t}}}function dl(e){const t=_o(e.basepath),n=`/${t}`,r=e.caseSensitive?n:n.toLowerCase(),s=`${r}/`;return{input:({url:i})=>{const a=e.caseSensitive?i.pathname:i.pathname.toLowerCase();return a===r?i.pathname="/":a.startsWith(s)&&(i.pathname=i.pathname.slice(n.length)),i},output:({url:i})=>(i.pathname=Gt(["/",t,i.pathname]),i)}}function tr(e,t){const n=e?.input?.({url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function go(e,t){const n=e?.output?.({url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function fl(e,t){const{createMutableStore:n,createReadonlyStore:r,batch:s}=t,i=new Map,a=n("idle"),o=n(e),l=n(void 0),c=n([]),d=r(()=>c.get().map(_=>i.get(_).get())),u=r(()=>({status:a.get(),isLoading:a.get()==="pending",matches:d.get(),location:o.get(),resolvedLocation:l.get()}));function h(_){let g=i.get(_);return g||(g=n(void 0),i.set(_,g)),g}const p={status:a,location:o,resolvedLocation:l,ids:c,matches:d,byRoute:i,__store:u,getMatchStore:h,setMatches:m};function m(_){const g=c.get(),v=_.map(y=>y.routeId);s(()=>{Fc(g,v)||c.set(v);for(const y of g)v.includes(y)||i.get(y).set(()=>{});for(const y of _){const S=h(y.routeId);S.get()!==y&&S.set(y)}})}return p}var Se="__TSR_index",Ns="popstate",Us="beforeunload";function pl(e){let t=e.getLocation();const n=new Set,r=a=>{t=e.getLocation(),n.forEach(o=>o({location:t,action:a}))},s=a=>{e.notifyOnIndexChange??!0?r(a):t=e.getLocation()},i=async({task:a,navigateOpts:o,...l})=>{if(o?.ignoreBlocker??!1){a();return}const c=e.getBlockers?.()??[],d=l.type==="PUSH"||l.type==="REPLACE";if(typeof document<"u"&&c.length&&d)for(const u of c){const h=vt(l.path,l.state);if(await u.blockerFn({currentLocation:t,nextLocation:h,action:l.type})){e.onBlocked?.();return}}a()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:a=>(n.add(a),()=>{n.delete(a)}),push:(a,o,l)=>{const c=t.state[Se];o=Bs(c+1,o),i({task:()=>{e.pushState(a,o),r({type:"PUSH"})},navigateOpts:l,type:"PUSH",path:a,state:o})},replace:(a,o,l)=>{const c=t.state[Se];o=Bs(c,o),i({task:()=>{e.replaceState(a,o),r({type:"REPLACE"})},navigateOpts:l,type:"REPLACE",path:a,state:o})},go:(a,o)=>{i({task:()=>{e.go(a),s({type:"GO",index:a})},navigateOpts:o,type:"GO"})},back:a=>{i({task:()=>{e.back(a?.ignoreBlocker??!1),s({type:"BACK"})},navigateOpts:a,type:"BACK"})},forward:a=>{i({task:()=>{e.forward(a?.ignoreBlocker??!1),s({type:"FORWARD"})},navigateOpts:a,type:"FORWARD"})},canGoBack:()=>t.state[Se]!==0,createHref:a=>e.createHref(a),block:a=>{if(!e.setBlockers)return()=>{};const o=e.getBlockers?.()??[];return e.setBlockers([...o,a]),()=>{const l=e.getBlockers?.()??[];e.setBlockers?.(l.filter(c=>c!==a))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}function Bs(e,t){t||(t={});const n=Nr();return{...t,key:n,__TSR_key:n,[Se]:e}}function yo(e){const t=e?.window??(typeof document<"u"?window:void 0),n=t.history.pushState,r=t.history.replaceState;let s=[];const i=()=>s,a=w=>s=w,o=e?.createHref??(w=>w),l=e?.parseLocation??(()=>vt(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){const w=Nr();t.history.replaceState({[Se]:0,key:w,__TSR_key:w},"")}let c=l(),d,u=!1,h=!1,p=!1,m=!1;const _=()=>c;let g;const v=()=>{g&&(P._ignoreSubscribers=!0,(g[2]?t.history.pushState:t.history.replaceState)(g[1],"",g[0]),P._ignoreSubscribers=!1,g=void 0,d=void 0)},y=(w,C,k)=>{const T=o(C),x=!!g;x||(d=c),c=vt(C,k),g=[T,k,g?.[2]||w],x||queueMicrotask(()=>v())},S=w=>{c=l(),P.notify({type:w})},b=async()=>{if(h){h=!1;return}const w=l(),C=w.state[Se]-c.state[Se],k=C===1,T=C===-1,x=!k&&!T||u;u=!1;const O=x?"GO":T?"BACK":"FORWARD",$=x?{type:"GO",index:C}:{type:T?"BACK":"FORWARD"};if(p)p=!1;else{const ot=i();if(typeof document<"u"&&ot.length){for(const se of ot)if(await se.blockerFn({currentLocation:c,nextLocation:w,action:O})){h=!0,t.history.go(1),P.notify($);return}}}c=l(),P.notify($)},R=w=>{if(m){m=!1;return}let C=!1;const k=i();if(typeof document<"u"&&k.length)for(const T of k){const x=T.enableBeforeUnload??!0;if(x===!0){C=!0;break}if(typeof x=="function"&&x()===!0){C=!0;break}}if(C)return w.preventDefault(),w.returnValue=""},P=pl({getLocation:_,getLength:()=>t.history.length,pushState:(w,C)=>y(!0,w,C),replaceState:(w,C)=>y(!1,w,C),back:w=>(w&&(p=!0),m=!0,t.history.back()),forward:w=>{w&&(p=!0),m=!0,t.history.forward()},go:w=>{u=!0,t.history.go(w)},createHref:w=>o(w),flush:v,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(Us,R,{capture:!0}),t.removeEventListener(Ns,b)},onBlocked:()=>{d&&c!==d&&(c=d)},getBlockers:i,setBlockers:a,notifyOnIndexChange:!1});return t.addEventListener(Us,R,{capture:!0}),t.addEventListener(Ns,b),t.history.pushState=function(...w){const C=n.apply(t.history,w);return P._ignoreSubscribers||S("PUSH"),C},t.history.replaceState=function(...w){const C=r.apply(t.history,w);return P._ignoreSubscribers||S("REPLACE"),C},P}function _l(e){const t=typeof document<"u"?window:void 0;return yo({window:t,parseLocation:()=>{const n=t.location.hash.split("#").slice(1),r=n[0]??"/",s=t.location.search,i=n.slice(1);return vt(`${r}${s}${i.length===0?"":`#${i.join("#")}`}`,t.history.state)},createHref:n=>`${t.location.pathname}${t.location.search}#${n}`})}function ml(e){let t=e.replace(/[\x00-\x1f\x7f]/g,"");return t.startsWith("//")&&(t="/"+t.replace(/^\/+/,"")),t}function vt(e,t){const n=ml(e),r=n.indexOf("#"),s=n.indexOf("?"),i=Nr();return{href:n,pathname:n.substring(0,r>0?s>0?Math.min(r,s):r:s>0?s:n.length),hash:r>-1?n.substring(r):"",search:s>-1?n.slice(s,r===-1?void 0:r):"",state:t||{[Se]:0,key:i,__TSR_key:i}}}function Nr(){return(Math.random()+1).toString(36).substring(7)}function js(e){return e.options.loader||e.options.beforeLoad||e.lazyFn||e.options.component?.preload||e.options.pendingComponent?.preload}function vn(e,t){return{fromLocation:t,toLocation:e,pathChanged:t?.pathname!==e.pathname,hrefChanged:t?.href!==e.href,hashChanged:t?.hash!==e.hash}}function Hs({key:e,__TSR_key:t,__TSR_index:n,__hashScrollIntoViewOptions:r,...s}){return s}function gl(e,t,n,r){for(const s of t){if(r?.()===!1)return;n.some(i=>i.routeId===s.routeId)||e.routesById[s.routeId].options.onLeave?.(s)}for(const s of n){if(r?.()===!1)return;e.routesById[s.routeId].options[t.some(i=>i.routeId===s.routeId)?"onStay":"onEnter"]?.(s)}}var yl=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={next:!0},this.subscribers=new Set,this._cache=new Map,this._committed=[],this.routeBranchCache=new WeakMap,this.lightweightCache=new WeakMap,this.startTransition=async n=>(n(),!1),this.update=n=>{const r=this.options,s=this.basepath??r?.basepath??"/",i=this.basepath===void 0,a=r?.rewrite;if(this.options={...r,...n},this.isServer=this.options.isServer??Rc??typeof document>"u",this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=Gc(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=yo()),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 c;this.resolvePathCache=ln(1e3),c=this.buildRouteTree(),this.setRoutes(c)}if(!this.stores&&this.latestLocation){const c=this.getStoreConfig(this);this.batch=c.batch,this.stores=fl(this.latestLocation,c),nl(this)}const o=this.options.basepath??"/",l=this.options.rewrite;if(i||s!==o||a!==l){this.basepath=o;const c=[],d=_o(o);d&&d!=="/"&&c.push(dl({basepath:o})),l&&c.push(l),this.rewrite=c.length===0?void 0:c.length===1?c[0]:hl(c),this.history&&this.updateLatestLocation(),this.stores&&this.stores.location.set(this.latestLocation)}},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{const n=qc(this.routeTree,this.options.caseSensitive,(r,s)=>{r.init({originalIndex:s})});return this.options.routeMasks&&Nc(this.options.routeMasks,n.processedTree),n},this.subscribe=(n,r)=>{const s={eventType:n,fn:r};return this.subscribers.add(s),()=>{this.subscribers.delete(s)}},this.emit=n=>{for(const r of this.subscribers)if(r.eventType===n.type)try{r.fn(n)}catch(s){console.error(s)}},this.parseLocation=(n,r)=>{const s=({pathname:l,search:c,hash:d,href:u,state:h})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(l)){const v=this.options.parseSearch(c),y=this.options.stringifySearch(v);return{href:l+y+d,publicHref:l+y+d,pathname:ct(l).path,external:!1,searchStr:y,search:ke(r?.search,v),hash:ct(d.slice(1)).path,state:Ie(r?.state,h)}}const p=new URL(u,this.origin),m=tr(this.rewrite,p),_=this.options.parseSearch(m.search),g=this.options.stringifySearch(_);return m.search=g,{href:m.href.replace(m.origin,""),publicHref:u,pathname:ct(m.pathname).path,external:!!this.rewrite&&m.origin!==this.origin,searchStr:g,search:ke(r?.search,_),hash:ct(m.hash.slice(1)).path,state:Ie(r?.state,h)}},i=s(n),{__tempLocation:a,__tempKey:o}=i.state;if(a&&(!o||o===this.tempLocationKey)){const l=s(a);return l.state.key=i.state.key,l.state.__TSR_key=i.state.__TSR_key,delete l.state.__tempLocation,{...l,maskedLocation:i}}return i},this.resolvePathWithBase=(n,r)=>zc({base:n,to:r.includes("//")?Dr(r):r,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(n,r,s)=>typeof n=="string"?this.matchRoutesInternal({pathname:n,search:r},s):this.matchRoutesInternal(n,r),this.getMatchedRoutes=n=>{const r=Object.create(null),s=jc(ue(n),this.processedTree,!0);return s&&Object.assign(r,s.rawParams),[s?.branch||[this.routesById.__root__],r,s?.route]},this.buildLocation=n=>{const r=(i={})=>{const a=i._fromLocation||this._pendingLocation||this.latestLocation,o=this.matchRoutesLightweight(a);i.from;const l=i.unsafeRelative==="path"?a.pathname:i.from??o[1],c=i.to?`${i.to}`:void 0,d=o[2],u=Object.assign(Object.create(null),o[3]),h=c?.charCodeAt(0)===47?"/":this.resolvePathWithBase(l,"."),p=c?this.resolvePathWithBase(h,c):h,m=qs(i.params,u),_=this.routesByPath[ue(p)];let g;if(_)g=this.getRouteBranch(_);else if(p.includes("$"))g=[];else{const[x,O,$]=this.getMatchedRoutes(p);g=x,this.options.notFoundRoute&&(!$||$.path!=="/"&&O["**"])&&(g=[...g,this.options.notFoundRoute])}if(g.length&&ao(m))for(const x of g){const O=x.options.params?.stringify??x.options.stringifyParams;if(O)try{Object.assign(m,O(m))}catch{}}const v=n.leaveParams?p:ct($s({path:p,params:m,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path;let y=d;if(n._includeValidateSearch&&this.options.search?.strict){const x={};g.forEach(O=>{if(O.options.validateSearch)try{Object.assign(x,Yt(O.options.validateSearch,{...x,...y}))}catch{}}),y=x}y=bl(y,i,g,n._includeValidateSearch),y=ke(d,y);const S=this.options.stringifySearch(y),b=i.hash===!0?a.hash:i.hash?tt(i.hash,a.hash):void 0,R=b?`#${b}`:"";let P=i.state===!0?a.state:i.state?tt(i.state,a.state):{};P=Ie(a.state,P);const w=`${v}${S}${R}`;let C,k,T=!1;if(this.rewrite){const x=new URL(w,this.origin),O=go(this.rewrite,x);C=x.href.replace(x.origin,""),O.origin!==this.origin?(k=O.href,T=!0):k=O.pathname+O.search+O.hash}else C=$c(w),k=C;return{publicHref:k,href:C,pathname:v,search:y,searchStr:S,state:P,hash:b??"",external:T,unmaskOnReload:i.unmaskOnReload}},s=(i={},a)=>{const o=r(i);let l=a?r(a):void 0;if(!l){const c=Object.create(null);if(this.options.routeMasks){const d=Uc(o.pathname,this.processedTree);if(d){Object.assign(c,d.rawParams);const{from:u,params:h,...p}=d.route,m=qs(h,c);a={from:n.from,...p,params:m},l=r(a)}}}return l&&(o.maskedLocation=l),o};return n.mask?s(n,{from:n.from,...n.mask}):s(n)},this.commitLocation=async({viewTransition:n,ignoreBlocker:r,...s})=>{let i;const a=ue(this.latestLocation.href)===ue(s.href)&&we(Hs(s.state),Hs(this.latestLocation.state)),o=this._commitPromise;let l;const c=new Promise(d=>{l=d});if(c.resolve=()=>{l(),o?.resolve()},this._commitPromise=c,a)this.load();else{let{maskedLocation:d,hashScrollIntoView:u,...h}=s;d&&(h={...d,state:{...d.state,__tempKey:void 0,__tempLocation:{...h,search:h.searchStr,state:{...h.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(h.unmaskOnReload??this.options.unmaskOnReload??!1)&&(h.state.__tempKey=this.tempLocationKey)),h.state.__hashScrollIntoViewOptions=u??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=n,i=s.replace?"REPLACE":"PUSH",this.history[i==="REPLACE"?"replace":"push"](h.publicHref,h.state,{ignoreBlocker:r}),this.history.subscribers.size||this.load({action:{type:i}})}return this._scroll.next=s.resetScroll??!0,this._commitPromise},this.buildAndCommitLocation=({replace:n,resetScroll:r,hashScrollIntoView:s,viewTransition:i,ignoreBlocker:a,_redirects:o,href:l,...c}={})=>{if(l){const h=this.history.location.state.__TSR_index,p=vt(l,{__TSR_index:n?h:h+1}),m=new URL(p.pathname,this.origin);c.to=tr(this.rewrite,m).pathname,c.search=this.options.parseSearch(p.search),c.hash=p.hash.slice(1)}const d=this.buildLocation({...c,_includeValidateSearch:!0});o&&(d._redirects=o),this._pendingLocation=d;const u=this.commitLocation({...d,viewTransition:i,replace:n,resetScroll:r,hashScrollIntoView:s,ignoreBlocker:a});return queueMicrotask(()=>{this._pendingLocation===d&&(this._pendingLocation=void 0)}),u},this.navigate=async({to:n,reloadDocument:r,href:s,publicHref:i,...a})=>{let o=!1;if(s)try{new URL(`${s}`),o=!0}catch{}if(o&&!r&&(r=!0),r){if(n!==void 0||!s){const c=this.buildLocation({to:n,...a});s=s??c.publicHref,i=i??c.publicHref}const l=!o&&i?i:s;if(cn(l,this.protocolAllowlist))return;if(!a.ignoreBlocker){const c=this.history.getBlockers?.()??[];for(const d of c)if(d?.blockerFn&&await d.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:"PUSH"}))return}a.replace?window.location.replace(l):window.location.href=l;return}return this.buildAndCommitLocation({...a,href:s,to:n,_isNavigate:!0})},this.load=async n=>{this.updateLatestLocation(),n?.action&&(this._scroll.hash=n.action.type==="PUSH"||n.action.type==="REPLACE"),await El(this,n)},this.startViewTransition=n=>{const r=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,r&&typeof document.startViewTransition=="function"){let s;if(typeof r=="object"&&window.CSS?.supports?.("selector(:active-view-transition-type(a))")){const i=this.latestLocation,a=this.stores.resolvedLocation.get(),o=typeof r.types=="function"?r.types(vn(i,a)):r.types;if(o===!1)return n();s={update:n,types:o}}else s=n;return document.startViewTransition(s).updateCallbackDone}return n()},this.invalidate=n=>{const r=this._committed,s=n?.filter,i=this._preloads,a=new Set([...r,...this._cache.values(),...[...i?.values()??[]].flat(),...this._tx?.[3]??[]].filter(c=>!s||s(c)).map(c=>c.id)),o=[];for(const[c,d]of i??[])d.some(u=>a.has(u.id))&&(i.delete(c),o.push(c));const l=c=>{if(a.has(c.id)){const d=this.routesById[c.routeId],u={...c,invalid:!0,...(n?.forcePending||c.status==="error"||c.status==="notFound")&&js(d)?{status:"pending",error:void 0}:void 0};return c._flight=void 0,u}return c};this._committed=r.map(l);for(const[c,d]of this._cache)a.has(c)&&(d.invalid=!0,n?.forcePending&&(d.status="pending"));for(const c of a)this._flights?.delete(c);for(const c of o)c.abort();return this.shouldViewTransition=!1,this.load({sync:n?.sync})},this.resolveRedirect=n=>{const r=n.headers.get("Location");if(!n.options.href||n.options._builtLocation){const s=(n.options._builtLocation??this.buildLocation(n.options)).publicHref||"/";n.options.href=s,n.headers.set("Location",s)}else if(r)try{const s=new URL(r);if(this.origin&&s.origin===this.origin){const i=s.pathname+s.search+s.hash;n.options.href=i,n.headers.set("Location",i)}}catch{}if(n.options.href&&!n.options._builtLocation&&cn(n.options.href,this.protocolAllowlist))throw new Error("Redirect blocked: unsafe protocol");return n.headers.get("Location")||n.headers.set("Location",n.options.href),n},this.clearCache=n=>{const r=this._cache,s=this._preloads,i=n?.filter,a=[],o=[];for(const[c,d]of r)(!i||i(d))&&(o.push(c),a.push(d));const l=[];for(const[c,d]of s??[])(!i||d.some(i))&&(l.push(c),a.push(...d));for(const c of o)r.delete(c);for(const c of l)s.delete(c);for(const c of a){const d=c._flight;c._flight=void 0,d&&!--d[2]&&(this._flights?.get(c.id)===d&&this._flights.delete(c.id),l.push(d[1]))}for(const c of l)c.abort()},this.loadRouteChunk=Ge,this.preloadRoute=n=>Eo(this,n),this.matchRoute=(n,r)=>{const s={...n,to:n.to?this.resolvePathWithBase(n.from||"",n.to):void 0,params:n.params||{},leaveParams:!0},i=this.buildLocation(s),a=this.stores.status.get()==="pending";if(r?.pending&&!a)return!1;const o=r?.pending??!a?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),l=Bc(i.pathname,r?.caseSensitive??!1,r?.fuzzy??!1,o.pathname,this.processedTree);return!l||n.params&&!we(l.rawParams,n.params,{partial:!0})?!1:r?.includeSearch??!0?we(o.search,i.search,{partial:!0})?l.rawParams:!1:l.rawParams},this.getStoreConfig=t,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??"fuzzy",stringifySearch:e.stringifySearch??al,parseSearch:e.parseSearch??ol,protocolAllowlist:e.protocolAllowlist??Mc}),self.__TSR_ROUTER__=this}isShell(){return!!this.options.isShell}get state(){return this.stores.__store.get()}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;const r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}getRouteBranch(e){let t=this.routeBranchCache.get(e);return t||(t=fo(e),this.routeBranchCache.set(e,t)),t}matchRoutesInternal(e,t){const[n,r,s]=this.getMatchedRoutes(e.pathname);let i=n,a=!1;(s?s.path!=="/"&&r["**"]:ue(e.pathname))&&(this.options.notFoundRoute?i=[...i,this.options.notFoundRoute]:a=!0);const o=a?wl(this.options.notFoundMode,i):void 0,l=new Array(i.length),c=this._committed,d=(h,p)=>{const m=c[p];return m?.routeId===h.id?m:h===this.options.notFoundRoute?c.find(_=>_.routeId===h.id):void 0};let u;for(let h=0;h{const h=u(o.preSearchFilters?o.preSearchFilters.reduce((p,m)=>m(p),d):d);return o.postSearchFilters?o.postSearchFilters.reduce((p,m)=>m(p),h):h};s.push(c)}const l=o.validateSearch;if(l){const c=({search:d,next:u,meta:h})=>{const p=u(d);if(r)try{const m=Yt(l,p);if(h&&m)for(const _ in m)_ in p||(h.defaulted||=new Map).set(_,m[_]);return{...p,...m}}catch{}return p};s.push(c)}}const i=(a,o,l)=>{if(a>=s.length){if(!t.search)return{};if(t.search===!0)return o;const d=tt(t.search,o);return l&&(l.explicit=d),d}const c=(d,u)=>{if(u){const h=l||{};return{search:i(a+1,d,h),meta:h}}return i(a+1,d,l)};return s[a]({search:o,next:c,meta:l})};return i(0,e)}function wl(e,t){if(e!=="root"){let n;for(let r=t.length-1;r>=0;r--){const s=t[r];if(s.options.notFoundComponent)return s.id;n||=s.children&&s.id}if(n)return n}return ze}function qs(e,t){return e===!1||e===null?Object.create(null):(e??!0)===!0?t:Object.assign(t,tt(e,t))}function Ws(e,t){const n=e.options.params?.parse??e.options.parseParams;n&&Object.assign(t,n(t))}function nr(e,t){return e.options[t]?.preload?.()}function Sl(e,t){const n=nr(e,"component"),r=nr(e,"pendingComponent"),s=t&&r?r.then(t):r;return t&&!r&&t(),n&&s?Promise.all([n,s]).then(()=>{}):n??s}function Ge(e,t,n){const r=()=>t===!1?void 0:t?nr(e,t):Sl(e,n),s=e._lazy;if(s)return s===!0?r():s.then(r);if(!e.lazyFn)return r();const i=e.lazyFn().then(a=>{{const{id:o,...l}=a.options;Object.assign(e.options,l),e._lazy=!0}},a=>{throw e._lazy=void 0,a});return e._lazy=i,i.then(r)}function vo(e){const t=e.findIndex(n=>n.status!=="success"||n._notFound)+1;return t&&t{const s=()=>r(t);t.addEventListener("abort",s,{once:!0}),Promise.resolve(e).then(n,r).finally(()=>t.removeEventListener("abort",s))})}function Ne(e,t){return e.routesById[t.routeId]}function wt(e,t,n){return Ar(e)?[X,e]:Me(e)?(e.routeId||=n,[bn,e]):(t&&typeof e?.then=="function"&&(e=new Error("A Promise was thrown",{cause:e})),t?[Pe,e]:[ce,e])}function bo(e,t){let n=wt(t,!0,e.id);if(n[0]!==Pe)return n;try{e.options.onError?.(n[1])}catch(r){n=wt(r,!0,e.id)}return n}function pt(e,t,n){return n[0].signal.aborted||!n[2]()?(n[0].abort(),[$e]):bo(e,t)}function wo(e,t){return n=>e.navigate({...n,_fromLocation:t})}async function Pl(e,t,n,r,s,i){const[a,o]=t,l=n[0].signal,c=!!n[4];for(let d=n[7]??0;d=i&&(u.status="pending"),n[8]?.();try{St(e,u,"beforeLoad",n[0]);const b=await Ce(v(y),l);if(!n[2]())return n[0].abort(),[d,[$e]];const R=wt(b,!1,h.id);if(R[0]!==ce)return he(e,u),[d,R];u.context={..._,...b}}catch(b){return he(e,u),[d,pt(h,b,n)]}finally{S==="success"&&u.status==="pending"&&(u.status="success"),St(e,u,!1,n[0])}}s()}function Ur(e,t,n){if(!(!n||--n[2])){if(e._flights?.get(t.id)===n){const r=e._tx;if(r&&!r[0].signal.aborted&&!r[3].includes(t)&&r[3].some(s=>s.id===t.id)&&r[3].some(s=>s.isFetching==="beforeLoad"))return;e._flights.delete(t.id)}return n[1]}}function he(e,t){const n=t._flight;t._flight=void 0,Ur(e,t,n)?.abort()}function K(e,t,n,r){const s=[];for(const i of t)if(!n?.includes(i)){const a=i._flight;if(i._flight=void 0,r&&a?.[2]===1&&e._flights?.get(i.id)===a&&n?.some(o=>o.id===i.id))a[2]=0;else{const o=Ur(e,i,a);o&&s.push(o)}}for(const i of s)i.abort()}function Br(e){for(const t of e){const n=t._flight;n&&n[2]++}}function St(e,t,n,r){if(t.isFetching=n,r&&e._tx?.[0]!==r)return;const s=e.stores.byRoute.get(t.routeId),i=s?.get();i?.id===t.id&&s.set({...i,isFetching:n})}function So(e,t,n,r,s,i,a){const o=t[0];return{params:n.params,location:o,navigate:wo(e,o),cause:a?"preload":n.cause,abortController:s,preload:a,deps:n.loaderDeps,parentMatchPromise:i,context:n.context,route:r,...e.options.additionalContext}}async function Vs(e,t,n,r,s,i,a,o){const l=o.signal;if(l.aborted)return[$e];if(!s)return[ce,void 0];let c=n._flight;St(e,n,"loader",o);try{if(!c){const d=new AbortController;c=[Promise.resolve().then(()=>s(So(e,t,n,r,d,i,a))).then(u=>wt(u,!1,r.id),u=>wt(u,!0,r.id)).then(u=>(u[0]!==ce&&e._flights?.get(n.id)===c&&(e._flights.delete(n.id),c[2]||d.abort()),u[0]===Pe&&c[2]?bo(r,u[1]):u)),d,1],(e._flights??=new Map).set(n.id,c)}return n._flight=c,n.abortController=c[1],await Ce(c[0],l)}catch(d){if(d!==l)throw d;return he(e,n),[$e]}finally{St(e,n,!1,o)}}function Qs(e,t,n){t[0]===ce?(e.loaderData=t[1],e.error=void 0,e.status="success",e.invalid=!1,e.updatedAt=Date.now(),e.preload=n):t[0]!==X&&(e.status="success",e.error=void 0,e.invalid=!0)}function Cl(e,t,n){const r=e._cache.get(t.id);if(r!==n||e._committed.some(i=>i.id===t.id&&i._flight===t._flight))return;const s={...t,_notFound:void 0,context:{}};s._flight&&s._flight[2]++,e._cache.set(t.id,s),r&&he(e,r)}function Ks(e,t){return t[0]===Pe||t[0]===bn?{...e,status:t[0]===Pe?"error":"notFound",error:t[1],_flight:void 0}:e}function Rl(e,t,n,r,s,i,a){const o=t[1][n],l=Ne(e,o),c=!!i[4],d=c?e._cache.get(o.id):void 0;let u,h=!1,p;try{if(o.status==="success"&&(u=l.options.shouldReload,typeof u=="function"&&(u=u(So(e,t,o,l,i[0],s,c))),i[2]()||(i[0].abort(),p=[$e])),!p)if(o.status!=="success")h=!0;else{const k=i[4]||o.preload?l.options.preloadStaleTime??e.options.defaultPreloadStaleTime??3e4:l.options.staleTime??e.options.defaultStaleTime??0;h=!!(o.invalid||u||u===void 0&&Date.now()-o.updatedAt>=k&&(i[6]||o.cause==="enter"||i[3].some(T=>T.routeId===o.routeId&&T.id!==o.id)))}}catch(k){o.invalid=!0,he(e,o),p=pt(l,k,i)}const m=l.options.loader,_=typeof m=="function"?m:m?.handler;let g=(!c||l.options.preload!==!1)&&m?e._flights?.get(o.id):void 0;g===o._flight||p?g=void 0:g&&!h&&!c&&u===void 0?h=!0:h||(g=void 0);const v=!!(m&&h&&o.status==="success"&&!c&&!i[5]&&((typeof m=="function"?void 0:m?.staleReloadMode)??e.options.defaultStaleReloadMode)!=="blocking"),y=h&&(!c||l.options.preload!==!1),S=y&&!v&&(o.status!=="success"||!!m),b=l.lazyFn&&l._lazy!==!0?i[8]:void 0;if(y&&!m&&(o.invalid=!1,o.updatedAt=Date.now()),g&&g[2]++,S){const k=o._flight;o._flight=g,Ur(e,o,k)?.abort(),o.status==="success"&&n>=a&&(o.status="pending"),i[8]?.()}y||(o.isFetching=!1);const R=(p?Promise.resolve(p):S?Vs(e,t,o,l,_,s,c,i[0]):Promise.resolve([ce,o.loaderData])).then(k=>(S&&(Qs(o,k,c),k[0]===ce&&(c&&m&&!i[0].signal.aborted&&Cl(e,o,d),o.status="pending")),k)),P=Ce(Promise.resolve().then(()=>Ge(l,void 0,b)),i[0].signal).then(()=>{},k=>[n,pt(l,k,i)]).then(k=>R.then(T=>(S&&!k&&T[0]===ce&&o.status==="pending"&&i[2]()&&(o.status="success",i[8]?.()),k)));if(r.push([n,R,P]),!v)return R.then(k=>Ks(o,k));const w={...o,status:"pending",preload:!1,_flight:g};o.invalid=!1,o.isFetching="loader";const C=Vs(e,t,w,l,_,s,!1,i[0]).then(k=>(o.isFetching=!1,Qs(w,k,!1),k));return(t[2]??=[]).push([n,C,P,w]),C.then(k=>Ks(w,k))}async function rr(e,t,n,r,s=0){const i=n?.[1][1];let a=i?.routeId?t.findIndex(o=>o.routeId===i.routeId):n?.[0]??t.length-1;a<0&&(a=0);for(let o=a;o>=0;o--){const l=Ne(e,t[o]),c=Ge(l,!1);if(c)try{await Ce(c,r)}catch(d){if(d===r)throw d}if(l.options.notFoundComponent)return o}return i?.routeId?a:s}function Je(e,t){t[2]&&(K(e,t[2].map(n=>n[3])),t[2]=void 0)}async function zs(e,t,n,r){let s;try{await Promise.all(e.map(i=>i[1].then(async a=>{const o=i[0];if(!(r&&o>=await r)){if(a[0]>=X)throw[o,a];!s&&a[0]!==ce&&(s=[o,a],await Promise.all((n??[]).map(l=>{if(!(l[0]<=o))return l[1].then(c=>{if(c[0]===X)throw[l[0],c]})})))}})))}catch(i){return i}return t??s}async function Po(e,t,n,r,s,i,a){const o=t[1];let l=await i,c=!1;const d=o.findIndex(m=>m._notFound),u=m=>m[1][0]===bn?rr(e,o,m,r.signal):m[0];let h=d<0?o.length:d;if((l?.[1][0]??0)>=X)h=0;else if(l){h=l[2]??=await u(l);for(const m of n){if(m[0]>=h)break;const _=await m[1];if(_[0]!==ce&&_[0]=h)break;const _=await m[2];if(_){l=_;break}}if((l?.[1][0]??0)>=X){const m=l[1];if(m[0]!==X||m[1].options.reloadDocument||s<20)return Je(e,t),m;c=!0,l=[0,[Pe,new Error("Too many redirects")]]}const p=l?l[2]??await u(l):d;if(p>=0){const m=l?.[1],_=m?.[0],g=o[p],v=m?.[1],y=()=>{m&&(g._notFound=void 0,_===Pe?g.status="error":(v.routeId=g.routeId,g.routeId===e.routeTree.id?(g.status="success",g._notFound=!0):g.status="notFound"),g.error=v,g.isFetching=!1)};y();const S=Ne(e,g);try{await Ce(m?Promise.resolve().then(()=>Ge(S,_===Pe?"errorComponent":"notFoundComponent")):Promise.all([Ge(S),Ge(S,"notFoundComponent")]),r.signal)}catch(b){if(b===r.signal)return Je(e,t),[$e]}m?c&&(r.abort(),await Promise.all([...n.map(b=>b[1]),...n.map(b=>b[2]),...(t[2]??[]).map(b=>b[1])]),Je(e,t),K(e,o),y()):(g.status="success",a?.())}return t}async function Co(e,t,n,r=0,s=t[1].length){const i=t[1];for(let a=r;a_._notFound);if(e.options.notFoundMode!=="root"&&a>=0){const _=await rr(e,s[1],void 0,r[0].signal,a);_!==a&&(n[a]._notFound=void 0,n[_]._notFound=!0),a=_}let o=a<0?n.length:a+1,l=0;for(;l{for(let _=d;_=X&&(o=0),h()),r[2]()&&!r[4]){const _=[];for(const[g,v]of e._flights??[])v[2]||(e._flights.delete(g),_.push(v[1]));for(const g of _)g.abort()}let m;try{const _=Po(e,s,c,r[0],r[1],zs(c,p,s[2]),r[8]);s[2]?.length&&(s[3]=zs(s[2],void 0,void 0,_.then(g=>bt(g)?0:vo(g[1]).length,()=>0))),m=await _}catch(_){throw Je(e,s),_}return bt(m)?m:Co(e,m,r[0].signal,r[7]===m[1].length?r[7]:0)}function sr(e,t){if(e._tx!==t)return;let n=e._pending,r=!1;const s=n?.[0][3][n[1]]?.id;n?.[0]!==t&&(n&&t[3][n[1]]?.id===s?(n[0]=t,r=!0):(clearTimeout(n?.[3]),e._pending=n=void 0));const i=t[3],a=e.stores.matches.get();let o=-1,l,c,d,u=!1;for(let _=0;_0){n[3]=setTimeout(()=>sr(e,t),_);return}n[2]=0}const p=i.map(_=>({..._,_flight:void 0}));p[o].status="pending";const m=e.startTransition(()=>e.stores.setMatches(p),p).then(_=>(_&&e._pending===n&&n[4]===m&&!n[2]&&(n[2]=Date.now()+c),_));n[4]=m}function Xt(e,t){const n=e._pending;n?.[0]===t&&(clearTimeout(n[3]),e._pending=void 0)}function ko(e,t){e._committed=t,e.stores.setMatches(t)}function Gs(e,t){K(e,t[1]),Je(e,t)}function kl(e,t,n,r){const s=e._committed,i=e._cache;for(const c of n)c.preload=!1,r&&(c._assetEnd=void 0);const a=vo(n).length,o=new Map,l=Date.now();for(const c of[...s,...i.values()]){if(c.status!=="success"||n.some((u,h)=>u.id===c.id&&(h=(c.preload?d.options.preloadGcTime??e.options.defaultPreloadGcTime??3e5:d.options.gcTime??e.options.defaultGcTime??3e5)||o.set(c.id,i.get(c.id)===c?c:{...c,_flight:void 0,isFetching:!1,context:{}})}t[3]=[],e._cache=o,ko(e,n),K(e,[...i.values(),...s],[...n,...o.values()]),gl(e,s,n,()=>e._tx===t)}async function xe(e,t){let n=e._tx;for(;n&&n!==t;){if(await n[5],e._tx===n)return;n=e._tx}}async function xo(e,t,n){await e.navigate({...n.options,replace:!0,ignoreBlocker:!0,_redirects:t[1]+1})}function To(e,t){Xt(e,t),t[0].abort(),K(e,t[3]),t[3]=[],e._tx===t&&(e.batch(()=>{e.stores.status.set("idle"),e.stores.setMatches(e._committed)}),e._tx===t&&(e._commitPromise?.resolve(),e._commitPromise=void 0))}async function xl(e,t,n,r,s){const i=n.map(c=>({...c}));Br(i);for(const c of r)he(e,i[c[0]]),i[c[0]]=c[3];const a=[t[2],i];let o;try{o=await Po(e,a,r,t[0],t[1],s)}catch(c){throw K(e,i),c}if(bt(o)){K(e,i),o[0]===X&&e._tx===t&&e._committed===n&&await xo(e,t,o[1]);return}const l=await Co(e,o,t[0].signal);if(e._tx!==t||e._committed!==n){K(e,l[1]);return}for(const c of l[1]){const d=e._cache.get(c.id);d?._flight&&d._flight===c._flight&&(e._cache.delete(c.id),he(e,d))}ko(e,l[1]),K(e,n,l[1])}async function Tl(e,t,n,r,s,i){const a=[t[0],t[1],()=>e._tx===t&&!!t[3].length,e._committed,void 0,s,n,i,r],o=await Ro(e,t[2],t[3],a);if(bt(o)){o[0]===X&&e._tx===t?(Xt(e,t),K(e,t[3]),t[3]=[],e._tx===t&&await xo(e,t,o[1])):To(e,t);return}const l=e._pending;if(l?.[0]===t&&(clearTimeout(l[3]),l[4])){const h=t[0].signal;let p=!1;try{p=await Ce(l[4],h)}catch(m){if(m!==h)throw m}if(p&&e._pending===l&&l[0]===t){const m=l[2]-Date.now();if(m>0){try{await Ce(new Promise(_=>{l[3]=setTimeout(_,m)}),h)}catch{}clearTimeout(l[3])}}}if(e._tx!==t){Xt(e,t),Gs(e,o);return}const c=t[2],d=vn(c,e.stores.resolvedLocation.get()),u=o[2];await e.startViewTransition(async()=>{if(e._tx!==t){Gs(e,o);return}const h=()=>{Xt(e,t),kl(e,t,o[1],i),e._tx===t&&(e.emit({type:"onLoad",...d}),e._tx===t&&e.emit({type:"onBeforeRouteMount",...d}))},p=await e.startTransition(h,o[1]);if(e._tx!==t){Je(e,o);return}u?.length&&xl(e,t,o[1],u,o[3]).catch(console.error),e.batch(()=>{e.stores.resolvedLocation.set(c),e.stores.status.set("idle"),e._tx===t&&e.emit({type:"onResolved",...d}),p&&e._tx===t&&e.emit({type:"onRendered",...d})}),e._tx===t&&(e._commitPromise?.resolve(),e._commitPromise=void 0)})}async function El(e,t){const n=e._tx,r=e.stores.resolvedLocation.get(),s=r??e.stores.location.get(),i=e.latestLocation,a=e._pendingLocation,o=a?.href===i.href?a._redirects??0:0,l=e._handoff,c=l?.[0](),d=new AbortController,u=e._preflight;if(e._preflight=d,c||l?.[1](),u?.abort(),d.signal.aborted){await xe(e,n);return}const h=vn(i,r);if(e.emit({type:"onBeforeNavigate",...h}),d.signal.aborted||e.emit({type:"onBeforeLoad",...h}),d.signal.aborted){await xe(e,n);return}const p=s.href===i.href;let m,_=d;try{m=e.matchRoutes(i,{_controller:d}),Br(m)}catch(y){if(d.abort(),!Ar(y)){await xe(e),e._commitPromise?.resolve(),e._commitPromise=void 0;return}await e.navigate({...y.options,replace:!0,ignoreBlocker:!0}),await xe(e,n);return}const g=c?l[1](m):void 0;if(g?_=c:c?.abort(),d.signal.aborted){K(e,m),await xe(e,n);return}e._preflight=void 0;const v=[_,o,i,m,Date.now(),Promise.resolve().then(()=>Tl(e,v,p,()=>sr(e,v),t?.sync,g)).catch(()=>{e._tx===v&&To(e,v)})];if(e._tx=v,n){for(const y of e.stores.matches.get()){if(e._tx!==v)break;y.isFetching&&St(e,y,!1)}n[0].abort(),K(e,n[3],v[3],!0)}if(e._tx!==v){K(e,v[3]),v[3]=[],await xe(e,v);return}e.batch(()=>{e.stores.status.set("pending"),e.stores.location.set(i)}),!r&&!m.some(y=>y._notFound)&&sr(e,v);try{await v[5]}finally{await xe(e,v)}}async function Eo(e,t,n=0){if(n>20)return;const r=t._builtLocation??e.buildLocation(t),s=e._committed,i=new AbortController;let a;try{a=e.matchRoutes(r,{_controller:i}),Br(a)}catch(l){i.abort(),Me(l)||console.error(l);return}(e._preloads??=new Map).set(i,a);let o;try{let l;try{l=await Ro(e,r,a,[i,n,()=>!0,s,!0])}finally{o=e._preloads.delete(i),K(e,a),i.abort()}if(!bt(l))return l[1];if(o&&l[0]===X&&!l[1].options.reloadDocument)return Eo(e,{...l[1].options,_fromLocation:r},n+1)}catch(l){Me(l)||console.error(l)}}const Ol="Error preloading route! ☝️";var Oo=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=t=>{this.originalIndex=t.originalIndex;const n=this.options,r=!n?.path&&!n?.id;this.parentRoute=this.options.getParentRoute?.(),r?this._path=ze:this.parentRoute||$r();let s=r?ze:n?.path;s&&s!=="/"&&(s=po(s));const i=n?.id||s;let a=r?ze:Gt([this.parentRoute.id==="__root__"?"":this.parentRoute.id,i]);s==="__root__"&&(s="/"),a!=="__root__"&&(a=Gt(["/",a]));const o=a==="__root__"?"/":Gt([this.parentRoute.fullPath,s]);this._path=s,this._id=a,this._fullPath=o,this._to=ue(o)},this.addChildren=t=>this._addFileChildren(t),this._addFileChildren=t=>(Array.isArray(t)&&(this.children=t),typeof t=="object"&&t!==null&&(this.children=Object.values(t)),this),this._addFileTypes=()=>this,this.updateLoader=t=>(Object.assign(this.options,t),this),this.update=t=>(Object.assign(this.options,t),this),this.lazy=t=>(this.lazyFn=t,this),this.redirect=t=>ul({from:this.fullPath,...t}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw new Error("Route cannot have both an 'id' and a 'path' option.")}},Il=class extends Oo{constructor(e){super(e)}};function jr(e){return f(Ll,{...e})}var Ll=class extends Z{constructor(...e){super(...e),this.state={error:null},this.reset=()=>{this.setState({error:null})}}static getDerivedStateFromProps(e,t){const n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:null}:{resetKey:n}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.props.onCatch?.(e,t)}render(){const e=this.state.error;return e?z(this.props.errorComponent??Ml,{error:e,reset:this.reset}):this.props.children}};function Ml({error:e}){const[t,n]=A(!1);return f("div",{style:{padding:".5rem",maxWidth:"100%"},children:[f("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[f("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),f("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>n(r=>!r),children:t?"Hide Error":"Show Error"})]}),f("div",{style:{height:".25rem"}}),t?f("div",{children:f("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:e.message?f("code",{children:e.message}):null})}):null]})}function $l({children:e,fallback:t=null}){return f(Ot.Fragment,{children:Io()?e:t})}function Io(){return Ot.useSyncExternalStore(Fl,()=>!0,()=>!1)}function Fl(){return()=>{}}var Lo=ne(null);function re(e){return ee(Lo)}var wn=ne(void 0),Dl=ne(void 0),F=(e=>(e[e.None=0]="None",e[e.Mutable=1]="Mutable",e[e.Watching=2]="Watching",e[e.RecursedCheck=4]="RecursedCheck",e[e.Recursed=8]="Recursed",e[e.Dirty=16]="Dirty",e[e.Pending=32]="Pending",e))(F||{});function Al({update:e,notify:t,unwatched:n}){return{link:r,unlink:s,propagate:i,checkDirty:a,shallowPropagate:o};function r(c,d,u){const h=d.depsTail;if(h!==void 0&&h.dep===c)return;const p=h!==void 0?h.nextDep:d.deps;if(p!==void 0&&p.dep===c){p.version=u,d.depsTail=p;return}const m=c.subsTail;if(m!==void 0&&m.version===u&&m.sub===d)return;const _=d.depsTail=c.subsTail={version:u,dep:c,sub:d,prevDep:h,nextDep:p,prevSub:m,nextSub:void 0};p!==void 0&&(p.prevDep=_),h!==void 0?h.nextDep=_:d.deps=_,m!==void 0?m.nextSub=_:c.subs=_}function s(c,d=c.sub){const u=c.dep,h=c.prevDep,p=c.nextDep,m=c.nextSub,_=c.prevSub;return p!==void 0?p.prevDep=h:d.depsTail=h,h!==void 0?h.nextDep=p:d.deps=p,m!==void 0?m.prevSub=_:u.subsTail=_,_!==void 0?_.nextSub=m:(u.subs=m)===void 0&&n(u),p}function i(c){let d=c.nextSub,u;e:do{const h=c.sub;let p=h.flags;if(p&60?p&12?p&4?!(p&48)&&l(c,h)?(h.flags=p|40,p&=1):p=0:h.flags=p&-9|32:p=0:h.flags=p|32,p&2&&t(h),p&1){const m=h.subs;if(m!==void 0){const _=(c=m).nextSub;_!==void 0&&(u={value:d,prev:u},d=_);continue}}if((c=d)!==void 0){d=c.nextSub;continue}for(;u!==void 0;)if(c=u.value,u=u.prev,c!==void 0){d=c.nextSub;continue e}break}while(!0)}function a(c,d){let u,h=0,p=!1;e:do{const m=c.dep,_=m.flags;if(d.flags&16)p=!0;else if((_&17)===17){if(e(m)){const g=m.subs;g.nextSub!==void 0&&o(g),p=!0}}else if((_&33)===33){(c.nextSub!==void 0||c.prevSub!==void 0)&&(u={value:c,prev:u}),c=m.deps,d=m,++h;continue}if(!p){const g=c.nextDep;if(g!==void 0){c=g;continue}}for(;h--;){const g=d.subs,v=g.nextSub!==void 0;if(v?(c=u.value,u=u.prev):c=g,p){if(e(d)){v&&o(g),d=c.sub;continue}p=!1}else d.flags&=-33;d=c.sub;const y=c.nextDep;if(y!==void 0){c=y;continue e}}return p}while(!0)}function o(c){do{const d=c.sub,u=d.flags;(u&48)===32&&(d.flags=u|16,(u&6)===2&&t(d))}while((c=c.nextSub)!==void 0)}function l(c,d){let u=d.depsTail;for(;u!==void 0;){if(u===c)return!0;u=u.prevDep}return!1}}function Nl(e,t,n){const r=typeof e=="object",s=r?e:void 0;return{next:(r?e.next:e)?.bind(s),error:(r?e.error:t)?.bind(s),complete:(r?e.complete:n)?.bind(s)}}const ir=[];let Zt=0;const{link:Js,unlink:Ul,propagate:Bl,checkDirty:Mo,shallowPropagate:Ys}=Al({update(e){return e._update()},notify(e){ir[or++]=e,e.flags&=~F.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=F.Mutable|F.Dirty,dn(e))}});let qt=0,or=0,oe,ar=0;function jl(e){try{++ar,e()}finally{--ar||$o()}}function dn(e){const t=e.depsTail;let n=t!==void 0?t.nextDep:e.deps;for(;n!==void 0;)n=Ul(n,e)}function $o(){if(!(ar>0)){for(;qt{s.get(),o.current?a.next?.(s._snapshot):o.current=!0});return{unsubscribe:()=>{l.stop()}}},_update(i){const a=oe,o=t?.compare??Object.is;if(n)oe=s,++Zt,s.depsTail=void 0;else if(i===void 0)return!1;n&&(s.flags=F.Mutable|F.RecursedCheck);try{const l=s._snapshot,c=typeof i=="function"?i(l):i===void 0&&n?r(l):i;return l===void 0||!o(l,c)?(s._snapshot=c,!0):!1}finally{oe=a,n&&(s.flags&=~F.RecursedCheck),dn(s)}}};return n?(s.flags=F.Mutable|F.Dirty,s.get=function(){const i=s.flags;if(i&F.Dirty||i&F.Pending&&Mo(s.deps,s)){if(s._update()){const a=s.subs;a!==void 0&&Ys(a)}}else i&F.Pending&&(s.flags=i&~F.Pending);return oe!==void 0&&Js(s,oe,Zt),s._snapshot}):s.set=function(i){if(s._update(i)){const a=s.subs;a!==void 0&&(Bl(a),Ys(a),$o())}},s}function Hl(e){const t=()=>{const r=oe;oe=n,++Zt,n.depsTail=void 0,n.flags=F.Watching|F.RecursedCheck;try{return e()}finally{oe=r,n.flags&=~F.RecursedCheck,dn(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:F.Watching|F.RecursedCheck,notify(){const r=this.flags;r&F.Dirty||r&F.Pending&&Mo(this.deps,this)?t():this.flags=F.Watching},stop(){this.flags=F.None,this.depsTail=void 0,dn(this)}};return t(),n}function ql(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function r(){var s=!1;try{s=this instanceof r}catch{}return s?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:function(){return e[r]}})}),n}var Mn={exports:{}},$n={};const Fo=ql(dc);var Fn={exports:{}},Dn={};var Zs;function Wl(){if(Zs)return Dn;Zs=1;var e=Fo;function t(u,h){return u===h&&(u!==0||1/u===1/h)||u!==u&&h!==h}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,s=e.useEffect,i=e.useLayoutEffect,a=e.useDebugValue;function o(u,h){var p=h(),m=r({inst:{value:p,getSnapshot:h}}),_=m[0].inst,g=m[1];return i(function(){_.value=p,_.getSnapshot=h,l(_)&&g({inst:_})},[u,p,h]),s(function(){return l(_)&&g({inst:_}),u(function(){l(_)&&g({inst:_})})},[u]),a(p),p}function l(u){var h=u.getSnapshot;u=u.value;try{var p=h();return!n(u,p)}catch{return!0}}function c(u,h){return h()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:o;return Dn.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:d,Dn}var ei;function Vl(){return ei||(ei=1,Fn.exports=Wl()),Fn.exports}var ti;function Ql(){if(ti)return $n;ti=1;var e=Fo,t=Vl();function n(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}var r=typeof Object.is=="function"?Object.is:n,s=t.useSyncExternalStore,i=e.useRef,a=e.useEffect,o=e.useMemo,l=e.useDebugValue;return $n.useSyncExternalStoreWithSelector=function(c,d,u,h,p){var m=i(null);if(m.current===null){var _={hasValue:!1,value:null};m.current=_}else _=m.current;m=o(function(){function v(P){if(!y){if(y=!0,S=P,P=h(P),p!==void 0&&_.hasValue){var w=_.value;if(p(w,P))return b=w}return b=P}if(w=b,r(S,P))return w;var C=h(P);return p!==void 0&&p(w,C)?(S=P,w):(S=P,b=C)}var y=!1,S,b,R=u===void 0?null:u;return[function(){return v(d())},R===null?void 0:function(){return v(R())}]},[d,u,h,p]);var g=s(c,m[0],m[1]);return a(function(){_.hasValue=!0,_.value=g},[g]),l(g),g},$n}var ni;function Kl(){return ni||(ni=1,Mn.exports=Ql()),Mn.exports}var zl=Kl();function Gl(e,t){return e===t}function pe(e,t,n=Gl){const r=j(a=>{if(!e)return()=>{};const{unsubscribe:o}=e.subscribe(a);return o},[e]),s=j(()=>e?.get(),[e]);return zl.useSyncExternalStoreWithSelector(r,s,s,t,n)}var ri={};function Do(e,t){const n=H();return r=>{const s=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=Ie(n.current,s):s}}function Ue(e){const t=re(),n=ee(e.from?Dl:wn),r=e.from??n,s=t.stores.getMatchStore(r),i=Do(e,t),a=pe(s,o=>o?i(o):ri);if(a!==ri)return a;(e.shouldThrow??!0)&&$r()}function Ao(e){return Ue({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function No(e){const{select:t,...n}=e;return Ue({...n,select:r=>t?t(r.loaderDeps):r.loaderDeps})}function Uo(e){return Ue({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{const n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function Bo(e){return Ue({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function It(e){const t=re();return j(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function jo(e){return Ue({...e,select:t=>e.select?e.select(t.context):t.context})}function An(e){const t=H(e);return we(t.current,e,{ignoreUndefined:!1})||(t.current=e),t.current}function Jl(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function Yl(e,t,n){if(e?.external)return cn(e.href,n)?void 0:e.href;if(!ou(t)&&!(typeof t!="string"||t.indexOf(":")===-1))try{return new URL(t),cn(t,n)?void 0:t}catch{}}function Xl(e,t,n,r,s,i){if(i)return!1;if(n?.exact){if(!Kc(e.pathname,t.pathname,r))return!1}else{const a=un(e.pathname,r),o=un(t.pathname,r);if(!(a.startsWith(o)&&(a.length===o.length||a[o.length]==="/")))return!1}return(n?.includeSearch??!0)&&!we(e.search,t.search,{partial:!n?.exact,ignoreUndefined:!n?.explicitUndefined})?!1:n?.includeHash?s&&e.hash===t.hash:!0}function Zl(e,t){const n=re(),r=xc(t),{activeProps:s,inactiveProps:i,activeOptions:a,to:o,preload:l,preloadDelay:c,preloadIntentProximity:d,hashScrollIntoView:u,replace:h,startTransition:p,resetScroll:m,viewTransition:_,children:g,target:v,disabled:y,style:S,className:b,onClick:R,onBlur:P,onFocus:w,onMouseEnter:C,onMouseLeave:k,onTouchStart:T,ignoreBlocker:x,params:O,search:$,hash:ot,state:se,mask:$t,reloadDocument:Oh,unsafeRelative:Ih,from:Lh,_fromLocation:Mh,...Vr}=e,Cn=Io(),ha=An(e.search),da=An(e.params),Qr=An(a),at=q(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,ha,da,e.state,e.mask,e.unsafeRelative]),fa=j(N=>{const B=n.buildLocation({_fromLocation:N,...at}),ie=iu(B.maskedLocation?B.maskedLocation.publicHref:B.publicHref,B.maskedLocation?B.maskedLocation.external:B.external,n.history,y),At=Yl(ie,o,n.protocolAllowlist);return[ie?.href,At,Xl(N,B,Qr,n.basepath,Cn,At!==void 0)]},[Qr,y,Cn,at,n,o]),[pa,Rn,kn]=pe(n.stores.location,fa,Jl),Ft=kn?tt(s,{})??eu:Nn,Dt=kn?Nn:tt(i,{})??Nn,Kr=[b,Ft.className,Dt.className].filter(Boolean).join(" "),zr=(S||Ft.style||Dt.style)&&{...S,...Ft.style,...Dt.style},[_a,Gr]=A(!1),Jr=H(!1),Be=e.reloadDocument||Rn?!1:l??n.options.defaultPreload,xn=c??n.options.defaultPreloadDelay??0,Re=j(()=>{n.preloadRoute(at).catch(N=>{console.warn(N),console.warn(Ol)})},[n,at]);kc(r,j(N=>{N?.isIntersecting&&Re()},[Re]),su,!!y||Be!=="viewport"),W(()=>{Jr.current||!y&&Be==="render"&&(Re(),Jr.current=!0)},[y,Re,Be]);const ma=N=>{const B=N.currentTarget.getAttribute("target"),ie=v!==void 0?v:B;if(!y&&!au(N)&&!N.defaultPrevented&&(!ie||ie==="_self")&&N.button===0){N.preventDefault(),Mr(()=>{Gr(!0)});const At=n.subscribe("onResolved",()=>{At(),Gr(!1)});n.navigate({...at,replace:h,resetScroll:m,hashScrollIntoView:u,startTransition:p,viewTransition:_,ignoreBlocker:x})}};if(Rn)return{...Vr,ref:r,href:Rn,...g&&{children:g},...v&&{target:v},...y&&{disabled:y},...S&&{style:S},...b&&{className:b},...R&&{onClick:R},...P&&{onBlur:P},...w&&{onFocus:w},...C&&{onMouseEnter:C},...k&&{onMouseLeave:k},...T&&{onTouchStart:T}};const Yr=N=>{if(y||Be!=="intent")return;if(!xn){Re();return}const B=N.currentTarget;if(lt.has(B))return;const ie=setTimeout(()=>{lt.delete(B),Re()},xn);lt.set(B,ie)},ga=N=>{y||Be!=="intent"||Re()},Xr=N=>{if(y||!Be||!xn)return;const B=N.currentTarget,ie=lt.get(B);ie&&(clearTimeout(ie),lt.delete(B))};return{...Vr,...Ft,...Dt,href:pa,ref:r,onClick:je([R,ma]),onBlur:je([P,Xr]),onFocus:je([w,Yr]),onMouseEnter:je([C,Yr]),onMouseLeave:je([k,Xr]),onTouchStart:je([T,ga]),disabled:!!y,target:v,...zr&&{style:zr},...Kr&&{className:Kr},...y&&tu,...kn&&nu,...Cn&&_a&&ru}}var Nn={},eu={className:"active"},tu={role:"link","aria-disabled":!0},nu={"data-status":"active","aria-current":"page"},ru={"data-transitioning":"transitioning"},lt=new WeakMap,su={rootMargin:"100px"},je=e=>t=>{for(const n of e)if(n){if(t.defaultPrevented)return;n(t)}};function iu(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||"/",external:!1}}function ou(e){if(typeof e!="string")return!1;const t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var te=Ir((e,t)=>{const{_asChild:n,...r}=e,{type:s,...i}=Zl(r,t),a=typeof r.children=="function"?r.children({isActive:i["data-status"]==="active"}):r.children;if(!n){const{disabled:o,...l}=i;return z("a",l,a)}return z(n,i,a)});function au(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var cu=class extends Oo{constructor(e){super(e),this.useMatch=t=>Ue({select:t?.select,from:this.id,structuralSharing:t?.structuralSharing}),this.useRouteContext=t=>jo({...t,from:this.id}),this.useSearch=t=>Bo({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useParams=t=>Uo({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useLoaderDeps=t=>No({...t,from:this.id}),this.useLoaderData=t=>Ao({...t,from:this.id}),this.useNavigate=()=>It({from:this.fullPath}),this.Link=Ot.forwardRef((t,n)=>f(te,{ref:n,from:this.fullPath,...t}))}};function Lt(e){return new cu(e)}var lu=class extends Il{constructor(e){super(e),this.useMatch=t=>Ue({select:t?.select,from:this.id,structuralSharing:t?.structuralSharing}),this.useRouteContext=t=>jo({...t,from:this.id}),this.useSearch=t=>Bo({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useParams=t=>Uo({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useLoaderDeps=t=>No({...t,from:this.id}),this.useLoaderData=t=>Ao({...t,from:this.id}),this.useNavigate=()=>It({from:this.fullPath}),this.Link=Ot.forwardRef((t,n)=>f(te,{ref:n,from:this.fullPath,...t}))}};function uu(e){return new lu(e)}function hu(e){const t=re(),n=`not-found-${pe(t.stores.location,r=>r.pathname)}-${pe(t.stores.status,r=>r)}`;return f(jr,{getResetKey:()=>n,onCatch:(r,s)=>{if(Me(r))e.onCatch?.(r,s);else throw r},errorComponent:({error:r})=>{if(Me(r))return e.fallback?.(r);throw r},children:e.children})}function du(){return f("p",{children:"Not Found"})}function We(e){return f(M,{children:e.children})}function Ho(e,t,n){return t.options.notFoundComponent?f(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?f(e.options.defaultNotFoundComponent,{...n}):f(du,{})}function Sn(e,t){const n=t?.options.pendingComponent??e.options.defaultPendingComponent;return n?f(n,{}):null}var fu=(e,t)=>e[0]===t[0]&&e[1]===t[1],qo=Tt(function({routeId:t}){const n=re();return f(pu,{router:n,match:pe(n.stores.getMatchStore(t),r=>r)})});function pu({router:e,match:t}){const n=e.routesById[t.routeId],r=Sn(e,n),s=n.options.errorComponent??e.options.defaultErrorComponent,i=n.options.onCatch??e.options.defaultOnCatch,a=n.isRoot?n.options.notFoundComponent??e.options.notFoundRoute?.options.component:n.options.notFoundComponent,o=t.ssr===!1||t.ssr==="data-only",l=n.options.wrapInSuspense??r??(n.options.errorComponent?.preload||o)?be:We,c=s?jr:We,d=a?hu:We;return f(n.isRoot?n.options.shellComponent??We:We,{children:[f(wn.Provider,{value:t.routeId,children:f(l,{fallback:r,children:f(c,{getResetKey:()=>t,errorComponent:s,onCatch:(u,h)=>{if(Me(u))throw u.routeId??=t.routeId,u;i?.(u,h)},children:f(d,{fallback:u=>{if(u.routeId??=t.routeId,u.routeId!==t.routeId)throw u;return z(a,u)},children:o?f($l,{fallback:r,children:f(si,{match:t})}):f(si,{match:t})})})})}),null]})}var si=Tt(function({match:t}){const n=re(),r=t.routeId,s=n.routesById[r],i=q(()=>{const o=(s.options.remountDeps??n.options.defaultRemountDeps)?.({routeId:r,loaderDeps:t.loaderDeps,params:t._strictParams,search:t._strictSearch});return o?JSON.stringify(o):void 0},[r,t.loaderDeps,t._strictParams,t._strictSearch,s.options.remountDeps,n.options.defaultRemountDeps]),a=q(()=>{const o=s.options.component??n.options.defaultComponent;return o?f(o,{},i):f(Wo,{})},[i,s.options.component,n.options.defaultComponent]);if(t.status==="pending"){if(n._tx)throw n._tx[5];return Sn(n,s)}if(t.status==="notFound")return Ho(n,s,t.error);if(t.status==="error")throw t.error;return a}),Wo=Tt(function(){const t=re(),n=ee(wn);let r,s,i;{const o=t.stores.getMatchStore(n);[r,s]=pe(o,l=>[!!l._notFound,l.error],fu),i=pe(t.stores.ids,l=>l[l.indexOf(n)+1])}if(r)return Ho(t,t.routesById[n],s);if(!i)return null;const a=f(qo,{routeId:i});return n===ze?f(be,{fallback:Sn(t),children:a}):a});function Vo(e,t){const n=e[1];e.length=0,n?.(t)}function _u({t:e}){const t=re(),n=t._rendered??=[];return t.startTransition=(r,s)=>new Promise((i,a)=>{Vo(n,!1),n.push(s,i),e(t),gn(()=>{try{r()}catch(o){n[1]===i&&(n.length=0),a(o)}})}),io(()=>{const r=t.history.subscribe(t.load);t.updateLatestLocation();const s=t.latestLocation,i=t.buildLocation({to:s.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});if(ue(s.publicHref)!==ue(i.publicHref))return t.commitLocation({...i,replace:!0,ignoreBlocker:!0}),r;const a=t.stores.resolvedLocation.get();return a?.href===s.href&&a.state.__TSR_key===s.state.__TSR_key?n.push(t.stores.matches.get(),o=>{o&&t.emit({type:"onRendered",...vn(a,a)})}):t._tx||t.load().catch(console.error),r},[t,t.history]),null}function mu(){const e=re(),t=e.routesById[ze],n=Sn(e,t),r=e.ssr?We:be,s=f(M,{children:[f(_u,{t:A()[1]}),f(r,{fallback:n,children:f(gu,{})})]});return e.options.InnerWrap?f(e.options.InnerWrap,{children:s}):s}function gu(){const e=re(),t=e._rendered,n=pe(e.stores.matches,a=>t[0]??a),r=n[0],s=r?.routeId;io(()=>{t[0]===n&&Vo(t,!0)},[t,n]);const i=s?f(qo,{routeId:s}):null;return f(wn.Provider,{value:s,children:e.options.disableGlobalCatchBoundary?i:f(jr,{getResetKey:()=>r,onCatch:void 0,children:i})})}var yu=e=>({createMutableStore:Xs,createReadonlyStore:Xs,batch:jl}),vu=e=>new bu(e),bu=class extends yl{constructor(e){super(e,yu)}};function wu({router:e,children:t,...n}){ao(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});const r=f(Lo.Provider,{value:e,children:t});return e.options.Wrap?f(e.options.Wrap,{children:r}):r}function Su({router:e,...t}){return f(wu,{router:e,...t,children:f(mu,{})})}function Qo(e){const t=re({warn:e?.router===void 0}),n=e?.router||t;return pe(n.stores.__store,Do(e,n))}const fn={width:3997,height:1467},Ko="M105 1467V670H0V405H105V248L372 0H868V265H548V1467ZM615 670 618 405H868V670ZM1104 1467 839 1202V670L1104 405H1401V670H1286V1219H1401V1467ZM1471 1467V1219H1581V670H1471V405H1767L2032 670V1202L1767 1467ZM2419 1467 2171 1219V0H2613V1202H2811V1467ZM3555 1467V0H3997V1467ZM3069 1467 2830 1228V644L3069 405H3485V670H3272V1219H3485V1362L3380 1467Z";function Pu(e,t,n){const r=n/fn.width,s=e-n/2,i=t-fn.height*r/2;return`translate(${s.toFixed(2)} ${i.toFixed(2)}) scale(${r.toFixed(5)})`}function ii({title:e,descriptor:t,className:n}){return f("span",{class:n?`wordmark ${n}`:"wordmark",children:[f("svg",{class:"wordmark-glyphs",viewBox:`0 0 ${fn.width} ${fn.height}`,fill:"currentColor",role:e?"img":void 0,"aria-label":e,"aria-hidden":e?void 0:"true",focusable:"false",children:[e?f("title",{children:e}):null,f("path",{d:Ko})]}),t?f(M,{children:[f("span",{class:"wordmark-rule","aria-hidden":"true"}),f("span",{class:"wordmark-descriptor",children:t})]}):null]})}const Cu=45e3;function Ru(e){const t=Math.max(0,Math.round(e/1e3));if(t<5)return"just now";if(t<60)return`${t}s ago`;const n=Math.round(t/60);return n<60?`${n}m ago`:`${Math.round(n/60)}h ago`}function ku({updatedAt:e,fetching:t,failed:n}){const[r,s]=A(()=>Date.now());if(W(()=>{const l=setInterval(()=>s(Date.now()),5e3);return()=>clearInterval(l)},[]),!e&&!n)return null;const i=r-e,a=n?"failed":t?"fetching":i>Cu?"stale":"live",o=a==="failed"?"not updating":a==="fetching"?"refreshing":Ru(i);return f("p",{class:"freshness","data-state":a,children:[f("span",{class:"dot","aria-hidden":"true"}),f("span",{class:"visually-hidden",children:a==="failed"?"The federation snapshot is not updating.":`Federation snapshot ${a==="fetching"?"refreshing now":`last updated ${o}`}.`}),f("span",{"aria-hidden":"true",children:o})]})}let Pt={token:"",state:"anonymous"};const cr=new Set;function zo(){for(const e of cr)e()}function xu(){return Pt}function Go(e,t="pasted"){const n=e.trim();Pt={token:n,state:n?t:"anonymous"},zo()}function Tu(){Pt={token:"",state:"anonymous"},zo()}function Jo(){return Pt.token?{Authorization:`Bearer ${Pt.token}`}:{}}function Eu(e){return cr.add(e),()=>{cr.delete(e)}}function Hr(){return st(Eu,xu)}const oi="1.9.0",Ou={consoleSource:"1.9.0",tenantGovernance:"1.9.0"};function pn(e){if(!e)return null;const t=/^v?(\d+)\.(\d+)(?:\.(\d+))?/.exec(e.trim());return t?[Number(t[1]),Number(t[2]),Number(t[3]??0)]:null}function Yo(e,t){const n=pn(e),r=pn(t);if(!n||!r)return 0;for(let s=0;s<3;s++){const i=(n[s]??0)-(r[s]??0);if(i!==0)return i<0?-1:1}return 0}function ai(e,t){return pn(e)?Yo(e,Ou[t])>=0:!0}function Iu(e){return!pn(e)||Yo(e,oi)>=0?null:`This console needs fold ${oi} or newer; the gateway reports ${e}. Parts of this page will be empty. Upgrade the gateway, or use the console bundled with it.`}function Lu(e){return e?/^\d/.test(e)?`v${e}`:e:""}const Mu=[{to:"/",label:"Overview"},{to:"/upstreams",label:"Upstreams"},{to:"/catalog",label:"Catalog"},{to:"/test",label:"Test console"}];function $u({version:e,authRequired:t,hint:n,onSignIn:r,onRefresh:s,refreshing:i,updatedAt:a,failed:o,section:l,children:c}){const d=Hr(),[u,h]=A(""),p=Qo({select:y=>y.location.pathname}),m=H(null),_=d.state==="signed-in",g=!_&&t!==!1,v=()=>{Go(u),s()};return f("div",{class:"shell",children:[f("button",{type:"button",class:"skip",onClick:()=>m.current?.focus(),children:"Skip to content"}),f("header",{class:"topbar",children:[f(te,{to:"/",className:"brand","aria-label":"fold console, overview",children:[f(ii,{title:"fold",descriptor:"Console"}),e?f("span",{class:"version muted",children:Lu(e)}):null]}),f("div",{class:"auth",children:[f(ku,{updatedAt:a,fetching:i,failed:o}),n?.oauth&&!_?f("button",{type:"button",onClick:r,children:"Sign in"}):null,_?f("button",{type:"button",onClick:()=>{Tu(),s()},children:"Sign out"}):null,g?f("input",{type:"password",value:u,autocomplete:"off",spellcheck:!1,"aria-label":"Bearer token",placeholder:n?.oauth?"…or paste a Bearer token":"Bearer token",onInput:y=>h(y.currentTarget.value),onBlur:v,onKeyDown:y=>{y.key==="Enter"&&v()}}):null,f("button",{type:"button",onClick:s,disabled:i,children:"Refresh"})]})]}),f("div",{class:"body",children:[f("nav",{class:"sidebar","aria-label":"Console sections",children:f("ul",{children:Mu.map(y=>f("li",{children:f(te,{to:y.to,className:ci(p,y.to)?"nav-link active":"nav-link","aria-current":ci(p,y.to)?"page":void 0,children:y.label})},y.to))})}),f("main",{id:"main",ref:m,tabIndex:-1,children:c})]}),f(Fu,{section:l}),f("footer",{children:f("div",{class:"foot",children:[f("span",{class:"legal",children:[f(ii,{}),"© fold.run · the enterprise MCP gateway"]}),f("nav",{"aria-label":"fold project",children:[f("a",{href:"https://fold.run/",rel:"noopener",children:"fold.run"}),f("a",{href:"https://docs.fold.run/",rel:"noopener",children:"Docs"}),f("a",{href:"https://github.com/fold-run/fold",rel:"noopener",children:"GitHub"}),f("a",{href:"https://fold.run/status/",rel:"noopener",children:"Status"})]})]})})]})}function Fu({section:e}){const[t,n]=A(""),r=H(!0);return W(()=>{if(r.current){r.current=!1;return}n(`${e} page`)},[e]),f("p",{class:"visually-hidden",role:"status","aria-live":"polite",children:t})}function ci(e,t){return t==="/"?e==="/":e===t||e.startsWith(`${t}/`)}function Un({tone:e="bad",children:t}){return f("p",{class:`banner ${e}`,role:"alert",children:t})}const Fe={tools:{list:"tools/list",listKey:"tools",call:"tools/call",verb:"Call tool",args:!0,label:"Tools"},prompts:{list:"prompts/list",listKey:"prompts",call:"prompts/get",verb:"Get prompt",args:!0,label:"Prompts"},resources:{list:"resources/list",listKey:"resources",call:"resources/read",verb:"Read resource",args:!1,label:"Resources"}},Mt=["tools","prompts","resources"],en={tools:[],prompts:[],resources:[]};function G(e,t){return(e==="resources"?t.uri:t.name)??""}class Du{constructor(t,n){this.path=t,this.clientVersion=n}path;clientVersion;sessionId=null;protocolVersion=null;nextId=0;wire=[];wireSeq=0;listeners=new Set;subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});getWire=()=>this.wire;clearWire=()=>{this.wire=[],this.emit()};emit(){for(const t of this.listeners)t()}log(t,n){const r=this.wire.concat({id:this.wireSeq++,direction:t,message:n});this.wire=r.length>400?r.slice(r.length-400):r,this.emit()}async rpc(t,n,r=!1){const s={jsonrpc:"2.0",method:t};n!==void 0&&(s.params=n),r||(s.id=++this.nextId),this.log("→",s);const i={"Content-Type":"application/json",Accept:"application/json, text/event-stream",...Jo()};this.sessionId&&(i["Mcp-Session-Id"]=this.sessionId),this.protocolVersion&&(i["MCP-Protocol-Version"]=this.protocolVersion);const a=await fetch(this.path,{method:"POST",headers:i,body:JSON.stringify(s)}),o=a.headers.get("mcp-session-id");if(o&&(this.sessionId=o),a.status===202)return null;if(!a.ok){const d=await a.text();throw new Error(`HTTP ${a.status}${d?`: ${d.slice(0,300)}`:""}`)}const l=a.headers.get("content-type")??"";let c=null;if(l.includes("text/event-stream")){const d=await a.text();for(const u of d.split(/\r?\n\r?\n/)){const h=u.split(/\r?\n/).filter(m=>m.startsWith("data:")).map(m=>m.slice(5).replace(/^ /,"")).join(` +`);if(!h)continue;let p;try{p=JSON.parse(h)}catch{continue}this.log("←",p),!r&&p.id===s.id&&(c=p)}}else c=await a.json(),this.log("←",c);if(r)return null;if(!c)throw new Error(`no response for request ${s.id} on the stream`);if(c.error)throw new Error(`JSON-RPC ${c.error.code}: ${c.error.message}`);return c.result}async fetchList(t){const n=Fe[t],r=[];let s;for(let i=0;i<25;i++){let a;try{a=await this.rpc(n.list,s?{cursor:s}:{})}catch(o){if(/-32601/.test(o.message))return[];throw o}if(r.push(...a[n.listKey]??[]),s=a.nextCursor,!s)break}return r}async connect(){this.sessionId=null,this.protocolVersion=null,this.nextId=0;const t=await this.rpc("initialize",{protocolVersion:"2025-06-18",capabilities:{},clientInfo:{name:"fold-console",version:this.clientVersion}});this.protocolVersion=t.protocolVersion??null,await this.rpc("notifications/initialized",void 0,!0);const n={tools:[],prompts:[],resources:[]};for(const r of Mt)n[r]=await this.fetchList(r);return n}async invoke(t,n,r){const s=t==="resources"?{uri:n}:{name:n,arguments:r};return this.rpc(Fe[t].call,s)}}function Au(e){const t=e?.inputSchema;if(t?.properties){const n=new Set(t.required??[]),r={};for(const[s,i]of Object.entries(t.properties))n.size&&!n.has(s)||(r[s]=Nu(i));if(Object.keys(r).length)return JSON.stringify(r,null,2)}if(e?.arguments?.length){const n={};for(const r of e.arguments)r.required!==!1&&(n[r.name]="");if(Object.keys(n).length)return JSON.stringify(n,null,2)}return""}function Nu(e){if(e.default!==void 0)return e.default;if(e.enum?.length)return e.enum[0];switch(e.type){case"number":case"integer":return 0;case"boolean":return!1;case"array":return[];case"object":return{};default:return""}}const _t=()=>{},Xo=ne({status:"idle",error:null,catalog:en,client:null,connect:_t,disconnect:_t,wire:[],clearWire:_t});function Zo(){return ee(Xo)}function Uu(e){const t=e&&e.trim()?e:"/mcp";return new URL(`..${t.startsWith("/")?t:`/${t}`}`,location.href).pathname}function Bu({mcpPath:e,gatewayVersion:t,children:n}){const[r,s]=A("idle"),[i,a]=A(null),[o,l]=A(en),[c,d]=A(null),{token:u}=Hr(),h=H(0),p=j(()=>{const y=++h.current,S=new Du(Uu(e),t??"dev");d(S),s("connecting"),a(null),l(en),S.connect().then(b=>{y===h.current&&(l(b),s("ready"))}).catch(b=>{y===h.current&&(a(`MCP connect failed: ${b.message}`),s("error"))})},[e,t]),m=j(()=>{h.current++,d(null),l(en),s("idle"),a(null)},[]),_=H(u);_.current!==u&&(_.current=u,r!=="idle"&&queueMicrotask(m));const g=st(c?c.subscribe:()=>_t,c?c.getWire:()=>ju),v=q(()=>({status:r,error:i,catalog:o,client:c,connect:p,disconnect:m,wire:g,clearWire:c?c.clearWire:_t}),[r,i,o,c,p,m,g]);return f(Xo.Provider,{value:v,children:n})}const ju=[];function Y({title:e,hint:t}){return f("div",{class:"empty",children:[f("p",{class:"empty-title",children:e}),t?f("p",{class:"muted",children:t}):null]})}class Qe extends Error{status;terminal;constructor(t,n,r=!1){super(n),this.name="ApiError",this.status=t,this.terminal=r}}const Hu="../api/federation",qu="../api/auth-hint";async function Wu(e){let t;try{t=await fetch(Hu,{headers:Jo(),signal:e})}catch(n){throw new Qe(0,`Could not reach the gateway: ${n.message}`)}if(t.status===401)throw new Qe(401,"Unauthorized. Sign in, or paste a valid Bearer token: the same one /mcp accepts.",!0);if(t.status===403)throw new Qe(403,"This principal is not in the introspection viewer allowlist (server.introspection.groups). The denial was audited.",!0);if(!t.ok)throw new Qe(t.status,`The gateway refused the read: HTTP ${t.status}.`);return await t.json()}const Vu={queryKey:["federation"],queryFn:({signal:e})=>Wu(e),refetchInterval:15e3,retry:(e,t)=>!(t instanceof Qe&&t.terminal)},lr="fold-console-pkce";function Bn(e){return btoa(String.fromCharCode(...e)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function ea(){try{const e=await fetch(qu);return e.ok?await e.json():null}catch{return null}}async function Qu(e){const t=e.replace(/\/$/,""),n=new URL(t),r=[`${t}/.well-known/openid-configuration`,`${n.origin}/.well-known/oauth-authorization-server${n.pathname.replace(/\/$/,"")}`];for(const s of r)try{const i=await fetch(s);if(!i.ok)continue;const a=await i.json();if(a.authorization_endpoint&&a.token_endpoint)return{authorization_endpoint:a.authorization_endpoint,token_endpoint:a.token_endpoint}}catch{}throw new Error(`could not discover authorization server metadata for ${e}`)}function ta(){return location.origin+location.pathname}async function Ku(e){if(!e.oauth)throw new Error("this gateway does not advertise an OAuth issuer");const t=await Qu(e.oauth.issuer),n=Bn(crypto.getRandomValues(new Uint8Array(32))),r=Bn(crypto.getRandomValues(new Uint8Array(16))),s=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(n));sessionStorage.setItem(lr,JSON.stringify({verifier:n,state:r,tokenEndpoint:t.token_endpoint}));const i=new URL(t.authorization_endpoint);i.searchParams.set("response_type","code"),i.searchParams.set("client_id",e.oauth.clientId),i.searchParams.set("redirect_uri",ta()),i.searchParams.set("code_challenge",Bn(new Uint8Array(s))),i.searchParams.set("code_challenge_method","S256"),i.searchParams.set("state",r),e.oauth.scopes?.length&&i.searchParams.set("scope",e.oauth.scopes.join(" ")),e.resource&&i.searchParams.set("resource",e.resource),location.assign(i)}async function zu(e){const t=new URLSearchParams(location.search);if(!t.has("code")&&!t.has("error"))return null;const n=sessionStorage.getItem(lr);if(sessionStorage.removeItem(lr),history.replaceState(null,"",location.pathname+location.hash),t.has("error")){const i=t.get("error_description");return`Sign-in failed: ${t.get("error")}${i?`. ${i}`:""}`}let r=null;try{r=JSON.parse(n??"null")}catch{}if(!r?.state||r.state!==t.get("state"))return"Sign-in failed: state mismatch. Start again from this page.";if(!e?.oauth||!r.tokenEndpoint||!r.verifier)return"Sign-in failed: the gateway no longer advertises the issuer this flow started against.";const s=new URLSearchParams({grant_type:"authorization_code",code:t.get("code")??"",redirect_uri:ta(),client_id:e.oauth.clientId,code_verifier:r.verifier});e.resource&&s.set("resource",e.resource);try{const i=await fetch(r.tokenEndpoint,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s}),a=await i.json();if(!i.ok||!a.access_token){const o=a.error_description?`: ${a.error_description}`:"";return`Token exchange failed: ${a.error??`HTTP ${i.status}`}${o}`}return Go(a.access_token,"signed-in"),null}catch(i){return`Token exchange failed: ${i.message}`}}let na=null;function Gu(e,t){na=t}const Ju=()=>na,ra=["auth-hint"],sa=ne({state:void 0,error:null,isPending:!0});function Pn(){return ee(sa)}const Yu={"/":"Overview","/upstreams":"Upstreams","/catalog":"Catalog","/test":"Test console"};function Xu(e){return Yu[e]??(e.startsWith("/upstreams/")?"Upstream":"Not found")}function Zu(){const e=ro(),t=Hr(),[n,r]=A(Ju()),{data:s=null}=Ts({queryKey:ra,queryFn:ea,staleTime:1/0}),i=Ts({...Vu,queryKey:["federation",t.token?"authed":"anon"]}),a=i.error instanceof Qe?i.error:null,o=j(()=>{r(null),e.invalidateQueries({queryKey:["federation"]})},[e]),l=j(()=>{r(null),Ku(s).catch(h=>r(`Sign-in failed: ${h.message}`))},[s]),c=Qo({select:h=>h.location.pathname}),d=Xu(c);W(()=>{document.title=`${d} · fold console`},[d]);const u=Iu(i.data?.version);return f(sa.Provider,{value:{state:i.data,error:a,isPending:i.isPending},children:f(Bu,{mcpPath:i.data?.mcpPath,gatewayVersion:i.data?.version,children:f($u,{version:i.data?.version,authRequired:i.data?.authRequired,hint:s,onSignIn:l,onRefresh:o,refreshing:i.isFetching,updatedAt:i.dataUpdatedAt,failed:!!a,section:d,children:[n?f(Un,{children:n}):null,a?f(Un,{children:a.message}):null,u?f(Un,{tone:"warn",children:u}):null,a?.terminal?f(Y,{title:"No federation snapshot",hint:"The gateway answered, but not with data this principal may read."}):f(Wo,{})]})})})}function eh(){return f(Y,{title:"No such page",hint:"That route is not part of the console. Pick a section from the sidebar."})}const it=uu({component:Zu,notFoundComponent:eh});function I({label:e,value:t,tone:n,wrap:r}){return f("div",{class:"card",children:[f("span",{class:"label",children:e}),f("b",{class:[n,r?"wrap":""].filter(Boolean).join(" ")||void 0,children:t})]})}function le({title:e,children:t,action:n}){return f("section",{class:"group","aria-label":e,children:[f("div",{class:"group-head",children:[f("h2",{children:e}),n]}),f("div",{class:"cards",children:t})]})}function nt({title:e,back:t,lede:n,actions:r,children:s}){return f("header",{class:"page-head",children:[t,f("div",{class:"page-head-row",children:[f("h1",{children:e}),r?f("div",{class:"page-actions",children:r}):null]}),n?f("p",{class:"muted lede",children:n}):null,s]})}const ia=ne(()=>{});function th(){return ee(ia)}const nh=3200;function rh({children:e}){const[t,n]=A([]),r=H(0),s=H(new Set),i=j((o,l="ok")=>{const c=r.current++;n(u=>u.concat({id:c,message:o,tone:l}));const d=setTimeout(()=>{n(u=>u.filter(h=>h.id!==c)),s.current.delete(d)},nh);s.current.add(d)},[]);W(()=>{const o=s.current;return()=>{for(const l of o)clearTimeout(l);o.clear()}},[]);const a=q(()=>i,[i]);return f(ia.Provider,{value:a,children:[e,f("div",{class:"toasts",role:"status","aria-live":"polite",children:t.map(o=>f("div",{class:`toast ${o.tone}`,children:o.message},o.id))})]})}function Ye({value:e,label:t,className:n}){const r=th(),s=async()=>{try{if(!navigator.clipboard)throw new Error("needs a secure context (https or localhost)");await navigator.clipboard.writeText(e),r(`${t} copied`)}catch(i){r(`Copy failed: ${i.message}`,"bad")}};return f("button",{type:"button",class:n?`copy ${n}`:"copy",onClick:s,disabled:!e,title:`Copy ${t.toLowerCase()}`,"aria-label":`Copy ${t.toLowerCase()}`,children:"Copy"})}const sh="https://docs.fold.run",ih={configuration:"configuration/",upstreams:"configuration/#upstreams-required",policy:"configuration/#policy",auth:"configuration/#auth-gateway-authentication",observability:"operations/",tenancy:"tenancy/",discovery:"discovery/"};function oh(e){return`${sh}/${ih[e]}`}function ut({topic:e,children:t}){return f("a",{class:"group-action",href:oh(e),rel:"noopener",children:[t," →"]})}function li({count:e=4}){return f("div",{class:"cards","aria-hidden":"true",children:Array.from({length:e},(t,n)=>f("div",{class:"card skeleton-card",children:[f("span",{class:"skeleton skeleton-label"}),f("span",{class:"skeleton skeleton-value"})]},n))})}function ah({columns:e,rows:t=3}){return f(M,{children:Array.from({length:t},(n,r)=>f("tr",{"aria-hidden":"true",children:Array.from({length:e},(s,i)=>f("td",{children:f("span",{class:"skeleton skeleton-cell"})},i))},r))})}const rt="—";function Q(e){return e==null||e===""?rt:String(e)}function Ct(e){return e===void 0?rt:e<1e3?`${e} ms`:`${(e/1e3).toFixed(2)} s`}function ur(e){if(!e)return rt;const t=[e.org,e.team].filter(Boolean);return t.length?t.join(" / "):rt}function ch(e){if(!e)return rt;const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{year:"numeric",month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}function lh(e){return e?e%1e3===0?`${e/1e3} s`:`${e} ms`:"30 s (default)"}function hr(e){try{return JSON.stringify(e,null,2)??String(e)}catch{return String(e)}}function oa(e,t){const n=t.trim().toLowerCase();return n?e.some(r=>r?.toLowerCase().includes(n)):!0}function uh(){const{state:e,isPending:t}=Pn();if(!e)return t?f(M,{children:[f(nt,{title:"Overview"}),f("section",{class:"group","aria-label":"Loading",children:[f("p",{class:"visually-hidden",role:"status",children:"Reading the federation snapshot."}),f(li,{count:5})]}),f("section",{class:"group","aria-hidden":"true",children:f(li,{count:3})})]}):f(Y,{title:"No federation snapshot",hint:"Check that server.introspection.enabled is set on the gateway."});const n=e.upstreams.filter(s=>s.connected).length,r=e.upstreams.length;return f(M,{children:[f(nt,{title:"Overview",lede:"The gateway's own view of its configuration and federation.",actions:f(ut,{topic:"configuration",children:"Configuration"})}),f(le,{title:"Gateway",children:[f(I,{label:"version",value:Q(e.version)}),f(I,{label:"endpoint",value:f(M,{children:[e.mcpPath,f(Ye,{value:e.mcpPath,label:"MCP path"})]})}),f(I,{label:"auth",value:(e.authRequired?"required":"disabled")+(e.emaEnabled?" + EMA":""),tone:e.authRequired?void 0:"warn"}),f(I,{label:"state",value:e.sharedState?"shared (Redis)":"in-process"}),e.passthrough?f(I,{label:"mode",value:"passthrough",tone:"warn"}):null,ai(e.version,"consoleSource")&&e.consoleSource?f(I,{label:"console build",value:e.consoleSource.slice(0,12)}):null]}),f(le,{title:"Federation",action:f(te,{to:"/upstreams",className:"group-action",children:"All upstreams →"}),children:[f(I,{label:"upstreams",value:`${e.staticUpstreams} static + ${e.discoveredUpstreams} discovered`}),f(I,{label:"connected",value:`${n} / ${r}`,tone:r===0?"warn":n===r?"ok":"bad"}),f(I,{label:"routing",value:`sep ${e.namespaceSeparator} · ${e.pageSize?`page size ${e.pageSize}`:"no pagination"}`})]}),f(le,{title:"Governance",action:f(ut,{topic:"policy",children:"Policy docs"}),children:[f(I,{label:"policy",value:`${e.policyDefaultDecision}, ${e.policyRules} rule(s)`,tone:e.policyDefaultDecision==="deny"?void 0:"warn"}),e.globalRequestsPerMinute?f(I,{label:"rate limit",value:`${e.globalRequestsPerMinute}/min global`+(e.perPrincipalRequestsPerMinute?` · ${e.perPrincipalRequestsPerMinute}/min per principal`:"")}):null,e.viewerGroups?.length?f(I,{label:"viewers",value:e.viewerGroups.join(", "),wrap:!0}):null]}),e.tenant&&ai(e.version,"tenantGovernance")?f(le,{title:"Your tenant",children:[f(I,{label:"tenant",value:e.tenant}),e.tenantRequestsPerMinute?f(I,{label:"requests",value:`${e.tenantRequestsPerMinute}/min`}):null,e.tenantUpstreamCalls?f(I,{label:"budget",value:`${e.tenantUpstreamCalls} calls/${Q(e.tenantBudgetPeriod)}`}):null]}):null,f(le,{title:"Observability",action:f(ut,{topic:"observability",children:"Observability docs"}),children:[f(I,{label:"audit",value:e.auditSinks.length?e.auditSinks.join(" + "):"none",tone:e.auditSinks.length?void 0:"warn"}),f(I,{label:"tracing",value:e.tracingEnabled?"OTLP":"off"})]}),e.discovery?f(le,{title:"Discovery",action:f(ut,{topic:"discovery",children:"Discovery docs"}),children:[f(I,{label:"source",value:e.discovery.url,wrap:!0}),f(I,{label:"interval",value:lh(e.discovery.intervalMs)}),e.discovery.lastOutcome?f(I,{label:"last sync",value:`${e.discovery.lastOutcome} · ${ch(e.discovery.lastSyncAt)}`,tone:e.discovery.lastOutcome==="applied"||e.discovery.lastOutcome==="unchanged"?"ok":"bad",wrap:!0}):f(I,{label:"last sync",value:"not yet run",tone:"warn"})]}):null]})}const hh=Lt({getParentRoute:()=>it,path:"/",component:uh});function aa(e,t,n,r="asc"){const s=t.find(a=>a.key===n);if(!s)return e;const i=r==="desc"?-1:1;return e.slice().sort((a,o)=>{const l=s.value(a),c=s.value(o);return typeof l=="number"&&typeof c=="number"?(l-c)*i:String(l).localeCompare(String(c),void 0,{numeric:!0})*i})}function qr({columns:e,rows:t,rowKey:n,sort:r,dir:s="asc",onSort:i,empty:a,caption:o,loading:l}){return f("div",{class:"tablewrap",children:f("table",{children:[o?f("caption",{class:"visually-hidden",children:o}):null,f("thead",{children:f("tr",{children:e.map(c=>{const d=r===c.key,u=i&&c.sortable!==!1;return f("th",{"aria-sort":d?s==="asc"?"ascending":"descending":void 0,children:c.headerHidden?f("span",{class:"visually-hidden",children:c.header}):u?f("button",{type:"button",class:"th-sort",onClick:()=>i(c.key),children:[c.header,f("span",{class:"sort-mark","aria-hidden":"true",children:d?s==="asc"?"↑":"↓":""})]}):c.header},c.key)})})}),f("tbody",{children:l?f(ah,{columns:e.length}):t.length===0?f("tr",{children:f("td",{class:"empty-cell",colSpan:e.length,children:a})}):t.map(c=>f("tr",{children:e.map(d=>f("td",{class:[d.tone?.(c),d.wrap?"wrap":""].filter(Boolean).join(" ")||void 0,children:d.render?d.render(c):d.value(c)},d.key))},n(c)))})]})})}function Wr({options:e,value:t,onChange:n,label:r}){return f("div",{class:"seg",role:"group","aria-label":r,children:e.map(s=>f("button",{type:"button",class:s.value===t?"active":void 0,"aria-pressed":s.value===t,disabled:s.disabled,onClick:()=>n(s.value),children:[s.label,s.count===void 0?null:f("span",{class:"seg-count",children:s.count})]},s.value))})}const jn=980,ui=20,Ee=34,ca=12,He=Ee+ca,me=268,dr=300,_e=26,Te=108,ht=76,hi=me+dr+18,dh=40;function fh(e,t,n){if(t<2)return n;const r=ht-26;return n-r/2+r*e/(t-1)}const ph=.6;function Wt(e,t,n){const r=Math.floor(t/(n*ph));return e.length<=r?e:`${e.slice(0,Math.max(1,r-1))}…`}function Vt(e){return e.connected&&(e.breaker==="closed"||!e.breaker)?"live":!e.connected||e.breaker==="open"?"down":"idle"}function di(e){const t=e.connected?"connected":"not connected",n=e.breaker?`, breaker ${e.breaker}`:"",r=e.connected?`, ${Ct(e.latencyMs)}`:e.error?`, ${e.error}`:"";return`${e.id}: ${t}${n}${r}`}function _h({state:e,upstreams:t}){const n=t.slice(0,dh),r=t.length-n.length,s=n.length*He-ca,i=Math.max(s,ht),a=i+ui*2,o=ui+(i-s)/2,l=a/2,c=_e+Te/2,d=t.filter(h=>Vt(h)==="live").length,u=`${t.length} upstream${t.length===1?"":"s"} behind one gateway endpoint at ${e.mcpPath}; ${d} connected. Every route crosses the gateway's auth, policy and audit boundary.`;return f("figure",{class:"topology",children:[f("p",{class:"visually-hidden",children:[u," Each upstream links to its detail page; the same data is in the table view."]}),f("div",{class:"topology-scroll",children:f("svg",{class:"topology-svg",viewBox:`0 0 ${jn} ${a}`,width:jn,height:a,children:[n.map((h,p)=>{const m=o+p*He+Ee/2,_=fh(p,n.length,l),g=`M ${_e+Te} ${_} C ${_e+Te+64} ${_}, ${me-64} ${m}, ${me} ${m}`,v=Vt(h);return f("path",{class:v==="live"?"fold-active":v==="down"?"fold-broken":"fold-dash",d:g},h.id)}),n.map((h,p)=>Vt(h)==="live"?f("path",{class:"fold-arrow",d:`M ${me-12} ${o+p*He+Ee/2-6} L ${me} ${o+p*He+Ee/2} L ${me-12} ${o+p*He+Ee/2+6} Z`},`a-${h.id}`):null),f("path",{class:"fold-notch",d:`M ${_e-8} ${l-8} v 16 M ${_e-4} ${l-11} v 22`}),f("path",{class:"fold-notch",d:`M ${_e+Te+4} ${l-11} v 22 M ${_e+Te+8} ${l-8} v 16`}),f("g",{children:[f("title",{children:`fold gateway, ${e.mcpPath}`}),f("rect",{class:"fold-gate",x:_e,y:l-ht/2,width:Te,height:ht,rx:"2"}),f("path",{class:"fold-node-mark",d:Ko,transform:Pu(c,l-8,56)}),f("text",{class:"fold-anno",x:c,y:l+18,"text-anchor":"middle",children:Wt(e.mcpPath,Te-12,11)})]}),f("text",{class:"fold-anno",x:c,y:l+ht/2+16,"text-anchor":"middle",children:Wt(`${e.policyDefaultDecision} · ${e.policyRules} rules`,150,11)}),n.map((h,p)=>{const m=o+p*He,_=m+Ee/2,g=Vt(h),v=h.namespace?`${h.namespace}${e.namespaceSeparator}*`:h.id,y=h.connected?h.breaker&&h.breaker!=="closed"?`${Ct(h.latencyMs)} · breaker ${h.breaker}`:Ct(h.latencyMs):h.error??"not connected";return f("a",{class:"fold-link",href:`#/upstreams/${encodeURIComponent(h.id)}`,"aria-label":di(h),children:[f("title",{children:di(h)}),f("rect",{class:"fold-node",x:me,y:m,width:dr,height:Ee,rx:"2"}),f("text",{class:"fold-node-label",x:me+14,y:_+5,children:Wt(v,dr-28,14)}),f("text",{class:`fold-anno ${g==="down"?"is-down":""}`,x:hi,y:_+4,children:Wt(y,jn-hi-8,11)})]},h.id)})]})}),f("figcaption",{class:"muted topology-caption",children:[d," of ",t.length," connected",r>0?` · ${r} more not drawn, see the table`:""," · every route crosses auth, policy and audit"]})]})}function mh(e){const t=(s,i)=>typeof s=="string"&&i.includes(s)?s:void 0,n=typeof e.q=="string"&&e.q?e.q:void 0,r=typeof e.sort=="string"&&e.sort?e.sort:void 0;return{...e.view==="map"?{view:"map"}:{},...n?{q:n}:{},...r?{sort:r}:{},...t(e.source,["static","discovered"])?{source:t(e.source,["static","discovered"])}:{},...t(e.status,["connected","disconnected"])?{status:t(e.status,["connected","disconnected"])}:{},...t(e.dir,["asc","desc"])?{dir:t(e.dir,["asc","desc"])}:{}}}const gh=e=>e.breaker==="closed"?"ok":e.breaker==="open"?"bad":"warn";function yh(){const{state:e,isPending:t}=Pn(),n=fr.useSearch(),r=It({from:fr.fullPath}),s=u=>{r({search:h=>({...h,...u}),replace:!0})},i=q(()=>[{key:"id",header:"Upstream",value:u=>u.id,render:u=>f(te,{to:"/upstreams/$id",params:{id:u.id},className:"cell-link",children:u.id})},{key:"namespace",header:"Namespace",value:u=>u.namespace??"",render:u=>Q(u.namespace)},{key:"source",header:"Source",value:u=>u.source??"",render:u=>Q(u.source)},{key:"auth",header:"Auth",value:u=>u.authStrategy??"",render:u=>Q(u.authStrategy)},{key:"connected",header:"Connected",value:u=>u.connected?1:0,render:u=>u.connected?"yes":"no",tone:u=>u.connected?"ok":"bad"},{key:"breaker",header:"Breaker",value:u=>u.breaker??"",render:u=>Q(u.breaker),tone:u=>u.breaker==="closed"?void 0:gh(u)},{key:"latency",header:"Latency",value:u=>u.connected?u.latencyMs??0:Number.MAX_SAFE_INTEGER,render:u=>u.connected?Ct(u.latencyMs):Q(u.error),tone:u=>u.connected?void 0:"warn",wrap:!0},{key:"owner",header:"Owner",value:u=>ur(u.owner),render:u=>ur(u.owner)}],[]),a=e?.upstreams??[],o=q(()=>{const u=a.filter(h=>n.source&&h.source!==n.source||n.status==="connected"&&!h.connected||n.status==="disconnected"&&h.connected?!1:oa([h.id,h.namespace,h.url,h.authStrategy,h.owner?.org,h.owner?.team,...Object.entries(h.labels??{}).map(([p,m])=>`${p}=${m}`)],n.q??""));return aa(u,i,n.sort,n.dir??"asc")},[a,i,n.q,n.source,n.status,n.sort,n.dir]),l=u=>{n.sort===u?s({dir:n.dir==="asc"?"desc":"asc"}):s({sort:u,dir:"asc"})},c=!!(n.q||n.source||n.status),d=n.view==="map"?"map":"table";return f(M,{children:[f(nt,{title:"Upstreams",lede:"Every MCP server this gateway federates, as the gateway last saw it.",actions:f(ut,{topic:"upstreams",children:"Upstream config"}),children:f("div",{class:"filters",children:[f(Wr,{label:"View",value:d,onChange:u=>s({view:u==="map"?"map":void 0}),options:[{value:"table",label:"Table"},{value:"map",label:"Map"}]}),f("input",{type:"search",class:"filter-text",placeholder:"Filter by id, namespace, URL, owner, label…","aria-label":"Filter upstreams",value:n.q??"",onInput:u=>s({q:u.target.value||void 0})}),f("select",{class:"filter-select","aria-label":"Source",value:n.source??"",onChange:u=>s({source:u.target.value||void 0}),children:[f("option",{value:"",children:"Any source"}),f("option",{value:"static",children:"Static"}),f("option",{value:"discovered",children:"Discovered"})]}),f("select",{class:"filter-select","aria-label":"Connection status",value:n.status??"",onChange:u=>s({status:u.target.value||void 0}),children:[f("option",{value:"",children:"Any status"}),f("option",{value:"connected",children:"Connected"}),f("option",{value:"disconnected",children:"Disconnected"})]}),f("output",{class:"muted count","aria-live":"polite",children:[o.length," of ",a.length]})]})}),d==="map"&&e&&o.length>0?f(_h,{state:e,upstreams:o}):f(qr,{caption:"Federated upstreams",columns:i,rows:o,rowKey:u=>u.id,sort:n.sort,dir:n.dir??"asc",onSort:l,loading:t,empty:c?f(Y,{title:"No upstream matches this filter",hint:f("button",{type:"button",class:"linkish",onClick:()=>s({q:void 0,source:void 0,status:void 0}),children:"Clear the filter"})}):f(Y,{title:"No upstreams in the federation",hint:"Add one under `upstreams` in the gateway config, or enable discovery."})})]})}const fr=Lt({getParentRoute:()=>it,path:"/upstreams",validateSearch:mh,component:yh});function pr({title:e,text:t,placeholder:n,tall:r,copyLabel:s,actions:i,follow:a}){const o=H(null),l=H(!0),c=()=>{const d=o.current;d&&(l.current=d.scrollHeight-d.scrollTop-d.clientHeight<48)};return W(()=>{const d=o.current;!a||!d||!l.current||(d.scrollTop=d.scrollHeight)},[a,t]),f("section",{class:"pane-block","aria-label":e,children:[f("div",{class:"pane-head",children:[f("h3",{children:e}),f("div",{class:"pane-actions",children:[i,f(Ye,{value:t,label:s??e})]})]}),f("pre",{ref:o,class:r?"pane tall":"pane",tabIndex:0,onScroll:a?c:void 0,children:t||n})]})}const vh=[{key:"url",header:"Endpoint",value:e=>e.url??"",render:e=>Q(e.url),wrap:!0},{key:"healthy",header:"Health",value:e=>e.healthy?1:0,render:e=>e.healthy?"healthy":"unhealthy",tone:e=>e.healthy?"ok":"bad",sortable:!1}];function bh(){const{id:e}=la.useParams(),{state:t,isPending:n}=Pn();if(!t)return f(Y,{title:n?"Reading the federation snapshot…":"No federation snapshot"});const r=t.upstreams.find(i=>i.id===e);if(!r)return f(Y,{title:`No upstream "${e}" in this federation`,hint:f(M,{children:["It may have been removed, or it may sit outside the visibility your tenant is granted."," ",f(te,{to:"/upstreams",children:"Back to upstreams"})]})});const s=Object.entries(r.labels??{});return f(M,{children:[f(nt,{title:r.id,back:f(te,{to:"/upstreams",className:"back",children:"← Upstreams"}),actions:f(Ye,{value:r.id,label:"Upstream ID"})}),f(le,{title:"Status",children:[f(I,{label:"connected",value:r.connected?"yes":"no",tone:r.connected?"ok":"bad"}),f(I,{label:"breaker",value:Q(r.breaker),tone:r.breaker==="closed"?"ok":r.breaker==="open"?"bad":"warn"}),f(I,{label:"latency",value:r.connected?Ct(r.latencyMs):rt}),r.error?f(I,{label:"error",value:r.error,tone:"bad",wrap:!0}):null]}),f(le,{title:"Configuration",children:[f(I,{label:"namespace",value:Q(r.namespace)}),f(I,{label:"source",value:Q(r.source)}),f(I,{label:"auth strategy",value:Q(r.authStrategy)}),r.url?f(I,{label:"url",value:f(M,{children:[r.url,f(Ye,{value:r.url,label:"Upstream URL"})]}),wrap:!0}):null]}),f(le,{title:"Ownership",children:[f(I,{label:"owner",value:ur(r.owner)}),r.owner?.contact?f(I,{label:"contact",value:f(M,{children:[r.owner.contact,f(Ye,{value:r.owner.contact,label:"Contact"})]}),wrap:!0}):null]}),f("section",{class:"group",children:[f("div",{class:"group-head",children:f("h2",{children:"Labels"})}),s.length?f("div",{class:"chips",children:s.map(([i,a])=>f("span",{class:"chip",children:[i,"=",a]},i))}):f("p",{class:"muted",children:"No labels on this upstream."})]}),f("section",{class:"group",children:[f("div",{class:"group-head",children:f("h2",{children:"Endpoints"})}),f(qr,{caption:`Endpoints for ${r.id}`,columns:vh,rows:r.endpoints??[],rowKey:i=>i.url??"endpoint",empty:f(Y,{title:"Single endpoint",hint:"This upstream is not load-balanced, so the balancer reports no per-replica view."})})]}),f(pr,{title:"Raw record",copyLabel:"Raw record",text:hr(r),placeholder:""})]})}const la=Lt({getParentRoute:()=>it,path:"/upstreams/$id",component:bh});function wh(e){const t=Mt.includes(e.mode)?e.mode:void 0,n=typeof e.q=="string"&&e.q?e.q:void 0,r=typeof e.sort=="string"&&e.sort?e.sort:void 0,s=e.dir==="asc"||e.dir==="desc"?e.dir:void 0;return{...t?{mode:t}:{},...n?{q:n}:{},...r?{sort:r}:{},...s?{dir:s}:{}}}function Qt(e,t){const n=t?e.indexOf(t):-1;return n<=0?{namespace:"",local:e}:{namespace:e.slice(0,n),local:e.slice(n+t.length)}}function Sh(){const{state:e}=Pn(),t=Zo(),n=_r.useSearch(),r=It({from:_r.fullPath}),s=n.mode??"tools",i=e?.namespaceSeparator??"",a=u=>{r({search:h=>({...h,...u}),replace:!0})},o=q(()=>[{key:"name",header:s==="resources"?"URI":"Name",value:u=>Qt(G(s,u),i).local,render:u=>f(te,{to:"/test",search:{mode:s,item:G(s,u)},className:"cell-link",title:G(s,u),children:Qt(G(s,u),i).local})},{key:"namespace",header:"Namespace",value:u=>Qt(G(s,u),i).namespace,render:u=>Q(Qt(G(s,u),i).namespace)},{key:"description",header:"Description",value:u=>u.description??u.title??"",render:u=>Q(u.description??u.title),wrap:!0},{key:"copy",header:"Copy",headerHidden:!0,value:()=>"",sortable:!1,render:u=>f(Ye,{value:G(s,u),label:s==="resources"?"URI":"Name"})}],[s,i]),l=t.catalog[s],c=q(()=>{const u=l.filter(h=>oa([G(s,h),h.title,h.description,h.mimeType],n.q??""));return aa(u,o,n.sort,n.dir??"asc")},[l,o,s,n.q,n.sort,n.dir]),d=u=>{n.sort===u?a({dir:n.dir==="asc"?"desc":"asc"}):a({sort:u,dir:"asc"})};return f(M,{children:[f(nt,{title:"Catalog",lede:"Tools, prompts and resources visible to this principal: the same list any MCP client would receive.",actions:f("button",{type:"button",class:t.status==="ready"?void 0:"primary",onClick:t.connect,disabled:t.status==="connecting",children:t.status==="connecting"?"Connecting…":t.status==="ready"?"Reload catalog":"Connect & list"}),children:f("div",{class:"filters",children:[f(Wr,{label:"Capability",value:s,onChange:u=>a({mode:u,sort:void 0,dir:void 0}),options:Mt.map(u=>({value:u,label:Fe[u].label,count:t.status==="ready"?t.catalog[u].length:void 0}))}),f("input",{type:"search",class:"filter-text",placeholder:"Filter by name, description, namespace…","aria-label":"Filter catalog",value:n.q??"",disabled:t.status!=="ready",onInput:u=>a({q:u.target.value||void 0})}),t.status==="ready"?f("output",{class:"muted count","aria-live":"polite",children:[c.length," of ",l.length]}):null]})}),f(qr,{caption:`${Fe[s].label} visible to this principal`,columns:o,rows:t.status==="ready"?c:[],rowKey:u=>G(s,u),sort:n.sort,dir:n.dir??"asc",onSort:d,empty:Ph(t.status,t.error,l.length,!!n.q,s)})]})}function Ph(e,t,n,r,s){return e==="connecting"?"Connecting to the gateway…":e==="error"?f(Y,{title:"Could not list the catalog",hint:t??void 0}):e==="idle"?f(Y,{title:"Not connected",hint:"Connect to open an MCP session against the gateway and list what this principal may see."}):r&&n?f(Y,{title:"Nothing matches this filter"}):f(Y,{title:`No ${Fe[s].label.toLowerCase()} visible`,hint:"Either no federated server exposes any, or policy denies this principal every one of them."})}const _r=Lt({getParentRoute:()=>it,path:"/catalog",validateSearch:wh,component:Sh});function Ch(e){const t=Mt.includes(e.mode)?e.mode:void 0,n=typeof e.item=="string"&&e.item?e.item:void 0;return{...t?{mode:t}:{},...n?{item:n}:{}}}function Rh(){const e=Zo(),t=mr.useSearch(),n=It({from:mr.fullPath}),r=t.mode??"tools",s=Fe[r],i=e.catalog[r],a=t.item&&i.some(b=>G(r,b)===t.item)?t.item:i[0]?G(r,i[0]):"",o=i.find(b=>G(r,b)===a),[l,c]=A(""),[d,u]=A(""),[h,p]=A(null),[m,_]=A(!1);W(()=>{c(s.args?Au(o):""),u(""),p(null)},[r,a,s.args,o]);const g=b=>{n({search:R=>({...R,...b}),replace:!0})},v=q(()=>e.wire.map(b=>`${b.direction} ${hr(b.message)}`).join(` -`),[e.wire]),y=async()=>{if(!e.client||!a)return;p(null),u("");let b={};if(s.args){const R=l.trim();if(R)try{b=JSON.parse(R)}catch(P){p(`Arguments are not valid JSON: ${P.message}`);return}}_(!0);try{u(hr(await e.client.invoke(r,a,b)))}catch(R){u(R.message)}finally{_(!1)}},S=e.status!=="ready";return f(M,{children:[f(nt,{title:"Test console",lede:"Calls go through the gateway's own MCP endpoint, so policy, rate limits and audit apply exactly as they do for any other client.",actions:f("button",{type:"button",class:e.status==="ready"?void 0:"primary",onClick:e.connect,disabled:e.status==="connecting",children:e.status==="connecting"?"Connecting…":e.status==="ready"?"Reconnect":"Connect & list"})}),e.status==="error"?f("p",{class:"banner bad",role:"alert",children:e.error}):null,S&&e.status!=="connecting"?f(Y,{title:e.status==="error"?"No MCP session":"Not connected",hint:f(M,{children:["Opening a session lists the tools, prompts and resources this principal can reach."," ",f(te,{to:"/catalog",children:"Browse the catalog"})," to see them as a searchable list."]})}):null,S?null:f(M,{children:[f("div",{class:"filters",children:[f(Wr,{label:"What to invoke",value:r,onChange:b=>g({mode:b,item:void 0}),options:$t.map(b=>({value:b,label:Fe[b].label,count:e.status==="ready"?e.catalog[b].length:void 0,disabled:S}))}),f(te,{to:"/catalog",search:{mode:r},className:"linkish",children:"Browse the catalog →"})]}),f("label",{class:"field",children:[f("span",{class:"field-label",children:r==="resources"?"Resource":r==="prompts"?"Prompt":"Tool"}),f("select",{value:a,disabled:S||i.length===0,onChange:b=>g({item:b.target.value}),children:[i.length===0?f("option",{value:"",children:"Nothing available"}):null,i.map(b=>{const R=G(r,b);return f("option",{value:R,children:r==="resources"&&b.name?`${R} (${b.name})`:R},R)})]})]}),o?.description?f("p",{class:"itemdesc muted",children:o.description}):null,f("label",{class:"field",children:[f("span",{class:"field-label",children:["Arguments",o?.inputSchema?.required?.length?f("span",{class:"muted",children:[" · required: ",o.inputSchema.required.join(", ")]}):null]}),f("textarea",{rows:8,spellcheck:!1,disabled:S||!s.args,value:l,placeholder:s.args?'{"argument": "value"}':"resources/read takes no arguments. The URI is the identity.",onInput:b=>c(b.target.value)})]}),h?f("p",{class:"banner bad",role:"alert",children:h}):null,f("div",{class:"row",children:f("button",{type:"button",class:"primary",disabled:S||!a||m,onClick:()=>{y()},children:m?"Calling…":s.verb})}),f(pr,{title:"Result",copyLabel:"Result",text:d,placeholder:"Nothing yet. Call something and the result lands here."}),f(pr,{title:"Wire log",copyLabel:"Wire log",text:v,placeholder:"Every JSON-RPC message this session sends and receives appears here.",tall:!0,follow:!0,actions:f("button",{type:"button",class:"copy",onClick:e.clearWire,disabled:e.wire.length===0,children:"Clear"})})]})]})}const mr=Mt({getParentRoute:()=>it,path:"/test",validateSearch:Rh,component:kh}),xh=it.addChildren([dh,fr,la,_r,mr]),Th=vu({routeTree:xh,history:_l(),defaultPreload:!1}),ua=new Ya({defaultOptions:{queries:{refetchOnWindowFocus:!0,staleTime:5e3,retry:1}}});function Eh(){return f(fc,{client:ua,children:f(sh,{children:f(Su,{router:Th})})})}async function Oh(){const e=await ea(),t=await Gu(e);Ju(e,t),ua.setQueryData(ra,e);const n=document.getElementById("app");if(!n)throw new Error("#app is missing from index.html");Xe(f(Eh,{}),n)}Oh(); +`),[e.wire]),y=async()=>{if(!e.client||!a)return;p(null),u("");let b={};if(s.args){const R=l.trim();if(R)try{b=JSON.parse(R)}catch(P){p(`Arguments are not valid JSON: ${P.message}`);return}}_(!0);try{u(hr(await e.client.invoke(r,a,b)))}catch(R){u(R.message)}finally{_(!1)}},S=e.status!=="ready";return f(M,{children:[f(nt,{title:"Test console",lede:"Calls go through the gateway's own MCP endpoint, so policy, rate limits and audit apply exactly as they do for any other client.",actions:f("button",{type:"button",class:e.status==="ready"?void 0:"primary",onClick:e.connect,disabled:e.status==="connecting",children:e.status==="connecting"?"Connecting…":e.status==="ready"?"Reconnect":"Connect & list"})}),e.status==="error"?f("p",{class:"banner bad",role:"alert",children:e.error}):null,S&&e.status!=="connecting"?f(Y,{title:e.status==="error"?"No MCP session":"Not connected",hint:f(M,{children:["Opening a session lists the tools, prompts and resources this principal can reach."," ",f(te,{to:"/catalog",children:"Browse the catalog"})," to see them as a searchable list."]})}):null,S?null:f(M,{children:[f("div",{class:"filters",children:[f(Wr,{label:"What to invoke",value:r,onChange:b=>g({mode:b,item:void 0}),options:Mt.map(b=>({value:b,label:Fe[b].label,count:e.status==="ready"?e.catalog[b].length:void 0,disabled:S}))}),f(te,{to:"/catalog",search:{mode:r},className:"linkish",children:"Browse the catalog →"})]}),f("label",{class:"field",children:[f("span",{class:"field-label",children:r==="resources"?"Resource":r==="prompts"?"Prompt":"Tool"}),f("select",{value:a,disabled:S||i.length===0,onChange:b=>g({item:b.target.value}),children:[i.length===0?f("option",{value:"",children:"Nothing available"}):null,i.map(b=>{const R=G(r,b);return f("option",{value:R,children:r==="resources"&&b.name?`${R} (${b.name})`:R},R)})]})]}),o?.description?f("p",{class:"itemdesc muted",children:o.description}):null,f("label",{class:"field",children:[f("span",{class:"field-label",children:["Arguments",o?.inputSchema?.required?.length?f("span",{class:"muted",children:[" · required: ",o.inputSchema.required.join(", ")]}):null]}),f("textarea",{rows:8,spellcheck:!1,disabled:S||!s.args,value:l,placeholder:s.args?'{"argument": "value"}':"resources/read takes no arguments. The URI is the identity.",onInput:b=>c(b.target.value)})]}),h?f("p",{class:"banner bad",role:"alert",children:h}):null,f("div",{class:"row",children:f("button",{type:"button",class:"primary",disabled:S||!a||m,onClick:()=>{y()},children:m?"Calling…":s.verb})}),f(pr,{title:"Result",copyLabel:"Result",text:d,placeholder:"Nothing yet. Call something and the result lands here."}),f(pr,{title:"Wire log",copyLabel:"Wire log",text:v,placeholder:"Every JSON-RPC message this session sends and receives appears here.",tall:!0,follow:!0,actions:f("button",{type:"button",class:"copy",onClick:e.clearWire,disabled:e.wire.length===0,children:"Clear"})})]})]})}const mr=Lt({getParentRoute:()=>it,path:"/test",validateSearch:Ch,component:Rh}),kh=it.addChildren([hh,fr,la,_r,mr]),xh=vu({routeTree:kh,history:_l(),defaultPreload:!1}),ua=new Ya({defaultOptions:{queries:{refetchOnWindowFocus:!0,staleTime:5e3,retry:1}}});function Th(){return f(fc,{client:ua,children:f(rh,{children:f(Su,{router:xh})})})}async function Eh(){const e=await ea(),t=await zu(e);Gu(e,t),ua.setQueryData(ra,e);const n=document.getElementById("app");if(!n)throw new Error("#app is missing from index.html");Xe(f(Th,{}),n)}Eh(); diff --git a/docs/design.md b/docs/design.md index 608939d..cd9cedf 100644 --- a/docs/design.md +++ b/docs/design.md @@ -75,8 +75,15 @@ curl the API to see one the page has not learned to render. form from a tool's schema. With no write API to submit one to, the read-only equivalent is to hand the operator a filled-in shape to edit. Required properties only; a skeleton carrying every optional field is noise. -- **Version-aware docs links.** The docs an operator opens from a running - gateway should be the docs for *that* gateway. +- **Docs links straight to the relevant section**, anchored where the page is + broad and the question is narrow. These were *versioned* first — + `docs.fold.run/1.10/configuration/` — on the reasoning that the docs opened + from a running gateway should match that gateway. It is a good idea borrowed + from tools whose docs are published per release. fold's are one unversioned + site, so every link 404'd, and three topic slugs did not exist under any + prefix. Nothing in the repo could have caught it: external navigations are + invisible to the CSP and to any test that does not leave the machine. + `tests/docs-links.spec.ts` now fetches every URL the console can emit. ## The fonts were shipping twice diff --git a/playwright.contract.config.ts b/playwright.contract.config.ts index 3181b65..d688169 100644 --- a/playwright.contract.config.ts +++ b/playwright.contract.config.ts @@ -5,7 +5,10 @@ import { defineConfig } from '@playwright/test' export default defineConfig({ testDir: './tests', - testMatch: 'contract.spec.ts', + // Both suites that talk to something outside this repo: the gateway, and + // the documentation site. Neither belongs in the e2e run, which must stay + // answerable to the code in the pull request. + testMatch: /(contract|docs-links)\.spec\.ts/, forbidOnly: !!process.env.CI, // No retry. A contract either holds or it does not; retrying a shape // mismatch just takes longer to tell you the same thing. diff --git a/src/components/DocsLink.tsx b/src/components/DocsLink.tsx index f7ee061..3a7171f 100644 --- a/src/components/DocsLink.tsx +++ b/src/components/DocsLink.tsx @@ -2,7 +2,6 @@ import { docsLink, type DocTopic } from '@/lib/docs' interface Props { topic: DocTopic - version: string | undefined children: string } @@ -15,9 +14,9 @@ interface Props { * on every page. Out here it also fills the right side of the page header, * which was otherwise empty on the two read-only routes. */ -export function DocsLink({ topic, version, children }: Props) { +export function DocsLink({ topic, children }: Props) { return ( - + {children} → ) diff --git a/src/lib/docs.ts b/src/lib/docs.ts index 05731dc..d2dbb44 100644 --- a/src/lib/docs.ts +++ b/src/lib/docs.ts @@ -1,34 +1,51 @@ -// Version-aware documentation links: the docs an operator opens from a -// running gateway should be the docs for *that* gateway, not for whatever is -// on main. +// Links out to the documentation. // -// These are the only external URLs in the console, and they are navigations -// rather than fetches — CSP's form-action/frame-ancestors do not gate a -// user-initiated link, and connect-src never sees one. The set is fixed and -// CI checks it against the same allowlist fold's own CSP implies. -import { minorLine } from './version' +// These were versioned — `docs.fold.run/1.10/configuration/` — on the reasoning +// that the docs an operator opens from a running gateway should be the docs for +// *that* gateway. It is a good idea, borrowed from tools whose documentation is +// published per release. fold's is not: docs.fold.run is a single unversioned +// Starlight site, so every one of those links was a 404, and three of the topic +// slugs did not exist under any prefix either. +// +// Nothing caught it. They are external navigations, so no CSP rule and no test +// touched them, and a link that looks plausible reads as correct right up until +// somebody clicks it. tests/docs-links.spec.ts now fetches every URL this can +// produce and asserts each one answers 200, which is the only check that would +// have. +// +// Targets below are verified against the live site, anchors included. const DOCS_ROOT = 'https://docs.fold.run' export type DocTopic = | 'configuration' - | 'federation' + | 'upstreams' | 'policy' | 'auth' | 'observability' | 'tenancy' | 'discovery' +/** + * Where each surface of this console sends an operator. + * + * Anchors are used where the page is broad and the question is narrow: someone + * reading the Governance cards wants the `policy` block, not the top of a + * configuration reference that opens on `upstreams`. + */ const TOPIC_PATH: Record = { - configuration: 'configuration', - federation: 'federation', - policy: 'policy', - auth: 'auth', - observability: 'observability', - tenancy: 'tenancy', - discovery: 'discovery', + configuration: 'configuration/', + upstreams: 'configuration/#upstreams-required', + policy: 'configuration/#policy', + auth: 'configuration/#auth-gateway-authentication', + observability: 'operations/', + tenancy: 'tenancy/', + discovery: 'discovery/', } -export function docsLink(topic: DocTopic, gatewayVersion?: string): string { - return `${DOCS_ROOT}/${minorLine(gatewayVersion)}/${TOPIC_PATH[topic]}/` +/** Every URL this module can produce, for the link check to walk. */ +export const DOC_TOPICS = Object.keys(TOPIC_PATH) as DocTopic[] + +export function docsLink(topic: DocTopic): string { + return `${DOCS_ROOT}/${TOPIC_PATH[topic]}` } diff --git a/src/lib/version.ts b/src/lib/version.ts index e2f645c..c1ebc14 100644 --- a/src/lib/version.ts +++ b/src/lib/version.ts @@ -76,12 +76,6 @@ export function skewWarning(gatewayVersion: string | undefined): string | null { ) } -/** "1.9.3" → "1.9" — the docs are published per minor line. */ -export function minorLine(version: string | undefined): string { - const p = parse(version) - return p ? `${p[0]}.${p[1]}` : 'latest' -} - /** Display form: releases get a leading v, "dev" is left alone. */ export function displayVersion(version: string | undefined): string { if (!version) return '' diff --git a/src/routes/overview.tsx b/src/routes/overview.tsx index af5e488..0022131 100644 --- a/src/routes/overview.tsx +++ b/src/routes/overview.tsx @@ -51,7 +51,7 @@ function Overview() { Configuration} + actions={Configuration} /> @@ -103,7 +103,7 @@ function Overview() { Policy docs + Policy docs } > Observability docs + Observability docs } > Discovery docs + Discovery docs } > diff --git a/src/routes/upstreams.tsx b/src/routes/upstreams.tsx index b80803f..b7fd55d 100644 --- a/src/routes/upstreams.tsx +++ b/src/routes/upstreams.tsx @@ -155,7 +155,7 @@ function Upstreams() { Federation docs} + actions={Upstream config} >
{ + for (const topic of DOC_TOPICS) { + test(`${topic} points at a page that exists`, async ({ request }) => { + const url = docsLink(topic) + const res = await request.get(url, { maxRedirects: 5 }) + expect(res.status(), `${url} should exist`).toBe(200) + }) + } + + test('anchors point at headings that exist', async ({ request }) => { + // A wrong anchor does not 404 — it silently lands at the top of the page, + // which is the failure mode that looks like success. Fetch the document + // and look for the id. + const anchored = DOC_TOPICS.map((t) => [t, docsLink(t)] as const).filter(([, url]) => + url.includes('#'), + ) + expect(anchored.length, 'the anchored topics should still be anchored').toBeGreaterThan(0) + + for (const [topic, url] of anchored) { + const [page, id] = url.split('#') + const html = await (await request.get(page!)).text() + expect(html, `${topic}: ${page} has no id="${id}"`).toContain(`id="${id}"`) + } + }) +}) From ce7ff850685e14a909681f0ed3e5d437ece03724 Mon Sep 17 00:00:00 2001 From: Blake Bauman Date: Sat, 15 Aug 2026 07:19:10 -0700 Subject: [PATCH 2/2] build: commit the rebuilt bundle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The merge commit shipped a stale dist/app.js. Resolving the conflict, I ran `git checkout --ours` on it after the rebuild, which put the pre-merge build back over the correct one — so the committed bytes were missing everything #11 added. Worse than the slip was the check: `git diff --quiet -- dist` compares the working tree to the index, and both held the same stale file, so it reported agreement. CI's check is `git diff --exit-code -- dist` *after* a build, which is the only form that means anything, and it is what caught this. Build output has no "ours" side. The resolution for a conflict in dist/ is always to fix the source and rebuild. Co-Authored-By: Claude Opus 5 (1M context) --- dist/app.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/app.js b/dist/app.js index 6caffe5..64dcd38 100644 --- a/dist/app.js +++ b/dist/app.js @@ -1,4 +1,4 @@ -var Rt,E,fi,ge,Zr,pi,_i,Tn,Kt,dt,mi,gr,Hn,qn,gi,tn={},nn=[],ya=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,kt=Array.isArray;function ae(e,t){for(var n in t)e[n]=t[n];return e}function yr(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function z(e,t,n){var r,s,i,a={};for(i in t)i=="key"?r=t[i]:i=="ref"?s=t[i]:a[i]=t[i];if(arguments.length>2&&(a.children=arguments.length>3?Rt.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)a[i]===void 0&&(a[i]=e.defaultProps[i]);return ft(e,a,r,s,null)}function ft(e,t,n,r,s){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:s??++fi,__i:-1,__u:0};return s==null&&E.vnode!=null&&E.vnode(i),i}function yi(){return{current:null}}function M(e){return e.children}function Z(e,t){this.props=e,this.context=t}function Le(e,t){if(t==null)return e.__?Le(e.__,e.__i+1):null;for(var n;tt&&ge.sort(_i),e=ge.shift(),t=ge.length,va(e)}finally{ge.length=rn.__r=0}}function bi(e,t,n,r,s,i,a,o,l,c,d){var u,h,p,m,_,g,v=r&&r.__k||nn,y=t.length;for(l=ba(n,t,v,l,y),u=0;u0?a=e.__k[i]=ft(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[i]=a,l=i+h,a.__=e,a.__b=e.__b+1,o=null,(c=a.__i=wa(a,n,l,u))!=-1&&(u--,(o=n[c])&&(o.__u|=2)),o==null||o.__v==null?(c==-1&&(s>d?h--:sl?h--:h++,a.__u|=4))):e.__k[i]=null;if(u)for(i=0;i(d?1:0)){for(s=n-1,i=n+1;s>=0||i=0?s--:i++])!=null&&(2&c.__u)==0&&o==c.key&&l==c.type)return a}return-1}function es(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||ya.test(t)?n:n+"px"}function Nt(e,t,n,r,s){var i,a;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||es(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||es(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")i=t!=(t=t.replace(mi,"$1")),a=t.toLowerCase(),t=a in e||t=="onFocusOut"||t=="onFocusIn"?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r?n[dt]=r[dt]:(n[dt]=gr,e.addEventListener(t,i?qn:Hn,i)):e.removeEventListener(t,i?qn:Hn,i);else{if(s=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function ts(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Kt]==null)t[Kt]=gr++;else if(t[Kt]0?e:kt(e)?e.map(Ci):e.constructor!==void 0?null:ae({},e)}function Sa(e,t,n,r,s,i,a,o,l){var c,d,u,h,p,m,_,g=n.props||tn,v=t.props,y=t.type;if(y=="svg"?s="http://www.w3.org/2000/svg":y=="math"?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),i!=null){for(c=0;c2&&(o.children=arguments.length>3?Rt.call(arguments,2):n),ft(e.type,o,r||e.key,s||e.ref,null)}function ne(e){function t(n){var r,s;return this.getChildContext||(r=new Set,(s={})[t.__c]=this,this.getChildContext=function(){return s},this.componentWillUnmount=function(){r=null},this.shouldComponentUpdate=function(i){this.props.value!=i.value&&r.forEach(function(a){a.__e=!0,Wn(a)})},this.sub=function(i){r.add(i);var a=i.componentWillUnmount;i.componentWillUnmount=function(){r&&r.delete(i),a&&a.call(i)}}),n.children}return t.__c="__cC"+gi++,t.__=e,t.Provider=t.__l=(t.Consumer=function(n,r){return n.children(r)}).contextType=t,t}Rt=nn.slice,E={__e:function(e,t,n,r){for(var s,i,a;t=t.__;)if((s=t.__c)&&!s.__)try{if((i=s.constructor)&&i.getDerivedStateFromError!=null&&(s.setState(i.getDerivedStateFromError(e)),a=s.__d),s.componentDidCatch!=null&&(s.componentDidCatch(e,r||{}),a=s.__d),a)return s.__E=s}catch(o){e=o}throw e}},fi=0,Z.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=ae({},this.state),typeof e=="function"&&(e=e(ae({},n),this.props)),e&&ae(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Wn(this))},Z.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Wn(this))},Z.prototype.render=M,ge=[],pi=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,_i=function(e,t){return e.__v.__b-t.__v.__b},rn.__r=0,Tn=Math.random().toString(8),Kt="__d"+Tn,dt="__a"+Tn,mi=/(PointerCapture)$|Capture$/i,gr=0,Hn=ts(!1),qn=ts(!0),gi=0;var Ra=0;function f(e,t,n,r,s,i){t||(t={});var a,o,l=t;if("ref"in l)for(o in l={},t)o=="ref"?a=t[o]:l[o]=t[o];var c={type:e,props:l,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Ra,__i:-1,__u:0,__source:s,__self:i};if(typeof e=="function"&&(a=e.defaultProps))for(o in a)l[o]===void 0&&(l[o]=a[o]);return E.vnode&&E.vnode(c),c}var xt=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ka=class extends xt{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<"u"&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},wr=new ka,xa={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Ta=class{#e=xa;#t=!1;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}},Oe=new Ta;function Ea(e){setTimeout(e,0)}var Oa=typeof window>"u"||"Deno"in globalThis;function V(){}function Ia(e,t){return typeof e=="function"?e(t):e}function Vn(e){return typeof e=="number"&&e>=0&&e!==1/0}function xi(e,t){return Math.max(e+(t||0)-Date.now(),0)}function ve(e,t){return typeof e=="function"?e(t):e}function J(e,t){return typeof e=="function"?e(t):e}function ns(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:i,queryKey:a,stale:o}=e;if(a){if(r){if(t.queryHash!==Sr(a,t.options))return!1}else if(!Ze(t.queryKey,a))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof o=="boolean"&&t.isStale()!==o||s&&s!==t.state.fetchStatus||i&&!i(t))}function rs(e,t){const{exact:n,status:r,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(mt(t.options.mutationKey)!==mt(i))return!1}else if(!Ze(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function Sr(e,t){return(t?.queryKeyHashFn||mt)(e)}function mt(e){return JSON.stringify(e,(t,n)=>Kn(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function Ze(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(Array.isArray(e)&&Array.isArray(t)){for(let r=0;r500)return t;const r=ss(e)&&ss(t);if(!r&&!(Kn(e)&&Kn(t)))return t;const i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,l=r?new Array(o):{};let c=0;for(let d=0;d{Oe.setTimeout(t,e)})}function zn(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?Ti(e,t):t}function $a(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function Fa(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Pr=Symbol();function Ei(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Pr?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Oi(e,t){return typeof e=="function"?e(...t):!!e}function Da(e,t,n){let r=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??=t(),r||(r=!0,s.aborted?n():s.addEventListener("abort",n,{once:!0})),s)}),e}var gt=(()=>{let e=()=>Oa;return{isServer(){return e()},setIsServer(t){e=t}}})();function Gn(){let e,t;const n=new Promise((s,i)=>{e=s,t=i});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),e(s)},n.reject=s=>{r({status:"rejected",reason:s}),t(s)},n}var Aa=Ea;function Na(){let e=[],t=0,n=o=>{o()},r=o=>{o()},s=Aa;const i=o=>{t?e.push(o):s(()=>{n(o)})},a=()=>{const o=e;e=[],o.length&&s(()=>{r(()=>{o.forEach(l=>{n(l)})})})};return{batch:o=>{let l;t++;try{l=o()}finally{t--,t||a()}return l},batchCalls:o=>(...l)=>{i(()=>{o(...l)})},schedule:i,setNotifyFunction:o=>{n=o},setBatchNotifyFunction:o=>{r=o},setScheduler:o=>{s=o}}}var U=Na(),Ua=class extends xt{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<"u"&&window.addEventListener){const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(n=>{n(e)}))}isOnline(){return this.#e}},sn=new Ua;function Ba(e){return Math.min(1e3*2**e,3e4)}function Ii(e){return(e??"online")==="online"?sn.isOnline():!0}var Jn=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function Li(e){let t=!1,n=0,r;const s=Gn(),i=()=>s.status!=="pending",a=_=>{if(!i()){const g=new Jn(_);h(g),e.onCancel?.(g)}},o=()=>{t=!0},l=()=>{t=!1},c=()=>wr.isFocused()&&(e.networkMode==="always"||sn.isOnline())&&e.canRun(),d=()=>Ii(e.networkMode)&&e.canRun(),u=_=>{i()||(r?.(),s.resolve(_))},h=_=>{i()||(r?.(),s.reject(_))},p=()=>new Promise(_=>{r=g=>{(i()||c())&&_(g)},e.onPause?.()}).then(()=>{r=void 0,i()||e.onContinue?.()}),m=()=>{if(i())return;let _;const g=n===0?e.initialPromise:void 0;try{_=g??e.fn()}catch(v){_=Promise.reject(v)}Promise.resolve(_).then(u).catch(v=>{if(i())return;const y=e.retry??(gt.isServer()?0:3),S=e.retryDelay??Ba,b=typeof S=="function"?S(n,v):S,R=y===!0||typeof y=="number"&&nc()?void 0:p()).then(()=>{t?h(v):m()})})};return{promise:s,status:()=>s.status,cancel:a,continue:()=>(r?.(),s),cancelRetry:o,continueRetry:l,canStart:d,start:()=>(d()?m():p().then(m),s)}}var Mi=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Vn(this.gcTime)&&(this.#e=Oe.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(gt.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(Oe.clearTimeout(this.#e),this.#e=void 0)}};function ja(e){return{onFetch:(t,n)=>{const r=t.options,s=t.fetchOptions?.meta?.fetchMore?.direction,i=t.state.data?.pages||[],a=t.state.data?.pageParams||[];let o={pages:[],pageParams:[]},l=0;const c=async()=>{let d=!1;const u=m=>{Da(m,()=>t.signal,()=>d=!0)},h=Ei(t.options,t.fetchOptions),p=async(m,_,g)=>{if(d)return Promise.reject(t.signal.reason);if(_==null&&m.pages.length)return Promise.resolve(m);const y=(()=>{const P={client:t.client,queryKey:t.queryKey,pageParam:_,direction:g?"backward":"forward",meta:t.options.meta};return u(P),P})(),S=await h(y),{maxPages:b}=t.options,R=g?Fa:$a;return{pages:R(m.pages,S,b),pageParams:R(m.pageParams,_,b)}};if(s&&i.length){const m=s==="backward",_=m?Ha:os,g={pages:i,pageParams:a},v=_(r,g);o=await p(g,v,m)}else{const m=e??i.length;do{const _=l===0?a[0]??r.initialPageParam:os(r,o);if(l>0&&_==null)break;o=await p(o,_),l++}while(lt.options.persister?.(c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=c}}}function os(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Ha(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var qa=class extends Mi{#e;#t;#n;#r;#i;#s;#a;#o;constructor(e){super(),this.#o=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=cs(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#s?.promise}setOptions(e){if(this.options={...this.#a,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const t=cs(this.options);t.data!==void 0&&(this.setState(as(t.data,t.dataUpdatedAt)),this.#t=t)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#r.remove(this)}setData(e,t){const n=zn(this.state.data,e,this.options);return this.#c({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:"setState",state:e})}cancel(e){const t=this.#s?.promise;return this.#s?.cancel(e),t?t.then(V).catch(V):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>J(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Pr||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>ve(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!xi(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#s?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#s?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#s&&(this.#o||this.#u()?this.#s.cancel({revert:!0}):this.#s.cancelRetry()),this.scheduleGc()),this.#r.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}#u(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"}invalidate(){this.state.isInvalidated||this.#c({type:"invalidate"})}async fetch(e,t){if(this.state.fetchStatus!=="idle"&&this.#s?.status()!=="rejected"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#s)return this.#s.continueRetry(),this.#s.promise}if(e&&this.setOptions(e),!this.options.queryFn){const l=this.observers.find(c=>c.options.queryFn);l&&this.setOptions(l.options)}const n=new AbortController,r=l=>{Object.defineProperty(l,"signal",{enumerable:!0,get:()=>(this.#o=!0,n.signal)})},s=()=>{const l=Ei(this.options,t),d=(()=>{const u={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(u),u})();return this.#o=!1,this.options.persister?this.options.persister(l,d,this):l(d)},a=(()=>{const l={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:s};return r(l),l})();(this.#e==="infinite"?ja(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:"fetch",meta:a.fetchOptions?.meta}),this.#s=Li({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:l=>{l instanceof Jn&&l.revert&&this.setState({...this.#n,fetchStatus:"idle"}),n.abort()},onFail:(l,c)=>{this.#c({type:"failed",failureCount:l,error:c})},onPause:()=>{this.#c({type:"pause"})},onContinue:()=>{this.#c({type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{const l=await this.#s.start();if(l===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(l),this.#r.config.onSuccess?.(l,this),this.#r.config.onSettled?.(l,this.state.error,this),l}catch(l){if(l instanceof Jn){if(l.silent)return this.#s.promise;if(l.revert){if(this.state.data===void 0)throw l;return this.state.data}}throw this.#c({type:"error",error:l}),this.#r.config.onError?.(l,this),this.#r.config.onSettled?.(this.state.data,l,this),l}finally{this.scheduleGc()}}#c(e){const t=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...$i(n.data,this.options),fetchMeta:e.meta??null};case"success":const r={...n,...as(e.data,e.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?r:void 0,r;case"error":const s=e.error;return{...n,error:s,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=t(this.state),U.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),this.#r.notify({query:this,type:"updated",action:e})})}};function $i(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ii(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function as(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function cs(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Wa=class extends xt{constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.#a=Gn(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#s;#a;#o;#u;#c;#p;#h;#d;#l;#_=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),ls(this.#t,this.options)?this.#f():this.updateResult(),this.#v())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Yn(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Yn(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#w(),this.#t.removeObserver(this)}setOptions(e){const t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof J(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#S(),this.#t.setOptions(this.options),t._defaulted&&!Qn(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const r=this.hasListeners();r&&us(this.#t,n,this.options,t)&&this.#f(),this.updateResult(),r&&(this.#t!==n||J(this.options.enabled,this.#t)!==J(t.enabled,this.#t)||ve(this.options.staleTime,this.#t)!==ve(t.staleTime,this.#t))&&this.#m();const s=this.#g();r&&(this.#t!==n||J(this.options.enabled,this.#t)!==J(t.enabled,this.#t)||s!==this.#l)&&this.#y(s)}getOptimisticResult(e){const t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return Qa(this,n)&&(this.#r=n,this.#s=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(n,r)=>(this.trackProp(r),t?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#a.status==="pending"&&this.#a.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,r))})}trackProp(e){this.#_.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#f({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#f(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(V)),t}#m(){this.#b();const e=ve(this.options.staleTime,this.#t);if(gt.isServer()||this.#r.isStale||!Vn(e))return;const n=xi(this.#r.dataUpdatedAt,e)+1;this.#h=Oe.setTimeout(()=>{this.#r.isStale||this.updateResult()},n)}#g(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#y(e){this.#w(),this.#l=e,!(gt.isServer()||J(this.options.enabled,this.#t)===!1||!Vn(this.#l)||this.#l===0)&&(this.#d=Oe.setInterval(()=>{(this.options.refetchIntervalInBackground||wr.isFocused())&&this.#f()},this.#l))}#v(){this.#m(),this.#y(this.#g())}#b(){this.#h!==void 0&&(Oe.clearTimeout(this.#h),this.#h=void 0)}#w(){this.#d!==void 0&&(Oe.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){const n=this.#t,r=this.options,s=this.#r,i=this.#i,a=this.#s,l=e!==n?e.state:this.#n,{state:c}=e;let d={...c},u=!1,h;if(t._optimisticResults){const C=this.hasListeners(),k=!C&&ls(e,t),T=C&&us(e,n,t,r);(k||T)&&(d={...d,...$i(c.data,e.options)}),t._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:p,errorUpdatedAt:m,status:_}=d;h=d.data;let g=!1;if(t.placeholderData!==void 0&&h===void 0&&_==="pending"){let C;s?.isPlaceholderData&&t.placeholderData===a?.placeholderData?(C=s.data,g=!0):C=typeof t.placeholderData=="function"?t.placeholderData(this.#p?.state.data,this.#p):t.placeholderData,C!==void 0&&(_="success",h=zn(s?.data,C,t),u=!0)}if(t.select&&h!==void 0&&!g)if(s&&h===i?.data&&t.select===this.#u)h=this.#c;else try{this.#u=t.select,h=t.select(h),h=zn(s?.data,h,t),this.#c=h,this.#o=null}catch(C){this.#o=C}this.#o&&(p=this.#o,h=this.#c,m=Date.now(),_="error");const v=d.fetchStatus==="fetching",y=_==="pending",S=_==="error",b=y&&v,R=h!==void 0,w={status:_,fetchStatus:d.fetchStatus,isPending:y,isSuccess:_==="success",isError:S,isInitialLoading:b,isLoading:b,data:h,dataUpdatedAt:d.dataUpdatedAt,error:p,errorUpdatedAt:m,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:d.dataUpdateCount>l.dataUpdateCount||d.errorUpdateCount>l.errorUpdateCount,isFetching:v,isRefetching:v&&!y,isLoadingError:S&&!R,isPaused:d.fetchStatus==="paused",isPlaceholderData:u,isRefetchError:S&&R,isStale:Cr(e,t),refetch:this.refetch,promise:this.#a,isEnabled:J(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const C=w.data!==void 0,k=w.status==="error"&&!C,T=$=>{k?$.reject(w.error):C&&$.resolve(w.data)},x=()=>{const $=this.#a=w.promise=Gn();T($)},O=this.#a;switch(O.status){case"pending":e.queryHash===n.queryHash&&T(O);break;case"fulfilled":(k||w.data!==O.value)&&x();break;case"rejected":(!k||w.error!==O.reason)&&x();break}}return w}updateResult(){const e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#s=this.options,this.#i.data!==void 0&&(this.#p=this.#t),Qn(t,e))return;this.#r=t;const n=()=>{if(!e)return!0;const{notifyOnChangeProps:r}=this.options,s=typeof r=="function"?r():r;if(s==="all"||!s&&!this.#_.size)return!0;const i=new Set(s??this.#_);return this.options.throwOnError&&i.add("error"),Object.keys(this.#r).some(a=>{const o=a;return this.#r[o]!==e[o]&&i.has(o)})};this.#P({listeners:n()})}#S(){const e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;const t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#v()}#P(e){U.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function Va(e,t){return J(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&J(t.retryOnMount,e)===!1)}function ls(e,t){return Va(e,t)||e.state.data!==void 0&&Yn(e,t,t.refetchOnMount)}function Yn(e,t,n){if(J(t.enabled,e)!==!1&&ve(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Cr(e,t)}return!1}function us(e,t,n,r){return(e!==t||J(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Cr(e,n)}function Cr(e,t){return J(t.enabled,e)!==!1&&e.isStaleByTime(ve(t.staleTime,e))}function Qa(e,t){return!Qn(e.getCurrentResult(),t)}var Ka=class extends Mi{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||za(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#i({type:"continue"})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=Li({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(new Error("No mutationFn found")),onFail:(i,a)=>{this.#i({type:"failed",failureCount:i,error:a})},onPause:()=>{this.#i({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});const r=this.state.status==="pending",s=!this.#r.canStart();try{if(r)t();else{this.#i({type:"pending",variables:e,isPaused:s}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);const a=await this.options.onMutate?.(e,n);a!==this.state.context&&this.#i({type:"pending",context:a,variables:e,isPaused:s})}const i=await this.#r.start();return await this.#n.config.onSuccess?.(i,e,this.state.context,this,n),await this.options.onSuccess?.(i,e,this.state.context,n),await this.#n.config.onSettled?.(i,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(i,null,e,this.state.context,n),this.#i({type:"success",data:i}),i}catch(i){try{await this.#n.config.onError?.(i,e,this.state.context,this,n)}catch(a){Promise.reject(a)}try{await this.options.onError?.(i,e,this.state.context,n)}catch(a){Promise.reject(a)}try{await this.#n.config.onSettled?.(void 0,i,this.state.variables,this.state.context,this,n)}catch(a){Promise.reject(a)}try{await this.options.onSettled?.(void 0,i,e,this.state.context,n)}catch(a){Promise.reject(a)}throw this.#i({type:"error",error:i}),i}finally{this.#n.runNext(this)}}#i(e){const t=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),U.batch(()=>{this.#t.forEach(n=>{n.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}};function za(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Ga=class extends xt{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){const r=new Ka({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);const t=Ut(e);if(typeof t=="string"){const n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){const t=Ut(e);if(typeof t=="string"){const n=this.#t.get(t);if(n)if(n.length>1){const r=n.indexOf(e);r!==-1&&n.splice(r,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=Ut(e);if(typeof t=="string"){const r=this.#t.get(t)?.find(s=>s.state.status==="pending");return!r||r===e}else return!0}runNext(e){const t=Ut(e);return typeof t=="string"?this.#t.get(t)?.find(r=>r!==e&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){U.batch(()=>{this.#e.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){const t={exact:!0,...e};return this.getAll().find(n=>rs(t,n))}findAll(e={}){return this.getAll().filter(t=>rs(e,t))}notify(e){U.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return U.batch(()=>Promise.all(e.map(t=>t.continue().catch(V))))}};function Ut(e){return e.options.scope?.id}var Ja=class extends xt{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){const r=t.queryKey,s=t.queryHash??Sr(r,t);let i=this.get(s);return i||(i=new qa({client:e,queryKey:r,queryHash:s,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(i)),i}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){U.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(n=>ns(t,n))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(n=>ns(e,n)):t}notify(e){U.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){U.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){U.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Ya=class{#e;#t;#n;#r;#i;#s;#a;#o;constructor(e={}){this.#e=e.queryCache||new Ja,this.#t=e.mutationCache||new Ga,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#s=0}mount(){this.#s++,this.#s===1&&(this.#a=wr.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#o=sn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#s--,this.#s===0&&(this.#a?.(),this.#a=void 0,this.#o?.(),this.#o=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#t.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(ve(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=Ia(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return U.batch(()=>this.#e.findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){const t=this.#e;U.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=this.#e;return U.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=U.batch(()=>this.#e.findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(V).catch(V)}invalidateQueries(e,t={}){return U.batch(()=>(this.#e.findAll(e).forEach(n=>{n.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=U.batch(()=>this.#e.findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,n);return n.throwOnError||(i=i.catch(V)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(V)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=this.#e.build(this,t);return n.isStaleByTime(ve(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(V).catch(V)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(V).catch(V)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return sn.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(mt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#r.values()],n={};return t.forEach(r=>{Ze(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(mt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#i.values()],n={};return t.forEach(r=>{Ze(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Sr(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Pr&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},fe,L,En,hs,et=0,Fi=[],D=E,ds=D.__b,fs=D.__r,ps=D.diffed,_s=D.__c,ms=D.unmount,gs=D.__;function De(e,t){D.__h&&D.__h(L,e,et||t),et=0;var n=L.__H||(L.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function A(e){return et=1,_n(Di,e)}function _n(e,t,n){var r=De(fe++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Di(void 0,t),function(o){var l=r.__N?r.__N[0]:r.__[0],c=r.t(l,o);l!==c&&(r.__N=[c,r.__[1]],r.__c.setState({}))}],r.__c=L,!L.__f)){var s=function(o,l,c){if(!r.__c.__H)return!0;var d=!1,u=r.__c.props!==o;if(r.__c.__H.__.some(function(p){if(p.__N){d=!0;var m=p.__[0];p.__=p.__N,p.__N=void 0,m!==p.__[0]&&(u=!0)}}),i){var h=i.call(this,o,l,c);return d?h||u:h}return!d||u};L.__f=!0;var i=L.shouldComponentUpdate,a=L.componentWillUpdate;L.componentWillUpdate=function(o,l,c){if(this.__e){var d=i;i=void 0,s(o,l,c),i=d}a&&a.call(this,o,l,c)},L.shouldComponentUpdate=s}return r.__N||r.__}function W(e,t){var n=De(fe++,3);!D.__s&&xr(n.__H,t)&&(n.__=e,n.u=t,L.__H.__h.push(n))}function Ae(e,t){var n=De(fe++,4);!D.__s&&xr(n.__H,t)&&(n.__=e,n.u=t,L.__h.push(n))}function H(e){return et=5,q(function(){return{current:e}},[])}function mn(e,t,n){et=6,Ae(function(){if(typeof e=="function"){var r=e(t());return function(){e(null),r&&typeof r=="function"&&r()}}if(e)return e.current=t(),function(){return e.current=null}},n==null?n:n.concat(e))}function q(e,t){var n=De(fe++,7);return xr(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function j(e,t){return et=8,q(function(){return e},t)}function ee(e){var t=L.context[e.__c],n=De(fe++,9);return n.c=e,t?(n.__==null&&(n.__=!0,t.sub(L)),t.props.value):e.__}function Rr(e,t){D.useDebugValue&&D.useDebugValue(t?t(e):e)}function Xa(e){var t=De(fe++,10),n=A();return t.__=e,L.componentDidCatch||(L.componentDidCatch=function(r,s){t.__&&t.__(r,s),n[1](r)}),[n[0],function(){n[1](void 0)}]}function kr(){var e=De(fe++,11);if(!e.__){for(var t=L.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__="P"+n[0]+"-"+n[1]++}return e.__}function Za(){for(var e;e=Fi.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(zt),t.__h.some(Xn),t.__h=[]}catch(n){t.__h=[],D.__e(n,e.__v)}}}D.__b=function(e){L=null,ds&&ds(e)},D.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),gs&&gs(e,t)},D.__r=function(e){fs&&fs(e),fe=0;var t=(L=e.__c).__H;t&&(En===L?(t.__h=[],L.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(zt),t.__h.some(Xn),t.__h=[],fe=0)),En=L},D.diffed=function(e){ps&&ps(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Fi.push(t)!==1&&hs===D.requestAnimationFrame||((hs=D.requestAnimationFrame)||ec)(Za)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),En=L=null},D.__c=function(e,t){t.some(function(n){try{n.__h.some(zt),n.__h=n.__h.filter(function(r){return!r.__||Xn(r)})}catch(r){t.some(function(s){s.__h&&(s.__h=[])}),t=[],D.__e(r,n.__v)}}),_s&&_s(e,t)},D.unmount=function(e){ms&&ms(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(r){try{zt(r)}catch(s){t=s}}),n.__H=void 0,t&&D.__e(t,n.__v))};var ys=typeof requestAnimationFrame=="function";function ec(e){var t,n=function(){clearTimeout(r),ys&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);ys&&(t=requestAnimationFrame(n))}function zt(e){var t=L,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),L=t}function Xn(e){var t=L;e.__c=e.__(),L=t}function xr(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function Di(e,t){return typeof t=="function"?t(e):t}function Ai(e,t){for(var n in t)e[n]=t[n];return e}function Zn(e,t){for(var n in e)if(n!=="__source"&&!(n in t))return!0;for(var r in t)if(r!=="__source"&&e[r]!==t[r])return!0;return!1}function st(e,t){var n=t(),r=A({t:{__:n,u:t}}),s=r[0].t,i=r[1];return Ae(function(){s.__=n,s.u=t,On(s)&&i({t:s})},[e,n,t]),W(function(){return On(s)&&i({t:s}),e(function(){On(s)&&i({t:s})})},[e]),n}function On(e){try{return!((t=e.__)===(n=e.u())&&(t!==0||1/t==1/n)||t!=t&&n!=n)}catch{return!0}var t,n}function gn(e){e()}function Tr(e){return e}function Er(){return[!1,gn]}var Or=Ae;function on(e,t){this.props=e,this.context=t}function Tt(e,t){function n(s){var i=this.props.ref;return i!=s.ref&&i&&(typeof i=="function"?i(null):i.current=null),t?!t(this.props,s)||i!=s.ref:Zn(this.props,s)}function r(s){return this.shouldComponentUpdate=n,z(e,s)}return r.displayName="Memo("+(e.displayName||e.name)+")",r.__f=r.prototype.isReactComponent=!0,r.type=e,r}(on.prototype=new Z).isPureReactComponent=!0,on.prototype.shouldComponentUpdate=function(e,t){return Zn(this.props,e)||Zn(this.state,t)};var vs=E.__b;E.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),vs&&vs(e)};var tc=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function Ir(e){function t(n){var r=Ai({},n);return delete r.ref,e(r,n.ref||null)}return t.$$typeof=tc,t.render=e,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var bs=function(e,t){return e==null?null:de(de(e).map(t))},Ni={map:bs,forEach:bs,count:function(e){return e?de(e).length:0},only:function(e){var t=de(e);if(t.length!==1)throw"Children.only";return t[0]},toArray:de},nc=E.__e;E.__e=function(e,t,n,r){if(e.then){for(var s,i=t;i=i.__;)if((s=i.__c)&&s.__c)return t.__e==null&&(t.__e=n.__e,t.__k=n.__k||[]),s.__c(e,t)}nc(e,t,n,r)};var ws=E.unmount;function Ui(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),e.__c.__H=null),(e=Ai({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return Ui(r,t,n)})),e}function Bi(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return Bi(r,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function be(){this.__u=0,this.o=null,this.__b=null}function ji(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function Hi(e){var t,n,r,s=null;function i(a){if(t||(t=e()).then(function(o){o&&(s=o.default||o),r=!0},function(o){n=o,r=!0}),n)throw n;if(!r)throw t;return s?z(s,a):null}return i.displayName="Lazy",i.__f=!0,i}function Ve(){this.i=null,this.l=null}E.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),ws&&ws(e)},(be.prototype=new Z).__c=function(e,t){var n=t.__c,r=this;r.o==null&&(r.o=[]),r.o.push(n);var s=ji(r.__v),i=!1,a=function(){i||r.__z||(i=!0,n.__R=null,s?s(l):l())};n.__R=a;var o=n.__P;n.__P=null;var l=function(){if(!--r.__u){if(r.state.__a){var c=r.state.__a;r.__v.__k[0]=Bi(c,c.__c.__P,c.__c.__O)}var d;for(r.setState({__a:r.__b=null});d=r.o.pop();)d.__P=o,d.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(a,a)},be.prototype.componentWillUnmount=function(){this.o=[]},be.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=Ui(this.__b,n,r.__O=r.__P)}this.__b=null}var s=t.__a&&z(M,null,e.fallback);return s&&(s.__u&=-33),[z(M,null,t.__a?null:e.children),s]};var Ss=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]>>1,1),t.h.removeChild(s)}}}Xe(z(rc,{context:t.context},e.__v),t.v)}function qi(e,t){var n=z(sc,{__v:e,h:t});return n.containerInfo=t,n}(Ve.prototype=new Z).__a=function(e){var t=this,n=ji(t.__v),r=t.l.get(e);return r[0]++,function(s){var i=function(){t.props.revealOrder?(r.push(s),Ss(t,e,r)):s()};n?n(i):i()}},Ve.prototype.render=function(e){this.i=null,this.l=new Map;var t=de(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},Ve.prototype.componentDidUpdate=Ve.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){Ss(e,n,t)})};var Wi=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,ic=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,oc=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,ac=/[A-Z0-9]/g,cc=typeof document<"u",lc=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};function Vi(e,t,n){return t.__k==null&&(t.textContent=""),Xe(e,t),typeof n=="function"&&n(),e?e.__c:null}function Qi(e,t,n){return ki(e,t),typeof n=="function"&&n(),e?e.__c:null}Z.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(Z.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Ps=E.event;E.event=function(e){return Ps&&(e=Ps(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var Lr,uc={configurable:!0,get:function(){return this.class}},Cs=E.vnode;E.vnode=function(e){typeof e.type=="string"&&(function(t){var n=t.props,r=t.type,s={},i=r.indexOf("-")==-1;for(var a in n){var o=n[a];if(!(a==="value"&&"defaultValue"in n&&o==null||cc&&a==="children"&&r==="noscript"||a==="class"||a==="className")){var l=a.toLowerCase();a==="defaultValue"&&"value"in n&&n.value==null?a="value":a==="download"&&o===!0?o="":l==="translate"&&o==="no"?o=!1:l[0]==="o"&&l[1]==="n"?l==="ondoubleclick"?a="ondblclick":l!=="onchange"||r!=="input"&&r!=="textarea"||lc(n.type)?l==="onfocus"?a="onfocusin":l==="onblur"?a="onfocusout":oc.test(a)&&(a=l):l=a="oninput":i&&ic.test(a)?a=a.replace(ac,"-$&").toLowerCase():o===null&&(o=void 0),l==="oninput"&&s[a=l]&&(a="oninputCapture"),s[a]=o}}r=="select"&&(s.multiple&&Array.isArray(s.value)&&(s.value=de(n.children).forEach(function(c){c.props.selected=s.value.indexOf(c.props.value)!=-1})),s.defaultValue!=null&&(s.value=de(n.children).forEach(function(c){c.props.selected=s.multiple?s.defaultValue.indexOf(c.props.value)!=-1:s.defaultValue==c.props.value}))),n.class&&!n.className?(s.class=n.class,Object.defineProperty(s,"className",uc)):n.className&&(s.class=s.className=n.className),t.props=s})(e),e.$$typeof=Wi,Cs&&Cs(e)};var Rs=E.__r;E.__r=function(e){Rs&&Rs(e),Lr=e.__c};var ks=E.diffed;E.diffed=function(e){ks&&ks(e);var t=e.props,n=e.__e;n!=null&&e.type==="textarea"&&"value"in t&&t.value!==n.value&&(n.value=t.value==null?"":t.value),Lr=null};var Ki={ReactCurrentDispatcher:{current:{readContext:function(e){return Lr.__n[e.__c].props.value},useCallback:j,useContext:ee,useDebugValue:Rr,useDeferredValue:Tr,useEffect:W,useId:kr,useImperativeHandle:mn,useInsertionEffect:Or,useLayoutEffect:Ae,useMemo:q,useReducer:_n,useRef:H,useState:A,useSyncExternalStore:st,useTransition:Er}}},hc="18.3.1";function zi(e){return z.bind(null,e)}function Et(e){return!!e&&e.$$typeof===Wi}function Gi(e){return Et(e)&&e.type===M}function Ji(e){return!!e&&typeof e.displayName=="string"&&e.displayName.indexOf("Memo(")==0}function Yi(e){return Et(e)?Ca.apply(null,arguments):e}function Xi(e){return!!e.__k&&(Xe(null,e),!0)}function Zi(e){return e&&(e.base||e.nodeType===1&&e)||null}var eo=function(e,t){return e(t)},Mr=function(e,t){var n,r=E.debounceRendering;E.debounceRendering=function(i){n=i};try{var s=e(t);return n&&n(),s}finally{E.debounceRendering=r}},to=Et,Ot={useState:A,useId:kr,useReducer:_n,useEffect:W,useLayoutEffect:Ae,useInsertionEffect:Or,useTransition:Er,useDeferredValue:Tr,useSyncExternalStore:st,startTransition:gn,useRef:H,useImperativeHandle:mn,useMemo:q,useCallback:j,useContext:ee,useDebugValue:Rr,version:"18.3.1",Children:Ni,render:Vi,hydrate:Qi,unmountComponentAtNode:Xi,createPortal:qi,createElement:z,createContext:ne,createFactory:zi,cloneElement:Yi,createRef:yi,Fragment:M,isValidElement:Et,isElement:to,isFragment:Gi,isMemo:Ji,findDOMNode:Zi,Component:Z,PureComponent:on,memo:Tt,forwardRef:Ir,flushSync:Mr,unstable_batchedUpdates:eo,StrictMode:M,Suspense:be,SuspenseList:Ve,lazy:Hi,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Ki};const dc=Object.freeze(Object.defineProperty({__proto__:null,Children:Ni,Component:Z,Fragment:M,PureComponent:on,StrictMode:M,Suspense:be,SuspenseList:Ve,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Ki,cloneElement:Yi,createContext:ne,createElement:z,createFactory:zi,createPortal:qi,createRef:yi,default:Ot,findDOMNode:Zi,flushSync:Mr,forwardRef:Ir,hydrate:Qi,isElement:to,isFragment:Gi,isMemo:Ji,isValidElement:Et,lazy:Hi,memo:Tt,render:Vi,startTransition:gn,unmountComponentAtNode:Xi,unstable_batchedUpdates:eo,useCallback:j,useContext:ee,useDebugValue:Rr,useDeferredValue:Tr,useEffect:W,useErrorBoundary:Xa,useId:kr,useImperativeHandle:mn,useInsertionEffect:Or,useLayoutEffect:Ae,useMemo:q,useReducer:_n,useRef:H,useState:A,useSyncExternalStore:st,useTransition:Er,version:hc},Symbol.toStringTag,{value:"Module"}));var no=ne(void 0),ro=e=>{const t=ee(no);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},fc=({client:e,children:t})=>(W(()=>(e.mount(),()=>{e.unmount()}),[e]),f(no.Provider,{value:e,children:t})),so=ne(!1),pc=()=>ee(so);so.Provider;function _c(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var mc=ne(_c()),gc=()=>ee(mc),yc=(e,t,n)=>{const r=n?.state.error&&typeof e.throwOnError=="function"?Oi(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},vc=e=>{W(()=>{e.clearReset()},[e])},bc=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||Oi(n,[e.error,r])),wc=e=>{if(e.suspense){const n=s=>s==="static"?s:Math.max(s??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...s)=>n(r(...s)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Sc=(e,t)=>e.isLoading&&e.isFetching&&!t,Pc=(e,t)=>e?.suspense&&t.isPending,xs=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Cc(e,t,n){const r=pc(),s=gc(),i=ro(),a=i.defaultQueryOptions(e);i.getDefaultOptions().queries?._experimental_beforeQuery?.(a);const o=i.getQueryCache().get(a.queryHash),l=e.subscribed!==!1;a._optimisticResults=r?"isRestoring":l?"optimistic":void 0,wc(a),yc(a,s,o),vc(s);const c=!i.getQueryCache().get(a.queryHash),[d]=A(()=>new t(i,a)),u=d.getOptimisticResult(a),h=!r&&l;if(st(j(p=>{const m=h?d.subscribe(U.batchCalls(p)):V;return d.updateResult(),m},[d,h]),()=>d.getCurrentResult()),W(()=>{d.setOptions(a)},[a,d]),Pc(a,u))throw xs(a,d,s);if(bc({result:u,errorResetBoundary:s,throwOnError:a.throwOnError,query:o,suspense:a.suspense}))throw u.error;return i.getDefaultOptions().queries?._experimental_afterQuery?.(a,u),a.experimental_prefetchInRender&&!gt.isServer()&&Sc(u,r)&&(c?xs(a,d,s):o?.promise)?.catch(V).finally(()=>{d.updateResult()}),a.notifyOnChangeProps?u:d.trackResult(u)}function Ts(e,t){return Cc(e,Wa)}const Rc=!1;var io=Ae;function kc(e,t,n={},r){W(()=>{if(!e.current||r||typeof IntersectionObserver!="function")return;const s=new IntersectionObserver(([i])=>{t(i)},n);return s.observe(e.current),()=>{s.disconnect()}},[t,r,n,e])}function xc(e){const t=H(null);return mn(e,()=>t.current,[]),t}function yt(e){return e[e.length-1]}function Tc(e){return typeof e=="function"}function tt(e,t){return Tc(e)?e(t):e}const oo=Object.prototype.hasOwnProperty,Ec=Object.prototype.propertyIsEnumerable;function ao(e){for(const t in e)if(oo.call(e,t))return!0;return!1}const Oc=()=>Object.create(null),ke=(e,t)=>Ie(e,t,Oc);function Ie(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;const s=t,i=Is(e)&&Is(s);if(!i&&!(an(e)&&an(s)))return s;const a=i?e:Es(e);if(!a)return s;const o=i?s:Es(s);if(!o)return s;const l=a.length,c=o.length,d=i?new Array(c):n();let u=0;for(let h=0;h"u")return!0;const n=t.prototype;return!(!Os(n)||!n.hasOwnProperty("isPrototypeOf"))}function Os(e){return Object.prototype.toString.call(e)==="[object Object]"}function Is(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function we(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,s=e.length;rs||!we(e[a],t[a],n)))return!1;return s===i}return!1}const Ic=/[\x00-\x1f\x7f"<>`{}]/g;function Lc(e){return e.replace(Ic,t=>"%"+t.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0"))}function Ls(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,n=>{try{return decodeURI(n)}catch{return n}})}return Lc(t)}const Mc=["http:","https:","mailto:","tel:"];function cn(e,t){if(!e)return!1;try{const n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function ct(e){if(!e)return{path:e,handledProtocolRelativeURL:!1};if(!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith("//"))return{path:e,handledProtocolRelativeURL:!1};const t=/%25|%5C/gi;let n=0,r="",s;for(;(s=t.exec(e))!==null;)r+=Ls(e.slice(n,s.index))+s[0],n=t.lastIndex;r=r+Ls(n?e.slice(n):e);let i=!1;return r.startsWith("//")&&(i=!0,r="/"+r.replace(/^\/+/,"")),{path:r,handledProtocolRelativeURL:i}}function $c(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Fc(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n{i.next&&(i.prev?(i.prev.next=i.next,i.next.prev=i.prev,i.next=void 0,r&&(r.next=i,i.prev=r)):(i.next.prev=void 0,n=i.next,i.next=void 0,r&&(i.prev=r,r.next=i)),r=i)};return{get(i){const a=t.get(i);if(a)return s(a),a.value},set(i,a){if(t.size>=e&&n){const l=n;t.delete(l.key),l.next&&(n=l.next,l.next.prev=void 0),l===r&&(r=void 0)}const o=t.get(i);if(o)o.value=a,s(o);else{const l={key:i,value:a,prev:r};r&&(r.next=l),r=l,n||(n=l),t.set(i,l)}},clear(){t.clear(),n=void 0,r=void 0}}}const ye=4,co=5;function Dc(e){const t=e.indexOf("{");if(t===-1)return null;const n=e.indexOf("}",t);return n===-1||t+1>=e.length?null:[t,n]}function lo(e,t,n=new Uint16Array(6)){const r=e.indexOf("/",t),s=r===-1?e.length:r,i=e.substring(t,s);if(!i||!i.includes("$"))return n[0]=0,n[1]=t,n[2]=t,n[3]=s,n[4]=s,n[5]=s,n;if(i==="$"){const o=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=o,n[4]=o,n[5]=o,n}if(i.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=s,n[4]=s,n[5]=s,n;const a=Dc(i);if(a){const[o,l]=a,c=i.charCodeAt(o+1);if(c===45){if(o+2!x.parse&&x.caseSensitive===P&&x.prefix===w&&x.suffix===C);if(T)g=T;else{const x=Ac(S,c,P,w,C);g=x,x.parent=s,x.depth=i;let O;S===1?O=s.dynamic??=[]:S===3?O=s.optional??=[]:O=s.wildcard??=[],O.push(x),O.length===2&&a?.push(O)}break}}s=g}if(p&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf("/")+1)===95){const _=Ke(c);_.kind=co,_.parent=s,i++,_.depth=i,s.pathless??=[],s.pathless.push(_),s=_}const m=(n.path||!n.children)&&!n.isRoot;if(m&&c.endsWith("/")){const _=Ke(c);_.kind=ye,_.parent=s,i++,_.depth=i,s.index=_,s=_}s.parse=p??null,s.priority=d?.params?.priority??0,m&&!s.route&&(s.route=n,s.fullPath=c)}if(n.children)for(const c of n.children)yn(e,t,c,l,s,i,a,o)}function uo(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function Ke(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,priority:0}}function Ac(e,t,n,r,s){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:s}}function Nc(e,t){const n=Ke("/"),r=new Uint16Array(6),s=[];for(const i of e)yn(!1,r,i,1,n,0,s);for(const i of s)i.sort(uo);t.masksTree=n,t.flatCache=ln(1e3)}function Uc(e,t){e||="/";const n=t.flatCache.get(e);if(n)return n;const r=Fr(e,t.masksTree);return t.flatCache.set(e,r),r}function Bc(e,t,n,r,s){e||="/",r||="/";const i=t?`case\0${e}`:e;let a=s.singleCache.get(i);return a||(a=Ke("/"),yn(t,new Uint16Array(6),{from:e},1,a,0),s.singleCache.set(i,a)),Fr(r,a,n)}function jc(e,t,n=!1){const r=n?e:`nofuzz\0${e}`,s=t.matchCache.get(r);if(s!==void 0)return s;e||="/";let i;try{i=Fr(e,t.segmentTree,n)}catch(a){if(a instanceof URIError)i=null;else throw a}return i&&(i.branch=fo(i.route)),t.matchCache.set(r,i),i}function Hc(e){return e==="/"?e:e.replace(/\/{1,}$/,"")}function qc(e,t=!1,n){const r=Ke(e.fullPath),s=new Uint16Array(6),i=[],a={},o={};let l=0;yn(t,s,e,1,r,0,i,c=>{if(n?.(c,l),c.id in a&&$r(),a[c.id]=c,l!==0&&c.path){const d=Hc(c.fullPath);(!o[d]||c.fullPath.endsWith("/"))&&(o[d]=c)}l++});for(const c of i)c.sort(uo);return{processedTree:{segmentTree:r,singleCache:ln(1e3),matchCache:ln(1e3),flatCache:null,masksTree:null},routesById:a,routesByPath:o}}function Fr(e,t,n=!1){const r=e.split("/"),s=Vc(e,r,t,n);if(!s)return null;const[i]=ho(e,r,s);return{route:s.node.route,rawParams:i}}function ho(e,t,n){const r=Wc(n.node);let s=null;const i=Object.create(null);let a=n.extract?.part??0,o=n.extract?.node??0,l=n.extract?.path??0,c=n.extract?.segment??0;for(;o=0;P--){const w=u.wildcard[P],{prefix:C,suffix:k}=w;if(!(C&&(S||!(w.caseSensitive?b:R??=b.toLowerCase()).startsWith(C)))){if(k){if(S)continue;const T=t.slice(h).join("/").slice(-k.length);if((w.caseSensitive?T:T.toLowerCase())!==k)continue}o.push({node:w,index:a,skipped:p,statics:m,dynamics:_,optionals:g,extract:v,rawParams:y})}}if(u.optional){const P=p|1<=0;w--){const C=u.optional[w];o.push({node:C,index:h,skipped:P,statics:m,dynamics:_,optionals:g,extract:v,rawParams:y})}if(!S)for(let w=u.optional.length-1;w>=0;w--){const C=u.optional[w],{prefix:k,suffix:T}=C;if(k||T){const x=C.caseSensitive?b:R??=b.toLowerCase();if(k&&!x.startsWith(k)||T&&!x.endsWith(T))continue}o.push({node:C,index:h+1,skipped:p,statics:m,dynamics:_,optionals:g+Bt(a,h),extract:v,rawParams:y})}}if(!S&&u.dynamic&&b)for(let P=u.dynamic.length-1;P>=0;P--){const w=u.dynamic[P],{prefix:C,suffix:k}=w;if(C||k){const T=w.caseSensitive?b:R??=b.toLowerCase();if(C&&!T.startsWith(C)||k&&!T.endsWith(k))continue}o.push({node:w,index:h+1,skipped:p,statics:m,dynamics:_+Bt(a,h),optionals:g,extract:v,rawParams:y})}if(!S&&u.staticInsensitive){const P=u.staticInsensitive.get(R??=b.toLowerCase());P&&o.push({node:P,index:h+1,skipped:p,statics:m+Bt(a,h),dynamics:_,optionals:g,extract:v,rawParams:y})}if(!S&&u.static){const P=u.static.get(b);P&&o.push({node:P,index:h+1,skipped:p,statics:m+Bt(a,h),dynamics:_,optionals:g,extract:v,rawParams:y})}if(u.pathless)for(let P=u.pathless.length-1;P>=0;P--){const w=u.pathless[P];o.push({node:w,index:h,skipped:p,statics:m,dynamics:_,optionals:g,extract:v,rawParams:y})}}if(c)return c;if(r&&l){let d=l.index;for(let h=0;he.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===ye)>(e.node.kind===ye)||t.node.kind===ye==(e.node.kind===ye)&&t.node.depth>e.node.depth))):!0}function Gt(e){return Dr(e.filter(t=>t!==void 0).join("/"))}function Dr(e){return e.replace(/\/{2,}/g,"/")}function po(e){return e==="/"?e:e.replace(/^\/{1,}/,"")}function ue(e){const t=e.length;return t>1&&e[t-1]==="/"?e.replace(/\/{1,}$/,""):e}function _o(e){return ue(po(e))}function un(e,t){return e?.endsWith("/")&&e!=="/"&&e!==`${t}/`?e.slice(0,-1):e}function Kc(e,t,n){return un(e,n)===un(t,n)}function zc({base:e,to:t,trailingSlash:n="never",cache:r}){const s=t===".",i=t.startsWith("/");let a;if(r){a=i?t:s?e:e+"\0"+t;const c=r.get(a);if(c)return c}let o;if(s)o=e.split("/");else if(i)o=t.split("/");else{for(o=e.split("/");o.length>1&&yt(o)==="";)o.pop();const c=t.split("/");for(let d=0,u=c.length;d1?o.pop():o=[""]:h==="."||o.push(h)}}o.length>1&&(yt(o)===""?n==="never"&&o.pop():n==="always"&&o.push(""));const l=Dr(o.join("/"))||"/";return a&&r&&r.set(a,l),l}function Gc(e){const t=new Map(e.map(s=>[encodeURIComponent(s),s])),n=Array.from(t.keys()).map(s=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),r=new RegExp(n,"g");return s=>s.replace(r,i=>t.get(i)??i)}function In(e,t,n){const r=t[e];return typeof r!="string"?r:e==="_splat"?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split("/").map(s=>Fs(s,n)).join("/"):Fs(r,n)}function $s({path:e,params:t,decoder:n,...r}){let s=!1;const i=Object.create(null);if(!e||e==="/")return{interpolatedPath:"/",usedParams:i,isMissingParams:s};if(!e.includes("$"))return{interpolatedPath:e,usedParams:i,isMissingParams:s};const a=e.length;let o=0,l,c="";for(;oe.state.__TSR_key||e.href;function tl(e){const t=e.getAttribute(Ds);if(t)return`[${Ds}="${t}"]`;let n="",r=e,s;for(;s=r.parentNode;){let i=1,a=r;for(;a=a.previousElementSibling;)i++;const o=`${r.localName}:nth-child(${i})`;n=n?`${o} > ${n}`:o,r=s}return n}let Ht=!1;const Jt="window";function er(e){try{return typeof e=="function"?e():document.querySelector(e)}catch{}}function As(e){const t=new Set;for(const n of e){if(n===Jt)continue;const r=er(n);r&&t.add(r)}return t}function nl(e,t){const n=e.options.scrollRestoration,r=e._scroll;n&&(r.restoring=!0);const s=e.options.getScrollRestorationKey||el,i=new Set,a=o=>{const l=qe[o]||={};for(const c of i)c===document?l[Jt]={scrollX,scrollY}:c.isConnected&&(l[tl(c)]={scrollX:c.scrollLeft,scrollY:c.scrollTop})};n&&!r.restoration&&(r.restoration=!0,Ht=!1,history.scrollRestoration="manual",document.addEventListener("scroll",o=>{Ht||i.add(o.target)},!0),e.subscribe("onBeforeLoad",o=>{o.fromLocation&&a(s(o.fromLocation)),i.clear()}),addEventListener("pagehide",()=>{a(s(e.stores.resolvedLocation.get()??e.stores.location.get())),Zc()})),!r.reset&&(r.reset=!0,e.subscribe("onRendered",o=>{const l=e.options.scrollRestorationBehavior,c=e.options.scrollToTopSelectors,d=r.next,u=r.hash;let h;if(i.clear(),r.next=!0,r.hash=!1,typeof e.options.scrollRestoration=="function"&&!e.options.scrollRestoration({location:e.latestLocation}))return;const p=s(o.toLocation),m=o.fromLocation&&s(o.fromLocation);if(r.restoring&&m&&m!==p){const _=qe[m];if(_){let g=qe[p];for(const v in _){if(v===Jt){if(d)continue}else{const y=er(v);if(!y||d&&c&&(h??=As(c),h.has(y)))continue}g||(g=qe[p]={}),g[v]??=_[v]}}}Ht=!0;try{const _=o.toLocation.hash,g=o.toLocation.state.__hashScrollIntoViewOptions??!0;let v=!1;if(d){!_&&c&&(h??=As(c));const y=_&&g&&u,S=r.restoring?qe[p]:void 0;if(S)for(const b in S){const{scrollX:R,scrollY:P}=S[b];if(b===Jt){if(y)continue;scrollTo({top:P,left:R,behavior:l}),v=!0}else{const w=er(b);w&&(w.scrollLeft=R,w.scrollTop=P,h?.delete(w))}}if(!_){const b={top:0,left:0,behavior:l};if(v||scrollTo(b),h)for(const R of h)R.scrollTo(b)}}!v&&_&&g&&document.getElementById(_)?.scrollIntoView(g)}finally{Ht=!1}}))}function rl(e,t=String){const n=new URLSearchParams;for(const r in e){const s=e[r];s!==void 0&&n.set(r,t(s))}return n.toString()}function Ln(e){return e?e==="false"?!1:e==="true"?!0:+e*0===0&&+e+""===e?+e:e:""}function sl(e){const t=new URLSearchParams(e),n=Object.create(null);for(const[r,s]of t.entries()){const i=n[r];i==null?n[r]=Ln(s):Array.isArray(i)?i.push(Ln(s)):n[r]=[i,Ln(s)]}return n}const il=/^(?:\s|["[{\d-]|fa|nu|tr)/,ol=cl(JSON.parse),al=ll(JSON.stringify,JSON.parse);function cl(e){return t=>{t[0]==="?"&&(t=t.substring(1));const n=sl(t);for(const r in n){const s=n[r];if(typeof s=="string")try{n[r]=e(s)}catch{}}return n}}function ll(e,t){const n=t===JSON.parse;function r(s){if(s&&typeof s=="object")try{return e(s)}catch{}else if(t&&typeof s=="string"){if(n&&!il.test(s))return s;try{return t(s),e(s)}catch{}}return s}return s=>{const i=rl(s,r);return i?`?${i}`:""}}const ze="__root__";function ul(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&!e.reloadDocument&&typeof e.href=="string")try{new URL(e.href),e.reloadDocument=!0}catch{}const t=new Headers(e.headers);e.href&&t.get("Location")===null&&t.set("Location",e.href);const n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function Ar(e){return e instanceof Response&&!!e.options}function hl(e){return{input:({url:t})=>{for(const n of e)t=tr(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=go(e[n],t);return t}}}function dl(e){const t=_o(e.basepath),n=`/${t}`,r=e.caseSensitive?n:n.toLowerCase(),s=`${r}/`;return{input:({url:i})=>{const a=e.caseSensitive?i.pathname:i.pathname.toLowerCase();return a===r?i.pathname="/":a.startsWith(s)&&(i.pathname=i.pathname.slice(n.length)),i},output:({url:i})=>(i.pathname=Gt(["/",t,i.pathname]),i)}}function tr(e,t){const n=e?.input?.({url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function go(e,t){const n=e?.output?.({url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function fl(e,t){const{createMutableStore:n,createReadonlyStore:r,batch:s}=t,i=new Map,a=n("idle"),o=n(e),l=n(void 0),c=n([]),d=r(()=>c.get().map(_=>i.get(_).get())),u=r(()=>({status:a.get(),isLoading:a.get()==="pending",matches:d.get(),location:o.get(),resolvedLocation:l.get()}));function h(_){let g=i.get(_);return g||(g=n(void 0),i.set(_,g)),g}const p={status:a,location:o,resolvedLocation:l,ids:c,matches:d,byRoute:i,__store:u,getMatchStore:h,setMatches:m};function m(_){const g=c.get(),v=_.map(y=>y.routeId);s(()=>{Fc(g,v)||c.set(v);for(const y of g)v.includes(y)||i.get(y).set(()=>{});for(const y of _){const S=h(y.routeId);S.get()!==y&&S.set(y)}})}return p}var Se="__TSR_index",Ns="popstate",Us="beforeunload";function pl(e){let t=e.getLocation();const n=new Set,r=a=>{t=e.getLocation(),n.forEach(o=>o({location:t,action:a}))},s=a=>{e.notifyOnIndexChange??!0?r(a):t=e.getLocation()},i=async({task:a,navigateOpts:o,...l})=>{if(o?.ignoreBlocker??!1){a();return}const c=e.getBlockers?.()??[],d=l.type==="PUSH"||l.type==="REPLACE";if(typeof document<"u"&&c.length&&d)for(const u of c){const h=vt(l.path,l.state);if(await u.blockerFn({currentLocation:t,nextLocation:h,action:l.type})){e.onBlocked?.();return}}a()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:a=>(n.add(a),()=>{n.delete(a)}),push:(a,o,l)=>{const c=t.state[Se];o=Bs(c+1,o),i({task:()=>{e.pushState(a,o),r({type:"PUSH"})},navigateOpts:l,type:"PUSH",path:a,state:o})},replace:(a,o,l)=>{const c=t.state[Se];o=Bs(c,o),i({task:()=>{e.replaceState(a,o),r({type:"REPLACE"})},navigateOpts:l,type:"REPLACE",path:a,state:o})},go:(a,o)=>{i({task:()=>{e.go(a),s({type:"GO",index:a})},navigateOpts:o,type:"GO"})},back:a=>{i({task:()=>{e.back(a?.ignoreBlocker??!1),s({type:"BACK"})},navigateOpts:a,type:"BACK"})},forward:a=>{i({task:()=>{e.forward(a?.ignoreBlocker??!1),s({type:"FORWARD"})},navigateOpts:a,type:"FORWARD"})},canGoBack:()=>t.state[Se]!==0,createHref:a=>e.createHref(a),block:a=>{if(!e.setBlockers)return()=>{};const o=e.getBlockers?.()??[];return e.setBlockers([...o,a]),()=>{const l=e.getBlockers?.()??[];e.setBlockers?.(l.filter(c=>c!==a))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}function Bs(e,t){t||(t={});const n=Nr();return{...t,key:n,__TSR_key:n,[Se]:e}}function yo(e){const t=e?.window??(typeof document<"u"?window:void 0),n=t.history.pushState,r=t.history.replaceState;let s=[];const i=()=>s,a=w=>s=w,o=e?.createHref??(w=>w),l=e?.parseLocation??(()=>vt(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){const w=Nr();t.history.replaceState({[Se]:0,key:w,__TSR_key:w},"")}let c=l(),d,u=!1,h=!1,p=!1,m=!1;const _=()=>c;let g;const v=()=>{g&&(P._ignoreSubscribers=!0,(g[2]?t.history.pushState:t.history.replaceState)(g[1],"",g[0]),P._ignoreSubscribers=!1,g=void 0,d=void 0)},y=(w,C,k)=>{const T=o(C),x=!!g;x||(d=c),c=vt(C,k),g=[T,k,g?.[2]||w],x||queueMicrotask(()=>v())},S=w=>{c=l(),P.notify({type:w})},b=async()=>{if(h){h=!1;return}const w=l(),C=w.state[Se]-c.state[Se],k=C===1,T=C===-1,x=!k&&!T||u;u=!1;const O=x?"GO":T?"BACK":"FORWARD",$=x?{type:"GO",index:C}:{type:T?"BACK":"FORWARD"};if(p)p=!1;else{const ot=i();if(typeof document<"u"&&ot.length){for(const se of ot)if(await se.blockerFn({currentLocation:c,nextLocation:w,action:O})){h=!0,t.history.go(1),P.notify($);return}}}c=l(),P.notify($)},R=w=>{if(m){m=!1;return}let C=!1;const k=i();if(typeof document<"u"&&k.length)for(const T of k){const x=T.enableBeforeUnload??!0;if(x===!0){C=!0;break}if(typeof x=="function"&&x()===!0){C=!0;break}}if(C)return w.preventDefault(),w.returnValue=""},P=pl({getLocation:_,getLength:()=>t.history.length,pushState:(w,C)=>y(!0,w,C),replaceState:(w,C)=>y(!1,w,C),back:w=>(w&&(p=!0),m=!0,t.history.back()),forward:w=>{w&&(p=!0),m=!0,t.history.forward()},go:w=>{u=!0,t.history.go(w)},createHref:w=>o(w),flush:v,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(Us,R,{capture:!0}),t.removeEventListener(Ns,b)},onBlocked:()=>{d&&c!==d&&(c=d)},getBlockers:i,setBlockers:a,notifyOnIndexChange:!1});return t.addEventListener(Us,R,{capture:!0}),t.addEventListener(Ns,b),t.history.pushState=function(...w){const C=n.apply(t.history,w);return P._ignoreSubscribers||S("PUSH"),C},t.history.replaceState=function(...w){const C=r.apply(t.history,w);return P._ignoreSubscribers||S("REPLACE"),C},P}function _l(e){const t=typeof document<"u"?window:void 0;return yo({window:t,parseLocation:()=>{const n=t.location.hash.split("#").slice(1),r=n[0]??"/",s=t.location.search,i=n.slice(1);return vt(`${r}${s}${i.length===0?"":`#${i.join("#")}`}`,t.history.state)},createHref:n=>`${t.location.pathname}${t.location.search}#${n}`})}function ml(e){let t=e.replace(/[\x00-\x1f\x7f]/g,"");return t.startsWith("//")&&(t="/"+t.replace(/^\/+/,"")),t}function vt(e,t){const n=ml(e),r=n.indexOf("#"),s=n.indexOf("?"),i=Nr();return{href:n,pathname:n.substring(0,r>0?s>0?Math.min(r,s):r:s>0?s:n.length),hash:r>-1?n.substring(r):"",search:s>-1?n.slice(s,r===-1?void 0:r):"",state:t||{[Se]:0,key:i,__TSR_key:i}}}function Nr(){return(Math.random()+1).toString(36).substring(7)}function js(e){return e.options.loader||e.options.beforeLoad||e.lazyFn||e.options.component?.preload||e.options.pendingComponent?.preload}function vn(e,t){return{fromLocation:t,toLocation:e,pathChanged:t?.pathname!==e.pathname,hrefChanged:t?.href!==e.href,hashChanged:t?.hash!==e.hash}}function Hs({key:e,__TSR_key:t,__TSR_index:n,__hashScrollIntoViewOptions:r,...s}){return s}function gl(e,t,n,r){for(const s of t){if(r?.()===!1)return;n.some(i=>i.routeId===s.routeId)||e.routesById[s.routeId].options.onLeave?.(s)}for(const s of n){if(r?.()===!1)return;e.routesById[s.routeId].options[t.some(i=>i.routeId===s.routeId)?"onStay":"onEnter"]?.(s)}}var yl=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={next:!0},this.subscribers=new Set,this._cache=new Map,this._committed=[],this.routeBranchCache=new WeakMap,this.lightweightCache=new WeakMap,this.startTransition=async n=>(n(),!1),this.update=n=>{const r=this.options,s=this.basepath??r?.basepath??"/",i=this.basepath===void 0,a=r?.rewrite;if(this.options={...r,...n},this.isServer=this.options.isServer??Rc??typeof document>"u",this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=Gc(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=yo()),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 c;this.resolvePathCache=ln(1e3),c=this.buildRouteTree(),this.setRoutes(c)}if(!this.stores&&this.latestLocation){const c=this.getStoreConfig(this);this.batch=c.batch,this.stores=fl(this.latestLocation,c),nl(this)}const o=this.options.basepath??"/",l=this.options.rewrite;if(i||s!==o||a!==l){this.basepath=o;const c=[],d=_o(o);d&&d!=="/"&&c.push(dl({basepath:o})),l&&c.push(l),this.rewrite=c.length===0?void 0:c.length===1?c[0]:hl(c),this.history&&this.updateLatestLocation(),this.stores&&this.stores.location.set(this.latestLocation)}},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{const n=qc(this.routeTree,this.options.caseSensitive,(r,s)=>{r.init({originalIndex:s})});return this.options.routeMasks&&Nc(this.options.routeMasks,n.processedTree),n},this.subscribe=(n,r)=>{const s={eventType:n,fn:r};return this.subscribers.add(s),()=>{this.subscribers.delete(s)}},this.emit=n=>{for(const r of this.subscribers)if(r.eventType===n.type)try{r.fn(n)}catch(s){console.error(s)}},this.parseLocation=(n,r)=>{const s=({pathname:l,search:c,hash:d,href:u,state:h})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(l)){const v=this.options.parseSearch(c),y=this.options.stringifySearch(v);return{href:l+y+d,publicHref:l+y+d,pathname:ct(l).path,external:!1,searchStr:y,search:ke(r?.search,v),hash:ct(d.slice(1)).path,state:Ie(r?.state,h)}}const p=new URL(u,this.origin),m=tr(this.rewrite,p),_=this.options.parseSearch(m.search),g=this.options.stringifySearch(_);return m.search=g,{href:m.href.replace(m.origin,""),publicHref:u,pathname:ct(m.pathname).path,external:!!this.rewrite&&m.origin!==this.origin,searchStr:g,search:ke(r?.search,_),hash:ct(m.hash.slice(1)).path,state:Ie(r?.state,h)}},i=s(n),{__tempLocation:a,__tempKey:o}=i.state;if(a&&(!o||o===this.tempLocationKey)){const l=s(a);return l.state.key=i.state.key,l.state.__TSR_key=i.state.__TSR_key,delete l.state.__tempLocation,{...l,maskedLocation:i}}return i},this.resolvePathWithBase=(n,r)=>zc({base:n,to:r.includes("//")?Dr(r):r,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(n,r,s)=>typeof n=="string"?this.matchRoutesInternal({pathname:n,search:r},s):this.matchRoutesInternal(n,r),this.getMatchedRoutes=n=>{const r=Object.create(null),s=jc(ue(n),this.processedTree,!0);return s&&Object.assign(r,s.rawParams),[s?.branch||[this.routesById.__root__],r,s?.route]},this.buildLocation=n=>{const r=(i={})=>{const a=i._fromLocation||this._pendingLocation||this.latestLocation,o=this.matchRoutesLightweight(a);i.from;const l=i.unsafeRelative==="path"?a.pathname:i.from??o[1],c=i.to?`${i.to}`:void 0,d=o[2],u=Object.assign(Object.create(null),o[3]),h=c?.charCodeAt(0)===47?"/":this.resolvePathWithBase(l,"."),p=c?this.resolvePathWithBase(h,c):h,m=qs(i.params,u),_=this.routesByPath[ue(p)];let g;if(_)g=this.getRouteBranch(_);else if(p.includes("$"))g=[];else{const[x,O,$]=this.getMatchedRoutes(p);g=x,this.options.notFoundRoute&&(!$||$.path!=="/"&&O["**"])&&(g=[...g,this.options.notFoundRoute])}if(g.length&&ao(m))for(const x of g){const O=x.options.params?.stringify??x.options.stringifyParams;if(O)try{Object.assign(m,O(m))}catch{}}const v=n.leaveParams?p:ct($s({path:p,params:m,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path;let y=d;if(n._includeValidateSearch&&this.options.search?.strict){const x={};g.forEach(O=>{if(O.options.validateSearch)try{Object.assign(x,Yt(O.options.validateSearch,{...x,...y}))}catch{}}),y=x}y=bl(y,i,g,n._includeValidateSearch),y=ke(d,y);const S=this.options.stringifySearch(y),b=i.hash===!0?a.hash:i.hash?tt(i.hash,a.hash):void 0,R=b?`#${b}`:"";let P=i.state===!0?a.state:i.state?tt(i.state,a.state):{};P=Ie(a.state,P);const w=`${v}${S}${R}`;let C,k,T=!1;if(this.rewrite){const x=new URL(w,this.origin),O=go(this.rewrite,x);C=x.href.replace(x.origin,""),O.origin!==this.origin?(k=O.href,T=!0):k=O.pathname+O.search+O.hash}else C=$c(w),k=C;return{publicHref:k,href:C,pathname:v,search:y,searchStr:S,state:P,hash:b??"",external:T,unmaskOnReload:i.unmaskOnReload}},s=(i={},a)=>{const o=r(i);let l=a?r(a):void 0;if(!l){const c=Object.create(null);if(this.options.routeMasks){const d=Uc(o.pathname,this.processedTree);if(d){Object.assign(c,d.rawParams);const{from:u,params:h,...p}=d.route,m=qs(h,c);a={from:n.from,...p,params:m},l=r(a)}}}return l&&(o.maskedLocation=l),o};return n.mask?s(n,{from:n.from,...n.mask}):s(n)},this.commitLocation=async({viewTransition:n,ignoreBlocker:r,...s})=>{let i;const a=ue(this.latestLocation.href)===ue(s.href)&&we(Hs(s.state),Hs(this.latestLocation.state)),o=this._commitPromise;let l;const c=new Promise(d=>{l=d});if(c.resolve=()=>{l(),o?.resolve()},this._commitPromise=c,a)this.load();else{let{maskedLocation:d,hashScrollIntoView:u,...h}=s;d&&(h={...d,state:{...d.state,__tempKey:void 0,__tempLocation:{...h,search:h.searchStr,state:{...h.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(h.unmaskOnReload??this.options.unmaskOnReload??!1)&&(h.state.__tempKey=this.tempLocationKey)),h.state.__hashScrollIntoViewOptions=u??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=n,i=s.replace?"REPLACE":"PUSH",this.history[i==="REPLACE"?"replace":"push"](h.publicHref,h.state,{ignoreBlocker:r}),this.history.subscribers.size||this.load({action:{type:i}})}return this._scroll.next=s.resetScroll??!0,this._commitPromise},this.buildAndCommitLocation=({replace:n,resetScroll:r,hashScrollIntoView:s,viewTransition:i,ignoreBlocker:a,_redirects:o,href:l,...c}={})=>{if(l){const h=this.history.location.state.__TSR_index,p=vt(l,{__TSR_index:n?h:h+1}),m=new URL(p.pathname,this.origin);c.to=tr(this.rewrite,m).pathname,c.search=this.options.parseSearch(p.search),c.hash=p.hash.slice(1)}const d=this.buildLocation({...c,_includeValidateSearch:!0});o&&(d._redirects=o),this._pendingLocation=d;const u=this.commitLocation({...d,viewTransition:i,replace:n,resetScroll:r,hashScrollIntoView:s,ignoreBlocker:a});return queueMicrotask(()=>{this._pendingLocation===d&&(this._pendingLocation=void 0)}),u},this.navigate=async({to:n,reloadDocument:r,href:s,publicHref:i,...a})=>{let o=!1;if(s)try{new URL(`${s}`),o=!0}catch{}if(o&&!r&&(r=!0),r){if(n!==void 0||!s){const c=this.buildLocation({to:n,...a});s=s??c.publicHref,i=i??c.publicHref}const l=!o&&i?i:s;if(cn(l,this.protocolAllowlist))return;if(!a.ignoreBlocker){const c=this.history.getBlockers?.()??[];for(const d of c)if(d?.blockerFn&&await d.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:"PUSH"}))return}a.replace?window.location.replace(l):window.location.href=l;return}return this.buildAndCommitLocation({...a,href:s,to:n,_isNavigate:!0})},this.load=async n=>{this.updateLatestLocation(),n?.action&&(this._scroll.hash=n.action.type==="PUSH"||n.action.type==="REPLACE"),await El(this,n)},this.startViewTransition=n=>{const r=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,r&&typeof document.startViewTransition=="function"){let s;if(typeof r=="object"&&window.CSS?.supports?.("selector(:active-view-transition-type(a))")){const i=this.latestLocation,a=this.stores.resolvedLocation.get(),o=typeof r.types=="function"?r.types(vn(i,a)):r.types;if(o===!1)return n();s={update:n,types:o}}else s=n;return document.startViewTransition(s).updateCallbackDone}return n()},this.invalidate=n=>{const r=this._committed,s=n?.filter,i=this._preloads,a=new Set([...r,...this._cache.values(),...[...i?.values()??[]].flat(),...this._tx?.[3]??[]].filter(c=>!s||s(c)).map(c=>c.id)),o=[];for(const[c,d]of i??[])d.some(u=>a.has(u.id))&&(i.delete(c),o.push(c));const l=c=>{if(a.has(c.id)){const d=this.routesById[c.routeId],u={...c,invalid:!0,...(n?.forcePending||c.status==="error"||c.status==="notFound")&&js(d)?{status:"pending",error:void 0}:void 0};return c._flight=void 0,u}return c};this._committed=r.map(l);for(const[c,d]of this._cache)a.has(c)&&(d.invalid=!0,n?.forcePending&&(d.status="pending"));for(const c of a)this._flights?.delete(c);for(const c of o)c.abort();return this.shouldViewTransition=!1,this.load({sync:n?.sync})},this.resolveRedirect=n=>{const r=n.headers.get("Location");if(!n.options.href||n.options._builtLocation){const s=(n.options._builtLocation??this.buildLocation(n.options)).publicHref||"/";n.options.href=s,n.headers.set("Location",s)}else if(r)try{const s=new URL(r);if(this.origin&&s.origin===this.origin){const i=s.pathname+s.search+s.hash;n.options.href=i,n.headers.set("Location",i)}}catch{}if(n.options.href&&!n.options._builtLocation&&cn(n.options.href,this.protocolAllowlist))throw new Error("Redirect blocked: unsafe protocol");return n.headers.get("Location")||n.headers.set("Location",n.options.href),n},this.clearCache=n=>{const r=this._cache,s=this._preloads,i=n?.filter,a=[],o=[];for(const[c,d]of r)(!i||i(d))&&(o.push(c),a.push(d));const l=[];for(const[c,d]of s??[])(!i||d.some(i))&&(l.push(c),a.push(...d));for(const c of o)r.delete(c);for(const c of l)s.delete(c);for(const c of a){const d=c._flight;c._flight=void 0,d&&!--d[2]&&(this._flights?.get(c.id)===d&&this._flights.delete(c.id),l.push(d[1]))}for(const c of l)c.abort()},this.loadRouteChunk=Ge,this.preloadRoute=n=>Eo(this,n),this.matchRoute=(n,r)=>{const s={...n,to:n.to?this.resolvePathWithBase(n.from||"",n.to):void 0,params:n.params||{},leaveParams:!0},i=this.buildLocation(s),a=this.stores.status.get()==="pending";if(r?.pending&&!a)return!1;const o=r?.pending??!a?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),l=Bc(i.pathname,r?.caseSensitive??!1,r?.fuzzy??!1,o.pathname,this.processedTree);return!l||n.params&&!we(l.rawParams,n.params,{partial:!0})?!1:r?.includeSearch??!0?we(o.search,i.search,{partial:!0})?l.rawParams:!1:l.rawParams},this.getStoreConfig=t,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??"fuzzy",stringifySearch:e.stringifySearch??al,parseSearch:e.parseSearch??ol,protocolAllowlist:e.protocolAllowlist??Mc}),self.__TSR_ROUTER__=this}isShell(){return!!this.options.isShell}get state(){return this.stores.__store.get()}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;const r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}getRouteBranch(e){let t=this.routeBranchCache.get(e);return t||(t=fo(e),this.routeBranchCache.set(e,t)),t}matchRoutesInternal(e,t){const[n,r,s]=this.getMatchedRoutes(e.pathname);let i=n,a=!1;(s?s.path!=="/"&&r["**"]:ue(e.pathname))&&(this.options.notFoundRoute?i=[...i,this.options.notFoundRoute]:a=!0);const o=a?wl(this.options.notFoundMode,i):void 0,l=new Array(i.length),c=this._committed,d=(h,p)=>{const m=c[p];return m?.routeId===h.id?m:h===this.options.notFoundRoute?c.find(_=>_.routeId===h.id):void 0};let u;for(let h=0;h{const h=u(o.preSearchFilters?o.preSearchFilters.reduce((p,m)=>m(p),d):d);return o.postSearchFilters?o.postSearchFilters.reduce((p,m)=>m(p),h):h};s.push(c)}const l=o.validateSearch;if(l){const c=({search:d,next:u,meta:h})=>{const p=u(d);if(r)try{const m=Yt(l,p);if(h&&m)for(const _ in m)_ in p||(h.defaulted||=new Map).set(_,m[_]);return{...p,...m}}catch{}return p};s.push(c)}}const i=(a,o,l)=>{if(a>=s.length){if(!t.search)return{};if(t.search===!0)return o;const d=tt(t.search,o);return l&&(l.explicit=d),d}const c=(d,u)=>{if(u){const h=l||{};return{search:i(a+1,d,h),meta:h}}return i(a+1,d,l)};return s[a]({search:o,next:c,meta:l})};return i(0,e)}function wl(e,t){if(e!=="root"){let n;for(let r=t.length-1;r>=0;r--){const s=t[r];if(s.options.notFoundComponent)return s.id;n||=s.children&&s.id}if(n)return n}return ze}function qs(e,t){return e===!1||e===null?Object.create(null):(e??!0)===!0?t:Object.assign(t,tt(e,t))}function Ws(e,t){const n=e.options.params?.parse??e.options.parseParams;n&&Object.assign(t,n(t))}function nr(e,t){return e.options[t]?.preload?.()}function Sl(e,t){const n=nr(e,"component"),r=nr(e,"pendingComponent"),s=t&&r?r.then(t):r;return t&&!r&&t(),n&&s?Promise.all([n,s]).then(()=>{}):n??s}function Ge(e,t,n){const r=()=>t===!1?void 0:t?nr(e,t):Sl(e,n),s=e._lazy;if(s)return s===!0?r():s.then(r);if(!e.lazyFn)return r();const i=e.lazyFn().then(a=>{{const{id:o,...l}=a.options;Object.assign(e.options,l),e._lazy=!0}},a=>{throw e._lazy=void 0,a});return e._lazy=i,i.then(r)}function vo(e){const t=e.findIndex(n=>n.status!=="success"||n._notFound)+1;return t&&t{const s=()=>r(t);t.addEventListener("abort",s,{once:!0}),Promise.resolve(e).then(n,r).finally(()=>t.removeEventListener("abort",s))})}function Ne(e,t){return e.routesById[t.routeId]}function wt(e,t,n){return Ar(e)?[X,e]:Me(e)?(e.routeId||=n,[bn,e]):(t&&typeof e?.then=="function"&&(e=new Error("A Promise was thrown",{cause:e})),t?[Pe,e]:[ce,e])}function bo(e,t){let n=wt(t,!0,e.id);if(n[0]!==Pe)return n;try{e.options.onError?.(n[1])}catch(r){n=wt(r,!0,e.id)}return n}function pt(e,t,n){return n[0].signal.aborted||!n[2]()?(n[0].abort(),[$e]):bo(e,t)}function wo(e,t){return n=>e.navigate({...n,_fromLocation:t})}async function Pl(e,t,n,r,s,i){const[a,o]=t,l=n[0].signal,c=!!n[4];for(let d=n[7]??0;d=i&&(u.status="pending"),n[8]?.();try{St(e,u,"beforeLoad",n[0]);const b=await Ce(v(y),l);if(!n[2]())return n[0].abort(),[d,[$e]];const R=wt(b,!1,h.id);if(R[0]!==ce)return he(e,u),[d,R];u.context={..._,...b}}catch(b){return he(e,u),[d,pt(h,b,n)]}finally{S==="success"&&u.status==="pending"&&(u.status="success"),St(e,u,!1,n[0])}}s()}function Ur(e,t,n){if(!(!n||--n[2])){if(e._flights?.get(t.id)===n){const r=e._tx;if(r&&!r[0].signal.aborted&&!r[3].includes(t)&&r[3].some(s=>s.id===t.id)&&r[3].some(s=>s.isFetching==="beforeLoad"))return;e._flights.delete(t.id)}return n[1]}}function he(e,t){const n=t._flight;t._flight=void 0,Ur(e,t,n)?.abort()}function K(e,t,n,r){const s=[];for(const i of t)if(!n?.includes(i)){const a=i._flight;if(i._flight=void 0,r&&a?.[2]===1&&e._flights?.get(i.id)===a&&n?.some(o=>o.id===i.id))a[2]=0;else{const o=Ur(e,i,a);o&&s.push(o)}}for(const i of s)i.abort()}function Br(e){for(const t of e){const n=t._flight;n&&n[2]++}}function St(e,t,n,r){if(t.isFetching=n,r&&e._tx?.[0]!==r)return;const s=e.stores.byRoute.get(t.routeId),i=s?.get();i?.id===t.id&&s.set({...i,isFetching:n})}function So(e,t,n,r,s,i,a){const o=t[0];return{params:n.params,location:o,navigate:wo(e,o),cause:a?"preload":n.cause,abortController:s,preload:a,deps:n.loaderDeps,parentMatchPromise:i,context:n.context,route:r,...e.options.additionalContext}}async function Vs(e,t,n,r,s,i,a,o){const l=o.signal;if(l.aborted)return[$e];if(!s)return[ce,void 0];let c=n._flight;St(e,n,"loader",o);try{if(!c){const d=new AbortController;c=[Promise.resolve().then(()=>s(So(e,t,n,r,d,i,a))).then(u=>wt(u,!1,r.id),u=>wt(u,!0,r.id)).then(u=>(u[0]!==ce&&e._flights?.get(n.id)===c&&(e._flights.delete(n.id),c[2]||d.abort()),u[0]===Pe&&c[2]?bo(r,u[1]):u)),d,1],(e._flights??=new Map).set(n.id,c)}return n._flight=c,n.abortController=c[1],await Ce(c[0],l)}catch(d){if(d!==l)throw d;return he(e,n),[$e]}finally{St(e,n,!1,o)}}function Qs(e,t,n){t[0]===ce?(e.loaderData=t[1],e.error=void 0,e.status="success",e.invalid=!1,e.updatedAt=Date.now(),e.preload=n):t[0]!==X&&(e.status="success",e.error=void 0,e.invalid=!0)}function Cl(e,t,n){const r=e._cache.get(t.id);if(r!==n||e._committed.some(i=>i.id===t.id&&i._flight===t._flight))return;const s={...t,_notFound:void 0,context:{}};s._flight&&s._flight[2]++,e._cache.set(t.id,s),r&&he(e,r)}function Ks(e,t){return t[0]===Pe||t[0]===bn?{...e,status:t[0]===Pe?"error":"notFound",error:t[1],_flight:void 0}:e}function Rl(e,t,n,r,s,i,a){const o=t[1][n],l=Ne(e,o),c=!!i[4],d=c?e._cache.get(o.id):void 0;let u,h=!1,p;try{if(o.status==="success"&&(u=l.options.shouldReload,typeof u=="function"&&(u=u(So(e,t,o,l,i[0],s,c))),i[2]()||(i[0].abort(),p=[$e])),!p)if(o.status!=="success")h=!0;else{const k=i[4]||o.preload?l.options.preloadStaleTime??e.options.defaultPreloadStaleTime??3e4:l.options.staleTime??e.options.defaultStaleTime??0;h=!!(o.invalid||u||u===void 0&&Date.now()-o.updatedAt>=k&&(i[6]||o.cause==="enter"||i[3].some(T=>T.routeId===o.routeId&&T.id!==o.id)))}}catch(k){o.invalid=!0,he(e,o),p=pt(l,k,i)}const m=l.options.loader,_=typeof m=="function"?m:m?.handler;let g=(!c||l.options.preload!==!1)&&m?e._flights?.get(o.id):void 0;g===o._flight||p?g=void 0:g&&!h&&!c&&u===void 0?h=!0:h||(g=void 0);const v=!!(m&&h&&o.status==="success"&&!c&&!i[5]&&((typeof m=="function"?void 0:m?.staleReloadMode)??e.options.defaultStaleReloadMode)!=="blocking"),y=h&&(!c||l.options.preload!==!1),S=y&&!v&&(o.status!=="success"||!!m),b=l.lazyFn&&l._lazy!==!0?i[8]:void 0;if(y&&!m&&(o.invalid=!1,o.updatedAt=Date.now()),g&&g[2]++,S){const k=o._flight;o._flight=g,Ur(e,o,k)?.abort(),o.status==="success"&&n>=a&&(o.status="pending"),i[8]?.()}y||(o.isFetching=!1);const R=(p?Promise.resolve(p):S?Vs(e,t,o,l,_,s,c,i[0]):Promise.resolve([ce,o.loaderData])).then(k=>(S&&(Qs(o,k,c),k[0]===ce&&(c&&m&&!i[0].signal.aborted&&Cl(e,o,d),o.status="pending")),k)),P=Ce(Promise.resolve().then(()=>Ge(l,void 0,b)),i[0].signal).then(()=>{},k=>[n,pt(l,k,i)]).then(k=>R.then(T=>(S&&!k&&T[0]===ce&&o.status==="pending"&&i[2]()&&(o.status="success",i[8]?.()),k)));if(r.push([n,R,P]),!v)return R.then(k=>Ks(o,k));const w={...o,status:"pending",preload:!1,_flight:g};o.invalid=!1,o.isFetching="loader";const C=Vs(e,t,w,l,_,s,!1,i[0]).then(k=>(o.isFetching=!1,Qs(w,k,!1),k));return(t[2]??=[]).push([n,C,P,w]),C.then(k=>Ks(w,k))}async function rr(e,t,n,r,s=0){const i=n?.[1][1];let a=i?.routeId?t.findIndex(o=>o.routeId===i.routeId):n?.[0]??t.length-1;a<0&&(a=0);for(let o=a;o>=0;o--){const l=Ne(e,t[o]),c=Ge(l,!1);if(c)try{await Ce(c,r)}catch(d){if(d===r)throw d}if(l.options.notFoundComponent)return o}return i?.routeId?a:s}function Je(e,t){t[2]&&(K(e,t[2].map(n=>n[3])),t[2]=void 0)}async function zs(e,t,n,r){let s;try{await Promise.all(e.map(i=>i[1].then(async a=>{const o=i[0];if(!(r&&o>=await r)){if(a[0]>=X)throw[o,a];!s&&a[0]!==ce&&(s=[o,a],await Promise.all((n??[]).map(l=>{if(!(l[0]<=o))return l[1].then(c=>{if(c[0]===X)throw[l[0],c]})})))}})))}catch(i){return i}return t??s}async function Po(e,t,n,r,s,i,a){const o=t[1];let l=await i,c=!1;const d=o.findIndex(m=>m._notFound),u=m=>m[1][0]===bn?rr(e,o,m,r.signal):m[0];let h=d<0?o.length:d;if((l?.[1][0]??0)>=X)h=0;else if(l){h=l[2]??=await u(l);for(const m of n){if(m[0]>=h)break;const _=await m[1];if(_[0]!==ce&&_[0]=h)break;const _=await m[2];if(_){l=_;break}}if((l?.[1][0]??0)>=X){const m=l[1];if(m[0]!==X||m[1].options.reloadDocument||s<20)return Je(e,t),m;c=!0,l=[0,[Pe,new Error("Too many redirects")]]}const p=l?l[2]??await u(l):d;if(p>=0){const m=l?.[1],_=m?.[0],g=o[p],v=m?.[1],y=()=>{m&&(g._notFound=void 0,_===Pe?g.status="error":(v.routeId=g.routeId,g.routeId===e.routeTree.id?(g.status="success",g._notFound=!0):g.status="notFound"),g.error=v,g.isFetching=!1)};y();const S=Ne(e,g);try{await Ce(m?Promise.resolve().then(()=>Ge(S,_===Pe?"errorComponent":"notFoundComponent")):Promise.all([Ge(S),Ge(S,"notFoundComponent")]),r.signal)}catch(b){if(b===r.signal)return Je(e,t),[$e]}m?c&&(r.abort(),await Promise.all([...n.map(b=>b[1]),...n.map(b=>b[2]),...(t[2]??[]).map(b=>b[1])]),Je(e,t),K(e,o),y()):(g.status="success",a?.())}return t}async function Co(e,t,n,r=0,s=t[1].length){const i=t[1];for(let a=r;a_._notFound);if(e.options.notFoundMode!=="root"&&a>=0){const _=await rr(e,s[1],void 0,r[0].signal,a);_!==a&&(n[a]._notFound=void 0,n[_]._notFound=!0),a=_}let o=a<0?n.length:a+1,l=0;for(;l{for(let _=d;_=X&&(o=0),h()),r[2]()&&!r[4]){const _=[];for(const[g,v]of e._flights??[])v[2]||(e._flights.delete(g),_.push(v[1]));for(const g of _)g.abort()}let m;try{const _=Po(e,s,c,r[0],r[1],zs(c,p,s[2]),r[8]);s[2]?.length&&(s[3]=zs(s[2],void 0,void 0,_.then(g=>bt(g)?0:vo(g[1]).length,()=>0))),m=await _}catch(_){throw Je(e,s),_}return bt(m)?m:Co(e,m,r[0].signal,r[7]===m[1].length?r[7]:0)}function sr(e,t){if(e._tx!==t)return;let n=e._pending,r=!1;const s=n?.[0][3][n[1]]?.id;n?.[0]!==t&&(n&&t[3][n[1]]?.id===s?(n[0]=t,r=!0):(clearTimeout(n?.[3]),e._pending=n=void 0));const i=t[3],a=e.stores.matches.get();let o=-1,l,c,d,u=!1;for(let _=0;_0){n[3]=setTimeout(()=>sr(e,t),_);return}n[2]=0}const p=i.map(_=>({..._,_flight:void 0}));p[o].status="pending";const m=e.startTransition(()=>e.stores.setMatches(p),p).then(_=>(_&&e._pending===n&&n[4]===m&&!n[2]&&(n[2]=Date.now()+c),_));n[4]=m}function Xt(e,t){const n=e._pending;n?.[0]===t&&(clearTimeout(n[3]),e._pending=void 0)}function ko(e,t){e._committed=t,e.stores.setMatches(t)}function Gs(e,t){K(e,t[1]),Je(e,t)}function kl(e,t,n,r){const s=e._committed,i=e._cache;for(const c of n)c.preload=!1,r&&(c._assetEnd=void 0);const a=vo(n).length,o=new Map,l=Date.now();for(const c of[...s,...i.values()]){if(c.status!=="success"||n.some((u,h)=>u.id===c.id&&(h=(c.preload?d.options.preloadGcTime??e.options.defaultPreloadGcTime??3e5:d.options.gcTime??e.options.defaultGcTime??3e5)||o.set(c.id,i.get(c.id)===c?c:{...c,_flight:void 0,isFetching:!1,context:{}})}t[3]=[],e._cache=o,ko(e,n),K(e,[...i.values(),...s],[...n,...o.values()]),gl(e,s,n,()=>e._tx===t)}async function xe(e,t){let n=e._tx;for(;n&&n!==t;){if(await n[5],e._tx===n)return;n=e._tx}}async function xo(e,t,n){await e.navigate({...n.options,replace:!0,ignoreBlocker:!0,_redirects:t[1]+1})}function To(e,t){Xt(e,t),t[0].abort(),K(e,t[3]),t[3]=[],e._tx===t&&(e.batch(()=>{e.stores.status.set("idle"),e.stores.setMatches(e._committed)}),e._tx===t&&(e._commitPromise?.resolve(),e._commitPromise=void 0))}async function xl(e,t,n,r,s){const i=n.map(c=>({...c}));Br(i);for(const c of r)he(e,i[c[0]]),i[c[0]]=c[3];const a=[t[2],i];let o;try{o=await Po(e,a,r,t[0],t[1],s)}catch(c){throw K(e,i),c}if(bt(o)){K(e,i),o[0]===X&&e._tx===t&&e._committed===n&&await xo(e,t,o[1]);return}const l=await Co(e,o,t[0].signal);if(e._tx!==t||e._committed!==n){K(e,l[1]);return}for(const c of l[1]){const d=e._cache.get(c.id);d?._flight&&d._flight===c._flight&&(e._cache.delete(c.id),he(e,d))}ko(e,l[1]),K(e,n,l[1])}async function Tl(e,t,n,r,s,i){const a=[t[0],t[1],()=>e._tx===t&&!!t[3].length,e._committed,void 0,s,n,i,r],o=await Ro(e,t[2],t[3],a);if(bt(o)){o[0]===X&&e._tx===t?(Xt(e,t),K(e,t[3]),t[3]=[],e._tx===t&&await xo(e,t,o[1])):To(e,t);return}const l=e._pending;if(l?.[0]===t&&(clearTimeout(l[3]),l[4])){const h=t[0].signal;let p=!1;try{p=await Ce(l[4],h)}catch(m){if(m!==h)throw m}if(p&&e._pending===l&&l[0]===t){const m=l[2]-Date.now();if(m>0){try{await Ce(new Promise(_=>{l[3]=setTimeout(_,m)}),h)}catch{}clearTimeout(l[3])}}}if(e._tx!==t){Xt(e,t),Gs(e,o);return}const c=t[2],d=vn(c,e.stores.resolvedLocation.get()),u=o[2];await e.startViewTransition(async()=>{if(e._tx!==t){Gs(e,o);return}const h=()=>{Xt(e,t),kl(e,t,o[1],i),e._tx===t&&(e.emit({type:"onLoad",...d}),e._tx===t&&e.emit({type:"onBeforeRouteMount",...d}))},p=await e.startTransition(h,o[1]);if(e._tx!==t){Je(e,o);return}u?.length&&xl(e,t,o[1],u,o[3]).catch(console.error),e.batch(()=>{e.stores.resolvedLocation.set(c),e.stores.status.set("idle"),e._tx===t&&e.emit({type:"onResolved",...d}),p&&e._tx===t&&e.emit({type:"onRendered",...d})}),e._tx===t&&(e._commitPromise?.resolve(),e._commitPromise=void 0)})}async function El(e,t){const n=e._tx,r=e.stores.resolvedLocation.get(),s=r??e.stores.location.get(),i=e.latestLocation,a=e._pendingLocation,o=a?.href===i.href?a._redirects??0:0,l=e._handoff,c=l?.[0](),d=new AbortController,u=e._preflight;if(e._preflight=d,c||l?.[1](),u?.abort(),d.signal.aborted){await xe(e,n);return}const h=vn(i,r);if(e.emit({type:"onBeforeNavigate",...h}),d.signal.aborted||e.emit({type:"onBeforeLoad",...h}),d.signal.aborted){await xe(e,n);return}const p=s.href===i.href;let m,_=d;try{m=e.matchRoutes(i,{_controller:d}),Br(m)}catch(y){if(d.abort(),!Ar(y)){await xe(e),e._commitPromise?.resolve(),e._commitPromise=void 0;return}await e.navigate({...y.options,replace:!0,ignoreBlocker:!0}),await xe(e,n);return}const g=c?l[1](m):void 0;if(g?_=c:c?.abort(),d.signal.aborted){K(e,m),await xe(e,n);return}e._preflight=void 0;const v=[_,o,i,m,Date.now(),Promise.resolve().then(()=>Tl(e,v,p,()=>sr(e,v),t?.sync,g)).catch(()=>{e._tx===v&&To(e,v)})];if(e._tx=v,n){for(const y of e.stores.matches.get()){if(e._tx!==v)break;y.isFetching&&St(e,y,!1)}n[0].abort(),K(e,n[3],v[3],!0)}if(e._tx!==v){K(e,v[3]),v[3]=[],await xe(e,v);return}e.batch(()=>{e.stores.status.set("pending"),e.stores.location.set(i)}),!r&&!m.some(y=>y._notFound)&&sr(e,v);try{await v[5]}finally{await xe(e,v)}}async function Eo(e,t,n=0){if(n>20)return;const r=t._builtLocation??e.buildLocation(t),s=e._committed,i=new AbortController;let a;try{a=e.matchRoutes(r,{_controller:i}),Br(a)}catch(l){i.abort(),Me(l)||console.error(l);return}(e._preloads??=new Map).set(i,a);let o;try{let l;try{l=await Ro(e,r,a,[i,n,()=>!0,s,!0])}finally{o=e._preloads.delete(i),K(e,a),i.abort()}if(!bt(l))return l[1];if(o&&l[0]===X&&!l[1].options.reloadDocument)return Eo(e,{...l[1].options,_fromLocation:r},n+1)}catch(l){Me(l)||console.error(l)}}const Ol="Error preloading route! ☝️";var Oo=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=t=>{this.originalIndex=t.originalIndex;const n=this.options,r=!n?.path&&!n?.id;this.parentRoute=this.options.getParentRoute?.(),r?this._path=ze:this.parentRoute||$r();let s=r?ze:n?.path;s&&s!=="/"&&(s=po(s));const i=n?.id||s;let a=r?ze:Gt([this.parentRoute.id==="__root__"?"":this.parentRoute.id,i]);s==="__root__"&&(s="/"),a!=="__root__"&&(a=Gt(["/",a]));const o=a==="__root__"?"/":Gt([this.parentRoute.fullPath,s]);this._path=s,this._id=a,this._fullPath=o,this._to=ue(o)},this.addChildren=t=>this._addFileChildren(t),this._addFileChildren=t=>(Array.isArray(t)&&(this.children=t),typeof t=="object"&&t!==null&&(this.children=Object.values(t)),this),this._addFileTypes=()=>this,this.updateLoader=t=>(Object.assign(this.options,t),this),this.update=t=>(Object.assign(this.options,t),this),this.lazy=t=>(this.lazyFn=t,this),this.redirect=t=>ul({from:this.fullPath,...t}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw new Error("Route cannot have both an 'id' and a 'path' option.")}},Il=class extends Oo{constructor(e){super(e)}};function jr(e){return f(Ll,{...e})}var Ll=class extends Z{constructor(...e){super(...e),this.state={error:null},this.reset=()=>{this.setState({error:null})}}static getDerivedStateFromProps(e,t){const n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:null}:{resetKey:n}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.props.onCatch?.(e,t)}render(){const e=this.state.error;return e?z(this.props.errorComponent??Ml,{error:e,reset:this.reset}):this.props.children}};function Ml({error:e}){const[t,n]=A(!1);return f("div",{style:{padding:".5rem",maxWidth:"100%"},children:[f("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[f("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),f("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>n(r=>!r),children:t?"Hide Error":"Show Error"})]}),f("div",{style:{height:".25rem"}}),t?f("div",{children:f("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:e.message?f("code",{children:e.message}):null})}):null]})}function $l({children:e,fallback:t=null}){return f(Ot.Fragment,{children:Io()?e:t})}function Io(){return Ot.useSyncExternalStore(Fl,()=>!0,()=>!1)}function Fl(){return()=>{}}var Lo=ne(null);function re(e){return ee(Lo)}var wn=ne(void 0),Dl=ne(void 0),F=(e=>(e[e.None=0]="None",e[e.Mutable=1]="Mutable",e[e.Watching=2]="Watching",e[e.RecursedCheck=4]="RecursedCheck",e[e.Recursed=8]="Recursed",e[e.Dirty=16]="Dirty",e[e.Pending=32]="Pending",e))(F||{});function Al({update:e,notify:t,unwatched:n}){return{link:r,unlink:s,propagate:i,checkDirty:a,shallowPropagate:o};function r(c,d,u){const h=d.depsTail;if(h!==void 0&&h.dep===c)return;const p=h!==void 0?h.nextDep:d.deps;if(p!==void 0&&p.dep===c){p.version=u,d.depsTail=p;return}const m=c.subsTail;if(m!==void 0&&m.version===u&&m.sub===d)return;const _=d.depsTail=c.subsTail={version:u,dep:c,sub:d,prevDep:h,nextDep:p,prevSub:m,nextSub:void 0};p!==void 0&&(p.prevDep=_),h!==void 0?h.nextDep=_:d.deps=_,m!==void 0?m.nextSub=_:c.subs=_}function s(c,d=c.sub){const u=c.dep,h=c.prevDep,p=c.nextDep,m=c.nextSub,_=c.prevSub;return p!==void 0?p.prevDep=h:d.depsTail=h,h!==void 0?h.nextDep=p:d.deps=p,m!==void 0?m.prevSub=_:u.subsTail=_,_!==void 0?_.nextSub=m:(u.subs=m)===void 0&&n(u),p}function i(c){let d=c.nextSub,u;e:do{const h=c.sub;let p=h.flags;if(p&60?p&12?p&4?!(p&48)&&l(c,h)?(h.flags=p|40,p&=1):p=0:h.flags=p&-9|32:p=0:h.flags=p|32,p&2&&t(h),p&1){const m=h.subs;if(m!==void 0){const _=(c=m).nextSub;_!==void 0&&(u={value:d,prev:u},d=_);continue}}if((c=d)!==void 0){d=c.nextSub;continue}for(;u!==void 0;)if(c=u.value,u=u.prev,c!==void 0){d=c.nextSub;continue e}break}while(!0)}function a(c,d){let u,h=0,p=!1;e:do{const m=c.dep,_=m.flags;if(d.flags&16)p=!0;else if((_&17)===17){if(e(m)){const g=m.subs;g.nextSub!==void 0&&o(g),p=!0}}else if((_&33)===33){(c.nextSub!==void 0||c.prevSub!==void 0)&&(u={value:c,prev:u}),c=m.deps,d=m,++h;continue}if(!p){const g=c.nextDep;if(g!==void 0){c=g;continue}}for(;h--;){const g=d.subs,v=g.nextSub!==void 0;if(v?(c=u.value,u=u.prev):c=g,p){if(e(d)){v&&o(g),d=c.sub;continue}p=!1}else d.flags&=-33;d=c.sub;const y=c.nextDep;if(y!==void 0){c=y;continue e}}return p}while(!0)}function o(c){do{const d=c.sub,u=d.flags;(u&48)===32&&(d.flags=u|16,(u&6)===2&&t(d))}while((c=c.nextSub)!==void 0)}function l(c,d){let u=d.depsTail;for(;u!==void 0;){if(u===c)return!0;u=u.prevDep}return!1}}function Nl(e,t,n){const r=typeof e=="object",s=r?e:void 0;return{next:(r?e.next:e)?.bind(s),error:(r?e.error:t)?.bind(s),complete:(r?e.complete:n)?.bind(s)}}const ir=[];let Zt=0;const{link:Js,unlink:Ul,propagate:Bl,checkDirty:Mo,shallowPropagate:Ys}=Al({update(e){return e._update()},notify(e){ir[or++]=e,e.flags&=~F.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=F.Mutable|F.Dirty,dn(e))}});let qt=0,or=0,oe,ar=0;function jl(e){try{++ar,e()}finally{--ar||$o()}}function dn(e){const t=e.depsTail;let n=t!==void 0?t.nextDep:e.deps;for(;n!==void 0;)n=Ul(n,e)}function $o(){if(!(ar>0)){for(;qt{s.get(),o.current?a.next?.(s._snapshot):o.current=!0});return{unsubscribe:()=>{l.stop()}}},_update(i){const a=oe,o=t?.compare??Object.is;if(n)oe=s,++Zt,s.depsTail=void 0;else if(i===void 0)return!1;n&&(s.flags=F.Mutable|F.RecursedCheck);try{const l=s._snapshot,c=typeof i=="function"?i(l):i===void 0&&n?r(l):i;return l===void 0||!o(l,c)?(s._snapshot=c,!0):!1}finally{oe=a,n&&(s.flags&=~F.RecursedCheck),dn(s)}}};return n?(s.flags=F.Mutable|F.Dirty,s.get=function(){const i=s.flags;if(i&F.Dirty||i&F.Pending&&Mo(s.deps,s)){if(s._update()){const a=s.subs;a!==void 0&&Ys(a)}}else i&F.Pending&&(s.flags=i&~F.Pending);return oe!==void 0&&Js(s,oe,Zt),s._snapshot}):s.set=function(i){if(s._update(i)){const a=s.subs;a!==void 0&&(Bl(a),Ys(a),$o())}},s}function Hl(e){const t=()=>{const r=oe;oe=n,++Zt,n.depsTail=void 0,n.flags=F.Watching|F.RecursedCheck;try{return e()}finally{oe=r,n.flags&=~F.RecursedCheck,dn(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:F.Watching|F.RecursedCheck,notify(){const r=this.flags;r&F.Dirty||r&F.Pending&&Mo(this.deps,this)?t():this.flags=F.Watching},stop(){this.flags=F.None,this.depsTail=void 0,dn(this)}};return t(),n}function ql(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function r(){var s=!1;try{s=this instanceof r}catch{}return s?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:function(){return e[r]}})}),n}var Mn={exports:{}},$n={};const Fo=ql(dc);var Fn={exports:{}},Dn={};var Zs;function Wl(){if(Zs)return Dn;Zs=1;var e=Fo;function t(u,h){return u===h&&(u!==0||1/u===1/h)||u!==u&&h!==h}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,s=e.useEffect,i=e.useLayoutEffect,a=e.useDebugValue;function o(u,h){var p=h(),m=r({inst:{value:p,getSnapshot:h}}),_=m[0].inst,g=m[1];return i(function(){_.value=p,_.getSnapshot=h,l(_)&&g({inst:_})},[u,p,h]),s(function(){return l(_)&&g({inst:_}),u(function(){l(_)&&g({inst:_})})},[u]),a(p),p}function l(u){var h=u.getSnapshot;u=u.value;try{var p=h();return!n(u,p)}catch{return!0}}function c(u,h){return h()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:o;return Dn.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:d,Dn}var ei;function Vl(){return ei||(ei=1,Fn.exports=Wl()),Fn.exports}var ti;function Ql(){if(ti)return $n;ti=1;var e=Fo,t=Vl();function n(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}var r=typeof Object.is=="function"?Object.is:n,s=t.useSyncExternalStore,i=e.useRef,a=e.useEffect,o=e.useMemo,l=e.useDebugValue;return $n.useSyncExternalStoreWithSelector=function(c,d,u,h,p){var m=i(null);if(m.current===null){var _={hasValue:!1,value:null};m.current=_}else _=m.current;m=o(function(){function v(P){if(!y){if(y=!0,S=P,P=h(P),p!==void 0&&_.hasValue){var w=_.value;if(p(w,P))return b=w}return b=P}if(w=b,r(S,P))return w;var C=h(P);return p!==void 0&&p(w,C)?(S=P,w):(S=P,b=C)}var y=!1,S,b,R=u===void 0?null:u;return[function(){return v(d())},R===null?void 0:function(){return v(R())}]},[d,u,h,p]);var g=s(c,m[0],m[1]);return a(function(){_.hasValue=!0,_.value=g},[g]),l(g),g},$n}var ni;function Kl(){return ni||(ni=1,Mn.exports=Ql()),Mn.exports}var zl=Kl();function Gl(e,t){return e===t}function pe(e,t,n=Gl){const r=j(a=>{if(!e)return()=>{};const{unsubscribe:o}=e.subscribe(a);return o},[e]),s=j(()=>e?.get(),[e]);return zl.useSyncExternalStoreWithSelector(r,s,s,t,n)}var ri={};function Do(e,t){const n=H();return r=>{const s=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=Ie(n.current,s):s}}function Ue(e){const t=re(),n=ee(e.from?Dl:wn),r=e.from??n,s=t.stores.getMatchStore(r),i=Do(e,t),a=pe(s,o=>o?i(o):ri);if(a!==ri)return a;(e.shouldThrow??!0)&&$r()}function Ao(e){return Ue({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function No(e){const{select:t,...n}=e;return Ue({...n,select:r=>t?t(r.loaderDeps):r.loaderDeps})}function Uo(e){return Ue({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{const n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function Bo(e){return Ue({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function It(e){const t=re();return j(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function jo(e){return Ue({...e,select:t=>e.select?e.select(t.context):t.context})}function An(e){const t=H(e);return we(t.current,e,{ignoreUndefined:!1})||(t.current=e),t.current}function Jl(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function Yl(e,t,n){if(e?.external)return cn(e.href,n)?void 0:e.href;if(!ou(t)&&!(typeof t!="string"||t.indexOf(":")===-1))try{return new URL(t),cn(t,n)?void 0:t}catch{}}function Xl(e,t,n,r,s,i){if(i)return!1;if(n?.exact){if(!Kc(e.pathname,t.pathname,r))return!1}else{const a=un(e.pathname,r),o=un(t.pathname,r);if(!(a.startsWith(o)&&(a.length===o.length||a[o.length]==="/")))return!1}return(n?.includeSearch??!0)&&!we(e.search,t.search,{partial:!n?.exact,ignoreUndefined:!n?.explicitUndefined})?!1:n?.includeHash?s&&e.hash===t.hash:!0}function Zl(e,t){const n=re(),r=xc(t),{activeProps:s,inactiveProps:i,activeOptions:a,to:o,preload:l,preloadDelay:c,preloadIntentProximity:d,hashScrollIntoView:u,replace:h,startTransition:p,resetScroll:m,viewTransition:_,children:g,target:v,disabled:y,style:S,className:b,onClick:R,onBlur:P,onFocus:w,onMouseEnter:C,onMouseLeave:k,onTouchStart:T,ignoreBlocker:x,params:O,search:$,hash:ot,state:se,mask:$t,reloadDocument:Oh,unsafeRelative:Ih,from:Lh,_fromLocation:Mh,...Vr}=e,Cn=Io(),ha=An(e.search),da=An(e.params),Qr=An(a),at=q(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,ha,da,e.state,e.mask,e.unsafeRelative]),fa=j(N=>{const B=n.buildLocation({_fromLocation:N,...at}),ie=iu(B.maskedLocation?B.maskedLocation.publicHref:B.publicHref,B.maskedLocation?B.maskedLocation.external:B.external,n.history,y),At=Yl(ie,o,n.protocolAllowlist);return[ie?.href,At,Xl(N,B,Qr,n.basepath,Cn,At!==void 0)]},[Qr,y,Cn,at,n,o]),[pa,Rn,kn]=pe(n.stores.location,fa,Jl),Ft=kn?tt(s,{})??eu:Nn,Dt=kn?Nn:tt(i,{})??Nn,Kr=[b,Ft.className,Dt.className].filter(Boolean).join(" "),zr=(S||Ft.style||Dt.style)&&{...S,...Ft.style,...Dt.style},[_a,Gr]=A(!1),Jr=H(!1),Be=e.reloadDocument||Rn?!1:l??n.options.defaultPreload,xn=c??n.options.defaultPreloadDelay??0,Re=j(()=>{n.preloadRoute(at).catch(N=>{console.warn(N),console.warn(Ol)})},[n,at]);kc(r,j(N=>{N?.isIntersecting&&Re()},[Re]),su,!!y||Be!=="viewport"),W(()=>{Jr.current||!y&&Be==="render"&&(Re(),Jr.current=!0)},[y,Re,Be]);const ma=N=>{const B=N.currentTarget.getAttribute("target"),ie=v!==void 0?v:B;if(!y&&!au(N)&&!N.defaultPrevented&&(!ie||ie==="_self")&&N.button===0){N.preventDefault(),Mr(()=>{Gr(!0)});const At=n.subscribe("onResolved",()=>{At(),Gr(!1)});n.navigate({...at,replace:h,resetScroll:m,hashScrollIntoView:u,startTransition:p,viewTransition:_,ignoreBlocker:x})}};if(Rn)return{...Vr,ref:r,href:Rn,...g&&{children:g},...v&&{target:v},...y&&{disabled:y},...S&&{style:S},...b&&{className:b},...R&&{onClick:R},...P&&{onBlur:P},...w&&{onFocus:w},...C&&{onMouseEnter:C},...k&&{onMouseLeave:k},...T&&{onTouchStart:T}};const Yr=N=>{if(y||Be!=="intent")return;if(!xn){Re();return}const B=N.currentTarget;if(lt.has(B))return;const ie=setTimeout(()=>{lt.delete(B),Re()},xn);lt.set(B,ie)},ga=N=>{y||Be!=="intent"||Re()},Xr=N=>{if(y||!Be||!xn)return;const B=N.currentTarget,ie=lt.get(B);ie&&(clearTimeout(ie),lt.delete(B))};return{...Vr,...Ft,...Dt,href:pa,ref:r,onClick:je([R,ma]),onBlur:je([P,Xr]),onFocus:je([w,Yr]),onMouseEnter:je([C,Yr]),onMouseLeave:je([k,Xr]),onTouchStart:je([T,ga]),disabled:!!y,target:v,...zr&&{style:zr},...Kr&&{className:Kr},...y&&tu,...kn&&nu,...Cn&&_a&&ru}}var Nn={},eu={className:"active"},tu={role:"link","aria-disabled":!0},nu={"data-status":"active","aria-current":"page"},ru={"data-transitioning":"transitioning"},lt=new WeakMap,su={rootMargin:"100px"},je=e=>t=>{for(const n of e)if(n){if(t.defaultPrevented)return;n(t)}};function iu(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||"/",external:!1}}function ou(e){if(typeof e!="string")return!1;const t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var te=Ir((e,t)=>{const{_asChild:n,...r}=e,{type:s,...i}=Zl(r,t),a=typeof r.children=="function"?r.children({isActive:i["data-status"]==="active"}):r.children;if(!n){const{disabled:o,...l}=i;return z("a",l,a)}return z(n,i,a)});function au(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var cu=class extends Oo{constructor(e){super(e),this.useMatch=t=>Ue({select:t?.select,from:this.id,structuralSharing:t?.structuralSharing}),this.useRouteContext=t=>jo({...t,from:this.id}),this.useSearch=t=>Bo({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useParams=t=>Uo({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useLoaderDeps=t=>No({...t,from:this.id}),this.useLoaderData=t=>Ao({...t,from:this.id}),this.useNavigate=()=>It({from:this.fullPath}),this.Link=Ot.forwardRef((t,n)=>f(te,{ref:n,from:this.fullPath,...t}))}};function Lt(e){return new cu(e)}var lu=class extends Il{constructor(e){super(e),this.useMatch=t=>Ue({select:t?.select,from:this.id,structuralSharing:t?.structuralSharing}),this.useRouteContext=t=>jo({...t,from:this.id}),this.useSearch=t=>Bo({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useParams=t=>Uo({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useLoaderDeps=t=>No({...t,from:this.id}),this.useLoaderData=t=>Ao({...t,from:this.id}),this.useNavigate=()=>It({from:this.fullPath}),this.Link=Ot.forwardRef((t,n)=>f(te,{ref:n,from:this.fullPath,...t}))}};function uu(e){return new lu(e)}function hu(e){const t=re(),n=`not-found-${pe(t.stores.location,r=>r.pathname)}-${pe(t.stores.status,r=>r)}`;return f(jr,{getResetKey:()=>n,onCatch:(r,s)=>{if(Me(r))e.onCatch?.(r,s);else throw r},errorComponent:({error:r})=>{if(Me(r))return e.fallback?.(r);throw r},children:e.children})}function du(){return f("p",{children:"Not Found"})}function We(e){return f(M,{children:e.children})}function Ho(e,t,n){return t.options.notFoundComponent?f(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?f(e.options.defaultNotFoundComponent,{...n}):f(du,{})}function Sn(e,t){const n=t?.options.pendingComponent??e.options.defaultPendingComponent;return n?f(n,{}):null}var fu=(e,t)=>e[0]===t[0]&&e[1]===t[1],qo=Tt(function({routeId:t}){const n=re();return f(pu,{router:n,match:pe(n.stores.getMatchStore(t),r=>r)})});function pu({router:e,match:t}){const n=e.routesById[t.routeId],r=Sn(e,n),s=n.options.errorComponent??e.options.defaultErrorComponent,i=n.options.onCatch??e.options.defaultOnCatch,a=n.isRoot?n.options.notFoundComponent??e.options.notFoundRoute?.options.component:n.options.notFoundComponent,o=t.ssr===!1||t.ssr==="data-only",l=n.options.wrapInSuspense??r??(n.options.errorComponent?.preload||o)?be:We,c=s?jr:We,d=a?hu:We;return f(n.isRoot?n.options.shellComponent??We:We,{children:[f(wn.Provider,{value:t.routeId,children:f(l,{fallback:r,children:f(c,{getResetKey:()=>t,errorComponent:s,onCatch:(u,h)=>{if(Me(u))throw u.routeId??=t.routeId,u;i?.(u,h)},children:f(d,{fallback:u=>{if(u.routeId??=t.routeId,u.routeId!==t.routeId)throw u;return z(a,u)},children:o?f($l,{fallback:r,children:f(si,{match:t})}):f(si,{match:t})})})})}),null]})}var si=Tt(function({match:t}){const n=re(),r=t.routeId,s=n.routesById[r],i=q(()=>{const o=(s.options.remountDeps??n.options.defaultRemountDeps)?.({routeId:r,loaderDeps:t.loaderDeps,params:t._strictParams,search:t._strictSearch});return o?JSON.stringify(o):void 0},[r,t.loaderDeps,t._strictParams,t._strictSearch,s.options.remountDeps,n.options.defaultRemountDeps]),a=q(()=>{const o=s.options.component??n.options.defaultComponent;return o?f(o,{},i):f(Wo,{})},[i,s.options.component,n.options.defaultComponent]);if(t.status==="pending"){if(n._tx)throw n._tx[5];return Sn(n,s)}if(t.status==="notFound")return Ho(n,s,t.error);if(t.status==="error")throw t.error;return a}),Wo=Tt(function(){const t=re(),n=ee(wn);let r,s,i;{const o=t.stores.getMatchStore(n);[r,s]=pe(o,l=>[!!l._notFound,l.error],fu),i=pe(t.stores.ids,l=>l[l.indexOf(n)+1])}if(r)return Ho(t,t.routesById[n],s);if(!i)return null;const a=f(qo,{routeId:i});return n===ze?f(be,{fallback:Sn(t),children:a}):a});function Vo(e,t){const n=e[1];e.length=0,n?.(t)}function _u({t:e}){const t=re(),n=t._rendered??=[];return t.startTransition=(r,s)=>new Promise((i,a)=>{Vo(n,!1),n.push(s,i),e(t),gn(()=>{try{r()}catch(o){n[1]===i&&(n.length=0),a(o)}})}),io(()=>{const r=t.history.subscribe(t.load);t.updateLatestLocation();const s=t.latestLocation,i=t.buildLocation({to:s.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});if(ue(s.publicHref)!==ue(i.publicHref))return t.commitLocation({...i,replace:!0,ignoreBlocker:!0}),r;const a=t.stores.resolvedLocation.get();return a?.href===s.href&&a.state.__TSR_key===s.state.__TSR_key?n.push(t.stores.matches.get(),o=>{o&&t.emit({type:"onRendered",...vn(a,a)})}):t._tx||t.load().catch(console.error),r},[t,t.history]),null}function mu(){const e=re(),t=e.routesById[ze],n=Sn(e,t),r=e.ssr?We:be,s=f(M,{children:[f(_u,{t:A()[1]}),f(r,{fallback:n,children:f(gu,{})})]});return e.options.InnerWrap?f(e.options.InnerWrap,{children:s}):s}function gu(){const e=re(),t=e._rendered,n=pe(e.stores.matches,a=>t[0]??a),r=n[0],s=r?.routeId;io(()=>{t[0]===n&&Vo(t,!0)},[t,n]);const i=s?f(qo,{routeId:s}):null;return f(wn.Provider,{value:s,children:e.options.disableGlobalCatchBoundary?i:f(jr,{getResetKey:()=>r,onCatch:void 0,children:i})})}var yu=e=>({createMutableStore:Xs,createReadonlyStore:Xs,batch:jl}),vu=e=>new bu(e),bu=class extends yl{constructor(e){super(e,yu)}};function wu({router:e,children:t,...n}){ao(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});const r=f(Lo.Provider,{value:e,children:t});return e.options.Wrap?f(e.options.Wrap,{children:r}):r}function Su({router:e,...t}){return f(wu,{router:e,...t,children:f(mu,{})})}function Qo(e){const t=re({warn:e?.router===void 0}),n=e?.router||t;return pe(n.stores.__store,Do(e,n))}const fn={width:3997,height:1467},Ko="M105 1467V670H0V405H105V248L372 0H868V265H548V1467ZM615 670 618 405H868V670ZM1104 1467 839 1202V670L1104 405H1401V670H1286V1219H1401V1467ZM1471 1467V1219H1581V670H1471V405H1767L2032 670V1202L1767 1467ZM2419 1467 2171 1219V0H2613V1202H2811V1467ZM3555 1467V0H3997V1467ZM3069 1467 2830 1228V644L3069 405H3485V670H3272V1219H3485V1362L3380 1467Z";function Pu(e,t,n){const r=n/fn.width,s=e-n/2,i=t-fn.height*r/2;return`translate(${s.toFixed(2)} ${i.toFixed(2)}) scale(${r.toFixed(5)})`}function ii({title:e,descriptor:t,className:n}){return f("span",{class:n?`wordmark ${n}`:"wordmark",children:[f("svg",{class:"wordmark-glyphs",viewBox:`0 0 ${fn.width} ${fn.height}`,fill:"currentColor",role:e?"img":void 0,"aria-label":e,"aria-hidden":e?void 0:"true",focusable:"false",children:[e?f("title",{children:e}):null,f("path",{d:Ko})]}),t?f(M,{children:[f("span",{class:"wordmark-rule","aria-hidden":"true"}),f("span",{class:"wordmark-descriptor",children:t})]}):null]})}const Cu=45e3;function Ru(e){const t=Math.max(0,Math.round(e/1e3));if(t<5)return"just now";if(t<60)return`${t}s ago`;const n=Math.round(t/60);return n<60?`${n}m ago`:`${Math.round(n/60)}h ago`}function ku({updatedAt:e,fetching:t,failed:n}){const[r,s]=A(()=>Date.now());if(W(()=>{const l=setInterval(()=>s(Date.now()),5e3);return()=>clearInterval(l)},[]),!e&&!n)return null;const i=r-e,a=n?"failed":t?"fetching":i>Cu?"stale":"live",o=a==="failed"?"not updating":a==="fetching"?"refreshing":Ru(i);return f("p",{class:"freshness","data-state":a,children:[f("span",{class:"dot","aria-hidden":"true"}),f("span",{class:"visually-hidden",children:a==="failed"?"The federation snapshot is not updating.":`Federation snapshot ${a==="fetching"?"refreshing now":`last updated ${o}`}.`}),f("span",{"aria-hidden":"true",children:o})]})}let Pt={token:"",state:"anonymous"};const cr=new Set;function zo(){for(const e of cr)e()}function xu(){return Pt}function Go(e,t="pasted"){const n=e.trim();Pt={token:n,state:n?t:"anonymous"},zo()}function Tu(){Pt={token:"",state:"anonymous"},zo()}function Jo(){return Pt.token?{Authorization:`Bearer ${Pt.token}`}:{}}function Eu(e){return cr.add(e),()=>{cr.delete(e)}}function Hr(){return st(Eu,xu)}const oi="1.9.0",Ou={consoleSource:"1.9.0",tenantGovernance:"1.9.0"};function pn(e){if(!e)return null;const t=/^v?(\d+)\.(\d+)(?:\.(\d+))?/.exec(e.trim());return t?[Number(t[1]),Number(t[2]),Number(t[3]??0)]:null}function Yo(e,t){const n=pn(e),r=pn(t);if(!n||!r)return 0;for(let s=0;s<3;s++){const i=(n[s]??0)-(r[s]??0);if(i!==0)return i<0?-1:1}return 0}function ai(e,t){return pn(e)?Yo(e,Ou[t])>=0:!0}function Iu(e){return!pn(e)||Yo(e,oi)>=0?null:`This console needs fold ${oi} or newer; the gateway reports ${e}. Parts of this page will be empty. Upgrade the gateway, or use the console bundled with it.`}function Lu(e){return e?/^\d/.test(e)?`v${e}`:e:""}const Mu=[{to:"/",label:"Overview"},{to:"/upstreams",label:"Upstreams"},{to:"/catalog",label:"Catalog"},{to:"/test",label:"Test console"}];function $u({version:e,authRequired:t,hint:n,onSignIn:r,onRefresh:s,refreshing:i,updatedAt:a,failed:o,section:l,children:c}){const d=Hr(),[u,h]=A(""),p=Qo({select:y=>y.location.pathname}),m=H(null),_=d.state==="signed-in",g=!_&&t!==!1,v=()=>{Go(u),s()};return f("div",{class:"shell",children:[f("button",{type:"button",class:"skip",onClick:()=>m.current?.focus(),children:"Skip to content"}),f("header",{class:"topbar",children:[f(te,{to:"/",className:"brand","aria-label":"fold console, overview",children:[f(ii,{title:"fold",descriptor:"Console"}),e?f("span",{class:"version muted",children:Lu(e)}):null]}),f("div",{class:"auth",children:[f(ku,{updatedAt:a,fetching:i,failed:o}),n?.oauth&&!_?f("button",{type:"button",onClick:r,children:"Sign in"}):null,_?f("button",{type:"button",onClick:()=>{Tu(),s()},children:"Sign out"}):null,g?f("input",{type:"password",value:u,autocomplete:"off",spellcheck:!1,"aria-label":"Bearer token",placeholder:n?.oauth?"…or paste a Bearer token":"Bearer token",onInput:y=>h(y.currentTarget.value),onBlur:v,onKeyDown:y=>{y.key==="Enter"&&v()}}):null,f("button",{type:"button",onClick:s,disabled:i,children:"Refresh"})]})]}),f("div",{class:"body",children:[f("nav",{class:"sidebar","aria-label":"Console sections",children:f("ul",{children:Mu.map(y=>f("li",{children:f(te,{to:y.to,className:ci(p,y.to)?"nav-link active":"nav-link","aria-current":ci(p,y.to)?"page":void 0,children:y.label})},y.to))})}),f("main",{id:"main",ref:m,tabIndex:-1,children:c})]}),f(Fu,{section:l}),f("footer",{children:f("div",{class:"foot",children:[f("span",{class:"legal",children:[f(ii,{}),"© fold.run · the enterprise MCP gateway"]}),f("nav",{"aria-label":"fold project",children:[f("a",{href:"https://fold.run/",rel:"noopener",children:"fold.run"}),f("a",{href:"https://docs.fold.run/",rel:"noopener",children:"Docs"}),f("a",{href:"https://github.com/fold-run/fold",rel:"noopener",children:"GitHub"}),f("a",{href:"https://fold.run/status/",rel:"noopener",children:"Status"})]})]})})]})}function Fu({section:e}){const[t,n]=A(""),r=H(!0);return W(()=>{if(r.current){r.current=!1;return}n(`${e} page`)},[e]),f("p",{class:"visually-hidden",role:"status","aria-live":"polite",children:t})}function ci(e,t){return t==="/"?e==="/":e===t||e.startsWith(`${t}/`)}function Un({tone:e="bad",children:t}){return f("p",{class:`banner ${e}`,role:"alert",children:t})}const Fe={tools:{list:"tools/list",listKey:"tools",call:"tools/call",verb:"Call tool",args:!0,label:"Tools"},prompts:{list:"prompts/list",listKey:"prompts",call:"prompts/get",verb:"Get prompt",args:!0,label:"Prompts"},resources:{list:"resources/list",listKey:"resources",call:"resources/read",verb:"Read resource",args:!1,label:"Resources"}},Mt=["tools","prompts","resources"],en={tools:[],prompts:[],resources:[]};function G(e,t){return(e==="resources"?t.uri:t.name)??""}class Du{constructor(t,n){this.path=t,this.clientVersion=n}path;clientVersion;sessionId=null;protocolVersion=null;nextId=0;wire=[];wireSeq=0;listeners=new Set;subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});getWire=()=>this.wire;clearWire=()=>{this.wire=[],this.emit()};emit(){for(const t of this.listeners)t()}log(t,n){const r=this.wire.concat({id:this.wireSeq++,direction:t,message:n});this.wire=r.length>400?r.slice(r.length-400):r,this.emit()}async rpc(t,n,r=!1){const s={jsonrpc:"2.0",method:t};n!==void 0&&(s.params=n),r||(s.id=++this.nextId),this.log("→",s);const i={"Content-Type":"application/json",Accept:"application/json, text/event-stream",...Jo()};this.sessionId&&(i["Mcp-Session-Id"]=this.sessionId),this.protocolVersion&&(i["MCP-Protocol-Version"]=this.protocolVersion);const a=await fetch(this.path,{method:"POST",headers:i,body:JSON.stringify(s)}),o=a.headers.get("mcp-session-id");if(o&&(this.sessionId=o),a.status===202)return null;if(!a.ok){const d=await a.text();throw new Error(`HTTP ${a.status}${d?`: ${d.slice(0,300)}`:""}`)}const l=a.headers.get("content-type")??"";let c=null;if(l.includes("text/event-stream")){const d=await a.text();for(const u of d.split(/\r?\n\r?\n/)){const h=u.split(/\r?\n/).filter(m=>m.startsWith("data:")).map(m=>m.slice(5).replace(/^ /,"")).join(` -`);if(!h)continue;let p;try{p=JSON.parse(h)}catch{continue}this.log("←",p),!r&&p.id===s.id&&(c=p)}}else c=await a.json(),this.log("←",c);if(r)return null;if(!c)throw new Error(`no response for request ${s.id} on the stream`);if(c.error)throw new Error(`JSON-RPC ${c.error.code}: ${c.error.message}`);return c.result}async fetchList(t){const n=Fe[t],r=[];let s;for(let i=0;i<25;i++){let a;try{a=await this.rpc(n.list,s?{cursor:s}:{})}catch(o){if(/-32601/.test(o.message))return[];throw o}if(r.push(...a[n.listKey]??[]),s=a.nextCursor,!s)break}return r}async connect(){this.sessionId=null,this.protocolVersion=null,this.nextId=0;const t=await this.rpc("initialize",{protocolVersion:"2025-06-18",capabilities:{},clientInfo:{name:"fold-console",version:this.clientVersion}});this.protocolVersion=t.protocolVersion??null,await this.rpc("notifications/initialized",void 0,!0);const n={tools:[],prompts:[],resources:[]};for(const r of Mt)n[r]=await this.fetchList(r);return n}async invoke(t,n,r){const s=t==="resources"?{uri:n}:{name:n,arguments:r};return this.rpc(Fe[t].call,s)}}function Au(e){const t=e?.inputSchema;if(t?.properties){const n=new Set(t.required??[]),r={};for(const[s,i]of Object.entries(t.properties))n.size&&!n.has(s)||(r[s]=Nu(i));if(Object.keys(r).length)return JSON.stringify(r,null,2)}if(e?.arguments?.length){const n={};for(const r of e.arguments)r.required!==!1&&(n[r.name]="");if(Object.keys(n).length)return JSON.stringify(n,null,2)}return""}function Nu(e){if(e.default!==void 0)return e.default;if(e.enum?.length)return e.enum[0];switch(e.type){case"number":case"integer":return 0;case"boolean":return!1;case"array":return[];case"object":return{};default:return""}}const _t=()=>{},Xo=ne({status:"idle",error:null,catalog:en,client:null,connect:_t,disconnect:_t,wire:[],clearWire:_t});function Zo(){return ee(Xo)}function Uu(e){const t=e&&e.trim()?e:"/mcp";return new URL(`..${t.startsWith("/")?t:`/${t}`}`,location.href).pathname}function Bu({mcpPath:e,gatewayVersion:t,children:n}){const[r,s]=A("idle"),[i,a]=A(null),[o,l]=A(en),[c,d]=A(null),{token:u}=Hr(),h=H(0),p=j(()=>{const y=++h.current,S=new Du(Uu(e),t??"dev");d(S),s("connecting"),a(null),l(en),S.connect().then(b=>{y===h.current&&(l(b),s("ready"))}).catch(b=>{y===h.current&&(a(`MCP connect failed: ${b.message}`),s("error"))})},[e,t]),m=j(()=>{h.current++,d(null),l(en),s("idle"),a(null)},[]),_=H(u);_.current!==u&&(_.current=u,r!=="idle"&&queueMicrotask(m));const g=st(c?c.subscribe:()=>_t,c?c.getWire:()=>ju),v=q(()=>({status:r,error:i,catalog:o,client:c,connect:p,disconnect:m,wire:g,clearWire:c?c.clearWire:_t}),[r,i,o,c,p,m,g]);return f(Xo.Provider,{value:v,children:n})}const ju=[];function Y({title:e,hint:t}){return f("div",{class:"empty",children:[f("p",{class:"empty-title",children:e}),t?f("p",{class:"muted",children:t}):null]})}class Qe extends Error{status;terminal;constructor(t,n,r=!1){super(n),this.name="ApiError",this.status=t,this.terminal=r}}const Hu="../api/federation",qu="../api/auth-hint";async function Wu(e){let t;try{t=await fetch(Hu,{headers:Jo(),signal:e})}catch(n){throw new Qe(0,`Could not reach the gateway: ${n.message}`)}if(t.status===401)throw new Qe(401,"Unauthorized. Sign in, or paste a valid Bearer token: the same one /mcp accepts.",!0);if(t.status===403)throw new Qe(403,"This principal is not in the introspection viewer allowlist (server.introspection.groups). The denial was audited.",!0);if(!t.ok)throw new Qe(t.status,`The gateway refused the read: HTTP ${t.status}.`);return await t.json()}const Vu={queryKey:["federation"],queryFn:({signal:e})=>Wu(e),refetchInterval:15e3,retry:(e,t)=>!(t instanceof Qe&&t.terminal)},lr="fold-console-pkce";function Bn(e){return btoa(String.fromCharCode(...e)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function ea(){try{const e=await fetch(qu);return e.ok?await e.json():null}catch{return null}}async function Qu(e){const t=e.replace(/\/$/,""),n=new URL(t),r=[`${t}/.well-known/openid-configuration`,`${n.origin}/.well-known/oauth-authorization-server${n.pathname.replace(/\/$/,"")}`];for(const s of r)try{const i=await fetch(s);if(!i.ok)continue;const a=await i.json();if(a.authorization_endpoint&&a.token_endpoint)return{authorization_endpoint:a.authorization_endpoint,token_endpoint:a.token_endpoint}}catch{}throw new Error(`could not discover authorization server metadata for ${e}`)}function ta(){return location.origin+location.pathname}async function Ku(e){if(!e.oauth)throw new Error("this gateway does not advertise an OAuth issuer");const t=await Qu(e.oauth.issuer),n=Bn(crypto.getRandomValues(new Uint8Array(32))),r=Bn(crypto.getRandomValues(new Uint8Array(16))),s=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(n));sessionStorage.setItem(lr,JSON.stringify({verifier:n,state:r,tokenEndpoint:t.token_endpoint}));const i=new URL(t.authorization_endpoint);i.searchParams.set("response_type","code"),i.searchParams.set("client_id",e.oauth.clientId),i.searchParams.set("redirect_uri",ta()),i.searchParams.set("code_challenge",Bn(new Uint8Array(s))),i.searchParams.set("code_challenge_method","S256"),i.searchParams.set("state",r),e.oauth.scopes?.length&&i.searchParams.set("scope",e.oauth.scopes.join(" ")),e.resource&&i.searchParams.set("resource",e.resource),location.assign(i)}async function zu(e){const t=new URLSearchParams(location.search);if(!t.has("code")&&!t.has("error"))return null;const n=sessionStorage.getItem(lr);if(sessionStorage.removeItem(lr),history.replaceState(null,"",location.pathname+location.hash),t.has("error")){const i=t.get("error_description");return`Sign-in failed: ${t.get("error")}${i?`. ${i}`:""}`}let r=null;try{r=JSON.parse(n??"null")}catch{}if(!r?.state||r.state!==t.get("state"))return"Sign-in failed: state mismatch. Start again from this page.";if(!e?.oauth||!r.tokenEndpoint||!r.verifier)return"Sign-in failed: the gateway no longer advertises the issuer this flow started against.";const s=new URLSearchParams({grant_type:"authorization_code",code:t.get("code")??"",redirect_uri:ta(),client_id:e.oauth.clientId,code_verifier:r.verifier});e.resource&&s.set("resource",e.resource);try{const i=await fetch(r.tokenEndpoint,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s}),a=await i.json();if(!i.ok||!a.access_token){const o=a.error_description?`: ${a.error_description}`:"";return`Token exchange failed: ${a.error??`HTTP ${i.status}`}${o}`}return Go(a.access_token,"signed-in"),null}catch(i){return`Token exchange failed: ${i.message}`}}let na=null;function Gu(e,t){na=t}const Ju=()=>na,ra=["auth-hint"],sa=ne({state:void 0,error:null,isPending:!0});function Pn(){return ee(sa)}const Yu={"/":"Overview","/upstreams":"Upstreams","/catalog":"Catalog","/test":"Test console"};function Xu(e){return Yu[e]??(e.startsWith("/upstreams/")?"Upstream":"Not found")}function Zu(){const e=ro(),t=Hr(),[n,r]=A(Ju()),{data:s=null}=Ts({queryKey:ra,queryFn:ea,staleTime:1/0}),i=Ts({...Vu,queryKey:["federation",t.token?"authed":"anon"]}),a=i.error instanceof Qe?i.error:null,o=j(()=>{r(null),e.invalidateQueries({queryKey:["federation"]})},[e]),l=j(()=>{r(null),Ku(s).catch(h=>r(`Sign-in failed: ${h.message}`))},[s]),c=Qo({select:h=>h.location.pathname}),d=Xu(c);W(()=>{document.title=`${d} · fold console`},[d]);const u=Iu(i.data?.version);return f(sa.Provider,{value:{state:i.data,error:a,isPending:i.isPending},children:f(Bu,{mcpPath:i.data?.mcpPath,gatewayVersion:i.data?.version,children:f($u,{version:i.data?.version,authRequired:i.data?.authRequired,hint:s,onSignIn:l,onRefresh:o,refreshing:i.isFetching,updatedAt:i.dataUpdatedAt,failed:!!a,section:d,children:[n?f(Un,{children:n}):null,a?f(Un,{children:a.message}):null,u?f(Un,{tone:"warn",children:u}):null,a?.terminal?f(Y,{title:"No federation snapshot",hint:"The gateway answered, but not with data this principal may read."}):f(Wo,{})]})})})}function eh(){return f(Y,{title:"No such page",hint:"That route is not part of the console. Pick a section from the sidebar."})}const it=uu({component:Zu,notFoundComponent:eh});function I({label:e,value:t,tone:n,wrap:r}){return f("div",{class:"card",children:[f("span",{class:"label",children:e}),f("b",{class:[n,r?"wrap":""].filter(Boolean).join(" ")||void 0,children:t})]})}function le({title:e,children:t,action:n}){return f("section",{class:"group","aria-label":e,children:[f("div",{class:"group-head",children:[f("h2",{children:e}),n]}),f("div",{class:"cards",children:t})]})}function nt({title:e,back:t,lede:n,actions:r,children:s}){return f("header",{class:"page-head",children:[t,f("div",{class:"page-head-row",children:[f("h1",{children:e}),r?f("div",{class:"page-actions",children:r}):null]}),n?f("p",{class:"muted lede",children:n}):null,s]})}const ia=ne(()=>{});function th(){return ee(ia)}const nh=3200;function rh({children:e}){const[t,n]=A([]),r=H(0),s=H(new Set),i=j((o,l="ok")=>{const c=r.current++;n(u=>u.concat({id:c,message:o,tone:l}));const d=setTimeout(()=>{n(u=>u.filter(h=>h.id!==c)),s.current.delete(d)},nh);s.current.add(d)},[]);W(()=>{const o=s.current;return()=>{for(const l of o)clearTimeout(l);o.clear()}},[]);const a=q(()=>i,[i]);return f(ia.Provider,{value:a,children:[e,f("div",{class:"toasts",role:"status","aria-live":"polite",children:t.map(o=>f("div",{class:`toast ${o.tone}`,children:o.message},o.id))})]})}function Ye({value:e,label:t,className:n}){const r=th(),s=async()=>{try{if(!navigator.clipboard)throw new Error("needs a secure context (https or localhost)");await navigator.clipboard.writeText(e),r(`${t} copied`)}catch(i){r(`Copy failed: ${i.message}`,"bad")}};return f("button",{type:"button",class:n?`copy ${n}`:"copy",onClick:s,disabled:!e,title:`Copy ${t.toLowerCase()}`,"aria-label":`Copy ${t.toLowerCase()}`,children:"Copy"})}const sh="https://docs.fold.run",ih={configuration:"configuration/",upstreams:"configuration/#upstreams-required",policy:"configuration/#policy",auth:"configuration/#auth-gateway-authentication",observability:"operations/",tenancy:"tenancy/",discovery:"discovery/"};function oh(e){return`${sh}/${ih[e]}`}function ut({topic:e,children:t}){return f("a",{class:"group-action",href:oh(e),rel:"noopener",children:[t," →"]})}function li({count:e=4}){return f("div",{class:"cards","aria-hidden":"true",children:Array.from({length:e},(t,n)=>f("div",{class:"card skeleton-card",children:[f("span",{class:"skeleton skeleton-label"}),f("span",{class:"skeleton skeleton-value"})]},n))})}function ah({columns:e,rows:t=3}){return f(M,{children:Array.from({length:t},(n,r)=>f("tr",{"aria-hidden":"true",children:Array.from({length:e},(s,i)=>f("td",{children:f("span",{class:"skeleton skeleton-cell"})},i))},r))})}const rt="—";function Q(e){return e==null||e===""?rt:String(e)}function Ct(e){return e===void 0?rt:e<1e3?`${e} ms`:`${(e/1e3).toFixed(2)} s`}function ur(e){if(!e)return rt;const t=[e.org,e.team].filter(Boolean);return t.length?t.join(" / "):rt}function ch(e){if(!e)return rt;const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{year:"numeric",month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}function lh(e){return e?e%1e3===0?`${e/1e3} s`:`${e} ms`:"30 s (default)"}function hr(e){try{return JSON.stringify(e,null,2)??String(e)}catch{return String(e)}}function oa(e,t){const n=t.trim().toLowerCase();return n?e.some(r=>r?.toLowerCase().includes(n)):!0}function uh(){const{state:e,isPending:t}=Pn();if(!e)return t?f(M,{children:[f(nt,{title:"Overview"}),f("section",{class:"group","aria-label":"Loading",children:[f("p",{class:"visually-hidden",role:"status",children:"Reading the federation snapshot."}),f(li,{count:5})]}),f("section",{class:"group","aria-hidden":"true",children:f(li,{count:3})})]}):f(Y,{title:"No federation snapshot",hint:"Check that server.introspection.enabled is set on the gateway."});const n=e.upstreams.filter(s=>s.connected).length,r=e.upstreams.length;return f(M,{children:[f(nt,{title:"Overview",lede:"The gateway's own view of its configuration and federation.",actions:f(ut,{topic:"configuration",children:"Configuration"})}),f(le,{title:"Gateway",children:[f(I,{label:"version",value:Q(e.version)}),f(I,{label:"endpoint",value:f(M,{children:[e.mcpPath,f(Ye,{value:e.mcpPath,label:"MCP path"})]})}),f(I,{label:"auth",value:(e.authRequired?"required":"disabled")+(e.emaEnabled?" + EMA":""),tone:e.authRequired?void 0:"warn"}),f(I,{label:"state",value:e.sharedState?"shared (Redis)":"in-process"}),e.passthrough?f(I,{label:"mode",value:"passthrough",tone:"warn"}):null,ai(e.version,"consoleSource")&&e.consoleSource?f(I,{label:"console build",value:e.consoleSource.slice(0,12)}):null]}),f(le,{title:"Federation",action:f(te,{to:"/upstreams",className:"group-action",children:"All upstreams →"}),children:[f(I,{label:"upstreams",value:`${e.staticUpstreams} static + ${e.discoveredUpstreams} discovered`}),f(I,{label:"connected",value:`${n} / ${r}`,tone:r===0?"warn":n===r?"ok":"bad"}),f(I,{label:"routing",value:`sep ${e.namespaceSeparator} · ${e.pageSize?`page size ${e.pageSize}`:"no pagination"}`})]}),f(le,{title:"Governance",action:f(ut,{topic:"policy",children:"Policy docs"}),children:[f(I,{label:"policy",value:`${e.policyDefaultDecision}, ${e.policyRules} rule(s)`,tone:e.policyDefaultDecision==="deny"?void 0:"warn"}),e.globalRequestsPerMinute?f(I,{label:"rate limit",value:`${e.globalRequestsPerMinute}/min global`+(e.perPrincipalRequestsPerMinute?` · ${e.perPrincipalRequestsPerMinute}/min per principal`:"")}):null,e.viewerGroups?.length?f(I,{label:"viewers",value:e.viewerGroups.join(", "),wrap:!0}):null]}),e.tenant&&ai(e.version,"tenantGovernance")?f(le,{title:"Your tenant",children:[f(I,{label:"tenant",value:e.tenant}),e.tenantRequestsPerMinute?f(I,{label:"requests",value:`${e.tenantRequestsPerMinute}/min`}):null,e.tenantUpstreamCalls?f(I,{label:"budget",value:`${e.tenantUpstreamCalls} calls/${Q(e.tenantBudgetPeriod)}`}):null]}):null,f(le,{title:"Observability",action:f(ut,{topic:"observability",children:"Observability docs"}),children:[f(I,{label:"audit",value:e.auditSinks.length?e.auditSinks.join(" + "):"none",tone:e.auditSinks.length?void 0:"warn"}),f(I,{label:"tracing",value:e.tracingEnabled?"OTLP":"off"})]}),e.discovery?f(le,{title:"Discovery",action:f(ut,{topic:"discovery",children:"Discovery docs"}),children:[f(I,{label:"source",value:e.discovery.url,wrap:!0}),f(I,{label:"interval",value:lh(e.discovery.intervalMs)}),e.discovery.lastOutcome?f(I,{label:"last sync",value:`${e.discovery.lastOutcome} · ${ch(e.discovery.lastSyncAt)}`,tone:e.discovery.lastOutcome==="applied"||e.discovery.lastOutcome==="unchanged"?"ok":"bad",wrap:!0}):f(I,{label:"last sync",value:"not yet run",tone:"warn"})]}):null]})}const hh=Lt({getParentRoute:()=>it,path:"/",component:uh});function aa(e,t,n,r="asc"){const s=t.find(a=>a.key===n);if(!s)return e;const i=r==="desc"?-1:1;return e.slice().sort((a,o)=>{const l=s.value(a),c=s.value(o);return typeof l=="number"&&typeof c=="number"?(l-c)*i:String(l).localeCompare(String(c),void 0,{numeric:!0})*i})}function qr({columns:e,rows:t,rowKey:n,sort:r,dir:s="asc",onSort:i,empty:a,caption:o,loading:l}){return f("div",{class:"tablewrap",children:f("table",{children:[o?f("caption",{class:"visually-hidden",children:o}):null,f("thead",{children:f("tr",{children:e.map(c=>{const d=r===c.key,u=i&&c.sortable!==!1;return f("th",{"aria-sort":d?s==="asc"?"ascending":"descending":void 0,children:c.headerHidden?f("span",{class:"visually-hidden",children:c.header}):u?f("button",{type:"button",class:"th-sort",onClick:()=>i(c.key),children:[c.header,f("span",{class:"sort-mark","aria-hidden":"true",children:d?s==="asc"?"↑":"↓":""})]}):c.header},c.key)})})}),f("tbody",{children:l?f(ah,{columns:e.length}):t.length===0?f("tr",{children:f("td",{class:"empty-cell",colSpan:e.length,children:a})}):t.map(c=>f("tr",{children:e.map(d=>f("td",{class:[d.tone?.(c),d.wrap?"wrap":""].filter(Boolean).join(" ")||void 0,children:d.render?d.render(c):d.value(c)},d.key))},n(c)))})]})})}function Wr({options:e,value:t,onChange:n,label:r}){return f("div",{class:"seg",role:"group","aria-label":r,children:e.map(s=>f("button",{type:"button",class:s.value===t?"active":void 0,"aria-pressed":s.value===t,disabled:s.disabled,onClick:()=>n(s.value),children:[s.label,s.count===void 0?null:f("span",{class:"seg-count",children:s.count})]},s.value))})}const jn=980,ui=20,Ee=34,ca=12,He=Ee+ca,me=268,dr=300,_e=26,Te=108,ht=76,hi=me+dr+18,dh=40;function fh(e,t,n){if(t<2)return n;const r=ht-26;return n-r/2+r*e/(t-1)}const ph=.6;function Wt(e,t,n){const r=Math.floor(t/(n*ph));return e.length<=r?e:`${e.slice(0,Math.max(1,r-1))}…`}function Vt(e){return e.connected&&(e.breaker==="closed"||!e.breaker)?"live":!e.connected||e.breaker==="open"?"down":"idle"}function di(e){const t=e.connected?"connected":"not connected",n=e.breaker?`, breaker ${e.breaker}`:"",r=e.connected?`, ${Ct(e.latencyMs)}`:e.error?`, ${e.error}`:"";return`${e.id}: ${t}${n}${r}`}function _h({state:e,upstreams:t}){const n=t.slice(0,dh),r=t.length-n.length,s=n.length*He-ca,i=Math.max(s,ht),a=i+ui*2,o=ui+(i-s)/2,l=a/2,c=_e+Te/2,d=t.filter(h=>Vt(h)==="live").length,u=`${t.length} upstream${t.length===1?"":"s"} behind one gateway endpoint at ${e.mcpPath}; ${d} connected. Every route crosses the gateway's auth, policy and audit boundary.`;return f("figure",{class:"topology",children:[f("p",{class:"visually-hidden",children:[u," Each upstream links to its detail page; the same data is in the table view."]}),f("div",{class:"topology-scroll",children:f("svg",{class:"topology-svg",viewBox:`0 0 ${jn} ${a}`,width:jn,height:a,children:[n.map((h,p)=>{const m=o+p*He+Ee/2,_=fh(p,n.length,l),g=`M ${_e+Te} ${_} C ${_e+Te+64} ${_}, ${me-64} ${m}, ${me} ${m}`,v=Vt(h);return f("path",{class:v==="live"?"fold-active":v==="down"?"fold-broken":"fold-dash",d:g},h.id)}),n.map((h,p)=>Vt(h)==="live"?f("path",{class:"fold-arrow",d:`M ${me-12} ${o+p*He+Ee/2-6} L ${me} ${o+p*He+Ee/2} L ${me-12} ${o+p*He+Ee/2+6} Z`},`a-${h.id}`):null),f("path",{class:"fold-notch",d:`M ${_e-8} ${l-8} v 16 M ${_e-4} ${l-11} v 22`}),f("path",{class:"fold-notch",d:`M ${_e+Te+4} ${l-11} v 22 M ${_e+Te+8} ${l-8} v 16`}),f("g",{children:[f("title",{children:`fold gateway, ${e.mcpPath}`}),f("rect",{class:"fold-gate",x:_e,y:l-ht/2,width:Te,height:ht,rx:"2"}),f("path",{class:"fold-node-mark",d:Ko,transform:Pu(c,l-8,56)}),f("text",{class:"fold-anno",x:c,y:l+18,"text-anchor":"middle",children:Wt(e.mcpPath,Te-12,11)})]}),f("text",{class:"fold-anno",x:c,y:l+ht/2+16,"text-anchor":"middle",children:Wt(`${e.policyDefaultDecision} · ${e.policyRules} rules`,150,11)}),n.map((h,p)=>{const m=o+p*He,_=m+Ee/2,g=Vt(h),v=h.namespace?`${h.namespace}${e.namespaceSeparator}*`:h.id,y=h.connected?h.breaker&&h.breaker!=="closed"?`${Ct(h.latencyMs)} · breaker ${h.breaker}`:Ct(h.latencyMs):h.error??"not connected";return f("a",{class:"fold-link",href:`#/upstreams/${encodeURIComponent(h.id)}`,"aria-label":di(h),children:[f("title",{children:di(h)}),f("rect",{class:"fold-node",x:me,y:m,width:dr,height:Ee,rx:"2"}),f("text",{class:"fold-node-label",x:me+14,y:_+5,children:Wt(v,dr-28,14)}),f("text",{class:`fold-anno ${g==="down"?"is-down":""}`,x:hi,y:_+4,children:Wt(y,jn-hi-8,11)})]},h.id)})]})}),f("figcaption",{class:"muted topology-caption",children:[d," of ",t.length," connected",r>0?` · ${r} more not drawn, see the table`:""," · every route crosses auth, policy and audit"]})]})}function mh(e){const t=(s,i)=>typeof s=="string"&&i.includes(s)?s:void 0,n=typeof e.q=="string"&&e.q?e.q:void 0,r=typeof e.sort=="string"&&e.sort?e.sort:void 0;return{...e.view==="map"?{view:"map"}:{},...n?{q:n}:{},...r?{sort:r}:{},...t(e.source,["static","discovered"])?{source:t(e.source,["static","discovered"])}:{},...t(e.status,["connected","disconnected"])?{status:t(e.status,["connected","disconnected"])}:{},...t(e.dir,["asc","desc"])?{dir:t(e.dir,["asc","desc"])}:{}}}const gh=e=>e.breaker==="closed"?"ok":e.breaker==="open"?"bad":"warn";function yh(){const{state:e,isPending:t}=Pn(),n=fr.useSearch(),r=It({from:fr.fullPath}),s=u=>{r({search:h=>({...h,...u}),replace:!0})},i=q(()=>[{key:"id",header:"Upstream",value:u=>u.id,render:u=>f(te,{to:"/upstreams/$id",params:{id:u.id},className:"cell-link",children:u.id})},{key:"namespace",header:"Namespace",value:u=>u.namespace??"",render:u=>Q(u.namespace)},{key:"source",header:"Source",value:u=>u.source??"",render:u=>Q(u.source)},{key:"auth",header:"Auth",value:u=>u.authStrategy??"",render:u=>Q(u.authStrategy)},{key:"connected",header:"Connected",value:u=>u.connected?1:0,render:u=>u.connected?"yes":"no",tone:u=>u.connected?"ok":"bad"},{key:"breaker",header:"Breaker",value:u=>u.breaker??"",render:u=>Q(u.breaker),tone:u=>u.breaker==="closed"?void 0:gh(u)},{key:"latency",header:"Latency",value:u=>u.connected?u.latencyMs??0:Number.MAX_SAFE_INTEGER,render:u=>u.connected?Ct(u.latencyMs):Q(u.error),tone:u=>u.connected?void 0:"warn",wrap:!0},{key:"owner",header:"Owner",value:u=>ur(u.owner),render:u=>ur(u.owner)}],[]),a=e?.upstreams??[],o=q(()=>{const u=a.filter(h=>n.source&&h.source!==n.source||n.status==="connected"&&!h.connected||n.status==="disconnected"&&h.connected?!1:oa([h.id,h.namespace,h.url,h.authStrategy,h.owner?.org,h.owner?.team,...Object.entries(h.labels??{}).map(([p,m])=>`${p}=${m}`)],n.q??""));return aa(u,i,n.sort,n.dir??"asc")},[a,i,n.q,n.source,n.status,n.sort,n.dir]),l=u=>{n.sort===u?s({dir:n.dir==="asc"?"desc":"asc"}):s({sort:u,dir:"asc"})},c=!!(n.q||n.source||n.status),d=n.view==="map"?"map":"table";return f(M,{children:[f(nt,{title:"Upstreams",lede:"Every MCP server this gateway federates, as the gateway last saw it.",actions:f(ut,{topic:"upstreams",children:"Upstream config"}),children:f("div",{class:"filters",children:[f(Wr,{label:"View",value:d,onChange:u=>s({view:u==="map"?"map":void 0}),options:[{value:"table",label:"Table"},{value:"map",label:"Map"}]}),f("input",{type:"search",class:"filter-text",placeholder:"Filter by id, namespace, URL, owner, label…","aria-label":"Filter upstreams",value:n.q??"",onInput:u=>s({q:u.target.value||void 0})}),f("select",{class:"filter-select","aria-label":"Source",value:n.source??"",onChange:u=>s({source:u.target.value||void 0}),children:[f("option",{value:"",children:"Any source"}),f("option",{value:"static",children:"Static"}),f("option",{value:"discovered",children:"Discovered"})]}),f("select",{class:"filter-select","aria-label":"Connection status",value:n.status??"",onChange:u=>s({status:u.target.value||void 0}),children:[f("option",{value:"",children:"Any status"}),f("option",{value:"connected",children:"Connected"}),f("option",{value:"disconnected",children:"Disconnected"})]}),f("output",{class:"muted count","aria-live":"polite",children:[o.length," of ",a.length]})]})}),d==="map"&&e&&o.length>0?f(_h,{state:e,upstreams:o}):f(qr,{caption:"Federated upstreams",columns:i,rows:o,rowKey:u=>u.id,sort:n.sort,dir:n.dir??"asc",onSort:l,loading:t,empty:c?f(Y,{title:"No upstream matches this filter",hint:f("button",{type:"button",class:"linkish",onClick:()=>s({q:void 0,source:void 0,status:void 0}),children:"Clear the filter"})}):f(Y,{title:"No upstreams in the federation",hint:"Add one under `upstreams` in the gateway config, or enable discovery."})})]})}const fr=Lt({getParentRoute:()=>it,path:"/upstreams",validateSearch:mh,component:yh});function pr({title:e,text:t,placeholder:n,tall:r,copyLabel:s,actions:i,follow:a}){const o=H(null),l=H(!0),c=()=>{const d=o.current;d&&(l.current=d.scrollHeight-d.scrollTop-d.clientHeight<48)};return W(()=>{const d=o.current;!a||!d||!l.current||(d.scrollTop=d.scrollHeight)},[a,t]),f("section",{class:"pane-block","aria-label":e,children:[f("div",{class:"pane-head",children:[f("h3",{children:e}),f("div",{class:"pane-actions",children:[i,f(Ye,{value:t,label:s??e})]})]}),f("pre",{ref:o,class:r?"pane tall":"pane",tabIndex:0,onScroll:a?c:void 0,children:t||n})]})}const vh=[{key:"url",header:"Endpoint",value:e=>e.url??"",render:e=>Q(e.url),wrap:!0},{key:"healthy",header:"Health",value:e=>e.healthy?1:0,render:e=>e.healthy?"healthy":"unhealthy",tone:e=>e.healthy?"ok":"bad",sortable:!1}];function bh(){const{id:e}=la.useParams(),{state:t,isPending:n}=Pn();if(!t)return f(Y,{title:n?"Reading the federation snapshot…":"No federation snapshot"});const r=t.upstreams.find(i=>i.id===e);if(!r)return f(Y,{title:`No upstream "${e}" in this federation`,hint:f(M,{children:["It may have been removed, or it may sit outside the visibility your tenant is granted."," ",f(te,{to:"/upstreams",children:"Back to upstreams"})]})});const s=Object.entries(r.labels??{});return f(M,{children:[f(nt,{title:r.id,back:f(te,{to:"/upstreams",className:"back",children:"← Upstreams"}),actions:f(Ye,{value:r.id,label:"Upstream ID"})}),f(le,{title:"Status",children:[f(I,{label:"connected",value:r.connected?"yes":"no",tone:r.connected?"ok":"bad"}),f(I,{label:"breaker",value:Q(r.breaker),tone:r.breaker==="closed"?"ok":r.breaker==="open"?"bad":"warn"}),f(I,{label:"latency",value:r.connected?Ct(r.latencyMs):rt}),r.error?f(I,{label:"error",value:r.error,tone:"bad",wrap:!0}):null]}),f(le,{title:"Configuration",children:[f(I,{label:"namespace",value:Q(r.namespace)}),f(I,{label:"source",value:Q(r.source)}),f(I,{label:"auth strategy",value:Q(r.authStrategy)}),r.url?f(I,{label:"url",value:f(M,{children:[r.url,f(Ye,{value:r.url,label:"Upstream URL"})]}),wrap:!0}):null]}),f(le,{title:"Ownership",children:[f(I,{label:"owner",value:ur(r.owner)}),r.owner?.contact?f(I,{label:"contact",value:f(M,{children:[r.owner.contact,f(Ye,{value:r.owner.contact,label:"Contact"})]}),wrap:!0}):null]}),f("section",{class:"group",children:[f("div",{class:"group-head",children:f("h2",{children:"Labels"})}),s.length?f("div",{class:"chips",children:s.map(([i,a])=>f("span",{class:"chip",children:[i,"=",a]},i))}):f("p",{class:"muted",children:"No labels on this upstream."})]}),f("section",{class:"group",children:[f("div",{class:"group-head",children:f("h2",{children:"Endpoints"})}),f(qr,{caption:`Endpoints for ${r.id}`,columns:vh,rows:r.endpoints??[],rowKey:i=>i.url??"endpoint",empty:f(Y,{title:"Single endpoint",hint:"This upstream is not load-balanced, so the balancer reports no per-replica view."})})]}),f(pr,{title:"Raw record",copyLabel:"Raw record",text:hr(r),placeholder:""})]})}const la=Lt({getParentRoute:()=>it,path:"/upstreams/$id",component:bh});function wh(e){const t=Mt.includes(e.mode)?e.mode:void 0,n=typeof e.q=="string"&&e.q?e.q:void 0,r=typeof e.sort=="string"&&e.sort?e.sort:void 0,s=e.dir==="asc"||e.dir==="desc"?e.dir:void 0;return{...t?{mode:t}:{},...n?{q:n}:{},...r?{sort:r}:{},...s?{dir:s}:{}}}function Qt(e,t){const n=t?e.indexOf(t):-1;return n<=0?{namespace:"",local:e}:{namespace:e.slice(0,n),local:e.slice(n+t.length)}}function Sh(){const{state:e}=Pn(),t=Zo(),n=_r.useSearch(),r=It({from:_r.fullPath}),s=n.mode??"tools",i=e?.namespaceSeparator??"",a=u=>{r({search:h=>({...h,...u}),replace:!0})},o=q(()=>[{key:"name",header:s==="resources"?"URI":"Name",value:u=>Qt(G(s,u),i).local,render:u=>f(te,{to:"/test",search:{mode:s,item:G(s,u)},className:"cell-link",title:G(s,u),children:Qt(G(s,u),i).local})},{key:"namespace",header:"Namespace",value:u=>Qt(G(s,u),i).namespace,render:u=>Q(Qt(G(s,u),i).namespace)},{key:"description",header:"Description",value:u=>u.description??u.title??"",render:u=>Q(u.description??u.title),wrap:!0},{key:"copy",header:"Copy",headerHidden:!0,value:()=>"",sortable:!1,render:u=>f(Ye,{value:G(s,u),label:s==="resources"?"URI":"Name"})}],[s,i]),l=t.catalog[s],c=q(()=>{const u=l.filter(h=>oa([G(s,h),h.title,h.description,h.mimeType],n.q??""));return aa(u,o,n.sort,n.dir??"asc")},[l,o,s,n.q,n.sort,n.dir]),d=u=>{n.sort===u?a({dir:n.dir==="asc"?"desc":"asc"}):a({sort:u,dir:"asc"})};return f(M,{children:[f(nt,{title:"Catalog",lede:"Tools, prompts and resources visible to this principal: the same list any MCP client would receive.",actions:f("button",{type:"button",class:t.status==="ready"?void 0:"primary",onClick:t.connect,disabled:t.status==="connecting",children:t.status==="connecting"?"Connecting…":t.status==="ready"?"Reload catalog":"Connect & list"}),children:f("div",{class:"filters",children:[f(Wr,{label:"Capability",value:s,onChange:u=>a({mode:u,sort:void 0,dir:void 0}),options:Mt.map(u=>({value:u,label:Fe[u].label,count:t.status==="ready"?t.catalog[u].length:void 0}))}),f("input",{type:"search",class:"filter-text",placeholder:"Filter by name, description, namespace…","aria-label":"Filter catalog",value:n.q??"",disabled:t.status!=="ready",onInput:u=>a({q:u.target.value||void 0})}),t.status==="ready"?f("output",{class:"muted count","aria-live":"polite",children:[c.length," of ",l.length]}):null]})}),f(qr,{caption:`${Fe[s].label} visible to this principal`,columns:o,rows:t.status==="ready"?c:[],rowKey:u=>G(s,u),sort:n.sort,dir:n.dir??"asc",onSort:d,empty:Ph(t.status,t.error,l.length,!!n.q,s)})]})}function Ph(e,t,n,r,s){return e==="connecting"?"Connecting to the gateway…":e==="error"?f(Y,{title:"Could not list the catalog",hint:t??void 0}):e==="idle"?f(Y,{title:"Not connected",hint:"Connect to open an MCP session against the gateway and list what this principal may see."}):r&&n?f(Y,{title:"Nothing matches this filter"}):f(Y,{title:`No ${Fe[s].label.toLowerCase()} visible`,hint:"Either no federated server exposes any, or policy denies this principal every one of them."})}const _r=Lt({getParentRoute:()=>it,path:"/catalog",validateSearch:wh,component:Sh});function Ch(e){const t=Mt.includes(e.mode)?e.mode:void 0,n=typeof e.item=="string"&&e.item?e.item:void 0;return{...t?{mode:t}:{},...n?{item:n}:{}}}function Rh(){const e=Zo(),t=mr.useSearch(),n=It({from:mr.fullPath}),r=t.mode??"tools",s=Fe[r],i=e.catalog[r],a=t.item&&i.some(b=>G(r,b)===t.item)?t.item:i[0]?G(r,i[0]):"",o=i.find(b=>G(r,b)===a),[l,c]=A(""),[d,u]=A(""),[h,p]=A(null),[m,_]=A(!1);W(()=>{c(s.args?Au(o):""),u(""),p(null)},[r,a,s.args,o]);const g=b=>{n({search:R=>({...R,...b}),replace:!0})},v=q(()=>e.wire.map(b=>`${b.direction} ${hr(b.message)}`).join(` +var kt,E,pi,ge,es,_i,mi,En,Qt,ft,gi,gr,Hn,qn,yi,nn={},rn=[],ya=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,xt=Array.isArray;function ae(e,t){for(var n in t)e[n]=t[n];return e}function yr(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function z(e,t,n){var r,s,i,a={};for(i in t)i=="key"?r=t[i]:i=="ref"?s=t[i]:a[i]=t[i];if(arguments.length>2&&(a.children=arguments.length>3?kt.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)a[i]===void 0&&(a[i]=e.defaultProps[i]);return pt(e,a,r,s,null)}function pt(e,t,n,r,s){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:s??++pi,__i:-1,__u:0};return s==null&&E.vnode!=null&&E.vnode(i),i}function vi(){return{current:null}}function I(e){return e.children}function ee(e,t){this.props=e,this.context=t}function Ie(e,t){if(t==null)return e.__?Ie(e.__,e.__i+1):null;for(var n;tt&&ge.sort(mi),e=ge.shift(),t=ge.length,va(e)}finally{ge.length=sn.__r=0}}function wi(e,t,n,r,s,i,a,o,l,c,d){var u,h,p,m,_,g,y=r&&r.__k||rn,v=t.length;for(l=ba(n,t,y,l,v),u=0;u0?a=e.__k[i]=pt(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[i]=a,l=i+h,a.__=e,a.__b=e.__b+1,o=null,(c=a.__i=wa(a,n,l,u))!=-1&&(u--,(o=n[c])&&(o.__u|=2)),o==null||o.__v==null?(c==-1&&(s>d?h--:sl?h--:h++,a.__u|=4))):e.__k[i]=null;if(u)for(i=0;i(d?1:0)){for(s=n-1,i=n+1;s>=0||i=0?s--:i++])!=null&&(2&c.__u)==0&&o==c.key&&l==c.type)return a}return-1}function ts(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||ya.test(t)?n:n+"px"}function Nt(e,t,n,r,s){var i,a;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||ts(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||ts(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")i=t!=(t=t.replace(gi,"$1")),a=t.toLowerCase(),t=a in e||t=="onFocusOut"||t=="onFocusIn"?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r?n[ft]=r[ft]:(n[ft]=gr,e.addEventListener(t,i?qn:Hn,i)):e.removeEventListener(t,i?qn:Hn,i);else{if(s=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function ns(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Qt]==null)t[Qt]=gr++;else if(t[Qt]0?e:xt(e)?e.map(Ri):e.constructor!==void 0?null:ae({},e)}function Sa(e,t,n,r,s,i,a,o,l){var c,d,u,h,p,m,_,g=n.props||nn,y=t.props,v=t.type;if(v=="svg"?s="http://www.w3.org/2000/svg":v=="math"?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),i!=null){for(c=0;c2&&(o.children=arguments.length>3?kt.call(arguments,2):n),pt(e.type,o,r||e.key,s||e.ref,null)}function ne(e){function t(n){var r,s;return this.getChildContext||(r=new Set,(s={})[t.__c]=this,this.getChildContext=function(){return s},this.componentWillUnmount=function(){r=null},this.shouldComponentUpdate=function(i){this.props.value!=i.value&&r.forEach(function(a){a.__e=!0,Wn(a)})},this.sub=function(i){r.add(i);var a=i.componentWillUnmount;i.componentWillUnmount=function(){r&&r.delete(i),a&&a.call(i)}}),n.children}return t.__c="__cC"+yi++,t.__=e,t.Provider=t.__l=(t.Consumer=function(n,r){return n.children(r)}).contextType=t,t}kt=rn.slice,E={__e:function(e,t,n,r){for(var s,i,a;t=t.__;)if((s=t.__c)&&!s.__)try{if((i=s.constructor)&&i.getDerivedStateFromError!=null&&(s.setState(i.getDerivedStateFromError(e)),a=s.__d),s.componentDidCatch!=null&&(s.componentDidCatch(e,r||{}),a=s.__d),a)return s.__E=s}catch(o){e=o}throw e}},pi=0,ee.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=ae({},this.state),typeof e=="function"&&(e=e(ae({},n),this.props)),e&&ae(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Wn(this))},ee.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Wn(this))},ee.prototype.render=I,ge=[],_i=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,mi=function(e,t){return e.__v.__b-t.__v.__b},sn.__r=0,En=Math.random().toString(8),Qt="__d"+En,ft="__a"+En,gi=/(PointerCapture)$|Capture$/i,gr=0,Hn=ns(!1),qn=ns(!0),yi=0;var Ra=0;function f(e,t,n,r,s,i){t||(t={});var a,o,l=t;if("ref"in l)for(o in l={},t)o=="ref"?a=t[o]:l[o]=t[o];var c={type:e,props:l,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Ra,__i:-1,__u:0,__source:s,__self:i};if(typeof e=="function"&&(a=e.defaultProps))for(o in a)l[o]===void 0&&(l[o]=a[o]);return E.vnode&&E.vnode(c),c}var Tt=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ka=class extends Tt{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<"u"&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},wr=new ka,xa={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Ta=class{#e=xa;#t=!1;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}},Oe=new Ta;function Ea(e){setTimeout(e,0)}var Oa=typeof window>"u"||"Deno"in globalThis;function V(){}function La(e,t){return typeof e=="function"?e(t):e}function Vn(e){return typeof e=="number"&&e>=0&&e!==1/0}function Ti(e,t){return Math.max(e+(t||0)-Date.now(),0)}function ve(e,t){return typeof e=="function"?e(t):e}function J(e,t){return typeof e=="function"?e(t):e}function rs(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:i,queryKey:a,stale:o}=e;if(a){if(r){if(t.queryHash!==Sr(a,t.options))return!1}else if(!Ze(t.queryKey,a))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof o=="boolean"&&t.isStale()!==o||s&&s!==t.state.fetchStatus||i&&!i(t))}function ss(e,t){const{exact:n,status:r,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(gt(t.options.mutationKey)!==gt(i))return!1}else if(!Ze(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function Sr(e,t){return(t?.queryKeyHashFn||gt)(e)}function gt(e){return JSON.stringify(e,(t,n)=>Qn(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function Ze(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(Array.isArray(e)&&Array.isArray(t)){for(let r=0;r500)return t;const r=is(e)&&is(t);if(!r&&!(Qn(e)&&Qn(t)))return t;const i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,l=r?new Array(o):{};let c=0;for(let d=0;d{Oe.setTimeout(t,e)})}function zn(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?Ei(e,t):t}function $a(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function Fa(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Pr=Symbol();function Oi(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Pr?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Li(e,t){return typeof e=="function"?e(...t):!!e}function Da(e,t,n){let r=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??=t(),r||(r=!0,s.aborted?n():s.addEventListener("abort",n,{once:!0})),s)}),e}var yt=(()=>{let e=()=>Oa;return{isServer(){return e()},setIsServer(t){e=t}}})();function Gn(){let e,t;const n=new Promise((s,i)=>{e=s,t=i});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),e(s)},n.reject=s=>{r({status:"rejected",reason:s}),t(s)},n}var Aa=Ea;function Na(){let e=[],t=0,n=o=>{o()},r=o=>{o()},s=Aa;const i=o=>{t?e.push(o):s(()=>{n(o)})},a=()=>{const o=e;e=[],o.length&&s(()=>{r(()=>{o.forEach(l=>{n(l)})})})};return{batch:o=>{let l;t++;try{l=o()}finally{t--,t||a()}return l},batchCalls:o=>(...l)=>{i(()=>{o(...l)})},schedule:i,setNotifyFunction:o=>{n=o},setBatchNotifyFunction:o=>{r=o},setScheduler:o=>{s=o}}}var U=Na(),Ua=class extends Tt{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<"u"&&window.addEventListener){const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(n=>{n(e)}))}isOnline(){return this.#e}},on=new Ua;function Ba(e){return Math.min(1e3*2**e,3e4)}function Ii(e){return(e??"online")==="online"?on.isOnline():!0}var Jn=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function Mi(e){let t=!1,n=0,r;const s=Gn(),i=()=>s.status!=="pending",a=_=>{if(!i()){const g=new Jn(_);h(g),e.onCancel?.(g)}},o=()=>{t=!0},l=()=>{t=!1},c=()=>wr.isFocused()&&(e.networkMode==="always"||on.isOnline())&&e.canRun(),d=()=>Ii(e.networkMode)&&e.canRun(),u=_=>{i()||(r?.(),s.resolve(_))},h=_=>{i()||(r?.(),s.reject(_))},p=()=>new Promise(_=>{r=g=>{(i()||c())&&_(g)},e.onPause?.()}).then(()=>{r=void 0,i()||e.onContinue?.()}),m=()=>{if(i())return;let _;const g=n===0?e.initialPromise:void 0;try{_=g??e.fn()}catch(y){_=Promise.reject(y)}Promise.resolve(_).then(u).catch(y=>{if(i())return;const v=e.retry??(yt.isServer()?0:3),P=e.retryDelay??Ba,w=typeof P=="function"?P(n,y):P,R=v===!0||typeof v=="number"&&nc()?void 0:p()).then(()=>{t?h(y):m()})})};return{promise:s,status:()=>s.status,cancel:a,continue:()=>(r?.(),s),cancelRetry:o,continueRetry:l,canStart:d,start:()=>(d()?m():p().then(m),s)}}var $i=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Vn(this.gcTime)&&(this.#e=Oe.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(yt.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(Oe.clearTimeout(this.#e),this.#e=void 0)}};function ja(e){return{onFetch:(t,n)=>{const r=t.options,s=t.fetchOptions?.meta?.fetchMore?.direction,i=t.state.data?.pages||[],a=t.state.data?.pageParams||[];let o={pages:[],pageParams:[]},l=0;const c=async()=>{let d=!1;const u=m=>{Da(m,()=>t.signal,()=>d=!0)},h=Oi(t.options,t.fetchOptions),p=async(m,_,g)=>{if(d)return Promise.reject(t.signal.reason);if(_==null&&m.pages.length)return Promise.resolve(m);const v=(()=>{const S={client:t.client,queryKey:t.queryKey,pageParam:_,direction:g?"backward":"forward",meta:t.options.meta};return u(S),S})(),P=await h(v),{maxPages:w}=t.options,R=g?Fa:$a;return{pages:R(m.pages,P,w),pageParams:R(m.pageParams,_,w)}};if(s&&i.length){const m=s==="backward",_=m?Ha:as,g={pages:i,pageParams:a},y=_(r,g);o=await p(g,y,m)}else{const m=e??i.length;do{const _=l===0?a[0]??r.initialPageParam:as(r,o);if(l>0&&_==null)break;o=await p(o,_),l++}while(lt.options.persister?.(c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=c}}}function as(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Ha(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var qa=class extends $i{#e;#t;#n;#r;#i;#s;#a;#o;constructor(e){super(),this.#o=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=ls(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#s?.promise}setOptions(e){if(this.options={...this.#a,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const t=ls(this.options);t.data!==void 0&&(this.setState(cs(t.data,t.dataUpdatedAt)),this.#t=t)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#r.remove(this)}setData(e,t){const n=zn(this.state.data,e,this.options);return this.#c({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:"setState",state:e})}cancel(e){const t=this.#s?.promise;return this.#s?.cancel(e),t?t.then(V).catch(V):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>J(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Pr||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>ve(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!Ti(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#s?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#s?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#s&&(this.#o||this.#u()?this.#s.cancel({revert:!0}):this.#s.cancelRetry()),this.scheduleGc()),this.#r.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}#u(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"}invalidate(){this.state.isInvalidated||this.#c({type:"invalidate"})}async fetch(e,t){if(this.state.fetchStatus!=="idle"&&this.#s?.status()!=="rejected"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#s)return this.#s.continueRetry(),this.#s.promise}if(e&&this.setOptions(e),!this.options.queryFn){const l=this.observers.find(c=>c.options.queryFn);l&&this.setOptions(l.options)}const n=new AbortController,r=l=>{Object.defineProperty(l,"signal",{enumerable:!0,get:()=>(this.#o=!0,n.signal)})},s=()=>{const l=Oi(this.options,t),d=(()=>{const u={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(u),u})();return this.#o=!1,this.options.persister?this.options.persister(l,d,this):l(d)},a=(()=>{const l={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:s};return r(l),l})();(this.#e==="infinite"?ja(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:"fetch",meta:a.fetchOptions?.meta}),this.#s=Mi({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:l=>{l instanceof Jn&&l.revert&&this.setState({...this.#n,fetchStatus:"idle"}),n.abort()},onFail:(l,c)=>{this.#c({type:"failed",failureCount:l,error:c})},onPause:()=>{this.#c({type:"pause"})},onContinue:()=>{this.#c({type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{const l=await this.#s.start();if(l===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(l),this.#r.config.onSuccess?.(l,this),this.#r.config.onSettled?.(l,this.state.error,this),l}catch(l){if(l instanceof Jn){if(l.silent)return this.#s.promise;if(l.revert){if(this.state.data===void 0)throw l;return this.state.data}}throw this.#c({type:"error",error:l}),this.#r.config.onError?.(l,this),this.#r.config.onSettled?.(this.state.data,l,this),l}finally{this.scheduleGc()}}#c(e){const t=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...Fi(n.data,this.options),fetchMeta:e.meta??null};case"success":const r={...n,...cs(e.data,e.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?r:void 0,r;case"error":const s=e.error;return{...n,error:s,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=t(this.state),U.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),this.#r.notify({query:this,type:"updated",action:e})})}};function Fi(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ii(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function cs(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function ls(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Wa=class extends Tt{constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.#a=Gn(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#s;#a;#o;#u;#c;#p;#h;#d;#l;#_=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),us(this.#t,this.options)?this.#f():this.updateResult(),this.#v())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Yn(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Yn(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#w(),this.#t.removeObserver(this)}setOptions(e){const t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof J(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#S(),this.#t.setOptions(this.options),t._defaulted&&!Kn(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const r=this.hasListeners();r&&hs(this.#t,n,this.options,t)&&this.#f(),this.updateResult(),r&&(this.#t!==n||J(this.options.enabled,this.#t)!==J(t.enabled,this.#t)||ve(this.options.staleTime,this.#t)!==ve(t.staleTime,this.#t))&&this.#m();const s=this.#g();r&&(this.#t!==n||J(this.options.enabled,this.#t)!==J(t.enabled,this.#t)||s!==this.#l)&&this.#y(s)}getOptimisticResult(e){const t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return Ka(this,n)&&(this.#r=n,this.#s=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(n,r)=>(this.trackProp(r),t?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#a.status==="pending"&&this.#a.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,r))})}trackProp(e){this.#_.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#f({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#f(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(V)),t}#m(){this.#b();const e=ve(this.options.staleTime,this.#t);if(yt.isServer()||this.#r.isStale||!Vn(e))return;const n=Ti(this.#r.dataUpdatedAt,e)+1;this.#h=Oe.setTimeout(()=>{this.#r.isStale||this.updateResult()},n)}#g(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#y(e){this.#w(),this.#l=e,!(yt.isServer()||J(this.options.enabled,this.#t)===!1||!Vn(this.#l)||this.#l===0)&&(this.#d=Oe.setInterval(()=>{(this.options.refetchIntervalInBackground||wr.isFocused())&&this.#f()},this.#l))}#v(){this.#m(),this.#y(this.#g())}#b(){this.#h!==void 0&&(Oe.clearTimeout(this.#h),this.#h=void 0)}#w(){this.#d!==void 0&&(Oe.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){const n=this.#t,r=this.options,s=this.#r,i=this.#i,a=this.#s,l=e!==n?e.state:this.#n,{state:c}=e;let d={...c},u=!1,h;if(t._optimisticResults){const C=this.hasListeners(),k=!C&&us(e,t),T=C&&hs(e,n,t,r);(k||T)&&(d={...d,...Fi(c.data,e.options)}),t._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:p,errorUpdatedAt:m,status:_}=d;h=d.data;let g=!1;if(t.placeholderData!==void 0&&h===void 0&&_==="pending"){let C;s?.isPlaceholderData&&t.placeholderData===a?.placeholderData?(C=s.data,g=!0):C=typeof t.placeholderData=="function"?t.placeholderData(this.#p?.state.data,this.#p):t.placeholderData,C!==void 0&&(_="success",h=zn(s?.data,C,t),u=!0)}if(t.select&&h!==void 0&&!g)if(s&&h===i?.data&&t.select===this.#u)h=this.#c;else try{this.#u=t.select,h=t.select(h),h=zn(s?.data,h,t),this.#c=h,this.#o=null}catch(C){this.#o=C}this.#o&&(p=this.#o,h=this.#c,m=Date.now(),_="error");const y=d.fetchStatus==="fetching",v=_==="pending",P=_==="error",w=v&&y,R=h!==void 0,b={status:_,fetchStatus:d.fetchStatus,isPending:v,isSuccess:_==="success",isError:P,isInitialLoading:w,isLoading:w,data:h,dataUpdatedAt:d.dataUpdatedAt,error:p,errorUpdatedAt:m,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:d.dataUpdateCount>l.dataUpdateCount||d.errorUpdateCount>l.errorUpdateCount,isFetching:y,isRefetching:y&&!v,isLoadingError:P&&!R,isPaused:d.fetchStatus==="paused",isPlaceholderData:u,isRefetchError:P&&R,isStale:Cr(e,t),refetch:this.refetch,promise:this.#a,isEnabled:J(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const C=b.data!==void 0,k=b.status==="error"&&!C,T=$=>{k?$.reject(b.error):C&&$.resolve(b.data)},x=()=>{const $=this.#a=b.promise=Gn();T($)},O=this.#a;switch(O.status){case"pending":e.queryHash===n.queryHash&&T(O);break;case"fulfilled":(k||b.data!==O.value)&&x();break;case"rejected":(!k||b.error!==O.reason)&&x();break}}return b}updateResult(){const e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#s=this.options,this.#i.data!==void 0&&(this.#p=this.#t),Kn(t,e))return;this.#r=t;const n=()=>{if(!e)return!0;const{notifyOnChangeProps:r}=this.options,s=typeof r=="function"?r():r;if(s==="all"||!s&&!this.#_.size)return!0;const i=new Set(s??this.#_);return this.options.throwOnError&&i.add("error"),Object.keys(this.#r).some(a=>{const o=a;return this.#r[o]!==e[o]&&i.has(o)})};this.#P({listeners:n()})}#S(){const e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;const t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#v()}#P(e){U.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function Va(e,t){return J(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&J(t.retryOnMount,e)===!1)}function us(e,t){return Va(e,t)||e.state.data!==void 0&&Yn(e,t,t.refetchOnMount)}function Yn(e,t,n){if(J(t.enabled,e)!==!1&&ve(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Cr(e,t)}return!1}function hs(e,t,n,r){return(e!==t||J(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Cr(e,n)}function Cr(e,t){return J(t.enabled,e)!==!1&&e.isStaleByTime(ve(t.staleTime,e))}function Ka(e,t){return!Kn(e.getCurrentResult(),t)}var Qa=class extends $i{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||za(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#i({type:"continue"})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=Mi({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(new Error("No mutationFn found")),onFail:(i,a)=>{this.#i({type:"failed",failureCount:i,error:a})},onPause:()=>{this.#i({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});const r=this.state.status==="pending",s=!this.#r.canStart();try{if(r)t();else{this.#i({type:"pending",variables:e,isPaused:s}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);const a=await this.options.onMutate?.(e,n);a!==this.state.context&&this.#i({type:"pending",context:a,variables:e,isPaused:s})}const i=await this.#r.start();return await this.#n.config.onSuccess?.(i,e,this.state.context,this,n),await this.options.onSuccess?.(i,e,this.state.context,n),await this.#n.config.onSettled?.(i,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(i,null,e,this.state.context,n),this.#i({type:"success",data:i}),i}catch(i){try{await this.#n.config.onError?.(i,e,this.state.context,this,n)}catch(a){Promise.reject(a)}try{await this.options.onError?.(i,e,this.state.context,n)}catch(a){Promise.reject(a)}try{await this.#n.config.onSettled?.(void 0,i,this.state.variables,this.state.context,this,n)}catch(a){Promise.reject(a)}try{await this.options.onSettled?.(void 0,i,e,this.state.context,n)}catch(a){Promise.reject(a)}throw this.#i({type:"error",error:i}),i}finally{this.#n.runNext(this)}}#i(e){const t=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),U.batch(()=>{this.#t.forEach(n=>{n.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}};function za(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Ga=class extends Tt{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){const r=new Qa({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);const t=Ut(e);if(typeof t=="string"){const n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){const t=Ut(e);if(typeof t=="string"){const n=this.#t.get(t);if(n)if(n.length>1){const r=n.indexOf(e);r!==-1&&n.splice(r,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=Ut(e);if(typeof t=="string"){const r=this.#t.get(t)?.find(s=>s.state.status==="pending");return!r||r===e}else return!0}runNext(e){const t=Ut(e);return typeof t=="string"?this.#t.get(t)?.find(r=>r!==e&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){U.batch(()=>{this.#e.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){const t={exact:!0,...e};return this.getAll().find(n=>ss(t,n))}findAll(e={}){return this.getAll().filter(t=>ss(e,t))}notify(e){U.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return U.batch(()=>Promise.all(e.map(t=>t.continue().catch(V))))}};function Ut(e){return e.options.scope?.id}var Ja=class extends Tt{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){const r=t.queryKey,s=t.queryHash??Sr(r,t);let i=this.get(s);return i||(i=new qa({client:e,queryKey:r,queryHash:s,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(i)),i}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){U.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(n=>rs(t,n))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(n=>rs(e,n)):t}notify(e){U.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){U.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){U.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Ya=class{#e;#t;#n;#r;#i;#s;#a;#o;constructor(e={}){this.#e=e.queryCache||new Ja,this.#t=e.mutationCache||new Ga,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#s=0}mount(){this.#s++,this.#s===1&&(this.#a=wr.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#o=on.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#s--,this.#s===0&&(this.#a?.(),this.#a=void 0,this.#o?.(),this.#o=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#t.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(ve(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=La(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return U.batch(()=>this.#e.findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){const t=this.#e;U.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=this.#e;return U.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=U.batch(()=>this.#e.findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(V).catch(V)}invalidateQueries(e,t={}){return U.batch(()=>(this.#e.findAll(e).forEach(n=>{n.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=U.batch(()=>this.#e.findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,n);return n.throwOnError||(i=i.catch(V)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(V)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=this.#e.build(this,t);return n.isStaleByTime(ve(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(V).catch(V)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(V).catch(V)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return on.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(gt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#r.values()],n={};return t.forEach(r=>{Ze(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(gt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#i.values()],n={};return t.forEach(r=>{Ze(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Sr(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Pr&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},fe,M,On,ds,et=0,Di=[],A=E,fs=A.__b,ps=A.__r,_s=A.diffed,ms=A.__c,gs=A.unmount,ys=A.__;function De(e,t){A.__h&&A.__h(M,e,et||t),et=0;var n=M.__H||(M.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function F(e){return et=1,mn(Ai,e)}function mn(e,t,n){var r=De(fe++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Ai(void 0,t),function(o){var l=r.__N?r.__N[0]:r.__[0],c=r.t(l,o);l!==c&&(r.__N=[c,r.__[1]],r.__c.setState({}))}],r.__c=M,!M.__f)){var s=function(o,l,c){if(!r.__c.__H)return!0;var d=!1,u=r.__c.props!==o;if(r.__c.__H.__.some(function(p){if(p.__N){d=!0;var m=p.__[0];p.__=p.__N,p.__N=void 0,m!==p.__[0]&&(u=!0)}}),i){var h=i.call(this,o,l,c);return d?h||u:h}return!d||u};M.__f=!0;var i=M.shouldComponentUpdate,a=M.componentWillUpdate;M.componentWillUpdate=function(o,l,c){if(this.__e){var d=i;i=void 0,s(o,l,c),i=d}a&&a.call(this,o,l,c)},M.shouldComponentUpdate=s}return r.__N||r.__}function j(e,t){var n=De(fe++,3);!A.__s&&xr(n.__H,t)&&(n.__=e,n.u=t,M.__H.__h.push(n))}function Ae(e,t){var n=De(fe++,4);!A.__s&&xr(n.__H,t)&&(n.__=e,n.u=t,M.__h.push(n))}function q(e){return et=5,B(function(){return{current:e}},[])}function gn(e,t,n){et=6,Ae(function(){if(typeof e=="function"){var r=e(t());return function(){e(null),r&&typeof r=="function"&&r()}}if(e)return e.current=t(),function(){return e.current=null}},n==null?n:n.concat(e))}function B(e,t){var n=De(fe++,7);return xr(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function W(e,t){return et=8,B(function(){return e},t)}function te(e){var t=M.context[e.__c],n=De(fe++,9);return n.c=e,t?(n.__==null&&(n.__=!0,t.sub(M)),t.props.value):e.__}function Rr(e,t){A.useDebugValue&&A.useDebugValue(t?t(e):e)}function Xa(e){var t=De(fe++,10),n=F();return t.__=e,M.componentDidCatch||(M.componentDidCatch=function(r,s){t.__&&t.__(r,s),n[1](r)}),[n[0],function(){n[1](void 0)}]}function kr(){var e=De(fe++,11);if(!e.__){for(var t=M.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__="P"+n[0]+"-"+n[1]++}return e.__}function Za(){for(var e;e=Di.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(zt),t.__h.some(Xn),t.__h=[]}catch(n){t.__h=[],A.__e(n,e.__v)}}}A.__b=function(e){M=null,fs&&fs(e)},A.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),ys&&ys(e,t)},A.__r=function(e){ps&&ps(e),fe=0;var t=(M=e.__c).__H;t&&(On===M?(t.__h=[],M.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(zt),t.__h.some(Xn),t.__h=[],fe=0)),On=M},A.diffed=function(e){_s&&_s(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Di.push(t)!==1&&ds===A.requestAnimationFrame||((ds=A.requestAnimationFrame)||ec)(Za)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),On=M=null},A.__c=function(e,t){t.some(function(n){try{n.__h.some(zt),n.__h=n.__h.filter(function(r){return!r.__||Xn(r)})}catch(r){t.some(function(s){s.__h&&(s.__h=[])}),t=[],A.__e(r,n.__v)}}),ms&&ms(e,t)},A.unmount=function(e){gs&&gs(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(r){try{zt(r)}catch(s){t=s}}),n.__H=void 0,t&&A.__e(t,n.__v))};var vs=typeof requestAnimationFrame=="function";function ec(e){var t,n=function(){clearTimeout(r),vs&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);vs&&(t=requestAnimationFrame(n))}function zt(e){var t=M,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),M=t}function Xn(e){var t=M;e.__c=e.__(),M=t}function xr(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function Ai(e,t){return typeof t=="function"?t(e):t}function Ni(e,t){for(var n in t)e[n]=t[n];return e}function Zn(e,t){for(var n in e)if(n!=="__source"&&!(n in t))return!0;for(var r in t)if(r!=="__source"&&e[r]!==t[r])return!0;return!1}function st(e,t){var n=t(),r=F({t:{__:n,u:t}}),s=r[0].t,i=r[1];return Ae(function(){s.__=n,s.u=t,Ln(s)&&i({t:s})},[e,n,t]),j(function(){return Ln(s)&&i({t:s}),e(function(){Ln(s)&&i({t:s})})},[e]),n}function Ln(e){try{return!((t=e.__)===(n=e.u())&&(t!==0||1/t==1/n)||t!=t&&n!=n)}catch{return!0}var t,n}function yn(e){e()}function Tr(e){return e}function Er(){return[!1,yn]}var Or=Ae;function an(e,t){this.props=e,this.context=t}function Et(e,t){function n(s){var i=this.props.ref;return i!=s.ref&&i&&(typeof i=="function"?i(null):i.current=null),t?!t(this.props,s)||i!=s.ref:Zn(this.props,s)}function r(s){return this.shouldComponentUpdate=n,z(e,s)}return r.displayName="Memo("+(e.displayName||e.name)+")",r.__f=r.prototype.isReactComponent=!0,r.type=e,r}(an.prototype=new ee).isPureReactComponent=!0,an.prototype.shouldComponentUpdate=function(e,t){return Zn(this.props,e)||Zn(this.state,t)};var bs=E.__b;E.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),bs&&bs(e)};var tc=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function Lr(e){function t(n){var r=Ni({},n);return delete r.ref,e(r,n.ref||null)}return t.$$typeof=tc,t.render=e,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var ws=function(e,t){return e==null?null:de(de(e).map(t))},Ui={map:ws,forEach:ws,count:function(e){return e?de(e).length:0},only:function(e){var t=de(e);if(t.length!==1)throw"Children.only";return t[0]},toArray:de},nc=E.__e;E.__e=function(e,t,n,r){if(e.then){for(var s,i=t;i=i.__;)if((s=i.__c)&&s.__c)return t.__e==null&&(t.__e=n.__e,t.__k=n.__k||[]),s.__c(e,t)}nc(e,t,n,r)};var Ss=E.unmount;function Bi(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),e.__c.__H=null),(e=Ni({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return Bi(r,t,n)})),e}function ji(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return ji(r,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function be(){this.__u=0,this.o=null,this.__b=null}function Hi(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function qi(e){var t,n,r,s=null;function i(a){if(t||(t=e()).then(function(o){o&&(s=o.default||o),r=!0},function(o){n=o,r=!0}),n)throw n;if(!r)throw t;return s?z(s,a):null}return i.displayName="Lazy",i.__f=!0,i}function Ve(){this.i=null,this.l=null}E.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Ss&&Ss(e)},(be.prototype=new ee).__c=function(e,t){var n=t.__c,r=this;r.o==null&&(r.o=[]),r.o.push(n);var s=Hi(r.__v),i=!1,a=function(){i||r.__z||(i=!0,n.__R=null,s?s(l):l())};n.__R=a;var o=n.__P;n.__P=null;var l=function(){if(!--r.__u){if(r.state.__a){var c=r.state.__a;r.__v.__k[0]=ji(c,c.__c.__P,c.__c.__O)}var d;for(r.setState({__a:r.__b=null});d=r.o.pop();)d.__P=o,d.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(a,a)},be.prototype.componentWillUnmount=function(){this.o=[]},be.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=Bi(this.__b,n,r.__O=r.__P)}this.__b=null}var s=t.__a&&z(I,null,e.fallback);return s&&(s.__u&=-33),[z(I,null,t.__a?null:e.children),s]};var Ps=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]>>1,1),t.h.removeChild(s)}}}Xe(z(rc,{context:t.context},e.__v),t.v)}function Wi(e,t){var n=z(sc,{__v:e,h:t});return n.containerInfo=t,n}(Ve.prototype=new ee).__a=function(e){var t=this,n=Hi(t.__v),r=t.l.get(e);return r[0]++,function(s){var i=function(){t.props.revealOrder?(r.push(s),Ps(t,e,r)):s()};n?n(i):i()}},Ve.prototype.render=function(e){this.i=null,this.l=new Map;var t=de(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},Ve.prototype.componentDidUpdate=Ve.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){Ps(e,n,t)})};var Vi=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,ic=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,oc=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,ac=/[A-Z0-9]/g,cc=typeof document<"u",lc=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};function Ki(e,t,n){return t.__k==null&&(t.textContent=""),Xe(e,t),typeof n=="function"&&n(),e?e.__c:null}function Qi(e,t,n){return xi(e,t),typeof n=="function"&&n(),e?e.__c:null}ee.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(ee.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Cs=E.event;E.event=function(e){return Cs&&(e=Cs(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var Ir,uc={configurable:!0,get:function(){return this.class}},Rs=E.vnode;E.vnode=function(e){typeof e.type=="string"&&(function(t){var n=t.props,r=t.type,s={},i=r.indexOf("-")==-1;for(var a in n){var o=n[a];if(!(a==="value"&&"defaultValue"in n&&o==null||cc&&a==="children"&&r==="noscript"||a==="class"||a==="className")){var l=a.toLowerCase();a==="defaultValue"&&"value"in n&&n.value==null?a="value":a==="download"&&o===!0?o="":l==="translate"&&o==="no"?o=!1:l[0]==="o"&&l[1]==="n"?l==="ondoubleclick"?a="ondblclick":l!=="onchange"||r!=="input"&&r!=="textarea"||lc(n.type)?l==="onfocus"?a="onfocusin":l==="onblur"?a="onfocusout":oc.test(a)&&(a=l):l=a="oninput":i&&ic.test(a)?a=a.replace(ac,"-$&").toLowerCase():o===null&&(o=void 0),l==="oninput"&&s[a=l]&&(a="oninputCapture"),s[a]=o}}r=="select"&&(s.multiple&&Array.isArray(s.value)&&(s.value=de(n.children).forEach(function(c){c.props.selected=s.value.indexOf(c.props.value)!=-1})),s.defaultValue!=null&&(s.value=de(n.children).forEach(function(c){c.props.selected=s.multiple?s.defaultValue.indexOf(c.props.value)!=-1:s.defaultValue==c.props.value}))),n.class&&!n.className?(s.class=n.class,Object.defineProperty(s,"className",uc)):n.className&&(s.class=s.className=n.className),t.props=s})(e),e.$$typeof=Vi,Rs&&Rs(e)};var ks=E.__r;E.__r=function(e){ks&&ks(e),Ir=e.__c};var xs=E.diffed;E.diffed=function(e){xs&&xs(e);var t=e.props,n=e.__e;n!=null&&e.type==="textarea"&&"value"in t&&t.value!==n.value&&(n.value=t.value==null?"":t.value),Ir=null};var zi={ReactCurrentDispatcher:{current:{readContext:function(e){return Ir.__n[e.__c].props.value},useCallback:W,useContext:te,useDebugValue:Rr,useDeferredValue:Tr,useEffect:j,useId:kr,useImperativeHandle:gn,useInsertionEffect:Or,useLayoutEffect:Ae,useMemo:B,useReducer:mn,useRef:q,useState:F,useSyncExternalStore:st,useTransition:Er}}},hc="18.3.1";function Gi(e){return z.bind(null,e)}function Ot(e){return!!e&&e.$$typeof===Vi}function Ji(e){return Ot(e)&&e.type===I}function Yi(e){return!!e&&typeof e.displayName=="string"&&e.displayName.indexOf("Memo(")==0}function Xi(e){return Ot(e)?Ca.apply(null,arguments):e}function Zi(e){return!!e.__k&&(Xe(null,e),!0)}function eo(e){return e&&(e.base||e.nodeType===1&&e)||null}var to=function(e,t){return e(t)},Mr=function(e,t){var n,r=E.debounceRendering;E.debounceRendering=function(i){n=i};try{var s=e(t);return n&&n(),s}finally{E.debounceRendering=r}},no=Ot,Lt={useState:F,useId:kr,useReducer:mn,useEffect:j,useLayoutEffect:Ae,useInsertionEffect:Or,useTransition:Er,useDeferredValue:Tr,useSyncExternalStore:st,startTransition:yn,useRef:q,useImperativeHandle:gn,useMemo:B,useCallback:W,useContext:te,useDebugValue:Rr,version:"18.3.1",Children:Ui,render:Ki,hydrate:Qi,unmountComponentAtNode:Zi,createPortal:Wi,createElement:z,createContext:ne,createFactory:Gi,cloneElement:Xi,createRef:vi,Fragment:I,isValidElement:Ot,isElement:no,isFragment:Ji,isMemo:Yi,findDOMNode:eo,Component:ee,PureComponent:an,memo:Et,forwardRef:Lr,flushSync:Mr,unstable_batchedUpdates:to,StrictMode:I,Suspense:be,SuspenseList:Ve,lazy:qi,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:zi};const dc=Object.freeze(Object.defineProperty({__proto__:null,Children:Ui,Component:ee,Fragment:I,PureComponent:an,StrictMode:I,Suspense:be,SuspenseList:Ve,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:zi,cloneElement:Xi,createContext:ne,createElement:z,createFactory:Gi,createPortal:Wi,createRef:vi,default:Lt,findDOMNode:eo,flushSync:Mr,forwardRef:Lr,hydrate:Qi,isElement:no,isFragment:Ji,isMemo:Yi,isValidElement:Ot,lazy:qi,memo:Et,render:Ki,startTransition:yn,unmountComponentAtNode:Zi,unstable_batchedUpdates:to,useCallback:W,useContext:te,useDebugValue:Rr,useDeferredValue:Tr,useEffect:j,useErrorBoundary:Xa,useId:kr,useImperativeHandle:gn,useInsertionEffect:Or,useLayoutEffect:Ae,useMemo:B,useReducer:mn,useRef:q,useState:F,useSyncExternalStore:st,useTransition:Er,version:hc},Symbol.toStringTag,{value:"Module"}));var ro=ne(void 0),so=e=>{const t=te(ro);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},fc=({client:e,children:t})=>(j(()=>(e.mount(),()=>{e.unmount()}),[e]),f(ro.Provider,{value:e,children:t})),io=ne(!1),pc=()=>te(io);io.Provider;function _c(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var mc=ne(_c()),gc=()=>te(mc),yc=(e,t,n)=>{const r=n?.state.error&&typeof e.throwOnError=="function"?Li(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},vc=e=>{j(()=>{e.clearReset()},[e])},bc=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||Li(n,[e.error,r])),wc=e=>{if(e.suspense){const n=s=>s==="static"?s:Math.max(s??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...s)=>n(r(...s)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Sc=(e,t)=>e.isLoading&&e.isFetching&&!t,Pc=(e,t)=>e?.suspense&&t.isPending,Ts=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Cc(e,t,n){const r=pc(),s=gc(),i=so(),a=i.defaultQueryOptions(e);i.getDefaultOptions().queries?._experimental_beforeQuery?.(a);const o=i.getQueryCache().get(a.queryHash),l=e.subscribed!==!1;a._optimisticResults=r?"isRestoring":l?"optimistic":void 0,wc(a),yc(a,s,o),vc(s);const c=!i.getQueryCache().get(a.queryHash),[d]=F(()=>new t(i,a)),u=d.getOptimisticResult(a),h=!r&&l;if(st(W(p=>{const m=h?d.subscribe(U.batchCalls(p)):V;return d.updateResult(),m},[d,h]),()=>d.getCurrentResult()),j(()=>{d.setOptions(a)},[a,d]),Pc(a,u))throw Ts(a,d,s);if(bc({result:u,errorResetBoundary:s,throwOnError:a.throwOnError,query:o,suspense:a.suspense}))throw u.error;return i.getDefaultOptions().queries?._experimental_afterQuery?.(a,u),a.experimental_prefetchInRender&&!yt.isServer()&&Sc(u,r)&&(c?Ts(a,d,s):o?.promise)?.catch(V).finally(()=>{d.updateResult()}),a.notifyOnChangeProps?u:d.trackResult(u)}function Es(e,t){return Cc(e,Wa)}const Rc=!1;var oo=Ae;function kc(e,t,n={},r){j(()=>{if(!e.current||r||typeof IntersectionObserver!="function")return;const s=new IntersectionObserver(([i])=>{t(i)},n);return s.observe(e.current),()=>{s.disconnect()}},[t,r,n,e])}function xc(e){const t=q(null);return gn(e,()=>t.current,[]),t}function vt(e){return e[e.length-1]}function Tc(e){return typeof e=="function"}function tt(e,t){return Tc(e)?e(t):e}const ao=Object.prototype.hasOwnProperty,Ec=Object.prototype.propertyIsEnumerable;function co(e){for(const t in e)if(ao.call(e,t))return!0;return!1}const Oc=()=>Object.create(null),ke=(e,t)=>Le(e,t,Oc);function Le(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;const s=t,i=Is(e)&&Is(s);if(!i&&!(cn(e)&&cn(s)))return s;const a=i?e:Os(e);if(!a)return s;const o=i?s:Os(s);if(!o)return s;const l=a.length,c=o.length,d=i?new Array(c):n();let u=0;for(let h=0;h"u")return!0;const n=t.prototype;return!(!Ls(n)||!n.hasOwnProperty("isPrototypeOf"))}function Ls(e){return Object.prototype.toString.call(e)==="[object Object]"}function Is(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function we(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,s=e.length;rs||!we(e[a],t[a],n)))return!1;return s===i}return!1}const Lc=/[\x00-\x1f\x7f"<>`{}]/g;function Ic(e){return e.replace(Lc,t=>"%"+t.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0"))}function Ms(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,n=>{try{return decodeURI(n)}catch{return n}})}return Ic(t)}const Mc=["http:","https:","mailto:","tel:"];function ln(e,t){if(!e)return!1;try{const n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function lt(e){if(!e)return{path:e,handledProtocolRelativeURL:!1};if(!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith("//"))return{path:e,handledProtocolRelativeURL:!1};const t=/%25|%5C/gi;let n=0,r="",s;for(;(s=t.exec(e))!==null;)r+=Ms(e.slice(n,s.index))+s[0],n=t.lastIndex;r=r+Ms(n?e.slice(n):e);let i=!1;return r.startsWith("//")&&(i=!0,r="/"+r.replace(/^\/+/,"")),{path:r,handledProtocolRelativeURL:i}}function $c(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Fc(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n{i.next&&(i.prev?(i.prev.next=i.next,i.next.prev=i.prev,i.next=void 0,r&&(r.next=i,i.prev=r)):(i.next.prev=void 0,n=i.next,i.next=void 0,r&&(i.prev=r,r.next=i)),r=i)};return{get(i){const a=t.get(i);if(a)return s(a),a.value},set(i,a){if(t.size>=e&&n){const l=n;t.delete(l.key),l.next&&(n=l.next,l.next.prev=void 0),l===r&&(r=void 0)}const o=t.get(i);if(o)o.value=a,s(o);else{const l={key:i,value:a,prev:r};r&&(r.next=l),r=l,n||(n=l),t.set(i,l)}},clear(){t.clear(),n=void 0,r=void 0}}}const ye=4,lo=5;function Dc(e){const t=e.indexOf("{");if(t===-1)return null;const n=e.indexOf("}",t);return n===-1||t+1>=e.length?null:[t,n]}function uo(e,t,n=new Uint16Array(6)){const r=e.indexOf("/",t),s=r===-1?e.length:r,i=e.substring(t,s);if(!i||!i.includes("$"))return n[0]=0,n[1]=t,n[2]=t,n[3]=s,n[4]=s,n[5]=s,n;if(i==="$"){const o=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=o,n[4]=o,n[5]=o,n}if(i.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=s,n[4]=s,n[5]=s,n;const a=Dc(i);if(a){const[o,l]=a,c=i.charCodeAt(o+1);if(c===45){if(o+2!x.parse&&x.caseSensitive===S&&x.prefix===b&&x.suffix===C);if(T)g=T;else{const x=Ac(P,c,S,b,C);g=x,x.parent=s,x.depth=i;let O;P===1?O=s.dynamic??=[]:P===3?O=s.optional??=[]:O=s.wildcard??=[],O.push(x),O.length===2&&a?.push(O)}break}}s=g}if(p&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf("/")+1)===95){const _=Qe(c);_.kind=lo,_.parent=s,i++,_.depth=i,s.pathless??=[],s.pathless.push(_),s=_}const m=(n.path||!n.children)&&!n.isRoot;if(m&&c.endsWith("/")){const _=Qe(c);_.kind=ye,_.parent=s,i++,_.depth=i,s.index=_,s=_}s.parse=p??null,s.priority=d?.params?.priority??0,m&&!s.route&&(s.route=n,s.fullPath=c)}if(n.children)for(const c of n.children)vn(e,t,c,l,s,i,a,o)}function ho(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function Qe(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,priority:0}}function Ac(e,t,n,r,s){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:s}}function Nc(e,t){const n=Qe("/"),r=new Uint16Array(6),s=[];for(const i of e)vn(!1,r,i,1,n,0,s);for(const i of s)i.sort(ho);t.masksTree=n,t.flatCache=un(1e3)}function Uc(e,t){e||="/";const n=t.flatCache.get(e);if(n)return n;const r=Fr(e,t.masksTree);return t.flatCache.set(e,r),r}function Bc(e,t,n,r,s){e||="/",r||="/";const i=t?`case\0${e}`:e;let a=s.singleCache.get(i);return a||(a=Qe("/"),vn(t,new Uint16Array(6),{from:e},1,a,0),s.singleCache.set(i,a)),Fr(r,a,n)}function jc(e,t,n=!1){const r=n?e:`nofuzz\0${e}`,s=t.matchCache.get(r);if(s!==void 0)return s;e||="/";let i;try{i=Fr(e,t.segmentTree,n)}catch(a){if(a instanceof URIError)i=null;else throw a}return i&&(i.branch=po(i.route)),t.matchCache.set(r,i),i}function Hc(e){return e==="/"?e:e.replace(/\/{1,}$/,"")}function qc(e,t=!1,n){const r=Qe(e.fullPath),s=new Uint16Array(6),i=[],a={},o={};let l=0;vn(t,s,e,1,r,0,i,c=>{if(n?.(c,l),c.id in a&&$r(),a[c.id]=c,l!==0&&c.path){const d=Hc(c.fullPath);(!o[d]||c.fullPath.endsWith("/"))&&(o[d]=c)}l++});for(const c of i)c.sort(ho);return{processedTree:{segmentTree:r,singleCache:un(1e3),matchCache:un(1e3),flatCache:null,masksTree:null},routesById:a,routesByPath:o}}function Fr(e,t,n=!1){const r=e.split("/"),s=Vc(e,r,t,n);if(!s)return null;const[i]=fo(e,r,s);return{route:s.node.route,rawParams:i}}function fo(e,t,n){const r=Wc(n.node);let s=null;const i=Object.create(null);let a=n.extract?.part??0,o=n.extract?.node??0,l=n.extract?.path??0,c=n.extract?.segment??0;for(;o=0;S--){const b=u.wildcard[S],{prefix:C,suffix:k}=b;if(!(C&&(P||!(b.caseSensitive?w:R??=w.toLowerCase()).startsWith(C)))){if(k){if(P)continue;const T=t.slice(h).join("/").slice(-k.length);if((b.caseSensitive?T:T.toLowerCase())!==k)continue}o.push({node:b,index:a,skipped:p,statics:m,dynamics:_,optionals:g,extract:y,rawParams:v})}}if(u.optional){const S=p|1<=0;b--){const C=u.optional[b];o.push({node:C,index:h,skipped:S,statics:m,dynamics:_,optionals:g,extract:y,rawParams:v})}if(!P)for(let b=u.optional.length-1;b>=0;b--){const C=u.optional[b],{prefix:k,suffix:T}=C;if(k||T){const x=C.caseSensitive?w:R??=w.toLowerCase();if(k&&!x.startsWith(k)||T&&!x.endsWith(T))continue}o.push({node:C,index:h+1,skipped:p,statics:m,dynamics:_,optionals:g+Bt(a,h),extract:y,rawParams:v})}}if(!P&&u.dynamic&&w)for(let S=u.dynamic.length-1;S>=0;S--){const b=u.dynamic[S],{prefix:C,suffix:k}=b;if(C||k){const T=b.caseSensitive?w:R??=w.toLowerCase();if(C&&!T.startsWith(C)||k&&!T.endsWith(k))continue}o.push({node:b,index:h+1,skipped:p,statics:m,dynamics:_+Bt(a,h),optionals:g,extract:y,rawParams:v})}if(!P&&u.staticInsensitive){const S=u.staticInsensitive.get(R??=w.toLowerCase());S&&o.push({node:S,index:h+1,skipped:p,statics:m+Bt(a,h),dynamics:_,optionals:g,extract:y,rawParams:v})}if(!P&&u.static){const S=u.static.get(w);S&&o.push({node:S,index:h+1,skipped:p,statics:m+Bt(a,h),dynamics:_,optionals:g,extract:y,rawParams:v})}if(u.pathless)for(let S=u.pathless.length-1;S>=0;S--){const b=u.pathless[S];o.push({node:b,index:h,skipped:p,statics:m,dynamics:_,optionals:g,extract:y,rawParams:v})}}if(c)return c;if(r&&l){let d=l.index;for(let h=0;he.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===ye)>(e.node.kind===ye)||t.node.kind===ye==(e.node.kind===ye)&&t.node.depth>e.node.depth))):!0}function Gt(e){return Dr(e.filter(t=>t!==void 0).join("/"))}function Dr(e){return e.replace(/\/{2,}/g,"/")}function _o(e){return e==="/"?e:e.replace(/^\/{1,}/,"")}function ue(e){const t=e.length;return t>1&&e[t-1]==="/"?e.replace(/\/{1,}$/,""):e}function mo(e){return ue(_o(e))}function hn(e,t){return e?.endsWith("/")&&e!=="/"&&e!==`${t}/`?e.slice(0,-1):e}function Qc(e,t,n){return hn(e,n)===hn(t,n)}function zc({base:e,to:t,trailingSlash:n="never",cache:r}){const s=t===".",i=t.startsWith("/");let a;if(r){a=i?t:s?e:e+"\0"+t;const c=r.get(a);if(c)return c}let o;if(s)o=e.split("/");else if(i)o=t.split("/");else{for(o=e.split("/");o.length>1&&vt(o)==="";)o.pop();const c=t.split("/");for(let d=0,u=c.length;d1?o.pop():o=[""]:h==="."||o.push(h)}}o.length>1&&(vt(o)===""?n==="never"&&o.pop():n==="always"&&o.push(""));const l=Dr(o.join("/"))||"/";return a&&r&&r.set(a,l),l}function Gc(e){const t=new Map(e.map(s=>[encodeURIComponent(s),s])),n=Array.from(t.keys()).map(s=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),r=new RegExp(n,"g");return s=>s.replace(r,i=>t.get(i)??i)}function In(e,t,n){const r=t[e];return typeof r!="string"?r:e==="_splat"?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split("/").map(s=>Ds(s,n)).join("/"):Ds(r,n)}function Fs({path:e,params:t,decoder:n,...r}){let s=!1;const i=Object.create(null);if(!e||e==="/")return{interpolatedPath:"/",usedParams:i,isMissingParams:s};if(!e.includes("$"))return{interpolatedPath:e,usedParams:i,isMissingParams:s};const a=e.length;let o=0,l,c="";for(;oe.state.__TSR_key||e.href;function tl(e){const t=e.getAttribute(As);if(t)return`[${As}="${t}"]`;let n="",r=e,s;for(;s=r.parentNode;){let i=1,a=r;for(;a=a.previousElementSibling;)i++;const o=`${r.localName}:nth-child(${i})`;n=n?`${o} > ${n}`:o,r=s}return n}let Ht=!1;const Jt="window";function er(e){try{return typeof e=="function"?e():document.querySelector(e)}catch{}}function Ns(e){const t=new Set;for(const n of e){if(n===Jt)continue;const r=er(n);r&&t.add(r)}return t}function nl(e,t){const n=e.options.scrollRestoration,r=e._scroll;n&&(r.restoring=!0);const s=e.options.getScrollRestorationKey||el,i=new Set,a=o=>{const l=qe[o]||={};for(const c of i)c===document?l[Jt]={scrollX,scrollY}:c.isConnected&&(l[tl(c)]={scrollX:c.scrollLeft,scrollY:c.scrollTop})};n&&!r.restoration&&(r.restoration=!0,Ht=!1,history.scrollRestoration="manual",document.addEventListener("scroll",o=>{Ht||i.add(o.target)},!0),e.subscribe("onBeforeLoad",o=>{o.fromLocation&&a(s(o.fromLocation)),i.clear()}),addEventListener("pagehide",()=>{a(s(e.stores.resolvedLocation.get()??e.stores.location.get())),Zc()})),!r.reset&&(r.reset=!0,e.subscribe("onRendered",o=>{const l=e.options.scrollRestorationBehavior,c=e.options.scrollToTopSelectors,d=r.next,u=r.hash;let h;if(i.clear(),r.next=!0,r.hash=!1,typeof e.options.scrollRestoration=="function"&&!e.options.scrollRestoration({location:e.latestLocation}))return;const p=s(o.toLocation),m=o.fromLocation&&s(o.fromLocation);if(r.restoring&&m&&m!==p){const _=qe[m];if(_){let g=qe[p];for(const y in _){if(y===Jt){if(d)continue}else{const v=er(y);if(!v||d&&c&&(h??=Ns(c),h.has(v)))continue}g||(g=qe[p]={}),g[y]??=_[y]}}}Ht=!0;try{const _=o.toLocation.hash,g=o.toLocation.state.__hashScrollIntoViewOptions??!0;let y=!1;if(d){!_&&c&&(h??=Ns(c));const v=_&&g&&u,P=r.restoring?qe[p]:void 0;if(P)for(const w in P){const{scrollX:R,scrollY:S}=P[w];if(w===Jt){if(v)continue;scrollTo({top:S,left:R,behavior:l}),y=!0}else{const b=er(w);b&&(b.scrollLeft=R,b.scrollTop=S,h?.delete(b))}}if(!_){const w={top:0,left:0,behavior:l};if(y||scrollTo(w),h)for(const R of h)R.scrollTo(w)}}!y&&_&&g&&document.getElementById(_)?.scrollIntoView(g)}finally{Ht=!1}}))}function rl(e,t=String){const n=new URLSearchParams;for(const r in e){const s=e[r];s!==void 0&&n.set(r,t(s))}return n.toString()}function Mn(e){return e?e==="false"?!1:e==="true"?!0:+e*0===0&&+e+""===e?+e:e:""}function sl(e){const t=new URLSearchParams(e),n=Object.create(null);for(const[r,s]of t.entries()){const i=n[r];i==null?n[r]=Mn(s):Array.isArray(i)?i.push(Mn(s)):n[r]=[i,Mn(s)]}return n}const il=/^(?:\s|["[{\d-]|fa|nu|tr)/,ol=cl(JSON.parse),al=ll(JSON.stringify,JSON.parse);function cl(e){return t=>{t[0]==="?"&&(t=t.substring(1));const n=sl(t);for(const r in n){const s=n[r];if(typeof s=="string")try{n[r]=e(s)}catch{}}return n}}function ll(e,t){const n=t===JSON.parse;function r(s){if(s&&typeof s=="object")try{return e(s)}catch{}else if(t&&typeof s=="string"){if(n&&!il.test(s))return s;try{return t(s),e(s)}catch{}}return s}return s=>{const i=rl(s,r);return i?`?${i}`:""}}const ze="__root__";function ul(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&!e.reloadDocument&&typeof e.href=="string")try{new URL(e.href),e.reloadDocument=!0}catch{}const t=new Headers(e.headers);e.href&&t.get("Location")===null&&t.set("Location",e.href);const n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function Ar(e){return e instanceof Response&&!!e.options}function hl(e){return{input:({url:t})=>{for(const n of e)t=tr(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=yo(e[n],t);return t}}}function dl(e){const t=mo(e.basepath),n=`/${t}`,r=e.caseSensitive?n:n.toLowerCase(),s=`${r}/`;return{input:({url:i})=>{const a=e.caseSensitive?i.pathname:i.pathname.toLowerCase();return a===r?i.pathname="/":a.startsWith(s)&&(i.pathname=i.pathname.slice(n.length)),i},output:({url:i})=>(i.pathname=Gt(["/",t,i.pathname]),i)}}function tr(e,t){const n=e?.input?.({url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function yo(e,t){const n=e?.output?.({url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function fl(e,t){const{createMutableStore:n,createReadonlyStore:r,batch:s}=t,i=new Map,a=n("idle"),o=n(e),l=n(void 0),c=n([]),d=r(()=>c.get().map(_=>i.get(_).get())),u=r(()=>({status:a.get(),isLoading:a.get()==="pending",matches:d.get(),location:o.get(),resolvedLocation:l.get()}));function h(_){let g=i.get(_);return g||(g=n(void 0),i.set(_,g)),g}const p={status:a,location:o,resolvedLocation:l,ids:c,matches:d,byRoute:i,__store:u,getMatchStore:h,setMatches:m};function m(_){const g=c.get(),y=_.map(v=>v.routeId);s(()=>{Fc(g,y)||c.set(y);for(const v of g)y.includes(v)||i.get(v).set(()=>{});for(const v of _){const P=h(v.routeId);P.get()!==v&&P.set(v)}})}return p}var Se="__TSR_index",Us="popstate",Bs="beforeunload";function pl(e){let t=e.getLocation();const n=new Set,r=a=>{t=e.getLocation(),n.forEach(o=>o({location:t,action:a}))},s=a=>{e.notifyOnIndexChange??!0?r(a):t=e.getLocation()},i=async({task:a,navigateOpts:o,...l})=>{if(o?.ignoreBlocker??!1){a();return}const c=e.getBlockers?.()??[],d=l.type==="PUSH"||l.type==="REPLACE";if(typeof document<"u"&&c.length&&d)for(const u of c){const h=bt(l.path,l.state);if(await u.blockerFn({currentLocation:t,nextLocation:h,action:l.type})){e.onBlocked?.();return}}a()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:a=>(n.add(a),()=>{n.delete(a)}),push:(a,o,l)=>{const c=t.state[Se];o=js(c+1,o),i({task:()=>{e.pushState(a,o),r({type:"PUSH"})},navigateOpts:l,type:"PUSH",path:a,state:o})},replace:(a,o,l)=>{const c=t.state[Se];o=js(c,o),i({task:()=>{e.replaceState(a,o),r({type:"REPLACE"})},navigateOpts:l,type:"REPLACE",path:a,state:o})},go:(a,o)=>{i({task:()=>{e.go(a),s({type:"GO",index:a})},navigateOpts:o,type:"GO"})},back:a=>{i({task:()=>{e.back(a?.ignoreBlocker??!1),s({type:"BACK"})},navigateOpts:a,type:"BACK"})},forward:a=>{i({task:()=>{e.forward(a?.ignoreBlocker??!1),s({type:"FORWARD"})},navigateOpts:a,type:"FORWARD"})},canGoBack:()=>t.state[Se]!==0,createHref:a=>e.createHref(a),block:a=>{if(!e.setBlockers)return()=>{};const o=e.getBlockers?.()??[];return e.setBlockers([...o,a]),()=>{const l=e.getBlockers?.()??[];e.setBlockers?.(l.filter(c=>c!==a))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}function js(e,t){t||(t={});const n=Nr();return{...t,key:n,__TSR_key:n,[Se]:e}}function vo(e){const t=e?.window??(typeof document<"u"?window:void 0),n=t.history.pushState,r=t.history.replaceState;let s=[];const i=()=>s,a=b=>s=b,o=e?.createHref??(b=>b),l=e?.parseLocation??(()=>bt(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){const b=Nr();t.history.replaceState({[Se]:0,key:b,__TSR_key:b},"")}let c=l(),d,u=!1,h=!1,p=!1,m=!1;const _=()=>c;let g;const y=()=>{g&&(S._ignoreSubscribers=!0,(g[2]?t.history.pushState:t.history.replaceState)(g[1],"",g[0]),S._ignoreSubscribers=!1,g=void 0,d=void 0)},v=(b,C,k)=>{const T=o(C),x=!!g;x||(d=c),c=bt(C,k),g=[T,k,g?.[2]||b],x||queueMicrotask(()=>y())},P=b=>{c=l(),S.notify({type:b})},w=async()=>{if(h){h=!1;return}const b=l(),C=b.state[Se]-c.state[Se],k=C===1,T=C===-1,x=!k&&!T||u;u=!1;const O=x?"GO":T?"BACK":"FORWARD",$=x?{type:"GO",index:C}:{type:T?"BACK":"FORWARD"};if(p)p=!1;else{const at=i();if(typeof document<"u"&&at.length){for(const se of at)if(await se.blockerFn({currentLocation:c,nextLocation:b,action:O})){h=!0,t.history.go(1),S.notify($);return}}}c=l(),S.notify($)},R=b=>{if(m){m=!1;return}let C=!1;const k=i();if(typeof document<"u"&&k.length)for(const T of k){const x=T.enableBeforeUnload??!0;if(x===!0){C=!0;break}if(typeof x=="function"&&x()===!0){C=!0;break}}if(C)return b.preventDefault(),b.returnValue=""},S=pl({getLocation:_,getLength:()=>t.history.length,pushState:(b,C)=>v(!0,b,C),replaceState:(b,C)=>v(!1,b,C),back:b=>(b&&(p=!0),m=!0,t.history.back()),forward:b=>{b&&(p=!0),m=!0,t.history.forward()},go:b=>{u=!0,t.history.go(b)},createHref:b=>o(b),flush:y,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(Bs,R,{capture:!0}),t.removeEventListener(Us,w)},onBlocked:()=>{d&&c!==d&&(c=d)},getBlockers:i,setBlockers:a,notifyOnIndexChange:!1});return t.addEventListener(Bs,R,{capture:!0}),t.addEventListener(Us,w),t.history.pushState=function(...b){const C=n.apply(t.history,b);return S._ignoreSubscribers||P("PUSH"),C},t.history.replaceState=function(...b){const C=r.apply(t.history,b);return S._ignoreSubscribers||P("REPLACE"),C},S}function _l(e){const t=typeof document<"u"?window:void 0;return vo({window:t,parseLocation:()=>{const n=t.location.hash.split("#").slice(1),r=n[0]??"/",s=t.location.search,i=n.slice(1);return bt(`${r}${s}${i.length===0?"":`#${i.join("#")}`}`,t.history.state)},createHref:n=>`${t.location.pathname}${t.location.search}#${n}`})}function ml(e){let t=e.replace(/[\x00-\x1f\x7f]/g,"");return t.startsWith("//")&&(t="/"+t.replace(/^\/+/,"")),t}function bt(e,t){const n=ml(e),r=n.indexOf("#"),s=n.indexOf("?"),i=Nr();return{href:n,pathname:n.substring(0,r>0?s>0?Math.min(r,s):r:s>0?s:n.length),hash:r>-1?n.substring(r):"",search:s>-1?n.slice(s,r===-1?void 0:r):"",state:t||{[Se]:0,key:i,__TSR_key:i}}}function Nr(){return(Math.random()+1).toString(36).substring(7)}function Hs(e){return e.options.loader||e.options.beforeLoad||e.lazyFn||e.options.component?.preload||e.options.pendingComponent?.preload}function bn(e,t){return{fromLocation:t,toLocation:e,pathChanged:t?.pathname!==e.pathname,hrefChanged:t?.href!==e.href,hashChanged:t?.hash!==e.hash}}function qs({key:e,__TSR_key:t,__TSR_index:n,__hashScrollIntoViewOptions:r,...s}){return s}function gl(e,t,n,r){for(const s of t){if(r?.()===!1)return;n.some(i=>i.routeId===s.routeId)||e.routesById[s.routeId].options.onLeave?.(s)}for(const s of n){if(r?.()===!1)return;e.routesById[s.routeId].options[t.some(i=>i.routeId===s.routeId)?"onStay":"onEnter"]?.(s)}}var yl=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={next:!0},this.subscribers=new Set,this._cache=new Map,this._committed=[],this.routeBranchCache=new WeakMap,this.lightweightCache=new WeakMap,this.startTransition=async n=>(n(),!1),this.update=n=>{const r=this.options,s=this.basepath??r?.basepath??"/",i=this.basepath===void 0,a=r?.rewrite;if(this.options={...r,...n},this.isServer=this.options.isServer??Rc??typeof document>"u",this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=Gc(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=vo()),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 c;this.resolvePathCache=un(1e3),c=this.buildRouteTree(),this.setRoutes(c)}if(!this.stores&&this.latestLocation){const c=this.getStoreConfig(this);this.batch=c.batch,this.stores=fl(this.latestLocation,c),nl(this)}const o=this.options.basepath??"/",l=this.options.rewrite;if(i||s!==o||a!==l){this.basepath=o;const c=[],d=mo(o);d&&d!=="/"&&c.push(dl({basepath:o})),l&&c.push(l),this.rewrite=c.length===0?void 0:c.length===1?c[0]:hl(c),this.history&&this.updateLatestLocation(),this.stores&&this.stores.location.set(this.latestLocation)}},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{const n=qc(this.routeTree,this.options.caseSensitive,(r,s)=>{r.init({originalIndex:s})});return this.options.routeMasks&&Nc(this.options.routeMasks,n.processedTree),n},this.subscribe=(n,r)=>{const s={eventType:n,fn:r};return this.subscribers.add(s),()=>{this.subscribers.delete(s)}},this.emit=n=>{for(const r of this.subscribers)if(r.eventType===n.type)try{r.fn(n)}catch(s){console.error(s)}},this.parseLocation=(n,r)=>{const s=({pathname:l,search:c,hash:d,href:u,state:h})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(l)){const y=this.options.parseSearch(c),v=this.options.stringifySearch(y);return{href:l+v+d,publicHref:l+v+d,pathname:lt(l).path,external:!1,searchStr:v,search:ke(r?.search,y),hash:lt(d.slice(1)).path,state:Le(r?.state,h)}}const p=new URL(u,this.origin),m=tr(this.rewrite,p),_=this.options.parseSearch(m.search),g=this.options.stringifySearch(_);return m.search=g,{href:m.href.replace(m.origin,""),publicHref:u,pathname:lt(m.pathname).path,external:!!this.rewrite&&m.origin!==this.origin,searchStr:g,search:ke(r?.search,_),hash:lt(m.hash.slice(1)).path,state:Le(r?.state,h)}},i=s(n),{__tempLocation:a,__tempKey:o}=i.state;if(a&&(!o||o===this.tempLocationKey)){const l=s(a);return l.state.key=i.state.key,l.state.__TSR_key=i.state.__TSR_key,delete l.state.__tempLocation,{...l,maskedLocation:i}}return i},this.resolvePathWithBase=(n,r)=>zc({base:n,to:r.includes("//")?Dr(r):r,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(n,r,s)=>typeof n=="string"?this.matchRoutesInternal({pathname:n,search:r},s):this.matchRoutesInternal(n,r),this.getMatchedRoutes=n=>{const r=Object.create(null),s=jc(ue(n),this.processedTree,!0);return s&&Object.assign(r,s.rawParams),[s?.branch||[this.routesById.__root__],r,s?.route]},this.buildLocation=n=>{const r=(i={})=>{const a=i._fromLocation||this._pendingLocation||this.latestLocation,o=this.matchRoutesLightweight(a);i.from;const l=i.unsafeRelative==="path"?a.pathname:i.from??o[1],c=i.to?`${i.to}`:void 0,d=o[2],u=Object.assign(Object.create(null),o[3]),h=c?.charCodeAt(0)===47?"/":this.resolvePathWithBase(l,"."),p=c?this.resolvePathWithBase(h,c):h,m=Ws(i.params,u),_=this.routesByPath[ue(p)];let g;if(_)g=this.getRouteBranch(_);else if(p.includes("$"))g=[];else{const[x,O,$]=this.getMatchedRoutes(p);g=x,this.options.notFoundRoute&&(!$||$.path!=="/"&&O["**"])&&(g=[...g,this.options.notFoundRoute])}if(g.length&&co(m))for(const x of g){const O=x.options.params?.stringify??x.options.stringifyParams;if(O)try{Object.assign(m,O(m))}catch{}}const y=n.leaveParams?p:lt(Fs({path:p,params:m,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path;let v=d;if(n._includeValidateSearch&&this.options.search?.strict){const x={};g.forEach(O=>{if(O.options.validateSearch)try{Object.assign(x,Yt(O.options.validateSearch,{...x,...v}))}catch{}}),v=x}v=bl(v,i,g,n._includeValidateSearch),v=ke(d,v);const P=this.options.stringifySearch(v),w=i.hash===!0?a.hash:i.hash?tt(i.hash,a.hash):void 0,R=w?`#${w}`:"";let S=i.state===!0?a.state:i.state?tt(i.state,a.state):{};S=Le(a.state,S);const b=`${y}${P}${R}`;let C,k,T=!1;if(this.rewrite){const x=new URL(b,this.origin),O=yo(this.rewrite,x);C=x.href.replace(x.origin,""),O.origin!==this.origin?(k=O.href,T=!0):k=O.pathname+O.search+O.hash}else C=$c(b),k=C;return{publicHref:k,href:C,pathname:y,search:v,searchStr:P,state:S,hash:w??"",external:T,unmaskOnReload:i.unmaskOnReload}},s=(i={},a)=>{const o=r(i);let l=a?r(a):void 0;if(!l){const c=Object.create(null);if(this.options.routeMasks){const d=Uc(o.pathname,this.processedTree);if(d){Object.assign(c,d.rawParams);const{from:u,params:h,...p}=d.route,m=Ws(h,c);a={from:n.from,...p,params:m},l=r(a)}}}return l&&(o.maskedLocation=l),o};return n.mask?s(n,{from:n.from,...n.mask}):s(n)},this.commitLocation=async({viewTransition:n,ignoreBlocker:r,...s})=>{let i;const a=ue(this.latestLocation.href)===ue(s.href)&&we(qs(s.state),qs(this.latestLocation.state)),o=this._commitPromise;let l;const c=new Promise(d=>{l=d});if(c.resolve=()=>{l(),o?.resolve()},this._commitPromise=c,a)this.load();else{let{maskedLocation:d,hashScrollIntoView:u,...h}=s;d&&(h={...d,state:{...d.state,__tempKey:void 0,__tempLocation:{...h,search:h.searchStr,state:{...h.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(h.unmaskOnReload??this.options.unmaskOnReload??!1)&&(h.state.__tempKey=this.tempLocationKey)),h.state.__hashScrollIntoViewOptions=u??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=n,i=s.replace?"REPLACE":"PUSH",this.history[i==="REPLACE"?"replace":"push"](h.publicHref,h.state,{ignoreBlocker:r}),this.history.subscribers.size||this.load({action:{type:i}})}return this._scroll.next=s.resetScroll??!0,this._commitPromise},this.buildAndCommitLocation=({replace:n,resetScroll:r,hashScrollIntoView:s,viewTransition:i,ignoreBlocker:a,_redirects:o,href:l,...c}={})=>{if(l){const h=this.history.location.state.__TSR_index,p=bt(l,{__TSR_index:n?h:h+1}),m=new URL(p.pathname,this.origin);c.to=tr(this.rewrite,m).pathname,c.search=this.options.parseSearch(p.search),c.hash=p.hash.slice(1)}const d=this.buildLocation({...c,_includeValidateSearch:!0});o&&(d._redirects=o),this._pendingLocation=d;const u=this.commitLocation({...d,viewTransition:i,replace:n,resetScroll:r,hashScrollIntoView:s,ignoreBlocker:a});return queueMicrotask(()=>{this._pendingLocation===d&&(this._pendingLocation=void 0)}),u},this.navigate=async({to:n,reloadDocument:r,href:s,publicHref:i,...a})=>{let o=!1;if(s)try{new URL(`${s}`),o=!0}catch{}if(o&&!r&&(r=!0),r){if(n!==void 0||!s){const c=this.buildLocation({to:n,...a});s=s??c.publicHref,i=i??c.publicHref}const l=!o&&i?i:s;if(ln(l,this.protocolAllowlist))return;if(!a.ignoreBlocker){const c=this.history.getBlockers?.()??[];for(const d of c)if(d?.blockerFn&&await d.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:"PUSH"}))return}a.replace?window.location.replace(l):window.location.href=l;return}return this.buildAndCommitLocation({...a,href:s,to:n,_isNavigate:!0})},this.load=async n=>{this.updateLatestLocation(),n?.action&&(this._scroll.hash=n.action.type==="PUSH"||n.action.type==="REPLACE"),await El(this,n)},this.startViewTransition=n=>{const r=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,r&&typeof document.startViewTransition=="function"){let s;if(typeof r=="object"&&window.CSS?.supports?.("selector(:active-view-transition-type(a))")){const i=this.latestLocation,a=this.stores.resolvedLocation.get(),o=typeof r.types=="function"?r.types(bn(i,a)):r.types;if(o===!1)return n();s={update:n,types:o}}else s=n;return document.startViewTransition(s).updateCallbackDone}return n()},this.invalidate=n=>{const r=this._committed,s=n?.filter,i=this._preloads,a=new Set([...r,...this._cache.values(),...[...i?.values()??[]].flat(),...this._tx?.[3]??[]].filter(c=>!s||s(c)).map(c=>c.id)),o=[];for(const[c,d]of i??[])d.some(u=>a.has(u.id))&&(i.delete(c),o.push(c));const l=c=>{if(a.has(c.id)){const d=this.routesById[c.routeId],u={...c,invalid:!0,...(n?.forcePending||c.status==="error"||c.status==="notFound")&&Hs(d)?{status:"pending",error:void 0}:void 0};return c._flight=void 0,u}return c};this._committed=r.map(l);for(const[c,d]of this._cache)a.has(c)&&(d.invalid=!0,n?.forcePending&&(d.status="pending"));for(const c of a)this._flights?.delete(c);for(const c of o)c.abort();return this.shouldViewTransition=!1,this.load({sync:n?.sync})},this.resolveRedirect=n=>{const r=n.headers.get("Location");if(!n.options.href||n.options._builtLocation){const s=(n.options._builtLocation??this.buildLocation(n.options)).publicHref||"/";n.options.href=s,n.headers.set("Location",s)}else if(r)try{const s=new URL(r);if(this.origin&&s.origin===this.origin){const i=s.pathname+s.search+s.hash;n.options.href=i,n.headers.set("Location",i)}}catch{}if(n.options.href&&!n.options._builtLocation&&ln(n.options.href,this.protocolAllowlist))throw new Error("Redirect blocked: unsafe protocol");return n.headers.get("Location")||n.headers.set("Location",n.options.href),n},this.clearCache=n=>{const r=this._cache,s=this._preloads,i=n?.filter,a=[],o=[];for(const[c,d]of r)(!i||i(d))&&(o.push(c),a.push(d));const l=[];for(const[c,d]of s??[])(!i||d.some(i))&&(l.push(c),a.push(...d));for(const c of o)r.delete(c);for(const c of l)s.delete(c);for(const c of a){const d=c._flight;c._flight=void 0,d&&!--d[2]&&(this._flights?.get(c.id)===d&&this._flights.delete(c.id),l.push(d[1]))}for(const c of l)c.abort()},this.loadRouteChunk=Ge,this.preloadRoute=n=>Oo(this,n),this.matchRoute=(n,r)=>{const s={...n,to:n.to?this.resolvePathWithBase(n.from||"",n.to):void 0,params:n.params||{},leaveParams:!0},i=this.buildLocation(s),a=this.stores.status.get()==="pending";if(r?.pending&&!a)return!1;const o=r?.pending??!a?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),l=Bc(i.pathname,r?.caseSensitive??!1,r?.fuzzy??!1,o.pathname,this.processedTree);return!l||n.params&&!we(l.rawParams,n.params,{partial:!0})?!1:r?.includeSearch??!0?we(o.search,i.search,{partial:!0})?l.rawParams:!1:l.rawParams},this.getStoreConfig=t,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??"fuzzy",stringifySearch:e.stringifySearch??al,parseSearch:e.parseSearch??ol,protocolAllowlist:e.protocolAllowlist??Mc}),self.__TSR_ROUTER__=this}isShell(){return!!this.options.isShell}get state(){return this.stores.__store.get()}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;const r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}getRouteBranch(e){let t=this.routeBranchCache.get(e);return t||(t=po(e),this.routeBranchCache.set(e,t)),t}matchRoutesInternal(e,t){const[n,r,s]=this.getMatchedRoutes(e.pathname);let i=n,a=!1;(s?s.path!=="/"&&r["**"]:ue(e.pathname))&&(this.options.notFoundRoute?i=[...i,this.options.notFoundRoute]:a=!0);const o=a?wl(this.options.notFoundMode,i):void 0,l=new Array(i.length),c=this._committed,d=(h,p)=>{const m=c[p];return m?.routeId===h.id?m:h===this.options.notFoundRoute?c.find(_=>_.routeId===h.id):void 0};let u;for(let h=0;h{const h=u(o.preSearchFilters?o.preSearchFilters.reduce((p,m)=>m(p),d):d);return o.postSearchFilters?o.postSearchFilters.reduce((p,m)=>m(p),h):h};s.push(c)}const l=o.validateSearch;if(l){const c=({search:d,next:u,meta:h})=>{const p=u(d);if(r)try{const m=Yt(l,p);if(h&&m)for(const _ in m)_ in p||(h.defaulted||=new Map).set(_,m[_]);return{...p,...m}}catch{}return p};s.push(c)}}const i=(a,o,l)=>{if(a>=s.length){if(!t.search)return{};if(t.search===!0)return o;const d=tt(t.search,o);return l&&(l.explicit=d),d}const c=(d,u)=>{if(u){const h=l||{};return{search:i(a+1,d,h),meta:h}}return i(a+1,d,l)};return s[a]({search:o,next:c,meta:l})};return i(0,e)}function wl(e,t){if(e!=="root"){let n;for(let r=t.length-1;r>=0;r--){const s=t[r];if(s.options.notFoundComponent)return s.id;n||=s.children&&s.id}if(n)return n}return ze}function Ws(e,t){return e===!1||e===null?Object.create(null):(e??!0)===!0?t:Object.assign(t,tt(e,t))}function Vs(e,t){const n=e.options.params?.parse??e.options.parseParams;n&&Object.assign(t,n(t))}function nr(e,t){return e.options[t]?.preload?.()}function Sl(e,t){const n=nr(e,"component"),r=nr(e,"pendingComponent"),s=t&&r?r.then(t):r;return t&&!r&&t(),n&&s?Promise.all([n,s]).then(()=>{}):n??s}function Ge(e,t,n){const r=()=>t===!1?void 0:t?nr(e,t):Sl(e,n),s=e._lazy;if(s)return s===!0?r():s.then(r);if(!e.lazyFn)return r();const i=e.lazyFn().then(a=>{{const{id:o,...l}=a.options;Object.assign(e.options,l),e._lazy=!0}},a=>{throw e._lazy=void 0,a});return e._lazy=i,i.then(r)}function bo(e){const t=e.findIndex(n=>n.status!=="success"||n._notFound)+1;return t&&t{const s=()=>r(t);t.addEventListener("abort",s,{once:!0}),Promise.resolve(e).then(n,r).finally(()=>t.removeEventListener("abort",s))})}function Ne(e,t){return e.routesById[t.routeId]}function St(e,t,n){return Ar(e)?[Z,e]:Me(e)?(e.routeId||=n,[wn,e]):(t&&typeof e?.then=="function"&&(e=new Error("A Promise was thrown",{cause:e})),t?[Pe,e]:[ce,e])}function wo(e,t){let n=St(t,!0,e.id);if(n[0]!==Pe)return n;try{e.options.onError?.(n[1])}catch(r){n=St(r,!0,e.id)}return n}function _t(e,t,n){return n[0].signal.aborted||!n[2]()?(n[0].abort(),[$e]):wo(e,t)}function So(e,t){return n=>e.navigate({...n,_fromLocation:t})}async function Pl(e,t,n,r,s,i){const[a,o]=t,l=n[0].signal,c=!!n[4];for(let d=n[7]??0;d=i&&(u.status="pending"),n[8]?.();try{Pt(e,u,"beforeLoad",n[0]);const w=await Ce(y(v),l);if(!n[2]())return n[0].abort(),[d,[$e]];const R=St(w,!1,h.id);if(R[0]!==ce)return he(e,u),[d,R];u.context={..._,...w}}catch(w){return he(e,u),[d,_t(h,w,n)]}finally{P==="success"&&u.status==="pending"&&(u.status="success"),Pt(e,u,!1,n[0])}}s()}function Ur(e,t,n){if(!(!n||--n[2])){if(e._flights?.get(t.id)===n){const r=e._tx;if(r&&!r[0].signal.aborted&&!r[3].includes(t)&&r[3].some(s=>s.id===t.id)&&r[3].some(s=>s.isFetching==="beforeLoad"))return;e._flights.delete(t.id)}return n[1]}}function he(e,t){const n=t._flight;t._flight=void 0,Ur(e,t,n)?.abort()}function Q(e,t,n,r){const s=[];for(const i of t)if(!n?.includes(i)){const a=i._flight;if(i._flight=void 0,r&&a?.[2]===1&&e._flights?.get(i.id)===a&&n?.some(o=>o.id===i.id))a[2]=0;else{const o=Ur(e,i,a);o&&s.push(o)}}for(const i of s)i.abort()}function Br(e){for(const t of e){const n=t._flight;n&&n[2]++}}function Pt(e,t,n,r){if(t.isFetching=n,r&&e._tx?.[0]!==r)return;const s=e.stores.byRoute.get(t.routeId),i=s?.get();i?.id===t.id&&s.set({...i,isFetching:n})}function Po(e,t,n,r,s,i,a){const o=t[0];return{params:n.params,location:o,navigate:So(e,o),cause:a?"preload":n.cause,abortController:s,preload:a,deps:n.loaderDeps,parentMatchPromise:i,context:n.context,route:r,...e.options.additionalContext}}async function Ks(e,t,n,r,s,i,a,o){const l=o.signal;if(l.aborted)return[$e];if(!s)return[ce,void 0];let c=n._flight;Pt(e,n,"loader",o);try{if(!c){const d=new AbortController;c=[Promise.resolve().then(()=>s(Po(e,t,n,r,d,i,a))).then(u=>St(u,!1,r.id),u=>St(u,!0,r.id)).then(u=>(u[0]!==ce&&e._flights?.get(n.id)===c&&(e._flights.delete(n.id),c[2]||d.abort()),u[0]===Pe&&c[2]?wo(r,u[1]):u)),d,1],(e._flights??=new Map).set(n.id,c)}return n._flight=c,n.abortController=c[1],await Ce(c[0],l)}catch(d){if(d!==l)throw d;return he(e,n),[$e]}finally{Pt(e,n,!1,o)}}function Qs(e,t,n){t[0]===ce?(e.loaderData=t[1],e.error=void 0,e.status="success",e.invalid=!1,e.updatedAt=Date.now(),e.preload=n):t[0]!==Z&&(e.status="success",e.error=void 0,e.invalid=!0)}function Cl(e,t,n){const r=e._cache.get(t.id);if(r!==n||e._committed.some(i=>i.id===t.id&&i._flight===t._flight))return;const s={...t,_notFound:void 0,context:{}};s._flight&&s._flight[2]++,e._cache.set(t.id,s),r&&he(e,r)}function zs(e,t){return t[0]===Pe||t[0]===wn?{...e,status:t[0]===Pe?"error":"notFound",error:t[1],_flight:void 0}:e}function Rl(e,t,n,r,s,i,a){const o=t[1][n],l=Ne(e,o),c=!!i[4],d=c?e._cache.get(o.id):void 0;let u,h=!1,p;try{if(o.status==="success"&&(u=l.options.shouldReload,typeof u=="function"&&(u=u(Po(e,t,o,l,i[0],s,c))),i[2]()||(i[0].abort(),p=[$e])),!p)if(o.status!=="success")h=!0;else{const k=i[4]||o.preload?l.options.preloadStaleTime??e.options.defaultPreloadStaleTime??3e4:l.options.staleTime??e.options.defaultStaleTime??0;h=!!(o.invalid||u||u===void 0&&Date.now()-o.updatedAt>=k&&(i[6]||o.cause==="enter"||i[3].some(T=>T.routeId===o.routeId&&T.id!==o.id)))}}catch(k){o.invalid=!0,he(e,o),p=_t(l,k,i)}const m=l.options.loader,_=typeof m=="function"?m:m?.handler;let g=(!c||l.options.preload!==!1)&&m?e._flights?.get(o.id):void 0;g===o._flight||p?g=void 0:g&&!h&&!c&&u===void 0?h=!0:h||(g=void 0);const y=!!(m&&h&&o.status==="success"&&!c&&!i[5]&&((typeof m=="function"?void 0:m?.staleReloadMode)??e.options.defaultStaleReloadMode)!=="blocking"),v=h&&(!c||l.options.preload!==!1),P=v&&!y&&(o.status!=="success"||!!m),w=l.lazyFn&&l._lazy!==!0?i[8]:void 0;if(v&&!m&&(o.invalid=!1,o.updatedAt=Date.now()),g&&g[2]++,P){const k=o._flight;o._flight=g,Ur(e,o,k)?.abort(),o.status==="success"&&n>=a&&(o.status="pending"),i[8]?.()}v||(o.isFetching=!1);const R=(p?Promise.resolve(p):P?Ks(e,t,o,l,_,s,c,i[0]):Promise.resolve([ce,o.loaderData])).then(k=>(P&&(Qs(o,k,c),k[0]===ce&&(c&&m&&!i[0].signal.aborted&&Cl(e,o,d),o.status="pending")),k)),S=Ce(Promise.resolve().then(()=>Ge(l,void 0,w)),i[0].signal).then(()=>{},k=>[n,_t(l,k,i)]).then(k=>R.then(T=>(P&&!k&&T[0]===ce&&o.status==="pending"&&i[2]()&&(o.status="success",i[8]?.()),k)));if(r.push([n,R,S]),!y)return R.then(k=>zs(o,k));const b={...o,status:"pending",preload:!1,_flight:g};o.invalid=!1,o.isFetching="loader";const C=Ks(e,t,b,l,_,s,!1,i[0]).then(k=>(o.isFetching=!1,Qs(b,k,!1),k));return(t[2]??=[]).push([n,C,S,b]),C.then(k=>zs(b,k))}async function rr(e,t,n,r,s=0){const i=n?.[1][1];let a=i?.routeId?t.findIndex(o=>o.routeId===i.routeId):n?.[0]??t.length-1;a<0&&(a=0);for(let o=a;o>=0;o--){const l=Ne(e,t[o]),c=Ge(l,!1);if(c)try{await Ce(c,r)}catch(d){if(d===r)throw d}if(l.options.notFoundComponent)return o}return i?.routeId?a:s}function Je(e,t){t[2]&&(Q(e,t[2].map(n=>n[3])),t[2]=void 0)}async function Gs(e,t,n,r){let s;try{await Promise.all(e.map(i=>i[1].then(async a=>{const o=i[0];if(!(r&&o>=await r)){if(a[0]>=Z)throw[o,a];!s&&a[0]!==ce&&(s=[o,a],await Promise.all((n??[]).map(l=>{if(!(l[0]<=o))return l[1].then(c=>{if(c[0]===Z)throw[l[0],c]})})))}})))}catch(i){return i}return t??s}async function Co(e,t,n,r,s,i,a){const o=t[1];let l=await i,c=!1;const d=o.findIndex(m=>m._notFound),u=m=>m[1][0]===wn?rr(e,o,m,r.signal):m[0];let h=d<0?o.length:d;if((l?.[1][0]??0)>=Z)h=0;else if(l){h=l[2]??=await u(l);for(const m of n){if(m[0]>=h)break;const _=await m[1];if(_[0]!==ce&&_[0]=h)break;const _=await m[2];if(_){l=_;break}}if((l?.[1][0]??0)>=Z){const m=l[1];if(m[0]!==Z||m[1].options.reloadDocument||s<20)return Je(e,t),m;c=!0,l=[0,[Pe,new Error("Too many redirects")]]}const p=l?l[2]??await u(l):d;if(p>=0){const m=l?.[1],_=m?.[0],g=o[p],y=m?.[1],v=()=>{m&&(g._notFound=void 0,_===Pe?g.status="error":(y.routeId=g.routeId,g.routeId===e.routeTree.id?(g.status="success",g._notFound=!0):g.status="notFound"),g.error=y,g.isFetching=!1)};v();const P=Ne(e,g);try{await Ce(m?Promise.resolve().then(()=>Ge(P,_===Pe?"errorComponent":"notFoundComponent")):Promise.all([Ge(P),Ge(P,"notFoundComponent")]),r.signal)}catch(w){if(w===r.signal)return Je(e,t),[$e]}m?c&&(r.abort(),await Promise.all([...n.map(w=>w[1]),...n.map(w=>w[2]),...(t[2]??[]).map(w=>w[1])]),Je(e,t),Q(e,o),v()):(g.status="success",a?.())}return t}async function Ro(e,t,n,r=0,s=t[1].length){const i=t[1];for(let a=r;a_._notFound);if(e.options.notFoundMode!=="root"&&a>=0){const _=await rr(e,s[1],void 0,r[0].signal,a);_!==a&&(n[a]._notFound=void 0,n[_]._notFound=!0),a=_}let o=a<0?n.length:a+1,l=0;for(;l{for(let _=d;_=Z&&(o=0),h()),r[2]()&&!r[4]){const _=[];for(const[g,y]of e._flights??[])y[2]||(e._flights.delete(g),_.push(y[1]));for(const g of _)g.abort()}let m;try{const _=Co(e,s,c,r[0],r[1],Gs(c,p,s[2]),r[8]);s[2]?.length&&(s[3]=Gs(s[2],void 0,void 0,_.then(g=>wt(g)?0:bo(g[1]).length,()=>0))),m=await _}catch(_){throw Je(e,s),_}return wt(m)?m:Ro(e,m,r[0].signal,r[7]===m[1].length?r[7]:0)}function sr(e,t){if(e._tx!==t)return;let n=e._pending,r=!1;const s=n?.[0][3][n[1]]?.id;n?.[0]!==t&&(n&&t[3][n[1]]?.id===s?(n[0]=t,r=!0):(clearTimeout(n?.[3]),e._pending=n=void 0));const i=t[3],a=e.stores.matches.get();let o=-1,l,c,d,u=!1;for(let _=0;_0){n[3]=setTimeout(()=>sr(e,t),_);return}n[2]=0}const p=i.map(_=>({..._,_flight:void 0}));p[o].status="pending";const m=e.startTransition(()=>e.stores.setMatches(p),p).then(_=>(_&&e._pending===n&&n[4]===m&&!n[2]&&(n[2]=Date.now()+c),_));n[4]=m}function Xt(e,t){const n=e._pending;n?.[0]===t&&(clearTimeout(n[3]),e._pending=void 0)}function xo(e,t){e._committed=t,e.stores.setMatches(t)}function Js(e,t){Q(e,t[1]),Je(e,t)}function kl(e,t,n,r){const s=e._committed,i=e._cache;for(const c of n)c.preload=!1,r&&(c._assetEnd=void 0);const a=bo(n).length,o=new Map,l=Date.now();for(const c of[...s,...i.values()]){if(c.status!=="success"||n.some((u,h)=>u.id===c.id&&(h=(c.preload?d.options.preloadGcTime??e.options.defaultPreloadGcTime??3e5:d.options.gcTime??e.options.defaultGcTime??3e5)||o.set(c.id,i.get(c.id)===c?c:{...c,_flight:void 0,isFetching:!1,context:{}})}t[3]=[],e._cache=o,xo(e,n),Q(e,[...i.values(),...s],[...n,...o.values()]),gl(e,s,n,()=>e._tx===t)}async function xe(e,t){let n=e._tx;for(;n&&n!==t;){if(await n[5],e._tx===n)return;n=e._tx}}async function To(e,t,n){await e.navigate({...n.options,replace:!0,ignoreBlocker:!0,_redirects:t[1]+1})}function Eo(e,t){Xt(e,t),t[0].abort(),Q(e,t[3]),t[3]=[],e._tx===t&&(e.batch(()=>{e.stores.status.set("idle"),e.stores.setMatches(e._committed)}),e._tx===t&&(e._commitPromise?.resolve(),e._commitPromise=void 0))}async function xl(e,t,n,r,s){const i=n.map(c=>({...c}));Br(i);for(const c of r)he(e,i[c[0]]),i[c[0]]=c[3];const a=[t[2],i];let o;try{o=await Co(e,a,r,t[0],t[1],s)}catch(c){throw Q(e,i),c}if(wt(o)){Q(e,i),o[0]===Z&&e._tx===t&&e._committed===n&&await To(e,t,o[1]);return}const l=await Ro(e,o,t[0].signal);if(e._tx!==t||e._committed!==n){Q(e,l[1]);return}for(const c of l[1]){const d=e._cache.get(c.id);d?._flight&&d._flight===c._flight&&(e._cache.delete(c.id),he(e,d))}xo(e,l[1]),Q(e,n,l[1])}async function Tl(e,t,n,r,s,i){const a=[t[0],t[1],()=>e._tx===t&&!!t[3].length,e._committed,void 0,s,n,i,r],o=await ko(e,t[2],t[3],a);if(wt(o)){o[0]===Z&&e._tx===t?(Xt(e,t),Q(e,t[3]),t[3]=[],e._tx===t&&await To(e,t,o[1])):Eo(e,t);return}const l=e._pending;if(l?.[0]===t&&(clearTimeout(l[3]),l[4])){const h=t[0].signal;let p=!1;try{p=await Ce(l[4],h)}catch(m){if(m!==h)throw m}if(p&&e._pending===l&&l[0]===t){const m=l[2]-Date.now();if(m>0){try{await Ce(new Promise(_=>{l[3]=setTimeout(_,m)}),h)}catch{}clearTimeout(l[3])}}}if(e._tx!==t){Xt(e,t),Js(e,o);return}const c=t[2],d=bn(c,e.stores.resolvedLocation.get()),u=o[2];await e.startViewTransition(async()=>{if(e._tx!==t){Js(e,o);return}const h=()=>{Xt(e,t),kl(e,t,o[1],i),e._tx===t&&(e.emit({type:"onLoad",...d}),e._tx===t&&e.emit({type:"onBeforeRouteMount",...d}))},p=await e.startTransition(h,o[1]);if(e._tx!==t){Je(e,o);return}u?.length&&xl(e,t,o[1],u,o[3]).catch(console.error),e.batch(()=>{e.stores.resolvedLocation.set(c),e.stores.status.set("idle"),e._tx===t&&e.emit({type:"onResolved",...d}),p&&e._tx===t&&e.emit({type:"onRendered",...d})}),e._tx===t&&(e._commitPromise?.resolve(),e._commitPromise=void 0)})}async function El(e,t){const n=e._tx,r=e.stores.resolvedLocation.get(),s=r??e.stores.location.get(),i=e.latestLocation,a=e._pendingLocation,o=a?.href===i.href?a._redirects??0:0,l=e._handoff,c=l?.[0](),d=new AbortController,u=e._preflight;if(e._preflight=d,c||l?.[1](),u?.abort(),d.signal.aborted){await xe(e,n);return}const h=bn(i,r);if(e.emit({type:"onBeforeNavigate",...h}),d.signal.aborted||e.emit({type:"onBeforeLoad",...h}),d.signal.aborted){await xe(e,n);return}const p=s.href===i.href;let m,_=d;try{m=e.matchRoutes(i,{_controller:d}),Br(m)}catch(v){if(d.abort(),!Ar(v)){await xe(e),e._commitPromise?.resolve(),e._commitPromise=void 0;return}await e.navigate({...v.options,replace:!0,ignoreBlocker:!0}),await xe(e,n);return}const g=c?l[1](m):void 0;if(g?_=c:c?.abort(),d.signal.aborted){Q(e,m),await xe(e,n);return}e._preflight=void 0;const y=[_,o,i,m,Date.now(),Promise.resolve().then(()=>Tl(e,y,p,()=>sr(e,y),t?.sync,g)).catch(()=>{e._tx===y&&Eo(e,y)})];if(e._tx=y,n){for(const v of e.stores.matches.get()){if(e._tx!==y)break;v.isFetching&&Pt(e,v,!1)}n[0].abort(),Q(e,n[3],y[3],!0)}if(e._tx!==y){Q(e,y[3]),y[3]=[],await xe(e,y);return}e.batch(()=>{e.stores.status.set("pending"),e.stores.location.set(i)}),!r&&!m.some(v=>v._notFound)&&sr(e,y);try{await y[5]}finally{await xe(e,y)}}async function Oo(e,t,n=0){if(n>20)return;const r=t._builtLocation??e.buildLocation(t),s=e._committed,i=new AbortController;let a;try{a=e.matchRoutes(r,{_controller:i}),Br(a)}catch(l){i.abort(),Me(l)||console.error(l);return}(e._preloads??=new Map).set(i,a);let o;try{let l;try{l=await ko(e,r,a,[i,n,()=>!0,s,!0])}finally{o=e._preloads.delete(i),Q(e,a),i.abort()}if(!wt(l))return l[1];if(o&&l[0]===Z&&!l[1].options.reloadDocument)return Oo(e,{...l[1].options,_fromLocation:r},n+1)}catch(l){Me(l)||console.error(l)}}const Ol="Error preloading route! ☝️";var Lo=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=t=>{this.originalIndex=t.originalIndex;const n=this.options,r=!n?.path&&!n?.id;this.parentRoute=this.options.getParentRoute?.(),r?this._path=ze:this.parentRoute||$r();let s=r?ze:n?.path;s&&s!=="/"&&(s=_o(s));const i=n?.id||s;let a=r?ze:Gt([this.parentRoute.id==="__root__"?"":this.parentRoute.id,i]);s==="__root__"&&(s="/"),a!=="__root__"&&(a=Gt(["/",a]));const o=a==="__root__"?"/":Gt([this.parentRoute.fullPath,s]);this._path=s,this._id=a,this._fullPath=o,this._to=ue(o)},this.addChildren=t=>this._addFileChildren(t),this._addFileChildren=t=>(Array.isArray(t)&&(this.children=t),typeof t=="object"&&t!==null&&(this.children=Object.values(t)),this),this._addFileTypes=()=>this,this.updateLoader=t=>(Object.assign(this.options,t),this),this.update=t=>(Object.assign(this.options,t),this),this.lazy=t=>(this.lazyFn=t,this),this.redirect=t=>ul({from:this.fullPath,...t}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw new Error("Route cannot have both an 'id' and a 'path' option.")}},Ll=class extends Lo{constructor(e){super(e)}};function jr(e){return f(Il,{...e})}var Il=class extends ee{constructor(...e){super(...e),this.state={error:null},this.reset=()=>{this.setState({error:null})}}static getDerivedStateFromProps(e,t){const n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:null}:{resetKey:n}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.props.onCatch?.(e,t)}render(){const e=this.state.error;return e?z(this.props.errorComponent??Ml,{error:e,reset:this.reset}):this.props.children}};function Ml({error:e}){const[t,n]=F(!1);return f("div",{style:{padding:".5rem",maxWidth:"100%"},children:[f("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[f("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),f("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>n(r=>!r),children:t?"Hide Error":"Show Error"})]}),f("div",{style:{height:".25rem"}}),t?f("div",{children:f("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:e.message?f("code",{children:e.message}):null})}):null]})}function $l({children:e,fallback:t=null}){return f(Lt.Fragment,{children:Io()?e:t})}function Io(){return Lt.useSyncExternalStore(Fl,()=>!0,()=>!1)}function Fl(){return()=>{}}var Mo=ne(null);function re(e){return te(Mo)}var Sn=ne(void 0),Dl=ne(void 0),D=(e=>(e[e.None=0]="None",e[e.Mutable=1]="Mutable",e[e.Watching=2]="Watching",e[e.RecursedCheck=4]="RecursedCheck",e[e.Recursed=8]="Recursed",e[e.Dirty=16]="Dirty",e[e.Pending=32]="Pending",e))(D||{});function Al({update:e,notify:t,unwatched:n}){return{link:r,unlink:s,propagate:i,checkDirty:a,shallowPropagate:o};function r(c,d,u){const h=d.depsTail;if(h!==void 0&&h.dep===c)return;const p=h!==void 0?h.nextDep:d.deps;if(p!==void 0&&p.dep===c){p.version=u,d.depsTail=p;return}const m=c.subsTail;if(m!==void 0&&m.version===u&&m.sub===d)return;const _=d.depsTail=c.subsTail={version:u,dep:c,sub:d,prevDep:h,nextDep:p,prevSub:m,nextSub:void 0};p!==void 0&&(p.prevDep=_),h!==void 0?h.nextDep=_:d.deps=_,m!==void 0?m.nextSub=_:c.subs=_}function s(c,d=c.sub){const u=c.dep,h=c.prevDep,p=c.nextDep,m=c.nextSub,_=c.prevSub;return p!==void 0?p.prevDep=h:d.depsTail=h,h!==void 0?h.nextDep=p:d.deps=p,m!==void 0?m.prevSub=_:u.subsTail=_,_!==void 0?_.nextSub=m:(u.subs=m)===void 0&&n(u),p}function i(c){let d=c.nextSub,u;e:do{const h=c.sub;let p=h.flags;if(p&60?p&12?p&4?!(p&48)&&l(c,h)?(h.flags=p|40,p&=1):p=0:h.flags=p&-9|32:p=0:h.flags=p|32,p&2&&t(h),p&1){const m=h.subs;if(m!==void 0){const _=(c=m).nextSub;_!==void 0&&(u={value:d,prev:u},d=_);continue}}if((c=d)!==void 0){d=c.nextSub;continue}for(;u!==void 0;)if(c=u.value,u=u.prev,c!==void 0){d=c.nextSub;continue e}break}while(!0)}function a(c,d){let u,h=0,p=!1;e:do{const m=c.dep,_=m.flags;if(d.flags&16)p=!0;else if((_&17)===17){if(e(m)){const g=m.subs;g.nextSub!==void 0&&o(g),p=!0}}else if((_&33)===33){(c.nextSub!==void 0||c.prevSub!==void 0)&&(u={value:c,prev:u}),c=m.deps,d=m,++h;continue}if(!p){const g=c.nextDep;if(g!==void 0){c=g;continue}}for(;h--;){const g=d.subs,y=g.nextSub!==void 0;if(y?(c=u.value,u=u.prev):c=g,p){if(e(d)){y&&o(g),d=c.sub;continue}p=!1}else d.flags&=-33;d=c.sub;const v=c.nextDep;if(v!==void 0){c=v;continue e}}return p}while(!0)}function o(c){do{const d=c.sub,u=d.flags;(u&48)===32&&(d.flags=u|16,(u&6)===2&&t(d))}while((c=c.nextSub)!==void 0)}function l(c,d){let u=d.depsTail;for(;u!==void 0;){if(u===c)return!0;u=u.prevDep}return!1}}function Nl(e,t,n){const r=typeof e=="object",s=r?e:void 0;return{next:(r?e.next:e)?.bind(s),error:(r?e.error:t)?.bind(s),complete:(r?e.complete:n)?.bind(s)}}const ir=[];let Zt=0;const{link:Ys,unlink:Ul,propagate:Bl,checkDirty:$o,shallowPropagate:Xs}=Al({update(e){return e._update()},notify(e){ir[or++]=e,e.flags&=~D.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=D.Mutable|D.Dirty,fn(e))}});let qt=0,or=0,oe,ar=0;function jl(e){try{++ar,e()}finally{--ar||Fo()}}function fn(e){const t=e.depsTail;let n=t!==void 0?t.nextDep:e.deps;for(;n!==void 0;)n=Ul(n,e)}function Fo(){if(!(ar>0)){for(;qt{s.get(),o.current?a.next?.(s._snapshot):o.current=!0});return{unsubscribe:()=>{l.stop()}}},_update(i){const a=oe,o=t?.compare??Object.is;if(n)oe=s,++Zt,s.depsTail=void 0;else if(i===void 0)return!1;n&&(s.flags=D.Mutable|D.RecursedCheck);try{const l=s._snapshot,c=typeof i=="function"?i(l):i===void 0&&n?r(l):i;return l===void 0||!o(l,c)?(s._snapshot=c,!0):!1}finally{oe=a,n&&(s.flags&=~D.RecursedCheck),fn(s)}}};return n?(s.flags=D.Mutable|D.Dirty,s.get=function(){const i=s.flags;if(i&D.Dirty||i&D.Pending&&$o(s.deps,s)){if(s._update()){const a=s.subs;a!==void 0&&Xs(a)}}else i&D.Pending&&(s.flags=i&~D.Pending);return oe!==void 0&&Ys(s,oe,Zt),s._snapshot}):s.set=function(i){if(s._update(i)){const a=s.subs;a!==void 0&&(Bl(a),Xs(a),Fo())}},s}function Hl(e){const t=()=>{const r=oe;oe=n,++Zt,n.depsTail=void 0,n.flags=D.Watching|D.RecursedCheck;try{return e()}finally{oe=r,n.flags&=~D.RecursedCheck,fn(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:D.Watching|D.RecursedCheck,notify(){const r=this.flags;r&D.Dirty||r&D.Pending&&$o(this.deps,this)?t():this.flags=D.Watching},stop(){this.flags=D.None,this.depsTail=void 0,fn(this)}};return t(),n}function ql(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function r(){var s=!1;try{s=this instanceof r}catch{}return s?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:function(){return e[r]}})}),n}var $n={exports:{}},Fn={};const Do=ql(dc);var Dn={exports:{}},An={};var ei;function Wl(){if(ei)return An;ei=1;var e=Do;function t(u,h){return u===h&&(u!==0||1/u===1/h)||u!==u&&h!==h}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,s=e.useEffect,i=e.useLayoutEffect,a=e.useDebugValue;function o(u,h){var p=h(),m=r({inst:{value:p,getSnapshot:h}}),_=m[0].inst,g=m[1];return i(function(){_.value=p,_.getSnapshot=h,l(_)&&g({inst:_})},[u,p,h]),s(function(){return l(_)&&g({inst:_}),u(function(){l(_)&&g({inst:_})})},[u]),a(p),p}function l(u){var h=u.getSnapshot;u=u.value;try{var p=h();return!n(u,p)}catch{return!0}}function c(u,h){return h()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:o;return An.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:d,An}var ti;function Vl(){return ti||(ti=1,Dn.exports=Wl()),Dn.exports}var ni;function Kl(){if(ni)return Fn;ni=1;var e=Do,t=Vl();function n(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}var r=typeof Object.is=="function"?Object.is:n,s=t.useSyncExternalStore,i=e.useRef,a=e.useEffect,o=e.useMemo,l=e.useDebugValue;return Fn.useSyncExternalStoreWithSelector=function(c,d,u,h,p){var m=i(null);if(m.current===null){var _={hasValue:!1,value:null};m.current=_}else _=m.current;m=o(function(){function y(S){if(!v){if(v=!0,P=S,S=h(S),p!==void 0&&_.hasValue){var b=_.value;if(p(b,S))return w=b}return w=S}if(b=w,r(P,S))return b;var C=h(S);return p!==void 0&&p(b,C)?(P=S,b):(P=S,w=C)}var v=!1,P,w,R=u===void 0?null:u;return[function(){return y(d())},R===null?void 0:function(){return y(R())}]},[d,u,h,p]);var g=s(c,m[0],m[1]);return a(function(){_.hasValue=!0,_.value=g},[g]),l(g),g},Fn}var ri;function Ql(){return ri||(ri=1,$n.exports=Kl()),$n.exports}var zl=Ql();function Gl(e,t){return e===t}function pe(e,t,n=Gl){const r=W(a=>{if(!e)return()=>{};const{unsubscribe:o}=e.subscribe(a);return o},[e]),s=W(()=>e?.get(),[e]);return zl.useSyncExternalStoreWithSelector(r,s,s,t,n)}var si={};function Ao(e,t){const n=q();return r=>{const s=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=Le(n.current,s):s}}function Ue(e){const t=re(),n=te(e.from?Dl:Sn),r=e.from??n,s=t.stores.getMatchStore(r),i=Ao(e,t),a=pe(s,o=>o?i(o):si);if(a!==si)return a;(e.shouldThrow??!0)&&$r()}function No(e){return Ue({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function Uo(e){const{select:t,...n}=e;return Ue({...n,select:r=>t?t(r.loaderDeps):r.loaderDeps})}function Bo(e){return Ue({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{const n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function jo(e){return Ue({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function it(e){const t=re();return W(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function Ho(e){return Ue({...e,select:t=>e.select?e.select(t.context):t.context})}function Nn(e){const t=q(e);return we(t.current,e,{ignoreUndefined:!1})||(t.current=e),t.current}function Jl(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function Yl(e,t,n){if(e?.external)return ln(e.href,n)?void 0:e.href;if(!ou(t)&&!(typeof t!="string"||t.indexOf(":")===-1))try{return new URL(t),ln(t,n)?void 0:t}catch{}}function Xl(e,t,n,r,s,i){if(i)return!1;if(n?.exact){if(!Qc(e.pathname,t.pathname,r))return!1}else{const a=hn(e.pathname,r),o=hn(t.pathname,r);if(!(a.startsWith(o)&&(a.length===o.length||a[o.length]==="/")))return!1}return(n?.includeSearch??!0)&&!we(e.search,t.search,{partial:!n?.exact,ignoreUndefined:!n?.explicitUndefined})?!1:n?.includeHash?s&&e.hash===t.hash:!0}function Zl(e,t){const n=re(),r=xc(t),{activeProps:s,inactiveProps:i,activeOptions:a,to:o,preload:l,preloadDelay:c,preloadIntentProximity:d,hashScrollIntoView:u,replace:h,startTransition:p,resetScroll:m,viewTransition:_,children:g,target:y,disabled:v,style:P,className:w,onClick:R,onBlur:S,onFocus:b,onMouseEnter:C,onMouseLeave:k,onTouchStart:T,ignoreBlocker:x,params:O,search:$,hash:at,state:se,mask:$t,reloadDocument:Mh,unsafeRelative:$h,from:Fh,_fromLocation:Dh,...Kr}=e,Rn=Io(),ha=Nn(e.search),da=Nn(e.params),Qr=Nn(a),ct=B(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,ha,da,e.state,e.mask,e.unsafeRelative]),fa=W(N=>{const H=n.buildLocation({_fromLocation:N,...ct}),ie=iu(H.maskedLocation?H.maskedLocation.publicHref:H.publicHref,H.maskedLocation?H.maskedLocation.external:H.external,n.history,v),At=Yl(ie,o,n.protocolAllowlist);return[ie?.href,At,Xl(N,H,Qr,n.basepath,Rn,At!==void 0)]},[Qr,v,Rn,ct,n,o]),[pa,kn,xn]=pe(n.stores.location,fa,Jl),Ft=xn?tt(s,{})??eu:Un,Dt=xn?Un:tt(i,{})??Un,zr=[w,Ft.className,Dt.className].filter(Boolean).join(" "),Gr=(P||Ft.style||Dt.style)&&{...P,...Ft.style,...Dt.style},[_a,Jr]=F(!1),Yr=q(!1),Be=e.reloadDocument||kn?!1:l??n.options.defaultPreload,Tn=c??n.options.defaultPreloadDelay??0,Re=W(()=>{n.preloadRoute(ct).catch(N=>{console.warn(N),console.warn(Ol)})},[n,ct]);kc(r,W(N=>{N?.isIntersecting&&Re()},[Re]),su,!!v||Be!=="viewport"),j(()=>{Yr.current||!v&&Be==="render"&&(Re(),Yr.current=!0)},[v,Re,Be]);const ma=N=>{const H=N.currentTarget.getAttribute("target"),ie=y!==void 0?y:H;if(!v&&!au(N)&&!N.defaultPrevented&&(!ie||ie==="_self")&&N.button===0){N.preventDefault(),Mr(()=>{Jr(!0)});const At=n.subscribe("onResolved",()=>{At(),Jr(!1)});n.navigate({...ct,replace:h,resetScroll:m,hashScrollIntoView:u,startTransition:p,viewTransition:_,ignoreBlocker:x})}};if(kn)return{...Kr,ref:r,href:kn,...g&&{children:g},...y&&{target:y},...v&&{disabled:v},...P&&{style:P},...w&&{className:w},...R&&{onClick:R},...S&&{onBlur:S},...b&&{onFocus:b},...C&&{onMouseEnter:C},...k&&{onMouseLeave:k},...T&&{onTouchStart:T}};const Xr=N=>{if(v||Be!=="intent")return;if(!Tn){Re();return}const H=N.currentTarget;if(ut.has(H))return;const ie=setTimeout(()=>{ut.delete(H),Re()},Tn);ut.set(H,ie)},ga=N=>{v||Be!=="intent"||Re()},Zr=N=>{if(v||!Be||!Tn)return;const H=N.currentTarget,ie=ut.get(H);ie&&(clearTimeout(ie),ut.delete(H))};return{...Kr,...Ft,...Dt,href:pa,ref:r,onClick:je([R,ma]),onBlur:je([S,Zr]),onFocus:je([b,Xr]),onMouseEnter:je([C,Xr]),onMouseLeave:je([k,Zr]),onTouchStart:je([T,ga]),disabled:!!v,target:y,...Gr&&{style:Gr},...zr&&{className:zr},...v&&tu,...xn&&nu,...Rn&&_a&&ru}}var Un={},eu={className:"active"},tu={role:"link","aria-disabled":!0},nu={"data-status":"active","aria-current":"page"},ru={"data-transitioning":"transitioning"},ut=new WeakMap,su={rootMargin:"100px"},je=e=>t=>{for(const n of e)if(n){if(t.defaultPrevented)return;n(t)}};function iu(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||"/",external:!1}}function ou(e){if(typeof e!="string")return!1;const t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var X=Lr((e,t)=>{const{_asChild:n,...r}=e,{type:s,...i}=Zl(r,t),a=typeof r.children=="function"?r.children({isActive:i["data-status"]==="active"}):r.children;if(!n){const{disabled:o,...l}=i;return z("a",l,a)}return z(n,i,a)});function au(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var cu=class extends Lo{constructor(e){super(e),this.useMatch=t=>Ue({select:t?.select,from:this.id,structuralSharing:t?.structuralSharing}),this.useRouteContext=t=>Ho({...t,from:this.id}),this.useSearch=t=>jo({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useParams=t=>Bo({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useLoaderDeps=t=>Uo({...t,from:this.id}),this.useLoaderData=t=>No({...t,from:this.id}),this.useNavigate=()=>it({from:this.fullPath}),this.Link=Lt.forwardRef((t,n)=>f(X,{ref:n,from:this.fullPath,...t}))}};function It(e){return new cu(e)}var lu=class extends Ll{constructor(e){super(e),this.useMatch=t=>Ue({select:t?.select,from:this.id,structuralSharing:t?.structuralSharing}),this.useRouteContext=t=>Ho({...t,from:this.id}),this.useSearch=t=>jo({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useParams=t=>Bo({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useLoaderDeps=t=>Uo({...t,from:this.id}),this.useLoaderData=t=>No({...t,from:this.id}),this.useNavigate=()=>it({from:this.fullPath}),this.Link=Lt.forwardRef((t,n)=>f(X,{ref:n,from:this.fullPath,...t}))}};function uu(e){return new lu(e)}function hu(e){const t=re(),n=`not-found-${pe(t.stores.location,r=>r.pathname)}-${pe(t.stores.status,r=>r)}`;return f(jr,{getResetKey:()=>n,onCatch:(r,s)=>{if(Me(r))e.onCatch?.(r,s);else throw r},errorComponent:({error:r})=>{if(Me(r))return e.fallback?.(r);throw r},children:e.children})}function du(){return f("p",{children:"Not Found"})}function We(e){return f(I,{children:e.children})}function qo(e,t,n){return t.options.notFoundComponent?f(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?f(e.options.defaultNotFoundComponent,{...n}):f(du,{})}function Pn(e,t){const n=t?.options.pendingComponent??e.options.defaultPendingComponent;return n?f(n,{}):null}var fu=(e,t)=>e[0]===t[0]&&e[1]===t[1],Wo=Et(function({routeId:t}){const n=re();return f(pu,{router:n,match:pe(n.stores.getMatchStore(t),r=>r)})});function pu({router:e,match:t}){const n=e.routesById[t.routeId],r=Pn(e,n),s=n.options.errorComponent??e.options.defaultErrorComponent,i=n.options.onCatch??e.options.defaultOnCatch,a=n.isRoot?n.options.notFoundComponent??e.options.notFoundRoute?.options.component:n.options.notFoundComponent,o=t.ssr===!1||t.ssr==="data-only",l=n.options.wrapInSuspense??r??(n.options.errorComponent?.preload||o)?be:We,c=s?jr:We,d=a?hu:We;return f(n.isRoot?n.options.shellComponent??We:We,{children:[f(Sn.Provider,{value:t.routeId,children:f(l,{fallback:r,children:f(c,{getResetKey:()=>t,errorComponent:s,onCatch:(u,h)=>{if(Me(u))throw u.routeId??=t.routeId,u;i?.(u,h)},children:f(d,{fallback:u=>{if(u.routeId??=t.routeId,u.routeId!==t.routeId)throw u;return z(a,u)},children:o?f($l,{fallback:r,children:f(ii,{match:t})}):f(ii,{match:t})})})})}),null]})}var ii=Et(function({match:t}){const n=re(),r=t.routeId,s=n.routesById[r],i=B(()=>{const o=(s.options.remountDeps??n.options.defaultRemountDeps)?.({routeId:r,loaderDeps:t.loaderDeps,params:t._strictParams,search:t._strictSearch});return o?JSON.stringify(o):void 0},[r,t.loaderDeps,t._strictParams,t._strictSearch,s.options.remountDeps,n.options.defaultRemountDeps]),a=B(()=>{const o=s.options.component??n.options.defaultComponent;return o?f(o,{},i):f(Vo,{})},[i,s.options.component,n.options.defaultComponent]);if(t.status==="pending"){if(n._tx)throw n._tx[5];return Pn(n,s)}if(t.status==="notFound")return qo(n,s,t.error);if(t.status==="error")throw t.error;return a}),Vo=Et(function(){const t=re(),n=te(Sn);let r,s,i;{const o=t.stores.getMatchStore(n);[r,s]=pe(o,l=>[!!l._notFound,l.error],fu),i=pe(t.stores.ids,l=>l[l.indexOf(n)+1])}if(r)return qo(t,t.routesById[n],s);if(!i)return null;const a=f(Wo,{routeId:i});return n===ze?f(be,{fallback:Pn(t),children:a}):a});function Ko(e,t){const n=e[1];e.length=0,n?.(t)}function _u({t:e}){const t=re(),n=t._rendered??=[];return t.startTransition=(r,s)=>new Promise((i,a)=>{Ko(n,!1),n.push(s,i),e(t),yn(()=>{try{r()}catch(o){n[1]===i&&(n.length=0),a(o)}})}),oo(()=>{const r=t.history.subscribe(t.load);t.updateLatestLocation();const s=t.latestLocation,i=t.buildLocation({to:s.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});if(ue(s.publicHref)!==ue(i.publicHref))return t.commitLocation({...i,replace:!0,ignoreBlocker:!0}),r;const a=t.stores.resolvedLocation.get();return a?.href===s.href&&a.state.__TSR_key===s.state.__TSR_key?n.push(t.stores.matches.get(),o=>{o&&t.emit({type:"onRendered",...bn(a,a)})}):t._tx||t.load().catch(console.error),r},[t,t.history]),null}function mu(){const e=re(),t=e.routesById[ze],n=Pn(e,t),r=e.ssr?We:be,s=f(I,{children:[f(_u,{t:F()[1]}),f(r,{fallback:n,children:f(gu,{})})]});return e.options.InnerWrap?f(e.options.InnerWrap,{children:s}):s}function gu(){const e=re(),t=e._rendered,n=pe(e.stores.matches,a=>t[0]??a),r=n[0],s=r?.routeId;oo(()=>{t[0]===n&&Ko(t,!0)},[t,n]);const i=s?f(Wo,{routeId:s}):null;return f(Sn.Provider,{value:s,children:e.options.disableGlobalCatchBoundary?i:f(jr,{getResetKey:()=>r,onCatch:void 0,children:i})})}var yu=e=>({createMutableStore:Zs,createReadonlyStore:Zs,batch:jl}),vu=e=>new bu(e),bu=class extends yl{constructor(e){super(e,yu)}};function wu({router:e,children:t,...n}){co(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});const r=f(Mo.Provider,{value:e,children:t});return e.options.Wrap?f(e.options.Wrap,{children:r}):r}function Su({router:e,...t}){return f(wu,{router:e,...t,children:f(mu,{})})}function Qo(e){const t=re({warn:e?.router===void 0}),n=e?.router||t;return pe(n.stores.__store,Ao(e,n))}const pn={width:3997,height:1467},zo="M105 1467V670H0V405H105V248L372 0H868V265H548V1467ZM615 670 618 405H868V670ZM1104 1467 839 1202V670L1104 405H1401V670H1286V1219H1401V1467ZM1471 1467V1219H1581V670H1471V405H1767L2032 670V1202L1767 1467ZM2419 1467 2171 1219V0H2613V1202H2811V1467ZM3555 1467V0H3997V1467ZM3069 1467 2830 1228V644L3069 405H3485V670H3272V1219H3485V1362L3380 1467Z";function Pu(e,t,n){const r=n/pn.width,s=e-n/2,i=t-pn.height*r/2;return`translate(${s.toFixed(2)} ${i.toFixed(2)}) scale(${r.toFixed(5)})`}function oi({title:e,descriptor:t,className:n}){return f("span",{class:n?`wordmark ${n}`:"wordmark",children:[f("svg",{class:"wordmark-glyphs",viewBox:`0 0 ${pn.width} ${pn.height}`,fill:"currentColor",role:e?"img":void 0,"aria-label":e,"aria-hidden":e?void 0:"true",focusable:"false",children:[e?f("title",{children:e}):null,f("path",{d:zo})]}),t?f(I,{children:[f("span",{class:"wordmark-rule","aria-hidden":"true"}),f("span",{class:"wordmark-descriptor",children:t})]}):null]})}const Cu=[{label:"Overview",to:"/"},{label:"Upstreams",to:"/upstreams"},{label:"Catalog",to:"/catalog"},{label:"Test console",to:"/test"}];function Ru({state:e,catalog:t,onClose:n}){const r=it(),s=q(null),[i,a]=F(""),[o,l]=F(0);j(()=>{s.current?.showModal()},[]);const c=B(()=>{const _=Cu.map(g=>({group:"Go to",label:g.label,run:()=>{r({to:g.to})}}));for(const g of e?.upstreams??[])_.push({group:"Upstreams",label:g.id,hint:g.connected?void 0:"not connected",run:()=>{r({to:"/upstreams/$id",params:{id:g.id}})}});for(const g of["tools","prompts","resources"])for(const y of t?.[g]??[]){const v=y.name??y.uri;v&&_.push({group:"Catalog",label:v,hint:g.slice(0,-1),run:()=>{r({to:"/test",search:{mode:g,item:v}})}})}return _},[e,t,r]),d=B(()=>{const _=i.trim().toLowerCase();return _?c.filter(g=>`${g.label} ${g.group}`.toLowerCase().includes(_)).slice(0,50):c.slice(0,50)},[c,i]),u=Math.min(o,Math.max(d.length-1,0)),h=_=>{_&&(n(),_.run())},p=_=>{if(_.key==="ArrowDown"||_.key==="ArrowUp"){if(_.preventDefault(),!d.length)return;const g=_.key==="ArrowDown"?1:-1;l(y=>(Math.min(y,d.length-1)+g+d.length)%d.length)}else _.key==="Enter"&&(_.preventDefault(),h(d[u]))},m=[];return d.forEach((_,g)=>{const y=m[m.length-1];y&&y.name===_.group?y.items.push({item:_,index:g}):m.push({name:_.group,items:[{item:_,index:g}]})}),f("dialog",{ref:s,class:"palette","aria-label":"Jump to",onClose:n,onClick:_=>{_.target===s.current&&s.current?.close()},children:[f("div",{class:"pal-input",children:f("input",{value:i,placeholder:"Search routes, upstreams, tools","aria-label":"Search",role:"combobox","aria-expanded":"true","aria-controls":"pal-list","aria-activedescendant":d.length?`pal-${u}`:void 0,autocomplete:"off",spellcheck:!1,onInput:_=>{a(_.target.value),l(0)},onKeyDown:p})}),d.length===0?f("p",{class:"pal-empty",id:"pal-list",children:"Nothing matches that. Routes, upstream ids and catalog names are searched."}):f("ul",{class:"pal-list",id:"pal-list",role:"listbox","aria-label":"Results",children:m.map(_=>f("li",{role:"group","aria-label":_.name,children:[f("p",{class:"pal-group","aria-hidden":"true",children:_.name}),_.items.map(({item:g,index:y})=>f("div",{id:`pal-${y}`,role:"option",class:"pal-item","aria-selected":y===u,onMouseEnter:()=>l(y),onClick:()=>h(g),children:[f("span",{class:"pal-label",children:g.label}),g.hint?f("span",{class:"pal-hint",children:g.hint}):null]},`${_.name}:${g.label}`))]},_.name))}),f("p",{class:"pal-foot",children:"↑ ↓ to move, Enter to open, Esc to close"})]})}let Ct={token:"",state:"anonymous"};const cr=new Set;function Go(){for(const e of cr)e()}function ku(){return Ct}function Jo(e,t="pasted"){const n=e.trim();Ct={token:n,state:n?t:"anonymous"},Go()}function xu(){Ct={token:"",state:"anonymous"},Go()}function Yo(){return Ct.token?{Authorization:`Bearer ${Ct.token}`}:{}}function Tu(e){return cr.add(e),()=>{cr.delete(e)}}function Hr(){return st(Tu,ku)}const Fe={tools:{list:"tools/list",listKey:"tools",call:"tools/call",verb:"Call tool",args:!0,label:"Tools"},prompts:{list:"prompts/list",listKey:"prompts",call:"prompts/get",verb:"Get prompt",args:!0,label:"Prompts"},resources:{list:"resources/list",listKey:"resources",call:"resources/read",verb:"Read resource",args:!1,label:"Resources"}},Mt=["tools","prompts","resources"],en={tools:[],prompts:[],resources:[]};function G(e,t){return(e==="resources"?t.uri:t.name)??""}class Eu{constructor(t,n){this.path=t,this.clientVersion=n}path;clientVersion;sessionId=null;protocolVersion=null;nextId=0;wire=[];wireSeq=0;listeners=new Set;subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});getWire=()=>this.wire;clearWire=()=>{this.wire=[],this.emit()};emit(){for(const t of this.listeners)t()}log(t,n){const r=this.wire.concat({id:this.wireSeq++,direction:t,message:n});this.wire=r.length>400?r.slice(r.length-400):r,this.emit()}async rpc(t,n,r=!1){const s={jsonrpc:"2.0",method:t};n!==void 0&&(s.params=n),r||(s.id=++this.nextId),this.log("→",s);const i={"Content-Type":"application/json",Accept:"application/json, text/event-stream",...Yo()};this.sessionId&&(i["Mcp-Session-Id"]=this.sessionId),this.protocolVersion&&(i["MCP-Protocol-Version"]=this.protocolVersion);const a=await fetch(this.path,{method:"POST",headers:i,body:JSON.stringify(s)}),o=a.headers.get("mcp-session-id");if(o&&(this.sessionId=o),a.status===202)return null;if(!a.ok){const d=await a.text();throw new Error(`HTTP ${a.status}${d?`: ${d.slice(0,300)}`:""}`)}const l=a.headers.get("content-type")??"";let c=null;if(l.includes("text/event-stream")){const d=await a.text();for(const u of d.split(/\r?\n\r?\n/)){const h=u.split(/\r?\n/).filter(m=>m.startsWith("data:")).map(m=>m.slice(5).replace(/^ /,"")).join(` +`);if(!h)continue;let p;try{p=JSON.parse(h)}catch{continue}this.log("←",p),!r&&p.id===s.id&&(c=p)}}else c=await a.json(),this.log("←",c);if(r)return null;if(!c)throw new Error(`no response for request ${s.id} on the stream`);if(c.error)throw new Error(`JSON-RPC ${c.error.code}: ${c.error.message}`);return c.result}async fetchList(t){const n=Fe[t],r=[];let s;for(let i=0;i<25;i++){let a;try{a=await this.rpc(n.list,s?{cursor:s}:{})}catch(o){if(/-32601/.test(o.message))return[];throw o}if(r.push(...a[n.listKey]??[]),s=a.nextCursor,!s)break}return r}async connect(){this.sessionId=null,this.protocolVersion=null,this.nextId=0;const t=await this.rpc("initialize",{protocolVersion:"2025-06-18",capabilities:{},clientInfo:{name:"fold-console",version:this.clientVersion}});this.protocolVersion=t.protocolVersion??null,await this.rpc("notifications/initialized",void 0,!0);const n={tools:[],prompts:[],resources:[]};for(const r of Mt)n[r]=await this.fetchList(r);return n}async invoke(t,n,r){const s=t==="resources"?{uri:n}:{name:n,arguments:r};return this.rpc(Fe[t].call,s)}}function Ou(e){const t=e?.inputSchema;if(t?.properties){const n=new Set(t.required??[]),r={};for(const[s,i]of Object.entries(t.properties))n.size&&!n.has(s)||(r[s]=Lu(i));if(Object.keys(r).length)return JSON.stringify(r,null,2)}if(e?.arguments?.length){const n={};for(const r of e.arguments)r.required!==!1&&(n[r.name]="");if(Object.keys(n).length)return JSON.stringify(n,null,2)}return""}function Lu(e){if(e.default!==void 0)return e.default;if(e.enum?.length)return e.enum[0];switch(e.type){case"number":case"integer":return 0;case"boolean":return!1;case"array":return[];case"object":return{};default:return""}}const mt=()=>{},Xo=ne({status:"idle",error:null,catalog:en,client:null,connect:mt,disconnect:mt,wire:[],clearWire:mt});function qr(){return te(Xo)}function Iu(e){const t=e&&e.trim()?e:"/mcp";return new URL(`..${t.startsWith("/")?t:`/${t}`}`,location.href).pathname}function Mu({mcpPath:e,gatewayVersion:t,children:n}){const[r,s]=F("idle"),[i,a]=F(null),[o,l]=F(en),[c,d]=F(null),{token:u}=Hr(),h=q(0),p=W(()=>{const v=++h.current,P=new Eu(Iu(e),t??"dev");d(P),s("connecting"),a(null),l(en),P.connect().then(w=>{v===h.current&&(l(w),s("ready"))}).catch(w=>{v===h.current&&(a(`MCP connect failed: ${w.message}`),s("error"))})},[e,t]),m=W(()=>{h.current++,d(null),l(en),s("idle"),a(null)},[]),_=q(u);_.current!==u&&(_.current=u,r!=="idle"&&queueMicrotask(m));const g=st(c?c.subscribe:()=>mt,c?c.getWire:()=>$u),y=B(()=>({status:r,error:i,catalog:o,client:c,connect:p,disconnect:m,wire:g,clearWire:c?c.clearWire:mt}),[r,i,o,c,p,m,g]);return f(Xo.Provider,{value:y,children:n})}const $u=[],Fu=45e3;function Du(e){const t=Math.max(0,Math.round(e/1e3));if(t<5)return"just now";if(t<60)return`${t}s ago`;const n=Math.round(t/60);return n<60?`${n}m ago`:`${Math.round(n/60)}h ago`}function Au({updatedAt:e,fetching:t,failed:n}){const[r,s]=F(()=>Date.now());if(j(()=>{const l=setInterval(()=>s(Date.now()),5e3);return()=>clearInterval(l)},[]),!e&&!n)return null;const i=r-e,a=n?"failed":t?"fetching":i>Fu?"stale":"live",o=a==="failed"?"not updating":a==="fetching"?"refreshing":Du(i);return f("p",{class:"freshness","data-state":a,children:[f("span",{class:"dot","aria-hidden":"true"}),f("span",{class:"visually-hidden",children:a==="failed"?"The federation snapshot is not updating.":`Federation snapshot ${a==="fetching"?"refreshing now":`last updated ${o}`}.`}),f("span",{"aria-hidden":"true",children:o})]})}const ai="1.9.0",Nu={consoleSource:"1.9.0",tenantGovernance:"1.9.0"};function _n(e){if(!e)return null;const t=/^v?(\d+)\.(\d+)(?:\.(\d+))?/.exec(e.trim());return t?[Number(t[1]),Number(t[2]),Number(t[3]??0)]:null}function Zo(e,t){const n=_n(e),r=_n(t);if(!n||!r)return 0;for(let s=0;s<3;s++){const i=(n[s]??0)-(r[s]??0);if(i!==0)return i<0?-1:1}return 0}function ci(e,t){return _n(e)?Zo(e,Nu[t])>=0:!0}function Uu(e){return!_n(e)||Zo(e,ai)>=0?null:`This console needs fold ${ai} or newer; the gateway reports ${e}. Parts of this page will be empty. Upgrade the gateway, or use the console bundled with it.`}function Bu(e){return e?/^\d/.test(e)?`v${e}`:e:""}const ju=[{to:"/",label:"Overview"},{to:"/upstreams",label:"Upstreams"},{to:"/catalog",label:"Catalog"},{to:"/test",label:"Test console"}];function Hu({federation:e,version:t,authRequired:n,hint:r,onSignIn:s,onRefresh:i,refreshing:a,updatedAt:o,failed:l,section:c,children:d}){const u=Hr(),h=qr(),[p,m]=F(!1),[_,g]=F("");j(()=>{const S=b=>{(b.metaKey||b.ctrlKey)&&b.key.toLowerCase()==="k"&&(b.preventDefault(),m(C=>!C))};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[]);const y=Qo({select:S=>S.location.pathname}),v=q(null),P=u.state==="signed-in",w=!P&&n!==!1,R=()=>{Jo(_),i()};return f("div",{class:"shell",children:[f("button",{type:"button",class:"skip",onClick:()=>v.current?.focus(),children:"Skip to content"}),f("header",{class:"topbar",children:[f(X,{to:"/",className:"brand","aria-label":"fold console, overview",children:[f(oi,{title:"fold",descriptor:"Console"}),t?f("span",{class:"version muted",children:Bu(t)}):null]}),f("div",{class:"auth",children:[f(Au,{updatedAt:o,fetching:a,failed:l}),f("button",{type:"button",onClick:()=>m(!0),"aria-keyshortcuts":"Meta+K Control+K",children:"Jump to"}),r?.oauth&&!P?f("button",{type:"button",onClick:s,children:"Sign in"}):null,P?f("button",{type:"button",onClick:()=>{xu(),i()},children:"Sign out"}):null,w?f("input",{type:"password",value:_,autocomplete:"off",spellcheck:!1,"aria-label":"Bearer token",placeholder:r?.oauth?"…or paste a Bearer token":"Bearer token",onInput:S=>g(S.currentTarget.value),onBlur:R,onKeyDown:S=>{S.key==="Enter"&&R()}}):null,f("button",{type:"button",onClick:i,disabled:a,children:"Refresh"})]})]}),f("div",{class:"body",children:[f("nav",{class:"sidebar","aria-label":"Console sections",children:f("ul",{children:ju.map(S=>f("li",{children:f(X,{to:S.to,className:li(y,S.to)?"nav-link active":"nav-link","aria-current":li(y,S.to)?"page":void 0,children:S.label})},S.to))})}),f("main",{id:"main",ref:v,tabIndex:-1,children:d})]}),p?f(Ru,{state:e,catalog:h.catalog,onClose:()=>m(!1)}):null,f(qu,{section:c}),f("footer",{children:f("div",{class:"foot",children:[f("span",{class:"legal",children:[f(oi,{}),"© fold.run · the enterprise MCP gateway"]}),f("nav",{"aria-label":"fold project",children:[f("a",{href:"https://fold.run/",rel:"noopener",children:"fold.run"}),f("a",{href:"https://docs.fold.run/",rel:"noopener",children:"Docs"}),f("a",{href:"https://github.com/fold-run/fold",rel:"noopener",children:"GitHub"}),f("a",{href:"https://fold.run/status/",rel:"noopener",children:"Status"})]})]})})]})}function qu({section:e}){const[t,n]=F(""),r=q(!0);return j(()=>{if(r.current){r.current=!1;return}n(`${e} page`)},[e]),f("p",{class:"visually-hidden",role:"status","aria-live":"polite",children:t})}function li(e,t){return t==="/"?e==="/":e===t||e.startsWith(`${t}/`)}function tn({tone:e="bad",announce:t=!0,children:n}){return f("p",{class:`banner ${e}`,role:t?"alert":void 0,children:n})}function Y({title:e,hint:t}){return f("div",{class:"empty",children:[f("p",{class:"empty-title",children:e}),t?f("p",{class:"muted",children:t}):null]})}class Ke extends Error{status;terminal;constructor(t,n,r=!1){super(n),this.name="ApiError",this.status=t,this.terminal=r}}const Wu="../api/federation",Vu="../api/auth-hint";async function Ku(e){let t;try{t=await fetch(Wu,{headers:Yo(),signal:e})}catch(n){throw new Ke(0,`Could not reach the gateway: ${n.message}`)}if(t.status===401)throw new Ke(401,"Unauthorized. Sign in, or paste a valid Bearer token: the same one /mcp accepts.",!0);if(t.status===403)throw new Ke(403,"This principal is not in the introspection viewer allowlist (server.introspection.groups). The denial was audited.",!0);if(!t.ok)throw new Ke(t.status,`The gateway refused the read: HTTP ${t.status}.`);return await t.json()}const Qu={queryKey:["federation"],queryFn:({signal:e})=>Ku(e),refetchInterval:15e3,retry:(e,t)=>!(t instanceof Ke&&t.terminal)},lr="fold-console-pkce";function Bn(e){return btoa(String.fromCharCode(...e)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function ea(){try{const e=await fetch(Vu);return e.ok?await e.json():null}catch{return null}}async function zu(e){const t=e.replace(/\/$/,""),n=new URL(t),r=[`${t}/.well-known/openid-configuration`,`${n.origin}/.well-known/oauth-authorization-server${n.pathname.replace(/\/$/,"")}`];for(const s of r)try{const i=await fetch(s);if(!i.ok)continue;const a=await i.json();if(a.authorization_endpoint&&a.token_endpoint)return{authorization_endpoint:a.authorization_endpoint,token_endpoint:a.token_endpoint}}catch{}throw new Error(`could not discover authorization server metadata for ${e}`)}function ta(){return location.origin+location.pathname}async function Gu(e){if(!e.oauth)throw new Error("this gateway does not advertise an OAuth issuer");const t=await zu(e.oauth.issuer),n=Bn(crypto.getRandomValues(new Uint8Array(32))),r=Bn(crypto.getRandomValues(new Uint8Array(16))),s=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(n));sessionStorage.setItem(lr,JSON.stringify({verifier:n,state:r,tokenEndpoint:t.token_endpoint}));const i=new URL(t.authorization_endpoint);i.searchParams.set("response_type","code"),i.searchParams.set("client_id",e.oauth.clientId),i.searchParams.set("redirect_uri",ta()),i.searchParams.set("code_challenge",Bn(new Uint8Array(s))),i.searchParams.set("code_challenge_method","S256"),i.searchParams.set("state",r),e.oauth.scopes?.length&&i.searchParams.set("scope",e.oauth.scopes.join(" ")),e.resource&&i.searchParams.set("resource",e.resource),location.assign(i)}async function Ju(e){const t=new URLSearchParams(location.search);if(!t.has("code")&&!t.has("error"))return null;const n=sessionStorage.getItem(lr);if(sessionStorage.removeItem(lr),history.replaceState(null,"",location.pathname+location.hash),t.has("error")){const i=t.get("error_description");return`Sign-in failed: ${t.get("error")}${i?`. ${i}`:""}`}let r=null;try{r=JSON.parse(n??"null")}catch{}if(!r?.state||r.state!==t.get("state"))return"Sign-in failed: state mismatch. Start again from this page.";if(!e?.oauth||!r.tokenEndpoint||!r.verifier)return"Sign-in failed: the gateway no longer advertises the issuer this flow started against.";const s=new URLSearchParams({grant_type:"authorization_code",code:t.get("code")??"",redirect_uri:ta(),client_id:e.oauth.clientId,code_verifier:r.verifier});e.resource&&s.set("resource",e.resource);try{const i=await fetch(r.tokenEndpoint,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s}),a=await i.json();if(!i.ok||!a.access_token){const o=a.error_description?`: ${a.error_description}`:"";return`Token exchange failed: ${a.error??`HTTP ${i.status}`}${o}`}return Jo(a.access_token,"signed-in"),null}catch(i){return`Token exchange failed: ${i.message}`}}let na=null;function Yu(e,t){na=t}const Xu=()=>na,ra=["auth-hint"],sa=ne({state:void 0,error:null,isPending:!0});function Cn(){return te(sa)}const Zu={"/":"Overview","/upstreams":"Upstreams","/catalog":"Catalog","/test":"Test console"};function eh(e){return Zu[e]??(e.startsWith("/upstreams/")?"Upstream":"Not found")}function th(){const e=so(),t=Hr(),[n,r]=F(Xu()),{data:s=null}=Es({queryKey:ra,queryFn:ea,staleTime:1/0}),i=Es({...Qu,queryKey:["federation",t.token?"authed":"anon"]}),a=i.error instanceof Ke?i.error:null,o=W(()=>{r(null),e.invalidateQueries({queryKey:["federation"]})},[e]),l=W(()=>{r(null),Gu(s).catch(h=>r(`Sign-in failed: ${h.message}`))},[s]),c=Qo({select:h=>h.location.pathname}),d=eh(c);j(()=>{document.title=`${d} · fold console`},[d]);const u=Uu(i.data?.version);return f(sa.Provider,{value:{state:i.data,error:a,isPending:i.isPending},children:f(Mu,{mcpPath:i.data?.mcpPath,gatewayVersion:i.data?.version,children:f(Hu,{federation:i.data,version:i.data?.version,authRequired:i.data?.authRequired,hint:s,onSignIn:l,onRefresh:o,refreshing:i.isFetching,updatedAt:i.dataUpdatedAt,failed:!!a,section:d,children:[n?f(tn,{children:n}):null,a?f(tn,{children:a.message}):null,u?f(tn,{tone:"warn",children:u}):null,a?.terminal?f(Y,{title:"No federation snapshot",hint:"The gateway answered, but not with data this principal may read."}):f(Vo,{})]})})})}function nh(){return f(Y,{title:"No such page",hint:"That route is not part of the console. Pick a section from the sidebar."})}const ot=uu({component:th,notFoundComponent:nh});function L({label:e,value:t,tone:n,wrap:r}){return f("div",{class:"card",children:[f("span",{class:"label",children:e}),f("b",{class:[n,r?"wrap":""].filter(Boolean).join(" ")||void 0,children:t})]})}function le({title:e,children:t,action:n}){return f("section",{class:"group","aria-label":e,children:[f("div",{class:"group-head",children:[f("h2",{children:e}),n]}),f("div",{class:"cards",children:t})]})}function nt({title:e,back:t,lede:n,actions:r,children:s}){return f("header",{class:"page-head",children:[t,f("div",{class:"page-head-row",children:[f("h1",{children:e}),r?f("div",{class:"page-actions",children:r}):null]}),n?f("p",{class:"muted lede",children:n}):null,s]})}const ia=ne(()=>{});function rh(){return te(ia)}const sh=3200;function ih({children:e}){const[t,n]=F([]),r=q(0),s=q(new Set),i=W((o,l="ok")=>{const c=r.current++;n(u=>u.concat({id:c,message:o,tone:l}));const d=setTimeout(()=>{n(u=>u.filter(h=>h.id!==c)),s.current.delete(d)},sh);s.current.add(d)},[]);j(()=>{const o=s.current;return()=>{for(const l of o)clearTimeout(l);o.clear()}},[]);const a=B(()=>i,[i]);return f(ia.Provider,{value:a,children:[e,f("div",{class:"toasts",role:"status","aria-live":"polite",children:t.map(o=>f("div",{class:`toast ${o.tone}`,children:o.message},o.id))})]})}function Ye({value:e,label:t,className:n}){const r=rh(),s=async()=>{try{if(!navigator.clipboard)throw new Error("needs a secure context (https or localhost)");await navigator.clipboard.writeText(e),r(`${t} copied`)}catch(i){r(`Copy failed: ${i.message}`,"bad")}};return f("button",{type:"button",class:n?`copy ${n}`:"copy",onClick:s,disabled:!e,title:`Copy ${t.toLowerCase()}`,"aria-label":`Copy ${t.toLowerCase()}`,children:"Copy"})}const oh="https://docs.fold.run",ah={configuration:"configuration/",upstreams:"configuration/#upstreams-required",policy:"configuration/#policy",auth:"configuration/#auth-gateway-authentication",observability:"operations/",tenancy:"tenancy/",discovery:"discovery/"};function ch(e){return`${oh}/${ah[e]}`}function ht({topic:e,children:t}){return f("a",{class:"group-action",href:ch(e),rel:"noopener",children:[t," →"]})}function ui({count:e=4}){return f("div",{class:"cards","aria-hidden":"true",children:Array.from({length:e},(t,n)=>f("div",{class:"card skeleton-card",children:[f("span",{class:"skeleton skeleton-label"}),f("span",{class:"skeleton skeleton-value"})]},n))})}function lh({columns:e,rows:t=3}){return f(I,{children:Array.from({length:t},(n,r)=>f("tr",{"aria-hidden":"true",children:Array.from({length:e},(s,i)=>f("td",{children:f("span",{class:"skeleton skeleton-cell"})},i))},r))})}const rt="—";function K(e){return e==null||e===""?rt:String(e)}function Rt(e){return e===void 0?rt:e<1e3?`${e} ms`:`${(e/1e3).toFixed(2)} s`}function ur(e){if(!e)return rt;const t=[e.org,e.team].filter(Boolean);return t.length?t.join(" / "):rt}function uh(e){if(!e)return rt;const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{year:"numeric",month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}function hh(e){return e?e%1e3===0?`${e/1e3} s`:`${e} ms`:"30 s (default)"}function hr(e){try{return JSON.stringify(e,null,2)??String(e)}catch{return String(e)}}function oa(e,t){const n=t.trim().toLowerCase();return n?e.some(r=>r?.toLowerCase().includes(n)):!0}function dh(){const{state:e,isPending:t}=Cn();if(!e)return t?f(I,{children:[f(nt,{title:"Overview"}),f("section",{class:"group","aria-label":"Loading",children:[f("p",{class:"visually-hidden",role:"status",children:"Reading the federation snapshot."}),f(ui,{count:5})]}),f("section",{class:"group","aria-hidden":"true",children:f(ui,{count:3})})]}):f(Y,{title:"No federation snapshot",hint:"Check that server.introspection.enabled is set on the gateway."});const n=e.upstreams.filter(s=>s.connected).length,r=e.upstreams.length;return f(I,{children:[f(nt,{title:"Overview",lede:"The gateway's own view of its configuration and federation.",actions:f(ht,{topic:"configuration",children:"Configuration"})}),f(fh,{state:e}),f(le,{title:"Gateway",children:[f(L,{label:"version",value:K(e.version)}),f(L,{label:"endpoint",value:f(I,{children:[e.mcpPath,f(Ye,{value:e.mcpPath,label:"MCP path"})]})}),f(L,{label:"auth",value:(e.authRequired?"required":"disabled")+(e.emaEnabled?" + EMA":""),tone:e.authRequired?void 0:"warn"}),f(L,{label:"state",value:e.sharedState?"shared (Redis)":"in-process"}),e.passthrough?f(L,{label:"mode",value:"passthrough",tone:"warn"}):null,ci(e.version,"consoleSource")&&e.consoleSource?f(L,{label:"console build",value:e.consoleSource.slice(0,12)}):null]}),f(le,{title:"Federation",action:f(X,{to:"/upstreams",className:"group-action",children:"All upstreams →"}),children:[f(L,{label:"upstreams",value:`${e.staticUpstreams} static + ${e.discoveredUpstreams} discovered`}),f(L,{label:"connected",value:`${n} / ${r}`,tone:r===0?"warn":n===r?"ok":"bad"}),f(L,{label:"routing",value:`sep ${e.namespaceSeparator} · ${e.pageSize?`page size ${e.pageSize}`:"no pagination"}`})]}),f(le,{title:"Governance",action:f(ht,{topic:"policy",children:"Policy docs"}),children:[f(L,{label:"policy",value:`${e.policyDefaultDecision}, ${e.policyRules} rule(s)`,tone:e.policyDefaultDecision==="deny"?void 0:"warn"}),e.globalRequestsPerMinute?f(L,{label:"rate limit",value:`${e.globalRequestsPerMinute}/min global`+(e.perPrincipalRequestsPerMinute?` · ${e.perPrincipalRequestsPerMinute}/min per principal`:"")}):null,e.viewerGroups?.length?f(L,{label:"viewers",value:e.viewerGroups.join(", "),wrap:!0}):null]}),e.tenant&&ci(e.version,"tenantGovernance")?f(le,{title:"Your tenant",children:[f(L,{label:"tenant",value:e.tenant}),e.tenantRequestsPerMinute?f(L,{label:"requests",value:`${e.tenantRequestsPerMinute}/min`}):null,e.tenantUpstreamCalls?f(L,{label:"budget",value:`${e.tenantUpstreamCalls} calls/${K(e.tenantBudgetPeriod)}`}):null]}):null,f(le,{title:"Observability",action:f(ht,{topic:"observability",children:"Observability docs"}),children:[f(L,{label:"audit",value:e.auditSinks.length?e.auditSinks.join(" + "):"none",tone:e.auditSinks.length?void 0:"warn"}),f(L,{label:"tracing",value:e.tracingEnabled?"OTLP":"off"})]}),e.discovery?f(le,{title:"Discovery",action:f(ht,{topic:"discovery",children:"Discovery docs"}),children:[f(L,{label:"source",value:e.discovery.url,wrap:!0}),f(L,{label:"interval",value:hh(e.discovery.intervalMs)}),e.discovery.lastOutcome?f(L,{label:"last sync",value:`${e.discovery.lastOutcome} · ${uh(e.discovery.lastSyncAt)}`,tone:e.discovery.lastOutcome==="applied"||e.discovery.lastOutcome==="unchanged"?"ok":"bad",wrap:!0}):f(L,{label:"last sync",value:"not yet run",tone:"warn"})]}):null]})}function fh({state:e}){const t=e.upstreams.filter(r=>!r.connected),n=e.upstreams.filter(r=>r.connected&&r.breaker==="open");return t.length===0&&n.length===0?null:f(tn,{tone:t.length?"bad":"warn",announce:!1,children:t.length?f(I,{children:[t.length===1?`${t[0]?.id} is not connected`:`${t.length} upstreams are not connected`,n.length?`, and ${n.length===1?"one more has":`${n.length} more have`} an open breaker`:"","."," ",f(X,{to:"/upstreams",search:{status:"disconnected"},children:"Show them"})]}):f(I,{children:[n.length===1?`${n[0]?.id} is connected but its breaker is open`:`${n.length} upstreams are connected but their breakers are open`,n.length===1?". Calls to it fail fast rather than being tried.":". Calls to them fail fast rather than being tried."," ",f(X,{to:"/upstreams",children:"Show the federation"})]})})}const ph=It({getParentRoute:()=>ot,path:"/",component:dh});function aa(e,t,n,r="asc"){const s=t.find(a=>a.key===n);if(!s)return e;const i=r==="desc"?-1:1;return e.slice().sort((a,o)=>{const l=s.value(a),c=s.value(o);return typeof l=="number"&&typeof c=="number"?(l-c)*i:String(l).localeCompare(String(c),void 0,{numeric:!0})*i})}function Wr({columns:e,rows:t,rowKey:n,sort:r,dir:s="asc",onSort:i,empty:a,caption:o,loading:l}){return f("div",{class:"tablewrap",children:f("table",{children:[o?f("caption",{class:"visually-hidden",children:o}):null,f("thead",{children:f("tr",{children:e.map(c=>{const d=r===c.key,u=i&&c.sortable!==!1;return f("th",{"aria-sort":d?s==="asc"?"ascending":"descending":void 0,children:c.headerHidden?f("span",{class:"visually-hidden",children:c.header}):u?f("button",{type:"button",class:"th-sort",onClick:()=>i(c.key),children:[c.header,f("span",{class:"sort-mark","aria-hidden":"true",children:d?s==="asc"?"↑":"↓":""})]}):c.header},c.key)})})}),f("tbody",{children:l?f(lh,{columns:e.length}):t.length===0?f("tr",{children:f("td",{class:"empty-cell",colSpan:e.length,children:a})}):t.map(c=>f("tr",{children:e.map(d=>f("td",{class:[d.tone?.(c),d.wrap?"wrap":""].filter(Boolean).join(" ")||void 0,children:d.render?d.render(c):d.value(c)},d.key))},n(c)))})]})})}function Vr({options:e,value:t,onChange:n,label:r}){return f("div",{class:"seg",role:"group","aria-label":r,children:e.map(s=>f("button",{type:"button",class:s.value===t?"active":void 0,"aria-pressed":s.value===t,disabled:s.disabled,onClick:()=>n(s.value),children:[s.label,s.count===void 0?null:f("span",{class:"seg-count",children:s.count})]},s.value))})}const jn=980,hi=20,Ee=34,ca=12,He=Ee+ca,me=268,dr=300,_e=26,Te=108,dt=76,di=me+dr+18,_h=40;function mh(e,t,n){if(t<2)return n;const r=dt-26;return n-r/2+r*e/(t-1)}const gh=.6;function Wt(e,t,n){const r=Math.floor(t/(n*gh));return e.length<=r?e:`${e.slice(0,Math.max(1,r-1))}…`}function Vt(e){return e.connected&&(e.breaker==="closed"||!e.breaker)?"live":!e.connected||e.breaker==="open"?"down":"idle"}function fi(e){const t=e.connected?"connected":"not connected",n=e.breaker?`, breaker ${e.breaker}`:"",r=e.connected?`, ${Rt(e.latencyMs)}`:e.error?`, ${e.error}`:"";return`${e.id}: ${t}${n}${r}`}function yh({state:e,upstreams:t}){const n=t.slice(0,_h),r=t.length-n.length,s=n.length*He-ca,i=Math.max(s,dt),a=i+hi*2,o=hi+(i-s)/2,l=a/2,c=_e+Te/2,d=t.filter(h=>Vt(h)==="live").length,u=`${t.length} upstream${t.length===1?"":"s"} behind one gateway endpoint at ${e.mcpPath}; ${d} connected. Every route crosses the gateway's auth, policy and audit boundary.`;return f("figure",{class:"topology",children:[f("p",{class:"visually-hidden",children:[u," Each upstream links to its detail page; the same data is in the table view."]}),f("div",{class:"topology-scroll",children:f("svg",{class:"topology-svg",viewBox:`0 0 ${jn} ${a}`,width:jn,height:a,children:[n.map((h,p)=>{const m=o+p*He+Ee/2,_=mh(p,n.length,l),g=`M ${_e+Te} ${_} C ${_e+Te+64} ${_}, ${me-64} ${m}, ${me} ${m}`,y=Vt(h);return f("path",{class:y==="live"?"fold-active":y==="down"?"fold-broken":"fold-dash",d:g},h.id)}),n.map((h,p)=>Vt(h)==="live"?f("path",{class:"fold-arrow",d:`M ${me-12} ${o+p*He+Ee/2-6} L ${me} ${o+p*He+Ee/2} L ${me-12} ${o+p*He+Ee/2+6} Z`},`a-${h.id}`):null),f("path",{class:"fold-notch",d:`M ${_e-8} ${l-8} v 16 M ${_e-4} ${l-11} v 22`}),f("path",{class:"fold-notch",d:`M ${_e+Te+4} ${l-11} v 22 M ${_e+Te+8} ${l-8} v 16`}),f("g",{children:[f("title",{children:`fold gateway, ${e.mcpPath}`}),f("rect",{class:"fold-gate",x:_e,y:l-dt/2,width:Te,height:dt,rx:"2"}),f("path",{class:"fold-node-mark",d:zo,transform:Pu(c,l-8,56)}),f("text",{class:"fold-anno",x:c,y:l+18,"text-anchor":"middle",children:Wt(e.mcpPath,Te-12,11)})]}),f("text",{class:"fold-anno",x:c,y:l+dt/2+16,"text-anchor":"middle",children:Wt(`${e.policyDefaultDecision} · ${e.policyRules} rules`,150,11)}),n.map((h,p)=>{const m=o+p*He,_=m+Ee/2,g=Vt(h),y=h.namespace?`${h.namespace}${e.namespaceSeparator}*`:h.id,v=h.connected?h.breaker&&h.breaker!=="closed"?`${Rt(h.latencyMs)} · breaker ${h.breaker}`:Rt(h.latencyMs):h.error??"not connected";return f("a",{class:"fold-link",href:`#/upstreams/${encodeURIComponent(h.id)}`,"aria-label":fi(h),children:[f("title",{children:fi(h)}),f("rect",{class:"fold-node",x:me,y:m,width:dr,height:Ee,rx:"2"}),f("text",{class:"fold-node-label",x:me+14,y:_+5,children:Wt(y,dr-28,14)}),f("text",{class:`fold-anno ${g==="down"?"is-down":""}`,x:di,y:_+4,children:Wt(v,jn-di-8,11)})]},h.id)})]})}),f("figcaption",{class:"muted topology-caption",children:[d," of ",t.length," connected",r>0?` · ${r} more not drawn, see the table`:""," · every route crosses auth, policy and audit"]})]})}function vh(e){const t=(s,i)=>typeof s=="string"&&i.includes(s)?s:void 0,n=typeof e.q=="string"&&e.q?e.q:void 0,r=typeof e.sort=="string"&&e.sort?e.sort:void 0;return{...e.view==="map"?{view:"map"}:{},...n?{q:n}:{},...r?{sort:r}:{},...t(e.source,["static","discovered"])?{source:t(e.source,["static","discovered"])}:{},...t(e.status,["connected","disconnected"])?{status:t(e.status,["connected","disconnected"])}:{},...t(e.dir,["asc","desc"])?{dir:t(e.dir,["asc","desc"])}:{}}}const bh=e=>e.breaker==="closed"?"ok":e.breaker==="open"?"bad":"warn";function wh(){const{state:e,isPending:t}=Cn(),n=fr.useSearch(),r=it({from:fr.fullPath}),s=u=>{r({search:h=>({...h,...u}),replace:!0})},i=B(()=>[{key:"id",header:"Upstream",value:u=>u.id,render:u=>f(X,{to:"/upstreams/$id",params:{id:u.id},className:"cell-link",children:u.id})},{key:"namespace",header:"Namespace",value:u=>u.namespace??"",render:u=>K(u.namespace)},{key:"source",header:"Source",value:u=>u.source??"",render:u=>K(u.source)},{key:"auth",header:"Auth",value:u=>u.authStrategy??"",render:u=>K(u.authStrategy)},{key:"connected",header:"Connected",value:u=>u.connected?1:0,render:u=>u.connected?"yes":"no",tone:u=>u.connected?"ok":"bad"},{key:"breaker",header:"Breaker",value:u=>u.breaker??"",render:u=>K(u.breaker),tone:u=>u.breaker==="closed"?void 0:bh(u)},{key:"latency",header:"Latency",value:u=>u.connected?u.latencyMs??0:Number.MAX_SAFE_INTEGER,render:u=>u.connected?Rt(u.latencyMs):K(u.error),tone:u=>u.connected?void 0:"warn",wrap:!0},{key:"owner",header:"Owner",value:u=>ur(u.owner),render:u=>ur(u.owner)}],[]),a=e?.upstreams??[],o=B(()=>{const u=a.filter(h=>n.source&&h.source!==n.source||n.status==="connected"&&!h.connected||n.status==="disconnected"&&h.connected?!1:oa([h.id,h.namespace,h.url,h.authStrategy,h.owner?.org,h.owner?.team,...Object.entries(h.labels??{}).map(([p,m])=>`${p}=${m}`)],n.q??""));return aa(u,i,n.sort,n.dir??"asc")},[a,i,n.q,n.source,n.status,n.sort,n.dir]),l=u=>{n.sort===u?s({dir:n.dir==="asc"?"desc":"asc"}):s({sort:u,dir:"asc"})},c=!!(n.q||n.source||n.status),d=n.view==="map"?"map":"table";return f(I,{children:[f(nt,{title:"Upstreams",lede:"Every MCP server this gateway federates, as the gateway last saw it.",actions:f(ht,{topic:"upstreams",children:"Upstream config"}),children:f("div",{class:"filters",children:[f(Vr,{label:"View",value:d,onChange:u=>s({view:u==="map"?"map":void 0}),options:[{value:"table",label:"Table"},{value:"map",label:"Map"}]}),f("input",{type:"search",class:"filter-text",placeholder:"Filter by id, namespace, URL, owner, label…","aria-label":"Filter upstreams",value:n.q??"",onInput:u=>s({q:u.target.value||void 0})}),f("select",{class:"filter-select","aria-label":"Source",value:n.source??"",onChange:u=>s({source:u.target.value||void 0}),children:[f("option",{value:"",children:"Any source"}),f("option",{value:"static",children:"Static"}),f("option",{value:"discovered",children:"Discovered"})]}),f("select",{class:"filter-select","aria-label":"Connection status",value:n.status??"",onChange:u=>s({status:u.target.value||void 0}),children:[f("option",{value:"",children:"Any status"}),f("option",{value:"connected",children:"Connected"}),f("option",{value:"disconnected",children:"Disconnected"})]}),f("output",{class:"muted count","aria-live":"polite",children:[o.length," of ",a.length]})]})}),d==="map"&&e&&o.length>0?f(yh,{state:e,upstreams:o}):f(Wr,{caption:"Federated upstreams",columns:i,rows:o,rowKey:u=>u.id,sort:n.sort,dir:n.dir??"asc",onSort:l,loading:t,empty:c?f(Y,{title:"No upstream matches this filter",hint:f("button",{type:"button",class:"linkish",onClick:()=>s({q:void 0,source:void 0,status:void 0}),children:"Clear the filter"})}):f(Y,{title:"No upstreams in the federation",hint:"Add one under `upstreams` in the gateway config, or enable discovery."})})]})}const fr=It({getParentRoute:()=>ot,path:"/upstreams",validateSearch:vh,component:wh});function pr({title:e,text:t,placeholder:n,tall:r,copyLabel:s,actions:i,follow:a}){const o=q(null),l=q(!0),c=()=>{const d=o.current;d&&(l.current=d.scrollHeight-d.scrollTop-d.clientHeight<48)};return j(()=>{const d=o.current;!a||!d||!l.current||(d.scrollTop=d.scrollHeight)},[a,t]),f("section",{class:"pane-block","aria-label":e,children:[f("div",{class:"pane-head",children:[f("h3",{children:e}),f("div",{class:"pane-actions",children:[i,f(Ye,{value:t,label:s??e})]})]}),f("pre",{ref:o,class:r?"pane tall":"pane",tabIndex:0,onScroll:a?c:void 0,children:t||n})]})}const Sh=[{key:"url",header:"Endpoint",value:e=>e.url??"",render:e=>K(e.url),wrap:!0},{key:"healthy",header:"Health",value:e=>e.healthy?1:0,render:e=>e.healthy?"healthy":"unhealthy",tone:e=>e.healthy?"ok":"bad",sortable:!1}];function Ph(){const{id:e}=la.useParams(),{state:t,isPending:n}=Cn();if(!t)return f(Y,{title:n?"Reading the federation snapshot…":"No federation snapshot"});const r=t.upstreams.find(i=>i.id===e);if(!r)return f(Y,{title:`No upstream "${e}" in this federation`,hint:f(I,{children:["It may have been removed, or it may sit outside the visibility your tenant is granted."," ",f(X,{to:"/upstreams",children:"Back to upstreams"})]})});const s=Object.entries(r.labels??{});return f(I,{children:[f(nt,{title:r.id,back:f(X,{to:"/upstreams",className:"back",children:"← Upstreams"}),actions:f(Ye,{value:r.id,label:"Upstream ID"})}),f(le,{title:"Status",children:[f(L,{label:"connected",value:r.connected?"yes":"no",tone:r.connected?"ok":"bad"}),f(L,{label:"breaker",value:K(r.breaker),tone:r.breaker==="closed"?"ok":r.breaker==="open"?"bad":"warn"}),f(L,{label:"latency",value:r.connected?Rt(r.latencyMs):rt}),r.error?f(L,{label:"error",value:r.error,tone:"bad",wrap:!0}):null]}),f(le,{title:"Configuration",children:[f(L,{label:"namespace",value:K(r.namespace)}),f(L,{label:"source",value:K(r.source)}),f(L,{label:"auth strategy",value:K(r.authStrategy)}),r.url?f(L,{label:"url",value:f(I,{children:[r.url,f(Ye,{value:r.url,label:"Upstream URL"})]}),wrap:!0}):null]}),f(le,{title:"Ownership",children:[f(L,{label:"owner",value:ur(r.owner)}),r.owner?.contact?f(L,{label:"contact",value:f(I,{children:[r.owner.contact,f(Ye,{value:r.owner.contact,label:"Contact"})]}),wrap:!0}):null]}),f("section",{class:"group",children:[f("div",{class:"group-head",children:f("h2",{children:"Labels"})}),s.length?f("div",{class:"chips",children:s.map(([i,a])=>f("span",{class:"chip",children:[i,"=",a]},i))}):f("p",{class:"muted",children:"No labels on this upstream."})]}),f("section",{class:"group",children:[f("div",{class:"group-head",children:f("h2",{children:"Endpoints"})}),f(Wr,{caption:`Endpoints for ${r.id}`,columns:Sh,rows:r.endpoints??[],rowKey:i=>i.url??"endpoint",empty:f(Y,{title:"Single endpoint",hint:"This upstream is not load-balanced, so the balancer reports no per-replica view."})})]}),f(pr,{title:"Raw record",copyLabel:"Raw record",text:hr(r),placeholder:""})]})}const la=It({getParentRoute:()=>ot,path:"/upstreams/$id",component:Ph});function Ch(e){const t=Mt.includes(e.mode)?e.mode:void 0,n=typeof e.q=="string"&&e.q?e.q:void 0,r=typeof e.sort=="string"&&e.sort?e.sort:void 0,s=e.dir==="asc"||e.dir==="desc"?e.dir:void 0;return{...t?{mode:t}:{},...n?{q:n}:{},...r?{sort:r}:{},...s?{dir:s}:{}}}function Kt(e,t){const n=t?e.indexOf(t):-1;return n<=0?{namespace:"",local:e}:{namespace:e.slice(0,n),local:e.slice(n+t.length)}}function Rh(){const{state:e}=Cn(),t=qr(),n=_r.useSearch(),r=it({from:_r.fullPath}),s=n.mode??"tools",i=e?.namespaceSeparator??"",a=u=>{r({search:h=>({...h,...u}),replace:!0})},o=B(()=>[{key:"name",header:s==="resources"?"URI":"Name",value:u=>Kt(G(s,u),i).local,render:u=>f(X,{to:"/test",search:{mode:s,item:G(s,u)},className:"cell-link",title:G(s,u),children:Kt(G(s,u),i).local})},{key:"namespace",header:"Namespace",value:u=>Kt(G(s,u),i).namespace,render:u=>K(Kt(G(s,u),i).namespace)},{key:"description",header:"Description",value:u=>u.description??u.title??"",render:u=>K(u.description??u.title),wrap:!0},{key:"copy",header:"Copy",headerHidden:!0,value:()=>"",sortable:!1,render:u=>f(Ye,{value:G(s,u),label:s==="resources"?"URI":"Name"})}],[s,i]),l=t.catalog[s],c=B(()=>{const u=l.filter(h=>oa([G(s,h),h.title,h.description,h.mimeType],n.q??""));return aa(u,o,n.sort,n.dir??"asc")},[l,o,s,n.q,n.sort,n.dir]),d=u=>{n.sort===u?a({dir:n.dir==="asc"?"desc":"asc"}):a({sort:u,dir:"asc"})};return f(I,{children:[f(nt,{title:"Catalog",lede:"Tools, prompts and resources visible to this principal: the same list any MCP client would receive.",actions:f("button",{type:"button",class:t.status==="ready"?void 0:"primary",onClick:t.connect,disabled:t.status==="connecting",children:t.status==="connecting"?"Connecting…":t.status==="ready"?"Reload catalog":"Connect & list"}),children:f("div",{class:"filters",children:[f(Vr,{label:"Capability",value:s,onChange:u=>a({mode:u,sort:void 0,dir:void 0}),options:Mt.map(u=>({value:u,label:Fe[u].label,count:t.status==="ready"?t.catalog[u].length:void 0}))}),f("input",{type:"search",class:"filter-text",placeholder:"Filter by name, description, namespace…","aria-label":"Filter catalog",value:n.q??"",disabled:t.status!=="ready",onInput:u=>a({q:u.target.value||void 0})}),t.status==="ready"?f("output",{class:"muted count","aria-live":"polite",children:[c.length," of ",l.length]}):null]})}),f(Wr,{caption:`${Fe[s].label} visible to this principal`,columns:o,rows:t.status==="ready"?c:[],rowKey:u=>G(s,u),sort:n.sort,dir:n.dir??"asc",onSort:d,empty:kh(t.status,t.error,l.length,!!n.q,s)})]})}function kh(e,t,n,r,s){return e==="connecting"?"Connecting to the gateway…":e==="error"?f(Y,{title:"Could not list the catalog",hint:t??void 0}):e==="idle"?f(Y,{title:"Not connected",hint:"Connect to open an MCP session against the gateway and list what this principal may see."}):r&&n?f(Y,{title:"Nothing matches this filter"}):f(Y,{title:`No ${Fe[s].label.toLowerCase()} visible`,hint:"Either no federated server exposes any, or policy denies this principal every one of them."})}const _r=It({getParentRoute:()=>ot,path:"/catalog",validateSearch:Ch,component:Rh});function xh(e){const t=Mt.includes(e.mode)?e.mode:void 0,n=typeof e.item=="string"&&e.item?e.item:void 0;return{...t?{mode:t}:{},...n?{item:n}:{}}}function Th(){const e=qr(),t=mr.useSearch(),n=it({from:mr.fullPath}),r=t.mode??"tools",s=Fe[r],i=e.catalog[r],a=t.item&&i.some(w=>G(r,w)===t.item)?t.item:i[0]?G(r,i[0]):"",o=i.find(w=>G(r,w)===a),[l,c]=F(""),[d,u]=F(""),[h,p]=F(null),[m,_]=F(!1);j(()=>{c(s.args?Ou(o):""),u(""),p(null)},[r,a,s.args,o]);const g=w=>{n({search:R=>({...R,...w}),replace:!0})},y=B(()=>e.wire.map(w=>`${w.direction} ${hr(w.message)}`).join(` -`),[e.wire]),y=async()=>{if(!e.client||!a)return;p(null),u("");let b={};if(s.args){const R=l.trim();if(R)try{b=JSON.parse(R)}catch(P){p(`Arguments are not valid JSON: ${P.message}`);return}}_(!0);try{u(hr(await e.client.invoke(r,a,b)))}catch(R){u(R.message)}finally{_(!1)}},S=e.status!=="ready";return f(M,{children:[f(nt,{title:"Test console",lede:"Calls go through the gateway's own MCP endpoint, so policy, rate limits and audit apply exactly as they do for any other client.",actions:f("button",{type:"button",class:e.status==="ready"?void 0:"primary",onClick:e.connect,disabled:e.status==="connecting",children:e.status==="connecting"?"Connecting…":e.status==="ready"?"Reconnect":"Connect & list"})}),e.status==="error"?f("p",{class:"banner bad",role:"alert",children:e.error}):null,S&&e.status!=="connecting"?f(Y,{title:e.status==="error"?"No MCP session":"Not connected",hint:f(M,{children:["Opening a session lists the tools, prompts and resources this principal can reach."," ",f(te,{to:"/catalog",children:"Browse the catalog"})," to see them as a searchable list."]})}):null,S?null:f(M,{children:[f("div",{class:"filters",children:[f(Wr,{label:"What to invoke",value:r,onChange:b=>g({mode:b,item:void 0}),options:Mt.map(b=>({value:b,label:Fe[b].label,count:e.status==="ready"?e.catalog[b].length:void 0,disabled:S}))}),f(te,{to:"/catalog",search:{mode:r},className:"linkish",children:"Browse the catalog →"})]}),f("label",{class:"field",children:[f("span",{class:"field-label",children:r==="resources"?"Resource":r==="prompts"?"Prompt":"Tool"}),f("select",{value:a,disabled:S||i.length===0,onChange:b=>g({item:b.target.value}),children:[i.length===0?f("option",{value:"",children:"Nothing available"}):null,i.map(b=>{const R=G(r,b);return f("option",{value:R,children:r==="resources"&&b.name?`${R} (${b.name})`:R},R)})]})]}),o?.description?f("p",{class:"itemdesc muted",children:o.description}):null,f("label",{class:"field",children:[f("span",{class:"field-label",children:["Arguments",o?.inputSchema?.required?.length?f("span",{class:"muted",children:[" · required: ",o.inputSchema.required.join(", ")]}):null]}),f("textarea",{rows:8,spellcheck:!1,disabled:S||!s.args,value:l,placeholder:s.args?'{"argument": "value"}':"resources/read takes no arguments. The URI is the identity.",onInput:b=>c(b.target.value)})]}),h?f("p",{class:"banner bad",role:"alert",children:h}):null,f("div",{class:"row",children:f("button",{type:"button",class:"primary",disabled:S||!a||m,onClick:()=>{y()},children:m?"Calling…":s.verb})}),f(pr,{title:"Result",copyLabel:"Result",text:d,placeholder:"Nothing yet. Call something and the result lands here."}),f(pr,{title:"Wire log",copyLabel:"Wire log",text:v,placeholder:"Every JSON-RPC message this session sends and receives appears here.",tall:!0,follow:!0,actions:f("button",{type:"button",class:"copy",onClick:e.clearWire,disabled:e.wire.length===0,children:"Clear"})})]})]})}const mr=Lt({getParentRoute:()=>it,path:"/test",validateSearch:Ch,component:Rh}),kh=it.addChildren([hh,fr,la,_r,mr]),xh=vu({routeTree:kh,history:_l(),defaultPreload:!1}),ua=new Ya({defaultOptions:{queries:{refetchOnWindowFocus:!0,staleTime:5e3,retry:1}}});function Th(){return f(fc,{client:ua,children:f(rh,{children:f(Su,{router:xh})})})}async function Eh(){const e=await ea(),t=await zu(e);Gu(e,t),ua.setQueryData(ra,e);const n=document.getElementById("app");if(!n)throw new Error("#app is missing from index.html");Xe(f(Th,{}),n)}Eh(); +`),[e.wire]),v=async()=>{if(!e.client||!a)return;p(null),u("");let w={};if(s.args){const R=l.trim();if(R)try{w=JSON.parse(R)}catch(S){p(`Arguments are not valid JSON: ${S.message}`);return}}_(!0);try{u(hr(await e.client.invoke(r,a,w)))}catch(R){u(R.message)}finally{_(!1)}},P=e.status!=="ready";return f(I,{children:[f(nt,{title:"Test console",lede:"Calls go through the gateway's own MCP endpoint, so policy, rate limits and audit apply exactly as they do for any other client.",actions:f("button",{type:"button",class:e.status==="ready"?void 0:"primary",onClick:e.connect,disabled:e.status==="connecting",children:e.status==="connecting"?"Connecting…":e.status==="ready"?"Reconnect":"Connect & list"})}),e.status==="error"?f("p",{class:"banner bad",role:"alert",children:e.error}):null,P&&e.status!=="connecting"?f(Y,{title:e.status==="error"?"No MCP session":"Not connected",hint:f(I,{children:["Opening a session lists the tools, prompts and resources this principal can reach."," ",f(X,{to:"/catalog",children:"Browse the catalog"})," to see them as a searchable list."]})}):null,P?null:f(I,{children:[f("div",{class:"filters",children:[f(Vr,{label:"What to invoke",value:r,onChange:w=>g({mode:w,item:void 0}),options:Mt.map(w=>({value:w,label:Fe[w].label,count:e.status==="ready"?e.catalog[w].length:void 0,disabled:P}))}),f(X,{to:"/catalog",search:{mode:r},className:"linkish",children:"Browse the catalog →"})]}),f("label",{class:"field",children:[f("span",{class:"field-label",children:r==="resources"?"Resource":r==="prompts"?"Prompt":"Tool"}),f("select",{value:a,disabled:P||i.length===0,onChange:w=>g({item:w.target.value}),children:[i.length===0?f("option",{value:"",children:"Nothing available"}):null,i.map(w=>{const R=G(r,w);return f("option",{value:R,children:r==="resources"&&w.name?`${R} (${w.name})`:R},R)})]})]}),o?.description?f("p",{class:"itemdesc muted",children:o.description}):null,f("label",{class:"field",children:[f("span",{class:"field-label",children:["Arguments",o?.inputSchema?.required?.length?f("span",{class:"muted",children:[" · required: ",o.inputSchema.required.join(", ")]}):null]}),f("textarea",{rows:8,spellcheck:!1,disabled:P||!s.args,value:l,placeholder:s.args?'{"argument": "value"}':"resources/read takes no arguments. The URI is the identity.",onInput:w=>c(w.target.value)})]}),h?f("p",{class:"banner bad",role:"alert",children:h}):null,f("div",{class:"row",children:f("button",{type:"button",class:"primary",disabled:P||!a||m,onClick:()=>{v()},children:m?"Calling…":s.verb})}),f(pr,{title:"Result",copyLabel:"Result",text:d,placeholder:"Nothing yet. Call something and the result lands here."}),f(pr,{title:"Wire log",copyLabel:"Wire log",text:y,placeholder:"Every JSON-RPC message this session sends and receives appears here.",tall:!0,follow:!0,actions:f("button",{type:"button",class:"copy",onClick:e.clearWire,disabled:e.wire.length===0,children:"Clear"})})]})]})}const mr=It({getParentRoute:()=>ot,path:"/test",validateSearch:xh,component:Th}),Eh=ot.addChildren([ph,fr,la,_r,mr]),Oh=vu({routeTree:Eh,history:_l(),defaultPreload:!1}),ua=new Ya({defaultOptions:{queries:{refetchOnWindowFocus:!0,staleTime:5e3,retry:1}}});function Lh(){return f(fc,{client:ua,children:f(ih,{children:f(Su,{router:Oh})})})}async function Ih(){const e=await ea(),t=await Ju(e);Yu(e,t),ua.setQueryData(ra,e);const n=document.getElementById("app");if(!n)throw new Error("#app is missing from index.html");Xe(f(Lh,{}),n)}Ih();