//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
// TypeScript helpers (universal micro-lib.) | Author: Sergei Y.Kitaev
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// HTTP-address helpers for URL-paths (static class):
class HAddress {
    static IsSlashChar(ch) {
        return ch == '/' || ch == '\\';
    }
    static StartsWithSlash(value) {
        return value != null && (value.startsWith('/') || value.startsWith('\\'));
    }
    static EndsWithSlash(value) {
        return value != null && (value.endsWith('/') || value.endsWith('\\'));
    }
    static BackSlashesToNormal(value) {
        let rslt = '';
        for (let i = 0; i < value.length; i++) {
            let ch = value[i];
            rslt = rslt + (ch == '\\' ? '/' : ch);
        }
        return rslt;
    }
    static NormalizeSlashes(address) {
        address = HAddress.BackSlashesToNormal(address).toLowerCase();
        return HAddress.EndsWithSlash(address) ? address : address + '/';
    }
    static SlashCat(part_1, part_2, normalize = false) {
        let ews_1 = HAddress.EndsWithSlash(part_1);
        let sws_2 = HAddress.StartsWithSlash(part_2);
        let concat = ews_1 && sws_2 ? part_1 + part_2.substr(1) :
            part_1 + (ews_1 || sws_2 ? '' : '/') + part_2;
        return normalize ? HAddress.NormalizeSlashes(concat) : concat;
    }
    static ToAbsolute(href) {
        return href.indexOf(':') >= 0 ?
            HAddress.EndsWithSlash(href) ? href : href + '/' :
            HAddress.SlashCat(window.location.origin, href, true);
    }
} // HAddress
//# sourceMappingURL=HAddress.js.map