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