!function(s){"use strict";function t(){this.option={isLogin:void 0}}t.prototype.isLogin=function(o){var n=this;(o=void 0===o?{}:o).hasOwnProperty("callbackIsLogin")||(o.callbackIsLogin=function(){}),o.hasOwnProperty("callbackNotIsLogin")||(o.callbackNotIsLogin=function(){}),$http("/ajax/minisite/account/is_login.php").get().then(function(t){var a=JSON.parse(t);if(a.hasOwnProperty("status"))switch(a.status){case"success":n.option.isLogin=a.isLogin,n.option.isLogin?o.callbackIsLogin():o.callbackNotIsLogin();break;case"error":case"reload":document.location.reload()}}).catch(function(t){})},t.prototype.openModal=function(i){var e=this,c=e._getModalLoginAndRegistration();(i=void 0===i?{}:i).hasOwnProperty("callbackSuccessLogin")||(i.callbackSuccessLogin=function(){}),i.hasOwnProperty("callbackSuccessRegistration")||(i.callbackSuccessRegistration=function(){}),$http("/ajax/minisite/account/get_form_login_and_registration.php").get().then(function(t){var a=JSON.parse(t);if(a.hasOwnProperty("status"))switch(a.status){case"success":var n=c.find(".modal-body");c.find(".modal-account-login-and-registration__title").html(""),c.find(".modal-body").html(a.html),c.modal(),c.on("submit",'[name="form-account-login"]',function(){n.waitMe();s(this);var t=$http("/ajax/minisite/account/login.php"),a=new FormData(document.querySelector('#modal-account-login-and-registration [name="form-account-login"]'));return c.find(".form-account-login__notification").html(""),t.post(a,!0).then(function(t){n.waitMe("hide");var a=JSON.parse(t);switch(!0){case a.hasOwnProperty("reload"):document.location.reload();break;case a.hasOwnProperty("error"):var o=s("<div />",{class:"alert alert-danger text-center",html:a.msg});c.find(".form-account-login__notification").html(o),setTimeout(function(){o.slideUp("slow",function(){s(this).remove()})},5e3);break;case a.hasOwnProperty("success"):e.option.isLogin=!0,c.modal("hide"),i.callbackSuccessLogin()}}).catch(function(t){n.waitMe("hide")}),!1}).on("submit",'[name="form-account-registration"]',function(){n.waitMe();s(this);var t=$http("/ajax/minisite/account/create_account.php"),a=new FormData(document.querySelector('#modal-account-login-and-registration [name="form-account-registration"]'));return c.find(".form-account-registration__notification").html(""),t.post(a,!0).then(function(t){n.waitMe("hide");var a=JSON.parse(t);switch(!0){case a.hasOwnProperty("reload"):document.location.reload();break;case a.hasOwnProperty("error"):var o=s("<div />",{class:"alert alert-danger text-center",html:a.msg});c.find(".form-account-registration__notification").html(o),setTimeout(function(){o.slideUp("slow",function(){s(this).remove()})},5e3);break;case a.hasOwnProperty("success"):e.option.isLogin=!0,c.modal("hide"),i.callbackSuccessRegistration()}}).catch(function(t){n.waitMe("hide")}),!1});break;case"error":case"reload":Location.reload()}}).catch(function(t){})},t.prototype._getModalLoginAndRegistration=function(){var t=s("#modal-account-login-and-registration");return 0===t.length&&(t=s("<div />",{class:"modal fade modal-account-login-and-registration",id:"modal-account-login-and-registration",tabindex:"-1",role:"dialog"}).append(s("<div />",{class:"modal-dialog modal-lg",role:"document"}).append(s("<div />",{class:"modal-content"}).append(s("<div />",{class:"modal-header"}).append(s("<button />",{type:"button",class:"close","data-dismiss":"modal","aria-label":"Close"}).append(s("<span />",{"aria-hidden":"true",html:"&times;"}))).append(s("<span />",{class:"modal-account-login-and-registration__title"}))).append(s("<div />",{class:"modal-body"})))),s("#main-conteneur").append(t)),t},window.SiteLoginClass=new t}(jQuery);