"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 _404Page = require('./404-page.cjs');
const listSkeleton = require('../loading/list-skeleton.cjs');

const ContentListPageInternal = React.lazy(
  () => import('./content-list-page.internal.cjs').then((m) => ({
    default: m.ContentListPage
  }))
);
function ContentListPageComponent({
  typeSlug
}) {
  const { onRouteError } = context.usePluginOverrides("cms");
  return /* @__PURE__ */ jsxRuntime.jsx(
    components.ComposedRoute,
    {
      path: `/cms/${typeSlug}`,
      PageComponent: ContentListPageInternal,
      ErrorComponent: defaultError.DefaultError,
      LoadingComponent: listSkeleton.ListSkeleton,
      NotFoundComponent: _404Page.NotFoundPage,
      props: { typeSlug },
      onError: (error) => {
        if (onRouteError) {
          onRouteError("contentList", error, {
            path: `/cms/${typeSlug}`,
            params: { typeSlug },
            isSSR: typeof window === "undefined"
          });
        }
      }
    }
  );
}

exports.ContentListPageComponent = ContentListPageComponent;
