"use client";
'use strict';

const jsxRuntime = require('react/jsx-runtime');
const React = require('react');
const context = require('@btst/stack/context');
const components = require('@btst/stack/client/components');
const defaultError = require('../shared/default-error.cjs');
const index = require('../loading/index.cjs');
const _404Page = require('./404-page.cjs');

const PostPage = React.lazy(
  () => import('./post-page.internal.cjs').then((m) => ({ default: m.PostPage }))
);
function PostPageComponent({ slug }) {
  const { onRouteError } = context.usePluginOverrides("blog");
  return /* @__PURE__ */ jsxRuntime.jsx(
    components.ComposedRoute,
    {
      path: `/blog/${slug}`,
      PageComponent: PostPage,
      ErrorComponent: defaultError.DefaultError,
      LoadingComponent: index.PostLoading,
      NotFoundComponent: _404Page.NotFoundPage,
      props: { slug },
      onError: (error) => {
        if (onRouteError) {
          onRouteError("post", error, {
            path: `/blog/${slug}`,
            isSSR: typeof window === "undefined",
            slug
          });
        }
      }
    }
  );
}

exports.PostPageComponent = PostPageComponent;
