MaiBot/webui/dist/assets/router-CWhjJi2n.js

6 lines
84 KiB
JavaScript

import{r as _s,a as se,g as oe,b as Rs}from"./react-vendor-Dtc2IqVY.js";function Ps(t,o){for(var e=0;e<o.length;e++){const s=o[e];if(typeof s!="string"&&!Array.isArray(s)){for(const n in s)if(n!=="default"&&!(n in t)){const r=Object.getOwnPropertyDescriptor(s,n);r&&Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>s[n]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var v=_s(),_=se();const it=oe(_),En=Ps({__proto__:null,default:it},[_]),Xt=new WeakMap,ws=new WeakMap,Et={current:[]};let Nt=!1,gt=0;const mt=new Set,wt=new Map;function Ge(t){for(const o of t){if(Et.current.includes(o))continue;Et.current.push(o),o.recompute();const e=ws.get(o);if(e)for(const s of e){const n=Xt.get(s);n?.length&&Ge(n)}}}function xs(t){const o={prevVal:t.prevState,currentVal:t.state};for(const e of t.listeners)e(o)}function bs(t){const o={prevVal:t.prevState,currentVal:t.state};for(const e of t.listeners)e(o)}function Je(t){if(gt>0&&!wt.has(t)&&wt.set(t,t.prevState),mt.add(t),!(gt>0)&&!Nt)try{for(Nt=!0;mt.size>0;){const o=Array.from(mt);mt.clear();for(const e of o){const s=wt.get(e)??e.prevState;e.prevState=s,xs(e)}for(const e of o){const s=Xt.get(e);s&&(Et.current.push(e),Ge(s))}for(const e of o){const s=Xt.get(e);if(s)for(const n of s)bs(n)}}}finally{Nt=!1,Et.current=[],wt.clear()}}function vt(t){gt++;try{t()}finally{if(gt--,gt===0){const o=mt.values().next().value;o&&Je(o)}}}function Cs(t){return typeof t=="function"}class Ms{constructor(o,e){this.listeners=new Set,this.subscribe=s=>{var n,r;this.listeners.add(s);const i=(r=(n=this.options)==null?void 0:n.onSubscribe)==null?void 0:r.call(n,s,this);return()=>{this.listeners.delete(s),i?.()}},this.prevState=o,this.state=o,this.options=e}setState(o){var e,s,n;this.prevState=this.state,(e=this.options)!=null&&e.updateFn?this.state=this.options.updateFn(this.prevState)(o):Cs(o)?this.state=o(this.prevState):this.state=o,(n=(s=this.options)==null?void 0:s.onUpdate)==null||n.call(s),Je(this)}}const q="__TSR_index",Re="popstate",Pe="beforeunload";function Ls(t){let o=t.getLocation();const e=new Set,s=i=>{o=t.getLocation(),e.forEach(a=>a({location:o,action:i}))},n=i=>{t.notifyOnIndexChange??!0?s(i):o=t.getLocation()},r=async({task:i,navigateOpts:a,...c})=>{if(a?.ignoreBlocker??!1){i();return}const l=t.getBlockers?.()??[],h=c.type==="PUSH"||c.type==="REPLACE";if(typeof document<"u"&&l.length&&h)for(const d of l){const f=Tt(c.path,c.state);if(await d.blockerFn({currentLocation:o,nextLocation:f,action:c.type})){t.onBlocked?.();return}}i()};return{get location(){return o},get length(){return t.getLength()},subscribers:e,subscribe:i=>(e.add(i),()=>{e.delete(i)}),push:(i,a,c)=>{const u=o.state[q];a=we(u+1,a),r({task:()=>{t.pushState(i,a),s({type:"PUSH"})},navigateOpts:c,type:"PUSH",path:i,state:a})},replace:(i,a,c)=>{const u=o.state[q];a=we(u,a),r({task:()=>{t.replaceState(i,a),s({type:"REPLACE"})},navigateOpts:c,type:"REPLACE",path:i,state:a})},go:(i,a)=>{r({task:()=>{t.go(i),n({type:"GO",index:i})},navigateOpts:a,type:"GO"})},back:i=>{r({task:()=>{t.back(i?.ignoreBlocker??!1),n({type:"BACK"})},navigateOpts:i,type:"BACK"})},forward:i=>{r({task:()=>{t.forward(i?.ignoreBlocker??!1),n({type:"FORWARD"})},navigateOpts:i,type:"FORWARD"})},canGoBack:()=>o.state[q]!==0,createHref:i=>t.createHref(i),block:i=>{if(!t.setBlockers)return()=>{};const a=t.getBlockers?.()??[];return t.setBlockers([...a,i]),()=>{const c=t.getBlockers?.()??[];t.setBlockers?.(c.filter(u=>u!==i))}},flush:()=>t.flush?.(),destroy:()=>t.destroy?.(),notify:s}}function we(t,o){o||(o={});const e=ne();return{...o,key:e,__TSR_key:e,[q]:t}}function Es(t){const o=typeof document<"u"?window:void 0,e=o.history.pushState,s=o.history.replaceState;let n=[];const r=()=>n,i=S=>n=S,a=(S=>S),c=(()=>Tt(`${o.location.pathname}${o.location.search}${o.location.hash}`,o.history.state));if(!o.history.state?.__TSR_key&&!o.history.state?.key){const S=ne();o.history.replaceState({[q]:0,key:S,__TSR_key:S},"")}let u=c(),l,h=!1,d=!1,f=!1,p=!1;const m=()=>u;let g,y;const w=()=>{g&&(R._ignoreSubscribers=!0,(g.isPush?o.history.pushState:o.history.replaceState)(g.state,"",g.href),R._ignoreSubscribers=!1,g=void 0,y=void 0,l=void 0)},P=(S,C,M)=>{const T=a(C);y||(l=u),u=Tt(C,M),g={href:T,state:M,isPush:g?.isPush||S==="push"},y||(y=Promise.resolve().then(()=>w()))},b=S=>{u=c(),R.notify({type:S})},E=async()=>{if(d){d=!1;return}const S=c(),C=S.state[q]-u.state[q],M=C===1,T=C===-1,I=!M&&!T||h;h=!1;const Y=I?"GO":T?"BACK":"FORWARD",D=I?{type:"GO",index:C}:{type:T?"BACK":"FORWARD"};if(f)f=!1;else{const X=r();if(typeof document<"u"&&X.length){for(const pe of X)if(await pe.blockerFn({currentLocation:u,nextLocation:S,action:Y})){d=!0,o.history.go(1),R.notify(D);return}}}u=c(),R.notify(D)},x=S=>{if(p){p=!1;return}let C=!1;const M=r();if(typeof document<"u"&&M.length)for(const T of M){const I=T.enableBeforeUnload??!0;if(I===!0){C=!0;break}if(typeof I=="function"&&I()===!0){C=!0;break}}if(C)return S.preventDefault(),S.returnValue=""},R=Ls({getLocation:m,getLength:()=>o.history.length,pushState:(S,C)=>P("push",S,C),replaceState:(S,C)=>P("replace",S,C),back:S=>(S&&(f=!0),p=!0,o.history.back()),forward:S=>{S&&(f=!0),p=!0,o.history.forward()},go:S=>{h=!0,o.history.go(S)},createHref:S=>a(S),flush:w,destroy:()=>{o.history.pushState=e,o.history.replaceState=s,o.removeEventListener(Pe,x,{capture:!0}),o.removeEventListener(Re,E)},onBlocked:()=>{l&&u!==l&&(u=l)},getBlockers:r,setBlockers:i,notifyOnIndexChange:!1});return o.addEventListener(Pe,x,{capture:!0}),o.addEventListener(Re,E),o.history.pushState=function(...S){const C=e.apply(o.history,S);return R._ignoreSubscribers||b("PUSH"),C},o.history.replaceState=function(...S){const C=s.apply(o.history,S);return R._ignoreSubscribers||b("REPLACE"),C},R}function Tt(t,o){const e=t.indexOf("#"),s=t.indexOf("?"),n=ne();return{href:t,pathname:t.substring(0,e>0?s>0?Math.min(e,s):e:s>0?s:t.length),hash:e>-1?t.substring(e):"",search:s>-1?t.slice(s,e===-1?void 0:e):"",state:o||{[q]:0,key:n,__TSR_key:n}}}function ne(){return(Math.random()+1).toString(36).substring(7)}function Zt(t){return t[t.length-1]}function Ts(t){return typeof t=="function"}function Q(t,o){return Ts(t)?t(o):t}const Is=Object.prototype.hasOwnProperty;function B(t,o){if(t===o)return t;const e=o,s=Ce(t)&&Ce(e);if(!s&&!(It(t)&&It(e)))return e;const n=s?t:xe(t);if(!n)return e;const r=s?e:xe(e);if(!r)return e;const i=n.length,a=r.length,c=s?new Array(a):{};let u=0;for(let l=0;l<a;l++){const h=s?l:r[l],d=t[h],f=e[h];if(d===f){c[h]=d,(s?l<i:Is.call(t,h))&&u++;continue}if(d===null||f===null||typeof d!="object"||typeof f!="object"){c[h]=f;continue}const p=B(d,f);c[h]=p,p===d&&u++}return i===a&&u===i?t:c}function xe(t){const o=[],e=Object.getOwnPropertyNames(t);for(const n of e){if(!Object.prototype.propertyIsEnumerable.call(t,n))return!1;o.push(n)}const s=Object.getOwnPropertySymbols(t);for(const n of s){if(!Object.prototype.propertyIsEnumerable.call(t,n))return!1;o.push(n)}return o}function It(t){if(!be(t))return!1;const o=t.constructor;if(typeof o>"u")return!0;const e=o.prototype;return!(!be(e)||!e.hasOwnProperty("isPrototypeOf"))}function be(t){return Object.prototype.toString.call(t)==="[object Object]"}function Ce(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function tt(t,o,e){if(t===o)return!0;if(typeof t!=typeof o)return!1;if(Array.isArray(t)&&Array.isArray(o)){if(t.length!==o.length)return!1;for(let s=0,n=t.length;s<n;s++)if(!tt(t[s],o[s],e))return!1;return!0}if(It(t)&&It(o)){const s=e?.ignoreUndefined??!0;if(e?.partial){for(const i in o)if((!s||o[i]!==void 0)&&!tt(t[i],o[i],e))return!1;return!0}let n=0;if(!s)n=Object.keys(t).length;else for(const i in t)t[i]!==void 0&&n++;let r=0;for(const i in o)if((!s||o[i]!==void 0)&&(r++,r>n||!tt(t[i],o[i],e)))return!1;return n===r}return!1}function at(t){let o,e;const s=new Promise((n,r)=>{o=n,e=r});return s.status="pending",s.resolve=n=>{s.status="resolved",s.value=n,o(n),t?.(n)},s.reject=n=>{s.status="rejected",e(n)},s}function G(t){return!!(t&&typeof t=="object"&&typeof t.then=="function")}const Os=Array.from(new Map([["%","%25"],["\\","%5C"]]).values());function Me(t,o=Os){function e(n,r,i=0){for(let a=i;a<r.length;a++){const c=r[a].toUpperCase();if(n.includes(c)){const u=n.split(c),l=[];for(const h of u)l.push(e(h,r,a+1));return l.join(c)}}try{return decodeURI(n)}catch{return n.replaceAll(/%[0-9A-F]{2}/g,a=>{try{return decodeURI(a)}catch{return a}})}}if(t===""||!/%[0-9A-Fa-f]{2}/g.test(t))return t;const s=t.replaceAll(/%[0-9a-f]{2}/g,n=>n.toUpperCase());return e(s,o)}var ks="Invariant failed";function K(t,o){if(!t)throw new Error(ks)}const N=0,st=1,ct=2,lt=3;function U(t){return re(t.filter(o=>o!==void 0).join("/"))}function re(t){return t.replace(/\/{2,}/g,"/")}function ie(t){return t==="/"?t:t.replace(/^\/{1,}/,"")}function J(t){return t==="/"?t:t.replace(/\/{1,}$/,"")}function Mt(t){return J(ie(t))}function Ot(t,o){return t?.endsWith("/")&&t!=="/"&&t!==`${o}/`?t.slice(0,-1):t}function Fs(t,o,e){return Ot(t,e)===Ot(o,e)}function As(t){const{type:o,value:e}=t;if(o===N)return e;const{prefixSegment:s,suffixSegment:n}=t;if(o===st){const r=e.substring(1);if(s&&n)return`${s}{$${r}}${n}`;if(s)return`${s}{$${r}}`;if(n)return`{$${r}}${n}`}if(o===lt){const r=e.substring(1);return s&&n?`${s}{-$${r}}${n}`:s?`${s}{-$${r}}`:n?`{-$${r}}${n}`:`{-$${r}}`}if(o===ct){if(s&&n)return`${s}{$}${n}`;if(s)return`${s}{$}`;if(n)return`{$}${n}`}return e}function Bs({base:t,to:o,trailingSlash:e="never",parseCache:s}){let n=ut(t,s).slice();const r=ut(o,s);n.length>1&&Zt(n)?.value==="/"&&n.pop();for(let c=0,u=r.length;c<u;c++){const l=r[c],h=l.value;h==="/"?c?c===u-1&&n.push(l):n=[l]:h===".."?n.pop():h==="."||n.push(l)}n.length>1&&(Zt(n).value==="/"?e==="never"&&n.pop():e==="always"&&n.push({type:N,value:"/"}));const i=n.map(As);return U(i)}const ut=(t,o)=>{if(!t)return[];const e=o?.get(t);if(e)return e;const s=Ws(t);return o?.set(t,s),s},Ds=/^\$.{1,}$/,zs=/^(.*?)\{(\$[a-zA-Z_$][a-zA-Z0-9_$]*)\}(.*)$/,$s=/^(.*?)\{-(\$[a-zA-Z_$][a-zA-Z0-9_$]*)\}(.*)$/,js=/^\$$/,Ns=/^(.*?)\{\$\}(.*)$/;function Ws(t){t=re(t);const o=[];if(t.slice(0,1)==="/"&&(t=t.substring(1),o.push({type:N,value:"/"})),!t)return o;const e=t.split("/").filter(Boolean);return o.push(...e.map(s=>{const n=s.match(Ns);if(n){const a=n[1],c=n[2];return{type:ct,value:"$",prefixSegment:a||void 0,suffixSegment:c||void 0}}const r=s.match($s);if(r){const a=r[1],c=r[2],u=r[3];return{type:lt,value:c,prefixSegment:a||void 0,suffixSegment:u||void 0}}const i=s.match(zs);if(i){const a=i[1],c=i[2],u=i[3];return{type:st,value:""+c,prefixSegment:a||void 0,suffixSegment:u||void 0}}if(Ds.test(s)){const a=s.substring(1);return{type:st,value:"$"+a,prefixSegment:void 0,suffixSegment:void 0}}return js.test(s)?{type:ct,value:"$",prefixSegment:void 0,suffixSegment:void 0}:{type:N,value:s}})),t.slice(-1)==="/"&&(t=t.substring(1),o.push({type:N,value:"/"})),o}function Wt({path:t,params:o,decodeCharMap:e,parseCache:s}){const n=ut(t,s);function r(u){const l=o[u],h=typeof l=="string";return u==="*"||u==="_splat"?h?encodeURI(l):l:h?Vs(l,e):l}let i=!1;const a={},c=U(n.map(u=>{if(u.type===N)return u.value;if(u.type===ct){a._splat=o._splat,a["*"]=o._splat;const l=u.prefixSegment||"",h=u.suffixSegment||"";if(!o._splat)return i=!0,l||h?`${l}${h}`:void 0;const d=r("_splat");return`${l}${d}${h}`}if(u.type===st){const l=u.value.substring(1);!i&&!(l in o)&&(i=!0),a[l]=o[l];const h=u.prefixSegment||"",d=u.suffixSegment||"";return`${h}${r(l)??"undefined"}${d}`}if(u.type===lt){const l=u.value.substring(1),h=u.prefixSegment||"",d=u.suffixSegment||"";return!(l in o)||o[l]==null?h||d?`${h}${d}`:void 0:(a[l]=o[l],`${h}${r(l)??""}${d}`)}return u.value}));return{usedParams:a,interpolatedPath:c,isMissingParams:i}}function Vs(t,o){let e=encodeURIComponent(t);if(o)for(const[s,n]of o)e=e.replaceAll(s,n);return e}function Qt(t,o,e){const s=Us(t,o,e);if(!(o.to&&!s))return s??{}}function Us(t,{to:o,fuzzy:e,caseSensitive:s},n){const r=o,i=ut(t.startsWith("/")?t:`/${t}`,n),a=ut(r.startsWith("/")?r:`/${r}`,n),c={};return Ks(i,a,c,e,s)?c:void 0}function Ks(t,o,e,s,n){let r=0,i=0;for(;r<t.length||i<o.length;){const a=t[r],c=o[i];if(c){if(c.type===ct){const u=t.slice(r);let l;if(c.prefixSegment||c.suffixSegment){if(!a)return!1;const h=c.prefixSegment||"",d=c.suffixSegment||"",f=a.value;if("prefixSegment"in c&&!f.startsWith(h)||"suffixSegment"in c&&!t[t.length-1]?.value.endsWith(d))return!1;let p=decodeURI(U(u.map(m=>m.value)));h&&p.startsWith(h)&&(p=p.slice(h.length)),d&&p.endsWith(d)&&(p=p.slice(0,p.length-d.length)),l=p}else l=decodeURI(U(u.map(h=>h.value)));return e["*"]=l,e._splat=l,!0}if(c.type===N){if(c.value==="/"&&!a?.value){i++;continue}if(a){if(n){if(c.value!==a.value)return!1}else if(c.value.toLowerCase()!==a.value.toLowerCase())return!1;r++,i++;continue}else return!1}if(c.type===st){if(!a||a.value==="/")return!1;let u="",l=!1;if(c.prefixSegment||c.suffixSegment){const h=c.prefixSegment||"",d=c.suffixSegment||"",f=a.value;if(h&&!f.startsWith(h)||d&&!f.endsWith(d))return!1;let p=f;h&&p.startsWith(h)&&(p=p.slice(h.length)),d&&p.endsWith(d)&&(p=p.slice(0,p.length-d.length)),u=decodeURIComponent(p),l=!0}else u=decodeURIComponent(a.value),l=!0;l&&(e[c.value.substring(1)]=u,r++),i++;continue}if(c.type===lt){if(!a){i++;continue}if(a.value==="/"){i++;continue}let u="",l=!1;if(c.prefixSegment||c.suffixSegment){const h=c.prefixSegment||"",d=c.suffixSegment||"",f=a.value;if((!h||f.startsWith(h))&&(!d||f.endsWith(d))){let p=f;h&&p.startsWith(h)&&(p=p.slice(h.length)),d&&p.endsWith(d)&&(p=p.slice(0,p.length-d.length)),u=decodeURIComponent(p),l=!0}}else{let h=!0;for(let d=i+1;d<o.length;d++){const f=o[d];if(f?.type===N&&f.value===a.value){h=!1;break}if(f?.type===st||f?.type===ct){t.length<o.length&&(h=!1);break}}h&&(u=decodeURIComponent(a.value),l=!0)}l&&(e[c.value.substring(1)]=u,r++),i++;continue}}if(r<t.length&&i>=o.length)return e["**"]=U(t.slice(r).map(u=>u.value)),!!s&&o[o.length-1]?.value!=="/";if(i<o.length&&r>=t.length){for(let u=i;u<o.length;u++)if(o[u]?.type!==lt)return!1;break}break}return!0}const Hs=.75,qs=1,Gs=.5,Js=.4,Ys=.25,Xs=.2,Zs=.05,Qs=.02,to=.01,Le=2e-4,Ee=1e-4;function Te(t,o){return t.prefixSegment&&t.suffixSegment?o+Zs+Le*t.prefixSegment.length+Ee*t.suffixSegment.length:t.prefixSegment?o+Qs+Le*t.prefixSegment.length:t.suffixSegment?o+to+Ee*t.suffixSegment.length:o}function eo(t){const o=[];return t.forEach((s,n)=>{if(s.isRoot||!s.path)return;const r=ie(s.fullPath);let i=ut(r),a=0;for(;i.length>a+1&&i[a]?.value==="/";)a++;a>0&&(i=i.slice(a));let c=0,u=!1;const l=i.map((h,d)=>{if(h.value==="/")return Hs;if(h.type===N)return qs;let f;h.type===st?f=Gs:h.type===lt?(f=Js,c++):f=Ys;for(let p=d+1;p<i.length;p++){const m=i[p];if(m.type===N&&m.value!=="/")return u=!0,Te(h,f+Xs)}return Te(h,f)});o.push({child:s,trimmed:r,parsed:i,index:n,scores:l,optionalParamCount:c,hasStaticAfter:u})}),o.sort((s,n)=>{const r=Math.min(s.scores.length,n.scores.length);for(let i=0;i<r;i++)if(s.scores[i]!==n.scores[i])return n.scores[i]-s.scores[i];if(s.scores.length!==n.scores.length){if(s.optionalParamCount!==n.optionalParamCount){if(s.hasStaticAfter===n.hasStaticAfter)return s.optionalParamCount-n.optionalParamCount;if(s.hasStaticAfter&&!n.hasStaticAfter)return-1;if(!s.hasStaticAfter&&n.hasStaticAfter)return 1}return n.scores.length-s.scores.length}for(let i=0;i<r;i++)if(s.parsed[i].value!==n.parsed[i].value)return s.parsed[i].value>n.parsed[i].value?1:-1;return s.index-n.index}).map((s,n)=>(s.child.rank=n,s.child))}function so({routeTree:t,initRoute:o}){const e={},s={},n=i=>{i.forEach((a,c)=>{o?.(a,c);const u=e[a.id];if(K(!u,`Duplicate routes found with id: ${String(a.id)}`),e[a.id]=a,!a.isRoot&&a.path){const h=J(a.fullPath);(!s[h]||a.fullPath.endsWith("/"))&&(s[h]=a)}const l=a.children;l?.length&&n(l)})};n([t]);const r=eo(Object.values(e));return{routesById:e,routesByPath:s,flatRoutes:r}}function $(t){return!!t?.isNotFound}function oo(){try{if(typeof window<"u"&&typeof window.sessionStorage=="object")return window.sessionStorage}catch{}}const kt="tsr-scroll-restoration-v1_3",no=(t,o)=>{let e;return(...s)=>{e||(e=setTimeout(()=>{t(...s),e=null},o))}};function ro(){const t=oo();if(!t)return null;const o=t.getItem(kt);let e=o?JSON.parse(o):{};return{state:e,set:s=>(e=Q(s,e)||e,t.setItem(kt,JSON.stringify(e)))}}const xt=ro(),te=t=>t.state.__TSR_key||t.href;function io(t){const o=[];let e;for(;e=t.parentNode;)o.push(`${t.tagName}:nth-child(${Array.prototype.indexOf.call(e.children,t)+1})`),t=e;return`${o.reverse().join(" > ")}`.toLowerCase()}let Ft=!1;function Ye({storageKey:t,key:o,behavior:e,shouldScrollRestoration:s,scrollToTopSelectors:n,location:r}){let i;try{i=JSON.parse(sessionStorage.getItem(t)||"{}")}catch(u){console.error(u);return}const a=o||window.history.state?.__TSR_key,c=i[a];Ft=!0;t:{if(s&&c&&Object.keys(c).length>0){for(const h in c){const d=c[h];if(h==="window")window.scrollTo({top:d.scrollY,left:d.scrollX,behavior:e});else if(h){const f=document.querySelector(h);f&&(f.scrollLeft=d.scrollX,f.scrollTop=d.scrollY)}}break t}const u=(r??window.location).hash.split("#",2)[1];if(u){const h=window.history.state?.__hashScrollIntoViewOptions??!0;if(h){const d=document.getElementById(u);d&&d.scrollIntoView(h)}break t}const l={top:0,left:0,behavior:e};if(window.scrollTo(l),n)for(const h of n){if(h==="window")continue;const d=typeof h=="function"?h():document.querySelector(h);d&&d.scrollTo(l)}}Ft=!1}function ao(t,o){if(!xt&&!t.isServer||((t.options.scrollRestoration??!1)&&(t.isScrollRestoring=!0),t.isServer||t.isScrollRestorationSetup||!xt))return;t.isScrollRestorationSetup=!0,Ft=!1;const s=t.options.getScrollRestorationKey||te;window.history.scrollRestoration="manual";const n=r=>{if(Ft||!t.isScrollRestoring)return;let i="";if(r.target===document||r.target===window)i="window";else{const c=r.target.getAttribute("data-scroll-restoration-id");c?i=`[data-scroll-restoration-id="${c}"]`:i=io(r.target)}const a=s(t.state.location);xt.set(c=>{const u=c[a]||={},l=u[i]||={};if(i==="window")l.scrollX=window.scrollX||0,l.scrollY=window.scrollY||0;else if(i){const h=document.querySelector(i);h&&(l.scrollX=h.scrollLeft||0,l.scrollY=h.scrollTop||0)}return c})};typeof document<"u"&&document.addEventListener("scroll",no(n,100),!0),t.subscribe("onRendered",r=>{const i=s(r.toLocation);if(!t.resetNextScroll){t.resetNextScroll=!0;return}typeof t.options.scrollRestoration=="function"&&!t.options.scrollRestoration({location:t.latestLocation})||(Ye({storageKey:kt,key:i,behavior:t.options.scrollRestorationBehavior,shouldScrollRestoration:t.isScrollRestoring,scrollToTopSelectors:t.options.scrollToTopSelectors,location:t.history.location}),t.isScrollRestoring&&xt.set(a=>(a[i]||={},a)))})}function co(t){if(typeof document<"u"&&document.querySelector){const o=t.state.location.state.__hashScrollIntoViewOptions??!0;if(o&&t.state.location.hash!==""){const e=document.getElementById(t.state.location.hash);e&&e.scrollIntoView(o)}}}function lo(t,o=String){const e=new URLSearchParams;for(const s in t){const n=t[s];n!==void 0&&e.set(s,o(n))}return e.toString()}function Vt(t){return t?t==="false"?!1:t==="true"?!0:+t*0===0&&+t+""===t?+t:t:""}function uo(t){const o=new URLSearchParams(t),e={};for(const[s,n]of o.entries()){const r=e[s];r==null?e[s]=Vt(n):Array.isArray(r)?r.push(Vt(n)):e[s]=[r,Vt(n)]}return e}const ho=po(JSON.parse),fo=mo(JSON.stringify,JSON.parse);function po(t){return o=>{o[0]==="?"&&(o=o.substring(1));const e=uo(o);for(const s in e){const n=e[s];if(typeof n=="string")try{e[s]=t(n)}catch{}}return e}}function mo(t,o){const e=typeof o=="function";function s(n){if(typeof n=="object"&&n!==null)try{return t(n)}catch{}else if(e&&typeof n=="string")try{return o(n),t(n)}catch{}return n}return n=>{const r=lo(n,s);return r?`?${r}`:""}}const A="__root__";function go(t){if(t.statusCode=t.statusCode||t.code||307,!t.reloadDocument&&typeof t.href=="string")try{new URL(t.href),t.reloadDocument=!0}catch{}const o=new Headers(t.headers);t.href&&o.get("Location")===null&&o.set("Location",t.href);const e=new Response(null,{status:t.statusCode,headers:o});if(e.options=t,t.throw)throw e;return e}function j(t){return t instanceof Response&&!!t.options}function vo(t){const o=new Map;let e,s;const n=r=>{r.next&&(r.prev?(r.prev.next=r.next,r.next.prev=r.prev,r.next=void 0,s&&(s.next=r,r.prev=s)):(r.next.prev=void 0,e=r.next,r.next=void 0,s&&(r.prev=s,s.next=r)),s=r)};return{get(r){const i=o.get(r);if(i)return n(i),i.value},set(r,i){if(o.size>=t&&e){const c=e;o.delete(c.key),c.next&&(e=c.next,c.next.prev=void 0),c===s&&(s=void 0)}const a=o.get(r);if(a)a.value=i,n(a);else{const c={key:r,value:i,prev:s};s&&(s.next=c),s=c,e||(e=c),o.set(r,c)}}}}const Lt=t=>{if(!t.rendered)return t.rendered=!0,t.onReady?.()},Bt=(t,o)=>!!(t.preload&&!t.router.state.matches.some(e=>e.id===o)),Xe=(t,o)=>{const e=t.router.routesById[o.routeId??""]??t.router.routeTree;!e.options.notFoundComponent&&t.router.options?.defaultNotFoundComponent&&(e.options.notFoundComponent=t.router.options.defaultNotFoundComponent),K(e.options.notFoundComponent);const s=t.matches.find(n=>n.routeId===e.id);K(s,"Could not find match for route: "+e.id),t.updateMatch(s.id,n=>({...n,status:"notFound",error:o,isFetching:!1})),o.routerCode==="BEFORE_LOAD"&&e.parentRoute&&(o.routeId=e.parentRoute.id,Xe(t,o))},H=(t,o,e)=>{if(!(!j(e)&&!$(e))){if(j(e)&&e.redirectHandled&&!e.options.reloadDocument)throw e;if(o){o._nonReactive.beforeLoadPromise?.resolve(),o._nonReactive.loaderPromise?.resolve(),o._nonReactive.beforeLoadPromise=void 0,o._nonReactive.loaderPromise=void 0;const s=j(e)?"redirected":"notFound";o._nonReactive.error=e,t.updateMatch(o.id,n=>({...n,status:s,isFetching:!1,error:e})),$(e)&&!e.routeId&&(e.routeId=o.routeId),o._nonReactive.loadPromise?.resolve()}throw j(e)?(t.rendered=!0,e.options._fromLocation=t.location,e.redirectHandled=!0,e=t.router.resolveRedirect(e),e):(Xe(t,e),e)}},Ze=(t,o)=>{const e=t.router.getMatch(o);return!!(!t.router.isServer&&e._nonReactive.dehydrated||t.router.isServer&&e.ssr===!1)},dt=(t,o,e,s)=>{const{id:n,routeId:r}=t.matches[o],i=t.router.looseRoutesById[r];if(e instanceof Promise)throw e;e.routerCode=s,t.firstBadMatchIndex??=o,H(t,t.router.getMatch(n),e);try{i.options.onError?.(e)}catch(a){e=a,H(t,t.router.getMatch(n),e)}t.updateMatch(n,a=>(a._nonReactive.beforeLoadPromise?.resolve(),a._nonReactive.beforeLoadPromise=void 0,a._nonReactive.loadPromise?.resolve(),{...a,error:e,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController}))},yo=(t,o,e,s)=>{const n=t.router.getMatch(o),r=t.matches[e-1]?.id,i=r?t.router.getMatch(r):void 0;if(t.router.isShell()){n.ssr=s.id===A;return}if(i?.ssr===!1){n.ssr=!1;return}const a=f=>f===!0&&i?.ssr==="data-only"?"data-only":f,c=t.router.options.defaultSsr??!0;if(s.options.ssr===void 0){n.ssr=a(c);return}if(typeof s.options.ssr!="function"){n.ssr=a(s.options.ssr);return}const{search:u,params:l}=n,h={search:bt(u,n.searchError),params:bt(l,n.paramsError),location:t.location,matches:t.matches.map(f=>({index:f.index,pathname:f.pathname,fullPath:f.fullPath,staticData:f.staticData,id:f.id,routeId:f.routeId,search:bt(f.search,f.searchError),params:bt(f.params,f.paramsError),ssr:f.ssr}))},d=s.options.ssr(h);if(G(d))return d.then(f=>{n.ssr=a(f??c)});n.ssr=a(d??c)},Qe=(t,o,e,s)=>{if(s._nonReactive.pendingTimeout!==void 0)return;const n=e.options.pendingMs??t.router.options.defaultPendingMs;if(!!(t.onReady&&!t.router.isServer&&!Bt(t,o)&&(e.options.loader||e.options.beforeLoad||ss(e))&&typeof n=="number"&&n!==1/0&&(e.options.pendingComponent??t.router.options?.defaultPendingComponent))){const i=setTimeout(()=>{Lt(t)},n);s._nonReactive.pendingTimeout=i}},So=(t,o,e)=>{const s=t.router.getMatch(o);if(!s._nonReactive.beforeLoadPromise&&!s._nonReactive.loaderPromise)return;Qe(t,o,e,s);const n=()=>{const r=t.router.getMatch(o);r.preload&&(r.status==="redirected"||r.status==="notFound")&&H(t,r,r.error)};return s._nonReactive.beforeLoadPromise?s._nonReactive.beforeLoadPromise.then(n):n()},_o=(t,o,e,s)=>{const n=t.router.getMatch(o),r=n._nonReactive.loadPromise;n._nonReactive.loadPromise=at(()=>{r?.resolve()});const{paramsError:i,searchError:a}=n;i&&dt(t,e,i,"PARSE_PARAMS"),a&&dt(t,e,a,"VALIDATE_SEARCH"),Qe(t,o,s,n);const c=new AbortController,u=t.matches[e-1]?.id,d={...(u?t.router.getMatch(u):void 0)?.context??t.router.options.context??void 0,...n.__routeContext};let f=!1;const p=()=>{f||(f=!0,t.updateMatch(o,R=>({...R,isFetching:"beforeLoad",fetchCount:R.fetchCount+1,abortController:c,context:d})))},m=()=>{n._nonReactive.beforeLoadPromise?.resolve(),n._nonReactive.beforeLoadPromise=void 0,t.updateMatch(o,R=>({...R,isFetching:!1}))};if(!s.options.beforeLoad){vt(()=>{p(),m()});return}n._nonReactive.beforeLoadPromise=at();const{search:g,params:y,cause:w}=n,P=Bt(t,o),b={search:g,abortController:c,params:y,preload:P,context:d,location:t.location,navigate:R=>t.router.navigate({...R,_fromLocation:t.location}),buildLocation:t.router.buildLocation,cause:P?"preload":w,matches:t.matches,...t.router.options.additionalContext},E=R=>{if(R===void 0){vt(()=>{p(),m()});return}(j(R)||$(R))&&(p(),dt(t,e,R,"BEFORE_LOAD")),vt(()=>{p(),t.updateMatch(o,S=>({...S,__beforeLoadContext:R,context:{...S.context,...R}})),m()})};let x;try{if(x=s.options.beforeLoad(b),G(x))return p(),x.catch(R=>{dt(t,e,R,"BEFORE_LOAD")}).then(E)}catch(R){p(),dt(t,e,R,"BEFORE_LOAD")}E(x)},Ro=(t,o)=>{const{id:e,routeId:s}=t.matches[o],n=t.router.looseRoutesById[s],r=()=>{if(t.router.isServer){const c=yo(t,e,o,n);if(G(c))return c.then(a)}return a()},i=()=>_o(t,e,o,n),a=()=>{if(Ze(t,e))return;const c=So(t,e,n);return G(c)?c.then(i):i()};return r()},yt=(t,o,e)=>{const s=t.router.getMatch(o);if(!s||!e.options.head&&!e.options.scripts&&!e.options.headers)return;const n={matches:t.matches,match:s,params:s.params,loaderData:s.loaderData};return Promise.all([e.options.head?.(n),e.options.scripts?.(n),e.options.headers?.(n)]).then(([r,i,a])=>{const c=r?.meta,u=r?.links,l=r?.scripts,h=r?.styles;return{meta:c,links:u,headScripts:l,headers:a,scripts:i,styles:h}})},ts=(t,o,e,s)=>{const n=t.matchPromises[e-1],{params:r,loaderDeps:i,abortController:a,cause:c}=t.router.getMatch(o);let u=t.router.options.context??{};for(let h=0;h<=e;h++){const d=t.matches[h];if(!d)continue;const f=t.router.getMatch(d.id);f&&(u={...u,...f.__routeContext??{},...f.__beforeLoadContext??{}})}const l=Bt(t,o);return{params:r,deps:i,preload:!!l,parentMatchPromise:n,abortController:a,context:u,location:t.location,navigate:h=>t.router.navigate({...h,_fromLocation:t.location}),cause:l?"preload":c,route:s,...t.router.options.additionalContext}},Ie=async(t,o,e,s)=>{try{const n=t.router.getMatch(o);try{(!t.router.isServer||n.ssr===!0)&&es(s);const r=s.options.loader?.(ts(t,o,e,s)),i=s.options.loader&&G(r);if(!!(i||s._lazyPromise||s._componentsPromise||s.options.head||s.options.scripts||s.options.headers||n._nonReactive.minPendingPromise)&&t.updateMatch(o,h=>({...h,isFetching:"loader"})),s.options.loader){const h=i?await r:r;H(t,t.router.getMatch(o),h),h!==void 0&&t.updateMatch(o,d=>({...d,loaderData:h}))}s._lazyPromise&&await s._lazyPromise;const c=yt(t,o,s),u=c?await c:void 0,l=n._nonReactive.minPendingPromise;l&&await l,s._componentsPromise&&await s._componentsPromise,t.updateMatch(o,h=>({...h,error:void 0,status:"success",isFetching:!1,updatedAt:Date.now(),...u}))}catch(r){let i=r;const a=n._nonReactive.minPendingPromise;a&&await a,$(r)&&await s.options.notFoundComponent?.preload?.(),H(t,t.router.getMatch(o),r);try{s.options.onError?.(r)}catch(l){i=l,H(t,t.router.getMatch(o),l)}const c=yt(t,o,s),u=c?await c:void 0;t.updateMatch(o,l=>({...l,error:i,status:"error",isFetching:!1,...u}))}}catch(n){const r=t.router.getMatch(o);if(r){const i=yt(t,o,s);if(i){const a=await i;t.updateMatch(o,c=>({...c,...a}))}r._nonReactive.loaderPromise=void 0}H(t,r,n)}},Po=async(t,o)=>{const{id:e,routeId:s}=t.matches[o];let n=!1,r=!1;const i=t.router.looseRoutesById[s];if(Ze(t,e)){if(t.router.isServer){const u=yt(t,e,i);if(u){const l=await u;t.updateMatch(e,h=>({...h,...l}))}return t.router.getMatch(e)}}else{const u=t.router.getMatch(e);if(u._nonReactive.loaderPromise){if(u.status==="success"&&!t.sync&&!u.preload)return u;await u._nonReactive.loaderPromise;const l=t.router.getMatch(e),h=l._nonReactive.error||l.error;h&&H(t,l,h)}else{const l=Date.now()-u.updatedAt,h=Bt(t,e),d=h?i.options.preloadStaleTime??t.router.options.defaultPreloadStaleTime??3e4:i.options.staleTime??t.router.options.defaultStaleTime??0,f=i.options.shouldReload,p=typeof f=="function"?f(ts(t,e,o,i)):f,m=!!h&&!t.router.state.matches.some(P=>P.id===e),g=t.router.getMatch(e);g._nonReactive.loaderPromise=at(),m!==g.preload&&t.updateMatch(e,P=>({...P,preload:m}));const{status:y,invalid:w}=g;if(n=y==="success"&&(w||(p??l>d)),!(h&&i.options.preload===!1))if(n&&!t.sync)r=!0,(async()=>{try{await Ie(t,e,o,i);const P=t.router.getMatch(e);P._nonReactive.loaderPromise?.resolve(),P._nonReactive.loadPromise?.resolve(),P._nonReactive.loaderPromise=void 0}catch(P){j(P)&&await t.router.navigate(P.options)}})();else if(y!=="success"||n&&t.sync)await Ie(t,e,o,i);else{const P=yt(t,e,i);if(P){const b=await P;t.updateMatch(e,E=>({...E,...b}))}}}}const a=t.router.getMatch(e);r||(a._nonReactive.loaderPromise?.resolve(),a._nonReactive.loadPromise?.resolve()),clearTimeout(a._nonReactive.pendingTimeout),a._nonReactive.pendingTimeout=void 0,r||(a._nonReactive.loaderPromise=void 0),a._nonReactive.dehydrated=void 0;const c=r?a.isFetching:!1;return c!==a.isFetching||a.invalid!==!1?(t.updateMatch(e,u=>({...u,isFetching:c,invalid:!1})),t.router.getMatch(e)):a};async function Oe(t){const o=Object.assign(t,{matchPromises:[]});!o.router.isServer&&o.router.state.matches.some(e=>e._forcePending)&&Lt(o);try{for(let n=0;n<o.matches.length;n++){const r=Ro(o,n);G(r)&&await r}const e=o.firstBadMatchIndex??o.matches.length;for(let n=0;n<e;n++)o.matchPromises.push(Po(o,n));await Promise.all(o.matchPromises);const s=Lt(o);G(s)&&await s}catch(e){if($(e)&&!o.preload){const s=Lt(o);throw G(s)&&await s,e}if(j(e))throw e}return o.matches}async function es(t){if(!t._lazyLoaded&&t._lazyPromise===void 0&&(t.lazyFn?t._lazyPromise=t.lazyFn().then(o=>{const{id:e,...s}=o.options;Object.assign(t.options,s),t._lazyLoaded=!0,t._lazyPromise=void 0}):t._lazyLoaded=!0),!t._componentsLoaded&&t._componentsPromise===void 0){const o=()=>{const e=[];for(const s of os){const n=t.options[s]?.preload;n&&e.push(n())}if(e.length)return Promise.all(e).then(()=>{t._componentsLoaded=!0,t._componentsPromise=void 0});t._componentsLoaded=!0,t._componentsPromise=void 0};t._componentsPromise=t._lazyPromise?t._lazyPromise.then(o):o()}return t._componentsPromise}function bt(t,o){return o?{status:"error",error:o}:{status:"success",value:t}}function ss(t){for(const o of os)if(t.options[o]?.preload)return!0;return!1}const os=["component","errorComponent","pendingComponent","notFoundComponent"];function wo(t){return{input:({url:o})=>{for(const e of t)o=ns(e,o);return o},output:({url:o})=>{for(let e=t.length-1;e>=0;e--)o=rs(t[e],o);return o}}}function xo(t){const o=Mt(t.basepath),e=`/${o}`,s=`${e}/`,n=t.caseSensitive?e:e.toLowerCase(),r=t.caseSensitive?s:s.toLowerCase();return{input:({url:i})=>{const a=t.caseSensitive?i.pathname:i.pathname.toLowerCase();return a===n?i.pathname="/":a.startsWith(r)&&(i.pathname=i.pathname.slice(e.length)),i},output:({url:i})=>(i.pathname=U(["/",o,i.pathname]),i)}}function ns(t,o){const e=t?.input?.({url:o});if(e){if(typeof e=="string")return new URL(e);if(e instanceof URL)return e}return o}function rs(t,o){const e=t?.output?.({url:o});if(e){if(typeof e=="string")return new URL(e);if(e instanceof URL)return e}return o}function et(t){const o=t.resolvedLocation,e=t.location,s=o?.pathname!==e.pathname,n=o?.href!==e.href,r=o?.hash!==e.hash;return{fromLocation:o,toLocation:e,pathChanged:s,hrefChanged:n,hashChanged:r}}class bo{constructor(o){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.isScrollRestoring=!1,this.isScrollRestorationSetup=!1,this.startTransition=e=>e(),this.update=e=>{e.notFoundRoute&&console.warn("The notFoundRoute API is deprecated and will be removed in the next major version. See https://tanstack.com/router/v1/docs/framework/react/guide/not-found-errors#migrating-from-notfoundroute for more info.");const s=this.options,n=this.basepath??s?.basepath??"/",r=this.basepath===void 0,i=s?.rewrite;this.options={...s,...e},this.isServer=this.options.isServer??typeof document>"u",this.pathParamsDecodeCharMap=this.options.pathParamsAllowedCharacters?new Map(this.options.pathParamsAllowedCharacters.map(d=>[encodeURIComponent(d),d])):void 0,(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.isServer||(this.history=Es())),this.origin=this.options.origin,this.origin||(!this.isServer&&window?.origin&&window.origin!=="null"?this.origin=window.origin:this.origin="http://localhost"),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree&&(this.routeTree=this.options.routeTree,this.buildRouteTree()),!this.__store&&this.latestLocation&&(this.__store=new Ms(Mo(this.latestLocation),{onUpdate:()=>{this.__store.state={...this.state,cachedMatches:this.state.cachedMatches.filter(d=>!["redirected"].includes(d.status))}}}),ao(this));let a=!1;const c=this.options.basepath??"/",u=this.options.rewrite;if(r||n!==c||i!==u){this.basepath=c;const d=[];Mt(c)!==""&&d.push(xo({basepath:c})),u&&d.push(u),this.rewrite=d.length===0?void 0:d.length===1?d[0]:wo(d),this.history&&this.updateLatestLocation(),a=!0}a&&this.__store&&(this.__store.state={...this.state,location:this.latestLocation}),typeof window<"u"&&"CSS"in window&&typeof window.CSS?.supports=="function"&&(this.isViewTransitionTypesSupported=window.CSS.supports("selector(:active-view-transition-type(a)"))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{const{routesById:e,routesByPath:s,flatRoutes:n}=so({routeTree:this.routeTree,initRoute:(i,a)=>{i.init({originalIndex:a})}});this.routesById=e,this.routesByPath=s,this.flatRoutes=n;const r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)},this.subscribe=(e,s)=>{const n={eventType:e,fn:s};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=e=>{this.subscribers.forEach(s=>{s.eventType===e.type&&s.fn(e)})},this.parseLocation=(e,s)=>{const n=({href:c,state:u})=>{const l=new URL(c,this.origin),h=ns(this.rewrite,l),d=this.options.parseSearch(h.search),f=this.options.stringifySearch(d);h.search=f;const p=h.href.replace(h.origin,""),{pathname:m,hash:g}=h;return{href:p,publicHref:c,url:h.href,pathname:Me(m),searchStr:f,search:B(s?.search,d),hash:g.split("#").reverse()[0]??"",state:B(s?.state,u)}},r=n(e),{__tempLocation:i,__tempKey:a}=r.state;if(i&&(!a||a===this.tempLocationKey)){const c=n(i);return c.state.key=r.state.key,c.state.__TSR_key=r.state.__TSR_key,delete c.state.__tempLocation,{...c,maskedLocation:r}}return r},this.resolvePathWithBase=(e,s)=>Bs({base:e,to:re(s),trailingSlash:this.options.trailingSlash,parseCache:this.parsePathnameCache}),this.matchRoutes=(e,s,n)=>typeof e=="string"?this.matchRoutesInternal({pathname:e,search:s},n):this.matchRoutesInternal(e,s),this.parsePathnameCache=vo(1e3),this.getMatchedRoutes=(e,s)=>Lo({pathname:e,routePathname:s,caseSensitive:this.options.caseSensitive,routesByPath:this.routesByPath,routesById:this.routesById,flatRoutes:this.flatRoutes,parseCache:this.parsePathnameCache}),this.cancelMatch=e=>{const s=this.getMatch(e);s&&(s.abortController.abort(),clearTimeout(s._nonReactive.pendingTimeout),s._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{const e=this.state.matches.filter(r=>r.status==="pending"),s=this.state.matches.filter(r=>r.isFetching==="loader");new Set([...this.state.pendingMatches??[],...e,...s]).forEach(r=>{this.cancelMatch(r.id)})},this.buildLocation=e=>{const s=(r={})=>{const i=r._fromLocation||this.pendingBuiltLocation||this.latestLocation,a=this.matchRoutes(i,{_buildLocation:!0}),c=Zt(a);r.from;const u=r.unsafeRelative==="path"?i.pathname:r.from??c.fullPath,l=this.resolvePathWithBase(u,"."),h=c.search,d={...c.params},f=r.to?this.resolvePathWithBase(l,`${r.to}`):this.resolvePathWithBase(l,"."),p=r.params===!1||r.params===null?{}:(r.params??!0)===!0?d:Object.assign(d,Q(r.params,d)),m=Wt({path:f,params:p,parseCache:this.parsePathnameCache}).interpolatedPath,g=this.matchRoutes(m,void 0,{_buildLocation:!0}).map(M=>this.looseRoutesById[M.routeId]);if(Object.keys(p).length>0)for(const M of g){const T=M.options.params?.stringify??M.options.stringifyParams;T&&Object.assign(p,T(p))}const y=e.leaveParams?f:Me(Wt({path:f,params:p,decodeCharMap:this.pathParamsDecodeCharMap,parseCache:this.parsePathnameCache}).interpolatedPath);let w=h;if(e._includeValidateSearch&&this.options.search?.strict){const M={};g.forEach(T=>{if(T.options.validateSearch)try{Object.assign(M,ee(T.options.validateSearch,{...M,...w}))}catch{}}),w=M}w=Eo({search:w,dest:r,destRoutes:g,_includeValidateSearch:e._includeValidateSearch}),w=B(h,w);const P=this.options.stringifySearch(w),b=r.hash===!0?i.hash:r.hash?Q(r.hash,i.hash):void 0,E=b?`#${b}`:"";let x=r.state===!0?i.state:r.state?Q(r.state,i.state):{};x=B(i.state,x);const R=`${y}${P}${E}`,S=new URL(R,this.origin),C=rs(this.rewrite,S);return{publicHref:C.pathname+C.search+C.hash,href:R,url:C.href,pathname:y,search:w,searchStr:P,state:x,hash:b??"",unmaskOnReload:r.unmaskOnReload}},n=(r={},i)=>{const a=s(r);let c=i?s(i):void 0;if(!c){let u={};const l=this.options.routeMasks?.find(h=>{const d=Qt(a.pathname,{to:h.from,caseSensitive:!1,fuzzy:!1},this.parsePathnameCache);return d?(u=d,!0):!1});if(l){const{from:h,...d}=l;i={from:e.from,...d,params:u},c=s(i)}}return c&&(a.maskedLocation=c),a};return e.mask?n(e,{from:e.from,...e.mask}):n(e)},this.commitLocation=({viewTransition:e,ignoreBlocker:s,...n})=>{const r=()=>{const c=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];c.forEach(l=>{n.state[l]=this.latestLocation.state[l]});const u=tt(n.state,this.latestLocation.state);return c.forEach(l=>{delete n.state[l]}),u},i=J(this.latestLocation.href)===J(n.href),a=this.commitLocationPromise;if(this.commitLocationPromise=at(()=>{a?.resolve()}),i&&r())this.load();else{let{maskedLocation:c,hashScrollIntoView:u,...l}=n;c&&(l={...c,state:{...c.state,__tempKey:void 0,__tempLocation:{...l,search:l.searchStr,state:{...l.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(l.unmaskOnReload??this.options.unmaskOnReload??!1)&&(l.state.__tempKey=this.tempLocationKey)),l.state.__hashScrollIntoViewOptions=u??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=e,this.history[n.replace?"replace":"push"](l.publicHref,l.state,{ignoreBlocker:s})}return this.resetNextScroll=n.resetScroll??!0,this.history.subscribers.size||this.load(),this.commitLocationPromise},this.buildAndCommitLocation=({replace:e,resetScroll:s,hashScrollIntoView:n,viewTransition:r,ignoreBlocker:i,href:a,...c}={})=>{if(a){const h=this.history.location.state.__TSR_index,d=Tt(a,{__TSR_index:e?h:h+1});c.to=d.pathname,c.search=this.options.parseSearch(d.search),c.hash=d.hash.slice(1)}const u=this.buildLocation({...c,_includeValidateSearch:!0});this.pendingBuiltLocation=u;const l=this.commitLocation({...u,viewTransition:r,replace:e,resetScroll:s,hashScrollIntoView:n,ignoreBlocker:i});return Promise.resolve().then(()=>{this.pendingBuiltLocation===u&&(this.pendingBuiltLocation=void 0)}),l},this.navigate=({to:e,reloadDocument:s,href:n,...r})=>{if(!s&&n)try{new URL(`${n}`),s=!0}catch{}return s?(n||(n=this.buildLocation({to:e,...r}).url),r.replace?window.location.replace(n):window.location.href=n,Promise.resolve()):this.buildAndCommitLocation({...r,href:n,to:e,_isNavigate:!0})},this.beforeLoad=()=>{if(this.cancelMatches(),this.updateLatestLocation(),this.isServer){const s=this.buildLocation({to:this.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0}),n=r=>{try{return encodeURI(decodeURI(r))}catch{return r}};if(Mt(n(this.latestLocation.href))!==Mt(n(s.href))){let r=s.url;throw this.origin&&r.startsWith(this.origin)&&(r=r.replace(this.origin,"")||"/"),go({href:r})}}const e=this.matchRoutes(this.latestLocation);this.__store.setState(s=>({...s,status:"pending",statusCode:200,isLoading:!0,location:this.latestLocation,pendingMatches:e,cachedMatches:s.cachedMatches.filter(n=>!e.some(r=>r.id===n.id))}))},this.load=async e=>{let s,n,r;for(r=new Promise(a=>{this.startTransition(async()=>{try{this.beforeLoad();const c=this.latestLocation,u=this.state.resolvedLocation;this.state.redirect||this.emit({type:"onBeforeNavigate",...et({resolvedLocation:u,location:c})}),this.emit({type:"onBeforeLoad",...et({resolvedLocation:u,location:c})}),await Oe({router:this,sync:e?.sync,matches:this.state.pendingMatches,location:c,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let l=[],h=[],d=[];vt(()=>{this.__store.setState(f=>{const p=f.matches,m=f.pendingMatches||f.matches;return l=p.filter(g=>!m.some(y=>y.id===g.id)),h=m.filter(g=>!p.some(y=>y.id===g.id)),d=m.filter(g=>p.some(y=>y.id===g.id)),{...f,isLoading:!1,loadedAt:Date.now(),matches:m,pendingMatches:void 0,cachedMatches:[...f.cachedMatches,...l.filter(g=>g.status!=="error")]}}),this.clearExpiredCache()}),[[l,"onLeave"],[h,"onEnter"],[d,"onStay"]].forEach(([f,p])=>{f.forEach(m=>{this.looseRoutesById[m.routeId].options[p]?.(m)})})})})}})}catch(c){j(c)?(s=c,this.isServer||this.navigate({...s.options,replace:!0,ignoreBlocker:!0})):$(c)&&(n=c),this.__store.setState(u=>({...u,statusCode:s?s.status:n?404:u.matches.some(l=>l.status==="error")?500:200,redirect:s}))}this.latestLoadPromise===r&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),a()})}),this.latestLoadPromise=r,await r;this.latestLoadPromise&&r!==this.latestLoadPromise;)await this.latestLoadPromise;let i;this.hasNotFoundMatch()?i=404:this.__store.state.matches.some(a=>a.status==="error")&&(i=500),i!==void 0&&this.__store.setState(a=>({...a,statusCode:i}))},this.startViewTransition=e=>{const s=this.shouldViewTransition??this.options.defaultViewTransition;if(delete this.shouldViewTransition,s&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let n;if(typeof s=="object"&&this.isViewTransitionTypesSupported){const r=this.latestLocation,i=this.state.resolvedLocation,a=typeof s.types=="function"?s.types(et({resolvedLocation:i,location:r})):s.types;if(a===!1){e();return}n={update:e,types:a}}else n=e;document.startViewTransition(n)}else e()},this.updateMatch=(e,s)=>{this.startTransition(()=>{const n=this.state.pendingMatches?.some(r=>r.id===e)?"pendingMatches":this.state.matches.some(r=>r.id===e)?"matches":this.state.cachedMatches.some(r=>r.id===e)?"cachedMatches":"";n&&this.__store.setState(r=>({...r,[n]:r[n]?.map(i=>i.id===e?s(i):i)}))})},this.getMatch=e=>{const s=n=>n.id===e;return this.state.cachedMatches.find(s)??this.state.pendingMatches?.find(s)??this.state.matches.find(s)},this.invalidate=e=>{const s=n=>e?.filter?.(n)??!0?{...n,invalid:!0,...e?.forcePending||n.status==="error"?{status:"pending",error:void 0}:void 0}:n;return this.__store.setState(n=>({...n,matches:n.matches.map(s),cachedMatches:n.cachedMatches.map(s),pendingMatches:n.pendingMatches?.map(s)})),this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.resolveRedirect=e=>{if(!e.options.href){const s=this.buildLocation(e.options);let n=s.url;this.origin&&n.startsWith(this.origin)&&(n=n.replace(this.origin,"")||"/"),e.options.href=s.href,e.headers.set("Location",n)}return e.headers.get("Location")||e.headers.set("Location",e.options.href),e},this.clearCache=e=>{const s=e?.filter;s!==void 0?this.__store.setState(n=>({...n,cachedMatches:n.cachedMatches.filter(r=>!s(r))})):this.__store.setState(n=>({...n,cachedMatches:[]}))},this.clearExpiredCache=()=>{const e=s=>{const n=this.looseRoutesById[s.routeId];if(!n.options.loader)return!0;const r=(s.preload?n.options.preloadGcTime??this.options.defaultPreloadGcTime:n.options.gcTime??this.options.defaultGcTime)??300*1e3;return s.status==="error"?!0:Date.now()-s.updatedAt>=r};this.clearCache({filter:e})},this.loadRouteChunk=es,this.preloadRoute=async e=>{const s=this.buildLocation(e);let n=this.matchRoutes(s,{throwOnError:!0,preload:!0,dest:e});const r=new Set([...this.state.matches,...this.state.pendingMatches??[]].map(a=>a.id)),i=new Set([...r,...this.state.cachedMatches.map(a=>a.id)]);vt(()=>{n.forEach(a=>{i.has(a.id)||this.__store.setState(c=>({...c,cachedMatches:[...c.cachedMatches,a]}))})});try{return n=await Oe({router:this,matches:n,location:s,preload:!0,updateMatch:(a,c)=>{r.has(a)?n=n.map(u=>u.id===a?c(u):u):this.updateMatch(a,c)}}),n}catch(a){if(j(a))return a.options.reloadDocument?void 0:await this.preloadRoute({...a.options,_fromLocation:s});$(a)||console.error(a);return}},this.matchRoute=(e,s)=>{const n={...e,to:e.to?this.resolvePathWithBase(e.from||"",e.to):void 0,params:e.params||{},leaveParams:!0},r=this.buildLocation(n);if(s?.pending&&this.state.status!=="pending")return!1;const a=(s?.pending===void 0?!this.state.isLoading:s.pending)?this.latestLocation:this.state.resolvedLocation||this.state.location,c=Qt(a.pathname,{...s,to:r.pathname},this.parsePathnameCache);return!c||e.params&&!tt(c,e.params,{partial:!0})?!1:c&&(s?.includeSearch??!0)?tt(a.search,r.search,{partial:!0})?c:!1:c},this.hasNotFoundMatch=()=>this.__store.state.matches.some(e=>e.status==="notFound"||e.globalNotFound),this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...o,caseSensitive:o.caseSensitive??!1,notFoundMode:o.notFoundMode??"fuzzy",stringifySearch:o.stringifySearch??fo,parseSearch:o.parseSearch??ho}),typeof document<"u"&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.__store.state}get looseRoutesById(){return this.routesById}matchRoutesInternal(o,e){const{foundRoute:s,matchedRoutes:n,routeParams:r}=this.getMatchedRoutes(o.pathname,e?.dest?.to);let i=!1;(s?s.path!=="/"&&r["**"]:J(o.pathname))&&(this.options.notFoundRoute?n.push(this.options.notFoundRoute):i=!0);const a=(()=>{if(i){if(this.options.notFoundMode!=="root")for(let l=n.length-1;l>=0;l--){const h=n[l];if(h.children)return h.id}return A}})(),c=[],u=l=>l?.id?l.context??this.options.context??void 0:this.options.context??void 0;return n.forEach((l,h)=>{const d=c[h-1],[f,p,m]=(()=>{const I=d?.search??o.search,Y=d?._strictSearch??void 0;try{const D=ee(l.options.validateSearch,{...I})??void 0;return[{...I,...D},{...Y,...D},void 0]}catch(D){let X=D;if(D instanceof At||(X=new At(D.message,{cause:D})),e?.throwOnError)throw X;return[I,{},X]}})(),g=l.options.loaderDeps?.({search:f})??"",y=g?JSON.stringify(g):"",{interpolatedPath:w,usedParams:P}=Wt({path:l.fullPath,params:r,decodeCharMap:this.pathParamsDecodeCharMap}),b=l.id+w+y,E=this.getMatch(b),x=this.state.matches.find(I=>I.routeId===l.id),R=E?._strictParams??P;let S;if(!E){const I=l.options.params?.parse??l.options.parseParams;if(I)try{Object.assign(R,I(R))}catch(Y){if(S=new Co(Y.message,{cause:Y}),e?.throwOnError)throw S}}Object.assign(r,R);const C=x?"stay":"enter";let M;if(E)M={...E,cause:C,params:x?B(x.params,r):r,_strictParams:R,search:B(x?x.search:E.search,f),_strictSearch:p};else{const I=l.options.loader||l.options.beforeLoad||l.lazyFn||ss(l)?"pending":"success";M={id:b,index:h,routeId:l.id,params:x?B(x.params,r):r,_strictParams:R,pathname:w,updatedAt:Date.now(),search:x?B(x.search,f):f,_strictSearch:p,searchError:void 0,status:I,isFetching:!1,error:void 0,paramsError:S,__routeContext:void 0,_nonReactive:{loadPromise:at()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:C,loaderDeps:x?B(x.loaderDeps,g):g,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:l.options.staticData||{},fullPath:l.fullPath}}e?.preload||(M.globalNotFound=a===l.id),M.searchError=m;const T=u(d);M.context={...T,...M.__routeContext,...M.__beforeLoadContext},c.push(M)}),c.forEach((l,h)=>{const d=this.looseRoutesById[l.routeId];if(!this.getMatch(l.id)&&e?._buildLocation!==!0){const p=c[h-1],m=u(p);if(d.options.context){const g={deps:l.loaderDeps,params:l.params,context:m??{},location:o,navigate:y=>this.navigate({...y,_fromLocation:o}),buildLocation:this.buildLocation,cause:l.cause,abortController:l.abortController,preload:!!l.preload,matches:c};l.__routeContext=d.options.context(g)??void 0}l.context={...m,...l.__routeContext,...l.__beforeLoadContext}}}),c}}class At extends Error{}class Co extends Error{}function Mo(t){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:t,matches:[],pendingMatches:[],cachedMatches:[],statusCode:200}}function ee(t,o){if(t==null)return{};if("~standard"in t){const e=t["~standard"].validate(o);if(e instanceof Promise)throw new At("Async validation not supported");if(e.issues)throw new At(JSON.stringify(e.issues,void 0,2),{cause:e});return e.value}return"parse"in t?t.parse(o):typeof t=="function"?t(o):{}}function Lo({pathname:t,routePathname:o,caseSensitive:e,routesByPath:s,routesById:n,flatRoutes:r,parseCache:i}){let a={};const c=J(t),u=f=>Qt(c,{to:f.fullPath,caseSensitive:f.options?.caseSensitive??e,fuzzy:!0},i);let l=o!==void 0?s[o]:void 0;if(l)a=u(l);else{let f;for(const p of r){const m=u(p);if(m)if(p.path!=="/"&&m["**"])f||(f={foundRoute:p,routeParams:m});else{l=p,a=m;break}}!l&&f&&(l=f.foundRoute,a=f.routeParams)}let h=l||n[A];const d=[h];for(;h.parentRoute;)h=h.parentRoute,d.push(h);return d.reverse(),{matchedRoutes:d,routeParams:a,foundRoute:l}}function Eo({search:t,dest:o,destRoutes:e,_includeValidateSearch:s}){const n=e.reduce((a,c)=>{const u=[];if("search"in c.options)c.options.search?.middlewares&&u.push(...c.options.search.middlewares);else if(c.options.preSearchFilters||c.options.postSearchFilters){const l=({search:h,next:d})=>{let f=h;"preSearchFilters"in c.options&&c.options.preSearchFilters&&(f=c.options.preSearchFilters.reduce((m,g)=>g(m),h));const p=d(f);return"postSearchFilters"in c.options&&c.options.postSearchFilters?c.options.postSearchFilters.reduce((m,g)=>g(m),p):p};u.push(l)}if(s&&c.options.validateSearch){const l=({search:h,next:d})=>{const f=d(h);try{return{...f,...ee(c.options.validateSearch,f)??void 0}}catch{return f}};u.push(l)}return a.concat(u)},[])??[],r=({search:a})=>o.search?o.search===!0?a:Q(o.search,a):{};n.push(r);const i=(a,c)=>{if(a>=n.length)return c;const u=n[a];return u({search:c,next:h=>i(a+1,h)})};return i(0,t)}const To="Error preloading route! ☝️";class is{constructor(o){if(this.init=e=>{this.originalIndex=e.originalIndex;const s=this.options,n=!s?.path&&!s?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=A:this.parentRoute||K(!1);let r=n?A:s?.path;r&&r!=="/"&&(r=ie(r));const i=s?.id||r;let a=n?A:U([this.parentRoute.id===A?"":this.parentRoute.id,i]);r===A&&(r="/"),a!==A&&(a=U(["/",a]));const c=a===A?"/":U([this.parentRoute.fullPath,r]);this._path=r,this._id=a,this._fullPath=c,this._to=c},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e=="object"&&e!==null&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.options=o||{},this.isRoot=!o?.getParentRoute,o?.id&&o?.path)throw new Error("Route cannot have both an 'id' and a 'path' option.")}get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}}class Io extends is{constructor(o){super(o)}}function ae(t){const o=t.errorComponent??Dt;return v.jsx(Oo,{getResetKey:t.getResetKey,onCatch:t.onCatch,children:({error:e,reset:s})=>e?_.createElement(o,{error:e,reset:s}):t.children})}class Oo extends _.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromProps(o){return{resetKey:o.getResetKey()}}static getDerivedStateFromError(o){return{error:o}}reset(){this.setState({error:null})}componentDidUpdate(o,e){e.error&&e.resetKey!==this.state.resetKey&&this.reset()}componentDidCatch(o,e){this.props.onCatch&&this.props.onCatch(o,e)}render(){return this.props.children({error:this.state.resetKey!==this.props.getResetKey()?null:this.state.error,reset:()=>{this.reset()}})}}function Dt({error:t}){const[o,e]=_.useState(!1);return v.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[v.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[v.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),v.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>e(s=>!s),children:o?"Hide Error":"Show Error"})]}),v.jsx("div",{style:{height:".25rem"}}),o?v.jsx("div",{children:v.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:t.message?v.jsx("code",{children:t.message}):null})}):null]})}function ko({children:t,fallback:o=null}){return Fo()?v.jsx(it.Fragment,{children:t}):v.jsx(it.Fragment,{children:o})}function Fo(){return it.useSyncExternalStore(Ao,()=>!0,()=>!1)}function Ao(){return()=>{}}var Ut={exports:{}},Kt={},Ht={exports:{}},qt={};var ke;function Bo(){if(ke)return qt;ke=1;var t=se();function o(h,d){return h===d&&(h!==0||1/h===1/d)||h!==h&&d!==d}var e=typeof Object.is=="function"?Object.is:o,s=t.useState,n=t.useEffect,r=t.useLayoutEffect,i=t.useDebugValue;function a(h,d){var f=d(),p=s({inst:{value:f,getSnapshot:d}}),m=p[0].inst,g=p[1];return r(function(){m.value=f,m.getSnapshot=d,c(m)&&g({inst:m})},[h,f,d]),n(function(){return c(m)&&g({inst:m}),h(function(){c(m)&&g({inst:m})})},[h]),i(f),f}function c(h){var d=h.getSnapshot;h=h.value;try{var f=d();return!e(h,f)}catch{return!0}}function u(h,d){return d()}var l=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:a;return qt.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:l,qt}var Fe;function Do(){return Fe||(Fe=1,Ht.exports=Bo()),Ht.exports}var Ae;function zo(){if(Ae)return Kt;Ae=1;var t=se(),o=Do();function e(u,l){return u===l&&(u!==0||1/u===1/l)||u!==u&&l!==l}var s=typeof Object.is=="function"?Object.is:e,n=o.useSyncExternalStore,r=t.useRef,i=t.useEffect,a=t.useMemo,c=t.useDebugValue;return Kt.useSyncExternalStoreWithSelector=function(u,l,h,d,f){var p=r(null);if(p.current===null){var m={hasValue:!1,value:null};p.current=m}else m=p.current;p=a(function(){function y(x){if(!w){if(w=!0,P=x,x=d(x),f!==void 0&&m.hasValue){var R=m.value;if(f(R,x))return b=R}return b=x}if(R=b,s(P,x))return R;var S=d(x);return f!==void 0&&f(R,S)?(P=x,R):(P=x,b=S)}var w=!1,P,b,E=h===void 0?null:h;return[function(){return y(l())},E===null?void 0:function(){return y(E())}]},[l,h,d,f]);var g=n(u,p[0],p[1]);return i(function(){m.hasValue=!0,m.value=g},[g]),c(g),g},Kt}var Be;function $o(){return Be||(Be=1,Ut.exports=zo()),Ut.exports}var as=$o();const Tn=oe(as);function jo(t,o=s=>s,e={}){const s=e.equal??No;return as.useSyncExternalStoreWithSelector(t.subscribe,()=>t.state,()=>t.state,o,s)}function No(t,o){if(Object.is(t,o))return!0;if(typeof t!="object"||t===null||typeof o!="object"||o===null)return!1;if(t instanceof Map&&o instanceof Map){if(t.size!==o.size)return!1;for(const[s,n]of t)if(!o.has(s)||!Object.is(n,o.get(s)))return!1;return!0}if(t instanceof Set&&o instanceof Set){if(t.size!==o.size)return!1;for(const s of t)if(!o.has(s))return!1;return!0}if(t instanceof Date&&o instanceof Date)return t.getTime()===o.getTime();const e=De(t);if(e.length!==De(o).length)return!1;for(let s=0;s<e.length;s++)if(!Object.prototype.hasOwnProperty.call(o,e[s])||!Object.is(t[e[s]],o[e[s]]))return!1;return!0}function De(t){return Object.keys(t).concat(Object.getOwnPropertySymbols(t))}const Gt=_.createContext(null);function cs(){return typeof document>"u"?Gt:window.__TSR_ROUTER_CONTEXT__?window.__TSR_ROUTER_CONTEXT__:(window.__TSR_ROUTER_CONTEXT__=Gt,Gt)}function F(t){const o=_.useContext(cs());return t?.warn,o}function k(t){const o=F({warn:t?.router===void 0}),e=t?.router||o,s=_.useRef(void 0);return jo(e.__store,n=>{if(t?.select){if(t.structuralSharing??e.options.defaultStructuralSharing){const r=B(s.current,t.select(n));return s.current=r,r}return t.select(n)}return n})}const zt=_.createContext(void 0),Wo=_.createContext(void 0);function W(t){const o=_.useContext(t.from?Wo:zt);return k({select:s=>{const n=s.matches.find(r=>t.from?t.from===r.routeId:r.id===o);if(K(!((t.shouldThrow??!0)&&!n),`Could not find ${t.from?`an active match from "${t.from}"`:"a nearest match!"}`),n!==void 0)return t.select?t.select(n):n},structuralSharing:t.structuralSharing})}function ce(t){return W({from:t.from,strict:t.strict,structuralSharing:t.structuralSharing,select:o=>t.select?t.select(o.loaderData):o.loaderData})}function le(t){const{select:o,...e}=t;return W({...e,select:s=>o?o(s.loaderDeps):s.loaderDeps})}function ue(t){return W({from:t.from,shouldThrow:t.shouldThrow,structuralSharing:t.structuralSharing,strict:t.strict,select:o=>{const e=t.strict===!1?o.params:o._strictParams;return t.select?t.select(e):e}})}function he(t){return W({from:t.from,strict:t.strict,shouldThrow:t.shouldThrow,structuralSharing:t.structuralSharing,select:o=>t.select?t.select(o.search):o.search})}function de(t){const o=F();return _.useCallback(e=>o.navigate({...e,from:e.from??t?.from}),[t?.from,o])}var fe=Rs();const In=oe(fe),Ct=typeof window<"u"?_.useLayoutEffect:_.useEffect;function Jt(t){const o=_.useRef({value:t,prev:null}),e=o.current.value;return t!==e&&(o.current={value:t,prev:e}),o.current.prev}function Vo(t,o,e={},s={}){_.useEffect(()=>{if(!t.current||s.disabled||typeof IntersectionObserver!="function")return;const n=new IntersectionObserver(([r])=>{o(r)},e);return n.observe(t.current),()=>{n.disconnect()}},[o,e,s.disabled,t])}function Uo(t){const o=_.useRef(null);return _.useImperativeHandle(t,()=>o.current,[]),o}function Ko(t,o){const e=F(),[s,n]=_.useState(!1),r=_.useRef(!1),i=Uo(o),{activeProps:a,inactiveProps:c,activeOptions:u,to:l,preload:h,preloadDelay:d,hashScrollIntoView:f,replace:p,startTransition:m,resetScroll:g,viewTransition:y,children:w,target:P,disabled:b,style:E,className:x,onClick:R,onFocus:S,onMouseEnter:C,onMouseLeave:M,onTouchStart:T,ignoreBlocker:I,params:Y,search:D,hash:X,state:pe,mask:fs,reloadDocument:xn,unsafeRelative:bn,from:Cn,_fromLocation:Mn,...me}=t,ps=k({select:L=>L.location.search,structuralSharing:!0}),ge=t.from,ht=_.useMemo(()=>({...t,from:ge}),[e,ps,ge,t._fromLocation,t.hash,t.to,t.search,t.params,t.state,t.mask,t.unsafeRelative]),V=_.useMemo(()=>e.buildLocation({...ht}),[e,ht]),St=_.useMemo(()=>{if(b)return;let L=V.maskedLocation?V.maskedLocation.url:V.url,O=!1;return e.origin&&(L.startsWith(e.origin)?L=e.history.createHref(L.replace(e.origin,""))||"/":O=!0),{href:L,external:O}},[b,V.maskedLocation,V.url,e.origin,e.history]),_t=_.useMemo(()=>{if(St?.external)return St.href;try{return new URL(l),l}catch{}},[l,St]),ot=t.reloadDocument||_t?!1:h??e.options.defaultPreload,$t=d??e.options.defaultPreloadDelay??0,jt=k({select:L=>{if(_t)return!1;if(u?.exact){if(!Fs(L.location.pathname,V.pathname,e.basepath))return!1}else{const O=Ot(L.location.pathname,e.basepath),z=Ot(V.pathname,e.basepath);if(!(O.startsWith(z)&&(O.length===z.length||O[z.length]==="/")))return!1}return(u?.includeSearch??!0)&&!tt(L.location.search,V.search,{partial:!u?.exact,ignoreUndefined:!u?.explicitUndefined})?!1:u?.includeHash?L.location.hash===V.hash:!0}}),Z=_.useCallback(()=>{e.preloadRoute({...ht}).catch(L=>{console.warn(L),console.warn(To)})},[e,ht]),ms=_.useCallback(L=>{L?.isIntersecting&&Z()},[Z]);Vo(i,ms,Yo,{disabled:!!b||ot!=="viewport"}),_.useEffect(()=>{r.current||!b&&ot==="render"&&(Z(),r.current=!0)},[b,Z,ot]);const gs=L=>{const O=L.currentTarget.getAttribute("target"),z=P!==void 0?P:O;if(!b&&!Xo(L)&&!L.defaultPrevented&&(!z||z==="_self")&&L.button===0){L.preventDefault(),fe.flushSync(()=>{n(!0)});const _e=e.subscribe("onResolved",()=>{_e(),n(!1)});e.navigate({...ht,replace:p,resetScroll:g,hashScrollIntoView:f,startTransition:m,viewTransition:y,ignoreBlocker:I})}};if(_t)return{...me,ref:i,href:_t,...w&&{children:w},...P&&{target:P},...b&&{disabled:b},...E&&{style:E},...x&&{className:x},...R&&{onClick:R},...S&&{onFocus:S},...C&&{onMouseEnter:C},...M&&{onMouseLeave:M},...T&&{onTouchStart:T}};const ve=L=>{b||ot&&Z()},vs=ve,ys=L=>{if(!(b||!ot))if(!$t)Z();else{const O=L.target;if(ft.has(O))return;const z=setTimeout(()=>{ft.delete(O),Z()},$t);ft.set(O,z)}},Ss=L=>{if(b||!ot||!$t)return;const O=L.target,z=ft.get(O);z&&(clearTimeout(z),ft.delete(O))},Rt=jt?Q(a,{})??Ho:Yt,Pt=jt?Yt:Q(c,{})??Yt,ye=[x,Rt.className,Pt.className].filter(Boolean).join(" "),Se=(E||Rt.style||Pt.style)&&{...E,...Rt.style,...Pt.style};return{...me,...Rt,...Pt,href:St?.href,ref:i,onClick:pt([R,gs]),onFocus:pt([S,ve]),onMouseEnter:pt([C,ys]),onMouseLeave:pt([M,Ss]),onTouchStart:pt([T,vs]),disabled:!!b,target:P,...Se&&{style:Se},...ye&&{className:ye},...b&&qo,...jt&&Go,...s&&Jo}}const Yt={},Ho={className:"active"},qo={role:"link","aria-disabled":!0},Go={"data-status":"active","aria-current":"page"},Jo={"data-transitioning":"transitioning"},ft=new WeakMap,Yo={rootMargin:"100px"},pt=t=>o=>{for(const e of t)if(e){if(o.defaultPrevented)return;e(o)}},ls=_.forwardRef((t,o)=>{const{_asChild:e,...s}=t,{type:n,ref:r,...i}=Ko(s,o),a=typeof s.children=="function"?s.children({isActive:i["data-status"]==="active"}):s.children;return e===void 0&&delete i.disabled,_.createElement(e||"a",{...i,ref:r},a)});function Xo(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}class Zo extends is{constructor(o){super(o),this.useMatch=e=>W({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>W({...e,from:this.id,select:s=>e?.select?e.select(s.context):s.context}),this.useSearch=e=>he({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>ue({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>le({...e,from:this.id}),this.useLoaderData=e=>ce({...e,from:this.id}),this.useNavigate=()=>de({from:this.fullPath}),this.Link=it.forwardRef((e,s)=>v.jsx(ls,{ref:s,from:this.fullPath,...e})),this.$$typeof=Symbol.for("react.memo")}}function Qo(t){return new Zo(t)}class tn extends Io{constructor(o){super(o),this.useMatch=e=>W({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>W({...e,from:this.id,select:s=>e?.select?e.select(s.context):s.context}),this.useSearch=e=>he({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>ue({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>le({...e,from:this.id}),this.useLoaderData=e=>ce({...e,from:this.id}),this.useNavigate=()=>de({from:this.fullPath}),this.Link=it.forwardRef((e,s)=>v.jsx(ls,{ref:s,from:this.fullPath,...e})),this.$$typeof=Symbol.for("react.memo")}}function On(t){return new tn(t)}function ze(t){return typeof t=="object"?new $e(t,{silent:!0}).createRoute(t):new $e(t,{silent:!0}).createRoute}class $e{constructor(o,e){this.path=o,this.createRoute=s=>{this.silent;const n=Qo(s);return n.isRoot=!1,n},this.silent=e?.silent}}class je{constructor(o){this.useMatch=e=>W({select:e?.select,from:this.options.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>W({from:this.options.id,select:s=>e?.select?e.select(s.context):s.context}),this.useSearch=e=>he({select:e?.select,structuralSharing:e?.structuralSharing,from:this.options.id}),this.useParams=e=>ue({select:e?.select,structuralSharing:e?.structuralSharing,from:this.options.id}),this.useLoaderDeps=e=>le({...e,from:this.options.id}),this.useLoaderData=e=>ce({...e,from:this.options.id}),this.useNavigate=()=>{const e=F();return de({from:e.routesById[this.options.id].fullPath})},this.options=o,this.$$typeof=Symbol.for("react.memo")}}function Ne(t){return typeof t=="object"?new je(t):o=>new je({id:t,...o})}function en(){const t=F(),o=_.useRef({router:t,mounted:!1}),[e,s]=_.useState(!1),{hasPendingMatches:n,isLoading:r}=k({select:h=>({isLoading:h.isLoading,hasPendingMatches:h.matches.some(d=>d.status==="pending")}),structuralSharing:!0}),i=Jt(r),a=r||e||n,c=Jt(a),u=r||n,l=Jt(u);return t.startTransition=h=>{s(!0),_.startTransition(()=>{h(),s(!1)})},_.useEffect(()=>{const h=t.history.subscribe(t.load),d=t.buildLocation({to:t.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return J(t.latestLocation.href)!==J(d.href)&&t.commitLocation({...d,replace:!0}),()=>{h()}},[t,t.history]),Ct(()=>{if(typeof window<"u"&&t.ssr||o.current.router===t&&o.current.mounted)return;o.current={router:t,mounted:!0},(async()=>{try{await t.load()}catch(d){console.error(d)}})()},[t]),Ct(()=>{i&&!r&&t.emit({type:"onLoad",...et(t.state)})},[i,t,r]),Ct(()=>{l&&!u&&t.emit({type:"onBeforeRouteMount",...et(t.state)})},[u,l,t]),Ct(()=>{c&&!a&&(t.emit({type:"onResolved",...et(t.state)}),t.__store.setState(h=>({...h,status:"idle",resolvedLocation:h.location})),co(t))},[a,c,t]),null}function sn(t){const o=k({select:e=>`not-found-${e.location.pathname}-${e.status}`});return v.jsx(ae,{getResetKey:()=>o,onCatch:(e,s)=>{if($(e))t.onCatch?.(e,s);else throw e},errorComponent:({error:e})=>{if($(e))return t.fallback?.(e);throw e},children:t.children})}function on(){return v.jsx("p",{children:"Not Found"})}function rt(t){return v.jsx(v.Fragment,{children:t.children})}function us(t,o,e){return o.options.notFoundComponent?v.jsx(o.options.notFoundComponent,{data:e}):t.options.defaultNotFoundComponent?v.jsx(t.options.defaultNotFoundComponent,{data:e}):v.jsx(on,{})}function nn({children:t}){const o=F();return o.isServer?v.jsx("script",{nonce:o.options.ssr?.nonce,className:"$tsr",dangerouslySetInnerHTML:{__html:[t].filter(Boolean).join(`
`)+";$_TSR.c()"}}):null}function rn(){const t=F();if(!t.isScrollRestoring||!t.isServer||typeof t.options.scrollRestoration=="function"&&!t.options.scrollRestoration({location:t.latestLocation}))return null;const e=(t.options.getScrollRestorationKey||te)(t.latestLocation),s=e!==te(t.latestLocation)?e:void 0,n={storageKey:kt,shouldScrollRestoration:!0};return s&&(n.key=s),v.jsx(nn,{children:`(${Ye.toString()})(${JSON.stringify(n)})`})}const hs=_.memo(function({matchId:o}){const e=F(),s=k({select:y=>{const w=y.matches.find(P=>P.id===o);return K(w),{routeId:w.routeId,ssr:w.ssr,_displayPending:w._displayPending}},structuralSharing:!0}),n=e.routesById[s.routeId],r=n.options.pendingComponent??e.options.defaultPendingComponent,i=r?v.jsx(r,{}):null,a=n.options.errorComponent??e.options.defaultErrorComponent,c=n.options.onCatch??e.options.defaultOnCatch,u=n.isRoot?n.options.notFoundComponent??e.options.notFoundRoute?.options.component:n.options.notFoundComponent,l=s.ssr===!1||s.ssr==="data-only",h=(!n.isRoot||n.options.wrapInSuspense||l)&&(n.options.wrapInSuspense??r??(n.options.errorComponent?.preload||l))?_.Suspense:rt,d=a?ae:rt,f=u?sn:rt,p=k({select:y=>y.loadedAt}),m=k({select:y=>{const w=y.matches.findIndex(P=>P.id===o);return y.matches[w-1]?.routeId}}),g=n.isRoot?n.options.shellComponent??rt:rt;return v.jsxs(g,{children:[v.jsx(zt.Provider,{value:o,children:v.jsx(h,{fallback:i,children:v.jsx(d,{getResetKey:()=>p,errorComponent:a||Dt,onCatch:(y,w)=>{if($(y))throw y;c?.(y,w)},children:v.jsx(f,{fallback:y=>{if(!u||y.routeId&&y.routeId!==s.routeId||!y.routeId&&!n.isRoot)throw y;return _.createElement(u,y)},children:l||s._displayPending?v.jsx(ko,{fallback:i,children:v.jsx(We,{matchId:o})}):v.jsx(We,{matchId:o})})})})}),m===A&&e.options.scrollRestoration?v.jsxs(v.Fragment,{children:[v.jsx(an,{}),v.jsx(rn,{})]}):null]})});function an(){const t=F(),o=_.useRef(void 0);return v.jsx("script",{suppressHydrationWarning:!0,ref:e=>{e&&(o.current===void 0||o.current.href!==t.latestLocation.href)&&(t.emit({type:"onRendered",...et(t.state)}),o.current=t.latestLocation)}},t.latestLocation.state.__TSR_key)}const We=_.memo(function({matchId:o}){const e=F(),{match:s,key:n,routeId:r}=k({select:c=>{const u=c.matches.find(p=>p.id===o),l=u.routeId,d=(e.routesById[l].options.remountDeps??e.options.defaultRemountDeps)?.({routeId:l,loaderDeps:u.loaderDeps,params:u._strictParams,search:u._strictSearch});return{key:d?JSON.stringify(d):void 0,routeId:l,match:{id:u.id,status:u.status,error:u.error,_forcePending:u._forcePending,_displayPending:u._displayPending}}},structuralSharing:!0}),i=e.routesById[r],a=_.useMemo(()=>{const c=i.options.component??e.options.defaultComponent;return c?v.jsx(c,{},n):v.jsx(cn,{})},[n,i.options.component,e.options.defaultComponent]);if(s._displayPending)throw e.getMatch(s.id)?._nonReactive.displayPendingPromise;if(s._forcePending)throw e.getMatch(s.id)?._nonReactive.minPendingPromise;if(s.status==="pending"){const c=i.options.pendingMinMs??e.options.defaultPendingMinMs;if(c){const u=e.getMatch(s.id);if(u&&!u._nonReactive.minPendingPromise&&!e.isServer){const l=at();u._nonReactive.minPendingPromise=l,setTimeout(()=>{l.resolve(),u._nonReactive.minPendingPromise=void 0},c)}}throw e.getMatch(s.id)?._nonReactive.loadPromise}if(s.status==="notFound")return K($(s.error)),us(e,i,s.error);if(s.status==="redirected")throw K(j(s.error)),e.getMatch(s.id)?._nonReactive.loadPromise;if(s.status==="error"){if(e.isServer){const c=(i.options.errorComponent??e.options.defaultErrorComponent)||Dt;return v.jsx(c,{error:s.error,reset:void 0,info:{componentStack:""}})}throw s.error}return a}),cn=_.memo(function(){const o=F(),e=_.useContext(zt),s=k({select:u=>u.matches.find(l=>l.id===e)?.routeId}),n=o.routesById[s],r=k({select:u=>{const h=u.matches.find(d=>d.id===e);return K(h),h.globalNotFound}}),i=k({select:u=>{const l=u.matches,h=l.findIndex(d=>d.id===e);return l[h+1]?.id}}),a=o.options.defaultPendingComponent?v.jsx(o.options.defaultPendingComponent,{}):null;if(r)return us(o,n,void 0);if(!i)return null;const c=v.jsx(hs,{matchId:i});return s===A?v.jsx(_.Suspense,{fallback:a,children:c}):c});function ln(){const t=F(),e=t.routesById[A].options.pendingComponent??t.options.defaultPendingComponent,s=e?v.jsx(e,{}):null,n=t.isServer||typeof document<"u"&&t.ssr?rt:_.Suspense,r=v.jsxs(n,{fallback:s,children:[!t.isServer&&v.jsx(en,{}),v.jsx(un,{})]});return t.options.InnerWrap?v.jsx(t.options.InnerWrap,{children:r}):r}function un(){const t=F(),o=k({select:n=>n.matches[0]?.id}),e=k({select:n=>n.loadedAt}),s=o?v.jsx(hs,{matchId:o}):null;return v.jsx(zt.Provider,{value:o,children:t.options.disableGlobalCatchBoundary?s:v.jsx(ae,{getResetKey:()=>e,errorComponent:Dt,onCatch:n=>{n.message||n.toString()},children:s})})}function kn(){const t=F();return k({select:o=>[o.location.href,o.resolvedLocation?.href,o.status],structuralSharing:!0}),_.useCallback(o=>{const{pending:e,caseSensitive:s,fuzzy:n,includeSearch:r,...i}=o;return t.matchRoute(i,{pending:e,caseSensitive:s,fuzzy:n,includeSearch:r})},[t])}const Fn=t=>new hn(t);class hn extends bo{constructor(o){super(o)}}typeof globalThis<"u"?(globalThis.createFileRoute=ze,globalThis.createLazyFileRoute=Ne):typeof window<"u"&&(window.createFileRoute=ze,window.createLazyFileRoute=Ne);function dn({router:t,children:o,...e}){Object.keys(e).length>0&&t.update({...t.options,...e,context:{...t.options.context,...e.context}});const s=cs(),n=v.jsx(s.Provider,{value:t,children:o});return t.options.Wrap?v.jsx(t.options.Wrap,{children:n}):n}function An({router:t,...o}){return v.jsx(dn,{router:t,...o,children:v.jsx(ln,{})})}function nt(t,o,e){let s=e.initialDeps??[],n;function r(){var i,a,c,u;let l;e.key&&((i=e.debug)!=null&&i.call(e))&&(l=Date.now());const h=t();if(!(h.length!==s.length||h.some((p,m)=>s[m]!==p)))return n;s=h;let f;if(e.key&&((a=e.debug)!=null&&a.call(e))&&(f=Date.now()),n=o(...h),e.key&&((c=e.debug)!=null&&c.call(e))){const p=Math.round((Date.now()-l)*100)/100,m=Math.round((Date.now()-f)*100)/100,g=m/16,y=(w,P)=>{for(w=String(w);w.length<P;)w=" "+w;return w};console.info(`%c⏱ ${y(m,5)} /${y(p,5)} ms`,`
font-size: .6rem;
font-weight: bold;
color: hsl(${Math.max(0,Math.min(120-120*g,120))}deg 100% 31%);`,e?.key)}return(u=e?.onChange)==null||u.call(e,n),n}return r.updateDeps=i=>{s=i},r}function Ve(t,o){if(t===void 0)throw new Error("Unexpected undefined");return t}const fn=(t,o)=>Math.abs(t-o)<1.01,pn=(t,o,e)=>{let s;return function(...n){t.clearTimeout(s),s=t.setTimeout(()=>o.apply(this,n),e)}},Ue=t=>{const{offsetWidth:o,offsetHeight:e}=t;return{width:o,height:e}},mn=t=>t,gn=t=>{const o=Math.max(t.startIndex-t.overscan,0),e=Math.min(t.endIndex+t.overscan,t.count-1),s=[];for(let n=o;n<=e;n++)s.push(n);return s},vn=(t,o)=>{const e=t.scrollElement;if(!e)return;const s=t.targetWindow;if(!s)return;const n=i=>{const{width:a,height:c}=i;o({width:Math.round(a),height:Math.round(c)})};if(n(Ue(e)),!s.ResizeObserver)return()=>{};const r=new s.ResizeObserver(i=>{const a=()=>{const c=i[0];if(c?.borderBoxSize){const u=c.borderBoxSize[0];if(u){n({width:u.inlineSize,height:u.blockSize});return}}n(Ue(e))};t.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return r.observe(e,{box:"border-box"}),()=>{r.unobserve(e)}},Ke={passive:!0},He=typeof window>"u"?!0:"onscrollend"in window,yn=(t,o)=>{const e=t.scrollElement;if(!e)return;const s=t.targetWindow;if(!s)return;let n=0;const r=t.options.useScrollendEvent&&He?()=>{}:pn(s,()=>{o(n,!1)},t.options.isScrollingResetDelay),i=l=>()=>{const{horizontal:h,isRtl:d}=t.options;n=h?e.scrollLeft*(d&&-1||1):e.scrollTop,r(),o(n,l)},a=i(!0),c=i(!1);c(),e.addEventListener("scroll",a,Ke);const u=t.options.useScrollendEvent&&He;return u&&e.addEventListener("scrollend",c,Ke),()=>{e.removeEventListener("scroll",a),u&&e.removeEventListener("scrollend",c)}},Sn=(t,o,e)=>{if(o?.borderBoxSize){const s=o.borderBoxSize[0];if(s)return Math.round(s[e.options.horizontal?"inlineSize":"blockSize"])}return t[e.options.horizontal?"offsetWidth":"offsetHeight"]},_n=(t,{adjustments:o=0,behavior:e},s)=>{var n,r;const i=t+o;(r=(n=s.scrollElement)==null?void 0:n.scrollTo)==null||r.call(n,{[s.options.horizontal?"left":"top"]:i,behavior:e})};class Rn{constructor(o){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let e=null;const s=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(n=>{n.forEach(r=>{const i=()=>{this._measureElement(r.target,r)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()})}));return{disconnect:()=>{var n;(n=s())==null||n.disconnect(),e=null},observe:n=>{var r;return(r=s())==null?void 0:r.observe(n,{box:"border-box"})},unobserve:n=>{var r;return(r=s())==null?void 0:r.unobserve(n)}}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach(([s,n])=>{typeof n>"u"&&delete e[s]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:mn,rangeExtractor:gn,onChange:()=>{},measureElement:Sn,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...e}},this.notify=e=>{var s,n;(n=(s=this.options).onChange)==null||n.call(s,this,e)},this.maybeNotify=nt(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var e;const s=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==s){if(this.cleanup(),!s){this.maybeNotify();return}this.scrollElement=s,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((e=this.scrollElement)==null?void 0:e.window)??null,this.elementsCache.forEach(n=>{this.observer.observe(n)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,n=>{this.scrollRect=n,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(n,r)=>{this.scrollAdjustments=0,this.scrollDirection=r?this.getScrollOffset()<n?"forward":"backward":null,this.scrollOffset=n,this.isScrolling=r,this.maybeNotify()}))}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(e,s)=>{const n=new Map,r=new Map;for(let i=s-1;i>=0;i--){const a=e[i];if(n.has(a.lane))continue;const c=r.get(a.lane);if(c==null||a.end>c.end?r.set(a.lane,a):a.end<c.end&&n.set(a.lane,!0),n.size===this.options.lanes)break}return r.size===this.options.lanes?Array.from(r.values()).sort((i,a)=>i.end===a.end?i.index-a.index:i.end-a.end)[0]:void 0},this.getMeasurementOptions=nt(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(e,s,n,r,i)=>(this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:s,scrollMargin:n,getItemKey:r,enabled:i}),{key:!1}),this.getMeasurements=nt(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:e,paddingStart:s,scrollMargin:n,getItemKey:r,enabled:i},a)=>{if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(l=>{this.itemSizeCache.set(l.key,l.size)}));const c=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const u=this.measurementsCache.slice(0,c);for(let l=c;l<e;l++){const h=r(l),d=this.options.lanes===1?u[l-1]:this.getFurthestMeasurement(u,l),f=d?d.end+this.options.gap:s+n,p=a.get(h),m=typeof p=="number"?p:this.options.estimateSize(l),g=f+m,y=d?d.lane:l%this.options.lanes;u[l]={index:l,start:f,size:m,end:g,key:h,lane:y}}return this.measurementsCache=u,u},{key:!1,debug:()=>this.options.debug}),this.calculateRange=nt(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,s,n,r)=>this.range=e.length>0&&s>0?Pn({measurements:e,outerSize:s,scrollOffset:n,lanes:r}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=nt(()=>{let e=null,s=null;const n=this.calculateRange();return n&&(e=n.startIndex,s=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,s]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,s]},(e,s,n,r,i)=>r===null||i===null?[]:e({startIndex:r,endIndex:i,overscan:s,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{const s=this.options.indexAttribute,n=e.getAttribute(s);return n?parseInt(n,10):(console.warn(`Missing attribute name '${s}={index}' on measured element.`),-1)},this._measureElement=(e,s)=>{const n=this.indexFromElement(e),r=this.measurementsCache[n];if(!r)return;const i=r.key,a=this.elementsCache.get(i);a!==e&&(a&&this.observer.unobserve(a),this.observer.observe(e),this.elementsCache.set(i,e)),e.isConnected&&this.resizeItem(n,this.options.measureElement(e,s,this))},this.resizeItem=(e,s)=>{const n=this.measurementsCache[e];if(!n)return;const r=this.itemSizeCache.get(n.key)??n.size,i=s-r;i!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(n,i,this):n.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=i,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(n.index),this.itemSizeCache=new Map(this.itemSizeCache.set(n.key,s)),this.notify(!1))},this.measureElement=e=>{if(!e){this.elementsCache.forEach((s,n)=>{s.isConnected||(this.observer.unobserve(s),this.elementsCache.delete(n))});return}this._measureElement(e,void 0)},this.getVirtualItems=nt(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,s)=>{const n=[];for(let r=0,i=e.length;r<i;r++){const a=e[r],c=s[a];n.push(c)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{const s=this.getMeasurements();if(s.length!==0)return Ve(s[ds(0,s.length-1,n=>Ve(s[n]).start,e)])},this.getOffsetForAlignment=(e,s,n=0)=>{const r=this.getSize(),i=this.getScrollOffset();s==="auto"&&(s=e>=i+r?"end":"start"),s==="center"?e+=(n-r)/2:s==="end"&&(e-=r);const a=this.getTotalSize()+this.options.scrollMargin-r;return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,s="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));const n=this.measurementsCache[e];if(!n)return;const r=this.getSize(),i=this.getScrollOffset();if(s==="auto")if(n.end>=i+r-this.options.scrollPaddingEnd)s="end";else if(n.start<=i+this.options.scrollPaddingStart)s="start";else return[i,s];const a=s==="end"?n.end+this.options.scrollPaddingEnd:n.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,s,n.size),s]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(e,{align:s="start",behavior:n}={})=>{n==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(e,s),{adjustments:void 0,behavior:n})},this.scrollToIndex=(e,{align:s="auto",behavior:n}={})=>{n==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),e=Math.max(0,Math.min(e,this.options.count-1));let r=0;const i=10,a=u=>{if(!this.targetWindow)return;const l=this.getOffsetForIndex(e,u);if(!l){console.warn("Failed to get offset for index:",e);return}const[h,d]=l;this._scrollToOffset(h,{adjustments:void 0,behavior:n}),this.targetWindow.requestAnimationFrame(()=>{const f=this.getScrollOffset(),p=this.getOffsetForIndex(e,d);if(!p){console.warn("Failed to get offset for index:",e);return}fn(p[0],f)||c(d)})},c=u=>{this.targetWindow&&(r++,r<i?this.targetWindow.requestAnimationFrame(()=>a(u)):console.warn(`Failed to scroll to index ${e} after ${i} attempts.`))};a(s)},this.scrollBy=(e,{behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+e,{adjustments:void 0,behavior:s})},this.getTotalSize=()=>{var e;const s=this.getMeasurements();let n;if(s.length===0)n=this.options.paddingStart;else if(this.options.lanes===1)n=((e=s[s.length-1])==null?void 0:e.end)??0;else{const r=Array(this.options.lanes).fill(null);let i=s.length-1;for(;i>=0&&r.some(a=>a===null);){const a=s[i];r[a.lane]===null&&(r[a.lane]=a.end),i--}n=Math.max(...r.filter(a=>a!==null))}return Math.max(n-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(e,{adjustments:s,behavior:n})=>{this.options.scrollToFn(e,{behavior:n,adjustments:s},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(o)}}const ds=(t,o,e,s)=>{for(;t<=o;){const n=(t+o)/2|0,r=e(n);if(r<s)t=n+1;else if(r>s)o=n-1;else return n}return t>0?t-1:0};function Pn({measurements:t,outerSize:o,scrollOffset:e,lanes:s}){const n=t.length-1,r=c=>t[c].start;if(t.length<=s)return{startIndex:0,endIndex:n};let i=ds(0,n,r,e),a=i;if(s===1)for(;a<n&&t[a].end<e+o;)a++;else if(s>1){const c=Array(s).fill(0);for(;a<n&&c.some(l=>l<e+o);){const l=t[a];c[l.lane]=l.end,a++}const u=Array(s).fill(e+o);for(;i>=0&&u.some(l=>l>=e);){const l=t[i];u[l.lane]=l.start,i--}i=Math.max(0,i-i%s),a=Math.min(n,a+(s-1-a%s))}return{startIndex:i,endIndex:a}}const qe=typeof document<"u"?_.useLayoutEffect:_.useEffect;function wn(t){const o=_.useReducer(()=>({}),{})[1],e={...t,onChange:(n,r)=>{var i;r?fe.flushSync(o):o(),(i=t.onChange)==null||i.call(t,n,r)}},[s]=_.useState(()=>new Rn(e));return s.setOptions(e),qe(()=>s._didMount(),[]),qe(()=>s._willUpdate()),s}function Bn(t){return wn({observeElementRect:vn,observeElementOffset:yn,scrollToFn:_n,...t})}export{ls as L,cn as O,it as R,En as a,fe as b,In as c,Do as d,de as e,Bn as f,kn as g,On as h,K as i,v as j,Qo as k,Fn as l,go as m,An as n,_ as r,Tn as u};