var _x=Object.defineProperty;var ch=e=>{throw TypeError(e)};var Lx=(e,t,n)=>t in e?_x(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var dh=(e,t,n)=>Lx(e,typeof t!="symbol"?t+"":t,n),uc=(e,t,n)=>t.has(e)||ch("Cannot "+n);var M=(e,t,n)=>(uc(e,t,"read from private field"),n?n.call(e):t.get(e)),ne=(e,t,n)=>t.has(e)?ch("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),K=(e,t,n,r)=>(uc(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),ce=(e,t,n)=>(uc(e,t,"access private method"),n);var fa=(e,t,n,r)=>({set _(o){K(e,t,o,n)},get _(){return M(e,t,r)}});function Rv(e,t){for(var n=0;nr[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var ls=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function $f(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Tr(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 Ov={exports:{}},Xl={},Mv={exports:{}},se={};/** * @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 ea=Symbol.for("react.element"),Ix=Symbol.for("react.portal"),Fx=Symbol.for("react.fragment"),Nx=Symbol.for("react.strict_mode"),Ax=Symbol.for("react.profiler"),jx=Symbol.for("react.provider"),zx=Symbol.for("react.context"),Dx=Symbol.for("react.forward_ref"),Bx=Symbol.for("react.suspense"),Ux=Symbol.for("react.memo"),Vx=Symbol.for("react.lazy"),fh=Symbol.iterator;function Hx(e){return e===null||typeof e!="object"?null:(e=fh&&e[fh]||e["@@iterator"],typeof e=="function"?e:null)}var Tv={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},$v=Object.assign,_v={};function Ei(e,t,n){this.props=e,this.context=t,this.refs=_v,this.updater=n||Tv}Ei.prototype.isReactComponent={};Ei.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")};Ei.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Lv(){}Lv.prototype=Ei.prototype;function _f(e,t,n){this.props=e,this.context=t,this.refs=_v,this.updater=n||Tv}var Lf=_f.prototype=new Lv;Lf.constructor=_f;$v(Lf,Ei.prototype);Lf.isPureReactComponent=!0;var ph=Array.isArray,Iv=Object.prototype.hasOwnProperty,If={current:null},Fv={key:!0,ref:!0,__self:!0,__source:!0};function Nv(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)Iv.call(t,r)&&!Fv.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(){}},di=typeof window>"u"||"Deno"in globalThis;function Qt(){}function tb(e,t){return typeof e=="function"?e(t):e}function nd(e){return typeof e=="number"&&e>=0&&e!==1/0}function zv(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Bo(e,t){return typeof e=="function"?e(t):e}function hn(e,t){return typeof e=="function"?e(t):e}function mh(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==Nf(s,t.options))return!1}else if(!Ps(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 gh(e,t){const{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(ks(t.options.mutationKey)!==ks(i))return!1}else if(!Ps(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function Nf(e,t){return((t==null?void 0:t.queryKeyHashFn)||ks)(e)}function ks(e){return JSON.stringify(e,(t,n)=>od(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function Ps(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!Ps(e[n],t[n])):!1}function Dv(e,t){if(e===t)return e;const n=vh(e)&&vh(t);if(n||od(e)&&od(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 id(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?Dv(e,t):t}function rb(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function ob(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Bv=Symbol();function Uv(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Bv?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var qr,cr,Jo,yv,ib=(yv=class extends ta{constructor(){super();ne(this,qr);ne(this,cr);ne(this,Jo);K(this,Jo,t=>{if(!di&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){M(this,cr)||this.setEventListener(M(this,Jo))}onUnsubscribe(){var t;this.hasListeners()||((t=M(this,cr))==null||t.call(this),K(this,cr,void 0))}setEventListener(t){var n;K(this,Jo,t),(n=M(this,cr))==null||n.call(this),K(this,cr,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){M(this,qr)!==t&&(K(this,qr,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof M(this,qr)=="boolean"?M(this,qr):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},qr=new WeakMap,cr=new WeakMap,Jo=new WeakMap,yv),Af=new ib,Zo,dr,ei,xv,sb=(xv=class extends ta{constructor(){super();ne(this,Zo,!0);ne(this,dr);ne(this,ei);K(this,ei,t=>{if(!di&&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(){M(this,dr)||this.setEventListener(M(this,ei))}onUnsubscribe(){var t;this.hasListeners()||((t=M(this,dr))==null||t.call(this),K(this,dr,void 0))}setEventListener(t){var n;K(this,ei,t),(n=M(this,dr))==null||n.call(this),K(this,dr,t(this.setOnline.bind(this)))}setOnline(t){M(this,Zo)!==t&&(K(this,Zo,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return M(this,Zo)}},Zo=new WeakMap,dr=new WeakMap,ei=new WeakMap,xv),sl=new sb;function ab(e){return Math.min(1e3*2**e,3e4)}function Vv(e){return(e??"online")==="online"?sl.isOnline():!0}var Hv=class{constructor(e){this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function dc(e){return e instanceof Hv}function Wv(e){let t=!1,n=0,r=!1,o,i,s;const a=new Promise((p,h)=>{i=p,s=h}),l=p=>{var h;r||(g(new Hv(p)),(h=e.abort)==null||h.call(e))},u=()=>{t=!0},c=()=>{t=!1},f=()=>Af.isFocused()&&(e.networkMode==="always"||sl.isOnline())&&e.canRun(),d=()=>Vv(e.networkMode)&&e.canRun(),m=p=>{var h;r||(r=!0,(h=e.onSuccess)==null||h.call(e,p),o==null||o(),i(p))},g=p=>{var h;r||(r=!0,(h=e.onError)==null||h.call(e,p),o==null||o(),s(p))},y=()=>new Promise(p=>{var h;o=v=>{(r||f())&&p(v)},(h=e.onPause)==null||h.call(e)}).then(()=>{var p;o=void 0,r||(p=e.onContinue)==null||p.call(e)}),S=()=>{if(r)return;let p;const h=n===0?e.initialPromise:void 0;try{p=h??e.fn()}catch(v){p=Promise.reject(v)}Promise.resolve(p).then(m).catch(v=>{var P;if(r)return;const x=e.retry??(di?0:3),C=e.retryDelay??ab,R=typeof C=="function"?C(n,v):C,k=x===!0||typeof x=="number"&&nf()?void 0:y()).then(()=>{t?g(v):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 lb(){let e=[],t=0,n=d=>{d()},r=d=>{d()},o=d=>setTimeout(d,0);const i=d=>{o=d},s=d=>{let m;t++;try{m=d()}finally{t--,t||u()}return m},a=d=>{t?e.push(d):o(()=>{n(d)})},l=d=>(...m)=>{a(()=>{d(...m)})},u=()=>{const d=e;e=[],d.length&&o(()=>{r(()=>{d.forEach(m=>{n(m)})})})};return{batch:s,batchCalls:l,schedule:a,setNotifyFunction:d=>{n=d},setBatchNotifyFunction:d=>{r=d},setScheduler:i}}var rt=lb(),Qr,bv,Kv=(bv=class{constructor(){ne(this,Qr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),nd(this.gcTime)&&K(this,Qr,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(di?1/0:5*60*1e3))}clearGcTimeout(){M(this,Qr)&&(clearTimeout(M(this,Qr)),K(this,Qr,void 0))}},Qr=new WeakMap,bv),ti,ni,qt,ut,Xs,Gr,fn,Bn,Sv,ub=(Sv=class extends Kv{constructor(t){super();ne(this,fn);ne(this,ti);ne(this,ni);ne(this,qt);ne(this,ut);ne(this,Xs);ne(this,Gr);K(this,Gr,!1),K(this,Xs,t.defaultOptions),this.setOptions(t.options),this.observers=[],K(this,qt,t.cache),this.queryKey=t.queryKey,this.queryHash=t.queryHash,K(this,ti,t.state||cb(this.options)),this.state=M(this,ti),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=M(this,ut))==null?void 0:t.promise}setOptions(t){this.options={...M(this,Xs),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&M(this,qt).remove(this)}setData(t,n){const r=id(this.state.data,t,this.options);return ce(this,fn,Bn).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){ce(this,fn,Bn).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,o;const n=(r=M(this,ut))==null?void 0:r.promise;return(o=M(this,ut))==null||o.cancel(t),n?n.then(Qt).catch(Qt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(M(this,ti))}isActive(){return this.observers.some(t=>hn(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||!zv(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=M(this,ut))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=M(this,ut))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),M(this,qt).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(M(this,ut)&&(M(this,Gr)?M(this,ut).cancel({revert:!0}):M(this,ut).cancelRetry()),this.scheduleGc()),M(this,qt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||ce(this,fn,Bn).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(M(this,ut))return M(this,ut).continueRetry(),M(this,ut).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:()=>(K(this,Gr,!0),r.signal)})},i=()=>{const f=Uv(this.options,n),d={queryKey:this.queryKey,meta:this.meta};return o(d),K(this,Gr,!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),K(this,ni,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=s.fetchOptions)==null?void 0:u.meta))&&ce(this,fn,Bn).call(this,{type:"fetch",meta:(c=s.fetchOptions)==null?void 0:c.meta});const a=f=>{var d,m,g,y;dc(f)&&f.silent||ce(this,fn,Bn).call(this,{type:"error",error:f}),dc(f)||((m=(d=M(this,qt).config).onError)==null||m.call(d,f,this),(y=(g=M(this,qt).config).onSettled)==null||y.call(g,this.state.data,f,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return K(this,ut,Wv({initialPromise:n==null?void 0:n.initialPromise,fn:s.fetchFn,abort:r.abort.bind(r),onSuccess:f=>{var d,m,g,y;if(f===void 0){a(new Error(`${this.queryHash} data is undefined`));return}this.setData(f),(m=(d=M(this,qt).config).onSuccess)==null||m.call(d,f,this),(y=(g=M(this,qt).config).onSettled)==null||y.call(g,f,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:a,onFail:(f,d)=>{ce(this,fn,Bn).call(this,{type:"failed",failureCount:f,error:d})},onPause:()=>{ce(this,fn,Bn).call(this,{type:"pause"})},onContinue:()=>{ce(this,fn,Bn).call(this,{type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0})),M(this,ut).start()}},ti=new WeakMap,ni=new WeakMap,qt=new WeakMap,ut=new WeakMap,Xs=new WeakMap,Gr=new WeakMap,fn=new WeakSet,Bn=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,...qv(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 dc(o)&&o.revert&&M(this,ni)?{...M(this,ni),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),rt.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),M(this,qt).notify({query:this,type:"updated",action:t})})},Sv);function qv(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Vv(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function cb(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 Pn,wv,db=(wv=class extends ta{constructor(t={}){super();ne(this,Pn);this.config=t,K(this,Pn,new Map)}build(t,n,r){const o=n.queryKey,i=n.queryHash??Nf(o,n);let s=this.get(i);return s||(s=new ub({cache:this,queryKey:o,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(s)),s}add(t){M(this,Pn).has(t.queryHash)||(M(this,Pn).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=M(this,Pn).get(t.queryHash);n&&(t.destroy(),n===t&&M(this,Pn).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){rt.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return M(this,Pn).get(t)}getAll(){return[...M(this,Pn).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>mh(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>mh(t,r)):n}notify(t){rt.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){rt.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){rt.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Pn=new WeakMap,wv),En,pt,Xr,Rn,or,Cv,fb=(Cv=class extends Kv{constructor(t){super();ne(this,Rn);ne(this,En);ne(this,pt);ne(this,Xr);this.mutationId=t.mutationId,K(this,pt,t.mutationCache),K(this,En,[]),this.state=t.state||pb(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){M(this,En).includes(t)||(M(this,En).push(t),this.clearGcTimeout(),M(this,pt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){K(this,En,M(this,En).filter(n=>n!==t)),this.scheduleGc(),M(this,pt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){M(this,En).length||(this.state.status==="pending"?this.scheduleGc():M(this,pt).remove(this))}continue(){var t;return((t=M(this,Xr))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,i,s,a,l,u,c,f,d,m,g,y,S,p,h,v,x,C,R,k;K(this,Xr,Wv({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(P,_)=>{ce(this,Rn,or).call(this,{type:"failed",failureCount:P,error:_})},onPause:()=>{ce(this,Rn,or).call(this,{type:"pause"})},onContinue:()=>{ce(this,Rn,or).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>M(this,pt).canRun(this)}));const n=this.state.status==="pending",r=!M(this,Xr).canStart();try{if(!n){ce(this,Rn,or).call(this,{type:"pending",variables:t,isPaused:r}),await((i=(o=M(this,pt).config).onMutate)==null?void 0:i.call(o,t,this));const _=await((a=(s=this.options).onMutate)==null?void 0:a.call(s,t));_!==this.state.context&&ce(this,Rn,or).call(this,{type:"pending",context:_,variables:t,isPaused:r})}const P=await M(this,Xr).start();return await((u=(l=M(this,pt).config).onSuccess)==null?void 0:u.call(l,P,t,this.state.context,this)),await((f=(c=this.options).onSuccess)==null?void 0:f.call(c,P,t,this.state.context)),await((m=(d=M(this,pt).config).onSettled)==null?void 0:m.call(d,P,null,this.state.variables,this.state.context,this)),await((y=(g=this.options).onSettled)==null?void 0:y.call(g,P,null,t,this.state.context)),ce(this,Rn,or).call(this,{type:"success",data:P}),P}catch(P){try{throw await((p=(S=M(this,pt).config).onError)==null?void 0:p.call(S,P,t,this.state.context,this)),await((v=(h=this.options).onError)==null?void 0:v.call(h,P,t,this.state.context)),await((C=(x=M(this,pt).config).onSettled)==null?void 0:C.call(x,void 0,P,this.state.variables,this.state.context,this)),await((k=(R=this.options).onSettled)==null?void 0:k.call(R,void 0,P,t,this.state.context)),P}finally{ce(this,Rn,or).call(this,{type:"error",error:P})}}finally{M(this,pt).runNext(this)}}},En=new WeakMap,pt=new WeakMap,Xr=new WeakMap,Rn=new WeakSet,or=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),rt.batch(()=>{M(this,En).forEach(r=>{r.onMutationUpdate(t)}),M(this,pt).notify({mutation:this,type:"updated",action:t})})},Cv);function pb(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Lt,Ys,kv,hb=(kv=class extends ta{constructor(t={}){super();ne(this,Lt);ne(this,Ys);this.config=t,K(this,Lt,new Map),K(this,Ys,Date.now())}build(t,n,r){const o=new fb({mutationCache:this,mutationId:++fa(this,Ys)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){const n=ha(t),r=M(this,Lt).get(n)??[];r.push(t),M(this,Lt).set(n,r),this.notify({type:"added",mutation:t})}remove(t){var r;const n=ha(t);if(M(this,Lt).has(n)){const o=(r=M(this,Lt).get(n))==null?void 0:r.filter(i=>i!==t);o&&(o.length===0?M(this,Lt).delete(n):M(this,Lt).set(n,o))}this.notify({type:"removed",mutation:t})}canRun(t){var r;const n=(r=M(this,Lt).get(ha(t)))==null?void 0:r.find(o=>o.state.status==="pending");return!n||n===t}runNext(t){var r;const n=(r=M(this,Lt).get(ha(t)))==null?void 0:r.find(o=>o!==t&&o.state.isPaused);return(n==null?void 0:n.continue())??Promise.resolve()}clear(){rt.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}getAll(){return[...M(this,Lt).values()].flat()}find(t){const n={exact:!0,...t};return this.getAll().find(r=>gh(n,r))}findAll(t={}){return this.getAll().filter(n=>gh(t,n))}notify(t){rt.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return rt.batch(()=>Promise.all(t.map(n=>n.continue().catch(Qt))))}},Lt=new WeakMap,Ys=new WeakMap,kv);function ha(e){var t;return((t=e.options.scope)==null?void 0:t.id)??String(e.mutationId)}function mb(e){return{onFetch:(t,n)=>{const r=async()=>{var g,y,S,p,h;const o=t.options,i=(S=(y=(g=t.fetchOptions)==null?void 0:g.meta)==null?void 0:y.fetchMore)==null?void 0:S.direction,s=((p=t.state.data)==null?void 0:p.pages)||[],a=((h=t.state.data)==null?void 0:h.pageParams)||[],l={pages:[],pageParams:[]};let u=!1;const c=v=>{Object.defineProperty(v,"signal",{enumerable:!0,get:()=>(t.signal.aborted?u=!0:t.signal.addEventListener("abort",()=>{u=!0}),t.signal)})},f=Uv(t.options,t.fetchOptions),d=async(v,x,C)=>{if(u)return Promise.reject();if(x==null&&v.pages.length)return Promise.resolve(v);const R={queryKey:t.queryKey,pageParam:x,direction:C?"backward":"forward",meta:t.options.meta};c(R);const k=await f(R),{maxPages:P}=t.options,_=C?ob:rb;return{pages:_(v.pages,k,P),pageParams:_(v.pageParams,x,P)}};let m;if(i&&s.length){const v=i==="backward",x=v?gb:xh,C={pages:s,pageParams:a},R=x(o,C);m=await d(C,R,v)}else{m=await d(l,a[0]??o.initialPageParam);const v=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 xh(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 gb(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 De,fr,pr,ri,oi,hr,ii,si,Pv,kL=(Pv=class{constructor(e={}){ne(this,De);ne(this,fr);ne(this,pr);ne(this,ri);ne(this,oi);ne(this,hr);ne(this,ii);ne(this,si);K(this,De,e.queryCache||new db),K(this,fr,e.mutationCache||new hb),K(this,pr,e.defaultOptions||{}),K(this,ri,new Map),K(this,oi,new Map),K(this,hr,0)}mount(){fa(this,hr)._++,M(this,hr)===1&&(K(this,ii,Af.subscribe(async e=>{e&&(await this.resumePausedMutations(),M(this,De).onFocus())})),K(this,si,sl.subscribe(async e=>{e&&(await this.resumePausedMutations(),M(this,De).onOnline())})))}unmount(){var e,t;fa(this,hr)._--,M(this,hr)===0&&((e=M(this,ii))==null||e.call(this),K(this,ii,void 0),(t=M(this,si))==null||t.call(this),K(this,si,void 0))}isFetching(e){return M(this,De).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return M(this,fr).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=M(this,De).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=M(this,De).build(this,n);return e.revalidateIfStale&&r.isStaleByTime(Bo(n.staleTime,r))&&this.prefetchQuery(n),Promise.resolve(t)}}getQueriesData(e){return M(this,De).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=M(this,De).get(r.queryHash),i=o==null?void 0:o.state.data,s=tb(t,i);if(s!==void 0)return M(this,De).build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return rt.batch(()=>M(this,De).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=M(this,De).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=M(this,De);rt.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=M(this,De),r={type:"active",...e};return rt.batch(()=>(n.findAll(e).forEach(o=>{o.reset()}),this.refetchQueries(r,t)))}cancelQueries(e={},t={}){const n={revert:!0,...t},r=rt.batch(()=>M(this,De).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(Qt).catch(Qt)}invalidateQueries(e={},t={}){return rt.batch(()=>{if(M(this,De).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=rt.batch(()=>M(this,De).findAll(e).filter(o=>!o.isDisabled()).map(o=>{let i=o.fetch(void 0,n);return n.throwOnError||(i=i.catch(Qt)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Qt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=M(this,De).build(this,t);return n.isStaleByTime(Bo(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Qt).catch(Qt)}fetchInfiniteQuery(e){return e.behavior=mb(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Qt).catch(Qt)}resumePausedMutations(){return sl.isOnline()?M(this,fr).resumePausedMutations():Promise.resolve()}getQueryCache(){return M(this,De)}getMutationCache(){return M(this,fr)}getDefaultOptions(){return M(this,pr)}setDefaultOptions(e){K(this,pr,e)}setQueryDefaults(e,t){M(this,ri).set(ks(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...M(this,ri).values()];let n={};return t.forEach(r=>{Ps(e,r.queryKey)&&(n={...n,...r.defaultOptions})}),n}setMutationDefaults(e,t){M(this,oi).set(ks(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...M(this,oi).values()];let n={};return t.forEach(r=>{Ps(e,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...M(this,pr).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Nf(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===Bv&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...M(this,pr).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){M(this,De).clear(),M(this,fr).clear()}},De=new WeakMap,fr=new WeakMap,pr=new WeakMap,ri=new WeakMap,oi=new WeakMap,hr=new WeakMap,ii=new WeakMap,si=new WeakMap,Pv),kt,de,Js,ht,Yr,ai,On,Zs,li,ui,Jr,Zr,mr,ci,ye,ts,sd,ad,ld,ud,cd,dd,fd,Qv,Ev,vb=(Ev=class extends ta{constructor(t,n){super();ne(this,ye);ne(this,kt);ne(this,de);ne(this,Js);ne(this,ht);ne(this,Yr);ne(this,ai);ne(this,On);ne(this,Zs);ne(this,li);ne(this,ui);ne(this,Jr);ne(this,Zr);ne(this,mr);ne(this,ci,new Set);this.options=n,K(this,kt,t),K(this,On,null),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(M(this,de).addObserver(this),bh(M(this,de),this.options)?ce(this,ye,ts).call(this):this.updateResult(),ce(this,ye,ud).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return pd(M(this,de),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return pd(M(this,de),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,ce(this,ye,cd).call(this),ce(this,ye,dd).call(this),M(this,de).removeObserver(this)}setOptions(t,n){const r=this.options,o=M(this,de);if(this.options=M(this,kt).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof hn(this.options.enabled,M(this,de))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");ce(this,ye,fd).call(this),M(this,de).setOptions(this.options),r._defaulted&&!rd(this.options,r)&&M(this,kt).getQueryCache().notify({type:"observerOptionsUpdated",query:M(this,de),observer:this});const i=this.hasListeners();i&&Sh(M(this,de),o,this.options,r)&&ce(this,ye,ts).call(this),this.updateResult(n),i&&(M(this,de)!==o||hn(this.options.enabled,M(this,de))!==hn(r.enabled,M(this,de))||Bo(this.options.staleTime,M(this,de))!==Bo(r.staleTime,M(this,de)))&&ce(this,ye,sd).call(this);const s=ce(this,ye,ad).call(this);i&&(M(this,de)!==o||hn(this.options.enabled,M(this,de))!==hn(r.enabled,M(this,de))||s!==M(this,mr))&&ce(this,ye,ld).call(this,s)}getOptimisticResult(t){const n=M(this,kt).getQueryCache().build(M(this,kt),t),r=this.createResult(n,t);return xb(this,r)&&(K(this,ht,r),K(this,ai,this.options),K(this,Yr,M(this,de).state)),r}getCurrentResult(){return M(this,ht)}trackResult(t,n){const r={};return Object.keys(t).forEach(o=>{Object.defineProperty(r,o,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(o),n==null||n(o),t[o])})}),r}trackProp(t){M(this,ci).add(t)}getCurrentQuery(){return M(this,de)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=M(this,kt).defaultQueryOptions(t),r=M(this,kt).getQueryCache().build(M(this,kt),n);return r.isFetchingOptimistic=!0,r.fetch().then(()=>this.createResult(r,n))}fetch(t){return ce(this,ye,ts).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),M(this,ht)))}createResult(t,n){var k;const r=M(this,de),o=this.options,i=M(this,ht),s=M(this,Yr),a=M(this,ai),u=t!==r?t.state:M(this,Js),{state:c}=t;let f={...c},d=!1,m;if(n._optimisticResults){const P=this.hasListeners(),_=!P&&bh(t,n),L=P&&Sh(t,r,n,o);(_||L)&&(f={...f,...qv(c.data,t.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:g,errorUpdatedAt:y,status:S}=f;if(n.select&&f.data!==void 0)if(i&&f.data===(s==null?void 0:s.data)&&n.select===M(this,Zs))m=M(this,li);else try{K(this,Zs,n.select),m=n.select(f.data),m=id(i==null?void 0:i.data,m,n),K(this,li,m),K(this,On,null)}catch(P){K(this,On,P)}else m=f.data;if(n.placeholderData!==void 0&&m===void 0&&S==="pending"){let P;if(i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData))P=i.data;else if(P=typeof n.placeholderData=="function"?n.placeholderData((k=M(this,ui))==null?void 0:k.state.data,M(this,ui)):n.placeholderData,n.select&&P!==void 0)try{P=n.select(P),K(this,On,null)}catch(_){K(this,On,_)}P!==void 0&&(S="success",m=id(i==null?void 0:i.data,P,n),d=!0)}M(this,On)&&(g=M(this,On),m=M(this,li),y=Date.now(),S="error");const p=f.fetchStatus==="fetching",h=S==="pending",v=S==="error",x=h&&p,C=m!==void 0;return{status:S,fetchStatus:f.fetchStatus,isPending:h,isSuccess:S==="success",isError:v,isInitialLoading:x,isLoading:x,data:m,dataUpdatedAt:f.dataUpdatedAt,error:g,errorUpdatedAt:y,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:f.dataUpdateCount>0||f.errorUpdateCount>0,isFetchedAfterMount:f.dataUpdateCount>u.dataUpdateCount||f.errorUpdateCount>u.errorUpdateCount,isFetching:p,isRefetching:p&&!h,isLoadingError:v&&!C,isPaused:f.fetchStatus==="paused",isPlaceholderData:d,isRefetchError:v&&C,isStale:jf(t,n),refetch:this.refetch}}updateResult(t){const n=M(this,ht),r=this.createResult(M(this,de),this.options);if(K(this,Yr,M(this,de).state),K(this,ai,this.options),M(this,Yr).data!==void 0&&K(this,ui,M(this,de)),rd(r,n))return;K(this,ht,r);const o={},i=()=>{if(!n)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!M(this,ci).size)return!0;const l=new Set(a??M(this,ci));return this.options.throwOnError&&l.add("error"),Object.keys(M(this,ht)).some(u=>{const c=u;return M(this,ht)[c]!==n[c]&&l.has(c)})};(t==null?void 0:t.listeners)!==!1&&i()&&(o.listeners=!0),ce(this,ye,Qv).call(this,{...o,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&ce(this,ye,ud).call(this)}},kt=new WeakMap,de=new WeakMap,Js=new WeakMap,ht=new WeakMap,Yr=new WeakMap,ai=new WeakMap,On=new WeakMap,Zs=new WeakMap,li=new WeakMap,ui=new WeakMap,Jr=new WeakMap,Zr=new WeakMap,mr=new WeakMap,ci=new WeakMap,ye=new WeakSet,ts=function(t){ce(this,ye,fd).call(this);let n=M(this,de).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Qt)),n},sd=function(){ce(this,ye,cd).call(this);const t=Bo(this.options.staleTime,M(this,de));if(di||M(this,ht).isStale||!nd(t))return;const r=zv(M(this,ht).dataUpdatedAt,t)+1;K(this,Jr,setTimeout(()=>{M(this,ht).isStale||this.updateResult()},r))},ad=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(M(this,de)):this.options.refetchInterval)??!1},ld=function(t){ce(this,ye,dd).call(this),K(this,mr,t),!(di||hn(this.options.enabled,M(this,de))===!1||!nd(M(this,mr))||M(this,mr)===0)&&K(this,Zr,setInterval(()=>{(this.options.refetchIntervalInBackground||Af.isFocused())&&ce(this,ye,ts).call(this)},M(this,mr)))},ud=function(){ce(this,ye,sd).call(this),ce(this,ye,ld).call(this,ce(this,ye,ad).call(this))},cd=function(){M(this,Jr)&&(clearTimeout(M(this,Jr)),K(this,Jr,void 0))},dd=function(){M(this,Zr)&&(clearInterval(M(this,Zr)),K(this,Zr,void 0))},fd=function(){const t=M(this,kt).getQueryCache().build(M(this,kt),this.options);if(t===M(this,de))return;const n=M(this,de);K(this,de,t),K(this,Js,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Qv=function(t){rt.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(M(this,ht))}),M(this,kt).getQueryCache().notify({query:M(this,de),type:"observerResultsUpdated"})})},Ev);function yb(e,t){return hn(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function bh(e,t){return yb(e,t)||e.state.data!==void 0&&pd(e,t,t.refetchOnMount)}function pd(e,t,n){if(hn(t.enabled,e)!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&jf(e,t)}return!1}function Sh(e,t,n,r){return(e!==t||hn(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&jf(e,n)}function jf(e,t){return hn(t.enabled,e)!==!1&&e.isStaleByTime(Bo(t.staleTime,e))}function xb(e,t){return!rd(e.getCurrentResult(),t)}var Gv=b.createContext(void 0),bb=e=>{const t=b.useContext(Gv);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},PL=({client:e,children:t})=>(b.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),$.jsx(Gv.Provider,{value:e,children:t})),Xv=b.createContext(!1),Sb=()=>b.useContext(Xv);Xv.Provider;function wb(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Cb=b.createContext(wb()),kb=()=>b.useContext(Cb);function Pb(e,t){return typeof e=="function"?e(...t):!!e}var Eb=(e,t)=>{(e.suspense||e.throwOnError)&&(t.isReset()||(e.retryOnMount=!1))},Rb=e=>{b.useEffect(()=>{e.clearReset()},[e])},Ob=({result:e,errorResetBoundary:t,throwOnError:n,query:r})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&Pb(n,[e.error,r]),Mb=(e,t)=>t.state.data===void 0,Tb=e=>{e.suspense&&typeof e.staleTime!="number"&&(e.staleTime=1e3)},$b=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,_b=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Lb(e,t,n){var u,c,f,d;const r=bb(),o=Sb(),i=kb(),s=r.defaultQueryOptions(e);(c=(u=r.getDefaultOptions().queries)==null?void 0:u._experimental_beforeQuery)==null||c.call(u,s),s._optimisticResults=o?"isRestoring":"optimistic",Tb(s),Eb(s,i),Rb(i);const[a]=b.useState(()=>new t(r,s)),l=a.getOptimisticResult(s);if(b.useSyncExternalStore(b.useCallback(m=>{const g=o?()=>{}:a.subscribe(rt.batchCalls(m));return a.updateResult(),g},[a,o]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),b.useEffect(()=>{a.setOptions(s,{listeners:!1})},[s,a]),$b(s,l))throw _b(s,a,i);if(Ob({result:l,errorResetBoundary:i,throwOnError:s.throwOnError,query:r.getQueryCache().get(s.queryHash)}))throw l.error;return(d=(f=r.getDefaultOptions().queries)==null?void 0:f._experimental_afterQuery)==null||d.call(f,s,l),s.notifyOnChangeProps?l:a.trackResult(l)}function EL(e,t){return Lb({...e,enabled:!0,suspense:!0,throwOnError:Mb,placeholderData:void 0},vb)}function RL(e){return e}const wh="pushstate",Ch="popstate",Yv="beforeunload",Jv=e=>(e.preventDefault(),e.returnValue=""),Ib=()=>{removeEventListener(Yv,Jv,{capture:!0})};function Zv(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=us(a),i(()=>{e.pushState(s,a),o()},l)},replace:(s,a,l)=>{a=us(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(Yv,Jv,{capture:!0}),()=>{r=r.filter(a=>a!==s),r.length||Ib()}),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 us(e){return e||(e={}),{...e,key:ey()}}function Fb(e){const t=typeof document<"u"?window:void 0,n=t.history.pushState,r=t.history.replaceState,o=y=>y,i=()=>hd(`${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,p)=>{const h=o(S);c||(a=s),s=hd(S,p),u={href:h,state:p,isPush:(u==null?void 0:u.isPush)||y==="push"},c||(c=Promise.resolve().then(()=>f()))},m=()=>{s=i(),g.notify()},g=Zv({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(wh,m),t.removeEventListener(Ch,m)},onBlocked:y=>{a&&s!==a&&(s=a,y())}});return t.addEventListener(wh,m),t.addEventListener(Ch,m),t.history.pushState=function(...y){const S=n.apply(t.history,y);return m(),S},t.history.replaceState=function(...y){const S=r.apply(t.history,y);return m(),S},g}function Nb(e={initialEntries:["/"]}){const t=e.initialEntries;let n=e.initialIndex??t.length-1,r={key:ey()};return Zv({getLocation:()=>hd(t[n],r),pushState:(i,s)=>{r=s,t.splice,n{r=s,t[n]=i},back:()=>{r=us(r),n=Math.max(n-1,0)},forward:()=>{r=us(r),n=Math.min(n+1,t.length-1)},go:i=>{r=us(r),n=Math.min(Math.max(n+i,0),t.length-1)},createHref:i=>i})}function hd(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 ey(){return(Math.random()+1).toString(36).substring(7)}var Ab="Invariant failed";function Pt(e,t){if(!e)throw new Error(Ab)}const fc=b.createContext(null);function ty(){return typeof document>"u"?fc:window.__TSR_ROUTER_CONTEXT__?window.__TSR_ROUTER_CONTEXT__:(window.__TSR_ROUTER_CONTEXT__=fc,fc)}function $r(e){const t=b.useContext(ty());return e==null||e.warn,t}var ny={exports:{}},ry={},oy={exports:{}},iy={};/** * @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 fi=b;function jb(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var zb=typeof Object.is=="function"?Object.is:jb,Db=fi.useState,Bb=fi.useEffect,Ub=fi.useLayoutEffect,Vb=fi.useDebugValue;function Hb(e,t){var n=t(),r=Db({inst:{value:n,getSnapshot:t}}),o=r[0].inst,i=r[1];return Ub(function(){o.value=n,o.getSnapshot=t,pc(o)&&i({inst:o})},[e,n,t]),Bb(function(){return pc(o)&&i({inst:o}),e(function(){pc(o)&&i({inst:o})})},[e]),Vb(n),n}function pc(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!zb(e,n)}catch{return!0}}function Wb(e,t){return t()}var Kb=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Wb:Hb;iy.useSyncExternalStore=fi.useSyncExternalStore!==void 0?fi.useSyncExternalStore:Kb;oy.exports=iy;var qb=oy.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 Yl=b,Qb=qb;function Gb(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Xb=typeof Object.is=="function"?Object.is:Gb,Yb=Qb.useSyncExternalStore,Jb=Yl.useRef,Zb=Yl.useEffect,eS=Yl.useMemo,tS=Yl.useDebugValue;ry.useSyncExternalStoreWithSelector=function(e,t,n,r,o){var i=Jb(null);if(i.current===null){var s={hasValue:!1,value:null};i.current=s}else s=i.current;i=eS(function(){function l(m){if(!u){if(u=!0,c=m,m=r(m),o!==void 0&&s.hasValue){var g=s.value;if(o(g,m))return f=g}return f=m}if(g=f,Xb(c,m))return g;var y=r(m);return o!==void 0&&o(g,y)?g:(c=m,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=Yb(e,i[0],i[1]);return Zb(function(){s.hasValue=!0,s.value=a},[a]),tS(a),a};ny.exports=ry;var nS=ny.exports;class zf{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 al(e,t=n=>n){return nS.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,rS)}function rS(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=iS(t);for(const r in n){const o=n[r];if(typeof o=="string")try{n[r]=e(o)}catch{}}return n}}function uS(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=oS(r).toString();return o?`?${o}`:""}}function ll(e){return e[e.length-1]}function cS(e){return typeof e=="function"}function Oo(e,t){return cS(e)?e(t):e}function cs(e,t){return t.reduce((n,r)=>(n[r]=e[r],n),{})}function wn(e,t){if(e===t)return e;const n=t,r=Eh(e)&&Eh(n);if(r||ul(e)&&ul(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!(!Ph(n)||!n.hasOwnProperty("isPrototypeOf"))}function Ph(e){return Object.prototype.toString.call(e)==="[object Object]"}function Eh(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Uo(e,t,n=!1){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(ul(e)&&ul(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)||!Uo(e[i],t[i],n))}return Array.isArray(e)&&Array.isArray(t)?e.length!==t.length?!1:!e.some((r,o)=>!Uo(r,t[o],n)):!1}const hc=typeof window<"u"?b.useLayoutEffect:b.useEffect;function Eo(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 Rh(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 yr(e){return Jl(e.filter(Boolean).join("/"))}function Jl(e){return e.replace(/\/{2,}/g,"/")}function Df(e){return e==="/"?e:e.replace(/^\/{1,}/,"")}function Ur(e){return e==="/"?e:e.replace(/\/{1,}$/,"")}function dS(e){return Ur(Df(e))}function cl(e,t){return e.endsWith("/")&&e!=="/"&&e!==`${t}/`?e.slice(0,-1):e}function fS(e,t,n){return cl(e,n)===cl(t,n)}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=pi(t);const a=pi(n);s.length>1&&((o=ll(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=ll(s))==null?void 0:i.value)==="/"?r==="never"&&s.pop():r==="always"&&s.push({type:"pathname",value:"/"}));const l=yr([e,...s.map(u=>u.value)]);return Jl(l)}function pi(e){if(!e)return[];e=Jl(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 mc({path:e,params:t,leaveWildcards:n,leaveParams:r}){const o=pi(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 yr(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 ma(e,t,n){const r=hS(e,t,n);if(!(n.to&&!r))return r??{}}function Oh(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 m=decodeURI(yr(o.slice(l).map(g=>g.value)));return s["*"]=m,s._splat=m,!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["**"]=yr(o.slice(l+1).map(m=>m.value)),!!n.fuzzy&&(c==null?void 0:c.value)!=="/"}return!0})()?s:void 0}function OL(e){if(e.isRedirect=!0,e.statusCode=e.statusCode||e.code||301,e.headers=e.headers||{},e.throw)throw e;return e}function Ar(e){return!!(e!=null&&e.isRedirect)}function Mh(e){return!!(e!=null&&e.isRedirect)&&e.href}function Bf(e){const t=e.errorComponent??Zl;return $.jsx(mS,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:r})=>n?b.createElement(t,{error:n,reset:r}):e.children})}class mS 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 Zl({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 gt(e){const t=$r({warn:(e==null?void 0:e.router)===void 0});return al(((e==null?void 0:e.router)||t).__store,e==null?void 0:e.select)}function kn(e){return!!(e!=null&&e.isNotFound)}function gS(e){const t=gt({select:n=>`not-found-${n.location.pathname}-${n.status}`});return $.jsx(Bf,{getResetKey:()=>t,onCatch:(n,r)=>{var o;if(kn(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 vS(){return $.jsx("p",{children:"Not Found"})}const yS=["component","errorComponent","pendingComponent","notFoundComponent"];function ML(e){return new xS(e)}class xS{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=`/${dS(n.basepath)}`),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.history=this.options.history??(this.isServer?Nb({initialEntries:[this.basepath||"/"]}):Fb()),this.latestLocation=this.parseLocation()),this.options.routeTree!==this.routeTree&&(this.routeTree=this.options.routeTree,this.buildRouteTree()),this.__store||(this.__store=new zf(wS(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(Pt(!u,`Duplicate routes found with id: ${String(a.id)}`),this.routesById[a.id]=a,!a.isRoot&&a.path){const f=Ur(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=Df(s.fullPath),c=pi(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:wn(n==null?void 0:n.search,f),hash:u.split("#").reverse()[0]??"",href:`${a}${d}${u}`,state:wn(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:Jl(r),trailingSlash:this.options.trailingSlash}),this.matchRoutes=(n,r,o)=>{let i={};const s=this.flatRoutes.find(m=>{const g=ma(this.basepath,Ur(n),{to:m.fullPath,caseSensitive:m.options.caseSensitive??this.options.caseSensitive,fuzzy:!0});return g?(i=g,!0):!1});let a=s||this.routesById[Ft];const l=[a];let u=!1;for((s?s.path!=="/"&&i["**"]:Ur(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 m=l.length-1;m>=0;m--){const g=l[m];if(g.children)return g.id}return Ft}})(),f=l.map(m=>{var g;let y;const S=((g=m.options.params)==null?void 0:g.parse)??m.options.parseParams;if(S)try{const p=S(i);Object.assign(i,p)}catch(p){if(y=new SS(p.message,{cause:p}),o!=null&&o.throwOnError)throw y;return y}}),d=[];return l.forEach((m,g)=>{var y,S,p,h,v,x,C,R,k,P;const _=d[g-1],[L,A]=(()=>{const I=(_==null?void 0:_.search)??r;try{const F=typeof m.options.validateSearch=="object"?m.options.validateSearch.parse:m.options.validateSearch,Q=(F==null?void 0:F(I))??{};return[{...I,...Q},void 0]}catch(F){const Q=new bS(F.message,{cause:F});if(o!=null&&o.throwOnError)throw Q;return[I,Q]}})(),j=((S=(y=m.options).loaderDeps)==null?void 0:S.call(y,{search:L}))??"",D=j?JSON.stringify(j):"",z=mc({path:m.fullPath,params:i}),E=mc({path:m.id,params:i,leaveWildcards:!0})+D,T=this.getMatch(E),N=this.state.matches.find(I=>I.id===E)?"stay":"enter";let O;if(T)O={...T,cause:N,params:i};else{const I=m.options.loader||m.options.beforeLoad||m.lazyFn?"pending":"success";O={id:E,index:g,routeId:m.id,params:i,pathname:yr([this.basepath,z]),updatedAt:Date.now(),search:{},searchError:void 0,status:I,isFetching:!1,error:void 0,paramsError:f[g],routeContext:void 0,context:void 0,abortController:new AbortController,fetchCount:0,cause:N,loaderDeps:j,invalid:!1,preload:!1,links:(h=(p=m.options).links)==null?void 0:h.call(p),scripts:(x=(v=m.options).scripts)==null?void 0:x.call(v),staticData:m.options.staticData||{},loadPromise:Eo()}}O.status==="success"&&(O.meta=(R=(C=m.options).meta)==null?void 0:R.call(C,{matches:d,match:O,params:O.params,loaderData:O.loaderData}),O.headers=(P=(k=m.options).headers)==null?void 0:P.call(k,{loaderData:O.loaderData})),o!=null&&o.preload||(O.globalNotFound=c===m.id),O.search=wn(O.search,L),O.searchError=A,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(D=>ma(this.basepath,Ur(D.pathname),{to:i.from,caseSensitive:!1,fuzzy:!1})):void 0,d=(f==null?void 0:f.pathname)||this.latestLocation.pathname;Pt(i.from==null||f!=null,"Could not find match for from: "+i.from);const m=((a=ll(c))==null?void 0:a.search)||this.latestLocation.search,g=s==null?void 0:s.filter(D=>c.find(z=>z.routeId===D.routeId)),y=this.routesById[(l=g==null?void 0:g.find(D=>D.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 p={...(u=ll(c))==null?void 0:u.params};let h=(i.params??!0)===!0?p:{...p,...Oo(i.params,p)};Object.keys(h).length>0&&(s==null||s.map(D=>{var z;const E=this.looseRoutesById[D.routeId];return((z=E==null?void 0:E.options.params)==null?void 0:z.stringify)??E.options.stringifyParams}).filter(Boolean).forEach(D=>{h={...h,...D(h)}})),S=mc({path:S,params:h??{},leaveWildcards:!1,leaveParams:n.leaveParams});const v=(g==null?void 0:g.map(D=>this.looseRoutesById[D.routeId].options.preSearchFilters??[]).flat().filter(Boolean))??[],x=(g==null?void 0:g.map(D=>this.looseRoutesById[D.routeId].options.postSearchFilters??[]).flat().filter(Boolean))??[],C=v.length?v.reduce((D,z)=>z(D),m):m,R=i.search===!0?C:i.search?Oo(i.search,C):v.length?C:{},k=x.length?x.reduce((D,z)=>z(D),R):R,P=wn(m,k),_=this.options.stringifySearch(P),L=i.hash===!0?this.latestLocation.hash:i.hash?Oo(i.hash,this.latestLocation.hash):void 0,A=L?`#${L}`:"";let j=i.state===!0?this.latestLocation.state:i.state?Oo(i.state,this.latestLocation.state):{};return j=wn(this.latestLocation.state,j),{pathname:S,search:P,searchStr:_,state:j,hash:L??"",href:`${S}${_}${A}`,unmaskOnReload:i.unmaskOnReload}},o=(i={},s)=>{var a;const l=r(i);let u=s?r(s):void 0;if(!u){let g={};const y=(a=this.options.routeMasks)==null?void 0:a.find(S=>{const p=ma(this.basepath,l.pathname,{to:S.from,caseSensitive:!1,fuzzy:!1});return p?(g=p,!0):!1});if(y){const{from:S,...p}=y;s={...cs(n,["from"]),...p,params:g},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,m=r(i,c);return d&&(m.maskedLocation=d),m};return n.mask?o(n,{...cs(n,["from"]),...n.mask}):o(n)},this.commitLocation=({viewTransition:n,ignoreBlocker:r,...o})=>{const i=()=>{o.state.key=this.latestLocation.state.key;const l=Uo(o.state,this.latestLocation.state);return delete o.state.key,l},s=this.latestLocation.href===o.href,a=this.commitLocationPromise;if(this.commitLocationPromise=Eo(()=>{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 Pt(!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(m=>m.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,m;this.__store.batch(()=>{this.__store.setState(g=>{const y=g.matches,S=g.pendingMatches||g.matches;return f=y.filter(p=>!S.find(h=>h.id===p.id)),d=S.filter(p=>!y.find(h=>h.id===p.id)),m=y.filter(p=>S.find(h=>h.id===p.id)),{...g,isLoading:!1,matches:S,pendingMatches:void 0,cachedMatches:[...g.cachedMatches,...f.filter(p=>p.status!=="error")]}}),this.cleanCache()}),[[f,"onLeave"],[d,"onEnter"],[m,"onStay"]].forEach(([g,y])=>{g.forEach(S=>{var p,h;(h=(p=this.looseRoutesById[S.routeId].options)[y])==null||h.call(p,S)})})})}})}catch(a){Mh(a)?(n=a,this.isServer||this.navigate({...a,replace:!0,__isRedirect:!0})):kn(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 m,g,y;if(Mh(d))throw d;if(Ar(d)||kn(d)){if(s(f.id,S=>({...S,status:Ar(d)?"redirected":kn(d)?"notFound":"error",isFetching:!1,error:d,beforeLoadPromise:void 0,loaderPromise:void 0})),d.routeId||(d.routeId=f.routeId),(m=f.beforeLoadPromise)==null||m.resolve(),(g=f.loaderPromise)==null||g.resolve(),(y=f.loadPromise)==null||y.resolve(),Ar(d))throw l=!0,d=this.resolveRedirect({...d,_fromLocation:n}),d;if(kn(d))throw this._handleNotFound(r,d,{updateMatch:s}),d}};try{await new Promise((f,d)=>{(async()=>{var m,g,y;try{const S=(v,x,C)=>{var R,k;const{id:P,routeId:_}=r[v],L=this.looseRoutesById[_];if(x instanceof Promise)throw x;x.routerCode=C,a=a??v,c(this.getMatch(P),x);try{(k=(R=L.options).onError)==null||k.call(R,x)}catch(A){x=A,c(this.getMatch(P),x)}s(P,A=>{var j;return(j=A.beforeLoadPromise)==null||j.resolve(),{...A,error:x,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController,beforeLoadPromise:void 0}})};for(const[v,{id:x,routeId:C}]of r.entries()){const R=this.getMatch(x);if(R.beforeLoadPromise||R.loaderPromise)await R.beforeLoadPromise;else{try{s(x,W=>({...W,loadPromise:Eo(()=>{var q;(q=W.loadPromise)==null||q.resolve()}),beforeLoadPromise:Eo()}));const k=this.looseRoutesById[C],P=new AbortController,_=(m=r[v-1])==null?void 0:m.id,L=()=>_?this.getMatch(_).context??this.options.context??{}:this.options.context??{},A=k.options.pendingMs??this.options.defaultPendingMs,j=!!(i&&!this.isServer&&!o&&(k.options.loader||k.options.beforeLoad)&&typeof A=="number"&&A!==1/0&&(k.options.pendingComponent??this.options.defaultPendingComponent));let D;j&&(D=setTimeout(()=>{try{u()}catch{}},A));const{paramsError:z,searchError:E}=this.getMatch(x);z&&S(v,z,"PARSE_PARAMS"),E&&S(v,E,"VALIDATE_SEARCH");const T=L();s(x,W=>({...W,isFetching:"beforeLoad",fetchCount:W.fetchCount+1,routeContext:wn(W.routeContext,T),context:wn(W.context,T),abortController:P,pendingTimeout:D}));const{search:N,params:O,routeContext:I,cause:F}=this.getMatch(x),Q={search:N,abortController:P,params:O,preload:!!o,context:I,location:n,navigate:W=>this.navigate({...W,_fromLocation:n}),buildLocation:this.buildLocation,cause:o?"preload":F},X=await((y=(g=k.options).beforeLoad)==null?void 0:y.call(g,Q))??{};(Ar(X)||kn(X))&&S(v,X,"BEFORE_LOAD"),s(x,W=>{const q={...W.routeContext,...X};return{...W,routeContext:wn(W.routeContext,q),context:wn(W.context,q),abortController:P}})}catch(k){S(v,k,"BEFORE_LOAD")}s(x,k=>{var P;return(P=k.beforeLoadPromise)==null||P.resolve(),{...k,beforeLoadPromise:void 0,isFetching:!1}})}}const p=r.slice(0,a),h=[];p.forEach(({id:v,routeId:x},C)=>{h.push((async()=>{const{loaderPromise:R}=this.getMatch(v);if(R)await R;else{const k=h[C-1],P=this.looseRoutesById[x],_=()=>{const{params:I,loaderDeps:F,abortController:Q,context:X,cause:W}=this.getMatch(v);return{params:I,deps:F,preload:!!o,parentMatchPromise:k,abortController:Q,context:X,location:n,navigate:q=>this.navigate({...q,_fromLocation:n}),cause:o?"preload":W,route:P}},L=Date.now()-this.getMatch(v).updatedAt,A=o?P.options.preloadStaleTime??this.options.defaultPreloadStaleTime??3e4:P.options.staleTime??this.options.defaultStaleTime??0,j=P.options.shouldReload,D=typeof j=="function"?j(_()):j;s(v,I=>({...I,loaderPromise:Eo(),preload:!!o&&!this.state.matches.find(F=>F.id===v)}));const z=async()=>{var I,F,Q,X,W,q,pe,oe;try{const we=async()=>{const Ce=this.getMatch(v);Ce.minPendingPromise&&await Ce.minPendingPromise};try{P._lazyPromise=P._lazyPromise||(P.lazyFn?P.lazyFn().then(ee=>{Object.assign(P.options,ee.options)}):Promise.resolve());const Ce=this.getMatch(v).componentsPromise||P._lazyPromise.then(()=>Promise.all(yS.map(async ee=>{const re=P.options[ee];re!=null&&re.preload&&await re.preload()})));s(v,ee=>({...ee,isFetching:"loader",componentsPromise:Ce})),await P._lazyPromise;let fe=await((F=(I=P.options).loader)==null?void 0:F.call(I,_()));this.serializeLoaderData&&(fe=this.serializeLoaderData(fe,{router:this,match:this.getMatch(v)})),c(this.getMatch(v),fe),await we();const Te=(X=(Q=P.options).meta)==null?void 0:X.call(Q,{matches:r,match:this.getMatch(v),params:this.getMatch(v).params,loaderData:fe}),Y=(q=(W=P.options).headers)==null?void 0:q.call(W,{loaderData:fe});s(v,ee=>({...ee,error:void 0,status:"success",isFetching:!1,updatedAt:Date.now(),loaderData:fe,meta:Te,headers:Y}))}catch(Ce){let fe=Ce;await we(),c(this.getMatch(v),Ce);try{(oe=(pe=P.options).onError)==null||oe.call(pe,Ce)}catch(Te){fe=Te,c(this.getMatch(v),Te)}s(v,Te=>({...Te,error:fe,status:"error",isFetching:!1}))}await this.getMatch(v).componentsPromise}catch(we){c(this.getMatch(v),we)}},{status:E,invalid:T}=this.getMatch(v);E==="success"&&(T||(D??L>A))?(async()=>{try{await z()}catch{}})():E!=="success"&&await z();const{loaderPromise:N,loadPromise:O}=this.getMatch(v);N==null||N.resolve(),O==null||O.resolve()}s(v,k=>({...k,isFetching:!1,loaderPromise:void 0}))})())}),await Promise.all(h),f()}catch(S){d(S)}})()}),await u()}catch(f){if(Ar(f)||kn(f))throw kn(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(Ar(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=ma(this.basepath,a.pathname,{...r,to:i.pathname});return!l||n.params&&!Uo(l,n.params,!0)?!1:l&&((r==null?void 0:r.includeSearch)??!0)?Uo(a.search,i.search,!0)?l:!1:l},this.dehydrate=()=>{var n;const r=((n=this.options.errorSerializer)==null?void 0:n.serialize)??CS;return{state:{dehydratedMatches:this.state.matches.map(o=>({...cs(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)),Pt(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 Pt(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(`