UNPKG

@baseplate-dev/project-builder-web

Version:

Web interface for constructing project builder JSON

9 lines 85 kB
import{i as N}from"../_virtual___federation_fn_import-o6aKHb82.js";import{j as S}from"../jsx-runtime-D_zvdyIk.js";import{r as Ze}from"../index-c0qeY2gs.js";var oe={exports:{}},se={};/** * @license React * use-sync-external-store-shim.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Te;function Rn(){if(Te)return se;Te=1;var t=Ze();function n(l,u){return l===u&&(l!==0||1/l===1/u)||l!==l&&u!==u}var e=typeof Object.is=="function"?Object.is:n,r=t.useState,o=t.useEffect,s=t.useLayoutEffect,i=t.useDebugValue;function c(l,u){var f=u(),p=r({inst:{value:f,getSnapshot:u}}),m=p[0].inst,v=p[1];return s(function(){m.value=f,m.getSnapshot=u,a(m)&&v({inst:m})},[l,f,u]),o(function(){return a(m)&&v({inst:m}),l(function(){a(m)&&v({inst:m})})},[l]),i(f),f}function a(l){var u=l.getSnapshot;l=l.value;try{var f=u();return!e(l,f)}catch{return!0}}function d(l,u){return u()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:c;return se.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:h,se}var $e;function Pn(){return $e||($e=1,oe.exports=Rn()),oe.exports}var wn="Invariant failed";function dt(t,n){if(!t)throw new Error(wn)}function _o(t,n){}const wt=new WeakMap,Vt=new WeakMap,zt={current:[]};let ie=!1,$t=0;const Tt=new Set,At=new Map;function Qe(t){const n=Array.from(t).sort((e,r)=>e instanceof xt&&e.options.deps.includes(r)?1:r instanceof xt&&r.options.deps.includes(e)?-1:0);for(const e of n){if(zt.current.includes(e))continue;zt.current.push(e),e.recompute();const r=Vt.get(e);if(r)for(const o of r){const s=wt.get(o);s&&Qe(s)}}}function xn(t){t.listeners.forEach(n=>n({prevVal:t.prevState,currentVal:t.state}))}function Cn(t){t.listeners.forEach(n=>n({prevVal:t.prevState,currentVal:t.state}))}function tn(t){if($t>0&&!At.has(t)&&At.set(t,t.prevState),Tt.add(t),!($t>0)&&!ie)try{for(ie=!0;Tt.size>0;){const n=Array.from(Tt);Tt.clear();for(const e of n){const r=At.get(e)??e.prevState;e.prevState=r,xn(e)}for(const e of n){const r=wt.get(e);r&&(zt.current.push(e),Qe(r))}for(const e of n){const r=wt.get(e);if(r)for(const o of r)Cn(o)}}}finally{ie=!1,zt.current=[],At.clear()}}function Fe(t){$t++;try{t()}finally{if($t--,$t===0){const n=Array.from(Tt)[0];n&&tn(n)}}}function bn(t){return typeof t=="function"}class pe{constructor(n,e){this.listeners=new Set,this.subscribe=r=>{var o,s;this.listeners.add(r);const i=(s=(o=this.options)==null?void 0:o.onSubscribe)==null?void 0:s.call(o,r,this);return()=>{this.listeners.delete(r),i?.()}},this.prevState=n,this.state=n,this.options=e}setState(n){var e,r,o;this.prevState=this.state,(e=this.options)!=null&&e.updateFn?this.state=this.options.updateFn(this.prevState)(n):bn(n)?this.state=n(this.prevState):this.state=n,(o=(r=this.options)==null?void 0:r.onUpdate)==null||o.call(r),tn(this)}}class xt{constructor(n){this.listeners=new Set,this._subscriptions=[],this.lastSeenDepValues=[],this.getDepVals=()=>{const e=[],r=[];for(const o of this.options.deps)e.push(o.prevState),r.push(o.state);return this.lastSeenDepValues=r,{prevDepVals:e,currDepVals:r,prevVal:this.prevState??void 0}},this.recompute=()=>{var e,r;this.prevState=this.state;const{prevDepVals:o,currDepVals:s,prevVal:i}=this.getDepVals();this.state=this.options.fn({prevDepVals:o,currDepVals:s,prevVal:i}),(r=(e=this.options).onUpdate)==null||r.call(e)},this.checkIfRecalculationNeededDeeply=()=>{for(const s of this.options.deps)s instanceof xt&&s.checkIfRecalculationNeededDeeply();let e=!1;const r=this.lastSeenDepValues,{currDepVals:o}=this.getDepVals();for(let s=0;s<o.length;s++)if(o[s]!==r[s]){e=!0;break}e&&this.recompute()},this.mount=()=>(this.registerOnGraph(),this.checkIfRecalculationNeededDeeply(),()=>{this.unregisterFromGraph();for(const e of this._subscriptions)e()}),this.subscribe=e=>{var r,o;this.listeners.add(e);const s=(o=(r=this.options).onSubscribe)==null?void 0:o.call(r,e,this);return()=>{this.listeners.delete(e),s?.()}},this.options=n,this.state=n.fn({prevDepVals:void 0,prevVal:void 0,currDepVals:this.getDepVals().currDepVals})}registerOnGraph(n=this.options.deps){for(const e of n)if(e instanceof xt)e.registerOnGraph(),this.registerOnGraph(e.options.deps);else if(e instanceof pe){let r=wt.get(e);r||(r=new Set,wt.set(e,r)),r.add(this);let o=Vt.get(this);o||(o=new Set,Vt.set(this,o)),o.add(e)}}unregisterFromGraph(n=this.options.deps){for(const e of n)if(e instanceof xt)this.unregisterFromGraph(e.options.deps);else if(e instanceof pe){const r=wt.get(e);r&&r.delete(this);const o=Vt.get(this);o&&o.delete(e)}}}const ft="__TSR_index",Be="popstate",Oe="beforeunload";function en(t){let n=t.getLocation();const e=new Set,r=i=>{n=t.getLocation(),e.forEach(c=>c({location:n,action:i}))},o=i=>{t.notifyOnIndexChange??!0?r(i):n=t.getLocation()},s=async({task:i,navigateOpts:c,...a})=>{var d,h;if(c?.ignoreBlocker??!1){i();return}const u=((d=t.getBlockers)==null?void 0:d.call(t))??[],f=a.type==="PUSH"||a.type==="REPLACE";if(typeof document<"u"&&u.length&&f)for(const p of u){const m=Ct(a.path,a.state);if(await p.blockerFn({currentLocation:n,nextLocation:m,action:a.type})){(h=t.onBlocked)==null||h.call(t);return}}i()};return{get location(){return n},get length(){return t.getLength()},subscribers:e,subscribe:i=>(e.add(i),()=>{e.delete(i)}),push:(i,c,a)=>{const d=n.state[ft];c=me(d+1,c),s({task:()=>{t.pushState(i,c),r({type:"PUSH"})},navigateOpts:a,type:"PUSH",path:i,state:c})},replace:(i,c,a)=>{const d=n.state[ft];c=me(d,c),s({task:()=>{t.replaceState(i,c),r({type:"REPLACE"})},navigateOpts:a,type:"REPLACE",path:i,state:c})},go:(i,c)=>{s({task:()=>{t.go(i),o({type:"GO",index:i})},navigateOpts:c,type:"GO"})},back:i=>{s({task:()=>{t.back(i?.ignoreBlocker??!1),o({type:"BACK"})},navigateOpts:i,type:"BACK"})},forward:i=>{s({task:()=>{t.forward(i?.ignoreBlocker??!1),o({type:"FORWARD"})},navigateOpts:i,type:"FORWARD"})},canGoBack:()=>n.state[ft]!==0,createHref:i=>t.createHref(i),block:i=>{var c;if(!t.setBlockers)return()=>{};const a=((c=t.getBlockers)==null?void 0:c.call(t))??[];return t.setBlockers([...a,i]),()=>{var d,h;const l=((d=t.getBlockers)==null?void 0:d.call(t))??[];(h=t.setBlockers)==null||h.call(t,l.filter(u=>u!==i))}},flush:()=>{var i;return(i=t.flush)==null?void 0:i.call(t)},destroy:()=>{var i;return(i=t.destroy)==null?void 0:i.call(t)},notify:r}}function me(t,n){n||(n={});const e=we();return{...n,key:e,__TSR_key:e,[ft]:t}}function nn(t){var n,e;const r=t?.window??(typeof document<"u"?window:void 0),o=r.history.pushState,s=r.history.replaceState;let i=[];const c=()=>i,a=y=>i=y,d=t?.createHref??(y=>y),h=t?.parseLocation??(()=>Ct(`${r.location.pathname}${r.location.search}${r.location.hash}`,r.history.state));if(!((n=r.history.state)!=null&&n.__TSR_key)&&!((e=r.history.state)!=null&&e.key)){const y=we();r.history.replaceState({[ft]:0,key:y,__TSR_key:y},"")}let l=h(),u,f=!1,p=!1,m=!1,v=!1;const g=()=>l;let w,P;const _=()=>{w&&(M._ignoreSubscribers=!0,(w.isPush?r.history.pushState:r.history.replaceState)(w.state,"",w.href),M._ignoreSubscribers=!1,w=void 0,P=void 0,u=void 0)},$=(y,L,C)=>{const T=d(L);P||(u=l),l=Ct(L,C),w={href:T,state:C,isPush:w?.isPush||y==="push"},P||(P=Promise.resolve().then(()=>_()))},I=y=>{l=h(),M.notify({type:y})},R=async()=>{if(p){p=!1;return}const y=h(),L=y.state[ft]-l.state[ft],C=L===1,T=L===-1,O=!C&&!T||f;f=!1;const H=O?"GO":T?"BACK":"FORWARD",b=O?{type:"GO",index:L}:{type:T?"BACK":"FORWARD"};if(m)m=!1;else{const A=c();if(typeof document<"u"&&A.length){for(const E of A)if(await E.blockerFn({currentLocation:l,nextLocation:y,action:H})){p=!0,r.history.go(1),M.notify(b);return}}}l=h(),M.notify(b)},x=y=>{if(v){v=!1;return}let L=!1;const C=c();if(typeof document<"u"&&C.length)for(const T of C){const O=T.enableBeforeUnload??!0;if(O===!0){L=!0;break}if(typeof O=="function"&&O()===!0){L=!0;break}}if(L)return y.preventDefault(),y.returnValue=""},M=en({getLocation:g,getLength:()=>r.history.length,pushState:(y,L)=>$("push",y,L),replaceState:(y,L)=>$("replace",y,L),back:y=>(y&&(m=!0),v=!0,r.history.back()),forward:y=>{y&&(m=!0),v=!0,r.history.forward()},go:y=>{f=!0,r.history.go(y)},createHref:y=>d(y),flush:_,destroy:()=>{r.history.pushState=o,r.history.replaceState=s,r.removeEventListener(Oe,x,{capture:!0}),r.removeEventListener(Be,R)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:c,setBlockers:a,notifyOnIndexChange:!1});return r.addEventListener(Oe,x,{capture:!0}),r.addEventListener(Be,R),r.history.pushState=function(...y){const L=o.apply(r.history,y);return M._ignoreSubscribers||I("PUSH"),L},r.history.replaceState=function(...y){const L=s.apply(r.history,y);return M._ignoreSubscribers||I("REPLACE"),L},M}function Ro(t){const n=t?.window??(typeof document<"u"?window:void 0);return nn({window:n,parseLocation:()=>{const e=n.location.hash.split("#").slice(1),r=e[0]??"/",o=n.location.search,s=e.slice(1),i=s.length===0?"":`#${s.join("#")}`,c=`${r}${o}${i}`;return Ct(c,n.history.state)},createHref:e=>`${n.location.pathname}${n.location.search}#${e}`})}function Ln(t={initialEntries:["/"]}){const n=t.initialEntries;let e=t.initialIndex?Math.min(Math.max(t.initialIndex,0),n.length-1):n.length-1;const r=n.map((s,i)=>me(i,void 0));return en({getLocation:()=>Ct(n[e],r[e]),getLength:()=>n.length,pushState:(s,i)=>{e<n.length-1&&(n.splice(e+1),r.splice(e+1)),r.push(i),n.push(s),e=Math.max(n.length-1,0)},replaceState:(s,i)=>{r[e]=i,n[e]=s},back:()=>{e=Math.max(e-1,0)},forward:()=>{e=Math.min(e+1,n.length-1)},go:s=>{e=Math.min(Math.max(e+s,0),n.length-1)},createHref:s=>s})}function Ct(t,n){const e=t.indexOf("#"),r=t.indexOf("?"),o=we();return{href:t,pathname:t.substring(0,e>0?r>0?Math.min(e,r):e:r>0?r:t.length),hash:e>-1?t.substring(e):"",search:r>-1?t.slice(r,e===-1?void 0:e):"",state:n||{[ft]:0,key:o,__TSR_key:o}}}function we(){return(Math.random()+1).toString(36).substring(7)}function ve(t){return t[t.length-1]}function Mn(t){return typeof t=="function"}function mt(t,n){return Mn(t)?t(n):t}function Kt(t,n){return n.reduce((e,r)=>(e[r]=t[r],e),{})}function nt(t,n){if(t===n)return t;const e=n,r=je(t)&&je(e);if(r||Ae(t)&&Ae(e)){const o=r?t:Object.keys(t).concat(Object.getOwnPropertySymbols(t)),s=o.length,i=r?e:Object.keys(e).concat(Object.getOwnPropertySymbols(e)),c=i.length,a=r?[]:{};let d=0;for(let h=0;h<c;h++){const l=r?h:i[h];(!r&&o.includes(l)||r)&&t[l]===void 0&&e[l]===void 0?(a[l]=void 0,d++):(a[l]=nt(t[l],e[l]),a[l]===t[l]&&t[l]!==void 0&&d++)}return s===c&&d===s?t:a}return e}function Ae(t){return ge(t)&&Object.getOwnPropertyNames(t).length===Object.keys(t).length}function ge(t){if(!De(t))return!1;const n=t.constructor;if(typeof n>"u")return!0;const e=n.prototype;return!(!De(e)||!e.hasOwnProperty("isPrototypeOf"))}function De(t){return Object.prototype.toString.call(t)==="[object Object]"}function je(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function Ne(t,n){let e=Object.keys(t);return n&&(e=e.filter(r=>t[r]!==void 0)),e}function vt(t,n,e){if(t===n)return!0;if(typeof t!=typeof n)return!1;if(ge(t)&&ge(n)){const r=e?.ignoreUndefined??!0,o=Ne(t,r),s=Ne(n,r);return!e?.partial&&o.length!==s.length?!1:s.every(i=>vt(t[i],n[i],e))}return Array.isArray(t)&&Array.isArray(n)?t.length!==n.length?!1:!t.some((r,o)=>!vt(r,n[o],e)):!1}function Rt(t){let n,e;const r=new Promise((o,s)=>{n=o,e=s});return r.status="pending",r.resolve=o=>{r.status="resolved",r.value=o,n(o),t?.(o)},r.reject=o=>{r.status="rejected",e(o)},r}function Po(t){return t.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"')}function wo(t,n){if(Object.is(t,n))return!0;if(typeof t!="object"||t===null||typeof n!="object"||n===null)return!1;const e=Object.keys(t);if(e.length!==Object.keys(n).length)return!1;for(const r of e)if(!Object.prototype.hasOwnProperty.call(n,r)||!Object.is(t[r],n[r]))return!1;return!0}function En(t){return typeof t?.message!="string"?!1:t.message.startsWith("Failed to fetch dynamically imported module")||t.message.startsWith("error loading dynamically imported module")||t.message.startsWith("Importing a module script failed")}const ct=0,yt=1,St=2,bt=3;function lt(t){return xe(t.filter(n=>n!==void 0).join("/"))}function xe(t){return t.replace(/\/{2,}/g,"/")}function Ce(t){return t==="/"?t:t.replace(/^\/{1,}/,"")}function Lt(t){return t==="/"?t:t.replace(/\/{1,}$/,"")}function ae(t){return Lt(Ce(t))}function Ut(t,n){return t?.endsWith("/")&&t!=="/"&&t!==`${n}/`?t.slice(0,-1):t}function kn(t,n,e){return Ut(t,e)===Ut(n,e)}function In(t){const{type:n,value:e}=t;if(n===ct)return e;const{prefixSegment:r,suffixSegment:o}=t;if(n===yt){const s=e.substring(1);if(r&&o)return`${r}{$${s}}${o}`;if(r)return`${r}{$${s}}`;if(o)return`{$${s}}${o}`}if(n===bt){const s=e.substring(1);return r&&o?`${r}{-$${s}}${o}`:r?`${r}{-$${s}}`:o?`{-$${s}}${o}`:`{-$${s}}`}if(n===St){if(r&&o)return`${r}{$}${o}`;if(r)return`${r}{$}`;if(o)return`{$}${o}`}return e}function Tn({basepath:t,base:n,to:e,trailingSlash:r="never",caseSensitive:o,parseCache:s}){var i;n=Ht(t,n,o),e=Ht(t,e,o);let c=Mt(n,s).slice();const a=Mt(e,s);c.length>1&&((i=ve(c))==null?void 0:i.value)==="/"&&c.pop();for(let l=0,u=a.length;l<u;l++){const f=a[l],p=f.value;p==="/"?l?l===u-1&&c.push(f):c=[f]:p===".."?c.pop():p==="."||c.push(f)}c.length>1&&(ve(c).value==="/"?r==="never"&&c.pop():r==="always"&&c.push({type:ct,value:"/"}));const d=c.map(In);return lt([t,...d])}const Mt=(t,n)=>{if(!t)return[];const e=n?.get(t);if(e)return e;const r=Dn(t);return n?.set(t,r),r},$n=/^\$.{1,}$/,Fn=/^(.*?)\{(\$[a-zA-Z_$][a-zA-Z0-9_$]*)\}(.*)$/,Bn=/^(.*?)\{-(\$[a-zA-Z_$][a-zA-Z0-9_$]*)\}(.*)$/,On=/^\$$/,An=/^(.*?)\{\$\}(.*)$/;function Dn(t){t=xe(t);const n=[];if(t.slice(0,1)==="/"&&(t=t.substring(1),n.push({type:ct,value:"/"})),!t)return n;const e=t.split("/").filter(Boolean);return n.push(...e.map(r=>{const o=r.match(An);if(o){const c=o[1],a=o[2];return{type:St,value:"$",prefixSegment:c||void 0,suffixSegment:a||void 0}}const s=r.match(Bn);if(s){const c=s[1],a=s[2],d=s[3];return{type:bt,value:a,prefixSegment:c||void 0,suffixSegment:d||void 0}}const i=r.match(Fn);if(i){const c=i[1],a=i[2],d=i[3];return{type:yt,value:""+a,prefixSegment:c||void 0,suffixSegment:d||void 0}}if($n.test(r)){const c=r.substring(1);return{type:yt,value:"$"+c,prefixSegment:void 0,suffixSegment:void 0}}return On.test(r)?{type:St,value:"$",prefixSegment:void 0,suffixSegment:void 0}:{type:ct,value:r.includes("%25")?r.split("%25").map(c=>decodeURI(c)).join("%25"):decodeURI(r)}})),t.slice(-1)==="/"&&(t=t.substring(1),n.push({type:ct,value:"/"})),n}function Dt({path:t,params:n,leaveWildcards:e,leaveParams:r,decodeCharMap:o,parseCache:s}){const i=Mt(t,s);function c(l){const u=n[l],f=typeof u=="string";return l==="*"||l==="_splat"?f?encodeURI(u):u:f?jn(u,o):u}let a=!1;const d={},h=lt(i.map(l=>{if(l.type===ct)return l.value;if(l.type===St){d._splat=n._splat;const u=l.prefixSegment||"",f=l.suffixSegment||"";if(!("_splat"in n))return a=!0,e?`${u}${l.value}${f}`:u||f?`${u}${f}`:void 0;const p=c("_splat");return e?`${u}${l.value}${p??""}${f}`:`${u}${p}${f}`}if(l.type===yt){const u=l.value.substring(1);!a&&!(u in n)&&(a=!0),d[u]=n[u];const f=l.prefixSegment||"",p=l.suffixSegment||"";if(r){const m=c(l.value);return`${f}${l.value}${m??""}${p}`}return`${f}${c(u)??"undefined"}${p}`}if(l.type===bt){const u=l.value.substring(1),f=l.prefixSegment||"",p=l.suffixSegment||"";if(!(u in n)||n[u]==null)return e?`${f}${u}${p}`:f||p?`${f}${p}`:void 0;if(d[u]=n[u],r){const m=c(l.value);return`${f}${l.value}${m??""}${p}`}return e?`${f}${u}${c(u)??""}${p}`:`${f}${c(u)??""}${p}`}return l.value}));return{usedParams:d,interpolatedPath:h,isMissingParams:a}}function jn(t,n){let e=encodeURIComponent(t);if(n)for(const[r,o]of n)e=e.replaceAll(r,o);return e}function ye(t,n,e,r){const o=Nn(t,n,e,r);if(!(e.to&&!o))return o??{}}function Ht(t,n,e=!1){const r=e?t:t.toLowerCase(),o=e?n:n.toLowerCase();switch(!0){case r==="/":return n;case o===r:return"";case n.length<t.length:return n;case o[r.length]!=="/":return n;case o.startsWith(r):return n.slice(t.length);default:return n}}function Nn(t,n,{to:e,fuzzy:r,caseSensitive:o},s){if(t!=="/"&&!n.startsWith(t))return;n=Ht(t,n,o),e=Ht(t,`${e??"$"}`,o);const i=Mt(n.startsWith("/")?n:`/${n}`,s),c=Mt(e.startsWith("/")?e:`/${e}`,s),a={};return Vn(i,c,a,r,o)?a:void 0}function Vn(t,n,e,r,o){var s,i,c;let a=0,d=0;for(;a<t.length||d<n.length;){const h=t[a],l=n[d];if(l){if(l.type===St){const u=t.slice(a);let f;if(l.prefixSegment||l.suffixSegment){if(!h)return!1;const p=l.prefixSegment||"",m=l.suffixSegment||"",v=h.value;if("prefixSegment"in l&&!v.startsWith(p)||"suffixSegment"in l&&!((s=t[t.length-1])!=null&&s.value.endsWith(m)))return!1;let g=decodeURI(lt(u.map(w=>w.value)));p&&g.startsWith(p)&&(g=g.slice(p.length)),m&&g.endsWith(m)&&(g=g.slice(0,g.length-m.length)),f=g}else f=decodeURI(lt(u.map(p=>p.value)));return e["*"]=f,e._splat=f,!0}if(l.type===ct){if(l.value==="/"&&!h?.value){d++;continue}if(h){if(o){if(l.value!==h.value)return!1}else if(l.value.toLowerCase()!==h.value.toLowerCase())return!1;a++,d++;continue}else return!1}if(l.type===yt){if(!h||h.value==="/")return!1;let u="",f=!1;if(l.prefixSegment||l.suffixSegment){const p=l.prefixSegment||"",m=l.suffixSegment||"",v=h.value;if(p&&!v.startsWith(p)||m&&!v.endsWith(m))return!1;let g=v;p&&g.startsWith(p)&&(g=g.slice(p.length)),m&&g.endsWith(m)&&(g=g.slice(0,g.length-m.length)),u=decodeURIComponent(g),f=!0}else u=decodeURIComponent(h.value),f=!0;f&&(e[l.value.substring(1)]=u,a++),d++;continue}if(l.type===bt){if(!h){d++;continue}if(h.value==="/"){d++;continue}let u="",f=!1;if(l.prefixSegment||l.suffixSegment){const p=l.prefixSegment||"",m=l.suffixSegment||"",v=h.value;if((!p||v.startsWith(p))&&(!m||v.endsWith(m))){let g=v;p&&g.startsWith(p)&&(g=g.slice(p.length)),m&&g.endsWith(m)&&(g=g.slice(0,g.length-m.length)),u=decodeURIComponent(g),f=!0}}else{let p=!0;for(let m=d+1;m<n.length;m++){const v=n[m];if(v?.type===ct&&v.value===h.value){p=!1;break}if(v?.type===yt||v?.type===St)break}p&&(u=decodeURIComponent(h.value),f=!0)}f&&(e[l.value.substring(1)]=u,a++),d++;continue}}if(a<t.length&&d>=n.length)return e["**"]=lt(t.slice(a).map(u=>u.value)),!!r&&((i=n[n.length-1])==null?void 0:i.value)!=="/";if(d<n.length&&a>=t.length){for(let u=d;u<n.length;u++)if(((c=n[u])==null?void 0:c.type)!==bt)return!1;break}break}return!0}function rn(t={}){if(t.isNotFound=!0,t.throw)throw t;return t}function rt(t){return!!t?.isNotFound}function Wn(){try{if(typeof window<"u"&&typeof window.sessionStorage=="object")return window.sessionStorage}catch{return}}const Gt="tsr-scroll-restoration-v1_3",zn=(t,n)=>{let e;return(...r)=>{e||(e=setTimeout(()=>{t(...r),e=null},n))}};function Kn(){const t=Wn();if(!t)return;const n=t.getItem(Gt);let e=n?JSON.parse(n):{};return{state:e,set:r=>(e=mt(r,e)||e,t.setItem(Gt,JSON.stringify(e)))}}const Wt=Kn(),qt=t=>t.state.__TSR_key||t.href;function on(t){const n=[];let e;for(;e=t.parentNode;)n.unshift(`${t.tagName}:nth-child(${[].indexOf.call(e.children,t)+1})`),t=e;return`${n.join(" > ")}`.toLowerCase()}let Jt=!1;function sn({storageKey:t,key:n,behavior:e,shouldScrollRestoration:r,scrollToTopSelectors:o,location:s}){var i;let c;try{c=JSON.parse(sessionStorage.getItem(t)||"{}")}catch(h){console.error(h);return}const a=n||((i=window.history.state)==null?void 0:i.key),d=c[a];Jt=!0,(()=>{if(r&&d&&Object.keys(d).length>0){for(const l in d){const u=d[l];if(l==="window")window.scrollTo({top:u.scrollY,left:u.scrollX,behavior:e});else if(l){const f=document.querySelector(l);f&&(f.scrollLeft=u.scrollX,f.scrollTop=u.scrollY)}}return}const h=(s??window.location).hash.split("#")[1];if(h){const l=(window.history.state||{}).__hashScrollIntoViewOptions??!0;if(l){const u=document.getElementById(h);u&&u.scrollIntoView(l)}return}["window",...o?.filter(l=>l!=="window")??[]].forEach(l=>{const u=l==="window"?window:typeof l=="function"?l():document.querySelector(l);u&&u.scrollTo({top:0,left:0,behavior:e})})})(),Jt=!1}function an(t,n){if(Wt===void 0||((n??t.options.scrollRestoration??!1)&&(t.isScrollRestoring=!0),typeof document>"u"||t.isScrollRestorationSetup))return;t.isScrollRestorationSetup=!0,Jt=!1;const r=t.options.getScrollRestorationKey||qt;window.history.scrollRestoration="manual";const o=s=>{if(Jt||!t.isScrollRestoring)return;let i="";if(s.target===document||s.target===window)i="window";else{const a=s.target.getAttribute("data-scroll-restoration-id");a?i=`[data-scroll-restoration-id="${a}"]`:i=on(s.target)}const c=r(t.state.location);Wt.set(a=>{const d=a[c]=a[c]||{},h=d[i]=d[i]||{};if(i==="window")h.scrollX=window.scrollX||0,h.scrollY=window.scrollY||0;else if(i){const l=document.querySelector(i);l&&(h.scrollX=l.scrollLeft||0,h.scrollY=l.scrollTop||0)}return a})};typeof document<"u"&&document.addEventListener("scroll",zn(o,100),!0),t.subscribe("onRendered",s=>{const i=r(s.toLocation);if(!t.resetNextScroll){t.resetNextScroll=!0;return}sn({storageKey:Gt,key:i,behavior:t.options.scrollRestorationBehavior,shouldScrollRestoration:t.isScrollRestoring,scrollToTopSelectors:t.options.scrollToTopSelectors,location:t.history.location}),t.isScrollRestoring&&Wt.set(c=>(c[i]=c[i]||{},c))})}function Un(t){if(typeof document<"u"&&document.querySelector){const n=t.state.location.state.__hashScrollIntoViewOptions??!0;if(n&&t.state.location.hash!==""){const e=document.getElementById(t.state.location.hash);e&&e.scrollIntoView(n)}}}function Hn(t,n){const e=Object.entries(t).flatMap(([o,s])=>Array.isArray(s)?s.map(i=>[o,String(i)]):[[o,String(s)]]),r=new URLSearchParams(e);return(n||"")+r.toString()}function ce(t){return t?t==="false"?!1:t==="true"?!0:+t*0===0&&+t+""===t?+t:t:""}function Gn(t,n){const e=n?t.slice(n.length):t;return[...new URLSearchParams(e).entries()].reduce((s,[i,c])=>{const a=s[i];return a==null?s[i]=ce(c):s[i]=Array.isArray(a)?[...a,ce(c)]:[a,ce(c)],s},{})}const qn=Yn(JSON.parse),Jn=Xn(JSON.stringify,JSON.parse);function Yn(t){return n=>{n.substring(0,1)==="?"&&(n=n.substring(1));const e=Gn(n);for(const r in e){const o=e[r];if(typeof o=="string")try{e[r]=t(o)}catch{}}return e}}function Xn(t,n){function e(r){if(typeof r=="object"&&r!==null)try{return t(r)}catch{}else if(typeof r=="string"&&typeof n=="function")try{return n(r),t(r)}catch{}return r}return r=>{r={...r},Object.keys(r).forEach(s=>{const i=r[s];typeof i>"u"||i===void 0?delete r[s]:r[s]=e(i)});const o=Hn(r).toString();return o?`?${o}`:""}}const ot="__root__";function Zn(t){if(t.statusCode=t.statusCode||t.code||307,!t.reloadDocument)try{new URL(`${t.href}`),t.reloadDocument=!0}catch{}const n=new Headers(t.headers||{});t.href&&n.get("Location")===null&&n.set("Location",t.href);const e=new Response(null,{status:t.statusCode,headers:n});if(e.options=t,t.throw)throw e;return e}function st(t){return t instanceof Response&&!!t.options}function Qn(t){const n=new Map;let e,r;const o=s=>{s.next&&(s.prev?(s.prev.next=s.next,s.next.prev=s.prev,s.next=void 0,r&&(r.next=s,s.prev=r)):(s.next.prev=void 0,e=s.next,s.next=void 0,r&&(s.prev=r,r.next=s)),r=s)};return{get(s){const i=n.get(s);if(i)return o(i),i.value},set(s,i){if(n.size>=t&&e){const a=e;n.delete(a.key),a.next&&(e=a.next,a.next.prev=void 0),a===r&&(r=void 0)}const c=n.get(s);if(c)c.value=i,o(c);else{const a={key:s,value:i,prev:r};r&&(r.next=a),r=a,e||(e=a),n.set(s,a)}}}}function tr(t){return t instanceof Error?{name:t.name,message:t.message}:{data:t}}function gt(t){const n=t.resolvedLocation,e=t.location,r=n?.pathname!==e.pathname,o=n?.href!==e.href,s=n?.hash!==e.hash;return{fromLocation:n,toLocation:e,pathChanged:r,hrefChanged:o,hashChanged:s}}class er{constructor(n){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=>{var r;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 o=this.options;this.options={...this.options,...e},this.isServer=this.options.isServer??typeof document>"u",this.pathParamsDecodeCharMap=this.options.pathParamsAllowedCharacters?new Map(this.options.pathParamsAllowedCharacters.map(s=>[encodeURIComponent(s),s])):void 0,(!this.basepath||e.basepath&&e.basepath!==o.basepath)&&(e.basepath===void 0||e.basepath===""||e.basepath==="/"?this.basepath="/":this.basepath=`/${ae(e.basepath)}`),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.history=this.options.history??(this.isServer?Ln({initialEntries:[this.basepath||"/"]}):nn()),this.latestLocation=this.parseLocation()),this.options.routeTree!==this.routeTree&&(this.routeTree=this.options.routeTree,this.buildRouteTree()),this.__store||(this.__store=new pe(rr(this.latestLocation),{onUpdate:()=>{this.__store.state={...this.state,cachedMatches:this.state.cachedMatches.filter(s=>!["redirected"].includes(s.status))}}}),an(this)),typeof window<"u"&&"CSS"in window&&typeof((r=window.CSS)==null?void 0:r.supports)=="function"&&(this.isViewTransitionTypesSupported=window.CSS.supports("selector(:active-view-transition-type(a)"))},this.buildRouteTree=()=>{const{routesById:e,routesByPath:r,flatRoutes:o}=ar({routeTree:this.routeTree,initRoute:(i,c)=>{i.init({originalIndex:c})}});this.routesById=e,this.routesByPath=r,this.flatRoutes=o;const s=this.options.notFoundRoute;s&&(s.init({originalIndex:99999999999}),this.routesById[s.id]=s)},this.subscribe=(e,r)=>{const o={eventType:e,fn:r};return this.subscribers.add(o),()=>{this.subscribers.delete(o)}},this.emit=e=>{this.subscribers.forEach(r=>{r.eventType===e.type&&r.fn(e)})},this.parseLocation=(e,r)=>{const o=({pathname:a,search:d,hash:h,state:l})=>{const u=this.options.parseSearch(d),f=this.options.stringifySearch(u);return{pathname:a,searchStr:f,search:nt(e?.search,u),hash:h.split("#").reverse()[0]??"",href:`${a}${f}${h}`,state:nt(e?.state,l)}},s=o(r??this.history.location),{__tempLocation:i,__tempKey:c}=s.state;if(i&&(!c||c===this.tempLocationKey)){const a=o(i);return a.state.key=s.state.key,a.state.__TSR_key=s.state.__TSR_key,delete a.state.__tempLocation,{...a,maskedLocation:s}}return s},this.resolvePathWithBase=(e,r)=>Tn({basepath:this.basepath,base:e,to:xe(r),trailingSlash:this.options.trailingSlash,caseSensitive:this.options.caseSensitive,parseCache:this.parsePathnameCache}),this.matchRoutes=(e,r,o)=>typeof e=="string"?this.matchRoutesInternal({pathname:e,search:r},o):this.matchRoutesInternal(e,r),this.parsePathnameCache=Qn(1e3),this.getMatchedRoutes=(e,r)=>cr({pathname:e,routePathname:r,basepath:this.basepath,caseSensitive:this.options.caseSensitive,routesByPath:this.routesByPath,routesById:this.routesById,flatRoutes:this.flatRoutes,parseCache:this.parsePathnameCache}),this.cancelMatch=e=>{const r=this.getMatch(e);r&&(r.abortController.abort(),this.updateMatch(e,o=>(clearTimeout(o.pendingTimeout),{...o,pendingTimeout:void 0})))},this.cancelMatches=()=>{var e;(e=this.state.pendingMatches)==null||e.forEach(r=>{this.cancelMatch(r.id)})},this.buildLocation=e=>{const r=(s={})=>{var i;const c=s._fromLocation||this.latestLocation,a=this.matchRoutes(c,{_buildLocation:!0}),d=ve(a);let h=d.fullPath;const l=s.to?this.resolvePathWithBase(h,`${s.to}`):this.resolvePathWithBase(h,"."),u=!!s.to&&!We(s.to.toString(),h)&&!We(l,h);s.unsafeRelative==="path"?h=c.pathname:u&&s.from&&(h=s.from);const f=d.search,p={...d.params},m=s.to?this.resolvePathWithBase(h,`${s.to}`):this.resolvePathWithBase(h,".");let v=s.params===!1||s.params===null?{}:(s.params??!0)===!0?p:{...p,...mt(s.params,p)};const g=Dt({path:m,params:v??{},parseCache:this.parsePathnameCache}).interpolatedPath,w=this.matchRoutes(g,{},{_buildLocation:!0}).map(M=>this.looseRoutesById[M.routeId]);Object.keys(v).length>0&&w.map(M=>{var y;return((y=M.options.params)==null?void 0:y.stringify)??M.options.stringifyParams}).filter(Boolean).forEach(M=>{v={...v,...M(v)}});const P=Dt({path:m,params:v??{},leaveWildcards:!1,leaveParams:e.leaveParams,decodeCharMap:this.pathParamsDecodeCharMap,parseCache:this.parsePathnameCache}).interpolatedPath;let _=f;if(e._includeValidateSearch&&((i=this.options.search)!=null&&i.strict)){let M={};w.forEach(y=>{try{y.options.validateSearch&&(M={...M,...Se(y.options.validateSearch,{...M,..._})??{}})}catch{}}),_=M}_=lr({search:_,dest:s,destRoutes:w,_includeValidateSearch:e._includeValidateSearch}),_=nt(f,_);const $=this.options.stringifySearch(_),I=s.hash===!0?c.hash:s.hash?mt(s.hash,c.hash):void 0,R=I?`#${I}`:"";let x=s.state===!0?c.state:s.state?mt(s.state,c.state):{};return x=nt(c.state,x),{pathname:P,search:_,searchStr:$,state:x,hash:I??"",href:`${P}${$}${R}`,unmaskOnReload:s.unmaskOnReload}},o=(s={},i)=>{var c;const a=r(s);let d=i?r(i):void 0;if(!d){let h={};const l=(c=this.options.routeMasks)==null?void 0:c.find(u=>{const f=ye(this.basepath,a.pathname,{to:u.from,caseSensitive:!1,fuzzy:!1},this.parsePathnameCache);return f?(h=f,!0):!1});if(l){const{from:u,...f}=l;i={...Kt(e,["from"]),...f,params:h},d=r(i)}}if(d){const h=r(i);a.maskedLocation=h}return a};return e.mask?o(e,{...Kt(e,["from"]),...e.mask}):o(e)},this.commitLocation=({viewTransition:e,ignoreBlocker:r,...o})=>{const s=()=>{const a=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];a.forEach(h=>{o.state[h]=this.latestLocation.state[h]});const d=vt(o.state,this.latestLocation.state);return a.forEach(h=>{delete o.state[h]}),d},i=this.latestLocation.href===o.href,c=this.commitLocationPromise;if(this.commitLocationPromise=Rt(()=>{c?.resolve()}),i&&s())this.load();else{let{maskedLocation:a,hashScrollIntoView:d,...h}=o;a&&(h={...a,state:{...a.state,__tempKey:void 0,__tempLocation:{...h,search:h.searchStr,state:{...h.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(h.unmaskOnReload??this.options.unmaskOnReload??!1)&&(h.state.__tempKey=this.tempLocationKey)),h.state.__hashScrollIntoViewOptions=d??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=e,this.history[o.replace?"replace":"push"](h.href,h.state,{ignoreBlocker:r})}return this.resetNextScroll=o.resetScroll??!0,this.history.subscribers.size||this.load(),this.commitLocationPromise},this.buildAndCommitLocation=({replace:e,resetScroll:r,hashScrollIntoView:o,viewTransition:s,ignoreBlocker:i,href:c,...a}={})=>{if(c){const h=this.history.location.state.__TSR_index,l=Ct(c,{__TSR_index:e?h:h+1});a.to=l.pathname,a.search=this.options.parseSearch(l.search),a.hash=l.hash.slice(1)}const d=this.buildLocation({...a,_includeValidateSearch:!0});return this.commitLocation({...d,viewTransition:s,replace:e,resetScroll:r,hashScrollIntoView:o,ignoreBlocker:i})},this.navigate=({to:e,reloadDocument:r,href:o,...s})=>{if(!r&&o)try{new URL(`${o}`),r=!0}catch{}if(r){if(!o){const i=this.buildLocation({to:e,...s});o=this.history.createHref(i.href)}return s.replace?window.location.replace(o):window.location.href=o,Promise.resolve()}return this.buildAndCommitLocation({...s,href:o,to:e,_isNavigate:!0})},this.beforeLoad=()=>{if(this.cancelMatches(),this.latestLocation=this.parseLocation(this.latestLocation),this.isServer){const r=this.buildLocation({to:this.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0}),o=s=>{try{return encodeURI(decodeURI(s))}catch{return s}};if(ae(o(this.latestLocation.href))!==ae(o(r.href)))throw Zn({href:r.href})}const e=this.matchRoutes(this.latestLocation);this.__store.setState(r=>({...r,status:"pending",statusCode:200,isLoading:!0,location:this.latestLocation,pendingMatches:e,cachedMatches:r.cachedMatches.filter(o=>!e.some(s=>s.id===o.id))}))},this.load=async e=>{let r,o,s;for(s=new Promise(i=>{this.startTransition(async()=>{var c;try{this.beforeLoad();const a=this.latestLocation,d=this.state.resolvedLocation;this.state.redirect||this.emit({type:"onBeforeNavigate",...gt({resolvedLocation:d,location:a})}),this.emit({type:"onBeforeLoad",...gt({resolvedLocation:d,location:a})}),await this.loadMatches({sync:e?.sync,matches:this.state.pendingMatches,location:a,onReady:async()=>{this.startViewTransition(async()=>{let h,l,u;Fe(()=>{this.__store.setState(f=>{const p=f.matches,m=f.pendingMatches||f.matches;return h=p.filter(v=>!m.some(g=>g.id===v.id)),l=m.filter(v=>!p.some(g=>g.id===v.id)),u=p.filter(v=>m.some(g=>g.id===v.id)),{...f,isLoading:!1,loadedAt:Date.now(),matches:m,pendingMatches:void 0,cachedMatches:[...f.cachedMatches,...h.filter(v=>v.status!=="error")]}}),this.clearExpiredCache()}),[[h,"onLeave"],[l,"onEnter"],[u,"onStay"]].forEach(([f,p])=>{f.forEach(m=>{var v,g;(g=(v=this.looseRoutesById[m.routeId].options)[p])==null||g.call(v,m)})})})}})}catch(a){st(a)?(r=a,this.isServer||this.navigate({...r.options,replace:!0,ignoreBlocker:!0})):rt(a)&&(o=a),this.__store.setState(d=>({...d,statusCode:r?r.status:o?404:d.matches.some(h=>h.status==="error")?500:200,redirect:r}))}this.latestLoadPromise===s&&((c=this.commitLocationPromise)==null||c.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),i()})}),this.latestLoadPromise=s,await s;this.latestLoadPromise&&s!==this.latestLoadPromise;)await this.latestLoadPromise;this.hasNotFoundMatch()&&this.__store.setState(i=>({...i,statusCode:404}))},this.startViewTransition=e=>{const r=this.shouldViewTransition??this.options.defaultViewTransition;if(delete this.shouldViewTransition,r&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let o;if(typeof r=="object"&&this.isViewTransitionTypesSupported){const s=this.latestLocation,i=this.state.resolvedLocation,c=typeof r.types=="function"?r.types(gt({resolvedLocation:i,location:s})):r.types;o={update:e,types:c}}else o=e;document.startViewTransition(o)}else e()},this.updateMatch=(e,r)=>{var o;const s=(o=this.state.pendingMatches)!=null&&o.some(i=>i.id===e)?"pendingMatches":this.state.matches.some(i=>i.id===e)?"matches":this.state.cachedMatches.some(i=>i.id===e)?"cachedMatches":"";s&&this.__store.setState(i=>{var c;return{...i,[s]:(c=i[s])==null?void 0:c.map(a=>a.id===e?r(a):a)}})},this.getMatch=e=>{var r;const o=s=>s.id===e;return this.state.cachedMatches.find(o)??((r=this.state.pendingMatches)==null?void 0:r.find(o))??this.state.matches.find(o)},this.loadMatches=async({location:e,matches:r,preload:o,onReady:s,updateMatch:i=this.updateMatch,sync:c})=>{let a,d=!1;const h=async()=>{d||(d=!0,await s?.())},l=p=>!!(o&&!this.state.matches.some(m=>m.id===p));!this.isServer&&this.state.matches.some(p=>p._forcePending)&&h();const u=(p,m)=>{var v,g,w;if(st(m)||rt(m)){if(st(m)&&m.redirectHandled&&!m.options.reloadDocument)throw m;if((v=p.beforeLoadPromise)==null||v.resolve(),(g=p.loaderPromise)==null||g.resolve(),i(p.id,P=>({...P,status:st(m)?"redirected":rt(m)?"notFound":"error",isFetching:!1,error:m,beforeLoadPromise:void 0,loaderPromise:void 0})),m.routeId||(m.routeId=p.routeId),(w=p.loadPromise)==null||w.resolve(),st(m))throw d=!0,m.options._fromLocation=e,m.redirectHandled=!0,m=this.resolveRedirect(m),m;if(rt(m))throw this._handleNotFound(r,m,{updateMatch:i}),m}},f=p=>{const m=this.getMatch(p);return!!(!this.isServer&&m._dehydrated||this.isServer&&m.ssr===!1)};try{await new Promise((p,m)=>{(async()=>{var v,g,w,P;try{const _=(R,x,M)=>{var y,L;const{id:C,routeId:T}=r[R],O=this.looseRoutesById[T];if(x instanceof Promise)throw x;x.routerCode=M,a=a??R,u(this.getMatch(C),x);try{(L=(y=O.options).onError)==null||L.call(y,x)}catch(H){x=H,u(this.getMatch(C),x)}i(C,H=>{var b,A;return(b=H.beforeLoadPromise)==null||b.resolve(),(A=H.loadPromise)==null||A.resolve(),{...H,error:x,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController,beforeLoadPromise:void 0}})};for(const[R,{id:x,routeId:M}]of r.entries()){const y=this.getMatch(x),L=(v=r[R-1])==null?void 0:v.id,C=L?this.getMatch(L):void 0,T=this.looseRoutesById[M],O=T.options.pendingMs??this.options.defaultPendingMs;if(this.isServer){let E;if(this.isShell())E=x===ot;else{const V=this.options.defaultSsr??!0;if(C?.ssr===!1)E=!1;else{let J;if(T.options.ssr===void 0)J=V;else if(typeof T.options.ssr=="function"){let Y=function(F,k){return k?{status:"error",error:k}:{status:"success",value:F}};const{search:Q,params:tt}=this.getMatch(x),G={search:Y(Q,y.searchError),params:Y(tt,y.paramsError),location:e,matches:r.map(F=>({index:F.index,pathname:F.pathname,fullPath:F.fullPath,staticData:F.staticData,id:F.id,routeId:F.routeId,search:Y(F.search,F.searchError),params:Y(F.params,F.paramsError),ssr:F.ssr}))};J=await T.options.ssr(G)??V}else J=T.options.ssr;J===!0&&C?.ssr==="data-only"?E="data-only":E=J}}i(x,V=>({...V,ssr:E}))}if(f(x))continue;const H=!!(s&&!this.isServer&&!l(x)&&(T.options.loader||T.options.beforeLoad||ze(T))&&typeof O=="number"&&O!==1/0&&(T.options.pendingComponent??((g=this.options)==null?void 0:g.defaultPendingComponent)));let b=!0;const A=()=>{if(H&&this.getMatch(x).pendingTimeout===void 0){const E=setTimeout(()=>{try{h()}catch{}},O);i(x,V=>({...V,pendingTimeout:E}))}};if(y.beforeLoadPromise||y.loaderPromise){A(),await y.beforeLoadPromise;const E=this.getMatch(x);E.status==="error"?b=!0:E.preload&&(E.status==="redirected"||E.status==="notFound")&&u(E,E.error)}if(b){try{i(x,j=>{const U=j.loadPromise;return{...j,loadPromise:Rt(()=>{U?.resolve()}),beforeLoadPromise:Rt()}});const{paramsError:E,searchError:V}=this.getMatch(x);E&&_(R,E,"PARSE_PARAMS"),V&&_(R,V,"VALIDATE_SEARCH"),A();const J=new AbortController,Y=C?.context??this.options.context??{};i(x,j=>({...j,isFetching:"beforeLoad",fetchCount:j.fetchCount+1,abortController:J,context:{...Y,...j.__routeContext}}));const{search:Q,params:tt,context:G,cause:F}=this.getMatch(x),k=l(x),K={search:Q,abortController:J,params:tt,preload:k,context:G,location:e,navigate:j=>this.navigate({...j,_fromLocation:e}),buildLocation:this.buildLocation,cause:k?"preload":F,matches:r},W=await((P=(w=T.options).beforeLoad)==null?void 0:P.call(w,K));(st(W)||rt(W))&&_(R,W,"BEFORE_LOAD"),i(x,j=>({...j,__beforeLoadContext:W,context:{...Y,...j.__routeContext,...W},abortController:J}))}catch(E){_(R,E,"BEFORE_LOAD")}i(x,E=>{var V;return(V=E.beforeLoadPromise)==null||V.resolve(),{...E,beforeLoadPromise:void 0,isFetching:!1}})}}const $=r.slice(0,a),I=[];$.forEach(({id:R,routeId:x},M)=>{I.push((async()=>{let y=!1,L=!1;const C=this.looseRoutesById[x],T=async()=>{var b,A,E,V,J,Y;const Q=this.getMatch(R);if(!Q)return;const tt={matches:r,match:Q,params:Q.params,loaderData:Q.loaderData},G=await((A=(b=C.options).head)==null?void 0:A.call(b,tt)),F=G?.meta,k=G?.links,K=G?.scripts,W=G?.styles,j=await((V=(E=C.options).scripts)==null?void 0:V.call(E,tt)),U=await((Y=(J=C.options).headers)==null?void 0:Y.call(J,tt));return{meta:F,links:k,headScripts:K,headers:U,scripts:j,styles:W}},O=async()=>{const b=this.getMatch(R);b.minPendingPromise&&await b.minPendingPromise},H=this.getMatch(R);if(f(R)){if(this.isServer){const b=await T();return i(R,A=>({...A,...b})),this.getMatch(R)}}else if(H.loaderPromise){if(H.status==="success"&&!c&&!H.preload)return this.getMatch(R);await H.loaderPromise;const b=this.getMatch(R);b.error&&u(b,b.error)}else{const b=I[M-1],A=()=>{const{params:k,loaderDeps:K,abortController:W,context:j,cause:U}=this.getMatch(R),q=l(R);return{params:k,deps:K,preload:!!q,parentMatchPromise:b,abortController:W,context:j,location:e,navigate:et=>this.navigate({...et,_fromLocation:e}),cause:q?"preload":U,route:C}},E=Date.now()-this.getMatch(R).updatedAt,V=l(R),J=V?C.options.preloadStaleTime??this.options.defaultPreloadStaleTime??3e4:C.options.staleTime??this.options.defaultStaleTime??0,Y=C.options.shouldReload,Q=typeof Y=="function"?Y(A()):Y;i(R,k=>({...k,loaderPromise:Rt(),preload:!!V&&!this.state.matches.some(K=>K.id===R)}));const tt=async()=>{var k,K,W,j;try{try{(!this.isServer||this.isServer&&this.getMatch(R).ssr===!0)&&this.loadRouteChunk(C),i(R,et=>({...et,isFetching:"loader"}));const U=await((K=(k=C.options).loader)==null?void 0:K.call(k,A()));u(this.getMatch(R),U),i(R,et=>({...et,loaderData:U})),await C._lazyPromise;const q=await T();await O(),await C._componentsPromise,i(R,et=>({...et,error:void 0,status:"success",isFetching:!1,updatedAt:Date.now(),...q}))}catch(U){let q=U;await O(),u(this.getMatch(R),U);try{(j=(W=C.options).onError)==null||j.call(W,U)}catch(_t){q=_t,u(this.getMatch(R),_t)}const et=await T();i(R,_t=>({..._t,error:q,status:"error",isFetching:!1,...et}))}}catch(U){const q=await T();i(R,et=>({...et,loaderPromise:void 0,...q})),u(this.getMatch(R),U)}},{status:G,invalid:F}=this.getMatch(R);if(y=G==="success"&&(F||(Q??E>J)),!(V&&C.options.preload===!1))if(y&&!c)L=!0,(async()=>{try{await tt();const{loaderPromise:k,loadPromise:K}=this.getMatch(R);k?.resolve(),K?.resolve(),i(R,W=>({...W,loaderPromise:void 0}))}catch(k){st(k)&&await this.navigate(k.options)}})();else if(G!=="success"||y&&c)await tt();else{const k=await T();i(R,K=>({...K,...k}))}}if(!L){const{loaderPromise:b,loadPromise:A}=this.getMatch(R);b?.resolve(),A?.resolve()}return i(R,b=>(clearTimeout(b.pendingTimeout),{...b,isFetching:L?b.isFetching:!1,loaderPromise:L?b.loaderPromise:void 0,invalid:!1,pendingTimeout:void 0,_dehydrated:void 0})),this.getMatch(R)})())}),await Promise.all(I),p()}catch(_){m(_)}})()}),await h()}catch(p){if(st(p)||rt(p))throw rt(p)&&!o&&await h(),p}return r},this.invalidate=e=>{const r=o=>{var s;return((s=e?.filter)==null?void 0:s.call(e,o))??!0?{...o,invalid:!0,...e?.forcePending||o.status==="error"?{status:"pending",error:void 0}:{}}:o};return this.__store.setState(o=>{var s;return{...o,matches:o.matches.map(r),cachedMatches:o.cachedMatches.map(r),pendingMatches:(s=o.pendingMatches)==null?void 0:s.map(r)}}),this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.resolveRedirect=e=>(e.options.href||(e.options.href=this.buildLocation(e.options).href,e.headers.set("Location",e.options.href)),e.headers.get("Location")||e.headers.set("Location",e.options.href),e),this.clearCache=e=>{const r=e?.filter;r!==void 0?this.__store.setState(o=>({...o,cachedMatches:o.cachedMatches.filter(s=>!r(s))})):this.__store.setState(o=>({...o,cachedMatches:[]}))},this.clearExpiredCache=()=>{const e=r=>{const o=this.looseRoutesById[r.routeId];if(!o.options.loader)return!0;const s=(r.preload?o.options.preloadGcTime??this.options.defaultPreloadGcTime:o.options.gcTime??this.options.defaultGcTime)??300*1e3;return r.status==="error"?!0:Date.now()-r.updatedAt>=s};this.clearCache({filter:e})},this.loadRouteChunk=e=>(e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(r=>{const{id:o,...s}=r.options;Object.assign(e.options,s)}):e._lazyPromise=Promise.resolve()),e._componentsPromise===void 0&&(e._componentsPromise=e._lazyPromise.then(()=>Promise.all(cn.map(async r=>{const o=e.options[r];o?.preload&&await o.preload()})))),e._componentsPromise),this.preloadRoute=async e=>{const r=this.buildLocation(e);let o=this.matchRoutes(r,{throwOnError:!0,preload:!0,dest:e});const s=new Set([...this.state.matches,...this.state.pendingMatches??[]].map(c=>c.id)),i=new Set([...s,...this.state.cachedMatches.map(c=>c.id)]);Fe(()=>{o.forEach(c=>{i.has(c.id)||this.__store.setState(a=>({...a,cachedMatches:[...a.cachedMatches,c]}))})});try{return o=await this.loadMatches({matches:o,location:r,preload:!0,updateMatch:(c,a)=>{s.has(c)?o=o.map(d=>d.id===c?a(d):d):this.updateMatch(c,a)}}),o}catch(c){if(st(c))return c.options.reloadDocument?void 0:await this.preloadRoute({...c.options,_fromLocation:r});rt(c)||console.error(c);return}},this.matchRoute=(e,r)=>{const o={...e,to:e.to?this.resolvePathWithBase(e.from||"",e.to):void 0,params:e.params||{},leaveParams:!0},s=this.buildLocation(o);if(r?.pending&&this.state.status!=="pending")return!1;const c=(r?.pending===void 0?!this.state.isLoading:r.pending)?this.latestLocation:this.state.resolvedLocation||this.state.location,a=ye(this.basepath,c.pathname,{...r,to:s.pathname},this.parsePathnameCache);return!a||e.params&&!vt(a,e.params,{partial:!0})?!1:a&&(r?.includeSearch??!0)?vt(c.search,s.search,{partial:!0})?a:!1:a},this._handleNotFound=(e,r,{updateMatch:o=this.updateMatch}={})=>{var s;const i=this.routesById[r.routeId??""]??this.routeTree,c={};for(const d of e)c[d.routeId]=d;!i.options.notFoundComponent&&((s=this.options)!=null&&s.defaultNotFoundComponent)&&(i.options.notFoundComponent=this.options.defaultNotFoundComponent),dt(i.options.notFoundComponent);const a=c[i.id];dt(a,"Could not find match for route: "+i.id),o(a.id,d=>({...d,status:"notFound",error:r,isFetching:!1})),r.routerCode==="BEFORE_LOAD"&&i.parentRoute&&(r.routeId=i.parentRoute.id,this._handleNotFound(e,r,{updateMatch:o}))},this.hasNotFoundMatch=()=>this.__store.state.matches.some(e=>e.status==="notFound"||e.globalNotFound),this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...n,caseSensitive:n.caseSensitive??!1,notFoundMode:n.notFoundMode??"fuzzy",stringifySearch:n.stringifySearch??Jn,parseSearch:n.parseSearch??qn}),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(n,e){var r;const{foundRoute:o,matchedRoutes:s,routeParams:i}=this.getMatchedRoutes(n.pathname,(r=e?.dest)==null?void 0:r.to);let c=!1;(o?o.path!=="/"&&i["**"]:Lt(n.pathname))&&(this.options.notFoundRoute?s.push(this.options.notFoundRoute):c=!0);const a=(()=>{if(c){if(this.options.notFoundMode!=="root")for(let u=s.length-1;u>=0;u--){const f=s[u];if(f.children)return f.id}return ot}})(),d=s.map(u=>{var f;let p;const m=((f=u.options.params)==null?void 0:f.parse)??u.options.parseParams;if(m)try{const v=m(i);Object.assign(i,v)}catch(v){if(p=new nr(v.message,{cause:v}),e?.throwOnError)throw p;return p}}),h=[],l=u=>u?.id?u.context??this.options.context??{}:this.options.context??{};return s.forEach((u,f)=>{var p,m;const v=h[f-1],[g,w,P]=(()=>{const O=v?.search??n.search,H=v?._strictSearch??{};try{const b=Se(u.options.validateSearch,{...O})??{};return[{...O,...b},{...H,...b},void 0]}catch(b){let A=b;if(b instanceof Yt||(A=new Yt(b.message,{cause:b})),e?.throwOnError)throw A;return[O,{},A]}})(),_=((m=(p=u.options).loaderDeps)==null?void 0:m.call(p,{search:g}))??"",$=_?JSON.stringify(_):"",{usedParams:I,interpolatedPath:R}=Dt({path:u.fullPath,params:i,decodeCharMap:this.pathParamsDecodeCharMap}),x=Dt({path:u.id,params:i,leaveWildcards:!0,decodeCharMap:this.pathParamsDecodeCharMap,parseCache:this.parsePathnameCache}).interpolatedPath+$,M=this.getMatch(x),y=this.state.matches.find(O=>O.routeId===u.id),L=y?"stay":"enter";let C;if(M)C={...M,cause:L,params:y?nt(y.params,i):i,_strictParams:I,search:nt(y?y.search:M.search,g),_strictSearch:w};else{const O=u.options.loader||u.options.beforeLoad||u.lazyFn||ze(u)?"pending":"success";C={id:x,index:f,routeId:u.id,params:y?nt(y.params,i):i,_strictParams:I,pathname:lt([this.basepath,R]),updatedAt:Date.now(),search:y?nt(y.search,g):g,_strictSearch:w,searchError:void 0,status:O,isFetching:!1,error:void 0,paramsError:d[f],__routeContext:{},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:L,loaderDeps:y?nt(y.loaderDeps,_):_,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:u.options.staticData||{},loadPromise:Rt(),fullPath:u.fullPath}}e?.preload||(C.globalNotFound=a===u.id),C.searchError=P;const T=l(v);C.context={...T,...C.__routeContext,...C.__beforeLoadContext},h.push(C)}),h.forEach((u,f)=>{var p,m;const v=this.looseRoutesById[u.routeId];if(!this.getMatch(u.id)&&e?._buildLocation!==!0){const w=h[f-1],P=l(w),_={deps:u.loaderDeps,params:u.params,context:P,location:n,navigate:$=>this.navigate({...$,_fromLocation:n}),buildLocation:this.buildLocation,cause:u.cause,abortController:u.abortController,preload:!!u.preload,matches:h};u.__routeContext=((m=(p=v.options).context)==null?void 0:m.call(p,_))??{},u.context={...P,...u.__routeContext,...u.__beforeLoadContext}}}),h}}class Yt extends Error{}class nr extends Error{}const Ve=t=>t.endsWith("/")&&t.length>1?t.slice(0,-1):t;function We(t,n){return Ve(t)===Ve(n)}function xo(t,n){return async(...e)=>(await t())[n||"default"](...e)}function rr(t){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:t,matches:[],pendingMatches:[],cachedMatches:[],statusCode:200}}function Se(t,n){if(t==null)return{};if("~standard"in t){const e=t["~standard"].validate(n);if(e instanceof Promise)throw new Yt("Async validation not supported");if(e.issues)throw new Yt(JSON.stringify(e.issues,void 0,2),{cause:e});return e.value}return"parse"in t?t.parse(n):typeof t=="function"?t(n):{}}const cn=["component","errorComponent","pendingComponent","notFoundComponent"];function ze(t){var n;for(const e of cn)if((n=t.options[e])!=null&&n.preload)return!0;return!1}const or=.5,sr=.4,ir=.25;function Ke(t,n){return t.prefixSegment&&t.suffixSegment?n+.05:t.prefixSegment?n+.02:t.suffixSegment?n+.01:n}function ar({routeTree:t,initRoute:n}){const e={},r={},o=a=>{a.forEach((d,h)=>{n?.(d,h);const l=e[d.id];if(dt(!l,`Duplicate routes found with id: ${String(d.id)}`),e[d.id]=d,!d.isRoot&&d.path){const f=Lt(d.fullPath);(!r[f]||d.fullPath.endsWith("/"))&&(r[f]=d)}const u=d.children;u?.length&&o(u)})};o([t]);const s=[];Object.values(e).forEach((a,d)=>{var h;if(a.isRoot||!a.path)return;const l=Ce(a.fullPath);let u=Mt(l),f=0;for(;u.length>f+1&&((h=u[f])==null?void 0:h.value)==="/";)f++;f>0&&(u=u.slice(f));let p=0,m=!1;const v=u.map((g,w)=>{if(g.value==="/")return .75;let P;if(g.type===yt?P=or:g.type===bt?(P=sr,p++):g.type===St&&(P=ir),P){for(let _=w+1;_<u.length;_++){const $=u[_];if($.type===ct&&$.value!=="/")return m=!0,Ke(g,P+.2)}return Ke(g,P)}return 1});s.push({child:a,trimmed:l,parsed:u,index:d,scores:v,optionalParamCount:p,hasStaticAfter:m})});const c=s.sort((a,d)=>{const h=Math.min(a.scores.leng