{"version":3,"file":"Redirect.js","names":[],"sources":["esm/link/Redirect.js"],"sourcesContent":["import { useRef } from \"react\";\nimport { useRouter } from \"../hooks\";\nimport { useFocusEffect } from \"../useFocusEffect\";\nconst redirectsInFlight = /* @__PURE__ */ new Set();\nfunction Redirect({ href }) {\n  const router = useRouter();\n  const hasRedirected = useRef(false);\n  useFocusEffect(() => {\n    if (hasRedirected.current) return;\n    const key = typeof href === \"string\" ? href : JSON.stringify(href);\n    if (redirectsInFlight.has(key)) return;\n    hasRedirected.current = true;\n    redirectsInFlight.add(key);\n    Promise.resolve(router.replace(href)).catch((error) => {\n      hasRedirected.current = false;\n      console.error(error);\n    }).finally(() => {\n      redirectsInFlight.delete(key);\n    });\n  }, [href]);\n  return null;\n}\nexport {\n  Redirect\n};\n//# sourceMappingURL=Redirect.js.map\n"],"mappings":";;;;;AAGA,MAAM,oCAAoC,IAAI,IAAI;AAClD,SAAS,SAAS,EAAE,QAAQ;CAC1B,MAAM,SAAS,UAAU;CACzB,MAAM,gBAAgB,OAAO,KAAK;CAClC,qBAAqB;EACnB,IAAI,cAAc,SAAS;EAC3B,MAAM,MAAM,OAAO,SAAS,WAAW,OAAO,KAAK,UAAU,IAAI;EACjE,IAAI,kBAAkB,IAAI,GAAG,GAAG;EAChC,cAAc,UAAU;EACxB,kBAAkB,IAAI,GAAG;EACzB,QAAQ,QAAQ,OAAO,QAAQ,IAAI,CAAC,CAAC,CAAC,OAAO,UAAU;GACrD,cAAc,UAAU;GACxB,QAAQ,MAAM,KAAK;EACrB,CAAC,CAAC,CAAC,cAAc;GACf,kBAAkB,OAAO,GAAG;EAC9B,CAAC;CACH,GAAG,CAAC,IAAI,CAAC;CACT,OAAO;AACT"}