MSN


MSN {window.webWorkerMessages.push(e.data)},window.webWorkerErrors=[],window.webWorker.onerror=e=>{window.webWorkerErrors.push(e)},window.chrome){const e=this.getAudienceMode(this.clientSettings);let t=!1;const n=window.webWorker&&window.chrome&&window.chrome.ntpSettingsPrivate;n&&”function”==typeof n.getPref&&(n.getPref(“ntp.news_feed_display”,e=>{e&&e.value&&window.webWorker.postMessage({id:”FeedDisplaySetting”,type:”command”,payload:e.value})}),n.getPref(“ntp.layout_mode”,e=>{e&&e.value&&window.webWorker.postMessage({id:”LayoutModeSetting”,type:”command”,payload:e.value})}),”adult”===e&&(t=!0,n.getPref(“ntp.user_nurturing”,e=>{let t=!1;e&&e.value&&e.value.length&&(t=this.getSingleColRequest(e.value)),window.webWorker.postMessage({id:”RenderSingleColumn”,type:”command”,payload:t})}))),t||window.webWorker.postMessage({id:”RenderSingleColumn”,type:”command”,payload:!1}),”enterprise”===e&&this.clientSettings.browser&&”edgeChromium”===this.clientSettings.browser.browserType&&parseInt(this.clientSettings.browser.version)>=87&&this.getAccessToken().then(e=>{e&&window.webWorker.postMessage({id:”AuthToken”,type:”command”,payload:e})}),”adult”!==e&&”enterprise”!==e||this.sendPageConfiguration()}}buildWebWorkerUrl(e=null){return(this.bundle||””)+”#”+this.qsFromDocument()+this.qsFromCookies()+this.qsFromDataAttribute(e||this.clientSettings)+this.qsMisc()+this.qsFromUrl()+this.qsFromServiceWorker()}qs(e,t,n){return e?t+”=”+(n||e)+”&”:””}qsFromDocument(){return this.qs(document.getElementsByTagName(“html”)[0].getAttribute(“lang”),”lang”)+this.qs(encodeURIComponent(window.location.href),”adsReferer”)}qsFromServiceWorker(){if(!navigator.serviceWorker||!navigator.serviceWorker.controller)return””;const e=navigator.serviceWorker.controller;if(“activated”!==e.state||!e.scriptURL)return””;if(e.scriptURL){const t=new URL(e.scriptURL).searchParams.toString();return t?”&”+t+”&”:””}return””}qsFromCookies(){return this.qs(Object(o.b)(this.authCookieName),”aace”,”1″)+this.qs(Object(o.b)(“muid”),”muid”)+this.qs(Object(o.b)(this.childCookieName),”child”)+this.qs(Object(o.b)(“cbypass”),”cbypass”)+this.qs(this.cookieBannerConsentRequired().toString(),”ccRequired”)+this.qs(Object(o.b)(“ecasession”),”ecasession”)+this.qs(Object(o.b)(“TOptOut”),”browserOptOut”)}qsFromDataAttributeHelper(e,t){return e&&e.featureFlags&&e.featureFlags.wpoEnabled&&(t=this.appendWpoFlightsToInfo(e,t)),this.qs(e.pcsInfo&&e.pcsInfo.env||e.env,”env”)+this.qs(e.aid,”aid”)+this.qs(e.apptype,”apptype”)+this.qs(e.pagetype,”pagetype”)+this.qs(e.audienceMode,”audienceMode”)+this.qs(e.configIndexDocId,”configIndexDocId”)+this.qs(e.deviceFormFactor,”deviceFormFactor”)+this.qs(e.domain,”domain”)+this.qs(e.configRootUrl,”configRootUrl”)+this.qs(this.getHighestCbid(e.cbid,e.apptype),”cbid”)+this.qs(e.ocid,”ocid”)+this.qs(e.os,”os”)+this.qs(JSON.stringify(e.locale),”locale”)+this.qs(e.geo_lat,”lat”)+this.qs(e.geo_long,”long”)+(“dhp”===e.pagetype||”ntp”===e.pagetype?this.qs(Object(o.b)(this.WeaSpartanHomeLocCookie),this.WeaSpartanHomeLocCookie)+this.qs(Object(o.b)(this.WeaSpartanDetectLocSetting),this.WeaSpartanDetectLocSetting):this.qs(Object(o.b)(this.WeaHomeLocCookie),this.WeaHomeLocCookie)+this.qs(Object(o.b)(this.WeaDetectLocSetting),this.WeaDetectLocSetting))+this.qs(JSON.stringify(e.featureFlags),”featureFlags”)+this.qs(JSON.stringify(e.browser),”browser”)+this.qs(JSON.stringify(e.servicesEndpoints),”servicesEndpoints”)+this.qs(e.bundleInfo&&e.bundleInfo.v||””,”buildVersion”)+this.buildArtifactHashes(e)+this.qs(t,”dataInfo”)}appendWpoFlightsToInfo(e,t){const n=this.getWpoFlightsFromLocalStorage(e);if(n&&n.length){const e=”;”,o=t.split(e);for(let e=0;ee.id)}}catch(e){console.warn(`Error getting wpo flights from ls for ${o} Error:${e}`)}return null}buildArtifactHashes(e){let t;try{const{locale:n={},bundleInfo:o={},audienceMode:s,pagetype:r,apptype:a}=e,{hash:c,configsHash:l,locConfigsHash:u}=o;if(!c||!l||!u)return””;t=this.qs(c,”bundleHash”)+this.qs(l,”configHash”)+this.qs(u,”locHash”);const d=`config_hash_${s}_${n.language}_${n.market}_${r}_${a}`,g=Object(i.a)().getItem(d);if(g){const{bundleHash:e,configHash:n,locHash:o}=JSON.parse(g)||{};e&&n&&o&&(t+=this.qs(e,”lastBundleHash”)+this.qs(n,”lastConfigHash”)+this.qs(o,”lastLocHash”))}return t}catch(e){console.error(“Error getting config hashes from ls: “+e)}return t}getHighestCbid(e,t){try{const n=Object(i.a)(),o=parseInt(e),s=parseInt(JSON.parse(n.getItem(“cbid_”+(t||””))));let r;if(o&&!isNaN(o)&&s&&!isNaN(s)&&(r=o>s?o:s),r=r||o||s,r)return window._cbid=r.toString()}catch(e){console.log(“Error getting highest CBID”+e)}}getAudienceMode(e){Object(i.a)();const t=Object(o.a)(this.authCookieName),n=Object(o.a)(this.childCookieName),{child:s}=t&&JSON.parse(t)||{};return t&&(1===s||n)?”kids”:”enterprise”===e.audienceMode&&e.IsCnDomain&&e.currentFlights.includes(“prg-china-aad”)?”adult”:e.audienceMode||”adult”}sendPageConfiguration(){const e=this.clientSettings.pagetype;if(e){const t=o.a&&”function”==typeof o.a&&Object(o.a)(“pglt-edgeChromium-“+e);if(t)return void window.webWorker.postMessage({id:”PageConfiguration”,type:”command”,payload:t})}window.webWorker.postMessage({id:”PageConfiguration”,type:”command”,payload:!1})}qsFromDataAttribute(e){let t,n;const o=Object(i.a)();if(o){const i=JSON.parse(o.getItem(“shd_”+e.pagetype)||null);i&&i.clientSettings&&i.info&&(t=Object.assign(Object.assign({},i.clientSettings),{bundleInfo:e.bundleInfo}),n=i.info)}return(!t||!n||e.pageGenTime>=t.pageGenTime)&&(t=e,n=this.domInfo),t.audienceMode=this.getAudienceMode(t),this.qsFromDataAttributeHelper(t,n)}qsFromUrl(){const e=location.search;return e&&e.length?e.substring(1,e.length):””}getAccessToken(){return new Promise(e=>{window.chrome&&window.chrome.authPrivate?window.chrome.authPrivate.getPrimaryAccountInfo(t=>{t&&”GCC_MODERATE”!==t.region_scope||e(“”);const n={account_id:t.account_id,account_type:t.account_type,client_id:”d7b530a4-7680-4c23-a8bf-c52c121d2e87″,scope_or_resource:”https://enterprisenews.microsoft.com”};window.chrome.authPrivate.acquireAccessTokenSilently(n,t=>{t.is_success?e(t.access_token):e(“”)})}):e(“”)})}qsMisc(){return this.qs(performance.timeOrigin&&performance.timeOrigin.toString(),”mainTimeOrigin”)}getSingleColRequest(e){const t=”render_single_column”,n=”feed_layout”;let o,i;for(const s of e){const{key:e,value:r}=s;e===t?o=r:e===n&&(i=r)}return”boolean”==typeof o?o:!!i&&(i&&”single”===i.type)}cookieBannerConsentRequired(){const e=null!=document.getElementById(“consent-banner-container”)&&null===Object(o.a)(“MSCC”),t=null!=document.getElementById(“onetrust-sdk”)&&null===Object(o.a)(“eupubconsent-v2”);return e||t}}).init(),function(e=[“vendors”,”common”,”microsoft”],t=”Error when loading bundle(s): “,n=5e5,o){(“visible”===document.visibilityState?Promise.resolve():new Promise(e=>{document.addEventListener(“visibilitychange”,()=>{“visible”===document.visibilityState&&e()})})).then(()=>{setTimeout(()=>{const n=window.webpackJsonp;if(n){const i=n.length,r=e.length+1;if(i{t.length&&t[0][0]&&e.splice(e.indexOf(t[0][0]),1)})}try{Object(s.b)(t+e.toString(),20202,{})}finally{o&&o()}}}},n)})}()},YBLW:function(e,t,n){“use strict”;let o;function i(e){if(!e)return null;if(!o){const e=document.cookie.split(“; “);o={};const t=e&&e.length;for(let n=0;nthis.maxLength&&this.list.shift()}get data(){return this.list}};function d(e,t,n){try{const i=r(),d=function(){if(s)return s;let e=document.head.getAttribute(“data-info”);const t=r();if(o()){let n;try{const e=window.localStorage.getItem(“shd_”+t.pagetype);n=JSON.parse(e)}catch(e){n=null}if(n){const o=n.clientSettings,i=n.info;o&&i&&t.pageGenTime0)return e.substring(0,t)}return””}(g.apikey));const p=function(e,t,n,o,i,s){if(n){i=i||{};const{apptype:r,audienceMode:c,pagetype:u,pageGenTime:d,bundleInfo:g}=n;i.pageGenTime=d,i.build=g&&g.v,i.appType=r;const h=”enterprise”===c&&”edgeChromium”===r?”entnews”:l[r],p=h||r,m=document.getElementsByTagName(“html”)[0].getAttribute(“lang”);let f=””;try{getCookieConsentRequired&&”function”==typeof getCookieConsentRequired&&getCookieConsentRequired()||(f=Object(a.a)(“muid”))}catch(e){console.log(“error fetching muid.”)}const b={name:”MS.News.Web.AppError”,time:d,ver:”4.0″,iKey:”o:”+o,data:{baseData:{},baseType:”MS.News.Web.Base”,page:{name:”default”,product:p,type:u},browser:{clientId:f},flight:{id:s},request:{activityId:n.aid,requestId:n.aid},locale:{mkt:m},extSchema:{id:e,severity:0,pb:i,message:t}}};return b?JSON.stringify(b):null}return null}(t,e,i,h,n,d);if(g&&p){console.error(p),u.push(p);const e=”https://”+c+”/OneCollector/1.0″+function(e){return”?”+Object.keys(e).map((function(t){return t+”=”+encodeURIComponent(e[t])})).join(“&”)}(g);navigator.sendBeacon(e,p)}else console.log(“missing parameters in data-client-settings. “+e)}catch(t){console.log(“error logging the app error. “+e)}}}}); ]]>

Source

Leave a Comment

Your email address will not be published. Required fields are marked *