1(()=>{"use strict";function k(n,e,t,s,o,r,i){try{var a=n[r](i),c=a.value}catch(w){return void t(w)}a.done?e(c):Promise.resolve(c).then(s,o)}function h(n){return function(){var e=this,t=arguments;return new Promise(function(s,o){var r=n.apply(e,t);function i(c){k(r,s,o,i,a,"next",c)}function a(c){k(r,s,o,i,a,"throw",c)}i(void 0)})}}const l="/client-oauth",T=`${l}/token/refresh`,L=`${l}/logout-data`,_=new Map([["DEFAULT",T],["AM",`${T}/ts`],["EVOUCHER",`${T}/evoucher`]]),p=n=>e=>n.startsWith(e),f=({headers:n,status:e,statusText:t},s)=>new Response(s,{headers:n,status:e,statusText:t}),O=n=>n.replaceAll("-","+").replaceAll("_","/"),A=new class S{constructor(e){this.scope=e,this.origin=this.scope.location.origin,this.logoutDataUrl=this.origin+L,this.refreshUrls=Array.from(_.values()).map(t=>this.origin+t),this.requestUrls=[],this.scope.addEventListener("message",this.handleMessage.bind(this)),this.scope.addEventListener("fetch",this.interceptRequest.bind(this))}get hasToken(){return!!this.token}sanitizeRequestUrls(e){try{const t=new RegExp(`.hilti.(?:co.|com.)*[a-zA-Z]{2,3}$|^${this.origin}$`.replaceAll(".",String.raw`\.`));return e.filter(s=>t.test(new URL(s).origin))}catch{return[]}}broadcastMessage(e){this.scope.clients.matchAll().then(t=>t.forEach(s=>s.postMessage(e)))}createTokenMessage(){return{tokenStore:{hasToken:this.hasToken}}}emitTokenPresence(){this.broadcastMessage(this.createTokenMessage())}setToken(e){const{header:t,payload:s}=e&&(n=>{try{const[e,t,s]=n.split(".");return{header:JSON.parse(atob(e)),payload:JSON.parse(atob(O(t))),signature:s}}catch{return null}})(e)||{};this.token="JWT"===t?.typ?e:null,this.clearTokenBeforeExpiry(s?.exp)}clearToken(){this.token&&(this.token="",this.emitTokenPresence())}clearTokenBeforeExpiry(e){if(clearTimeout(this.clearTokenTimeout),e){const t=1e3*e-Date.now()-6e4;this.clearTokenTimeout=setTimeout(()=>this.clearToken(),t)}}handleMessage({data:e={tokenStore:{}},source:t}){const{tokenStore:{enabled:s,requestUrls:o,token:r,userId:i}={}}=e;switch(e.type){case"INIT":{this.requestUrls=this.sanitizeRequestUrls(o),this.enabled=s;const a=s&&this.token&&i!==this.userId;this.userId=i,!s&&this.token||a?this.clearToken():t.postMessage(this.createTokenMessage());break}case"HAS_TOKEN":t.postMessage(this.createTokenMessage());break;case"SET_TOKEN":this.setToken(r),this.emitTokenPresence()}}interceptRequest(e){if(!this.enabled)return;const{request:t}=e,{url:s}=t;if(this.token){if(this.requestUrls.some(p(s)))return void e.respondWith(this.tokenizeRequest(t));if(s.startsWith(this.logoutDataUrl))return void e.respondWith(this.tokenizeLogoutData(t))}this.refreshUrls.some(p(s))&&e.respondWith(this.fetchToken(t))}fetchToken(e){var t=this;return h(function*(){const s=yield fetch(e);if(s.ok){const{token:o}=yield s.json();t.setToken(o)}return t.emitTokenPresence(),f(s,JSON.stringify({hasToken:t.hasToken}))})()}tokenizeLogoutData(e){var t=this;return h(function*(){const s=yield fetch(e),o=yield s.json(),{parameters:r}=o,i=Object.keys(r).find(a=>"{{access_token}}"===r[a]);return r[i]=t.token,t.clearToken(),f(s,JSON.stringify(o))})()}tokenizeRequest(e){var t=this;return h(function*(){try{const s=new Headers(e.headers);s.set("authorization",`Bearer ${t.token}`);const o=yield fetch(new Request(e,{headers:s}));return 401===o.status&&t.clearToken(),o}catch(s){return t.clearToken(),s}})()}}(self);self.addEventListener("activate",n=>{n.waitUntil(self.clients.claim())}),self.addEventListener("message",({data:n={},source:e})=>{const{type:t,skipWaiting:s}=n;if("INIT"===t){const{waiting:o}=self.registration;!o||s||A.hasToken?s&&self.skipWaiting():o.postMessage({...n,skipWaiting:!0}),e.postMessage({ready:!0,version:"25.04"})}})})();
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.