'use client';
import React from 'react';
import { useDocumentInfo } from '../../providers/DocumentInfo/index.js';
import IDLabel from '../IDLabel/index.js';
const baseClass = 'render-title';
const RenderTitle = (props)=>{
    const { className, element = 'h1', fallback, title: titleFromProps } = props;
    const documentInfo = useDocumentInfo();
    const { id, title: titleFromContext } = documentInfo;
    const title = titleFromProps || titleFromContext || fallback;
    const idAsTitle = title === id;
    const Tag = element;
    return /*#__PURE__*/ React.createElement(Tag, {
        className: [
            className,
            baseClass,
            idAsTitle && `${baseClass}--has-id`
        ].filter(Boolean).join(' '),
        title: title
    }, idAsTitle ? /*#__PURE__*/ React.createElement(IDLabel, {
        className: `${baseClass}__id`,
        id: id
    }) : title);
};
export default RenderTitle;

//# sourceMappingURL=index.js.map