/*!
 * Custom elements for Nanopore-Digital Web applications
 */
import { h as h$1 } from './index-BM3Om9WE.js';

/* eslint-disable @typescript-eslint/no-namespace */
// css only components cannot be transformed because their static css relies on the tag name
const CSS_ONLY_COMPONENTS = [
    'nano-avatar',
    'nano-badge',
    'nano-card',
    'nano-content-links',
    'nano-cta',
    'nano-feature-box',
    'nano-icon-item',
    'nano-option-box',
    'nano-progress-bar',
    'nano-search-result',
    'nano-skeleton',
    'nano-spinner',
    'nano-tag',
];
/**
 * Transforms a tag name by adding a prefix if it's a custom element
 * @param tag
 * @returns the transformed tag
 */
function transformTag(tag) {
    if (!tagPrefix)
        return tag;
    const isMyCustomElement = tag.startsWith('nano-') && !CSS_ONLY_COMPONENTS.includes(tag);
    return isMyCustomElement ? `${tagPrefix}-${tag}` : tag;
}
/**
 * Augment Stencil's `h()` function to add a tag prefix
 * @param args incoming JSX arguments
 * @returns the result of the original `h()` function
 */
function h(...args) {
    const tagName = args[0];
    if (!tagName || typeof tagName !== 'string' || !tagPrefix) {
        return h$1(...args);
    }
    let newTagName = tagName;
    if (typeof tagName === 'string') {
        newTagName = transformTag(tagName);
    }
    const arr = args.slice(2);
    const tuple = [newTagName, args[1], arr];
    return h$1(...tuple);
}
let tagPrefix = '';
/**
 * Sets the tag prefix to be used when rendering custom elements
 * @param prefix the prefix to use
 * @returns the `transformTag` function
 */
function setTagPrefix(prefix) {
    tagPrefix = prefix;
    return transformTag;
}
/**
 * Gets the current tag prefix
 * @returns the current tag prefix
 */
function getTagPrefix() {
    return tagPrefix;
}
(function (h) {
})(h || (h = {}));

export { getTagPrefix as g, h, setTagPrefix as s, transformTag as t };
