1/*! For license information please see chunk-LhrReportRendererUIFeatures-13.1.0.da2f0e1fd2c6a2a33ba5.js.LICENSE.txt */ 2"use strict";(("undefined"==typeof window?self:window).webpackChunkdebugbear_gae=("undefined"==typeof window?self:window).webpackChunkdebugbear_gae||[]).push([[4285],{99471(t,e,i){i.r(e),i.d(e,{ReportUIFeatures:()=>m});var o=i(12019);function s(t,e){const i=t.rootEl;void 0===e?i.classList.toggle("lh-dark"):i.classList.toggle("lh-dark",e)}const n="undefined"!=typeof btoa?btoa:t=>Buffer.from(t).toString("base64"),r=("undefined"!=typeof atob&&atob,async function(t,e){let i=(new TextEncoder).encode(t);if(e.gzip)if("undefined"!=typeof CompressionStream){const t=new CompressionStream("gzip"),e=t.writable.getWriter();e.write(i),e.close();const o=await new Response(t.readable).arrayBuffer();i=new Uint8Array(o)}else i=window.pako.gzip(t);let o="";for(let t=0;t<i.length;t+=5e3)o+=String.fromCharCode(...i.subarray(t,t+5e3));return n(o)});function a(){const t=window.location.host.endsWith(".vercel.app"),e=new URLSearchParams(window.location.search).has("dev");return t?`https://${window.location.host}/gh-pages`:e?"http://localhost:7333":"https://googlechrome.github.io/lighthouse"}function l(t){const e=t.generatedTime,i=t.fetchTime||e;return`${t.lighthouseVersion}-${t.finalDisplayedUrl}-${i}`}async function h(t,e,i){const o=new URL(e),s=Boolean(window.CompressionStream);o.hash=await r(JSON.stringify(t),{gzip:s}),s&&o.searchParams.set("gzip","1"),window.open(o.toString(),i)}class d{constructor(t){this._dom=t,this._toggleEl,this._menuEl,this.onDocumentKeyDown=this.onDocumentKeyDown.bind(this),this.onToggleClick=this.onToggleClick.bind(this),this.onToggleKeydown=this.onToggleKeydown.bind(this),this.onMenuFocusOut=this.onMenuFocusOut.bind(this),this.onMenuKeydown=this.onMenuKeydown.bind(this),this._getNextMenuItem=this._getNextMenuItem.bind(this),this._getNextSelectableNode=this._getNextSelectableNode.bind(this),this._getPreviousMenuItem=this._getPreviousMenuItem.bind(this)}setup(t){this._toggleEl=this._dom.find(".lh-topbar button.lh-tools__button",this._dom.rootEl),this._toggleEl.addEventListener("click",this.onToggleClick),this._toggleEl.addEventListener("keydown",this.onToggleKeydown),this._menuEl=this._dom.find(".lh-topbar div.lh-tools__dropdown",this._dom.rootEl),this._menuEl.addEventListener("keydown",this.onMenuKeydown),this._menuEl.addEventListener("click",t)}close(){this._toggleEl.classList.remove("lh-active"),this._toggleEl.setAttribute("aria-expanded","false"),this._menuEl.contains(this._dom.document().activeElement)&&this._toggleEl.focus(),this._menuEl.removeEventListener("focusout",this.onMenuFocusOut),this._dom.document().removeEventListener("keydown",this.onDocumentKeyDown)}open(t){this._toggleEl.classList.contains("lh-active")?t.focus():this._menuEl.addEventListener("transitionend",()=>{t.focus()},{once:!0}),this._toggleEl.classList.add("lh-active"),this._toggleEl.setAttribute("aria-expanded","true"),this._menuEl.addEventListener("focusout",this.onMenuFocusOut),this._dom.document().addEventListener("keydown",this.onDocumentKeyDown)}onToggleClick(t){t.preventDefault(),t.stopImmediatePropagation(),this._toggleEl.classList.contains("lh-active")?this.close():this.open(this._getNextMenuItem())}onToggleKeydown(t){switch(t.code){case"ArrowUp":t.preventDefault(),this.open(this._getPreviousMenuItem());break;case"ArrowDown":case"Enter":case" ":t.preventDefault(),this.open(this._getNextMenuItem())}}onMenuKeydown(t){const e=t.target;switch(t.code){case"ArrowUp":t.preventDefault(),this._getPreviousMenuItem(e).focus();break;case"ArrowDown":t.preventDefault(),this._getNextMenuItem(e).focus();break;case"Home":t.preventDefault(),this._getNextMenuItem().focus();break;case"End":t.preventDefault(),this._getPreviousMenuItem().focus()}}onDocumentKeyDown(t){27===t.keyCode&&this.close()}onMenuFocusOut(t){const e=t.relatedTarget;this._menuEl.contains(e)||this.close()}_getNextSelectableNode(t,e){const i=t.filter(t=>t instanceof HTMLElement).filter(t=>!t.hasAttribute("disabled")&&"none"!==window.getComputedStyle(t).display);let o=e?i.indexOf(e)+1:0;return o>=i.length&&(o=0),i[o]}_getNextMenuItem(t){const e=Array.from(this._menuEl.childNodes);return this._getNextSelectableNode(e,t)}_getPreviousMenuItem(t){const e=Array.from(this._menuEl.childNodes).reverse();return this._getNextSelectableNode(e,t)}}class c{constructor(t,e){this.lhr,this._reportUIFeatures=t,this._dom=e,this._dropDownMenu=new d(this._dom),this._copyAttempt=!1,this.topbarEl,this.categoriesEl,this.stickyHeaderEl,this.highlightEl,this.onDropDownMenuClick=this.onDropDownMenuClick.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.onCopy=this.onCopy.bind(this),this.collapseAllDetails=this.collapseAllDetails.bind(this)}enable(t){this.lhr=t,this._dom.rootEl.addEventListener("keyup",this.onKeyUp),this._dom.document().addEventListener("copy",this.onCopy),this._dropDownMenu.setup(this.onDropDownMenuClick),this._setUpCollapseDetailsAfterPrinting(),this._dom.find(".lh-topbar__logo",this._dom.rootEl).addEventListener("click",()=>s(this._dom)),this._setupStickyHeader()}onDropDownMenuClick(t){t.preventDefault();const e=t.target;if(e&&e.hasAttribute("data-action")){switch(e.getAttribute("data-action")){case"copy":this.onCopyButtonClick();break;case"print-summary":this.collapseAllDetails(),this._print();break;case"print-expanded":this.expandAllDetails(),this._print();break;case"save-json":{const t=JSON.stringify(this.lhr,null,2);this._reportUIFeatures._saveFile(new Blob([t],{type:"application/json"}));break}case"save-html":{const e=this._reportUIFeatures.getReportHtml();try{this._reportUIFeatures._saveFile(new Blob([e],{type:"text/html"}))}catch(t){this._dom.fireEventOn("lh-log",this._dom.document(),{cmd:"error",msg:"Could not export as HTML. "+t.message})}break}case"open-viewer":this._dom.isDevTools()?async function(t){const e="viewer-"+l(t),i=a()+"/viewer/";await h({lhr:t},i,e)}(this.lhr):async function(t){const e="viewer-"+l(t);
2!function(t,e,i){const o=new URL(e).origin;window.addEventListener("message",function e(i){i.origin===o&&s&&i.data.opened&&(s.postMessage(t,o),window.removeEventListener("message",e))});const s=window.open(e,i)}({lhr:t},a()+"/viewer/",e)}(this.lhr);break;case"save-gist":this._reportUIFeatures.saveAsGist();break;case"toggle-dark":s(this._dom);break;case"view-unthrottled-trace":this._reportUIFeatures._opts.onViewTrace?.()}this._dropDownMenu.close()}}onCopy(t){this._copyAttempt&&t.clipboardData&&(t.preventDefault(),t.clipboardData.setData("text/plain",JSON.stringify(this.lhr,null,2)),this._dom.fireEventOn("lh-log",this._dom.document(),{cmd:"log",msg:"Report JSON copied to clipboard"})),this._copyAttempt=!1}onCopyButtonClick(){this._dom.fireEventOn("lh-analytics",this._dom.document(),{name:"copy"});try{this._dom.document().queryCommandSupported("copy")&&(this._copyAttempt=!0,this._dom.document().execCommand("copy")||(this._copyAttempt=!1,this._dom.fireEventOn("lh-log",this._dom.document(),{cmd:"warn",msg:"Your browser does not support copy to clipboard."})))}catch(t){this._copyAttempt=!1,this._dom.fireEventOn("lh-log",this._dom.document(),{cmd:"log",msg:t.message})}}onKeyUp(t){(t.ctrlKey||t.metaKey)&&80===t.keyCode&&this._dropDownMenu.close()}expandAllDetails(){this._dom.findAll(".lh-categories details",this._dom.rootEl).map(t=>t.open=!0)}collapseAllDetails(){this._dom.findAll(".lh-categories details",this._dom.rootEl).map(t=>t.open=!1)}_print(){this._reportUIFeatures._opts.onPrintOverride?this._reportUIFeatures._opts.onPrintOverride(this._dom.rootEl):self.print()}resetUIState(){this._dropDownMenu.close()}_getScrollParent(t){const{overflowY:e}=window.getComputedStyle(t);return"visible"!==e&&"hidden"!==e?t:t.parentElement?this._getScrollParent(t.parentElement):document}_setUpCollapseDetailsAfterPrinting(){"onbeforeprint"in self?self.addEventListener("afterprint",this.collapseAllDetails):self.matchMedia("print").addListener(t=>{t.matches?this.expandAllDetails():this.collapseAllDetails()})}_setupStickyHeader(){this.topbarEl=this._dom.find("div.lh-topbar",this._dom.rootEl),this.categoriesEl=this._dom.find("div.lh-categories",this._dom.rootEl),requestAnimationFrame(()=>requestAnimationFrame(()=>{try{this.stickyHeaderEl=this._dom.find("div.lh-sticky-header",this._dom.rootEl)}catch{return}this.highlightEl=this._dom.createChildOf(this.stickyHeaderEl,"div","lh-highlighter");const t=this._getScrollParent(this._dom.find(".lh-container",this._dom.rootEl));t.addEventListener("scroll",()=>this._updateStickyHeader());const e=t instanceof window.Document?document.documentElement:t;new window.ResizeObserver(()=>this._updateStickyHeader()).observe(e)}))}_updateStickyHeader(){if(!this.stickyHeaderEl)return;const t=this.topbarEl.getBoundingClientRect().bottom>=this.categoriesEl.getBoundingClientRect().top,e=Array.from(this._dom.rootEl.querySelectorAll(".lh-category")).filter(t=>t.getBoundingClientRect().top-window.innerHeight/2<0),i=e.length>0?e.length-1:0,o=this.stickyHeaderEl.querySelectorAll(".lh-gauge__wrapper, .lh-fraction__wrapper"),s=o[i],n=o[0].getBoundingClientRect().left,r=s.getBoundingClientRect().left-n;this.highlightEl.style.transform=`translate(${r}px)`,this.stickyHeaderEl.classList.toggle("lh-sticky-header--visible",t)}}var u=i(91444);var p=i(40531);class m{constructor(t,e={}){this.json,this._dom=t,this._opts=e,this._topbar=e.omitTopbar?null:new c(this,t),this.onMediaQueryChange=this.onMediaQueryChange.bind(this)}initFeatures(t){this.json=t,this._fullPageScreenshot=u.J.getFullPageScreenshot(t),this._topbar&&(this._topbar.enable(t),this._topbar.resetUIState()),this._setupMediaQueryListeners(),this._setupThirdPartyFilter(),this._setupElementScreenshotOverlay(this._dom.rootEl);const e=this._dom.isDevTools()||this._opts.disableDarkMode||this._opts.disableAutoDarkModeAndFireworks;!e&&window.matchMedia("(prefers-color-scheme: dark)").matches&&s(this._dom,!0);const i=["performance","accessibility","best-practices","seo"].every(e=>{const i=t.categories[e];return i&&1===i.score}),o=this._opts.disableFireworks||this._opts.disableAutoDarkModeAndFireworks;i&&!o&&(this._enableFireworks(),e||s(this._dom,!0)),t.categories.performance&&t.categories.performance.auditRefs.some(e=>Boolean("metrics"===e.group&&t.audits[e.id].errorMessage))&&(this._dom.find("input.lh-metrics-toggle__input",this._dom.rootEl).checked=!0),this.json.audits["script-treemap-data"]&&this.json.audits["script-treemap-data"].details&&this.addButton({text:p.R.strings.viewTreemapLabel,icon:"treemap",onClick:()=>function(t){if(!t.audits["script-treemap-data"].details)throw new Error("no script treemap data found");h({lhr:{mainDocumentUrl:t.mainDocumentUrl,finalUrl:t.finalUrl,finalDisplayedUrl:t.finalDisplayedUrl,audits:{"script-treemap-data":t.audits["script-treemap-data"]},configSettings:{locale:t.configSettings.locale}}},a()+"/treemap/","treemap-"+l(t))}(this.json)}),this._opts.onViewTrace&&("simulate"===t.configSettings.throttlingMethod?this._dom.find('a[data-action="view-unthrottled-trace"]',this._dom.rootEl).classList.remove("lh-hidden"):this.addButton({text:p.R.strings.viewTraceLabel,onClick:()=>this._opts.onViewTrace?.()})),this._opts.getStandaloneReportHTML&&this._dom.find('a[data-action="save-html"]',this._dom.rootEl).classList.remove("lh-hidden");for(const t of this._dom.findAll("[data-i18n]",this._dom.rootEl)){const e=t.getAttribute("data-i18n");t.textContent=p.R.strings[e]}}addButton(t){const e=this._dom.rootEl.querySelector(".lh-audit-group--metrics");if(!e)return;let i=e.querySelector(".lh-buttons");i||(i=this._dom.createChildOf(e,"div","lh-buttons"));const o=["lh-button"];t.icon&&(o.push("lh-report-icon"),o.push(`lh-report-icon--${t.icon}`));const s=this._dom.createChildOf(i,"button",o.join(" "));return s.textContent=t.text,s.addEventListener("click",t.onClick),s}resetUIState(){this._topbar&&this._topbar.resetUIState()}getReportHtml(){if(!this._opts.getStandaloneReportHTML)throw new Error("`getStandaloneReportHTML` is not set");return this.resetUIState(),this._opts.getStandaloneReportHTML()}saveAsGist(){throw new Error("Cannot save as gist from base report")}_enableFireworks(){this._dom.find(".lh-scores-container",this._dom.rootEl).classList.add("lh-score100")}_setupMediaQueryListeners(){const t=self.matchMedia("(max-width: 500px)");t.addListener(this.onMediaQueryChange),this.onMediaQueryChange(t)}
2_resetUIState(){this._topbar&&this._topbar.resetUIState()}onMediaQueryChange(t){this._dom.rootEl.classList.toggle("lh-narrow",t.matches)}_setupThirdPartyFilter(){const t=["uses-rel-preconnect","third-party-facades","network-dependency-tree-insight"],e=["legacy-javascript","legacy-javascript-insight"];Array.from(this._dom.rootEl.querySelectorAll("table.lh-table")).filter(t=>t.querySelector("td.lh-table-column--url, td.lh-table-column--source-location")).filter(e=>{const i=e.closest(".lh-audit");if(!i)throw new Error(".lh-table not within audit");return!t.includes(i.id)}).forEach(t=>{const i=function(t){return Array.from(t.tBodies[0].rows)}(t),o=i.filter(t=>!t.classList.contains("lh-sub-item-row")),s=this._getThirdPartyRows(o,u.J.getFinalDisplayedUrl(this.json)),n=i.some(t=>t.classList.contains("lh-row--even")),r=this._dom.createComponent("3pFilter"),a=this._dom.find("input",r);a.addEventListener("change",t=>{const e=t.target instanceof HTMLInputElement&&!t.target.checked;let i=!0,r=o[0];for(;r;){const t=e&&s.includes(r);do{r.classList.toggle("lh-row--hidden",t),n&&(r.classList.toggle("lh-row--even",!t&&i),r.classList.toggle("lh-row--odd",!t&&!i)),r=r.nextElementSibling}while(r&&r.classList.contains("lh-sub-item-row"));t||(i=!i)}});const l=s.filter(t=>!t.classList.contains("lh-row--group")).length;this._dom.find(".lh-3p-filter-count",r).textContent=`${l}`,this._dom.find(".lh-3p-ui-string",r).textContent=p.R.strings.thirdPartyResourcesLabel;const h=s.length===o.length,d=!s.length;if((h||d)&&(this._dom.find("div.lh-3p-filter",r).hidden=!0),!t.parentNode)return;t.parentNode.insertBefore(r,t);const c=t.closest(".lh-audit");if(!c)throw new Error(".lh-table not within audit");e.includes(c.id)&&!h&&a.click()})}_setupElementScreenshotOverlay(t){this._fullPageScreenshot&&o.o.installOverlayFeature({dom:this._dom,rootEl:t,overlayContainerEl:t,fullPageScreenshot:this._fullPageScreenshot})}_getThirdPartyRows(t,e){const i=u.J.getEntityFromUrl(e,this.json.entities),o=this.json.entities?.find(t=>!0===t.isFirstParty)?.name,s=[];for(const e of t){if(o){if(!e.dataset.entity||e.dataset.entity===o)continue}else{const t=e.querySelector("div.lh-text__url");
2if(!t)continue;const o=t.dataset.url;if(!o)continue;if(u.J.getEntityFromUrl(o,this.json.entities)===i)continue}s.push(e)}return s}_saveFile(t){const e=t.type.match("json")?".json":".html",i=(o={finalDisplayedUrl:u.J.getFinalDisplayedUrl(this.json),fetchTime:this.json.fetchTime},function(t,e){const i=e?new Date(e):new Date,o=i.toLocaleTimeString("en-US",{hour12:!1}),s=i.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}).split("/");return s.unshift(s.pop()),`${t}_${s.join("-")}_${o}`.replace(/[/?<>\\:*|"]/g,"-")}(new URL(o.finalDisplayedUrl).hostname,o.fetchTime)+e);var o;this._opts.onSaveFileOverride?this._opts.onSaveFileOverride(t,i):this._dom.saveFile(t,i)}}}}]);
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.