1function getCookieValue(name){const parts=('; '+document.cookie).split('; '+name+'=');if(parts.length===2&&parts[1]){return parts.pop().split(';').shift()} 2return null} 3function setCookieValue(name,value,expirationDate,path='/'){document.cookie=`${name}=${value}; expires=${expirationDate.toUTCString()}; path=${path}`} 4function generateUniqueId(){return([1e7]+ -1e3+ -4e3+ -8e3+ -1e11).replace(/[018]/g,(digit)=>(digit^(crypto.getRandomValues(new Uint8Array(1))[0]&(15>>(digit/4)))).toString(16))} 5const ONE_DAY=24*60*60*1000;const THIRTY_MINUTES=30*60*1000;const USER_COOKIE='EA_UID';const SESSION_COOKIE='EA_SID';const SESSION_SAMPLED_COOKIE='EA_SESSION_SAMPLED';const ACKNOWLEDGEMENT_COOKIE='EA_COOKIE_ACK';const DEFAULT_SAMPLING=1;class UserSessionStore{constructor(){this.userToken=getCookieValue(USER_COOKIE)||generateUniqueId();this.userTokenLifetime=ONE_DAY;this.sessionLifetime=THIRTY_MINUTES;this.samplingRate=DEFAULT_SAMPLING;if(this.isAcknowledged()){this.initializeCookies()}} 6isAcknowledged(){if(typeof window.userSessionConfig!=='undefined'&&window.userSessionConfig.isAcknowledged==='true'){return!0} 7return getCookieValue(ACKNOWLEDGEMENT_COOKIE)==='true'} 8setAcknowledgement(acknowledged=!0){if(acknowledged){const expirationDate=new Date(Date.now()+ONE_DAY);setCookieValue(ACKNOWLEDGEMENT_COOKIE,'true',expirationDate);this.initializeCookies()}else{this.clearAllCookies()}} 9initializeCookies(){if(!getCookieValue(SESSION_SAMPLED_COOKIE)){this.setSessionSampledCookie((Math.random()<=this.samplingRate).toString())} 10if(this.userToken!==getCookieValue(USER_COOKIE)){this.updateUserCookie()} 11this.updateSessionCookie()} 12clearAllCookies(){const pastDate=new Date(0);setCookieValue(USER_COOKIE,'',pastDate);setCookieValue(SESSION_COOKIE,'',pastDate);setCookieValue(SESSION_SAMPLED_COOKIE,'',pastDate);setCookieValue(ACKNOWLEDGEMENT_COOKIE,'',pastDate)} 13getUserId(){if(!this.isAcknowledged()){return null} 14let userId=getCookieValue(USER_COOKIE);if(!userId){this.updateUserCookie();userId=getCookieValue(USER_COOKIE)} 15return userId} 16isSessionSampled(){if(!this.isAcknowledged()){return!1} 17return getCookieValue(SESSION_SAMPLED_COOKIE)==='true'} 18setSessionSampledCookie(value){if(!this.isAcknowledged()){return} 19const expirationDate=new Date(Date.now()+THIRTY_MINUTES);setCookieValue(SESSION_SAMPLED_COOKIE,value,expirationDate)} 20getSessionId(){if(!this.isAcknowledged()){return null} 21return getCookieValue(SESSION_COOKIE)} 22updateSessionCookie(){if(!this.isAcknowledged()){return} 23const sessionId=getCookieValue(SESSION_COOKIE)||generateUniqueId();const expirationDate=new Date(Date.now()+this.sessionLifetime);setCookieValue(SESSION_COOKIE,sessionId,expirationDate)} 24updateUserCookie(){if(!this.isAcknowledged()){return} 25const expirationDate=new Date(Date.now()+this.userTokenLifetime);setCookieValue(USER_COOKIE,this.userToken,expirationDate)}} 26const userSessionStore=new UserSessionStore();window.userSessionStore=userSessionStore;document.addEventListener('click',function(e){if(e.target&&e.target.id==='cookie-accept'){userSessionStore.setAcknowledgement(!0)}});if(userSessionStore.isAcknowledged()){userSessionStore.updateSessionCookie()}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.