var ex=Object.defineProperty;var kp=e=>{throw TypeError(e)};var tx=(e,t,n)=>t in e?ex(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Rp=(e,t,n)=>tx(e,typeof t!="symbol"?t+"":t,n),$u=(e,t,n)=>t.has(e)||kp("Cannot "+n);var F=(e,t,n)=>($u(e,t,"read from private field"),n?n.call(e):t.get(e)),de=(e,t,n)=>t.has(e)?kp("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),ee=(e,t,n,r)=>($u(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),et=(e,t,n)=>($u(e,t,"access private method"),n);var As=(e,t,n,r)=>({set _(o){ee(e,t,o,n)},get _(){return F(e,t,r)}});function Ag(e,t){for(var n=0;nr[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(o){if(o.ep)return;o.ep=!0;const i=n(o);fetch(o.href,i)}})();var Ni=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function bl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Sr(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?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 o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}),n}var jg={exports:{}},wl={},Dg={exports:{}},te={};/** * @license React * react.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var ks=Symbol.for("react.element"),nx=Symbol.for("react.portal"),rx=Symbol.for("react.fragment"),ox=Symbol.for("react.strict_mode"),ix=Symbol.for("react.profiler"),sx=Symbol.for("react.provider"),ax=Symbol.for("react.context"),lx=Symbol.for("react.forward_ref"),ux=Symbol.for("react.suspense"),cx=Symbol.for("react.memo"),dx=Symbol.for("react.lazy"),Op=Symbol.iterator;function fx(e){return e===null||typeof e!="object"?null:(e=Op&&e[Op]||e["@@iterator"],typeof e=="function"?e:null)}var zg={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Bg=Object.assign,Ug={};function oi(e,t,n){this.props=e,this.context=t,this.refs=Ug,this.updater=n||zg}oi.prototype.isReactComponent={};oi.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};oi.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Vg(){}Vg.prototype=oi.prototype;function qd(e,t,n){this.props=e,this.context=t,this.refs=Ug,this.updater=n||zg}var Qd=qd.prototype=new Vg;Qd.constructor=qd;Bg(Qd,oi.prototype);Qd.isPureReactComponent=!0;var _p=Array.isArray,Hg=Object.prototype.hasOwnProperty,Gd={current:null},Wg={key:!0,ref:!0,__self:!0,__source:!0};function Kg(e,t,n){var r,o={},i=null,s=null;if(t!=null)for(r in t.ref!==void 0&&(s=t.ref),t.key!==void 0&&(i=""+t.key),t)Hg.call(t,r)&&!Wg.hasOwnProperty(r)&&(o[r]=t[r]);var a=arguments.length-2;if(a===1)o.children=n;else if(1{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},El=typeof window>"u"||"Deno"in globalThis;function rn(){}function Cx(e,t){return typeof e=="function"?e(t):e}function Ex(e){return typeof e=="number"&&e>=0&&e!==1/0}function Px(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Mp(e,t){return typeof e=="function"?e(t):e}function kx(e,t){return typeof e=="function"?e(t):e}function $p(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==Yd(s,t.options))return!1}else if(!es(t.queryKey,s))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||o&&o!==t.state.fetchStatus||i&&!i(t))}function Ip(e,t){const{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(Zi(t.options.mutationKey)!==Zi(i))return!1}else if(!es(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function Yd(e,t){return((t==null?void 0:t.queryKeyHashFn)||Zi)(e)}function Zi(e){return JSON.stringify(e,(t,n)=>Oc(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function es(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!es(e[n],t[n])):!1}function Gg(e,t){if(e===t)return e;const n=Lp(e)&&Lp(t);if(n||Oc(e)&&Oc(t)){const r=n?e:Object.keys(e),o=r.length,i=n?t:Object.keys(t),s=i.length,a=n?[]:{};let l=0;for(let u=0;u{setTimeout(t,e)})}function Ox(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?Gg(e,t):t}function _x(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function Tx(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Xg=Symbol();function Yg(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Xg?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var Fr,tr,Lo,_g,Mx=(_g=class extends Cl{constructor(){super();de(this,Fr);de(this,tr);de(this,Lo);ee(this,Lo,t=>{if(!El&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){F(this,tr)||this.setEventListener(F(this,Lo))}onUnsubscribe(){var t;this.hasListeners()||((t=F(this,tr))==null||t.call(this),ee(this,tr,void 0))}setEventListener(t){var n;ee(this,Lo,t),(n=F(this,tr))==null||n.call(this),ee(this,tr,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){F(this,Fr)!==t&&(ee(this,Fr,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof F(this,Fr)=="boolean"?F(this,Fr):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Fr=new WeakMap,tr=new WeakMap,Lo=new WeakMap,_g),Jg=new Mx,Fo,nr,No,Tg,$x=(Tg=class extends Cl{constructor(){super();de(this,Fo,!0);de(this,nr);de(this,No);ee(this,No,t=>{if(!El&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){F(this,nr)||this.setEventListener(F(this,No))}onUnsubscribe(){var t;this.hasListeners()||((t=F(this,nr))==null||t.call(this),ee(this,nr,void 0))}setEventListener(t){var n;ee(this,No,t),(n=F(this,nr))==null||n.call(this),ee(this,nr,t(this.setOnline.bind(this)))}setOnline(t){F(this,Fo)!==t&&(ee(this,Fo,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return F(this,Fo)}},Fo=new WeakMap,nr=new WeakMap,No=new WeakMap,Tg),Ia=new $x;function Ix(e){return Math.min(1e3*2**e,3e4)}function Zg(e){return(e??"online")==="online"?Ia.isOnline():!0}var ey=class{constructor(e){this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Lu(e){return e instanceof ey}function ty(e){let t=!1,n=0,r=!1,o,i,s;const a=new Promise((m,p)=>{i=m,s=p}),l=m=>{var p;r||(v(new ey(m)),(p=e.abort)==null||p.call(e))},u=()=>{t=!0},c=()=>{t=!1},f=()=>Jg.isFocused()&&(e.networkMode==="always"||Ia.isOnline())&&e.canRun(),d=()=>Zg(e.networkMode)&&e.canRun(),h=m=>{var p;r||(r=!0,(p=e.onSuccess)==null||p.call(e,m),o==null||o(),i(m))},v=m=>{var p;r||(r=!0,(p=e.onError)==null||p.call(e,m),o==null||o(),s(m))},y=()=>new Promise(m=>{var p;o=g=>{(r||f())&&m(g)},(p=e.onPause)==null||p.call(e)}).then(()=>{var m;o=void 0,r||(m=e.onContinue)==null||m.call(e)}),S=()=>{if(r)return;let m;const p=n===0?e.initialPromise:void 0;try{m=p??e.fn()}catch(g){m=Promise.reject(g)}Promise.resolve(m).then(h).catch(g=>{var R;if(r)return;const x=e.retry??(El?0:3),w=e.retryDelay??Ix,k=typeof w=="function"?w(n,g):w,C=x===!0||typeof x=="number"&&nf()?void 0:y()).then(()=>{t?v(g):S()})})};return{promise:a,cancel:l,continue:()=>(o==null||o(),a),cancelRetry:u,continueRetry:c,canStart:d,start:()=>(d()?S():y().then(S),a)}}function Lx(){let e=[],t=0,n=d=>{d()},r=d=>{d()},o=d=>setTimeout(d,0);const i=d=>{o=d},s=d=>{let h;t++;try{h=d()}finally{t--,t||u()}return h},a=d=>{t?e.push(d):o(()=>{n(d)})},l=d=>(...h)=>{a(()=>{d(...h)})},u=()=>{const d=e;e=[],d.length&&o(()=>{r(()=>{d.forEach(h=>{n(h)})})})};return{batch:s,batchCalls:l,schedule:a,setNotifyFunction:d=>{n=d},setBatchNotifyFunction:d=>{r=d},setScheduler:i}}var dt=Lx(),Nr,Mg,ny=(Mg=class{constructor(){de(this,Nr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Ex(this.gcTime)&&ee(this,Nr,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(El?1/0:5*60*1e3))}clearGcTimeout(){F(this,Nr)&&(clearTimeout(F(this,Nr)),ee(this,Nr,void 0))}},Nr=new WeakMap,Mg),Ao,jo,zt,ot,Es,Ar,sn,$n,$g,Fx=($g=class extends ny{constructor(t){super();de(this,sn);de(this,Ao);de(this,jo);de(this,zt);de(this,ot);de(this,Es);de(this,Ar);ee(this,Ar,!1),ee(this,Es,t.defaultOptions),this.setOptions(t.options),this.observers=[],ee(this,zt,t.cache),this.queryKey=t.queryKey,this.queryHash=t.queryHash,ee(this,Ao,t.state||Ax(this.options)),this.state=F(this,Ao),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=F(this,ot))==null?void 0:t.promise}setOptions(t){this.options={...F(this,Es),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&F(this,zt).remove(this)}setData(t,n){const r=Ox(this.state.data,t,this.options);return et(this,sn,$n).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){et(this,sn,$n).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,o;const n=(r=F(this,ot))==null?void 0:r.promise;return(o=F(this,ot))==null||o.cancel(t),n?n.then(rn).catch(rn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(F(this,Ao))}isActive(){return this.observers.some(t=>kx(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(t=0){return this.state.isInvalidated||this.state.data===void 0||!Px(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=F(this,ot))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=F(this,ot))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),F(this,zt).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(F(this,ot)&&(F(this,Ar)?F(this,ot).cancel({revert:!0}):F(this,ot).cancelRetry()),this.scheduleGc()),F(this,zt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||et(this,sn,$n).call(this,{type:"invalidate"})}fetch(t,n){var l,u,c;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(F(this,ot))return F(this,ot).continueRetry(),F(this,ot).promise}if(t&&this.setOptions(t),!this.options.queryFn){const f=this.observers.find(d=>d.options.queryFn);f&&this.setOptions(f.options)}const r=new AbortController,o=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(ee(this,Ar,!0),r.signal)})},i=()=>{const f=Yg(this.options,n),d={queryKey:this.queryKey,meta:this.meta};return o(d),ee(this,Ar,!1),this.options.persister?this.options.persister(f,d,this):f(d)},s={fetchOptions:n,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:i};o(s),(l=this.options.behavior)==null||l.onFetch(s,this),ee(this,jo,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=s.fetchOptions)==null?void 0:u.meta))&&et(this,sn,$n).call(this,{type:"fetch",meta:(c=s.fetchOptions)==null?void 0:c.meta});const a=f=>{var d,h,v,y;Lu(f)&&f.silent||et(this,sn,$n).call(this,{type:"error",error:f}),Lu(f)||((h=(d=F(this,zt).config).onError)==null||h.call(d,f,this),(y=(v=F(this,zt).config).onSettled)==null||y.call(v,this.state.data,f,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return ee(this,ot,ty({initialPromise:n==null?void 0:n.initialPromise,fn:s.fetchFn,abort:r.abort.bind(r),onSuccess:f=>{var d,h,v,y;if(f===void 0){a(new Error(`${this.queryHash} data is undefined`));return}this.setData(f),(h=(d=F(this,zt).config).onSuccess)==null||h.call(d,f,this),(y=(v=F(this,zt).config).onSettled)==null||y.call(v,f,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:a,onFail:(f,d)=>{et(this,sn,$n).call(this,{type:"failed",failureCount:f,error:d})},onPause:()=>{et(this,sn,$n).call(this,{type:"pause"})},onContinue:()=>{et(this,sn,$n).call(this,{type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0})),F(this,ot).start()}},Ao=new WeakMap,jo=new WeakMap,zt=new WeakMap,ot=new WeakMap,Es=new WeakMap,Ar=new WeakMap,sn=new WeakSet,$n=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...Nx(r.data,this.options),fetchMeta:t.meta??null};case"success":return{...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const o=t.error;return Lu(o)&&o.revert&&F(this,jo)?{...F(this,jo),fetchStatus:"idle"}:{...r,error:o,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),dt.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),F(this,zt).notify({query:this,type:"updated",action:t})})},$g);function Nx(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Zg(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Ax(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 vn,Ig,jx=(Ig=class extends Cl{constructor(t={}){super();de(this,vn);this.config=t,ee(this,vn,new Map)}build(t,n,r){const o=n.queryKey,i=n.queryHash??Yd(o,n);let s=this.get(i);return s||(s=new Fx({cache:this,queryKey:o,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(s)),s}add(t){F(this,vn).has(t.queryHash)||(F(this,vn).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=F(this,vn).get(t.queryHash);n&&(t.destroy(),n===t&&F(this,vn).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){dt.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return F(this,vn).get(t)}getAll(){return[...F(this,vn).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>$p(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>$p(t,r)):n}notify(t){dt.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){dt.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){dt.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},vn=new WeakMap,Ig),xn,ut,jr,Sn,Gn,Lg,Dx=(Lg=class extends ny{constructor(t){super();de(this,Sn);de(this,xn);de(this,ut);de(this,jr);this.mutationId=t.mutationId,ee(this,ut,t.mutationCache),ee(this,xn,[]),this.state=t.state||zx(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){F(this,xn).includes(t)||(F(this,xn).push(t),this.clearGcTimeout(),F(this,ut).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){ee(this,xn,F(this,xn).filter(n=>n!==t)),this.scheduleGc(),F(this,ut).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){F(this,xn).length||(this.state.status==="pending"?this.scheduleGc():F(this,ut).remove(this))}continue(){var t;return((t=F(this,jr))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,i,s,a,l,u,c,f,d,h,v,y,S,m,p,g,x,w,k,C;ee(this,jr,ty({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(R,I)=>{et(this,Sn,Gn).call(this,{type:"failed",failureCount:R,error:I})},onPause:()=>{et(this,Sn,Gn).call(this,{type:"pause"})},onContinue:()=>{et(this,Sn,Gn).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>F(this,ut).canRun(this)}));const n=this.state.status==="pending",r=!F(this,jr).canStart();try{if(!n){et(this,Sn,Gn).call(this,{type:"pending",variables:t,isPaused:r}),await((i=(o=F(this,ut).config).onMutate)==null?void 0:i.call(o,t,this));const I=await((a=(s=this.options).onMutate)==null?void 0:a.call(s,t));I!==this.state.context&&et(this,Sn,Gn).call(this,{type:"pending",context:I,variables:t,isPaused:r})}const R=await F(this,jr).start();return await((u=(l=F(this,ut).config).onSuccess)==null?void 0:u.call(l,R,t,this.state.context,this)),await((f=(c=this.options).onSuccess)==null?void 0:f.call(c,R,t,this.state.context)),await((h=(d=F(this,ut).config).onSettled)==null?void 0:h.call(d,R,null,this.state.variables,this.state.context,this)),await((y=(v=this.options).onSettled)==null?void 0:y.call(v,R,null,t,this.state.context)),et(this,Sn,Gn).call(this,{type:"success",data:R}),R}catch(R){try{throw await((m=(S=F(this,ut).config).onError)==null?void 0:m.call(S,R,t,this.state.context,this)),await((g=(p=this.options).onError)==null?void 0:g.call(p,R,t,this.state.context)),await((w=(x=F(this,ut).config).onSettled)==null?void 0:w.call(x,void 0,R,this.state.variables,this.state.context,this)),await((C=(k=this.options).onSettled)==null?void 0:C.call(k,void 0,R,t,this.state.context)),R}finally{et(this,Sn,Gn).call(this,{type:"error",error:R})}}finally{F(this,ut).runNext(this)}}},xn=new WeakMap,ut=new WeakMap,jr=new WeakMap,Sn=new WeakSet,Gn=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),dt.batch(()=>{F(this,xn).forEach(r=>{r.onMutationUpdate(t)}),F(this,ut).notify({mutation:this,type:"updated",action:t})})},Lg);function zx(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Et,Ps,Fg,Bx=(Fg=class extends Cl{constructor(t={}){super();de(this,Et);de(this,Ps);this.config=t,ee(this,Et,new Map),ee(this,Ps,Date.now())}build(t,n,r){const o=new Dx({mutationCache:this,mutationId:++As(this,Ps)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){const n=Ds(t),r=F(this,Et).get(n)??[];r.push(t),F(this,Et).set(n,r),this.notify({type:"added",mutation:t})}remove(t){var r;const n=Ds(t);if(F(this,Et).has(n)){const o=(r=F(this,Et).get(n))==null?void 0:r.filter(i=>i!==t);o&&(o.length===0?F(this,Et).delete(n):F(this,Et).set(n,o))}this.notify({type:"removed",mutation:t})}canRun(t){var r;const n=(r=F(this,Et).get(Ds(t)))==null?void 0:r.find(o=>o.state.status==="pending");return!n||n===t}runNext(t){var r;const n=(r=F(this,Et).get(Ds(t)))==null?void 0:r.find(o=>o!==t&&o.state.isPaused);return(n==null?void 0:n.continue())??Promise.resolve()}clear(){dt.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}getAll(){return[...F(this,Et).values()].flat()}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Ip(n,r))}findAll(t={}){return this.getAll().filter(n=>Ip(t,n))}notify(t){dt.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return dt.batch(()=>Promise.all(t.map(n=>n.continue().catch(rn))))}},Et=new WeakMap,Ps=new WeakMap,Fg);function Ds(e){var t;return((t=e.options.scope)==null?void 0:t.id)??String(e.mutationId)}function Ux(e){return{onFetch:(t,n)=>{const r=async()=>{var v,y,S,m,p;const o=t.options,i=(S=(y=(v=t.fetchOptions)==null?void 0:v.meta)==null?void 0:y.fetchMore)==null?void 0:S.direction,s=((m=t.state.data)==null?void 0:m.pages)||[],a=((p=t.state.data)==null?void 0:p.pageParams)||[],l={pages:[],pageParams:[]};let u=!1;const c=g=>{Object.defineProperty(g,"signal",{enumerable:!0,get:()=>(t.signal.aborted?u=!0:t.signal.addEventListener("abort",()=>{u=!0}),t.signal)})},f=Yg(t.options,t.fetchOptions),d=async(g,x,w)=>{if(u)return Promise.reject();if(x==null&&g.pages.length)return Promise.resolve(g);const k={queryKey:t.queryKey,pageParam:x,direction:w?"backward":"forward",meta:t.options.meta};c(k);const C=await f(k),{maxPages:R}=t.options,I=w?Tx:_x;return{pages:I(g.pages,C,R),pageParams:I(g.pageParams,x,R)}};let h;if(i&&s.length){const g=i==="backward",x=g?Vx:Np,w={pages:s,pageParams:a},k=x(o,w);h=await d(w,k,g)}else{h=await d(l,a[0]??o.initialPageParam);const g=e??s.length;for(let x=1;x{var o,i;return(i=(o=t.options).persister)==null?void 0:i.call(o,r,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=r}}}function Np(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 Vx(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var Ne,rr,or,Do,zo,ir,Bo,Uo,Ng,Hx=(Ng=class{constructor(e={}){de(this,Ne);de(this,rr);de(this,or);de(this,Do);de(this,zo);de(this,ir);de(this,Bo);de(this,Uo);ee(this,Ne,e.queryCache||new jx),ee(this,rr,e.mutationCache||new Bx),ee(this,or,e.defaultOptions||{}),ee(this,Do,new Map),ee(this,zo,new Map),ee(this,ir,0)}mount(){As(this,ir)._++,F(this,ir)===1&&(ee(this,Bo,Jg.subscribe(async e=>{e&&(await this.resumePausedMutations(),F(this,Ne).onFocus())})),ee(this,Uo,Ia.subscribe(async e=>{e&&(await this.resumePausedMutations(),F(this,Ne).onOnline())})))}unmount(){var e,t;As(this,ir)._--,F(this,ir)===0&&((e=F(this,Bo))==null||e.call(this),ee(this,Bo,void 0),(t=F(this,Uo))==null||t.call(this),ee(this,Uo,void 0))}isFetching(e){return F(this,Ne).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return F(this,rr).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=F(this,Ne).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.getQueryData(e.queryKey);if(t===void 0)return this.fetchQuery(e);{const n=this.defaultQueryOptions(e),r=F(this,Ne).build(this,n);return e.revalidateIfStale&&r.isStaleByTime(Mp(n.staleTime,r))&&this.prefetchQuery(n),Promise.resolve(t)}}getQueriesData(e){return F(this,Ne).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),o=F(this,Ne).get(r.queryHash),i=o==null?void 0:o.state.data,s=Cx(t,i);if(s!==void 0)return F(this,Ne).build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return dt.batch(()=>F(this,Ne).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=F(this,Ne).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=F(this,Ne);dt.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=F(this,Ne),r={type:"active",...e};return dt.batch(()=>(n.findAll(e).forEach(o=>{o.reset()}),this.refetchQueries(r,t)))}cancelQueries(e={},t={}){const n={revert:!0,...t},r=dt.batch(()=>F(this,Ne).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(rn).catch(rn)}invalidateQueries(e={},t={}){return dt.batch(()=>{if(F(this,Ne).findAll(e).forEach(r=>{r.invalidate()}),e.refetchType==="none")return Promise.resolve();const n={...e,type:e.refetchType??e.type??"active"};return this.refetchQueries(n,t)})}refetchQueries(e={},t){const n={...t,cancelRefetch:(t==null?void 0:t.cancelRefetch)??!0},r=dt.batch(()=>F(this,Ne).findAll(e).filter(o=>!o.isDisabled()).map(o=>{let i=o.fetch(void 0,n);return n.throwOnError||(i=i.catch(rn)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(rn)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=F(this,Ne).build(this,t);return n.isStaleByTime(Mp(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(rn).catch(rn)}fetchInfiniteQuery(e){return e.behavior=Ux(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(rn).catch(rn)}resumePausedMutations(){return Ia.isOnline()?F(this,rr).resumePausedMutations():Promise.resolve()}getQueryCache(){return F(this,Ne)}getMutationCache(){return F(this,rr)}getDefaultOptions(){return F(this,or)}setDefaultOptions(e){ee(this,or,e)}setQueryDefaults(e,t){F(this,Do).set(Zi(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...F(this,Do).values()];let n={};return t.forEach(r=>{es(e,r.queryKey)&&(n={...n,...r.defaultOptions})}),n}setMutationDefaults(e,t){F(this,zo).set(Zi(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...F(this,zo).values()];let n={};return t.forEach(r=>{es(e,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...F(this,or).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Yd(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.enabled!==!0&&t.queryFn===Xg&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...F(this,or).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){F(this,Ne).clear(),F(this,rr).clear()}},Ne=new WeakMap,rr=new WeakMap,or=new WeakMap,Do=new WeakMap,zo=new WeakMap,ir=new WeakMap,Bo=new WeakMap,Uo=new WeakMap,Ng),Wx=b.createContext(void 0),Kx=({client:e,children:t})=>(b.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),_.jsx(Wx.Provider,{value:e,children:t}));const Ap="pushstate",jp="popstate",ry="beforeunload",oy=e=>(e.preventDefault(),e.returnValue=""),qx=()=>{removeEventListener(ry,oy,{capture:!0})};function iy(e){let t=e.getLocation();const n=new Set;let r=[];const o=()=>{t=e.getLocation(),n.forEach(s=>s())},i=async(s,a)=>{var l;if(!((a==null?void 0:a.ignoreBlocker)??!1)&&typeof document<"u"&&r.length){for(const c of r)if(!await c()){(l=e.onBlocked)==null||l.call(e,o);return}}s()};return{get location(){return t},subscribers:n,subscribe:s=>(n.add(s),()=>{n.delete(s)}),push:(s,a,l)=>{a=Ai(a),i(()=>{e.pushState(s,a),o()},l)},replace:(s,a,l)=>{a=Ai(a),i(()=>{e.replaceState(s,a),o()},l)},go:(s,a)=>{i(()=>{e.go(s),o()},a)},back:s=>{i(()=>{e.back(),o()},s)},forward:s=>{i(()=>{e.forward(),o()},s)},createHref:s=>e.createHref(s),block:s=>(r.push(s),r.length===1&&addEventListener(ry,oy,{capture:!0}),()=>{r=r.filter(a=>a!==s),r.length||qx()}),flush:()=>{var s;return(s=e.flush)==null?void 0:s.call(e)},destroy:()=>{var s;return(s=e.destroy)==null?void 0:s.call(e)},notify:o}}function Ai(e){return e||(e={}),{...e,key:sy()}}function Qx(e){const t=typeof document<"u"?window:void 0,n=t.history.pushState,r=t.history.replaceState,o=y=>y,i=()=>_c(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state);let s=i(),a;const l=()=>s;let u,c;const f=()=>{if(!u)return;(u.isPush?n:r).call(t.history,u.state,"",u.href),u=void 0,c=void 0,a=void 0},d=(y,S,m)=>{const p=o(S);c||(a=s),s=_c(S,m),u={href:p,state:m,isPush:(u==null?void 0:u.isPush)||y==="push"},c||(c=Promise.resolve().then(()=>f()))},h=()=>{s=i(),v.notify()},v=iy({getLocation:l,pushState:(y,S)=>d("push",y,S),replaceState:(y,S)=>d("replace",y,S),back:()=>t.history.back(),forward:()=>t.history.forward(),go:y=>t.history.go(y),createHref:y=>o(y),flush:f,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(Ap,h),t.removeEventListener(jp,h)},onBlocked:y=>{a&&s!==a&&(s=a,y())}});return t.addEventListener(Ap,h),t.addEventListener(jp,h),t.history.pushState=function(...y){const S=n.apply(t.history,y);return h(),S},t.history.replaceState=function(...y){const S=r.apply(t.history,y);return h(),S},v}function Gx(e={initialEntries:["/"]}){const t=e.initialEntries;let n=e.initialIndex??t.length-1,r={key:sy()};return iy({getLocation:()=>_c(t[n],r),pushState:(i,s)=>{r=s,t.splice,n{r=s,t[n]=i},back:()=>{r=Ai(r),n=Math.max(n-1,0)},forward:()=>{r=Ai(r),n=Math.min(n+1,t.length-1)},go:i=>{r=Ai(r),n=Math.min(Math.max(n+i,0),t.length-1)},createHref:i=>i})}function _c(e,t){const n=e.indexOf("#"),r=e.indexOf("?");return{href:e,pathname:e.substring(0,n>0?r>0?Math.min(n,r):n:r>0?r:e.length),hash:n>-1?e.substring(n):"",search:r>-1?e.slice(r,n===-1?void 0:n):"",state:t||{}}}function sy(){return(Math.random()+1).toString(36).substring(7)}var Xx="Invariant failed";function gt(e,t){if(!e)throw new Error(Xx)}const Fu=b.createContext(null);function ay(){return typeof document>"u"?Fu:window.__TSR_ROUTER_CONTEXT__?window.__TSR_ROUTER_CONTEXT__:(window.__TSR_ROUTER_CONTEXT__=Fu,Fu)}function Xr(e){const t=b.useContext(ay());return e==null||e.warn,t}var ly={exports:{}},uy={},cy={exports:{}},dy={};/** * @license React * use-sync-external-store-shim.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Vo=b;function Yx(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Jx=typeof Object.is=="function"?Object.is:Yx,Zx=Vo.useState,eS=Vo.useEffect,tS=Vo.useLayoutEffect,nS=Vo.useDebugValue;function rS(e,t){var n=t(),r=Zx({inst:{value:n,getSnapshot:t}}),o=r[0].inst,i=r[1];return tS(function(){o.value=n,o.getSnapshot=t,Nu(o)&&i({inst:o})},[e,n,t]),eS(function(){return Nu(o)&&i({inst:o}),e(function(){Nu(o)&&i({inst:o})})},[e]),nS(n),n}function Nu(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Jx(e,n)}catch{return!0}}function oS(e,t){return t()}var iS=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?oS:rS;dy.useSyncExternalStore=Vo.useSyncExternalStore!==void 0?Vo.useSyncExternalStore:iS;cy.exports=dy;var sS=cy.exports;/** * @license React * use-sync-external-store-shim/with-selector.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Pl=b,aS=sS;function lS(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var uS=typeof Object.is=="function"?Object.is:lS,cS=aS.useSyncExternalStore,dS=Pl.useRef,fS=Pl.useEffect,pS=Pl.useMemo,hS=Pl.useDebugValue;uy.useSyncExternalStoreWithSelector=function(e,t,n,r,o){var i=dS(null);if(i.current===null){var s={hasValue:!1,value:null};i.current=s}else s=i.current;i=pS(function(){function l(h){if(!u){if(u=!0,c=h,h=r(h),o!==void 0&&s.hasValue){var v=s.value;if(o(v,h))return f=v}return f=h}if(v=f,uS(c,h))return v;var y=r(h);return o!==void 0&&o(v,y)?v:(c=h,f=y)}var u=!1,c,f,d=n===void 0?null:n;return[function(){return l(t())},d===null?void 0:function(){return l(d())}]},[t,n,r,o]);var a=cS(e,i[0],i[1]);return fS(function(){s.hasValue=!0,s.value=a},[a]),hS(a),a};ly.exports=uy;var mS=ly.exports;class Jd{constructor(t,n){this.listeners=new Set,this._batching=!1,this._flushing=0,this.subscribe=r=>{var o,i;this.listeners.add(r);const s=(i=(o=this.options)==null?void 0:o.onSubscribe)==null?void 0:i.call(o,r,this);return()=>{this.listeners.delete(r),s==null||s()}},this.setState=r=>{var o,i,s;const a=this.state;this.state=(o=this.options)!=null&&o.updateFn?this.options.updateFn(a)(r):r(a),(s=(i=this.options)==null?void 0:i.onUpdate)==null||s.call(i),this._flush()},this._flush=()=>{if(this._batching)return;const r=++this._flushing;this.listeners.forEach(o=>{this._flushing===r&&o()})},this.batch=r=>{if(this._batching)return r();this._batching=!0,r(),this._batching=!1,this._flush()},this.state=t,this.options=n}}function La(e,t=n=>n){return mS.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,gS)}function gS(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r=0;r{t.substring(0,1)==="?"&&(t=t.substring(1));const n=vS(t);for(const r in n){const o=n[r];if(typeof o=="string")try{n[r]=e(o)}catch{}}return n}}function wS(e,t){function n(r){if(typeof r=="object"&&r!==null)try{return e(r)}catch{}else if(typeof r=="string"&&typeof t=="function")try{return t(r),e(r)}catch{}return r}return r=>{r={...r},Object.keys(r).forEach(i=>{const s=r[i];typeof s>"u"||s===void 0?delete r[i]:r[i]=n(s)});const o=yS(r).toString();return o?`?${o}`:""}}function Fa(e){return e[e.length-1]}function CS(e){return typeof e=="function"}function zs(e,t){return CS(e)?e(t):e}function ji(e,t){return t.reduce((n,r)=>(n[r]=e[r],n),{})}function mn(e,t){if(e===t)return e;const n=t,r=Bp(e)&&Bp(n);if(r||Na(e)&&Na(n)){const o=r?e:Object.keys(e),i=o.length,s=r?n:Object.keys(n),a=s.length,l=r?[]:{};let u=0;for(let c=0;c"u")return!0;const n=t.prototype;return!(!zp(n)||!n.hasOwnProperty("isPrototypeOf"))}function zp(e){return Object.prototype.toString.call(e)==="[object Object]"}function Bp(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Di(e,t,n=!1){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Na(e)&&Na(t)){const r=Object.keys(e).filter(i=>e[i]!==void 0),o=Object.keys(t).filter(i=>t[i]!==void 0);return!n&&r.length!==o.length?!1:!o.some(i=>!(i in e)||!Di(e[i],t[i],n))}return Array.isArray(e)&&Array.isArray(t)?e.length!==t.length?!1:!e.some((r,o)=>!Di(r,t[o],n)):!1}const Au=typeof window<"u"?b.useLayoutEffect:b.useEffect;function co(e){let t,n;const r=new Promise((o,i)=>{t=o,n=i});return r.status="pending",r.resolve=o=>{r.status="resolved",r.value=o,t(o),e==null||e(o)},r.reject=o=>{r.status="rejected",n(o)},r}function Up(e){const t=b.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function lr(e){return kl(e.filter(Boolean).join("/"))}function kl(e){return e.replace(/\/{2,}/g,"/")}function Zd(e){return e==="/"?e:e.replace(/^\/{1,}/,"")}function Tr(e){return e==="/"?e:e.replace(/\/{1,}$/,"")}function ES(e){return Tr(Zd(e))}function PS({basepath:e,base:t,to:n,trailingSlash:r="never"}){var o,i;t=t.replace(new RegExp(`^${e}`),"/"),n=n.replace(new RegExp(`^${e}`),"/");let s=Ho(t);const a=Ho(n);s.length>1&&((o=Fa(s))==null?void 0:o.value)==="/"&&s.pop(),a.forEach((u,c)=>{u.value==="/"?c?c===a.length-1&&s.push(u):s=[u]:u.value===".."?s.pop():u.value==="."||s.push(u)}),s.length>1&&(((i=Fa(s))==null?void 0:i.value)==="/"?r==="never"&&s.pop():r==="always"&&s.push({type:"pathname",value:"/"}));const l=lr([e,...s.map(u=>u.value)]);return kl(l)}function Ho(e){if(!e)return[];e=kl(e);const t=[];if(e.slice(0,1)==="/"&&(e=e.substring(1),t.push({type:"pathname",value:"/"})),!e)return t;const n=e.split("/").filter(Boolean);return t.push(...n.map(r=>r==="$"||r==="*"?{type:"wildcard",value:r}:r.charAt(0)==="$"?{type:"param",value:r}:{type:"pathname",value:decodeURIComponent(r)})),e.slice(-1)==="/"&&(e=e.substring(1),t.push({type:"pathname",value:"/"})),t}function ju({path:e,params:t,leaveWildcards:n,leaveParams:r}){const o=Ho(e),i={};for(const[s,a]of Object.entries(t)){const l=typeof a=="string";["*","_splat"].includes(s)?i[s]=l?encodeURI(a):a:i[s]=l?encodeURIComponent(a):a}return lr(o.map(s=>{if(s.type==="wildcard"){const a=i._splat;return n?`${s.value}${a??""}`:a}if(s.type==="param"){if(r){const a=i[s.value];return`${s.value}${a??""}`}return i[s.value.substring(1)]??"undefined"}return s.value}))}function Bs(e,t,n){const r=kS(e,t,n);if(!(n.to&&!r))return r??{}}function Vp(e,t){switch(!0){case e==="/":return t;case t===e:return"";case t.length{for(let l=0;l=o.length-1,d=l>=i.length-1;if(c){if(c.type==="wildcard"){if(u!=null&&u.value){const h=decodeURI(lr(o.slice(l).map(v=>v.value)));return s["*"]=h,s._splat=h,!0}return!1}if(c.type==="pathname"){if(c.value==="/"&&!(u!=null&&u.value))return!0;if(u){if(n.caseSensitive){if(c.value!==u.value)return!1}else if(c.value.toLowerCase()!==u.value.toLowerCase())return!1}}if(!u)return!1;if(c.type==="param"){if(u.value==="/")return!1;u.value.charAt(0)!=="$"&&(s[c.value.substring(1)]=decodeURIComponent(u.value))}}if(!f&&d)return s["**"]=lr(o.slice(l+1).map(h=>h.value)),!!n.fuzzy&&(c==null?void 0:c.value)!=="/"}return!0})()?s:void 0}function Pr(e){return!!(e!=null&&e.isRedirect)}function Hp(e){return!!(e!=null&&e.isRedirect)&&e.href}function ef(e){const t=e.errorComponent??Rl;return _.jsx(RS,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:r})=>n?b.createElement(t,{error:n,reset:r}):e.children})}class RS extends b.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromProps(t){return{resetKey:t.getResetKey()}}static getDerivedStateFromError(t){return{error:t}}reset(){this.setState({error:null})}componentDidUpdate(t,n){n.error&&n.resetKey!==this.state.resetKey&&this.reset()}componentDidCatch(t,n){this.props.onCatch&&this.props.onCatch(t,n)}render(){return this.props.children({error:this.state.resetKey!==this.props.getResetKey()?null:this.state.error,reset:()=>{this.reset()}})}}function Rl({error:e}){const[t,n]=b.useState(!1);return _.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[_.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[_.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),_.jsx("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"})]}),_.jsx("div",{style:{height:".25rem"}}),t?_.jsx("div",{children:_.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:e.message?_.jsx("code",{children:e.message}):null})}):null]})}function xt(e){const t=Xr({warn:(e==null?void 0:e.router)===void 0});return La(((e==null?void 0:e.router)||t).__store,e==null?void 0:e.select)}function yn(e){return!!(e!=null&&e.isNotFound)}function OS(e){const t=xt({select:n=>`not-found-${n.location.pathname}-${n.status}`});return _.jsx(ef,{getResetKey:()=>t,onCatch:(n,r)=>{var o;if(yn(n))(o=e.onCatch)==null||o.call(e,n,r);else throw n},errorComponent:({error:n})=>{var r;return(r=e.fallback)==null?void 0:r.call(e,n)},children:e.children})}function _S(){return _.jsx("p",{children:"Not Found"})}const TS=["component","errorComponent","pendingComponent","notFoundComponent"];function MS(e){return new $S(e)}class $S{constructor(t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.subscribers=new Set,this.startReactTransition=n=>n(),this.update=n=>{n.notFoundRoute&&console.warn("The notFoundRoute API is deprecated and will be removed in the next major version. See https://tanstack.com/router/v1/docs/guide/not-found-errors#migrating-from-notfoundroute for more info.");const r=this.options;this.options={...this.options,...n},this.isServer=this.options.isServer??typeof document>"u",(!this.basepath||n.basepath&&n.basepath!==r.basepath)&&(n.basepath===void 0||n.basepath===""||n.basepath==="/"?this.basepath="/":this.basepath=`/${ES(n.basepath)}`),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.history=this.options.history??(this.isServer?Gx({initialEntries:[this.basepath||"/"]}):Qx()),this.latestLocation=this.parseLocation()),this.options.routeTree!==this.routeTree&&(this.routeTree=this.options.routeTree,this.buildRouteTree()),this.__store||(this.__store=new Jd(FS(this.latestLocation),{onUpdate:()=>{this.__store.state={...this.state,cachedMatches:this.state.cachedMatches.filter(o=>!["redirected"].includes(o.status))}}}))},this.buildRouteTree=()=>{this.routesById={},this.routesByPath={};const n=this.options.notFoundRoute;n&&(n.init({originalIndex:99999999999}),this.routesById[n.id]=n);const r=s=>{s.forEach((a,l)=>{a.init({originalIndex:l});const u=this.routesById[a.id];if(gt(!u,`Duplicate routes found with id: ${String(a.id)}`),this.routesById[a.id]=a,!a.isRoot&&a.path){const f=Tr(a.fullPath);(!this.routesByPath[f]||a.fullPath.endsWith("/"))&&(this.routesByPath[f]=a)}const c=a.children;c!=null&&c.length&&r(c)})};r([this.routeTree]);const o=[];Object.values(this.routesById).forEach((s,a)=>{var l;if(s.isRoot||!s.path)return;const u=Zd(s.fullPath),c=Ho(u);for(;c.length>1&&((l=c[0])==null?void 0:l.value)==="/";)c.shift();const f=c.map(d=>d.value==="/"?.75:d.type==="param"?.5:d.type==="wildcard"?.25:1);o.push({child:s,trimmed:u,parsed:c,index:a,scores:f})}),this.flatRoutes=o.sort((s,a)=>{const l=Math.min(s.scores.length,a.scores.length);for(let u=0;ua.parsed[u].value?1:-1;return s.index-a.index}).map((s,a)=>(s.child.rank=a,s.child))},this.subscribe=(n,r)=>{const o={eventType:n,fn:r};return this.subscribers.add(o),()=>{this.subscribers.delete(o)}},this.emit=n=>{this.subscribers.forEach(r=>{r.eventType===n.type&&r.fn(n)})},this.parseLocation=n=>{const r=({pathname:a,search:l,hash:u,state:c})=>{const f=this.options.parseSearch(l),d=this.options.stringifySearch(f);return{pathname:a,searchStr:d,search:mn(n==null?void 0:n.search,f),hash:u.split("#").reverse()[0]??"",href:`${a}${d}${u}`,state:mn(n==null?void 0:n.state,c)}},o=r(this.history.location),{__tempLocation:i,__tempKey:s}=o.state;if(i&&(!s||s===this.tempLocationKey)){const a=r(i);return a.state.key=o.state.key,delete a.state.__tempLocation,{...a,maskedLocation:o}}return o},this.resolvePathWithBase=(n,r)=>PS({basepath:this.basepath,base:n,to:kl(r),trailingSlash:this.options.trailingSlash}),this.matchRoutes=(n,r,o)=>{let i={};const s=this.flatRoutes.find(h=>{const v=Bs(this.basepath,Tr(n),{to:h.fullPath,caseSensitive:h.options.caseSensitive??this.options.caseSensitive,fuzzy:!0});return v?(i=v,!0):!1});let a=s||this.routesById[kt];const l=[a];let u=!1;for((s?s.path!=="/"&&i["**"]:Tr(n))&&(this.options.notFoundRoute?l.push(this.options.notFoundRoute):u=!0);a.parentRoute;)a=a.parentRoute,l.unshift(a);const c=(()=>{if(u){if(this.options.notFoundMode!=="root")for(let h=l.length-1;h>=0;h--){const v=l[h];if(v.children)return v.id}return kt}})(),f=l.map(h=>{var v;let y;const S=((v=h.options.params)==null?void 0:v.parse)??h.options.parseParams;if(S)try{const m=S(i);Object.assign(i,m)}catch(m){if(y=new LS(m.message,{cause:m}),o!=null&&o.throwOnError)throw y;return y}}),d=[];return l.forEach((h,v)=>{var y,S,m,p,g,x,w,k,C,R;const I=d[v-1],[M,j]=(()=>{const $=(I==null?void 0:I.search)??r;try{const L=typeof h.options.validateSearch=="object"?h.options.validateSearch.parse:h.options.validateSearch,W=(L==null?void 0:L($))??{};return[{...$,...W},void 0]}catch(L){const W=new IS(L.message,{cause:L});if(o!=null&&o.throwOnError)throw W;return[$,W]}})(),z=((S=(y=h.options).loaderDeps)==null?void 0:S.call(y,{search:M}))??"",B=z?JSON.stringify(z):"",A=ju({path:h.fullPath,params:i}),E=ju({path:h.id,params:i,leaveWildcards:!0})+B,T=this.getMatch(E),N=this.state.matches.find($=>$.id===E)?"stay":"enter";let O;if(T)O={...T,cause:N,params:i};else{const $=h.options.loader||h.options.beforeLoad||h.lazyFn?"pending":"success";O={id:E,index:v,routeId:h.id,params:i,pathname:lr([this.basepath,A]),updatedAt:Date.now(),search:{},searchError:void 0,status:$,isFetching:!1,error:void 0,paramsError:f[v],routeContext:void 0,context:void 0,abortController:new AbortController,fetchCount:0,cause:N,loaderDeps:z,invalid:!1,preload:!1,links:(p=(m=h.options).links)==null?void 0:p.call(m),scripts:(x=(g=h.options).scripts)==null?void 0:x.call(g),staticData:h.options.staticData||{},loadPromise:co()}}O.status==="success"&&(O.meta=(k=(w=h.options).meta)==null?void 0:k.call(w,{matches:d,match:O,params:O.params,loaderData:O.loaderData}),O.headers=(R=(C=h.options).headers)==null?void 0:R.call(C,{loaderData:O.loaderData})),o!=null&&o.preload||(O.globalNotFound=c===h.id),O.search=mn(O.search,M),O.searchError=j,d.push(O)}),d},this.cancelMatch=n=>{const r=this.getMatch(n);r&&(r.abortController.abort(),clearTimeout(r.pendingTimeout))},this.cancelMatches=()=>{var n;(n=this.state.pendingMatches)==null||n.forEach(r=>{this.cancelMatch(r.id)})},this.buildLocation=n=>{const r=(i={},s)=>{var a,l,u;const c=i._fromLocation!=null?this.matchRoutes(i._fromLocation.pathname,i.fromSearch||i._fromLocation.search):this.state.matches,f=i.from!=null?c.find(B=>Bs(this.basepath,Tr(B.pathname),{to:i.from,caseSensitive:!1,fuzzy:!1})):void 0,d=(f==null?void 0:f.pathname)||this.latestLocation.pathname;gt(i.from==null||f!=null,"Could not find match for from: "+i.from);const h=((a=Fa(c))==null?void 0:a.search)||this.latestLocation.search,v=s==null?void 0:s.filter(B=>c.find(A=>A.routeId===B.routeId)),y=this.routesById[(l=v==null?void 0:v.find(B=>B.pathname===d))==null?void 0:l.routeId];let S=i.to?this.resolvePathWithBase(d,`${i.to}`):this.resolvePathWithBase(d,(y==null?void 0:y.to)??d);const m={...(u=Fa(c))==null?void 0:u.params};let p=(i.params??!0)===!0?m:{...m,...zs(i.params,m)};Object.keys(p).length>0&&(s==null||s.map(B=>{var A;const E=this.looseRoutesById[B.routeId];return((A=E==null?void 0:E.options.params)==null?void 0:A.stringify)??E.options.stringifyParams}).filter(Boolean).forEach(B=>{p={...p,...B(p)}})),S=ju({path:S,params:p??{},leaveWildcards:!1,leaveParams:n.leaveParams});const g=(v==null?void 0:v.map(B=>this.looseRoutesById[B.routeId].options.preSearchFilters??[]).flat().filter(Boolean))??[],x=(v==null?void 0:v.map(B=>this.looseRoutesById[B.routeId].options.postSearchFilters??[]).flat().filter(Boolean))??[],w=g.length?g.reduce((B,A)=>A(B),h):h,k=i.search===!0?w:i.search?zs(i.search,w):g.length?w:{},C=x.length?x.reduce((B,A)=>A(B),k):k,R=mn(h,C),I=this.options.stringifySearch(R),M=i.hash===!0?this.latestLocation.hash:i.hash?zs(i.hash,this.latestLocation.hash):void 0,j=M?`#${M}`:"";let z=i.state===!0?this.latestLocation.state:i.state?zs(i.state,this.latestLocation.state):{};return z=mn(this.latestLocation.state,z),{pathname:S,search:R,searchStr:I,state:z,hash:M??"",href:`${S}${I}${j}`,unmaskOnReload:i.unmaskOnReload}},o=(i={},s)=>{var a;const l=r(i);let u=s?r(s):void 0;if(!u){let v={};const y=(a=this.options.routeMasks)==null?void 0:a.find(S=>{const m=Bs(this.basepath,l.pathname,{to:S.from,caseSensitive:!1,fuzzy:!1});return m?(v=m,!0):!1});if(y){const{from:S,...m}=y;s={...ji(n,["from"]),...m,params:v},u=r(s)}}const c=this.matchRoutes(l.pathname,l.search),f=u?this.matchRoutes(u.pathname,u.search):void 0,d=u?r(s,f):void 0,h=r(i,c);return d&&(h.maskedLocation=d),h};return n.mask?o(n,{...ji(n,["from"]),...n.mask}):o(n)},this.commitLocation=({viewTransition:n,ignoreBlocker:r,...o})=>{const i=()=>{o.state.key=this.latestLocation.state.key;const l=Di(o.state,this.latestLocation.state);return delete o.state.key,l},s=this.latestLocation.href===o.href,a=this.commitLocationPromise;if(this.commitLocationPromise=co(()=>{a==null||a.resolve()}),s&&i())this.load();else{let{maskedLocation:l,...u}=o;l&&(u={...l,state:{...l.state,__tempKey:void 0,__tempLocation:{...u,search:u.searchStr,state:{...u.state,__tempKey:void 0,__tempLocation:void 0,key:void 0}}}},(u.unmaskOnReload??this.options.unmaskOnReload??!1)&&(u.state.__tempKey=this.tempLocationKey)),this.shouldViewTransition=n,this.history[o.replace?"replace":"push"](u.href,u.state,{ignoreBlocker:r})}return this.resetNextScroll=o.resetScroll??!0,this.history.subscribers.size||this.load(),this.commitLocationPromise},this.buildAndCommitLocation=({replace:n,resetScroll:r,viewTransition:o,ignoreBlocker:i,...s}={})=>{const a=this.buildLocation(s);return this.commitLocation({...a,viewTransition:o,replace:n,resetScroll:r,ignoreBlocker:i})},this.navigate=({from:n,to:r,__isRedirect:o,...i})=>{const s=String(r);let a;try{new URL(`${s}`),a=!0}catch{}return gt(!a),this.buildAndCommitLocation({...i,from:n,to:r})},this.load=async()=>{this.latestLocation=this.parseLocation(this.latestLocation),this.__store.setState(i=>({...i,loadedAt:Date.now()}));let n,r;const o=new Promise(i=>{this.startReactTransition(async()=>{var s;try{const a=this.latestLocation,l=this.state.resolvedLocation,u=l.href!==a.href;this.cancelMatches();let c;this.__store.batch(()=>{c=this.matchRoutes(a.pathname,a.search),this.__store.setState(f=>({...f,status:"pending",isLoading:!0,location:a,pendingMatches:c,cachedMatches:f.cachedMatches.filter(d=>!c.find(h=>h.id===d.id))}))}),this.state.redirect||this.emit({type:"onBeforeNavigate",fromLocation:l,toLocation:a,pathChanged:u}),this.emit({type:"onBeforeLoad",fromLocation:l,toLocation:a,pathChanged:u}),await this.loadMatches({matches:c,location:a,onReady:async()=>{this.startViewTransition(async()=>{let f,d,h;this.__store.batch(()=>{this.__store.setState(v=>{const y=v.matches,S=v.pendingMatches||v.matches;return f=y.filter(m=>!S.find(p=>p.id===m.id)),d=S.filter(m=>!y.find(p=>p.id===m.id)),h=y.filter(m=>S.find(p=>p.id===m.id)),{...v,isLoading:!1,matches:S,pendingMatches:void 0,cachedMatches:[...v.cachedMatches,...f.filter(m=>m.status!=="error")]}}),this.cleanCache()}),[[f,"onLeave"],[d,"onEnter"],[h,"onStay"]].forEach(([v,y])=>{v.forEach(S=>{var m,p;(p=(m=this.looseRoutesById[S.routeId].options)[y])==null||p.call(m,S)})})})}})}catch(a){Hp(a)?(n=a,this.isServer||this.navigate({...a,replace:!0,__isRedirect:!0})):yn(a)&&(r=a),this.__store.setState(l=>({...l,statusCode:n?n.statusCode:r?404:l.matches.some(u=>u.status==="error")?500:200,redirect:n}))}this.latestLoadPromise===o&&((s=this.commitLocationPromise)==null||s.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),i()})});for(this.latestLoadPromise=o,await o;this.latestLoadPromise&&o!==this.latestLoadPromise;)await this.latestLoadPromise},this.startViewTransition=n=>{var r,o;const i=this.shouldViewTransition??this.options.defaultViewTransition;delete this.shouldViewTransition,(o=(r=i&&typeof document<"u"?document:void 0)==null?void 0:r.startViewTransition)!=null&&o.call(r,n)||n()},this.updateMatch=(n,r)=>{var o;let i;const s=(o=this.state.pendingMatches)==null?void 0:o.find(u=>u.id===n),a=this.state.matches.find(u=>u.id===n),l=s?"pendingMatches":a?"matches":"cachedMatches";return this.__store.setState(u=>{var c;return{...u,[l]:(c=u[l])==null?void 0:c.map(f=>f.id===n?i=r(f):f)}}),i},this.getMatch=n=>[...this.state.cachedMatches,...this.state.pendingMatches??[],...this.state.matches].find(r=>r.id===n),this.loadMatches=async({location:n,matches:r,preload:o,onReady:i,updateMatch:s=this.updateMatch})=>{let a,l=!1;const u=async()=>{l||(l=!0,await(i==null?void 0:i()))};!this.isServer&&!this.state.matches.length&&u();const c=(f,d)=>{var h,v,y;if(Hp(d))throw d;if(Pr(d)||yn(d)){if(s(f.id,S=>({...S,status:Pr(d)?"redirected":yn(d)?"notFound":"error",isFetching:!1,error:d,beforeLoadPromise:void 0,loaderPromise:void 0})),d.routeId||(d.routeId=f.routeId),(h=f.beforeLoadPromise)==null||h.resolve(),(v=f.loaderPromise)==null||v.resolve(),(y=f.loadPromise)==null||y.resolve(),Pr(d))throw l=!0,d=this.resolveRedirect({...d,_fromLocation:n}),d;if(yn(d))throw this._handleNotFound(r,d,{updateMatch:s}),d}};try{await new Promise((f,d)=>{(async()=>{var h,v,y;try{const S=(g,x,w)=>{var k,C;const{id:R,routeId:I}=r[g],M=this.looseRoutesById[I];if(x instanceof Promise)throw x;x.routerCode=w,a=a??g,c(this.getMatch(R),x);try{(C=(k=M.options).onError)==null||C.call(k,x)}catch(j){x=j,c(this.getMatch(R),x)}s(R,j=>{var z;return(z=j.beforeLoadPromise)==null||z.resolve(),{...j,error:x,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController,beforeLoadPromise:void 0}})};for(const[g,{id:x,routeId:w}]of r.entries()){const k=this.getMatch(x);if(k.beforeLoadPromise||k.loaderPromise)await k.beforeLoadPromise;else{try{s(x,V=>({...V,loadPromise:co(()=>{var H;(H=V.loadPromise)==null||H.resolve()}),beforeLoadPromise:co()}));const C=this.looseRoutesById[w],R=new AbortController,I=(h=r[g-1])==null?void 0:h.id,M=()=>I?this.getMatch(I).context??this.options.context??{}:this.options.context??{},j=C.options.pendingMs??this.options.defaultPendingMs,z=!!(i&&!this.isServer&&!o&&(C.options.loader||C.options.beforeLoad)&&typeof j=="number"&&j!==1/0&&(C.options.pendingComponent??this.options.defaultPendingComponent));let B;z&&(B=setTimeout(()=>{try{u()}catch{}},j));const{paramsError:A,searchError:E}=this.getMatch(x);A&&S(g,A,"PARSE_PARAMS"),E&&S(g,E,"VALIDATE_SEARCH");const T=M();s(x,V=>({...V,isFetching:"beforeLoad",fetchCount:V.fetchCount+1,routeContext:mn(V.routeContext,T),context:mn(V.context,T),abortController:R,pendingTimeout:B}));const{search:N,params:O,routeContext:$,cause:L}=this.getMatch(x),W={search:N,abortController:R,params:O,preload:!!o,context:$,location:n,navigate:V=>this.navigate({...V,_fromLocation:n}),buildLocation:this.buildLocation,cause:o?"preload":L},K=await((y=(v=C.options).beforeLoad)==null?void 0:y.call(v,W))??{};(Pr(K)||yn(K))&&S(g,K,"BEFORE_LOAD"),s(x,V=>{const H={...V.routeContext,...K};return{...V,routeContext:mn(V.routeContext,H),context:mn(V.context,H),abortController:R}})}catch(C){S(g,C,"BEFORE_LOAD")}s(x,C=>{var R;return(R=C.beforeLoadPromise)==null||R.resolve(),{...C,beforeLoadPromise:void 0,isFetching:!1}})}}const m=r.slice(0,a),p=[];m.forEach(({id:g,routeId:x},w)=>{p.push((async()=>{const{loaderPromise:k}=this.getMatch(g);if(k)await k;else{const C=p[w-1],R=this.looseRoutesById[x],I=()=>{const{params:$,loaderDeps:L,abortController:W,context:K,cause:V}=this.getMatch(g);return{params:$,deps:L,preload:!!o,parentMatchPromise:C,abortController:W,context:K,location:n,navigate:H=>this.navigate({...H,_fromLocation:n}),cause:o?"preload":V,route:R}},M=Date.now()-this.getMatch(g).updatedAt,j=o?R.options.preloadStaleTime??this.options.defaultPreloadStaleTime??3e4:R.options.staleTime??this.options.defaultStaleTime??0,z=R.options.shouldReload,B=typeof z=="function"?z(I()):z;s(g,$=>({...$,loaderPromise:co(),preload:!!o&&!this.state.matches.find(L=>L.id===g)}));const A=async()=>{var $,L,W,K,V,H,ie,ne;try{const Ee=async()=>{const Pe=this.getMatch(g);Pe.minPendingPromise&&await Pe.minPendingPromise};try{R._lazyPromise=R._lazyPromise||(R.lazyFn?R.lazyFn().then(ae=>{Object.assign(R.options,ae.options)}):Promise.resolve());const Pe=this.getMatch(g).componentsPromise||R._lazyPromise.then(()=>Promise.all(TS.map(async ae=>{const Z=R.options[ae];Z!=null&&Z.preload&&await Z.preload()})));s(g,ae=>({...ae,isFetching:"loader",componentsPromise:Pe})),await R._lazyPromise;let se=await((L=($=R.options).loader)==null?void 0:L.call($,I()));this.serializeLoaderData&&(se=this.serializeLoaderData(se,{router:this,match:this.getMatch(g)})),c(this.getMatch(g),se),await Ee();const je=(K=(W=R.options).meta)==null?void 0:K.call(W,{matches:r,match:this.getMatch(g),params:this.getMatch(g).params,loaderData:se}),oe=(H=(V=R.options).headers)==null?void 0:H.call(V,{loaderData:se});s(g,ae=>({...ae,error:void 0,status:"success",isFetching:!1,updatedAt:Date.now(),loaderData:se,meta:je,headers:oe}))}catch(Pe){let se=Pe;await Ee(),c(this.getMatch(g),Pe);try{(ne=(ie=R.options).onError)==null||ne.call(ie,Pe)}catch(je){se=je,c(this.getMatch(g),je)}s(g,je=>({...je,error:se,status:"error",isFetching:!1}))}await this.getMatch(g).componentsPromise}catch(Ee){c(this.getMatch(g),Ee)}},{status:E,invalid:T}=this.getMatch(g);E==="success"&&(T||(B??M>j))?(async()=>{try{await A()}catch{}})():E!=="success"&&await A();const{loaderPromise:N,loadPromise:O}=this.getMatch(g);N==null||N.resolve(),O==null||O.resolve()}s(g,C=>({...C,isFetching:!1,loaderPromise:void 0}))})())}),await Promise.all(p),f()}catch(S){d(S)}})()}),await u()}catch(f){if(Pr(f)||yn(f))throw yn(f)&&!o&&await u(),f}return r},this.invalidate=()=>{const n=r=>({...r,invalid:!0,...r.status==="error"?{status:"pending",error:void 0}:{}});return this.__store.setState(r=>{var o;return{...r,matches:r.matches.map(n),cachedMatches:r.cachedMatches.map(n),pendingMatches:(o=r.pendingMatches)==null?void 0:o.map(n)}}),this.load()},this.resolveRedirect=n=>{const r=n;return r.href||(r.href=this.buildLocation(r).href),r},this.cleanCache=()=>{this.__store.setState(n=>({...n,cachedMatches:n.cachedMatches.filter(r=>{const o=this.looseRoutesById[r.routeId];if(!o.options.loader)return!1;const i=(r.preload?o.options.preloadGcTime??this.options.defaultPreloadGcTime:o.options.gcTime??this.options.defaultGcTime)??5*60*1e3;return r.status!=="error"&&Date.now()-r.updatedAt{const r=this.buildLocation(n);let o=this.matchRoutes(r.pathname,r.search,{throwOnError:!0,preload:!0});const i=Object.fromEntries([...this.state.matches,...this.state.pendingMatches??[],...this.state.cachedMatches].map(a=>[a.id,!0]));this.__store.batch(()=>{o.forEach(a=>{i[a.id]||this.__store.setState(l=>({...l,cachedMatches:[...l.cachedMatches,a]}))})});const s=new Set([...this.state.matches,...this.state.pendingMatches??[]].map(a=>a.id));try{return o=await this.loadMatches({matches:o,location:r,preload:!0,updateMatch:(a,l)=>{s.has(a)?o=o.map(u=>u.id===a?l(u):u):this.updateMatch(a,l)}}),o}catch(a){if(Pr(a))return await this.preloadRoute({...a,_fromLocation:r});console.error(a);return}},this.matchRoute=(n,r)=>{const o={...n,to:n.to?this.resolvePathWithBase(n.from||"",n.to):void 0,params:n.params||{},leaveParams:!0},i=this.buildLocation(o);if(r!=null&&r.pending&&this.state.status!=="pending")return!1;const a=((r==null?void 0:r.pending)===void 0?!this.state.isLoading:r.pending)?this.latestLocation:this.state.resolvedLocation,l=Bs(this.basepath,a.pathname,{...r,to:i.pathname});return!l||n.params&&!Di(l,n.params,!0)?!1:l&&((r==null?void 0:r.includeSearch)??!0)?Di(a.search,i.search,!0)?l:!1:l},this.dehydrate=()=>{var n;const r=((n=this.options.errorSerializer)==null?void 0:n.serialize)??NS;return{state:{dehydratedMatches:this.state.matches.map(o=>({...ji(o,["id","status","updatedAt"]),error:o.error?{data:r(o.error),__isServerError:!0}:void 0}))},manifest:this.manifest}},this.hydrate=()=>{var n,r,o;let i;typeof document<"u"&&(i=this.options.transformer.parse((n=window.__TSR__)==null?void 0:n.dehydrated)),gt(i),this.dehydratedData=i.payload,(o=(r=this.options).hydrate)==null||o.call(r,i.payload);const s=i.router.state,a=this.matchRoutes(this.state.location.pathname,this.state.location.search).map(l=>{const u=s.dehydratedMatches.find(c=>c.id===l.id);return gt(u,`Could not find a client-side match for dehydrated match with id: ${l.id}!`),{...l,...u}});this.__store.setState(l=>({...l,matches:a})),this.manifest=i.router.manifest},this.injectedHtml=[],this.injectHtml=n=>{const r=()=>(this.injectedHtml=this.injectedHtml.filter(o=>o!==r),n);this.injectedHtml.push(r)},this.streamedKeys=new Set,this.getStreamedValue=n=>{var r;if(this.isServer)return;const o=(r=window.__TSR__)==null?void 0:r.streamedValues[n];if(o)return o.parsed||(o.parsed=this.options.transformer.parse(o.value)),o.parsed},this.streamValue=(n,r)=>{var o;this.streamedKeys.has(n),this.streamedKeys.add(n);const i=`__TSR__.streamedValues['${n}'] = { value: ${(o=this.serializer)==null?void 0:o.call(this,this.options.transformer.stringify(r))}}`;this.injectHtml(`