import{r as l,R as O}from"./react.js";import"./react-dom.js";import{l as _,R as k,N as x,u as F,a as P,b as N,c as j}from"./react-router.js";import{c as I,s as K,b as y}from"./@remix-run.js";/** * React Router DOM v6.30.3 * * 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 w(){return w=Object.assign?Object.assign.bind():function(e){for(var r=1;r=0)&&(a[s]=e[s]);return a}function A(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function W(e,r){return e.button===0&&(!r||r==="_self")&&!A(e)}const B=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],H="6";try{window.__reactRouterVersion=H}catch{}const z="startTransition",b=O[z];function Y(e){let{basename:r,children:a,future:t,window:s}=e,i=l.useRef();i.current==null&&(i.current=I({window:s,v5Compat:!0}));let o=i.current,[u,c]=l.useState({action:o.action,location:o.location}),{v7_startTransition:n}=t||{},f=l.useCallback(p=>{n&&b?b(()=>c(p)):c(p)},[c,n]);return l.useLayoutEffect(()=>o.listen(f),[o,f]),l.useEffect(()=>_(t),[t]),l.createElement(k,{basename:r,children:a,location:u.location,navigationType:u.action,navigator:o,future:t})}const G=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",M=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Z=l.forwardRef(function(r,a){let{onClick:t,relative:s,reloadDocument:i,replace:o,state:u,target:c,to:n,preventScrollReset:f,viewTransition:p}=r,m=V(r,B),{basename:U}=l.useContext(x),R,v=!1;if(typeof n=="string"&&M.test(n)&&(R=n,G))try{let h=new URL(window.location.href),d=n.startsWith("//")?new URL(h.protocol+n):new URL(n),g=K(d.pathname,U);d.origin===h.origin&&g!=null?n=g+d.search+d.hash:v=!0}catch{}let E=F(n,{relative:s}),C=X(n,{replace:o,state:u,target:c,preventScrollReset:f,relative:s,viewTransition:p});function L(h){t&&t(h),h.defaultPrevented||C(h)}return l.createElement("a",w({},m,{href:R||E,onClick:v||i?t:L,ref:a,target:c}))});var S;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(S||(S={}));var T;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(T||(T={}));function X(e,r){let{target:a,replace:t,state:s,preventScrollReset:i,relative:o,viewTransition:u}=r===void 0?{}:r,c=P(),n=N(),f=j(e,{relative:o});return l.useCallback(p=>{if(W(p,a)){p.preventDefault();let m=t!==void 0?t:y(n)===y(f);c(e,{replace:m,state:s,preventScrollReset:i,relative:o,viewTransition:u})}},[n,c,f,t,s,a,e,i,o,u])}export{Y as H,Z as L};