"use client";
import {
  __esm
} from "./chunk-GGWZFCYS.js";

// src/embed-shims/next-navigation.tsx
import { useEffect, useState } from "react";
function registerNavigation(nav) {
  impl = { ...impl, ...nav };
}
function fallbackUseRouter() {
  if (typeof window === "undefined") return noopRouter;
  return {
    push: (href) => window.location.assign(href),
    replace: (href) => window.location.replace(href),
    back: () => window.history.back(),
    forward: () => window.history.forward(),
    refresh: () => window.location.reload(),
    prefetch: () => {
    }
  };
}
function readLocation(read, fallback) {
  return typeof window === "undefined" ? fallback : read();
}
function useLocationSubscription() {
  const [tick, setTick] = useState(0);
  useEffect(() => {
    if (typeof window === "undefined") return;
    const onChange = () => setTick((t) => t + 1);
    window.addEventListener("popstate", onChange);
    return () => window.removeEventListener("popstate", onChange);
  }, []);
  return tick;
}
function fallbackUsePathname() {
  useLocationSubscription();
  return readLocation(() => window.location.pathname, "/");
}
function fallbackUseSearchParams() {
  useLocationSubscription();
  return readLocation(
    () => new URLSearchParams(window.location.search),
    new URLSearchParams()
  );
}
function fallbackUseParams() {
  return {};
}
function fallbackRedirect(url) {
  if (typeof window !== "undefined") window.location.assign(url);
  throw new Error(`[next-navigation shim] redirect(${url})`);
}
function fallbackPermanentRedirect(url) {
  if (typeof window !== "undefined") window.location.replace(url);
  throw new Error(`[next-navigation shim] permanentRedirect(${url})`);
}
function fallbackNotFound() {
  throw new Error("[next-navigation shim] notFound()");
}
function useRouter() {
  return (impl.useRouter ?? fallbackUseRouter)();
}
function usePathname() {
  return (impl.usePathname ?? fallbackUsePathname)();
}
function useSearchParams() {
  return (impl.useSearchParams ?? fallbackUseSearchParams)();
}
function useParams() {
  return (impl.useParams ?? fallbackUseParams)();
}
function redirect(url, type) {
  return (impl.redirect ?? fallbackRedirect)(url, type);
}
function permanentRedirect(url, type) {
  return (impl.permanentRedirect ?? fallbackPermanentRedirect)(url, type);
}
function notFound() {
  return (impl.notFound ?? fallbackNotFound)();
}
var impl, noopRouter, RedirectType, ServerInsertedHTMLContext;
var init_next_navigation = __esm({
  "src/embed-shims/next-navigation.tsx"() {
    impl = {};
    noopRouter = {
      push: () => {
      },
      replace: () => {
      },
      back: () => {
      },
      forward: () => {
      },
      refresh: () => {
      },
      prefetch: () => {
      }
    };
    RedirectType = {
      push: "push",
      replace: "replace"
    };
    ServerInsertedHTMLContext = null;
  }
});

export {
  registerNavigation,
  useRouter,
  usePathname,
  useSearchParams,
  useParams,
  redirect,
  permanentRedirect,
  notFound,
  RedirectType,
  ServerInsertedHTMLContext,
  init_next_navigation
};
//# sourceMappingURL=chunk-PLJLE4A4.js.map