/*!
 * KoliBri - The accessible HTML-Standard
 */
import { a as __rest } from './tslib.es6-QNbPBOk5.js';
import { h } from './index-Brmny3Vg.js';
import { c as clsx } from './clsx-COFh-Vc8.js';

const MIN_HEADING_LEVEL = 1;
const MAX_HEADING_LEVEL = 6;
function isValidHeadingLevel(level) {
    return level >= MIN_HEADING_LEVEL && level <= MAX_HEADING_LEVEL;
}
function getHeadlineTag(level) {
    return isValidHeadingLevel(level) ? `h${level}` : 'strong';
}
const KolHeadlineFc = (_a, children) => {
    var { class: classNames, level = MIN_HEADING_LEVEL } = _a, other = __rest(_a, ["class", "level"]);
    const HeadlineTag = getHeadlineTag(level);
    return (h(HeadlineTag, Object.assign({ class: clsx('kol-headline', `kol-headline--${HeadlineTag}`, classNames) }, other), children));
};
const KolSecondaryHeadlineFc = (_a, children) => {
    var { class: classNames } = _a, other = __rest(_a, ["class"]);
    return (h("p", Object.assign({ class: clsx('kol-headline kol-headline--group kol-headline--secondary', classNames) }, other), children));
};
const KolHeadingFc = (_a, children) => {
    var { secondaryHeadline, level = MIN_HEADING_LEVEL, class: classNames, HeadingGroupProps = {}, SecondaryHeadlineProps = {} } = _a, other = __rest(_a, ["secondaryHeadline", "level", "class", "HeadingGroupProps", "SecondaryHeadlineProps"]);
    const headlineProps = Object.assign({ level }, other);
    if (!secondaryHeadline) {
        return (h(KolHeadlineFc, Object.assign({ class: clsx(classNames, 'kol-headline--single') }, headlineProps), children));
    }
    const { class: groupClassNames } = HeadingGroupProps, groupOthers = __rest(HeadingGroupProps, ["class"]);
    const headlineGroupProps = Object.assign({ class: clsx('kol-heading-group', groupClassNames) }, groupOthers);
    return (h("hgroup", Object.assign({}, headlineGroupProps), h(KolHeadlineFc, Object.assign({ class: clsx(classNames, 'kol-headline--group', 'kol-headline--primary') }, headlineProps), children), h(KolSecondaryHeadlineFc, Object.assign({}, SecondaryHeadlineProps), secondaryHeadline)));
};

export { KolHeadingFc as K };
//# sourceMappingURL=Heading-Hh3eykel.js.map

//# sourceMappingURL=Heading-Hh3eykel.js.map