var vs=e=>{throw TypeError(e)};var Be=(e,t,s)=>t.has(e)||vs("Cannot "+s);var h=(e,t,s)=>(Be(e,t,"read from private field"),s?s.call(e):t.get(e)),_=(e,t,s)=>t.has(e)?vs("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),P=(e,t,s,i)=>(Be(e,t,"write to private field"),i?i.call(e,s):t.set(e,s),s),x=(e,t,s)=>(Be(e,t,"access private method"),s);var Me=(e,t,s,i)=>({set _(r){P(e,t,r,s)},get _(){return h(e,t,i)}});import{r as C,c as wi}from"./react-DXd9vB-a.js";import{j as F}from"./mui-DQviNP-p.js";var be=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},oe=typeof window>"u"||"Deno"in globalThis;function lt(){}function Fi(e,t){return typeof e=="function"?e(t):e}function He(e){return typeof e=="number"&&e>=0&&e!==1/0}function qs(e,t){return Math.max(e+(t||0)-Date.now(),0)}function qt(e,t){return typeof e=="function"?e(t):e}function ht(e,t){return typeof e=="function"?e(t):e}function ys(e,t){const{type:s="all",exact:i,fetchStatus:r,predicate:n,queryKey:o,stale:a}=e;if(o){if(i){if(t.queryHash!==ls(o,t.options))return!1}else if(!pe(t.queryKey,o))return!1}if(s!=="all"){const c=t.isActive();if(s==="active"&&!c||s==="inactive"&&c)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||r&&r!==t.state.fetchStatus||n&&!n(t))}function gs(e,t){const{exact:s,status:i,predicate:r,mutationKey:n}=e;if(n){if(!t.options.mutationKey)return!1;if(s){if(fe(t.options.mutationKey)!==fe(n))return!1}else if(!pe(t.options.mutationKey,n))return!1}return!(i&&t.state.status!==i||r&&!r(t))}function ls(e,t){return((t==null?void 0:t.queryKeyHashFn)||fe)(e)}function fe(e){return JSON.stringify(e,(t,s)=>Ge(s)?Object.keys(s).sort().reduce((i,r)=>(i[r]=s[r],i),{}):s)}function pe(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(s=>!pe(e[s],t[s])):!1}function zs(e,t){if(e===t)return e;const s=bs(e)&&bs(t);if(s||Ge(e)&&Ge(t)){const i=s?e:Object.keys(e),r=i.length,n=s?t:Object.keys(t),o=n.length,a=s?[]:{};let c=0;for(let u=0;u{setTimeout(t,e)})}function Je(e,t,s){return typeof s.structuralSharing=="function"?s.structuralSharing(e,t):s.structuralSharing!==!1?zs(e,t):t}function Ri(e,t,s=0){const i=[...e,t];return s&&i.length>s?i.slice(1):i}function Ci(e,t,s=0){const i=[t,...e];return s&&i.length>s?i.slice(0,-1):i}var Hs=Symbol();function Ws(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Hs?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var Vt,Ft,Ht,js,Ei=(js=class extends be{constructor(){super();_(this,Vt);_(this,Ft);_(this,Ht);P(this,Ht,t=>{if(!oe&&window.addEventListener){const s=()=>t();return window.addEventListener("visibilitychange",s,!1),()=>{window.removeEventListener("visibilitychange",s)}}})}onSubscribe(){h(this,Ft)||this.setEventListener(h(this,Ht))}onUnsubscribe(){var t;this.hasListeners()||((t=h(this,Ft))==null||t.call(this),P(this,Ft,void 0))}setEventListener(t){var s;P(this,Ht,t),(s=h(this,Ft))==null||s.call(this),P(this,Ft,t(i=>{typeof i=="boolean"?this.setFocused(i):this.onFocus()}))}setFocused(t){h(this,Vt)!==t&&(P(this,Vt,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(s=>{s(t)})}isFocused(){var t;return typeof h(this,Vt)=="boolean"?h(this,Vt):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Vt=new WeakMap,Ft=new WeakMap,Ht=new WeakMap,js),cs=new Ei,Wt,_t,Gt,Ds,xi=(Ds=class extends be{constructor(){super();_(this,Wt,!0);_(this,_t);_(this,Gt);P(this,Gt,t=>{if(!oe&&window.addEventListener){const s=()=>t(!0),i=()=>t(!1);return window.addEventListener("online",s,!1),window.addEventListener("offline",i,!1),()=>{window.removeEventListener("online",s),window.removeEventListener("offline",i)}}})}onSubscribe(){h(this,_t)||this.setEventListener(h(this,Gt))}onUnsubscribe(){var t;this.hasListeners()||((t=h(this,_t))==null||t.call(this),P(this,_t,void 0))}setEventListener(t){var s;P(this,Gt,t),(s=h(this,_t))==null||s.call(this),P(this,_t,t(this.setOnline.bind(this)))}setOnline(t){h(this,Wt)!==t&&(P(this,Wt,t),this.listeners.forEach(i=>{i(t)}))}isOnline(){return h(this,Wt)}},Wt=new WeakMap,_t=new WeakMap,Gt=new WeakMap,Ds),Ce=new xi;function Li(e){return Math.min(1e3*2**e,3e4)}function Gs(e){return(e??"online")==="online"?Ce.isOnline():!0}var Js=class{constructor(e){this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function $e(e){return e instanceof Js}function Xs(e){let t=!1,s=0,i=!1,r,n,o;const a=new Promise((M,S)=>{n=M,o=S}),c=M=>{var S;i||(v(new Js(M)),(S=e.abort)==null||S.call(e))},u=()=>{t=!0},l=()=>{t=!1},d=()=>cs.isFocused()&&(e.networkMode==="always"||Ce.isOnline())&&e.canRun(),f=()=>Gs(e.networkMode)&&e.canRun(),p=M=>{var S;i||(i=!0,(S=e.onSuccess)==null||S.call(e,M),r==null||r(),n(M))},v=M=>{var S;i||(i=!0,(S=e.onError)==null||S.call(e,M),r==null||r(),o(M))},m=()=>new Promise(M=>{var S;r=y=>{(i||d())&&M(y)},(S=e.onPause)==null||S.call(e)}).then(()=>{var M;r=void 0,i||(M=e.onContinue)==null||M.call(e)}),g=()=>{if(i)return;let M;const S=s===0?e.initialPromise:void 0;try{M=S??e.fn()}catch(y){M=Promise.reject(y)}Promise.resolve(M).then(p).catch(y=>{var b;if(i)return;const w=e.retry??(oe?0:3),R=e.retryDelay??Li,O=typeof R=="function"?R(s,y):R,E=w===!0||typeof w=="number"&&sd()?void 0:m()).then(()=>{t?v(y):g()})})};return{promise:a,cancel:c,continue:()=>(r==null||r(),a),cancelRetry:u,continueRetry:l,canStart:f,start:()=>(f()?g():m().then(g),a)}}function Oi(){let e=[],t=0,s=f=>{f()},i=f=>{f()},r=f=>setTimeout(f,0);const n=f=>{r=f},o=f=>{let p;t++;try{p=f()}finally{t--,t||u()}return p},a=f=>{t?e.push(f):r(()=>{s(f)})},c=f=>(...p)=>{a(()=>{f(...p)})},u=()=>{const f=e;e=[],f.length&&r(()=>{i(()=>{f.forEach(p=>{s(p)})})})};return{batch:o,batchCalls:c,schedule:a,setNotifyFunction:f=>{s=f},setBatchNotifyFunction:f=>{i=f},setScheduler:n}}var z=Oi(),jt,ks,Ys=(ks=class{constructor(){_(this,jt)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),He(this.gcTime)&&P(this,jt,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(oe?1/0:5*60*1e3))}clearGcTimeout(){h(this,jt)&&(clearTimeout(h(this,jt)),P(this,jt,void 0))}},jt=new WeakMap,ks),Jt,Xt,ut,G,me,Dt,ct,St,Bs,Ai=(Bs=class extends Ys{constructor(t){super();_(this,ct);_(this,Jt);_(this,Xt);_(this,ut);_(this,G);_(this,me);_(this,Dt);P(this,Dt,!1),P(this,me,t.defaultOptions),this.setOptions(t.options),this.observers=[],P(this,ut,t.cache),this.queryKey=t.queryKey,this.queryHash=t.queryHash,P(this,Jt,t.state||Ti(this.options)),this.state=h(this,Jt),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=h(this,G))==null?void 0:t.promise}setOptions(t){this.options={...h(this,me),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&h(this,ut).remove(this)}setData(t,s){const i=Je(this.state.data,t,this.options);return x(this,ct,St).call(this,{data:i,type:"success",dataUpdatedAt:s==null?void 0:s.updatedAt,manual:s==null?void 0:s.manual}),i}setState(t,s){x(this,ct,St).call(this,{type:"setState",state:t,setStateOptions:s})}cancel(t){var i,r;const s=(i=h(this,G))==null?void 0:i.promise;return(r=h(this,G))==null||r.cancel(t),s?s.then(lt).catch(lt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(h(this,Jt))}isActive(){return this.observers.some(t=>ht(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||!qs(this.state.dataUpdatedAt,t)}onFocus(){var s;const t=this.observers.find(i=>i.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(s=h(this,G))==null||s.continue()}onOnline(){var s;const t=this.observers.find(i=>i.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(s=h(this,G))==null||s.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),h(this,ut).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(s=>s!==t),this.observers.length||(h(this,G)&&(h(this,Dt)?h(this,G).cancel({revert:!0}):h(this,G).cancelRetry()),this.scheduleGc()),h(this,ut).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||x(this,ct,St).call(this,{type:"invalidate"})}fetch(t,s){var c,u,l;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(s!=null&&s.cancelRefetch))this.cancel({silent:!0});else if(h(this,G))return h(this,G).continueRetry(),h(this,G).promise}if(t&&this.setOptions(t),!this.options.queryFn){const d=this.observers.find(f=>f.options.queryFn);d&&this.setOptions(d.options)}const i=new AbortController,r=d=>{Object.defineProperty(d,"signal",{enumerable:!0,get:()=>(P(this,Dt,!0),i.signal)})},n=()=>{const d=Ws(this.options,s),f={queryKey:this.queryKey,meta:this.meta};return r(f),P(this,Dt,!1),this.options.persister?this.options.persister(d,f,this):d(f)},o={fetchOptions:s,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:n};r(o),(c=this.options.behavior)==null||c.onFetch(o,this),P(this,Xt,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=o.fetchOptions)==null?void 0:u.meta))&&x(this,ct,St).call(this,{type:"fetch",meta:(l=o.fetchOptions)==null?void 0:l.meta});const a=d=>{var f,p,v,m;$e(d)&&d.silent||x(this,ct,St).call(this,{type:"error",error:d}),$e(d)||((p=(f=h(this,ut).config).onError)==null||p.call(f,d,this),(m=(v=h(this,ut).config).onSettled)==null||m.call(v,this.state.data,d,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return P(this,G,Xs({initialPromise:s==null?void 0:s.initialPromise,fn:o.fetchFn,abort:i.abort.bind(i),onSuccess:d=>{var f,p,v,m;if(d===void 0){a(new Error(`${this.queryHash} data is undefined`));return}this.setData(d),(p=(f=h(this,ut).config).onSuccess)==null||p.call(f,d,this),(m=(v=h(this,ut).config).onSettled)==null||m.call(v,d,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:a,onFail:(d,f)=>{x(this,ct,St).call(this,{type:"failed",failureCount:d,error:f})},onPause:()=>{x(this,ct,St).call(this,{type:"pause"})},onContinue:()=>{x(this,ct,St).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0})),h(this,G).start()}},Jt=new WeakMap,Xt=new WeakMap,ut=new WeakMap,G=new WeakMap,me=new WeakMap,Dt=new WeakMap,ct=new WeakSet,St=function(t){const s=i=>{switch(t.type){case"failed":return{...i,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...i,fetchStatus:"paused"};case"continue":return{...i,fetchStatus:"fetching"};case"fetch":return{...i,...Zs(i.data,this.options),fetchMeta:t.meta??null};case"success":return{...i,data:t.data,dataUpdateCount:i.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const r=t.error;return $e(r)&&r.revert&&h(this,Xt)?{...h(this,Xt),fetchStatus:"idle"}:{...i,error:r,errorUpdateCount:i.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:i.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:"idle",status:"error"};case"invalidate":return{...i,isInvalidated:!0};case"setState":return{...i,...t.state}}};this.state=s(this.state),z.batch(()=>{this.observers.forEach(i=>{i.onQueryUpdate()}),h(this,ut).notify({query:this,type:"updated",action:t})})},Bs);function Zs(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Gs(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Ti(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,s=t!==void 0,i=s?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:s?i??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}var mt,$s,Ii=($s=class extends be{constructor(t={}){super();_(this,mt);this.config=t,P(this,mt,new Map)}build(t,s,i){const r=s.queryKey,n=s.queryHash??ls(r,s);let o=this.get(n);return o||(o=new Ai({cache:this,queryKey:r,queryHash:n,options:t.defaultQueryOptions(s),state:i,defaultOptions:t.getQueryDefaults(r)}),this.add(o)),o}add(t){h(this,mt).has(t.queryHash)||(h(this,mt).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const s=h(this,mt).get(t.queryHash);s&&(t.destroy(),s===t&&h(this,mt).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){z.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return h(this,mt).get(t)}getAll(){return[...h(this,mt).values()]}find(t){const s={exact:!0,...t};return this.getAll().find(i=>ys(s,i))}findAll(t={}){const s=this.getAll();return Object.keys(t).length>0?s.filter(i=>ys(t,i)):s}notify(t){z.batch(()=>{this.listeners.forEach(s=>{s(t)})})}onFocus(){z.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){z.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},mt=new WeakMap,$s),vt,J,kt,yt,wt,Qs,Vi=(Qs=class extends Ys{constructor(t){super();_(this,yt);_(this,vt);_(this,J);_(this,kt);this.mutationId=t.mutationId,P(this,J,t.mutationCache),P(this,vt,[]),this.state=t.state||ji(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){h(this,vt).includes(t)||(h(this,vt).push(t),this.clearGcTimeout(),h(this,J).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){P(this,vt,h(this,vt).filter(s=>s!==t)),this.scheduleGc(),h(this,J).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){h(this,vt).length||(this.state.status==="pending"?this.scheduleGc():h(this,J).remove(this))}continue(){var t;return((t=h(this,kt))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var r,n,o,a,c,u,l,d,f,p,v,m,g,M,S,y,w,R,O,E;P(this,kt,Xs({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(b,T)=>{x(this,yt,wt).call(this,{type:"failed",failureCount:b,error:T})},onPause:()=>{x(this,yt,wt).call(this,{type:"pause"})},onContinue:()=>{x(this,yt,wt).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>h(this,J).canRun(this)}));const s=this.state.status==="pending",i=!h(this,kt).canStart();try{if(!s){x(this,yt,wt).call(this,{type:"pending",variables:t,isPaused:i}),await((n=(r=h(this,J).config).onMutate)==null?void 0:n.call(r,t,this));const T=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,t));T!==this.state.context&&x(this,yt,wt).call(this,{type:"pending",context:T,variables:t,isPaused:i})}const b=await h(this,kt).start();return await((u=(c=h(this,J).config).onSuccess)==null?void 0:u.call(c,b,t,this.state.context,this)),await((d=(l=this.options).onSuccess)==null?void 0:d.call(l,b,t,this.state.context)),await((p=(f=h(this,J).config).onSettled)==null?void 0:p.call(f,b,null,this.state.variables,this.state.context,this)),await((m=(v=this.options).onSettled)==null?void 0:m.call(v,b,null,t,this.state.context)),x(this,yt,wt).call(this,{type:"success",data:b}),b}catch(b){try{throw await((M=(g=h(this,J).config).onError)==null?void 0:M.call(g,b,t,this.state.context,this)),await((y=(S=this.options).onError)==null?void 0:y.call(S,b,t,this.state.context)),await((R=(w=h(this,J).config).onSettled)==null?void 0:R.call(w,void 0,b,this.state.variables,this.state.context,this)),await((E=(O=this.options).onSettled)==null?void 0:E.call(O,void 0,b,t,this.state.context)),b}finally{x(this,yt,wt).call(this,{type:"error",error:b})}}finally{h(this,J).runNext(this)}}},vt=new WeakMap,J=new WeakMap,kt=new WeakMap,yt=new WeakSet,wt=function(t){const s=i=>{switch(t.type){case"failed":return{...i,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...i,isPaused:!0};case"continue":return{...i,isPaused:!1};case"pending":return{...i,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{...i,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...i,data:void 0,error:t.error,failureCount:i.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=s(this.state),z.batch(()=>{h(this,vt).forEach(i=>{i.onMutationUpdate(t)}),h(this,J).notify({mutation:this,type:"updated",action:t})})},Qs);function ji(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var st,ve,Us,Di=(Us=class extends be{constructor(t={}){super();_(this,st);_(this,ve);this.config=t,P(this,st,new Map),P(this,ve,Date.now())}build(t,s,i){const r=new Vi({mutationCache:this,mutationId:++Me(this,ve)._,options:t.defaultMutationOptions(s),state:i});return this.add(r),r}add(t){const s=Pe(t),i=h(this,st).get(s)??[];i.push(t),h(this,st).set(s,i),this.notify({type:"added",mutation:t})}remove(t){var i;const s=Pe(t);if(h(this,st).has(s)){const r=(i=h(this,st).get(s))==null?void 0:i.filter(n=>n!==t);r&&(r.length===0?h(this,st).delete(s):h(this,st).set(s,r))}this.notify({type:"removed",mutation:t})}canRun(t){var i;const s=(i=h(this,st).get(Pe(t)))==null?void 0:i.find(r=>r.state.status==="pending");return!s||s===t}runNext(t){var i;const s=(i=h(this,st).get(Pe(t)))==null?void 0:i.find(r=>r!==t&&r.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}clear(){z.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}getAll(){return[...h(this,st).values()].flat()}find(t){const s={exact:!0,...t};return this.getAll().find(i=>gs(s,i))}findAll(t={}){return this.getAll().filter(s=>gs(t,s))}notify(t){z.batch(()=>{this.listeners.forEach(s=>{s(t)})})}resumePausedMutations(){const t=this.getAll().filter(s=>s.state.isPaused);return z.batch(()=>Promise.all(t.map(s=>s.continue().catch(lt))))}},st=new WeakMap,ve=new WeakMap,Us);function Pe(e){var t;return((t=e.options.scope)==null?void 0:t.id)??String(e.mutationId)}function ki(e){return{onFetch:(t,s)=>{const i=async()=>{var v,m,g,M,S;const r=t.options,n=(g=(m=(v=t.fetchOptions)==null?void 0:v.meta)==null?void 0:m.fetchMore)==null?void 0:g.direction,o=((M=t.state.data)==null?void 0:M.pages)||[],a=((S=t.state.data)==null?void 0:S.pageParams)||[],c={pages:[],pageParams:[]};let u=!1;const l=y=>{Object.defineProperty(y,"signal",{enumerable:!0,get:()=>(t.signal.aborted?u=!0:t.signal.addEventListener("abort",()=>{u=!0}),t.signal)})},d=Ws(t.options,t.fetchOptions),f=async(y,w,R)=>{if(u)return Promise.reject();if(w==null&&y.pages.length)return Promise.resolve(y);const O={queryKey:t.queryKey,pageParam:w,direction:R?"backward":"forward",meta:t.options.meta};l(O);const E=await d(O),{maxPages:b}=t.options,T=R?Ci:Ri;return{pages:T(y.pages,E,b),pageParams:T(y.pageParams,w,b)}};let p;if(n&&o.length){const y=n==="backward",w=y?Bi:Ms,R={pages:o,pageParams:a},O=w(r,R);p=await f(R,O,y)}else{p=await f(c,a[0]??r.initialPageParam);const y=e??o.length;for(let w=1;w{var r,n;return(n=(r=t.options).persister)==null?void 0:n.call(r,i,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},s)}:t.fetchFn=i}}}function Ms(e,{pages:t,pageParams:s}){const i=t.length-1;return t.length>0?e.getNextPageParam(t[i],t,s[i],s):void 0}function Bi(e,{pages:t,pageParams:s}){var i;return t.length>0?(i=e.getPreviousPageParam)==null?void 0:i.call(e,t[0],t,s[0],s):void 0}var j,Rt,Ct,Yt,Zt,Et,te,ee,Ks,Fn=(Ks=class{constructor(e={}){_(this,j);_(this,Rt);_(this,Ct);_(this,Yt);_(this,Zt);_(this,Et);_(this,te);_(this,ee);P(this,j,e.queryCache||new Ii),P(this,Rt,e.mutationCache||new Di),P(this,Ct,e.defaultOptions||{}),P(this,Yt,new Map),P(this,Zt,new Map),P(this,Et,0)}mount(){Me(this,Et)._++,h(this,Et)===1&&(P(this,te,cs.subscribe(async e=>{e&&(await this.resumePausedMutations(),h(this,j).onFocus())})),P(this,ee,Ce.subscribe(async e=>{e&&(await this.resumePausedMutations(),h(this,j).onOnline())})))}unmount(){var e,t;Me(this,Et)._--,h(this,Et)===0&&((e=h(this,te))==null||e.call(this),P(this,te,void 0),(t=h(this,ee))==null||t.call(this),P(this,ee,void 0))}isFetching(e){return h(this,j).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return h(this,Rt).findAll({...e,status:"pending"}).length}getQueryData(e){var s;const t=this.defaultQueryOptions({queryKey:e});return(s=h(this,j).get(t.queryHash))==null?void 0:s.state.data}ensureQueryData(e){const t=this.getQueryData(e.queryKey);if(t===void 0)return this.fetchQuery(e);{const s=this.defaultQueryOptions(e),i=h(this,j).build(this,s);return e.revalidateIfStale&&i.isStaleByTime(qt(s.staleTime,i))&&this.prefetchQuery(s),Promise.resolve(t)}}getQueriesData(e){return h(this,j).findAll(e).map(({queryKey:t,state:s})=>{const i=s.data;return[t,i]})}setQueryData(e,t,s){const i=this.defaultQueryOptions({queryKey:e}),r=h(this,j).get(i.queryHash),n=r==null?void 0:r.state.data,o=Fi(t,n);if(o!==void 0)return h(this,j).build(this,i).setData(o,{...s,manual:!0})}setQueriesData(e,t,s){return z.batch(()=>h(this,j).findAll(e).map(({queryKey:i})=>[i,this.setQueryData(i,t,s)]))}getQueryState(e){var s;const t=this.defaultQueryOptions({queryKey:e});return(s=h(this,j).get(t.queryHash))==null?void 0:s.state}removeQueries(e){const t=h(this,j);z.batch(()=>{t.findAll(e).forEach(s=>{t.remove(s)})})}resetQueries(e,t){const s=h(this,j),i={type:"active",...e};return z.batch(()=>(s.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries(i,t)))}cancelQueries(e={},t={}){const s={revert:!0,...t},i=z.batch(()=>h(this,j).findAll(e).map(r=>r.cancel(s)));return Promise.all(i).then(lt).catch(lt)}invalidateQueries(e={},t={}){return z.batch(()=>{if(h(this,j).findAll(e).forEach(i=>{i.invalidate()}),e.refetchType==="none")return Promise.resolve();const s={...e,type:e.refetchType??e.type??"active"};return this.refetchQueries(s,t)})}refetchQueries(e={},t){const s={...t,cancelRefetch:(t==null?void 0:t.cancelRefetch)??!0},i=z.batch(()=>h(this,j).findAll(e).filter(r=>!r.isDisabled()).map(r=>{let n=r.fetch(void 0,s);return s.throwOnError||(n=n.catch(lt)),r.state.fetchStatus==="paused"?Promise.resolve():n}));return Promise.all(i).then(lt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const s=h(this,j).build(this,t);return s.isStaleByTime(qt(t.staleTime,s))?s.fetch(t):Promise.resolve(s.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(lt).catch(lt)}fetchInfiniteQuery(e){return e.behavior=ki(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(lt).catch(lt)}resumePausedMutations(){return Ce.isOnline()?h(this,Rt).resumePausedMutations():Promise.resolve()}getQueryCache(){return h(this,j)}getMutationCache(){return h(this,Rt)}getDefaultOptions(){return h(this,Ct)}setDefaultOptions(e){P(this,Ct,e)}setQueryDefaults(e,t){h(this,Yt).set(fe(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...h(this,Yt).values()];let s={};return t.forEach(i=>{pe(e,i.queryKey)&&(s={...s,...i.defaultOptions})}),s}setMutationDefaults(e,t){h(this,Zt).set(fe(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...h(this,Zt).values()];let s={};return t.forEach(i=>{pe(e,i.mutationKey)&&(s={...s,...i.defaultOptions})}),s}defaultQueryOptions(e){if(e._defaulted)return e;const t={...h(this,Ct).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=ls(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===Hs&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...h(this,Ct).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){h(this,j).clear(),h(this,Rt).clear()}},j=new WeakMap,Rt=new WeakMap,Ct=new WeakMap,Yt=new WeakMap,Zt=new WeakMap,Et=new WeakMap,te=new WeakMap,ee=new WeakMap,Ks),tt,L,ye,X,Bt,se,gt,ge,ie,re,$t,Qt,xt,ne,A,ce,Xe,Ye,Ze,ts,es,ss,is,ti,Ns,$i=(Ns=class extends be{constructor(t,s){super();_(this,A);_(this,tt);_(this,L);_(this,ye);_(this,X);_(this,Bt);_(this,se);_(this,gt);_(this,ge);_(this,ie);_(this,re);_(this,$t);_(this,Qt);_(this,xt);_(this,ne,new Set);this.options=s,P(this,tt,t),P(this,gt,null),this.bindMethods(),this.setOptions(s)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(h(this,L).addObserver(this),Ps(h(this,L),this.options)?x(this,A,ce).call(this):this.updateResult(),x(this,A,ts).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return rs(h(this,L),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return rs(h(this,L),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,x(this,A,es).call(this),x(this,A,ss).call(this),h(this,L).removeObserver(this)}setOptions(t,s){const i=this.options,r=h(this,L);if(this.options=h(this,tt).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ht(this.options.enabled,h(this,L))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");x(this,A,is).call(this),h(this,L).setOptions(this.options),i._defaulted&&!We(this.options,i)&&h(this,tt).getQueryCache().notify({type:"observerOptionsUpdated",query:h(this,L),observer:this});const n=this.hasListeners();n&&ws(h(this,L),r,this.options,i)&&x(this,A,ce).call(this),this.updateResult(s),n&&(h(this,L)!==r||ht(this.options.enabled,h(this,L))!==ht(i.enabled,h(this,L))||qt(this.options.staleTime,h(this,L))!==qt(i.staleTime,h(this,L)))&&x(this,A,Xe).call(this);const o=x(this,A,Ye).call(this);n&&(h(this,L)!==r||ht(this.options.enabled,h(this,L))!==ht(i.enabled,h(this,L))||o!==h(this,xt))&&x(this,A,Ze).call(this,o)}getOptimisticResult(t){const s=h(this,tt).getQueryCache().build(h(this,tt),t),i=this.createResult(s,t);return Ui(this,i)&&(P(this,X,i),P(this,se,this.options),P(this,Bt,h(this,L).state)),i}getCurrentResult(){return h(this,X)}trackResult(t,s){const i={};return Object.keys(t).forEach(r=>{Object.defineProperty(i,r,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(r),s==null||s(r),t[r])})}),i}trackProp(t){h(this,ne).add(t)}getCurrentQuery(){return h(this,L)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const s=h(this,tt).defaultQueryOptions(t),i=h(this,tt).getQueryCache().build(h(this,tt),s);return i.isFetchingOptimistic=!0,i.fetch().then(()=>this.createResult(i,s))}fetch(t){return x(this,A,ce).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),h(this,X)))}createResult(t,s){var E;const i=h(this,L),r=this.options,n=h(this,X),o=h(this,Bt),a=h(this,se),u=t!==i?t.state:h(this,ye),{state:l}=t;let d={...l},f=!1,p;if(s._optimisticResults){const b=this.hasListeners(),T=!b&&Ps(t,s),K=b&&ws(t,i,s,r);(T||K)&&(d={...d,...Zs(l.data,t.options)}),s._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:v,errorUpdatedAt:m,status:g}=d;if(s.select&&d.data!==void 0)if(n&&d.data===(o==null?void 0:o.data)&&s.select===h(this,ge))p=h(this,ie);else try{P(this,ge,s.select),p=s.select(d.data),p=Je(n==null?void 0:n.data,p,s),P(this,ie,p),P(this,gt,null)}catch(b){P(this,gt,b)}else p=d.data;if(s.placeholderData!==void 0&&p===void 0&&g==="pending"){let b;if(n!=null&&n.isPlaceholderData&&s.placeholderData===(a==null?void 0:a.placeholderData))b=n.data;else if(b=typeof s.placeholderData=="function"?s.placeholderData((E=h(this,re))==null?void 0:E.state.data,h(this,re)):s.placeholderData,s.select&&b!==void 0)try{b=s.select(b),P(this,gt,null)}catch(T){P(this,gt,T)}b!==void 0&&(g="success",p=Je(n==null?void 0:n.data,b,s),f=!0)}h(this,gt)&&(v=h(this,gt),p=h(this,ie),m=Date.now(),g="error");const M=d.fetchStatus==="fetching",S=g==="pending",y=g==="error",w=S&&M,R=p!==void 0;return{status:g,fetchStatus:d.fetchStatus,isPending:S,isSuccess:g==="success",isError:y,isInitialLoading:w,isLoading:w,data:p,dataUpdatedAt:d.dataUpdatedAt,error:v,errorUpdatedAt:m,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>u.dataUpdateCount||d.errorUpdateCount>u.errorUpdateCount,isFetching:M,isRefetching:M&&!S,isLoadingError:y&&!R,isPaused:d.fetchStatus==="paused",isPlaceholderData:f,isRefetchError:y&&R,isStale:hs(t,s),refetch:this.refetch}}updateResult(t){const s=h(this,X),i=this.createResult(h(this,L),this.options);if(P(this,Bt,h(this,L).state),P(this,se,this.options),h(this,Bt).data!==void 0&&P(this,re,h(this,L)),We(i,s))return;P(this,X,i);const r={},n=()=>{if(!s)return!0;const{notifyOnChangeProps:o}=this.options,a=typeof o=="function"?o():o;if(a==="all"||!a&&!h(this,ne).size)return!0;const c=new Set(a??h(this,ne));return this.options.throwOnError&&c.add("error"),Object.keys(h(this,X)).some(u=>{const l=u;return h(this,X)[l]!==s[l]&&c.has(l)})};(t==null?void 0:t.listeners)!==!1&&n()&&(r.listeners=!0),x(this,A,ti).call(this,{...r,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&x(this,A,ts).call(this)}},tt=new WeakMap,L=new WeakMap,ye=new WeakMap,X=new WeakMap,Bt=new WeakMap,se=new WeakMap,gt=new WeakMap,ge=new WeakMap,ie=new WeakMap,re=new WeakMap,$t=new WeakMap,Qt=new WeakMap,xt=new WeakMap,ne=new WeakMap,A=new WeakSet,ce=function(t){x(this,A,is).call(this);let s=h(this,L).fetch(this.options,t);return t!=null&&t.throwOnError||(s=s.catch(lt)),s},Xe=function(){x(this,A,es).call(this);const t=qt(this.options.staleTime,h(this,L));if(oe||h(this,X).isStale||!He(t))return;const i=qs(h(this,X).dataUpdatedAt,t)+1;P(this,$t,setTimeout(()=>{h(this,X).isStale||this.updateResult()},i))},Ye=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(h(this,L)):this.options.refetchInterval)??!1},Ze=function(t){x(this,A,ss).call(this),P(this,xt,t),!(oe||ht(this.options.enabled,h(this,L))===!1||!He(h(this,xt))||h(this,xt)===0)&&P(this,Qt,setInterval(()=>{(this.options.refetchIntervalInBackground||cs.isFocused())&&x(this,A,ce).call(this)},h(this,xt)))},ts=function(){x(this,A,Xe).call(this),x(this,A,Ze).call(this,x(this,A,Ye).call(this))},es=function(){h(this,$t)&&(clearTimeout(h(this,$t)),P(this,$t,void 0))},ss=function(){h(this,Qt)&&(clearInterval(h(this,Qt)),P(this,Qt,void 0))},is=function(){const t=h(this,tt).getQueryCache().build(h(this,tt),this.options);if(t===h(this,L))return;const s=h(this,L);P(this,L,t),P(this,ye,t.state),this.hasListeners()&&(s==null||s.removeObserver(this),t.addObserver(this))},ti=function(t){z.batch(()=>{t.listeners&&this.listeners.forEach(s=>{s(h(this,X))}),h(this,tt).getQueryCache().notify({query:h(this,L),type:"observerResultsUpdated"})})},Ns);function Qi(e,t){return ht(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Ps(e,t){return Qi(e,t)||e.state.data!==void 0&&rs(e,t,t.refetchOnMount)}function rs(e,t,s){if(ht(t.enabled,e)!==!1){const i=typeof s=="function"?s(e):s;return i==="always"||i!==!1&&hs(e,t)}return!1}function ws(e,t,s,i){return(e!==t||ht(i.enabled,e)===!1)&&(!s.suspense||e.state.status!=="error")&&hs(e,s)}function hs(e,t){return ht(t.enabled,e)!==!1&&e.isStaleByTime(qt(t.staleTime,e))}function Ui(e,t){return!We(e.getCurrentResult(),t)}var ei=C.createContext(void 0),Ki=e=>{const t=C.useContext(ei);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},_n=({client:e,children:t})=>(C.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),F.jsx(ei.Provider,{value:e,children:t})),si=C.createContext(!1),Ni=()=>C.useContext(si);si.Provider;function qi(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var zi=C.createContext(qi()),Hi=()=>C.useContext(zi);function Wi(e,t){return typeof e=="function"?e(...t):!!e}var Gi=(e,t)=>{(e.suspense||e.throwOnError)&&(t.isReset()||(e.retryOnMount=!1))},Ji=e=>{C.useEffect(()=>{e.clearReset()},[e])},Xi=({result:e,errorResetBoundary:t,throwOnError:s,query:i})=>e.isError&&!t.isReset()&&!e.isFetching&&i&&Wi(s,[e.error,i]),Yi=(e,t)=>t.state.data===void 0,Zi=e=>{e.suspense&&typeof e.staleTime!="number"&&(e.staleTime=1e3)},tr=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,er=(e,t,s)=>t.fetchOptimistic(e).catch(()=>{s.clearReset()});function sr(e,t,s){var u,l,d,f;const i=Ki(),r=Ni(),n=Hi(),o=i.defaultQueryOptions(e);(l=(u=i.getDefaultOptions().queries)==null?void 0:u._experimental_beforeQuery)==null||l.call(u,o),o._optimisticResults=r?"isRestoring":"optimistic",Zi(o),Gi(o,n),Ji(n);const[a]=C.useState(()=>new t(i,o)),c=a.getOptimisticResult(o);if(C.useSyncExternalStore(C.useCallback(p=>{const v=r?()=>{}:a.subscribe(z.batchCalls(p));return a.updateResult(),v},[a,r]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),C.useEffect(()=>{a.setOptions(o,{listeners:!1})},[o,a]),tr(o,c))throw er(o,a,n);if(Xi({result:c,errorResetBoundary:n,throwOnError:o.throwOnError,query:i.getQueryCache().get(o.queryHash)}))throw c.error;return(f=(d=i.getDefaultOptions().queries)==null?void 0:d._experimental_afterQuery)==null||f.call(d,o,c),o.notifyOnChangeProps?c:a.trackResult(c)}function Rn(e,t){return sr({...e,enabled:!0,suspense:!0,throwOnError:Yi,placeholderData:void 0},$i)}function Cn(e){return e}const Fs="pushstate",_s="popstate",ii="beforeunload",ri=e=>(e.preventDefault(),e.returnValue=""),ir=()=>{removeEventListener(ii,ri,{capture:!0})};function ni(e){let t=e.getLocation();const s=new Set;let i=[];const r=()=>{t=e.getLocation(),s.forEach(o=>o())},n=async(o,a)=>{var c;if(!((a==null?void 0:a.ignoreBlocker)??!1)&&typeof document<"u"&&i.length){for(const l of i)if(!await l()){(c=e.onBlocked)==null||c.call(e,r);return}}o()};return{get location(){return t},subscribers:s,subscribe:o=>(s.add(o),()=>{s.delete(o)}),push:(o,a,c)=>{a=he(a),n(()=>{e.pushState(o,a),r()},c)},replace:(o,a,c)=>{a=he(a),n(()=>{e.replaceState(o,a),r()},c)},go:(o,a)=>{n(()=>{e.go(o),r()},a)},back:o=>{n(()=>{e.back(),r()},o)},forward:o=>{n(()=>{e.forward(),r()},o)},createHref:o=>e.createHref(o),block:o=>(i.push(o),i.length===1&&addEventListener(ii,ri,{capture:!0}),()=>{i=i.filter(a=>a!==o),i.length||ir()}),flush:()=>{var o;return(o=e.flush)==null?void 0:o.call(e)},destroy:()=>{var o;return(o=e.destroy)==null?void 0:o.call(e)},notify:r}}function he(e){return e||(e={}),{...e,key:oi()}}function rr(e){const t=typeof document<"u"?window:void 0,s=t.history.pushState,i=t.history.replaceState,r=m=>m,n=()=>ns(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state);let o=n(),a;const c=()=>o;let u,l;const d=()=>{if(!u)return;(u.isPush?s:i).call(t.history,u.state,"",u.href),u=void 0,l=void 0,a=void 0},f=(m,g,M)=>{const S=r(g);l||(a=o),o=ns(g,M),u={href:S,state:M,isPush:(u==null?void 0:u.isPush)||m==="push"},l||(l=Promise.resolve().then(()=>d()))},p=()=>{o=n(),v.notify()},v=ni({getLocation:c,pushState:(m,g)=>f("push",m,g),replaceState:(m,g)=>f("replace",m,g),back:()=>t.history.back(),forward:()=>t.history.forward(),go:m=>t.history.go(m),createHref:m=>r(m),flush:d,destroy:()=>{t.history.pushState=s,t.history.replaceState=i,t.removeEventListener(Fs,p),t.removeEventListener(_s,p)},onBlocked:m=>{a&&o!==a&&(o=a,m())}});return t.addEventListener(Fs,p),t.addEventListener(_s,p),t.history.pushState=function(...m){const g=s.apply(t.history,m);return p(),g},t.history.replaceState=function(...m){const g=i.apply(t.history,m);return p(),g},v}function nr(e={initialEntries:["/"]}){const t=e.initialEntries;let s=e.initialIndex??t.length-1,i={key:oi()};return ni({getLocation:()=>ns(t[s],i),pushState:(n,o)=>{i=o,t.splice,s{i=o,t[s]=n},back:()=>{i=he(i),s=Math.max(s-1,0)},forward:()=>{i=he(i),s=Math.min(s+1,t.length-1)},go:n=>{i=he(i),s=Math.min(Math.max(s+n,0),t.length-1)},createHref:n=>n})}function ns(e,t){const s=e.indexOf("#"),i=e.indexOf("?");return{href:e,pathname:e.substring(0,s>0?i>0?Math.min(s,i):s:i>0?i:e.length),hash:s>-1?e.substring(s):"",search:i>-1?e.slice(i,s===-1?void 0:s):"",state:t||{}}}function oi(){return(Math.random()+1).toString(36).substring(7)}var or="Invariant failed";function et(e,t){if(!e)throw new Error(or)}const Qe=C.createContext(null);function ai(){return typeof document>"u"?Qe:window.__TSR_ROUTER_CONTEXT__?window.__TSR_ROUTER_CONTEXT__:(window.__TSR_ROUTER_CONTEXT__=Qe,Qe)}function Ot(e){const t=C.useContext(ai());return e==null||e.warn,t}var ui={exports:{}},li={},ci={exports:{}},hi={};/** * @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 ae=C;function ar(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ur=typeof Object.is=="function"?Object.is:ar,lr=ae.useState,cr=ae.useEffect,hr=ae.useLayoutEffect,dr=ae.useDebugValue;function fr(e,t){var s=t(),i=lr({inst:{value:s,getSnapshot:t}}),r=i[0].inst,n=i[1];return hr(function(){r.value=s,r.getSnapshot=t,Ue(r)&&n({inst:r})},[e,s,t]),cr(function(){return Ue(r)&&n({inst:r}),e(function(){Ue(r)&&n({inst:r})})},[e]),dr(s),s}function Ue(e){var t=e.getSnapshot;e=e.value;try{var s=t();return!ur(e,s)}catch{return!0}}function pr(e,t){return t()}var mr=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?pr:fr;hi.useSyncExternalStore=ae.useSyncExternalStore!==void 0?ae.useSyncExternalStore:mr;ci.exports=hi;var vr=ci.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 Te=C,yr=vr;function gr(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var br=typeof Object.is=="function"?Object.is:gr,Sr=yr.useSyncExternalStore,Mr=Te.useRef,Pr=Te.useEffect,wr=Te.useMemo,Fr=Te.useDebugValue;li.useSyncExternalStoreWithSelector=function(e,t,s,i,r){var n=Mr(null);if(n.current===null){var o={hasValue:!1,value:null};n.current=o}else o=n.current;n=wr(function(){function c(p){if(!u){if(u=!0,l=p,p=i(p),r!==void 0&&o.hasValue){var v=o.value;if(r(v,p))return d=v}return d=p}if(v=d,br(l,p))return v;var m=i(p);return r!==void 0&&r(v,m)?v:(l=p,d=m)}var u=!1,l,d,f=s===void 0?null:s;return[function(){return c(t())},f===null?void 0:function(){return c(f())}]},[t,s,i,r]);var a=Sr(e,n[0],n[1]);return Pr(function(){o.hasValue=!0,o.value=a},[a]),Fr(a),a};ui.exports=li;var _r=ui.exports;class ds{constructor(t,s){this.listeners=new Set,this._batching=!1,this._flushing=0,this.subscribe=i=>{var r,n;this.listeners.add(i);const o=(n=(r=this.options)==null?void 0:r.onSubscribe)==null?void 0:n.call(r,i,this);return()=>{this.listeners.delete(i),o==null||o()}},this.setState=i=>{var r,n,o;const a=this.state;this.state=(r=this.options)!=null&&r.updateFn?this.options.updateFn(a)(i):i(a),(o=(n=this.options)==null?void 0:n.onUpdate)==null||o.call(n),this._flush()},this._flush=()=>{if(this._batching)return;const i=++this._flushing;this.listeners.forEach(r=>{this._flushing===i&&r()})},this.batch=i=>{if(this._batching)return i();this._batching=!0,i(),this._batching=!1,this._flush()},this.state=t,this.options=s}}function Ee(e,t=s=>s){return _r.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,Rr)}function Rr(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const s=Object.keys(e);if(s.length!==Object.keys(t).length)return!1;for(let i=0;i{t.substring(0,1)==="?"&&(t=t.substring(1));const s=Er(t);for(const i in s){const r=s[i];if(typeof r=="string")try{s[i]=e(r)}catch{}}return s}}function Ar(e,t){function s(i){if(typeof i=="object"&&i!==null)try{return e(i)}catch{}else if(typeof i=="string"&&typeof t=="function")try{return t(i),e(i)}catch{}return i}return i=>{i={...i},Object.keys(i).forEach(n=>{const o=i[n];typeof o>"u"||o===void 0?delete i[n]:i[n]=s(o)});const r=Cr(i).toString();return r?`?${r}`:""}}function xe(e){return e[e.length-1]}function Tr(e){return typeof e=="function"}function Nt(e,t){return Tr(e)?e(t):e}function de(e,t){return t.reduce((s,i)=>(s[i]=e[i],s),{})}function ft(e,t){if(e===t)return e;const s=t,i=Es(e)&&Es(s);if(i||Le(e)&&Le(s)){const r=i?e:Object.keys(e),n=r.length,o=i?s:Object.keys(s),a=o.length,c=i?[]:{};let u=0;for(let l=0;l"u")return!0;const s=t.prototype;return!(!Cs(s)||!s.hasOwnProperty("isPrototypeOf"))}function Cs(e){return Object.prototype.toString.call(e)==="[object Object]"}function Es(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function zt(e,t,s=!1){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Le(e)&&Le(t)){const i=Object.keys(e).filter(n=>e[n]!==void 0),r=Object.keys(t).filter(n=>t[n]!==void 0);return!s&&i.length!==r.length?!1:!r.some(n=>!(n in e)||!zt(e[n],t[n],s))}return Array.isArray(e)&&Array.isArray(t)?e.length!==t.length?!1:!e.some((i,r)=>!zt(i,t[r],s)):!1}const Ke=typeof window<"u"?C.useLayoutEffect:C.useEffect;function Kt(e){let t,s;const i=new Promise((r,n)=>{t=r,s=n});return i.status="pending",i.resolve=r=>{i.status="resolved",i.value=r,t(r),e==null||e(r)},i.reject=r=>{i.status="rejected",s(r)},i}function xs(e){const t=C.useRef({value:e,prev:null}),s=t.current.value;return e!==s&&(t.current={value:e,prev:s}),t.current.prev}function Lt(e){return Ie(e.filter(Boolean).join("/"))}function Ie(e){return e.replace(/\/{2,}/g,"/")}function fs(e){return e==="/"?e:e.replace(/^\/{1,}/,"")}function It(e){return e==="/"?e:e.replace(/\/{1,}$/,"")}function Ir(e){return It(fs(e))}function Oe(e,t){return e.endsWith("/")&&e!=="/"&&e!==`${t}/`?e.slice(0,-1):e}function Vr(e,t,s){return Oe(e,s)===Oe(t,s)}function jr({basepath:e,base:t,to:s,trailingSlash:i="never"}){var r,n;t=t.replace(new RegExp(`^${e}`),"/"),s=s.replace(new RegExp(`^${e}`),"/");let o=ue(t);const a=ue(s);o.length>1&&((r=xe(o))==null?void 0:r.value)==="/"&&o.pop(),a.forEach((u,l)=>{u.value==="/"?l?l===a.length-1&&o.push(u):o=[u]:u.value===".."?o.pop():u.value==="."||o.push(u)}),o.length>1&&(((n=xe(o))==null?void 0:n.value)==="/"?i==="never"&&o.pop():i==="always"&&o.push({type:"pathname",value:"/"}));const c=Lt([e,...o.map(u=>u.value)]);return Ie(c)}function ue(e){if(!e)return[];e=Ie(e);const t=[];if(e.slice(0,1)==="/"&&(e=e.substring(1),t.push({type:"pathname",value:"/"})),!e)return t;const s=e.split("/").filter(Boolean);return t.push(...s.map(i=>i==="$"||i==="*"?{type:"wildcard",value:i}:i.charAt(0)==="$"?{type:"param",value:i}:{type:"pathname",value:decodeURIComponent(i)})),e.slice(-1)==="/"&&(e=e.substring(1),t.push({type:"pathname",value:"/"})),t}function Ne({path:e,params:t,leaveWildcards:s,leaveParams:i}){const r=ue(e),n={};for(const[o,a]of Object.entries(t)){const c=typeof a=="string";["*","_splat"].includes(o)?n[o]=c?encodeURI(a):a:n[o]=c?encodeURIComponent(a):a}return Lt(r.map(o=>{if(o.type==="wildcard"){const a=n._splat;return s?`${o.value}${a??""}`:a}if(o.type==="param"){if(i){const a=n[o.value];return`${o.value}${a??""}`}return n[o.value.substring(1)]??"undefined"}return o.value}))}function we(e,t,s){const i=Dr(e,t,s);if(!(s.to&&!i))return i??{}}function Ls(e,t){switch(!0){case e==="/":return t;case t===e:return"";case t.length{for(let c=0;c=r.length-1,f=c>=n.length-1;if(l){if(l.type==="wildcard"){if(u!=null&&u.value){const p=decodeURI(Lt(r.slice(c).map(v=>v.value)));return o["*"]=p,o._splat=p,!0}return!1}if(l.type==="pathname"){if(l.value==="/"&&!(u!=null&&u.value))return!0;if(u){if(s.caseSensitive){if(l.value!==u.value)return!1}else if(l.value.toLowerCase()!==u.value.toLowerCase())return!1}}if(!u)return!1;if(l.type==="param"){if(u.value==="/")return!1;u.value.charAt(0)!=="$"&&(o[l.value.substring(1)]=decodeURIComponent(u.value))}}if(!d&&f)return o["**"]=Lt(r.slice(c+1).map(p=>p.value)),!!s.fuzzy&&(l==null?void 0:l.value)!=="/"}return!0})()?o:void 0}function En(e){if(e.isRedirect=!0,e.statusCode=e.statusCode||e.code||301,e.headers=e.headers||{},e.throw)throw e;return e}function Tt(e){return!!(e!=null&&e.isRedirect)}function Os(e){return!!(e!=null&&e.isRedirect)&&e.href}function ps(e){const t=e.errorComponent??Ve;return F.jsx(kr,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:s,reset:i})=>s?C.createElement(t,{error:s,reset:i}):e.children})}class kr extends C.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,s){s.error&&s.resetKey!==this.state.resetKey&&this.reset()}componentDidCatch(t,s){this.props.onCatch&&this.props.onCatch(t,s)}render(){return this.props.children({error:this.state.resetKey!==this.props.getResetKey()?null:this.state.error,reset:()=>{this.reset()}})}}function Ve({error:e}){const[t,s]=C.useState(!1);return F.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[F.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[F.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),F.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>s(i=>!i),children:t?"Hide Error":"Show Error"})]}),F.jsx("div",{style:{height:".25rem"}}),t?F.jsx("div",{children:F.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:e.message?F.jsx("code",{children:e.message}):null})}):null]})}function Y(e){const t=Ot({warn:(e==null?void 0:e.router)===void 0});return Ee(((e==null?void 0:e.router)||t).__store,e==null?void 0:e.select)}function pt(e){return!!(e!=null&&e.isNotFound)}function Br(e){const t=Y({select:s=>`not-found-${s.location.pathname}-${s.status}`});return F.jsx(ps,{getResetKey:()=>t,onCatch:(s,i)=>{var r;if(pt(s))(r=e.onCatch)==null||r.call(e,s,i);else throw s},errorComponent:({error:s})=>{var i;return(i=e.fallback)==null?void 0:i.call(e,s)},children:e.children})}function $r(){return F.jsx("p",{children:"Not Found"})}const Qr=["component","errorComponent","pendingComponent","notFoundComponent"];function xn(e){return new Ur(e)}class Ur{constructor(t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.subscribers=new Set,this.startReactTransition=s=>s(),this.update=s=>{s.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 i=this.options;this.options={...this.options,...s},this.isServer=this.options.isServer??typeof document>"u",(!this.basepath||s.basepath&&s.basepath!==i.basepath)&&(s.basepath===void 0||s.basepath===""||s.basepath==="/"?this.basepath="/":this.basepath=`/${Ir(s.basepath)}`),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.history=this.options.history??(this.isServer?nr({initialEntries:[this.basepath||"/"]}):rr()),this.latestLocation=this.parseLocation()),this.options.routeTree!==this.routeTree&&(this.routeTree=this.options.routeTree,this.buildRouteTree()),this.__store||(this.__store=new ds(qr(this.latestLocation),{onUpdate:()=>{this.__store.state={...this.state,cachedMatches:this.state.cachedMatches.filter(r=>!["redirected"].includes(r.status))}}}))},this.buildRouteTree=()=>{this.routesById={},this.routesByPath={};const s=this.options.notFoundRoute;s&&(s.init({originalIndex:99999999999}),this.routesById[s.id]=s);const i=o=>{o.forEach((a,c)=>{a.init({originalIndex:c});const u=this.routesById[a.id];if(et(!u,`Duplicate routes found with id: ${String(a.id)}`),this.routesById[a.id]=a,!a.isRoot&&a.path){const d=It(a.fullPath);(!this.routesByPath[d]||a.fullPath.endsWith("/"))&&(this.routesByPath[d]=a)}const l=a.children;l!=null&&l.length&&i(l)})};i([this.routeTree]);const r=[];Object.values(this.routesById).forEach((o,a)=>{var c;if(o.isRoot||!o.path)return;const u=fs(o.fullPath),l=ue(u);for(;l.length>1&&((c=l[0])==null?void 0:c.value)==="/";)l.shift();const d=l.map(f=>f.value==="/"?.75:f.type==="param"?.5:f.type==="wildcard"?.25:1);r.push({child:o,trimmed:u,parsed:l,index:a,scores:d})}),this.flatRoutes=r.sort((o,a)=>{const c=Math.min(o.scores.length,a.scores.length);for(let u=0;ua.parsed[u].value?1:-1;return o.index-a.index}).map((o,a)=>(o.child.rank=a,o.child))},this.subscribe=(s,i)=>{const r={eventType:s,fn:i};return this.subscribers.add(r),()=>{this.subscribers.delete(r)}},this.emit=s=>{this.subscribers.forEach(i=>{i.eventType===s.type&&i.fn(s)})},this.parseLocation=s=>{const i=({pathname:a,search:c,hash:u,state:l})=>{const d=this.options.parseSearch(c),f=this.options.stringifySearch(d);return{pathname:a,searchStr:f,search:ft(s==null?void 0:s.search,d),hash:u.split("#").reverse()[0]??"",href:`${a}${f}${u}`,state:ft(s==null?void 0:s.state,l)}},r=i(this.history.location),{__tempLocation:n,__tempKey:o}=r.state;if(n&&(!o||o===this.tempLocationKey)){const a=i(n);return a.state.key=r.state.key,delete a.state.__tempLocation,{...a,maskedLocation:r}}return r},this.resolvePathWithBase=(s,i)=>jr({basepath:this.basepath,base:s,to:Ie(i),trailingSlash:this.options.trailingSlash}),this.matchRoutes=(s,i,r)=>{let n={};const o=this.flatRoutes.find(p=>{const v=we(this.basepath,It(s),{to:p.fullPath,caseSensitive:p.options.caseSensitive??this.options.caseSensitive,fuzzy:!0});return v?(n=v,!0):!1});let a=o||this.routesById[it];const c=[a];let u=!1;for((o?o.path!=="/"&&n["**"]:It(s))&&(this.options.notFoundRoute?c.push(this.options.notFoundRoute):u=!0);a.parentRoute;)a=a.parentRoute,c.unshift(a);const l=(()=>{if(u){if(this.options.notFoundMode!=="root")for(let p=c.length-1;p>=0;p--){const v=c[p];if(v.children)return v.id}return it}})(),d=c.map(p=>{var v;let m;const g=((v=p.options.params)==null?void 0:v.parse)??p.options.parseParams;if(g)try{const M=g(n);Object.assign(n,M)}catch(M){if(m=new Nr(M.message,{cause:M}),r!=null&&r.throwOnError)throw m;return m}}),f=[];return c.forEach((p,v)=>{var m,g,M,S,y,w,R,O,E,b;const T=f[v-1],[K,N]=(()=>{const k=(T==null?void 0:T.search)??i;try{const W=typeof p.options.validateSearch=="object"?p.options.validateSearch.parse:p.options.validateSearch,Z=(W==null?void 0:W(k))??{};return[{...k,...Z},void 0]}catch(W){const Z=new Kr(W.message,{cause:W});if(r!=null&&r.throwOnError)throw Z;return[k,Z]}})(),$=((g=(m=p.options).loaderDeps)==null?void 0:g.call(m,{search:K}))??"",I=$?JSON.stringify($):"",U=Ne({path:p.fullPath,params:n}),q=Ne({path:p.id,params:n,leaveWildcards:!0})+I,H=this.getMatch(q),dt=this.state.matches.find(k=>k.id===q)?"stay":"enter";let D;if(H)D={...H,cause:dt,params:n};else{const k=p.options.loader||p.options.beforeLoad||p.lazyFn?"pending":"success";D={id:q,index:v,routeId:p.id,params:n,pathname:Lt([this.basepath,U]),updatedAt:Date.now(),search:{},searchError:void 0,status:k,isFetching:!1,error:void 0,paramsError:d[v],routeContext:void 0,context:void 0,abortController:new AbortController,fetchCount:0,cause:dt,loaderDeps:$,invalid:!1,preload:!1,links:(S=(M=p.options).links)==null?void 0:S.call(M),scripts:(w=(y=p.options).scripts)==null?void 0:w.call(y),staticData:p.options.staticData||{},loadPromise:Kt()}}D.status==="success"&&(D.meta=(O=(R=p.options).meta)==null?void 0:O.call(R,{matches:f,match:D,params:D.params,loaderData:D.loaderData}),D.headers=(b=(E=p.options).headers)==null?void 0:b.call(E,{loaderData:D.loaderData})),r!=null&&r.preload||(D.globalNotFound=l===p.id),D.search=ft(D.search,K),D.searchError=N,f.push(D)}),f},this.cancelMatch=s=>{const i=this.getMatch(s);i&&(i.abortController.abort(),clearTimeout(i.pendingTimeout))},this.cancelMatches=()=>{var s;(s=this.state.pendingMatches)==null||s.forEach(i=>{this.cancelMatch(i.id)})},this.buildLocation=s=>{const i=(n={},o)=>{var a,c,u;const l=n._fromLocation!=null?this.matchRoutes(n._fromLocation.pathname,n.fromSearch||n._fromLocation.search):this.state.matches,d=n.from!=null?l.find(I=>we(this.basepath,It(I.pathname),{to:n.from,caseSensitive:!1,fuzzy:!1})):void 0,f=(d==null?void 0:d.pathname)||this.latestLocation.pathname;et(n.from==null||d!=null,"Could not find match for from: "+n.from);const p=((a=xe(l))==null?void 0:a.search)||this.latestLocation.search,v=o==null?void 0:o.filter(I=>l.find(U=>U.routeId===I.routeId)),m=this.routesById[(c=v==null?void 0:v.find(I=>I.pathname===f))==null?void 0:c.routeId];let g=n.to?this.resolvePathWithBase(f,`${n.to}`):this.resolvePathWithBase(f,(m==null?void 0:m.to)??f);const M={...(u=xe(l))==null?void 0:u.params};let S=(n.params??!0)===!0?M:{...M,...Nt(n.params,M)};Object.keys(S).length>0&&(o==null||o.map(I=>{var U;const q=this.looseRoutesById[I.routeId];return((U=q==null?void 0:q.options.params)==null?void 0:U.stringify)??q.options.stringifyParams}).filter(Boolean).forEach(I=>{S={...S,...I(S)}})),g=Ne({path:g,params:S??{},leaveWildcards:!1,leaveParams:s.leaveParams});const y=(v==null?void 0:v.map(I=>this.looseRoutesById[I.routeId].options.preSearchFilters??[]).flat().filter(Boolean))??[],w=(v==null?void 0:v.map(I=>this.looseRoutesById[I.routeId].options.postSearchFilters??[]).flat().filter(Boolean))??[],R=y.length?y.reduce((I,U)=>U(I),p):p,O=n.search===!0?R:n.search?Nt(n.search,R):y.length?R:{},E=w.length?w.reduce((I,U)=>U(I),O):O,b=ft(p,E),T=this.options.stringifySearch(b),K=n.hash===!0?this.latestLocation.hash:n.hash?Nt(n.hash,this.latestLocation.hash):void 0,N=K?`#${K}`:"";let $=n.state===!0?this.latestLocation.state:n.state?Nt(n.state,this.latestLocation.state):{};return $=ft(this.latestLocation.state,$),{pathname:g,search:b,searchStr:T,state:$,hash:K??"",href:`${g}${T}${N}`,unmaskOnReload:n.unmaskOnReload}},r=(n={},o)=>{var a;const c=i(n);let u=o?i(o):void 0;if(!u){let v={};const m=(a=this.options.routeMasks)==null?void 0:a.find(g=>{const M=we(this.basepath,c.pathname,{to:g.from,caseSensitive:!1,fuzzy:!1});return M?(v=M,!0):!1});if(m){const{from:g,...M}=m;o={...de(s,["from"]),...M,params:v},u=i(o)}}const l=this.matchRoutes(c.pathname,c.search),d=u?this.matchRoutes(u.pathname,u.search):void 0,f=u?i(o,d):void 0,p=i(n,l);return f&&(p.maskedLocation=f),p};return s.mask?r(s,{...de(s,["from"]),...s.mask}):r(s)},this.commitLocation=({viewTransition:s,ignoreBlocker:i,...r})=>{const n=()=>{r.state.key=this.latestLocation.state.key;const c=zt(r.state,this.latestLocation.state);return delete r.state.key,c},o=this.latestLocation.href===r.href,a=this.commitLocationPromise;if(this.commitLocationPromise=Kt(()=>{a==null||a.resolve()}),o&&n())this.load();else{let{maskedLocation:c,...u}=r;c&&(u={...c,state:{...c.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=s,this.history[r.replace?"replace":"push"](u.href,u.state,{ignoreBlocker:i})}return this.resetNextScroll=r.resetScroll??!0,this.history.subscribers.size||this.load(),this.commitLocationPromise},this.buildAndCommitLocation=({replace:s,resetScroll:i,viewTransition:r,ignoreBlocker:n,...o}={})=>{const a=this.buildLocation(o);return this.commitLocation({...a,viewTransition:r,replace:s,resetScroll:i,ignoreBlocker:n})},this.navigate=({from:s,to:i,__isRedirect:r,...n})=>{const o=String(i);let a;try{new URL(`${o}`),a=!0}catch{}return et(!a),this.buildAndCommitLocation({...n,from:s,to:i})},this.load=async()=>{this.latestLocation=this.parseLocation(this.latestLocation),this.__store.setState(n=>({...n,loadedAt:Date.now()}));let s,i;const r=new Promise(n=>{this.startReactTransition(async()=>{var o;try{const a=this.latestLocation,c=this.state.resolvedLocation,u=c.href!==a.href;this.cancelMatches();let l;this.__store.batch(()=>{l=this.matchRoutes(a.pathname,a.search),this.__store.setState(d=>({...d,status:"pending",isLoading:!0,location:a,pendingMatches:l,cachedMatches:d.cachedMatches.filter(f=>!l.find(p=>p.id===f.id))}))}),this.state.redirect||this.emit({type:"onBeforeNavigate",fromLocation:c,toLocation:a,pathChanged:u}),this.emit({type:"onBeforeLoad",fromLocation:c,toLocation:a,pathChanged:u}),await this.loadMatches({matches:l,location:a,onReady:async()=>{this.startViewTransition(async()=>{let d,f,p;this.__store.batch(()=>{this.__store.setState(v=>{const m=v.matches,g=v.pendingMatches||v.matches;return d=m.filter(M=>!g.find(S=>S.id===M.id)),f=g.filter(M=>!m.find(S=>S.id===M.id)),p=m.filter(M=>g.find(S=>S.id===M.id)),{...v,isLoading:!1,matches:g,pendingMatches:void 0,cachedMatches:[...v.cachedMatches,...d.filter(M=>M.status!=="error")]}}),this.cleanCache()}),[[d,"onLeave"],[f,"onEnter"],[p,"onStay"]].forEach(([v,m])=>{v.forEach(g=>{var M,S;(S=(M=this.looseRoutesById[g.routeId].options)[m])==null||S.call(M,g)})})})}})}catch(a){Os(a)?(s=a,this.isServer||this.navigate({...a,replace:!0,__isRedirect:!0})):pt(a)&&(i=a),this.__store.setState(c=>({...c,statusCode:s?s.statusCode:i?404:c.matches.some(u=>u.status==="error")?500:200,redirect:s}))}this.latestLoadPromise===r&&((o=this.commitLocationPromise)==null||o.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),n()})});for(this.latestLoadPromise=r,await r;this.latestLoadPromise&&r!==this.latestLoadPromise;)await this.latestLoadPromise},this.startViewTransition=s=>{var i,r;const n=this.shouldViewTransition??this.options.defaultViewTransition;delete this.shouldViewTransition,(r=(i=n&&typeof document<"u"?document:void 0)==null?void 0:i.startViewTransition)!=null&&r.call(i,s)||s()},this.updateMatch=(s,i)=>{var r;let n;const o=(r=this.state.pendingMatches)==null?void 0:r.find(u=>u.id===s),a=this.state.matches.find(u=>u.id===s),c=o?"pendingMatches":a?"matches":"cachedMatches";return this.__store.setState(u=>{var l;return{...u,[c]:(l=u[c])==null?void 0:l.map(d=>d.id===s?n=i(d):d)}}),n},this.getMatch=s=>[...this.state.cachedMatches,...this.state.pendingMatches??[],...this.state.matches].find(i=>i.id===s),this.loadMatches=async({location:s,matches:i,preload:r,onReady:n,updateMatch:o=this.updateMatch})=>{let a,c=!1;const u=async()=>{c||(c=!0,await(n==null?void 0:n()))};!this.isServer&&!this.state.matches.length&&u();const l=(d,f)=>{var p,v,m;if(Os(f))throw f;if(Tt(f)||pt(f)){if(o(d.id,g=>({...g,status:Tt(f)?"redirected":pt(f)?"notFound":"error",isFetching:!1,error:f,beforeLoadPromise:void 0,loaderPromise:void 0})),f.routeId||(f.routeId=d.routeId),(p=d.beforeLoadPromise)==null||p.resolve(),(v=d.loaderPromise)==null||v.resolve(),(m=d.loadPromise)==null||m.resolve(),Tt(f))throw c=!0,f=this.resolveRedirect({...f,_fromLocation:s}),f;if(pt(f))throw this._handleNotFound(i,f,{updateMatch:o}),f}};try{await new Promise((d,f)=>{(async()=>{var p,v,m;try{const g=(y,w,R)=>{var O,E;const{id:b,routeId:T}=i[y],K=this.looseRoutesById[T];if(w instanceof Promise)throw w;w.routerCode=R,a=a??y,l(this.getMatch(b),w);try{(E=(O=K.options).onError)==null||E.call(O,w)}catch(N){w=N,l(this.getMatch(b),w)}o(b,N=>{var $;return($=N.beforeLoadPromise)==null||$.resolve(),{...N,error:w,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController,beforeLoadPromise:void 0}})};for(const[y,{id:w,routeId:R}]of i.entries()){const O=this.getMatch(w);if(O.beforeLoadPromise||O.loaderPromise)await O.beforeLoadPromise;else{try{o(w,B=>({...B,loadPromise:Kt(()=>{var nt;(nt=B.loadPromise)==null||nt.resolve()}),beforeLoadPromise:Kt()}));const E=this.looseRoutesById[R],b=new AbortController,T=(p=i[y-1])==null?void 0:p.id,K=()=>T?this.getMatch(T).context??this.options.context??{}:this.options.context??{},N=E.options.pendingMs??this.options.defaultPendingMs,$=!!(n&&!this.isServer&&!r&&(E.options.loader||E.options.beforeLoad)&&typeof N=="number"&&N!==1/0&&(E.options.pendingComponent??this.options.defaultPendingComponent));let I;$&&(I=setTimeout(()=>{try{u()}catch{}},N));const{paramsError:U,searchError:q}=this.getMatch(w);U&&g(y,U,"PARSE_PARAMS"),q&&g(y,q,"VALIDATE_SEARCH");const H=K();o(w,B=>({...B,isFetching:"beforeLoad",fetchCount:B.fetchCount+1,routeContext:ft(B.routeContext,H),context:ft(B.context,H),abortController:b,pendingTimeout:I}));const{search:dt,params:D,routeContext:k,cause:W}=this.getMatch(w),Z={search:dt,abortController:b,params:D,preload:!!r,context:k,location:s,navigate:B=>this.navigate({...B,_fromLocation:s}),buildLocation:this.buildLocation,cause:r?"preload":W},rt=await((m=(v=E.options).beforeLoad)==null?void 0:m.call(v,Z))??{};(Tt(rt)||pt(rt))&&g(y,rt,"BEFORE_LOAD"),o(w,B=>{const nt={...B.routeContext,...rt};return{...B,routeContext:ft(B.routeContext,nt),context:ft(B.context,nt),abortController:b}})}catch(E){g(y,E,"BEFORE_LOAD")}o(w,E=>{var b;return(b=E.beforeLoadPromise)==null||b.resolve(),{...E,beforeLoadPromise:void 0,isFetching:!1}})}}const M=i.slice(0,a),S=[];M.forEach(({id:y,routeId:w},R)=>{S.push((async()=>{const{loaderPromise:O}=this.getMatch(y);if(O)await O;else{const E=S[R-1],b=this.looseRoutesById[w],T=()=>{const{params:k,loaderDeps:W,abortController:Z,context:rt,cause:B}=this.getMatch(y);return{params:k,deps:W,preload:!!r,parentMatchPromise:E,abortController:Z,context:rt,location:s,navigate:nt=>this.navigate({...nt,_fromLocation:s}),cause:r?"preload":B,route:b}},K=Date.now()-this.getMatch(y).updatedAt,N=r?b.options.preloadStaleTime??this.options.defaultPreloadStaleTime??3e4:b.options.staleTime??this.options.defaultStaleTime??0,$=b.options.shouldReload,I=typeof $=="function"?$(T()):$;o(y,k=>({...k,loaderPromise:Kt(),preload:!!r&&!this.state.matches.find(W=>W.id===y)}));const U=async()=>{var k,W,Z,rt,B,nt,Se,Mt;try{const Pt=async()=>{const ot=this.getMatch(y);ot.minPendingPromise&&await ot.minPendingPromise};try{b._lazyPromise=b._lazyPromise||(b.lazyFn?b.lazyFn().then(V=>{Object.assign(b.options,V.options)}):Promise.resolve());const ot=this.getMatch(y).componentsPromise||b._lazyPromise.then(()=>Promise.all(Qr.map(async V=>{const At=b.options[V];At!=null&&At.preload&&await At.preload()})));o(y,V=>({...V,isFetching:"loader",componentsPromise:ot})),await b._lazyPromise;let at=await((W=(k=b.options).loader)==null?void 0:W.call(k,T()));this.serializeLoaderData&&(at=this.serializeLoaderData(at,{router:this,match:this.getMatch(y)})),l(this.getMatch(y),at),await Pt();const bt=(rt=(Z=b.options).meta)==null?void 0:rt.call(Z,{matches:i,match:this.getMatch(y),params:this.getMatch(y).params,loaderData:at}),Q=(nt=(B=b.options).headers)==null?void 0:nt.call(B,{loaderData:at});o(y,V=>({...V,error:void 0,status:"success",isFetching:!1,updatedAt:Date.now(),loaderData:at,meta:bt,headers:Q}))}catch(ot){let at=ot;await Pt(),l(this.getMatch(y),ot);try{(Mt=(Se=b.options).onError)==null||Mt.call(Se,ot)}catch(bt){at=bt,l(this.getMatch(y),bt)}o(y,bt=>({...bt,error:at,status:"error",isFetching:!1}))}await this.getMatch(y).componentsPromise}catch(Pt){l(this.getMatch(y),Pt)}},{status:q,invalid:H}=this.getMatch(y);q==="success"&&(H||(I??K>N))?(async()=>{try{await U()}catch{}})():q!=="success"&&await U();const{loaderPromise:dt,loadPromise:D}=this.getMatch(y);dt==null||dt.resolve(),D==null||D.resolve()}o(y,E=>({...E,isFetching:!1,loaderPromise:void 0}))})())}),await Promise.all(S),d()}catch(g){f(g)}})()}),await u()}catch(d){if(Tt(d)||pt(d))throw pt(d)&&!r&&await u(),d}return i},this.invalidate=()=>{const s=i=>({...i,invalid:!0,...i.status==="error"?{status:"pending",error:void 0}:{}});return this.__store.setState(i=>{var r;return{...i,matches:i.matches.map(s),cachedMatches:i.cachedMatches.map(s),pendingMatches:(r=i.pendingMatches)==null?void 0:r.map(s)}}),this.load()},this.resolveRedirect=s=>{const i=s;return i.href||(i.href=this.buildLocation(i).href),i},this.cleanCache=()=>{this.__store.setState(s=>({...s,cachedMatches:s.cachedMatches.filter(i=>{const r=this.looseRoutesById[i.routeId];if(!r.options.loader)return!1;const n=(i.preload?r.options.preloadGcTime??this.options.defaultPreloadGcTime:r.options.gcTime??this.options.defaultGcTime)??5*60*1e3;return i.status!=="error"&&Date.now()-i.updatedAt{const i=this.buildLocation(s);let r=this.matchRoutes(i.pathname,i.search,{throwOnError:!0,preload:!0});const n=Object.fromEntries([...this.state.matches,...this.state.pendingMatches??[],...this.state.cachedMatches].map(a=>[a.id,!0]));this.__store.batch(()=>{r.forEach(a=>{n[a.id]||this.__store.setState(c=>({...c,cachedMatches:[...c.cachedMatches,a]}))})});const o=new Set([...this.state.matches,...this.state.pendingMatches??[]].map(a=>a.id));try{return r=await this.loadMatches({matches:r,location:i,preload:!0,updateMatch:(a,c)=>{o.has(a)?r=r.map(u=>u.id===a?c(u):u):this.updateMatch(a,c)}}),r}catch(a){if(Tt(a))return await this.preloadRoute({...a,_fromLocation:i});console.error(a);return}},this.matchRoute=(s,i)=>{const r={...s,to:s.to?this.resolvePathWithBase(s.from||"",s.to):void 0,params:s.params||{},leaveParams:!0},n=this.buildLocation(r);if(i!=null&&i.pending&&this.state.status!=="pending")return!1;const a=((i==null?void 0:i.pending)===void 0?!this.state.isLoading:i.pending)?this.latestLocation:this.state.resolvedLocation,c=we(this.basepath,a.pathname,{...i,to:n.pathname});return!c||s.params&&!zt(c,s.params,!0)?!1:c&&((i==null?void 0:i.includeSearch)??!0)?zt(a.search,n.search,!0)?c:!1:c},this.dehydrate=()=>{var s;const i=((s=this.options.errorSerializer)==null?void 0:s.serialize)??zr;return{state:{dehydratedMatches:this.state.matches.map(r=>({...de(r,["id","status","updatedAt"]),error:r.error?{data:i(r.error),__isServerError:!0}:void 0}))},manifest:this.manifest}},this.hydrate=()=>{var s,i,r;let n;typeof document<"u"&&(n=this.options.transformer.parse((s=window.__TSR__)==null?void 0:s.dehydrated)),et(n),this.dehydratedData=n.payload,(r=(i=this.options).hydrate)==null||r.call(i,n.payload);const o=n.router.state,a=this.matchRoutes(this.state.location.pathname,this.state.location.search).map(c=>{const u=o.dehydratedMatches.find(l=>l.id===c.id);return et(u,`Could not find a client-side match for dehydrated match with id: ${c.id}!`),{...c,...u}});this.__store.setState(c=>({...c,matches:a})),this.manifest=n.router.manifest},this.injectedHtml=[],this.injectHtml=s=>{const i=()=>(this.injectedHtml=this.injectedHtml.filter(r=>r!==i),s);this.injectedHtml.push(i)},this.streamedKeys=new Set,this.getStreamedValue=s=>{var i;if(this.isServer)return;const r=(i=window.__TSR__)==null?void 0:i.streamedValues[s];if(r)return r.parsed||(r.parsed=this.options.transformer.parse(r.value)),r.parsed},this.streamValue=(s,i)=>{var r;this.streamedKeys.has(s),this.streamedKeys.add(s);const n=`__TSR__.streamedValues['${s}'] = { value: ${(r=this.serializer)==null?void 0:r.call(this,this.options.transformer.stringify(i))}}`;this.injectHtml(`