/*!
 * Built by ShiftSoftware
 * Copyright (c)
 */
'use strict';

var index = require('./index-CmK48vN3.js');
var cn = require('./cn-BHnqYtun.js');

const TickIcon = props => (index.h("svg", Object.assign({ fill: "none", "stroke-width": "2", viewBox: "0 0 24 24" }, props, { stroke: "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round" }),
    index.h("path", { d: "M20 6 9 17l-5-5" })));

const FormInputPrefix = ({ direction, prefix, name }) => {
    if (!prefix)
        return false;
    return (index.h("div", { dir: direction, class: cn.cn('form-input-prefix', {
            [`${name}-prefix`]: !!name,
        }), part: cn.cn('form-input-prefix', {
            [`${name}-prefix`]: !!name,
        }) }, prefix));
};

const whiteLoaderSvg = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9IndoaXRlIgogICAgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJsdWNpZGUgbHVjaWRlLWxvYWRlciI+CiAgICA8cGF0aCBkPSJNMTIgMnY0IiAvPgogICAgPHBhdGggZD0ibTE2LjIgNy44IDIuOS0yLjkiIC8+CiAgICA8cGF0aCBkPSJNMTggMTJoNCIgLz4KICAgIDxwYXRoIGQ9Im0xNi4yIDE2LjIgMi45IDIuOSIgLz4KICAgIDxwYXRoIGQ9Ik0xMiAxOHY0IiAvPgogICAgPHBhdGggZD0ibTQuOSAxOS4xIDIuOS0yLjkiIC8+CiAgICA8cGF0aCBkPSJNMiAxMmg0IiAvPgogICAgPHBhdGggZD0ibTQuOSA0LjkgMi45IDIuOSIgLz4KPC9zdmc+';

const appendClasses = (currentValue, value) => {
    if (value === null || value === void 0 ? void 0 : value.length)
        return `${currentValue} ${Array.from(value).join(' ')}`;
    return currentValue;
};
function getCustomClassesForPortal(element) {
    var _a, _b, _c, _d, _e, _f, _g, _h, _j;
    let current = element;
    let finaleClass = '';
    let foundHostParent = false;
    while (current && !foundHostParent) {
        const root = (_a = current.getRootNode) === null || _a === void 0 ? void 0 : _a.call(current);
        if (((_b = current.part) === null || _b === void 0 ? void 0 : _b.contains('shift-form')) ||
            ((_c = current.classList) === null || _c === void 0 ? void 0 : _c.contains('shift-form')) ||
            ((_d = current.part) === null || _d === void 0 ? void 0 : _d.contains('shift-component')) ||
            ((_e = current.classList) === null || _e === void 0 ? void 0 : _e.contains('shift-component'))) {
            finaleClass = appendClasses(finaleClass, (_f = current === null || current === void 0 ? void 0 : current.part) !== null && _f !== void 0 ? _f : null);
            finaleClass = appendClasses(finaleClass, (_g = current === null || current === void 0 ? void 0 : current.classList) !== null && _g !== void 0 ? _g : null);
        }
        if (current.parentElement) {
            current = current.parentElement;
            continue;
        }
        if (root instanceof ShadowRoot) {
            current = root.host;
            if (!!finaleClass)
                foundHostParent = true;
            continue;
        }
        break;
    }
    if (foundHostParent && current) {
        finaleClass = appendClasses(finaleClass, (_h = current === null || current === void 0 ? void 0 : current.part) !== null && _h !== void 0 ? _h : null);
        finaleClass = appendClasses(finaleClass, (_j = current === null || current === void 0 ? void 0 : current.classList) !== null && _j !== void 0 ? _j : null);
    }
    return finaleClass === null || finaleClass === void 0 ? void 0 : finaleClass.replaceAll('  ', ' ');
}

exports.FormInputPrefix = FormInputPrefix;
exports.TickIcon = TickIcon;
exports.getCustomClassesForPortal = getCustomClassesForPortal;
exports.whiteLoaderSvg = whiteLoaderSvg;
