'use client';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Fragment } from 'react';
import { BackLink } from '@not-govuk/back-link';
import { Breadcrumbs } from '@not-govuk/breadcrumbs';
import { classBuilder } from '@react-foundry/component-helpers';
import { Footer } from '@not-govuk/footer';
import { Header } from '@not-govuk/header';
import { A } from '@not-govuk/link';
import { PhaseBanner } from '@not-govuk/phase-banner';
import { ServiceNavigation } from '@not-govuk/service-navigation';
import { SkipLink } from '@not-govuk/skip-link';
import { WidthContainer } from '@not-govuk/width-container';
import '../assets/Page.scss';
export const Page = ({ backHref, breadcrumbs, children, classBlock, classModifiers: _classModifiers, className: _className, department, feedbackHref, footerContent, footerNavigation, govUK, logo, maxContentsWidth, meta, metaTitle, navigation, organisationHref, organisationText, phase, phaseBannerContent, rebrand = false, serviceHref, serviceName, signOutHref, signOutText, ...attrs }) => {
    const classModifiers = (Array.isArray(_classModifiers)
        ? _classModifiers
        : [_classModifiers]);
    const className = _className || '';
    const classes = classBuilder('not-govuk-page', classBlock, [...classModifiers, department], className + (rebrand ? ' govuk-template--rebranded' : ''));
    const headerProps = {
        department,
        govUK,
        logo,
        maxContentsWidth,
        organisationHref,
        organisationText,
        rebrand
    };
    const navigationProps = {
        maxContentsWidth,
        items: navigation,
        serviceHref,
        serviceName,
        signOutHref,
        signOutText
    };
    const footerProps = {
        department,
        govUK,
        maxContentsWidth,
        meta,
        metaTitle,
        navigation: footerNavigation,
        rebrand
    };
    const showNavigation = navigation?.length || serviceName;
    const mainId = 'main-content';
    return (_jsxs("div", { ...attrs, className: classes(), children: [_jsx("meta", { name: "viewport", content: "width=device-width, initial-scale=1, viewport-fit=cover" }), _jsx(SkipLink, { id: "skip-link", for: mainId, children: "Skip to main content" }), _jsx(Header, { ...headerProps, className: classes('header'), classModifiers: showNavigation ? 'full-width-border' : undefined }), !showNavigation ? null : (_jsx(ServiceNavigation, { ...navigationProps, className: classes('navigation') })), _jsx("div", { className: classes('body'), children: _jsxs(WidthContainer, { maxWidth: maxContentsWidth, className: classes('container'), children: [!phase ? null : (_jsx(PhaseBanner, { id: "phase-banner", phase: phase, children: phaseBannerContent || (_jsxs(Fragment, { children: ["This is a new service - your ", feedbackHref
                                        ? (_jsx(A, { href: feedbackHref, children: "feedback" }))
                                        : 'feedback', " will help us to improve it."] })) })), breadcrumbs?.length
                            ? (_jsx(Breadcrumbs, { id: "breadcrumbs", items: breadcrumbs }))
                            : (!backHref ? null : (_jsx(BackLink, { id: "back-link", href: backHref }))), _jsx("main", { id: mainId, className: classes('main'), children: children })] }) }), _jsx(Footer, { ...footerProps, className: classes('footer'), children: footerContent })] }));
};
export default Page;
