/*!
 * KoliBri - The accessible HTML-Standard
 */
'use strict';

var tslib_es6 = require('./tslib.es6-Cm0ytgPY.js');
var index = require('./index-DBbl8tEq.js');
var clsx = require('./clsx-Bm_HQUnh.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 = tslib_es6.__rest(_a, ["class", "level"]);
    const HeadlineTag = getHeadlineTag(level);
    return (index.h(HeadlineTag, Object.assign({ class: clsx.clsx('kol-headline', `kol-headline--${HeadlineTag}`, classNames) }, other), children));
};
const KolSecondaryHeadlineFc = (_a, children) => {
    var { class: classNames } = _a, other = tslib_es6.__rest(_a, ["class"]);
    return (index.h("p", Object.assign({ class: clsx.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 = tslib_es6.__rest(_a, ["secondaryHeadline", "level", "class", "HeadingGroupProps", "SecondaryHeadlineProps"]);
    const headlineProps = Object.assign({ level }, other);
    if (!secondaryHeadline) {
        return (index.h(KolHeadlineFc, Object.assign({ class: clsx.clsx(classNames, 'kol-headline--single') }, headlineProps), children));
    }
    const { class: groupClassNames } = HeadingGroupProps, groupOthers = tslib_es6.__rest(HeadingGroupProps, ["class"]);
    const headlineGroupProps = Object.assign({ class: clsx.clsx('kol-heading-group', groupClassNames) }, groupOthers);
    return (index.h("hgroup", Object.assign({}, headlineGroupProps), index.h(KolHeadlineFc, Object.assign({ class: clsx.clsx(classNames, 'kol-headline--group', 'kol-headline--primary') }, headlineProps), children), index.h(KolSecondaryHeadlineFc, Object.assign({}, SecondaryHeadlineProps), secondaryHeadline)));
};

exports.KolHeadingFc = KolHeadingFc;
//# sourceMappingURL=Heading-Cswcjs5-.js.map

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