"use strict";(this.__LOADABLE_LOADED_CHUNKS__=this.__LOADABLE_LOADED_CHUNKS__||[]).push([[9301],{20781:(e,t,o)=>{o.d(t,{Z:()=>b});var n=o(77184),i=o(92862),r=o(83533),s=o(72798),a=o(75628),c=o(10813),l=o(68062),u=o(35747),d=o(63992),p=o(78698);function g(){return g=Object.assign?Object.assign.bind():function(e){for(var t=1;t-1?"&":"?"}pname=fb&campid=s&keyid=${e}`;return`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent((0,l.v_)(f,o))}`}w.prototype.isReady=(0,n.Z)((function(){const e=this;return"undefined"==typeof window?Promise.reject(new Error("Facebook service is only available on browser")):new Promise(((e,t)=>{const o=(0,c.bM)(h.getState());(0,p.KB)().then((async()=>{setTimeout(t,5e3),await(0,i.Z)(`https://connect.facebook.net/${o}/sdk.js`,"facebookScript").then(e,t)}))})).then((()=>{if(!window.FB)throw new Error("FB is not initialized");window.FB.init({appId:e.config.fbAppId,channelUrl:`${f}misc/fb_channel/`,music:e.config.music,oauth:!0,status:!0,version:"v3.2",xfbml:!0})}))})),w.prototype.getFBSession=function(){return new Promise(((e,t)=>{window.FB.login(y.bind(null,e,t),{scope:"email,user_gender,user_location,user_birthday,user_link"})}))},w.prototype.login=function(e){return this.getFBSession().then(this._getProfile).then((({email:t,accessToken:o,userID:n})=>h.dispatch((0,u.R5)({accessToken:o,email:t,provider:"fb",signupFlow:e,userId:n}))))},w.prototype.link=function(e,t){return this.isReady().then((()=>new Promise(((e,t)=>{window.FB.login(y.bind(null,e,t),{scope:"email,user_gender,user_location,user_birthday,user_link"})})))).then((o=>(0,s.Z)((0,d.X0)({accessToken:o.accessToken,accessTokenType:"fb",ampUrl:(0,a.h_)(h.getState()),profileId:e,sessionId:t,uid:o.userID,useUnauthorizedInterceptor:!1})).then((()=>o.userID))))},w.prototype.backgroundLogin=function(){return this.isReady().then((()=>new Promise(((e,t)=>{window.FB.getLoginStatus((o=>{if(!o||"connected"!==o.status){const e=new Error("Attempted background login; FB did not provide a session");throw e.type="facebook",e.payload=o,e}return y(e,t,o)}))})))).then(this._getProfile).then((({email:e,accessToken:t,userID:o})=>h.dispatch((0,u.R5)({accessToken:t,email:e,provider:"fb",signupFlow:"default",userId:o}))))},w.prototype.parse=function(e){return this.isReady().then((()=>window.FB.XFBML.parse(e)))},w.prototype.getShareUrl=m,w.getShareUrl=m,w.prototype.getUserImageUrl=function(e){return this.isReady().then((()=>new Promise(((t,o)=>window.FB.api(`/${e}/picture`,{height:2e3,redirect:0,width:2e3},(e=>e?e.error?o(e.error):t(e.data.url):o(new Error("No FB Response"))))))))},w.prototype._getProfile=function(e){return new Promise(((t,o)=>window.FB.api("/me",(n=>n?n.error?o(n.error):t(g({},e,{email:n.email})):o(new Error("No FB Response"))))))};const b=w},99301:(e,t,o)=>{o.d(t,{s:()=>Q});var n=o(17),i=o(25642),r=o(20781),s=o(77184),a=o(92862),c=o(46423),l=o(83533),u=o(72798),d=o(75628),p=o(35747),g=o(63992),h=o(78698);const f=(0,l.ZP)();let y,w;function m(e){this.config={appId:e.appId,clientId:e.clientId,country:e.country},window.___gcfg={isSignedOut:!0,lang:e.lang,parsetags:"explicit"}}m.prototype.isReady=(0,s.Z)((function(){return new Promise(((e,t)=>{window.__gapiReady=()=>{w=window.gapi,w?w.load("auth2",(()=>{y=w.auth2.init({client_id:this.config.clientId,cookiepolicy:"single_host_origin",immediate:!1,requestvisibleactions:"http://schemas.google.com/ListenActivity",scope:"https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile"}),e()})):t(new Error("gapi was not initialized"))},(0,h.KB)().then((async()=>{setTimeout(t,5e3),await(0,a.Z)("https://apis.google.com/js/client:platform.js?onload=__gapiReady","gPlusScript").then(void 0,t)}))}))})),m.prototype.signin=function(){return this._gaSignin().then(this._getProfile).then((({email:e,access_token:t,id:o})=>f.dispatch((0,p.R5)({accessToken:t,email:e,provider:"google",signupFlow:"default",userId:o}))))},m.prototype.link=function(e,t){return this._gaSignin().then(this._getProfile).then((o=>(0,u.Z)((0,g.X0)({accessToken:o.access_token,accessTokenType:"google",ampUrl:(0,d.h_)(f.getState()),profileId:e,sessionId:t,uid:o.id})).then((()=>o.id))))},m.prototype._gaSignin=function(){return new Promise(((e,t)=>{if(y)y.signIn().then((()=>{const t=y.currentUser.get().getAuthResponse(),o=y.currentUser.get().getBasicProfile();e({access_token:t.access_token,email:o.getEmail(),id:o.getId()})})).catch((e=>{const o=e&&(e.error||e.description||e.message)||e,n=new Error(o);n.type="gplus",n.payload=o,c.ZP.error([c.Ke.AUTH,c.Ke.SOCIAL],o,{},n),t(n)}));else{const e=new Error("[Google error, auth2 is Undefined]");e.type="gplus",c.ZP.error([c.Ke.AUTH,c.Ke.SOCIAL],e.message,{},e),t(e)}}))},m.prototype._getProfile=function(e){return new Promise(((t,o)=>{if(!e||!e.access_token){const t=new Error("[Google error, User info is not complete. User access token is undefined]");return t.type="gplus",t.payload=e,o(t)}return t({access_token:e.access_token,email:e.email,id:e.id})}))};const b=m;var _=o(11692),k=o(59277),I=o(15803),v=o(40826),P=o.n(v),T=o(68062),U=o(32034),S=o(11129),F=o(70044),R=o(10813),A=o(94214),Z=o(61006),L=o(82766),B=o(5132),E=o(24586);let C;const K=(0,l.ZP)(),O=(0,A.v)(K.getState()),j=()=>{K.dispatch((0,E.j_)({title:O("Login unsuccessful. Please try again later."),sticky:!0}))},H=(0,L.z)({initialize({appKey:e}){if(!e)return!1;const t=document.createElement("script");return t.id="google-sdk",t.src="https://accounts.google.com/gsi/client",t.async=!0,t.defer=!0,document.body.append(t),new Promise(((o,n)=>{t.addEventListener("load",(()=>{var t;C=null==(t=google.accounts)?void 0:t.oauth2.initCodeClient({client_id:e,callback:async e=>{if(!(0,B.Kn)(e)||!(0,B.HD)(e.code))return j(),void n();const t=await(0,u.Z)({method:"GET",url:"/api/v1/google/exchange-code/",params:{code:e.code}});if(200===t.status){const{accessToken:e,idToken:o}=t.data,i=(0,Z.Z)(o);i.sub?K.dispatch((0,p.R5)({accessToken:e,email:i.email,provider:"google",signupFlow:"default",userId:i.sub})):(c.ZP.error([c.Ke.AUTH,c.Ke.SOCIAL],"Google JWT unable to be decoded"),j(),n())}else c.ZP.error([c.Ke.AUTH,c.Ke.SOCIAL],"Google code exchange failed"),j(),n()},scope:"profile email openid"}),o(!0)}))}))},login(){C.requestCode?C.requestCode():(c.ZP.error([c.Ke.AUTH,c.Ke.SOCIAL],"Unable to request code from Google code client"),j())},remove(){var e;null==(e=document.querySelector("script#google-sdk"))||e.remove()}});var D=o(40887);const G=(0,l.ZP)(),$=(0,U.zB)({isAuthenticated:S.j3}),z={fb:"Facebook",gplus:"Google"},q=P()((()=>$(G.getState()))),x=P()((()=>$(G.getState()))),J="facebook-warning-shown";function N(){const e=G.getState(),{isAuthenticated:t}=$(e);t&&this.userChanged(),G.subscribe(q((()=>{this.userChanged()}))),this.tw=i,this.gplus=new b({clientId:(0,F.QJ)(e),country:(0,d.so)(e),lang:(0,R.VQ)(e)}),this.google=H;try{this.google.initialize({appKey:(0,F.QJ)(e),clientSecret:(0,F.q1)(e)})}catch(e){}this._initFbBridge()}N.prototype._initFbBridge=function(){const e=(0,S.Ld)(G.getState()),t=(0,T.IO)();let o;if(o=decodeURIComponent(t.radio_station||t.musician||""),o&&(o=(0,T.F1)(o,{autoplay:!0})),e&&(t.fb_auto_login||o))return this.isReady().then(this.backgroundLogin.bind(this,"fb"));o&&(window.location=o)},N.prototype.userChanged=function(){const e=G.getState(),{isAnonymous:t}=(0,S.Ld)(e);this.fb=new r.Z({country:(0,d.so)(e),fbAppId:(0,F.iJ)(e),music:!t})},N.prototype.isReady=function(){return Promise.all([this.isGoogleReady(),this.isFacebookReady()])},N.prototype.isGoogleReady=function(){var e;return null==(e=this.gplus)?void 0:e.isReady()},N.prototype.isFacebookReady=function(){return new Promise(((e,t)=>{const{isAuthenticated:o}=$(G.getState());if("/sdk/auth/"===window.location.pathname)this.userChanged(),this.initFacebook().then(e);else if(o)this.initFacebook().then(e);else{const t=G.subscribe(x((()=>{t(),this.userChanged(),this.initFacebook().then(e)})))}}))},N.prototype.initFacebook=function(){return this.fb.isReady().then(void 0,(()=>{k.Z.getItem(J,null)&&(k.Z.setItem(J,1),k.Z.setItem(I.Z.SocialTimeout,1))}))},N.prototype.backgroundLogin=function(e){return"fb"===e?this.fb.backgroundLogin():Promise.reject(new Error("Unsupported social type"))},N.prototype.link=function(e){const t=G.getState(),o=(0,A.v)(t),{profileId:i,sessionId:r}=(0,S.UR)(t),s="fb"===e,a=z[e];return this.isReady().then((()=>{var e;return s?this.fb.link(i,r):null==(e=this.gplus)?void 0:e.link(i,r)})).then((e=>{G.dispatch((0,D.MJ)(s?"facebookId":"googlePlusId",e)),_.Z.trigger(_.E.AUTHENTICATED,s?"facebook":"gplus"),G.dispatch((0,E.j_)({title:o("Update successful."),description:o("Your account has been linked to {provider}.",{provider:s?"Facebook":"Google"})}))})).catch((e=>{c.ZP.error([c.Ke.AUTH,c.Ke.SOCIAL],{},{},e),(0,n.Z)(e,["response","data","errors"],[]).forEach((({code:e})=>{2===e?G.dispatch((0,E.j_)({title:o("This {accountType} account is already linked to an iHeartRadio account",{accountType:a})})):G.dispatch((0,E.j_)({title:o("{accountType} account linking failed. Please try again later.",{accountType:a})}))}))}))},N.prototype.unlink=function(e){return this.isReady().then((()=>{const t=G.getState(),o=(0,A.v)(t),n="fb"===e,i=z[e],{profileId:r,sessionId:s}=(0,S.UR)(t);return(0,u.Z)((0,g.Gr)({ampUrl:(0,d.h_)(t),profileId:r,provider:e,sessionId:s})).then((()=>{G.dispatch((0,D.MJ)(n?"facebookId":"googlePlusId",null)),G.dispatch((0,E.j_)({title:o("Update successful."),description:o("Your account has been unlinked from {provider}.",{provider:n?"Facebook":"Google"})}))}),(()=>{G.dispatch((0,E.j_)({title:o("{accountType} account unlinking failed. Please try again later.",{accountType:i})}))}))}))},N.prototype.parse=function(e){if("fb"===e)return this.fb.parse()},N.prototype.login=function(e){const t=G.getState(),o=(0,A.v)(t),n={facebook:()=>this.fb.login(),googleplus:()=>this.google.login()};return this.isReady().then((()=>{var t;return null==n||null==(t=n[e])||null==(t=t.call(n))?void 0:t.catch((e=>{c.ZP.error([c.Ke.AUTH,c.Ke.SOCIAL],{},{},e);const t="popup_closed_by_user"===e.payload?o("Login unsuccessful. Window closed before completion. Please try again."):o("Login unsuccessful. Please try again later.");G.dispatch((0,E.j_)({title:t,sticky:!0}))}))}))},N.prototype.checkForPopUpError=function(e){if(["popup_closed_by_user","popup_blocked_by_browser"].includes(e)){const e=G.getState(),t=(0,A.v)(e);return G.dispatch((0,E.j_)({title:t("Do You Have a Popup Blocker?"),description:t("To log in with your Facebook or Google account, ensure you've allowed popups from www.iheart.com, refresh, and then try again."),sticky:!0})),!0}return!1},N.prototype.getUserImageUrl=function(e,t){if("fb"===e)return this.fb.getUserImageUrl(t)};const M=new N,Q=()=>M},25642:(e,t,o)=>{o.r(t),o.d(t,{getShareUrl:()=>s,getTweetUrl:()=>a});var n=o(68062);const i=`${window.location.protocol}//${window.location.host}/`;function r(e,t,o=""){return`http://twitter.com/share?${(0,n.wu)({related:"iHeartRadio",screen_name:o,text:e,url:(0,n.v_)(i,t)})}`}function s(e,t){return r(`I’m listening to ${t} ♫ @iHeartRadio`,e)}function a(e){return e?r("","",e.replace(/@/g,"").trim()):""}}}]); //# sourceMappingURL=9301.www.js.map