import warning from "tiny-warning";
import { createRoute } from "./route.js";
import { useMatch } from "./useMatch.js";
import { useLoaderDeps } from "./useLoaderDeps.js";
import { useLoaderData } from "./useLoaderData.js";
import { useSearch } from "./useSearch.js";
import { useParams } from "./useParams.js";
import { useNavigate } from "./useNavigate.js";
import { useRouter } from "./useRouter.js";
import { useRouteContext } from "./useRouteContext.js";
function createFileRoute(path) {
  if (typeof path === "object") {
    return new FileRoute(path, {
      silent: true
    }).createRoute(path);
  }
  return new FileRoute(path, {
    silent: true
  }).createRoute;
}
class FileRoute {
  constructor(path, _opts) {
    this.path = path;
    this.createRoute = (options) => {
      if (process.env.NODE_ENV !== "production") {
        warning(
          this.silent,
          "FileRoute is deprecated and will be removed in the next major version. Use the createFileRoute(path)(options) function instead."
        );
      }
      const route = createRoute(options);
      route.isRoot = false;
      return route;
    };
    this.silent = _opts?.silent;
  }
}
function FileRouteLoader(_path) {
  if (process.env.NODE_ENV !== "production") {
    warning(
      false,
      `FileRouteLoader is deprecated and will be removed in the next major version. Please place the loader function in the the main route file, inside the \`createFileRoute('/path/to/file')(options)\` options`
    );
  }
  return (loaderFn) => loaderFn;
}
class LazyRoute {
  constructor(opts) {
    this.useMatch = (opts2) => {
      return useMatch({
        select: opts2?.select,
        from: this.options.id,
        structuralSharing: opts2?.structuralSharing
      });
    };
    this.useRouteContext = (opts2) => {
      return useRouteContext({ ...opts2, from: this.options.id });
    };
    this.useSearch = (opts2) => {
      return useSearch({
        select: opts2?.select,
        structuralSharing: opts2?.structuralSharing,
        from: this.options.id
      });
    };
    this.useParams = (opts2) => {
      return useParams({
        select: opts2?.select,
        structuralSharing: opts2?.structuralSharing,
        from: this.options.id
      });
    };
    this.useLoaderDeps = (opts2) => {
      return useLoaderDeps({ ...opts2, from: this.options.id });
    };
    this.useLoaderData = (opts2) => {
      return useLoaderData({ ...opts2, from: this.options.id });
    };
    this.useNavigate = () => {
      const router = useRouter();
      return useNavigate({ from: router.routesById[this.options.id].fullPath });
    };
    this.options = opts;
    this.$$typeof = /* @__PURE__ */ Symbol.for("react.memo");
  }
}
function createLazyRoute(id) {
  return (opts) => {
    return new LazyRoute({
      id,
      ...opts
    });
  };
}
function createLazyFileRoute(id) {
  if (typeof id === "object") {
    return new LazyRoute(id);
  }
  return (opts) => new LazyRoute({ id, ...opts });
}
export {
  FileRoute,
  FileRouteLoader,
  LazyRoute,
  createFileRoute,
  createLazyFileRoute,
  createLazyRoute
};//# sourceMappingURL=https://main.vscode-cdn.net/sourcemaps/e0b7a2bcf575cfba10528c4e7c10bd3ce2d7769a/node_modules/@tanstack/react-router/dist/esm/fileRoute.js.map
