import{r as a,a as Z}from"./react-5aTaZycZ.js";import{i as C,j as S,g as D,e as J,k as z,p as V,m as W,n as H,q as ee,t as k,v as te}from"./vendor-DwnJLnf2.js";function b(){return b=Object.assign?Object.assign.bind():function(e){for(var t=1;t{d.current=!0}),a.useCallback(function(f,u){if(u===void 0&&(u={}),!d.current)return;if(typeof f=="number"){n.go(f);return}let s=J(f,JSON.parse(l),i,u.relative==="path");e==null&&t!=="/"&&(s.pathname=s.pathname==="/"?t:S([t,s.pathname])),(u.replace?n.replace:n.push)(s,u.state,u)},[t,n,l,i,e])}function G(e,t){let{relative:r}=t===void 0?{}:t,{future:n}=a.useContext(E),{matches:o}=a.useContext(R),{pathname:i}=w(),l=JSON.stringify(D(o,n.v7_relativeSplatPath));return a.useMemo(()=>J(e,JSON.parse(l),i,r==="path"),[e,l,i,r])}function oe(e,t){return le(e,t)}function le(e,t,r,n){P()||C(!1);let{navigator:o}=a.useContext(E),{matches:i}=a.useContext(R),l=i[i.length-1],d=l?l.params:{};l&&l.pathname;let c=l?l.pathnameBase:"/";l&&l.route;let f=w(),u;if(t){var s;let h=typeof t=="string"?V(t):t;c==="/"||(s=h.pathname)!=null&&s.startsWith(c)||C(!1),u=h}else u=f;let p=u.pathname||"/",v=p;if(c!=="/"){let h=c.replace(/^\//,"").split("/");v="/"+p.replace(/^\//,"").split("/").slice(h.length).join("/")}let m=H(e,{pathname:v}),y=fe(m&&m.map(h=>Object.assign({},h,{params:Object.assign({},d,h.params),pathname:S([c,o.encodeLocation?o.encodeLocation(h.pathname).pathname:h.pathname]),pathnameBase:h.pathnameBase==="/"?c:S([c,o.encodeLocation?o.encodeLocation(h.pathnameBase).pathname:h.pathnameBase])})),i,r,n);return t&&y?a.createElement(B.Provider,{value:{location:b({pathname:"/",search:"",hash:"",state:null,key:"default"},u),navigationType:z.Pop}},y):y}function ie(){let e=ve(),t=ee(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,o={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return a.createElement(a.Fragment,null,a.createElement("h2",null,"Unexpected Application Error!"),a.createElement("h3",{style:{fontStyle:"italic"}},t),r?a.createElement("pre",{style:o},r):null,null)}const se=a.createElement(ie,null);class ue extends a.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?a.createElement(R.Provider,{value:this.props.routeContext},a.createElement(K.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function ce(e){let{routeContext:t,match:r,children:n}=e,o=a.useContext(_);return o&&o.static&&o.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=r.route.id),a.createElement(R.Provider,{value:t},n)}function fe(e,t,r,n){var o;if(t===void 0&&(t=[]),r===void 0&&(r=null),n===void 0&&(n=null),e==null){var i;if(!r)return null;if(r.errors)e=r.matches;else if((i=n)!=null&&i.v7_partialHydration&&t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let l=e,d=(o=r)==null?void 0:o.errors;if(d!=null){let u=l.findIndex(s=>s.route.id&&d?.[s.route.id]!==void 0);u>=0||C(!1),l=l.slice(0,Math.min(l.length,u+1))}let c=!1,f=-1;if(r&&n&&n.v7_partialHydration)for(let u=0;u=0?l=l.slice(0,f+1):l=[l[0]];break}}}return l.reduceRight((u,s,p)=>{let v,m=!1,y=null,h=null;r&&(v=d&&s.route.id?d[s.route.id]:void 0,y=s.route.errorElement||se,c&&(f<0&&p===0?(ge("route-fallback"),m=!0,h=null):f===p&&(m=!0,h=s.route.hydrateFallbackElement||null)));let x=t.concat(l.slice(0,p+1)),U=()=>{let g;return v?g=y:m?g=h:s.route.Component?g=a.createElement(s.route.Component,null):s.route.element?g=s.route.element:g=u,a.createElement(ce,{match:s,routeContext:{outlet:u,matches:x,isDataRoute:r!=null},children:g})};return r&&(s.route.ErrorBoundary||s.route.errorElement||p===0)?a.createElement(ue,{location:r.location,revalidation:r.revalidation,component:y,error:v,children:U(),routeContext:{outlet:null,matches:x,isDataRoute:!0}}):U()},null)}var X=(function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e})(X||{}),Q=(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})(Q||{});function de(e){let t=a.useContext(_);return t||C(!1),t}function he(e){let t=a.useContext(re);return t||C(!1),t}function pe(e){let t=a.useContext(R);return t||C(!1),t}function Y(e){let t=pe(),r=t.matches[t.matches.length-1];return r.route.id||C(!1),r.route.id}function ve(){var e;let t=a.useContext(K),r=he(),n=Y();return t!==void 0?t:(e=r.errors)==null?void 0:e[n]}function me(){let{router:e}=de(X.UseNavigateStable),t=Y(Q.UseNavigateStable),r=a.useRef(!1);return $(()=>{r.current=!0}),a.useCallback(function(o,i){i===void 0&&(i={}),r.current&&(typeof o=="number"?e.navigate(o):e.navigate(o,b({fromRouteId:t},i)))},[e,t])}const I={};function ge(e,t,r){I[e]||(I[e]=!0)}function Ce(e,t){e?.v7_startTransition,e?.v7_relativeSplatPath}function ye(e){C(!1)}function Ee(e){let{basename:t="/",children:r=null,location:n,navigationType:o=z.Pop,navigator:i,static:l=!1,future:d}=e;P()&&C(!1);let c=t.replace(/^\/*/,"/"),f=a.useMemo(()=>({basename:c,navigator:i,static:l,future:b({v7_relativeSplatPath:!1},d)}),[c,d,i,l]);typeof n=="string"&&(n=V(n));let{pathname:u="/",search:s="",hash:p="",state:v=null,key:m="default"}=n,y=a.useMemo(()=>{let h=W(u,c);return h==null?null:{location:{pathname:h,search:s,hash:p,state:v,key:m},navigationType:o}},[c,u,s,p,v,m,o]);return y==null?null:a.createElement(E.Provider,{value:f},a.createElement(B.Provider,{children:r,value:y}))}function _e(e){let{children:t,location:r}=e;return oe(N(t),r)}new Promise(()=>{});function N(e,t){t===void 0&&(t=[]);let r=[];return a.Children.forEach(e,(n,o)=>{if(!a.isValidElement(n))return;let i=[...t,o];if(n.type===a.Fragment){r.push.apply(r,N(n.props.children,i));return}n.type!==ye&&C(!1),!n.props.index||!n.props.children||C(!1);let l={id:n.props.id||i.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&&(l.children=N(n.props.children,i)),r.push(l)}),r}function O(){return O=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(r[o]=e[o]);return r}function xe(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function be(e,t){return e.button===0&&(!t||t==="_self")&&!xe(e)}function T(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(o=>[r,o]):[[r,n]])},[]))}function Pe(e,t){let r=T(e);return t&&t.forEach((n,o)=>{r.has(o)||t.getAll(o).forEach(i=>{r.append(o,i)})}),r}const we=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],Ue="6";try{window.__reactRouterVersion=Ue}catch{}const Le="startTransition",j=Z[Le];function Fe(e){let{basename:t,children:r,future:n,window:o}=e,i=a.useRef();i.current==null&&(i.current=te({window:o,v5Compat:!0}));let l=i.current,[d,c]=a.useState({action:l.action,location:l.location}),{v7_startTransition:f}=n||{},u=a.useCallback(s=>{f&&j?j(()=>c(s)):c(s)},[c,f]);return a.useLayoutEffect(()=>l.listen(u),[l,u]),a.useEffect(()=>Ce(n),[n]),a.createElement(Ee,{basename:t,children:r,location:d.location,navigationType:d.action,navigator:l,future:n})}const Se=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Be=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ke=a.forwardRef(function(t,r){let{onClick:n,relative:o,reloadDocument:i,replace:l,state:d,target:c,to:f,preventScrollReset:u,viewTransition:s}=t,p=Re(t,we),{basename:v}=a.useContext(E),m,y=!1;if(typeof f=="string"&&Be.test(f)&&(m=f,Se))try{let g=new URL(window.location.href),L=f.startsWith("//")?new URL(g.protocol+f):new URL(f),F=W(L.pathname,v);L.origin===g.origin&&F!=null?f=F+L.search+L.hash:y=!0}catch{}let h=ne(f,{relative:o}),x=Ne(f,{replace:l,state:d,target:c,preventScrollReset:u,relative:o,viewTransition:s});function U(g){n&&n(g),g.defaultPrevented||x(g)}return a.createElement("a",O({},p,{href:m||h,onClick:y||i?n:U,ref:r,target:c}))});var M;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(M||(M={}));var A;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(A||(A={}));function Ne(e,t){let{target:r,replace:n,state:o,preventScrollReset:i,relative:l,viewTransition:d}=t===void 0?{}:t,c=q(),f=w(),u=G(e,{relative:l});return a.useCallback(s=>{if(be(s,r)){s.preventDefault();let p=n!==void 0?n:k(f)===k(u);c(e,{replace:p,state:o,preventScrollReset:i,relative:l,viewTransition:d})}},[f,c,u,n,o,r,e,i,l,d])}function Ie(e){let t=a.useRef(T(e)),r=a.useRef(!1),n=w(),o=a.useMemo(()=>Pe(n.search,r.current?null:t.current),[n.search]),i=q(),l=a.useCallback((d,c)=>{const f=T(typeof d=="function"?d(o):d);r.current=!0,i("?"+f,c)},[i,o]);return[o,l]}export{Fe as B,ke as L,_e as R,w as a,Ie as b,ye as c,q as u};