Haleshot's picture
Update course materials and assets across various sections, including functional programming, optimization, probability, and Python. Enhance HTML content and ensure consistency in asset management.
565ea71 unverified
raw
history blame
5.48 kB
var e,n=-1,t=function(e){addEventListener("pageshow",(function(t){t.persisted&&(n=t.timeStamp,e(t))}),!0)},r=function(){var e=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},i=function(){var e=r();return e&&e.activationStart||0},a=function(e,t){var a=r(),o="navigate";return n>=0?o="back-forward-cache":a&&(document.prerendering||i()>0?o="prerender":document.wasDiscarded?o="restore":a.type&&(o=a.type.replace(/_/g,"-"))),{name:e,value:void 0===t?-1:t,rating:"good",delta:0,entries:[],id:"v4-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:o}},o=function(e,n,t){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var r=new PerformanceObserver((function(e){Promise.resolve().then((function(){n(e.getEntries())}))}));return r.observe(Object.assign({type:e,buffered:!0},t||{})),r}}catch(i){}},c=function(e,n,t,r){var i,a;return function(o){var c,u;n.value>=0&&(o||r)&&((a=n.value-(i||0))||void 0===i)&&(i=n.value,n.delta=a,n.rating=(c=n.value)>(u=t)[1]?"poor":c>u[0]?"needs-improvement":"good",e(n))}},u=function(e){requestAnimationFrame((function(){return requestAnimationFrame((function(){return e()}))}))},s=function(e){document.addEventListener("visibilitychange",(function(){"hidden"===document.visibilityState&&e()}))},f=function(e){var n=!1;return function(){n||(e(),n=!0)}},d=-1,l=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},v=function(e){"hidden"===document.visibilityState&&d>-1&&(d="visibilitychange"===e.type?e.timeStamp:0,m())},h=function(){addEventListener("visibilitychange",v,!0),addEventListener("prerenderingchange",v,!0)},m=function(){removeEventListener("visibilitychange",v,!0),removeEventListener("prerenderingchange",v,!0)},p=function(){return d<0&&(d=l(),h(),t((function(){setTimeout((function(){d=l(),h()}),0)}))),{get firstHiddenTime(){return d}}},g=function(e){document.prerendering?addEventListener("prerenderingchange",(function(){return e()}),!0):e()},y=[1800,3e3],T=function(e,n){n=n||{},g((function(){var r,s=p(),f=a("FCP"),d=o("paint",(function(e){e.forEach((function(e){"first-contentful-paint"===e.name&&(d.disconnect(),e.startTime<s.firstHiddenTime&&(f.value=Math.max(e.startTime-i(),0),f.entries.push(e),r(!0)))}))}));d&&(r=c(e,f,y,n.reportAllChanges),t((function(t){f=a("FCP"),r=c(e,f,y,n.reportAllChanges),u((function(){f.value=performance.now()-t.timeStamp,r(!0)}))})))}))},C=[.1,.25],E=function(e,n){n=n||{},T(f((function(){var r,i=a("CLS",0),f=0,d=[],l=function(e){e.forEach((function(e){if(!e.hadRecentInput){var n=d[0],t=d[d.length-1];f&&e.startTime-t.startTime<1e3&&e.startTime-n.startTime<5e3?(f+=e.value,d.push(e)):(f=e.value,d=[e])}})),f>i.value&&(i.value=f,i.entries=d,r())},v=o("layout-shift",l);v&&(r=c(e,i,C,n.reportAllChanges),s((function(){l(v.takeRecords()),r(!0)})),t((function(){f=0,i=a("CLS",0),r=c(e,i,C,n.reportAllChanges),u((function(){return r()}))})),setTimeout(r,0))})))},b=0,P=1/0,L=0,S=function(e){e.forEach((function(e){e.interactionId&&(P=Math.min(P,e.interactionId),L=Math.max(L,e.interactionId),b=L?(L-P)/7+1:0)}))},I=function(){return e?b:performance.interactionCount||0},A=[],w=new Map,M=0,k=[],F=function(e){if(k.forEach((function(n){return n(e)})),e.interactionId||"first-input"===e.entryType){var n=A[A.length-1],t=w.get(e.interactionId);if(t||A.length<10||e.duration>n.latency){if(t)e.duration>t.latency?(t.entries=[e],t.latency=e.duration):e.duration===t.latency&&e.startTime===t.entries[0].startTime&&t.entries.push(e);else{var r={id:e.interactionId,latency:e.duration,entries:[e]};w.set(r.id,r),A.push(r)}A.sort((function(e,n){return n.latency-e.latency})),A.length>10&&A.splice(10).forEach((function(e){return w.delete(e.id)}))}}},x=function(e){var n=self.requestIdleCallback||self.setTimeout,t=-1;return e=f(e),"hidden"===document.visibilityState?e():(t=n(e),s(e)),t},N=[200,500],R=function(n,r){"PerformanceEventTiming"in self&&"interactionId"in PerformanceEventTiming.prototype&&(r=r||{},g((function(){var i;"interactionCount"in performance||e||(e=o("event",S,{type:"event",buffered:!0,durationThreshold:0}));var u,f=a("INP"),d=function(e){x((function(){e.forEach(F);var n=function(){var e=Math.min(A.length-1,Math.floor((I()-M)/50));return A[e]}();n&&n.latency!==f.value&&(f.value=n.latency,f.entries=n.entries,u())}))},l=o("event",d,{durationThreshold:null!==(i=r.durationThreshold)&&void 0!==i?i:40});u=c(n,f,N,r.reportAllChanges),l&&(l.observe({type:"first-input",buffered:!0}),s((function(){d(l.takeRecords()),u(!0)})),t((function(){M=I(),A.length=0,w.clear(),f=a("INP"),u=c(n,f,N,r.reportAllChanges)})))})))},q=[2500,4e3],H={},O=function(e,n){n=n||{},g((function(){var r,d=p(),l=a("LCP"),v=function(e){n.reportAllChanges||(e=e.slice(-1)),e.forEach((function(e){e.startTime<d.firstHiddenTime&&(l.value=Math.max(e.startTime-i(),0),l.entries=[e],r())}))},h=o("largest-contentful-paint",v);if(h){r=c(e,l,q,n.reportAllChanges);var m=f((function(){H[l.id]||(v(h.takeRecords()),h.disconnect(),H[l.id]=!0,r(!0))}));["keydown","click"].forEach((function(e){addEventListener(e,(function(){return x(m)}),{once:!0,capture:!0})})),s(m),t((function(t){l=a("LCP"),r=c(e,l,q,n.reportAllChanges),u((function(){l.value=performance.now()-t.timeStamp,H[l.id]=!0,r(!0)}))}))}}))};export{C as CLSThresholds,y as FCPThresholds,N as INPThresholds,q as LCPThresholds,E as onCLS,T as onFCP,R as onINP,O as onLCP};