@tanstack/react-router 0.0.1-beta.244 → 0.0.1-beta.245

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,5 +18,5 @@
18
18
  * LICENSE.md file in the root directory of this source tree.
19
19
  *
20
20
  * @license MIT
21
- */const s="pushstate",a="popstate",i="beforeunload",c=t=>(t.preventDefault(),t.returnValue=""),l=()=>{removeEventListener(i,c,{capture:!0})};function u(t){let e=t.getLocation(),n=new Set,o=[],r=[];const s=()=>{e=t.getLocation(),n.forEach((t=>t()))},a=()=>{if(o.length)o[0]?.(a,(()=>{o=[],l()}));else for(;r.length;)r.shift()?.()},u=t=>{r.push(t),a()};return{get location(){return e},subscribe:t=>(n.add(t),()=>{n.delete(t)}),push:(e,n)=>{n=h(n),u((()=>{t.pushState(e,n,s)}))},replace:(e,n)=>{n=h(n),u((()=>{t.replaceState(e,n,s)}))},go:e=>{u((()=>{t.go(e)}))},back:()=>{u((()=>{t.back()}))},forward:()=>{u((()=>{t.forward()}))},createHref:e=>t.createHref(e),block:t=>(o.push(t),1===o.length&&addEventListener(i,c,{capture:!0}),()=>{o=o.filter((e=>e!==t)),o.length||l()}),flush:()=>t.flush?.(),destroy:()=>t.destroy?.(),notify:s}}function h(t){return t||(t={}),{...t,key:m()}}function d(t){const e=t?.getHref??(()=>`${window.location.pathname}${window.location.search}${window.location.hash}`),n=t?.createHref??(t=>t);let o=p(e(),window.history.state);let r,i,c=!0;const l=()=>{c=!1,(()=>{r&&(window.history[r.isPush?"pushState":"replaceState"](r.state,"",r.href),r=void 0,i=void 0)})(),c=!0},h=(t,e,s,a)=>{const c=n(e);o=p(c,s),r={href:c,state:s,isPush:r?.isPush||"push"===t},a(),i||(i=Promise.resolve().then((()=>l())))},d=()=>{o=p(e(),window.history.state),y.notify()};var f=window.history.pushState,m=window.history.replaceState;const y=u({getLocation:()=>o,pushState:(t,e,n)=>h("push",t,e,n),replaceState:(t,e,n)=>h("replace",t,e,n),back:()=>window.history.back(),forward:()=>window.history.forward(),go:t=>window.history.go(t),createHref:t=>n(t),flush:l,destroy:()=>{window.history.pushState=f,window.history.replaceState=m,window.removeEventListener(s,d),window.removeEventListener(a,d)}});return window.addEventListener(s,d),window.addEventListener(a,d),window.history.pushState=function(){let t=f.apply(window.history,arguments);return c&&y.notify(),t},window.history.replaceState=function(){let t=m.apply(window.history,arguments);return c&&y.notify(),t},y}function f(t={initialEntries:["/"]}){const e=t.initialEntries;let n=t.initialIndex??e.length-1,o={key:m()};return u({getLocation:()=>p(e[n],o),pushState:(t,r)=>{o=r,e.push(t),n++},replaceState:(t,r)=>{o=r,e[n]=t},back:()=>{n--},forward:()=>{n=Math.min(n+1,e.length-1)},go:t=>window.history.go(t),createHref:t=>t})}function p(t,e){let n=t.indexOf("#"),o=t.indexOf("?");return{href:t,pathname:t.substring(0,n>0?o>0?Math.min(n,o):n:o>0?o:t.length),hash:n>-1?t.substring(n):"",search:o>-1?t.slice(o,-1===n?void 0:n):"",state:e||{}}}function m(){return(Math.random()+1).toString(36).substring(7)}var y="Invariant failed";function g(t,e){if(!t)throw new Error(y)}var v,w={exports:{}},b={};w.exports=function(){if(v)return b;v=1;var t=e,o=n,r="function"==typeof Object.is?Object.is:function(t,e){return t===e&&(0!==t||1/t==1/e)||t!=t&&e!=e},s=o.useSyncExternalStore,a=t.useRef,i=t.useEffect,c=t.useMemo,l=t.useDebugValue;return b.useSyncExternalStoreWithSelector=function(t,e,n,o,u){var h=a(null);if(null===h.current){var d={hasValue:!1,value:null};h.current=d}else d=h.current;h=c((function(){function t(t){if(!i){if(i=!0,s=t,t=o(t),void 0!==u&&d.hasValue){var e=d.value;if(u(e,t))return a=e}return a=t}if(e=a,r(s,t))return e;var n=o(t);return void 0!==u&&u(e,n)?e:(s=t,a=n)}var s,a,i=!1,c=void 0===n?null:n;return[function(){return t(e())},null===c?void 0:function(){return t(c())}]}),[e,n,o,u]);var f=s(t,h[0],h[1]);return i((function(){d.hasValue=!0,d.value=f}),[f]),l(f),f},b}();var S=w.exports,R=class{constructor(t,e){this.listeners=new Set,this._batching=!1,this._flushing=0,this._nextPriority=null,this.subscribe=t=>{this.listeners.add(t);const e=this.options?.onSubscribe?.(t,this);return()=>{this.listeners.delete(t),e?.()}},this.setState=(t,e)=>{const n=this.state;this.state=this.options?.updateFn?this.options.updateFn(n)(t):t(n);const o=e?.priority??this.options?.defaultPriority??"high";null===this._nextPriority||"high"===this._nextPriority?this._nextPriority=o:this._nextPriority=this.options?.defaultPriority??"high",this.options?.onUpdate?.({priority:this._nextPriority}),this._flush()},this._flush=()=>{if(this._batching)return;const t=++this._flushing;this.listeners.forEach((e=>{this._flushing===t&&e({priority:this._nextPriority??"high"})}))},this.batch=t=>{if(this._batching)return t();this._batching=!0,t(),this._batching=!1,this._flush()},this.state=t,this.options=e}};function _(t,e){if(Object.is(t,e))return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(let o=0;o<n.length;o++)if(!Object.prototype.hasOwnProperty.call(e,n[o])||!Object.is(t[n[o]],e[n[o]]))return!1;return!0}function E(t){const e=t.errorComponent??P;return r.createElement(L,{getResetKey:t.getResetKey,onCatch:t.onCatch,children:({error:n})=>n?r.createElement(e,{error:n}):t.children})}class L extends r.Component{state={error:null};static getDerivedStateFromProps(t){return{resetKey:t.getResetKey()}}static getDerivedStateFromError(t){return{error:t}}componentDidUpdate(t,e){e.error&&e.resetKey!==this.state.resetKey&&this.setState({error:null})}componentDidCatch(t){console.error(t),this.props.onCatch?.(t)}render(){return this.props.children(this.state)}}function P({error:t}){const[e,n]=r.useState(!1);return r.createElement("div",{style:{padding:".5rem",maxWidth:"100%"}},r.createElement("div",{style:{display:"flex",alignItems:"center",gap:".5rem"}},r.createElement("strong",{style:{fontSize:"1rem"}},"Something went wrong!"),r.createElement("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>n((t=>!t))},e?"Hide Error":"Show Error")),r.createElement("div",{style:{height:".25rem"}}),e?r.createElement("div",null,r.createElement("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"}},t.message?r.createElement("code",null,t.message):null)):null)}const x="undefined"==typeof document;function C(t){return t[t.length-1]}function T(t,e){return"function"==typeof t?t(e):t}function k(t,e){return e.reduce(((e,n)=>(e[n]=t[n],e)),{})}function M(t,e){if(t===e)return t;const n=e,o=Array.isArray(t)&&Array.isArray(n);if(o||O(t)&&O(n)){const e=o?t.length:Object.keys(t).length,r=o?n:Object.keys(n),s=r.length,a=o?[]:{};let i=0;for(let e=0;e<s;e++){const s=o?e:r[e];a[s]=M(t[s],n[s]),a[s]===t[s]&&i++}return e===s&&i===e?t:a}return n}function O(t){if(!D(t))return!1;const e=t.constructor;if(void 0===e)return!0;const n=e.prototype;return!!D(n)&&!!n.hasOwnProperty("isPrototypeOf")}function D(t){return"[object Object]"===Object.prototype.toString.call(t)}function I(t,e,n=!1){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(O(t)&&O(e)){const o=Object.keys(t),r=Object.keys(e);return!(!n&&o.length!==r.length)&&!r.some((o=>!(o in t)||!I(t[o],e[o],n)))}return!(!Array.isArray(t)||!Array.isArray(e))&&!t.some(((t,o)=>!I(t,e[o],n)))}const j="undefined"!=typeof window?r.useLayoutEffect:r.useEffect;function $(t){return t.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"')}function A(t){return B(t.filter(Boolean).join("/"))}function B(t){return t.replace(/\/{2,}/g,"/")}function N(t){return"/"===t?t:t.replace(/^\/{1,}/,"")}function H(t){return"/"===t?t:t.replace(/\/{1,}$/,"")}function K(t){return H(N(t))}function F(t,e,n){e=e.replace(new RegExp(`^${t}`),"/"),n=n.replace(new RegExp(`^${t}`),"/");let o=W(e);const r=W(n);r.forEach(((t,e)=>{if("/"===t.value)e?e===r.length-1&&o.push(t):o=[t];else if(".."===t.value)o.length>1&&"/"===C(o)?.value&&o.pop(),o.pop();else{if("."===t.value)return;o.push(t)}}));return B(A([t,...o.map((t=>t.value))]))}function W(t){if(!t)return[];const e=[];if("/"===(t=B(t)).slice(0,1)&&(t=t.substring(1),e.push({type:"pathname",value:"/"})),!t)return e;const n=t.split("/").filter(Boolean);return e.push(...n.map((t=>"$"===t||"*"===t?{type:"wildcard",value:t}:"$"===t.charAt(0)?{type:"param",value:t}:{type:"pathname",value:t}))),"/"===t.slice(-1)&&(t=t.substring(1),e.push({type:"pathname",value:"/"})),e}function U(t,e,n=!1){return A(W(t).map((t=>{if("wildcard"===t.type){const o=e[t.value];return n?`${t.value}${o??""}`:o}return"param"===t.type?e[t.value.substring(1)]??"undefined":t.value})))}function z(t,e,n){const o=Y(t,e,n);if(!n.to||o)return o??{}}function Y(t,e,n){e="/"!=t?e.substring(t.length):e;const o=`${n.to??"$"}`,r=W(e),s=W(o);e.startsWith("/")||r.unshift({type:"pathname",value:"/"}),o.startsWith("/")||s.unshift({type:"pathname",value:"/"});const a={};return(()=>{for(let t=0;t<Math.max(r.length,s.length);t++){const e=r[t],o=s[t],i=t>=r.length-1,c=t>=s.length-1;if(o){if("wildcard"===o.type)return!!e?.value&&(a["*"]=A(r.slice(t).map((t=>t.value))),!0);if("pathname"===o.type){if("/"===o.value&&!e?.value)return!0;if(e)if(n.caseSensitive){if(o.value!==e.value)return!1}else if(o.value.toLowerCase()!==e.value.toLowerCase())return!1}if(!e)return!1;if("param"===o.type){if("/"===e?.value)return!1;"$"!==e.value.charAt(0)&&(a[o.value.substring(1)]=e.value)}}if(!i&&c)return!!n.fuzzy}return!0})()?a:void 0}function J(t){return ht({select:e=>{const n=C(e.matches)?.params;return t?.select?t.select(n):n}})}function X(t){return at({...t,select:e=>t?.select?t.select(e.search):e.search})}const q="__root__";class V{constructor(t){this.options=t||{},this.isRoot=!t?.getParentRoute,V.__onInit(this),this.$$typeof=Symbol.for("react.memo")}init=t=>{this.originalIndex=t.originalIndex;const e=this.options,n=!e?.path&&!e?.id;this.parentRoute=this.options?.getParentRoute?.(),n?this.path=q:g(this.parentRoute);let o=n?q:e.path;o&&"/"!==o&&(o=K(o));const r=e?.id||o;let s=n?q:A([this.parentRoute.id===q?"":this.parentRoute.id,r]);o===q&&(o="/"),s!==q&&(s=A(["/",s]));const a=s===q?"/":A([this.parentRoute.fullPath,o]);this.path=o,this.id=s,this.fullPath=a,this.to=a};addChildren=t=>(this.children=t,this);update=t=>(Object.assign(this.options,t),this);static __onInit=t=>{};useMatch=t=>at({...t,from:this.id});useRouteContext=t=>at({...t,from:this.id,select:e=>t?.select?t.select(e.context):e.context});useSearch=t=>X({...t,from:this.id});useParams=t=>J({...t,from:this.id});useLoaderData=t=>it({...t,from:this.id})}class G extends V{constructor(t){super(t)}}const Q=r.createContext(void 0);function Z(){const t=dt(),e=ht({select:t=>st(t)[0]?.id}),n=t.routesById[q],o=r.useCallback((t=>r.createElement(P,{...t,useMatch:n.useMatch,useRouteContext:n.useRouteContext,useSearch:n.useSearch,useParams:n.useParams})),[n]);return r.createElement(Q.Provider,{value:e},r.createElement(E,{getResetKey:()=>t.state.resolvedLocation.state?.key,errorComponent:o,onCatch:()=>{}},e?r.createElement(et,{matchId:e}):null))}function tt(t){return r.createElement(r.Fragment,null,t.children)}function et({matchId:t}){const e=dt(),n=ht({select:e=>st(e).find((e=>e.id===t))?.routeId});g(n);const o=e.routesById[n],s=o.options.pendingComponent??e.options.defaultPendingComponent,a=s?r.createElement(s,{useMatch:o.useMatch,useRouteContext:o.useRouteContext,useSearch:o.useSearch,useParams:o.useParams}):void 0,i=o.options.errorComponent??e.options.defaultErrorComponent??P,c=o.options.wrapInSuspense??a?r.Suspense:tt,l=i?r.useCallback((t=>r.createElement(i,{...t,useMatch:o.useMatch,useRouteContext:o.useRouteContext,useSearch:o.useSearch,useParams:o.useParams})),[o]):void 0,u=l?E:tt;return r.createElement(Q.Provider,{value:t},r.createElement(c,{fallback:a},r.createElement(u,{getResetKey:()=>e.state.resolvedLocation.state?.key,errorComponent:l,onCatch:()=>{}},r.createElement(nt,{matchId:t,pendingElement:a}))))}function nt({matchId:t,pendingElement:e}){const n=dt(),o=ht({select:e=>st(e).find((e=>e.id===t))?.routeId}),s=n.routesById[o],a=ht({select:e=>k(st(e).find((e=>e.id===t)),["status","error","showPending","loadPromise"])});if("error"===a.status)throw a.error;if("pending"===a.status){if(a.showPending)return e||null;throw a.loadPromise}if("success"===a.status){let t=s.options.component??n.options.defaultComponent;return t?r.createElement(t,{useMatch:s.useMatch,useRouteContext:s.useRouteContext,useSearch:s.useSearch,useParams:s.useParams,useLoaderData:s.useLoaderData}):r.createElement(ot,null)}g(!1)}function ot(){const t=r.useContext(Q),e=ht({select:e=>{const n=st(e),o=n.findIndex((e=>e.id===t));return n[o+1]?.id}});return e?r.createElement(et,{matchId:e}):null}function rt(){const{matchRoute:t}=dt();return r.useCallback((e=>{const{pending:n,caseSensitive:o,...r}=e;return t(r,{pending:n,caseSensitive:o})}),[])}function st(t){return t.pendingMatches?.some((t=>t.showPending))?t.pendingMatches:t.matches}function at(t){const e=dt(),n=r.useContext(Q),o=st(e.state).find((t=>t.id===n))?.routeId,s=(()=>{const o=st(e.state);return(t?.from?o.find((e=>e.routeId===t?.from)):o.find((t=>t.id===n))).routeId})();(t?.strict??1)&&g(o==s);return ht({select:e=>{const o=st(e).find((t=>t.id===n));return g(o,t?.from&&t.from),t?.select?t.select(o):o}})}function it(t){return at({...t,select:e=>"function"==typeof t.select?t.select(e?.loaderData):e?.loaderData})}const ct=r.createContext(null);function lt(){const t=dt(),e=ht({select:t=>k(t,["isLoading","location","resolvedLocation","isTransitioning"])}),[n,o]=r.useTransition();t.startReactTransition=o,r.useEffect((()=>{n&&t.__store.setState((t=>({...t,isTransitioning:n})))}),[n]);const s=()=>{var n;n=()=>{try{t.load()}catch(t){console.error(t)}},e.isTransitioning?n():o((()=>n()))};return j((()=>{const n=t.history.subscribe((()=>{t.latestLocation=t.parseLocation(t.latestLocation),e.location!==t.latestLocation&&s()})),o=t.buildLocation({search:!0,params:!0,hash:!0,state:!0});return e.location.href!==o.href&&t.commitLocation({...o,replace:!0}),()=>{n()}}),[t.history]),j((()=>{!e.isTransitioning||n||e.isLoading||e.resolvedLocation===e.location||(t.emit({type:"onResolved",fromLocation:e.resolvedLocation,toLocation:e.location,pathChanged:e.location.href!==e.resolvedLocation?.href}),t.pendingMatches=[],t.__store.setState((t=>({...t,isTransitioning:!1,resolvedLocation:t.location}))))}),[e.isTransitioning,n,e.isLoading,e.resolvedLocation,e.location]),j((()=>{window.__TSR_DEHYDRATED__||s()}),[]),null}function ut(t,e){return[...t.pendingMatches??[],...t.matches].find((t=>t.id===e))}function ht(t){return function(t,e=(t=>t)){return S.useSyncExternalStoreWithSelector(t.subscribe,(()=>t.state),(()=>t.state),e,_)}(dt().__store,t?.select)}function dt(){const t="undefined"!=typeof document&&window.__TSR_ROUTER_CONTEXT__||ct;return r.useContext(t)}function ft(t){return"object"==typeof t&&null!==t&&!(t instanceof Promise)&&!t.then&&"__deferredState"in t}function pt({promise:t}){const e=dt();let n=t.__deferredState;const o=`__TSR__DEFERRED__${n.uid}`;if(ft(t)&&(n=e.hydrateData(o),(t=Promise.resolve(n.data)).__deferredState=n),"pending"===n.status)throw new Promise((t=>setTimeout(t,1))).then((()=>t));if("error"===n.status)throw n.error;return e.dehydrateData(o,n),[n.data]}"undefined"!=typeof document&&(window.__TSR_ROUTER_CONTEXT__=ct);function mt(){return mt=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},mt.apply(this,arguments)}function yt(t){const{buildLink:e}=dt(),n=at({strict:!1,select:t=>t.pathname}),{type:o,children:r,target:s,activeProps:a=(()=>({className:"active"})),inactiveProps:i=(()=>({})),activeOptions:c,disabled:l,hash:u,search:h,params:d,to:f,state:p,mask:m,preload:y,preloadDelay:g,replace:v,startTransition:w,resetScroll:b,style:S,className:R,onClick:_,onFocus:E,onMouseEnter:L,onMouseLeave:P,onTouchStart:x,...C}=t,k=e({from:t.to?n:void 0,...t});if("external"===k.type){const{href:t}=k;return{href:t}}const{handleClick:M,handleFocus:O,handleEnter:D,handleLeave:I,handleTouchStart:j,isActive:$,next:A}=k,B=t=>e=>{e.persist&&e.persist(),t.filter(Boolean).forEach((t=>{e.defaultPrevented||t(e)}))},N=$?T(a,{})??{}:{},H=$?{}:T(i,{})??{};return{...N,...H,...C,href:l?void 0:A.maskedLocation?A.maskedLocation.href:A.href,onClick:B([_,M]),onFocus:B([E,O]),onMouseEnter:B([L,D]),onMouseLeave:B([P,I]),onTouchStart:B([x,j]),target:s,style:{...S,...N.style,...H.style},className:[R,N.className,H.className].filter(Boolean).join(" ")||void 0,...l?{role:"link","aria-disabled":!0}:void 0,"data-status":$?"active":void 0}}const gt=r.forwardRef(((t,e)=>{const n=yt(t);return r.createElement("a",mt({ref:e},n,{children:"function"==typeof t.children?t.children({isActive:"active"===n["data-status"]}):t.children}))}));function vt(t,e){var n,o,r,s="";for(n in t)if(void 0!==(r=t[n]))if(Array.isArray(r))for(o=0;o<r.length;o++)s&&(s+="&"),s+=encodeURIComponent(n)+"="+encodeURIComponent(r[o]);else s&&(s+="&"),s+=encodeURIComponent(n)+"="+encodeURIComponent(r);return(e||"")+s}function wt(t){if(!t)return"";var e=decodeURIComponent(t);return"false"!==e&&("true"===e||(0*+e==0&&+e+""===e?+e:e))}function bt(t){for(var e,n,o={},r=t.split("&");e=r.shift();)void 0!==o[n=(e=e.split("=")).shift()]?o[n]=[].concat(o[n],wt(e.shift())):o[n]=wt(e.shift());return o}function St(t){return!!t?.isRedirect}const Rt=Et(JSON.parse),_t=Lt(JSON.stringify,JSON.parse);function Et(t){return e=>{"?"===e.substring(0,1)&&(e=e.substring(1));let n=bt(e);for(let e in n){const o=n[e];if("string"==typeof o)try{n[e]=t(o)}catch(t){}}return n}}function Lt(t,e){return n=>{(n={...n})&&Object.keys(n).forEach((o=>{const r=n[o];void 0===r||void 0===r?delete n[o]:n[o]=function(n){if("object"==typeof n&&null!==n)try{return t(n)}catch(t){}else if("string"==typeof n&&"function"==typeof e)try{return e(n),t(n)}catch(t){}return n}(r)}));const o=vt(n).toString();return o?`?${o}`:""}}const Pt=["component","errorComponent","pendingComponent"],xt="Error preloading route! ☝️";class Ct extends Error{}class Tt extends Error{}function kt(t){return{isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:{...t},location:t,matches:[],pendingMatches:[],lastUpdated:Date.now()}}const Mt="undefined"!=typeof window?r.useLayoutEffect:r.useEffect,Ot="window",Dt="___";let It=new WeakSet;let jt="undefined"!=typeof window&&window.sessionStorage?(()=>{const t="tsr-scroll-restoration-v2";return{state:JSON.parse(window.sessionStorage.getItem(t)||"null")||{cached:{},next:{}},set:e=>{jt.state=T(e,jt.state),window.sessionStorage.setItem(t,JSON.stringify(jt.state))}}})():void 0;const $t=t=>t.state.key;function At(t){const e=dt();Mt((()=>{const n=t?.getKey||$t,{history:o}=window;o.scrollRestoration&&(o.scrollRestoration="manual");const r=t=>{if(It.has(t.target))return;It.add(t.target);let e="";if(t.target===document||t.target===window)e=Ot;else{const n=t.target.getAttribute("data-scroll-restoration-id");e=n?`[data-scroll-restoration-id="${n}"]`:Bt(t.target)}jt.state.next[e]||jt.set((t=>({...t,next:{...t.next,[e]:{scrollX:NaN,scrollY:NaN}}})))};"undefined"!=typeof document&&document.addEventListener("scroll",r,!0);const s=e.subscribe("onBeforeLoad",(t=>{if(t.pathChanged){const e=n(t.fromLocation);for(const t in jt.state.next){const n=jt.state.next[t];if(t===Ot)n.scrollX=window.scrollX||0,n.scrollY=window.scrollY||0;else if(t){const e=document.querySelector(t);n.scrollX=e?.scrollLeft||0,n.scrollY=e?.scrollTop||0}jt.set((o=>{const r={...o.next};return delete r[t],{...o,next:r,cached:{...o.cached,[[e,t].join(Dt)]:n}}}))}}})),a=e.subscribe("onResolved",(n=>{if(n.pathChanged){if(!e.resetNextScroll)return;e.resetNextScroll=!0;const o=(t?.getKey||$t)(n.toLocation);let r=!1;for(const t in jt.state.cached){const e=jt.state.cached[t],[n,s]=t.split(Dt);if(n===o)if(s===Ot)r=!0,window.scrollTo(e.scrollX,e.scrollY);else if(s){const t=document.querySelector(s);t&&(t.scrollLeft=e.scrollX,t.scrollTop=e.scrollY)}}r||window.scrollTo(0,0),jt.set((t=>({...t,next:{}}))),It=new WeakSet}}));return()=>{document.removeEventListener("scroll",r),s(),a()}}),[])}function Bt(t){let e,n=[];for(;e=t.parentNode;)n.unshift(`${t.tagName}:nth-child(${[].indexOf.call(e.children,t)+1})`),t=e;return`${n.join(" > ")}`.toLowerCase()}function Nt(t,e=!0){const{history:n}=dt();r.useEffect((()=>{if(!e)return;let o=n.block(((e,n)=>{window.confirm(t)&&(o(),e())}));return o}))}t.Await=function(t){const e=pt(t);return t.children(...e)},t.Block=function({message:t,condition:e,children:n}){return Nt(t,e),n??null},t.CatchBoundary=E,t.CatchBoundaryImpl=L,t.ErrorComponent=P,t.FileRoute=class{constructor(t){this.path=t}createRoute=t=>{const e=new V(t);return e.isRoot=!1,e}},t.Link=gt,t.Match=et,t.MatchRoute=function(t){const e=rt()(t);return"function"==typeof t.children?t.children(e):e?t.children:null},t.Matches=Z,t.Navigate=function(t){const{navigate:e}=dt(),n=at({strict:!1});return j((()=>{e({from:t.to?n.pathname:void 0,...t})}),[]),null},t.Outlet=ot,t.PathParamError=Tt,t.RootRoute=G,t.Route=V,t.Router=class{tempLocationKey=`${Math.round(1e7*Math.random())}`;resetNextScroll=!0;navigateTimeout=null;latestLoadPromise=Promise.resolve();subscribers=new Set;pendingMatches=[];injectedHtml=[];constructor(t){this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...t,stringifySearch:t?.stringifySearch??_t,parseSearch:t?.parseSearch??Rt})}startReactTransition=t=>t();update=t=>{this.options={...this.options,...t},this.basepath=`/${K(t.basepath??"")??""}`,(!this.history||this.options.history&&this.options.history!==this.history)&&(this.history=this.options.history??("undefined"!=typeof document?d():f()),this.latestLocation=this.parseLocation()),this.options.routeTree!==this.routeTree&&(this.routeTree=this.options.routeTree,this.buildRouteTree()),this.__store||(this.__store=new R(kt(this.latestLocation),{onUpdate:()=>{this.__store.state={...this.state,status:this.state.isTransitioning||this.state.isLoading?"pending":"idle"}}}))};get state(){return this.__store.state}buildRouteTree=()=>{this.routesById={},this.routesByPath={};const t=e=>{e.forEach(((e,n)=>{e.init({originalIndex:n});if(g(!this.routesById[e.id],String(e.id)),this.routesById[e.id]=e,!e.isRoot&&e.path){const t=H(e.fullPath);this.routesByPath[t]&&!e.fullPath.endsWith("/")||(this.routesByPath[t]=e)}const o=e.children;o?.length&&t(o)}))};t([this.routeTree]),this.flatRoutes=Object.values(this.routesByPath).map(((t,e)=>{const n=K(t.fullPath),o=W(n);for(;o.length>1&&"/"===o[0]?.value;)o.shift();const r=o.map((t=>"param"===t.type?.5:"wildcard"===t.type?.25:1));return{child:t,trimmed:n,parsed:o,index:e,score:r}})).sort(((t,e)=>{let n="/"===t.trimmed?1:"/"===e.trimmed?-1:0;if(0!==n)return n;const o=Math.min(t.score.length,e.score.length);if(t.score.length!==e.score.length)return e.score.length-t.score.length;for(let n=0;n<o;n++)if(t.score[n]!==e.score[n])return e.score[n]-t.score[n];for(let n=0;n<o;n++)if(t.parsed[n].value!==e.parsed[n].value)return t.parsed[n].value>e.parsed[n].value?1:-1;return t.trimmed!==e.trimmed?t.trimmed>e.trimmed?1:-1:t.index-e.index})).map(((t,e)=>(t.child.rank=e,t.child)))};subscribe=(t,e)=>{const n={eventType:t,fn:e};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}};emit=t=>{this.subscribers.forEach((e=>{e.eventType===t.type&&e.fn(t)}))};checkLatest=t=>this.latestLoadPromise!==t?this.latestLoadPromise:void 0;parseLocation=t=>{const e=({pathname:e,search:n,hash:o,state:r})=>{const s=this.options.parseSearch(n);return{pathname:e,searchStr:n,search:M(t?.search,s),hash:o.split("#").reverse()[0]??"",href:`${e}${n}${o}`,state:M(t?.state,r)}},n=e(this.history.location);let{__tempLocation:o,__tempKey:r}=n.state;if(o&&(!r||r===this.tempLocationKey)){const t=e(o);return t.state.key=n.state.key,delete t.state.__tempLocation,{...t,maskedLocation:n}}return n};resolvePathWithBase=(t,e)=>F(this.basepath,t,B(e));get looseRoutesById(){return this.routesById}matchRoutes=(t,e,n)=>{let o={},r=this.flatRoutes.find((e=>{const n=z(this.basepath,H(t),{to:e.fullPath,caseSensitive:e.options.caseSensitive??this.options.caseSensitive,fuzzy:!1});return!!n&&(o=n,!0)}))||this.routesById.__root__,s=[r];for(;r?.parentRoute;)r=r.parentRoute,r&&s.unshift(r);const a=s.map((t=>{let e;if(t.options.parseParams)try{const e=t.options.parseParams(o);Object.assign(o,e)}catch(t){if(e=new Tt(t.message,{cause:t}),n?.throwOnError)throw e;return e}})),i=[];return s.forEach(((t,r)=>{const s=i[r-1],[c,l]=(()=>{const o=s?.search??e;try{const e="object"==typeof t.options.validateSearch?t.options.validateSearch.parse:t.options.validateSearch;let n=e?.(o)??{};return[{...o,...n},void 0]}catch(t){const e=new Ct(t.message,{cause:t});if(n?.throwOnError)throw e;return[o,e]}})(),u=U(t.fullPath,o),h=U(t.id,o,!0)+(t.options.key?.({search:c,location:this.state.location})??""),d=ut(this.state,h),f=this.state.matches.find((t=>t.id===h))?"stay":"enter",p=!(!t.options.loader&&!Pt.some((e=>t.options[e]?.preload))),m=d?{...d,cause:f}:{id:h,routeId:t.id,params:o,pathname:A([this.basepath,u]),updatedAt:Date.now(),search:{},searchError:void 0,status:p?"pending":"success",showPending:!1,isFetching:!1,invalid:!1,error:void 0,paramsError:a[r],loadPromise:Promise.resolve(),context:void 0,abortController:new AbortController,shouldReloadDeps:void 0,fetchedAt:0,cause:f};m.search=M(m.search,c),m.searchError=l,i.push(m)})),i};cancelMatch=t=>{ut(this.state,t)?.abortController?.abort()};cancelMatches=()=>{this.state.pendingMatches?.forEach((t=>{this.cancelMatch(t.id)}))};buildLocation=t=>{const e=(t={},e)=>{const n=this.latestLocation,o=t.from??n.pathname;let r=this.resolvePathWithBase(o,`${t.to??""}`);const s=this.matchRoutes(o,n.search),a=e?.filter((t=>s?.find((e=>e.routeId===t.routeId)))),i={...C(s)?.params};let c=!0===(t.params??!0)?i:T(t.params,i);c&&e?.map((t=>this.looseRoutesById[t.routeId].options.stringifyParams)).filter(Boolean).forEach((t=>{c={...c,...t(c)}})),r=U(r,c??{});const l=a?.map((t=>this.looseRoutesById[t.routeId].options.preSearchFilters??[])).flat().filter(Boolean)??[],u=a?.map((t=>this.looseRoutesById[t.routeId].options.postSearchFilters??[])).flat().filter(Boolean)??[],h=l?.length?l?.reduce(((t,e)=>e(t)),n.search):n.search,d=!0===t.search?h:t.search?T(t.search,h)??{}:l?.length?h:{},f=u?.length?u.reduce(((t,e)=>e(t)),d):d,p=M(n.search,f),m=this.options.stringifySearch(p),y=!0===t.hash?n.hash:t.hash?T(t.hash,n.hash):n.hash,g=y?`#${y}`:"";let v=!0===t.state?n.state:t.state?T(t.state,n.state):n.state;return v=M(n.state,v),{pathname:r,search:p,searchStr:m,state:v,hash:y,href:this.history.createHref(`${r}${m}${g}`),unmaskOnReload:t.unmaskOnReload}},n=(t={},n)=>{let o=e(t),r=n?e(n):void 0;if(!r){let t={},s=this.options.routeMasks?.find((e=>{const n=z(this.basepath,o.pathname,{to:e.from,caseSensitive:!1,fuzzy:!1});return!!n&&(t=n,!0)}));s&&(s={...s,from:U(s.from,t)},r=e(n=s))}const s=this.matchRoutes(o.pathname,o.search),a=r?this.matchRoutes(r.pathname,r.search):void 0,i=r?e(n,a):void 0,c=e(t,s);return i&&(c.maskedLocation=i),c};return t.mask?n(t,{...k(t,["from"]),...t.mask}):n(t)};commitLocation=async({startTransition:t,...e})=>{this.navigateTimeout&&clearTimeout(this.navigateTimeout);if(!(this.latestLocation.href===e.href)||!e.replace){let{maskedLocation:n,...o}=e;n&&(o={...n,state:{...n.state,__tempKey:void 0,__tempLocation:{...o,search:o.searchStr,state:{...o.state,__tempKey:void 0,__tempLocation:void 0,key:void 0}}}},(o.unmaskOnReload??this.options.unmaskOnReload)&&(o.state.__tempKey=this.tempLocationKey));const r=()=>{this.history[e.replace?"replace":"push"](o.href,o.state)};t??1?this.startReactTransition(r):r()}return this.resetNextScroll=e.resetScroll??!0,this.latestLoadPromise};buildAndCommitLocation=({replace:t,resetScroll:e,startTransition:n,...o}={})=>{const r=this.buildLocation(o);return this.commitLocation({...r,startTransition:n,replace:t,resetScroll:e})};navigate=({from:t,to:e="",...n})=>{const o=String(e),r=void 0===t?t:String(t);let s;try{new URL(`${o}`),s=!0}catch(t){}return g(!s),this.buildAndCommitLocation({...n,from:r,to:o})};loadMatches=async({checkLatest:t,matches:e,preload:n,invalidate:o})=>{let r,s;const a=t=>{this.__store.setState((e=>({...e,pendingMatches:e.pendingMatches?.map((e=>e.id===t.id?t:e))})))};try{for(let[t,o]of e.entries()){const r=e[t-1],a=this.looseRoutesById[o.routeId],i=(n,r)=>{if(n.routerCode=r,s=s??t,St(n))throw n;try{a.options.onError?.(n)}catch(t){if(n=t,St(t))throw t}e[t]=o={...o,error:n,status:"error",updatedAt:Date.now()}};try{o.paramsError&&i(o.paramsError,"PARSE_PARAMS"),o.searchError&&i(o.searchError,"VALIDATE_SEARCH");const s=r?.context??this.options.context??{},c=await(a.options.beforeLoad?.({search:o.search,abortController:o.abortController,params:o.params,preload:!!n,context:s,location:this.state.location,navigate:t=>this.navigate({...t,from:o.pathname}),buildLocation:this.buildLocation,cause:o.cause}))??{},l={...s,...c};e[t]=o={...o,context:M(o.context,l)}}catch(t){i(t,"BEFORE_LOAD");break}}}catch(t){if(St(t))return n||this.navigate(t),e;throw t}const i=e.slice(0,s),c=[];return i.forEach(((s,i)=>{c.push((async()=>{const l=c[i-1],u=this.looseRoutesById[s.routeId],h=t=>!!St(t)&&(n||this.navigate(t),!0);let d;e[i]=s={...s,fetchedAt:Date.now(),invalid:!1,showPending:!1};const f=u.options.pendingMs??this.options.defaultPendingMs;let p;if(!n&&f&&(u.options.pendingComponent??this.options.defaultPendingComponent)&&(p=new Promise((t=>setTimeout(t,f)))),s.isFetching)d=ut(this.state,s.id)?.loadPromise;else{const t={params:s.params,search:s.search,preload:!!n,parentMatchPromise:l,abortController:s.abortController,context:s.context,location:this.state.location,navigate:t=>this.navigate({...t,from:s.pathname}),cause:s.cause};let r=!0,a="function"==typeof u.options.shouldReload?u.options.shouldReload?.(t):!!(u.options.shouldReload??1);if("enter"===s.cause||o?s.shouldReloadDeps=a:"stay"===s.cause&&("object"==typeof a?(r=!I(a,s.shouldReloadDeps),s.shouldReloadDeps=a):r=!!a),r){e[i]=s={...s,isFetching:!0};const n=Promise.all(Pt.map((async t=>{const e=u.options[t];e?.preload&&await e.preload()}))),o=u.options.loader?.(t);d=Promise.all([n,o]).then((t=>t[1]))}else d=Promise.resolve(s.loaderData)}e[i]=s={...s,loadPromise:d},n||a(s);let m=!1;const y=u.options.pendingMinMs??this.options.defaultPendingMinMs;await new Promise((async o=>{p&&p.then((()=>{(r=t())||(m=!0,e[i]=s={...s,showPending:!0},a(s),o())}));try{const n=await d;if(r=t())return await r;if(m&&y&&await new Promise((t=>setTimeout(t,y))),r=t())return await r;e[i]=s={...s,error:void 0,status:"success",isFetching:!1,updatedAt:Date.now(),loaderData:n,loadPromise:void 0}}catch(n){if(r=t())return await r;if(h(n))return;try{u.options.onError?.(n)}catch(t){if(n=t,h(t))return}e[i]=s={...s,error:n,status:"error",isFetching:!1,updatedAt:Date.now()}}finally{m&&y&&s.showPending&&this.__store.setState((t=>({...t,matches:t.matches?.map((t=>t.id===s.id?s:t))})))}n||a(s),o()}))})())})),await Promise.all(c),e};invalidate=()=>this.load({invalidate:!0});load=async t=>{const e=new Promise((async(n,o)=>{const r=this.latestLocation,s=this.state.resolvedLocation,a=s.href!==r.href;let i;this.cancelMatches(),this.emit({type:"onBeforeLoad",fromLocation:s,toLocation:r,pathChanged:a});let c=this.matchRoutes(r.pathname,r.search,{debug:!0});const l=this.state.matches;this.__store.setState((t=>({...t,isLoading:!0,location:r,pendingMatches:c})));try{try{await this.loadMatches({matches:c,checkLatest:()=>this.checkLatest(e),invalidate:t?.invalidate})}catch(t){}if(i=this.checkLatest(e))return i;const o=l.filter((t=>!this.pendingMatches.includes(t))),u=this.pendingMatches.filter((t=>!l.includes(t))),h=l.filter((t=>this.pendingMatches.includes(t)));this.__store.setState((t=>({...t,isLoading:!1,matches:c,pendingMatches:void 0}))),[[o,"onLeave"],[u,"onEnter"],[h,"onTransition"]].forEach((([t,e])=>{t.forEach((t=>{this.looseRoutesById[t.routeId].options[e]?.(t)}))})),this.emit({type:"onLoad",fromLocation:s,toLocation:r,pathChanged:a}),n()}catch(t){if(i=this.checkLatest(e))return i;o(t)}}));return this.latestLoadPromise=e,this.latestLoadPromise};preloadRoute=async(t=this.state.location)=>{let e=this.buildLocation(t),n=this.matchRoutes(e.pathname,e.search,{throwOnError:!0});return await this.loadMatches({matches:n,preload:!0,checkLatest:()=>{}}),[C(n),n]};buildLink=t=>{const{to:e,preload:n,preloadDelay:o,activeOptions:r,disabled:s,target:a,replace:i,resetScroll:c,startTransition:l}=t;try{return new URL(`${e}`),{type:"external",href:e}}catch(t){}const u=t,h=this.buildLocation(u),d=n??this.options.defaultPreload,f=o??this.options.defaultPreloadDelay??0,p=this.latestLocation.pathname.split("/"),m=h.pathname.split("/").every(((t,e)=>t===p[e])),y=r?.exact?this.latestLocation.pathname===h.pathname:m,g=!r?.includeHash||this.latestLocation.hash===h.hash,v=!(r?.includeSearch??1)||I(this.latestLocation.search,h.search,!0);return{type:"internal",next:h,handleFocus:t=>{d&&this.preloadRoute(u).catch((t=>{console.warn(t),console.warn(xt)}))},handleClick:t=>{s||function(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}(t)||t.defaultPrevented||a&&"_self"!==a||0!==t.button||(t.preventDefault(),this.commitLocation({...h,replace:i,resetScroll:c,startTransition:l}))},handleEnter:t=>{const e=t.target||{};if(d){if(e.preloadTimeout)return;e.preloadTimeout=setTimeout((()=>{e.preloadTimeout=null,this.preloadRoute(u).catch((t=>{console.warn(t),console.warn(xt)}))}),f)}},handleLeave:t=>{const e=t.target||{};e.preloadTimeout&&(clearTimeout(e.preloadTimeout),e.preloadTimeout=null)},handleTouchStart:t=>{this.preloadRoute(u).catch((t=>{console.warn(t),console.warn(xt)}))},isActive:y&&g&&v,disabled:s}};matchRoute=(t,e)=>{t={...t,to:t.to?this.resolvePathWithBase(t.from||"",t.to):void 0};const n=this.buildLocation(t);if(e?.pending&&"pending"!==this.state.status)return!1;const o=e?.pending?this.latestLocation:this.state.resolvedLocation;if(!o)return!1;const r=z(this.basepath,o.pathname,{...e,to:n.pathname});return!!r&&(r&&(e?.includeSearch??1)?!!I(o.search,n.search,!0)&&r:r)};injectHtml=async t=>{this.injectedHtml.push(t)};dehydrateData=(t,e)=>{if("undefined"==typeof document){const n="string"==typeof t?t:JSON.stringify(t);return this.injectHtml((async()=>{const t=`__TSR_DEHYDRATED__${n}`,o="function"==typeof e?await e():e;return`<script id='${t}' suppressHydrationWarning>window["__TSR_DEHYDRATED__${$(n)}"] = ${JSON.stringify(o)}\n ;(() => {\n var el = document.getElementById('${t}')\n el.parentElement.removeChild(el)\n })()\n <\/script>`})),()=>this.hydrateData(t)}return()=>{}};hydrateData=t=>{if("undefined"!=typeof document){const e="string"==typeof t?t:JSON.stringify(t);return window[`__TSR_DEHYDRATED__${e}`]}};dehydrate=()=>({state:{dehydratedMatches:this.state.matches.map((t=>k(t,["fetchedAt","invalid","id","status","updatedAt","loaderData"])))}});hydrate=async t=>{let e=t;"undefined"!=typeof document&&(e=window.__TSR_DEHYDRATED__),g(e);const n=e;this.dehydratedData=n.payload,this.options.hydrate?.(n.payload);const o=n.router.state;let r=this.matchRoutes(this.state.location.pathname,this.state.location.search).map((t=>{const e=o.dehydratedMatches.find((e=>e.id===t.id));return g(e,t.id),e?{...t,...e}:t}));this.__store.setState((t=>({...t,matches:r})))}},t.RouterProvider=function({router:t,...e}){t.update({...t.options,...e,context:{...t.options.context,...e?.context}});const n=r.createElement(ct.Provider,{value:t},r.createElement(Z,null),r.createElement(lt,null));return t.options.Wrap?r.createElement(t.options.Wrap,null,n):n},t.ScrollRestoration=function(t){return At(t),null},t.SearchParamError=Ct,t.cleanPath=B,t.componentTypes=Pt,t.createBrowserHistory=d,t.createHashHistory=function(){return d({getHref:()=>window.location.hash.substring(1),createHref:t=>`#${t}`})},t.createMemoryHistory=f,t.createRouteMask=function(t){return t},t.decode=bt,t.deepEqual=I,t.defaultParseSearch=Rt,t.defaultStringifySearch=_t,t.defer=function(t){const e=t;if(!e.__deferredState){e.__deferredState={uid:Math.random().toString(36).slice(2),status:"pending"};const t=e.__deferredState;e.then((e=>{t.status="success",t.data=e})).catch((e=>{t.status="error",t.error=e}))}return e},t.encode=vt,t.escapeJSON=$,t.functionalUpdate=T,t.getInitialRouterState=kt,t.getRouteMatch=ut,t.interpolatePath=U,t.invariant=g,t.isDehydratedDeferred=ft,t.isPlainObject=O,t.isRedirect=St,t.isServer=x,t.joinPaths=A,t.last=C,t.lazyFn=function(t,e){return async(...n)=>(await t())[e||"default"](...n)},t.lazyRouteComponent=function(t,e){let n;const o=()=>(n||(n=t()),n),s=r.lazy((async()=>({default:(await o())[e??"default"]})));return s.preload=o,s},t.matchByPath=Y,t.matchContext=Q,t.matchPathname=z,t.parsePathname=W,t.parseSearchWith=Et,t.pick=k,t.redirect=function(t){return t.isRedirect=!0,t},t.replaceEqualDeep=M,t.resolvePath=F,t.rootRouteId=q,t.rootRouteWithContext=function(){return t=>new G(t)},t.routerContext=ct,t.shallow=function(t,e){if(Object.is(t,e))return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(let o=0;o<n.length;o++)if(!Object.prototype.hasOwnProperty.call(e,n[o])||!Object.is(t[n[o]],e[n[o]]))return!1;return!0},t.stringifySearchWith=Lt,t.trimPath=K,t.trimPathLeft=N,t.trimPathRight=H,t.typedNavigate=function(t){return t},t.useAwaited=pt,t.useBlocker=Nt,t.useElementScrollRestoration=function(t){const e=dt(),n=t?.getKey||$t;let o="";if(t.id)o=`[data-scroll-restoration-id="${t.id}"]`;else{const e=t.getElement?.();if(!e)return;o=Bt(e)}const r=[n(e.latestLocation),o].join(Dt);return jt.state.cached[r]},t.useLayoutEffect=j,t.useLinkProps=yt,t.useLoaderData=it,t.useMatch=at,t.useMatchRoute=rt,t.useMatches=function(t){const e=r.useContext(Q);return ht({select:n=>{let o=st(n);return o=o.slice(o.findIndex((t=>t.id===e))),t?.select?t.select(o):o}})},t.useNavigate=function(t){const{navigate:e}=dt(),n=at({strict:!1,select:t=>t.pathname});return r.useCallback((o=>e({from:o?.to?n:void 0,...t,...o})),[])},t.useParams=J,t.useRouteContext=function(t){return at({...t,select:e=>t?.select?t.select(e.context):e.context})},t.useRouter=dt,t.useRouterState=ht,t.useScrollRestoration=At,t.useSearch=X,t.useStableCallback=function(t){const e=r.useRef(t);return e.current=t,r.useRef(((...t)=>e.current(...t))).current},t.warning=function(t,e){}}));
21
+ */const s="pushstate",a="popstate",i="beforeunload",c=t=>(t.preventDefault(),t.returnValue=""),l=()=>{removeEventListener(i,c,{capture:!0})};function u(t){let e=t.getLocation(),n=new Set,o=[],r=[];const s=()=>{e=t.getLocation(),n.forEach((t=>t()))},a=()=>{if(o.length)o[0]?.(a,(()=>{o=[],l()}));else for(;r.length;)r.shift()?.()},u=t=>{r.push(t),a()};return{get location(){return e},subscribe:t=>(n.add(t),()=>{n.delete(t)}),push:(e,n)=>{n=h(n),u((()=>{t.pushState(e,n,s)}))},replace:(e,n)=>{n=h(n),u((()=>{t.replaceState(e,n,s)}))},go:e=>{u((()=>{t.go(e)}))},back:()=>{u((()=>{t.back()}))},forward:()=>{u((()=>{t.forward()}))},createHref:e=>t.createHref(e),block:t=>(o.push(t),1===o.length&&addEventListener(i,c,{capture:!0}),()=>{o=o.filter((e=>e!==t)),o.length||l()}),flush:()=>t.flush?.(),destroy:()=>t.destroy?.(),notify:s}}function h(t){return t||(t={}),{...t,key:m()}}function d(t){const e=t?.getHref??(()=>`${window.location.pathname}${window.location.search}${window.location.hash}`),n=t?.createHref??(t=>t);let o=p(e(),window.history.state);let r,i,c=!0;const l=()=>{c=!1,(()=>{r&&(window.history[r.isPush?"pushState":"replaceState"](r.state,"",r.href),r=void 0,i=void 0)})(),c=!0},h=(t,e,s,a)=>{const c=n(e);o=p(c,s),r={href:c,state:s,isPush:r?.isPush||"push"===t},a(),i||(i=Promise.resolve().then((()=>l())))},d=()=>{o=p(e(),window.history.state),y.notify()};var f=window.history.pushState,m=window.history.replaceState;const y=u({getLocation:()=>o,pushState:(t,e,n)=>h("push",t,e,n),replaceState:(t,e,n)=>h("replace",t,e,n),back:()=>window.history.back(),forward:()=>window.history.forward(),go:t=>window.history.go(t),createHref:t=>n(t),flush:l,destroy:()=>{window.history.pushState=f,window.history.replaceState=m,window.removeEventListener(s,d),window.removeEventListener(a,d)}});return window.addEventListener(s,d),window.addEventListener(a,d),window.history.pushState=function(){let t=f.apply(window.history,arguments);return c&&y.notify(),t},window.history.replaceState=function(){let t=m.apply(window.history,arguments);return c&&y.notify(),t},y}function f(t={initialEntries:["/"]}){const e=t.initialEntries;let n=t.initialIndex??e.length-1,o={key:m()};return u({getLocation:()=>p(e[n],o),pushState:(t,r)=>{o=r,e.push(t),n++},replaceState:(t,r)=>{o=r,e[n]=t},back:()=>{n--},forward:()=>{n=Math.min(n+1,e.length-1)},go:t=>window.history.go(t),createHref:t=>t})}function p(t,e){let n=t.indexOf("#"),o=t.indexOf("?");return{href:t,pathname:t.substring(0,n>0?o>0?Math.min(n,o):n:o>0?o:t.length),hash:n>-1?t.substring(n):"",search:o>-1?t.slice(o,-1===n?void 0:n):"",state:e||{}}}function m(){return(Math.random()+1).toString(36).substring(7)}var y="Invariant failed";function g(t,e){if(!t)throw new Error(y)}var v,w={exports:{}},b={};w.exports=function(){if(v)return b;v=1;var t=e,o=n,r="function"==typeof Object.is?Object.is:function(t,e){return t===e&&(0!==t||1/t==1/e)||t!=t&&e!=e},s=o.useSyncExternalStore,a=t.useRef,i=t.useEffect,c=t.useMemo,l=t.useDebugValue;return b.useSyncExternalStoreWithSelector=function(t,e,n,o,u){var h=a(null);if(null===h.current){var d={hasValue:!1,value:null};h.current=d}else d=h.current;h=c((function(){function t(t){if(!i){if(i=!0,s=t,t=o(t),void 0!==u&&d.hasValue){var e=d.value;if(u(e,t))return a=e}return a=t}if(e=a,r(s,t))return e;var n=o(t);return void 0!==u&&u(e,n)?e:(s=t,a=n)}var s,a,i=!1,c=void 0===n?null:n;return[function(){return t(e())},null===c?void 0:function(){return t(c())}]}),[e,n,o,u]);var f=s(t,h[0],h[1]);return i((function(){d.hasValue=!0,d.value=f}),[f]),l(f),f},b}();var S=w.exports,R=class{constructor(t,e){this.listeners=new Set,this._batching=!1,this._flushing=0,this._nextPriority=null,this.subscribe=t=>{this.listeners.add(t);const e=this.options?.onSubscribe?.(t,this);return()=>{this.listeners.delete(t),e?.()}},this.setState=(t,e)=>{const n=this.state;this.state=this.options?.updateFn?this.options.updateFn(n)(t):t(n);const o=e?.priority??this.options?.defaultPriority??"high";null===this._nextPriority||"high"===this._nextPriority?this._nextPriority=o:this._nextPriority=this.options?.defaultPriority??"high",this.options?.onUpdate?.({priority:this._nextPriority}),this._flush()},this._flush=()=>{if(this._batching)return;const t=++this._flushing;this.listeners.forEach((e=>{this._flushing===t&&e({priority:this._nextPriority??"high"})}))},this.batch=t=>{if(this._batching)return t();this._batching=!0,t(),this._batching=!1,this._flush()},this.state=t,this.options=e}};function _(t,e){if(Object.is(t,e))return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(let o=0;o<n.length;o++)if(!Object.prototype.hasOwnProperty.call(e,n[o])||!Object.is(t[n[o]],e[n[o]]))return!1;return!0}function E(t){const e=t.errorComponent??P;return r.createElement(L,{getResetKey:t.getResetKey,onCatch:t.onCatch,children:({error:n})=>n?r.createElement(e,{error:n}):t.children})}class L extends r.Component{state={error:null};static getDerivedStateFromProps(t){return{resetKey:t.getResetKey()}}static getDerivedStateFromError(t){return{error:t}}componentDidUpdate(t,e){e.error&&e.resetKey!==this.state.resetKey&&this.setState({error:null})}componentDidCatch(t){console.error(t),this.props.onCatch?.(t)}render(){return this.props.children(this.state)}}function P({error:t}){const[e,n]=r.useState(!1);return r.createElement("div",{style:{padding:".5rem",maxWidth:"100%"}},r.createElement("div",{style:{display:"flex",alignItems:"center",gap:".5rem"}},r.createElement("strong",{style:{fontSize:"1rem"}},"Something went wrong!"),r.createElement("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>n((t=>!t))},e?"Hide Error":"Show Error")),r.createElement("div",{style:{height:".25rem"}}),e?r.createElement("div",null,r.createElement("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"}},t.message?r.createElement("code",null,t.message):null)):null)}const x="undefined"==typeof document;function C(t){return t[t.length-1]}function T(t,e){return"function"==typeof t?t(e):t}function k(t,e){return e.reduce(((e,n)=>(e[n]=t[n],e)),{})}function M(t,e){if(t===e)return t;const n=e,o=Array.isArray(t)&&Array.isArray(n);if(o||O(t)&&O(n)){const e=o?t.length:Object.keys(t).length,r=o?n:Object.keys(n),s=r.length,a=o?[]:{};let i=0;for(let e=0;e<s;e++){const s=o?e:r[e];a[s]=M(t[s],n[s]),a[s]===t[s]&&i++}return e===s&&i===e?t:a}return n}function O(t){if(!D(t))return!1;const e=t.constructor;if(void 0===e)return!0;const n=e.prototype;return!!D(n)&&!!n.hasOwnProperty("isPrototypeOf")}function D(t){return"[object Object]"===Object.prototype.toString.call(t)}function I(t,e,n=!1){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(O(t)&&O(e)){const o=Object.keys(t),r=Object.keys(e);return!(!n&&o.length!==r.length)&&!r.some((o=>!(o in t)||!I(t[o],e[o],n)))}return!(!Array.isArray(t)||!Array.isArray(e))&&!t.some(((t,o)=>!I(t,e[o],n)))}const j="undefined"!=typeof window?r.useLayoutEffect:r.useEffect;function $(t){return t.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"')}function A(t){return B(t.filter(Boolean).join("/"))}function B(t){return t.replace(/\/{2,}/g,"/")}function N(t){return"/"===t?t:t.replace(/^\/{1,}/,"")}function H(t){return"/"===t?t:t.replace(/\/{1,}$/,"")}function K(t){return H(N(t))}function F(t,e,n){e=e.replace(new RegExp(`^${t}`),"/"),n=n.replace(new RegExp(`^${t}`),"/");let o=W(e);const r=W(n);r.forEach(((t,e)=>{if("/"===t.value)e?e===r.length-1&&o.push(t):o=[t];else if(".."===t.value)o.length>1&&"/"===C(o)?.value&&o.pop(),o.pop();else{if("."===t.value)return;o.push(t)}}));return B(A([t,...o.map((t=>t.value))]))}function W(t){if(!t)return[];const e=[];if("/"===(t=B(t)).slice(0,1)&&(t=t.substring(1),e.push({type:"pathname",value:"/"})),!t)return e;const n=t.split("/").filter(Boolean);return e.push(...n.map((t=>"$"===t||"*"===t?{type:"wildcard",value:t}:"$"===t.charAt(0)?{type:"param",value:t}:{type:"pathname",value:t}))),"/"===t.slice(-1)&&(t=t.substring(1),e.push({type:"pathname",value:"/"})),e}function U(t,e,n=!1){return A(W(t).map((t=>{if("wildcard"===t.type){const o=e[t.value];return n?`${t.value}${o??""}`:o}return"param"===t.type?e[t.value.substring(1)]??"undefined":t.value})))}function z(t,e,n){const o=Y(t,e,n);if(!n.to||o)return o??{}}function Y(t,e,n){e="/"!=t?e.substring(t.length):e;const o=`${n.to??"$"}`,r=W(e),s=W(o);e.startsWith("/")||r.unshift({type:"pathname",value:"/"}),o.startsWith("/")||s.unshift({type:"pathname",value:"/"});const a={};return(()=>{for(let t=0;t<Math.max(r.length,s.length);t++){const e=r[t],o=s[t],i=t>=r.length-1,c=t>=s.length-1;if(o){if("wildcard"===o.type)return!!e?.value&&(a["*"]=A(r.slice(t).map((t=>t.value))),!0);if("pathname"===o.type){if("/"===o.value&&!e?.value)return!0;if(e)if(n.caseSensitive){if(o.value!==e.value)return!1}else if(o.value.toLowerCase()!==e.value.toLowerCase())return!1}if(!e)return!1;if("param"===o.type){if("/"===e?.value)return!1;"$"!==e.value.charAt(0)&&(a[o.value.substring(1)]=e.value)}}if(!i&&c)return!!n.fuzzy}return!0})()?a:void 0}function J(t){return ht({select:e=>{const n=C(e.matches)?.params;return t?.select?t.select(n):n}})}function X(t){return at({...t,select:e=>t?.select?t.select(e.search):e.search})}const q="__root__";class V{constructor(t){this.options=t||{},this.isRoot=!t?.getParentRoute,V.__onInit(this),this.$$typeof=Symbol.for("react.memo")}init=t=>{this.originalIndex=t.originalIndex;const e=this.options,n=!e?.path&&!e?.id;this.parentRoute=this.options?.getParentRoute?.(),n?this.path=q:g(this.parentRoute);let o=n?q:e.path;o&&"/"!==o&&(o=K(o));const r=e?.id||o;let s=n?q:A([this.parentRoute.id===q?"":this.parentRoute.id,r]);o===q&&(o="/"),s!==q&&(s=A(["/",s]));const a=s===q?"/":A([this.parentRoute.fullPath,o]);this.path=o,this.id=s,this.fullPath=a,this.to=a};addChildren=t=>(this.children=t,this);update=t=>(Object.assign(this.options,t),this);static __onInit=t=>{};useMatch=t=>at({...t,from:this.id});useRouteContext=t=>at({...t,from:this.id,select:e=>t?.select?t.select(e.context):e.context});useSearch=t=>X({...t,from:this.id});useParams=t=>J({...t,from:this.id});useLoaderData=t=>it({...t,from:this.id})}class G extends V{constructor(t){super(t)}}const Q=r.createContext(void 0);function Z(){const t=dt(),e=ht({select:t=>st(t)[0]?.id}),n=t.routesById[q],o=r.useCallback((t=>r.createElement(P,{...t,useMatch:n.useMatch,useRouteContext:n.useRouteContext,useSearch:n.useSearch,useParams:n.useParams})),[n]);return r.createElement(Q.Provider,{value:e},r.createElement(E,{getResetKey:()=>t.state.resolvedLocation.state?.key,errorComponent:o,onCatch:()=>{}},e?r.createElement(et,{matchId:e}):null))}function tt(t){return r.createElement(r.Fragment,null,t.children)}function et({matchId:t}){const e=dt(),n=ht({select:e=>st(e).find((e=>e.id===t))?.routeId});g(n);const o=e.routesById[n],s=o.options.pendingComponent??e.options.defaultPendingComponent,a=s?r.createElement(s,{useMatch:o.useMatch,useRouteContext:o.useRouteContext,useSearch:o.useSearch,useParams:o.useParams}):void 0,i=o.options.errorComponent??e.options.defaultErrorComponent??P,c=o.options.wrapInSuspense??a?r.Suspense:tt,l=i?r.useCallback((t=>r.createElement(i,{...t,useMatch:o.useMatch,useRouteContext:o.useRouteContext,useSearch:o.useSearch,useParams:o.useParams})),[o]):void 0,u=l?E:tt;return r.createElement(Q.Provider,{value:t},r.createElement(c,{fallback:a},r.createElement(u,{getResetKey:()=>e.state.resolvedLocation.state?.key,errorComponent:l,onCatch:()=>{}},r.createElement(nt,{matchId:t,pendingElement:a}))))}function nt({matchId:t,pendingElement:e}){const n=dt(),o=ht({select:e=>st(e).find((e=>e.id===t))?.routeId}),s=n.routesById[o],a=ht({select:e=>k(st(e).find((e=>e.id===t)),["status","error","showPending","loadPromise"])});if("error"===a.status)throw a.error;if("pending"===a.status){if(a.showPending)return e||null;throw a.loadPromise}if("success"===a.status){let t=s.options.component??n.options.defaultComponent;return t?r.createElement(t,{useMatch:s.useMatch,useRouteContext:s.useRouteContext,useSearch:s.useSearch,useParams:s.useParams,useLoaderData:s.useLoaderData}):r.createElement(ot,null)}g(!1)}const ot=r.memo((function(){const t=r.useContext(Q),e=ht({select:e=>{const n=st(e),o=n.findIndex((e=>e.id===t));return n[o+1]?.id}});return e?r.createElement(et,{matchId:e}):null}));function rt(){const{matchRoute:t}=dt();return r.useCallback((e=>{const{pending:n,caseSensitive:o,...r}=e;return t(r,{pending:n,caseSensitive:o})}),[])}function st(t){return t.pendingMatches?.some((t=>t.showPending))?t.pendingMatches:t.matches}function at(t){const e=dt(),n=r.useContext(Q),o=st(e.state).find((t=>t.id===n))?.routeId,s=(()=>{const o=st(e.state);return(t?.from?o.find((e=>e.routeId===t?.from)):o.find((t=>t.id===n))).routeId})();(t?.strict??1)&&g(o==s);return ht({select:e=>{const o=st(e).find((t=>t.id===n));return g(o,t?.from&&t.from),t?.select?t.select(o):o}})}function it(t){return at({...t,select:e=>"function"==typeof t.select?t.select(e?.loaderData):e?.loaderData})}const ct=r.createContext(null);function lt(){const t=dt(),e=ht({select:t=>k(t,["isLoading","location","resolvedLocation","isTransitioning"])}),[n,o]=r.useTransition();t.startReactTransition=o,r.useEffect((()=>{n&&t.__store.setState((t=>({...t,isTransitioning:n})))}),[n]);const s=()=>{var n;n=()=>{try{t.load()}catch(t){console.error(t)}},e.isTransitioning?n():o((()=>n()))};return j((()=>{const n=t.history.subscribe((()=>{t.latestLocation=t.parseLocation(t.latestLocation),e.location!==t.latestLocation&&s()})),o=t.buildLocation({search:!0,params:!0,hash:!0,state:!0});return e.location.href!==o.href&&t.commitLocation({...o,replace:!0}),()=>{n()}}),[t.history]),j((()=>{!e.isTransitioning||n||e.isLoading||e.resolvedLocation===e.location||(t.emit({type:"onResolved",fromLocation:e.resolvedLocation,toLocation:e.location,pathChanged:e.location.href!==e.resolvedLocation?.href}),t.pendingMatches=[],t.__store.setState((t=>({...t,isTransitioning:!1,resolvedLocation:t.location}))))}),[e.isTransitioning,n,e.isLoading,e.resolvedLocation,e.location]),j((()=>{window.__TSR_DEHYDRATED__||s()}),[]),null}function ut(t,e){return[...t.pendingMatches??[],...t.matches].find((t=>t.id===e))}function ht(t){return function(t,e=(t=>t)){return S.useSyncExternalStoreWithSelector(t.subscribe,(()=>t.state),(()=>t.state),e,_)}(dt().__store,t?.select)}function dt(){const t="undefined"!=typeof document&&window.__TSR_ROUTER_CONTEXT__||ct;return r.useContext(t)}function ft(t){return"object"==typeof t&&null!==t&&!(t instanceof Promise)&&!t.then&&"__deferredState"in t}function pt({promise:t}){const e=dt();let n=t.__deferredState;const o=`__TSR__DEFERRED__${n.uid}`;if(ft(t)&&(n=e.hydrateData(o),(t=Promise.resolve(n.data)).__deferredState=n),"pending"===n.status)throw new Promise((t=>setTimeout(t,1))).then((()=>t));if("error"===n.status)throw n.error;return e.dehydrateData(o,n),[n.data]}"undefined"!=typeof document&&(window.__TSR_ROUTER_CONTEXT__=ct);function mt(){return mt=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},mt.apply(this,arguments)}function yt(t){const{buildLink:e}=dt(),n=at({strict:!1,select:t=>t.pathname}),{type:o,children:r,target:s,activeProps:a=(()=>({className:"active"})),inactiveProps:i=(()=>({})),activeOptions:c,disabled:l,hash:u,search:h,params:d,to:f,state:p,mask:m,preload:y,preloadDelay:g,replace:v,startTransition:w,resetScroll:b,style:S,className:R,onClick:_,onFocus:E,onMouseEnter:L,onMouseLeave:P,onTouchStart:x,...C}=t,k=e({from:t.to?n:void 0,...t});if("external"===k.type){const{href:t}=k;return{href:t}}const{handleClick:M,handleFocus:O,handleEnter:D,handleLeave:I,handleTouchStart:j,isActive:$,next:A}=k,B=t=>e=>{e.persist&&e.persist(),t.filter(Boolean).forEach((t=>{e.defaultPrevented||t(e)}))},N=$?T(a,{})??{}:{},H=$?{}:T(i,{})??{};return{...N,...H,...C,href:l?void 0:A.maskedLocation?A.maskedLocation.href:A.href,onClick:B([_,M]),onFocus:B([E,O]),onMouseEnter:B([L,D]),onMouseLeave:B([P,I]),onTouchStart:B([x,j]),target:s,style:{...S,...N.style,...H.style},className:[R,N.className,H.className].filter(Boolean).join(" ")||void 0,...l?{role:"link","aria-disabled":!0}:void 0,"data-status":$?"active":void 0}}const gt=r.forwardRef(((t,e)=>{const n=yt(t);return r.createElement("a",mt({ref:e},n,{children:"function"==typeof t.children?t.children({isActive:"active"===n["data-status"]}):t.children}))}));function vt(t,e){var n,o,r,s="";for(n in t)if(void 0!==(r=t[n]))if(Array.isArray(r))for(o=0;o<r.length;o++)s&&(s+="&"),s+=encodeURIComponent(n)+"="+encodeURIComponent(r[o]);else s&&(s+="&"),s+=encodeURIComponent(n)+"="+encodeURIComponent(r);return(e||"")+s}function wt(t){if(!t)return"";var e=decodeURIComponent(t);return"false"!==e&&("true"===e||(0*+e==0&&+e+""===e?+e:e))}function bt(t){for(var e,n,o={},r=t.split("&");e=r.shift();)void 0!==o[n=(e=e.split("=")).shift()]?o[n]=[].concat(o[n],wt(e.shift())):o[n]=wt(e.shift());return o}function St(t){return!!t?.isRedirect}const Rt=Et(JSON.parse),_t=Lt(JSON.stringify,JSON.parse);function Et(t){return e=>{"?"===e.substring(0,1)&&(e=e.substring(1));let n=bt(e);for(let e in n){const o=n[e];if("string"==typeof o)try{n[e]=t(o)}catch(t){}}return n}}function Lt(t,e){return n=>{(n={...n})&&Object.keys(n).forEach((o=>{const r=n[o];void 0===r||void 0===r?delete n[o]:n[o]=function(n){if("object"==typeof n&&null!==n)try{return t(n)}catch(t){}else if("string"==typeof n&&"function"==typeof e)try{return e(n),t(n)}catch(t){}return n}(r)}));const o=vt(n).toString();return o?`?${o}`:""}}const Pt=["component","errorComponent","pendingComponent"],xt="Error preloading route! ☝️";class Ct extends Error{}class Tt extends Error{}function kt(t){return{isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:{...t},location:t,matches:[],pendingMatches:[],lastUpdated:Date.now()}}const Mt="undefined"!=typeof window?r.useLayoutEffect:r.useEffect,Ot="window",Dt="___";let It=new WeakSet;let jt="undefined"!=typeof window&&window.sessionStorage?(()=>{const t="tsr-scroll-restoration-v2";return{state:JSON.parse(window.sessionStorage.getItem(t)||"null")||{cached:{},next:{}},set:e=>{jt.state=T(e,jt.state),window.sessionStorage.setItem(t,JSON.stringify(jt.state))}}})():void 0;const $t=t=>t.state.key;function At(t){const e=dt();Mt((()=>{const n=t?.getKey||$t,{history:o}=window;o.scrollRestoration&&(o.scrollRestoration="manual");const r=t=>{if(It.has(t.target))return;It.add(t.target);let e="";if(t.target===document||t.target===window)e=Ot;else{const n=t.target.getAttribute("data-scroll-restoration-id");e=n?`[data-scroll-restoration-id="${n}"]`:Bt(t.target)}jt.state.next[e]||jt.set((t=>({...t,next:{...t.next,[e]:{scrollX:NaN,scrollY:NaN}}})))};"undefined"!=typeof document&&document.addEventListener("scroll",r,!0);const s=e.subscribe("onBeforeLoad",(t=>{if(t.pathChanged){const e=n(t.fromLocation);for(const t in jt.state.next){const n=jt.state.next[t];if(t===Ot)n.scrollX=window.scrollX||0,n.scrollY=window.scrollY||0;else if(t){const e=document.querySelector(t);n.scrollX=e?.scrollLeft||0,n.scrollY=e?.scrollTop||0}jt.set((o=>{const r={...o.next};return delete r[t],{...o,next:r,cached:{...o.cached,[[e,t].join(Dt)]:n}}}))}}})),a=e.subscribe("onResolved",(n=>{if(n.pathChanged){if(!e.resetNextScroll)return;e.resetNextScroll=!0;const o=(t?.getKey||$t)(n.toLocation);let r=!1;for(const t in jt.state.cached){const e=jt.state.cached[t],[n,s]=t.split(Dt);if(n===o)if(s===Ot)r=!0,window.scrollTo(e.scrollX,e.scrollY);else if(s){const t=document.querySelector(s);t&&(t.scrollLeft=e.scrollX,t.scrollTop=e.scrollY)}}r||window.scrollTo(0,0),jt.set((t=>({...t,next:{}}))),It=new WeakSet}}));return()=>{document.removeEventListener("scroll",r),s(),a()}}),[])}function Bt(t){let e,n=[];for(;e=t.parentNode;)n.unshift(`${t.tagName}:nth-child(${[].indexOf.call(e.children,t)+1})`),t=e;return`${n.join(" > ")}`.toLowerCase()}function Nt(t,e=!0){const{history:n}=dt();r.useEffect((()=>{if(!e)return;let o=n.block(((e,n)=>{window.confirm(t)&&(o(),e())}));return o}))}t.Await=function(t){const e=pt(t);return t.children(...e)},t.Block=function({message:t,condition:e,children:n}){return Nt(t,e),n??null},t.CatchBoundary=E,t.CatchBoundaryImpl=L,t.ErrorComponent=P,t.FileRoute=class{constructor(t){this.path=t}createRoute=t=>{const e=new V(t);return e.isRoot=!1,e}},t.Link=gt,t.Match=et,t.MatchRoute=function(t){const e=rt()(t);return"function"==typeof t.children?t.children(e):e?t.children:null},t.Matches=Z,t.Navigate=function(t){const{navigate:e}=dt(),n=at({strict:!1});return j((()=>{e({from:t.to?n.pathname:void 0,...t})}),[]),null},t.Outlet=ot,t.PathParamError=Tt,t.RootRoute=G,t.Route=V,t.Router=class{tempLocationKey=`${Math.round(1e7*Math.random())}`;resetNextScroll=!0;navigateTimeout=null;latestLoadPromise=Promise.resolve();subscribers=new Set;pendingMatches=[];injectedHtml=[];constructor(t){this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...t,stringifySearch:t?.stringifySearch??_t,parseSearch:t?.parseSearch??Rt})}startReactTransition=t=>t();update=t=>{this.options={...this.options,...t},this.basepath=`/${K(t.basepath??"")??""}`,(!this.history||this.options.history&&this.options.history!==this.history)&&(this.history=this.options.history??("undefined"!=typeof document?d():f()),this.latestLocation=this.parseLocation()),this.options.routeTree!==this.routeTree&&(this.routeTree=this.options.routeTree,this.buildRouteTree()),this.__store||(this.__store=new R(kt(this.latestLocation),{onUpdate:()=>{this.__store.state={...this.state,status:this.state.isTransitioning||this.state.isLoading?"pending":"idle"}}}))};get state(){return this.__store.state}buildRouteTree=()=>{this.routesById={},this.routesByPath={};const t=e=>{e.forEach(((e,n)=>{e.init({originalIndex:n});if(g(!this.routesById[e.id],String(e.id)),this.routesById[e.id]=e,!e.isRoot&&e.path){const t=H(e.fullPath);this.routesByPath[t]&&!e.fullPath.endsWith("/")||(this.routesByPath[t]=e)}const o=e.children;o?.length&&t(o)}))};t([this.routeTree]),this.flatRoutes=Object.values(this.routesByPath).map(((t,e)=>{const n=K(t.fullPath),o=W(n);for(;o.length>1&&"/"===o[0]?.value;)o.shift();const r=o.map((t=>"param"===t.type?.5:"wildcard"===t.type?.25:1));return{child:t,trimmed:n,parsed:o,index:e,score:r}})).sort(((t,e)=>{let n="/"===t.trimmed?1:"/"===e.trimmed?-1:0;if(0!==n)return n;const o=Math.min(t.score.length,e.score.length);if(t.score.length!==e.score.length)return e.score.length-t.score.length;for(let n=0;n<o;n++)if(t.score[n]!==e.score[n])return e.score[n]-t.score[n];for(let n=0;n<o;n++)if(t.parsed[n].value!==e.parsed[n].value)return t.parsed[n].value>e.parsed[n].value?1:-1;return t.trimmed!==e.trimmed?t.trimmed>e.trimmed?1:-1:t.index-e.index})).map(((t,e)=>(t.child.rank=e,t.child)))};subscribe=(t,e)=>{const n={eventType:t,fn:e};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}};emit=t=>{this.subscribers.forEach((e=>{e.eventType===t.type&&e.fn(t)}))};checkLatest=t=>this.latestLoadPromise!==t?this.latestLoadPromise:void 0;parseLocation=t=>{const e=({pathname:e,search:n,hash:o,state:r})=>{const s=this.options.parseSearch(n);return{pathname:e,searchStr:n,search:M(t?.search,s),hash:o.split("#").reverse()[0]??"",href:`${e}${n}${o}`,state:M(t?.state,r)}},n=e(this.history.location);let{__tempLocation:o,__tempKey:r}=n.state;if(o&&(!r||r===this.tempLocationKey)){const t=e(o);return t.state.key=n.state.key,delete t.state.__tempLocation,{...t,maskedLocation:n}}return n};resolvePathWithBase=(t,e)=>F(this.basepath,t,B(e));get looseRoutesById(){return this.routesById}matchRoutes=(t,e,n)=>{let o={},r=this.flatRoutes.find((e=>{const n=z(this.basepath,H(t),{to:e.fullPath,caseSensitive:e.options.caseSensitive??this.options.caseSensitive,fuzzy:!1});return!!n&&(o=n,!0)}))||this.routesById.__root__,s=[r];for(;r?.parentRoute;)r=r.parentRoute,r&&s.unshift(r);const a=s.map((t=>{let e;if(t.options.parseParams)try{const e=t.options.parseParams(o);Object.assign(o,e)}catch(t){if(e=new Tt(t.message,{cause:t}),n?.throwOnError)throw e;return e}})),i=[];return s.forEach(((t,r)=>{const s=i[r-1],[c,l]=(()=>{const o=s?.search??e;try{const e="object"==typeof t.options.validateSearch?t.options.validateSearch.parse:t.options.validateSearch;let n=e?.(o)??{};return[{...o,...n},void 0]}catch(t){const e=new Ct(t.message,{cause:t});if(n?.throwOnError)throw e;return[o,e]}})(),u=U(t.fullPath,o),h=U(t.id,o,!0)+(t.options.key?.({search:c,location:this.state.location})??""),d=ut(this.state,h),f=this.state.matches.find((t=>t.id===h))?"stay":"enter",p=!(!t.options.loader&&!Pt.some((e=>t.options[e]?.preload))),m=d?{...d,cause:f}:{id:h,routeId:t.id,params:o,pathname:A([this.basepath,u]),updatedAt:Date.now(),search:{},searchError:void 0,status:p?"pending":"success",showPending:!1,isFetching:!1,invalid:!1,error:void 0,paramsError:a[r],loadPromise:Promise.resolve(),context:void 0,abortController:new AbortController,shouldReloadDeps:void 0,fetchedAt:0,cause:f};m.search=M(m.search,c),m.searchError=l,i.push(m)})),i};cancelMatch=t=>{ut(this.state,t)?.abortController?.abort()};cancelMatches=()=>{this.state.pendingMatches?.forEach((t=>{this.cancelMatch(t.id)}))};buildLocation=t=>{const e=(t={},e)=>{const n=this.latestLocation,o=t.from??n.pathname;let r=this.resolvePathWithBase(o,`${t.to??""}`);const s=this.matchRoutes(o,n.search),a=e?.filter((t=>s?.find((e=>e.routeId===t.routeId)))),i={...C(s)?.params};let c=!0===(t.params??!0)?i:T(t.params,i);c&&e?.map((t=>this.looseRoutesById[t.routeId].options.stringifyParams)).filter(Boolean).forEach((t=>{c={...c,...t(c)}})),r=U(r,c??{});const l=a?.map((t=>this.looseRoutesById[t.routeId].options.preSearchFilters??[])).flat().filter(Boolean)??[],u=a?.map((t=>this.looseRoutesById[t.routeId].options.postSearchFilters??[])).flat().filter(Boolean)??[],h=l?.length?l?.reduce(((t,e)=>e(t)),n.search):n.search,d=!0===t.search?h:t.search?T(t.search,h)??{}:l?.length?h:{},f=u?.length?u.reduce(((t,e)=>e(t)),d):d,p=M(n.search,f),m=this.options.stringifySearch(p),y=!0===t.hash?n.hash:t.hash?T(t.hash,n.hash):n.hash,g=y?`#${y}`:"";let v=!0===t.state?n.state:t.state?T(t.state,n.state):n.state;return v=M(n.state,v),{pathname:r,search:p,searchStr:m,state:v,hash:y,href:this.history.createHref(`${r}${m}${g}`),unmaskOnReload:t.unmaskOnReload}},n=(t={},n)=>{let o=e(t),r=n?e(n):void 0;if(!r){let t={},s=this.options.routeMasks?.find((e=>{const n=z(this.basepath,o.pathname,{to:e.from,caseSensitive:!1,fuzzy:!1});return!!n&&(t=n,!0)}));s&&(s={...s,from:U(s.from,t)},r=e(n=s))}const s=this.matchRoutes(o.pathname,o.search),a=r?this.matchRoutes(r.pathname,r.search):void 0,i=r?e(n,a):void 0,c=e(t,s);return i&&(c.maskedLocation=i),c};return t.mask?n(t,{...k(t,["from"]),...t.mask}):n(t)};commitLocation=async({startTransition:t,...e})=>{this.navigateTimeout&&clearTimeout(this.navigateTimeout);if(!(this.latestLocation.href===e.href)||!e.replace){let{maskedLocation:n,...o}=e;n&&(o={...n,state:{...n.state,__tempKey:void 0,__tempLocation:{...o,search:o.searchStr,state:{...o.state,__tempKey:void 0,__tempLocation:void 0,key:void 0}}}},(o.unmaskOnReload??this.options.unmaskOnReload)&&(o.state.__tempKey=this.tempLocationKey));const r=()=>{this.history[e.replace?"replace":"push"](o.href,o.state)};t??1?this.startReactTransition(r):r()}return this.resetNextScroll=e.resetScroll??!0,this.latestLoadPromise};buildAndCommitLocation=({replace:t,resetScroll:e,startTransition:n,...o}={})=>{const r=this.buildLocation(o);return this.commitLocation({...r,startTransition:n,replace:t,resetScroll:e})};navigate=({from:t,to:e="",...n})=>{const o=String(e),r=void 0===t?t:String(t);let s;try{new URL(`${o}`),s=!0}catch(t){}return g(!s),this.buildAndCommitLocation({...n,from:r,to:o})};loadMatches=async({checkLatest:t,matches:e,preload:n,invalidate:o})=>{let r,s;const a=t=>{this.__store.setState((e=>({...e,pendingMatches:e.pendingMatches?.map((e=>e.id===t.id?t:e))})))};try{for(let[t,o]of e.entries()){const r=e[t-1],a=this.looseRoutesById[o.routeId],i=(n,r)=>{if(n.routerCode=r,s=s??t,St(n))throw n;try{a.options.onError?.(n)}catch(t){if(n=t,St(t))throw t}e[t]=o={...o,error:n,status:"error",updatedAt:Date.now()}};try{o.paramsError&&i(o.paramsError,"PARSE_PARAMS"),o.searchError&&i(o.searchError,"VALIDATE_SEARCH");const s=r?.context??this.options.context??{},c=await(a.options.beforeLoad?.({search:o.search,abortController:o.abortController,params:o.params,preload:!!n,context:s,location:this.state.location,navigate:t=>this.navigate({...t,from:o.pathname}),buildLocation:this.buildLocation,cause:o.cause}))??{},l={...s,...c};e[t]=o={...o,context:M(o.context,l)}}catch(t){i(t,"BEFORE_LOAD");break}}}catch(t){if(St(t))return n||this.navigate(t),e;throw t}const i=e.slice(0,s),c=[];return i.forEach(((s,i)=>{c.push((async()=>{const l=c[i-1],u=this.looseRoutesById[s.routeId],h=t=>!!St(t)&&(n||this.navigate(t),!0);let d;e[i]=s={...s,fetchedAt:Date.now(),invalid:!1,showPending:!1};const f=u.options.pendingMs??this.options.defaultPendingMs;let p;if(!n&&f&&(u.options.pendingComponent??this.options.defaultPendingComponent)&&(p=new Promise((t=>setTimeout(t,f)))),s.isFetching)d=ut(this.state,s.id)?.loadPromise;else{const t={params:s.params,search:s.search,preload:!!n,parentMatchPromise:l,abortController:s.abortController,context:s.context,location:this.state.location,navigate:t=>this.navigate({...t,from:s.pathname}),cause:s.cause};let r=!0,a="function"==typeof u.options.shouldReload?u.options.shouldReload?.(t):!!(u.options.shouldReload??1);if("enter"===s.cause||o?s.shouldReloadDeps=a:"stay"===s.cause&&("object"==typeof a?(r=!I(a,s.shouldReloadDeps),s.shouldReloadDeps=a):r=!!a),r){e[i]=s={...s,isFetching:!0};const n=Promise.all(Pt.map((async t=>{const e=u.options[t];e?.preload&&await e.preload()}))),o=u.options.loader?.(t);d=Promise.all([n,o]).then((t=>t[1]))}else d=Promise.resolve(s.loaderData)}e[i]=s={...s,loadPromise:d},n||a(s);let m=!1;const y=u.options.pendingMinMs??this.options.defaultPendingMinMs;await new Promise((async o=>{p&&p.then((()=>{(r=t())||(m=!0,e[i]=s={...s,showPending:!0},a(s),o())}));try{const n=await d;if(r=t())return await r;if(m&&y&&await new Promise((t=>setTimeout(t,y))),r=t())return await r;e[i]=s={...s,error:void 0,status:"success",isFetching:!1,updatedAt:Date.now(),loaderData:n,loadPromise:void 0}}catch(n){if(r=t())return await r;if(h(n))return;try{u.options.onError?.(n)}catch(t){if(n=t,h(t))return}e[i]=s={...s,error:n,status:"error",isFetching:!1,updatedAt:Date.now()}}finally{m&&y&&s.showPending&&this.__store.setState((t=>({...t,matches:t.matches?.map((t=>t.id===s.id?s:t))})))}n||a(s),o()}))})())})),await Promise.all(c),e};invalidate=()=>this.load({invalidate:!0});load=async t=>{const e=new Promise((async(n,o)=>{const r=this.latestLocation,s=this.state.resolvedLocation,a=s.href!==r.href;let i;this.cancelMatches(),this.emit({type:"onBeforeLoad",fromLocation:s,toLocation:r,pathChanged:a});let c=this.matchRoutes(r.pathname,r.search,{debug:!0});const l=this.state.matches;this.__store.setState((t=>({...t,isLoading:!0,location:r,pendingMatches:c})));try{try{await this.loadMatches({matches:c,checkLatest:()=>this.checkLatest(e),invalidate:t?.invalidate})}catch(t){}if(i=this.checkLatest(e))return i;const o=l.filter((t=>!this.pendingMatches.includes(t))),u=this.pendingMatches.filter((t=>!l.includes(t))),h=l.filter((t=>this.pendingMatches.includes(t)));this.__store.setState((t=>({...t,isLoading:!1,matches:c,pendingMatches:void 0}))),[[o,"onLeave"],[u,"onEnter"],[h,"onTransition"]].forEach((([t,e])=>{t.forEach((t=>{this.looseRoutesById[t.routeId].options[e]?.(t)}))})),this.emit({type:"onLoad",fromLocation:s,toLocation:r,pathChanged:a}),n()}catch(t){if(i=this.checkLatest(e))return i;o(t)}}));return this.latestLoadPromise=e,this.latestLoadPromise};preloadRoute=async(t=this.state.location)=>{let e=this.buildLocation(t),n=this.matchRoutes(e.pathname,e.search,{throwOnError:!0});return await this.loadMatches({matches:n,preload:!0,checkLatest:()=>{}}),[C(n),n]};buildLink=t=>{const{to:e,preload:n,preloadDelay:o,activeOptions:r,disabled:s,target:a,replace:i,resetScroll:c,startTransition:l}=t;try{return new URL(`${e}`),{type:"external",href:e}}catch(t){}const u=t,h=this.buildLocation(u),d=n??this.options.defaultPreload,f=o??this.options.defaultPreloadDelay??0,p=this.latestLocation.pathname.split("/"),m=h.pathname.split("/").every(((t,e)=>t===p[e])),y=r?.exact?this.latestLocation.pathname===h.pathname:m,g=!r?.includeHash||this.latestLocation.hash===h.hash,v=!(r?.includeSearch??1)||I(this.latestLocation.search,h.search,!0);return{type:"internal",next:h,handleFocus:t=>{d&&this.preloadRoute(u).catch((t=>{console.warn(t),console.warn(xt)}))},handleClick:t=>{s||function(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}(t)||t.defaultPrevented||a&&"_self"!==a||0!==t.button||(t.preventDefault(),this.commitLocation({...h,replace:i,resetScroll:c,startTransition:l}))},handleEnter:t=>{const e=t.target||{};if(d){if(e.preloadTimeout)return;e.preloadTimeout=setTimeout((()=>{e.preloadTimeout=null,this.preloadRoute(u).catch((t=>{console.warn(t),console.warn(xt)}))}),f)}},handleLeave:t=>{const e=t.target||{};e.preloadTimeout&&(clearTimeout(e.preloadTimeout),e.preloadTimeout=null)},handleTouchStart:t=>{this.preloadRoute(u).catch((t=>{console.warn(t),console.warn(xt)}))},isActive:y&&g&&v,disabled:s}};matchRoute=(t,e)=>{t={...t,to:t.to?this.resolvePathWithBase(t.from||"",t.to):void 0};const n=this.buildLocation(t);if(e?.pending&&"pending"!==this.state.status)return!1;const o=e?.pending?this.latestLocation:this.state.resolvedLocation;if(!o)return!1;const r=z(this.basepath,o.pathname,{...e,to:n.pathname});return!!r&&(r&&(e?.includeSearch??1)?!!I(o.search,n.search,!0)&&r:r)};injectHtml=async t=>{this.injectedHtml.push(t)};dehydrateData=(t,e)=>{if("undefined"==typeof document){const n="string"==typeof t?t:JSON.stringify(t);return this.injectHtml((async()=>{const t=`__TSR_DEHYDRATED__${n}`,o="function"==typeof e?await e():e;return`<script id='${t}' suppressHydrationWarning>window["__TSR_DEHYDRATED__${$(n)}"] = ${JSON.stringify(o)}\n ;(() => {\n var el = document.getElementById('${t}')\n el.parentElement.removeChild(el)\n })()\n <\/script>`})),()=>this.hydrateData(t)}return()=>{}};hydrateData=t=>{if("undefined"!=typeof document){const e="string"==typeof t?t:JSON.stringify(t);return window[`__TSR_DEHYDRATED__${e}`]}};dehydrate=()=>({state:{dehydratedMatches:this.state.matches.map((t=>k(t,["fetchedAt","invalid","id","status","updatedAt","loaderData"])))}});hydrate=async t=>{let e=t;"undefined"!=typeof document&&(e=window.__TSR_DEHYDRATED__),g(e);const n=e;this.dehydratedData=n.payload,this.options.hydrate?.(n.payload);const o=n.router.state;let r=this.matchRoutes(this.state.location.pathname,this.state.location.search).map((t=>{const e=o.dehydratedMatches.find((e=>e.id===t.id));return g(e,t.id),e?{...t,...e}:t}));this.__store.setState((t=>({...t,matches:r})))}},t.RouterProvider=function({router:t,...e}){t.update({...t.options,...e,context:{...t.options.context,...e?.context}});const n=r.createElement(ct.Provider,{value:t},r.createElement(Z,null),r.createElement(lt,null));return t.options.Wrap?r.createElement(t.options.Wrap,null,n):n},t.ScrollRestoration=function(t){return At(t),null},t.SearchParamError=Ct,t.cleanPath=B,t.componentTypes=Pt,t.createBrowserHistory=d,t.createHashHistory=function(){return d({getHref:()=>window.location.hash.substring(1),createHref:t=>`#${t}`})},t.createMemoryHistory=f,t.createRouteMask=function(t){return t},t.decode=bt,t.deepEqual=I,t.defaultParseSearch=Rt,t.defaultStringifySearch=_t,t.defer=function(t){const e=t;if(!e.__deferredState){e.__deferredState={uid:Math.random().toString(36).slice(2),status:"pending"};const t=e.__deferredState;e.then((e=>{t.status="success",t.data=e})).catch((e=>{t.status="error",t.error=e}))}return e},t.encode=vt,t.escapeJSON=$,t.functionalUpdate=T,t.getInitialRouterState=kt,t.getRouteMatch=ut,t.interpolatePath=U,t.invariant=g,t.isDehydratedDeferred=ft,t.isPlainObject=O,t.isRedirect=St,t.isServer=x,t.joinPaths=A,t.last=C,t.lazyFn=function(t,e){return async(...n)=>(await t())[e||"default"](...n)},t.lazyRouteComponent=function(t,e){let n;const o=()=>(n||(n=t()),n),s=r.lazy((async()=>({default:(await o())[e??"default"]})));return s.preload=o,s},t.matchByPath=Y,t.matchContext=Q,t.matchPathname=z,t.parsePathname=W,t.parseSearchWith=Et,t.pick=k,t.redirect=function(t){return t.isRedirect=!0,t},t.replaceEqualDeep=M,t.resolvePath=F,t.rootRouteId=q,t.rootRouteWithContext=function(){return t=>new G(t)},t.routerContext=ct,t.shallow=function(t,e){if(Object.is(t,e))return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(let o=0;o<n.length;o++)if(!Object.prototype.hasOwnProperty.call(e,n[o])||!Object.is(t[n[o]],e[n[o]]))return!1;return!0},t.stringifySearchWith=Lt,t.trimPath=K,t.trimPathLeft=N,t.trimPathRight=H,t.typedNavigate=function(t){return t},t.useAwaited=pt,t.useBlocker=Nt,t.useElementScrollRestoration=function(t){const e=dt(),n=t?.getKey||$t;let o="";if(t.id)o=`[data-scroll-restoration-id="${t.id}"]`;else{const e=t.getElement?.();if(!e)return;o=Bt(e)}const r=[n(e.latestLocation),o].join(Dt);return jt.state.cached[r]},t.useLayoutEffect=j,t.useLinkProps=yt,t.useLoaderData=it,t.useMatch=at,t.useMatchRoute=rt,t.useMatches=function(t){const e=r.useContext(Q);return ht({select:n=>{let o=st(n);return o=o.slice(o.findIndex((t=>t.id===e))),t?.select?t.select(o):o}})},t.useNavigate=function(t){const{navigate:e}=dt(),n=at({strict:!1,select:t=>t.pathname});return r.useCallback((o=>e({from:o?.to?n:void 0,...t,...o})),[])},t.useParams=J,t.useRouteContext=function(t){return at({...t,select:e=>t?.select?t.select(e.context):e.context})},t.useRouter=dt,t.useRouterState=ht,t.useScrollRestoration=At,t.useSearch=X,t.useStableCallback=function(t){const e=r.useRef(t);return e.current=t,r.useRef(((...t)=>e.current(...t))).current},t.warning=function(t,e){}}));
22
22
  //# sourceMappingURL=index.production.js.map