|
|
*/function V(){return V=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},V.apply(this,arguments)}var J;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(J||(J={}));const Gt="popstate";function nn(e){e===void 0&&(e={});function t(n,a){let{pathname:l,search:o,hash:d}=n.location;return Ze("",{pathname:l,search:o,hash:d},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}function r(n,a){return typeof a=="string"?a:Le(a)}return on(t,r,null,e)}function U(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Ne(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function an(){return Math.random().toString(36).substr(2,8)}function Xt(e,t){return{usr:e.state,key:e.key,idx:t}}function Ze(e,t,r,n){return r===void 0&&(r=null),V({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?he(t):t,{state:r,key:t&&t.key||n||an()})}function Le(e){let{pathname:t="/",search:r="",hash:n=""}=e;return r&&r!=="?"&&(t+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}function he(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}function on(e,t,r,n){n===void 0&&(n={});let{window:a=document.defaultView,v5Compat:l=!1}=n,o=a.history,d=J.Pop,u=null,f=h();f==null&&(f=0,o.replaceState(V({},o.state,{idx:f}),""));function h(){return(o.state||{idx:null}).idx}function p(){d=J.Pop;let R=h(),j=R==null?null:R-f;f=R,u&&u({action:d,location:x.location,delta:j})}function y(R,j){d=J.Push;let M=Ze(x.location,R,j);f=h()+1;let I=Xt(M,f),k=x.createHref(M);try{o.pushState(I,"",k)}catch(X){if(X instanceof DOMException&&X.name==="DataCloneError")throw X;a.location.assign(k)}l&&u&&u({action:d,location:x.location,delta:1})}function b(R,j){d=J.Replace;let M=Ze(x.location,R,j);f=h();let I=Xt(M,f),k=x.createHref(M);o.replaceState(I,"",k),l&&u&&u({action:d,location:x.location,delta:0})}function S(R){let j=a.location.origin!=="null"?a.location.origin:a.location.href,M=typeof R=="string"?R:Le(R);return M=M.replace(/ $/,"%20"),U(j,"No window.location.(origin|href) available to create URL for href: "+M),new URL(M,j)}let x={get action(){return d},get location(){return e(a,o)},listen(R){if(u)throw new Error("A history only accepts one active listener");return a.addEventListener(Gt,p),u=R,()=>{a.removeEventListener(Gt,p),u=null}},createHref(R){return t(a,R)},createURL:S,encodeLocation(R){let j=S(R);return{pathname:j.pathname,search:j.search,hash:j.hash}},push:y,replace:b,go(R){return o.go(R)}};return x}var z;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(z||(z={}));const ln=new Set(["lazy","caseSensitive","path","id","index","children"]);function sn(e){return e.index===!0}function pt(e,t,r,n){return r===void 0&&(r=[]),n===void 0&&(n={}),e.map((a,l)=>{let o=[...r,String(l)],d=typeof a.id=="string"?a.id:o.join("-");if(U(a.index!==!0||!a.children,"Cannot specify children on an index route"),U(!n[d],'Found a route id collision on id "'+d+`". Route id's must be globally unique within Data Router usages`),sn(a)){let u=V({},a,t(a),{id:d});return n[d]=u,u}else{let u=V({},a,t(a),{id:d,children:void 0});return n[d]=u,a.children&&(u.children=pt(a.children,t,o,n)),u}})}function xe(e,t,r){return r===void 0&&(r="/"),ht(e,t,r,!1)}function ht(e,t,r,n){let a=typeof t=="string"?he(t):t,l=Ae(a.pathname||"/",r);if(l==null)return null;let o=vr(e);dn(o);let d=null;for(let u=0;d==null&&u<o.length;++u){let f=Rn(l);d=bn(o[u],f,n)}return d}function un(e,t){let{route:r,pathname:n,params:a}=e;return{id:r.id,pathname:n,params:a,data:t[r.id],handle:r.handle}}function vr(e,t,r,n){t===void 0&&(t=[]),r===void 0&&(r=[]),n===void 0&&(n="");let a=(l,o,d)=>{let u={relativePath:d===void 0?l.path||"":d,caseSensitive:l.caseSensitive===!0,childrenIndex:o,route:l};u.relativePath.startsWith("/")&&(U(u.relativePath.startsWith(n),'Absolute route path "'+u.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),u.relativePath=u.relativePath.slice(n.length));let f=fe([n,u.relativePath]),h=r.concat(u);l.children&&l.children.length>0&&(U(l.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+f+'".')),vr(l.children,t,h,f)),!(l.path==null&&!l.index)&&t.push({path:f,score:vn(f,l.index),routesMeta:h})};return e.forEach((l,o)=>{var d;if(l.path===""||!((d=l.path)!=null&&d.includes("?")))a(l,o);else for(let u of yr(l.path))a(l,o,u)}),t}function yr(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,a=r.endsWith("?"),l=r.replace(/\?$/,"");if(n.length===0)return a?[l,""]:[l];let o=yr(n.join("/")),d=[];return d.push(...o.map(u=>u===""?l:[l,u].join("/"))),a&&d.push(...o),d.map(u=>e.startsWith("/")&&u===""?"/":u)}function dn(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:yn(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const cn=/^:[\w-]+$/,fn=3,hn=2,pn=1,mn=10,gn=-2,Qt=e=>e==="*";function vn(e,t){let r=e.split("/"),n=r.length;return r.some(Qt)&&(n+=gn),t&&(n+=hn),r.filter(a=>!Qt(a)).reduce((a,l)=>a+(cn.test(l)?fn:l===""?pn:mn),n)}function yn(e,t){return e.length===t.length&&e.slice(0,-1).every((n,a)=>n===t[a])?e[e.length-1]-t[t.length-1]:0}function bn(e,t,r){r===void 0&&(r=!1);let{routesMeta:n}=e,a={},l="/",o=[];for(let d=0;d<n.length;++d){let u=n[d],f=d===n.length-1,h=l==="/"?t:t.slice(l.length)||"/",p=qe({path:u.relativePath,caseSensitive:u.caseSensitive,end:f},h),y=u.route;if(!p&&f&&r&&!n[n.length-1].route.index&&(p=qe({path:u.relativePath,caseSensitive:u.caseSensitive,end:!1},h)),!p)return null;Object.assign(a,p.params),o.push({params:a,pathname:fe([l,p.pathname]),pathnameBase:xn(fe([l,p.pathnameBase])),route:y}),p.pathnameBase!=="/"&&(l=fe([l,p.pathnameBase]))}return o}function qe(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=wn(e.path,e.caseSensitive,e.end),a=t.match(r);if(!a)return null;let l=a[0],o=l.replace(/(.)\/+$/,"$1"),d=a.slice(1);return{params:n.reduce((f,h,p)=>{let{paramName:y,isOptional:b}=h;if(y==="*"){let x=d[p]||"";o=l.slice(0,l.length-x.length).replace(/(.)\/+$/,"$1")}const S=d[p];return b&&!S?f[y]=void 0:f[y]=(S||"").replace(/%2F/g,"/"),f},{}),pathname:l,pathnameBase:o,pattern:e}}function wn(e,t,r){t===void 0&&(t=!1),r===void 0&&(r=!0),Ne(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let n=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,d,u)=>(n.push({paramName:d,isOptional:u!=null}),u?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(n.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),n]}function Rn(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Ne(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function Ae(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}function En(e,t){t===void 0&&(t="/");let{pathname:r,search:n="",hash:a=""}=typeof e=="string"?he(e):e;return{pathname:r?r.startsWith("/")?r:Sn(r,t):t,search:Pn(n),hash:Dn(a)}}function Sn(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?r.length>1&&r.pop():a!=="."&&r.push(a)}),r.length>1?r.join("/"):"/"}function xt(e,t,r,n){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function br(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function Ft(e,t){let r=br(e);return t?r.map((n,a)=>a===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function _t(e,t,r,n){n===void 0&&(n=!1);let a;typeof e=="string"?a=he(e):(a=V({},e),U(!a.pathname||!a.pathname.includes("?"),xt("?","pathname","search",a)),U(!a.pathname||!a.pathname.includes("#"),xt("#","pathname","hash",a)),U(!a.search||!a.search.includes("#"),xt("#","search","hash",a)));let l=e===""||a.pathname==="",o=l?"/":a.pathname,d;if(o==null)d=r;else{let p=t.length-1;if(!n&&o.startsWith("..")){let y=o.split("/");for(;y[0]==="..";)y.shift(),p-=1;a.pathname=y.join("/")}d=p>=0?t[p]:"/"}let u=En(a,d),f=o&&o!=="/"&&o.endsWith("/"),h=(l||o===".")&&r.endsWith("/");return!u.pathname.endsWith("/")&&(f||h)&&(u.pathname+="/"),u}const fe=e=>e.join("/").replace(/\/\/+/g,"/"),xn=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Pn=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Dn=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;class mt{constructor(t,r,n,a){a===void 0&&(a=!1),this.status=t,this.statusText=r||"",this.internal=a,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}}function vt(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const wr=["post","put","patch","delete"],Ln=new Set(wr),Cn=["get",...wr],Mn=new Set(Cn),Tn=new Set([301,302,303,307,308]),Un=new Set([307,308]),Pt={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Fn={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Je={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},Ot=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,_n=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),Rr="remix-router-transitions";function On(e){const t=e.window?e.window:typeof window<"u"?window:void 0,r=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u",n=!r;U(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let a;if(e.mapRouteProperties)a=e.mapRouteProperties;else if(e.detectErrorBoundary){let i=e.detectErrorBoundary;a=s=>({hasErrorBoundary:i(s)})}else a=_n;let l={},o=pt(e.routes,a,void 0,l),d,u=e.basename||"/",f=e.dataStrategy||Nn,h=e.patchRoutesOnNavigation,p=V({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,v7_skipActionErrorRevalidation:!1},e.future),y=null,b=new Set,S=null,x=null,R=null,j=e.hydrationData!=null,M=xe(o,e.history.location,u),I=null;if(M==null&&!h){let i=ae(404,{pathname:e.history.location.pathname}),{matches:s,route:c}=sr(o);M=s,I={[c.id]:i}}M&&!e.hydrationData&&st(M,o,e.history.location.pathname).active&&(M=null);let k;if(M)if(M.some(i=>i.route.lazy))k=!1;else if(!M.some(i=>i.route.loader))k=!0;else if(p.v7_partialHydration){let i=e.hydrationData?e.hydrationData.loaderData:null,s=e.hydrationData?e.hydrationData.errors:null;if(s){let c=M.findIndex(g=>s[g.route.id]!==void 0);k=M.slice(0,c+1).every(g=>!Ct(g.route,i,s))}else k=M.every(c=>!Ct(c.route,i,s))}else k=e.hydrationData!=null;else if(k=!1,M=[],p.v7_partialHydration){let i=st(null,o,e.history.location.pathname);i.active&&i.matches&&(M=i.matches)}let X,m={historyAction:e.history.action,location:e.history.location,matches:M,initialized:k,navigation:Pt,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||I,fetchers:new Map,blockers:new Map},ee=J.Pop,F=!1,O,$=!1,te=new Map,Q=null,ne=!1,Z=!1,Me=[],nt=new Set,G=new Map,at=0,ke=-1,Te=new Map,ue=new Set,Ue=new Map,He=new Map,oe=new Set,be=new Map,we=new Map,it;function Ir(){if(y=e.history.listen(i=>{let{action:s,location:c,delta:g}=i;if(it){it(),it=void 0;return}Ne(we.size===0||g!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let w=Wt({currentLocation:m.location,nextLocation:c,historyAction:s});if(w&&g!=null){let L=new Promise(T=>{it=T});e.history.go(g*-1),lt(w,{state:"blocked",location:c,proceed(){lt(w,{state:"proceeding",proceed:void 0,reset:void 0,location:c}),L.then(()=>e.history.go(g))},reset(){let T=new Map(m.blockers);T.set(w,Je),re({blockers:T})}});return}return Re(s,c)}),r){Zn(t,te);let i=()=>qn(t,te);t.addEventListener("pagehide",i),Q=()=>t.removeEventListener("pagehide",i)}return m.initialized||Re(J.Pop,m.location,{initialHydration:!0}),X}function Nr(){y&&y(),Q&&Q(),b.clear(),O&&O.abort(),m.fetchers.forEach((i,s)=>ot(s)),m.blockers.forEach((i,s)=>Vt(s))}function Ar(i){return b.add(i),()=>b.delete(i)}function re(i,s){s===void 0&&(s={}),m=V({},m,i);let c=[],g=[];p.v7_fetcherPersist&&m.fetchers.forEach((w,L)=>{w.state==="idle"&&(oe.has(L)?g.push(L):c.push(L))}),oe.forEach(w=>{!m.fetchers.has(w)&&!G.has(w)&&g.push(w)}),[...b].forEach(w=>w(m,{deletedFetchers:g,viewTransitionOpts:s.viewTransitionOpts,flushSync:s.flushSync===!0})),p.v7_fetcherPersist?(c.forEach(w=>m.fetchers.delete(w)),g.forEach(w=>ot(w))):g.forEach(w=>oe.delete(w))}function Fe(i,s,c){var g,w;let{flushSync:L}=c===void 0?{}:c,T=m.actionData!=null&&m.navigation.formMethod!=null&&le(m.navigation.formMethod)&&m.navigation.state==="loading"&&((g=i.state)==null?void 0:g._isRedirect)!==!0,P;s.actionData?Object.keys(s.actionData).length>0?P=s.actionData:P=null:T?P=m.actionData:P=null;let D=s.loaderData?or(m.loaderData,s.loaderData,s.matches||[],s.errors):m.loaderData,E=m.blockers;E.size>0&&(E=new Map(E),E.forEach((B,q)=>E.set(q,Je)));let C=F===!0||m.navigation.formMethod!=null&&le(m.navigation.formMethod)&&((w=i.state)==null?void 0:w._isRedirect)!==!0;d&&(o=d,d=void 0),ne||ee===J.Pop||(ee===J.Push?e.history.push(i,i.state):ee===J.Replace&&e.history.replace(i,i.state));let _;if(ee===J.Pop){let B=te.get(m.location.pathname);B&&B.has(i.pathname)?_={currentLocation:m.location,nextLocation:i}:te.has(i.pathname)&&(_={currentLocation:i,nextLocation:m.location})}else if($){let B=te.get(m.location.pathname);B?B.add(i.pathname):(B=new Set([i.pathname]),te.set(m.location.pathname,B)),_={currentLocation:m.location,nextLocation:i}}re(V({},s,{actionData:P,loaderData:D,historyAction:ee,location:i,initialized:!0,navigation:Pt,revalidation:"idle",restoreScrollPosition:Jt(i,s.matches||m.matches),preventScrollReset:C,blockers:E}),{viewTransitionOpts:_,flushSync:L===!0}),ee=J.Pop,F=!1,$=!1,ne=!1,Z=!1,Me=[]}async function It(i,s){if(typeof i=="number"){e.history.go(i);return}let c=Lt(m.location,m.matches,u,p.v7_prependBasename,i,p.v7_relativeSplatPath,s==null?void 0:s.fromRouteId,s==null?void 0:s.relative),{path:g,submission:w,error:L}=Zt(p.v7_normalizeFormMethod,!1,c,s),T=m.location,P=Ze(m.location,g,s&&s.state);P=V({},P,e.history.encodeLocation(P));let D=s&&s.replace!=null?s.replace:void 0,E=J.Push;D===!0?E=J.Replace:D===!1||w!=null&&le(w.formMethod)&&w.formAction===m.location.pathname+m.location.search&&(E=J.Replace);let C=s&&"preventScrollReset"in s?s.preventScrollReset===!0:void 0,_=(s&&s.flushSync)===!0,B=Wt({currentLocation:T,nextLocation:P,historyAction:E});if(B){lt(B,{state:"blocked",location:P,proceed(){lt(B,{state:"proceeding",proceed:void 0,reset:void 0,location:P}),It(i,s)},reset(){let q=new Map(m.blockers);q.set(B,Je),re({blockers:q})}});return}return await Re(E,P,{submission:w,pendingError:L,preventScrollReset:C,replace:s&&s.replace,enableViewTransition:s&&s.viewTransition,flushSync:_})}function zr(){if(wt(),re({revalidation:"loading"}),m.navigation.state!=="submitting"){if(m.navigation.state==="idle"){Re(m.historyAction,m.location,{startUninterruptedRevalidation:!0});return}Re(ee||m.historyAction,m.navigation.location,{overrideNavigation:m.navigation,enableViewTransition:$===!0})}}async function Re(i,s,c){O&&O.abort(),O=null,ee=i,ne=(c&&c.startUninterruptedRevalidation)===!0,Xr(m.location,m.matches),F=(c&&c.preventScrollReset)===!0,$=(c&&c.enableViewTransition)===!0;let g=d||o,w=c&&c.overrideNavigation,L=xe(g,s,u),T=(c&&c.flushSync)===!0,P=st(L,g,s.pathname);if(P.active&&P.matches&&(L=P.matches),!L){let{error:H,notFoundMatches:A,route:W}=Rt(s.pathname);Fe(s,{matches:A,loaderData:{},errors:{[W.id]:H}},{flushSync:T});return}if(m.initialized&&!Z&&Vn(m.location,s)&&!(c&&c.submission&&le(c.submission.formMethod))){Fe(s,{matches:L},{flushSync:T});return}O=new AbortController;let D=Be(e.history,s,O.signal,c&&c.submission),E;if(c&&c.pendingError)E=[Pe(L).route.id,{type:z.error,error:c.pendingError}];else if(c&&c.submission&&le(c.submission.formMethod)){let H=await kr(D,s,c.submission,L,P.active,{replace:c.replace,flushSync:T});if(H.shortCircuited)return;if(H.pendingActionResult){let[A,W]=H.pendingActionResult;if(ie(W)&&vt(W.error)&&W.error.status===404){O=null,Fe(s,{matches:H.matches,loaderData:{},errors:{[A]:W.error}});return}}L=H.matches||L,E=H.pendingActionResult,w=Dt(s,c.submission),T=!1,P.active=!1,D=Be(e.history,D.url,D.signal)}let{shortCircuited:C,matches:_,loaderData:B,errors:q}=await Hr(D,s,L,P.active,w,c&&c.submission,c&&c.fetcherSubmission,c&&c.replace,c&&c.initialHydration===!0,T,E);C||(O=null,Fe(s,V({matches:_||L},lr(E),{loaderData:B,errors:q})))}async function kr(i,s,c,g,w,L){L===void 0&&(L={}),wt();let T=Xn(s,c);if(re({navigation:T},{flushSync:L.flushSync===!0}),w){let E=await ut(g,s.pathname,i.signal);if(E.type==="aborted")return{shortCircuited:!0};if(E.type==="error"){let C=Pe(E.partialMatches).route.id;return{matches:E.partialMatches,pendingActionResult:[C,{type:z.error,error:E.error}]}}else if(E.matches)g=E.matches;else{let{notFoundMatches:C,error:_,route:B}=Rt(s.pathname);return{matches:C,pendingActionResult:[B.id,{type:z.error,error:_}]}}}let P,D=Xe(g,s);if(!D.route.action&&!D.route.lazy)P={type:z.error,error:ae(405,{method:i.method,pathname:s.pathname,routeId:D.route.id})};else if(P=(await $e("action",m,i,[D],g,null))[D.route.id],i.signal.aborted)return{shortCircuited:!0};if(De(P)){let E;return L&&L.replace!=null?E=L.replace:E=nr(P.response.headers.get("Location"),new URL(i.url),u)===m.location.pathname+m.location.search,await Ee(i,P,!0,{submission:c,replace:E}),{shortCircuited:!0}}if(ve(P))throw ae(400,{type:"defer-action"});if(ie(P)){let E=Pe(g,D.route.id);return(L&&L.replace)!==!0&&(ee=J.Push),{matches:g,pendingActionResult:[E.route.id,P]}}return{matches:g,pendingActionResult:[D.route.id,P]}}async function Hr(i,s,c,g,w,L,T,P,D,E,C){let _=w||Dt(s,L),B=L||T||dr(_),q=!ne&&(!p.v7_partialHydration||!D);if(g){if(q){let K=Nt(C);re(V({navigation:_},K!==void 0?{actionData:K}:{}),{flushSync:E})}let N=await ut(c,s.pathname,i.signal);if(N.type==="aborted")return{shortCircuited:!0};if(N.type==="error"){let K=Pe(N.partialMatches).route.id;return{matches:N.partialMatches,loaderData:{},errors:{[K]:N.error}}}else if(N.matches)c=N.matches;else{let{error:K,notFoundMatches:Oe,route:Ke}=Rt(s.pathname);return{matches:Oe,loaderData:{},errors:{[Ke.id]:K}}}}let H=d||o,[A,W]=er(e.history,m,c,B,s,p.v7_partialHydration&&D===!0,p.v7_skipActionErrorRevalidation,Z,Me,nt,oe,Ue,ue,H,u,C);if(Et(N=>!(c&&c.some(K=>K.route.id===N))||A&&A.some(K=>K.route.id===N)),ke=++at,A.length===0&&W.length===0){let N=Ht();return Fe(s,V({matches:c,loaderData:{},errors:C&&ie(C[1])?{[C[0]]:C[1].error}:null},lr(C),N?{fetchers:new Map(m.fetchers)}:{}),{flushSync:E}),{shortCircuited:!0}}if(q){let N={};if(!g){N.navigation=_;let K=Nt(C);K!==void 0&&(N.actionData=K)}W.length>0&&(N.fetchers=$r(W)),re(N,{flushSync:E})}W.forEach(N=>{me(N.key),N.controller&&G.set(N.key,N.controller)});let _e=()=>W.forEach(N=>me(N.key));O&&O.signal.addEventListener("abort",_e);let{loaderResults:Ve,fetcherResults:ce}=await At(m,c,A,W,i);if(i.signal.aborted)return{shortCircuited:!0};O&&O.signal.removeEventListener("abort",_e),W.forEach(N=>G.delete(N.key));let se=ft(Ve);if(se)return await Ee(i,se.result,!0,{replace:P}),{shortCircuited:!0};if(se=ft(ce),se)return ue.add(se.key),await Ee(i,se.result,!0,{replace:P}),{shortCircuited:!0};let{loaderData:St,errors:We}=ir(m,c,Ve,C,W,ce,be);be.forEach((N,K)=>{N.subscribe(Oe=>{(Oe||N.done)&&be.delete(K)})}),p.v7_partialHydration&&D&&m.errors&&(We=V({},m.errors,We));let Se=Ht(),dt=$t(ke),ct=Se||dt||W.length>0;return V({matches:c,loaderData:St,errors:We},ct?{fetchers:new Map(m.fetchers)}:{})}function Nt(i){if(i&&!ie(i[1]))return{[i[0]]:i[1].data};if(m.actionData)return Object.keys(m.actionData).length===0?null:m.actionData}function $r(i){return i.forEach(s=>{let c=m.fetchers.get(s.key),g=Ye(void 0,c?c.data:void 0);m.fetchers.set(s.key,g)}),new Map(m.fetchers)}function Vr(i,s,c,g){if(n)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");me(i);let w=(g&&g.flushSync)===!0,L=d||o,T=Lt(m.location,m.matches,u,p.v7_prependBasename,c,p.v7_relativeSplatPath,s,g==null?void 0:g.relative),P=xe(L,T,u),D=st(P,L,T);if(D.active&&D.matches&&(P=D.matches),!P){de(i,s,ae(404,{pathname:T}),{flushSync:w});return}let{path:E,submission:C,error:_}=Zt(p.v7_normalizeFormMethod,!0,T,g);if(_){de(i,s,_,{flushSync:w});return}let B=Xe(P,E),q=(g&&g.preventScrollReset)===!0;if(C&&le(C.formMethod)){Wr(i,s,E,B,P,D.active,w,q,C);return}Ue.set(i,{routeId:s,path:E}),Kr(i,s,E,B,P,D.active,w,q,C)}async function Wr(i,s,c,g,w,L,T,P,D){wt(),Ue.delete(i);function E(Y){if(!Y.route.action&&!Y.route.lazy){let je=ae(405,{method:D.formMethod,pathname:c,routeId:s});return de(i,s,je,{flushSync:T}),!0}return!1}if(!L&&E(g))return;let C=m.fetchers.get(i);pe(i,Qn(D,C),{flushSync:T});let _=new AbortController,B=Be(e.history,c,_.signal,D);if(L){let Y=await ut(w,c,B.signal);if(Y.type==="aborted")return;if(Y.type==="error"){de(i,s,Y.error,{flushSync:T});return}else if(Y.matches){if(w=Y.matches,g=Xe(w,c),E(g))return}else{de(i,s,ae(404,{pathname:c}),{flushSync:T});return}}G.set(i,_);let q=at,A=(await $e("action",m,B,[g],w,i))[g.route.id];if(B.signal.aborted){G.get(i)===_&&G.delete(i);return}if(p.v7_fetcherPersist&&oe.has(i)){if(De(A)||ie(A)){pe(i,ge(void 0));return}}else{if(De(A))if(G.delete(i),ke>q){pe(i,ge(void 0));return}else return ue.add(i),pe(i,Ye(D)),Ee(B,A,!1,{fetcherSubmission:D,preventScrollReset:P});if(ie(A)){de(i,s,A.error);return}}if(ve(A))throw ae(400,{type:"defer-action"});let W=m.navigation.location||m.location,_e=Be(e.history,W,_.signal),Ve=d||o,ce=m.navigation.state!=="idle"?xe(Ve,m.navigation.location,u):m.matches;U(ce,"Didn't find any matches after fetcher action");let se=++at;Te.set(i,se);let St=Ye(D,A.data);m.fetchers.set(i,St);let[We,Se]=er(e.history,m,ce,D,W,!1,p.v7_skipActionErrorRevalidation,Z,Me,nt,oe,Ue,ue,Ve,u,[g.route.id,A]);Se.filter(Y=>Y.key!==i).forEach(Y=>{let je=Y.key,Yt=m.fetchers.get(je),qr=Ye(void 0,Yt?Yt.data:void 0);m.fetchers.set(je,qr),me(je),Y.controller&&G.set(je,Y.controller)}),re({fetchers:new Map(m.fetchers)});let dt=()=>Se.forEach(Y=>me(Y.key));_.signal.addEventListener("abort",dt);let{loaderResults:ct,fetcherResults:N}=await At(m,ce,We,Se,_e);if(_.signal.aborted)return;_.signal.removeEventListener("abort",dt),Te.delete(i),G.delete(i),Se.forEach(Y=>G.delete(Y.key));let K=ft(ct);if(K)return Ee(_e,K.result,!1,{preventScrollReset:P});if(K=ft(N),K)return ue.add(K.key),Ee(_e,K.result,!1,{preventScrollReset:P});let{loaderData:Oe,errors:Ke}=ir(m,ce,ct,void 0,Se,N,be);if(m.fetchers.has(i)){let Y=ge(A.data);m.fetchers.set(i,Y)}$t(se),m.navigation.state==="loading"&&se>ke?(U(ee,"Expected pending action"),O&&O.abort(),Fe(m.navigation.location,{matches:ce,loaderData:Oe,errors:Ke,fetchers:new Map(m.fetchers)})):(re({errors:Ke,loaderData:or(m.loaderData,Oe,ce,Ke),fetchers:new Map(m.fetchers)}),Z=!1)}async function Kr(i,s,c,g,w,L,T,P,D){let E=m.fetchers.get(i);pe(i,Ye(D,E?E.data:void 0),{flushSync:T});let C=new AbortController,_=Be(e.history,c,C.signal);if(L){let A=await ut(w,c,_.signal);if(A.type==="aborted")return;if(A.type==="error"){de(i,s,A.error,{flushSync:T});return}else if(A.matches)w=A.matches,g=Xe(w,c);else{de(i,s,ae(404,{pathname:c}),{flushSync:T});return}}G.set(i,C);let B=at,H=(await $e("loader",m,_,[g],w,i))[g.route.id];if(ve(H)&&(H=await jt(H,_.signal,!0)||H),G.get(i)===C&&G.delete(i),!_.signal.aborted){if(oe.has(i)){pe(i,ge(void 0));return}if(De(H))if(ke>B){pe(i,ge(void 0));return}else{ue.add(i),await Ee(_,H,!1,{preventScrollReset:P});return}if(ie(H)){de(i,s,H.error);return}U(!ve(H),"Unhandled fetcher deferred data"),pe(i,ge(H.data))}}async function Ee(i,s,c,g){let{submission:w,fetcherSubmission:L,preventScrollReset:T,replace:P}=g===void 0?{}:g;s.response.headers.has("X-Remix-Revalidate")&&(Z=!0);let D=s.response.headers.get("Location");U(D,"Expected a Location header on the redirect Response"),D=nr(D,new URL(i.url),u);let E=Ze(m.location,D,{_isRedirect:!0});if(r){let A=!1;if(s.response.headers.has("X-Remix-Reload-Document"))A=!0;else if(Ot.test(D)){const W=e.history.createURL(D);A=W.origin!==t.location.origin||Ae(W.pathname,u)==null}if(A){P?t.location.replace(D):t.location.assign(D);return}}O=null;let C=P===!0||s.response.headers.has("X-Remix-Replace")?J.Replace:J.Push,{formMethod:_,formAction:B,formEncType:q}=m.navigation;!w&&!L&&_&&B&&q&&(w=dr(m.navigation));let H=w||L;if(Un.has(s.response.status)&&H&&le(H.formMethod))await Re(C,E,{submission:V({},H,{formAction:D}),preventScrollReset:T||F,enableViewTransition:c?$:void 0});else{let A=Dt(E,w);await Re(C,E,{overrideNavigation:A,fetcherSubmission:L,preventScrollReset:T||F,enableViewTransition:c?$:void 0})}}async function $e(i,s,c,g,w,L){let T,P={};try{T=await An(f,i,s,c,g,w,L,l,a)}catch(D){return g.forEach(E=>{P[E.route.id]={type:z.error,error:D}}),P}for(let[D,E]of Object.entries(T))if(Wn(E)){let C=E.result;P[D]={type:z.redirect,response:Hn(C,c,D,w,u,p.v7_relativeSplatPath)}}else P[D]=await kn(E);return P}async function At(i,s,c,g,w){let L=i.matches,T=$e("loader",i,w,c,s,null),P=Promise.all(g.map(async C=>{if(C.matches&&C.match&&C.controller){let B=(await $e("loader",i,Be(e.history,C.path,C.controller.signal),[C.match],C.matches,C.key))[C.match.route.id];return{[C.key]:B}}else return Promise.resolve({[C.key]:{type:z.error,error:ae(404,{pathname:C.path})}})})),D=await T,E=(await P).reduce((C,_)=>Object.assign(C,_),{});return await Promise.all([Yn(s,D,w.signal,L,i.loaderData),Gn(s,E,g)]),{loaderResults:D,fetcherResults:E}}function wt(){Z=!0,Me.push(...Et()),Ue.forEach((i,s)=>{G.has(s)&&nt.add(s),me(s)})}function pe(i,s,c){c===void 0&&(c={}),m.fetchers.set(i,s),re({fetchers:new Map(m.fetchers)},{flushSync:(c&&c.flushSync)===!0})}function de(i,s,c,g){g===void 0&&(g={});let w=Pe(m.matches,s);ot(i),re({errors:{[w.route.id]:c},fetchers:new Map(m.fetchers)},{flushSync:(g&&g.flushSync)===!0})}function zt(i){return He.set(i,(He.get(i)||0)+1),oe.has(i)&&oe.delete(i),m.fetchers.get(i)||Fn}function ot(i){let s=m.fetchers.get(i);G.has(i)&&!(s&&s.state==="loading"&&Te.has(i))&&me(i),Ue.delete(i),Te.delete(i),ue.delete(i),p.v7_fetcherPersist&&oe.delete(i),nt.delete(i),m.fetchers.delete(i)}function Jr(i){let s=(He.get(i)||0)-1;s<=0?(He.delete(i),oe.add(i),p.v7_fetcherPersist||ot(i)):He.set(i,s),re({fetchers:new Map(m.fetchers)})}function me(i){let s=G.get(i);s&&(s.abort(),G.delete(i))}function kt(i){for(let s of i){let c=zt(s),g=ge(c.data);m.fetchers.set(s,g)}}function Ht(){let i=[],s=!1;for(let c of ue){let g=m.fetchers.get(c);U(g,"Expected fetcher: "+c),g.state==="loading"&&(ue.delete(c),i.push(c),s=!0)}return kt(i),s}function $t(i){let s=[];for(let[c,g]of Te)if(g<i){let w=m.fetchers.get(c);U(w,"Expected fetcher: "+c),w.state==="loading"&&(me(c),Te.delete(c),s.push(c))}return kt(s),s.length>0}function Yr(i,s){let c=m.blockers.get(i)||Je;return we.get(i)!==s&&we.set(i,s),c}function Vt(i){m.blockers.delete(i),we.delete(i)}function lt(i,s){let c=m.blockers.get(i)||Je;U(c.state==="unblocked"&&s.state==="blocked"||c.state==="blocked"&&s.state==="blocked"||c.state==="blocked"&&s.state==="proceeding"||c.state==="blocked"&&s.state==="unblocked"||c.state==="proceeding"&&s.state==="unblocked","Invalid blocker state transition: "+c.state+" -> "+s.state);let g=new Map(m.blockers);g.set(i,s),re({blockers:g})}function Wt(i){let{currentLocation:s,nextLocation:c,historyAction:g}=i;if(we.size===0)return;we.size>1&&Ne(!1,"A router only supports one blocker at a time");let w=Array.from(we.entries()),[L,T]=w[w.length-1],P=m.blockers.get(L);if(!(P&&P.state==="proceeding")&&T({currentLocation:s,nextLocation:c,historyAction:g}))return L}function Rt(i){let s=ae(404,{pathname:i}),c=d||o,{matches:g,route:w}=sr(c);return Et(),{notFoundMatches:g,route:w,error:s}}function Et(i){let s=[];return be.forEach((c,g)=>{(!i||i(g))&&(c.cancel(),s.push(g),be.delete(g))}),s}function Gr(i,s,c){if(S=i,R=s,x=c||null,!j&&m.navigation===Pt){j=!0;let g=Jt(m.location,m.matches);g!=null&&re({restoreScrollPosition:g})}return()=>{S=null,R=null,x=null}}function Kt(i,s){return x&&x(i,s.map(g=>un(g,m.loaderData)))||i.key}function Xr(i,s){if(S&&R){let c=Kt(i,s);S[c]=R()}}function Jt(i,s){if(S){let c=Kt(i,s),g=S[c];if(typeof g=="number")return g}return null}function st(i,s,c){if(h)if(i){if(Object.keys(i[0].params).length>0)return{active:!0,matches:ht(s,c,u,!0)}}else return{active:!0,matches:ht(s,c,u,!0)||[]};return{active:!1,matches:null}}async function ut(i,s,c){if(!h)return{type:"success",matches:i};let g=i;for(;;){let w=d==null,L=d||o,T=l;try{await h({path:s,matches:g,patch:(E,C)=>{c.aborted||rr(E,C,L,T,a)}})}catch(E){return{type:"error",error:E,partialMatches:g}}finally{w&&!c.aborted&&(o=[...o])}if(c.aborted)return{type:"aborted"};let P=xe(L,s,u);if(P)return{type:"success",matches:P};let D=ht(L,s,u,!0);if(!D||g.length===D.length&&g.every((E,C)=>E.route.id===D[C].route.id))return{type:"success",matches:null};g=D}}function Qr(i){l={},d=pt(i,a,void 0,l)}function Zr(i,s){let c=d==null;rr(i,s,d||o,l,a),c&&(o=[...o],re({}))}return X={get basename(){return u},get future(){return p},get state(){return m},get routes(){return o},get window(){return t},initialize:Ir,subscribe:Ar,enableScrollRestoration:Gr,navigate:It,fetch:Vr,revalidate:zr,createHref:i=>e.history.createHref(i),encodeLocation:i=>e.history.encodeLocation(i),getFetcher:zt,deleteFetcher:Jr,dispose:Nr,getBlocker:Yr,deleteBlocker:Vt,patchRoutes:Zr,_internalFetchControllers:G,_internalActiveDeferreds:be,_internalSetRoutes:Qr},X}function jn(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function Lt(e,t,r,n,a,l,o,d){let u,f;if(o){u=[];for(let p of t)if(u.push(p),p.route.id===o){f=p;break}}else u=t,f=t[t.length-1];let h=_t(a||".",Ft(u,l),Ae(e.pathname,r)||e.pathname,d==="path");if(a==null&&(h.search=e.search,h.hash=e.hash),(a==null||a===""||a===".")&&f){let p=Bt(h.search);if(f.route.index&&!p)h.search=h.search?h.search.replace(/^\?/,"?index&"):"?index";else if(!f.route.index&&p){let y=new URLSearchParams(h.search),b=y.getAll("index");y.delete("index"),b.filter(x=>x).forEach(x=>y.append("index",x));let S=y.toString();h.search=S?"?"+S:""}}return n&&r!=="/"&&(h.pathname=h.pathname==="/"?r:fe([r,h.pathname])),Le(h)}function Zt(e,t,r,n){if(!n||!jn(n))return{path:r};if(n.formMethod&&!Jn(n.formMethod))return{path:r,error:ae(405,{method:n.formMethod})};let a=()=>({path:r,error:ae(400,{type:"invalid-body"})}),l=n.formMethod||"get",o=e?l.toUpperCase():l.toLowerCase(),d=xr(r);if(n.body!==void 0){if(n.formEncType==="text/plain"){if(!le(o))return a();let y=typeof n.body=="string"?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((b,S)=>{let[x,R]=S;return""+b+x+"="+R+`
|
|
|
`},""):String(n.body);return{path:r,submission:{formMethod:o,formAction:d,formEncType:n.formEncType,formData:void 0,json:void 0,text:y}}}else if(n.formEncType==="application/json"){if(!le(o))return a();try{let y=typeof n.body=="string"?JSON.parse(n.body):n.body;return{path:r,submission:{formMethod:o,formAction:d,formEncType:n.formEncType,formData:void 0,json:y,text:void 0}}}catch{return a()}}}U(typeof FormData=="function","FormData is not available in this environment");let u,f;if(n.formData)u=Mt(n.formData),f=n.formData;else if(n.body instanceof FormData)u=Mt(n.body),f=n.body;else if(n.body instanceof URLSearchParams)u=n.body,f=ar(u);else if(n.body==null)u=new URLSearchParams,f=new FormData;else try{u=new URLSearchParams(n.body),f=ar(u)}catch{return a()}let h={formMethod:o,formAction:d,formEncType:n&&n.formEncType||"application/x-www-form-urlencoded",formData:f,json:void 0,text:void 0};if(le(h.formMethod))return{path:r,submission:h};let p=he(r);return t&&p.search&&Bt(p.search)&&u.append("index",""),p.search="?"+u,{path:Le(p),submission:h}}function qt(e,t,r){r===void 0&&(r=!1);let n=e.findIndex(a=>a.route.id===t);return n>=0?e.slice(0,r?n+1:n):e}function er(e,t,r,n,a,l,o,d,u,f,h,p,y,b,S,x){let R=x?ie(x[1])?x[1].error:x[1].data:void 0,j=e.createURL(t.location),M=e.createURL(a),I=r;l&&t.errors?I=qt(r,Object.keys(t.errors)[0],!0):x&&ie(x[1])&&(I=qt(r,x[0]));let k=x?x[1].statusCode:void 0,X=o&&k&&k>=400,m=I.filter((F,O)=>{let{route:$}=F;if($.lazy)return!0;if($.loader==null)return!1;if(l)return Ct($,t.loaderData,t.errors);if(Bn(t.loaderData,t.matches[O],F)||u.some(ne=>ne===F.route.id))return!0;let te=t.matches[O],Q=F;return tr(F,V({currentUrl:j,currentParams:te.params,nextUrl:M,nextParams:Q.params},n,{actionResult:R,actionStatus:k,defaultShouldRevalidate:X?!1:d||j.pathname+j.search===M.pathname+M.search||j.search!==M.search||Er(te,Q)}))}),ee=[];return p.forEach((F,O)=>{if(l||!r.some(Z=>Z.route.id===F.routeId)||h.has(O))return;let $=xe(b,F.path,S);if(!$){ee.push({key:O,routeId:F.routeId,path:F.path,matches:null,match:null,controller:null});return}let te=t.fetchers.get(O),Q=Xe($,F.path),ne=!1;y.has(O)?ne=!1:f.has(O)?(f.delete(O),ne=!0):te&&te.state!=="idle"&&te.data===void 0?ne=d:ne=tr(Q,V({currentUrl:j,currentParams:t.matches[t.matches.length-1].params,nextUrl:M,nextParams:r[r.length-1].params},n,{actionResult:R,actionStatus:k,defaultShouldRevalidate:X?!1:d})),ne&&ee.push({key:O,routeId:F.routeId,path:F.path,matches:$,match:Q,controller:new AbortController})}),[m,ee]}function Ct(e,t,r){if(e.lazy)return!0;if(!e.loader)return!1;let n=t!=null&&t[e.id]!==void 0,a=r!=null&&r[e.id]!==void 0;return!n&&a?!1:typeof e.loader=="function"&&e.loader.hydrate===!0?!0:!n&&!a}function Bn(e,t,r){let n=!t||r.route.id!==t.route.id,a=e[r.route.id]===void 0;return n||a}function Er(e,t){let r=e.route.path;return e.pathname!==t.pathname||r!=null&&r.endsWith("*")&&e.params["*"]!==t.params["*"]}function tr(e,t){if(e.route.shouldRevalidate){let r=e.route.shouldRevalidate(t);if(typeof r=="boolean")return r}return t.defaultShouldRevalidate}function rr(e,t,r,n,a){var l;let o;if(e){let f=n[e];U(f,"No route found to patch children into: routeId = "+e),f.children||(f.children=[]),o=f.children}else o=r;let d=t.filter(f=>!o.some(h=>Sr(f,h))),u=pt(d,a,[e||"_","patch",String(((l=o)==null?void 0:l.length)||"0")],n);o.push(...u)}function Sr(e,t){return"id"in e&&"id"in t&&e.id===t.id?!0:e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children.every((r,n)=>{var a;return(a=t.children)==null?void 0:a.some(l=>Sr(r,l))}):!1}async function In(e,t,r){if(!e.lazy)return;let n=await e.lazy();if(!e.lazy)return;let a=r[e.id];U(a,"No route found in manifest");let l={};for(let o in n){let u=a[o]!==void 0&&o!=="hasErrorBoundary";Ne(!u,'Route "'+a.id+'" has a static property "'+o+'" defined but its lazy function is also returning a value for this property. '+('The lazy route property "'+o+'" will be ignored.')),!u&&!ln.has(o)&&(l[o]=n[o])}Object.assign(a,l),Object.assign(a,V({},t(a),{lazy:void 0}))}async function Nn(e){let{matches:t}=e,r=t.filter(a=>a.shouldLoad);return(await Promise.all(r.map(a=>a.resolve()))).reduce((a,l,o)=>Object.assign(a,{[r[o].route.id]:l}),{})}async function An(e,t,r,n,a,l,o,d,u,f){let h=l.map(b=>b.route.lazy?In(b.route,u,d):void 0),p=l.map((b,S)=>{let x=h[S],R=a.some(M=>M.route.id===b.route.id);return V({},b,{shouldLoad:R,resolve:async M=>(M&&n.method==="GET"&&(b.route.lazy||b.route.loader)&&(R=!0),R?zn(t,n,b,x,M,f):Promise.resolve({type:z.data,result:void 0}))})}),y=await e({matches:p,request:n,params:l[0].params,fetcherKey:o,context:f});try{await Promise.all(h)}catch{}return y}async function zn(e,t,r,n,a,l){let o,d,u=f=>{let h,p=new Promise((S,x)=>h=x);d=()=>h(),t.signal.addEventListener("abort",d);let y=S=>typeof f!="function"?Promise.reject(new Error("You cannot call the handler for a route which defines a boolean "+('"'+e+'" [routeId: '+r.route.id+"]"))):f({request:t,params:r.params,context:l},...S!==void 0?[S]:[]),b=(async()=>{try{return{type:"data",result:await(a?a(x=>y(x)):y())}}catch(S){return{type:"error",result:S}}})();return Promise.race([b,p])};try{let f=r.route[e];if(n)if(f){let h,[p]=await Promise.all([u(f).catch(y=>{h=y}),n]);if(h!==void 0)throw h;o=p}else if(await n,f=r.route[e],f)o=await u(f);else if(e==="action"){let h=new URL(t.url),p=h.pathname+h.search;throw ae(405,{method:t.method,pathname:p,routeId:r.route.id})}else return{type:z.data,result:void 0};else if(f)o=await u(f);else{let h=new URL(t.url),p=h.pathname+h.search;throw ae(404,{pathname:p})}U(o.result!==void 0,"You defined "+(e==="action"?"an action":"a loader")+" for route "+('"'+r.route.id+"\" but didn't return anything from your `"+e+"` ")+"function. Please return a value or `null`.")}catch(f){return{type:z.error,result:f}}finally{d&&t.signal.removeEventListener("abort",d)}return o}async function kn(e){let{result:t,type:r}=e;if(Pr(t)){let f;try{let h=t.headers.get("Content-Type");h&&/\bapplication\/json\b/.test(h)?t.body==null?f=null:f=await t.json():f=await t.text()}catch(h){return{type:z.error,error:h}}return r===z.error?{type:z.error,error:new mt(t.status,t.statusText,f),statusCode:t.status,headers:t.headers}:{type:z.data,data:f,statusCode:t.status,headers:t.headers}}if(r===z.error){if(ur(t)){var n;if(t.data instanceof Error){var a;return{type:z.error,error:t.data,statusCode:(a=t.init)==null?void 0:a.status}}t=new mt(((n=t.init)==null?void 0:n.status)||500,void 0,t.data)}return{type:z.error,error:t,statusCode:vt(t)?t.status:void 0}}if(Kn(t)){var l,o;return{type:z.deferred,deferredData:t,statusCode:(l=t.init)==null?void 0:l.status,headers:((o=t.init)==null?void 0:o.headers)&&new Headers(t.init.headers)}}if(ur(t)){var d,u;return{type:z.data,data:t.data,statusCode:(d=t.init)==null?void 0:d.status,headers:(u=t.init)!=null&&u.headers?new Headers(t.init.headers):void 0}}return{type:z.data,data:t}}function Hn(e,t,r,n,a,l){let o=e.headers.get("Location");if(U(o,"Redirects returned/thrown from loaders/actions must have a Location header"),!Ot.test(o)){let d=n.slice(0,n.findIndex(u=>u.route.id===r)+1);o=Lt(new URL(t.url),d,a,!0,o,l),e.headers.set("Location",o)}return e}function nr(e,t,r){if(Ot.test(e)){let n=e,a=n.startsWith("//")?new URL(t.protocol+n):new URL(n),l=Ae(a.pathname,r)!=null;if(a.origin===t.origin&&l)return a.pathname+a.search+a.hash}return e}function Be(e,t,r,n){let a=e.createURL(xr(t)).toString(),l={signal:r};if(n&&le(n.formMethod)){let{formMethod:o,formEncType:d}=n;l.method=o.toUpperCase(),d==="application/json"?(l.headers=new Headers({"Content-Type":d}),l.body=JSON.stringify(n.json)):d==="text/plain"?l.body=n.text:d==="application/x-www-form-urlencoded"&&n.formData?l.body=Mt(n.formData):l.body=n.formData}return new Request(a,l)}function Mt(e){let t=new URLSearchParams;for(let[r,n]of e.entries())t.append(r,typeof n=="string"?n:n.name);return t}function ar(e){let t=new FormData;for(let[r,n]of e.entries())t.append(r,n);return t}function $n(e,t,r,n,a){let l={},o=null,d,u=!1,f={},h=r&&ie(r[1])?r[1].error:void 0;return e.forEach(p=>{if(!(p.route.id in t))return;let y=p.route.id,b=t[y];if(U(!De(b),"Cannot handle redirect results in processLoaderData"),ie(b)){let S=b.error;h!==void 0&&(S=h,h=void 0),o=o||{};{let x=Pe(e,y);o[x.route.id]==null&&(o[x.route.id]=S)}l[y]=void 0,u||(u=!0,d=vt(b.error)?b.error.status:500),b.headers&&(f[y]=b.headers)}else ve(b)?(n.set(y,b.deferredData),l[y]=b.deferredData.data,b.statusCode!=null&&b.statusCode!==200&&!u&&(d=b.statusCode),b.headers&&(f[y]=b.headers)):(l[y]=b.data,b.statusCode&&b.statusCode!==200&&!u&&(d=b.statusCode),b.headers&&(f[y]=b.headers))}),h!==void 0&&r&&(o={[r[0]]:h},l[r[0]]=void 0),{loaderData:l,errors:o,statusCode:d||200,loaderHeaders:f}}function ir(e,t,r,n,a,l,o){let{loaderData:d,errors:u}=$n(t,r,n,o);return a.forEach(f=>{let{key:h,match:p,controller:y}=f,b=l[h];if(U(b,"Did not find corresponding fetcher result"),!(y&&y.signal.aborted))if(ie(b)){let S=Pe(e.matches,p==null?void 0:p.route.id);u&&u[S.route.id]||(u=V({},u,{[S.route.id]:b.error})),e.fetchers.delete(h)}else if(De(b))U(!1,"Unhandled fetcher revalidation redirect");else if(ve(b))U(!1,"Unhandled fetcher deferred data");else{let S=ge(b.data);e.fetchers.set(h,S)}}),{loaderData:d,errors:u}}function or(e,t,r,n){let a=V({},t);for(let l of r){let o=l.route.id;if(t.hasOwnProperty(o)?t[o]!==void 0&&(a[o]=t[o]):e[o]!==void 0&&l.route.loader&&(a[o]=e[o]),n&&n.hasOwnProperty(o))break}return a}function lr(e){return e?ie(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function Pe(e,t){return(t?e.slice(0,e.findIndex(n=>n.route.id===t)+1):[...e]).reverse().find(n=>n.route.hasErrorBoundary===!0)||e[0]}function sr(e){let t=e.length===1?e[0]:e.find(r=>r.index||!r.path||r.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function ae(e,t){let{pathname:r,routeId:n,method:a,type:l,message:o}=t===void 0?{}:t,d="Unknown Server Error",u="Unknown @remix-run/router error";return e===400?(d="Bad Request",a&&r&&n?u="You made a "+a+' request to "'+r+'" but '+('did not provide a `loader` for route "'+n+'", ')+"so there is no way to handle the request.":l==="defer-action"?u="defer() is not supported in actions":l==="invalid-body"&&(u="Unable to encode submission body")):e===403?(d="Forbidden",u='Route "'+n+'" does not match URL "'+r+'"'):e===404?(d="Not Found",u='No route matches URL "'+r+'"'):e===405&&(d="Method Not Allowed",a&&r&&n?u="You made a "+a.toUpperCase()+' request to "'+r+'" but '+('did not provide an `action` for route "'+n+'", ')+"so there is no way to handle the request.":a&&(u='Invalid request method "'+a.toUpperCase()+'"')),new mt(e||500,d,new Error(u),!0)}function ft(e){let t=Object.entries(e);for(let r=t.length-1;r>=0;r--){let[n,a]=t[r];if(De(a))return{key:n,result:a}}}function xr(e){let t=typeof e=="string"?he(e):e;return Le(V({},t,{hash:""}))}function Vn(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function Wn(e){return Pr(e.result)&&Tn.has(e.result.status)}function ve(e){return e.type===z.deferred}function ie(e){return e.type===z.error}function De(e){return(e&&e.type)===z.redirect}function ur(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function Kn(e){let t=e;return t&&typeof t=="object"&&typeof t.data=="object"&&typeof t.subscribe=="function"&&typeof t.cancel=="function"&&typeof t.resolveData=="function"}function Pr(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function Jn(e){return Mn.has(e.toLowerCase())}function le(e){return Ln.has(e.toLowerCase())}async function Yn(e,t,r,n,a){let l=Object.entries(t);for(let o=0;o<l.length;o++){let[d,u]=l[o],f=e.find(y=>(y==null?void 0:y.route.id)===d);if(!f)continue;let h=n.find(y=>y.route.id===f.route.id),p=h!=null&&!Er(h,f)&&(a&&a[f.route.id])!==void 0;ve(u)&&p&&await jt(u,r,!1).then(y=>{y&&(t[d]=y)})}}async function Gn(e,t,r){for(let n=0;n<r.length;n++){let{key:a,routeId:l,controller:o}=r[n],d=t[a];e.find(f=>(f==null?void 0:f.route.id)===l)&&ve(d)&&(U(o,"Expected an AbortController for revalidating fetcher deferred result"),await jt(d,o.signal,!0).then(f=>{f&&(t[a]=f)}))}}async function jt(e,t,r){if(r===void 0&&(r=!1),!await e.deferredData.resolveData(t)){if(r)try{return{type:z.data,data:e.deferredData.unwrappedData}}catch(a){return{type:z.error,error:a}}return{type:z.data,data:e.deferredData.data}}}function Bt(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function Xe(e,t){let r=typeof t=="string"?he(t).search:t.search;if(e[e.length-1].route.index&&Bt(r||""))return e[e.length-1];let n=br(e);return n[n.length-1]}function dr(e){let{formMethod:t,formAction:r,formEncType:n,text:a,formData:l,json:o}=e;if(!(!t||!r||!n)){if(a!=null)return{formMethod:t,formAction:r,formEncType:n,formData:void 0,json:void 0,text:a};if(l!=null)return{formMethod:t,formAction:r,formEncType:n,formData:l,json:void 0,text:void 0};if(o!==void 0)return{formMethod:t,formAction:r,formEncType:n,formData:void 0,json:o,text:void 0}}}function Dt(e,t){return t?{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}:{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function Xn(e,t){return{state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}function Ye(e,t){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function Qn(e,t){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function ge(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function Zn(e,t){try{let r=e.sessionStorage.getItem(Rr);if(r){let n=JSON.parse(r);for(let[a,l]of Object.entries(n||{}))l&&Array.isArray(l)&&t.set(a,new Set(l||[]))}}catch{}}function qn(e,t){if(t.size>0){let r={};for(let[n,a]of t)r[n]=[...a];try{e.sessionStorage.setItem(Rr,JSON.stringify(r))}catch(n){Ne(!1,"Failed to save applied view transitions in sessionStorage ("+n+").")}}}/**
|
|
|
*/function et(){return et=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},et.apply(this,arguments)}const yt=v.createContext(null),Dr=v.createContext(null),Ce=v.createContext(null),bt=v.createContext(null),ye=v.createContext({outlet:null,matches:[],isDataRoute:!1}),Lr=v.createContext(null);function ea(e,t){let{relative:r}=t===void 0?{}:t;rt()||U(!1);let{basename:n,navigator:a}=v.useContext(Ce),{hash:l,pathname:o,search:d}=Tr(e,{relative:r}),u=o;return n!=="/"&&(u=o==="/"?n:fe([n,o])),a.createHref({pathname:u,search:d,hash:l})}function rt(){return v.useContext(bt)!=null}function ze(){return rt()||U(!1),v.useContext(bt).location}function Cr(e){v.useContext(Ce).static||v.useLayoutEffect(e)}function Mr(){let{isDataRoute:e}=v.useContext(ye);return e?fa():ta()}function ta(){rt()||U(!1);let e=v.useContext(yt),{basename:t,future:r,navigator:n}=v.useContext(Ce),{matches:a}=v.useContext(ye),{pathname:l}=ze(),o=JSON.stringify(Ft(a,r.v7_relativeSplatPath)),d=v.useRef(!1);return Cr(()=>{d.current=!0}),v.useCallback(function(f,h){if(h===void 0&&(h={}),!d.current)return;if(typeof f=="number"){n.go(f);return}let p=_t(f,JSON.parse(o),l,h.relative==="path");e==null&&t!=="/"&&(p.pathname=p.pathname==="/"?t:fe([t,p.pathname])),(h.replace?n.replace:n.push)(p,h.state,h)},[t,n,o,l,e])}function Qa(){let{matches:e}=v.useContext(ye),t=e[e.length-1];return t?t.params:{}}function Tr(e,t){let{relative:r}=t===void 0?{}:t,{future:n}=v.useContext(Ce),{matches:a}=v.useContext(ye),{pathname:l}=ze(),o=JSON.stringify(Ft(a,n.v7_relativeSplatPath));return v.useMemo(()=>_t(e,JSON.parse(o),l,r==="path"),[e,o,l,r])}function ra(e,t){return Ur(e,t)}function Ur(e,t,r,n){rt()||U(!1);let{navigator:a}=v.useContext(Ce),{matches:l}=v.useContext(ye),o=l[l.length-1],d=o?o.params:{};o&&o.pathname;let u=o?o.pathnameBase:"/";o&&o.route;let f=ze(),h;if(t){var p;let R=typeof t=="string"?he(t):t;u==="/"||(p=R.pathname)!=null&&p.startsWith(u)||U(!1),h=R}else h=f;let y=h.pathname||"/",b=y;if(u!=="/"){let R=u.replace(/^\//,"").split("/");b="/"+y.replace(/^\//,"").split("/").slice(R.length).join("/")}let S=xe(e,{pathname:b}),x=la(S&&S.map(R=>Object.assign({},R,{params:Object.assign({},d,R.params),pathname:fe([u,a.encodeLocation?a.encodeLocation(R.pathname).pathname:R.pathname]),pathnameBase:R.pathnameBase==="/"?u:fe([u,a.encodeLocation?a.encodeLocation(R.pathnameBase).pathname:R.pathnameBase])})),l,r,n);return t&&x?v.createElement(bt.Provider,{value:{location:et({pathname:"/",search:"",hash:"",state:null,key:"default"},h),navigationType:J.Pop}},x):x}function na(){let e=ca(),t=vt(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,a={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},t),r?v.createElement("pre",{style:a},r):null,null)}const aa=v.createElement(na,null);class ia extends v.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,r){return r.location!==t.location||r.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:r.error,location:r.location,revalidation:t.revalidation||r.revalidation}}componentDidCatch(t,r){console.error("React Router caught the following error during render",t,r)}render(){return this.state.error!==void 0?v.createElement(ye.Provider,{value:this.props.routeContext},v.createElement(Lr.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function oa(e){let{routeContext:t,match:r,children:n}=e,a=v.useContext(yt);return a&&a.static&&a.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=r.route.id),v.createElement(ye.Provider,{value:t},n)}function la(e,t,r,n){var a;if(t===void 0&&(t=[]),r===void 0&&(r=null),n===void 0&&(n=null),e==null){var l;if(!r)return null;if(r.errors)e=r.matches;else if((l=n)!=null&&l.v7_partialHydration&&t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let o=e,d=(a=r)==null?void 0:a.errors;if(d!=null){let h=o.findIndex(p=>p.route.id&&(d==null?void 0:d[p.route.id])!==void 0);h>=0||U(!1),o=o.slice(0,Math.min(o.length,h+1))}let u=!1,f=-1;if(r&&n&&n.v7_partialHydration)for(let h=0;h<o.length;h++){let p=o[h];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(f=h),p.route.id){let{loaderData:y,errors:b}=r,S=p.route.loader&&y[p.route.id]===void 0&&(!b||b[p.route.id]===void 0);if(p.route.lazy||S){u=!0,f>=0?o=o.slice(0,f+1):o=[o[0]];break}}}return o.reduceRight((h,p,y)=>{let b,S=!1,x=null,R=null;r&&(b=d&&p.route.id?d[p.route.id]:void 0,x=p.route.errorElement||aa,u&&(f<0&&y===0?(S=!0,R=null):f===y&&(S=!0,R=p.route.hydrateFallbackElement||null)));let j=t.concat(o.slice(0,y+1)),M=()=>{let I;return b?I=x:S?I=R:p.route.Component?I=v.createElement(p.route.Component,null):p.route.element?I=p.route.element:I=h,v.createElement(oa,{match:p,routeContext:{outlet:h,matches:j,isDataRoute:r!=null},children:I})};return r&&(p.route.ErrorBoundary||p.route.errorElement||y===0)?v.createElement(ia,{location:r.location,revalidation:r.revalidation,component:x,error:b,children:M(),routeContext:{outlet:null,matches:j,isDataRoute:!0}}):M()},null)}var Fr=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(Fr||{}),gt=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(gt||{});function sa(e){let t=v.useContext(yt);return t||U(!1),t}function ua(e){let t=v.useContext(Dr);return t||U(!1),t}function da(e){let t=v.useContext(ye);return t||U(!1),t}function _r(e){let t=da(),r=t.matches[t.matches.length-1];return r.route.id||U(!1),r.route.id}function ca(){var e;let t=v.useContext(Lr),r=ua(gt.UseRouteError),n=_r(gt.UseRouteError);return t!==void 0?t:(e=r.errors)==null?void 0:e[n]}function fa(){let{router:e}=sa(Fr.UseNavigateStable),t=_r(gt.UseNavigateStable),r=v.useRef(!1);return Cr(()=>{r.current=!0}),v.useCallback(function(a,l){l===void 0&&(l={}),r.current&&(typeof a=="number"?e.navigate(a):e.navigate(a,et({fromRouteId:t},l)))},[e,t])}const cr={};function ha(e,t){cr[t]||(cr[t]=!0,console.warn(t))}const Ie=(e,t,r)=>ha(e,"⚠️ React Router Future Flag Warning: "+t+". "+("You can use the `"+e+"` future flag to opt-in early. ")+("For more information, see "+r+"."));function pa(e,t){(e==null?void 0:e.v7_startTransition)===void 0&&Ie("v7_startTransition","React Router will begin wrapping state updates in `React.startTransition` in v7","https://reactrouter.com/v6/upgrading/future#v7_starttransition"),(e==null?void 0:e.v7_relativeSplatPath)===void 0&&(!t||!t.v7_relativeSplatPath)&&Ie("v7_relativeSplatPath","Relative route resolution within Splat routes is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_relativesplatpath"),t&&(t.v7_fetcherPersist===void 0&&Ie("v7_fetcherPersist","The persistence behavior of fetchers is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_fetcherpersist"),t.v7_normalizeFormMethod===void 0&&Ie("v7_normalizeFormMethod","Casing of `formMethod` fields is being normalized to uppercase in v7","https://reactrouter.com/v6/upgrading/future#v7_normalizeformmethod"),t.v7_partialHydration===void 0&&Ie("v7_partialHydration","`RouterProvider` hydration behavior is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_partialhydration"),t.v7_skipActionErrorRevalidation===void 0&&Ie("v7_skipActionErrorRevalidation","The revalidation behavior after 4xx/5xx `action` responses is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_skipactionerrorrevalidation"))}function ma(e){U(!1)}function ga(e){let{basename:t="/",children:r=null,location:n,navigationType:a=J.Pop,navigator:l,static:o=!1,future:d}=e;rt()&&U(!1);let u=t.replace(/^\/*/,"/"),f=v.useMemo(()=>({basename:u,navigator:l,static:o,future:et({v7_relativeSplatPath:!1},d)}),[u,d,l,o]);typeof n=="string"&&(n=he(n));let{pathname:h="/",search:p="",hash:y="",state:b=null,key:S="default"}=n,x=v.useMemo(()=>{let R=Ae(h,u);return R==null?null:{location:{pathname:R,search:p,hash:y,state:b,key:S},navigationType:a}},[u,h,p,y,b,S,a]);return x==null?null:v.createElement(Ce.Provider,{value:f},v.createElement(bt.Provider,{children:r,value:x}))}function Za(e){let{children:t,location:r}=e;return ra(Tt(t),r)}new Promise(()=>{});function Tt(e,t){t===void 0&&(t=[]);let r=[];return v.Children.forEach(e,(n,a)=>{if(!v.isValidElement(n))return;let l=[...t,a];if(n.type===v.Fragment){r.push.apply(r,Tt(n.props.children,l));return}n.type!==ma&&U(!1),!n.props.index||!n.props.children||U(!1);let o={id:n.props.id||l.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(o.children=Tt(n.props.children,l)),r.push(o)}),r}function va(e){let t={hasErrorBoundary:e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&Object.assign(t,{element:v.createElement(e.Component),Component:void 0}),e.HydrateFallback&&Object.assign(t,{hydrateFallbackElement:v.createElement(e.HydrateFallback),HydrateFallback:void 0}),e.ErrorBoundary&&Object.assign(t,{errorElement:v.createElement(e.ErrorBoundary),ErrorBoundary:void 0}),t}/**
|
|
|
*/function tt(){return tt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},tt.apply(this,arguments)}function ya(e,t){if(e==null)return{};var r={},n=Object.keys(e),a,l;for(l=0;l<n.length;l++)a=n[l],!(t.indexOf(a)>=0)&&(r[a]=e[a]);return r}function ba(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function wa(e,t){return e.button===0&&(!t||t==="_self")&&!ba(e)}function Ut(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map(a=>[r,a]):[[r,n]])},[]))}function Ra(e,t){let r=Ut(e);return t&&t.forEach((n,a)=>{r.has(a)||t.getAll(a).forEach(l=>{r.append(a,l)})}),r}const Ea=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],Sa="6";try{window.__reactRouterVersion=Sa}catch{}function qa(e,t){return On({basename:t==null?void 0:t.basename,future:tt({},t==null?void 0:t.future,{v7_prependBasename:!0}),history:nn({window:t==null?void 0:t.window}),hydrationData:(t==null?void 0:t.hydrationData)||xa(),routes:e,mapRouteProperties:va,dataStrategy:t==null?void 0:t.dataStrategy,patchRoutesOnNavigation:t==null?void 0:t.patchRoutesOnNavigation,window:t==null?void 0:t.window}).initialize()}function xa(){var e;let t=(e=window)==null?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=tt({},t,{errors:Pa(t.errors)})),t}function Pa(e){if(!e)return null;let t=Object.entries(e),r={};for(let[n,a]of t)if(a&&a.__type==="RouteErrorResponse")r[n]=new mt(a.status,a.statusText,a.data,a.internal===!0);else if(a&&a.__type==="Error"){if(a.__subType){let l=window[a.__subType];if(typeof l=="function")try{let o=new l(a.message);o.stack="",r[n]=o}catch{}}if(r[n]==null){let l=new Error(a.message);l.stack="",r[n]=l}}else r[n]=a;return r}const Da=v.createContext({isTransitioning:!1}),La=v.createContext(new Map),Ca="startTransition",fr=en[Ca],Ma="flushSync",hr=tn[Ma];function Ta(e){fr?fr(e):e()}function Ge(e){hr?hr(e):e()}class Ua{constructor(){this.status="pending",this.promise=new Promise((t,r)=>{this.resolve=n=>{this.status==="pending"&&(this.status="resolved",t(n))},this.reject=n=>{this.status==="pending"&&(this.status="rejected",r(n))}})}}function ei(e){let{fallbackElement:t,router:r,future:n}=e,[a,l]=v.useState(r.state),[o,d]=v.useState(),[u,f]=v.useState({isTransitioning:!1}),[h,p]=v.useState(),[y,b]=v.useState(),[S,x]=v.useState(),R=v.useRef(new Map),{v7_startTransition:j}=n||{},M=v.useCallback(F=>{j?Ta(F):F()},[j]),I=v.useCallback((F,O)=>{let{deletedFetchers:$,flushSync:te,viewTransitionOpts:Q}=O;F.fetchers.forEach((Z,Me)=>{Z.data!==void 0&&R.current.set(Me,Z.data)}),$.forEach(Z=>R.current.delete(Z));let ne=r.window==null||r.window.document==null||typeof r.window.document.startViewTransition!="function";if(!Q||ne){te?Ge(()=>l(F)):M(()=>l(F));return}if(te){Ge(()=>{y&&(h&&h.resolve(),y.skipTransition()),f({isTransitioning:!0,flushSync:!0,currentLocation:Q.currentLocation,nextLocation:Q.nextLocation})});let Z=r.window.document.startViewTransition(()=>{Ge(()=>l(F))});Z.finished.finally(()=>{Ge(()=>{p(void 0),b(void 0),d(void 0),f({isTransitioning:!1})})}),Ge(()=>b(Z));return}y?(h&&h.resolve(),y.skipTransition(),x({state:F,currentLocation:Q.currentLocation,nextLocation:Q.nextLocation})):(d(F),f({isTransitioning:!0,flushSync:!1,currentLocation:Q.currentLocation,nextLocation:Q.nextLocation}))},[r.window,y,h,R,M]);v.useLayoutEffect(()=>r.subscribe(I),[r,I]),v.useEffect(()=>{u.isTransitioning&&!u.flushSync&&p(new Ua)},[u]),v.useEffect(()=>{if(h&&o&&r.window){let F=o,O=h.promise,$=r.window.document.startViewTransition(async()=>{M(()=>l(F)),await O});$.finished.finally(()=>{p(void 0),b(void 0),d(void 0),f({isTransitioning:!1})}),b($)}},[M,o,h,r.window]),v.useEffect(()=>{h&&o&&a.location.key===o.location.key&&h.resolve()},[h,y,a.location,o]),v.useEffect(()=>{!u.isTransitioning&&S&&(d(S.state),f({isTransitioning:!0,flushSync:!1,currentLocation:S.currentLocation,nextLocation:S.nextLocation}),x(void 0))},[u.isTransitioning,S]),v.useEffect(()=>{},[]);let k=v.useMemo(()=>({createHref:r.createHref,encodeLocation:r.encodeLocation,go:F=>r.navigate(F),push:(F,O,$)=>r.navigate(F,{state:O,preventScrollReset:$==null?void 0:$.preventScrollReset}),replace:(F,O,$)=>r.navigate(F,{replace:!0,state:O,preventScrollReset:$==null?void 0:$.preventScrollReset})}),[r]),X=r.basename||"/",m=v.useMemo(()=>({router:r,navigator:k,static:!1,basename:X}),[r,k,X]),ee=v.useMemo(()=>({v7_relativeSplatPath:r.future.v7_relativeSplatPath}),[r.future.v7_relativeSplatPath]);return v.useEffect(()=>pa(n,r.future),[n,r.future]),v.createElement(v.Fragment,null,v.createElement(yt.Provider,{value:m},v.createElement(Dr.Provider,{value:a},v.createElement(La.Provider,{value:R.current},v.createElement(Da.Provider,{value:u},v.createElement(ga,{basename:X,location:a.location,navigationType:a.historyAction,navigator:k,future:ee},a.initialized||r.future.v7_partialHydration?v.createElement(Fa,{routes:r.routes,future:r.future,state:a}):t))))),null)}const Fa=v.memo(_a);function _a(e){let{routes:t,future:r,state:n}=e;return Ur(t,void 0,n,r)}const Oa=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",ja=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ti=v.forwardRef(function(t,r){let{onClick:n,relative:a,reloadDocument:l,replace:o,state:d,target:u,to:f,preventScrollReset:h,viewTransition:p}=t,y=ya(t,Ea),{basename:b}=v.useContext(Ce),S,x=!1;if(typeof f=="string"&&ja.test(f)&&(S=f,Oa))try{let I=new URL(window.location.href),k=f.startsWith("//")?new URL(I.protocol+f):new URL(f),X=Ae(k.pathname,b);k.origin===I.origin&&X!=null?f=X+k.search+k.hash:x=!0}catch{}let R=ea(f,{relative:a}),j=Ba(f,{replace:o,state:d,target:u,preventScrollReset:h,relative:a,viewTransition:p});function M(I){n&&n(I),I.defaultPrevented||j(I)}return v.createElement("a",tt({},y,{href:S||R,onClick:x||l?n:M,ref:r,target:u}))});var pr;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(pr||(pr={}));var mr;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(mr||(mr={}));function Ba(e,t){let{target:r,replace:n,state:a,preventScrollReset:l,relative:o,viewTransition:d}=t===void 0?{}:t,u=Mr(),f=ze(),h=Tr(e,{relative:o});return v.useCallback(p=>{if(wa(p,r)){p.preventDefault();let y=n!==void 0?n:Le(f)===Le(h);u(e,{replace:y,state:a,preventScrollReset:l,relative:o,viewTransition:d})}},[f,u,h,n,a,r,e,l,o,d])}function ri(e){let t=v.useRef(Ut(e)),r=v.useRef(!1),n=ze(),a=v.useMemo(()=>Ra(n.search,r.current?null:t.current),[n.search]),l=Mr(),o=v.useCallback((d,u)=>{const f=Ut(typeof d=="function"?d(a):d);r.current=!0,l("?"+f,u)},[l,a]);return[a,o]}var Ia=function(t){return t.join("/").replace(/\/\/+/g,"/")},Na=/^:\w+$/,Aa=3,za=2,ka=1,Ha=10,$a=-2,gr=function(t){return t==="*"};function Va(e,t){var r=e.split("/"),n=r.length;return r.some(gr)&&(n+=$a),t&&(n+=za),r.filter(function(a){return!gr(a)}).reduce(function(a,l){return Na.test(l)?a+Aa:l===""?a+ka:a+Ha},n)}function Wa(e,t){var r=e.length===t.length&&e.slice(0,-1).every(function(n,a){return n===t[a]});return r?e[e.length-1]-t[t.length-1]:0}function Or(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[],n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"";return e.forEach(function(a,l){var o;if(typeof a.path!="string"&&!a.index&&!(!((o=a.children)===null||o===void 0)&&o.length))throw new Error("useBreadcrumbs: `path` or `index` must be provided in every route object");if(a.path&&a.index)throw new Error("useBreadcrumbs: `path` and `index` cannot be provided at the same time");var d={relativePath:a.path||"",childrenIndex:l,route:a};if(d.relativePath.charAt(0)==="/"){if(!d.relativePath.startsWith(n))throw new Error("useBreadcrumbs: The absolute path of the child route must start with the parent path");d.relativePath=d.relativePath.slice(n.length)}var u=Ia([n,d.relativePath]),f=r.concat(d);if(a.children&&a.children.length>0){if(a.index)throw new Error("useBreadcrumbs: Index route cannot have child routes");Or(a.children,t,f,u)}t.push({path:u,score:Va(u,a.index),routesMeta:f})}),t}function Ka(e){return e.sort(function(t,r){return t.score!==r.score?r.score-t.score:Wa(t.routesMeta.map(function(n){return n.childrenIndex}),r.routesMeta.map(function(n){return n.childrenIndex}))})}var Qe=Symbol("NO_BREADCRUMB"),jr=function(t){return t.replace(/^[\s_]+|[\s_]+$/g,"").replace(/[-_\s]+/g," ").replace(/^[a-z]/,function(r){return r.toUpperCase()})},Br=function(t){var r=t.breadcrumb,n=t.match,a=t.location,l=t.props,o=Object.assign({match:n,location:a,key:n.pathname},l||{});return Object.assign(Object.assign({},o),{breadcrumb:typeof r=="string"?v.createElement("span",{key:o.key},r):rn.createElement(r,Object.assign({},o))})},Ja=function(t){var r=t.currentSection,n=t.location,a=t.pathSection,l=t.defaultFormatter,o=qe({end:!0,path:a},a);return Br({breadcrumb:l?l(r):jr(r),match:o,location:n})},Ya=function(t){var r=t.currentSection,n=t.disableDefaults,a=t.excludePaths,l=t.defaultFormatter,o=t.location,d=t.pathSection,u=t.branches,f,h=function(y){return qe({path:y,end:!0},d)!=null};return a&&a.some(h)?Qe:(u.some(function(p){var y=p.path,b=p.routesMeta,S=b[b.length-1].route,x=S.breadcrumb;if(!x&&S.index){var R=b[b.length-2];R&&R.route.breadcrumb&&(x=R.route.breadcrumb)}var j=S.caseSensitive,M=S.props,I=qe({path:y,end:!0,caseSensitive:j},d);return I&&x===null?(f=Qe,!0):I?!x&&n?(f=Qe,!0):(f=Br({breadcrumb:x||(l?l(r):jr(r)),match:Object.assign(Object.assign({},I),{route:S}),location:o,props:M}),!0):!1}),f||(n?Qe:Ja({pathSection:d,currentSection:d==="/"?"Home":r,location:o,defaultFormatter:l})))},Ga=function(t){var r=t.routes,n=t.location,a=t.options,l=a===void 0?{}:a,o=n.pathname,d=Ka(Or(r)),u=[];return o.split("?")[0].split("/").reduce(function(f,h,p){var y=h?"".concat(f,"/").concat(h):"/";if(y==="/"&&p!==0)return"";var b=Ya(Object.assign({currentSection:h,location:n,pathSection:y,branches:d},l));return b!==Qe&&u.push(b),y==="/"?"":y},""),u},ni=function(t,r){return Ga({routes:t,location:ze(),options:r})};export{ti as L,Za as R,ri as a,Qa as b,ni as c,ze as d,ma as e,qa as f,ei as g,Mr as u};
|