import React, { useContext, useMemo } from "react";
import { Routes, Route } from "react-router-dom";
import { AuthContext } from "../Auth/auth";
import { BuildContext } from "../Build/build";
import { LangContext } from "v-eris";
import "./routes.wrap.scss";
export var RoutesWrap = function (props) {
    var auth = useContext(AuthContext);
    var lang = useContext(LangContext);
    var build = useContext(BuildContext);
    var tryAccess = function (element) {
        return auth.access < 3 ?
            (React.createElement("div", { className: "core-deny" }, lang.get(auth.access < 1 ? "Server::Banned" : "Server::NeedConfirmation")))
            :
                (build.denyAccess ? (React.createElement("div", { className: "core-deny" }, lang.get("Server::Deny"))) : element);
    };
    var content = useMemo(function () {
        var list = [];
        for (var key in build.routes) {
            list.push(React.createElement(Route, { key: key, path: key, element: tryAccess(build.routes[key].element) }));
        }
        ;
        return list;
    }, [build.routes, auth.access]);
    return (React.createElement("div", { className: "eris-routes-wrap-container" },
        React.createElement(Routes, null, content)));
};
//# sourceMappingURL=routes.wrap.js.map