(function () {

    let engyjClientID = window.egyjClientID;

    const appendScript = (url, target = 'head', onload = null) => {
        var script = document.createElement("SCRIPT");
        script.src = url;
        script.type = 'text/javascript';
        script.onload = onload;
        document.getElementsByTagName(target)[0].appendChild(script);
    }

    const appendStyle = (url) => {
        var style = document.createElement("LINK");
        style.href = url;
        style.rel = 'stylesheet'; 
        document.getElementsByTagName("head")[0].appendChild(style);
    }
    
    const engyjify = ($) => {
        $(document).ready(function(){

            $('body').append($('<div />').attr('id','engyjChatWidgetRoot'));
            appendScript( 'http://ada.engyj.com/0.1-old/static/main.js', 'body', function () { });  

                        appendStyle( 'http://ada.engyj.com/0.1-old/static/css/main.593551e3.chunk.css'); 
            
                        appendScript( 'http://ada.engyj.com/0.1-old/static/js/2.1252b13e.chunk.js', 'body', function () { }); 
                        appendScript( 'http://ada.engyj.com/0.1-old/static/js/main.f68c05bf.chunk.js', 'body', function () { }); 
             

        });
    }

    if (typeof window.jQuery === 'undefined') {
        appendScript( 'https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js', 'head', function () { 
            engyjify(window.jQuery);
        }); 
    }
})();