// AUTO-GENERATED by `wrnexus dev` - do not edit.
// Typed routes support required, optional, and catch-all parameters.

export interface Routes {
  "/": Record<string, never>;
  "/accessibility": Record<string, never>;
  "/advanced-forms": Record<string, never>;
  "/base": Record<string, never>;
  "/block-library": Record<string, never>;
  "/colors": Record<string, never>;
  "/components/accordion": Record<string, never>;
  "/components/advanced-select": Record<string, never>;
  "/components/alert": Record<string, never>;
  "/components/announcement-bar": Record<string, never>;
  "/components/auth-form": Record<string, never>;
  "/components/auth-split-layout": Record<string, never>;
  "/components/avatar": Record<string, never>;
  "/components/avatar-group": Record<string, never>;
  "/components/back-to-top": Record<string, never>;
  "/components/badge": Record<string, never>;
  "/components/blockquote": Record<string, never>;
  "/components/breadcrumb": Record<string, never>;
  "/components/button": Record<string, never>;
  "/components/button-group": Record<string, never>;
  "/components/card": Record<string, never>;
  "/components/carousel": Record<string, never>;
  "/components/chart": Record<string, never>;
  "/components/chat-bubble": Record<string, never>;
  "/components/checkbox": Record<string, never>;
  "/components/clipboard": Record<string, never>;
  "/components/collapse": Record<string, never>;
  "/components/color-picker": Record<string, never>;
  "/components/columns": Record<string, never>;
  "/components/combo-box": Record<string, never>;
  "/components/confetti": Record<string, never>;
  "/components/container": Record<string, never>;
  "/components/context-menu": Record<string, never>;
  "/components/ctasection": Record<string, never>;
  "/components/custom-scrollbar": Record<string, never>;
  "/components/data-map": Record<string, never>;
  "/components/data-table": Record<string, never>;
  "/components/date-picker": Record<string, never>;
  "/components/device-frame": Record<string, never>;
  "/components/divider": Record<string, never>;
  "/components/drag-and-drop": Record<string, never>;
  "/components/drawer": Record<string, never>;
  "/components/dropdown": Record<string, never>;
  "/components/feature-card": Record<string, never>;
  "/components/feature-grid": Record<string, never>;
  "/components/feature-icon-card": Record<string, never>;
  "/components/file-input": Record<string, never>;
  "/components/file-upload-progress": Record<string, never>;
  "/components/footer": Record<string, never>;
  "/components/grid": Record<string, never>;
  "/components/hero": Record<string, never>;
  "/components/hero-actions": Record<string, never>;
  "/components/image": Record<string, never>;
  "/components/input": Record<string, never>;
  "/components/input-group": Record<string, never>;
  "/components/input-number": Record<string, never>;
  "/components/kbd": Record<string, never>;
  "/components/layout-splitter": Record<string, never>;
  "/components/legend-indicator": Record<string, never>;
  "/components/link": Record<string, never>;
  "/components/list": Record<string, never>;
  "/components/list-group": Record<string, never>;
  "/components/map": Record<string, never>;
  "/components/marketing-section-header": Record<string, never>;
  "/components/marquee": Record<string, never>;
  "/components/mega-menu": Record<string, never>;
  "/components/metric-card": Record<string, never>;
  "/components/metric-grid": Record<string, never>;
  "/components/modal": Record<string, never>;
  "/components/nav": Record<string, never>;
  "/components/navbar": Record<string, never>;
  "/components/page-header": Record<string, never>;
  "/components/pagination": Record<string, never>;
  "/components/pin-input": Record<string, never>;
  "/components/popover": Record<string, never>;
  "/components/portal-dashboard": Record<string, never>;
  "/components/preference-switcher": Record<string, never>;
  "/components/progress": Record<string, never>;
  "/components/public-page-shell": Record<string, never>;
  "/components/radio": Record<string, never>;
  "/components/range-slider": Record<string, never>;
  "/components/rating": Record<string, never>;
  "/components/scrollspy": Record<string, never>;
  "/components/search-box": Record<string, never>;
  "/components/section": Record<string, never>;
  "/components/section-header": Record<string, never>;
  "/components/select": Record<string, never>;
  "/components/sidebar": Record<string, never>;
  "/components/skeleton": Record<string, never>;
  "/components/spinner": Record<string, never>;
  "/components/split-hero": Record<string, never>;
  "/components/stats-bar": Record<string, never>;
  "/components/stepper": Record<string, never>;
  "/components/strong-password": Record<string, never>;
  "/components/styled-icon": Record<string, never>;
  "/components/switch": Record<string, never>;
  "/components/tabs": Record<string, never>;
  "/components/text-link": Record<string, never>;
  "/components/textarea": Record<string, never>;
  "/components/time-picker": Record<string, never>;
  "/components/timeline": Record<string, never>;
  "/components/toaster": Record<string, never>;
  "/components/toggle-count": Record<string, never>;
  "/components/toggle-password": Record<string, never>;
  "/components/tooltip": Record<string, never>;
  "/components/tree-view": Record<string, never>;
  "/components/typography": Record<string, never>;
  "/components/wysiwyg-editor": Record<string, never>;
  "/core": Record<string, never>;
  "/dark-mode": Record<string, never>;
  "/data": Record<string, never>;
  "/docs": Record<string, never>;
  "/fonts": Record<string, never>;
  "/forms": Record<string, never>;
  "/framework-guides": Record<string, never>;
  "/installation": Record<string, never>;
  "/integrations": Record<string, never>;
  "/layout": Record<string, never>;
  "/marketing": Record<string, never>;
  "/navigation": Record<string, never>;
  "/overlays": Record<string, never>;
  "/resources": Record<string, never>;
  "/sizing": Record<string, never>;
  "/tables": Record<string, never>;
  "/templates": Record<string, never>;
  "/themes": Record<string, never>;
  "/v06-functions": Record<string, never>;
  "/v06-imports": Record<string, never>;
  "/v06-migration": Record<string, never>;
  "/v06-outputs": Record<string, never>;
  "/v06-runtime": Record<string, never>;
  "/v06-state": Record<string, never>;
  "/v06-stores": Record<string, never>;
  "/v06-types": Record<string, never>;
}

export interface RouteNames {
  "index": "/";
  "accessibility": "/accessibility";
  "advanced.forms": "/advanced-forms";
  "base": "/base";
  "block.library": "/block-library";
  "colors": "/colors";
  "components.accordion": "/components/accordion";
  "components.advanced.select": "/components/advanced-select";
  "components.alert": "/components/alert";
  "components.announcement.bar": "/components/announcement-bar";
  "components.auth.form": "/components/auth-form";
  "components.auth.split.layout": "/components/auth-split-layout";
  "components.avatar": "/components/avatar";
  "components.avatar.group": "/components/avatar-group";
  "components.back.to.top": "/components/back-to-top";
  "components.badge": "/components/badge";
  "components.blockquote": "/components/blockquote";
  "components.breadcrumb": "/components/breadcrumb";
  "components.button": "/components/button";
  "components.button.group": "/components/button-group";
  "components.card": "/components/card";
  "components.carousel": "/components/carousel";
  "components.chart": "/components/chart";
  "components.chat.bubble": "/components/chat-bubble";
  "components.checkbox": "/components/checkbox";
  "components.clipboard": "/components/clipboard";
  "components.collapse": "/components/collapse";
  "components.color.picker": "/components/color-picker";
  "components.columns": "/components/columns";
  "components.combo.box": "/components/combo-box";
  "components.confetti": "/components/confetti";
  "components.container": "/components/container";
  "components.context.menu": "/components/context-menu";
  "components.ctasection": "/components/ctasection";
  "components.custom.scrollbar": "/components/custom-scrollbar";
  "components.data.map": "/components/data-map";
  "components.data.table": "/components/data-table";
  "components.date.picker": "/components/date-picker";
  "components.device.frame": "/components/device-frame";
  "components.divider": "/components/divider";
  "components.drag.and.drop": "/components/drag-and-drop";
  "components.drawer": "/components/drawer";
  "components.dropdown": "/components/dropdown";
  "components.feature.card": "/components/feature-card";
  "components.feature.grid": "/components/feature-grid";
  "components.feature.icon.card": "/components/feature-icon-card";
  "components.file.input": "/components/file-input";
  "components.file.upload.progress": "/components/file-upload-progress";
  "components.footer": "/components/footer";
  "components.grid": "/components/grid";
  "components.hero": "/components/hero";
  "components.hero.actions": "/components/hero-actions";
  "components.image": "/components/image";
  "components.input": "/components/input";
  "components.input.group": "/components/input-group";
  "components.input.number": "/components/input-number";
  "components.kbd": "/components/kbd";
  "components.layout.splitter": "/components/layout-splitter";
  "components.legend.indicator": "/components/legend-indicator";
  "components.link": "/components/link";
  "components.list": "/components/list";
  "components.list.group": "/components/list-group";
  "components.map": "/components/map";
  "components.marketing.section.header": "/components/marketing-section-header";
  "components.marquee": "/components/marquee";
  "components.mega.menu": "/components/mega-menu";
  "components.metric.card": "/components/metric-card";
  "components.metric.grid": "/components/metric-grid";
  "components.modal": "/components/modal";
  "components.nav": "/components/nav";
  "components.navbar": "/components/navbar";
  "components.page.header": "/components/page-header";
  "components.pagination": "/components/pagination";
  "components.pin.input": "/components/pin-input";
  "components.popover": "/components/popover";
  "components.portal.dashboard": "/components/portal-dashboard";
  "components.preference.switcher": "/components/preference-switcher";
  "components.progress": "/components/progress";
  "components.public.page.shell": "/components/public-page-shell";
  "components.radio": "/components/radio";
  "components.range.slider": "/components/range-slider";
  "components.rating": "/components/rating";
  "components.scrollspy": "/components/scrollspy";
  "components.search.box": "/components/search-box";
  "components.section": "/components/section";
  "components.section.header": "/components/section-header";
  "components.select": "/components/select";
  "components.sidebar": "/components/sidebar";
  "components.skeleton": "/components/skeleton";
  "components.spinner": "/components/spinner";
  "components.split.hero": "/components/split-hero";
  "components.stats.bar": "/components/stats-bar";
  "components.stepper": "/components/stepper";
  "components.strong.password": "/components/strong-password";
  "components.styled.icon": "/components/styled-icon";
  "components.switch": "/components/switch";
  "components.tabs": "/components/tabs";
  "components.text.link": "/components/text-link";
  "components.textarea": "/components/textarea";
  "components.time.picker": "/components/time-picker";
  "components.timeline": "/components/timeline";
  "components.toaster": "/components/toaster";
  "components.toggle.count": "/components/toggle-count";
  "components.toggle.password": "/components/toggle-password";
  "components.tooltip": "/components/tooltip";
  "components.tree.view": "/components/tree-view";
  "components.typography": "/components/typography";
  "components.wysiwyg.editor": "/components/wysiwyg-editor";
  "core": "/core";
  "dark.mode": "/dark-mode";
  "data": "/data";
  "docs": "/docs";
  "fonts": "/fonts";
  "forms": "/forms";
  "framework.guides": "/framework-guides";
  "installation": "/installation";
  "integrations": "/integrations";
  "layout": "/layout";
  "marketing": "/marketing";
  "navigation": "/navigation";
  "overlays": "/overlays";
  "resources": "/resources";
  "sizing": "/sizing";
  "tables": "/tables";
  "templates": "/templates";
  "themes": "/themes";
  "v06.functions": "/v06-functions";
  "v06.imports": "/v06-imports";
  "v06.migration": "/v06-migration";
  "v06.outputs": "/v06-outputs";
  "v06.runtime": "/v06-runtime";
  "v06.state": "/v06-state";
  "v06.stores": "/v06-stores";
  "v06.types": "/v06-types";
}

export interface RouteQueries {
  [path: string]: Record<string, string | number | boolean | null | undefined>;
}

export type RoutePath = keyof Routes;
export type RouteName = keyof RouteNames;
export type RouteQuery<P extends RoutePath> = P extends keyof RouteQueries
  ? RouteQueries[P]
  : Record<string, string | number | boolean | null | undefined>;
type RouteValue = string | readonly string[] | undefined;

function encodeRouteValue(value: RouteValue, catchAll: boolean): string {
  if (value === undefined) return "";
  const values = Array.isArray(value) ? value : catchAll ? String(value).split("/") : [String(value)];
  return values.map((part) => encodeURIComponent(part)).join("/");
}

function buildHref(path: string, params: Record<string, RouteValue> = {}): string {
  const output: string[] = [];
  for (const segment of path.split("/").filter(Boolean)) {
    let name: string | undefined;
    let optional = false;
    let catchAll = false;
    if (segment.startsWith("[[") && segment.endsWith("]]")) {
      optional = true;
      name = segment.slice(2, -2);
    } else if (segment.startsWith("[") && segment.endsWith("]")) {
      name = segment.slice(1, -1);
      if (name.endsWith("?")) {
        optional = true;
        name = name.slice(0, -1);
      }
    }
    if (!name) {
      output.push(segment);
      continue;
    }
    if (name.startsWith("...")) {
      catchAll = true;
      name = name.slice(3);
    }
    const value = params[name];
    if (value === undefined && optional) continue;
    if (value === undefined) throw new Error(`WRN-ROUTE-MISSING-PARAM: Missing route parameter '${name}'.`);
    output.push(encodeRouteValue(value, catchAll));
  }
  return "/" + output.filter(Boolean).join("/");
}

export function href<P extends RoutePath>(
  path: P,
  ...args: keyof Routes[P] extends never
    ? []
    : Record<string, never> extends Routes[P]
      ? [params?: Routes[P]]
      : [params: Routes[P]]
): string {
  const params = (args[0] ?? {}) as Record<string, RouteValue>;
  return buildHref(String(path), params);
}

export function route<N extends RouteName>(
  name: N,
  ...args: keyof Routes[RouteNames[N]] extends never
    ? [params?: Routes[RouteNames[N]], query?: RouteQuery<RouteNames[N]>]
    : Record<string, never> extends Routes[RouteNames[N]]
      ? [params?: Routes[RouteNames[N]], query?: RouteQuery<RouteNames[N]>]
      : [params: Routes[RouteNames[N]], query?: RouteQuery<RouteNames[N]>]
): string {
  const paths: Record<RouteName, RoutePath> = {
  "index": "/",
  "accessibility": "/accessibility",
  "advanced.forms": "/advanced-forms",
  "base": "/base",
  "block.library": "/block-library",
  "colors": "/colors",
  "components.accordion": "/components/accordion",
  "components.advanced.select": "/components/advanced-select",
  "components.alert": "/components/alert",
  "components.announcement.bar": "/components/announcement-bar",
  "components.auth.form": "/components/auth-form",
  "components.auth.split.layout": "/components/auth-split-layout",
  "components.avatar": "/components/avatar",
  "components.avatar.group": "/components/avatar-group",
  "components.back.to.top": "/components/back-to-top",
  "components.badge": "/components/badge",
  "components.blockquote": "/components/blockquote",
  "components.breadcrumb": "/components/breadcrumb",
  "components.button": "/components/button",
  "components.button.group": "/components/button-group",
  "components.card": "/components/card",
  "components.carousel": "/components/carousel",
  "components.chart": "/components/chart",
  "components.chat.bubble": "/components/chat-bubble",
  "components.checkbox": "/components/checkbox",
  "components.clipboard": "/components/clipboard",
  "components.collapse": "/components/collapse",
  "components.color.picker": "/components/color-picker",
  "components.columns": "/components/columns",
  "components.combo.box": "/components/combo-box",
  "components.confetti": "/components/confetti",
  "components.container": "/components/container",
  "components.context.menu": "/components/context-menu",
  "components.ctasection": "/components/ctasection",
  "components.custom.scrollbar": "/components/custom-scrollbar",
  "components.data.map": "/components/data-map",
  "components.data.table": "/components/data-table",
  "components.date.picker": "/components/date-picker",
  "components.device.frame": "/components/device-frame",
  "components.divider": "/components/divider",
  "components.drag.and.drop": "/components/drag-and-drop",
  "components.drawer": "/components/drawer",
  "components.dropdown": "/components/dropdown",
  "components.feature.card": "/components/feature-card",
  "components.feature.grid": "/components/feature-grid",
  "components.feature.icon.card": "/components/feature-icon-card",
  "components.file.input": "/components/file-input",
  "components.file.upload.progress": "/components/file-upload-progress",
  "components.footer": "/components/footer",
  "components.grid": "/components/grid",
  "components.hero": "/components/hero",
  "components.hero.actions": "/components/hero-actions",
  "components.image": "/components/image",
  "components.input": "/components/input",
  "components.input.group": "/components/input-group",
  "components.input.number": "/components/input-number",
  "components.kbd": "/components/kbd",
  "components.layout.splitter": "/components/layout-splitter",
  "components.legend.indicator": "/components/legend-indicator",
  "components.link": "/components/link",
  "components.list": "/components/list",
  "components.list.group": "/components/list-group",
  "components.map": "/components/map",
  "components.marketing.section.header": "/components/marketing-section-header",
  "components.marquee": "/components/marquee",
  "components.mega.menu": "/components/mega-menu",
  "components.metric.card": "/components/metric-card",
  "components.metric.grid": "/components/metric-grid",
  "components.modal": "/components/modal",
  "components.nav": "/components/nav",
  "components.navbar": "/components/navbar",
  "components.page.header": "/components/page-header",
  "components.pagination": "/components/pagination",
  "components.pin.input": "/components/pin-input",
  "components.popover": "/components/popover",
  "components.portal.dashboard": "/components/portal-dashboard",
  "components.preference.switcher": "/components/preference-switcher",
  "components.progress": "/components/progress",
  "components.public.page.shell": "/components/public-page-shell",
  "components.radio": "/components/radio",
  "components.range.slider": "/components/range-slider",
  "components.rating": "/components/rating",
  "components.scrollspy": "/components/scrollspy",
  "components.search.box": "/components/search-box",
  "components.section": "/components/section",
  "components.section.header": "/components/section-header",
  "components.select": "/components/select",
  "components.sidebar": "/components/sidebar",
  "components.skeleton": "/components/skeleton",
  "components.spinner": "/components/spinner",
  "components.split.hero": "/components/split-hero",
  "components.stats.bar": "/components/stats-bar",
  "components.stepper": "/components/stepper",
  "components.strong.password": "/components/strong-password",
  "components.styled.icon": "/components/styled-icon",
  "components.switch": "/components/switch",
  "components.tabs": "/components/tabs",
  "components.text.link": "/components/text-link",
  "components.textarea": "/components/textarea",
  "components.time.picker": "/components/time-picker",
  "components.timeline": "/components/timeline",
  "components.toaster": "/components/toaster",
  "components.toggle.count": "/components/toggle-count",
  "components.toggle.password": "/components/toggle-password",
  "components.tooltip": "/components/tooltip",
  "components.tree.view": "/components/tree-view",
  "components.typography": "/components/typography",
  "components.wysiwyg.editor": "/components/wysiwyg-editor",
  "core": "/core",
  "dark.mode": "/dark-mode",
  "data": "/data",
  "docs": "/docs",
  "fonts": "/fonts",
  "forms": "/forms",
  "framework.guides": "/framework-guides",
  "installation": "/installation",
  "integrations": "/integrations",
  "layout": "/layout",
  "marketing": "/marketing",
  "navigation": "/navigation",
  "overlays": "/overlays",
  "resources": "/resources",
  "sizing": "/sizing",
  "tables": "/tables",
  "templates": "/templates",
  "themes": "/themes",
  "v06.functions": "/v06-functions",
  "v06.imports": "/v06-imports",
  "v06.migration": "/v06-migration",
  "v06.outputs": "/v06-outputs",
  "v06.runtime": "/v06-runtime",
  "v06.state": "/v06-state",
  "v06.stores": "/v06-stores",
  "v06.types": "/v06-types"
} as Record<RouteName, RoutePath>;
  const output = buildHref(paths[name], (args[0] ?? {}) as Record<string, RouteValue>);
  const query = args[1];
  if (!query) return output;
  const search = new URLSearchParams();
  for (const [key, value] of Object.entries(query))
    if (value !== undefined && value !== null) search.set(key, String(value));
  const text = search.toString();
  return text ? `${output}?${text}` : output;
}
