(function(){"use strict";class w{constructor(){this.inIframe=!1,this.fallbackButtonAndListeners=i=>{let t=document.getElementById("wpo365RedirectLoadingOther");if(t||(t=document.getElementById("wpo365OpenIdRedirect")),!t)return;const e=document.createElement("button");e.setAttribute("style","border: 1px solid #8c8c8c; background: #ffffff;"),e.className="pintraRedirectMsSignin",e.innerHTML='<div style="display: flex; height: 41px; box-sizing: border-box; pointer: cursor;"><img src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMSIgaGVpZ2h0PSIyMSIgdmlld0JveD0iMCAwIDIxIDIxIj48dGl0bGU+TVMtU3ltYm9sTG9ja3VwPC90aXRsZT48cmVjdCB4PSIxIiB5PSIxIiB3aWR0aD0iOSIgaGVpZ2h0PSI5IiBmaWxsPSIjZjI1MDIyIi8+PHJlY3QgeD0iMSIgeT0iMTEiIHdpZHRoPSI5IiBoZWlnaHQ9IjkiIGZpbGw9IiMwMGE0ZWYiLz48cmVjdCB4PSIxMSIgeT0iMSIgd2lkdGg9IjkiIGhlaWdodD0iOSIgZmlsbD0iIzdmYmEwMCIvPjxyZWN0IHg9IjExIiB5PSIxMSIgd2lkdGg9IjkiIGhlaWdodD0iOSIgZmlsbD0iI2ZmYjkwMCIvPjwvc3ZnPg=="><span style="white-space: nowrap; margin-left: 15px; padding-right: 12px; font-weight: 600; font-size: 15px; line-height: 41px; color: #5e5e5e;">Sign in with Microsoft</span>',e.onclick=i,t.appendChild(e)},this.uuidv4=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(i){var t=Math.random()*16|0,e=i=="x"?t:t&3|8;return e.toString(16)}),this.queryString=i=>{const t=i.indexOf("?");if(t==-1)return{};const n=i.substr(t+1).split("&"),r={};for(let o=0;o<n.length;o++){const s=n[o].split("=");r[s[0]]=s.length==2?s[1]:""}return r},this.PopupCenter=(i,t,e=600,n=535)=>{const r=screen.availWidth,o=screen.availHeight;e>r&&(e=r),n>o&&(n=o);const s=(r-e)/2,d=(o-n)/2,c=window.open(i,t,"width="+e+",height="+n+",top="+d+",left="+s+"toolbar=no,menubar=no,scrollbars=no,location=no,status=no");c&&c.focus()},this.formPost=(i,t)=>{const e=document.getElementById("wpo365OpenIdRedirect");if(!e)return;const n=document.createElement("form");n.method="POST",n.action=t,n.style.display="none";for(const r in i)if(i.hasOwnProperty(r)){const o=document.createElement("input");o.type="hidden",o.name=r,o.value=i[r],n.appendChild(o)}e.appendChild(n),n.submit()},this.inIframe=window!=top}toMsOnline(i="",t=location.href,e="",n="",r=!1,o=""){var p;if(["interactive","complete"].indexOf(document.readyState)==-1){setTimeout(()=>this.toMsOnline(i,t,e,n,r),500);return}if(window.location.href.toLowerCase().indexOf("interim-login=1")>=0){try{((p=window.top)!=null?p:window.self).location.reload()}catch(a){window.location.reload()}return}if(i&&!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,6})+$/.test(i)&&(console.log("WPO365 -> loginHint parameter ignored because it is not a valid email address"),i=""),t&&!/^((http|https):\/\/)([a-zA-Z0-9@:%._\-\+~#?&\/\$=]*)$/.test(t)&&(console.log("WPO365 -> pRedirectTo parameter ignored because it is not a valid (encoded) URL"),t=location.href),e&&!/^([a-zA-Z0-9])([a-zA-Z0-9\-\.])*(\.)([a-zA-Z0-9\-]){2,6}$/.test(e)&&(console.log("WPO365 -> domainHint parameter ignored because it is not a valid domain name"),e=""),o){const a=document.createElement("div");a.innerHTML=o;const h=a.textContent;o!=h&&(console.log("WPO365 -> idpKey parameter ignored because its escaped value is not equal to its actual value"),o="")}let s=window.location.href;window.wpo365.bounceUrl?s=window.wpo365.bounceUrl:window.wpo365.siteUrl&&(s=window.wpo365.siteUrl);const d=this.queryString(window.location.href),c=Object.keys(this.queryString(s)).length===0?"?":"&",l="redirect_to"in d?decodeURIComponent(d.redirect_to):t;if(this.inIframe&&!r){const a=`${s}${c}action=openidredirect&redirect_to=${l}&domain_hint=${e}&b2c_policy=${n}&cb=${this.uuidv4()}&wpo_embedded=iframe`;this.PopupCenter(a,"msOnline"),this.fallbackButtonAndListeners(()=>{this.PopupCenter(a,"msOnline")});return}const u={action:"openidredirect",login_hint:i,domain_hint:e,redirect_to:l,b2c_policy:n,idp_id:o};this.formPost(u,`${s}${c}cb=${this.uuidv4()}`)}}window.wpo365=window.wpo365||{},window.wpo365.pintraRedirect=new w})();
