dotfiles/.config/spicetify/Extracted/Raw/login/login.js

2 lines
85 KiB
JavaScript
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(()=>{var e,t={3171:e=>{e.exports={af:"af-ZA",am:"am-ET",ar:"ar",az:"az-AZ",bg:"bg-BG",bn:"bn-IN",bho:"bp",cs:"cs-CZ",da:"da-DK",de:"de-DE",el:"el-GR",es:"es-ES","es-419":"es-LA",et:"et-EE",fa:"fa-IR",fr:"fr-FR",fi:"fi-FI",fil:"fp-PH","fr-CA":"fr-CA",gu:"gu-IN",hu:"hu-HU",he:"he-IL",hi:"hi-IN",hr:"hr-HR",id:"id-ID",is:"is-IS",it:"it-IT",ja:"ja-JP",kn:"kn-IN",ko:"ko-KR",lt:"lt-LT",lv:"lv-LV",ml:"ml-IN",mr:"mr-IN",ms:"ms-MY",nb:"nb-NO",ne:"ne-NP",nl:"nl-NL",or:"or-IN","pa-IN":"pa-IN","pa-PK":"pa-PK",pl:"pl-PL","pt-PT":"pt-PT","pt-BR":"pt-BR",ro:"ro-RO",ru:"ru-RU",sk:"sk-SK",sl:"sl-SI",sr:"sr-RS",sv:"sv-SE",sw:"sw",ta:"ta-IN",te:"te-IN",th:"th-TH",tr:"tr-TR",uk:"uk-UA",ur:"ur",vi:"vi-VN","zh-CN":"zh-CN","zh-TW":"zh-TW",zu:"zu-ZA","ar-EG":"ar-EG","ar-MA":"ar-MA","ar-SA":"ar-SA",eu:"eu-ES",bs:"bs-BA",ca:"ca-ES","zh-HK":"zh-HK","en-GB":"en-GB",gl:"gl-ES",mk:"mk-MK","es-AR":"es-AR","es-MX":"es-MX"}},8272:(e,t,n)=>{"use strict";var s={};n.r(s),n.d(s,{ABORT_LOGIN_TYPE_ACCOUNTS:()=>A,ACCOUNTS_METHODS:()=>P,LOADING:()=>v,LOGIN_BEFORE:()=>E,LOGIN_CLEAR_ERRORS:()=>w,LOGIN_FAIL:()=>C,LOGIN_SUCCESS:()=>k,LOGIN_TYPE_ACCOUNTS:()=>N,LOGIN_TYPE_AUTOLOGIN:()=>I,LOGIN_TYPE_EMAIL:()=>T,UTM_PARAMETERS:()=>x,abortLoginWithAccounts:()=>G,fetchUTMParameters:()=>B,loading:()=>L,login:()=>R,loginClearErrors:()=>W,loginFailed:()=>O,loginSuccess:()=>M,loginWithAccounts:()=>U,receivedUTMParameters:()=>H});var r={};n.r(r),n.d(r,{ENTER_LOGIN_MODE:()=>q,ENTER_SETTINGS_MODE:()=>J,ENTER_SIGNUP_MODE:()=>$,ENTER_SIGNUP_MODE_STEP_0:()=>K,ENTER_SIGNUP_MODE_STEP_1:()=>Y,ENTER_WELCOME_MODE:()=>z,INTERACTION:()=>X,START_APP:()=>V,enterLoginMode:()=>ne,enterSettingsMode:()=>re,enterSignupMode:()=>Q,enterSignupModeStep0:()=>ee,enterSignupModeStep1:()=>te,enterWelcomeMode:()=>se,interaction:()=>ie,openSignupPage:()=>oe,startApp:()=>Z});var o={};n.r(o),n.d(o,{CLEAR_ALL_ERRORS:()=>De,COUNTRY_NOT_LAUNCHED:()=>Pe,FACEBOOK_SIGNUP_ATTEMPT:()=>Ce,FACEBOOK_SIGNUP_FAILURE:()=>xe,FACEBOOK_SIGNUP_SUCCESS:()=>ve,SIGNUP_ATTEMPT:()=>Ee,SIGNUP_FAILURE:()=>ke,SIGNUP_RESTRICTIONS_FAILURE:()=>ye,SIGNUP_RESTRICTIONS_SUCCESS:()=>Se,SIGNUP_SUCCESS:()=>we,UPDATE_SIGNUP_DATA:()=>Ae,VALIDATE_FIELD_ATTEMPT:()=>Te,VALIDATE_FIELD_FAILURE:()=>Ie,VALIDATE_FIELD_SUCCESS:()=>Ne,clearAllErrors:()=>Xe,countryNotLaunched:()=>Je,facebookSignup:()=>We,facebookSignupFailure:()=>$e,facebookSignupSuccess:()=>Ve,getSignupRestrictions:()=>Fe,signup:()=>Le,signupAttempt:()=>Re,signupFailure:()=>Ge,signupRestrictionsFailure:()=>Oe,signupRestrictionsSuccess:()=>Me,signupSuccess:()=>Ue,signupWithAccounts:()=>He,updateSignupData:()=>ze,validateField:()=>je,validateFieldAttempt:()=>Ke,validateFieldFailure:()=>Ye,validateFieldSuccess:()=>qe});var i={};n.r(i),n.d(i,{SETTINGS_FETCH_PROXY_SETTINGS_FAILURE:()=>mt,SETTINGS_FETCH_PROXY_SETTINGS_SUCCESS:()=>gt,SETTINGS_RESTART_CLIENT_FAILURE:()=>St,SETTINGS_RESTART_CLIENT_SUCCESS:()=>bt,SETTINGS_UPDATE_PROXY_SETTINGS_FAILURE:()=>ft,SETTINGS_UPDATE_PROXY_SETTINGS_SUCCESS:()=>_t,fetchProxySettings:()=>yt,restartClient:()=>kt,updateProxySettings:()=>Et});var a=n(7995),l=n(2033),d=n(1740),c=n(4607),u=n(7180);const p=e=>n.g&&"function"==typeof n.g._getSpotifyModule?new Promise(((t,s)=>{n.g._getSpotifyModule("bridge").executeRequest(JSON.stringify(e),{onSuccess:t,onFailure:s})})):null,h=window.localStorage,g="lastUsername",m="THIS_USER_DOES_NOT_EXIST_AND_IS_A_PLACEHOLDER",_="utmParameters",f=h.getItem(_),b=h.getItem(g),S={errorData:null,loginInProgress:!1,redirectTo:null,username:b!==m?b:"",utmParameters:f?JSON.parse(f):null};const y=function(e=S,t){switch(t.type){case wt.LOADING:return{...e,loading:!0,throbberDelay:t.throbberDelay};case wt.LOGIN_FAIL:return{...e,loading:!1,errorData:t.errorData,loggedIn:!1,loginInProgress:!1};case wt.LOGIN_BEFORE:return{...e,errorData:t.errorData,loggedIn:!1,loginInProgress:t.loginInProgress,username:t.username};case wt.LOGIN_SUCCESS:return{...e,loading:!1,loggedIn:!0,redirectDelay:t.redirectDelay||0,redirectTo:t.redirectTo,username:t.username};case wt.UTM_PARAMETERS:return{...e,utmParameters:t.utmParameters};case wt.LOGIN_CLEAR_ERRORS:return{...e,errorData:null};default:return e}},E="LOGIN_BEFORE",k="LOGIN_SUCCESS",w="LOGIN_CLEAR_ERRORS",C="LOGIN_FAIL",v="LOADING",x="UTM_PARAMETERS",T="login",I="autologin",N="login-accounts",A="abort-login-accounts",P={facebook:"facebook",apple:"apple",google:"google"},D=200;function F(e,t=T){return{type:E,errorData:null,username:e||"",loginInProgress:t===T,loginType:t}}function M(e,t,n=T,s=!1,r){return{type:k,errorData:null,redirectTo:r,redirectDelay:t||0,username:e,loginType:n,afterSignup:s}}function O(e,t=T){return{type:C,errorData:e,loginType:t}}function L(e){return{type:v,throbberDelay:e&&e.throbberDelay?e.throbberDelay:0}}const j=async(e,t,{defaultErrorCode:n,redirectDelay:s=0}={},r=T,o=!1,i=null,a=!0)=>{i&&(t.args=t.args||[],t.args[0]=t.args[0]||{},t.args[0].actionHash=i);try{const n=JSON.parse(await p(t)).redirectTo||"xpui";let i=null;t&&t.args&&t.args[0]&&(i=t.args[0].username),e(M(a?i:m,s,r,o,n))}catch(t){let s=t;n?s={errorCode:n}:"string"==typeof t&&(s=JSON.parse(t)),e(O(s,r))}};function R({username:e,password:t,rememberMe:n},s=!1,r=null){return o=>{const i=s?I:T;o(F(n?e:m,i));j(o,{name:T,args:[{username:e,password:t,rememberMe:n}]},{redirectDelay:D},i,s,r,n)}}function U(e,t){return n=>{n(F(null,N));j(n,{name:N,args:[{method:e,enableSignup:!1}]},{redirectDelay:D},N,!1,t)}}function G(){return async()=>{await p({name:A,args:[]})}}function B(){return async e=>{e(H(JSON.parse(await p({name:"get-signup-utm-parameters",args:[]}))))}}function H(e){return{type:x,utmParameters:e}}function W(){return{type:w}}const V="START_APP",$="ENTER_SIGNUP_MODE",K="ENTER_SIGNUP_MODE_STEP_0",Y="ENTER_SIGNUP_MODE_STEP_1",q="ENTER_LOGIN_MODE",z="ENTER_WELCOME_MODE",J="ENTER_SETTINGS_MODE",X="INTERACTION";function Z(){return{type:V}}function Q(e=null){return{type:$,actionHash:e}}function ee(){return{type:K}}function te(){return{type:Y}}function ne(e=null){return{type:q,actionHash:e}}function se(e=null){return{type:z,errorMessage:e}}function re(){return{type:J}}function oe(e=!1){return async(t,n)=>{let s,r={};switch(e?"website":"desktop-app"){case"desktop-app":t(Q());break;case"website":{await t(B());const e=n();r=e.login.utmParameters||{utm_source:"spotify",utm_medium:"desktop-unknown",utm_campaign:"organic",referral:""};const o=Object.keys(r).reduce(((e,t)=>(e[t]=encodeURIComponent(r[t]),e)),{});s=`https://www.spotify.com/signup?utm_source=${o.utm_source}&utm_medium=${o.utm_medium}&utm_campaign=${o.utm_campaign}`,o.referral&&(s+=`&referral=${o.referral}&referrer=${o.referral}`),window.open(s);break}}}}function ie(e,t,n,s,r){return{type:X,page:e,interactionType:t,intent:n,itemId:s,actionHash:r}}var ae=n(8961),le=n.n(ae);const de="Spotify-App-Version",ce="App-Platform";function ue(){const e="undefined"!=typeof window&&window.__spotify&&window.__spotify.DESKTOP_SIGNUP_DEBUG_KEY;return e||"4c7a36d5260abca4af282779720cf631"}function pe(){const e="undefined"!=typeof window&&window.__spotify&&window.__spotify.client_version||"";if(!e)throw new Error("Missing Spotify App Version! Something is wrong: talk to #desktop-squad.");return[de,e]}function he(){const e="undefined"!=typeof window&&window.navigator&&window.navigator.platform||"";let t="";if(-1!==e.indexOf("Mac")?t="OSX":-1!==e.indexOf("Win")?t="Win32":-1!==e.indexOf("Linux")&&(t="Linux"),!t)throw new Error("Missing App Platform! Something is wrong: talk to #desktop-squad.");return[ce,t]}function ge(e){const t=new Map(Object.entries(e).sort()),n=function(e){const t=le().create();return e.forEach((e=>{void 0!==e&&t.update(e.toString())})),t.hex()}(t);if(t.size>n.length)return t;const s=[...t],r=[...Array(t.size).keys()].sort((function(e,t){const r=n.charAt(e).localeCompare(n.charAt(t));return 0!==r?r:s[e][0].localeCompare(s[t][0])})),o=new Map;return r.forEach((function(e){o.set(s[e][0],s[e][1])})),o}const me=e=>async(t,n,s)=>{const r=function({name:e,email:t,password:n,gender:s,birthDate:r={},sendEmail:o,shareData:i,agreeEula:a}={},l={utm_source:"spotify",utm_medium:"desktop-unknown",utm_campaign:"organic",referral:""},d=!1){const c=Object.keys(l).reduce(((e,t)=>(e[t]=encodeURIComponent(l[t]),e)),{});let u=`https://login.app.spotify.com?utm_source=${c.utm_source}&utm_medium=${c.utm_medium}&utm_campaign=${c.utm_campaign}`;c.referral&&(u+=`&referral=${c.referral}&referrer=${c.referral}`);const p={key:ue(),displayname:e,email:t,password:n,password_repeat:n,gender:s,birth_year:r.year,birth_month:r.month,birth_day:r.day,iagree:a?1:0,creation_point:u,creation_flow:"desktop",platform:"desktop",referrer:c.referral};return"boolean"==typeof o&&(p["send-email"]=o),"boolean"==typeof i&&(p.thirdpartyemail=i),d&&Object.keys(p).forEach((e=>{void 0===p[e]&&delete p[e]})),ge(p)}(t,n,s),o=new FormData;r.forEach(((e,t)=>{o.append(t,e)}));const i=[pe(),he()].reduce(((e,t)=>(e[t[0]]=t[1],e)),{}),a={method:"POST",body:o,headers:{"App-Platform":i["App-Platform"],"Spotify-App-Version":i["Spotify-App-Version"],"X-Client-Id":{}.SPOTIFY_CLIENT_ID}},l=new Request(e,a);((e,t)=>{const n=e.headers.get("content-type");e.headers.set("content-type",((e,t)=>[...e.split(";"),t].join(";"))(n,t))})(l,"charset=utf-8");const d=await fetch(l),{errors:c,...u}=await d.json()||{};if(c)throw c;return u},_e=me("https://spclient.wg.spotify.com/signup/public/v1/account/"),fe=me("https://spclient.wg.spotify.com/signup/public/v1/account/?validate=true"),be=async()=>{const e=await fetch("https://spclient.wg.spotify.com/signup/public/v1/account/?validate=1"),t=await e.json()||{};if(t.errors&&t.errors.length>0)throw t.errors;return t};const Se="SIGNUP_RESTRICTIONS_SUCCESS",ye="SIGNUP_RESTRICTIONS_FAILURE",Ee="SIGNUP_ATTEMPT",ke="SIGNUP_FAILURE",we="SIGNUP_SUCCESS",Ce="FACEBOOK_SIGNUP_ATTEMPT",ve="FACEBOOK_SIGNUP_SUCCESS",xe="FACEBOOK_SIGNUP_FAILURE",Te="VALIDATE_FIELD_ATTEMPT",Ie="VALIDATE_FIELD_FAILURE",Ne="VALIDATE_FIELD_SUCCESS",Ae="UPDATE_SIGNUP_DATA",Pe="COUNTRY_NOT_LAUNCHED",De="CLEAR_ALL_ERRORS";function Fe(){return async(e,t)=>{const n=t();try{e(Me(window.__spotify&&!0===window.__spotify.is_running_on_teamcity?{}:await be()))}catch(t){e(Oe(t)),n.app&&n.app.mode&&"welcome"!==n.app.mode&&(e(ne()),e(oe(!0)))}}}function Me(e){return{type:Se,restrictions:e}}function Oe(e){return{type:ye,error:e}}function Le(e=null){return async(t,n)=>{t(Re()),await t(B());const s=n().signup.formData,r=n().login.utmParameters;try{await _e(s,r),t(Ue());const{email:n,password:o}=s;t(R({username:n,password:o,rememberMe:!0},!0,e))}catch(e){const n={};Object.keys(e).forEach((t=>{n["birthdate"===t?"birthDate":t]={message:e[t]}})),t(Ge(n))}}}function je(e){return async(t,n)=>{await t(B());const s=n().signup.formData[e],r=n().login.utmParameters;t(Ke(e,s));try{await fe({[e]:s},r,!0)}catch(n){n[e]&&t(Ye(e,{message:n[e]}))}}}function Re(){return{type:Ee}}function Ue(){return{type:we}}function Ge(e){return{type:ke,errors:e}}const Be=async(e,t,n=null)=>{n&&(t.args=t.args||[],t.args[0]=t.args[0]||{},t.args[0].actionHash=n);try{const n=JSON.parse(await p(t)).redirectTo||"xpui";e(Ve()),e(M(null,0,I,!0,n))}catch(t){let n=t;"string"==typeof t&&(n=JSON.parse(t)),e($e(n))}};function He(e,t=null){return n=>{const s={name:N,args:[{method:e,enableSignup:!0}]};n(We()),Be(n,s,t)}}function We(){return{type:Ce}}function Ve(){return{type:ve}}function $e(e){return{type:xe,errorData:e}}function Ke(e,t){return{type:Te,field:e,value:t}}function Ye(e,t){return{type:Ie,field:e,error:t}}function qe(e){return{type:Ne,field:e}}function ze(e){return{type:Ae,data:e}}function Je(){return{type:Pe}}function Xe(){return{type:De}}var Ze=n(9496),Qe=n(3171),et=n.n(Qe);let tt=function(e){return e.af="af",e.am="am",e.ar="ar",e.arEG="ar-EG",e.arMA="ar-MA",e.arSA="ar-SA",e.az="az",e.bg="bg",e.bn="bn",e.bho="bho",e.bs="bs",e.ca="ca",e.cs="cs",e.da="da",e.de="de",e.el="el",e.en="en",e.enGB="en-GB",e.es419="es-419",e.es="es",e.esAR="es-AR",e.esMX="es-MX",e.et="et",e.eu="eu",e.fa="fa",e.fi="fi",e.fil="fil",e.frCA="fr-CA",e.fr="fr",e.gl="gl",e.gu="gu",e.he="he",e.hi="hi",e.hr="hr",e.hu="hu",e.id="id",e.is="is",e.it="it",e.ja="ja",e.kn="kn",e.ko="ko",e.lt="lt",e.lv="lv",e.mk="mk",e.ml="ml",e.mr="mr",e.ms="ms",e.nb="nb",e.ne="ne",e.nl="nl",e.or="or",e.paIN="pa-IN",e.paPK="pa-PK",e.pl="pl",e.ptBR="pt-BR",e.ptPT="pt-PT",e.ro="ro",e.ru="ru",e.sk="sk",e.sl="sl",e.sr="sr",e.sv="sv",e.sw="sw",e.ta="ta",e.te="te",e.th="th",e.tr="tr",e.uk="uk",e.ur="ur",e.vi="vi",e.zhCN="zh-CN",e.zhHK="zh-HK",e.zhTW="zh-TW",e.zu="zu",e}({});var nt=function(e){return e.AR="، ",e.FA="، ",e.EN=", ",e}(nt||{}),st=function(e){return e.ZERO="zero",e.ONE="one",e.TWO="two",e.FEW="few",e.MANY="many",e.OTHER="other",e}(st||{});let rt={};const ot=e=>"ar"===e?"ar-u-nu-latn":e;function it(e){const t=`(?:${e.join("|")})`;return new RegExp(String.raw`(\{${t}\}|%${t}%)`,"g")}const at=new class{_relativeTimeFormat=null;_dateTimeFormats=new Map;constructor(){this._dictionary={},this._locale=tt.en,this._urlLocale=tt.en}getDateTimeFormat(e){const t=JSON.stringify(Object.keys(e).sort().map((t=>({[t]:e[t]}))));let n=this._dateTimeFormats.get(t);return void 0===n&&(n=new Intl.DateTimeFormat(ot(this._locale),e),this._dateTimeFormats.set(t,n)),n}getRelativeTimeFormat(){return null===this._relativeTimeFormat&&(this._relativeTimeFormat=void 0===Intl.RelativeTimeFormat?null:new Intl.RelativeTimeFormat(this._locale)),this._relativeTimeFormat}getDictionary(){return this._dictionary}setDictionary(e){this._dictionary=e}setLocale(e){this._locale=e,this._dateTimeFormats.clear(),this._relativeTimeFormat=null}setUrlLocale(e){this._urlLocale=e}getLocale(){return this._locale}getUrlLocale(){return this._urlLocale}getSmartlingLocale(){const e=this._locale;return et()[e]||e}toLocaleLowerCase(e){return e?.toLocaleLowerCase(this._locale)}toLocaleUpperCase(e){return e?.toLocaleUpperCase(this._locale)}get(e,...t){const n=e in this._dictionary?this._dictionary[e]:e;let s="";if("string"!=typeof n){const e=t[0],r=((e,t)=>{try{return(rt[e]||(rt[e]=new Intl.PluralRules(e))).select(t)}catch{return st.OTHER}})(this._locale,parseInt(e,10)),o=n[r];void 0!==o?s=o:n.other&&(s=n.other)}else s=n;if(/%\d%/.test(s)){if(!["desktop.login.DefaultErrorMessage","desktop.login.ErrorProxyAuthRequired","desktop.login.MissingUserInfoMessage","desktop.login.RegionMismatchMessage","desktop.login.ClientUpdateFail","desktop.login.FbUserNotFoundSignUp","desktop-auth.error"].includes(e))throw new Error("i18n: The placeholder format %0% is legacy and is only allowed for existing strings.")}const r={},o={};t.forEach(((e,t)=>{const n="object"!=typeof e||null===e||(0,Ze.isValidElement)(e)?[[t,e]]:Object.entries(e);for(const[e,t]of n)(0,Ze.isValidElement)(t)?o[e]=t:void 0!==t&&(r[e]=t)})),s=s.replace(it(Object.keys(r)),((e,t)=>{const n=t.slice(1,-1),s=r[n];return"number"==typeof s?this.formatNumber(s):s}));const i=Object.keys(o);return i.length?(0,Ze.createElement)(Ze.Fragment,null,s.split(it(i)).map(((e,t)=>{if(t%2){const t=e.slice(1,-1),n=o[t];return(0,Ze.cloneElement)(n,{key:n.key??t})}return e})).filter((e=>""!==e))):s}getSeparator(){switch(this._locale){case tt.ar:return nt.AR;case tt.fa:return nt.FA;default:return nt.EN}}formatNumber(e,t){return e.toLocaleString(ot(this._locale),t)}formatNumberCompact(e){return this.formatNumber(e,{notation:"compact",maximumFractionDigits:1})}formatDate(e,t=null){const n=t||{year:"numeric",month:"long",day:"numeric"};return this.getDateTimeFormat(n).format(e)}formatRelativeDate(e,t=null){const n=new Date(Date.now());e=new Date(e);const s=this.getRelativeTimeFormat(),r=e.getTime()-n.getTime(),o=Math.abs(r)<2592e6;if(null!==s&&o){const{weeks:e,days:t,hours:n,minutes:o,seconds:a}=(i=r,{seconds:Math.round(i/1e3),minutes:Math.round(i/1e3/60),hours:Math.round(i/1e3/60/60),days:Math.round(i/1e3/60/60/24),weeks:Math.round(i/1e3/60/60/24/7)});return Math.abs(t)>=7?s.format(e,"weeks"):Math.abs(n)>=24?s.format(t,"days"):Math.abs(o)>=60?s.format(n,"hours"):Math.abs(a)>=60?s.format(o,"minutes"):s.format(a,"seconds")}var i;return this.formatDate(e,t)}__resetForTests(){this._dictionary={},this._locale=tt.en,rt={}}},lt=2,dt=3,ct=4,ut={"auto-detect":{label:()=>at.get("desktop.settings.proxy.autodetect")},"no-proxy":{label:()=>at.get("desktop.settings.proxy.noproxy")},http:{label:()=>at.get("desktop.settings.proxy.http")},socks4:{label:()=>at.get("desktop.settings.proxy.socks4")},socks5:{label:()=>at.get("desktop.settings.proxy.socks5")}},pt=[{enumKey:"auto-detect",enumValue:0},{enumKey:"no-proxy",enumValue:1},{enumKey:"http",enumValue:2},{enumKey:"socks4",enumValue:3},{enumKey:"socks5",enumValue:4}],ht="sp://proxy/v1/";const gt="SETTINGS_FETCH_PROXY_SETTINGS_SUCCESS",mt="SETTINGS_FETCH_PROXY_SETTINGS_FAILURE",_t="SETTINGS_UPDATE_PROXY_SETTINGS_SUCCESS",ft="SETTINGS_UPDATE_PROXY_SETTINGS_FAILURE",bt="SETTINGS_RESTART_CLIENT_SUCCESS",St="SETTINGS_RESTART_CLIENT_FAILURE";function yt(){return e=>{(async function(){return new Promise(((e,t)=>{window.sendCosmosRequest({request:JSON.stringify({method:"GET",uri:ht}),persistent:!1,onSuccess:n=>{const s=JSON.parse(n);200!==s.status&&t(new Error(`Failed to fetch proxy settings (status code: ${s.status})`));const r=JSON.parse(s.body);e({mode:r["network.proxy.mode"],address:r["network.proxy.addr"],username:r["network.proxy.user"],password:r["network.proxy.pass"]})},onFailure:(e,n)=>{t(e)}})}))})().then((t=>{e(function(e){return{type:gt,data:e}}(t))}),(t=>{e(function(e){return{type:mt,error:e}}(t))}))}}function Et(e){return t=>{(async function(e){return new Promise(((t,n)=>{const s={"network.proxy.mode":e.mode};[lt,dt,ct].includes(e.mode)&&(s["network.proxy.addr"]=e.address,s["network.proxy.user"]=e.username),[lt,ct].includes(e.mode)&&(s["network.proxy.pass"]=e.password),window.sendCosmosRequest({request:JSON.stringify({method:"PUT",uri:ht,body:JSON.stringify(s)}),persistent:!1,onSuccess:()=>{t()},onFailure:(e,t)=>{n(e)}})}))})(e).then((()=>{t({type:_t}),t(yt())}),(e=>{t(function(e){return{type:ft,error:e}}(e))}))}}function kt(){return e=>{(async function(){return new Promise(((e,t)=>{window.sendCosmosRequest({request:JSON.stringify({method:"POST",uri:"sp://desktop/v1/restart"}),persistent:!1,onSuccess:()=>{e()},onFailure:(e,n)=>{t(e)}})}))})().then((()=>{e({type:bt})}),(t=>{e(function(e){return{type:St,error:e}}(t))}))}}const wt={...r,...s,...o,...i};var Ct=n(4637);class vt extends Ze.Component{constructor(e){super(e),this.state={hidden:this.props.delay>0}}componentDidMount(){!0===this.state.hidden&&(this.throbberTimeout=setTimeout((()=>{this.setState({hidden:!1})}),this.props.delay))}componentWillUnmount(){this.throbberTimeout&&clearTimeout(this.throbberTimeout)}render(){return this.state.hidden?null:(0,Ct.jsx)("div",{"data-testid":"glue-throbber",className:"GlueThrobber "+(this.props.initial?"throbber-initial":"throbber"),children:(0,Ct.jsx)("div",{})})}}vt.defaultProps={delay:0,initial:!0};var xt=n(5530),Tt=n.n(xt);function It(){return Tt().create().toString()}var Nt=n(7849),At=n(9475);class Pt extends Ze.PureComponent{constructor(e){super(e),this.handleLoginClick=this.handleLoginClick.bind(this),this.handleErrorClick=this.handleErrorClick.bind(this)}handleLoginClick(){const e=It();this.props.openLoginPage(e),this.props.onInteraction("login/welcome","click","open-page-login",null,e)}handleErrorClick(e){if(e.target.getAttribute("data-action")){"showSettings"===e.target.getAttribute("data-action")&&this.props.openSettingsPage()}}render(){const{errorMessage:e}=this.props;return(0,Ct.jsxs)("main",{className:"Welcome","data-testid":"welcome",children:[(0,Ct.jsxs)("h1",{className:"HeroText __welcome",children:[at.get("desktop-auth.login.millions-of-songs"),(0,Ct.jsx)("br",{}),at.get("desktop-auth.login.free-on-spotify")]}),(0,Ct.jsxs)("div",{className:"Welcome__signup-or-login",children:[e&&(0,Ct.jsxs)("div",{className:"Welcome__error-message",role:"alert",onClick:this.handleErrorClick,"aria-live":"assertive",children:[(0,Ct.jsx)(Nt.l,{className:"Welcome__error-message__icon"}),(0,Ct.jsx)("span",{dangerouslySetInnerHTML:{__html:e}})]}),(0,Ct.jsx)(At.D,{id:"login-button",onClick:this.handleLoginClick,"data-ta-id":"welcome-login-button","data-testid":"login-button",fullWidth:!0,children:at.get("desktop.login.LoginButton")})]})]})}}const Dt=(0,d.$j)((e=>({errorMessage:e.app.errorMessage})),(e=>({openLoginPage:t=>e(wt.enterLoginMode(t)),openSettingsPage:()=>e(wt.enterSettingsMode()),onInteraction:(t,n,s,r,o)=>e(wt.interaction(t,n,s,r,o))})))(Pt);var Ft=n(6162),Mt=n(4285);const Ot="https://www.spotify.com/redirect/account-page/",Lt="showSettings",jt={id:"UnknownLoginErrorMessage"},Rt={id:"DefaultErrorMessage",replace:[Lt]},Ut={127:{id:"SessionTerminatedMessage"},3:{id:"BadCredentialsMessage"},4:{id:"ErrorResolvingDNS"},53:{id:"ErrorProxyUnauthorized"},54:{id:"ErrorProxyForbidden"},55:{id:"ErrorProxyAuthRequired",replace:[Lt]},400:jt,401:jt,402:{id:"CriticalUpdate"},403:{id:"UserBannedMessage"},404:jt,405:jt,406:{id:"UserNotAllowedOnPlatformMessage"},407:{id:"MissingUserInfoMessage",replace:[Ot]},408:{id:"RegionMismatchMessage",replace:[Ot,"https://www.spotify.com/redirect/upgrade-product/"]},409:{id:"PremiumUsersOnlyMessage"},410:{id:"BadCredentialsMessage"},411:jt,412:{id:"BadCredentialsMessage"},413:{id:"CreateUserDeniedMessage"},414:jt,415:jt,416:jt,417:{id:"FacebookCredentialsMisusedMessage"},418:jt,"critical-update-error":{id:"ClientUpdateFail",replace:["https://www.spotify.com/redirect/download/"]}},Gt={1:jt,2:jt,3:{id:"BadCredentialsMessage"},4:jt,5:jt,6:jt,7:jt,8:jt,9:jt},Bt={1:{silent:!0},2:jt,3:jt,4:{id:"SessionExpiredMessage"},5:Rt};function Ht(e,t,n){if(0===t)return!1;if(!e&&!t)return!1;let s=Ut;switch(e){case"session":s=Gt;break;case"desktop_login_accounts":s=Bt}const r=s[t]||Rt;if(r.silent)return!1;const o=r.replace||[];let i="";switch(r.id){case"UnknownLoginErrorMessage":i=at.get("desktop.login.UnknownLoginErrorMessage");break;case"DefaultErrorMessage":i=at.get("desktop.login.DefaultErrorMessage",o[0]);break;case"SessionTerminatedMessage":i=at.get("desktop.login.SessionTerminatedMessage");break;case"SessionExpiredMessage":i=at.get("desktop.login.SessionExpiredMessage");break;case"BadCredentialsMessage":i=at.get("desktop.login.BadCredentialsMessage");break;case"ErrorResolvingDNS":i=at.get("desktop.login.ErrorResolvingDNS");break;case"ErrorProxyUnauthorized":i=at.get("desktop.login.ErrorProxyUnauthorized");break;case"ErrorProxyForbidden":i=at.get("desktop.login.ErrorProxyForbidden");break;case"ErrorProxyAuthRequired":i=at.get("desktop.login.ErrorProxyAuthRequired",o[0]);break;case"CriticalUpdate":i=at.get("desktop.login.CriticalUpdate");break;case"UserBannedMessage":i=at.get("desktop.login.UserBannedMessage");break;case"UserNotAllowedOnPlatformMessage":i=at.get("desktop.login.UserNotAllowedOnPlatformMessage");break;case"MissingUserInfoMessage":i=at.get("desktop.login.MissingUserInfoMessage",o[0]);break;case"RegionMismatchMessage":i=at.get("desktop.login.RegionMismatchMessage",o[0],o[1]);break;case"PremiumUsersOnlyMessage":i=at.get("desktop.login.PremiumUsersOnlyMessage");break;case"CreateUserDeniedMessage":i=at.get("desktop.login.CreateUserDeniedMessage");break;case"ClientUpdateFail":i=at.get("desktop.login.ClientUpdateFail",o[0]);break;case"FbUserNotFoundSignUp":i=at.get("desktop.login.FbUserNotFoundSignUp",o[0])}return n?`${i}<br>${at.get("desktop.login.errorCode",n)}`:i}function Wt({validity:e={}}){return e.valid?null:["valueMissing","typeMismatch","tooShort"].find((t=>e[t]))}const Vt="H5vfurs7KNEs9Io5DUA7",$t="qfBRU_bttJde7gy46oAB",Kt="ypTrzM1PtlrZp04qs6Eq",Yt="oHZmDpK0SrWDaXhPjUtC",qt="lAHowB9HYfAUrg9UaSde";var zt=n(8147);const Jt=Tt().create().toString(),Xt="has-used-app",Zt=!window.localStorage.getItem(Xt);Zt&&window.localStorage.setItem(Xt,!0);const Qt=()=>{const e=h.getItem("utmParameters");let t;try{t=e?JSON.parse(e).referral:""}catch(e){t=""}return t};class en{constructor(e){this._eventSender=e}logPageView({page:e}){this.logAction({page:e,action_type:"pageview",action_intent:""})}logAction({page:e,action_type:t,action_intent:n,item_id:s,action_hash:r},o){this._eventSender.send((0,zt.e)({action_type:t,action_intent:n,action_page:e,action_item_id:s,action_hash:r,device_is_new_install:Zt,device_locale:window.__spotify.locale,device_referrer:Qt(),ab_flags:"",session_id:Jt}),o)}}var tn=function(e){return e[e.SUCCESS=0]="SUCCESS",e[e.OPERATION_ABORTED=1]="OPERATION_ABORTED",e[e.OPERATION_TIMED_OUT=2]="OPERATION_TIMED_OUT",e[e.LOGIN_BAD_CREDENTIALS=3]="LOGIN_BAD_CREDENTIALS",e[e.LOGIN_BAD_APP_KEY=4]="LOGIN_BAD_APP_KEY",e[e.LOGIN_BAD_CLIENT_VERSION_INFO=5]="LOGIN_BAD_CLIENT_VERSION_INFO",e[e.STORAGE_INITIALIZATION_FAILED=6]="STORAGE_INITIALIZATION_FAILED",e[e.MULTIPLE_LOGIN_NOT_ALLOWED=7]="MULTIPLE_LOGIN_NOT_ALLOWED",e[e.OPERATION_CANCELLED=8]="OPERATION_CANCELLED",e[e.BAD_DEVICE_INFO=9]="BAD_DEVICE_INFO",e[e.INTERNAL_ERROR=10]="INTERNAL_ERROR",e}(tn||{});const nn=function({eventSender:e,loginOnly:t=!1}){const[n,s]=(0,Ze.useState)(""),[r,o]=(0,Ze.useState)(!1),[i,a]=(0,Ze.useState)(!1),l=(0,d.I0)(),c=function(){const e=(0,d.I0)();return()=>{e(re())}}(),u=(0,Ze.useRef)(0),h=(0,Ze.useMemo)((()=>new en(e)),[e]);(0,Ze.useEffect)((()=>{h.logPageView({page:"auth-on-web"})}),[h]);const g=async t=>{const n=++u.current,r=It();a(t),s(""),o(!0),h.logAction({page:"auth-on-web",action_type:"click",action_intent:t?"sign-up-with-browser":"log-in-with-browser",action_hash:r});try{await p({name:N,args:[{method:"login-accounts",enableSignup:t,actionHash:r}]}),h.logAction({page:"auth-on-web",action_type:"view",action_intent:t?"show-success-signup":"show-success-login"},{flush:!1}),await e.finalFlush(),location.href="spotify:app:xpui"}catch(e){const r="string"==typeof e?JSON.parse(e):e;if(n!==u.current)return void h.logAction({page:"auth-on-web",action_type:"view",action_intent:t?"sign-up-with-browser-cancelled-by-new-attempt":"log-in-with-browser-cancelled-by-new-attempt",item_id:r?.errorReference});o(!1);let i=Ht(r.errorCategory,r.errorCode,r.errorReference);"desktop_login_accounts"===r.errorCategory&&r.errorCode===tn.OPERATION_TIMED_OUT&&(i=t?at.get("desktop-auth.login.signup-time-out"):at.get("desktop-auth.login.login-time-out")),s(i||""),h.logAction({page:"auth-on-web",action_type:"view",action_intent:t?"show-error-signup":"show-error-login",item_id:r?.errorReference})}};return(0,Ct.jsx)("main",{children:r?(0,Ct.jsxs)(Ct.Fragment,{children:[(0,Ct.jsx)(Ft.D,{as:"h1",variant:"alto",semanticColor:"textBase",className:Vt,children:i?at.get("desktop-auth.login.go-to-browser-signup"):at.get("desktop-auth.login.go-to-browser-login")}),(0,Ct.jsxs)("button",{className:Kt,onClick:()=>{o(!1),h.logAction({page:"auth-on-web",action_type:"click",action_intent:"try-again"})},children:[(0,Ct.jsx)(Ft.D,{as:"span",variant:"ballad",semanticColor:"textSubdued",children:at.get("desktop-auth.login.not-seeing-browser")})," ",(0,Ct.jsx)(Ft.D,{as:"span",variant:"balladBold",semanticColor:"textBase",children:at.get("desktop-auth.login.try-again")})]})]}):(0,Ct.jsxs)(Ct.Fragment,{children:[(0,Ct.jsxs)(Ft.D,{as:"h1",variant:"alto",semanticColor:"textBase",className:Vt,children:[at.get("desktop-auth.login.millions-of-songs"),(0,Ct.jsx)("br",{}),at.get("desktop-auth.login.free-on-spotify")]}),n&&(0,Ct.jsxs)("div",{className:Yt,role:"alert",onClick:e=>{if(e.currentTarget.getAttribute("data-action")){"showSettings"===e.currentTarget.getAttribute("data-action")&&c()}},"aria-live":"assertive",children:[(0,Ct.jsx)(Nt.l,{className:qt}),(0,Ct.jsx)("span",{dangerouslySetInnerHTML:{__html:n}})]}),(0,Ct.jsx)(At.D,{onClick:()=>{g(!1)},iconTrailing:Mt.T,children:at.get("desktop-auth.login.log-in-with-browser")}),(0,Ct.jsxs)("button",{className:$t,onClick:()=>{if(t){const e=It();l(wt.enterSignupMode(e))}else g(!0)},children:[(0,Ct.jsx)(Ft.D,{as:"span",variant:"ballad",semanticColor:"textSubdued",children:at.get("desktop-auth.login.new-to-spotify")}),(0,Ct.jsx)(Ft.D,{as:"span",variant:"balladBold",semanticColor:"textBase",children:at.get("desktop-auth.login.sign-up-with-browser")}),!t&&(0,Ct.jsx)(Mt.T,{iconSize:16,semanticColor:"textBase"})]})]})})};var sn=n(8895),rn=n(2761),on=n(366),an=n(4875),ln=n.n(an);const dn=()=>(0,Ct.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,Ct.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0 8C0 3.58172 3.58172 0 8 0C12.4183 0 16 3.58172 16 8C16 12.4183 12.4183 16 8 16C3.58172 16 0 12.4183 0 8ZM7.25 3V10H8.75V3H7.25ZM7.25 11.5256V13.0256H8.75V11.5256H7.25Z",fill:"#eb6471"})});class cn extends Ze.PureComponent{render(){const{errorMessage:e}=this.props;return(0,Ct.jsxs)("div",{"aria-live":"polite",className:ln()("FieldError",{"FieldError--hidden":!e}),children:[(0,Ct.jsx)(dn,{}),(0,Ct.jsx)("span",{children:e||""})]})}}let un=0;class pn extends Ze.PureComponent{constructor(...e){super(...e),this.idNumber=++un,this.handleChange=this.handleChange.bind(this)}handleChange(e){this.props.onChange(e)}render(){const{label:e,placeholderLabel:t,name:n,type:s,isRequired:r,taId:o,id:i,defaultValue:a,value:l,minLength:d,autoFocus:c,hasError:u,isDisabled:p,isHiddenForScreenReaders:h,useCustomStyle:g,className:m,inputClassName:_,inputRef:f,onBlur:b,onFocus:S,onInput:y,onKeyDown:E,onKeyUp:k}=this.props,w=i||`GlueTextInput-${this.idNumber}`;return(0,Ct.jsx)("label",{className:g?m:"GlueTextInput",htmlFor:w,"aria-label":e,"aria-hidden":!!h||void 0,children:(0,Ct.jsx)("input",{className:g?_:ln()("GlueTextInput__input",{"GlueTextInput__input--has-error":u}),tabIndex:h?"-1":void 0,type:s,id:w,name:n,"data-ta-id":o,"aria-invalid":u,disabled:p,minLength:d,autoFocus:c,placeholder:t||e,value:a?void 0:l,defaultValue:a,onBlur:b,onFocus:S,onChange:this.handleChange,onInput:a?void 0:y,onKeyDown:E,onKeyUp:k,ref:f,required:r})})}}pn.defaultProps={name:"",type:"text",isRequired:!1,taId:"",defaultValue:void 0,value:"",minLength:0,autoFocus:!1,hasError:!1,isDisabled:!1,isHiddenForScreenReaders:!1,useCustomStyle:!1,onBlur(){},onFocus(){},onChange(){},onInput(){},onKeyDown(){}};class hn extends Ze.PureComponent{constructor(e){super(e),this.state={isEditing:!1,passwordVisible:!1},this.handleBlur=this.handleBlur.bind(this),this.handleInput=this.handleInput.bind(this)}handleBlur({target:e,relatedTarget:t}){this.setState({isEditing:!1}),t&&(t.name||"submit"===t.type)&&this.validate(e)}handleInput(){this.setState({isEditing:!0})}handleTogglePasswordVisible=()=>{const e=!this.state.passwordVisible;this.setState({passwordVisible:e}),this.props.onTogglePasswordVisibility&&this.props.onTogglePasswordVisibility(e)};validate(e){const{name:t,onValidate:n,noValidate:s}=this.props;!s&&n&&n(t,Wt(e))}renderPasswordEyeToggler(){const{type:e}=this.props,{passwordVisible:t}=this.state;return"password"!==e?null:(0,Ct.jsxs)(Ze.Fragment,{children:[(0,Ct.jsx)("button",{type:"button",onClick:this.handleTogglePasswordVisible,tabIndex:"-1",className:"FormField--passwordEyeIcon "+(t?"passwordVisible":"")}),(0,Ct.jsx)("span",{tabIndex:"-1",className:"FormField--passwordEyeIcon--cross "+(t?"passwordVisible":"")})]})}render(){const{error:e={},noValidate:t,label:n,name:s,type:r,value:o,isRequired:i,minLength:a,autoFocus:l,isDisabled:d,onChange:c,onKeyUp:u,onFocus:p,rightIcon:h=null}=this.props,{isEditing:g,passwordVisible:m}=this.state,_=h;let f=r;return"password"===r&&m&&(f="text"),(0,Ct.jsxs)("div",{className:ln()("FormField",{"FormField--no-validate":t}),children:[(0,Ct.jsx)(pn,{label:n,name:s,type:f,taId:`${s}-field`,value:o,isRequired:i,minLength:a,autoFocus:l,hasError:!!e.message&&!g,isDisabled:d,onChange:c,onFocus:p,onKeyUp:u,onBlur:this.handleBlur,onInput:this.handleInput}),_&&(0,Ct.jsx)(_,{className:"FormField--rightIcon"}),this.renderPasswordEyeToggler(),!t&&!g&&e.message&&(0,Ct.jsx)(Ct.Fragment,{children:(0,Ct.jsx)(cn,{errorMessage:e.message})})]})}}const gn=(0,d.$j)((()=>({})),(()=>({})))(hn);class mn extends Ze.PureComponent{constructor(...e){super(...e),this.handleBlur=this.handleBlur.bind(this)}handleBlur(e={}){this.props.onBlur&&this.props.onBlur(e)}render(){const{type:e="text",name:t,label:n,classes:s,hasError:r,...o}=this.props,i=`${t}-field`;return(0,Ct.jsxs)("span",{className:s,children:[(0,Ct.jsx)("label",{className:"glue-hidden-visually",htmlFor:i,children:n}),(0,Ct.jsx)("input",{...o,onBlur:this.handleBlur,type:e,name:t,id:i,"data-ta-id":i,className:ln()("form-control Input",{"Input--has-error":r}),"aria-invalid":!!r,placeholder:n,required:!0})]})}}const _n=(new Date).getFullYear()-120,fn=(e,t,n)=>{let s=null;return((e,t,n)=>[e,t,n].reduce(((e,t)=>e&&!!t),!0))(e,t,n)?((e,t,n)=>{const s=new Date(n,t-1,e);return!(s.getFullYear()<_n)&&s.getDate()===e&&s.getMonth()===t-1&&s.getFullYear()===n})(e,t,n)||(s="invalid"):s="incomplete",s},bn={BIG_ENDIAN:"big",LITTLE_ENDIAN:"little",MIDDLE_ENDIAN:"middle"};class Sn extends Ze.PureComponent{constructor(e){super(e),this.state={isEditing:!1},this.monthStrings=[at.get("desktop.login.January"),at.get("desktop.login.February"),at.get("desktop.login.March"),at.get("desktop.login.April"),at.get("desktop.login.May"),at.get("desktop.login.June"),at.get("desktop.login.July"),at.get("desktop.login.August"),at.get("desktop.login.September"),at.get("desktop.login.October"),at.get("desktop.login.November"),at.get("desktop.login.December")],this.handleInput=this.handleInput.bind(this),this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this)}handleInput({target:{name:e,value:t,validity:n={}}}){this.setState({isEditing:!0});const s=parseInt(t,10);n.valueMissing||!isFinite(t)||isNaN(s)?this.props.onChange({...this.props.value,[e]:void 0}):this.props.onChange({...this.props.value,[e]:s})}handleBlur(e){const t=e.relatedTarget?e.relatedTarget.name:null,n=["day","month","year"].includes(t);this.setState({isEditing:n}),n||this.validate()}handleFocus(e){this.setState({isEditing:!0});const t=e.relatedTarget?e.relatedTarget.name:null;!["day","month","year"].includes(t)&&this.props.onFocus&&this.props.onFocus()}validate(){const{day:e,month:t,year:n}=this.props.value,s=fn(e,t,n,this.props.minAge);this.props.onValidate("birthDate",s)}renderYear(e,t,n=undefined){return(0,Ct.jsx)(mn,{type:"number",name:"year",classes:"FormDate__input FormDate__year",label:at.get("desktop.login.Year"),autoFocus:n,defaultValue:e||"",onInput:this.handleInput,onBlur:this.handleBlur,disabled:this.props.disabled,min:_n,hasError:t.includes("year"),onFocus:this.handleFocus})}renderMonth(e,t,n=undefined){return(0,Ct.jsxs)("select",{name:"month",id:"month-field",className:ln()("form-control Input FormDate__input FormDate__month",{"Input--has-error":t.includes("month")}),autoFocus:n,defaultValue:e||"",required:!0,onChange:this.handleInput,onBlur:this.handleBlur,disabled:this.props.disabled,onFocus:this.handleFocus,children:[(0,Ct.jsx)("option",{value:"",disabled:!0,hidden:!0,children:at.get("desktop.login.Month")}),this.monthStrings.map(((e,t)=>(0,Ct.jsx)("option",{value:t+1,children:e},t)))]})}renderDay(e,t,n=undefined){return(0,Ct.jsx)(mn,{type:"number",name:"day",classes:"FormDate__input FormDate__day",label:at.get("desktop.login.Day"),autoFocus:n,defaultValue:e||"",onInput:this.handleInput,onBlur:this.handleBlur,disabled:this.props.disabled,min:1,max:31,hasError:t.includes("day"),onFocus:this.handleFocus})}render(){const{name:e,label:t,dateEndianness:n,error:s={},autoFocus:r}=this.props,{day:o,month:i,year:a}=this.props.value,{isEditing:l}=this.state,d=["day","month","year"].filter((e=>!(l||!s.message)&&("incomplete"===s.code?!this.props.value[e]:"tooOld"!==s.code||"year"===e)));let c="";return c="big"===bn[n]?(0,Ct.jsxs)("div",{className:"FormDate__inputs",children:[this.renderYear(a,d,r),this.renderMonth(i,d),this.renderDay(o,d)]}):"little"===bn[n]?(0,Ct.jsxs)("div",{className:"FormDate__inputs",children:[this.renderDay(o,d,r),this.renderMonth(i,d),this.renderYear(a,d)]}):(0,Ct.jsxs)("div",{className:"FormDate__inputs",children:[this.renderMonth(i,d,r),this.renderDay(o,d),this.renderYear(a,d)]}),(0,Ct.jsxs)("div",{className:"FormDate",children:[(0,Ct.jsx)("label",{className:`FormDate__label ${e}-label`,htmlFor:"month-field",children:t}),c,!l&&s.message&&(0,Ct.jsx)(Ct.Fragment,{children:(0,Ct.jsx)(cn,{errorMessage:s.message})})]})}}Sn.defaultProps={value:{},dateEndianness:"MIDDLE_ENDIAN",minAge:13};const yn=(0,d.$j)((()=>({})),(()=>({})))(Sn);class En extends Ze.PureComponent{constructor(e){super(e),this.state={isEditing:!1},this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this)}handleBlur(e){this.state={isEditing:!1};(e.relatedTarget?e.relatedTarget.name:null)!==this.props.name&&this.validate(e.target)}handleFocus(e){this.state={isEditing:!0},this.props.onOptionFocus&&e&&e.target&&this.props.onOptionFocus(e.target.value)}validate(e){const{name:t,onValidate:n}=this.props;n&&n(t,Wt(e))}render(){const{name:e,label:t,options:n,value:s,showTitle:r,error:o={},onValidate:i,onOptionFocus:a,...l}=this.props,{isEditing:d}=this.state,c=`${e}-field`,u=ln()("FormRadioSelect",{"FormRadioSelect--is-disabled":this.props.disabled});return(0,Ct.jsxs)("div",{className:u,children:[(0,Ct.jsx)("label",{className:r?"":"glue-hidden-visually",htmlFor:c,children:t}),n.map((t=>{const n=`${t.value}-radio`;return(0,Ct.jsxs)("span",{className:s===t.value?"checked":"",children:[(0,Ct.jsx)("input",{...l,name:e,type:"radio",id:n,className:"glue-hidden-visually",value:t.value,checked:s===t.value,onBlur:this.handleBlur,onFocus:this.handleFocus,required:!0,disabled:this.props.disabled}),(0,Ct.jsx)("label",{className:ln()("FormRadioSelect__label",{"FormRadioSelect__label--has-error":!!o.message}),htmlFor:n,children:t.label})]},t.value)})),!d&&o.message&&(0,Ct.jsx)(Ct.Fragment,{children:(0,Ct.jsx)(cn,{errorMessage:o.message})})]})}}const kn=(0,d.$j)((()=>({})),(()=>({})))(En);class wn extends Ze.PureComponent{constructor(...e){super(...e),this.handleChange=this.handleChange.bind(this)}handleChange(e){this.props.isDisabled||this.props.onChange(e.target.checked)}render(){const e=`${this.props.name}-field`,t=ln()("GlueCheckbox",{"GlueCheckbox--is-disabled":this.props.isDisabled});return(0,Ct.jsxs)("div",{className:t,children:[(0,Ct.jsx)("input",{className:"GlueCheckbox__input",id:e,name:this.props.name,checked:this.props.isChecked,type:"checkbox",onChange:this.handleChange,disabled:this.props.isDisabled}),(0,Ct.jsx)("label",{className:"GlueCheckbox__label",htmlFor:e,dangerouslySetInnerHTML:{__html:this.props.label}})]})}}wn.defaultProps={label:"",name:"",isChecked:!1,isDisabled:!1,onChange(){}};class Cn extends Ze.Component{constructor(e){super(e),this.handleClick=this.handleClick.bind(this)}handleClick(e){if(e.target.getAttribute("data-action")){"showSettings"===e.target.getAttribute("data-action")&&this.props.openSettingsPage()}}render(){const e=this.props.errorData,t=e?Ht(e.errorCategory,e.errorCode,e.errorReference):null;return t?(0,Ct.jsxs)("div",{className:"alert alert-danger ErrorMessage alert-icon",id:"login-message","data-ta-id":"login-message","data-testid":"login-message",role:"alert","aria-live":"assertive",onClick:this.handleClick,children:[(0,Ct.jsx)(Nt.l,{iconSize:24}),(0,Ct.jsx)("span",{dangerouslySetInnerHTML:{__html:t}})]}):null}}const vn=(0,d.$j)((e=>{let{mode:t}=e.app;return"welcome"===t&&(t="signup"),{errorData:e[t]&&e[t].errorData?e[t].errorData:null}}),(e=>({openSettingsPage:()=>e(wt.enterSettingsMode()),openSignupPage:()=>e(wt.openSignupPage())})))(Cn);class xn extends Ze.PureComponent{static getNextId(){const e=(xn.instanceCount||0)+1;return xn.instanceCount=e,e}constructor(e){super(e),this.state={tosAgreed:!1,privacyAgreed:!1},this.handleTosChange=this.handleTosChange.bind(this),this.handlePrivacyChange=this.handlePrivacyChange.bind(this),this.handleTosAndPrivacyChange=this.handleTosAndPrivacyChange.bind(this),this.handleEulaChange=this.handleEulaChange.bind(this),this.eulaId=xn.getNextId()}handleTosChange(e){this.setState({tosAgreed:e},(()=>{this.handleEulaChange()}))}handlePrivacyChange(e){this.setState({privacyAgreed:e},(()=>{this.handleEulaChange()}))}handleTosAndPrivacyChange(e){this.setState({tosAgreed:e,privacyAgreed:e},(()=>{this.handleEulaChange()}))}handleEulaChange(){this.props.onChange(this.state.tosAgreed&&this.state.privacyAgreed)}render(){let e=null;const t=`<a href="https://www.spotify.com/int/legal/end-user-agreement/" target="_new">${at.get("desktop.login.TermsAndConditions")}</a>`,n=`<a href="https://www.spotify.com/int/legal/privacy-policy/" target="_new">${at.get("desktop.login.PrivacyPolicy")}</a>`,s=at.get("desktop.login.SignupButton");return e=this.props.restrictions.pretick_eula?(0,Ct.jsxs)("div",{children:[!this.props.hideTermsAndConditions&&(0,Ct.jsx)("p",{className:"SignupForm__terms-and-conditions",dangerouslySetInnerHTML:{__html:at.get("desktop.login.SignupAgree",s,t)}}),!this.props.hidePrivacyPolicy&&(0,Ct.jsx)("p",{className:"SignupForm__privacy-policy",dangerouslySetInnerHTML:{__html:at.get("desktop.login.PrivacyPolicyAgree",n)}})]}):this.props.restrictions.can_accept_licenses_in_one_step?(0,Ct.jsxs)("div",{className:"SignupForm__checkbox-container",children:[(0,Ct.jsx)(wn,{"data-ta-id":"agree-eula",name:`agree-eula-${this.eulaId}`,label:this.props.restrictions.specific_licenses?at.get("desktop.login.SignupAgreeCheckboxSpecificLicenses",t,n):at.get("desktop.login.SignupAgreeCheckbox",t,n),onChange:this.handleTosAndPrivacyChange,isChecked:this.state.tosAgreed&&this.state.privacyAgreed,isDisabled:this.props.disabled}),this.props.restrictions.specific_licenses&&(0,Ct.jsx)("p",{className:"SignupForm__privacy-policy",dangerouslySetInnerHTML:{__html:at.get("desktop.login.PrivacyPolicyAgree",n)}})]}):(0,Ct.jsxs)("div",{children:[(0,Ct.jsx)("div",{className:"SignupForm__checkbox-container",children:(0,Ct.jsx)(wn,{"data-ta-id":"agree-tos",name:`agree-tos-${this.eulaId}`,label:at.get("desktop.login.TermsOfServiceAgreeCheckbox",t),onChange:this.handleTosChange,isChecked:this.state.tosAgreed,isDisabled:this.props.disabled})}),(0,Ct.jsx)("div",{className:"SignupForm__checkbox-container",children:(0,Ct.jsx)(wn,{"data-ta-id":"agree-privacy",name:`agree-privacy-${this.eulaId}`,label:at.get("desktop.login.PrivacyPolicyAgreeCheckbox",n),onChange:this.handlePrivacyChange,isChecked:this.state.privacyAgreed,isDisabled:this.props.disabled})})]}),(0,Ct.jsxs)("div",{className:"EulaAgreement",children:[e,this.props.error&&(0,Ct.jsx)(Ct.Fragment,{children:(0,Ct.jsx)(cn,{errorMessage:this.props.error.message})})]})}}const Tn=(0,d.$j)((()=>({})),(()=>({})))(xn);class In extends Ze.PureComponent{handleClick=e=>{const{method:t}=this.props;e&&(e.preventDefault(),e.stopPropagation()),this.props.onClick(t)};render(){const{type:e,label:t,isDisabled:n,method:s}=this.props,r=s.substr(0,1).toUpperCase()+s.substr(1),o=ln()("button","SocialButton",`${r}Button`,{[`${r}Button--login`]:"login"===e,[`${r}Button--signup`]:"signup"===e});return(0,Ct.jsx)("button",{type:"button",className:o,onClick:this.handleClick,"data-ta-id":`${s}-${e}-button`,disabled:n,children:t})}}class Nn extends Ze.PureComponent{static defaultProps={isDisabled:!1,hideEula:!1};constructor(e){super(e),this.state={eulaAgreed:this.props.restrictions.pretick_eula,error:{}}}handleAgreeEulaChange=e=>{const t=e?"checked":"unchecked";this.props.onInteraction("signup","click",`eula-change-${t}`,null,this.props.actionHash),this.setState({eulaAgreed:e,error:e?{}:this.state.error})};handleOnClick=(...e)=>{(()=>this.state.eulaAgreed||this.props.restrictions.pretick_eula||this.props.hideEula)()?this.props.onClick(...e):this.setState({error:{message:at.get("desktop.login.agreeEula.notAccepted")}})};render(){return(0,Ct.jsxs)("div",{className:"SignupFacebook",children:[(0,Ct.jsx)(In,{method:"facebook",isDisabled:this.props.isDisabled,onClick:e=>this.handleOnClick(e,this.props.actionHash),type:"signup",label:at.get("desktop.login.SignupButtonFacebookNirvana")}),this.props.restrictions.pretick_eula||this.props.hideEula?null:(0,Ct.jsx)(Tn,{restrictions:this.props.restrictions,error:this.state.error,disabled:this.props.isDisabled,onChange:this.handleAgreeEulaChange})]})}}const An=(0,d.$j)((e=>({isDisabled:!!e.signup.isAttempting,restrictions:e.signup.restrictions,actionHash:e.app.currentActionHash??It()})),(e=>({onInteraction:(t,n,s,r,o)=>e(wt.interaction(t,n,s,r,o)),onClick:(t,n)=>{e(wt.signupWithAccounts(t,n)),e(wt.interaction("signup","click",`create-account-${t}`,null,n))}})),((e,t)=>({...e,...t,onClick:(e,n)=>{t.onClick(e,n)}})))(Nn),Pn=({title:e})=>(0,Ct.jsx)("p",{className:"FormTitleSeparator","aria-hidden":"true",children:e});Pn.defaultProps={title:""};const Dn=Pn;class Fn extends Ze.PureComponent{static defaultProps={errors:{},data:{},step:0};constructor(e){super(e),this.state={isEditing:!0}}handleEmailValidate=(e,t)=>{this.props.onValidate(e,t),t||this.props.validateEmail()};handleEmailFocus=()=>{this.props.onInteraction("signup","click","input-email",null,this.props.actionHash)};handlePasswordValidate=(e,t)=>{this.props.onValidate(e,t),t||this.props.validatePassword()};handlePasswordFocus=()=>{this.props.onInteraction("signup","click","input-password",null,this.props.actionHash)};handleNameFocus=()=>{this.props.onInteraction("signup","click","input-name",null,this.props.actionHash)};handleGenderOptionFocus=e=>{this.props.onInteraction("signup","click",`input-gender-${e}`,null,this.props.actionHash)};handleInputChange=({target:{name:e,value:t}})=>{this.props.updateData({[e]:t}),this.setState({isEditing:!0})};handleBirthDateChange=e=>{this.props.updateData({birthDate:e})};handleSendEmailChange=e=>{this.props.updateData({sendEmail:e})};handleShareDataChange=e=>{this.props.updateData({shareData:e})};handleAgreeEulaChange=e=>{this.props.updateData({agreeEula:e})};handleSubmit=e=>{e&&e.preventDefault();const{step:t,actionHash:n}=this.props;this.props.onInteraction("signup","click",0===t?"continue":"create-account",null,n),this.setState({isEditing:!1});let s=!0;const r={0:["email","password","name"],1:["birthDate","gender","agreeEula"]};!!this.props.errors&&Object.keys(this.props.errors).filter((e=>-1!==r[t].indexOf(e))).some((e=>this.props.errors[e]&&this.props.errors[e].message))&&(s=!1);const o=e=>t=>{this.props.data[t]||(this.props.onValidate(t,{code:e}),s=!1)};switch(t){case 0:["email","password","name"].forEach(o("valueMissing"));break;case 1:{const{day:e,month:t,year:r}=this.props.data.birthDate;r||this.props.onInteraction("signup","view","show-error-empty-year",null,n),t||this.props.onInteraction("signup","view","show-error-empty-month",null,n),e||this.props.onInteraction("signup","view","show-error-empty-date",null,n);const i=fn(e,t,r,this.props.restrictions.minimum_age);i&&(this.props.onValidate("birthDate",{code:i}),s=!1),o("valueMissing")("gender"),o("notAccepted")("agreeEula")}}if(s)switch(t){case 0:this.setStep(t+1);break;case 1:this.props.signup(n)}};handleBack=()=>{const{step:e}=this.props;this.props.onInteraction("signup","click",`back-step-${e+1}`,null,this.props.actionHash),this.props.clearAllErrors(),e<=0?this.props.enterWelcomeMode():this.setStep(e-1)};handleLogin=()=>{const e=It();this.props.onInteraction("signup","click","open-page-login",null,e),this.props.enterLoginMode(e)};setStep=e=>{switch(e){case 0:this.props.enterSignupModeStep0();break;case 1:this.props.enterSignupModeStep1()}};renderErrorMsg(){const e=Object.keys(this.props.errors).filter((e=>this.props.errors[e]&&this.props.errors[e].message));return(0,Ct.jsx)("div",{className:"glue-hidden-visually",role:"alert","aria-live":this.state.isEditing?"off":"assertive",children:e.length>0?(0,Ct.jsxs)("div",{children:[(0,Ct.jsx)("p",{children:at.get("desktop.login.email.errorMessageA11y",e.length)}),(0,Ct.jsx)("ul",{children:e.map((e=>(0,Ct.jsx)("li",{children:this.props.errors[e].message},e)))})]}):null})}renderStep0(){const{data:e,errors:t,isDisabled:n,onValidate:s}=this.props;return(0,Ct.jsxs)("div",{children:[(0,Ct.jsx)(gn,{name:"email",type:"email",label:at.get("desktop.login.SignupEmail"),value:e.email,onChange:this.handleInputChange,isDisabled:n,error:t.email,onValidate:this.handleEmailValidate,onFocus:this.handleEmailFocus,isRequired:!0,autoFocus:!0,rightIcon:sn.B}),(0,Ct.jsx)(gn,{name:"password",type:"password",label:at.get("desktop.login.CreateAPassword"),value:e.password,onChange:this.handleInputChange,minLength:8,isRequired:!0,isDisabled:n,error:t.password,onValidate:this.handlePasswordValidate,onFocus:this.handlePasswordFocus,onTogglePasswordVisibility:e=>{this.props.onInteraction("signup","click",e?"toggle-password-visibility-show":"toggle-password-visibility-hide",null,this.props.actionHash)}}),(0,Ct.jsx)(gn,{name:"name",label:at.get("desktop.login.SignupName"),value:e.name,onChange:this.handleInputChange,isRequired:!0,isDisabled:n,error:t.name,onValidate:s,rightIcon:rn.W,onFocus:this.handleNameFocus})]})}renderStep1(){const{data:e,errors:t,restrictions:n,isDisabled:s,onValidate:r}=this.props;let o=null;n.requires_marketing_opt_in_text?o=(0,Ct.jsx)("div",{className:"SignupForm__send-email-implicit",children:at.get("desktop.login.SendEmailImplicitLabel")}):n.requires_marketing_opt_in&&(o=(0,Ct.jsx)("div",{className:"SignupForm__checkbox-container",children:(0,Ct.jsx)(wn,{name:"send-email",label:at.get("desktop.login.SendEmailLabel"),onChange:this.handleSendEmailChange,isChecked:e.sendEmail,isDisabled:s})}));const i=[{label:at.get("desktop.login.Female"),value:"female"},{label:at.get("desktop.login.Male"),value:"male"}];return n.use_all_genders&&i.push({label:at.get("desktop.login.NonBinary"),value:"neutral"}),n.use_other_gender&&i.push({label:at.get("desktop.login.gender.Other"),value:"other"}),n.use_prefer_not_to_say_gender&&i.push({label:at.get("desktop.login.gender.PreferNotToSay"),value:"prefer_not_to_say"}),(0,Ct.jsxs)("div",{children:[(0,Ct.jsx)(yn,{name:"birth-date",label:at.get("desktop.login.WhatsYourSignupBirthDate"),value:e.birthDate,onChange:this.handleBirthDateChange,disabled:s,error:t.birthDate,onValidate:r,dateEndianness:n.date_endianness,minAge:n.minimum_age,autoFocus:!0,onFocus:()=>{this.props.onInteraction("signup","click","input-birth-date",null,this.props.actionHash)}}),(0,Ct.jsx)(kn,{showTitle:!0,name:"gender",label:at.get("desktop.login.WhatsYourSignupGender"),options:i,value:e.gender,onChange:this.handleInputChange,disabled:s,error:t.gender,onValidate:r,onOptionFocus:this.handleGenderOptionFocus}),o,(0,Ct.jsx)(Tn,{restrictions:n,error:t.agreeEula,disabled:s,onChange:this.handleAgreeEulaChange})]})}render(){const{isDisabled:e,step:t}=this.props;return(0,Ct.jsxs)("form",{onSubmit:this.handleSubmit,className:"SignupForm",children:[this.renderErrorMsg(),(0,Ct.jsx)(vn,{}),0===t?this.renderStep0():"",1===t?this.renderStep1():"",(0,Ct.jsx)(At.D,{type:"submit",disabled:e,id:"signup-button",onClick:this.handleSubmit,"data-ta-id":"signup-submit",fullWidth:!0,children:0===t?at.get("desktop.login.Continue"):at.get("desktop.login.SignupButton")}),0===t&&(0,Ct.jsxs)(Ze.Fragment,{children:[(0,Ct.jsx)(Dn,{title:at.get("desktop.login.SignupOr")}),(0,Ct.jsx)(An,{})]}),(0,Ct.jsx)(on.o,{onClick:this.handleBack,children:at.get("desktop.login.Back")}),0===t&&(0,Ct.jsx)("h3",{className:"FooterFormText",children:(0,Ct.jsx)("a",{className:"FooterFormText__NoUnderline",href:"#",id:"login-link",onClick:this.handleLogin,dangerouslySetInnerHTML:{__html:at.get("desktop.login.AlreadyOnSpotifyLogin")}})})]})}}const Mn=(0,d.$j)((e=>({isDisabled:!!e.signup.isAttempting,restrictions:e.signup.restrictions,email:e.signup.email,errors:e.signup.errors,data:e.signup.formData,actionHash:e.app.currentActionHash??It()})),(e=>({signup:t=>e(wt.signup(t)),enterLoginMode:t=>e(wt.enterLoginMode(t)),enterSignupModeStep0:()=>e(wt.enterSignupModeStep0()),enterSignupModeStep1:()=>e(wt.enterSignupModeStep1()),updateData:t=>e(wt.updateSignupData(t)),validateEmail:()=>e(wt.validateField("email")),validatePassword:()=>e(wt.validateField("password")),enterWelcomeMode:()=>e(wt.enterWelcomeMode()),clearAllErrors:()=>e(wt.clearAllErrors()),onValidate:(t,n)=>{if(n){const s=n.code||n,r={birthDate:{incomplete:at.get("desktop.login.birthDate.incomplete"),invalid:at.get("desktop.login.birthDate.invalid")},password:{valueMissing:at.get("desktop.login.password.valueMissing"),tooShort:at.get("desktop.login.password.tooShort")},email:{valueMissing:at.get("desktop.login.email.valueMissing"),typeMismatch:at.get("desktop.login.email.typeMismatch")},name:{valueMissing:at.get("desktop.login.name.valueMissing")},gender:{valueMissing:at.get("desktop.login.gender.valueMissing")},agreeEula:{notAccepted:at.get("desktop.login.agreeEula.notAccepted")}};e(wt.validateFieldFailure(t,{code:s,message:r[t]&&r[t][s]||""}))}else e(wt.validateFieldSuccess(t))},onInteraction:(t,n,s,r,o)=>e(wt.interaction(t,n,s,r,o))})))(Fn);class On extends Ze.PureComponent{render(){const{step:e,restrictions:t}=this.props;if(!t)return(0,Ct.jsx)(vt,{delay:2e3});const n=0===e?at.get("desktop.login.SignupHeroText"):at.get("desktop.login.SignupAlmostDone");return(0,Ct.jsxs)("main",{className:"Signup","data-testid":"signup","aria-labelledby":"signup-form-title",id:"signup","data-ta-id":"signup-form",children:[(0,Ct.jsx)("h1",{className:"HeroText",id:"signup-form-title",children:n}),(0,Ct.jsx)(Mn,{step:e})]})}}const Ln=(0,d.$j)((e=>({isDisabled:!!e.signup.isAttempting,restrictions:e.signup.restrictions})))(On);class jn extends Ze.PureComponent{constructor(...e){super(...e),this.handleChange=this.handleChange.bind(this)}handleChange(){this.props.isDisabled||this.props.onChange(!this.props.isActive)}render(){const{isActive:e,isDisabled:t,labelId:n,taId:s}=this.props;return(0,Ct.jsxs)("div",{className:ln()("GlueToggle",{"GlueToggle--is-active":e,"GlueToggle--is-disabled":t}),children:[(0,Ct.jsx)("input",{type:"checkbox",name:n,id:n,className:"glue-hidden-visually",onChange:this.handleChange,checked:e,disabled:t,"data-ta-id":s}),(0,Ct.jsx)("div",{className:"GlueToggle__toggle",onClick:this.handleChange,"aria-hidden":"true",children:(0,Ct.jsx)("div",{className:"GlueToggle__toggle-inner"})})]})}}jn.defaultProps={isActive:!1,isDisabled:!1,onChange:()=>{}};class Rn extends Ze.PureComponent{render(){const{name:e,label:t,checked:n,disabled:s,onChange:r}=this.props,o=`${e}-field`;return(0,Ct.jsxs)("div",{className:"FormToggle",children:[(0,Ct.jsx)("label",{htmlFor:o,"data-ta-id":"remember-me-label",children:t}),(0,Ct.jsx)(jn,{labelId:o,isActive:n,onChange:r,taId:"remember-me-slider",isDisabled:s})]})}}class Un extends Ze.PureComponent{constructor(e){super(e),this.state={username:this.props.username,password:"",rememberMe:!0},["handleSubmit","handleUsernameChange","handleUsernameFocus","handlePasswordChange","handlePasswordFocus","handleRememberMeChange"].forEach((e=>{this[e]=this[e].bind(this)}))}handleUsernameChange({target:e}){this.setState({username:e.value})}handleUsernameFocus(){this.props.onInteraction("login","click","input-email",null,this.props.actionHash)}handlePasswordChange({target:e}){this.setState({password:e.value})}handlePasswordFocus(){this.props.onInteraction("login","click","input-password",null,this.props.actionHash)}handleRememberMeChange(){this.setState({rememberMe:!this.state.rememberMe})}handleSubmit(e){e&&e.preventDefault();const t=this.state.username?this.state.username.trim():null,{password:n,rememberMe:s}=this.state,{actionHash:r}=this.props;this.props.onInteraction("login","click","login-email",null,r),t&&n?this.props.login({username:t,password:n,rememberMe:s},!1,r):t?n||this.props.onInteraction("login","view","show-error-empty-password",null,r):this.props.onInteraction("login","view","show-error-empty-email",null,r)}handleForgotPasswordLinkClick=()=>{this.props.onInteraction("login","click","reset-password",null,this.props.actionHash)};render(){const{isDisabled:e}=this.props;return(0,Ct.jsxs)("form",{onSubmit:this.handleSubmit,children:[(0,Ct.jsx)("h3",{className:"glue-hidden-visually",children:at.get("desktop.login.LoginWithEmailTitle")}),(0,Ct.jsx)(vn,{}),(0,Ct.jsx)(gn,{name:"username",label:at.get("desktop.login.LoginUsernameOrEmail"),value:this.state.username||"",onChange:this.handleUsernameChange,onFocus:this.handleUsernameFocus,isDisabled:e,autoFocus:!0,noValidate:!0,rightIcon:sn.B}),(0,Ct.jsx)(gn,{name:"password",type:"password",label:at.get("desktop.login.LoginPassword"),value:this.state.password,onChange:this.handlePasswordChange,onFocus:this.handlePasswordFocus,isDisabled:e,noValidate:!0}),(0,Ct.jsx)("a",{className:"LoginForm__reset-password",href:"https://www.spotify.com/redirect/password-reset",target:"_new",onClick:this.handleForgotPasswordLinkClick,children:at.get("desktop.login.forgotPassLink")}),(0,Ct.jsx)(Rn,{name:"remember-me",label:at.get("desktop.login.RememberMeLabel"),checked:this.state.rememberMe,onChange:this.handleRememberMeChange,disabled:e}),(0,Ct.jsx)("button",{type:"submit",className:"button button-white LoginForm__login-button",disabled:e,id:"login-button","data-ta-id":"login-button",children:at.get("desktop.login.LoginButton")})]})}}const Gn=(0,d.$j)((e=>({isDisabled:!!e.login.loginInProgress,username:e.login.username,actionHash:e.app.currentActionHash??It()})),(e=>({login:(t,n,s)=>e(wt.login(t,n,s)),onInteraction:(t,n,s,r,o)=>e(wt.interaction(t,n,s,r,o))})))(Un);class Bn extends Ze.PureComponent{componentWillUnmount(){this.props.clearErrors()}handleSignup(){const e=It();this.props.enterSignupMode(e),this.props.onInteraction("login","click","open-page-signup",null,e)}getSignupLink(){return(0,Ct.jsx)("a",{className:"FooterFormText__NoUnderline",href:"#",id:"signup-link",onClick:()=>this.handleSignup(),"data-ta-id":"signup-link",dangerouslySetInnerHTML:{__html:at.get("desktop.login.DontHaveAnAccountSignup")}})}render(){const{isDisabled:e,actionHash:t}=this.props;return(0,Ct.jsxs)("main",{className:"Login","data-testid":"login","aria-labelledby":"login-form-title",id:"login","data-ta-id":"login-form",children:[(0,Ct.jsx)("h1",{className:"HeroText",id:"login-form-title",children:at.get("desktop.login.LoginHeroText")}),(0,Ct.jsx)(Gn,{}),(0,Ct.jsx)(Dn,{title:at.get("desktop.login.SignupOr")}),(0,Ct.jsx)(In,{method:"facebook",isDisabled:e,onClick:e=>this.props.onSocialButtonClick(e,t),type:"login",label:at.get("desktop.login.ContinueWithFacebook")}),(0,Ct.jsx)(In,{method:"google",isDisabled:e,onClick:e=>this.props.onSocialButtonClick(e,t),type:"login",label:at.get("desktop.login.ContinueWithGoogle")}),(0,Ct.jsx)(In,{method:"apple",isDisabled:e,onClick:e=>this.props.onSocialButtonClick(e,t),type:"login",label:at.get("desktop.login.ContinueWithApple")}),(0,Ct.jsx)("h3",{className:"FooterFormText",children:this.getSignupLink()})]})}}const Hn=(0,d.$j)((e=>({isDisabled:!!e.login.loginInProgress,actionHash:e.app.currentActionHash??It()})),(e=>({enterSignupMode:t=>e(wt.enterSignupMode(t)),onInteraction:(t,n,s,r,o)=>e(wt.interaction(t,n,s,r,o)),onSocialButtonClick:(t,n)=>{e(wt.loginWithAccounts(t,n)),e(wt.interaction("login","click",`login-${t}`,null,n))},clearErrors:()=>e(wt.loginClearErrors())})),((e,t)=>({...e,...t,onSocialButtonClick:(e,n)=>{t.onSocialButtonClick(e,n)}})))(Bn);class Wn extends Ze.PureComponent{render(){const{operationUsed:e}=this.props,t="signup"===e?at.get("desktop-auth.login.redirecting-to-browser-signup"):at.get("desktop-auth.login.redirecting-to-browser-login");return(0,Ct.jsx)("main",{children:(0,Ct.jsx)("h1",{className:"HeroText __redirect",children:t})})}}const Vn=(0,d.$j)((e=>({operationUsed:e.experimentWebAuthReducer.operationUsed})))(Wn);var $n=n(7447);const Kn="mpdBa62OP4Fr5wvCsa89",Yn="acVhMt5pELcXQyLaaPuV",qn="AavUTirpKSAHapguSAy0",zn="SkbGMKYv49KtJNB5XxdX",Jn="qfjicQPaTTPrLWJWRxMQ",Xn=({id:e,type:t,placeHolder:n,inputRef:s,handleOnChange:r})=>(0,Ct.jsx)("input",{type:t||"text",id:e,"data-testid":e,className:zn,placeholder:n,ref:s,onChange:r}),Zn=({children:e,label:t})=>(0,Ct.jsx)($n.c,{label:t,className:Jn,children:e});var Qn=n(2842),es=n.n(Qn);const ts="zrvvPyoxE6wQNqnu0yWA",ns="jmu6DFPvhxRl0wSfmv2O",ss=({value:e,id:t,children:n,disabled:s,onSelect:r,className:o,dir:i})=>(0,Ct.jsx)("span",{className:o,children:(0,Ct.jsx)("select",{className:ln()(ts,{[ns]:"Safari"===es().parse(window.navigator.userAgent).browser.name}),value:e?.toString(),id:t,disabled:s,onBlur:()=>{},onChange:e=>{r(e.target.value)},dir:i,children:n})}),rs=(0,Ze.createContext)(void 0),os=({children:e})=>{const[t,n]=(0,Ze.useState)(!1),[s,r]=(0,Ze.useState)(new Set),o=(0,Ze.useCallback)(((e,t)=>{r((n=>{if(n.has(e)===t)return n;const s=new Set(n);return t?s.add(e):s.delete(e),s}))}),[]),i=s.size>0;return(0,Ct.jsx)(rs.Provider,{value:{sectionMatch:t,setSectionMatch:n,sectionContainsMatch:i,setSectionFilterMatchQueryValue:o},children:e})},is=()=>{const e=(0,Ze.useContext)(rs);if(void 0===e)throw new Error("useSectionMatchState() must be used within a SectionFilterMatchContextProvider");return e};(0,n(2226).Ue)((e=>({lastFilterState:"",lastFilteredUri:"",setLastState:(t,n)=>{e({lastFilterState:t,lastFilteredUri:n})}})));const as=(0,Ze.createContext)({setFilter:()=>{throw new Error("setFilter must be used within a FilterProvider")},filter:""});n(3016);const ls=new Intl.Collator(void 0,{sensitivity:"base",usage:"search"}),ds=/\p{White_Space}/u,cs=/\p{P}/u,us=/\p{sc=Han}/u;function ps(e){return null!==e&&ds.test(e)}function hs(e){return null!==e&&(e<="/"||e>=":"&&e<="@"||"\\"===e||ps(e))}function gs(e){return null!==e&&cs.test(e)}function ms(e){return null!==e&&us.test(e)}class _s{constructor(e,t,n){if(t<0||n<0||t+n>e.length)throw new RangeError;this.data=e,this.offset=t,this.length=n,this.position=0}static from(e){const t=Array.from(e.normalize("NFC"));return new _s(t,0,t.length)}toString(){return this.data.slice(this.offset,this.offset+this.length).join("")}slice(e=0,t=this.length){if(e<0||t>this.length)throw new RangeError;const n=this.offset+e,s=t-e;return new _s(this.data,n,s)}nextCodePoint(){return this.position===this.length?null:this.data[this.offset+this.position++]}}function fs(e){let t;do{t=e.nextCodePoint()}while(null!==t&&ps(t)||gs(t));return t}function bs(e,t){let n=fs(e),s=fs(t);if(null===s)return{offset:0,length:0};const r=e.offset+e.position-1;let o=e.offset+e.position;for(;;){if(null===n&&null===s)return{offset:r,length:o-r};if(null===s)return{offset:r,length:o-r};if(null===n)return null;if(0!==ls.compare(n,s))return null;o=e.offset+e.position,n=fs(e),s=fs(t)}}function Ss(e,t){let n,s,r;do{s=e.position,n=e.nextCodePoint()}while(null!==n&&ps(n));if(t?.segmentQuotedStrings&&function(e){return null!==e&&('"'===e||"'"===e)}(n)){const t=n;s=e.position;do{r=e.position,n=e.nextCodePoint()}while(null!==n&&n!==t);return null===n&&s===r?null:e.slice(s,r)}do{if(r=e.position,t?.segmentCJKUnifieIdeographs&&ms(n))break;n=e.nextCodePoint()}while(null!==n&&!hs(n));return null===n&&s===r?null:e.slice(s,r)}function ys(e){return Ss(e,{segmentQuotedStrings:!0,segmentCJKUnifieIdeographs:!1})}function Es(e){return Ss(e,{segmentQuotedStrings:!1,segmentCJKUnifieIdeographs:!0})}function ks(e,t){const n=[];for(let s=Es(e);null!==s;s=Es(e)){let r=bs(s,t.slice());null===r?(r=bs(e.slice(s.offset),t.slice()),null===r||n.push(r)):n.push(r)}return n}function ws(e,t){return e.offset===t.offset&&e.length===t.length}const Cs=(e,t)=>"string"==typeof e&&"string"==typeof t?!(e.length>0)||null!==function(e,...t){const n=_s.from(e),s=[];for(let e=ys(n);null!==e;e=ys(n)){const n=[];for(let s=0;s<t.length;++s){const r=t[s],o=ks(_s.from(r),e);for(const e of o)n.push({text:r,range:e})}if(0===n.length)return null;s.push(...n.filter(((e,t,n)=>e.range.length>0&&n.findIndex((t=>ws(e.range,t.range)))===t)))}return s.length>0?s:null}(e,t):"boolean"!=typeof e||e,vs={section:"c6TyNYOUJRIsjYZJZofy"};function xs({children:e,filterMatchQuery:t}){const{filter:n}=(0,Ze.useContext)(as),{setSectionMatch:s,sectionContainsMatch:r}=is(),o=Cs(n,t);return(0,Ze.useEffect)((()=>{s(o)}),[o,s]),o||r?(0,Ct.jsx)("div",{className:vs.section,children:e}):null}function Ts(e){return(0,Ct.jsx)(os,{children:(0,Ct.jsx)(xs,{...e})})}var Is=n(9237),Ns=n.n(Is);const As={highlightedText:"M0E2Al6URHV3iyoDbvi_"};function Ps({searchWords:e,textToHighlight:t,...n}){return 0===e.length||e.every((e=>!e))?(0,Ct.jsx)(Ct.Fragment,{children:t}):(0,Ct.jsx)(Ns(),{highlightClassName:As.highlightedText,searchWords:e,textToHighlight:t,autoEscape:!0,...n})}function Ds({children:e}){const{filter:t}=(0,Ze.useContext)(as);return(0,Ct.jsx)(Ft.D,{as:"h2",variant:"cello",semanticColor:"textBase",children:(0,Ct.jsx)(Ps,{searchWords:[t],textToHighlight:e})})}var Fs=n(3082);const Ms={button:"gvcgOXnAiNKEe_z92_lw"};function Os({onClick:e}){return(0,Ct.jsx)(Fs.P,{className:Ms.button,onClick:e,children:at.get("settings.restartApp")})}const Ls=(e,t,n)=>{let s=`${e}:${t}`;switch(n){case lt:s+="@http";break;case dt:s+="@socks4";break;case ct:s+="@socks5"}return s},js=({addr:e,mode:t,pass:n,user:s,setValue:r,restartContainer:o,fullWidth:i})=>{const a=(0,Ze.useRef)(null),l=(0,Ze.useRef)(null),d=(0,Ze.useRef)(null),c=(0,Ze.useRef)(null),[u,p]=(0,Ze.useState)(""),[h,g]=(0,Ze.useState)(""),[m,_]=(0,Ze.useState)(!1);(0,Ze.useEffect)((()=>{const[t,n]=e?.split(/[:@]+/)||["",""];p(t),g(n),a.current&&(a.current.value=t),l.current&&(l.current.value=n)}),[e]),(0,Ze.useEffect)((()=>{c.current&&n&&(c.current.value=n.toString())}),[n]),(0,Ze.useEffect)((()=>{d.current&&s&&(d.current.value=s.toString())}),[s]);const f=(0,Ze.useCallback)((({target:e})=>{const n=Ls(e.value,h,t||0);p(e.value),r("network.proxy.addr",n),_(!0)}),[t,h,r]),b=(0,Ze.useCallback)((({target:e})=>{const n=Ls(u,e.value,t||0);g(e.value),r("network.proxy.addr",n),_(!0)}),[t,u,r]),S=(0,Ze.useCallback)((({target:e})=>{r("network.proxy.user",e.value),_(!0)}),[r]),y=(0,Ze.useCallback)((({target:e})=>{r("network.proxy.pass",e.value),_(!0)}),[r]),E=0!==t&&1!==t,k=t!==dt;return(0,Ct.jsxs)(Ts,{filterMatchQuery:at.get("desktop.settings.proxy.title"),children:[(0,Ct.jsx)(Ds,{children:at.get("desktop.settings.proxy.title")}),(0,Ct.jsxs)("div",{className:ln()(Yn,i?qn:null),children:[(0,Ct.jsx)(Zn,{label:at.get("desktop.settings.proxy.type"),children:(0,Ct.jsx)(ss,{id:"network.proxy.mode",value:t,onSelect:e=>{const t=parseInt(e,10);r("network.proxy.mode",t),_(!0)},children:pt.map((({enumKey:e,enumValue:t})=>(0,Ct.jsx)("option",{value:t,"data-testid":e,children:ut[e]?ut[e].label():""},e)))})}),E?(0,Ct.jsxs)(Ct.Fragment,{children:[(0,Ct.jsxs)("div",{className:Kn,children:[(0,Ct.jsx)(Zn,{label:at.get("desktop.settings.proxy.host"),children:(0,Ct.jsx)(Xn,{id:"network.proxy.host",handleOnChange:f,placeHolder:at.get("desktop.settings.proxy.host"),inputRef:a})}),(0,Ct.jsx)(Zn,{label:at.get("desktop.settings.proxy.port"),children:(0,Ct.jsx)(Xn,{id:"network.proxy.port",type:"number",handleOnChange:b,placeHolder:at.get("desktop.settings.proxy.port"),inputRef:l})})]}),(0,Ct.jsxs)("div",{className:k?Kn:void 0,children:[(0,Ct.jsx)(Zn,{label:at.get("desktop.settings.proxy.user"),children:(0,Ct.jsx)(Xn,{id:"network.proxy.user",handleOnChange:S,placeHolder:at.get("desktop.settings.proxy.user"),inputRef:d})}),k?(0,Ct.jsx)(Zn,{label:at.get("desktop.settings.proxy.pass"),children:(0,Ct.jsx)(Xn,{id:"network.proxy.pass",handleOnChange:y,placeHolder:at.get("desktop.settings.proxy.pass"),type:"password",inputRef:c})}):null]})]}):null,m&&(0,Ct.jsx)("div",{children:(0,Ct.jsx)(Os,{onClick:o})})]})]})},Rs=["network.proxy.mode","network.proxy.addr","network.proxy.user","network.proxy.pass"];const Us=(0,d.$j)((e=>({settings:{proxy:e.settings.proxy}})),(e=>({fetchProxySettings(){e(wt.fetchProxySettings())},updateProxySettings(t){e(wt.updateProxySettings(t))},restartClient(){e(wt.restartClient())}})))((({settings:e={proxy:{mode:0,address:"",username:"",password:""}},fetchProxySettings:t=(()=>{}),updateProxySettings:n=(()=>{}),restartClient:s=(()=>{})})=>{(0,Ze.useEffect)((()=>{t()}),[t]);const r=(0,Ze.useCallback)(((t,s)=>{if(function(e){return!!Rs.includes(e)}(t)){const r={...e.proxy};switch(t){case"network.proxy.mode":r.mode=s;break;case"network.proxy.addr":r.address=s;break;case"network.proxy.user":r.username=s;break;case"network.proxy.pass":r.password=s}n(r)}return Promise.resolve()}),[e,n]);return(0,Ct.jsxs)("main",{className:"Settings","aria-labelledby":"settings-form-title","data-testid":"settings",children:[(0,Ct.jsx)("h1",{className:"HeroText",id:"settings-form-title",children:at.get("desktop.login.PreferencesLink")}),(0,Ct.jsx)(js,{mode:e.proxy.mode,addr:e.proxy.address,user:e.proxy.username,pass:e.proxy.password,setValue:r,restartContainer:s,fullWidth:!0})]})}));class Gs extends Ze.PureComponent{constructor(e){super(e),this.handleSettingsClick=this.goToSettingsPage.bind(this),this.handleBackToLoginClick=this.handleBackToLoginClick.bind(this)}handleSignupClick(){const{openSignupPage:e,onInteraction:t}=this.props,n=It();e(n),t("login/welcome","click","open-page-signup",null,n)}handleBackToLoginClick(e){e.preventDefault(),this.props.openLoginPage(),this.props.onInteraction(this.props.mode,"click","back-to-login")}goToSettingsPage(e){e.preventDefault(),this.props.openSettingsPage(),this.props.onInteraction(this.props.mode,"click","open-page-settings")}renderPreferencesLink(){return(0,Ct.jsx)("a",{className:"Footer__link",href:"#",onClick:this.handleSettingsClick,"data-ta-id":"login-footer-settings",children:at.get("desktop.login.PreferencesLink")})}renderBackToLoginLink(){return(0,Ct.jsx)("a",{className:"Footer__link",href:"#",onClick:this.handleBackToLoginClick,"data-ta-id":"login-footer-settings-back-to-login",children:at.get("desktop.login.Back")})}renderTryAgain(){return(0,Ct.jsxs)(Ct.Fragment,{children:[(0,Ct.jsx)("span",{children:at.get("desktop-auth.login.not-seeing-browser")})," ",(0,Ct.jsx)("a",{href:"#",onClick:()=>this.props.tryAgainHandler(),children:at.get("desktop-auth.login.try-again")})]})}renderSignupLink(){return(0,Ct.jsx)("a",{className:"Footer__NoUnderline",href:"#",id:"signup-link",onClick:()=>this.handleSignupClick(),"data-ta-id":"welcome-signup-link",dangerouslySetInnerHTML:{__html:at.get("desktop.login.DontHaveAnAccountSignup")}})}renderRussiaLegalFormLink(){return(0,Ct.jsx)("div",{children:(0,Ct.jsx)("a",{className:"Footer__link",href:"https://support.spotify.com/ru-ru/contact-spotify-legal-form/",target:"_blank",rel:"noopener",children:"Форма для Ваших обращений"})})}renderMode(e,t){return"login"===e||"welcome"===e&&t?this.renderPreferencesLink():"settings"===e?this.renderBackToLoginLink():"open-browser"===e?this.renderTryAgain():"welcome"===e?this.renderSignupLink():null}render(){const{mode:e,country:t,isAuthOnWebEnabled:n}=this.props;return(0,Ct.jsxs)("footer",{className:"Footer",role:"contentinfo",children:[this.renderMode(e,n),"RU"===t&&this.renderRussiaLegalFormLink()]})}}const Bs=(0,d.$j)((e=>({country:e.signup.restrictions?.country})),(e=>({tryAgainHandler:()=>{e(wt.abortLoginWithAccounts()),e(wt.enterWelcomeMode())},openLoginPage:()=>{e(wt.enterLoginMode())},openSignupPage:t=>e(wt.enterSignupMode(t)),openSettingsPage:()=>e(wt.enterSettingsMode()),onInteraction:(t,n,s,r,o)=>e(wt.interaction(t,n,s,r,o))})))(Gs);class Hs extends Ze.PureComponent{render(){return(0,Ct.jsxs)("header",{className:"Header",children:[(0,Ct.jsx)("h1",{className:"glue-hidden-visually",children:"Spotify"}),(0,Ct.jsx)("img",{className:"Header__logo",src:"images/logo.svg",alt:""})]})}}var Ws=n(9823),Vs=n(6994),$s=n(6844),Ks=n(6320);const Ys=(0,Ks.JP)({name:"enableAuthOnWeb",description:"Property to enable experiment to use the web authentication flow for Desktop application.",default:!1}),qs=(0,Ks.JP)({name:"enableAuthOnWebLogin",description:"Property to enable experiment to use the web authentication flow for Desktop application for login.",default:!1});class zs extends Ze.Component{static defaultProps={throbberDelay:0,transitionLeaveTimeout:0};renderFakeWebPlayer(){return(0,Ct.jsxs)("div",{className:"fakeWebPlayer",children:[(0,Ct.jsx)("aside",{}),(0,Ct.jsxs)("footer",{children:[(0,Ct.jsx)("div",{className:"fakeWebPlayer__footer-left"}),(0,Ct.jsx)("div",{className:"fakeWebPlayer__footer-center"}),(0,Ct.jsx)("div",{className:"fakeWebPlayer__footer-right"})]}),(0,Ct.jsx)("main",{children:(0,Ct.jsx)("div",{className:"fakeWebPlayer__content"})})]})}renderMode(e,t,n,s,r){return"settings"===e?(0,Ct.jsx)(Us,{}):n?(0,Ct.jsx)(nn,{eventSender:r}):"signup"===e?(0,Ct.jsx)(Ln,{step:t}):s?(0,Ct.jsx)(nn,{eventSender:r,loginOnly:!0}):"welcome"===e?(0,Ct.jsx)(Dt,{}):"login"===e?(0,Ct.jsx)(Hn,{}):"open-browser"===e?(0,Ct.jsx)(Vn,{}):null}render(){const{loading:e,mode:t,loggedIn:n,previousMode:s,throbberDelay:r,signupStep:o,previousSignupStep:i,isAuthOnWebEnabled:a,isAuthOnWebLoginEnabled:l,eventSender:d}=this.props;if(e||!t)return(0,Ct.jsx)(vt,{delay:r});if(n)return null;let c=s?`__${t} __${s}-to-${t}`:"";return"signup"===t&&Number.isInteger(i)&&(c+=` __signup_step_${i}_to_${o}`),(0,Ct.jsxs)("main",{className:"App","data-ta-id":"login-app","data-testid":"login-app","data-ta-login-mode":t,children:[this.renderFakeWebPlayer(),(0,Ct.jsx)("div",{className:`App__content ${c}`,children:(0,Ct.jsx)(Vs.Z,{mode:"in-out",children:(0,Ct.jsx)(Ws.Z,{timeout:{appear:0,enter:0,exit:650},children:(0,Ct.jsxs)("div",{className:`App__modal ${c}`,children:[(0,Ct.jsx)(Hs,{}),this.renderMode(t,o,a,l,d),(0,Ct.jsx)(Bs,{mode:t,isAuthOnWebEnabled:a||l})]})},c)})})]},"main1")}}const Js=(0,$s.yS)({isAuthOnWebEnabled:Ys,isAuthOnWebLoginEnabled:qs}),Xs=(0,d.$j)((e=>({mode:e.app.mode,previousMode:e.app.previousMode,signupStep:e.signup.step,previousSignupStep:e.signup.previousStep,loading:!!e.login.loading,loggedIn:!!e.login.loggedIn,throbberDelay:e.login.throbberDelay,transitionLeaveTimeout:e.login.redirectDelay})))(Js(zs));var Zs=n(4385),Qs=n(874);const er=e=>t=>n=>{const s=t(n);switch(n.type){case wt.START_APP:!async function(){new Promise(((e,t)=>{window.sendCosmosRequest({request:JSON.stringify({method:"POST",uri:"sp://messages/v1/container/control",body:'{"type":"view_loaded", "name":"/loginUI"}'}),persistent:!1,onSuccess:()=>{e()},onFailure:(e,n)=>{t(e)}})}))}(),e.dispatch(wt.getSignupRestrictions());!h.getItem("lastUsername")?e.dispatch(wt.enterWelcomeMode()):e.dispatch(wt.enterLoginMode());break;case wt.LOGIN_FAIL:{const t=e.getState();if(n.loginType===wt.LOGIN_TYPE_AUTOLOGIN){const n=t.app.mode;"welcome"===n?e.dispatch(wt.enterWelcomeMode()):"login"===n?e.dispatch(wt.enterLoginMode()):"signup"===n&&e.dispatch(wt.enterSignupMode())}else{if("open-browser"===t.app.mode){const s=n.errorData;let r=Ht(s.errorCategory,s.errorCode,s.errorReference);"desktop_login_accounts"===s.errorCategory&&4===s.errorCode&&(r="signup"===t.experimentWebAuthReducer.operationUsed?at.get("desktop-auth.login.signup-time-out"):at.get("desktop-auth.login.login-time-out")),r?e.dispatch(wt.enterWelcomeMode(r)):e.dispatch(wt.enterWelcomeMode())}}break}case wt.ENTER_SIGNUP_MODE:{const t=e.getState().signup.restrictions;t?!1===t.is_country_launched&&e.dispatch(wt.countryNotLaunched()):e.dispatch(wt.getSignupRestrictions());break}case wt.SIGNUP_RESTRICTIONS_SUCCESS:!1===n.restrictions.is_country_launched&&e.dispatch(wt.countryNotLaunched());break;case wt.SIGNUP_FAILURE:(n.errors.email||n.errors.password||n.errors.displayname)&&e.dispatch(wt.enterSignupModeStep0());break;case wt.COUNTRY_NOT_LAUNCHED:e.dispatch(wt.openSignupPage(!0))}return s},tr=e=>{const t=new en(e);return()=>e=>n=>{const s=e(n);switch(n.type){case wt.ENTER_LOGIN_MODE:t.logPageView({page:"login"});break;case wt.LOGIN_SUCCESS:n.loginType===wt.LOGIN_TYPE_EMAIL&&t.logAction({page:"login",action_type:"view",action_intent:"show-success-login-email"});break;case wt.LOGIN_FAIL:n.loginType===wt.LOGIN_TYPE_EMAIL&&n.errorData&&3===n.errorData.errorCode&&t.logAction({page:"login",action_type:"view",action_intent:"show-error-invalid-credential"});break;case wt.ENTER_SIGNUP_MODE:t.logPageView({page:"signup"});break;case wt.ENTER_SIGNUP_MODE_STEP_0:t.logAction({page:"signup",action_type:"view",action_intent:"show-signup-step-one"});break;case wt.ENTER_SIGNUP_MODE_STEP_1:t.logAction({page:"signup",action_type:"view",action_intent:"show-signup-step-two"});break;case wt.SIGNUP_SUCCESS:t.logAction({page:"signup",action_type:"view",action_intent:"show-success-signup-email"});break;case wt.SIGNUP_FAILURE:t.logAction({page:"signup",action_type:"view",action_intent:"show-error-signup-email",item_id:n.errors&&Object.keys(n.errors).join("|")});break;case wt.FACEBOOK_SIGNUP_SUCCESS:t.logAction({page:"signup",action_type:"view",action_intent:"show-success-authentication-facebook"});break;case wt.FACEBOOK_SIGNUP_FAILURE:t.logAction({page:"signup",action_type:"view",action_intent:"show-error-authentication-facebook",item_id:n.errorData&&`${n.errorData.errorCode} - ${n.errorData.errorDescription}`});break;case wt.ENTER_WELCOME_MODE:t.logPageView({page:"login/welcome"});break;case wt.ENTER_SETTINGS_MODE:t.logPageView({page:"login/settings"});break;case wt.INTERACTION:t.logAction({page:n.page,action_type:n.interactionType,action_intent:n.intent,item_id:n.itemId,action_hash:n.actionHash});break;case wt.VALIDATE_FIELD_FAILURE:if(n.error){const e=n.field,s=n.error.code;let r=null,o=null;"valueMissing"===s?r=`show-error-empty-${e}`:["incomplete","invalid","typeMismatch","tooShort"].includes(s)?r=`show-error-format-${e}`:(r=`show-error-${e}`,o=n.error.message||""),null!==r&&t.logAction({page:"signup",action_type:"view",action_intent:r,...o?{item_id:o}:{}})}}return s}},nr=e=>{window.location.href=e},sr=()=>e=>t=>{const n=e(t);if(!t.redirectTo)return n;let s;return"xpui"!==t.redirectTo||(s="spotify:app:xpui",t.redirectDelay?setTimeout((()=>{nr(s)}),t.redirectDelay):nr(s)),n},rr={errorMessage:null,currentActionHash:null};const or=function(e=rr,t){switch(t.type){case wt.ENTER_SIGNUP_MODE:return{...e,previousMode:e.mode,mode:"signup",currentActionHash:t.actionHash};case wt.ENTER_LOGIN_MODE:return{...e,previousMode:e.mode,mode:"login",currentActionHash:t.actionHash};case wt.LOGIN_BEFORE:case wt.SIGNUP_ATTEMPT:case wt.FACEBOOK_SIGNUP_ATTEMPT:return{...e,currentActionHash:null};case wt.COUNTRY_NOT_LAUNCHED:return{...e,previousMode:e.mode,mode:"login"};case wt.ENTER_WELCOME_MODE:return{...e,previousMode:e.mode,mode:"welcome",errorMessage:t.errorMessage??null};case wt.ENTER_SETTINGS_MODE:return{...e,previousMode:e.mode,mode:"settings"};default:return e}};const ir={proxy:{mode:0,address:"",username:"",password:""}};const ar=function(e=ir,t){return function(e){return e.type===wt.SETTINGS_FETCH_PROXY_SETTINGS_SUCCESS}(t)?{...e,proxy:{mode:t.data.mode,address:t.data.address,username:t.data.username,password:t.data.password}}:e},lr={step:0,isAttempting:!1,isSuccessful:void 0,errors:{},errorData:{},validated:{},formData:{name:"",email:"",password:"",birthDate:{day:void 0,month:void 0,year:void 0},gender:void 0,sendEmail:void 0,shareData:void 0,agreeEula:!1},restrictions:void 0};const dr=function(e=lr,t){switch(t.type){case wt.ENTER_SIGNUP_MODE_STEP_0:return{...e,previousStep:e.step,step:0};case wt.ENTER_SIGNUP_MODE_STEP_1:return{...e,previousStep:e.step,step:1};case wt.SIGNUP_RESTRICTIONS_SUCCESS:return{...e,formData:{...e.formData,sendEmail:!!t.restrictions.requires_marketing_opt_in_text||void 0,agreeEula:!!t.restrictions.pretick_eula},restrictions:t.restrictions};case wt.SIGNUP_RESTRICTIONS_FAILURE:return{...e,errorData:t.error};case wt.SIGNUP_ATTEMPT:return{...e,isAttempting:!0,errorData:null};case wt.SIGNUP_SUCCESS:return{...e,isAttempting:!0,isSuccessful:!0,errorData:null};case wt.SIGNUP_FAILURE:return{...e,isAttempting:!1,isSuccessful:!1,errors:t.errors,errorData:null};case wt.FACEBOOK_SIGNUP_ATTEMPT:return{...e,errorData:null,errors:{}};case wt.FACEBOOK_SIGNUP_FAILURE:return{...e,errorData:t.errorData};case wt.VALIDATE_FIELD_ATTEMPT:return{...e,errors:{...e.errors,[t.field]:void 0}};case wt.VALIDATE_FIELD_FAILURE:return{...e,errors:{...e.errors,[t.field]:t.error},validated:{...e.validated,[t.field]:!1}};case wt.VALIDATE_FIELD_SUCCESS:return{...e,errors:{...e.errors,[t.field]:void 0},validated:{...e.validated,[t.field]:!0}};case wt.UPDATE_SIGNUP_DATA:{const n={};for(const e of Object.keys(t.data))n[e]=void 0;return{...e,errors:{...e.errors,...n},formData:{...e.formData,...t.data}}}case wt.CLEAR_ALL_ERRORS:return{...e,errors:{}};default:return e}};function cr(e){const t=(0,Zs.MT)((0,Zs.UY)({app:or,login:y,settings:ar,signup:dr}),void 0,(0,Zs.md)(Qs.Z,er,tr(e),sr));return t.subscribe((()=>{const e=t.getState();e.login.username&&localStorage.setItem(g,e.login.username),e.login.utmParameters&&localStorage.setItem(_,JSON.stringify(e.login.utmParameters))})),t}var ur=n(9442),pr=n(5233);let hr=null;var gr=n(3170);const mr=(e,t)=>{const n=e.event_sender_context_information;return[(0,gr.UY)({version_code:n.client_version_int,version_string:n.client_version_string}),(0,gr.jx)(t),(0,gr.IE)(n.installation_id),(0,gr.CF)({device_id:n.device_id,device_manufacturer:n.device_manufacturer,device_model:n.device_model,os_version:n.os_version,platform_type:n.platform_type})]},_r=(e,t,n,s,r)=>(0,gr.mi)({transport:t,suppressPersist:false,context:mr(e,n),storagePrefix:n,ownerProvider:s,useOptimizedESS2NA:r}),fr=/Spotify\/(?<version>.+)\s/;var br=n(2162),Sr=n(5459),yr=n(7786);(0,br.hb)(),async function(){for(const e of[window.__spotify.locale,tt.en])try{const t=await fetch(`i18n/${e}.json`).then((e=>e.json()));return at.setLocale(e),void at.setDictionary(t)}catch(e){0}throw new Error("Cannot find a suitable locale! Something is wrong: talk to #desktop.")}().then((async function(){const e=function(){const e=(0,pr.qy)({providers:{endpoints:(0,pr.uG)(),token:()=>null}});return e.connect(),e}();hr=e;const t=_r(window.__spotify,e,"65b708073fc0480ea92a077233ca87bd",(()=>null),!1),n=cr(t);u.attach(),u.update(),c.attach();const s=document.location.search,r=new RegExp(`\\?param=error-code\\${encodeURIComponent("=")}([0-9]+)`,"i");window.addEventListener("message",(e=>{"critical-update-error"===e.data&&n.dispatch(wt.loginFailed({errorCode:e.data}))}));const o=s.match(r);if(s&&o){const e=+o[1];n.dispatch(wt.loginFailed({errorCode:e}))}let i="linux";window.navigator.platform.startsWith("Mac")&&(i="mac"),window.navigator.platform.startsWith("Win")&&(i="windows"),document.body.classList.add(`body-container--${i}`);const p=Sr.L.addMiddleware(yr._);a.render((0,Ct.jsx)(l.zj,{children:(0,Ct.jsx)(d.zt,{store:n,children:(0,Ct.jsx)($s.nD,{resolver:p,context:{username:null},options:{clientId:"client-desktop-ui-app-login",timeout:5e3,transport:e,eventSender:t,version:window.navigator.userAgent.match(fr).groups.version,installationId:window.__spotify.event_sender_context_information?.installation_id},children:(0,Ct.jsx)(Ze.Suspense,{fallback:null,children:(0,Ct.jsx)(Xs,{eventSender:t})})})})}),document.getElementById("main")),n.dispatch(wt.startApp()),document.documentElement.setAttribute("dir",window.__spotify.localization_is_rtl?"rtl":"ltr");const h={[ur.PLATFORM_UNKNOWN]:"body-container--unknown-os",[ur.PLATFORM_MAC]:"body-container--mac",[ur.PLATFORM_WINDOWS]:"body-container--windows"},g=(0,ur.getPlatform)();document.body.classList.add(h[g]),(0,br.wm)("UI init phase is done for login")}))},9442:(e,t,n)=>{"use strict";n.r(t),n.d(t,{PLATFORM_MAC:()=>r,PLATFORM_UNKNOWN:()=>s,PLATFORM_WINDOWS:()=>o,getPlatform:()=>l,isMac:()=>i,isWindows:()=>a});const s=Symbol("PLATFORM_UNKNOWN"),r=Symbol("PLATFORM_MAC"),o=Symbol("PLATFORM_WINDOWS");function i(){return window.navigator.platform.startsWith("Mac")}function a(){return window.navigator.platform.startsWith("Win")}function l(){return i()?r:a()?o:s}},4607:(e,t)=>{let n=!1;t.update=()=>{},t.attach=()=>{if(n)return;n=!0;const e=window.__spotify&&window.__spotify.locale;e&&document.documentElement.setAttribute("lang",e)},t.detach=()=>{n&&(n=!1,document.documentElement.removeAttribute("lang"))}},7180:(e,t,n)=>{const{getPlatform:s,PLATFORM_UNKNOWN:r,PLATFORM_MAC:o,PLATFORM_WINDOWS:i}=n(9442);let a=!1,l="always-visible",d=0;const c={[r]:"linux",[o]:"mac",[i]:"windows"};let u=c[r];function p(){const e=[...document.querySelectorAll("*")],t=[],n=["scroll","auto","overlay"];e.forEach((e=>{const s=window.getComputedStyle(e),r=s.overflowX,o=s.overflowY;n.includes(r)&&t.push({node:e,property:"overflow-x"}),n.includes(o)&&t.push({node:e,property:"overflow-y"})}));const s=document.createElement("style");s.innerHTML="\n html::-webkit-scrollbar,\n body::-webkit-scrollbar {\n background-color: rgba(1, 2, 3, 0) !important;\n }\n ".trimRight();const r=`data-scrollbar-fix-${++d}-id`;let o=0;t.forEach((({node:e,property:t})=>{if(e!==document.body){const n=++o;e.setAttribute(r,n),s.innerHTML+=`\n [${r}="${n}"] { ${t}: hidden !important; }`}})),document.head.appendChild(s),setTimeout((()=>{document.head.removeChild(s),t.forEach((({node:e})=>{e.removeAttribute(r)}))}),0)}t.performScrollBarFix=p,t.update=function(){},t.attach=function(){if(a)return;a=!0;const e=window.__spotify&&window.__spotify.scroller_style;l="overlay"===e?"overlay":"always-visible";const t=s();u=c[t],"always-visible"===l||"mac"!==u?(document.body.classList.remove("scrollbar-style-when-scrolling-mac"),document.body.classList.add(`scrollbar-style-visible-${u}`)):(document.body.classList.remove(`scrollbar-style-visible-${u}`),document.body.classList.add("scrollbar-style-when-scrolling-mac")),window.addEventListener("message",(e=>{"set_active"===e.data.name&&e.data.active&&p()}))},t.detach=function(){a&&(a=!1,d=0)}}},n={};function s(e){var r=n[e];if(void 0!==r)return r.exports;var o=n[e]={id:e,loaded:!1,exports:{}};return t[e].call(o.exports,o,o.exports,s),o.loaded=!0,o.exports}s.m=t,s.amdO={},e=[],s.O=(t,n,r,o)=>{if(!n){var i=1/0;for(c=0;c<e.length;c++){for(var[n,r,o]=e[c],a=!0,l=0;l<n.length;l++)(!1&o||i>=o)&&Object.keys(s.O).every((e=>s.O[e](n[l])))?n.splice(l--,1):(a=!1,o<i&&(i=o));if(a){e.splice(c--,1);var d=r();void 0!==d&&(t=d)}}return t}o=o||0;for(var c=e.length;c>0&&e[c-1][2]>o;c--)e[c]=e[c-1];e[c]=[n,r,o]},s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e={535:0};s.O.j=t=>0===e[t];var t=(t,n)=>{var r,o,[i,a,l]=n,d=0;if(i.some((t=>0!==e[t]))){for(r in a)s.o(a,r)&&(s.m[r]=a[r]);if(l)var c=l(s)}for(t&&t(n);d<i.length;d++)o=i[d],s.o(e,o)&&e[o]&&e[o][0](),e[o]=0;return s.O(c)},n=("undefined"!=typeof self?self:global).webpackChunkclient_web=("undefined"!=typeof self?self:global).webpackChunkclient_web||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})(),s.nc=void 0;var r=s.O(void 0,[569],(()=>s(8272)));r=s.O(r)})();
//# sourceMappingURL=login.js.map