const ssoLogin=async()=>{try{return await(async()=>new Promise((e,t)=>{const o=setTimeout(()=>{t("Time out!")},2e3);window.addEventListener("message",i=>{if(i.origin.indexOf("erp.30shine.com")>=0)if("logout"==i.data)window.location.reload();else{const s=i.data;s&&s.AccessToken||t("Null credentials!"),clearTimeout(o),Object.keys(s).forEach(e=>{localStorage[e]=s[e]}),e(s)}});var i=document.createElement("iframe");i.setAttribute("id","authIframe");var s=document.body;i.setAttribute("style","width:0;height:0;border:0;border:none;position:absolute;"),i.setAttribute("src","https://erp.30shine.com/iframe-sso"),s.appendChild(i)}))()}catch(e){console.log("Not authenticated!",e);const t=`https://erp.30shine.com/dang-nhap.html?redirect=${window.location.href.split("?")[0]}`;window.location.replace(t)}},ssoLogout=()=>{const e=`https://erp.30shine.com/dang-xuat.html?redirect=${window.location.href.split("?")[0]}`;window.location.replace(e)};