var __extends = (this && this.__extends) || (function () {
    var extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __generator = (this && this.__generator) || function (thisArg, body) {
    var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
    return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
    function verb(n) { return function (v) { return step([n, v]); }; }
    function step(op) {
        if (f) throw new TypeError("Generator is already executing.");
        while (_) try {
            if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
            if (y = 0, t) op = [0, t.value];
            switch (op[0]) {
                case 0: case 1: t = op; break;
                case 4: _.label++; return { value: op[1], done: false };
                case 5: _.label++; y = op[1]; op = [0]; continue;
                case 7: op = _.ops.pop(); _.trys.pop(); continue;
                default:
                    if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                    if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                    if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                    if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                    if (t[2]) _.ops.pop();
                    _.trys.pop(); continue;
            }
            op = body.call(thisArg, _);
        } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
        if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
    }
};
import "./chunk-7fb7349a.js";
import { a as Util } from "./chunk-e405d082.js";
var en = { ADD: "Add", ADDRESS: "Address", ADMIN: "Administration", CANCEL: "Cancel", "CHANGE LANGUAGE": "Change language", CLOSE: "Close", CONFIRM: "Confirm", "CONFIRM WARNING": "This action cannot be undone", CONTACT: "Contact", COUNTRY: "Country", CREATE: "Create", CURRENT: "Current", DATA: "Data", DATE: "Date", DATE_NTH: { 1: "{day} January {year}", 2: "{day} February {year}", 3: "{day} March {year}", 4: "{day} April {year}", 5: "{day} May {year}", 6: "{day} June {year}", 7: "{day} July {year}", 8: "{day} August {year}", 9: "{day} September {year}", 10: "{day} October {year}", 11: "{day} November {year}", 12: "{day} December {year}" }, DATE_MONTH_NTH: { 1: "January", 2: "February", 3: "March", 4: "April", 5: "May", 6: "June", 7: "July", 8: "August", 9: "September", 10: "October", 11: "November", 12: "December" }, DELETE: "Delete", "DELETE CONFIRM": "Are you sure you want to delete this item", "DELETE CONFIRM MULTIPLE": "Are you sure you want to delete these items", DETAIL: "Detail", DETAILS: "Details", EDIT: "Edit", EMAIL: "E-mail", "EMAIL ADDRESS": "E-mail address", "EMAIL ERROR": "This is not a valid email address", ERROR: "Error", FIELD: "Field", "FIELD REQUIRED": "This field is required", "FORM INVALID": "The form can not be submitted yet. Please fill in the required fields", "FORM SUCCESS": "The data have been stored", LANGUAGE: "Language", LOGIN: "Login", "LOGIN ERROR": "The credentials you provided are not valid", "LOGIN EXPIRED": "Your authorization has expired. Please login again", LOGOUT: "Log out", NAME: "Name", "NETWORK ERROR": "There is no internet connection", PASSWORD: "Password", "PASSWORD ERROR": "Password is required", "PASSWORD MATCH ERROR": "The passwords don't match", REMARKS: "Remarks", REMEMBER: "Remember", REQUIRED: "Required", RESET: "Wissen", RESULT: "Result", RESULTS: "Results", RESULTS_NTH: { 0: "No results", 1: "{n} result", 2: "{n} results", n: "{n} results", gt99: "99+ results" }, SAVE: "Save", SEARCH: "Search", SUBMIT: "Submit", TITLE: "Title", USER: "User", USERS: "Users", USERNAME: "Username", counter: "The count is {n}" }, nl = { ADD: "Toevoegen", ADDRESS: "Adres", ADMIN: "Beheer", CANCEL: "Annuleren", "CHANGE LANGUAGE": "Taal wijzigen", CLOSE: "Sluiten", CONFIRM: "Bevestigen", "CONFIRM WARNING": "Deze handeling kan niet ongedaan worden gemaakt", CONTACT: "Contact", COUNTRY: "Land", CREATE: "Aanmaken", CURRENT: "Huidige", DATA: "Gegevens", DATE: "Datum", DATE_NTH: { 1: "{day} Januari {year}", 2: "{day} Februari {year}", 3: "{day} Maart {year}", 4: "{day} April {year}", 5: "{day} Mei {year}", 6: "{day} Juni {year}", 7: "{day} Juli {year}", 8: "{day} Augustus {year}", 9: "{day} September {year}", 10: "{day} Oktober {year}", 11: "{day} November {year}", 12: "{day} December {year}" }, DATE_MONTH_NTH: { 1: "Januari", 2: "Februari", 3: "Maart", 4: "April", 5: "Mei", 6: "Juni", 7: "Juli", 8: "Augustus", 9: "September", 10: "Oktober", 11: "November", 12: "December" }, DELETE: "Verwijderen", "DELETE CONFIRM": "Weet u zeker dat u dit onderdeel wilt verwijderen", "DELETE CONFIRM MULTIPLE": "Weet u zeker dat u deze onderdelen wilt verwijderen", DETAIL: "Detail", DETAILS: "Details", EDIT: "Bewerken", EMAIL: "E-mail", "EMAIL ADDRESS": "E-mailadres", "EMAIL ERROR": "Er is geen geldige e-mail ingevoerd", ERROR: "Fout", FIELD: "Veld", "FIELD REQUIRED": "Dit veld is verplicht", "FORM INVALID": "Het formulier kan niet worden verstuurd. Vul eerst de ontbrekende velden in", "FORM SUCCESS": "De gegevens zijn opgeslagen", LANGUAGE: "Taal", LOGIN: "Inloggen", "LOGIN ERROR": "De ingevoerde login combinatie is niet geldig", "LOGIN EXPIRED": "Uw autorisatie is verlopen. Log opnieuw in a.u.b", LOGOUT: "Uitloggen", NAME: "Naam", "NETWORK ERROR": "De internetverbinding is verbroken", PASSWORD: "Wachtwoord", "PASSWORD ERROR": "Er is geen geldig wachtwoord ingevoerd", "PASSWORD MATCH ERROR": "De ingevoerde wachtwoorden komen niet overeen", REMARKS: "Opmerkingen", REMEMBER: "Onthouden", REQUIRED: "Verplicht", RESET: "Reset", RESULT: "Resultaat", RESULTS: "Resultaten", RESULTS_NTH: { 0: "Geen resultaten", 1: "{n} resultaat", 2: "{n} resultaten", n: "{n} resultaten", gt99: "99+ resultaten" }, SAVE: "Opslaan", SEARCH: "Zoeken", SUBMIT: "Indienen", TITLE: "Titel", USER: "Gebruiker", USERS: "Gebruikers", USERNAME: "Gebruikersnaam", counter: "Het aantal is {n}" }, i18n = { en: en, nl: nl };
var DomUtil = /** @class */ (function () {
    function DomUtil() {
    }
    DomUtil.addClass = function (e, t) { e.classList ? e.classList.add(t) : e.className += " " + t; };
    DomUtil.hasClass = function (e, t) { e.classList ? e.classList.contains(t) : new RegExp("(^| )" + t + "( |$)", "gi").test(e.className); };
    DomUtil.removeClass = function (e, t) { e.classList ? e.classList.remove(t) : e.className = e.className.replace(new RegExp("(^|\\b)" + t.split(" ").join("|") + "(\\b|$)", "gi"), " "); };
    DomUtil.toggleClass = function (e, t) { if (e.classList)
        e.classList.toggle(t);
    else {
        var n = e.className.split(" "), a = n.indexOf(t);
        a >= 0 ? n.splice(a, 1) : n.push(t), e.className = n.join(" ");
    } };
    DomUtil.remove = function (e) { e.parentNode.removeChild(e); };
    DomUtil.getAttributes = function (e) { var t = e.attributes, n = {}, a = 0; for (; a < t.length; a++)
        n[t[a].name] = t[a].value; return n; };
    DomUtil.setAttributes = function (e, t) { Object.keys(t).forEach(function (n) { e.setAttribute(n, t[n]); }); };
    DomUtil.getStyle = function (e, t) { var n; var a = e.ownerDocument.defaultView; return a && a.getComputedStyle ? (t = t.replace(/([A-Z])/g, "-$1").toLowerCase(), a.getComputedStyle(e, null).getPropertyValue(t)) : e.currentStyle ? (t = t.replace(/\-(\w)/g, function (e, t) { return t.toUpperCase(); }), n = e.currentStyle[t], /^\d+(em|pt|%|ex)?$/i.test(n) ? function (t) { var n = e.style.left, a = e.runtimeStyle.left; return e.runtimeStyle.left = e.currentStyle.left, e.style.left = t || 0, t = e.style.pixelLeft + "px", e.style.left = n, e.runtimeStyle.left = a, t; }(n) : n) : void 0; };
    DomUtil.viewportSize = function () { var e = { width: void 0, height: void 0 }; return "undefined" != typeof window && (window.innerHeight ? (e.width = window.innerWidth, e.height = window.innerHeight) : (e.width = document.documentElement.clientWidth, e.height = document.documentElement.clientHeight)), e; };
    DomUtil.copyToClipboard = function (e) { var t = document.createElement("textarea"); t.value = e, t.setAttribute("readonly", ""), t.style.position = "absolute", t.style.left = "-9999px", document.body.appendChild(t); var n = document.getSelection().rangeCount > 0 && document.getSelection().getRangeAt(0); t.select(), document.execCommand("copy"), document.body.removeChild(t), n && (document.getSelection().removeAllRanges(), document.getSelection().addRange(n)); };
    DomUtil.fadeIn = function (e, t, n, a) {
        if (t === void 0) { t = 300; }
        if (n === void 0) { n = 0; }
        if (a === void 0) { a = "block"; }
        var r = 1 / t * 10;
        e.style.opacity = "0", e.style.display = a, setTimeout(function () { !function t() { var n = parseFloat(e.style.opacity); (n += r) > 1 || (e.style.opacity = n.toString(), requestAnimationFrame(t)); }(); }, n);
    };
    DomUtil.fadeOut = function (e, t, n, a) {
        if (t === void 0) { t = 300; }
        if (n === void 0) { n = 0; }
        if (a === void 0) { a = !1; }
        var r = 1 / t * 10;
        e.style.opacity = "1", setTimeout(function () { !function t() { var n = Number(e.style.opacity); n -= r, e.style.opacity = n.toString(), n < 0 ? !1 === a && (e.style.display = "none", e.style.opacity = "1") : requestAnimationFrame(t); }(); }, n);
    };
    DomUtil.getUrlParameterByName = function (e) { var t = RegExp("[?&]" + e + "=([^&]*)").exec(window.location.search); return t && decodeURIComponent(t[1].replace(/\+/g, " ")); };
    return DomUtil;
}());
var StringUtil = /** @class */ (function () {
    function StringUtil() {
    }
    StringUtil.lowercaseFirst = function (e) { return e.charAt(0).toLowerCase() + e.slice(1); };
    StringUtil.uppercaseFirst = function (e) { return e.charAt(0).toUpperCase() + e.slice(1); };
    StringUtil.replaceAll = function (e, t, n, a) {
        if (a === void 0) { a = !1; }
        return e ? (r = t, i = n, s = a, String(e).replace(new RegExp(r.replace(/([\/\,\!\\\^\$\{\}\[\]\(\)\.\*\+\?\|\<\>\-\&])/g, "\\$&"), s ? "gi" : "g"), "string" == typeof i ? i.replace(/\$/g, "$$$$") : i)) : e;
        var r, i, s;
    };
    StringUtil.between = function (e, t, n, a) {
        if (a === void 0) { a = !1; }
        return e ? function (e, t, n) { var a = e.indexOf(t); if (!(a >= 0))
            return ""; if (e = e.substring(a + t.length), n) {
            if (!((a = e.indexOf(n)) >= 0))
                return "";
            e = e.substring(0, a);
        } return e; }(e, t, n) : e;
    };
    return StringUtil;
}());
var __awaiter = function (e, t, n, a) { return new (n || (n = Promise))(function (r, i) { function s(e) { try {
    l(a.next(e));
}
catch (e) {
    i(e);
} } function o(e) { try {
    l(a.throw(e));
}
catch (e) {
    i(e);
} } function l(e) { e.done ? r(e.value) : new n(function (t) { t(e.value); }).then(s, o); } l((a = a.apply(e, t || [])).next()); }); };
var Translate = /** @class */ (function () {
    function Translate() {
        var _this = this;
        this.i18n = i18n, this.defaultLanguage = "en-US", this.supportedLanguages = ["en-US", "nl-NL"], this.translations = {}, this.translationsLocation = "assets/translations", this.options = { debug: !1, namespaceSplitter: "::" }, this.initTranslateJs(), this.libTranslate = Util.getGlobal().libTranslate, Object.keys(i18n).forEach(function (e) { _this.supportedLanguages.push(e); }), this.translations = Util.copy(i18n), this.translations["nl-NL"] = Util.copy(this.translations.nl), this.translations["en-US"] = Util.copy(this.translations.en), this.translations["en-BE"] = Util.copy(this.translations.en), this.use(this.defaultLanguage);
    }
    Translate.prototype.get = function (e) {
        var t = [];
        for (var _i = 1; _i < arguments.length; _i++) {
            t[_i - 1] = arguments[_i];
        }
        return this.t.apply(this, [e].concat(t));
    };
    Translate.prototype.set = function (e, t) { this.translations[this.language][e] = t; };
    Translate.prototype.add = function (e) {
        var _this = this;
        Object.keys(e).forEach(function (t) { _this.set(t, e[t]); });
    };
    Translate.prototype.use = function (e, t) {
        if (t === void 0) { t = !1; }
        return __awaiter(this, void 0, void 0, function () { var _a; return __generator(this, function (_b) {
            switch (_b.label) {
                case 0:
                    this.language = e;
                    _a = this.translations[e] && !t;
                    if (_a) return [3 /*break*/, 2];
                    return [4 /*yield*/, this.loadTranslation(e)];
                case 1:
                    _a = (_b.sent());
                    _b.label = 2;
                case 2:
                    _a, this.t = this.libTranslate.getTranslationFunction(this.translations[e], [this.options]);
                    return [2 /*return*/];
            }
        }); });
    };
    Translate.prototype.loadTranslation = function (e) { return __awaiter(this, void 0, void 0, function () {
        var t;
        var _this = this;
        return __generator(this, function (_a) {
            switch (_a.label) {
                case 0:
                    this.translations[e] || (this.translations[e] = {});
                    return [4 /*yield*/, Util.fetchJson(this.translationsLocation + "/" + e + ".json")];
                case 1:
                    t = _a.sent();
                    Object.keys(t).forEach(function (n) { _this.translations[e][n] = t[n]; });
                    return [2 /*return*/];
            }
        });
    }); };
    Translate.prototype.updateTranslateComponents = function () { Array.from(document.getElementsByTagName("ema-translate")).forEach(function (e) { e.update(); }); };
    Translate.prototype.initTranslateJs = function () { var e, t, n; e = function (e) { return !isNaN(parseFloat(e)) && isFinite(e); }, t = function (e) { return "object" == typeof e && null !== e; }, n = function (e) { return "[object String]" === Object.prototype.toString.call(e); }, Util.getGlobal().libTranslate = { getTranslationFunction: function (a, r) { function i(e) { if (a[e])
            return a[e]; var t = e.split(l), n = t[0], r = t[1]; return a[n] && a[n][r] ? a[n][r] : null; } function s(e, t) { return n(e) ? e.replace(/\{(\w*)\}/g, function (e, n) { return t.hasOwnProperty(n) ? t.hasOwnProperty(n) ? t[n] : n : (o && console.log('Could not find replacement "' + n + '" in provided replacements object:', t), "{" + n + "}"); }) : e; } var o = (r = t(r) ? r : {}).debug, l = r.namespaceSplitter || "::"; return function (n) { var a = t(arguments[1]) ? arguments[1] : t(arguments[2]) ? arguments[2] : {}, r = e(arguments[1]) ? arguments[1] : e(arguments[2]) ? arguments[2] : null, l = i(n); return null !== r && (a.n = a.n ? a.n : r, l = function (e, n) { if (t(e)) {
            var a, r = Object.keys(e);
            if (0 === r.length)
                return o && console.log("[Translation] No plural forms found."), null;
            for (var i = 0; i < r.length; i++)
                0 === r[i].indexOf("gt") && (a = parseInt(r[i].replace("gt", ""), 10));
            e[n] ? e = e[n] : n > a ? e = e["gt" + a] : e.n ? e = e.n : (o && console.log('[Translation] No plural forms found for count:"' + n + '" in', e), e = e[Object.keys(e).reverse()[0]]);
        } return e; }(l, r)), null === (l = s(l, a)) && (l = o ? "@@" + n + "@@" : n, o && console.log('Translation for "' + n + '" not found.')), l; }; } }; };
    return Translate;
}());
var singleton = Symbol(), singletonEnforcer = Symbol();
var TranslateService = /** @class */ (function (_super) {
    __extends(TranslateService, _super);
    function TranslateService(e) {
        var _this = this;
        if (_this = _super.call(this) || this, e !== singletonEnforcer)
            throw new Error("Cannot construct singleton");
        _this._type = "TranslateService";
        return _this;
    }
    Object.defineProperty(TranslateService, "instance", {
        get: function () { return this[singleton] || (this[singleton] = new TranslateService(singletonEnforcer)), this[singleton]; },
        enumerable: true,
        configurable: true
    });
    TranslateService.prototype.registerTranslateComponents = function () {
        var _this = this;
        Array.from(document.getElementsByTagName("ema-translate")).forEach(function (e) { e.setTranslateService(_this); });
    };
    Object.defineProperty(TranslateService.prototype, "type", {
        get: function () { return this._type; },
        set: function (e) { this._type = e; },
        enumerable: true,
        configurable: true
    });
    return TranslateService;
}(Translate));
export { TranslateService as a, DomUtil as b, StringUtil as c };
