const utilGlobal=function(){function e(e,t,n="json"){if(!e.ok)throw uiGlobal&&uiGlobal.toggleLoader&&uiGlobal.globalSwal&&t&&uiGlobal.showGlobalSwalError(t),Error(`${t} ||| ${e.statusText}`)}function t(){if(dataModelGlobal.isOrder)return;const e=["authData","filters","server-type"];Object.keys(sessionStorage).forEach(t=>{-1===e.indexOf(t)&&sessionStorage.removeItem(t)})}function n(e){return e.reduce((e,t)=>{const n=e||0;return t+n},0)}function o(e,t){let n={};const{DefaultConfig:o}=e;return t.forEach(t=>{let l=t;if("HDD"!==l&&"OS"!==l||(l=o.hasOwnProperty("JBOD")?"JBOD":"EmbeddedRAID"),o.hasOwnProperty(l)){const i=o[l];let d=e[t].filter(e=>e.Value===i)[0];"HDD"===t&&(d=e[t].filter(e=>e.SubItem===i[0].SubItem)[0]),"OS"===t&&(d=e[t].filter(e=>e.Value===i[0].OS)[0]),"CPU"===t&&(d=e[t].filter(e=>e.SubItem===i.SubItem)[0]),"IPv"===t&&(d=e[t].filter(e=>e.SubItem===i[0].SubItem)[0]),n[t]=d||e[t][0]}else n[t]=e[l][0]}),n}function l(e,t){const n=e/100*t,o=t-n;return o}function i(){var e='\n \n
\n ';document.body.insertAdjacentHTML("beforeend",e),document.getElementById("close")&&document.getElementById("close").addEventListener("click",d),document.getElementById("code")&&document.getElementById("code").addEventListener("keypress",function(e){"Enter"===e.key&&document.getElementById("submit")&&(e.preventDefault(),document.getElementById("submit").click())}),document.getElementById("submit")&&document.getElementById("submit").addEventListener("click",a),document.getElementById("golden-1")&&document.getElementById("golden-1").classList.add("lower-opacity"),document.getElementsByClassName("login-container")[0]&&document.getElementsByClassName("login-container")[0].classList.add("lower-opacity")}function d(){document.getElementById("golden-1")&&document.getElementById("golden-1").classList.remove("lower-opacity"),document.getElementsByClassName("login-container")[0]&&document.getElementsByClassName("login-container")[0].classList.remove("lower-opacity"),document.getElementById("modal").remove(),document.getElementById("overlay").remove(),uiGlobal.toggleLoader("hide")}function a(){code=document.getElementById("code").value,req_data=utilGlobal.data,req_data.code=code,req_data.uid=utilGlobal.uid,r=JSON.stringify(req_data),fetch("/api/otp/login",{method:"POST",headers:{"Content-type":"application/json","X-Website":Website,"X-Linked":utilGlobal.uidlinked},body:r}).then(e=>200!=e.status?e.status:e.json()).then(e=>{401===e?Swal.fire("Sorry, the code is wrong. Check if it didn't expire."):"function"==typeof utilGlobal.finalCall?utilGlobal.finalCall(utilGlobal.uid,e.token):Swal.fire("Some unexpected error.")})}let r;const c={maxMobile:"(max-width: 1024px)"},s=(e,t,n)=>("D104a"===e&&(e="D104"),`/newOrder/dedicated/config/?type=${e}${t?`&instantType=${t}`:""}${n?`${n}`:""}`);return{handleError:e,clearOrderStorage:t,mediaQueries:c,changeOrderLink:s,getServerDefaultComponents:o,calculateServerPrice:n,getDiscountPrice:l,OTP:i,closeTwoFAWindow:d,verifyCode:a}}();