!function(e,t,n){var r,a,o,i=!1,c=!1,u=1e3,s={},f=function(){var e=new URL(location);(r=e.searchParams.get("path"))||(r="/");var t=e.searchParams.get("config");t||(t="abtf-pwa-config.json"),a=r+t};e.addEventListener("install",function(t){t.waitUntil(m().then(function(){e.skipWaiting()}).catch(function(){e.skipWaiting()}))}),e.addEventListener("activate",function(t){e.clients.claim()}),CacheStorage.prototype.match||(CacheStorage.prototype.match=function(e,t){var n=this;return this.keys().then(function(r){var a;return r.reduce(function(r,o){return r.then(function(){return a||n.open(o).then(function(n){return n.match(e,t)}).then(function(e){return a=e})})},Promise.resolve())})});var h,l=function(){function e(){this.value=[],this.leftBits=0}function t(e){for(var t="",n=e.byteLength,r=0;r0&&(e&1+~e)===e}function r(e,t){return e-t}function a(e,t,n){return new Promise(function(r,a){var i=o(e);crypto.subtle.digest("SHA-256",c.encode(i)).then(function(e){var a=new DataView(e).getUint32(0),o=Math.log2(t*n);if(o>31)throw Error("This implementation only supports up to 31 bit hash values");r(a=a>>32-o&(1<=Math.pow(2,32))throw Error('Invalid probability: "${p}" must be smaller than 2**32');if(!n(i))throw Error('Invalid probability: "${p}" must be a power of 2');var c,u=Math.min(Math.pow(2,Math.round(Math.log2(o.length))),Math.pow(2,31)),s=[];return new Promise(function(n,f){Promise.all(o.map(function(e){return a(e,u,i)})).then(function(a){s=s.concat().sort(r),c=Uint8Array.from((new e).addBits(Math.log2(u),5).addBits(Math.log2(i),5).gcsEncode(s,Math.log2(i)).value),n(t(c))})})}e.prototype.addBit=function(e){return 0==this.leftBits&&(this.value.push(0),this.leftBits=8),--this.leftBits,e&&(this.value[this.value.length-1]|=1<>t;0!=o;--o)this.addBit(0);this.addBit(1),this.addBits(a,t),n=e[r]}return this};var c=new TextEncoder("utf-8");return function(e,t){return i(e,t)}}(),d=function(e){return e&&e.includes("text/html")?new Promise(function(e,t){caches.open(o+":push").then(function(t){t.keys().then(function(t){if(0===t.length)return e(null);var n=[];t.forEach(function(e){n.push(N(e))}),Promise.all(n).then(function(n){var r=[];t.forEach(function(e,t){"undefined"!==n[t]&&n[t]&&r.push(e.url)}),0===r.length?e(null):l(r,Math.pow(2,7)).then(function(t){e(t)})})})})}):Promise.resolve(null)},p=function(){var e={},t=0,n=[],r=function(t,a,o){var i=!1,c=Object.keys(e);if(c.length>0){var u=Date.now();c.forEach(function(t){if(!i)if(e[t][0]0&&r(null,0)},a,s,t),o]}else if(t&&n.push([t]),n.length>0)for(var h=n.shift();h;){if(h instanceof Array){h[1]&&clearTimeout(h[1]);try{h[0]()}catch(e){}}h=n.shift()}};return{start:function(n){var r=++t;return e[r]=[Date.now(),n],r},complete:function(t){try{delete e[t]}catch(e){}n.length>0&&r(null,0)},onIdle:r}}(),v=function(e){return new Promise(function(n,r){if(!i||!c||e&&e>c){var o=!i;m().then(function(){o&&n(i?i:!1)}).catch(function(){o&&n(!1)})}else if(!h&&cu&&(n.sort(function(e,t){return e.t>t.t?-1:e.tg()-5)return s[f][1];var h=function(e){e in s&&(s[e]&&s[e][2]&&clearTimeout(s[e][2]),s[e]=!1,delete s[e])},l=t(u).then(function(e){h(f);var t=!1;if(e.ok&&e.status<400){var r=e.headers.get("link");r&&(r instanceof Array||(r=[r]),p.onIdle(function(){caches.open(o+":push").then(function(e){r.forEach(function(t){t.split(",").forEach(function(t){if(/rel=preload/.test(t)){var n=t.match(/<([^>]+)>/);n&&n[1]&&e.match(n[1]).then(function(t){t||e.put(n[1],new Response(null,{status:204}))})}})})})},1e3)),n&&(t=!0,n.conditions&&n.conditions.forEach(function(n){if(t)switch(n.type){case"url":if(n.regex)if(a=E(n.pattern)){i=a.test(u.url);n.not?i&&(t=!1):i||(t=!1)}else t=!1;else{i=-1!==u.url.indexOf(n.pattern);n.not?i&&(t=!1):i||(t=!1)}break;case"header":var r=e.headers.get(n.name);if(r)if(n.regex){var a=E(n.pattern);if(a){i=a.test(r);n.not?i&&(t=!1):i||(t=!1)}else t=!1}else if("object"==typeof n.pattern)if(n.pattern.operator){r=parseFloat(r);var o=parseFloat(n.pattern.value);if(isNaN(r)||isNaN(o))t=!1;else{switch(n.pattern.operator){case"<":i=r":i=r>o;break;case"=":var i=r===o;break;default:t=!1}t&&(n.not?i&&(t=!1):i||(t=!1))}}else t=!1;else-1===r.indexOf(n.pattern)&&(t=!1);else t=!1}}),t&&A(u,e.clone(),n).then(function(){p.complete(i)}))}return t||p.complete(i),e}).catch(function(e){return h(f),p.complete(i),r?r(u,null,e):null});return a&&(s[f]=[g(),l],s[f][2]=setTimeout(function(){s[f]=!1,delete s[f]},5e3)),l})},P=function(e,n,r,a){var o=r.headers.get("etag"),i=w(r.headers.get("last-modified"));if(!o&&!i){var c=k(e,n);return a&&(c=c.then(a)),c}var u=p.start(1e3),s=new Request(e.url,{method:"HEAD",headers:e.headers,mode:"no-cors"});t(s).then(function(t){var r=!1,c=t.headers.get("etag"),s=w(t.headers.get("last-modified"));if(c&&c!==o?r=!0:s&&s!==i&&(r=!0),r){var f=k(e,n);return f=f.then(function(e){return p.complete(u),e}),a&&(f=f.then(a)),f}return p.complete(u),null}).catch(function(t){var r=k(e,n);return r=r.then(function(e){return p.complete(u),e}),a&&(r=r.then(a)),r})},M=function(e,n){return e=new Request(e),N(e).then(function(e){return e?e.blob().then(function(t){return new Response(t,{status:503,statusText:"Offline",headers:e.headers})}):t(n).catch(function(e){setTimeout(function(){throw e})})})},N=function(e){var t=p.start(1e3);return caches.open(o).then(function(n){return n.match(e).then(function(e){if(e){var n=e.headers.get("x-abtf-sw-expire");if(n)var r=e.headers.get("x-abtf-sw");var a=e.headers.get("expire");a&&(a=w(a)),n&&rg()-o&&(a=!1)}return a&&function(e,t){setTimeout(function(){var n;if(r.cache.notify&&(n=function(){clients.matchAll().then(function(t){t.forEach(function(t){t.postMessage([2,e.url])})})}),r.cache.head_update)P(e,r.cache,t,n);else{var a=k(e,r.cache);n&&a.then(n)}},10)}(e.request.clone(),n.clone()),n}return k(e.request,r.cache,function(n,a,o){return r.offline?M(r.offline,n.clone()):a||t(e.request.clone()).catch(function(e){setTimeout(function(){throw e})})})});case"event":return N(e.request).then(function(n){return n||k(e.request,null,function(n,a,o){return r.offline?M(r.offline,n.clone()):a||t(e.request).catch(function(e){setTimeout(function(){throw e})})})});case"network":default:return k(e.request,r.cache,function(n,a,o){return N(n).then(function(o){return o||(r.offline?M(r.offline,n.clone()):a||t(e.request).catch(function(e){setTimeout(function(){throw e})}))})})}}(n,i);if(!1!==a)return n.respondWith(a)}}}),e.addEventListener("message",function(t){if(t&&t.data&&t.data instanceof Array){if(1===t.data[0]&&(t.data[1]&&!isNaN(parseInt(t.data[1]))&&v(parseInt(t.data[1])),t.data[3]&&!isNaN(parseInt(t.data[3]))&&(u=parseInt(t.data[3])),p.onIdle(T,1e4,"clean-cache")),2===t.data[0]||3===t.data[0])if(t.ports[0])n=function(e,n){t.ports[0].postMessage({error:e,status:n})};else var n=!1;if(2===t.data[0])if(t.data[1]){var r;if("string"==typeof t.data[1]||t.data[1]instanceof Request?r=[t.data[1]]:t.data[1]instanceof Array&&(r=t.data[1]),r){var a=[];r.forEach(function(e){a.push(I(e))}),n&&Promise.all(a).then(function(e){var t=[];e.forEach(function(e){var n={url:e.url,status:e.status,statusText:e.statusText},r=e.headers.get("content-length");n.size=isNaN(parseInt(r))?-1:parseInt(r),t.push(n)}),n(null,t)}).catch(function(e){})}else n&&n("invalid-data")}else n&&n("no-urls");3===t.data[0]&&(e.registration.showNotification(t.data[1],t.data[2]),n&&n(null,"sent"))}})}(self,self.fetch,Cache);