lighthouse 9.5.0-dev.20221003 → 9.5.0-dev.20221005
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/test/smokehouse/core-tests.js +2 -0
- package/cli/test/smokehouse/readme.md +1 -1
- package/cli/test/smokehouse/report-assert-test.js +4 -4
- package/cli/test/smokehouse/report-assert.js +1 -1
- package/core/audits/byte-efficiency/legacy-javascript.js +1 -1
- package/core/audits/byte-efficiency/modern-image-formats.js +1 -1
- package/core/audits/byte-efficiency/uses-optimized-images.js +1 -1
- package/core/audits/font-display.js +1 -1
- package/core/audits/redirects.js +3 -3
- package/core/audits/seo/crawlable-anchors.js +1 -1
- package/core/audits/seo/font-size.js +1 -1
- package/core/audits/seo/link-text.js +2 -2
- package/core/audits/service-worker.js +1 -1
- package/core/audits/third-party-summary.js +1 -1
- package/core/audits/valid-source-maps.js +1 -1
- package/core/computed/page-dependency-graph.js +1 -1
- package/core/computed/resource-summary.js +1 -1
- package/core/gather/base-artifacts.js +4 -6
- package/core/gather/gatherers/full-page-screenshot.js +18 -5
- package/core/gather/gatherers/link-elements.js +4 -4
- package/core/gather/gatherers/seo/robots-txt.js +2 -2
- package/core/gather/gatherers/web-app-manifest.js +2 -2
- package/core/gather/navigation-runner.js +2 -4
- package/core/gather/snapshot-runner.js +1 -2
- package/core/gather/timespan-runner.js +2 -6
- package/core/legacy/gather/gather-runner.js +3 -4
- package/core/runner.js +3 -1
- package/core/user-flow.js +2 -2
- package/core/util.cjs +25 -0
- package/dist/report/bundle.esm.js +48 -13
- package/dist/report/flow.js +7 -7
- package/dist/report/standalone.js +8 -8
- package/flow-report/src/summary/category.tsx +3 -3
- package/flow-report/src/summary/summary.tsx +2 -2
- package/package.json +1 -1
- package/report/generator/file-namer.js +2 -2
- package/report/generator/report-generator.js +1 -1
- package/report/renderer/element-screenshot-renderer.js +6 -1
- package/report/renderer/open-tab.js +3 -1
- package/report/renderer/report-renderer.js +3 -3
- package/report/renderer/report-ui-features.js +9 -6
- package/report/renderer/util.js +25 -0
- package/report/test/generator/file-namer-test.js +1 -1
- package/report/test/generator/report-generator-test.js +1 -1
- package/report/test/renderer/report-renderer-test.js +4 -1
- package/report/test/renderer/report-ui-features-test.js +1 -1
- package/types/artifacts.d.ts +2 -8
- package/types/lhr/lhr.d.ts +9 -2
- package/types/lhr/treemap.d.ts +3 -1
- package/types/smokehouse.d.ts +1 -1
package/dist/report/flow.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
|
-
*/const ie="…",ae="data:image/jpeg;base64,",le={label:"pass",minScore:.9},se={label:"average",minScore:.5},ce={label:"fail"},de={label:"error"},he=["com","co","gov","edu","ac","org","go","gob","or","net","in","ne","nic","gouv","web","spb","blog","jus","kiev","mil","wi","qc","ca","bel","on"];class pe{static i18n=null;static get PASS_THRESHOLD(){return.9}static get MS_DISPLAY_VALUE(){return"%10d ms"}static prepareReportResult(e){const t=JSON.parse(JSON.stringify(e));t.configSettings.locale||(t.configSettings.locale="en"),t.configSettings.formFactor||(t.configSettings.formFactor=t.configSettings.emulatedFormFactor);for(const e of Object.values(t.audits))if("not_applicable"!==e.scoreDisplayMode&&"not-applicable"!==e.scoreDisplayMode||(e.scoreDisplayMode="notApplicable"),e.details&&(void 0!==e.details.type&&"diagnostic"!==e.details.type||(e.details.type="debugdata"),"filmstrip"===e.details.type))for(const t of e.details.items)t.data.startsWith(ae)||(t.data=ae+t.data);if("object"!=typeof t.categories)throw new Error("No categories provided.");const n=new Map,[r]=t.lighthouseVersion.split(".").map(Number),o=t.categories.performance;if(r<9&&o){t.categoryGroups||(t.categoryGroups={}),t.categoryGroups.hidden={title:""};for(const e of o.auditRefs)e.group?["load-opportunities","diagnostics"].includes(e.group)&&delete e.group:e.group="hidden"}for(const e of Object.values(t.categories))e.auditRefs.forEach((e=>{e.relevantAudits&&e.relevantAudits.forEach((t=>{const r=n.get(t)||[];r.push(e),n.set(t,r)}))})),e.auditRefs.forEach((e=>{const r=t.audits[e.id];e.result=r,n.has(e.id)&&(e.relevantMetrics=n.get(e.id)),t.stackPacks&&t.stackPacks.forEach((t=>{t.descriptions[e.id]&&(e.stackPacks=e.stackPacks||[],e.stackPacks.push({title:t.title,iconDataURL:t.iconDataURL,description:t.descriptions[e.id]}))}))}));return t}static showAsPassed(e){switch(e.scoreDisplayMode){case"manual":case"notApplicable":return!0;case"error":case"informative":return!1;case"numeric":case"binary":default:return Number(e.score)>=le.minScore}}static calculateRating(e,t){if("manual"===t||"notApplicable"===t)return le.label;if("error"===t)return de.label;if(null===e)return ce.label;let n=ce.label;return e>=le.minScore?n=le.label:e>=se.minScore&&(n=se.label),n}static splitMarkdownCodeSpans(e){const t=[],n=e.split(/`(.*?)`/g);for(let e=0;e<n.length;e++){const r=n[e];if(!r)continue;const o=e%2!=0;t.push({isCode:o,text:r})}return t}static splitMarkdownLink(e){const t=[],n=e.split(/\[([^\]]+?)\]\((https?:\/\/.*?)\)/g);for(;n.length;){const[e,r,o]=n.splice(0,3);e&&t.push({isLink:!1,text:e}),r&&o&&t.push({isLink:!0,text:r,linkHref:o})}return t}static getURLDisplayName(e,t){const n=void 0!==(t=t||{numPathParts:void 0,preserveQuery:void 0,preserveHost:void 0}).numPathParts?t.numPathParts:2,r=void 0===t.preserveQuery||t.preserveQuery,o=t.preserveHost||!1;let i;if("about:"===e.protocol||"data:"===e.protocol)i=e.href;else{i=e.pathname;const t=i.split("/").filter((e=>e.length));n&&t.length>n&&(i=ie+t.slice(-1*n).join("/")),o&&(i=`${e.host}/${i.replace(/^\//,"")}`),r&&(i=`${i}${e.search}`)}if("data:"!==e.protocol&&(i=i.replace(/([a-f0-9]{7})[a-f0-9]{13}[a-f0-9]*/g,"$1…"),i=i.replace(/([a-zA-Z0-9-_]{9})(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])[a-zA-Z0-9-_]{10,}/g,"$1…"),i=i.replace(/(\d{3})\d{6,}/g,"$1…"),i=i.replace(/\u2026+/g,ie),i.length>64&&i.includes("?")&&(i=i.replace(/\?([^=]*)(=)?.*/,"?$1$2…"),i.length>64&&(i=i.replace(/\?.*/,"?…")))),i.length>64){const e=i.lastIndexOf(".");i=e>=0?i.slice(0,63-(i.length-e))+`…${i.slice(e)}`:i.slice(0,63)+ie}return i}static parseURL(e){const t=new URL(e);return{file:pe.getURLDisplayName(t),hostname:t.hostname,origin:t.origin}}static createOrReturnURL(e){return e instanceof URL?e:new URL(e)}static getTld(e){const t=e.split(".").slice(-2);return he.includes(t[0])?`.${t.join(".")}`:`.${t[t.length-1]}`}static getRootDomain(e){const t=pe.createOrReturnURL(e).hostname,n=pe.getTld(t).split(".");return t.split(".").slice(-n.length).join(".")}static getEmulationDescriptions(e){let t,n,r;const o=e.throttling;switch(e.throttlingMethod){case"provided":r=n=t=pe.i18n.strings.throttlingProvided;break;case"devtools":{const{cpuSlowdownMultiplier:e,requestLatencyMs:i}=o;t=`${pe.i18n.formatNumber(e)}x slowdown (DevTools)`,n=`${pe.i18n.formatMilliseconds(i)} HTTP RTT, ${pe.i18n.formatKbps(o.downloadThroughputKbps)} down, ${pe.i18n.formatKbps(o.uploadThroughputKbps)} up (DevTools)`;r=(()=>562.5===i&&o.downloadThroughputKbps===1638.4*.9&&675===o.uploadThroughputKbps)()?pe.i18n.strings.runtimeSlow4g:pe.i18n.strings.runtimeCustom;break}case"simulate":{const{cpuSlowdownMultiplier:e,rttMs:i,throughputKbps:a}=o;t=`${pe.i18n.formatNumber(e)}x slowdown (Simulated)`,n=`${pe.i18n.formatMilliseconds(i)} TCP RTT, ${pe.i18n.formatKbps(a)} throughput (Simulated)`;r=(()=>150===i&&1638.4===a)()?pe.i18n.strings.runtimeSlow4g:pe.i18n.strings.runtimeCustom;break}default:r=t=n=pe.i18n.strings.runtimeUnknown}return{deviceEmulation:{mobile:pe.i18n.strings.runtimeMobileEmulation,desktop:pe.i18n.strings.runtimeDesktopEmulation}[e.formFactor]||pe.i18n.strings.runtimeNoEmulation,cpuThrottling:t,networkThrottling:n,summary:r}}static filterRelevantLines(e,t,n){if(0===t.length)return e.slice(0,2*n+1);const r=new Set;return(t=t.sort(((e,t)=>(e.lineNumber||0)-(t.lineNumber||0)))).forEach((({lineNumber:e})=>{let t=e-n,o=e+n;for(;t<1;)t++,o++;r.has(t-3-1)&&(t-=3);for(let e=t;e<=o;e++){const t=e;r.add(t)}})),e.filter((e=>r.has(e.lineNumber)))}static isPluginCategory(e){return e.startsWith("lighthouse-plugin-")}static shouldDisplayAsFraction(e){return"timespan"===e||"snapshot"===e}static calculateCategoryFraction(e){let t=0,n=0,r=0,o=0;for(const i of e.auditRefs){const e=pe.showAsPassed(i.result);"hidden"!==i.group&&"manual"!==i.result.scoreDisplayMode&&"notApplicable"!==i.result.scoreDisplayMode&&("informative"!==i.result.scoreDisplayMode?(++t,o+=i.weight,e&&n++):e||++r)}return{numPassed:n,numPassableAudits:t,numInformative:r,totalWeight:o}}}pe.reportJson=null;let ue=0;pe.getUniqueSuffix=()=>ue++,pe.resetUniqueSuffix=()=>{ue=0};pe.UIStrings={varianceDisclaimer:"Values are estimated and may vary. The [performance score is calculated](https://web.dev/performance-scoring/) directly from these metrics.",calculatorLink:"See calculator.",showRelevantAudits:"Show audits relevant to:",opportunityResourceColumnLabel:"Opportunity",opportunitySavingsColumnLabel:"Estimated Savings",errorMissingAuditInfo:"Report error: no audit information",errorLabel:"Error!",warningHeader:"Warnings: ",warningAuditsGroupTitle:"Passed audits but with warnings",passedAuditsGroupTitle:"Passed audits",notApplicableAuditsGroupTitle:"Not applicable",manualAuditsGroupTitle:"Additional items to manually check",toplevelWarningsMessage:"There were issues affecting this run of Lighthouse:",crcInitialNavigation:"Initial Navigation",crcLongestDurationLabel:"Maximum critical path latency:",snippetExpandButtonLabel:"Expand snippet",snippetCollapseButtonLabel:"Collapse snippet",lsPerformanceCategoryDescription:"[Lighthouse](https://developers.google.com/web/tools/lighthouse/) analysis of the current page on an emulated mobile network. Values are estimated and may vary.",labDataTitle:"Lab Data",thirdPartyResourcesLabel:"Show 3rd-party resources",viewTreemapLabel:"View Treemap",viewTraceLabel:"View Trace",viewOriginalTraceLabel:"View Original Trace",dropdownPrintSummary:"Print Summary",dropdownPrintExpanded:"Print Expanded",dropdownCopyJSON:"Copy JSON",dropdownSaveHTML:"Save as HTML",dropdownSaveJSON:"Save as JSON",dropdownViewer:"Open in Viewer",dropdownSaveGist:"Save as Gist",dropdownDarkTheme:"Toggle Dark Theme",runtimeSettingsDevice:"Device",runtimeSettingsNetworkThrottling:"Network throttling",runtimeSettingsCPUThrottling:"CPU throttling",runtimeSettingsUANetwork:"User agent (network)",runtimeSettingsBenchmark:"CPU/Memory Power",runtimeSettingsAxeVersion:"Axe version",footerIssue:"File an issue",runtimeNoEmulation:"No emulation",runtimeMobileEmulation:"Emulated Moto G4",runtimeDesktopEmulation:"Emulated Desktop",runtimeUnknown:"Unknown",runtimeSingleLoad:"Single page load",runtimeAnalysisWindow:"Initial page load",runtimeSingleLoadTooltip:"This data is taken from a single page load, as opposed to field data summarizing many sessions.",throttlingProvided:"Provided by environment",show:"Show",hide:"Hide",expandView:"Expand view",collapseView:"Collapse view",runtimeSlow4g:"Slow 4G throttling",runtimeCustom:"Custom throttling"};const ge=()=>D("svg",{width:"14",viewBox:"0 0 18 16",fill:"none",role:"img",children:D("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M0 2C0 1.17 0.67 0.5 1.5 0.5C2.33 0.5 3 1.17 3 2C3 2.83 2.33 3.5 1.5 3.5C0.67 3.5 0 2.83 0 2ZM0 8C0 7.17 0.67 6.5 1.5 6.5C2.33 6.5 3 7.17 3 8C3 8.83 2.33 9.5 1.5 9.5C0.67 9.5 0 8.83 0 8ZM1.5 12.5C0.67 12.5 0 13.18 0 14C0 14.82 0.68 15.5 1.5 15.5C2.32 15.5 3 14.82 3 14C3 13.18 2.33 12.5 1.5 12.5ZM18 15H5V13H18V15ZM5 9H18V7H5V9ZM5 3V1H18V3H5Z",fill:"currentColor"})}),me=()=>D("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",role:"img","aria-label":"Icon representing a navigation report",children:D("circle",{cx:"8",cy:"8",r:"7",fill:"none",stroke:"currentColor","stroke-width":"2"})}),fe=()=>D("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",role:"img","aria-label":"Icon representing a timespan report",children:[D("circle",{cx:"8",cy:"8",r:"7",fill:"none",stroke:"currentColor","stroke-width":"2"}),D("path",{d:"m 8,4 v 4 l 4,1.9999998",stroke:"currentColor","stroke-width":"1.5"})]}),_e=()=>D("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",role:"img","aria-label":"Icon representing a snapshot report",children:D("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M 12.2038,12.2812 C 11.1212,13.3443 9.6372,14 8,14 7.81038,14 7.62281,13.9912 7.43768,13.974 L 10.3094,9 Z M 12.8925,11.4741 10.0207,6.5 H 13.811 C 13.9344,6.97943 14,7.48205 14,8 c 0,1.2947 -0.4101,2.4937 -1.1075,3.4741 z M 13.456,5.5 H 7.71135 L 9.6065,2.21749 C 11.3203,2.69259 12.7258,3.90911 13.456,5.5 Z M 8.5624,2.02601 C 8.3772,2.0088 8.1896,2 8,2 6.36282,2 4.8788,2.65572 3.79622,3.71885 L 5.69061,7.00002 Z M 3.10749,4.52594 C 2.4101,5.5063 2,6.70526 2,8 2,8.5179 2.06563,9.0206 2.18903,9.5 H 5.97927 Z M 2.54404,10.5 c 0.73017,1.5909 2.1357,2.8074 3.84949,3.2825 L 8.2887,10.5 Z M 16,8 c 0,4.4183 -3.5817,8 -8,8 C 3.58172,16 0,12.4183 0,8 0,3.58172 3.58172,0 8,0 c 4.4183,0 8,3.58172 8,8 z",fill:"currentColor"})}),ve=()=>D("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24px",viewBox:"0 0 24 24",width:"24px",fill:"currentColor",role:"img","aria-label":"Icon representing a close action",children:[D("path",{d:"M0 0h24v24H0V0z",fill:"none"}),D("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})]}),be=()=>D("svg",{width:"15",height:"12",viewBox:"0 0 15 12",fill:"none",role:"img",children:D("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.33317 2.00008H13.9998V0.666748H3.33317C2.59984 0.666748 1.99984 1.26675 1.99984 2.00008V9.33341H0.666504V11.3334H7.99984V9.33341H3.33317V2.00008ZM13.9998 3.33341H9.99984C9.63317 3.33341 9.33317 3.63341 9.33317 4.00008V10.6667C9.33317 11.0334 9.63317 11.3334 9.99984 11.3334H13.9998C14.3665 11.3334 14.6665 11.0334 14.6665 10.6667V4.00008C14.6665 3.63341 14.3665 3.33341 13.9998 3.33341ZM10.6665 9.33341H13.3332V4.66675H10.6665V9.33341Z",fill:"currentColor"})}),we=()=>D("svg",{width:"16",height:"11",viewBox:"0 0 16 11",fill:"none",role:"img",children:D("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M0.666687 3.26663L2.00002 4.59997C3.92002 2.67997 6.52669 1.87997 9.02002 2.18663L9.81335 0.399966C6.59335 -0.173367 3.16002 0.779966 0.666687 3.26663ZM10.6 0.599966C10.4867 0.599966 10.3867 0.659966 10.3267 0.753299L10.28 0.853299L6.82669 8.61996C6.72002 8.8133 6.65335 9.02663 6.65335 9.25996C6.65335 9.99996 7.25335 10.6 7.99335 10.6C8.63335 10.6 9.17335 10.1466 9.30002 9.53996L9.30669 9.51997L10.9334 0.933299C10.9334 0.746633 10.7867 0.599966 10.6 0.599966ZM15.3334 3.26663L14 4.59997C13.1867 3.78663 12.2534 3.17997 11.2534 2.76663L11.6067 0.886633C12.9667 1.38663 14.24 2.1733 15.3334 3.26663ZM11.3334 7.26663L12.6667 5.9333C12.1334 5.39997 11.5334 4.98663 10.8934 4.6733L10.5267 6.61997C10.8067 6.79997 11.08 7.0133 11.3334 7.26663ZM4.66669 7.26663L3.33335 5.9333C4.67335 4.5933 6.45335 3.95997 8.20669 4.0133L7.35335 5.9333C6.37335 6.0733 5.42002 6.5133 4.66669 7.26663Z",fill:"currentColor"})}),ye=()=>D("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",role:"img",children:D("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M15.5 7.16667V5.5H13.8333V3.83333C13.8333 2.91667 13.0833 2.16667 12.1667 2.16667H10.5V0.5H8.83333V2.16667H7.16667V0.5H5.5V2.16667H3.83333C2.91667 2.16667 2.16667 2.91667 2.16667 3.83333V5.5H0.5V7.16667H2.16667V8.83333H0.5V10.5H2.16667V12.1667C2.16667 13.0833 2.91667 13.8333 3.83333 13.8333H5.5V15.5H7.16667V13.8333H8.83333V15.5H10.5V13.8333H12.1667C13.0833 13.8333 13.8333 13.0833 13.8333 12.1667V10.5H15.5V8.83333H13.8333V7.16667H15.5ZM10.5 5.5H5.5V10.5H10.5V5.5ZM3.83333 12.1667H12.1667V3.83333H3.83333V12.1667Z",fill:"currentColor"})}),xe=()=>D("svg",{viewBox:"0 0 18 12",width:"18",height:"12",role:"img",children:[D("rect",{width:"18",height:"2",fill:"currentColor"}),D("rect",{y:"5",width:"18",height:"2",fill:"currentColor"}),D("rect",{y:"10",width:"18",height:"2",fill:"currentColor"})]}),ke=()=>D("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:D("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M13 7C13 10.3137 10.3137 13 7 13C3.68629 13 1 10.3137 1 7C1 3.68629 3.68629 1 7 1C10.3137 1 13 3.68629 13 7ZM14 7C14 10.866 10.866 14 7 14C3.13401 14 0 10.866 0 7C0 3.13401 3.13401 0 7 0C10.866 0 14 3.13401 14 7ZM7.66658 11H6.33325V9.66667H7.66658V11ZM4.33325 5.66667C4.33325 4.19333 5.52659 3 6.99992 3C8.47325 3 9.66658 4.19333 9.66658 5.66667C9.66658 6.52194 9.1399 6.98221 8.62709 7.43036C8.1406 7.85551 7.66658 8.26975 7.66658 9H6.33325C6.33325 7.78582 6.96133 7.30439 7.51355 6.88112C7.94674 6.54907 8.33325 6.25281 8.33325 5.66667C8.33325 4.93333 7.73325 4.33333 6.99992 4.33333C6.26658 4.33333 5.66658 4.93333 5.66658 5.66667H4.33325Z",fill:"currentColor"})}),Ae=H(void 0),Ce=H({});function Ee(e){return new URLSearchParams(location.hash.replace("#","?")).get(e)}function Se(...e){const t=[];for(const n of e){if(!n)continue;if("string"==typeof n){t.push(n);continue}const e=Object.entries(n).filter((([e,t])=>t)).map((([e])=>e));t.push(...e)}return t.join(" ")}function ze(e,t){switch(e){case"navigation":return t.navigationDescription;case"timespan":return t.timespanDescription;case"snapshot":return t.snapshotDescription}}function Me(){const e=Y(Ae);if(!e)throw Error("useFlowResult must be called in the FlowResultContext");return e}function Le(){const e=Me(),[t,n]=function(...e){const[t,n]=q(e.map(Ee));return K((()=>{function r(){const r=e.map(Ee);r.every(((e,n)=>e===t[n]))||n(r)}return window.addEventListener("hashchange",r),()=>window.removeEventListener("hashchange",r)}),[t]),t}("index","anchor");return Q((()=>{if(!t)return null;const r=Number(t);if(!Number.isFinite(r))return console.warn(`Invalid hash index: ${t}`),null;const o=e.steps[r];return o?{currentLhr:o.lhr,index:r,anchor:n}:(console.warn(`No flow step at index ${r}`),null)}),[t,e,n])}function Ne(e,t){const n=J(null);return Z((()=>{if(!n.current)return;const t=e();return n.current.append(t),()=>{n.current?.contains(t)&&n.current.removeChild(t)}}),t),n}const Fe=()=>D("div",{className:"Separator",role:"separator"}),He=({mode:e})=>D(g,{children:["navigation"===e&&D(me,{}),"timespan"===e&&D(fe,{}),"snapshot"===e&&D(_e,{})]}),Te=({mode:e})=>D("div",{className:"FlowSegment",children:[D("div",{className:"FlowSegment__top-line"}),e&&D(He,{mode:e}),D("div",{className:"FlowSegment__bottom-line"})]}),De=({frames:e,width:t,height:n})=>{const[r,o]=q(0),i=r%e.length;return K((()=>{const t=setInterval((()=>o((t=>(t+1)%e.length))),500);return()=>clearInterval(t)}),[e.length]),D("img",{className:"FlowStepThumbnail","data-testid":"FlowStepAnimatedThumbnail",src:e[i].data,style:{width:t,height:n},alt:"Animated screenshots of a page tested by Lighthouse"})},Pe=({lhr:e,width:t,height:n})=>{const r=function(e){const t=e.audits["full-page-screenshot"];return t?.details&&"full-page-screenshot"===t.details.type&&t.details||null}(e),o=function(e){const t=e.audits["screenshot-thumbnails"];if(!t)return;return t.details&&"filmstrip"===t.details.type&&t.details.items||void 0}(e),i=function(e){const{width:t,height:n}=e.configSettings.screenEmulation;return{width:t,height:n}}(e);if(t&&void 0===n?n=i.height*t/i.width:n&&void 0===t&&(t=i.width*n/i.height),!t||!n)return console.warn(new Error("FlowStepThumbnail requested without any dimensions").stack),D(g,{});let a;if(o?.length){if(a=o[o.length-1].data,"timespan"===e.gatherMode)return D(De,{frames:o,width:t,height:n})}else a=r?.screenshot.data;return D(g,{children:a&&D("img",{className:"FlowStepThumbnail",src:a,style:{width:t,height:n},alt:"Screenshot of a page tested by Lighthouse"})})};var Re,Ue=function(){function e(t,n,r,o){this.message=t,this.expected=n,this.found=r,this.location=o,this.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,e)}return function(e,t){function n(){this.constructor=e}n.prototype=t.prototype,e.prototype=new n}(e,Error),e.buildMessage=function(e,t){var n={literal:function(e){return'"'+o(e.text)+'"'},class:function(e){var t,n="";for(t=0;t<e.parts.length;t++)n+=e.parts[t]instanceof Array?i(e.parts[t][0])+"-"+i(e.parts[t][1]):i(e.parts[t]);return"["+(e.inverted?"^":"")+n+"]"},any:function(e){return"any character"},end:function(e){return"end of input"},other:function(e){return e.description}};function r(e){return e.charCodeAt(0).toString(16).toUpperCase()}function o(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return"\\x0"+r(e)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(e){return"\\x"+r(e)}))}function i(e){return e.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return"\\x0"+r(e)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(e){return"\\x"+r(e)}))}return"Expected "+function(e){var t,r,o,i=new Array(e.length);for(t=0;t<e.length;t++)i[t]=(o=e[t],n[o.type](o));if(i.sort(),i.length>0){for(t=1,r=1;t<i.length;t++)i[t-1]!==i[t]&&(i[r]=i[t],r++);i.length=r}switch(i.length){case 1:return i[0];case 2:return i[0]+" or "+i[1];default:return i.slice(0,-1).join(", ")+", or "+i[i.length-1]}}(e)+" but "+function(e){return e?'"'+o(e)+'"':"end of input"}(t)+" found."},{SyntaxError:e,parse:function(t,n){n=void 0!==n?n:{};var r,o={},i={start:ce},a=ce,l=function(e){return e.join("")},s=re("{",!1),c=",",d=re(",",!1),h=re("}",!1),p="number",u=re("number",!1),g="date",m=re("date",!1),f="time",_=re("time",!1),v="plural",b=re("plural",!1),w="selectordinal",y=re("selectordinal",!1),x="select",k=re("select",!1),A=re("=",!1),C="offset:",E=re("offset:",!1),S=ie("whitespace"),z=/^[ \t\n\r]/,M=oe([" ","\t","\n","\r"],!1,!1),L=ie("optionalWhitespace"),N=/^[0-9]/,F=oe([["0","9"]],!1,!1),H=/^[0-9a-f]/i,T=oe([["0","9"],["a","f"]],!1,!0),D=re("0",!1),P=/^[1-9]/,R=oe([["1","9"]],!1,!1),U="'",I=re("'",!1),O=/^[ \t\n\r,.+={}#]/,B=oe([" ","\t","\n","\r",",",".","+","=","{","}","#"],!1,!1),V={type:"any"},$=/^[^{}\\\0-\x1F\x7F \t\n\r]/,j=oe(["{","}","\\",["\0",""],""," ","\t","\n","\r"],!0,!1),G=re("\\\\",!1),W=re("\\#",!1),q=re("\\{",!1),K=re("\\}",!1),Z=re("\\u",!1),J=0,Q=0,Y=[{line:1,column:1}],X=0,ee=[],te=0;if("startRule"in n){if(!(n.startRule in i))throw new Error("Can't start parsing from rule \""+n.startRule+'".');a=i[n.startRule]}function ne(){return le(Q,J)}function re(e,t){return{type:"literal",text:e,ignoreCase:t}}function oe(e,t,n){return{type:"class",parts:e,inverted:t,ignoreCase:n}}function ie(e){return{type:"other",description:e}}function ae(e){var n,r=Y[e];if(r)return r;for(n=e-1;!Y[n];)n--;for(r={line:(r=Y[n]).line,column:r.column};n<e;)10===t.charCodeAt(n)?(r.line++,r.column=1):r.column++,n++;return Y[e]=r,r}function le(e,t){var n=ae(e),r=ae(t);return{start:{offset:e,line:n.line,column:n.column},end:{offset:t,line:r.line,column:r.column}}}function se(e){J<X||(J>X&&(X=J,ee=[]),ee.push(e))}function ce(){return de()}function de(){var e,t,n;for(e=J,t=[],n=he();n!==o;)t.push(n),n=he();return t!==o&&(Q=e,t={type:"messageFormatPattern",elements:t,location:ne()}),e=t}function he(){var e;return(e=function(){var e,n;e=J,(n=function(){var e,n,r,i,a,l;e=J,n=[],r=J,(i=me())!==o&&(a=xe())!==o&&(l=me())!==o?r=i=[i,a,l]:(J=r,r=o);if(r!==o)for(;r!==o;)n.push(r),r=J,(i=me())!==o&&(a=xe())!==o&&(l=me())!==o?r=i=[i,a,l]:(J=r,r=o);else n=o;n!==o&&(Q=e,n=n.reduce((function(e,t){return e.concat(t)}),[]).join(""));(e=n)===o&&(e=J,e=(n=ge())!==o?t.substring(e,J):n);return e}())!==o&&(Q=e,n={type:"messageTextElement",value:n,location:ne()});return e=n}())===o&&(e=function(){var e,n,r,i,a,A,C;e=J,123===t.charCodeAt(J)?(n="{",J++):(n=o,0===te&&se(s));n!==o&&me()!==o&&(r=function(){var e,t,n;if((e=ve())===o){for(e=J,t=[],n=be();n!==o;)t.push(n),n=be();t!==o&&(Q=e,t=l(t)),e=t}return e}())!==o&&me()!==o?(i=J,44===t.charCodeAt(J)?(a=c,J++):(a=o,0===te&&se(d)),a!==o&&(A=me())!==o&&(C=function(){var e;(e=function(){var e,n,r,i,a,l;e=J,t.substr(J,6)===p?(n=p,J+=6):(n=o,0===te&&se(u));n===o&&(t.substr(J,4)===g?(n=g,J+=4):(n=o,0===te&&se(m)),n===o&&(t.substr(J,4)===f?(n=f,J+=4):(n=o,0===te&&se(_))));n!==o&&me()!==o?(r=J,44===t.charCodeAt(J)?(i=c,J++):(i=o,0===te&&se(d)),i!==o&&(a=me())!==o&&(l=xe())!==o?r=i=[i,a,l]:(J=r,r=o),r===o&&(r=null),r!==o?(Q=e,e=n={type:n+"Format",style:(s=r)&&s[2],location:ne()}):(J=e,e=o)):(J=e,e=o);var s;return e}())===o&&(e=function(){var e,n,r,i;e=J,t.substr(J,6)===v?(n=v,J+=6):(n=o,0===te&&se(b));n!==o&&me()!==o?(44===t.charCodeAt(J)?(r=c,J++):(r=o,0===te&&se(d)),r!==o&&me()!==o&&(i=ue())!==o?(Q=e,e=n={type:(a=i).type,ordinal:!1,offset:a.offset||0,options:a.options,location:ne()}):(J=e,e=o)):(J=e,e=o);var a;return e}())===o&&(e=function(){var e,n,r,i;e=J,t.substr(J,13)===w?(n=w,J+=13):(n=o,0===te&&se(y));n!==o&&me()!==o?(44===t.charCodeAt(J)?(r=c,J++):(r=o,0===te&&se(d)),r!==o&&me()!==o&&(i=ue())!==o?(Q=e,e=n={type:(a=i).type,ordinal:!0,offset:a.offset||0,options:a.options,location:ne()}):(J=e,e=o)):(J=e,e=o);var a;return e}())===o&&(e=function(){var e,n,r,i,a;e=J,t.substr(J,6)===x?(n=x,J+=6):(n=o,0===te&&se(k));if(n!==o)if(me()!==o)if(44===t.charCodeAt(J)?(r=c,J++):(r=o,0===te&&se(d)),r!==o)if(me()!==o){if(i=[],(a=pe())!==o)for(;a!==o;)i.push(a),a=pe();else i=o;i!==o?(Q=e,e=n=function(e){return{type:"selectFormat",options:e,location:ne()}}(i)):(J=e,e=o)}else J=e,e=o;else J=e,e=o;else J=e,e=o;else J=e,e=o;return e}());return e}())!==o?i=a=[a,A,C]:(J=i,i=o),i===o&&(i=null),i!==o&&(a=me())!==o?(125===t.charCodeAt(J)?(A="}",J++):(A=o,0===te&&se(h)),A!==o?(Q=e,e=n={type:"argumentElement",id:r,format:(E=i)&&E[2],location:ne()}):(J=e,e=o)):(J=e,e=o)):(J=e,e=o);var E;return e}()),e}function pe(){var e,n,r,i,a;return e=J,me()!==o&&(n=function(){var e,n,r,i;return e=J,n=J,61===t.charCodeAt(J)?(r="=",J++):(r=o,0===te&&se(A)),r!==o&&(i=ve())!==o?n=r=[r,i]:(J=n,n=o),(e=n!==o?t.substring(e,J):n)===o&&(e=xe()),e}())!==o&&me()!==o?(123===t.charCodeAt(J)?(r="{",J++):(r=o,0===te&&se(s)),r!==o&&(i=de())!==o?(125===t.charCodeAt(J)?(a="}",J++):(a=o,0===te&&se(h)),a!==o?(Q=e,e={type:"optionalFormatPattern",selector:n,value:i,location:ne()}):(J=e,e=o)):(J=e,e=o)):(J=e,e=o),e}function ue(){var e,n,r,i;if(e=J,(n=function(){var e,n,r;return e=J,t.substr(J,7)===C?(n=C,J+=7):(n=o,0===te&&se(E)),n!==o&&me()!==o&&(r=ve())!==o?(Q=e,e=n=r):(J=e,e=o),e}())===o&&(n=null),n!==o)if(me()!==o){if(r=[],(i=pe())!==o)for(;i!==o;)r.push(i),i=pe();else r=o;r!==o?(Q=e,e=n=function(e,t){return{type:"pluralFormat",offset:e,options:t,location:ne()}}(n,r)):(J=e,e=o)}else J=e,e=o;else J=e,e=o;return e}function ge(){var e,n;if(te++,e=[],z.test(t.charAt(J))?(n=t.charAt(J),J++):(n=o,0===te&&se(M)),n!==o)for(;n!==o;)e.push(n),z.test(t.charAt(J))?(n=t.charAt(J),J++):(n=o,0===te&&se(M));else e=o;return te--,e===o&&(n=o,0===te&&se(S)),e}function me(){var e,n,r;for(te++,e=J,n=[],r=ge();r!==o;)n.push(r),r=ge();return e=n!==o?t.substring(e,J):n,te--,e===o&&(n=o,0===te&&se(L)),e}function fe(){var e;return N.test(t.charAt(J))?(e=t.charAt(J),J++):(e=o,0===te&&se(F)),e}function _e(){var e;return H.test(t.charAt(J))?(e=t.charAt(J),J++):(e=o,0===te&&se(T)),e}function ve(){var e,n,r,i,a,l;if(e=J,48===t.charCodeAt(J)?(n="0",J++):(n=o,0===te&&se(D)),n===o){if(n=J,r=J,P.test(t.charAt(J))?(i=t.charAt(J),J++):(i=o,0===te&&se(R)),i!==o){for(a=[],l=fe();l!==o;)a.push(l),l=fe();a!==o?r=i=[i,a]:(J=r,r=o)}else J=r,r=o;n=r!==o?t.substring(n,J):r}return n!==o&&(Q=e,n=parseInt(n,10)),e=n}function be(){var e,n,r;return e=J,n=J,te++,39===t.charCodeAt(J)?(r=U,J++):(r=o,0===te&&se(I)),r===o&&(O.test(t.charAt(J))?(r=t.charAt(J),J++):(r=o,0===te&&se(B))),te--,r===o?n=void 0:(J=n,n=o),n!==o?(t.length>J?(r=t.charAt(J),J++):(r=o,0===te&&se(V)),r!==o?(Q=e,e=n=r):(J=e,e=o)):(J=e,e=o),e===o&&(e=J,39===t.charCodeAt(J)?(n=U,J++):(n=o,0===te&&se(I)),n!==o&&(r=function(){var e;O.test(t.charAt(J))?(e=t.charAt(J),J++):(e=o,0===te&&se(B));e===o&&(e=we());return e}())!==o?(Q=e,e=n=r):(J=e,e=o)),e}function we(){var e;return 39===t.charCodeAt(J)?(e=U,J++):(e=o,0===te&&se(I)),e}function ye(){var e,n,r,i,a,l,s,c,d;return e=J,39===t.charCodeAt(J)?(n=U,J++):(n=o,0===te&&se(I)),n!==o&&(r=we())!==o?(Q=e,e=n=r):(J=e,e=o),e===o&&($.test(t.charAt(J))?(e=t.charAt(J),J++):(e=o,0===te&&se(j)),e===o&&(e=J,"\\\\"===t.substr(J,2)?(n="\\\\",J+=2):(n=o,0===te&&se(G)),n!==o&&(Q=e,n="\\"),(e=n)===o&&(e=J,"\\#"===t.substr(J,2)?(n="\\#",J+=2):(n=o,0===te&&se(W)),n!==o&&(Q=e,n="\\#"),(e=n)===o&&(e=J,"\\{"===t.substr(J,2)?(n="\\{",J+=2):(n=o,0===te&&se(q)),n!==o&&(Q=e,n="{"),(e=n)===o&&(e=J,"\\}"===t.substr(J,2)?(n="\\}",J+=2):(n=o,0===te&&se(K)),n!==o&&(Q=e,n="}"),(e=n)===o&&(e=J,"\\u"===t.substr(J,2)?(n="\\u",J+=2):(n=o,0===te&&se(Z)),n!==o?(r=J,i=J,(a=_e())!==o&&(l=_e())!==o&&(s=_e())!==o&&(c=_e())!==o?i=a=[a,l,s,c]:(J=i,i=o),(r=i!==o?t.substring(r,J):i)!==o?(Q=e,d=r,e=n=String.fromCharCode(parseInt(d,16))):(J=e,e=o)):(J=e,e=o))))))),e}function xe(){var e,t,n;if(e=J,t=[],(n=ye())!==o)for(;n!==o;)t.push(n),n=ye();else t=o;return t!==o&&(Q=e,t=l(t)),e=t}if((r=a())!==o&&J===t.length)return r;throw r!==o&&J<t.length&&se({type:"end"}),function(t,n,r){return new e(e.buildMessage(t,n),t,n,r)}(ee,X<t.length?t.charAt(X):null,X<t.length?le(X,X+1):le(X,X))}}}(),Ie=(Re=function(e,t){return(Re=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}Re(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),Oe=function(){function e(e,t,n){this.locales=[],this.formats={number:{},date:{},time:{}},this.pluralNumberFormat=null,this.currentPlural=null,this.pluralStack=[],this.locales=e,this.formats=t,this.formatters=n}return e.prototype.compile=function(e){return this.pluralStack=[],this.currentPlural=null,this.pluralNumberFormat=null,this.compileMessage(e)},e.prototype.compileMessage=function(e){var t=this;if(!e||"messageFormatPattern"!==e.type)throw new Error('Message AST is not of type: "messageFormatPattern"');var n=e.elements,r=n.filter((function(e){return"messageTextElement"===e.type||"argumentElement"===e.type})).map((function(e){return"messageTextElement"===e.type?t.compileMessageText(e):t.compileArgument(e)}));if(r.length!==n.length)throw new Error("Message element does not have a valid type");return r},e.prototype.compileMessageText=function(e){return this.currentPlural&&/(^|[^\\])#/g.test(e.value)?(this.pluralNumberFormat||(this.pluralNumberFormat=new Intl.NumberFormat(this.locales)),new je(this.currentPlural.id,this.currentPlural.format.offset,this.pluralNumberFormat,e.value)):e.value.replace(/\\#/g,"#")},e.prototype.compileArgument=function(e){var t=e.format,n=e.id,r=this.formatters;if(!t)return new Ve(n);var o=this.formats,i=this.locales;switch(t.type){case"numberFormat":return{id:n,format:r.getNumberFormat(i,o.number[t.style]).format};case"dateFormat":return{id:n,format:r.getDateTimeFormat(i,o.date[t.style]).format};case"timeFormat":return{id:n,format:r.getDateTimeFormat(i,o.time[t.style]).format};case"pluralFormat":return new $e(n,t.offset,this.compileOptions(e),r.getPluralRules(i,{type:t.ordinal?"ordinal":"cardinal"}));case"selectFormat":return new Ge(n,this.compileOptions(e));default:throw new Error("Message element does not have a valid format type")}},e.prototype.compileOptions=function(e){var t=this,n=e.format,r=n.options;this.pluralStack.push(this.currentPlural),this.currentPlural="pluralFormat"===n.type?e:null;var o=r.reduce((function(e,n){return e[n.selector]=t.compileMessage(n.value),e}),{});return this.currentPlural=this.pluralStack.pop(),o},e}(),Be=function(e){this.id=e},Ve=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ie(t,e),t.prototype.format=function(e){return e||"number"==typeof e?"string"==typeof e?e:String(e):""},t}(Be),$e=function(){function e(e,t,n,r){this.id=e,this.offset=t,this.options=n,this.pluralRules=r}return e.prototype.getOption=function(e){var t=this.options;return t["="+e]||t[this.pluralRules.select(e-this.offset)]||t.other},e}(),je=function(e){function t(t,n,r,o){var i=e.call(this,t)||this;return i.offset=n,i.numberFormat=r,i.string=o,i}return Ie(t,e),t.prototype.format=function(e){var t=this.numberFormat.format(e-this.offset);return this.string.replace(/(^|[^\\])#/g,"$1"+t).replace(/\\#/g,"#")},t}(Be),Ge=function(){function e(e,t){this.id=e,this.options=t}return e.prototype.getOption=function(e){var t=this.options;return t[e]||t.other},e}();function We(e){return!!e.options}var qe=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ke=function(){return(Ke=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function Ze(e){"string"==typeof e&&(e=[e]);try{return Intl.NumberFormat.supportedLocalesOf(e,{localeMatcher:"best fit"})[0]}catch(e){return Xe.defaultLocale}}function Je(e,t){for(var n="",r=0,o=e;r<o.length;r++){var i=o[r];if("string"!=typeof i){var a=i.id;if(!t||!(a in t))throw new Ye("A value must be provided for: "+a,a);var l=t[a];We(i)?n+=Je(i.getOption(l),t):n+=i.format(l)}else n+=i}return n}function Qe(e,t){return t?Object.keys(e).reduce((function(n,r){var o,i;return n[r]=(o=e[r],(i=t[r])?Ke({},o||{},i||{},Object.keys(o).reduce((function(e,t){return e[t]=Ke({},o[t],i[t]||{}),e}),{})):o),n}),Ke({},e)):e}var Ye=function(e){function t(t,n){var r=e.call(this,t)||this;return r.variableId=n,r}return qe(t,e),t}(Error);var Xe=function(){function e(t,n,r,o){var i=this;if(void 0===n&&(n=e.defaultLocale),this.format=function(e){try{return Je(i.pattern,e)}catch(e){throw e.variableId?new Error("The intl string context variable '"+e.variableId+"' was not provided to the string '"+i.message+"'"):e}},"string"==typeof t){if(!e.__parse)throw new TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`");this.ast=e.__parse(t)}else this.ast=t;if(this.message=t,!this.ast||"messageFormatPattern"!==this.ast.type)throw new TypeError("A message must be provided as a String or AST.");var a=Qe(e.formats,r);this.locale=Ze(n||[]);var l=o&&o.formatters||{getNumberFormat:function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return new((e=Intl.NumberFormat).bind.apply(e,[void 0].concat(t)))},getDateTimeFormat:function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return new((e=Intl.DateTimeFormat).bind.apply(e,[void 0].concat(t)))},getPluralRules:function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return new((e=Intl.PluralRules).bind.apply(e,[void 0].concat(t)))}};this.pattern=new Oe(n,a,l).compile(this.ast)}return e.prototype.resolvedOptions=function(){return{locale:this.locale}},e.prototype.getAst=function(){return this.ast},e.defaultLocale="en",e.__parse=void 0,e.formats={number:{currency:{style:"currency"},percent:{style:"percent"}},date:{short:{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},long:{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"}},time:{short:{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},long:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}},e}();Xe.__parse=Ue.parse,
|
|
17
|
+
*/const ie="…",ae="data:image/jpeg;base64,",le={label:"pass",minScore:.9},se={label:"average",minScore:.5},ce={label:"fail"},de={label:"error"},he=["com","co","gov","edu","ac","org","go","gob","or","net","in","ne","nic","gouv","web","spb","blog","jus","kiev","mil","wi","qc","ca","bel","on"];class pe{static i18n=null;static get PASS_THRESHOLD(){return.9}static get MS_DISPLAY_VALUE(){return"%10d ms"}static getFinalDisplayedUrl(e){if(e.finalDisplayedUrl)return e.finalDisplayedUrl;if(e.finalUrl)return e.finalUrl;throw new Error("Could not determine final displayed URL")}static getMainDocumentUrl(e){return e.mainDocumentUrl||e.finalUrl}static prepareReportResult(e){const t=JSON.parse(JSON.stringify(e));t.configSettings.locale||(t.configSettings.locale="en"),t.configSettings.formFactor||(t.configSettings.formFactor=t.configSettings.emulatedFormFactor),t.finalDisplayedUrl=this.getFinalDisplayedUrl(t),t.mainDocumentUrl=this.getMainDocumentUrl(t);for(const e of Object.values(t.audits))if("not_applicable"!==e.scoreDisplayMode&&"not-applicable"!==e.scoreDisplayMode||(e.scoreDisplayMode="notApplicable"),e.details&&(void 0!==e.details.type&&"diagnostic"!==e.details.type||(e.details.type="debugdata"),"filmstrip"===e.details.type))for(const t of e.details.items)t.data.startsWith(ae)||(t.data=ae+t.data);if("object"!=typeof t.categories)throw new Error("No categories provided.");const n=new Map,[r]=t.lighthouseVersion.split(".").map(Number),o=t.categories.performance;if(r<9&&o){t.categoryGroups||(t.categoryGroups={}),t.categoryGroups.hidden={title:""};for(const e of o.auditRefs)e.group?["load-opportunities","diagnostics"].includes(e.group)&&delete e.group:e.group="hidden"}for(const e of Object.values(t.categories))e.auditRefs.forEach((e=>{e.relevantAudits&&e.relevantAudits.forEach((t=>{const r=n.get(t)||[];r.push(e),n.set(t,r)}))})),e.auditRefs.forEach((e=>{const r=t.audits[e.id];e.result=r,n.has(e.id)&&(e.relevantMetrics=n.get(e.id)),t.stackPacks&&t.stackPacks.forEach((t=>{t.descriptions[e.id]&&(e.stackPacks=e.stackPacks||[],e.stackPacks.push({title:t.title,iconDataURL:t.iconDataURL,description:t.descriptions[e.id]}))}))}));return t}static showAsPassed(e){switch(e.scoreDisplayMode){case"manual":case"notApplicable":return!0;case"error":case"informative":return!1;case"numeric":case"binary":default:return Number(e.score)>=le.minScore}}static calculateRating(e,t){if("manual"===t||"notApplicable"===t)return le.label;if("error"===t)return de.label;if(null===e)return ce.label;let n=ce.label;return e>=le.minScore?n=le.label:e>=se.minScore&&(n=se.label),n}static splitMarkdownCodeSpans(e){const t=[],n=e.split(/`(.*?)`/g);for(let e=0;e<n.length;e++){const r=n[e];if(!r)continue;const o=e%2!=0;t.push({isCode:o,text:r})}return t}static splitMarkdownLink(e){const t=[],n=e.split(/\[([^\]]+?)\]\((https?:\/\/.*?)\)/g);for(;n.length;){const[e,r,o]=n.splice(0,3);e&&t.push({isLink:!1,text:e}),r&&o&&t.push({isLink:!0,text:r,linkHref:o})}return t}static getURLDisplayName(e,t){const n=void 0!==(t=t||{numPathParts:void 0,preserveQuery:void 0,preserveHost:void 0}).numPathParts?t.numPathParts:2,r=void 0===t.preserveQuery||t.preserveQuery,o=t.preserveHost||!1;let i;if("about:"===e.protocol||"data:"===e.protocol)i=e.href;else{i=e.pathname;const t=i.split("/").filter((e=>e.length));n&&t.length>n&&(i=ie+t.slice(-1*n).join("/")),o&&(i=`${e.host}/${i.replace(/^\//,"")}`),r&&(i=`${i}${e.search}`)}if("data:"!==e.protocol&&(i=i.replace(/([a-f0-9]{7})[a-f0-9]{13}[a-f0-9]*/g,"$1…"),i=i.replace(/([a-zA-Z0-9-_]{9})(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])[a-zA-Z0-9-_]{10,}/g,"$1…"),i=i.replace(/(\d{3})\d{6,}/g,"$1…"),i=i.replace(/\u2026+/g,ie),i.length>64&&i.includes("?")&&(i=i.replace(/\?([^=]*)(=)?.*/,"?$1$2…"),i.length>64&&(i=i.replace(/\?.*/,"?…")))),i.length>64){const e=i.lastIndexOf(".");i=e>=0?i.slice(0,63-(i.length-e))+`…${i.slice(e)}`:i.slice(0,63)+ie}return i}static parseURL(e){const t=new URL(e);return{file:pe.getURLDisplayName(t),hostname:t.hostname,origin:t.origin}}static createOrReturnURL(e){return e instanceof URL?e:new URL(e)}static getTld(e){const t=e.split(".").slice(-2);return he.includes(t[0])?`.${t.join(".")}`:`.${t[t.length-1]}`}static getRootDomain(e){const t=pe.createOrReturnURL(e).hostname,n=pe.getTld(t).split(".");return t.split(".").slice(-n.length).join(".")}static getEmulationDescriptions(e){let t,n,r;const o=e.throttling;switch(e.throttlingMethod){case"provided":r=n=t=pe.i18n.strings.throttlingProvided;break;case"devtools":{const{cpuSlowdownMultiplier:e,requestLatencyMs:i}=o;t=`${pe.i18n.formatNumber(e)}x slowdown (DevTools)`,n=`${pe.i18n.formatMilliseconds(i)} HTTP RTT, ${pe.i18n.formatKbps(o.downloadThroughputKbps)} down, ${pe.i18n.formatKbps(o.uploadThroughputKbps)} up (DevTools)`;r=(()=>562.5===i&&o.downloadThroughputKbps===1638.4*.9&&675===o.uploadThroughputKbps)()?pe.i18n.strings.runtimeSlow4g:pe.i18n.strings.runtimeCustom;break}case"simulate":{const{cpuSlowdownMultiplier:e,rttMs:i,throughputKbps:a}=o;t=`${pe.i18n.formatNumber(e)}x slowdown (Simulated)`,n=`${pe.i18n.formatMilliseconds(i)} TCP RTT, ${pe.i18n.formatKbps(a)} throughput (Simulated)`;r=(()=>150===i&&1638.4===a)()?pe.i18n.strings.runtimeSlow4g:pe.i18n.strings.runtimeCustom;break}default:r=t=n=pe.i18n.strings.runtimeUnknown}return{deviceEmulation:{mobile:pe.i18n.strings.runtimeMobileEmulation,desktop:pe.i18n.strings.runtimeDesktopEmulation}[e.formFactor]||pe.i18n.strings.runtimeNoEmulation,cpuThrottling:t,networkThrottling:n,summary:r}}static filterRelevantLines(e,t,n){if(0===t.length)return e.slice(0,2*n+1);const r=new Set;return(t=t.sort(((e,t)=>(e.lineNumber||0)-(t.lineNumber||0)))).forEach((({lineNumber:e})=>{let t=e-n,o=e+n;for(;t<1;)t++,o++;r.has(t-3-1)&&(t-=3);for(let e=t;e<=o;e++){const t=e;r.add(t)}})),e.filter((e=>r.has(e.lineNumber)))}static isPluginCategory(e){return e.startsWith("lighthouse-plugin-")}static shouldDisplayAsFraction(e){return"timespan"===e||"snapshot"===e}static calculateCategoryFraction(e){let t=0,n=0,r=0,o=0;for(const i of e.auditRefs){const e=pe.showAsPassed(i.result);"hidden"!==i.group&&"manual"!==i.result.scoreDisplayMode&&"notApplicable"!==i.result.scoreDisplayMode&&("informative"!==i.result.scoreDisplayMode?(++t,o+=i.weight,e&&n++):e||++r)}return{numPassed:n,numPassableAudits:t,numInformative:r,totalWeight:o}}}pe.reportJson=null;let ue=0;pe.getUniqueSuffix=()=>ue++,pe.resetUniqueSuffix=()=>{ue=0};pe.UIStrings={varianceDisclaimer:"Values are estimated and may vary. The [performance score is calculated](https://web.dev/performance-scoring/) directly from these metrics.",calculatorLink:"See calculator.",showRelevantAudits:"Show audits relevant to:",opportunityResourceColumnLabel:"Opportunity",opportunitySavingsColumnLabel:"Estimated Savings",errorMissingAuditInfo:"Report error: no audit information",errorLabel:"Error!",warningHeader:"Warnings: ",warningAuditsGroupTitle:"Passed audits but with warnings",passedAuditsGroupTitle:"Passed audits",notApplicableAuditsGroupTitle:"Not applicable",manualAuditsGroupTitle:"Additional items to manually check",toplevelWarningsMessage:"There were issues affecting this run of Lighthouse:",crcInitialNavigation:"Initial Navigation",crcLongestDurationLabel:"Maximum critical path latency:",snippetExpandButtonLabel:"Expand snippet",snippetCollapseButtonLabel:"Collapse snippet",lsPerformanceCategoryDescription:"[Lighthouse](https://developers.google.com/web/tools/lighthouse/) analysis of the current page on an emulated mobile network. Values are estimated and may vary.",labDataTitle:"Lab Data",thirdPartyResourcesLabel:"Show 3rd-party resources",viewTreemapLabel:"View Treemap",viewTraceLabel:"View Trace",viewOriginalTraceLabel:"View Original Trace",dropdownPrintSummary:"Print Summary",dropdownPrintExpanded:"Print Expanded",dropdownCopyJSON:"Copy JSON",dropdownSaveHTML:"Save as HTML",dropdownSaveJSON:"Save as JSON",dropdownViewer:"Open in Viewer",dropdownSaveGist:"Save as Gist",dropdownDarkTheme:"Toggle Dark Theme",runtimeSettingsDevice:"Device",runtimeSettingsNetworkThrottling:"Network throttling",runtimeSettingsCPUThrottling:"CPU throttling",runtimeSettingsUANetwork:"User agent (network)",runtimeSettingsBenchmark:"CPU/Memory Power",runtimeSettingsAxeVersion:"Axe version",footerIssue:"File an issue",runtimeNoEmulation:"No emulation",runtimeMobileEmulation:"Emulated Moto G4",runtimeDesktopEmulation:"Emulated Desktop",runtimeUnknown:"Unknown",runtimeSingleLoad:"Single page load",runtimeAnalysisWindow:"Initial page load",runtimeSingleLoadTooltip:"This data is taken from a single page load, as opposed to field data summarizing many sessions.",throttlingProvided:"Provided by environment",show:"Show",hide:"Hide",expandView:"Expand view",collapseView:"Collapse view",runtimeSlow4g:"Slow 4G throttling",runtimeCustom:"Custom throttling"};const ge=()=>D("svg",{width:"14",viewBox:"0 0 18 16",fill:"none",role:"img",children:D("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M0 2C0 1.17 0.67 0.5 1.5 0.5C2.33 0.5 3 1.17 3 2C3 2.83 2.33 3.5 1.5 3.5C0.67 3.5 0 2.83 0 2ZM0 8C0 7.17 0.67 6.5 1.5 6.5C2.33 6.5 3 7.17 3 8C3 8.83 2.33 9.5 1.5 9.5C0.67 9.5 0 8.83 0 8ZM1.5 12.5C0.67 12.5 0 13.18 0 14C0 14.82 0.68 15.5 1.5 15.5C2.32 15.5 3 14.82 3 14C3 13.18 2.33 12.5 1.5 12.5ZM18 15H5V13H18V15ZM5 9H18V7H5V9ZM5 3V1H18V3H5Z",fill:"currentColor"})}),me=()=>D("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",role:"img","aria-label":"Icon representing a navigation report",children:D("circle",{cx:"8",cy:"8",r:"7",fill:"none",stroke:"currentColor","stroke-width":"2"})}),fe=()=>D("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",role:"img","aria-label":"Icon representing a timespan report",children:[D("circle",{cx:"8",cy:"8",r:"7",fill:"none",stroke:"currentColor","stroke-width":"2"}),D("path",{d:"m 8,4 v 4 l 4,1.9999998",stroke:"currentColor","stroke-width":"1.5"})]}),_e=()=>D("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",role:"img","aria-label":"Icon representing a snapshot report",children:D("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M 12.2038,12.2812 C 11.1212,13.3443 9.6372,14 8,14 7.81038,14 7.62281,13.9912 7.43768,13.974 L 10.3094,9 Z M 12.8925,11.4741 10.0207,6.5 H 13.811 C 13.9344,6.97943 14,7.48205 14,8 c 0,1.2947 -0.4101,2.4937 -1.1075,3.4741 z M 13.456,5.5 H 7.71135 L 9.6065,2.21749 C 11.3203,2.69259 12.7258,3.90911 13.456,5.5 Z M 8.5624,2.02601 C 8.3772,2.0088 8.1896,2 8,2 6.36282,2 4.8788,2.65572 3.79622,3.71885 L 5.69061,7.00002 Z M 3.10749,4.52594 C 2.4101,5.5063 2,6.70526 2,8 2,8.5179 2.06563,9.0206 2.18903,9.5 H 5.97927 Z M 2.54404,10.5 c 0.73017,1.5909 2.1357,2.8074 3.84949,3.2825 L 8.2887,10.5 Z M 16,8 c 0,4.4183 -3.5817,8 -8,8 C 3.58172,16 0,12.4183 0,8 0,3.58172 3.58172,0 8,0 c 4.4183,0 8,3.58172 8,8 z",fill:"currentColor"})}),ve=()=>D("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24px",viewBox:"0 0 24 24",width:"24px",fill:"currentColor",role:"img","aria-label":"Icon representing a close action",children:[D("path",{d:"M0 0h24v24H0V0z",fill:"none"}),D("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})]}),be=()=>D("svg",{width:"15",height:"12",viewBox:"0 0 15 12",fill:"none",role:"img",children:D("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.33317 2.00008H13.9998V0.666748H3.33317C2.59984 0.666748 1.99984 1.26675 1.99984 2.00008V9.33341H0.666504V11.3334H7.99984V9.33341H3.33317V2.00008ZM13.9998 3.33341H9.99984C9.63317 3.33341 9.33317 3.63341 9.33317 4.00008V10.6667C9.33317 11.0334 9.63317 11.3334 9.99984 11.3334H13.9998C14.3665 11.3334 14.6665 11.0334 14.6665 10.6667V4.00008C14.6665 3.63341 14.3665 3.33341 13.9998 3.33341ZM10.6665 9.33341H13.3332V4.66675H10.6665V9.33341Z",fill:"currentColor"})}),we=()=>D("svg",{width:"16",height:"11",viewBox:"0 0 16 11",fill:"none",role:"img",children:D("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M0.666687 3.26663L2.00002 4.59997C3.92002 2.67997 6.52669 1.87997 9.02002 2.18663L9.81335 0.399966C6.59335 -0.173367 3.16002 0.779966 0.666687 3.26663ZM10.6 0.599966C10.4867 0.599966 10.3867 0.659966 10.3267 0.753299L10.28 0.853299L6.82669 8.61996C6.72002 8.8133 6.65335 9.02663 6.65335 9.25996C6.65335 9.99996 7.25335 10.6 7.99335 10.6C8.63335 10.6 9.17335 10.1466 9.30002 9.53996L9.30669 9.51997L10.9334 0.933299C10.9334 0.746633 10.7867 0.599966 10.6 0.599966ZM15.3334 3.26663L14 4.59997C13.1867 3.78663 12.2534 3.17997 11.2534 2.76663L11.6067 0.886633C12.9667 1.38663 14.24 2.1733 15.3334 3.26663ZM11.3334 7.26663L12.6667 5.9333C12.1334 5.39997 11.5334 4.98663 10.8934 4.6733L10.5267 6.61997C10.8067 6.79997 11.08 7.0133 11.3334 7.26663ZM4.66669 7.26663L3.33335 5.9333C4.67335 4.5933 6.45335 3.95997 8.20669 4.0133L7.35335 5.9333C6.37335 6.0733 5.42002 6.5133 4.66669 7.26663Z",fill:"currentColor"})}),ye=()=>D("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",role:"img",children:D("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M15.5 7.16667V5.5H13.8333V3.83333C13.8333 2.91667 13.0833 2.16667 12.1667 2.16667H10.5V0.5H8.83333V2.16667H7.16667V0.5H5.5V2.16667H3.83333C2.91667 2.16667 2.16667 2.91667 2.16667 3.83333V5.5H0.5V7.16667H2.16667V8.83333H0.5V10.5H2.16667V12.1667C2.16667 13.0833 2.91667 13.8333 3.83333 13.8333H5.5V15.5H7.16667V13.8333H8.83333V15.5H10.5V13.8333H12.1667C13.0833 13.8333 13.8333 13.0833 13.8333 12.1667V10.5H15.5V8.83333H13.8333V7.16667H15.5ZM10.5 5.5H5.5V10.5H10.5V5.5ZM3.83333 12.1667H12.1667V3.83333H3.83333V12.1667Z",fill:"currentColor"})}),xe=()=>D("svg",{viewBox:"0 0 18 12",width:"18",height:"12",role:"img",children:[D("rect",{width:"18",height:"2",fill:"currentColor"}),D("rect",{y:"5",width:"18",height:"2",fill:"currentColor"}),D("rect",{y:"10",width:"18",height:"2",fill:"currentColor"})]}),ke=()=>D("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:D("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M13 7C13 10.3137 10.3137 13 7 13C3.68629 13 1 10.3137 1 7C1 3.68629 3.68629 1 7 1C10.3137 1 13 3.68629 13 7ZM14 7C14 10.866 10.866 14 7 14C3.13401 14 0 10.866 0 7C0 3.13401 3.13401 0 7 0C10.866 0 14 3.13401 14 7ZM7.66658 11H6.33325V9.66667H7.66658V11ZM4.33325 5.66667C4.33325 4.19333 5.52659 3 6.99992 3C8.47325 3 9.66658 4.19333 9.66658 5.66667C9.66658 6.52194 9.1399 6.98221 8.62709 7.43036C8.1406 7.85551 7.66658 8.26975 7.66658 9H6.33325C6.33325 7.78582 6.96133 7.30439 7.51355 6.88112C7.94674 6.54907 8.33325 6.25281 8.33325 5.66667C8.33325 4.93333 7.73325 4.33333 6.99992 4.33333C6.26658 4.33333 5.66658 4.93333 5.66658 5.66667H4.33325Z",fill:"currentColor"})}),Ae=H(void 0),Ce=H({});function Ee(e){return new URLSearchParams(location.hash.replace("#","?")).get(e)}function Se(...e){const t=[];for(const n of e){if(!n)continue;if("string"==typeof n){t.push(n);continue}const e=Object.entries(n).filter((([e,t])=>t)).map((([e])=>e));t.push(...e)}return t.join(" ")}function ze(e,t){switch(e){case"navigation":return t.navigationDescription;case"timespan":return t.timespanDescription;case"snapshot":return t.snapshotDescription}}function Me(){const e=Y(Ae);if(!e)throw Error("useFlowResult must be called in the FlowResultContext");return e}function Le(){const e=Me(),[t,n]=function(...e){const[t,n]=q(e.map(Ee));return K((()=>{function r(){const r=e.map(Ee);r.every(((e,n)=>e===t[n]))||n(r)}return window.addEventListener("hashchange",r),()=>window.removeEventListener("hashchange",r)}),[t]),t}("index","anchor");return Q((()=>{if(!t)return null;const r=Number(t);if(!Number.isFinite(r))return console.warn(`Invalid hash index: ${t}`),null;const o=e.steps[r];return o?{currentLhr:o.lhr,index:r,anchor:n}:(console.warn(`No flow step at index ${r}`),null)}),[t,e,n])}function Ne(e,t){const n=J(null);return Z((()=>{if(!n.current)return;const t=e();return n.current.append(t),()=>{n.current?.contains(t)&&n.current.removeChild(t)}}),t),n}const Fe=()=>D("div",{className:"Separator",role:"separator"}),He=({mode:e})=>D(g,{children:["navigation"===e&&D(me,{}),"timespan"===e&&D(fe,{}),"snapshot"===e&&D(_e,{})]}),Te=({mode:e})=>D("div",{className:"FlowSegment",children:[D("div",{className:"FlowSegment__top-line"}),e&&D(He,{mode:e}),D("div",{className:"FlowSegment__bottom-line"})]}),De=({frames:e,width:t,height:n})=>{const[r,o]=q(0),i=r%e.length;return K((()=>{const t=setInterval((()=>o((t=>(t+1)%e.length))),500);return()=>clearInterval(t)}),[e.length]),D("img",{className:"FlowStepThumbnail","data-testid":"FlowStepAnimatedThumbnail",src:e[i].data,style:{width:t,height:n},alt:"Animated screenshots of a page tested by Lighthouse"})},Pe=({lhr:e,width:t,height:n})=>{const r=function(e){const t=e.audits["full-page-screenshot"];return t?.details&&"full-page-screenshot"===t.details.type&&t.details||null}(e),o=function(e){const t=e.audits["screenshot-thumbnails"];if(!t)return;return t.details&&"filmstrip"===t.details.type&&t.details.items||void 0}(e),i=function(e){const{width:t,height:n}=e.configSettings.screenEmulation;return{width:t,height:n}}(e);if(t&&void 0===n?n=i.height*t/i.width:n&&void 0===t&&(t=i.width*n/i.height),!t||!n)return console.warn(new Error("FlowStepThumbnail requested without any dimensions").stack),D(g,{});let a;if(o?.length){if(a=o[o.length-1].data,"timespan"===e.gatherMode)return D(De,{frames:o,width:t,height:n})}else a=r?.screenshot.data;return D(g,{children:a&&D("img",{className:"FlowStepThumbnail",src:a,style:{width:t,height:n},alt:"Screenshot of a page tested by Lighthouse"})})};var Re,Ue=function(){function e(t,n,r,o){this.message=t,this.expected=n,this.found=r,this.location=o,this.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,e)}return function(e,t){function n(){this.constructor=e}n.prototype=t.prototype,e.prototype=new n}(e,Error),e.buildMessage=function(e,t){var n={literal:function(e){return'"'+o(e.text)+'"'},class:function(e){var t,n="";for(t=0;t<e.parts.length;t++)n+=e.parts[t]instanceof Array?i(e.parts[t][0])+"-"+i(e.parts[t][1]):i(e.parts[t]);return"["+(e.inverted?"^":"")+n+"]"},any:function(e){return"any character"},end:function(e){return"end of input"},other:function(e){return e.description}};function r(e){return e.charCodeAt(0).toString(16).toUpperCase()}function o(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return"\\x0"+r(e)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(e){return"\\x"+r(e)}))}function i(e){return e.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return"\\x0"+r(e)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(e){return"\\x"+r(e)}))}return"Expected "+function(e){var t,r,o,i=new Array(e.length);for(t=0;t<e.length;t++)i[t]=(o=e[t],n[o.type](o));if(i.sort(),i.length>0){for(t=1,r=1;t<i.length;t++)i[t-1]!==i[t]&&(i[r]=i[t],r++);i.length=r}switch(i.length){case 1:return i[0];case 2:return i[0]+" or "+i[1];default:return i.slice(0,-1).join(", ")+", or "+i[i.length-1]}}(e)+" but "+function(e){return e?'"'+o(e)+'"':"end of input"}(t)+" found."},{SyntaxError:e,parse:function(t,n){n=void 0!==n?n:{};var r,o={},i={start:ce},a=ce,l=function(e){return e.join("")},s=re("{",!1),c=",",d=re(",",!1),h=re("}",!1),p="number",u=re("number",!1),g="date",m=re("date",!1),f="time",_=re("time",!1),v="plural",b=re("plural",!1),w="selectordinal",y=re("selectordinal",!1),x="select",k=re("select",!1),A=re("=",!1),C="offset:",E=re("offset:",!1),S=ie("whitespace"),z=/^[ \t\n\r]/,M=oe([" ","\t","\n","\r"],!1,!1),L=ie("optionalWhitespace"),N=/^[0-9]/,F=oe([["0","9"]],!1,!1),H=/^[0-9a-f]/i,T=oe([["0","9"],["a","f"]],!1,!0),D=re("0",!1),P=/^[1-9]/,R=oe([["1","9"]],!1,!1),U="'",I=re("'",!1),O=/^[ \t\n\r,.+={}#]/,B=oe([" ","\t","\n","\r",",",".","+","=","{","}","#"],!1,!1),V={type:"any"},$=/^[^{}\\\0-\x1F\x7F \t\n\r]/,j=oe(["{","}","\\",["\0",""],""," ","\t","\n","\r"],!0,!1),G=re("\\\\",!1),W=re("\\#",!1),q=re("\\{",!1),K=re("\\}",!1),Z=re("\\u",!1),J=0,Q=0,Y=[{line:1,column:1}],X=0,ee=[],te=0;if("startRule"in n){if(!(n.startRule in i))throw new Error("Can't start parsing from rule \""+n.startRule+'".');a=i[n.startRule]}function ne(){return le(Q,J)}function re(e,t){return{type:"literal",text:e,ignoreCase:t}}function oe(e,t,n){return{type:"class",parts:e,inverted:t,ignoreCase:n}}function ie(e){return{type:"other",description:e}}function ae(e){var n,r=Y[e];if(r)return r;for(n=e-1;!Y[n];)n--;for(r={line:(r=Y[n]).line,column:r.column};n<e;)10===t.charCodeAt(n)?(r.line++,r.column=1):r.column++,n++;return Y[e]=r,r}function le(e,t){var n=ae(e),r=ae(t);return{start:{offset:e,line:n.line,column:n.column},end:{offset:t,line:r.line,column:r.column}}}function se(e){J<X||(J>X&&(X=J,ee=[]),ee.push(e))}function ce(){return de()}function de(){var e,t,n;for(e=J,t=[],n=he();n!==o;)t.push(n),n=he();return t!==o&&(Q=e,t={type:"messageFormatPattern",elements:t,location:ne()}),e=t}function he(){var e;return(e=function(){var e,n;e=J,(n=function(){var e,n,r,i,a,l;e=J,n=[],r=J,(i=me())!==o&&(a=xe())!==o&&(l=me())!==o?r=i=[i,a,l]:(J=r,r=o);if(r!==o)for(;r!==o;)n.push(r),r=J,(i=me())!==o&&(a=xe())!==o&&(l=me())!==o?r=i=[i,a,l]:(J=r,r=o);else n=o;n!==o&&(Q=e,n=n.reduce((function(e,t){return e.concat(t)}),[]).join(""));(e=n)===o&&(e=J,e=(n=ge())!==o?t.substring(e,J):n);return e}())!==o&&(Q=e,n={type:"messageTextElement",value:n,location:ne()});return e=n}())===o&&(e=function(){var e,n,r,i,a,A,C;e=J,123===t.charCodeAt(J)?(n="{",J++):(n=o,0===te&&se(s));n!==o&&me()!==o&&(r=function(){var e,t,n;if((e=ve())===o){for(e=J,t=[],n=be();n!==o;)t.push(n),n=be();t!==o&&(Q=e,t=l(t)),e=t}return e}())!==o&&me()!==o?(i=J,44===t.charCodeAt(J)?(a=c,J++):(a=o,0===te&&se(d)),a!==o&&(A=me())!==o&&(C=function(){var e;(e=function(){var e,n,r,i,a,l;e=J,t.substr(J,6)===p?(n=p,J+=6):(n=o,0===te&&se(u));n===o&&(t.substr(J,4)===g?(n=g,J+=4):(n=o,0===te&&se(m)),n===o&&(t.substr(J,4)===f?(n=f,J+=4):(n=o,0===te&&se(_))));n!==o&&me()!==o?(r=J,44===t.charCodeAt(J)?(i=c,J++):(i=o,0===te&&se(d)),i!==o&&(a=me())!==o&&(l=xe())!==o?r=i=[i,a,l]:(J=r,r=o),r===o&&(r=null),r!==o?(Q=e,e=n={type:n+"Format",style:(s=r)&&s[2],location:ne()}):(J=e,e=o)):(J=e,e=o);var s;return e}())===o&&(e=function(){var e,n,r,i;e=J,t.substr(J,6)===v?(n=v,J+=6):(n=o,0===te&&se(b));n!==o&&me()!==o?(44===t.charCodeAt(J)?(r=c,J++):(r=o,0===te&&se(d)),r!==o&&me()!==o&&(i=ue())!==o?(Q=e,e=n={type:(a=i).type,ordinal:!1,offset:a.offset||0,options:a.options,location:ne()}):(J=e,e=o)):(J=e,e=o);var a;return e}())===o&&(e=function(){var e,n,r,i;e=J,t.substr(J,13)===w?(n=w,J+=13):(n=o,0===te&&se(y));n!==o&&me()!==o?(44===t.charCodeAt(J)?(r=c,J++):(r=o,0===te&&se(d)),r!==o&&me()!==o&&(i=ue())!==o?(Q=e,e=n={type:(a=i).type,ordinal:!0,offset:a.offset||0,options:a.options,location:ne()}):(J=e,e=o)):(J=e,e=o);var a;return e}())===o&&(e=function(){var e,n,r,i,a;e=J,t.substr(J,6)===x?(n=x,J+=6):(n=o,0===te&&se(k));if(n!==o)if(me()!==o)if(44===t.charCodeAt(J)?(r=c,J++):(r=o,0===te&&se(d)),r!==o)if(me()!==o){if(i=[],(a=pe())!==o)for(;a!==o;)i.push(a),a=pe();else i=o;i!==o?(Q=e,e=n=function(e){return{type:"selectFormat",options:e,location:ne()}}(i)):(J=e,e=o)}else J=e,e=o;else J=e,e=o;else J=e,e=o;else J=e,e=o;return e}());return e}())!==o?i=a=[a,A,C]:(J=i,i=o),i===o&&(i=null),i!==o&&(a=me())!==o?(125===t.charCodeAt(J)?(A="}",J++):(A=o,0===te&&se(h)),A!==o?(Q=e,e=n={type:"argumentElement",id:r,format:(E=i)&&E[2],location:ne()}):(J=e,e=o)):(J=e,e=o)):(J=e,e=o);var E;return e}()),e}function pe(){var e,n,r,i,a;return e=J,me()!==o&&(n=function(){var e,n,r,i;return e=J,n=J,61===t.charCodeAt(J)?(r="=",J++):(r=o,0===te&&se(A)),r!==o&&(i=ve())!==o?n=r=[r,i]:(J=n,n=o),(e=n!==o?t.substring(e,J):n)===o&&(e=xe()),e}())!==o&&me()!==o?(123===t.charCodeAt(J)?(r="{",J++):(r=o,0===te&&se(s)),r!==o&&(i=de())!==o?(125===t.charCodeAt(J)?(a="}",J++):(a=o,0===te&&se(h)),a!==o?(Q=e,e={type:"optionalFormatPattern",selector:n,value:i,location:ne()}):(J=e,e=o)):(J=e,e=o)):(J=e,e=o),e}function ue(){var e,n,r,i;if(e=J,(n=function(){var e,n,r;return e=J,t.substr(J,7)===C?(n=C,J+=7):(n=o,0===te&&se(E)),n!==o&&me()!==o&&(r=ve())!==o?(Q=e,e=n=r):(J=e,e=o),e}())===o&&(n=null),n!==o)if(me()!==o){if(r=[],(i=pe())!==o)for(;i!==o;)r.push(i),i=pe();else r=o;r!==o?(Q=e,e=n=function(e,t){return{type:"pluralFormat",offset:e,options:t,location:ne()}}(n,r)):(J=e,e=o)}else J=e,e=o;else J=e,e=o;return e}function ge(){var e,n;if(te++,e=[],z.test(t.charAt(J))?(n=t.charAt(J),J++):(n=o,0===te&&se(M)),n!==o)for(;n!==o;)e.push(n),z.test(t.charAt(J))?(n=t.charAt(J),J++):(n=o,0===te&&se(M));else e=o;return te--,e===o&&(n=o,0===te&&se(S)),e}function me(){var e,n,r;for(te++,e=J,n=[],r=ge();r!==o;)n.push(r),r=ge();return e=n!==o?t.substring(e,J):n,te--,e===o&&(n=o,0===te&&se(L)),e}function fe(){var e;return N.test(t.charAt(J))?(e=t.charAt(J),J++):(e=o,0===te&&se(F)),e}function _e(){var e;return H.test(t.charAt(J))?(e=t.charAt(J),J++):(e=o,0===te&&se(T)),e}function ve(){var e,n,r,i,a,l;if(e=J,48===t.charCodeAt(J)?(n="0",J++):(n=o,0===te&&se(D)),n===o){if(n=J,r=J,P.test(t.charAt(J))?(i=t.charAt(J),J++):(i=o,0===te&&se(R)),i!==o){for(a=[],l=fe();l!==o;)a.push(l),l=fe();a!==o?r=i=[i,a]:(J=r,r=o)}else J=r,r=o;n=r!==o?t.substring(n,J):r}return n!==o&&(Q=e,n=parseInt(n,10)),e=n}function be(){var e,n,r;return e=J,n=J,te++,39===t.charCodeAt(J)?(r=U,J++):(r=o,0===te&&se(I)),r===o&&(O.test(t.charAt(J))?(r=t.charAt(J),J++):(r=o,0===te&&se(B))),te--,r===o?n=void 0:(J=n,n=o),n!==o?(t.length>J?(r=t.charAt(J),J++):(r=o,0===te&&se(V)),r!==o?(Q=e,e=n=r):(J=e,e=o)):(J=e,e=o),e===o&&(e=J,39===t.charCodeAt(J)?(n=U,J++):(n=o,0===te&&se(I)),n!==o&&(r=function(){var e;O.test(t.charAt(J))?(e=t.charAt(J),J++):(e=o,0===te&&se(B));e===o&&(e=we());return e}())!==o?(Q=e,e=n=r):(J=e,e=o)),e}function we(){var e;return 39===t.charCodeAt(J)?(e=U,J++):(e=o,0===te&&se(I)),e}function ye(){var e,n,r,i,a,l,s,c,d;return e=J,39===t.charCodeAt(J)?(n=U,J++):(n=o,0===te&&se(I)),n!==o&&(r=we())!==o?(Q=e,e=n=r):(J=e,e=o),e===o&&($.test(t.charAt(J))?(e=t.charAt(J),J++):(e=o,0===te&&se(j)),e===o&&(e=J,"\\\\"===t.substr(J,2)?(n="\\\\",J+=2):(n=o,0===te&&se(G)),n!==o&&(Q=e,n="\\"),(e=n)===o&&(e=J,"\\#"===t.substr(J,2)?(n="\\#",J+=2):(n=o,0===te&&se(W)),n!==o&&(Q=e,n="\\#"),(e=n)===o&&(e=J,"\\{"===t.substr(J,2)?(n="\\{",J+=2):(n=o,0===te&&se(q)),n!==o&&(Q=e,n="{"),(e=n)===o&&(e=J,"\\}"===t.substr(J,2)?(n="\\}",J+=2):(n=o,0===te&&se(K)),n!==o&&(Q=e,n="}"),(e=n)===o&&(e=J,"\\u"===t.substr(J,2)?(n="\\u",J+=2):(n=o,0===te&&se(Z)),n!==o?(r=J,i=J,(a=_e())!==o&&(l=_e())!==o&&(s=_e())!==o&&(c=_e())!==o?i=a=[a,l,s,c]:(J=i,i=o),(r=i!==o?t.substring(r,J):i)!==o?(Q=e,d=r,e=n=String.fromCharCode(parseInt(d,16))):(J=e,e=o)):(J=e,e=o))))))),e}function xe(){var e,t,n;if(e=J,t=[],(n=ye())!==o)for(;n!==o;)t.push(n),n=ye();else t=o;return t!==o&&(Q=e,t=l(t)),e=t}if((r=a())!==o&&J===t.length)return r;throw r!==o&&J<t.length&&se({type:"end"}),function(t,n,r){return new e(e.buildMessage(t,n),t,n,r)}(ee,X<t.length?t.charAt(X):null,X<t.length?le(X,X+1):le(X,X))}}}(),Ie=(Re=function(e,t){return(Re=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}Re(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),Oe=function(){function e(e,t,n){this.locales=[],this.formats={number:{},date:{},time:{}},this.pluralNumberFormat=null,this.currentPlural=null,this.pluralStack=[],this.locales=e,this.formats=t,this.formatters=n}return e.prototype.compile=function(e){return this.pluralStack=[],this.currentPlural=null,this.pluralNumberFormat=null,this.compileMessage(e)},e.prototype.compileMessage=function(e){var t=this;if(!e||"messageFormatPattern"!==e.type)throw new Error('Message AST is not of type: "messageFormatPattern"');var n=e.elements,r=n.filter((function(e){return"messageTextElement"===e.type||"argumentElement"===e.type})).map((function(e){return"messageTextElement"===e.type?t.compileMessageText(e):t.compileArgument(e)}));if(r.length!==n.length)throw new Error("Message element does not have a valid type");return r},e.prototype.compileMessageText=function(e){return this.currentPlural&&/(^|[^\\])#/g.test(e.value)?(this.pluralNumberFormat||(this.pluralNumberFormat=new Intl.NumberFormat(this.locales)),new je(this.currentPlural.id,this.currentPlural.format.offset,this.pluralNumberFormat,e.value)):e.value.replace(/\\#/g,"#")},e.prototype.compileArgument=function(e){var t=e.format,n=e.id,r=this.formatters;if(!t)return new Ve(n);var o=this.formats,i=this.locales;switch(t.type){case"numberFormat":return{id:n,format:r.getNumberFormat(i,o.number[t.style]).format};case"dateFormat":return{id:n,format:r.getDateTimeFormat(i,o.date[t.style]).format};case"timeFormat":return{id:n,format:r.getDateTimeFormat(i,o.time[t.style]).format};case"pluralFormat":return new $e(n,t.offset,this.compileOptions(e),r.getPluralRules(i,{type:t.ordinal?"ordinal":"cardinal"}));case"selectFormat":return new Ge(n,this.compileOptions(e));default:throw new Error("Message element does not have a valid format type")}},e.prototype.compileOptions=function(e){var t=this,n=e.format,r=n.options;this.pluralStack.push(this.currentPlural),this.currentPlural="pluralFormat"===n.type?e:null;var o=r.reduce((function(e,n){return e[n.selector]=t.compileMessage(n.value),e}),{});return this.currentPlural=this.pluralStack.pop(),o},e}(),Be=function(e){this.id=e},Ve=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ie(t,e),t.prototype.format=function(e){return e||"number"==typeof e?"string"==typeof e?e:String(e):""},t}(Be),$e=function(){function e(e,t,n,r){this.id=e,this.offset=t,this.options=n,this.pluralRules=r}return e.prototype.getOption=function(e){var t=this.options;return t["="+e]||t[this.pluralRules.select(e-this.offset)]||t.other},e}(),je=function(e){function t(t,n,r,o){var i=e.call(this,t)||this;return i.offset=n,i.numberFormat=r,i.string=o,i}return Ie(t,e),t.prototype.format=function(e){var t=this.numberFormat.format(e-this.offset);return this.string.replace(/(^|[^\\])#/g,"$1"+t).replace(/\\#/g,"#")},t}(Be),Ge=function(){function e(e,t){this.id=e,this.options=t}return e.prototype.getOption=function(e){var t=this.options;return t[e]||t.other},e}();function We(e){return!!e.options}var qe=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ke=function(){return(Ke=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function Ze(e){"string"==typeof e&&(e=[e]);try{return Intl.NumberFormat.supportedLocalesOf(e,{localeMatcher:"best fit"})[0]}catch(e){return Xe.defaultLocale}}function Je(e,t){for(var n="",r=0,o=e;r<o.length;r++){var i=o[r];if("string"!=typeof i){var a=i.id;if(!t||!(a in t))throw new Ye("A value must be provided for: "+a,a);var l=t[a];We(i)?n+=Je(i.getOption(l),t):n+=i.format(l)}else n+=i}return n}function Qe(e,t){return t?Object.keys(e).reduce((function(n,r){var o,i;return n[r]=(o=e[r],(i=t[r])?Ke({},o||{},i||{},Object.keys(o).reduce((function(e,t){return e[t]=Ke({},o[t],i[t]||{}),e}),{})):o),n}),Ke({},e)):e}var Ye=function(e){function t(t,n){var r=e.call(this,t)||this;return r.variableId=n,r}return qe(t,e),t}(Error);var Xe=function(){function e(t,n,r,o){var i=this;if(void 0===n&&(n=e.defaultLocale),this.format=function(e){try{return Je(i.pattern,e)}catch(e){throw e.variableId?new Error("The intl string context variable '"+e.variableId+"' was not provided to the string '"+i.message+"'"):e}},"string"==typeof t){if(!e.__parse)throw new TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`");this.ast=e.__parse(t)}else this.ast=t;if(this.message=t,!this.ast||"messageFormatPattern"!==this.ast.type)throw new TypeError("A message must be provided as a String or AST.");var a=Qe(e.formats,r);this.locale=Ze(n||[]);var l=o&&o.formatters||{getNumberFormat:function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return new((e=Intl.NumberFormat).bind.apply(e,[void 0].concat(t)))},getDateTimeFormat:function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return new((e=Intl.DateTimeFormat).bind.apply(e,[void 0].concat(t)))},getPluralRules:function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return new((e=Intl.PluralRules).bind.apply(e,[void 0].concat(t)))}};this.pattern=new Oe(n,a,l).compile(this.ast)}return e.prototype.resolvedOptions=function(){return{locale:this.locale}},e.prototype.getAst=function(){return this.ast},e.defaultLocale="en",e.__parse=void 0,e.formats={number:{currency:{style:"currency"},percent:{style:"percent"}},date:{short:{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},long:{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"}},time:{short:{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},long:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}},e}();Xe.__parse=Ue.parse,
|
|
18
18
|
/**
|
|
19
19
|
* @license Copyright 2021 The Lighthouse Authors. All Rights Reserved.
|
|
20
20
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
@@ -90,7 +90,7 @@ class yt{constructor(e,t){this._document=e,this._lighthouseChannel="unknown",thi
|
|
|
90
90
|
* @license Copyright 2020 The Lighthouse Authors. All Rights Reserved.
|
|
91
91
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
92
92
|
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
93
|
-
*/function Ct(e,t,n){return e<t?t:e>n?n:e}class Et{static getScreenshotPositions(e,t,n){const r={x:(o=e).left+o.width/2,y:o.top+o.height/2};var o;const i=Ct(r.x-t.width/2,0,n.width-t.width),a=Ct(r.y-t.height/2,0,n.height-t.height);return{screenshot:{left:i,top:a},clip:{left:e.left-i,top:e.top-a}}}static renderClipPathInScreenshot(e,t,n,r,o){const i=e.find("clipPath",t),a=`clip-${pe.getUniqueSuffix()}`;i.id=a,t.style.clipPath=`url(#${a})`;const l=n.top/o.height,s=l+r.height/o.height,c=n.left/o.width,d=c+r.width/o.width,h=[`0,0 1,0 1,${l} 0,${l}`,`0,${s} 1,${s} 1,1 0,1`,`0,${l} ${c},${l} ${c},${s} 0,${s}`,`${d},${l} 1,${l} 1,${s} ${d},${s}`];for(const t of h){const n=e.createElementNS("http://www.w3.org/2000/svg","polygon");n.setAttribute("points",t),i.append(n)}}static installFullPageScreenshot(e,t){e.style.setProperty("--element-screenshot-url",`url('${t.data}')`)}static installOverlayFeature(e){const{dom:t,rootEl:n,overlayContainerEl:r,fullPageScreenshot:o}=e,i="lh-screenshot-overlay--enabled";n.classList.contains(i)||(n.classList.add(i),n.addEventListener("click",(e=>{const n=e.target;if(!n)return;const i=n.closest(".lh-node > .lh-element-screenshot");if(!i)return;const a=t.createElement("div","lh-element-screenshot__overlay");r.append(a);const l={width:.95*a.clientWidth,height:.8*a.clientHeight},s={width:Number(i.dataset.rectWidth),height:Number(i.dataset.rectHeight),left:Number(i.dataset.rectLeft),right:Number(i.dataset.rectLeft)+Number(i.dataset.rectWidth),top:Number(i.dataset.rectTop),bottom:Number(i.dataset.rectTop)+Number(i.dataset.rectHeight)},c=Et.render(t,o.screenshot,s,l);c?(a.append(c),a.addEventListener("click",(()=>a.remove()))):a.remove()})))}static _computeZoomFactor(e,t){const n={x:t.width/e.width,y:t.height/e.height},r=.75*Math.min(n.x,n.y);return Math.min(1,r)}static render(e,t,n,r){if(!function(e,t){return t.left<=e.width&&0<=t.right&&t.top<=e.height&&0<=t.bottom}(t,n))return null;const o=e.createComponent("elementScreenshot"),i=e.find("div.lh-element-screenshot",o);i.dataset.rectWidth=n.width.toString(),i.dataset.rectHeight=n.height.toString(),i.dataset.rectLeft=n.left.toString(),i.dataset.rectTop=n.top.toString();const a=this._computeZoomFactor(n,r),l={width:r.width/a,height:r.height/a};l.width=
|
|
93
|
+
*/function Ct(e,t,n){return e<t?t:e>n?n:e}class Et{static getScreenshotPositions(e,t,n){const r={x:(o=e).left+o.width/2,y:o.top+o.height/2};var o;const i=Ct(r.x-t.width/2,0,n.width-t.width),a=Ct(r.y-t.height/2,0,n.height-t.height);return{screenshot:{left:i,top:a},clip:{left:e.left-i,top:e.top-a}}}static renderClipPathInScreenshot(e,t,n,r,o){const i=e.find("clipPath",t),a=`clip-${pe.getUniqueSuffix()}`;i.id=a,t.style.clipPath=`url(#${a})`;const l=n.top/o.height,s=l+r.height/o.height,c=n.left/o.width,d=c+r.width/o.width,h=[`0,0 1,0 1,${l} 0,${l}`,`0,${s} 1,${s} 1,1 0,1`,`0,${l} ${c},${l} ${c},${s} 0,${s}`,`${d},${l} 1,${l} 1,${s} ${d},${s}`];for(const t of h){const n=e.createElementNS("http://www.w3.org/2000/svg","polygon");n.setAttribute("points",t),i.append(n)}}static installFullPageScreenshot(e,t){e.style.setProperty("--element-screenshot-url",`url('${t.data}')`)}static installOverlayFeature(e){const{dom:t,rootEl:n,overlayContainerEl:r,fullPageScreenshot:o}=e,i="lh-screenshot-overlay--enabled";n.classList.contains(i)||(n.classList.add(i),n.addEventListener("click",(e=>{const n=e.target;if(!n)return;const i=n.closest(".lh-node > .lh-element-screenshot");if(!i)return;const a=t.createElement("div","lh-element-screenshot__overlay");r.append(a);const l={width:.95*a.clientWidth,height:.8*a.clientHeight},s={width:Number(i.dataset.rectWidth),height:Number(i.dataset.rectHeight),left:Number(i.dataset.rectLeft),right:Number(i.dataset.rectLeft)+Number(i.dataset.rectWidth),top:Number(i.dataset.rectTop),bottom:Number(i.dataset.rectTop)+Number(i.dataset.rectHeight)},c=Et.render(t,o.screenshot,s,l);c?(a.append(c),a.addEventListener("click",(()=>a.remove()))):a.remove()})))}static _computeZoomFactor(e,t){const n={x:t.width/e.width,y:t.height/e.height},r=.75*Math.min(n.x,n.y);return Math.min(1,r)}static render(e,t,n,r){if(!function(e,t){return t.left<=e.width&&0<=t.right&&t.top<=e.height&&0<=t.bottom}(t,n))return null;const o=e.createComponent("elementScreenshot"),i=e.find("div.lh-element-screenshot",o);i.dataset.rectWidth=n.width.toString(),i.dataset.rectHeight=n.height.toString(),i.dataset.rectLeft=n.left.toString(),i.dataset.rectTop=n.top.toString();const a=this._computeZoomFactor(n,r),l={width:r.width/a,height:r.height/a};t.width<l.width&&(l.width=t.width,l.height=t.height);const s=l.width*a,c=l.height*a,d=Et.getScreenshotPositions(n,l,{width:t.width,height:t.height}),h=e.find("div.lh-element-screenshot__image",i);h.style.width=s+"px",h.style.height=c+"px",h.style.backgroundPositionY=-d.screenshot.top*a+"px",h.style.backgroundPositionX=-d.screenshot.left*a+"px",h.style.backgroundSize=`${t.width*a}px ${t.height*a}px`;const p=e.find("div.lh-element-screenshot__element-marker",i);p.style.width=n.width*a+"px",p.style.height=n.height*a+"px",p.style.left=d.clip.left*a+"px",p.style.top=d.clip.top*a+"px";const u=e.find("div.lh-element-screenshot__mask",i);return u.style.width=s+"px",u.style.height=c+"px",Et.renderClipPathInScreenshot(e,u,d.clip,n,l),i}}
|
|
94
94
|
/**
|
|
95
95
|
* @license
|
|
96
96
|
* Copyright 2017 The Lighthouse Authors. All Rights Reserved.
|
|
@@ -157,7 +157,7 @@ class yt{constructor(e,t){this._document=e,this._lighthouseChannel="unknown",thi
|
|
|
157
157
|
*
|
|
158
158
|
* Dummy text for ensuring report robustness: <\/script> pre$`post %%LIGHTHOUSE_JSON%%
|
|
159
159
|
* (this is handled by terser)
|
|
160
|
-
*/class Nt{constructor(e){this._dom=e,this._opts={}}renderReport(e,t,n){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);n&&(this._opts=n),this._dom.setLighthouseChannel(e.configSettings.channel||"unknown");const r=pe.prepareReportResult(e);return this._dom.rootEl.textContent="",this._dom.rootEl.append(this._renderReport(r)),this._dom.rootEl}_renderReportTopbar(e){const t=this._dom.createComponent("topbar"),n=this._dom.find("a.lh-topbar__url",t);return n.textContent=e.
|
|
160
|
+
*/class Nt{constructor(e){this._dom=e,this._opts={}}renderReport(e,t,n){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);n&&(this._opts=n),this._dom.setLighthouseChannel(e.configSettings.channel||"unknown");const r=pe.prepareReportResult(e);return this._dom.rootEl.textContent="",this._dom.rootEl.append(this._renderReport(r)),this._dom.rootEl}_renderReportTopbar(e){const t=this._dom.createComponent("topbar"),n=this._dom.find("a.lh-topbar__url",t);return n.textContent=e.finalDisplayedUrl,n.title=e.finalDisplayedUrl,this._dom.safelySetHref(n,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=pe.i18n.strings.footerIssue,this._dom.find(".lh-footer__version",t).textContent=e.lighthouseVersion,t}_renderMetaBlock(e,t){const n=pe.getEmulationDescriptions(e.configSettings||{}),r=e.userAgent.match(/(\w*Chrome\/[\d.]+)/),o=Array.isArray(r)?r[1].replace("/"," ").replace("Chrome","Chromium"):"Chromium",i=e.configSettings.channel,a=e.environment.benchmarkIndex.toFixed(0),l=e.environment.credits?.["axe-core"],s=[["date",`Captured at ${pe.i18n.formatDateTime(e.fetchTime)}`],["devices",`${n.deviceEmulation} with Lighthouse ${e.lighthouseVersion}`,`${pe.i18n.strings.runtimeSettingsBenchmark}: ${a}\n${pe.i18n.strings.runtimeSettingsCPUThrottling}: ${n.cpuThrottling}`+(l?`\n${pe.i18n.strings.runtimeSettingsAxeVersion}: ${l}`:"")],["samples-one",pe.i18n.strings.runtimeSingleLoad,pe.i18n.strings.runtimeSingleLoadTooltip],["stopwatch",pe.i18n.strings.runtimeAnalysisWindow],["networkspeed",`${n.summary}`,`${pe.i18n.strings.runtimeSettingsNetworkThrottling}: ${n.networkThrottling}`],["chrome",`Using ${o}`+(i?` with ${i}`:""),`${pe.i18n.strings.runtimeSettingsUANetwork}: "${e.environment.networkUserAgent}"`]],c=this._dom.find(".lh-meta__items",t);for(const[e,t,n]of s){const r=this._dom.createChildOf(c,"li","lh-meta__item");if(r.textContent=t,n){r.classList.add("lh-tooltip-boundary");this._dom.createChildOf(r,"div","lh-tooltip").textContent=n}r.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=pe.i18n.strings.toplevelWarningsMessage;const n=[];for(const t of e.runWarnings){const e=this._dom.createElement("li");e.append(this._dom.convertMarkdownLinkSnippets(t)),n.push(e)}return this._dom.find("ul",t).append(...n),t}_renderScoreGauges(e,t,n){const r=[],o=[],i=[];for(const a of Object.values(e.categories)){const l=n[a.id]||t,s=l.renderCategoryScore(a,e.categoryGroups||{},{gatherMode:e.gatherMode}),c=this._dom.find("a.lh-gauge__wrapper, a.lh-fraction__wrapper",s);c&&(this._dom.safelySetHref(c,`#${a.id}`),c.addEventListener("click",(e=>{if(!c.matches('[href^="#"]'))return;const t=c.getAttribute("href"),n=this._dom.rootEl;if(!t||!n)return;const r=this._dom.find(t,n);e.preventDefault(),r.scrollIntoView()})),this._opts.onPageAnchorRendered?.(c)),pe.isPluginCategory(a.id)?i.push(s):l.renderCategoryScore===t.renderCategoryScore?r.push(s):o.push(s)}return[...r,...o,...i]}_renderReport(e){const t=new it(e.configSettings.locale,{...pe.UIStrings,...e.i18n.rendererFormattedStrings});pe.i18n=t,pe.reportJson=e;const n=e.audits["full-page-screenshot"]?.details&&"full-page-screenshot"===e.audits["full-page-screenshot"].details.type?e.audits["full-page-screenshot"].details:void 0,r=new zt(this._dom,{fullPageScreenshot:n}),o=new xt(this._dom,r),i={performance:new Mt(this._dom,r),pwa:new Lt(this._dom,r)},a=this._dom.createElement("div");a.append(this._renderReportHeader());const l=this._dom.createElement("div","lh-container"),s=this._dom.createElement("div","lh-report");let c;s.append(this._renderReportWarnings(e));1===Object.keys(e.categories).length?a.classList.add("lh-header--solo-category"):c=this._dom.createElement("div","lh-scores-header");const d=this._dom.createElement("div");if(d.classList.add("lh-scorescale-wrap"),d.append(this._dom.createComponent("scorescale")),c){const t=this._dom.find(".lh-scores-container",a);c.append(...this._renderScoreGauges(e,o,i)),t.append(c,d);const n=this._dom.createElement("div","lh-sticky-header");n.append(...this._renderScoreGauges(e,o,i)),l.append(n)}const h=this._dom.createElement("div","lh-categories");s.append(h);const p={gatherMode:e.gatherMode};for(const t of Object.values(e.categories)){const n=i[t.id]||o;n.dom.createChildOf(h,"div","lh-category-wrapper").append(n.render(t,e.categoryGroups,p))}o.injectFinalScreenshot(h,e.audits,d);const u=this._dom.createFragment();return this._opts.omitGlobalStyles||u.append(this._dom.createComponent("styles")),this._opts.omitTopbar||u.append(this._renderReportTopbar(e)),u.append(l),s.append(this._renderReportFooter(e)),l.append(a,s),n&&Et.installFullPageScreenshot(this._dom.rootEl,n.screenshot),u}}
|
|
161
161
|
/**
|
|
162
162
|
* @license Copyright 2021 The Lighthouse Authors. All Rights Reserved.
|
|
163
163
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
@@ -183,7 +183,7 @@ class yt{constructor(e,t){this._document=e,this._lighthouseChannel="unknown",thi
|
|
|
183
183
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
184
184
|
* See the License for the specific language governing permissions and
|
|
185
185
|
* limitations under the License.
|
|
186
|
-
*/function Pt(){const e=window.location.host.endsWith(".vercel.app"),t=new URLSearchParams(window.location.search).has("dev");return e?`https://${window.location.host}/gh-pages`:t?"http://localhost:7333":"https://googlechrome.github.io/lighthouse"}function Rt(e){const t=e.generatedTime,n=e.fetchTime||t;return`${e.lighthouseVersion}-${e.
|
|
186
|
+
*/function Pt(){const e=window.location.host.endsWith(".vercel.app"),t=new URLSearchParams(window.location.search).has("dev");return e?`https://${window.location.host}/gh-pages`:t?"http://localhost:7333":"https://googlechrome.github.io/lighthouse"}function Rt(e){const t=e.generatedTime,n=e.fetchTime||t;return`${e.lighthouseVersion}-${e.finalDisplayedUrl}-${n}`}async function Ut(e,t,n){const r=new URL(t),o=Boolean(window.CompressionStream);r.hash=await Dt.toBase64(JSON.stringify(e),{gzip:o}),o&&r.searchParams.set("gzip","1"),window.open(r.toString(),n)}async function It(e){const t="viewer-"+Rt(e);!function(e,t,n){const r=new URL(t).origin;window.addEventListener("message",(function t(n){n.origin===r&&o&&n.data.opened&&(o.postMessage(e,r),window.removeEventListener("message",t))}));const o=window.open(t,n)}({lhr:e},Pt()+"/viewer/",t)}
|
|
187
187
|
/**
|
|
188
188
|
* @license Copyright 2021 The Lighthouse Authors. All Rights Reserved.
|
|
189
189
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
@@ -199,7 +199,7 @@ class Ot{constructor(e){this._dom=e,this._toggleEl,this._menuEl,this.onDocumentK
|
|
|
199
199
|
* @license Copyright 2017 The Lighthouse Authors. All Rights Reserved.
|
|
200
200
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
201
201
|
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
202
|
-
*/function Vt(e,t){const n=t?new Date(t):new Date,r=n.toLocaleTimeString("en-US",{hour12:!1}),o=n.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}).split("/");o.unshift(o.pop());return`${e}_${o.join("-")}_${r}`.replace(/[/?<>\\:*|"]/g,"-")}class $t{constructor(e,t={}){this.json,this._dom=e,this._opts=t,this._topbar=t.omitTopbar?null:new Bt(this,e),this.onMediaQueryChange=this.onMediaQueryChange.bind(this)}initFeatures(e){this.json=e,this._topbar&&(this._topbar.enable(e),this._topbar.resetUIState()),this._setupMediaQueryListeners(),this._setupThirdPartyFilter(),this._setupElementScreenshotOverlay(this._dom.rootEl);const t=this._dom.isDevTools()||this._opts.disableDarkMode||this._opts.disableAutoDarkModeAndFireworks;!t&&window.matchMedia("(prefers-color-scheme: dark)").matches&&Ft(this._dom,!0);const n=["performance","accessibility","best-practices","seo"].every((t=>{const n=e.categories[t];return n&&1===n.score})),r=this._opts.disableFireworks||this._opts.disableAutoDarkModeAndFireworks;n&&!r&&(this._enableFireworks(),t||Ft(this._dom,!0));if(e.categories.performance&&e.categories.performance.auditRefs.some((t=>Boolean("metrics"===t.group&&e.audits[t.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:pe.i18n.strings.viewTreemapLabel,icon:"treemap",onClick:()=>function(e){if(!e.audits["script-treemap-data"].details)throw new Error("no script treemap data found");Ut({lhr:{finalUrl:e.finalUrl,audits:{"script-treemap-data":e.audits["script-treemap-data"]},configSettings:{locale:e.configSettings.locale}}},Pt()+"/treemap/","treemap-"+Rt(e))}(this.json)}),this._opts.onViewTrace&&this.addButton({text:"simulate"===e.configSettings.throttlingMethod?pe.i18n.strings.viewOriginalTraceLabel:pe.i18n.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 e of this._dom.findAll("[data-i18n]",this._dom.rootEl)){const t=e.getAttribute("data-i18n");e.textContent=pe.i18n.strings[t]}}addButton(e){const t=this._dom.rootEl.querySelector(".lh-audit-group--metrics");if(!t)return;let n=t.querySelector(".lh-buttons");n||(n=this._dom.createChildOf(t,"div","lh-buttons"));const r=["lh-button"];e.icon&&(r.push("lh-report-icon"),r.push(`lh-report-icon--${e.icon}`));const o=this._dom.createChildOf(n,"button",r.join(" "));return o.textContent=e.text,o.addEventListener("click",e.onClick),o}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 e=self.matchMedia("(max-width: 500px)");e.addListener(this.onMediaQueryChange),this.onMediaQueryChange(e)}_resetUIState(){this._topbar&&this._topbar.resetUIState()}onMediaQueryChange(e){this._dom.rootEl.classList.toggle("lh-narrow",e.matches)}_setupThirdPartyFilter(){const e=["uses-rel-preconnect","third-party-facades"],t=["legacy-javascript"];Array.from(this._dom.rootEl.querySelectorAll("table.lh-table")).filter((e=>e.querySelector("td.lh-table-column--url, td.lh-table-column--source-location"))).filter((t=>{const n=t.closest(".lh-audit");if(!n)throw new Error(".lh-table not within audit");return!e.includes(n.id)})).forEach((e=>{const n=
|
|
202
|
+
*/function Vt(e,t){const n=t?new Date(t):new Date,r=n.toLocaleTimeString("en-US",{hour12:!1}),o=n.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}).split("/");o.unshift(o.pop());return`${e}_${o.join("-")}_${r}`.replace(/[/?<>\\:*|"]/g,"-")}class $t{constructor(e,t={}){this.json,this._dom=e,this._opts=t,this._topbar=t.omitTopbar?null:new Bt(this,e),this.onMediaQueryChange=this.onMediaQueryChange.bind(this)}initFeatures(e){this.json=e,this._topbar&&(this._topbar.enable(e),this._topbar.resetUIState()),this._setupMediaQueryListeners(),this._setupThirdPartyFilter(),this._setupElementScreenshotOverlay(this._dom.rootEl);const t=this._dom.isDevTools()||this._opts.disableDarkMode||this._opts.disableAutoDarkModeAndFireworks;!t&&window.matchMedia("(prefers-color-scheme: dark)").matches&&Ft(this._dom,!0);const n=["performance","accessibility","best-practices","seo"].every((t=>{const n=e.categories[t];return n&&1===n.score})),r=this._opts.disableFireworks||this._opts.disableAutoDarkModeAndFireworks;n&&!r&&(this._enableFireworks(),t||Ft(this._dom,!0));if(e.categories.performance&&e.categories.performance.auditRefs.some((t=>Boolean("metrics"===t.group&&e.audits[t.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:pe.i18n.strings.viewTreemapLabel,icon:"treemap",onClick:()=>function(e){if(!e.audits["script-treemap-data"].details)throw new Error("no script treemap data found");Ut({lhr:{mainDocumentUrl:e.mainDocumentUrl,finalUrl:e.finalUrl,finalDisplayedUrl:e.finalDisplayedUrl,audits:{"script-treemap-data":e.audits["script-treemap-data"]},configSettings:{locale:e.configSettings.locale}}},Pt()+"/treemap/","treemap-"+Rt(e))}(this.json)}),this._opts.onViewTrace&&this.addButton({text:"simulate"===e.configSettings.throttlingMethod?pe.i18n.strings.viewOriginalTraceLabel:pe.i18n.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 e of this._dom.findAll("[data-i18n]",this._dom.rootEl)){const t=e.getAttribute("data-i18n");e.textContent=pe.i18n.strings[t]}}addButton(e){const t=this._dom.rootEl.querySelector(".lh-audit-group--metrics");if(!t)return;let n=t.querySelector(".lh-buttons");n||(n=this._dom.createChildOf(t,"div","lh-buttons"));const r=["lh-button"];e.icon&&(r.push("lh-report-icon"),r.push(`lh-report-icon--${e.icon}`));const o=this._dom.createChildOf(n,"button",r.join(" "));return o.textContent=e.text,o.addEventListener("click",e.onClick),o}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 e=self.matchMedia("(max-width: 500px)");e.addListener(this.onMediaQueryChange),this.onMediaQueryChange(e)}_resetUIState(){this._topbar&&this._topbar.resetUIState()}onMediaQueryChange(e){this._dom.rootEl.classList.toggle("lh-narrow",e.matches)}_setupThirdPartyFilter(){const e=["uses-rel-preconnect","third-party-facades"],t=["legacy-javascript"];Array.from(this._dom.rootEl.querySelectorAll("table.lh-table")).filter((e=>e.querySelector("td.lh-table-column--url, td.lh-table-column--source-location"))).filter((t=>{const n=t.closest(".lh-audit");if(!n)throw new Error(".lh-table not within audit");return!e.includes(n.id)})).forEach((e=>{const n=
|
|
203
203
|
/**
|
|
204
204
|
* @license
|
|
205
205
|
* Copyright 2017 The Lighthouse Authors. All Rights Reserved.
|
|
@@ -216,12 +216,12 @@ class Ot{constructor(e){this._dom=e,this._toggleEl,this._menuEl,this.onDocumentK
|
|
|
216
216
|
* See the License for the specific language governing permissions and
|
|
217
217
|
* limitations under the License.
|
|
218
218
|
*/
|
|
219
|
-
function(e){return Array.from(e.tBodies[0].rows)}(e),r=this._getThirdPartyRows(n,this.json
|
|
219
|
+
function(e){return Array.from(e.tBodies[0].rows)}(e),r=this._getThirdPartyRows(n,pe.getFinalDisplayedUrl(this.json)),o=this._dom.createComponent("3pFilter"),i=this._dom.find("input",o);i.addEventListener("change",(e=>{const t=e.target instanceof HTMLInputElement&&!e.target.checked;let o=!0,i=n[0];for(;i;){const e=t&&r.includes(i);do{i.classList.toggle("lh-row--hidden",e),i.classList.toggle("lh-row--even",!e&&o),i.classList.toggle("lh-row--odd",!e&&!o),i=i.nextElementSibling}while(i&&i.classList.contains("lh-sub-item-row"));e||(o=!o)}})),this._dom.find(".lh-3p-filter-count",o).textContent=`${r.length}`,this._dom.find(".lh-3p-ui-string",o).textContent=pe.i18n.strings.thirdPartyResourcesLabel;const a=r.length===n.length,l=!r.length;if((a||l)&&(this._dom.find("div.lh-3p-filter",o).hidden=!0),!e.parentNode)return;e.parentNode.insertBefore(o,e);const s=e.closest(".lh-audit");if(!s)throw new Error(".lh-table not within audit");t.includes(s.id)&&!a&&i.click()}))}_setupElementScreenshotOverlay(e){const t=this.json.audits["full-page-screenshot"]&&this.json.audits["full-page-screenshot"].details&&"full-page-screenshot"===this.json.audits["full-page-screenshot"].details.type&&this.json.audits["full-page-screenshot"].details;t&&Et.installOverlayFeature({dom:this._dom,rootEl:e,overlayContainerEl:e,fullPageScreenshot:t})}_getThirdPartyRows(e,t){const n=[],r=pe.getRootDomain(t);for(const t of e){if(t.classList.contains("lh-sub-item-row"))continue;const e=t.querySelector("div.lh-text__url");if(!e)continue;const o=e.dataset.url;if(!o)continue;pe.getRootDomain(o)!==r&&n.push(t)}return n}_saveFile(e){const t=e.type.match("json")?".json":".html",n=(r={finalDisplayedUrl:pe.getFinalDisplayedUrl(this.json),fetchTime:this.json.fetchTime},Vt(new URL(r.finalDisplayedUrl).hostname,r.fetchTime)+t);var r;this._opts.onSaveFileOverride?this._opts.onSaveFileOverride(e,n):this._dom.saveFile(e,n)}}
|
|
220
220
|
/**
|
|
221
221
|
* @license Copyright 2021 The Lighthouse Authors. All Rights Reserved.
|
|
222
222
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
223
223
|
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
224
|
-
*/function jt(){return new yt(document,document.documentElement).createComponent("styles")}const Gt=({category:e,href:t,gatherMode:n})=>D("div",{ref:Ne((()=>function(e,t){const n=new yt(document,document.documentElement),r=new zt(n);return new xt(n,r).renderCategoryScore(e,{},t)}(e,{gatherMode:n,omitLabel:!0,onPageAnchorRendered:e=>e.href=t})),[e,t]),"data-testid":"CategoryScore"}),Wt=({text:e})=>D("span",{ref:Ne((()=>{return t=e,new yt(document,document.documentElement).convertMarkdownCodeSnippets(t);var t}),[e])});function qt(e,t){switch(e){case"navigation":return t.navigationReport;case"timespan":return t.timespanReport;case"snapshot":return t.snapshotReport}}function Kt(e,t){switch(e){case"pass":return t.ratingPass;case"average":return t.ratingAverage;case"fail":return t.ratingFail;case"error":return t.ratingError}}function Zt(e){return e.weight*(1-e.result.score)}function Jt(e){return e.result.details&&"opportunity"===e.result.details.type&&e.result.details.overallSavingsMs||0}const Qt=({audit:e})=>D("div",{className:`SummaryTooltipAudit SummaryTooltipAudit--${pe.calculateRating(e.result.score,e.result.scoreDisplayMode)}`,children:D(Wt,{text:e.result.title})}),Yt=({category:e})=>{const t=ht();const n=e.auditRefs.filter((function(t){return null!==t.result.score&&"metrics"!==t.group&&("hidden"!==t.group||"performance"!==e.id)&&(t.weight>0||Jt(t)>0)&&!pe.showAsPassed(t.result)})).sort(((e,t)=>{const n=Zt(e),r=Zt(t);return n!==r?r-n:Jt(t)-Jt(e)})).splice(0,2);return n.length?D("div",{className:"SummaryTooltipAudits",children:[D("div",{className:"SummaryTooltipAudits__title",children:t.highestImpact}),n.map((e=>D(Qt,{audit:e},e.id)))]}):null},Xt=({category:e,gatherMode:t,url:n})=>{const r=ht(),o=pt(),{numPassed:i,numPassableAudits:a,numInformative:l,totalWeight:s}=pe.calculateCategoryFraction(e),c=dt(),d=pe.shouldDisplayAsFraction(t),h=d?i/a:e.score,p=null===h?"error":pe.calculateRating(h);return D("div",{className:"SummaryTooltip",children:[D("div",{className:"SummaryTooltip__title",children:qt(t,r)}),D("div",{className:"SummaryTooltip__url",children:n}),D(Fe,{}),D("div",{className:"SummaryTooltip__category",children:[D("div",{className:"SummaryTooltip__category-title",children:e.title}),0!==s&&D("div",{className:`SummaryTooltip__rating SummaryTooltip__rating--${p}`,children:[D("span",{children:Kt(p,r)}),!d&&null!==e.score&&D(g,{children:[D("span",{children:" · "}),D("span",{children:c.formatInteger(100*e.score)})]})]})]}),D("div",{className:"SummaryTooltip__fraction",children:[D("span",{children:o(r.passedAuditCount,{numPassed:i})}),D("span",{children:" / "}),D("span",{children:o(r.passableAuditCount,{numPassableAudits:a})})]}),0!==l&&D("div",{className:"SummaryTooltip__informative",children:o(r.informativeAuditCount,{numInformative:l})}),D(Yt,{category:e})]})},en=({category:e,href:t,gatherMode:n,finalUrl:r})=>D("div",{className:"SummaryCategory",children:D("div",e?{className:"SummaryCategory__content",children:[D(Gt,{category:e,href:t,gatherMode:n}),D(Xt,{category:e,gatherMode:n,url:r})]}:{className:"SummaryCategory__null","data-testid":"SummaryCategory__null"})}),tn=["performance","accessibility","best-practices","seo"],nn=({lhr:e})=>{const t=ht();return D("div",{className:"SummaryNavigationHeader","data-testid":"SummaryNavigationHeader",children:[D(Te,{}),D("div",{className:"SummaryNavigationHeader__url",children:D("a",{rel:"noopener",target:"_blank",href:e.finalUrl,children:e.finalUrl})}),D("div",{className:"SummaryNavigationHeader__category",children:t.categoryPerformance}),D("div",{className:"SummaryNavigationHeader__category",children:t.categoryAccessibility}),D("div",{className:"SummaryNavigationHeader__category",children:t.categoryBestPractices}),D("div",{className:"SummaryNavigationHeader__category",children:t.categorySeo})]})},rn=({lhr:e,label:t,hashIndex:n})=>{const r=Q((()=>pe.prepareReportResult(e)),[e]),o=ht(),i=ze(e.gatherMode,o);return D("div",{className:"SummaryFlowStep",children:["navigation"===e.gatherMode||0===n?D(nn,{lhr:e}):D("div",{className:"SummaryFlowStep__separator",children:[D(Te,{}),D(Fe,{})]}),D(Pe,{lhr:e,width:40}),D(Te,{mode:e.gatherMode}),D("div",{className:"SummaryFlowStep__label",children:[D("div",{className:"SummaryFlowStep__mode",children:i}),D("a",{className:"SummaryFlowStep__link",href:`#index=${n}`,children:t})]}),tn.map((t=>D(en,{category:r.categories[t],href:`#index=${n}&anchor=${t}`,gatherMode:e.gatherMode,finalUrl:e.finalUrl},t)))]})},on=()=>D("div",{className:"SummaryFlow",children:Me().steps.map(((e,t)=>D(rn,{lhr:e.lhr,label:e.name,hashIndex:t},e.lhr.fetchTime)))}),an=()=>{const e=Me(),t=ht(),n=pt();let r=0,o=0,i=0;for(const t of e.steps)switch(t.lhr.gatherMode){case"navigation":r++;break;case"timespan":o++;break;case"snapshot":i++}const a=[];r&&a.push(n(t.navigationReportCount,{numNavigation:r})),o&&a.push(n(t.timespanReportCount,{numTimespan:o})),i&&a.push(n(t.snapshotReportCount,{numSnapshot:i}));const l=a.join(" · ");return D("div",{className:"SummaryHeader",children:[D("div",{className:"SummaryHeader__title",children:t.summary}),D("div",{className:"SummaryHeader__subtitle",children:l})]})},ln=({children:e})=>D("div",{className:"SummarySectionHeader",children:[D("div",{className:"SummarySectionHeader__content",children:e}),D(Fe,{})]}),sn=()=>{const e=ht();return D("div",{className:"Summary","data-testid":"Summary",children:[D(an,{}),D(Fe,{}),D(ln,{children:e.allReports}),D(on,{})]})};const cn=({hashState:e})=>D("div",{ref:Ne((()=>function(e,t={}){const n=document.createElement("article");n.classList.add("lh-root","lh-vars");const r=new yt(n.ownerDocument,n);return new Nt(r).renderReport(e,n,t),new $t(r,t).initFeatures(e),n}(e.currentLhr,{disableFireworks:!0,disableDarkMode:!0,omitTopbar:!0,omitGlobalStyles:!0,onPageAnchorRendered:t=>function(e,t){const n=e.cloneNode(!0);if(!n.hash)return n;const r=e.hash.substr(1);n.hash=`#index=${t}&anchor=${r}`,n.onclick=e=>{e.preventDefault();const t=document.getElementById(r);t&&t.scrollIntoView()},e.replaceWith(n)}(t,e.index)})),[e]),"data-testid":"Report"}),dn=e=>{const t=ht();return D("div",{className:"HelpDialogColumn",children:[D("div",{className:"HelpDialogColumn__legend",children:[D("div",{className:"HelpDialogColumnTimeline",children:[e.icon,D("div",{className:"HelpDialogColumnTimeline__line"})]}),D("div",{className:"HelpDialogColumn__legend-label",children:e.userFriendlyModeLabel})]}),D("div",{className:"HelpDialogColumn__header",children:[D("div",{className:"HelpDialogColumn__header-title",children:e.lighthouseOfficialModeLabel}),D("p",{children:e.modeDescription})]}),D("div",{className:"HelpDialogColumn__use-cases",children:[D("p",{children:e.useCaseInstruction}),D("ul",{children:e.useCases.map(((e,t)=>D("li",{children:e},t)))})]}),D("div",{className:"HelpDialogColumn__categories",children:[D("p",{children:t.categories}),D("ul",{children:e.availableCategories.map(((e,t)=>D("li",{children:e},t)))})]})]})},hn=({onClose:e})=>{const t=ht();return D("div",{className:"HelpDialog",children:[D("div",{className:"HelpDialog__title",children:[D("div",{children:t.helpDialogTitle}),D("div",{style:{flexGrow:1}}),D("button",{className:"HelpDialog__close",onClick:e,children:D(ve,{})})]}),D("div",{className:"HelpDialog__columns",children:[D(dn,{icon:D(me,{}),userFriendlyModeLabel:t.navigationDescription,lighthouseOfficialModeLabel:t.navigationReport,modeDescription:t.navigationLongDescription,useCaseInstruction:t.helpUseCaseInstructionNavigation,useCases:[t.helpUseCaseNavigation1,t.helpUseCaseNavigation2,t.helpUseCaseNavigation3],availableCategories:[t.categoryPerformance,t.categoryAccessibility,t.categoryBestPractices,t.categorySeo,t.categoryProgressiveWebApp]}),D(dn,{icon:D(fe,{}),userFriendlyModeLabel:t.timespanDescription,lighthouseOfficialModeLabel:t.timespanReport,modeDescription:t.timespanLongDescription,useCaseInstruction:t.helpUseCaseInstructionTimespan,useCases:[t.helpUseCaseTimespan1,t.helpUseCaseTimespan2],availableCategories:[t.categoryPerformance,t.categoryBestPractices]}),D(dn,{icon:D(_e,{}),userFriendlyModeLabel:t.snapshotDescription,lighthouseOfficialModeLabel:t.snapshotReport,modeDescription:t.snapshotLongDescription,useCaseInstruction:t.helpUseCaseInstructionSnapshot,useCases:[t.helpUseCaseSnapshot1,t.helpUseCaseSnapshot2],availableCategories:[t.categoryPerformance,t.categoryAccessibility,t.categoryBestPractices,t.categorySeo]})]})]})};function pn(e,t){const n=new Blob([t],{type:"text/html"}),r=function(e){const t=e.steps[0].lhr;return Vt(e.name.replace(/\s/g,"-"),t.fetchTime)}(e)+".html";pn.saveFile(n,r)}pn.saveFile=function(e,t){new yt(document,document.documentElement).saveFile(e,t)};const un=()=>D("svg",{height:"24",width:"24",viewBox:"0 0 24 24",role:"img",children:[D("defs",{children:[D("linearGradient",{x1:"57.456%",y1:"13.086%",x2:"18.259%",y2:"72.322%",id:"Topbar__logo--a",children:[D("stop",{"stop-color":"#262626","stop-opacity":".1",offset:"0%"}),D("stop",{"stop-color":"#262626","stop-opacity":"0",offset:"100%"})]}),D("linearGradient",{x1:"100%",y1:"50%",x2:"0%",y2:"50%",id:"Topbar__logo--b",children:[D("stop",{"stop-color":"#262626","stop-opacity":".1",offset:"0%"}),D("stop",{"stop-color":"#262626","stop-opacity":"0",offset:"100%"})]}),D("linearGradient",{x1:"58.764%",y1:"65.756%",x2:"36.939%",y2:"50.14%",id:"Topbar__logo--c",children:[D("stop",{"stop-color":"#262626","stop-opacity":".1",offset:"0%"}),D("stop",{"stop-color":"#262626","stop-opacity":"0",offset:"100%"})]}),D("linearGradient",{x1:"41.635%",y1:"20.358%",x2:"72.863%",y2:"85.424%",id:"Topbar__logo--d",children:[D("stop",{"stop-color":"#FFF","stop-opacity":".1",offset:"0%"}),D("stop",{"stop-color":"#FFF","stop-opacity":"0",offset:"100%"})]})]}),D("g",{fill:"none","fill-rule":"evenodd",children:[D("path",{d:"M12 3l4.125 2.625v3.75H18v2.25h-1.688l1.5 9.375H6.188l1.5-9.375H6v-2.25h1.875V5.648L12 3zm2.201 9.938L9.54 14.633 9 18.028l5.625-2.062-.424-3.028zM12.005 5.67l-1.88 1.207v2.498h3.75V6.86l-1.87-1.19z",fill:"#F44B21"}),D("path",{fill:"#FFF",d:"M14.201 12.938L9.54 14.633 9 18.028l5.625-2.062z"}),D("path",{d:"M6 18c-2.042 0-3.95-.01-5.813 0l1.5-9.375h4.326L6 18z",fill:"url(#Topbar__logo--a)","fill-rule":"nonzero",transform:"translate(6 3)"}),D("path",{fill:"#FFF176","fill-rule":"nonzero",d:"M13.875 9.375v-2.56l-1.87-1.19-1.88 1.207v2.543z"}),D("path",{fill:"url(#Topbar__logo--b)","fill-rule":"nonzero",d:"M0 6.375h6v2.25H0z",transform:"translate(6 3)"}),D("path",{fill:"url(#Topbar__logo--c)","fill-rule":"nonzero",d:"M6 6.375H1.875v-3.75L6 0z",transform:"translate(6 3)"}),D("path",{fill:"url(#Topbar__logo--d)","fill-rule":"nonzero",d:"M6 0l4.125 2.625v3.75H12v2.25h-1.688l1.5 9.375H.188l1.5-9.375H0v-2.25h1.875V2.648z",transform:"translate(6 3)"})]})]}),gn=({onClick:e,label:t,children:n})=>D("button",{className:"TopbarButton",onClick:e,"aria-label":t,children:n}),mn=({onMenuClick:e})=>{const t=Me(),n=ht(),[r,o]=q(!1),{getReportHtml:i,saveAsGist:a}=Y(Ce);return D("div",{className:"Topbar",children:[D(gn,{onClick:e,label:"Button that opens and closes the sidebar",children:D(xe,{})}),D("div",{className:"Topbar__logo",children:D(un,{})}),D("div",{className:"Topbar__title",children:n.title}),i&&D(gn,{onClick:()=>{const e=i(t);pn(t,e)},label:"Button that saves the report as HTML",children:n.save}),a&&D(gn,{onClick:()=>a(t),label:"Button that saves the report to a gist",children:n.dropdownSaveGist}),D("div",{style:{flexGrow:1}}),D(gn,{onClick:()=>o((e=>!e)),label:"Button that toggles the help dialog",children:D("div",{className:"Topbar__help-label",children:[D(ke,{}),n.helpLabel]})}),r?D(hn,{onClose:()=>o(!1)}):null]})},fn=({lhr:e,position:t})=>D("div",{className:`HeaderThumbnail HeaderThumbnail--${t}`,children:[D(Pe,{lhr:e,height:"main"===t?120:80}),D("div",{className:"HeaderThumbnail__icon",children:D(He,{mode:e.gatherMode})})]}),_n=({hashState:e})=>{const t=Me(),{index:n}=e,r=t.steps[n],o=t.steps[n-1],i=t.steps[n+1],a=ht(),l=ze(r.lhr.gatherMode,a);return D("div",{className:"Header",children:[o&&D(g,{children:[t.steps[n-2]&&D("div",{className:"Header__segment"}),D("div",{className:"Header__prev-thumbnail",children:[D(fn,{lhr:o.lhr,position:"prev"}),D("div",{className:"Header__segment"})]}),D("a",{className:"Header__prev-title",href:"#index="+(n-1),children:o.name})]}),D("div",{className:"Header__current-thumbnail",children:D(fn,{lhr:r.lhr,position:"main"})}),D("div",{className:"Header__current-title",children:[r.name,D("div",{className:"Header__current-description",children:l})]}),i&&D(g,{children:[D("div",{className:"Header__next-thumbnail",children:[D("div",{className:"Header__segment"}),D(fn,{lhr:i.lhr,position:"next"})]}),D("a",{className:"Header__next-title",href:`#index=${n+1}`,children:i.name}),t.steps[n+2]&&D("div",{className:"Header__segment"})]})]})},vn=()=>D("div",{ref:Ne(jt)});const bn=()=>{const e=Le(),t=J(null);return Z((()=>{const n=function(e){return e&&e.anchor?document.getElementById(e.anchor):null}(e);n?n.scrollIntoView():t.current&&(t.current.scrollTop=0)}),[e]),D("div",{ref:t,className:"Content",children:e?D(g,{children:[D(_n,{hashState:e}),D(cn,{hashState:e})]}):D(sn,{})})},wn=({flowResult:e,options:t})=>{const[n,r]=q(!1),o=Q((()=>t||{}),[t]);return D(Ce.Provider,{value:o,children:D(Ae.Provider,{value:e,children:D(ut,{children:[D(vn,{}),D("div",{className:Se("App",{"App--collapsed":n}),"data-testid":"App",children:[D(mn,{onMenuClick:()=>r((e=>!e))}),D(wt,{}),D(bn,{})]})]})})})};
|
|
224
|
+
*/function jt(){return new yt(document,document.documentElement).createComponent("styles")}const Gt=({category:e,href:t,gatherMode:n})=>D("div",{ref:Ne((()=>function(e,t){const n=new yt(document,document.documentElement),r=new zt(n);return new xt(n,r).renderCategoryScore(e,{},t)}(e,{gatherMode:n,omitLabel:!0,onPageAnchorRendered:e=>e.href=t})),[e,t]),"data-testid":"CategoryScore"}),Wt=({text:e})=>D("span",{ref:Ne((()=>{return t=e,new yt(document,document.documentElement).convertMarkdownCodeSnippets(t);var t}),[e])});function qt(e,t){switch(e){case"navigation":return t.navigationReport;case"timespan":return t.timespanReport;case"snapshot":return t.snapshotReport}}function Kt(e,t){switch(e){case"pass":return t.ratingPass;case"average":return t.ratingAverage;case"fail":return t.ratingFail;case"error":return t.ratingError}}function Zt(e){return e.weight*(1-e.result.score)}function Jt(e){return e.result.details&&"opportunity"===e.result.details.type&&e.result.details.overallSavingsMs||0}const Qt=({audit:e})=>D("div",{className:`SummaryTooltipAudit SummaryTooltipAudit--${pe.calculateRating(e.result.score,e.result.scoreDisplayMode)}`,children:D(Wt,{text:e.result.title})}),Yt=({category:e})=>{const t=ht();const n=e.auditRefs.filter((function(t){return null!==t.result.score&&"metrics"!==t.group&&("hidden"!==t.group||"performance"!==e.id)&&(t.weight>0||Jt(t)>0)&&!pe.showAsPassed(t.result)})).sort(((e,t)=>{const n=Zt(e),r=Zt(t);return n!==r?r-n:Jt(t)-Jt(e)})).splice(0,2);return n.length?D("div",{className:"SummaryTooltipAudits",children:[D("div",{className:"SummaryTooltipAudits__title",children:t.highestImpact}),n.map((e=>D(Qt,{audit:e},e.id)))]}):null},Xt=({category:e,gatherMode:t,url:n})=>{const r=ht(),o=pt(),{numPassed:i,numPassableAudits:a,numInformative:l,totalWeight:s}=pe.calculateCategoryFraction(e),c=dt(),d=pe.shouldDisplayAsFraction(t),h=d?i/a:e.score,p=null===h?"error":pe.calculateRating(h);return D("div",{className:"SummaryTooltip",children:[D("div",{className:"SummaryTooltip__title",children:qt(t,r)}),D("div",{className:"SummaryTooltip__url",children:n}),D(Fe,{}),D("div",{className:"SummaryTooltip__category",children:[D("div",{className:"SummaryTooltip__category-title",children:e.title}),0!==s&&D("div",{className:`SummaryTooltip__rating SummaryTooltip__rating--${p}`,children:[D("span",{children:Kt(p,r)}),!d&&null!==e.score&&D(g,{children:[D("span",{children:" · "}),D("span",{children:c.formatInteger(100*e.score)})]})]})]}),D("div",{className:"SummaryTooltip__fraction",children:[D("span",{children:o(r.passedAuditCount,{numPassed:i})}),D("span",{children:" / "}),D("span",{children:o(r.passableAuditCount,{numPassableAudits:a})})]}),0!==l&&D("div",{className:"SummaryTooltip__informative",children:o(r.informativeAuditCount,{numInformative:l})}),D(Yt,{category:e})]})},en=({category:e,href:t,gatherMode:n,finalDisplayedUrl:r})=>D("div",{className:"SummaryCategory",children:D("div",e?{className:"SummaryCategory__content",children:[D(Gt,{category:e,href:t,gatherMode:n}),D(Xt,{category:e,gatherMode:n,url:r})]}:{className:"SummaryCategory__null","data-testid":"SummaryCategory__null"})}),tn=["performance","accessibility","best-practices","seo"],nn=({lhr:e})=>{const t=ht();return D("div",{className:"SummaryNavigationHeader","data-testid":"SummaryNavigationHeader",children:[D(Te,{}),D("div",{className:"SummaryNavigationHeader__url",children:D("a",{rel:"noopener",target:"_blank",href:e.finalDisplayedUrl,children:e.finalDisplayedUrl})}),D("div",{className:"SummaryNavigationHeader__category",children:t.categoryPerformance}),D("div",{className:"SummaryNavigationHeader__category",children:t.categoryAccessibility}),D("div",{className:"SummaryNavigationHeader__category",children:t.categoryBestPractices}),D("div",{className:"SummaryNavigationHeader__category",children:t.categorySeo})]})},rn=({lhr:e,label:t,hashIndex:n})=>{const r=Q((()=>pe.prepareReportResult(e)),[e]),o=ht(),i=ze(e.gatherMode,o);return D("div",{className:"SummaryFlowStep",children:["navigation"===e.gatherMode||0===n?D(nn,{lhr:e}):D("div",{className:"SummaryFlowStep__separator",children:[D(Te,{}),D(Fe,{})]}),D(Pe,{lhr:e,width:40}),D(Te,{mode:e.gatherMode}),D("div",{className:"SummaryFlowStep__label",children:[D("div",{className:"SummaryFlowStep__mode",children:i}),D("a",{className:"SummaryFlowStep__link",href:`#index=${n}`,children:t})]}),tn.map((t=>D(en,{category:r.categories[t],href:`#index=${n}&anchor=${t}`,gatherMode:e.gatherMode,finalDisplayedUrl:e.finalDisplayedUrl},t)))]})},on=()=>D("div",{className:"SummaryFlow",children:Me().steps.map(((e,t)=>D(rn,{lhr:e.lhr,label:e.name,hashIndex:t},e.lhr.fetchTime)))}),an=()=>{const e=Me(),t=ht(),n=pt();let r=0,o=0,i=0;for(const t of e.steps)switch(t.lhr.gatherMode){case"navigation":r++;break;case"timespan":o++;break;case"snapshot":i++}const a=[];r&&a.push(n(t.navigationReportCount,{numNavigation:r})),o&&a.push(n(t.timespanReportCount,{numTimespan:o})),i&&a.push(n(t.snapshotReportCount,{numSnapshot:i}));const l=a.join(" · ");return D("div",{className:"SummaryHeader",children:[D("div",{className:"SummaryHeader__title",children:t.summary}),D("div",{className:"SummaryHeader__subtitle",children:l})]})},ln=({children:e})=>D("div",{className:"SummarySectionHeader",children:[D("div",{className:"SummarySectionHeader__content",children:e}),D(Fe,{})]}),sn=()=>{const e=ht();return D("div",{className:"Summary","data-testid":"Summary",children:[D(an,{}),D(Fe,{}),D(ln,{children:e.allReports}),D(on,{})]})};const cn=({hashState:e})=>D("div",{ref:Ne((()=>function(e,t={}){const n=document.createElement("article");n.classList.add("lh-root","lh-vars");const r=new yt(n.ownerDocument,n);return new Nt(r).renderReport(e,n,t),new $t(r,t).initFeatures(e),n}(e.currentLhr,{disableFireworks:!0,disableDarkMode:!0,omitTopbar:!0,omitGlobalStyles:!0,onPageAnchorRendered:t=>function(e,t){const n=e.cloneNode(!0);if(!n.hash)return n;const r=e.hash.substr(1);n.hash=`#index=${t}&anchor=${r}`,n.onclick=e=>{e.preventDefault();const t=document.getElementById(r);t&&t.scrollIntoView()},e.replaceWith(n)}(t,e.index)})),[e]),"data-testid":"Report"}),dn=e=>{const t=ht();return D("div",{className:"HelpDialogColumn",children:[D("div",{className:"HelpDialogColumn__legend",children:[D("div",{className:"HelpDialogColumnTimeline",children:[e.icon,D("div",{className:"HelpDialogColumnTimeline__line"})]}),D("div",{className:"HelpDialogColumn__legend-label",children:e.userFriendlyModeLabel})]}),D("div",{className:"HelpDialogColumn__header",children:[D("div",{className:"HelpDialogColumn__header-title",children:e.lighthouseOfficialModeLabel}),D("p",{children:e.modeDescription})]}),D("div",{className:"HelpDialogColumn__use-cases",children:[D("p",{children:e.useCaseInstruction}),D("ul",{children:e.useCases.map(((e,t)=>D("li",{children:e},t)))})]}),D("div",{className:"HelpDialogColumn__categories",children:[D("p",{children:t.categories}),D("ul",{children:e.availableCategories.map(((e,t)=>D("li",{children:e},t)))})]})]})},hn=({onClose:e})=>{const t=ht();return D("div",{className:"HelpDialog",children:[D("div",{className:"HelpDialog__title",children:[D("div",{children:t.helpDialogTitle}),D("div",{style:{flexGrow:1}}),D("button",{className:"HelpDialog__close",onClick:e,children:D(ve,{})})]}),D("div",{className:"HelpDialog__columns",children:[D(dn,{icon:D(me,{}),userFriendlyModeLabel:t.navigationDescription,lighthouseOfficialModeLabel:t.navigationReport,modeDescription:t.navigationLongDescription,useCaseInstruction:t.helpUseCaseInstructionNavigation,useCases:[t.helpUseCaseNavigation1,t.helpUseCaseNavigation2,t.helpUseCaseNavigation3],availableCategories:[t.categoryPerformance,t.categoryAccessibility,t.categoryBestPractices,t.categorySeo,t.categoryProgressiveWebApp]}),D(dn,{icon:D(fe,{}),userFriendlyModeLabel:t.timespanDescription,lighthouseOfficialModeLabel:t.timespanReport,modeDescription:t.timespanLongDescription,useCaseInstruction:t.helpUseCaseInstructionTimespan,useCases:[t.helpUseCaseTimespan1,t.helpUseCaseTimespan2],availableCategories:[t.categoryPerformance,t.categoryBestPractices]}),D(dn,{icon:D(_e,{}),userFriendlyModeLabel:t.snapshotDescription,lighthouseOfficialModeLabel:t.snapshotReport,modeDescription:t.snapshotLongDescription,useCaseInstruction:t.helpUseCaseInstructionSnapshot,useCases:[t.helpUseCaseSnapshot1,t.helpUseCaseSnapshot2],availableCategories:[t.categoryPerformance,t.categoryAccessibility,t.categoryBestPractices,t.categorySeo]})]})]})};function pn(e,t){const n=new Blob([t],{type:"text/html"}),r=function(e){const t=e.steps[0].lhr;return Vt(e.name.replace(/\s/g,"-"),t.fetchTime)}(e)+".html";pn.saveFile(n,r)}pn.saveFile=function(e,t){new yt(document,document.documentElement).saveFile(e,t)};const un=()=>D("svg",{height:"24",width:"24",viewBox:"0 0 24 24",role:"img",children:[D("defs",{children:[D("linearGradient",{x1:"57.456%",y1:"13.086%",x2:"18.259%",y2:"72.322%",id:"Topbar__logo--a",children:[D("stop",{"stop-color":"#262626","stop-opacity":".1",offset:"0%"}),D("stop",{"stop-color":"#262626","stop-opacity":"0",offset:"100%"})]}),D("linearGradient",{x1:"100%",y1:"50%",x2:"0%",y2:"50%",id:"Topbar__logo--b",children:[D("stop",{"stop-color":"#262626","stop-opacity":".1",offset:"0%"}),D("stop",{"stop-color":"#262626","stop-opacity":"0",offset:"100%"})]}),D("linearGradient",{x1:"58.764%",y1:"65.756%",x2:"36.939%",y2:"50.14%",id:"Topbar__logo--c",children:[D("stop",{"stop-color":"#262626","stop-opacity":".1",offset:"0%"}),D("stop",{"stop-color":"#262626","stop-opacity":"0",offset:"100%"})]}),D("linearGradient",{x1:"41.635%",y1:"20.358%",x2:"72.863%",y2:"85.424%",id:"Topbar__logo--d",children:[D("stop",{"stop-color":"#FFF","stop-opacity":".1",offset:"0%"}),D("stop",{"stop-color":"#FFF","stop-opacity":"0",offset:"100%"})]})]}),D("g",{fill:"none","fill-rule":"evenodd",children:[D("path",{d:"M12 3l4.125 2.625v3.75H18v2.25h-1.688l1.5 9.375H6.188l1.5-9.375H6v-2.25h1.875V5.648L12 3zm2.201 9.938L9.54 14.633 9 18.028l5.625-2.062-.424-3.028zM12.005 5.67l-1.88 1.207v2.498h3.75V6.86l-1.87-1.19z",fill:"#F44B21"}),D("path",{fill:"#FFF",d:"M14.201 12.938L9.54 14.633 9 18.028l5.625-2.062z"}),D("path",{d:"M6 18c-2.042 0-3.95-.01-5.813 0l1.5-9.375h4.326L6 18z",fill:"url(#Topbar__logo--a)","fill-rule":"nonzero",transform:"translate(6 3)"}),D("path",{fill:"#FFF176","fill-rule":"nonzero",d:"M13.875 9.375v-2.56l-1.87-1.19-1.88 1.207v2.543z"}),D("path",{fill:"url(#Topbar__logo--b)","fill-rule":"nonzero",d:"M0 6.375h6v2.25H0z",transform:"translate(6 3)"}),D("path",{fill:"url(#Topbar__logo--c)","fill-rule":"nonzero",d:"M6 6.375H1.875v-3.75L6 0z",transform:"translate(6 3)"}),D("path",{fill:"url(#Topbar__logo--d)","fill-rule":"nonzero",d:"M6 0l4.125 2.625v3.75H12v2.25h-1.688l1.5 9.375H.188l1.5-9.375H0v-2.25h1.875V2.648z",transform:"translate(6 3)"})]})]}),gn=({onClick:e,label:t,children:n})=>D("button",{className:"TopbarButton",onClick:e,"aria-label":t,children:n}),mn=({onMenuClick:e})=>{const t=Me(),n=ht(),[r,o]=q(!1),{getReportHtml:i,saveAsGist:a}=Y(Ce);return D("div",{className:"Topbar",children:[D(gn,{onClick:e,label:"Button that opens and closes the sidebar",children:D(xe,{})}),D("div",{className:"Topbar__logo",children:D(un,{})}),D("div",{className:"Topbar__title",children:n.title}),i&&D(gn,{onClick:()=>{const e=i(t);pn(t,e)},label:"Button that saves the report as HTML",children:n.save}),a&&D(gn,{onClick:()=>a(t),label:"Button that saves the report to a gist",children:n.dropdownSaveGist}),D("div",{style:{flexGrow:1}}),D(gn,{onClick:()=>o((e=>!e)),label:"Button that toggles the help dialog",children:D("div",{className:"Topbar__help-label",children:[D(ke,{}),n.helpLabel]})}),r?D(hn,{onClose:()=>o(!1)}):null]})},fn=({lhr:e,position:t})=>D("div",{className:`HeaderThumbnail HeaderThumbnail--${t}`,children:[D(Pe,{lhr:e,height:"main"===t?120:80}),D("div",{className:"HeaderThumbnail__icon",children:D(He,{mode:e.gatherMode})})]}),_n=({hashState:e})=>{const t=Me(),{index:n}=e,r=t.steps[n],o=t.steps[n-1],i=t.steps[n+1],a=ht(),l=ze(r.lhr.gatherMode,a);return D("div",{className:"Header",children:[o&&D(g,{children:[t.steps[n-2]&&D("div",{className:"Header__segment"}),D("div",{className:"Header__prev-thumbnail",children:[D(fn,{lhr:o.lhr,position:"prev"}),D("div",{className:"Header__segment"})]}),D("a",{className:"Header__prev-title",href:"#index="+(n-1),children:o.name})]}),D("div",{className:"Header__current-thumbnail",children:D(fn,{lhr:r.lhr,position:"main"})}),D("div",{className:"Header__current-title",children:[r.name,D("div",{className:"Header__current-description",children:l})]}),i&&D(g,{children:[D("div",{className:"Header__next-thumbnail",children:[D("div",{className:"Header__segment"}),D(fn,{lhr:i.lhr,position:"next"})]}),D("a",{className:"Header__next-title",href:`#index=${n+1}`,children:i.name}),t.steps[n+2]&&D("div",{className:"Header__segment"})]})]})},vn=()=>D("div",{ref:Ne(jt)});const bn=()=>{const e=Le(),t=J(null);return Z((()=>{const n=function(e){return e&&e.anchor?document.getElementById(e.anchor):null}(e);n?n.scrollIntoView():t.current&&(t.current.scrollTop=0)}),[e]),D("div",{ref:t,className:"Content",children:e?D(g,{children:[D(_n,{hashState:e}),D(cn,{hashState:e})]}):D(sn,{})})},wn=({flowResult:e,options:t})=>{const[n,r]=q(!1),o=Q((()=>t||{}),[t]);return D(Ce.Provider,{value:o,children:D(Ae.Provider,{value:e,children:D(ut,{children:[D(vn,{}),D("div",{className:Se("App",{"App--collapsed":n}),"data-testid":"App",children:[D(mn,{onMenuClick:()=>r((e=>!e))}),D(wt,{}),D(bn,{})]})]})})})};
|
|
225
225
|
/**
|
|
226
226
|
* @license Copyright 2021 The Lighthouse Authors. All Rights Reserved.
|
|
227
227
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|