1/*! For license information please see chunk-LhrReportRenderer-12.3.0.17c37136cb33bf7b5050.js.LICENSE.txt */ 2"use strict";(("undefined"==typeof window?self:window).webpackChunkdebugbear_gae=("undefined"==typeof window?self:window).webpackChunkdebugbear_gae||[]).push([[6967],{17328(e,t,r){r.r(t),r.d(t,{ReportRenderer:()=>f});var i=r(53850),n=r(1548);class s{constructor(e,t){this.dom=e,this.detailsRenderer=t}get _clumpTitles(){return{warning:n.R.strings.warningAuditsGroupTitle,manual:n.R.strings.manualAuditsGroupTitle,passed:n.R.strings.passedAuditsGroupTitle,notApplicable:n.R.strings.notApplicableAuditsGroupTitle}}renderAudit(e){const t=n.R.strings,r=this.dom.createComponent("audit"),i=this.dom.find("div.lh-audit",r);i.id=e.result.id;const s=e.result.scoreDisplayMode;e.result.displayValue&&(this.dom.find(".lh-audit__display-text",i).textContent=e.result.displayValue);const o=this.dom.find(".lh-audit__title",i);o.append(this.dom.convertMarkdownCodeSnippets(e.result.title));const a=this.dom.find(".lh-audit__description",i);a.append(this.dom.convertMarkdownLinkSnippets(e.result.description));for(const t of e.relevantMetrics||[]){const e=this.dom.createChildOf(a,"span","lh-audit__adorn");e.title=`Relevant to ${t.result.title}`,e.textContent=t.acronym||t.id}e.stackPacks&&e.stackPacks.forEach(e=>{const t=this.dom.createElement("img","lh-audit__stackpack__img");t.src=e.iconDataURL,t.alt=e.title;const r=this.dom.convertMarkdownLinkSnippets(e.description,{alwaysAppendUtmSource:!0}),n=this.dom.createElement("div","lh-audit__stackpack");n.append(t,r),this.dom.find(".lh-audit__stackpacks",i).append(n)});const l=this.dom.find("details",i);if(e.result.details){const t=this.detailsRenderer.render(e.result.details);t&&(t.classList.add("lh-details"),l.append(t))}if(this.dom.find(".lh-chevron-container",i).append(this._createChevron()),this._setRatingClass(i,e.result.score,s),"error"===e.result.scoreDisplayMode){i.classList.add("lh-audit--error");
2const r=this.dom.find(".lh-audit__display-text",i);r.textContent=t.errorLabel,r.classList.add("lh-tooltip-boundary"),this.dom.createChildOf(r,"div","lh-tooltip lh-tooltip--error").textContent=e.result.errorMessage||t.errorMissingAuditInfo}else e.result.explanation&&(this.dom.createChildOf(o,"div","lh-audit-explanation").textContent=e.result.explanation);const d=e.result.warnings;if(!d||0===d.length)return i;const c=this.dom.find("summary",l),h=this.dom.createChildOf(c,"div","lh-warnings");if(this.dom.createChildOf(h,"span").textContent=t.warningHeader,1===d.length)h.append(this.dom.createTextNode(d.join("")));else{const e=this.dom.createChildOf(h,"ul");for(const t of d)this.dom.createChildOf(e,"li").textContent=t}return i}injectFinalScreenshot(e,t,r){const i=t["final-screenshot"];if(!i||"error"===i.scoreDisplayMode)return null;if(!i.details||"screenshot"!==i.details.type)return null;const n=this.dom.createElement("img","lh-final-ss-image"),s=i.details.data;n.src=s,n.alt=i.title;const o=this.dom.find(".lh-category .lh-category-header",e),a=this.dom.createElement("div","lh-category-headercol"),l=this.dom.createElement("div","lh-category-headercol lh-category-headercol--separator"),d=this.dom.createElement("div","lh-category-headercol");a.append(...o.childNodes),a.append(r),d.append(n),o.append(a,l,d),o.classList.add("lh-category-header__finalscreenshot")}_createChevron(){const e=this.dom.createComponent("chevron");return this.dom.find("svg.lh-chevron",e)}_setRatingClass(e,t,r){const n=i.y.calculateRating(t,r);return e.classList.add(`lh-audit--${r.toLowerCase()}`),"informative"!==r&&e.classList.add(`lh-audit--${n}`),e}renderCategoryHeader(e,t,r){const i=this.dom.createComponent("categoryHeader"),n=this.dom.find(".lh-score__gauge",i),s=this.renderCategoryScore(e,t,r);if(n.append(s),e.description){const t=this.dom.convertMarkdownLinkSnippets(e.description);this.dom.find(".lh-category-header__description",i).append(t)}return i}renderAuditGroup(e){const t=this.dom.createElement("div","lh-audit-group"),r=this.dom.createElement("div","lh-audit-group__header");this.dom.createChildOf(r,"span","lh-audit-group__title").textContent=e.title,t.append(r);let i=null;return e.description&&(i=this.dom.convertMarkdownLinkSnippets(e.description),i.classList.add("lh-audit-group__description","lh-audit-group__footer"),t.append(i)),[t,i]}_renderGroupedAudits(e,t){const r=new Map,i="NotAGroup";r.set(i,[]);for(const t of e){const e=t.group||i,n=r.get(e)||[];n.push(t),r.set(e,n)}const n=[];for(const[e,s]of r){if(e===i){for(const e of s)n.push(this.renderAudit(e));continue}const r=t[e],[o,a]=this.renderAuditGroup(r);for(const e of s)o.insertBefore(this.renderAudit(e),a);o.classList.add(`lh-audit-group--${e}`),n.push(o)}return n}renderUnexpandableClump(e,t){const r=this.dom.createElement("div");return this._renderGroupedAudits(e,t).forEach(e=>r.append(e)),r}renderClump(e,{auditRefsOrEls:t,description:r,openByDefault:i}){const s=this.dom.createComponent("clump"),o=this.dom.find(".lh-clump",s);i&&o.setAttribute("open","");const a=this.dom.find(".lh-audit-group__header",o),l=this._clumpTitles[e];this.dom.find(".lh-audit-group__title",a).textContent=l,this.dom.find(".lh-audit-group__itemcount",o).textContent=`(${t.length})`;const d=t.map(e=>e instanceof HTMLElement?e:this.renderAudit(e));o.append(...d);const c=this.dom.find(".lh-audit-group",s);if(r){const e=this.dom.convertMarkdownLinkSnippets(r);e.classList.add("lh-audit-group__description","lh-audit-group__footer"),c.append(e)}return this.dom.find(".lh-clump-toggletext--show",c).textContent=n.R.strings.show,this.dom.find(".lh-clump-toggletext--hide",c).textContent=n.R.strings.hide,o.classList.add(`lh-clump--${e.toLowerCase()}`),c}renderCategoryScore(e,t,r){let n;if(n=r&&i.y.shouldDisplayAsFraction(r.gatherMode)?this.renderCategoryFraction(e):this.renderScoreGauge(e,t),r?.omitLabel&&this.dom.find(".lh-gauge__label,.lh-fraction__label",n).remove(),r?.onPageAnchorRendered){const e=this.dom.find("a",n);r.onPageAnchorRendered(e)}return n}renderScoreGauge(e,t){const r=this.dom.createComponent("gauge"),s=this.dom.find("a.lh-gauge__wrapper",r);i.y.isPluginCategory(e.id)&&s.classList.add("lh-gauge__wrapper--plugin");const o=Number(e.score),a=this.dom.find(".lh-gauge",r),l=this.dom.find("circle.lh-gauge-arc",a);l&&this._setGaugeArc(l,o);const d=Math.round(100*o),c=this.dom.find("div.lh-gauge__percentage",r);return c.textContent=d.toString(),null===e.score&&(c.classList.add("lh-gauge--error"),c.textContent="",c.title=n.R.strings.errorLabel),0===e.auditRefs.length||this.hasApplicableAudits(e)?s.classList.add(`lh-gauge__wrapper--${i.y.calculateRating(e.score)}`):(s.classList.add("lh-gauge__wrapper--not-applicable"),c.textContent="-",c.title=n.R.strings.notApplicableAuditsGroupTitle),this.dom.find(".lh-gauge__label",r).textContent=e.title,r}renderCategoryFraction(e){const t=this.dom.createComponent("fraction"),r=this.dom.find("a.lh-fraction__wrapper",t),{numPassed:n,numPassableAudits:s,totalWeight:o}=i.y.calculateCategoryFraction(e),a=n/s,l=this.dom.find(".lh-fraction__content",t),d=this.dom.createElement("span");d.textContent=`${n}/${s}`,l.append(d);let c=i.y.calculateRating(a);return 0===o&&(c="null"),r.classList.add(`lh-fraction__wrapper--${c}`),this.dom.find(".lh-fraction__label",t).textContent=e.title,t}hasApplicableAudits(e){return e.auditRefs.some(e=>"notApplicable"!==e.result.scoreDisplayMode)}_setGaugeArc(e,t){const r=2*Math.PI*Number(e.getAttribute("r")),i=Number(e.getAttribute("stroke-width")),n=.25*i/r;e.style.transform=`rotate(${360*n-90}deg)`;let s=t*r-i/2;0===t&&(e.style.opacity="0"),1===t&&(s=r),e.style.strokeDasharray=`${Math.max(s,0)} ${r}`}_auditHasWarning(e){return Boolean(e.result.warnings?.length)}_getClumpIdForAuditRef(e){const t=e.result.scoreDisplayMode;return"manual"===t||"notApplicable"===t?t:i.y.showAsPassed(e.result)?this._auditHasWarning(e)?"warning":"passed":"failed"}render(e,t={},r){const i=this.dom.createElement("div","lh-category");i.id=e.id,i.append(this.renderCategoryHeader(e,t,r));const n=new Map;n.set("failed",[]),n.set("warning",[]),n.set("manual",[]),n.set("passed",[]),n.set("notApplicable",[]);for(const t of e.auditRefs){if("hidden"===t.group)continue;const e=this._getClumpIdForAuditRef(t),r=n.get(e);r.push(t),n.set(e,r)}for(const e of n.values())e.sort((e,t)=>
2t.weight-e.weight);const s=n.get("failed")?.length;for(const[r,o]of n){if(0===o.length)continue;if("failed"===r){const e=this.renderUnexpandableClump(o,t);e.classList.add("lh-clump--failed"),i.append(e);continue}const n="manual"===r?e.manualDescription:void 0,a="warning"===r||"manual"===r&&0===s,l=this.renderClump(r,{auditRefsOrEls:o,description:n,openByDefault:a});i.append(l)}return i}}var o=r(92127);class a{static initTree(e){let t=0;const r=Object.keys(e);return r.length>0&&(t=e[r[0]].request.startTime),{tree:e,startTime:t,transferSize:0}}static createSegment(e,t,r,i,n,s){const o=e[t],a=Object.keys(e),l=a.indexOf(t)===a.length-1,d=!!o.children&&Object.keys(o.children).length>0,c=Array.isArray(n)?n.slice(0):[];return void 0!==s&&c.push(!s),{node:o,isLastChild:l,hasChildren:d,startTime:r,transferSize:i+o.request.transferSize,treeMarkers:c}}static createChainNode(e,t,r){const i=e.createComponent("crcChain");e.find(".lh-crc-node",i).setAttribute("title",t.node.request.url);const s=e.find(".lh-crc-node__tree-marker",i);t.treeMarkers.forEach(t=>{const r=t?"lh-tree-marker lh-vert":"lh-tree-marker";s.append(e.createElement("span",r),e.createElement("span","lh-tree-marker"))});const o=t.isLastChild?"lh-tree-marker lh-up-right":"lh-tree-marker lh-vert-right",a=t.hasChildren?"lh-tree-marker lh-horiz-down":"lh-tree-marker lh-right";s.append(e.createElement("span",o),e.createElement("span","lh-tree-marker lh-right"),e.createElement("span",a));const l=t.node.request.url,d=r.renderTextURL(l),c=e.find(".lh-crc-node__tree-value",i);if(c.append(d),!t.hasChildren){const{startTime:r,endTime:i,transferSize:s}=t.node.request,o=e.createElement("span","lh-crc-node__chain-duration");o.textContent=" - "+n.R.i18n.formatMilliseconds(1e3*(i-r))+", ";const a=e.createElement("span","lh-crc-node__chain-duration");a.textContent=n.R.i18n.formatBytesToKiB(s,.01),c.append(o,a)}return i}static buildTree(e,t,r,i,n,s){if(i.append(l.createChainNode(e,r,s)),r.node.children)for(const o of Object.keys(r.node.children)){const a=l.createSegment(r.node.children,o,r.startTime,r.transferSize,r.treeMarkers,r.isLastChild);l.buildTree(e,t,a,i,n,s)}}static render(e,t,r){const i=e.createComponent("crc"),s=e.find(".lh-crc",i);e.find(".lh-crc-initial-nav",i).textContent=n.R.strings.crcInitialNavigation,e.find(".lh-crc__longest_duration_label",i).textContent=n.R.strings.crcLongestDurationLabel,e.find(".lh-crc__longest_duration",i).textContent=n.R.i18n.formatMilliseconds(t.longestChain.duration);const o=l.initTree(t.chains);for(const n of Object.keys(o.tree)){const a=l.createSegment(o.tree,n,o.startTime,o.transferSize);l.buildTree(e,i,a,s,t,r)}return e.find(".lh-crc-container",i)}}const l=a;var d=r(71690);const c=["http://","https://","data:"],h=["bytes","numeric","ms","timespanMs"];class u{constructor(e,t={}){this._dom=e,this._fullPageScreenshot=t.fullPageScreenshot,this._entities=t.entities}render(e){switch(e.type){case"filmstrip":return this._renderFilmstrip(e);case"list":return this._renderList(e);case"table":case"opportunity":return this._renderTable(e);case"criticalrequestchain":return a.render(this._dom,e,this);case"screenshot":case"debugdata":case"treemap-data":return null;default:return this._renderUnknown(e.type,e)}}_renderBytes(e){const t=n.R.i18n.formatBytesToKiB(e.value,e.granularity||.1),r=this._renderText(t);return r.title=n.R.i18n.formatBytes(e.value),r}_renderMilliseconds(e){let t;return t="duration"===e.displayUnit?n.R.i18n.formatDuration(e.value):n.R.i18n.formatMilliseconds(e.value,e.granularity||10),this._renderText(t)}renderTextURL(e){const t=e;let r,i,n;try{const e=o.J.parseURL(t);r="/"===e.file?e.origin:e.file,i="/"===e.file||""===e.hostname?"":`(${e.hostname})`,n=t}catch(e){r=t}const s=this._dom.createElement("div","lh-text__url");
2if(s.append(this._renderLink({text:r,url:t})),i){const e=this._renderText(i);e.classList.add("lh-text__url-host"),s.append(e)}return n&&(s.title=t,s.dataset.url=t),s}_renderLink(e){const t=this._dom.createElement("a");if(this._dom.safelySetHref(t,e.url),!t.href){const t=this._renderText(e.text);return t.classList.add("lh-link"),t}return t.rel="noopener",t.target="_blank",t.textContent=e.text,t.classList.add("lh-link"),t}_renderText(e){const t=this._dom.createElement("div","lh-text");return t.textContent=e,t}_renderNumeric(e){const t=n.R.i18n.formatNumber(e.value,e.granularity||.1),r=this._dom.createElement("div","lh-numeric");return r.textContent=t,r}_renderThumbnail(e){const t=this._dom.createElement("img","lh-thumbnail"),r=e;return t.src=r,t.title=r,t.alt="",t}_renderUnknown(e,t){console.error(`Unknown details type: ${e}`,t);const r=this._dom.createElement("details","lh-unknown");return this._dom.createChildOf(r,"summary").textContent=`We don't know how to render audit details of type \`${e}\`. The Lighthouse version that collected this data is likely newer than the Lighthouse version of the report renderer. Expand for the raw JSON.`,this._dom.createChildOf(r,"pre").textContent=JSON.stringify(t,null,2),r}_renderTableValue(e,t){if(null==e)return null;if("object"==typeof e)switch(e.type){case"code":return this._renderCode(e.value);case"link":return this._renderLink(e);case"node":return this.renderNode(e);case"numeric":return this._renderNumeric(e);case"source-location":return this.renderSourceLocation(e);case"url":return this.renderTextURL(e.value);default:return this._renderUnknown(e.type,e)}switch(t.valueType){case"bytes":{const r=Number(e);return this._renderBytes({value:r,granularity:t.granularity})}case"code":{const t=String(e);return this._renderCode(t)}case"ms":{const r={value:Number(e),granularity:t.granularity,displayUnit:t.displayUnit};return this._renderMilliseconds(r)}case"numeric":{const r=Number(e);return this._renderNumeric({value:r,granularity:t.granularity})}case"text":{const t=String(e);return this._renderText(t)}case"thumbnail":{const t=String(e);return this._renderThumbnail(t)}case"timespanMs":{const t=Number(e);return this._renderMilliseconds({value:t})}case"url":{const t=String(e);return c.some(e=>t.startsWith(e))?this.renderTextURL(t):this._renderCode(t)}default:return this._renderUnknown(t.valueType,e)}}_getDerivedSubItemsHeading(e){return e.subItemsHeading?{key:e.subItemsHeading.key||"",valueType:e.subItemsHeading.valueType||e.valueType,granularity:e.subItemsHeading.granularity||e.granularity,displayUnit:e.subItemsHeading.displayUnit||e.displayUnit,label:""}:null}_renderTableRow(e,t){const r=this._dom.createElement("tr");for(const i of t){if(!i||!i.key){this._dom.createChildOf(r,"td","lh-table-column--empty");continue}const t=e[i.key];let n;if(null!=t&&(n=this._renderTableValue(t,i)),n){const e=`lh-table-column--${i.valueType}`;this._dom.createChildOf(r,"td",e).append(n)}else this._dom.createChildOf(r,"td","lh-table-column--empty")}return r}_renderTableRowsFromItem(e,t){const r=this._dom.createFragment();if(r.append(this._renderTableRow(e,t)),!e.subItems)return r;const i=t.map(this._getDerivedSubItemsHeading);if(!i.some(Boolean))return r;for(const t of e.subItems.items){const e=this._renderTableRow(t,i);e.classList.add("lh-sub-item-row"),r.append(e)}return r}_adornEntityGroupRow(e){const t=e.dataset.entity;if(!t)return;const r=this._entities?.find(e=>e.name===t);if(!r)return;const i=this._dom.find("td",e);if(r.category){const e=this._dom.createElement("span");e.classList.add("lh-audit__adorn"),e.textContent=r.category,i.append(" ",e)}if(r.isFirstParty){const e=this._dom.createElement("span");e.classList.add("lh-audit__adorn","lh-audit__adorn1p"),e.textContent=n.R.strings.firstPartyChipLabel,i.append(" ",e)}if(r.homepage){const e=this._dom.createElement("a");e.href=r.homepage,e.target="_blank",e.title=n.R.strings.openInANewTabTooltip,e.classList.add("lh-report-icon--external"),i.append(" ",e)}}_renderEntityGroupRow(e,t){const r={...t[0]};r.valueType="text";const i=[r,...t.slice(1)],n=this._dom.createFragment();return n.append(this._renderTableRow(e,i)),this._dom.find("tr",n).classList.add("lh-row--group"),n}_getEntityGroupItems(e){const{items:t,headings:r,sortedBy:s}=e;if(!t.length||e.isEntityGrouped||!t.some(e=>e.entity))return[];const o=new Set(e.skipSumming||[]),a=[];for(const e of r)e.key&&!o.has(e.key)&&h.includes(e.valueType)&&a.push(e.key);const l=r[0].key;if(!l)return[];const d=new Map;for(const e of t){const t="string"==typeof e.entity?e.entity:void 0,r=d.get(t)||{[l]:t||n.R.strings.unattributable,entity:t};for(const t of a)r[t]=Number(r[t]||0)+Number(e[t]||0);d.set(t,r)}const c=[...d.values()];return s&&c.sort(i.y.getTableItemSortComparator(s)),c}_renderTable(e){if(!e.items.length)return this._dom.createElement("span");const t=this._dom.createElement("table","lh-table"),r=this._dom.createChildOf(t,"thead"),i=this._dom.createChildOf(r,"tr");for(const t of e.headings){const e=`lh-table-column--${t.valueType||"text"}`,r=this._dom.createElement("div","lh-text");r.textContent=t.label,this._dom.createChildOf(i,"th",e).append(r)}const n=this._getEntityGroupItems(e),s=this._dom.createChildOf(t,"tbody");if(n.length)for(const t of n){const r="string"==typeof t.entity?t.entity:void 0,i=this._renderEntityGroupRow(t,e.headings);for(const t of e.items.filter(e=>e.entity===r))i.append(this._renderTableRowsFromItem(t,e.headings)
2);const n=this._dom.findAll("tr",i);r&&n.length&&(n.forEach(e=>e.dataset.entity=r),this._adornEntityGroupRow(n[0])),s.append(i)}else{let t=!0;for(const r of e.items){const i=this._renderTableRowsFromItem(r,e.headings),n=this._dom.findAll("tr",i),o=n[0];if("string"==typeof r.entity&&(o.dataset.entity=r.entity),e.isEntityGrouped&&r.entity)o.classList.add("lh-row--group"),this._adornEntityGroupRow(o);else for(const e of n)e.classList.add(t?"lh-row--even":"lh-row--odd");t=!t,s.append(i)}}return t}_renderList(e){const t=this._dom.createElement("div","lh-list");return e.items.forEach(e=>{const r=this.render(e);r&&t.append(r)}),t}renderNode(e){const t=this._dom.createElement("span","lh-node");if(e.nodeLabel){const r=this._dom.createElement("div");r.textContent=e.nodeLabel,t.append(r)}if(e.snippet){const r=this._dom.createElement("div");r.classList.add("lh-node__snippet"),r.textContent=e.snippet,t.append(r)}if(e.selector&&(t.title=e.selector),e.path&&t.setAttribute("data-path",e.path),e.selector&&t.setAttribute("data-selector",e.selector),e.snippet&&t.setAttribute("data-snippet",e.snippet),!this._fullPageScreenshot)return t;const r=e.lhId&&this._fullPageScreenshot.nodes[e.lhId];if(!r||0===r.width||0===r.height)return t;const i=d.o.render(this._dom,this._fullPageScreenshot.screenshot,r,{width:147,height:100});return i&&t.prepend(i),t}renderSourceLocation(e){if(!e.url)return null;const t=`${e.url}:${e.line+1}:${e.column}`;let r,i;if(e.original&&(r=`${e.original.file||"<unmapped>"}:${e.original.line+1}:${e.original.column}`),"network"===e.urlProvider&&r)i=this._renderLink({url:e.url,text:r}),i.title=`maps to generated location ${t}`;else if("network"!==e.urlProvider||r)if("comment"===e.urlProvider&&r)i=this._renderText(`${r} (from source map)`),i.title=`${t} (from sourceURL)`;else{if("comment"!==e.urlProvider||r)return null;i=this._renderText(`${t} (from sourceURL)`)}else i=this.renderTextURL(e.url),this._dom.find(".lh-link",i).textContent+=`:${e.line+1}:${e.column}`;return i.classList.add("lh-source-location"),i.setAttribute("data-source-url",e.url),i.setAttribute("data-source-line",String(e.line)),i.setAttribute("data-source-column",String(e.column)),i}_renderFilmstrip(e){const t=this._dom.createElement("div","lh-filmstrip");for(const r of e.items){const e=this._dom.createChildOf(t,"div","lh-filmstrip__frame"),i=this._dom.createChildOf(e,"img","lh-filmstrip__thumbnail");i.src=r.data,i.alt="Screenshot"}return t}_renderCode(e){const t=this._dom.createElement("pre","lh-code");return t.textContent=e,t}}const m=1048576;class p{constructor(e){"en-XA"===e&&(e="de"),this._locale=e,this._cachedNumberFormatters=new Map}_formatNumberWithGranularity(e,t,r={}){if(void 0!==t){const i=-Math.log10(t);Number.isInteger(i)||(console.warn(`granularity of ${t} is invalid. Using 1 instead`),t=1),t<1&&((r={...r}).minimumFractionDigits=r.maximumFractionDigits=Math.ceil(i)),e=Math.round(e/t)*t,Object.is(e,-0)&&(e=0)}else Math.abs(e)<5e-4&&(e=0);let i;const n=[r.minimumFractionDigits,r.maximumFractionDigits,r.style,r.unit,r.unitDisplay,this._locale].join("");return i=this._cachedNumberFormatters.get(n),i||(i=new Intl.NumberFormat(this._locale,r),this._cachedNumberFormatters.set(n,i)),i.format(e).replace(" ","Â ")}formatNumber(e,t){return this._formatNumberWithGranularity(e,t)}formatInteger(e){return this._formatNumberWithGranularity(e,1)}formatPercent(e){return new Intl.NumberFormat(this._locale,{style:"percent"}).format(e)}formatBytesToKiB(e,t=void 0){return this._formatNumberWithGranularity(e/1024,t)+"Â KiB"}formatBytesToMiB(e,t=void 0){return this._formatNumberWithGranularity(e/m,t)+"Â MiB"}formatBytes(e,t=1){return this._formatNumberWithGranularity(e,t,{style:"unit",unit:"byte",unitDisplay:"long"})}formatBytesWithBestUnit(e,t=.1){return e>=m?this.formatBytesToMiB(e,t):e>=1024?this.formatBytesToKiB(e,t):this._formatNumberWithGranularity(e,t,{style:"unit",unit:"byte",unitDisplay:"narrow"})}formatKbps(e,t=void 0){return this._formatNumberWithGranularity(e,t,{style:"unit",unit:"kilobit-per-second",unitDisplay:"short"})}formatMilliseconds(e,t=void 0){return this._formatNumberWithGranularity(e,t,{style:"unit",unit:"millisecond",unitDisplay:"short"})}formatSeconds(e,t=void 0){return this._formatNumberWithGranularity(e/1e3,t,{style:"unit",unit:"second",unitDisplay:"narrow"})}formatDateTime(e){const t={month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"numeric",timeZoneName:"short"};let r;try{r=new Intl.DateTimeFormat(this._locale,t)}catch(e){t.timeZone="UTC",r=new Intl.DateTimeFormat(this._locale,t)}return r.format(new Date(e))}formatDuration(e){let t=e/1e3;if(0===Math.round(t))return"None";const r=[],i={day:86400,hour:3600,minute:60,second:1};
2return Object.keys(i).forEach(e=>{const n=i[e],s=Math.floor(t/n);if(s>0){t-=s*n;const i=this._formatNumberWithGranularity(s,1,{style:"unit",unit:e,unitDisplay:"narrow"});r.push(i)}}),r.join(" ")}}class g extends s{_renderMetric(e){const t=this.dom.createComponent("metric"),r=this.dom.find(".lh-metric",t);r.id=e.result.id;const n=i.y.calculateRating(e.result.score,e.result.scoreDisplayMode);r.classList.add(`lh-metric--${n}`),this.dom.find(".lh-metric__title",t).textContent=e.result.title;const s=this.dom.find(".lh-metric__value",t);s.textContent=e.result.displayValue||"";const o=this.dom.find(".lh-metric__description",t);return o.append(this.dom.convertMarkdownLinkSnippets(e.result.description)),"error"===e.result.scoreDisplayMode?(o.textContent="",s.textContent="Error!",this.dom.createChildOf(o,"span").textContent=e.result.errorMessage||"Report error: no metric information"):"notApplicable"===e.result.scoreDisplayMode&&(s.textContent="--"),r}_getScoringCalculatorHref(e){const t=e.filter(e=>"metrics"===e.group),r=e.find(e=>"interactive"===e.id),i=e.find(e=>"first-cpu-idle"===e.id),s=e.find(e=>"first-meaningful-paint"===e.id);r&&t.push(r),i&&t.push(i),s&&"number"==typeof s.result.score&&t.push(s);const o=[...t.map(e=>{let t;var r;return"number"==typeof e.result.numericValue?(t="cumulative-layout-shift"===e.id?(r=e.result.numericValue,Math.round(100*r)/100):Math.round(e.result.numericValue),t=t.toString()):t="null",[e.acronym||e.id,t]})];n.R.reportJson&&(o.push(["device",n.R.reportJson.configSettings.formFactor]),o.push(["version",n.R.reportJson.lighthouseVersion]));const a=new URLSearchParams(o),l=new URL("https://googlechrome.github.io/lighthouse/scorecalc/");return l.hash=a.toString(),l.href}overallImpact(e,t){if(!e.result.metricSavings)return{overallImpact:0,overallLinearImpact:0};let r=0,i=0;for(const[n,s]of Object.entries(e.result.metricSavings)){if(void 0===s)continue;const e=t.find(e=>e.acronym===n);if(!e)continue;if(null===e.result.score)continue;const a=e.result.numericValue;if(!a)continue;i+=s/a*e.weight;const l=e.result.scoringOptions;l&&(r+=(o.J.computeLogNormalScore(l,a-s)-e.result.score)*e.weight)}return{overallImpact:r,overallLinearImpact:i}}render(e,t,r){const s=n.R.strings,o=this.dom.createElement("div","lh-category");o.id=e.id,o.append(this.renderCategoryHeader(e,t,r));const a=e.auditRefs.filter(e=>"metrics"===e.group);if(a.length){const[r,i]=this.renderAuditGroup(t.metrics),l=this.dom.createElement("input","lh-metrics-toggle__input"),d=`lh-metrics-toggle${n.R.getUniqueSuffix()}`;l.setAttribute("aria-label","Toggle the display of metric descriptions"),l.type="checkbox",l.id=d,r.prepend(l);const c=this.dom.find(".lh-audit-group__header",r),h=this.dom.createChildOf(c,"label","lh-metrics-toggle__label");h.htmlFor=d;const u=this.dom.createChildOf(h,"span","lh-metrics-toggle__labeltext--show"),m=this.dom.createChildOf(h,"span","lh-metrics-toggle__labeltext--hide");u.textContent=n.R.strings.expandView,m.textContent=n.R.strings.collapseView;const p=this.dom.createElement("div","lh-metrics-container");if(r.insertBefore(p,i),a.forEach(e=>{p.append(this._renderMetric(e))}),o.querySelector(".lh-gauge__wrapper")){const t=this.dom.find(".lh-category-header__description",o),r=this.dom.createChildOf(t,"div","lh-metrics__disclaimer"),i=this.dom.convertMarkdownLinkSnippets(s.varianceDisclaimer);r.append(i);const n=this.dom.createChildOf(r,"a","lh-calclink");n.target="_blank",n.textContent=s.calculatorLink,this.dom.safelySetHref(n,this._getScoringCalculatorHref(e.auditRefs))}r.classList.add("lh-audit-group--metrics"),o.append(r)}const l=this.dom.createChildOf(o,"div","lh-filmstrip-container"),d=e.auditRefs.find(e=>"screenshot-thumbnails"===e.id),c=d?.result;if(c?.details){l.id=c.id;const e=this.detailsRenderer.render(c.details);e&&l.append(e)}const h=e.auditRefs.filter(e=>"diagnostics"===e.group).map(e=>{const{overallImpact:t,overallLinearImpact:r}=this.overallImpact(e,a),i=e.result.guidanceLevel||1;return{auditRef:e,auditEl:this.renderAudit(e),overallImpact:t,overallLinearImpact:r,guidanceLevel:i}}),u=h.filter(e=>!i.y.showAsPassed(e.auditRef.result)),m=h.filter(e=>i.y.showAsPassed(e.auditRef.result)),[p,g]=this.renderAuditGroup(t.diagnostics);function f(e){for(const t of h)if("All"===e)t.auditEl.hidden=!1;else{const r=void 0===t.auditRef.result.metricSavings?.[e];t.auditEl.hidden=r}u.sort((t,r)=>{const i=t.auditRef.result.score||0,n=r.auditRef.result.score||0;if(i!==n)return i-n;if("All"!==e){const i=t.auditRef.result.metricSavings?.[e]??-1,n=r.auditRef.result.metricSavings?.[e]??-1;if(i!==n)return n-i}return t.overallImpact!==r.overallImpact?r.overallImpact*r.guidanceLevel-t.overallImpact*t.guidanceLevel:0===t.overallImpact&&0===r.overallImpact&&t.overallLinearImpact!==r.overallLinearImpact?r.overallLinearImpact*r.guidanceLevel-t.overallLinearImpact*t.guidanceLevel:r.guidanceLevel-t.guid
2anceLevel});for(const e of u)p.insertBefore(e.auditEl,g)}p.classList.add("lh-audit-group--diagnostics");const _=new Set;for(const e of u){const t=e.auditRef.result.metricSavings||{};for(const[e,r]of Object.entries(t))"number"==typeof r&&_.add(e)}const y=a.filter(e=>e.acronym&&_.has(e.acronym));if(y.length&&this.renderMetricAuditFilter(y,o,f),f("All"),u.length&&o.append(p),!m.length)return o;const v={auditRefsOrEls:m.map(e=>e.auditEl),groupDefinitions:t},b=this.renderClump("passed",v);if(o.append(b),(!r||"navigation"===r?.gatherMode)&&null!==e.score){const t=function(e){const t=e.createComponent("explodeyGauge");return e.find(".lh-exp-gauge-component",t)}(this.dom);(function(e,t,r){const n=e.find("div.lh-exp-gauge__wrapper",t);n.className="",n.classList.add("lh-exp-gauge__wrapper",`lh-exp-gauge__wrapper--${i.y.calculateRating(r.score)}`),function(e,t,r){const n=128,s=-.5*n,o=Number(r.score),{radiusInner:a,radiusOuter:l,circumferenceInner:d,circumferenceOuter:c,getArcLength:h,getMetricArcLength:u,endDiffInner:m,endDiffOuter:p,strokeWidth:g,strokeGap:f}=function(e,t,r){const i=e/(r=r||e/32),n=.5*r,s=i+n+r,o=2*Math.PI*i,a=Math.acos(1-.5*Math.pow(.5*r/i,2))*i,l=2*Math.PI*s,d=Math.acos(1-.5*Math.pow(.5*r/s,2))*s;return{radiusInner:i,radiusOuter:s,circumferenceInner:o,circumferenceOuter:l,getArcLength:()=>Math.max(0,Number(t*o)),getMetricArcLength:(e,t=!1)=>{const r=t?0:2*d;return Math.max(0,Number(e*l-n-r))},endDiffInner:a,endDiffOuter:d,strokeWidth:r,strokeGap:n}}(n,o),_=e.find("svg.lh-exp-gauge",t);e.find(".lh-exp-gauge__label",_).textContent=r.title,_.setAttribute("viewBox",[s,s/2,n,n/2].join(" ")),_.style.setProperty("--stroke-width",`${g}px`),_.style.setProperty("--circle-meas",(2*Math.PI).toFixed(4));const y=e.find("g.lh-exp-gauge__outer",t),v=e.find("g.lh-exp-gauge__inner",t),b=e.find("circle.lh-cover",y),x=e.find("circle.lh-exp-gauge__arc",v),C=e.find("text.lh-exp-gauge__percentage",v);y.style.setProperty("--scale-initial",String(a/l)),y.style.setProperty("--radius",`${l}px`),b.style.setProperty("--radius",.5*(a+l)+"px"),b.setAttribute("stroke-width",String(f)),_.style.setProperty("--radius",`${a}px`),x.setAttribute("stroke-dasharray",`${h()} ${(d-h()).toFixed(4)}`),x.setAttribute("stroke-dashoffset",String(.25*d-m)),C.textContent=Math.round(100*o).toString();const w=l+g,L=l-g,R=r.auditRefs.filter(e=>"metrics"===e.group&&e.weight),S=R.reduce((e,t)=>e+t.weight,0);let k=.25*c-p-.5*f,E=-.5*Math.PI;y.querySelectorAll(".metric").forEach(e=>{R.map(e=>`metric--${e.id}`).find(t=>e.classList.contains(t))||e.remove()}),R.forEach((t,r)=>{const n=t.acronym??t.id,s=!y.querySelector(`.metric--${n}`),o=e.maybeFind(`g.metric--${n}`,y)||e.createSVGElement("g"),a=e.maybeFind(`.metric--${n} circle.lh-exp-gauge--faded`,y)||e.createSVGElement("circle"),l=e.maybeFind(`.metric--${n} circle.lh-exp-gauge--miniarc`,y)||e.createSVGElement("circle"),d=e.maybeFind(`.metric--${n} circle.lh-exp-gauge-hovertarget`,y)||e.createSVGElement("circle"),h=e.maybeFind(`.metric--${n} text.metric__label`,y)||e.createSVGElement("text"),m=e.maybeFind(`.metric--${n} text.metric__value`,y)||e.createSVGElement("text");o.classList.add("metric",`metric--${n}`),a.classList.add("lh-exp-gauge__arc","lh-exp-gauge__arc--metric","lh-exp-gauge--faded"),l.classList.add("lh-exp-gauge__arc","lh-exp-gauge__arc--metric","lh-exp-gauge--miniarc"),d.classList.add("lh-exp-gauge__arc","lh-exp-gauge__arc--metric","lh-exp-gauge-hovertarget");const g=t.weight/S,f=u(g),_=t.result.score?t.result.score*g:0,v=u(_),b=g*c,x=u(g,!0),C=i.y.calculateRating(t.result.score,t.result.scoreDisplayMode);o.style.setProperty("--metric-rating",C),o.style.setProperty("--metric-color",`var(--color-${C})`),o.style.setProperty("--metric-offset",`${k}`),o.style.setProperty("--i",r.toString()),a.setAttribute("stroke-dasharray",`${f} ${c-f}`),l.style.setProperty("--metric-array",`${v} ${c-v}`),d.setAttribute("stroke-dasharray",`${x} ${c-x-p}`),h.classList.add("metric__label"),m.classList.add("metric__value"),h.textContent=n,m.textContent=`+${Math.round(100*_)}`;const R=E+g*Math.PI,A=Math.cos(R),M=Math.sin(R);switch(!0){case A>0:m.setAttribute("text-anchor","end");break;case A<0:h.setAttribute("text-anchor","end");break;case 0===A:h.setAttribute("text-anchor","middle"),m.setAttribute("text-anchor","middle")}switch(!0){case M>0:h.setAttribute("dominant-baseline","hanging");break;case M<0:m.setAttribute("dominant-baseline","hanging");break;case 0===M:h.setAttribute("dominant-baseline","middle"),m.setAttribute("dominant-baseline","middle")}h.setAttribute("x",(w*A).toFixed(2)),h.setAttribute("y",(w*M).toFixed(2)),m.setAttribute("x",(L*A).toFixed(2)),m.setAttribute("y",(L*
2M).toFixed(2)),s&&(o.appendChild(a),o.appendChild(l),o.appendChild(d),o.appendChild(h),o.appendChild(m),y.appendChild(o)),k-=b,E+=2*g*Math.PI});const A=y.querySelector(".lh-exp-gauge-underhovertarget")||e.createSVGElement("circle");A.classList.add("lh-exp-gauge__arc","lh-exp-gauge__arc--metric","lh-exp-gauge-hovertarget","lh-exp-gauge-underhovertarget");const M=u(1,!0);A.setAttribute("stroke-dasharray",`${M} ${c-M-p}`),A.isConnected||y.prepend(A),_.dataset.listenersSetup||(_.dataset.listenersSetup=!0,async function(t){if(await new Promise(e=>setTimeout(e,1e3)),t.classList.contains("state--expanded"))return;const r=e.find(".lh-exp-gauge__inner",t),i=`uniq-${Math.random()}`;r.setAttribute("id",i);const n=e.createSVGElement("use");n.setAttribute("href",`#${i}`),t.appendChild(n),t.style.setProperty("--peek-dur","2.5s"),t.classList.add("state--peek","state--expanded");const s=()=>{t.classList.remove("state--peek","state--expanded"),n.remove()},o=setTimeout(()=>{t.removeEventListener("mouseenter",a),s()},3750);function a(){clearTimeout(o),s()}t.addEventListener("mouseenter",a,{once:!0})}(_),_.addEventListener("pointerover",r=>{if(r.target===_&&_.classList.contains("state--expanded"))return _.classList.remove("state--expanded"),void(_.classList.contains("state--highlight")&&(_.classList.remove("state--highlight"),e.find(".metric--highlight",_).classList.remove("metric--highlight")));if(!(r.target instanceof Element))return;const i=r.target.parentNode;if(i instanceof SVGElement)if(i&&i===v)_.classList.contains("state--expanded")?_.classList.contains("state--highlight")&&(_.classList.remove("state--highlight"),e.find(".metric--highlight",_).classList.remove("metric--highlight")):_.classList.add("state--expanded");else if(i&&i.classList&&i.classList.contains("metric")){const r=i.style.getPropertyValue("--metric-rating");if(t.style.setProperty("--color-highlight",`var(--color-${r}-secondary)`),_.classList.contains("state--highlight")){const t=e.find(".metric--highlight",_);i!==t&&(t.classList.remove("metric--highlight"),i.classList.add("metric--highlight"))}else _.classList.add("state--highlight"),i.classList.add("metric--highlight")}}),_.addEventListener("mouseleave",()=>{_.classList.remove("state--highlight");const e=_.querySelector(".metric--highlight");e?.classList.remove("metric--highlight")}))}(e,n,r)})(this.dom,t,e),this.dom.find(".lh-score__gauge",o).replaceWith(t)}return o}renderMetricAuditFilter(e,t,r){const i=this.dom.createElement("div","lh-metricfilter");this.dom.createChildOf(i,"span","lh-metricfilter__text").textContent=n.R.strings.showRelevantAudits;const s=[{acronym:"All",id:"All"},...e],o=n.R.getUniqueSuffix();for(const e of s){const n=`metric-${e.acronym}-${o}`,s=this.dom.createChildOf(i,"input","lh-metricfilter__radio");s.type="radio",s.name=`metricsfilter-${o}`,s.id=n;const a=this.dom.createChildOf(i,"label","lh-metricfilter__label");a.htmlFor=n,a.title="result"in e?e.result.title:"",a.textContent=e.acronym||e.id,"All"===e.acronym&&(s.checked=!0,a.classList.add("lh-metricfilter__label--active")),t.append(i),s.addEventListener("input",i=>{for(const e of t.querySelectorAll("label.lh-metricfilter__label"))e.classList.toggle("lh-metricfilter__label--active",e.htmlFor===n);t.classList.toggle("lh-category--filtered","All"!==e.acronym),r(e.acronym||"All");const s=t.querySelectorAll("div.lh-audit-group, details.lh-audit-group");for(const e of s){e.hidden=!1;const t=Array.from(e.querySelectorAll("div.lh-audit")),r=!!t.length&&t.every(e=>e.hidden);e.hidden=r}})}}}class f{constructor(e){this._dom=e,this._opts={}}renderReport(e,t,r){if(!this._dom.rootEl&&t){console.warn("Please adopt the new report API in renderer/api.js.");const e=t.closest(".lh-root");e?this._dom.rootEl=e:(t.classList.add("lh-root","lh-vars"),this._dom.rootEl=t)}else this._dom.rootEl&&t&&(this._dom.rootEl=t);r&&(this._opts=r),this._dom.setLighthouseChannel(e.configSettings.channel||"unknown");const n=i.y.prepareReportResult(e);return this._dom.rootEl.textContent="",this._dom.rootEl.append(this._renderReport(n)),this._opts.occupyEntireViewport&&this._dom.rootEl.classList.add("lh-max-viewport"),this._dom.rootEl}_renderReportTopbar(e){const t=this._dom.createComponent("topbar"),r=this._dom.find("a.lh-topbar__url",t);return r.textContent=e.finalDisplayedUrl,r.title=e.finalDisplayedUrl,this._dom.safelySetHref(r,e.finalDisplayedUrl),t}_renderReportHeader(){const e=this._dom.createComponent("heading"),t=this._dom.createComponent("scoresWrapper");return this._dom.find(".lh-scores-wrapper-placeholder",e).replaceWith(t),e}_renderReportFooter(e){const t=this._dom.createComponent("footer");return this._renderMetaBlock(e,t),this._dom.find(".lh-footer__version_issue",t).textContent=n.R.strings.footerIssue,this._dom.find(".lh-footer__version",t).textContent=e.lighthouseVersion,t}_renderMetaBlock(e,t){const r=i.y.getEmulationDescriptions(e.configSettings||{}),s=e.userAgent.match(/(\w*Chrome\/[\d.]+)/),o=Array.isArray(s)?s[1].replace("/"," ").replace("Chrome","Chromium"):"Chromium",a=e.configSettings.channel,l=e.environment.benchmarkIndex.toFixed(0),d=e.environment.credits?.["axe-core"],c=[`${n.R.strings.runtimeSettingsBenchmark}: ${l}`,`${n.R.strings.runtimeSettingsCPUThrottling}: ${r.cpuThrottling}`];r.screenEmulation&&c.push(`${n.R.strings.runtimeSettingsScreenEmulation}: ${r.screenEmulation}`),d&&c.push(`${n.R.strings.runtimeSettingsAxeVersion}: ${d}`);let h=n.R.strings.runtimeAnalysisWindow;"timespan"===e.gatherMode?h=n.R.strings.runtimeAnalysisWindowTimespan:"snapshot"===e.gatherMode&&(h=n.R.strings.runtimeAnalysisWindowSnapshot);const u=[["date",`Captured at ${n.R.i18n.formatDateTime(e.fetchTime)}`],["devices",`${r.deviceEmulation} with Lighthouse ${e.lighthouseVersion}`,c.join("\n")],["samples-one",n.R.strings.runtimeSingleLoad,n.R.strings.runtimeSingleLoadTooltip],["stopwatch",h],["networkspeed",`${r.summary}`,`${n.R.strings.runtimeSettingsNetworkThrottling}: ${r.networkThrottling}`],["chrome",`Using ${o}`+(a?` with ${a}`:""),`${n.R.strings.runtimeSettingsUANetwork}: "${e.environment.networkUserAgent}"`]],m=this._dom.find(".lh-meta__items",t);for(const[e,t,r]of u){const i=this._dom.createChildOf(m,"li","lh-meta__item");
2i.textContent=t,r&&(i.classList.add("lh-tooltip-boundary"),this._dom.createChildOf(i,"div","lh-tooltip").textContent=r),i.classList.add("lh-report-icon",`lh-report-icon--${e}`)}}_renderReportWarnings(e){if(!e.runWarnings||0===e.runWarnings.length)return this._dom.createElement("div");const t=this._dom.createComponent("warningsToplevel");this._dom.find(".lh-warnings__msg",t).textContent=n.R.strings.toplevelWarningsMessage;const r=[];for(const t of e.runWarnings){const e=this._dom.createElement("li");e.append(this._dom.convertMarkdownLinkSnippets(t)),r.push(e)}return this._dom.find("ul",t).append(...r),t}_renderScoreGauges(e,t,r){const n=[],s=[];for(const o of Object.values(e.categories)){const a=(r[o.id]||t).renderCategoryScore(o,e.categoryGroups||{},{gatherMode:e.gatherMode}),l=this._dom.find("a.lh-gauge__wrapper, a.lh-fraction__wrapper",a);l&&(this._dom.safelySetHref(l,`#${o.id}`),l.addEventListener("click",e=>{if(!l.matches('[href^="#"]'))return;const t=l.getAttribute("href"),r=this._dom.rootEl;if(!t||!r)return;const i=this._dom.find(t,r);e.preventDefault(),i.scrollIntoView()}),this._opts.onPageAnchorRendered?.(l)),i.y.isPluginCategory(o.id)?s.push(a):n.push(a)}return[...n,...s]}_renderReport(e){n.R.apply({providedStrings:e.i18n.rendererFormattedStrings,i18n:new p(e.configSettings.locale),reportJson:e});const t=new u(this._dom,{fullPageScreenshot:e.fullPageScreenshot??void 0,entities:e.entities}),r=new s(this._dom,t),i={performance:new g(this._dom,t)},o=this._dom.createElement("div");o.append(this._renderReportHeader());const a=this._dom.createElement("div","lh-container"),l=this._dom.createElement("div","lh-report");let c;l.append(this._renderReportWarnings(e)),1===Object.keys(e.categories).length?o.classList.add("lh-header--solo-category"):c=this._dom.createElement("div","lh-scores-header");const h=this._dom.createElement("div");if(h.classList.add("lh-scorescale-wrap"),h.append(this._dom.createComponent("scorescale")),c){const t=this._dom.find(".lh-scores-container",o);c.append(...this._renderScoreGauges(e,r,i)),t.append(c,h);const n=this._dom.createElement("div","lh-sticky-header");n.append(...this._renderScoreGauges(e,r,i)),a.append(n)}const m=this._dom.createElement("div","lh-categories");l.append(m);const f={gatherMode:e.gatherMode};for(const t of Object.values(e.categories)){const n=i[t.id]||r;n.dom.createChildOf(m,"div","lh-category-wrapper").append(n.render(t,e.categoryGroups,f))}r.injectFinalScreenshot(m,e.audits,h);const _=this._dom.createFragment();return this._opts.omitGlobalStyles||_.append(this._dom.createComponent("styles")),this._opts.omitTopbar||_.append(this._renderReportTopbar(e)),_.append(a),l.append(this._renderReportFooter(e)),a.append(o,l),e.fullPageScreenshot&&d.o.installFullPageScreenshot(this._dom.rootEl,e.fullPageScreenshot.screenshot),_}}}}]);
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.