!function(){"use strict";"function"!=typeof[].at&&Object.defineProperty(Array.prototype,"at",{value(e){var i=this.length,t=Math.trunc(e)||0;return 0>t&&(t+=i),0>t||t>=i?void 0:this[t]},writable:!0,enumerable:!1,configurable:!0});var e="undefined"!=typeof window?window:void 0,i="undefined"!=typeof globalThis?globalThis:e;null!=i&&i.XMLHttpRequest&&new i.XMLHttpRequest;var t="undefined"!=typeof globalThis?globalThis:e;t&&"undefined"==typeof self&&(t.self=t),t&&"undefined"==typeof File&&(t.File=function(){});var r=null!=e?e:{};function n(){return n=Object.assign?Object.assign.bind():function(e){for(var i=1;arguments.length>i;i++){var t=arguments[i];for(var r in t)({}).hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},n.apply(null,arguments)}var a=-1,o=e=>{addEventListener("pageshow",(i=>{i.persisted&&(a=i.timeStamp,e(i))}),!0)},s=(e,i,t,r)=>{var n,a;return o=>{i.value>=0&&(o||r)&&((a=i.value-(null!=n?n:0))||void 0===n)&&(n=i.value,i.delta=a,i.rating=((e,i)=>e>i[1]?"poor":e>i[0]?"needs-improvement":"good")(i.value,t),e(i))}},v=e=>{requestAnimationFrame((()=>requestAnimationFrame(e)))},d=()=>{var e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart{var e,i;return null!==(e=null==(i=d())?void 0:i.activationStart)&&void 0!==e?e:0},h=function(e,i){void 0===i&&(i=-1);var t=d(),r="navigate";return 0>a?t&&(document.prerendering||u()>0?r="prerender":document.wasDiscarded?r="restore":t.type&&(r=t.type.replace(/_/g,"-"))):r="back-forward-cache",{name:e,value:i,rating:"good",delta:0,entries:[],id:"v5-"+Date.now()+"-"+(Math.floor(8999999999999*Math.random())+1e12),navigationType:r}},f=new WeakMap;function l(e,i){var t=f.get(i);return t||(t=new WeakMap,f.set(i,t)),t.get(e)||t.set(e,new i),t.get(e)}class c{constructor(){this.t=void 0,this.i=0,this.o=[]}h(e){var i;if(!e.hadRecentInput){var t=this.o[0],r=this.o.at(-1);this.i&&t&&r&&1e3>e.startTime-r.startTime&&5e3>e.startTime-t.startTime?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),null==(i=this.t)||i.call(this,e)}}}var m,p=function(e,i,t){void 0===t&&(t={});try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var r=new PerformanceObserver((e=>{queueMicrotask((()=>{i(e.getEntries())}))}));return r.observe(n({type:e,buffered:!0},t)),r}}catch(e){}},g=e=>{var i=!1;return()=>{i||(e(),i=!0)}},b=-1,y=new Set,T=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,L=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(var i of y)i();isFinite(b)||(b="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",L,!0))}},w=()=>{if(0>b){var e,i=u(),t=document.prerendering||null==(e=globalThis.performance.getEntriesByType("visibility-state").find((e=>"hidden"===e.name&&e.startTime>=i)))?void 0:e.startTime;b=null!=t?t:T(),addEventListener("visibilitychange",L,!0),addEventListener("prerenderingchange",L,!0),o((()=>{setTimeout((()=>{b=T()}))}))}return{get firstHiddenTime(){return b},onHidden(e){y.add(e)}}},M=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},P=[1800,3e3],C=function(e,i){void 0===i&&(i={}),M((()=>{var t,r=w(),n=h("FCP"),a=p("paint",(e=>{for(var i of e)"first-contentful-paint"===i.name&&(a.disconnect(),r.firstHiddenTime>i.startTime&&(n.value=Math.max(i.startTime-u(),0),n.entries.push(i),t(!0)))}));a&&(t=s(e,n,P,i.reportAllChanges),o((r=>{n=h("FCP"),t=s(e,n,P,i.reportAllChanges),v((()=>{n.value=performance.now()-r.timeStamp,t(!0)}))})))}))},E=[.1,.25],F=0,k=1/0,O=0,I=e=>{for(var i of e)i.interactionId&&(k=Math.min(k,i.interactionId),O=Math.max(O,i.interactionId),F=O?(O-k)/7+1:0)},S=()=>{var e;return m?F:null!==(e=performance.interactionCount)&&void 0!==e?e:0},j=0;class q{constructor(){this.l=[],this.u=new Map,this.m=void 0,this.p=void 0}v(){j=S(),this.l.length=0,this.u.clear()}T(){var e=Math.min(this.l.length-1,Math.floor((S()-j)/50));return this.l[e]}h(e){var i;if(null!=(i=this.m)&&i.call(this,e),e.interactionId||"first-input"===e.entryType){var t=this.l.at(-1),r=this.u.get(e.interactionId);if(r||10>this.l.length||e.duration>t.L){var n;if(r?e.duration>r.L?(r.entries=[e],r.L=e.duration):e.duration===r.L&&e.startTime===r.entries[0].startTime&&r.entries.push(e):(this.u.set((r={id:e.interactionId,entries:[e],L:e.duration}).id,r),this.l.push(r)),this.l.sort(((e,i)=>i.L-e.L)),this.l.length>10){var a=this.l.splice(10);for(var o of a)this.u.delete(o.id)}null==(n=this.p)||n.call(this,r)}}}}var A=e=>{var i=globalThis.requestIdleCallback||setTimeout,t=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{var r=g(e),n=-1,a=()=>{t(n),r()};addEventListener("visibilitychange",a,{once:!0,capture:!0}),n=i((()=>{removeEventListener("visibilitychange",a,{capture:!0}),r()}))}},N=[200,500];class H{constructor(){this.m=void 0}h(e){var i;null==(i=this.m)||i.call(this,e)}}var W=[2500,4e3],D={onLCP(e,i){void 0===i&&(i={}),M((()=>{var t,r=w(),n=h("LCP"),a=l(i,H),d=e=>{for(var o of(i.reportAllChanges||(e=e.slice(-1)),e))a.h(o),r.firstHiddenTime>o.startTime&&(n.value=Math.max(o.startTime-u(),0),n.entries=[o],t())},f=p("largest-contentful-paint",d);if(f){t=s(e,n,W,i.reportAllChanges);var c=g((()=>{d(f.takeRecords()),f.disconnect(),t(!0)})),m=e=>{e.isTrusted&&(A(c),removeEventListener(e.type,m,{capture:!0}))};for(var b of["keydown","click","visibilitychange"])addEventListener(b,m,{capture:!0});o((r=>{n=h("LCP"),t=s(e,n,W,i.reportAllChanges),v((()=>{n.value=performance.now()-r.timeStamp,t(!0)}))}))}}))},onCLS(e,i){void 0===i&&(i={});var t=w();C(g((()=>{var r,n=h("CLS",0),a=l(i,c),d=e=>{for(var i of e)a.h(i);a.i>n.value&&(n.value=a.i,n.entries=a.o,r())},u=p("layout-shift",d);u&&(r=s(e,n,E,i.reportAllChanges),t.onHidden((()=>{d(u.takeRecords()),r(!0)})),o((()=>{a.i=0,n=h("CLS",0),r=s(e,n,E,i.reportAllChanges),v(r)})),setTimeout(r))})))},onFCP:C,onINP(e,i){if(void 0===i&&(i={}),globalThis.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype){var t=w();M((()=>{var r;"interactionCount"in performance||m||(m=p("event",I,{durationThreshold:0}));var n,a=h("INP"),v=l(i,q),d=e=>{A((()=>{for(var i of e)v.h(i);var t=v.T();t&&t.L!==a.value&&(a.value=t.L,a.entries=t.entries,n())}))},u=p("event",d,{durationThreshold:null!==(r=i.durationThreshold)&&void 0!==r?r:40});n=s(e,a,N,i.reportAllChanges),u&&(u.observe({type:"first-input",buffered:!0}),t.onHidden((()=>{d(u.takeRecords()),n(!0)})),o((()=>{v.v(),a=h("INP"),n=s(e,a,N,i.reportAllChanges)})))}))}}};r.__PosthogExtensions__=r.__PosthogExtensions__||{},r.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=r.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},r.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals"]=D,r.__PosthogExtensions__.postHogWebVitalsCallbacks=D,r.postHogWebVitalsCallbacks=D,r.__PosthogExtensions__.loadWebVitalsCallbacks=()=>D}(); //# sourceMappingURL=web-vitals.js.map