"use client";
import { jsx } from 'react/jsx-runtime';
import { lazy } from 'react';
import { usePluginOverrides } from '@btst/stack/context';
import { ComposedRoute } from '@btst/stack/client/components';
import { DefaultError } from '../shared/default-error.mjs';
import { PostsLoading } from '../loading/index.mjs';
import { NotFoundPage } from './404-page.mjs';

const TagPage = lazy(
  () => import('./tag-page.internal.mjs').then((m) => ({ default: m.TagPage }))
);
function TagPageComponent({ tagSlug }) {
  const { onRouteError } = usePluginOverrides("blog");
  return /* @__PURE__ */ jsx(
    ComposedRoute,
    {
      path: `/blog/tag/${tagSlug}`,
      PageComponent: TagPage,
      ErrorComponent: DefaultError,
      LoadingComponent: PostsLoading,
      NotFoundComponent: NotFoundPage,
      props: { tagSlug },
      onError: (error) => {
        if (onRouteError) {
          onRouteError("tag", error, {
            path: `/blog/tag/${tagSlug}`,
            isSSR: typeof window === "undefined",
            tagSlug
          });
        }
      }
    }
  );
}

export { TagPageComponent };
