/*! * device-uuid.js v1.0.4 (https://github.com/biggora/device-uuid/) * Copyright 2016-2017 Alexey Gordeyev * Licensed under MIT (https://github.com/biggora/device-uuid/blob/master/LICENSE) */ (function(exports){'use strict';var BOTS=['\\+https:\\/\\/developers.google.com\\/\\+\\/web\\/snippet\\/','googlebot','baiduspider','gurujibot','yandexbot','slurp','msnbot','bingbot','facebookexternalhit','linkedinbot','twitterbot','slackbot','telegrambot','applebot','pingdom','tumblr ','Embedly','spbot'];var IS_BOT_REGEXP=new RegExp('^.*('+BOTS.join('|')+').*$');var DeviceUUID=function(options){options=options?options:{};var defOptions={version:false,webgl:true,nameDevice:true,platform:true,os:true,pixelDepth:true,colorDepth:true,resolution:true,isAuthoritative:true,silkAccelerated:true,isKindleFire:true,isMobile:true,isTablet:true,isWindows:true,isLinux:true,isChromeOS:true,isMac:true,isiPad:true,isiPhone:true,isiPod:true,isAndroid:true,isSamsung:true,isSmartTV:true,isRaspberry:true,isBlackberry:true,isTouchScreen:true,source:false,cpuCores:false};for(var key in options){if(options.hasOwnProperty(key)&&typeof defOptions[key]!=='undefined'){defOptions[key]=options[key];}} this.options=defOptions;this.version='1.0.0';this._OS={Windows11:/windows nt 11\.0/i,Windows10:/windows nt 10\.0/i,Windows81:/windows nt 6\.3/i,Windows8:/windows nt 6\.2/i,Windows7:/windows nt 6\.1/i,UnknownWindows:/windows nt 6\.\d+/i,WindowsVista:/windows nt 6\.0/i,Windows2003:/windows nt 5\.2/i,WindowsXP:/windows nt 5\.1/i,Windows2000:/windows nt 5\.0/i,WindowsPhone8:/windows phone 8\./i,OSXCheetah:/os x 10[._]0/i,OSXPuma:/os x 10[._]1/i,OSXJaguar:/os x 10[._]2/i,OSXPanther:/os x 10[._]3/i,OSXTiger:/os x 10[._]4/i,OSXLeopard:/os x 10[._]5/i,OSXSnowLeopard:/os x 10[._]6/i,OSXLion:/os x 10[._]7/i,OSXMountainLion:/os x 10[._]8/i,OSXMavericks:/os x 10[._]9/i,OSXYosemite:/os x 10[._]10/i,OSXElCapitan:/os x 10[._]11/i,OSXSierra:/os x 10[._]12/i,OSXHighSierra:/os x 10[._]13/i,OSXMojave:/os x 10[._]14/i,OSXCatalina:/os x 10[._]15/i,OSXBigSur:/os x 11[._]\d+/i,OSXMonterey:/os x 12[._]\d+/i,OSXVentura:/os x 13[._]\d+/i,OSXSonoma:/os x 14[._]\d+/i,Mac:/os x|mac os/i,Linux:/linux(?!.*android)/i,Ubuntu:/ubuntu/i,Debian:/debian/i,Fedora:/fedora/i,ArchLinux:/arch/i,openSUSE:/opensuse/i,CentOS:/centos/i,RedHat:/red hat/i,AlmaLinux:/almalinux/i,RockyLinux:/rockylinux/i,AmazonLinux:/amazon linux/i,KaliLinux:/kali/i,Tails:/tails/i,Raspbian:/raspbian/i,PuppyLinux:/puppy/i,Lubuntu:/lubuntu/i,Xubuntu:/xubuntu/i,ChromeOS:/cros/i,Wii:/wii/i,PS3:/playstation 3/i,PSP:/playstation portable/i,Bada:/Bada\/(\d+)\.(\d+)/i,Curl:/curl\/(\d+)\.(\d+)\.(\d+)/i,Android:/android/i,Android14:/android 14/i,Android13:/android 13/i,Android12:/android 12/i,Android11:/android 11/i,Android10:/android 10/i,AndroidPie:/android 9/i,AndroidOreo:/android 8/i,AndroidNougat:/android 7/i,AndroidMarshmallow:/android 6/i,AndroidLollipop:/android 5/i,AndroidKitKat:/android 4\.4/i,AndroidJellyBean:/android 4\.1|android 4\.2|android 4\.3/i,AndroidIceCreamSandwich:/android 4\.0/i,AndroidGingerbread:/android 2\.3/i,AndroidFroyo:/android 2\.2/i,iPad:/\(iPad.*os (\d+)[._](\d+)/i,iPhone:/\(iPhone.*os (\d+)[._](\d+)/i,iOS:/os ([\d_]+) like Mac OS X/i,iOS18:/os 18[._]\d+/i,iOS17:/os 17[._]\d+/i,iOS16:/os 16[._]\d+/i,iOS15:/os 15[._]\d+/i,iOS14:/os 14[._]\d+/i,iOS13:/os 13[._]\d+/i,iOS12:/os 12[._]\d+/i,iOS11:/os 11[._]\d+/i,iOS10:/os 10[._]\d+/i,iOS9:/os 9[._]\d+/i,iOS8:/os 8[._]\d+/i,iOS7:/os 7[._]\d+/i};this._Platform={Windows:/windows nt/i,WindowsPhone:/windows phone/i,Mac:/macintosh|mac os/i,Linux:/linux/i,ChromeOS:/cros/i,iPad:/ipad/i,iPod:/ipod/i,iPhone:/iphone/i,SamsungTablet:/sm-t|galaxy tab/i,AmazonFireTablet:/kf|kindle fire/i,GenericAndroidTablet:/android(?!.*mobile)/i,Android:/android/i,Blackberry:/blackberry/i,Samsung:/samsung/i,Wii:/wii/i,Playstation:/playstation/i,Curl:/curl/i};this._Versions={Edge:/Edge\/([\d\w\.\-]+)/i,Firefox:/firefox\/([\d\w\.\-]+)/i,IE:/msie\s([\d\.]+[\d])|trident\/\d+\.\d+;.*[rv:]+(\d+\.\d)/i,Chrome:/chrome\/([\d\w\.\-]+)/i,Chromium:/(?:chromium|crios)\/([\d\w\.\-]+)/i,Safari:/version\/([\d\w\.\-]+)/i,Opera:/version\/([\d\w\.\-]+)|OPR\/([\d\w\.\-]+)/i,Ps3:/([\d\w\.\-]+)\)\s*$/i,Psp:/([\d\w\.\-]+)\)?\s*$/i,Amaya:/amaya\/([\d\w\.\-]+)/i,SeaMonkey:/seamonkey\/([\d\w\.\-]+)/i,OmniWeb:/omniweb\/v([\d\w\.\-]+)/i,Flock:/flock\/([\d\w\.\-]+)/i,Epiphany:/epiphany\/([\d\w\.\-]+)/i,WinJs:/msapphost\/([\d\w\.\-]+)/i,PhantomJS:/phantomjs\/([\d\w\.\-]+)/i,UC:/UCBrowser\/([\d\w\.]+)/i};this._Browsers={Edge:/edge/i,Amaya:/amaya/i,Konqueror:/konqueror/i,Epiphany:/epiphany/i,SeaMonkey:/seamonkey/i,Flock:/flock/i,OmniWeb:/omniweb/i,Chromium:/chromium|crios/i,Chrome:/chrome/i,Safari:/safari/i,IE:/msie|trident/i,Opera:/opera|OPR/i,PS3:/playstation 3/i,PSP:/playstation portable/i,Firefox:/firefox/i,WinJs:/msapphost/i,PhantomJS:/phantomjs/i,UC:/UCBrowser/i};this.DefaultAgent={isSamsung:false,isSamsungTablet:false,isiPad:false,isiPhone:false,isMac:false,isMacOS:false,isOSXCheetah:false,isOSXPuma:false,isOSXJaguar:false,isOSXPanther:false,isOSXTiger:false,isOSXLeopard:false,isOSXSnowLeopard:false,isOSXLion:false,isOSXMountainLion:false,isOSXMavericks:false,isOSXYosemite:false,isOSXElCapitan:false,isOSXSierra:false,isOSXHighSierra:false,isOSXMojave:false,isOSXCatalina:false,isOSXBigSur:false,isOSXMonterey:false,isOSXVentura:false,isOSXSonoma:false,isiOS18:false,isiOS17:false,isiOS16:false,isiOS15:false,isiOS14:false,isiOS13:false,isiOS12:false,isiOS11:false,isiOS10:false,isiOS9:false,isiOS8:false,isiOS7:false,isiOS:false,isWindowsDesktop:false,isWindowsPhone:false,isWindows11:false,isWindows10:false,isWindows81:false,isWindows8:false,isWindows7:false,isWindowsVista:false,isWindows2003:false,isWindowsXP:false,isWindows2000:false,isAndroidMobile:false,isAndroidTablet:false,isAndroid14:false,isAndroid13:false,isAndroid12:false,isAndroid11:false,isAndroid10:false,isAndroidPie:false,isAndroidOreo:false,isAndroidNougat:false,isAndroidMarshmallow:false,isAndroidLollipop:false,isAndroidKitKat:false,isAndroidJellyBean:false,isAndroidIceCreamSandwich:false,isAndroidGingerbread:false,isAndroidFroyo:false,isLinux:false,isUbuntu:false,isDebian:false,isFedora:false,isArchLinux:false,isopenSUSE:false,isCentOS:false,isRedHat:false,isAlmaLinux:false,isRockyLinux:false,isAmazonLinux:false,isKaliLinux:false,isTails:false,isRaspbian:false,isPuppyLinux:false,isLubuntu:false,isXubuntu:false,isAuthoritative:true,isMobile:false,isBlackberry:false,isWindows:false,isChromeOS:false,isBada:false,isRaspberry:false,isBot:false,isCurl:false,isKindleFire:false,isSilk:false,isCaptive:false,isSmartTV:false,isTouchScreen:false,silkAccelerated:false,colorDepth:-1,pixelDepth:-1,resolution:[],cpuCores:-1,os:'unknown',nameDevice:'unknown',platform:'unknown',webgl:'unknown',source:'',hashInt:function(string){var hash=0,i,chr,len;if(string.length===0){return hash;} for(i=0,len=string.length;i>>(32-iShiftBits));} function addUnsigned(lX,lY){var lX4,lY4,lX8,lY8,lResult;lX8=(lX&0x80000000);lY8=(lY&0x80000000);lX4=(lX&0x40000000);lY4=(lY&0x40000000);lResult=(lX&0x3FFFFFFF)+(lY&0x3FFFFFFF);if(lX4&lY4){return(lResult^0x80000000^lX8^lY8);} if(lX4|lY4){if(lResult&0x40000000){return(lResult^0xC0000000^lX8^lY8);}else{return(lResult^0x40000000^lX8^lY8);}}else{return(lResult^lX8^lY8);}} function gF(x,y,z){return(x&y)|((~x)&z);} function gG(x,y,z){return(x&z)|(y&(~z));} function gH(x,y,z){return(x^y^z);} function gI(x,y,z){return(y^(x|(~z)));} function gFF(a,b,c,d,x,s,ac){a=addUnsigned(a,addUnsigned(addUnsigned(gF(b,c,d),x),ac));return addUnsigned(rotateLeft(a,s),b);} function gGG(a,b,c,d,x,s,ac){a=addUnsigned(a,addUnsigned(addUnsigned(gG(b,c,d),x),ac));return addUnsigned(rotateLeft(a,s),b);} function gHH(a,b,c,d,x,s,ac){a=addUnsigned(a,addUnsigned(addUnsigned(gH(b,c,d),x),ac));return addUnsigned(rotateLeft(a,s),b);} function gII(a,b,c,d,x,s,ac){a=addUnsigned(a,addUnsigned(addUnsigned(gI(b,c,d),x),ac));return addUnsigned(rotateLeft(a,s),b);} function convertToWordArray(string){var lWordCount;var lMessageLength=string.length;var lNumberOfWordsTemp1=lMessageLength+8;var lNumberOfWordsTemp2=(lNumberOfWordsTemp1-(lNumberOfWordsTemp1%64))/ 64;var lNumberOfWords=(lNumberOfWordsTemp2+1)*16;var lWordArray=new Array(lNumberOfWords-1);var lBytePosition=0;var lByteCount=0;while(lByteCount>>29;return lWordArray;} function wordToHex(lValue){var wordToHexValue='',wordToHexValueTemp='',lByte,lCount;for(lCount=0;lCount<=3;lCount++){lByte=(lValue>>>(lCount*8))&255;wordToHexValueTemp='0'+lByte.toString(16);wordToHexValue=wordToHexValue+wordToHexValueTemp.substr(wordToHexValueTemp.length-2,2);} return wordToHexValue;} function utf8Encode(string){string=string.replace(/\r\n/g,'\n');var utftext='';for(var n=0;n127)&&(c<2048)){utftext+=String.fromCharCode((c>>6)|192);utftext+=String.fromCharCode((c&63)|128);}else{utftext+=String.fromCharCode((c>>12)|224);utftext+=String.fromCharCode(((c>>6)&63)|128);utftext+=String.fromCharCode((c&63)|128);}} return utftext;} var x=[];var k,AA,BB,CC,DD,a,b,c,d;var S11=7,S12=12,S13=17,S14=22;var S21=5,S22=9,S23=14,S24=20;var S31=4,S32=11,S33=16,S34=23;var S41=6,S42=10,S43=15,S44=21;string=utf8Encode(string);x=convertToWordArray(string);a=0x67452301;b=0xEFCDAB89;c=0x98BADCFE;d=0x10325476;for(k=0;k0)||(navigator.msMaxTouchPoints>0));};this.getColorDepth=function(){var ua=this;ua.Agent.colorDepth=screen.colorDepth||-1;};this.getScreenResolution=function(){var ua=this;ua.Agent.resolution=[screen.availWidth,screen.availHeight];};this.getPixelDepth=function(){var ua=this;ua.Agent.pixelDepth=screen.pixelDepth||-1;};this.getCPU=function(){var ua=this;ua.Agent.cpuCores=navigator.hardwareConcurrency||-1;};this.getNameDeviceAndroid=function(source){var ua=this;let match=source.match(/\(([^;]+;[^;]+;[^)]+)\)/);if(match&&match.length>1){let deviceInfo=match[1].split(";").map(str=>str.trim());ua.Agent.nameDevice=deviceInfo.length>=3?deviceInfo[2]:"unknown";}} this.reset=function reset(){var ua=this;for(var key in ua.DefaultAgent){if(ua.DefaultAgent.hasOwnProperty(key)){ua.Agent[key]=ua.DefaultAgent[key];}} return ua;};this.getPerformaceGPU=function(){var ua=this;const gl=document.createElement("canvas").getContext("webgl");ua.Agent.webgl=gl.getParameter(gl.MAX_TEXTURE_SIZE);} this.parse=function get(source){source=source||navigator.userAgent;var ua=new DeviceUUID();ua.Agent.source=source.replace(/^\s*/,'').replace(/\s*$/,'');ua.Agent.os=ua.getOS(ua.Agent.source);ua.Agent.platform=ua.getPlatform(ua.Agent.source);ua.getNameDeviceAndroid(ua.Agent.source) ua.testBot();ua.testSmartTV();ua.testSilk();ua.testKindleFire();ua.testCaptiveNetwork();ua.testTouchSupport();ua.getCPU();if(ua.Agent.isMobile=='true'){ua.getColorDepth();ua.getPixelDepth();ua.getScreenResolution();} ua.getPerformaceGPU();return ua.Agent;};this.get=function(customData){var pref='a',du=this.parse();var dua=[];for(var key in this.options){if(this.options.hasOwnProperty(key)&&this.options[key]===true){dua.push(du[key]);}} if(customData){dua.push(customData);} if(!this.options.resolution&&du.isMobile){dua.push(du.resolution);} pref='b';var tmpUuid=du.hashMD5(dua.join(':'));var uuid=[tmpUuid.slice(0,8),tmpUuid.slice(8,12),'4'+tmpUuid.slice(12,15),pref+tmpUuid.slice(15,18),tmpUuid.slice(20)];return uuid.join('-');};this.Agent=this.DefaultAgent;return this;};exports.DeviceUUID=DeviceUUID;return new DeviceUUID(navigator.userAgent);})(this);; if(!window.filters)window.filters={__filters:document.createElement('filters'),init:function(){if(window.filters_hooks){window.filters_hooks.forEach(element=>{let key=Object.keys(element)[0];this.add(key,element[key]);});}},add:function(name,filter){this.__filters.addEventListener(name,function(ev){filter(ev.detail);});},exec:function(name,val){var data={ret:val};let event=new CustomEvent(name,{"detail":data});this.__filters.dispatchEvent(event);return data.ret;}};window.filters.init();(function(){GediSocial={settings:{gigya:{sdk:'https://cdns.eu1.gigya.com/js/gigya.js',load:true,appId:'3_2oQ0Rw41QlhvMLmUtCqjJUkf3Vou3hkxjQGQBHWIc9REFlNZdsQ6Nhgf1lcRZARv',gateway:'https://fidm.gigya.com/jwt/',clp:'https://login.gedi.it/clp/login.php',timeout:15000,jwt:{expiration:7200,refreshLimit:300000,refreshCheck:120000,cookieName:"blaize_jwt",cookieNameSession:'blaize_session',cookieNameTracking:'blaize_tracking_id',cookieDomain:'',cookieExpires:365,cookiePath:'/',cookieSameSite:'None',cookieSecure:true,localStorageEXP:'gediaccounts_jwt_exp'},loginParams:{authFlow:'redirect',},screenSets:{login:{screenSet:'GEDI-RegistrationLogin',cid:'OLD',},profile:{screenSet:'GEDI-ProfileUpdate',},sessions_params:["authCode","gig_origin","gig_brand","gig_actions","gig_myCustomLang","gig_myCustomSessionExpiration","gig_screenSet","gig_initialApiKey","gig_startScreen","gig_source_reg"],}},recaptcha:{sdk:'https://www.google.com/recaptcha/api.js',public_key:'6Ldl3JcqAAAAAEjlW686RJTqJ4ZXiuCOEsRykfMV'},view:{default:{containerID:'account-data-container'},pw:{containerID:'account-pw-container',},render:true,userAgent:window.navigator.userAgent,},handlers:{reload:true,autologin_cb:null,autologout_cb:null}},status:{handlers:{reload:{_running:false}},gigya:{blocked:undefined,logged:false,response:null,uid:null,lastlogin:null,initialized:false,gacProcessing:false,jwt:{_running:false},privacy:false}}} GediSocial.interfaces={standard:{init:function(settings={}){var me=this;if(settings&&!GediSocial.utils.isNull(settings)) GediSocial.settings=GediSocial.utils.deepExtend(GediSocial.settings,settings);me.cleanSettings();if(window.gedi&&!GediSocial.utils.isNull(window.gedi.view)) GediSocial.settings.view=GediSocial.utils.deepExtend(GediSocial.settings.view,window.gedi.view);if(window.gedi&&!GediSocial.utils.isNull(window.gedi.handlers)) GediSocial.settings.handlers=GediSocial.utils.deepExtend(GediSocial.settings.handlers,window.gedi.handlers);var onGigyaServiceReady=function(){me.initializeGigya();};var onError=function(){GediSocial.setGigyaBlocked();} GediSocial.interface.loadGigya(onGigyaServiceReady,onError);},loadGigya:function(onGigyaServiceReady,onError){if(GediSocial.settings.gigya.load){if(!window.gigya||!window.gigya.socialize||!window.gigya.accounts){window.onGigyaServiceReady=function(serviceName){if(serviceName!='socialize')return;onGigyaServiceReady();} var gigyaSrc=GediSocial.settings.gigya.sdk+'?apikey='+escape(GediSocial.settings.gigya.appId)+'&lang=it-IT';(function(d){var js;js=d.createElement('script');js.async=true;js.src=gigyaSrc;js.text=JSON.stringify(GediSocial.settings.gigya.conf);if(onError) js.onerror=onError;d.getElementsByTagName('head')[0].appendChild(js);}(document));}else{window.onGigyaServiceReady('socialize');}}},loadRecaptcha:function(hide=true,onLoad=null,onError=null){if(hide){var css='.grecaptcha-badge { visibility: hidden; }',head=document.head||document.getElementsByTagName('head')[0],style=document.createElement('style');head.appendChild(style);style.type='text/css';style.appendChild(document.createTextNode(css));} (function(d){var recaptchaSrc=GediSocial.settings.recaptcha.sdk+'?render='+GediSocial.settings.recaptcha.public_key;var js;js=d.createElement('script');js.async=true;js.src=recaptchaSrc;d.getElementsByTagName('head')[0].appendChild(js);}(document));},initializeGigya:function(){var me=this;if(GediSocial.status.gigya.blocked!==undefined)return;GediSocial.status.gigya.blocked=false;try{GediSocial.logger.log('Gigya initialized');GediSocial.utils.setOriginUrl();me.addEventHandlers()}catch(e){GediSocial.logger.error(e);}},checkAccount:function(response){var me=GediSocial.interface;GediSocial.status.gigya.response=response;if(GediSocial.utils.isApp()) me.renderAccountViewMobile(response);else me.renderAccountViewDesktop(response);window.filters.exec("GediSocial.checkAccount.done",response);},renderAccountViewDesktop:function(response){var me=GediSocial.interface;if(me.isLogged(response)){GediSocial.status.gigya.logged=true;GediSocial.status.gigya.uid=response.UID;GediSocial.status.gigya.lastlogin=response.lastLogin;document.body.classList.add("logged");me.loadJWT();if(GediSocial.settings.view.render){if(!GediSocial.status.gigya.gacProcessing){me.renderAccountLogged(response);} me.renderProfileLogged(false);me.checkCustomerBase(GediSocial.settings.service,response);me.checkDoubleNick(response);me.checkUsername(response);cookieHelpDesk=GediSocial.utils.getCookie('helpdesk');parts=location.hostname.split('.');sndleveldomain=parts.slice(-2).join('.');if(pageType=='dettaglio_altro'&&(parts.slice(-3).join('.')=='quotidiano.repubblica.it')){me.blockProfile(response);} if((sndleveldomain=='repubblica.it')&&(!cookieHelpDesk||cookieHelpDesk=='false')){me.checkDevice(response);me.checkAuthDevice(response);} GediSocial.utils.setOriginUrl();}}else{me.deleteJWT();if(GediSocial.settings.view.render){if(!GediSocial.status.gigya.gacProcessing){me.renderAccountNotLogged(response);}}}},renderAccountViewMobile:function(response){GediSocial.settings.gigya.jwt.expiration=8035200;var me=GediSocial.interface;if(me.isLogged(response)){GediSocial.status.gigya.logged=true;GediSocial.status.gigya.uid=response.UID;GediSocial.status.gigya.lastlogin=response.lastLogin;document.body.classList.add("logged");me.loadJWT();if(GediSocial.settings.view.render){me.renderProfileLogged(false);me.checkCustomerBase(GediSocial.settings.service,response);cookieHelpDesk=GediSocial.utils.getCookie('helpdesk');parts=location.hostname.split('.');sndleveldomain=parts.slice(-2).join('.');if((sndleveldomain=='repubblica.it')&&(!cookieHelpDesk||cookieHelpDesk=='false')){me.checkDevice(response);}}} GediSocial.interface.extendExpireCookieJWT();},isLogged:function(response){return(response&&(response.operation=='/accounts.getAccountInfo'||response.operation=='getUserInfo')&&((!response.errorCode&&!GediSocial.utils.isNull(response.UID))||(response.errorCode&&response.errorCode===0)))},loginDone:function(response){return(response&&response.fullEventName=='accounts.login'&&!GediSocial.utils.isNull(response.UID))},logoutDone:function(response){return(response&&response.fullEventName=='accounts.logout'&&GediSocial.utils.isNull(response.UID))},showScreenSet:function(page){page=(!GediSocial.utils.isNull(page))?page:'login';var params=GediSocial.settings.gigya.screenSets[page];gigya.accounts.showScreenSet(params);},showScreenSetProfile:function(){GediSocial.interface.renderProfileLogged(true);},hideScreenSet:function(page){page=(!GediSocial.utils.isNull(page))?page:'login';var params=GediSocial.settings.gigya.screenSets[page];gigya.accounts.hideScreenSet(params);},hideScreenSetProfile:function(){var params=GediSocial.settings.gigya.screenSets.profile;gigya.accounts.hideScreenSet(params);},checkAccountInfo:function(response){gigya.accounts.getAccountInfo({callback:GediSocial.interface.checkAccount});},setGac:async function(response){if(!GediSocial.utils.isApp()){if(GediSocial.settings.gac_service&&!GediSocial.utils.isEmptyString(GediSocial.settings.gac_service)){if(GediSocial.status.gigya.gacProcessing){return;} GediSocial.status.gigya.gacProcessing=true;const gac_request=new XMLHttpRequest();gac_request.open("POST",GediSocial.settings.gac_service+'?uid='+response.UID,false);gac_request.send(null);GediSocial.debugger.kibana({'action':'setGac'},response);if(gac_request.status===200){GediSocial.debugger.kibana({'action':'refreshUI'},response);await new Promise((resolve)=>{gigya.socialize.refreshUI({callback:function(resp){GediSocial.status.gigya.gacProcessing=false;GediSocial.utils.gltOverwritten();if(!GediSocial.status.gigya.initialized) GediSocial.interface.checkAccountInfo(resp);resolve();}});});}else{GediSocial.status.gigya.gacProcessing=false;}}}},onGigyaHandlers:async function(response){var me=GediSocial.interface;if(me.loginDone(response)){if(!GediSocial.status.gigya.gacProcessing){await me.setGac(response);var cbAutologin=function(){GediSocial.debugger.kibana({'action':'autologin'},response);var reload_cb=function(){if(GediSocial.settings.handlers.autologin_cb!=null&&typeof GediSocial.settings.handlers.autologin_cb==='function'){GediSocial.settings.handlers.autologin_cb();}else if(GediSocial.settings.handlers.reload==true){GediSocial.status.handlers.reload._running=true;if(!GediSocial.utils.isAppNew()){window.location.reload();}}} if(!GediSocial.utils.isNull(GediSocial.utils.getCookie(GediSocial.settings.gigya.jwt.cookieName))){reload_cb();}else{window.filters.add("GediSocial.getJWT.done",reload_cb);} window.filters.exec("GediSocial.login.done",response);} GediSocial.interface.setDataLogin(response,cbAutologin);}} if(me.logoutDone(response)){GediSocial.debugger.kibana({'action':'autologout'});GediSocial.interface.deleteJWT();GediSocial.settings.gigya.screenSets.sessions_params.push=('source_reg');GediSocial.utils.setOriginUrl('logout');productLam=sessionStorage.getItem('productLam') if(productLam){sessionStorage.removeItem("productLam");} cacheLamb=sessionStorage.getItem('cacheLamb') if(cacheLamb){sessionStorage.removeItem("cacheLamb");} window.filters.exec("GediSocial.logout.done",response);if(GediSocial.settings.handlers.autologout_cb!=null&&typeof GediSocial.settings.handlers.autologout_cb==='function'){GediSocial.settings.handlers.autologout_cb();}else if(GediSocial.settings.handlers.reload==true){GediSocial.status.handlers.reload._running=true;if(!GediSocial.utils.isAppNew()){window.location.reload();}}else{GediSocial.interface.renderAccountNotLogged(response);}}},ssoLogin:function(params={}){GediSocial.utils.deepExtend(GediSocial.settings.gigya.loginParams,params);GediSocial.interface.cleanSettings();gigya.sso.login(GediSocial.settings.gigya.loginParams);},logout:function(params={}){GediSocial.debugger.kibana({'action':'logout'});let defaultParams={forceProvidersLogout:false,callback:GediSocial.interface.checkAccount};if(params&&!GediSocial.utils.isNull(params)) defaultParams=GediSocial.utils.deepExtend(defaultParams,params);GediSocial.interface.deleteJWT();gigya.accounts.logout(defaultParams);},renderAccountLogged:function(response){if(GediSocial.status.handlers.reload._running==false){if(GediSocial.settings.view.login&&!GediSocial.utils.isNull(GediSocial.settings.view.login.logged)){var element=document.getElementById(GediSocial.settings.view.login.containerID);GediSocial.settings.view.login.logged(element,response);}else{var element=document.getElementById(GediSocial.settings.view.default.containerID);let profile=response.profile.nickname?response.profile.nickname:response.profile.firstName+' '+response.profile.lastName if(element){element.textContent='';element.innerHTML='Ciao '+profile+'! Ti sei appena loggato!
logout';element.onclick=function(){GediSocial.interface.logout();return false;}}else{console.log('no div container')}}}},renderAccountNotLogged:function(response){if(GediSocial.settings.view.login&&!GediSocial.utils.isNull(GediSocial.settings.view.login.notLogged)){var element=document.getElementById(GediSocial.settings.view.login.containerID);GediSocial.settings.view.login.notLogged(element);}else{var element=document.getElementById(GediSocial.settings.view.default.containerID);if(!GediSocial.utils.isNull(element)){element.innerHTML="login";element.onclick=function(){GediSocial.interface.ssoLogin();};}}},renderAccountNotLoggedPW:function(response){if(GediSocial.settings.view.pw&&!GediSocial.utils.isNull(GediSocial.settings.view.login.notLoggedPW)){var element=document.getElementById(GediSocial.settings.view.pw.containerID);GediSocial.settings.view.login.notLoggedPW(element);}else{var element=document.getElementById(GediSocial.settings.view.pw.containerID);var hPWLogin=document.createElement('h2');var aPWLogin=document.createElement('a');aPWLogin.setAttribute('class','ls-logged-profile');aPWLogin.innerHTML='Accedi';aPWLogin.onclick=function(){GediSocial.interface.ssoLogin({redirectURL:window.location.href});};aPWLogin.style.cssText+='color:#4297b5 !important; font-weight:normal !important;cursor:pointer';hPWLogin.style.cssText+='text-align:center !important; font-size:20px !important; font-weight:normal !important;';var tPWLogin=document.createTextNode("Sei già abbonato? ");hPWLogin.append(tPWLogin);hPWLogin.append(aPWLogin);element.append(hPWLogin);element.style.cssText+='margin-top: -55px !important;';}},renderProfileLogged:function(show){GediSocial.settings.gigya.screenSets.profile=GediSocial.utils.deepExtend(GediSocial.settings.gigya.screenSets.profile,GediSocial.settings.view.profile);var element=document.getElementById(GediSocial.settings.gigya.screenSets.profile.containerID);if((typeof(show)=='undefined'||show)||!GediSocial.utils.isNull(element)){var me=GediSocial.interface;me.showScreenSet('profile');}},addEventHandlers:function(){gigya.accounts.addEventHandlers({onLogin:GediSocial.interface.onGigyaHandlers,onLogout:GediSocial.interface.onGigyaHandlers});if(!GediSocial.status.gigya.initialized) GediSocial.interface.checkAccountInfo();},loadJWT:function(callback=null,params={}){if(GediSocial.status.gigya.logged){GediSocial.interface.refreshJWT(callback,params);setInterval(function(){GediSocial.interface.refreshJWT(callback,params);},GediSocial.settings.gigya.jwt.refreshCheck);}else{GediSocial.utils.removeLocalstorage(GediSocial.settings.gigya.jwt.localStorageEXP);}},blockProfile:function(response){if(response.UID=='7d17b3f15a8e4316a3f914babeb0784d'||response.UID=='de3f896ac37d46a593da150b2bc4f477'||response.UID=='2432fa0d1f51458eabebc8a3e421a7d6'){window.location.replace('https://www.repubblica.it/clp/accounts/sites/repubblica/nazionale/404_anonimo.php')}},checkDoubleNick:async()=>{var blaize=GediSocial.utils.getCookie(GediSocial.settings.gigya.jwt.cookieName);if(!GediSocial.utils.isNull(blaize)){var url='https://scripts.kataweb.it/viafoura/gigya-cookie-validator/index2.php/?blaize='+blaize;const response=await fetch(url);}},checkUsername:function(){var placeholder='-review';if(GediSocial.status.gigya.logged&&GediSocial.status.gigya.response.profile.nickname&&GediSocial.status.gigya.response.profile.nickname.endsWith(placeholder)){new Promise(resolve=>setTimeout(resolve,5000)).then(()=>{var t=new XMLHttpRequest;t.onreadystatechange=function(e){if(4===t.readyState&&200===t.status){var pcontainer=document.createElement('div');pcontainer.setAttribute('id','nicknameWidgetOverlay');pcontainer.innerHTML=t.responseText;document.body.appendChild(pcontainer);document.querySelector("#overlayNickname").showModal();document.getElementById('account-nickname').innerText=GediSocial.status.gigya.response.profile.nickname.replace(placeholder,'');closedialog=document.querySelector(".widget__overlay__close");closedialog.addEventListener("click",()=>{document.querySelector(".widget__overlay").close() var params={profile:{nickname:GediSocial.status.gigya.response.profile.nickname.replace(placeholder,'')}} gigya.accounts.setAccountInfo(params);GediSocial.status.gigya.response.profile.nickname=params.profile.nickname;GediSocial.interface.renderAccountLogged(GediSocial.status.gigya.response);});}};t.open("GET","https://www.repstatic.it/cless/common/widget/overlay/2023-v1/include/nickname.html");t.send();});}},checkDevice:function(response){if(!(typeof GediSocial.settings.view.userAgent!=='undefined'&&GediSocial.settings.view.userAgent.includes('gd-facet-webview'))){sessionTime=sessionStorage.getItem('cacheLamb');currentTime=Date.now();if(!sessionTime){sessionTime=currentTime;sessionStorage.setItem('cacheLamb',currentTime);} var diffTime=currentTime-sessionTime;var minutesDifference=Math.floor(diffTime/1000/60);var cookie_blz=GediSocial.utils.getCookie(GediSocial.settings.gigya.jwt.cookieName);jwt=GediSocial.utils.parseJwt(cookie_blz);device_jwt=jwt['data.device'];if((device_jwt!=response.data.device)||((typeof(device_jwt)==='undefined'))||(minutesDifference>'5')||(!sessionTime)||(pageType=="device")||(typeof pageDevice!=='undefined'&&pageDevice===true)){if(response.errorCode===0){var deviceapn;gid=response.UID;const lamGetDevice='https://ws.login.gedidigital.it/apn/get_devices?op=get&gigya_id='+gid;try{fetch(lamGetDevice).then(call=>{if(!call.ok){throw new Error('KO');} return call.json();}).then(data=>{deviceapn=data;let deviceSession=new Date();var deviceUUID=new DeviceUUID().get();var devicePlatform=new DeviceUUID().getPlatform(window.navigator.userAgent);var deviceOS=new DeviceUUID().getOS(window.navigator.userAgent);var deviceBrowser=new DeviceUUID().getBrowser(window.navigator.userAgent);let listdevices=(response.data.devices)?JSON.parse(response.data.devices):[];listdevices=listdevices.concat(deviceapn.filter(({uuid})=>!listdevices.find(f=>f.uuid==uuid)));listdevices.sort(function(a,b){return new Date(a.startdate)-new Date(b.startdate)}) let device;let deviceIndex=listdevices.findIndex((device)=>device.uuid==deviceUUID);if(deviceIndex==-1){listdevices.push({"uuid":deviceUUID,"startdate":deviceSession,"platform":devicePlatform,"os":deviceOS,"browser":deviceBrowser,"useragent":GediSocial.settings.view.userAgent,});device=listdevices.length;}else{device=(deviceIndex+1);} gigya.accounts.setAccountInfo({data:{device:device,devices:JSON.stringify(listdevices)},callback:function(res){if(res.errorCode===0){gigya.accounts.getAccountInfo({callback:function(getResp){if(getResp.errorCode===0){if((typeof(device_jwt)==='undefined')||(device_jwt!=getResp.data.device)){localStorage.setItem('gediaccounts_jwt_exp',0);GediSocial.interface.refreshJWT();}}}});}}});}).catch(error=>{console.error('Error:',error);});}catch(err){}} sessionStorage.setItem('cacheLamb',currentTime);}}},removeDeviceCbk(){gigya.accounts.getAccountInfo({callback:function(getResp){if(getResp.errorCode===0){var cookie_blz=GediSocial.utils.getCookie(GediSocial.settings.gigya.jwt.cookieName);jwt=GediSocial.utils.parseJwt(cookie_blz);device_jwt=jwt['data.device'];if((typeof(device_jwt)==='undefined')||(device_jwt!=getResp.data.device)){localStorage.setItem('gediaccounts_jwt_exp',0);GediSocial.interface.refreshJWT();}}}});},checkProduct:async function(gigya_id){productLam=sessionStorage.getItem('productLam') if(productLam){product=JSON.parse(productLam);return product;}else{var url='https://ws.login.gedidigital.it/apn/get_devices?op=checkSku&gigya_id='+gigya_id;const result=await fetch(url);const product=await result.json();if(product){sessionStorage.setItem("productLam",JSON.stringify(product));} return product}},removeDevice:async function(type,deviceUUID,os,all){let userDevices;let device;var lastDate;let response=GediSocial.status.gigya.response;let devices=(response.data.devices)?JSON.parse(response.data.devices):[];let deviceIndex=devices.findIndex((device)=>device.uuid==deviceUUID);cookieHelpDesk=GediSocial.utils.getCookie('helpdesk');var currentDate=new Date().getTime();if(response.data.lastremovedevice){const date=new Date(response.data.lastremovedevice);year=date.getFullYear();month=date.getMonth();if(year==2025&&(month==5||month==4)){var undefined;GediSocial.status.gigya.response.data.lastremovedevice=undefined;} lastDate=response.data.lastremovedevice;var difference=currentDate-lastDate;var daysDifference=Math.floor(difference/1000/60/60/24);rDayDifference=30-daysDifference;} if(deviceIndex!=-1){if((!(product.sku==='repubblica-quotidiano_adv1'&&daysDifference<=30))||(cookieHelpDesk||cookieHelpDesk==true)){if(type!='mobile'){devices.splice(deviceIndex,1);userDevices=JSON.stringify(devices);}else{const lamGetDevice='https://ws.login.gedidigital.it/apn/get_devices?op=removeDevice&device='+deviceUUID+'&os='+os+'&gigya_id='+response.UID;const result=await fetch(lamGetDevice);if(result.status=='200'){devices.splice(deviceIndex,1);userDevices=JSON.stringify(devices);}} var mydevice=new DeviceUUID().get();device=devices.findIndex((device)=>device.uuid==mydevice)+1;if(devices.length<=1&&(!cookieHelpDesk||cookieHelpDesk=='false')){var params={data:{devices:userDevices,device:device,lastremovedevice:currentDate,}} GediSocial.status.gigya.response.data.lastremovedevice=params.data.lastremovedevice;}else{var params={data:{devices:userDevices,device:device,}}} gigya.accounts.setAccountInfo(params);GediSocial.status.gigya.response.data.devices=params.data.devices;GediSocial.status.gigya.response.data.device=params.data.device;if(all!='y'){localStorage.setItem('gediaccounts_jwt_exp',0);GediSocial.interface.refreshJWT();}}else{document.getElementById('error-device').innerText='';document.getElementById('error-device').innerText='Potrai rimuovere il tuo dispositivo tra '+rDayDifference+' giorni.';}}},removeAllDevice:async function(){let response=GediSocial.status.gigya.response;var currentDate=new Date().getTime();cookieHelpDesk=GediSocial.utils.getCookie('helpdesk');if(response.data.lastremovedevice){const date=new Date(response.data.lastremovedevice);year=date.getFullYear();month=date.getMonth();if(year==2025&&(month==5||month==4)){var undefined;GediSocial.status.gigya.response.data.lastremovedevice=undefined;} lastDate=response.data.lastremovedevice;var difference=currentDate-lastDate;var daysDifference=Math.floor(difference/1000/60/60/24);rDayDifference=30-daysDifference;} const product=await GediSocial.interface.checkProduct(response.UID);let devices=(response.data.devices)?JSON.parse(response.data.devices):[];var mydevice=new DeviceUUID().get();if((!(product.sku==='repubblica-quotidiano_adv1'&&daysDifference<=30))||(cookieHelpDesk||cookieHelpDesk==true)){for(i=0;i'3'||(!modalTime)){const product=await GediSocial.interface.checkProduct(response.UID) if(product.sku=='repubblica-sito-premium'||product.sku=='repubblica-sito-smart'||product.sku=='repubblica-quotidiano-we'||product.sku=='repubblica-quotidiano'||product.sku=='repubblica-sito-premium_adv1'||product.sku=='repubblica-quotidiano_adv1'||product.sku=='repubblica-quotidiano-we_adv1'){deviceEnable=product.devices_num;device=JSON.parse(response.data.devices);if(device.length>deviceEnable&&pageType!="device"){new Promise(resolve=>setTimeout(resolve,5000)).then(()=>{var xhttp=new XMLHttpRequest();xhttp.onreadystatechange=function(){if(xhttp.readyState==4&&xhttp.status==200){var pcontainer=document.createElement('div');pcontainer.setAttribute('id','devicesWidgetOverlay');pcontainer.innerHTML=xhttp.responseText;document.body.appendChild(pcontainer);document.querySelector("#overlayDevices").showModal();sessionStorage.setItem('modalTime',currentDate);}};xhttp.open("GET","https://www.repstatic.it/cless/common/widget/overlay/2023-v1/include/devices.html");xhttp.send();});}}}}},checkProfileComplete:function(response){if(response.errorCode===0){name=GediSocial.status.gigya.response.profile.firstName;lastname=GediSocial.status.gigya.response.profile.lastName;if(!lastname||name=='undefined'){var completationParams={screenSet:'GEDI-CLP-RegistrationLogin',startScreen:'gigya-complete-name-screen',} gigya.accounts.showScreenSet(completationParams);}}},checkCustomerBase:function(testata,response){try{let externalData={};let exDataJson={};var update=false;var addService=false;if(response.data&&response.data.externalData){externalData=response.data.externalData;let exDataStr=externalData.replaceAll('\'','"');exDataJson=JSON.parse(exDataStr);if(exDataJson["SSOListServiceSubTS"]){if(typeof exDataJson.SSOListServiceSubTS=='string'){update=true;exDataJson.SSOListServiceSubTS=JSON.parse(exDataJson.SSOListServiceSubTS);} let cloneExDataJson=JSON.parse(JSON.stringify(exDataJson.SSOListServiceSubTS));for(index in exDataJson.SSOListServiceSubTS){if(exDataJson.SSOListServiceSubTS[index]==null||exDataJson.SSOListServiceSubTS[index]==undefined||exDataJson.SSOListServiceSubTS[index]=='undefined'||exDataJson.SSOListServiceSubTS[index].serviceId==null){update=true;cloneExDataJson.splice(index,1);}} if(update) exDataJson.SSOListServiceSubTS=cloneExDataJson;if(!exDataJson.SSOListServiceSubTS.filter((item)=>item.serviceId==testata).length){addService=true;update=true;}} else{exDataJson.SSOListServiceSubTS=[];update=true;}} else{exDataJson.SSOListServiceSubTS=[];update=true;} if(update){if(addService){let datetime=GediSocial.utils.getDatetime();let custBaseElem={"serviceId":testata,"subscriptionTS":datetime,"refreshLoginTS":datetime};exDataJson.SSOListServiceSubTS.push(custBaseElem);} exDataStr=JSON.stringify(exDataJson);let data={"externalData":exDataStr};let setAccountParam={callback:GediSocial.interface.setAccountInfoResponse,data} gigya.accounts.setAccountInfo(setAccountParam);}}catch(err){console.log("Errore:"+err.message);} return false;},setDataLogin:function(response,cb=null){try{let callback=(cb!=null)?cb:GediSocial.interface.setAccountInfoResponse;let data={"login":Date.now()};let setAccountParam={callback,data} gigya.accounts.setAccountInfo(setAccountParam);}catch(err){console.log("Errore:"+err.message);} return false;},setDataRefreshLogin:function(response=null,cb=null){try{let callback=(cb!=null)?cb:GediSocial.interface.setAccountInfoResponse;let data={"refreshLogin":Date.now()};let exDataJson=JSON.parse(GediSocial.status.gigya.response.data.externalData.replaceAll('\'','"'));if(exDataJson["SSOListServiceSubTS"]){for(index in exDataJson.SSOListServiceSubTS){if(exDataJson.SSOListServiceSubTS[index].serviceId==GediSocial.settings.service){exDataJson.SSOListServiceSubTS[index].refreshLoginTS=GediSocial.utils.getDatetime();exDataStr=JSON.stringify(exDataJson);data.externalData=exDataStr;}}} let setAccountParam={callback,data} gigya.accounts.setAccountInfo(setAccountParam);}catch(err){console.log("Errore:"+err.message);} return false;},setAccountInfoResponse:function(response){if(response.errorCode==0){console.log("setAccountInfoResponse OK");} else{console.log("setAccountInfoResponse FAIL!!!");}},isDebug:function(){var field='kwdebug';var url=window.location.href;return(url.indexOf('?'+field+'=true')!=-1);},getJWTApp:function(callback,params){GediSocial.debugger.kibana({'action':'getJWTApp'});GediSocial.interface.getJWT(callback,params);},getJWT:function(callback=null,params={}){if(!GediSocial.status.gigya.jwt._running){GediSocial.status.gigya.jwt._running=true;GediSocial.utils.removeLocalstorage(GediSocial.settings.gigya.jwt.localStorageEXP);function cb(response){GediSocial.status.gigya.jwt._running=false;GediSocial.interface.saveJWT(response);window.filters.exec("GediSocial.getJWT.done",response);if(callback)callback(response);} var parameters={"callback":cb,"fields":'profile.email, profile.lastName, profile.firstName, profile.nickname,profile.photoURL, data.selected, data.selected_repubblica, data.selected_huffingtonpost, data.selected_lastampa, data.device, data.trial_start_date, data.trial_end_date,preferences.REPUBBLICA_TRIAL.isConsentGranted',"expiration":GediSocial.settings.gigya.jwt.expiration};if(!GediSocial.utils.isObjectNull(params))parameters=GediSocial.utils.deepExtend(parameters,params);gigya.accounts.getJWT(parameters);}},saveJWT:function(response){if(response!=null&&!GediSocial.utils.isObjectNull(response)&&response.errorCode!=null&&response.errorCode==0&&!GediSocial.utils.isNull(response.id_token)&&typeof response.id_token!='undefined'&&response.id_token!='undefined'&&response.id_token!=null&&!GediSocial.utils.isObjectNull(jwt=GediSocial.utils.parseJwt(response.id_token))){if(typeof jwt.sub!=='string'){GediSocial.debugger.kibana({'action':'gigya.jwt_SUB_ERROR','response':response});} var cookieName=GediSocial.settings.gigya.jwt.cookieName;var cookieDomain=(!GediSocial.utils.isNull(GediSocial.settings.gigya.jwt.cookieDomain))?GediSocial.settings.gigya.jwt.cookieDomain:null;var cookieExpires=GediSocial.settings.gigya.jwt.cookieExpires;var cookiePath=GediSocial.settings.gigya.jwt.cookiePath+';SameSite='+GediSocial.settings.gigya.jwt.cookieSameSite;var cookieSecure=GediSocial.settings.gigya.jwt.cookieSecure;GediSocial.interface.setDataRefreshLogin(response);GediSocial.utils.setCookie(cookieName,response.id_token,cookieExpires,cookieDomain,cookiePath,cookieSecure);GediSocial.utils.setLocalstorage(GediSocial.settings.gigya.jwt.localStorageEXP,jwt.exp);var ls_exp=GediSocial.utils.getLocalstorage(GediSocial.settings.gigya.jwt.localStorageEXP) GediSocial.debugger.kibana({'action':'login.jwt','jwt_exp':jwt.exp,'ls_exp':ls_exp});if(!(GediSocial.settings.handlers.reload===false)){if(!GediSocial.utils.isAppNew()){window.location.reload();}}}else{GediSocial.debugger.kibana({'action':'gigya.jwtERROR','response':response});}},extendExpireCookieJWT:function(){if(GediSocial.utils.isApp()&&!GediSocial.status.gigya.jwt._running){var cookieValue=GediSocial.utils.getCookie(GediSocial.settings.gigya.jwt.cookieName);if(!GediSocial.utils.isNull(cookieValue)){var jwt=GediSocial.utils.parseJwt(cookieValue);if(!GediSocial.utils.isNull(jwt)&&!GediSocial.utils.isNull(jwt.exp)){GediSocial.utils.setLocalstorage(GediSocial.settings.gigya.jwt.localStorageEXP,jwt.exp);var is_alive_jwt=Math.round((jwt.exp*1000)-Date.now());if(is_alive_jwt>0){var cookieExpires=(is_alive_jwt>86400000)?Math.round(((jwt.exp*1000)-Date.now())/(1000*60*60*24)):1;var cookieName=GediSocial.settings.gigya.jwt.cookieName;var cookieDomain=GediSocial.settings.gigya.jwt.cookieDomain;var cookiePath=GediSocial.settings.gigya.jwt.cookiePath+';SameSite='+GediSocial.settings.gigya.jwt.cookieSameSite;var cookieSecure=GediSocial.settings.gigya.jwt.cookieSecure;GediSocial.utils.setCookie(cookieName,cookieValue,cookieExpires,cookieDomain,cookiePath,cookieSecure);GediSocial.debugger.kibana({'action':'extendExpireCookieJWT','ls_exp':jwt.exp,'diff':cookieExpires});}else{GediSocial.debugger.kibana({'action':'extendExpireCookieJWT','ls_exp':jwt.exp,'diff':is_alive_jwt});}}}}},refreshJWT:function(callback=null,params={}){var ls_exp=GediSocial.utils.getLocalstorage(GediSocial.settings.gigya.jwt.localStorageEXP);var cookie_blz=GediSocial.utils.getCookie(GediSocial.settings.gigya.jwt.cookieName);if(GediSocial.utils.isNull(ls_exp)){if(!GediSocial.utils.isNull(cookie_blz)){var jwt=GediSocial.utils.parseJwt(cookie_blz);if(!GediSocial.utils.isNull(jwt)&&!GediSocial.utils.isNull(jwt.exp)){GediSocial.utils.setLocalstorage(GediSocial.settings.gigya.jwt.localStorageEXP,jwt.exp);ls_exp=jwt.exp;}}} if(!GediSocial.utils.isNull(ls_exp)&&ls_exp!='undefined'){if(!GediSocial.utils.isNull(cookie_blz)){var diff=new Date(new Date(ls_exp*1000).getTime()-new Date().getTime());var diffTime=diff.getTime();var torefresh=diffTime<=GediSocial.settings.gigya.jwt.refreshLimit;var jwt=GediSocial.utils.parseJwt(cookie_blz);if(torefresh||(GediSocial.status.gigya.uid!=jwt.sub)){GediSocial.debugger.kibana({'action':'refreshJWT','ls_exp':ls_exp,'diff':diff.getTime(),'torefresh':torefresh});GediSocial.interface.getJWT(callback,params);}}else{GediSocial.debugger.kibana({'action':'refreshJWT','ls_exp':ls_exp});GediSocial.interface.getJWT(callback,params);}}else{if(GediSocial.status.gigya.logged){GediSocial.debugger.kibana({'action':'refreshJWT'});GediSocial.interface.getJWT(callback,params);}} window.filters.exec("GediSocial.refreshJWT.done");},deleteJWT:function(params){if(!GediSocial.utils.isApp()){if(GediSocial.utils.issCheck()){var cookieDomain=(!GediSocial.utils.isNull(GediSocial.settings.gigya.jwt.cookieDomain))?GediSocial.settings.gigya.jwt.cookieDomain:null;var cookiePath=GediSocial.settings.gigya.jwt.cookiePath;GediSocial.utils.deleteCookie(GediSocial.settings.gigya.jwt.cookieName,-1,cookieDomain,cookiePath);GediSocial.utils.deleteCookie(GediSocial.settings.gigya.jwt.cookieNameSession,-1,'',cookiePath);GediSocial.utils.deleteCookie(GediSocial.settings.gigya.jwt.cookieNameTracking,-1,'',cookiePath);GediSocial.utils.deleteCookie(GediSocial.settings.gigya.jwt.cookieNameSession,-1,cookieDomain,cookiePath);GediSocial.utils.deleteCookie(GediSocial.settings.gigya.jwt.cookieNameTracking,-1,cookieDomain,cookiePath);GediSocial.utils.removeLocalstorage(GediSocial.settings.gigya.jwt.localStorageEXP);}}},cleanSettings:function(){}}} GediSocial.setGigyaBlocked=function(autologin){GediSocial.status.gigya.blocked=true;GediSocial.logger.log('Gigya blocked');} GediSocial.getLogger=function(context){var ret={log:function(){},error:function(){}};if(window.common&&common.logging){ret=common.logging.getLogger('SOCIAL');}else if(window.console){var ret={};if(window.console.log.bind) ret.log=window.console.log.bind(window.console,context);if(window.console.error.bind) ret.error=window.console.error.bind(window.console,context);if(!ret.log) ret.log=window.console.log;if(!ret.error) ret.error=window.console.error;} return ret;} GediSocial.initLogging=function(){if(window.common&&common.logging)common.logging.init();GediSocial.logger=GediSocial.getLogger('SOCIAL');};GediSocial.utils={} GediSocial.utils.isApp=function(){return(typeof window.facet!=='undefined'&&window.facet==='True');} GediSocial.utils.gltOverwritten=function(){if(typeof window.gltOverwritten==='function'){window.gltOverwritten();}} GediSocial.utils.isAppNew=function(){newapp=GediSocial.utils.getCookie('kw_tlh_wv_ver');return(typeof newapp!=='undefined'&&newapp==='rep_25_01');} GediSocial.utils.isStorageAvailable=function(){try{var storage=window['localStorage'],x='__storage_test__';storage.setItem(x,x);storage.removeItem(x);return true;} catch(e){return false;}} GediSocial.utils.isDevice=function(){var check=false;(function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))check=true;})(navigator.userAgent||navigator.vendor||window.opera);return check;} GediSocial.utils.isNull=function(v){return!(typeof(v)!='undefined')||!v;} GediSocial.utils.isObjectNull=function(v){return GediSocial.utils.getObjectLength(v)==0;} GediSocial.utils.getObjectLength=function(obj){var size=0,key;for(key in obj){size++;} return size;} GediSocial.utils.isEmptyString=function(v){return!(!GediSocial.utils.isNull(v)&&v.trim()!='');} GediSocial.utils.parseJwt=function(token){if(!GediSocial.utils.isNull(token)){try{var base64Url=token.split('.')[1];var base64=base64Url.replace(/-/g,'+').replace(/_/g,'/');var jsonPayload=decodeURIComponent(atob(base64).split('').map(function(c){return'%'+('00'+c.charCodeAt(0).toString(16)).slice(-2);}).join(''));return JSON.parse(jsonPayload);}catch(e){}} return{};} GediSocial.utils.serializeJSON=function(json,text=''){try{for(var key in json){var item=json[key];if(typeof item==="object"){if(typeof key==="string") key=key.replace(/'/g,'"');text+='||||STARTOBJECT||'+key+':';text+=GediSocial.utils.serializeJSON(item)+':'+key+'||ENDOBJECT||';}else{if(typeof key==="string") key=key.replace(/'/g,'"');if(typeof item==="string") item=item.replace(/'/g,'"');if(typeof item==="function"){item='function()';} text+='||'+key+' - '+item;}}}catch(e){} return text;} GediSocial.utils.issCheck=function(){var token=GediSocial.utils.getCookie(GediSocial.settings.gigya.jwt.cookieName);if(!GediSocial.utils.isNull(token)){var ret=GediSocial.utils.parseJwt(token) if(!GediSocial.utils.isNull(ret)&&ret.iss==GediSocial.settings.gigya.gateway+GediSocial.settings.gigya.appId+'/'){return true;}} return false;} GediSocial.utils.setLocalstorage=function(key,value){try{localStorage.setItem(key,value);}catch(e){}} GediSocial.utils.getLocalstorage=function(key){try{return localStorage.getItem(key);}catch(e){} return null;} GediSocial.utils.removeLocalstorage=function(key){try{return localStorage.removeItem(key);}catch(e){}} GediSocial.utils.getDatetime=function(){let datetime=null;try{let dt=new Date() let year=dt.getFullYear().toString().padStart(4,'0');let month=(dt.getMonth()+1).toString().padStart(2,'0');let day=dt.getDate().toString().padStart(2,'0');let hours=dt.getHours().toString().padStart(2,'0');let minutes=dt.getMinutes().toString().padStart(2,'0');let seconds=dt.getSeconds().toString().padStart(2,'0');datetime=year+'-'+month+'-'+day+' '+hours+':'+minutes+':'+seconds;}catch(e){} return datetime;} GediSocial.utils.deepExtend=function(out){out=out||{};for(var i=1;i1&&String(b)!=="[object Object]"){c=GediSocial.utils.deepExtend({},c);if(b===null||b===undefined){c.expires=-1;} if(typeof c.expires==="number"){var d=c.expires,e=(c.expires=new Date());e.setDate(e.getDate()+d);} b=String(b);return(document.cookie=[encodeURIComponent(a),"=",c.raw?b:encodeURIComponent(b),c.expires?"; expires="+c.expires.toUTCString():"",c.path?"; path="+c.path:"",c.domain?"; domain="+c.domain:"",c.secure?"; secure":"",].join(""));} c=b||{};var f,g=c.raw?function(a){return a;}:decodeURIComponent;return(f=new RegExp("(?:^|; )"+encodeURIComponent(a)+"=([^;]*)").exec(document.cookie))?g(f[1]):null;} GediSocial.utils.setCookie=function(name,value,days,domain,path,secure){if(!GediSocial.utils.isNull(name)&&!GediSocial.utils.isNull(value)){try{var params={};if(!GediSocial.utils.isNull(days)&&((typeof days==='number')||(typeof days.getMonth==='function'))) params.expires=days;if(!GediSocial.utils.isNull(domain)) params.domain=domain;if(!GediSocial.utils.isNull(path)) params.path=path;if(!GediSocial.utils.isNull(secure)) params.secure=secure;return GediSocial.utils.cookie(name,value,params);}catch(e){GediSocial.logger.log('ATTENZIONE! COOKIE NON SALVATO!');}}else{return false;}} GediSocial.utils.deleteCookie=function(name,expires,domain,path){GediSocial.utils.cookie(name,'',{expires:-1,domain:domain,path:path});} GediSocial.utils.removeURLParameters=function(url,parameters){let url_cleaned=url;for(parameter in parameters){url_cleaned=GediSocial.utils.removeURLParameter(url_cleaned,parameters[parameter]);} return url_cleaned;} GediSocial.utils.removeURLParameter=function(url,parameter){var urlparts=url.split('?');if(urlparts.length>=2){var prefix=encodeURIComponent(parameter)+'=';var pars=urlparts[1].split(/[&;]/g);for(var i=pars.length;i-->0;){let pars_indx=pars[i].lastIndexOf(prefix,0);if(pars_indx!==-1){pars.splice(i,1);}} return urlparts[0]+(pars.length>0?'?'+pars.join('&'):'');} return url;} GediSocial.utils.getURLParameter=function(parameter){var queryString=window.location.search;var searchParams=new URLSearchParams(queryString);if(searchParams.has(parameter)===true){return searchParams.get(parameter);} return null;} GediSocial.utils.setOriginUrl=function(custom_params=null){if(!GediSocial.utils.isApp()&&window.location.pathname.split('/')[6]!='slogin.php'){if(custom_params=='logout'){var logoutParams=new URLSearchParams(window.location.search);logoutParams.set('logout','true');if(!GediSocial.utils.isAppNew()){window.history.pushState(null,null,'?'+logoutParams);}else{window.history.replaceState(null,null,'?'+logoutParams);}}else{let paramsFounded=false;if(GediSocial.status.gigya.logged==true){GediSocial.settings.gigya.screenSets.sessions_params.push=('logout');if(GediSocial.status.gigya.response.registeredTimestamp==GediSocial.status.gigya.response.lastLoginTimestamp){if(sreg){var searchParams=new URLSearchParams(window.location.search);searchParams.set('source_reg',nparams);if(!GediSocial.utils.isAppNew()){window.history.pushState(null,null,'?'+searchParams);}else{window.history.replaceState(null,null,'?'+searchParams);}}}} let params=(custom_params!=null)?custom_params:GediSocial.settings.gigya.screenSets.sessions_params;for(session_param in params){if(GediSocial.utils.getURLParameter(params[session_param])!=null){paramsFounded=true;} if(GediSocial.utils.getURLParameter('gig_source_reg')!=null){let=sreg=true;nparams=GediSocial.utils.getURLParameter('gig_source_reg');}else{let=sreg=false;}} if(paramsFounded){let url=GediSocial.utils.removeURLParameters(window.location.href,params);if(!GediSocial.utils.isAppNew()){window.history.pushState(null,"",url);}else{window.history.replaceState(null,"",url);}}}}} GediSocial.initLogging();GediSocial.interface=GediSocial.interfaces.standard;GediSocial.debugger={settings:{kibana:{url:'https://logger.kataweb.it/',path:'genericweblogger/',prefix:'accounts_dbggr--',delimiter:'--',separator:'||'}},status:{uid:null,jwt_uid:null,jwt_exp:null,jwt_iss:null,brand:null,logged:false,lastlogin:null,login:false,logout:false,onlogin:false,onlogout:false,glt:false,blaize:false},isEnabled:function(){return(!GediSocial.utils.isNull(GediSocial.settings.logger)&&GediSocial.settings.logger);},kibana:function(params,response){if(this.isEnabled()){try{this.status.brand=(!GediSocial.utils.isNull(GediSocial.settings.gigya.loginParams.context)&&!GediSocial.utils.isNull(GediSocial.settings.gigya.loginParams.context.brand))?GediSocial.settings.gigya.loginParams.context.brand:'none';this.status.brand=(!GediSocial.utils.isNull(window.kw_tlh_testataLogin))?window.kw_tlh_testataLogin:this.status.brand;this.status.uid=GediSocial.status.gigya.uid;this.status.lastlogin=GediSocial.status.gigya.lastlogin;this.status.logged=true;this.status.glt=(!GediSocial.utils.isNull(GediSocial.utils.getCookie('glt_'+GediSocial.settings.gigya.appId)));var cookie_blz=GediSocial.utils.getCookie(GediSocial.settings.gigya.jwt.cookieName);if(!GediSocial.utils.isNull(cookie_blz)){var jwt=GediSocial.utils.parseJwt(cookie_blz);this.status.blaize=true;this.status.jwt_uid=jwt.sub;this.status.jwt_exp=jwt.exp;this.status.jwt_iss=jwt.iss;} if(!GediSocial.utils.isNull(response)){this.status.uid=response.UID} var msg=this.getMessage(params);var url=this.settings.kibana.url+this.settings.kibana.path+'?'+msg;var handler=new XMLHttpRequest();handler.open("GET",url,true);handler.send(null);return true;}catch(e){console.log(e);}}},getMessage:function(params){var ret=this.settings.kibana.prefix+this.settings.kibana.delimiter +'brand:'+this.status.brand+this.settings.kibana.delimiter;if(GediSocial.utils.isApp()) ret+='isApp:true'+this.settings.kibana.delimiter;else ret+='isApp:false'+this.settings.kibana.delimiter;ret+='uid:'+this.status.uid+this.settings.kibana.delimiter;if(this.status.logged){ret+='lastlogin:'+this.status.lastlogin+this.settings.kibana.delimiter;} ret+='action:'+params.action+this.settings.kibana.delimiter +'glt:'+this.status.glt+this.settings.kibana.delimiter +'blaize:'+this.status.blaize+this.settings.kibana.delimiter;if(params.action=='loadJWT'){ret+='ls_exp:'+params.ls_exp+this.settings.kibana.delimiter;} if(params.action=='gigya.jwtERROR'){var json_serialized=GediSocial.utils.serializeJSON(params.response);ret+='responseGigya:'+json_serialized+this.settings.kibana.delimiter;} if(this.status.blaize){ret+='jwt_uid:'+this.status.jwt_uid+this.settings.kibana.delimiter +'jwt_exp:'+this.status.jwt_exp+this.settings.kibana.delimiter +'jwt_iss:'+this.status.jwt_iss+this.settings.kibana.delimiter +'sessione_dirty:'+(this.status.jwt_uid!=this.status.uid)+this.settings.kibana.delimiter;} if(params.cookieExpires){ret+='cookieExpires:'+params.cookieExpires+this.settings.kibana.delimiter +'lastlogin:'+this.status.lastlogin+this.settings.kibana.delimiter;} if(params.ls_exp){ret+='ls_exp:'+params.ls_exp+this.settings.kibana.delimiter;if(params.diff) ret+='diff:'+params.diff+this.settings.kibana.delimiter;if(params.torefresh) ret+='torefresh:'+params.torefresh+this.settings.kibana.delimiter;} ret+="isdevice:"+this.isDevice()+this.settings.kibana.delimiter;ret+="isStorageAvailable:"+GediSocial.utils.isStorageAvailable()+this.settings.kibana.delimiter;ret+="device:"+encodeURIComponent(navigator.userAgent)+this.settings.kibana.delimiter;ret+="href:"+encodeURIComponent(window.location.href);return ret;},isDevice:function(){var check=false;(function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))check=true;})(navigator.userAgent||navigator.vendor||window.opera);return check;}};})();; (function(){RenderAccounts=function(){} RenderAccounts.BRAND="repubblica";RenderAccounts.APP_ID="3_1LA7c1Tgh8TOu8RyhRNltE6n6Avs4pEXj5bhyQNpnpC3KHJ60mcdJ6xOubYt6iUJ";RenderAccounts.BASEURL="https://www.repubblica.it/";RenderAccounts.BASEURL_EDICOLA="https://quotidiano.repubblica.it/";if(window.location.hostname=='desk.int.gedi.it'){RenderAccounts.COOKIE_NAME="blaize_jwt";RenderAccounts.COOKIE_DOMAIN=".gedi.it";}else if(window.location.hostname=='eventi.greenandblue.it'){RenderAccounts.COOKIE_NAME="blaize_jwt";RenderAccounts.COOKIE_DOMAIN=".greenandblue.it";}else{RenderAccounts.COOKIE_NAME="blaize_jwt";RenderAccounts.COOKIE_DOMAIN=".repubblica.it";} RenderAccounts.SERVICE="repubblica.it";RenderAccounts.FUNNEL_MANAGER_PW="https://quotidiano.repubblica.it/edicola/manager";RenderAccounts.FUNNEL_MANAGER_ERROR_PW="https://quotidiano.repubblica.it/edicola/errorerep.jsp";RenderAccounts.FUNNEL_ZONA_PW="rep";RenderAccounts.FUNNEL_SERVICE_PW="purchase";RenderAccounts.FUNNEL_SOURCE_PW="PWS_MOB";RenderAccounts.PW_PROVIDER_URL="https://www.awin1.com/awclick.php";RenderAccounts.PW_PROVIDER_GID="361875";RenderAccounts.PW_PROVIDER_MID="15069";RenderAccounts.PW_PROVIDER_AWINAFFID="578913";RenderAccounts.PW_PROVIDER_LINKID="2626126";RenderAccounts.FUNNEL_CATALOGO="https://quotidiano.repubblica.it/edicola/catalogogenerale.jsp";RenderAccounts.FUNNEL_CATALOGO_SOURCE="PWL_snodo";RenderAccounts.FUNNEL_CATALOGO_REF="sr-pwl";RenderAccounts.FUNNEL_ORIGIN_PREFIX="RIT_";RenderAccounts.FUNNEL_TOKEN_LOGIN="repnzfree";RenderAccounts.WT_ORIGIN_URL=encodeURIComponent((window.location.host+window.location.pathname).replace(/\./g,'_'));RenderAccounts.WT_GSA_CATALOGO='PWL_snodo.paywall.campagna_pwl.'+RenderAccounts.WT_ORIGIN_URL+'.ctaaltreoff.';RenderAccounts.renderAccountLogged=function(container,response){if(!GediSocial.utils.isNull((container))){var profile='https://www.repubblica.it/profilo/home/';var uName=(response.profile.nickname)?response.profile.nickname:response.profile.firstName;var socialThumb=(response.profile.photoURL)?response.profile.photoURL:'https://www.repstatic.it/cless/common/social/stable/img/repubblica/nazionale/placeholder-utente.png';if(GediSocial.utils.isNull(window.managerLoginInfo)) loggedViewSite(container,uName,socialThumb,undefined,profile);else loggedViewQuotidiano(container,uName,socialThumb,undefined,profile);}} var loggedViewSite=function(container,uName,socialThumb,logout,profile){if(typeof pageType!=='undefined'&&pageType!='dettaglio_altro2'){container.innerHTML='';var logged=document.createElement('span');logged.setAttribute('class','header-logged-label');logged.innerHTML=uName;container.append(logged);var icon=document.createElement('img');icon.setAttribute('class','header-logged-img');icon.setAttribute('src',socialThumb);icon.setAttribute('width','20px');container.append(icon);var menu=document.createElement('span');menu.setAttribute('class','header-logged-link');var cprofile=document.createElement('a');cprofile.setAttribute('class','header-logged-profile');cprofile.href=profile;cprofile.innerHTML='PROFILO';menu.append(cprofile);var clogout=document.createElement('a');clogout.setAttribute('class','header-logged-logout');clogout.innerHTML='ESCI';if(!logout){logout=function(){GediSocial.interface.logout();};} clogout.onclick=function(){logout();} menu.append(clogout);container.append(menu);container.onclick=function(){container.classList.toggle("open");};}else{container.innerHTML='';var details=document.createElement('details');details.setAttribute('class','user-menu');var userMenuToggle=document.createElement('summary');userMenuToggle.setAttribute('class','user-menu__toggle');details.append(userMenuToggle) var userMenuUsername=document.createElement('span');userMenuUsername.setAttribute('class','user-menu__username');userMenuUsername.innerHTML=uName;var icon=document.createElementNS('http://www.w3.org/2000/svg','svg');icon.setAttribute('class','icon');useElem=document.createElementNS('http://www.w3.org/2000/svg','use');if(window.screen.availWidth<='767'){useElem.setAttributeNS('http://www.w3.org/1999/xlink','href','#icon-user-mobile');}else{useElem.setAttributeNS('http://www.w3.org/1999/xlink','href','#icon-user');} icon.appendChild(useElem);userMenuToggle.append(userMenuUsername) userMenuToggle.append(icon) var menuContent=document.createElement('div');menuContent.setAttribute('class','user-menu__content');var menuUl=document.createElement('ul');menuUl.setAttribute('class','user-menu__nav');const menuItems=[{name:'I tuoi contenuti',link:'https://www.repubblica.it/profilo/i-tuoi-contenuti/'},{name:'Proposte per te',link:'https://www.repubblica.it/profilo/proposte-per-te/'},{name:'Il tuo abbonamento',link:'https://www.repubblica.it/profilo/il-tuo-abbonamento/'},{name:'I tuoi dati',link:'https://www.repubblica.it/profilo/i-tuoi-dati/'},{name:'Assistenza',link:'https://www.repubblica.it/profilo/faq-e-contatti/'}];const cprofile=document.createElement('li');const profilelabel=document.createElement('a');profilelabel.innerHTML='Home';profilelabel.href='https://www.repubblica.it/profilo/home/';cprofile.appendChild(profilelabel);menuUl.appendChild(cprofile);menuItems.forEach(item=>{const li=document.createElement('li');const a=document.createElement('a');a.href=item.link;a.textContent=item.name;li.setAttribute('class','hide-tablet hide-desktop');li.appendChild(a);menuUl.appendChild(li);});const clogout=document.createElement('li');const lablogout=document.createElement('a');lablogout.innerHTML='Esci';clogout.appendChild(lablogout);if(!logout){logout=function(){GediSocial.interface.logout();};} clogout.onclick=function(){logout();} menuUl.appendChild(clogout);menuContent.append(menuUl);details.append(menuContent);container.append(details);}} var loggedViewQuotidiano=function(container,uName,socialThumb,logout,profile){container.innerHTML='';var loggedId='ls-login-label-id';var logged=document.createElement('span');logged.setAttribute('class','ls-login-label');logged.setAttribute('id',loggedId);container.append(logged);var account=document.createElement('span');account.innerHTML=uName;logged.append(account);if(!GediSocial.utils.isNull(socialThumb)){var icon=document.createElement('img');icon.setAttribute('class','ls-logged-img');icon.setAttribute('src',socialThumb);}else{var icon=document.createElementNS('http://www.w3.org/2000/svg','svg'),useElem=document.createElementNS('http://www.w3.org/2000/svg','use');useElem.setAttributeNS('http://www.w3.org/1999/xlink','xlink:href','#repubblica-user');icon.appendChild(useElem);} logged.append(icon);var links=document.createElement('span');links.setAttribute('class','ls-logged-link');container.append(links);if(profile){var cprofile=document.createElement('a');cprofile.setAttribute('class','ls-logged-profile');cprofile.href=profile;var linkProfile=document.createTextNode("Profilo");cprofile.appendChild(linkProfile);links.append(cprofile);} var clogout=document.createElement('a');clogout.setAttribute('class','ls-logged-logout');var linkLogout=document.createTextNode("Esci");clogout.appendChild(linkLogout);if(!logout){logout=function(){GediSocial.interface.logout();};} clogout.onclick=logout;links.append(clogout);} RenderAccounts.renderAccountNotLogged=function(container){if(!GediSocial.utils.isNull((container))){if(GediSocial.utils.isNull(window.managerLoginInfo)){RenderAccounts.renderAccountNotLoggedSite(container);if(!GediSocial.utils.isNull((cPWLogin=document.getElementById(GediSocial.settings.view.pw.containerID)))){RenderAccounts.renderAccountNotLoggedPW(cPWLogin);}}else RenderAccounts.renderAccountNotLoggedQuotidiano(container);}} RenderAccounts.renderAccountNotLoggedPW=function(container){var pwLoginCssId='pw-login-css';if(!document.getElementById(pwLoginCssId)){var pwLoginCss=document.createElement('link');pwLoginCss.setAttribute('id',pwLoginCssId);pwLoginCss.setAttribute('rel','stylesheet');pwLoginCss.setAttribute('type','text/css');pwLoginCss.setAttribute('href','https://www.repstatic.it/cless/main/common/paywall/css/pw-login.css');document.head.append(pwLoginCss);} var hPWLogin=document.createElement('h2');var aPWLogin=document.createElement('a');aPWLogin.setAttribute('class','ls-logged-profile');aPWLogin.innerHTML='Accedi';aPWLogin.onclick=function(){GediSocial.interface.ssoLogin({redirectURL:window.location.href});};var tPWLogin=document.createTextNode("Sei già abbonato? ");hPWLogin.append(tPWLogin);hPWLogin.append(aPWLogin);container.append(hPWLogin);} RenderAccounts.renderAccountNotLoggedSite=function(container){if(typeof pageType!=='undefined'&&pageType!="dettaglio_altro2"){container.innerHTML='';let accedi=document.createElement('span');accedi.setAttribute('class','header-login-label');accedi.innerHTML="Accedi";container.append(accedi);container.onclick=function(){GediSocial.interface.ssoLogin();return false;} var icon=document.createElementNS('http://www.w3.org/2000/svg','svg');icon.setAttribute('class','social-icon-user');useElem=document.createElementNS('http://www.w3.org/2000/svg','use');useElem.setAttributeNS('http://www.w3.org/1999/xlink','xlink:href','#social-icon-user');icon.appendChild(useElem);container.append(icon);}else{container.innerHTML='';let divMenu=document.createElement('div');divMenu.setAttribute('class','user-menu');let menuToggle=document.createElement('a');menuToggle.setAttribute('class','user-menu__toggle');divMenu.append(menuToggle);let menuLabel=document.createElement('span');menuLabel.setAttribute('class','user-menu__username');menuLabel.innerHTML="Accedi";menuToggle.append(menuLabel);container.onclick=function(){GediSocial.interface.ssoLogin();return false;} var icon=document.createElementNS('http://www.w3.org/2000/svg','svg');icon.setAttribute('class','icon');useElem=document.createElementNS('http://www.w3.org/2000/svg','use');if(window.screen.availWidth<='767'){useElem.setAttributeNS('http://www.w3.org/1999/xlink','href','#icon-user-mobile');}else{useElem.setAttributeNS('http://www.w3.org/1999/xlink','href','#icon-user');} icon.appendChild(useElem);menuToggle.append(icon);container.append(divMenu);}} RenderAccounts.renderAccountNotLoggedQuotidiano=function(container){var menuRedazione=(window.managerLoginInfo&&(managerLoginInfo.type=="none"||managerLoginInfo.type=="user"))?true:false;var loggedId='ls-login-label-id';var logged=document.createElement('span');logged.setAttribute('class','ls-login-label');logged.setAttribute('id',loggedId);container.append(logged);var account=document.createElement('span');account.innerHTML='Accedi';logged.append(account);var icon=document.createElementNS('http://www.w3.org/2000/svg','svg'),useElem=document.createElementNS('http://www.w3.org/2000/svg','use');useElem.setAttributeNS('http://www.w3.org/1999/xlink','xlink:href','#repubblica-user');icon.appendChild(useElem);logged.append(icon);var credazioneId='editorial-access-id';var credazione=document.createElement('div');credazione.setAttribute('class','editorial-access');credazione.setAttribute('id',credazioneId);container.append(credazione);logged.onclick=function(){var para=document.getElementById(loggedId);para.classList.toggle('is-active');document.body.classList.toggle('has-login-membership-active');var credazioneT=document.getElementById(credazioneId);if(credazioneT.style.display==="none"||credazioneT.style.display===""){credazioneT.style.display="block";}else{credazioneT.style.display="none";}} var loginButton=document.createElement('button');loginButton.setAttribute('type','submit');loginButton.innerHTML="Vai alla login";loginButton.onclick=function(){GediSocial.interface.ssoLogin();return false;};credazione.append(loginButton);credazione.append(document.createElement('hr'));if(managerLoginInfo.type=="none"||managerLoginInfo.type=="user"&&!GediSocial.status.gigya.logged){if(managerLoginInfo.redazione){var caccessor=document.createElement('button');caccessor.setAttribute('type','submit');caccessor.innerHTML="Accesso Redazionale";caccessor.onclick=function(){document.location.href=managerLoginInfo.redazione;return false;};credazione.append(caccessor);credazione.append(document.createElement('hr'));} if(managerLoginInfo.chiaveaccesso){GediSocial.interface.loadRecaptcha();var form=document.createElement('form');form.setAttribute('class','editorial-access_form');var ccnl=document.createElement('label');ccnl.innerHTML="Se hai ricevuto un codice inseriscilo qui:";ccnl.setAttribute('for','code-number');form.append(ccnl);var ccn=document.createElement('input');ccn.setAttribute('name','code-number');ccn.setAttribute('id','code-number');ccn.setAttribute('type','text');ccn.setAttribute('required','required');if(managerLoginInfo.phone_key){ccn.setAttribute('value',managerLoginInfo.phone_key);} form.append(ccn);var cb=document.createElement('button');cb.innerHTML='Prosegui';cb.setAttribute('type','submit');cb.setAttribute('class','g-recaptcha');cb.setAttribute('data-action','submit');form.append(cb);form.addEventListener("submit",function(evt){evt.preventDefault();var phk=ccn.value;var redirectTo=managerLoginInfo.chiaveaccesso+encodeURIComponent(phk);try{var client=new ClientJS();fingerprint=client.getFingerprint();redirectTo+='&fingerPrint='+fingerprint;}catch(err){} if(typeof grecaptcha==='object'){try{grecaptcha.ready(function(){grecaptcha.execute(GediSocial.settings.recaptcha.public_key,{action:'submit'}).then(function(retoken){redirectTo+='&retoken='+retoken;window.location.replace(redirectTo);return false;});});}catch(err){window.location.replace(redirectTo);return false;}}else{window.location.replace(redirectTo);return false;}});credazione.append(form);} container.setAttribute('class','padded');}else{if(managerLoginInfo.type=="user"){var uName=(response.profile.nickname)?response.profile.nickname:response.profile.firstName;var socialThumb=response.profile.photoURL;loggedViewQuotidiano(container,uName,socialThumb,undefined,profile);}else{var logout=null;if(managerLoginInfo.logout){logout=function(){location.href=managerLoginInfo.logout;}} if(managerLoginInfo.profile){profile=managerLoginInfo.profile;} if(managerLoginInfo.type=="redazione"){loggedViewQuotidiano(container,"Utente redazionale","provider=site",logout);} if(managerLoginInfo.type=="accesskey") loggedViewQuotidiano(container,"Utente con chiave di accesso",null,logout,profile);}}} RenderAccounts.ssoLogin=function(){GediSocial.interface.ssoLogin();} RenderAccounts.ssoLogout=function(){GediSocial.interface.logout();} RenderAccounts.ssoRegistration=function(){GediSocial.interface.ssoLogin({context:{screenSet:'GEDI-CLP-RegistrationLogin',startScreen:'gigya-register-screen'}});} RenderAccounts.ssoRegistrationWall=function(){GediSocial.interface.ssoLogin({context:{screenSet:'GEDI-CLP-RegistrationLogin',startScreen:'gigya-register-screen',source_reg:"CTA_REG_WALL_PW",pw_reg:"CTA_REG_WALL_PW"}});} RenderAccounts.getCommonSettings=function(){var settingsView={login:{logged:RenderAccounts.renderAccountLogged,notLogged:RenderAccounts.renderAccountNotLogged,containerID:'account-data-container'}} var settings={gigya:{appId:RenderAccounts.APP_ID,loginParams:{context:{brand:'repubblica'}},clp:'https://login.gedi.it/clp/login.php',jwt:{cookieName:RenderAccounts.COOKIE_NAME,cookieDomain:RenderAccounts.COOKIE_DOMAIN}},view:settingsView,service:'repubblica.it',logger:true,privacy:true};return settings;} RenderAccounts.init=function(page){if(typeof GediSocial==='object'){var settings=RenderAccounts.getCommonSettings();GediSocial.settings=GediSocial.utils.deepExtend(GediSocial.settings,settings);GediSocial.interface.init();}} RenderAccounts.init();})();; ;window.kwait=window.kwait||[];kwait.push(['call',"accounts_js"]);