import{o as e}from"./rolldown-runtime-BTPm5ob3.js";import{r as t}from"./animations-BBry1XJJ.js";var n=e(t(),1);function r(e,t=`tab`){let[r,i]=(0,n.useState)(()=>new URLSearchParams(window.location.search).get(t)||e);return(0,n.useEffect)(()=>{let n=()=>{Promise.resolve().then(()=>{i(new URLSearchParams(window.location.search).get(t)||e)})};return window.addEventListener(`popstate`,n),window.addEventListener(`wawp-navigate`,n),()=>{window.removeEventListener(`popstate`,n),window.removeEventListener(`wawp-navigate`,n)}},[e,t]),(0,n.useEffect)(()=>{let n=new URL(window.location.href);r!==(n.searchParams.get(t)||e)&&(r===e?n.searchParams.delete(t):n.searchParams.set(t,r),window.history.replaceState({},``,n.toString()))},[r,e,t]),[r,i]}export{r as t};