try{let e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`57da379e-18fd-4679-a0c0-da983c3fa07d`,e._sentryDebugIdIdentifier=`sentry-dbid-57da379e-18fd-4679-a0c0-da983c3fa07d`)}catch{}import{o as e}from"./rolldown-runtime-eb2nym32.js";import{t}from"./useIntraDialogHistory-jdzxwi77.js";import{t as n}from"./useLocation-fu2554ly.js";import{Fg as r,Gp as i,Ig as a,Qp as o,ch as s,ti as c}from"./entry.client-dr7r6s9a.js";import{s as l}from"./DialogShell-k2jpaw9r.js";var u=r(),d=e(a(),1);function f(e,t){if(!t)return`unknown`;try{return e.matchRoutes(t,{}).at(-1)?.fullPath??`unknown`}catch{return`unknown`}}var p=()=>{let e=(0,u.c)(6),t=i(),r=o(),{trackUserAction:a}=s(),l=n(),p=(0,d.useRef)(l),m=(0,d.useRef)(r),h;e[0]!==l||e[1]!==r?(h=()=>{p.current=l,m.current=r},e[0]=l,e[1]=r,e[2]=h):h=e[2],(0,d.useEffect)(h);let g;return e[3]!==t||e[4]!==a?(g=e=>{let n=p.current,r=c(e),i=new URL(`https://example.com${r}`).pathname;t({to:e.to,params:e.params,search:e.search,replace:e.replace,state:{prevPath:i===n.pathname?n.state?.prevPath:n.pathname}}),i!==n.pathname&&a(`NavigateInModal`,{destination:e.to,source:f(m.current,n.pathname)},`Press`)},e[3]=t,e[4]=a,e[5]=g):g=e[5],g},m=()=>{let e=(0,u.c)(8),r=t(),{onClose:i}=l(),{trackUserAction:a}=s(),c=n(),d=o(),p;e[0]!==r||e[1]!==a||e[2]!==d||e[3]!==c.state||e[4]!==c.pathname?(p=()=>{r.goBack(),a(`NavigateInModal`,{destination:f(d,c.state?.prevPath??``),source:f(d,c.pathname)},`Press`)},e[0]=r,e[1]=a,e[2]=d,e[3]=c.state,e[4]=c.pathname,e[5]=p):p=e[5];let m=p,h;e[6]===i?h=e[7]:(h=()=>{i()},e[6]=i,e[7]=h);let g=h;return r.index===0?g:m};export{m as n,p as t};