function getApolloLocaleSlugMap(){return{"":0,us:1,uk:2,au:3,nz:4,"in":5,asean:6,"middle-east":7,africa:8,nl:9,de:10,ca:11,ie:12,asia:13,es:14,pl:15,world:-1}}function getApolloLocaleIdMap(){return{"0":"","1":"us","2":"uk","3":"au","4":"nz","5":"in","6":"asean","7":"middle-east","8":"africa","9":"nl","10":"de","11":"ca","12":"ie","13":"asia","14":"es","15":"pl","-1":"world"}}function getApolloLocaleDescMap(){return{"0":"","1":"United States","2":"United Kingdom","3":"Australia","4":"New Zealand","5":"India","6":"ASEAN","7":"Middle East","8":"Africa","9":"Netherlands","10":"Germany","11":"Canada","12":"Ireland","13":"Asia","14":"Spain","15":"Poland","-1":"World"}}function getApolloLocaleBrandMap(){var map={};for(i=0;i<32;i++){map[Math.pow(2,i)]=[0]}map[32].push(2);map[32].push(3);map[32].push(5);map[32].push(6);map[128].push(2);map[128].push(3);map[128].push(4);map[128].push(5);map[256].push(2);map[256].push(3);map[256].push(4);map[256].push(5);map[256].push(6);map[256].push(7);map[256].push(8);map[2048].push(2);map[128].push(9);map[256].push(9);map[32].push(10);return map}function getCountryCodeLocaleMap(){var map={US:0,UM:0,PR:0,GU:0,AS:0,VI:0,GB:2,IM:2,KY:2,BM:2,VG:2,GG:2,JE:2,GI:2,PN:2,MS:2,FK:2,AI:2,SH:2,GS:2,TN:2,AU:3,NZ:4,IN:5,BN:6,HK:6,KH:6,ID:6,LA:6,MM:6,MY:6,PG:6,PH:6,SG:6,TH:6,VN:6,TL:6,BH:7,EG:7,IR:7,IQ:7,JO:7,KW:7,LB:7,OM:7,PS:7,QA:7,SA:7,SY:7,TR:7,AE:7,YE:7,AO:8,BJ:8,BW:8,BF:8,BI:8,VC:8,CM:8,CF:8,TD:8,KM:8,CG:8,CI:8,CD:8,DJ:8,GQ:8,ER:8,SZ:8,ET:8,GA:8,GM:8,GH:8,GW:8,LS:8,LR:8,MG:8,MW:8,ML:8,MR:8,MU:8,MZ:8,NA:8,NE:8,NG:8,RE:8,RW:8,EH:8,ST:8,SN:8,SC:8,SL:8,SO:8,ZA:8,SD:8,TG:8,ZM:8,ZW:8,KE:8,SS:8,TZ:8,UG:8,NL:9,BE:9,LU:9,DE:10,CA:11,IE:12};return map}function getCookie(cookieName){return $.cookie(cookieName)}function setCookie(cookieName,cookieValue){$.cookie(cookieName,cookieValue,{expires:365,path:"/"})}function getFastlyCountryCode(){return getCookie("fastlyCountryCode")}function getLocaleFromCountryCode(countryCode){var brandId=parseInt(brandConfigBrandId);var map={};map=getCountryCodeLocaleMap();return countryCode&&countryCode in map?map[countryCode]:0}function getAutoLocale(fastlyCountryCode){var localeId=getLocaleFromCountryCode(fastlyCountryCode);var map=getApolloLocaleBrandMap();if(localeId&&brandConfigBrandId&&map[parseInt(brandConfigBrandId)]&&map[parseInt(brandConfigBrandId)].includes(parseInt(localeId))){return localeId}return 0}function getSelectedLocale(){var localeId=getCookie("selectedLocale");var map=getApolloLocaleBrandMap();if(localeId&&brandConfigBrandId&&map[parseInt(brandConfigBrandId)]&&map[parseInt(brandConfigBrandId)].includes(parseInt(localeId))){return localeId}return null}function setSelectedLocale(localeId){setCookie("selectedLocale",localeId)}function browserLocaleError(){console.log("error getting geolocation, ignore")}function setBrowserLocale(position){var latitude=position.coords.latitude;var longitude=position.coords.longitude;var apiKey="foo";fetch("https://maps.googleapis.com/maps/api/geocode/json?latlng="+latitude+","+longitude+"&key="+apiKey).then(function(response){var json=response.json();if("results" in json&&"address_components" in json.results){for(var i in json.results.address_components){if("types" in json.results.address_components[i]){var arrAddressTypes=json.results.address_components[i]["types"];if(arrAddressTypes.includes.country){var countryCode=json.results.address_components[i]["short_name"];var brandId=parseInt(brandConfigBrandId);var map={};map=getCountryCodeLocaleMap();if(countryCode in map){setCookie("browserLocale",map[countryCode]);break}}}}}})}function getRedirectLocale(){return getCookie("redirectLocale")}function getBrowserLocale(){var locale=getCookie("browserLocale");if(locale==null){if("geolocation" in navigator){navigator.geolocation.getCurrentPosition(setBrowserLocale,browserLocaleError)}}return locale}function getLocale(){var map=getApolloLocaleSlugMap();for(var slug in map){if(slug&&(location.pathname=="/"+slug||location.pathname.indexOf("/"+slug+"/")==0)){return map[slug]}}var selectedLocale=getSelectedLocale();if(selectedLocale!=null){return selectedLocale}var fastlyCountryCode=getFastlyCountryCode();if(fastlyCountryCode!=null){return getAutoLocale(fastlyCountryCode)}return 0};