import{r as a,R as q}from"./react-WWJ_A68P.js";import{R as Q}from"./react-dom-CvjNlBjt.js";import{m as Z,u as F,a as M,D as j,b as B,R as $,c as ee,N as z,d as te,e as re,f as ne,g as ae}from"./react-router-UVekkiTI.js";import{b as oe,d as se,E as ie,s as H,e as N,i as W}from"./@remix-run-DhIrJP8L.js";/** * React Router DOM v6.26.1 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function _(){return _=Object.assign?Object.assign.bind():function(e){for(var r=1;r=0)&&(t[n]=e[n]);return t}function ue(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function ce(e,r){return e.button===0&&(!r||r==="_self")&&!ue(e)}function U(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((r,t)=>{let o=e[t];return r.concat(Array.isArray(o)?o.map(n=>[t,n]):[[t,o]])},[]))}function fe(e,r){let t=U(e);return r&&r.forEach((o,n)=>{t.has(n)||r.getAll(n).forEach(s=>{t.append(n,s)})}),t}const de=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"],he="6";try{window.__reactRouterVersion=he}catch{}function Ie(e,r){return oe({basename:void 0,future:_({},void 0,{v7_prependBasename:!0}),history:se({window:void 0}),hydrationData:pe(),routes:e,mapRouteProperties:Z,unstable_dataStrategy:void 0,unstable_patchRoutesOnNavigation:void 0,window:void 0}).initialize()}function pe(){var e;let r=(e=window)==null?void 0:e.__staticRouterHydrationData;return r&&r.errors&&(r=_({},r,{errors:ve(r.errors)})),r}function ve(e){if(!e)return null;let r=Object.entries(e),t={};for(let[o,n]of r)if(n&&n.__type==="RouteErrorResponse")t[o]=new ie(n.status,n.statusText,n.data,n.internal===!0);else if(n&&n.__type==="Error"){if(n.__subType){let s=window[n.__subType];if(typeof s=="function")try{let u=new s(n.message);u.stack="",t[o]=u}catch{}}if(t[o]==null){let s=new Error(n.message);s.stack="",t[o]=s}}else t[o]=n;return t}const me=a.createContext({isTransitioning:!1}),we=a.createContext(new Map),Se="startTransition",A=q[Se],Re="flushSync",K=Q[Re];function ye(e){A?A(e):e()}function C(e){K?K(e):e()}class ge{constructor(){this.status="pending",this.promise=new Promise((r,t)=>{this.resolve=o=>{this.status==="pending"&&(this.status="resolved",r(o))},this.reject=o=>{this.status==="pending"&&(this.status="rejected",t(o))}})}}function Ne(e){let{fallbackElement:r,router:t,future:o}=e,[n,s]=a.useState(t.state),[u,c]=a.useState(),[f,l]=a.useState({isTransitioning:!1}),[i,p]=a.useState(),[h,w]=a.useState(),[S,P]=a.useState(),T=a.useRef(new Map),{v7_startTransition:x}=o||{},L=a.useCallback(d=>{x?ye(d):d()},[x]),v=a.useCallback((d,y)=>{let{deletedFetchers:m,unstable_flushSync:I,unstable_viewTransitionOpts:g}=y;m.forEach(E=>T.current.delete(E)),d.fetchers.forEach((E,X)=>{E.data!==void 0&&T.current.set(X,E.data)});let J=t.window==null||t.window.document==null||typeof t.window.document.startViewTransition!="function";if(!g||J){I?C(()=>s(d)):L(()=>s(d));return}if(I){C(()=>{h&&(i&&i.resolve(),h.skipTransition()),l({isTransitioning:!0,flushSync:!0,currentLocation:g.currentLocation,nextLocation:g.nextLocation})});let E=t.window.document.startViewTransition(()=>{C(()=>s(d))});E.finished.finally(()=>{C(()=>{p(void 0),w(void 0),c(void 0),l({isTransitioning:!1})})}),C(()=>w(E));return}h?(i&&i.resolve(),h.skipTransition(),P({state:d,currentLocation:g.currentLocation,nextLocation:g.nextLocation})):(c(d),l({isTransitioning:!0,flushSync:!1,currentLocation:g.currentLocation,nextLocation:g.nextLocation}))},[t.window,h,i,T,L]);a.useLayoutEffect(()=>t.subscribe(v),[t,v]),a.useEffect(()=>{f.isTransitioning&&!f.flushSync&&p(new ge)},[f]),a.useEffect(()=>{if(i&&u&&t.window){let d=u,y=i.promise,m=t.window.document.startViewTransition(async()=>{L(()=>s(d)),await y});m.finished.finally(()=>{p(void 0),w(void 0),c(void 0),l({isTransitioning:!1})}),w(m)}},[L,u,i,t.window]),a.useEffect(()=>{i&&u&&n.location.key===u.location.key&&i.resolve()},[i,h,n.location,u]),a.useEffect(()=>{!f.isTransitioning&&S&&(c(S.state),l({isTransitioning:!0,flushSync:!1,currentLocation:S.currentLocation,nextLocation:S.nextLocation}),P(void 0))},[f.isTransitioning,S]),a.useEffect(()=>{},[]);let R=a.useMemo(()=>({createHref:t.createHref,encodeLocation:t.encodeLocation,go:d=>t.navigate(d),push:(d,y,m)=>t.navigate(d,{state:y,preventScrollReset:m==null?void 0:m.preventScrollReset}),replace:(d,y,m)=>t.navigate(d,{replace:!0,state:y,preventScrollReset:m==null?void 0:m.preventScrollReset})}),[t]),b=t.basename||"/",Y=a.useMemo(()=>({router:t,navigator:R,static:!1,basename:b}),[t,R,b]),G=a.useMemo(()=>({v7_relativeSplatPath:t.future.v7_relativeSplatPath}),[t.future.v7_relativeSplatPath]);return a.createElement(a.Fragment,null,a.createElement(j.Provider,{value:Y},a.createElement(B.Provider,{value:n},a.createElement(we.Provider,{value:T.current},a.createElement(me.Provider,{value:f},a.createElement($,{basename:b,location:n.location,navigationType:n.historyAction,navigator:R,future:G},n.initialized||t.future.v7_partialHydration?a.createElement(Ee,{routes:t.routes,future:t.future,state:n}):r))))),null)}const Ee=a.memo(Te);function Te(e){let{routes:r,future:t,state:o}=e;return ee(r,void 0,o,t)}const Le=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",be=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ae=a.forwardRef(function(r,t){let{onClick:o,relative:n,reloadDocument:s,replace:u,state:c,target:f,to:l,preventScrollReset:i,unstable_viewTransition:p}=r,h=le(r,de),{basename:w}=a.useContext(z),S,P=!1;if(typeof l=="string"&&be.test(l)&&(S=l,Le))try{let v=new URL(window.location.href),R=l.startsWith("//")?new URL(v.protocol+l):new URL(l),b=H(R.pathname,w);R.origin===v.origin&&b!=null?l=b+R.search+R.hash:P=!0}catch{}let T=te(l,{relative:n}),x=Ce(l,{replace:u,state:c,target:f,preventScrollReset:i,relative:n,unstable_viewTransition:p});function L(v){o&&o(v),v.defaultPrevented||x(v)}return a.createElement("a",_({},h,{href:S||T,onClick:P||s?o:L,ref:t,target:f}))});function Ke(e){let{getKey:r,storageKey:t}=e;return xe({getKey:r,storageKey:t}),null}var k;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(k||(k={}));var D;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(D||(D={}));function _e(e){let r=a.useContext(j);return r||W(!1),r}function Pe(e){let r=a.useContext(B);return r||W(!1),r}function Ce(e,r){let{target:t,replace:o,state:n,preventScrollReset:s,relative:u,unstable_viewTransition:c}=r===void 0?{}:r,f=M(),l=F(),i=re(e,{relative:u});return a.useCallback(p=>{if(ce(p,t)){p.preventDefault();let h=o!==void 0?o:N(l)===N(i);f(e,{replace:h,state:n,preventScrollReset:s,relative:u,unstable_viewTransition:c})}},[l,f,i,o,n,t,e,s,u,c])}function Ve(e){let r=a.useRef(U(e)),t=a.useRef(!1),o=F(),n=a.useMemo(()=>fe(o.search,t.current?null:r.current),[o.search]),s=M(),u=a.useCallback((c,f)=>{const l=U(typeof c=="function"?c(n):c);t.current=!0,s("?"+l,f)},[s,n]);return[n,u]}const V="react-router-scroll-positions";let O={};function xe(e){let{getKey:r,storageKey:t}=e===void 0?{}:e,{router:o}=_e(k.UseScrollRestoration),{restoreScrollPosition:n,preventScrollReset:s}=Pe(D.UseScrollRestoration),{basename:u}=a.useContext(z),c=F(),f=ne(),l=ae();a.useEffect(()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"}),[]),Oe(a.useCallback(()=>{if(l.state==="idle"){let i=(r?r(c,f):null)||c.key;O[i]=window.scrollY}try{sessionStorage.setItem(t||V,JSON.stringify(O))}catch{}window.history.scrollRestoration="auto"},[t,r,l.state,c,f])),typeof document<"u"&&(a.useLayoutEffect(()=>{try{let i=sessionStorage.getItem(t||V);i&&(O=JSON.parse(i))}catch{}},[t]),a.useLayoutEffect(()=>{let i=r&&u!=="/"?(h,w)=>r(_({},h,{pathname:H(h.pathname,u)||h.pathname}),w):r,p=o==null?void 0:o.enableScrollRestoration(O,()=>window.scrollY,i);return()=>p&&p()},[o,u,r]),a.useLayoutEffect(()=>{if(n!==!1){if(typeof n=="number"){window.scrollTo(0,n);return}if(c.hash){let i=document.getElementById(decodeURIComponent(c.hash.slice(1)));if(i){i.scrollIntoView();return}}s!==!0&&window.scrollTo(0,0)}},[c,n,s]))}function Oe(e,r){let{capture:t}={};a.useEffect(()=>{let o=t!=null?{capture:t}:void 0;return window.addEventListener("pagehide",e,o),()=>{window.removeEventListener("pagehide",e,o)}},[e,t])}export{Ae as L,Ne as R,Ke as S,U as a,Ie as c,Ve as u};