From d896140be38fe80bb07356fd8be5a86fa216b9f0 Mon Sep 17 00:00:00 2001 From: Barry Pollard Date: Thu, 9 May 2024 12:06:11 +0100 Subject: [PATCH] Latest build --- src/browser_action/web-vitals.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/browser_action/web-vitals.js b/src/browser_action/web-vitals.js index 74bcc56..2b895d9 100644 --- a/src/browser_action/web-vitals.js +++ b/src/browser_action/web-vitals.js @@ -1 +1 @@ -var t,e,n=function(){var t=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(t&&t.responseStart>0&&t.responseStart(e||100)-1)return n||a;if(n=n?a+">"+n:a,r.id)break;t=r.parentNode}}catch(t){}return n},o=-1,c=function(){return o},u=function(t){addEventListener("pageshow",(function(e){e.persisted&&(o=e.timeStamp,t(e))}),!0)},s=function(){var t=n();return t&&t.activationStart||0},f=function(t,e){var r=n(),i="navigate";c()>=0?i="back-forward-cache":r&&(document.prerendering||s()>0?i="prerender":document.wasDiscarded?i="restore":r.type&&(i=r.type.replace(/_/g,"-")));return{name:t,value:void 0===e?-1:e,rating:"good",delta:0,entries:[],id:"v4-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:i}},d=function(t,e,n){try{if(PerformanceObserver.supportedEntryTypes.includes(t)){var r=new PerformanceObserver((function(t){Promise.resolve().then((function(){e(t.getEntries())}))}));return r.observe(Object.assign({type:t,buffered:!0},n||{})),r}}catch(t){}},l=function(t,e,n,r){var i,a;return function(o){e.value>=0&&(o||r)&&((a=e.value-(i||0))||void 0===i)&&(i=e.value,e.delta=a,e.rating=function(t,e){return t>e[1]?"poor":t>e[0]?"needs-improvement":"good"}(e.value,n),t(e))}},m=function(t){requestAnimationFrame((function(){return requestAnimationFrame((function(){return t()}))}))},p=function(t){document.addEventListener("visibilitychange",(function(){"hidden"===document.visibilityState&&t()}))},v=function(t){var e=!1;return function(){e||(t(),e=!0)}},g=-1,h=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},y=function(t){"hidden"===document.visibilityState&&g>-1&&(g="visibilitychange"===t.type?t.timeStamp:0,E())},T=function(){addEventListener("visibilitychange",y,!0),addEventListener("prerenderingchange",y,!0)},E=function(){removeEventListener("visibilitychange",y,!0),removeEventListener("prerenderingchange",y,!0)},S=function(){return g<0&&(g=h(),T(),u((function(){setTimeout((function(){g=h(),T()}),0)}))),{get firstHiddenTime(){return g}}},b=function(t){document.prerendering?addEventListener("prerenderingchange",(function(){return t()}),!0):t()},L=[1800,3e3],C=function(t,e){e=e||{},b((function(){var n,r=S(),i=f("FCP"),a=d("paint",(function(t){t.forEach((function(t){"first-contentful-paint"===t.name&&(a.disconnect(),t.startTimer.value&&(r.value=i,r.entries=a,n())},c=d("layout-shift",o);c&&(n=l(t,r,M,e.reportAllChanges),p((function(){o(c.takeRecords()),n(!0)})),u((function(){i=0,r=f("CLS",0),n=l(t,r,M,e.reportAllChanges),m((function(){return n()}))})),setTimeout(n,0))})))}((function(e){var n=function(t){var e,n={};if(t.entries.length){var i=t.entries.reduce((function(t,e){return t&&t.value>e.value?t:e}));if(i&&i.sources&&i.sources.length){var o=(e=i.sources).find((function(t){return t.node&&1===t.node.nodeType}))||e[0];o&&(n={largestShiftTarget:a(o.node),largestShiftTime:i.startTime,largestShiftValue:i.value,largestShiftSource:o,largestShiftEntry:i,loadState:r(i.startTime)})}}return Object.assign(t,{attribution:n})}(e);t(n)}),e)},D=function(t,e){C((function(e){var i=function(t){var e={timeToFirstByte:0,firstByteToFCP:t.value,loadState:r(c())};if(t.entries.length){var i=n(),a=t.entries[t.entries.length-1];if(i){var o=i.activationStart||0,u=Math.max(0,i.responseStart-o);e={timeToFirstByte:u,firstByteToFCP:t.value-u,loadState:r(t.entries[0].startTime),navigationEntry:i,fcpEntry:a}}}return Object.assign(t,{attribution:e})}(e);t(i)}),e)},k=0,x=1/0,A=0,I=function(t){t.forEach((function(t){t.interactionId&&(x=Math.min(x,t.interactionId),A=Math.max(A,t.interactionId),k=A?(A-x)/7+1:0)}))},F=function(){"interactionCount"in performance||t||(t=d("event",I,{type:"event",buffered:!0,durationThreshold:0}))},P=[],B=new Map,O=0,R=function(){return(t?k:performance.interactionCount||0)-O},j=[],q=function(t){if(j.forEach((function(e){return e(t)})),t.interactionId||"first-input"===t.entryType){var e=P[P.length-1],n=B.get(t.interactionId);if(n||P.length<10||t.duration>e.latency){if(n)t.duration>n.latency?(n.entries=[t],n.latency=t.duration):t.duration===n.latency&&t.startTime===n.entries[0].startTime&&n.entries.push(t);else{var r={id:t.interactionId,latency:t.duration,entries:[t]};B.set(r.id,r),P.push(r)}P.sort((function(t,e){return e.latency-t.latency})),P.length>10&&P.splice(10).forEach((function(t){return B.delete(t.id)}))}}},H=function(t){var e=self.requestIdleCallback||self.setTimeout,n=-1;return t=v(t),"hidden"===document.visibilityState?t():(n=e(t),p(t)),n},N=[200,500],W=function(t,e){e=e||{},b((function(){var n;F();var r,i=f("INP"),a=function(t){t.forEach(q);var e,n=(e=Math.min(P.length-1,Math.floor(R()/50)),P[e]);n&&n.latency!==i.value&&(i.value=n.latency,i.entries=n.entries,r())},o=d("event",a,{durationThreshold:null!==(n=e.durationThreshold)&&void 0!==n?n:40});r=l(t,i,N,e.reportAllChanges),o&&("PerformanceEventTiming"in self&&"interactionId"in PerformanceEventTiming.prototype&&o.observe({type:"first-input",buffered:!0}),p((function(){a(o.takeRecords()),r(!0)})),u((function(){O=0,P.length=0,B.clear(),i=f("INP"),r=l(t,i,N,e.reportAllChanges)})))}))},z=[],U=new Map,V=[],_=new WeakMap,G=new Map,J=-1,K=function(t){t.forEach((function(t){return z.push(t)}))},Q=function(){(V=V.slice(-50),G.size>10)&&Array.from(G.keys()).slice(0,-10).forEach((function(t){return G.delete(t)}));var t=new Set(V.concat(P.map((function(t){return _.get(t.entries[0])}))));U.forEach((function(e,n){t.has(n)||U.delete(n)}));var e=new Set;U.forEach((function(t){tt(t.startTime,t.processingEnd).forEach((function(t){e.add(t)}))})),z=Array.from(e),J=-1};j.push((function(t){var e=t.interactionId;e&&!G.get(e)&&t.target&&G.set(e,a(t.target))}),(function(t){for(var e,n=t.startTime+t.duration,r=V.length-1;r>=0;r--)if(e=V[r],Math.abs(n-e)<=8){var i=U.get(e);i.startTime=Math.min(t.startTime,i.startTime),i.processingStart=Math.min(t.processingStart,i.processingStart),i.processingEnd=Math.max(t.processingEnd,i.processingEnd),i.entries.push(t),n=e;break}n!==e&&(V.push(n),U.set(n,{startTime:t.startTime,processingStart:t.processingStart,processingEnd:t.processingEnd,entries:[t]})),(t.interactionId||"first-input"===t.entryType)&&_.set(t,n),J<0&&(J=H(Q))}));var X,Y,Z,$,tt=function(t,e){for(var n,r=[],i=0;n=z[i];i++)if(!(n.startTime+n.duratione)break;r.push(n)}return r},et=function(t,n){e||(e=d("long-animation-frame",K)),W((function(e){H((function(){var n=function(t){var e=t.entries[0],n=_.get(e),i=U.get(n),o=e.processingStart,c=i.processingEnd,u=i.entries.sort((function(t,e){return t.processingStart-e.processingStart})),s=tt(e.startTime,c),f=t.entries.find((function(t){return t.target})),d=f?a(f.target):G.get(e.interactionId)||"",l=[e.startTime+e.duration,c].concat(s.map((function(t){return t.startTime+t.duration}))),m=Math.max.apply(Math,l),p={interactionTarget:d,interactionType:e.name.startsWith("key")?"keyboard":"pointer",interactionTime:e.startTime,nextPaintTime:m,processedEventEntries:u,longAnimationFrameEntries:s,inputDelay:o-e.startTime,processingDuration:c-o,presentationDelay:Math.max(m-c,0),loadState:r(e.startTime)};return Object.assign(t,{attribution:p})}(e);t(n)}))}),n)},nt=[2500,4e3],rt={},it=function(t,e){!function(t,e){e=e||{},b((function(){var n,r=S(),i=f("LCP"),a=function(t){e.reportAllChanges||(t=t.slice(-1)),t.forEach((function(t){t.startTime=0&&Y1e12?new Date:performance.now())-t.timeStamp;"pointerdown"==t.type?function(t,e){var n=function(){dt(t,e),i()},r=function(){i()},i=function(){removeEventListener("pointerup",n,st),removeEventListener("pointercancel",r,st)};addEventListener("pointerup",n,st),addEventListener("pointercancel",r,st)}(e,t):dt(e,t)}},pt=function(t){["mousedown","keydown","touchstart","pointerdown"].forEach((function(e){return t(e,mt,st)}))},vt=[100,300],gt=function(t,e){e=e||{},b((function(){var n,r=S(),i=f("FID"),a=function(t){t.startTime0&&t.responseStart(e||100)-1)return n||a;if(n=n?a+">"+n:a,r.id)break;t=r.parentNode}}catch(t){}return n},o=-1,c=function(){return o},u=function(t){addEventListener("pageshow",(function(e){e.persisted&&(o=e.timeStamp,t(e))}),!0)},s=function(){var t=n();return t&&t.activationStart||0},f=function(t,e){var r=n(),i="navigate";c()>=0?i="back-forward-cache":r&&(document.prerendering||s()>0?i="prerender":document.wasDiscarded?i="restore":r.type&&(i=r.type.replace(/_/g,"-")));return{name:t,value:void 0===e?-1:e,rating:"good",delta:0,entries:[],id:"v4-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:i}},d=function(t,e,n){try{if(PerformanceObserver.supportedEntryTypes.includes(t)){var r=new PerformanceObserver((function(t){Promise.resolve().then((function(){e(t.getEntries())}))}));return r.observe(Object.assign({type:t,buffered:!0},n||{})),r}}catch(t){}},l=function(t,e,n,r){var i,a;return function(o){e.value>=0&&(o||r)&&((a=e.value-(i||0))||void 0===i)&&(i=e.value,e.delta=a,e.rating=function(t,e){return t>e[1]?"poor":t>e[0]?"needs-improvement":"good"}(e.value,n),t(e))}},m=function(t){requestAnimationFrame((function(){return requestAnimationFrame((function(){return t()}))}))},p=function(t){document.addEventListener("visibilitychange",(function(){"hidden"===document.visibilityState&&t()}))},v=function(t){var e=!1;return function(){e||(t(),e=!0)}},g=-1,h=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},y=function(t){"hidden"===document.visibilityState&&g>-1&&(g="visibilitychange"===t.type?t.timeStamp:0,E())},T=function(){addEventListener("visibilitychange",y,!0),addEventListener("prerenderingchange",y,!0)},E=function(){removeEventListener("visibilitychange",y,!0),removeEventListener("prerenderingchange",y,!0)},S=function(){return g<0&&(g=h(),T(),u((function(){setTimeout((function(){g=h(),T()}),0)}))),{get firstHiddenTime(){return g}}},b=function(t){document.prerendering?addEventListener("prerenderingchange",(function(){return t()}),!0):t()},L=[1800,3e3],C=function(t,e){e=e||{},b((function(){var n,r=S(),i=f("FCP"),a=d("paint",(function(t){t.forEach((function(t){"first-contentful-paint"===t.name&&(a.disconnect(),t.startTimer.value&&(r.value=i,r.entries=a,n())},c=d("layout-shift",o);c&&(n=l(t,r,M,e.reportAllChanges),p((function(){o(c.takeRecords()),n(!0)})),u((function(){i=0,r=f("CLS",0),n=l(t,r,M,e.reportAllChanges),m((function(){return n()}))})),setTimeout(n,0))})))}((function(e){var n=function(t){var e,n={};if(t.entries.length){var i=t.entries.reduce((function(t,e){return t&&t.value>e.value?t:e}));if(i&&i.sources&&i.sources.length){var o=(e=i.sources).find((function(t){return t.node&&1===t.node.nodeType}))||e[0];o&&(n={largestShiftTarget:a(o.node),largestShiftTime:i.startTime,largestShiftValue:i.value,largestShiftSource:o,largestShiftEntry:i,loadState:r(i.startTime)})}}return Object.assign(t,{attribution:n})}(e);t(n)}),e)},D=function(t,e){C((function(e){var i=function(t){var e={timeToFirstByte:0,firstByteToFCP:t.value,loadState:r(c())};if(t.entries.length){var i=n(),a=t.entries[t.entries.length-1];if(i){var o=i.activationStart||0,u=Math.max(0,i.responseStart-o);e={timeToFirstByte:u,firstByteToFCP:t.value-u,loadState:r(t.entries[0].startTime),navigationEntry:i,fcpEntry:a}}}return Object.assign(t,{attribution:e})}(e);t(i)}),e)},k=0,x=1/0,A=0,I=function(t){t.forEach((function(t){t.interactionId&&(x=Math.min(x,t.interactionId),A=Math.max(A,t.interactionId),k=A?(A-x)/7+1:0)}))},F=function(){"interactionCount"in performance||t||(t=d("event",I,{type:"event",buffered:!0,durationThreshold:0}))},P=[],B=new Map,O=0,R=function(){return(t?k:performance.interactionCount||0)-O},j=[],q=function(t){if(j.forEach((function(e){return e(t)})),t.interactionId||"first-input"===t.entryType){var e=P[P.length-1],n=B.get(t.interactionId);if(n||P.length<10||t.duration>e.latency){if(n)t.duration>n.latency?(n.entries=[t],n.latency=t.duration):t.duration===n.latency&&t.startTime===n.entries[0].startTime&&n.entries.push(t);else{var r={id:t.interactionId,latency:t.duration,entries:[t]};B.set(r.id,r),P.push(r)}P.sort((function(t,e){return e.latency-t.latency})),P.length>10&&P.splice(10).forEach((function(t){return B.delete(t.id)}))}}},H=function(t){var e=self.requestIdleCallback||self.setTimeout,n=-1;return t=v(t),"hidden"===document.visibilityState?t():(n=e(t),p(t)),n},N=[200,500],W=function(t,e){e=e||{},b((function(){var n;F();var r,i=f("INP"),a=function(t){t.forEach(q);var e,n=(e=Math.min(P.length-1,Math.floor(R()/50)),P[e]);n&&n.latency!==i.value&&(i.value=n.latency,i.entries=n.entries,r())},o=d("event",a,{durationThreshold:null!==(n=e.durationThreshold)&&void 0!==n?n:40});r=l(t,i,N,e.reportAllChanges),o&&("PerformanceEventTiming"in self&&"interactionId"in PerformanceEventTiming.prototype&&o.observe({type:"first-input",buffered:!0}),p((function(){a(o.takeRecords()),r(!0)})),u((function(){O=0,P.length=0,B.clear(),i=f("INP"),r=l(t,i,N,e.reportAllChanges)})))}))},z=[],U=new Map,V=[],_=new WeakMap,G=new Map,J=-1,K=function(t){t.forEach((function(t){return z.push(t)}))},Q=function(){(V=V.slice(-50),G.size>10)&&Array.from(G.keys()).slice(0,-10).forEach((function(t){return G.delete(t)}));var t=new Set(V.concat(P.map((function(t){return _.get(t.entries[0])}))));U.forEach((function(e,n){t.has(n)||U.delete(n)}));var e=new Set;U.forEach((function(t){tt(t.startTime,t.processingEnd).forEach((function(t){e.add(t)}))})),z=Array.from(e),J=-1};j.push((function(t){var e=t.interactionId;if(e&&!G.get(e)&&t.target){var n="first-input"!==t.entryType&&t.name.startsWith("key")?"keyboard":a(t.target);G.set(e,n)}}),(function(t){for(var e,n=t.startTime+t.duration,r=V.length-1;r>=0;r--)if(e=V[r],Math.abs(n-e)<=8){var i=U.get(e);i.startTime=Math.min(t.startTime,i.startTime),i.processingStart=Math.min(t.processingStart,i.processingStart),i.processingEnd=Math.max(t.processingEnd,i.processingEnd),i.entries.push(t),n=e;break}n!==e&&(V.push(n),U.set(n,{startTime:t.startTime,processingStart:t.processingStart,processingEnd:t.processingEnd,entries:[t]})),(t.interactionId||"first-input"===t.entryType)&&_.set(t,n),J<0&&(J=H(Q))}));var X,Y,Z,$,tt=function(t,e){for(var n,r=[],i=0;n=z[i];i++)if(!(n.startTime+n.duratione)break;r.push(n)}return r},et=function(t,n){e||(e=d("long-animation-frame",K)),W((function(e){H((function(){var n=function(t){var e=t.entries[0],n=_.get(e),i=U.get(n),o=e.processingStart,c=i.processingEnd,u=i.entries.sort((function(t,e){return t.processingStart-e.processingStart})),s=tt(e.startTime,c),f=t.entries.find((function(t){return t.target})),d=f?a(f.target):G.get(e.interactionId)||"",l=[e.startTime+e.duration,c].concat(s.map((function(t){return t.startTime+t.duration}))),m=Math.max.apply(Math,l),p={interactionTarget:d,interactionType:e.name.startsWith("key")?"keyboard":"pointer",interactionTime:e.startTime,nextPaintTime:m,processedEventEntries:u,longAnimationFrameEntries:s,inputDelay:o-e.startTime,processingDuration:c-o,presentationDelay:Math.max(m-c,0),loadState:r(e.startTime)};return Object.assign(t,{attribution:p})}(e);t(n)}))}),n)},nt=[2500,4e3],rt={},it=function(t,e){!function(t,e){e=e||{},b((function(){var n,r=S(),i=f("LCP"),a=function(t){e.reportAllChanges||(t=t.slice(-1)),t.forEach((function(t){t.startTime=0&&Y1e12?new Date:performance.now())-t.timeStamp;"pointerdown"==t.type?function(t,e){var n=function(){dt(t,e),i()},r=function(){i()},i=function(){removeEventListener("pointerup",n,st),removeEventListener("pointercancel",r,st)};addEventListener("pointerup",n,st),addEventListener("pointercancel",r,st)}(e,t):dt(e,t)}},pt=function(t){["mousedown","keydown","touchstart","pointerdown"].forEach((function(e){return t(e,mt,st)}))},vt=[100,300],gt=function(t,e){e=e||{},b((function(){var n,r=S(),i=f("FID"),a=function(t){t.startTime