const OVERLAY_OPEN_CLASS = 'anj-overlay-open';
var ActionKey;
(function (ActionKey) {
    ActionKey["ArrowUp"] = "ArrowUp";
    ActionKey["ArrowDown"] = "ArrowDown";
    ActionKey["Enter"] = "Enter";
    ActionKey["Escape"] = "Escape";
})(ActionKey || (ActionKey = {}));
const ActionKeys = Object.values(ActionKey);
var BreakPoint;
(function (BreakPoint) {
    BreakPoint[BreakPoint["Xsmall"] = 0] = "Xsmall";
    BreakPoint[BreakPoint["Small"] = 576] = "Small";
    BreakPoint[BreakPoint["Medium"] = 768] = "Medium";
    BreakPoint[BreakPoint["Large"] = 992] = "Large";
    BreakPoint[BreakPoint["Xlarge"] = 1200] = "Xlarge";
})(BreakPoint || (BreakPoint = {}));
var PagerSizeOption;
(function (PagerSizeOption) {
    PagerSizeOption[PagerSizeOption["Xsmall"] = 10] = "Xsmall";
    PagerSizeOption[PagerSizeOption["Small"] = 15] = "Small";
    PagerSizeOption[PagerSizeOption["Medium"] = 20] = "Medium";
    PagerSizeOption[PagerSizeOption["Large"] = 30] = "Large";
    PagerSizeOption[PagerSizeOption["XLarge"] = 50] = "XLarge";
})(PagerSizeOption || (PagerSizeOption = {}));
const boolValueChanged = (newValue, oldValue) => {
    return !(!newValue && !oldValue);
};
const onBoolValueChanged = (newValue, oldValue, cb) => {
    const changed = boolValueChanged(newValue, oldValue);
    if (changed) {
        cb(newValue);
    }
    return newValue;
};
const coerceToNumber = (value, defValue) => {
    return typeof value === 'string' && !isNaN(value) ? parseInt(value, 10) : defValue;
};
const concatClasses = (...args) => {
    let classList = [];
    // Really wanted to do this as a reducer but it never worked out
    args.forEach((arg) => {
        classList = arg && Array.isArray(arg) ? classList.concat(arg) : classList.concat([arg]);
    });
    return classList.join(' ');
};
const debounce = (func, wait = 0) => {
    let timer;
    return (...args) => {
        clearTimeout(timer);
        timer = setTimeout(func, wait, ...args);
    };
};
const debounceEvent = (event, wait) => {
    const original = event._original || event;
    return {
        _original: event,
        emit: debounce(original.emit.bind(original), wait)
    };
};
const derivedId = (id, postfix) => {
    return `${id}-${postfix}`;
};
const evalToBool = (value) => {
    return value !== null && value !== 'false' && value !== '0';
};
const enterAsClick = (cb) => {
    return (event) => {
        if (event.code === 'Enter') {
            cb(event);
        }
    };
};
const hasValue = (value) => {
    if (Array.isArray(value)) {
        return value.length > 0;
    }
    else if (typeof value === 'string') {
        return (value && value.trim().length > 0);
    }
    else {
        return (value !== null && value !== undefined);
    }
};

export { ActionKey as A, BreakPoint as B, OVERLAY_OPEN_CLASS as O, PagerSizeOption as P, ActionKeys as a, boolValueChanged as b, coerceToNumber as c, concatClasses as d, debounce as e, debounceEvent as f, derivedId as g, evalToBool as h, enterAsClick as i, hasValue as j, onBoolValueChanged as o };
