(self.webpackChunk_msnews_msnews_experiences=self.webpackChunk_msnews_msnews_experiences||[]).push([["experiences_ms-rewards-wc_dist_index_js"],{51727:function(e,t,r){"use strict";r.r(t),r.d(t,{MsRewardsWC:function(){return S},MsRewardsWCStyles:function(){return X},MsRewardsWCTemplate:function(){return _},ToolingInfo:function(){return Q}});var s=r(64690),a=r(84289),n=r(12090),o=r(12517),i=r(83227);const d=(0,s.e)(i.x.msRewardsWC,"A sample Peregrine Web Component experience",Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},(0,a.G)("thresholdToTruncateRewardPoints","Points Truncation","Threshold to determine when to truncate reward points")),{coachmarkInfo:(0,n.h)("Coachmark","Coachmark experience info",[i.x.coachmarkWC])}),(0,o.u)({accessibility:{msRewardsAriaLabel:"Microsoft rewards",title:"Microsoft rewards"},truncatedRewardPoints:"9999+"})),(0,a.JJ)("rewardsIconAligned","Determines if the rewards icon and text are aligned as expected")),(0,a.JJ)("disableDarkMode","Tells whether dark mode should be avaialble")));var l=r(33940),h=r(1334),c=r(16517),p=r(41115),g=r(54804),u=r(12108),w=r(53076),m=r(31699),f=r(99452),y=r(26415),b=r(19388);var v,C,x,M,k;!function(e){e.EdgeChromiumNtp="MSNInterestsAnaheimNTP",e.EdgeChromiumDhp="MSNInterestsAnaheimDHP",e.EdgeNtp="MSNInterestEdgeNTP",e.EdgeDhp="MSNInterestsEdgeDHP",e.SpartanNtp="MSNInterestPrimeNTP",e.SpartanDhp="MSNInterestsPrimeDHP"}(v||(v={})),function(e){e.EdgeChromiumNtp="MY01G9",e.EdgeChromiumDhp="MY01G8",e.EdgeNtp="MY01GD",e.EdgeDhp="MY01GC",e.SpartanNtp="MY01GH",e.SpartanDhp="MY01GG"}(C||(C={})),function(e){e.EdgeChromiumNtp="MY01GB",e.EdgeChromiumDhp="MY01GA",e.EdgeNtp="MY01GF",e.EdgeDhp="MY01GE",e.SpartanNtp="MY01GJ",e.SpartanDhp="MY01GI"}(x||(x={})),function(e){e.EdgeChromiumNtp="edgechromiumntp",e.EdgeChromiumDhp="edgechromiumdhp",e.EdgeNtp="edgentp",e.EdgeDhp="edgedhp",e.SpartanNtp="spartanntp",e.SpartanDhp="spartandhp"}(M||(M={})),function(e){e.EdgeChromium="EdgeNTP",e.Windows="WindowsStart"}(k||(k={}));var E=r(65135),T=r(38156),D=r(9533),I=r(81555),O=r(75155),P=r(33379),R=r(58958),N=r(77162),F=r(65932);class S extends O.l{constructor(){super(...arguments),this.pageType=u.G.NTP,this.partnerId=k.EdgeChromium,this.flyoutOpen=!1,this.outsideClickHandler=this.handleOutsideClick.bind(this),this.onMessageHandler=this.onMessage.bind(this),this.onFlyoutEvent=(e,t)=>{this.showFlyout&&e!==h.tk.msRewards&&t&&this.toggleFlyout()}}getExperienceType(){return i.x.msRewardsWC}connectedCallback(){super.connectedCallback(),window.addEventListener("message",this.onMessageHandler),(0,h.WW)(this.onFlyoutEvent)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("message",this.onMessageHandler)}onMessage(e){if(e&&e.data&&"resize"===e.data.action){if(e.data.bodyHeight){const t=this.shadowRoot.querySelector(".rewards-flyout");t&&t.style&&(t.style.height=e.data.bodyHeight+"px")}else E.M0.sendAppErrorEvent(Object.assign(Object.assign({},y.s8f.RewardsFlyoutBodyHeightMissing),{message:"Rewards flyout didn't return body height"}));(0,b.o_)("RewardsFlyout",!0)}}toggleFlyout(){this.showFlyout=!this.showFlyout,this.showFlyout?document.addEventListener("mouseup",this.outsideClickHandler):document.removeEventListener("mouseup",this.outsideClickHandler),(0,h.Gg)(h.tk.msRewards,this.showFlyout)}get rewardsButtonAlignmentClass(){return this.config.rewardsIconAligned?"rewards-button-aligned":""}get rewardPointsAlignmentClass(){return this.config.rewardsIconAligned?"reward-points-aligned":""}handleOutsideClick(e){if(e.target.instanceId===i.x.msRewardsWC)return;const t=e.composedPath();(null==t?void 0:t.includes(this))||(this.showFlyout=!1,document.removeEventListener("mouseup",this.outsideClickHandler),(0,h.Gg)(h.tk.msRewards,!1))}experienceConnected(){var e,t;this.pageType=null===(t=null===(e=null===c.jG||void 0===c.jG?void 0:c.jG.TrackInfo)||void 0===e?void 0:e.sitePage)||void 0===t?void 0:t.page_type,this.pageType===u.G.Windows&&(this.isOnImage=this.getDarkModeStatus(),this.iconClass=this.isOnImage?"light":"dark",this.partnerId=k.Windows,this.flyoutClass="win-flyout"),(0,p.N6)("backgroundImage",(e=>{const t="displayed"===e;m.S.queueUpdate((()=>{this.isOnImage=t||this.getDarkModeStatus(),this.iconClass=this.isOnImage?"light":"dark"}))})),this.showExperience=!0,(0,F.Uo)(w.z.RewardsData,(e=>this.updateRewardsData(e))),this.generateTelemetryTags()}updateRewardsData(e){this.rewardPoints=e.rewardPoints,(0,N.n2)().then((t=>{const r=(0,g.nP)().CurrentFlightSet.has("prg-acclink-rewards")&&t&&e.isRewardsUser;this.showExperience=!t||r}))}generateTelemetryTags(){this.rewardsTelemetryObject=this.telemetryObject.addOrUpdateChild({name:"MicrosoftRewards",type:T.c9.Module,behavior:T.wu.Customize,content:{headline:"Rewards"}}),this.rewardsTelemetryTag=this.rewardsTelemetryObject.getMetadataTag()}shadowDomPopulated(){if(!(0,P.N)())return;const e=this.shadowRoot.getElementById("msRewards");e&&(0,D.FY)(I._.rewardsIcon,e);const t=this.shadowRoot.getElementById("rewards-button");t&&(0,D.FY)(I._.rewardsButton,t)}getDarkModeStatus(){return!this.config.disableDarkMode&&(0,R.Y)()}}(0,l.gn)([f.LO],S.prototype,"showExperience",void 0),(0,l.gn)([f.LO],S.prototype,"rewardPoints",void 0),(0,l.gn)([f.LO],S.prototype,"isOnImage",void 0),(0,l.gn)([f.LO],S.prototype,"showFlyout",void 0),(0,l.gn)([f.LO],S.prototype,"rewardsTelemetryTag",void 0),(0,l.gn)([f.LO],S.prototype,"iconClass",void 0),(0,l.gn)([f.LO],S.prototype,"flyoutClass",void 0);var $=r(49218),G=r(93703),H=r(94929),L=r(56334),Y=r.n(L);const j=$.d`