lighthouse 9.5.0-dev.20230201 → 9.5.0-dev.20230203
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/core/audits/third-party-summary.js +2 -6
- package/core/config/constants.d.ts +3 -3
- package/core/config/constants.js +7 -8
- package/core/gather/driver/prepare.d.ts +6 -0
- package/core/gather/driver/prepare.js +26 -12
- package/core/gather/gatherers/bf-cache-failures.js +4 -1
- package/core/gather/navigation-runner.js +10 -0
- package/core/gather/timespan-runner.js +10 -1
- package/core/legacy/gather/driver.d.ts +4 -3
- package/core/legacy/gather/driver.js +6 -3
- package/core/legacy/gather/gather-runner.js +1 -1
- package/core/lib/emulation.js +5 -5
- package/dist/report/bundle.esm.js +2 -2
- package/dist/report/flow.js +1 -1
- package/dist/report/standalone.js +1 -1
- package/flow-report/test/sidebar/sidebar-test.tsx +3 -3
- package/package.json +1 -1
- package/report/renderer/report-utils.js +2 -2
- package/report/test/generator/report-generator-test.js +1 -1
- package/report/test/renderer/performance-category-renderer-test.js +1 -1
- package/report/test/renderer/report-renderer-test.js +2 -2
- package/report/test/renderer/report-utils-test.js +2 -2
- package/shared/localization/locales/en-US.json +1 -1
- package/shared/localization/locales/en-XL.json +1 -1
|
@@ -217,11 +217,7 @@ class ThirdPartySummary extends Audit {
|
|
|
217
217
|
|
|
218
218
|
return {
|
|
219
219
|
...stats,
|
|
220
|
-
entity:
|
|
221
|
-
type: /** @type {const} */ ('link'),
|
|
222
|
-
text: entity.name,
|
|
223
|
-
url: entity.homepage || '',
|
|
224
|
-
},
|
|
220
|
+
entity: entity.name,
|
|
225
221
|
subItems: {
|
|
226
222
|
type: /** @type {const} */ ('subitems'),
|
|
227
223
|
items: ThirdPartySummary.makeSubItems(entity, summaries, stats),
|
|
@@ -234,7 +230,7 @@ class ThirdPartySummary extends Audit {
|
|
|
234
230
|
/** @type {LH.Audit.Details.Table['headings']} */
|
|
235
231
|
const headings = [
|
|
236
232
|
/* eslint-disable max-len */
|
|
237
|
-
{key: 'entity', valueType: '
|
|
233
|
+
{key: 'entity', valueType: 'text', label: str_(UIStrings.columnThirdParty), subItemsHeading: {key: 'url', valueType: 'url'}},
|
|
238
234
|
{key: 'transferSize', granularity: 1, valueType: 'bytes', label: str_(i18n.UIStrings.columnTransferSize), subItemsHeading: {key: 'transferSize'}},
|
|
239
235
|
{key: 'blockingTime', granularity: 1, valueType: 'ms', label: str_(i18n.UIStrings.columnBlockingTime), subItemsHeading: {key: 'blockingTime'}},
|
|
240
236
|
/* eslint-enable max-len */
|
|
@@ -39,7 +39,7 @@ export namespace throttling {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
export namespace screenEmulationMetrics {
|
|
42
|
-
export {
|
|
42
|
+
export { MOTOGPOWER_EMULATION_METRICS as mobile };
|
|
43
43
|
export { DESKTOP_EMULATION_METRICS as desktop };
|
|
44
44
|
}
|
|
45
45
|
export namespace userAgents {
|
|
@@ -74,13 +74,13 @@ declare const DEVTOOLS_THROUGHPUT_ADJUSTMENT_FACTOR: 0.9;
|
|
|
74
74
|
/**
|
|
75
75
|
* @type {Required<LH.SharedFlagsSettings['screenEmulation']>}
|
|
76
76
|
*/
|
|
77
|
-
declare const
|
|
77
|
+
declare const MOTOGPOWER_EMULATION_METRICS: Required<LH.SharedFlagsSettings['screenEmulation']>;
|
|
78
78
|
/**
|
|
79
79
|
* Desktop metrics adapted from emulated_devices/module.json
|
|
80
80
|
* @type {Required<LH.SharedFlagsSettings['screenEmulation']>}
|
|
81
81
|
*/
|
|
82
82
|
declare const DESKTOP_EMULATION_METRICS: Required<LH.SharedFlagsSettings['screenEmulation']>;
|
|
83
|
-
declare const MOTOG4_USERAGENT: "Mozilla/5.0 (Linux; Android
|
|
83
|
+
declare const MOTOG4_USERAGENT: "Mozilla/5.0 (Linux; Android 11; moto g power (2022)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Mobile Safari/537.36";
|
|
84
84
|
declare const DESKTOP_USERAGENT: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36";
|
|
85
85
|
export {};
|
|
86
86
|
//# sourceMappingURL=constants.d.ts.map
|
package/core/config/constants.js
CHANGED
|
@@ -52,14 +52,13 @@ const throttling = {
|
|
|
52
52
|
/**
|
|
53
53
|
* @type {Required<LH.SharedFlagsSettings['screenEmulation']>}
|
|
54
54
|
*/
|
|
55
|
-
const
|
|
55
|
+
const MOTOGPOWER_EMULATION_METRICS = {
|
|
56
56
|
mobile: true,
|
|
57
|
-
width:
|
|
58
|
-
height:
|
|
59
|
-
//
|
|
60
|
-
// our perf recommendations.
|
|
57
|
+
width: 412,
|
|
58
|
+
height: 823,
|
|
59
|
+
// This value has some interesting ramifications for image-size-responsive, see:
|
|
61
60
|
// https://github.com/GoogleChrome/lighthouse/issues/10741#issuecomment-626903508
|
|
62
|
-
deviceScaleFactor:
|
|
61
|
+
deviceScaleFactor: 1.75,
|
|
63
62
|
disabled: false,
|
|
64
63
|
};
|
|
65
64
|
|
|
@@ -76,12 +75,12 @@ const DESKTOP_EMULATION_METRICS = {
|
|
|
76
75
|
};
|
|
77
76
|
|
|
78
77
|
const screenEmulationMetrics = {
|
|
79
|
-
mobile:
|
|
78
|
+
mobile: MOTOGPOWER_EMULATION_METRICS,
|
|
80
79
|
desktop: DESKTOP_EMULATION_METRICS,
|
|
81
80
|
};
|
|
82
81
|
|
|
83
82
|
|
|
84
|
-
const MOTOG4_USERAGENT = 'Mozilla/5.0 (Linux; Android
|
|
83
|
+
const MOTOG4_USERAGENT = 'Mozilla/5.0 (Linux; Android 11; moto g power (2022)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Mobile Safari/537.36'; // eslint-disable-line max-len
|
|
85
84
|
const DESKTOP_USERAGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36'; // eslint-disable-line max-len
|
|
86
85
|
|
|
87
86
|
const userAgents = {
|
|
@@ -43,4 +43,10 @@ export function prepareTargetForIndividualNavigation(session: LH.Gatherer.FRProt
|
|
|
43
43
|
}): Promise<{
|
|
44
44
|
warnings: Array<LH.IcuMessage>;
|
|
45
45
|
}>;
|
|
46
|
+
/**
|
|
47
|
+
* Enables `Debugger` domain to receive async stacktrace information on network request initiators.
|
|
48
|
+
* This is critical for tracking attribution of tasks and performance simulation accuracy.
|
|
49
|
+
* @param {LH.Gatherer.FRProtocolSession} session
|
|
50
|
+
*/
|
|
51
|
+
export function enableAsyncStacks(session: LH.Gatherer.FRProtocolSession): Promise<() => Promise<void>>;
|
|
46
52
|
//# sourceMappingURL=prepare.d.ts.map
|
|
@@ -22,17 +22,33 @@ async function enableAsyncStacks(session) {
|
|
|
22
22
|
await session.sendCommand('Debugger.setAsyncCallStackDepth', {maxDepth: 8});
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Resume any pauses that make it through `setSkipAllPauses`
|
|
27
|
+
*/
|
|
28
|
+
function onDebuggerPaused() {
|
|
29
|
+
session.sendCommand('Debugger.resume');
|
|
30
|
+
}
|
|
27
31
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
32
|
+
/**
|
|
33
|
+
* `Debugger.setSkipAllPauses` is reset after every navigation, so retrigger it on main frame navigations.
|
|
34
|
+
* See https://bugs.chromium.org/p/chromium/issues/detail?id=990945&q=setSkipAllPauses&can=2
|
|
35
|
+
* @param {LH.Crdp.Page.FrameNavigatedEvent} event
|
|
36
|
+
*/
|
|
37
|
+
function onFrameNavigated(event) {
|
|
31
38
|
if (event.frame.parentId) return;
|
|
32
39
|
enable().catch(err => log.error('Driver', err));
|
|
33
|
-
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
session.on('Debugger.paused', onDebuggerPaused);
|
|
43
|
+
session.on('Page.frameNavigated', onFrameNavigated);
|
|
34
44
|
|
|
35
45
|
await enable();
|
|
46
|
+
|
|
47
|
+
return async () => {
|
|
48
|
+
await session.sendCommand('Debugger.disable');
|
|
49
|
+
session.off('Debugger.paused', onDebuggerPaused);
|
|
50
|
+
session.off('Page.frameNavigated', onFrameNavigated);
|
|
51
|
+
};
|
|
36
52
|
}
|
|
37
53
|
|
|
38
54
|
/**
|
|
@@ -128,15 +144,12 @@ async function prepareThrottlingAndNetwork(session, settings, options) {
|
|
|
128
144
|
* @param {LH.Gatherer.FRTransitionalDriver} driver
|
|
129
145
|
* @param {LH.Config.Settings} settings
|
|
130
146
|
*/
|
|
131
|
-
async function
|
|
147
|
+
async function prepareDeviceEmulation(driver, settings) {
|
|
132
148
|
// Enable network domain here so future calls to `emulate()` don't clear cache (https://github.com/GoogleChrome/lighthouse/issues/12631)
|
|
133
149
|
await driver.defaultSession.sendCommand('Network.enable');
|
|
134
150
|
|
|
135
151
|
// Emulate our target device screen and user agent.
|
|
136
152
|
await emulation.emulate(driver.defaultSession, settings);
|
|
137
|
-
|
|
138
|
-
// Enable better stacks on network requests.
|
|
139
|
-
await enableAsyncStacks(driver.defaultSession);
|
|
140
153
|
}
|
|
141
154
|
|
|
142
155
|
/**
|
|
@@ -149,7 +162,7 @@ async function prepareTargetForTimespanMode(driver, settings) {
|
|
|
149
162
|
const status = {msg: 'Preparing target for timespan mode', id: 'lh:prepare:timespanMode'};
|
|
150
163
|
log.time(status);
|
|
151
164
|
|
|
152
|
-
await
|
|
165
|
+
await prepareDeviceEmulation(driver, settings);
|
|
153
166
|
await prepareThrottlingAndNetwork(driver.defaultSession, settings, {
|
|
154
167
|
disableThrottling: false,
|
|
155
168
|
blockedUrlPatterns: undefined,
|
|
@@ -171,7 +184,7 @@ async function prepareTargetForNavigationMode(driver, settings) {
|
|
|
171
184
|
const status = {msg: 'Preparing target for navigation mode', id: 'lh:prepare:navigationMode'};
|
|
172
185
|
log.time(status);
|
|
173
186
|
|
|
174
|
-
await
|
|
187
|
+
await prepareDeviceEmulation(driver, settings);
|
|
175
188
|
|
|
176
189
|
// Automatically handle any JavaScript dialogs to prevent a hung renderer.
|
|
177
190
|
await dismissJavaScriptDialogs(driver.defaultSession);
|
|
@@ -227,4 +240,5 @@ export {
|
|
|
227
240
|
prepareTargetForTimespanMode,
|
|
228
241
|
prepareTargetForNavigationMode,
|
|
229
242
|
prepareTargetForIndividualNavigation,
|
|
243
|
+
enableAsyncStacks,
|
|
230
244
|
};
|
|
@@ -9,6 +9,7 @@ import {waitForFrameNavigated, waitForLoadEvent} from '../driver/wait-for-condit
|
|
|
9
9
|
import DevtoolsLog from './devtools-log.js';
|
|
10
10
|
|
|
11
11
|
const FAILURE_EVENT_TIMEOUT = 100;
|
|
12
|
+
const TEMP_PAGE_PAUSE_TIMEOUT = 100;
|
|
12
13
|
|
|
13
14
|
class BFCacheFailures extends FRGatherer {
|
|
14
15
|
/** @type {LH.Gatherer.GathererMeta<'DevtoolsLog'>} */
|
|
@@ -109,7 +110,9 @@ class BFCacheFailures extends FRGatherer {
|
|
|
109
110
|
// https://github.com/GoogleChrome/lighthouse/issues/14665
|
|
110
111
|
await Promise.all([
|
|
111
112
|
session.sendCommand('Page.navigate', {url: 'chrome://terms'}),
|
|
112
|
-
|
|
113
|
+
// DevTools e2e tests can sometimes fail on the next command if we progress too fast.
|
|
114
|
+
// The only reliable way to prevent this is to wait for an arbitrary period of time after load.
|
|
115
|
+
waitForLoadEvent(session, TEMP_PAGE_PAUSE_TIMEOUT).promise,
|
|
113
116
|
]);
|
|
114
117
|
|
|
115
118
|
const [, frameNavigatedEvent] = await Promise.all([
|
|
@@ -227,6 +227,10 @@ async function _navigation(navigationContext) {
|
|
|
227
227
|
};
|
|
228
228
|
|
|
229
229
|
const setupResult = await _setupNavigation(navigationContext);
|
|
230
|
+
|
|
231
|
+
const disableAsyncStacks =
|
|
232
|
+
await prepare.enableAsyncStacks(navigationContext.driver.defaultSession);
|
|
233
|
+
|
|
230
234
|
await collectPhaseArtifacts({phase: 'startInstrumentation', ...phaseState});
|
|
231
235
|
await collectPhaseArtifacts({phase: 'startSensitiveInstrumentation', ...phaseState});
|
|
232
236
|
const navigateResult = await _navigate(navigationContext);
|
|
@@ -244,6 +248,12 @@ async function _navigation(navigationContext) {
|
|
|
244
248
|
|
|
245
249
|
await collectPhaseArtifacts({phase: 'stopSensitiveInstrumentation', ...phaseState});
|
|
246
250
|
await collectPhaseArtifacts({phase: 'stopInstrumentation', ...phaseState});
|
|
251
|
+
|
|
252
|
+
// bf-cache-failures can emit `Page.frameNavigated` at the end of the run.
|
|
253
|
+
// This can cause us to issue protocol commands after the target closes.
|
|
254
|
+
// We should disable our `Page.frameNavigated` handlers before that.
|
|
255
|
+
await disableAsyncStacks();
|
|
256
|
+
|
|
247
257
|
await _cleanupNavigation(navigationContext);
|
|
248
258
|
|
|
249
259
|
return _computeNavigationResult(navigationContext, phaseState, setupResult, navigateResult);
|
|
@@ -9,7 +9,7 @@ import log from 'lighthouse-logger';
|
|
|
9
9
|
import {Driver} from './driver.js';
|
|
10
10
|
import {Runner} from '../runner.js';
|
|
11
11
|
import {getEmptyArtifactState, collectPhaseArtifacts, awaitArtifacts} from './runner-helpers.js';
|
|
12
|
-
import {prepareTargetForTimespanMode} from './driver/prepare.js';
|
|
12
|
+
import {enableAsyncStacks, prepareTargetForTimespanMode} from './driver/prepare.js';
|
|
13
13
|
import {initializeConfig} from '../config/config.js';
|
|
14
14
|
import {getBaseArtifacts, finalizeArtifacts} from './base-artifacts.js';
|
|
15
15
|
|
|
@@ -44,6 +44,9 @@ async function startTimespanGather(page, options = {}) {
|
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
await prepareTargetForTimespanMode(driver, resolvedConfig.settings);
|
|
47
|
+
|
|
48
|
+
const disableAsyncStacks = await enableAsyncStacks(driver.defaultSession);
|
|
49
|
+
|
|
47
50
|
await collectPhaseArtifacts({phase: 'startInstrumentation', ...phaseOptions});
|
|
48
51
|
await collectPhaseArtifacts({phase: 'startSensitiveInstrumentation', ...phaseOptions});
|
|
49
52
|
|
|
@@ -58,6 +61,12 @@ async function startTimespanGather(page, options = {}) {
|
|
|
58
61
|
|
|
59
62
|
await collectPhaseArtifacts({phase: 'stopSensitiveInstrumentation', ...phaseOptions});
|
|
60
63
|
await collectPhaseArtifacts({phase: 'stopInstrumentation', ...phaseOptions});
|
|
64
|
+
|
|
65
|
+
// bf-cache-failures can emit `Page.frameNavigated` at the end of the run.
|
|
66
|
+
// This can cause us to issue protocol commands after the target closes.
|
|
67
|
+
// We should disable our `Page.frameNavigated` handlers before that.
|
|
68
|
+
await disableAsyncStacks();
|
|
69
|
+
|
|
61
70
|
await collectPhaseArtifacts({phase: 'getArtifact', ...phaseOptions});
|
|
62
71
|
await driver.disconnect();
|
|
63
72
|
|
|
@@ -200,12 +200,13 @@ export class Driver implements LH.Gatherer.FRTransitionalDriver {
|
|
|
200
200
|
/**
|
|
201
201
|
* Begin recording devtools protocol messages.
|
|
202
202
|
*/
|
|
203
|
-
beginDevtoolsLog(): void
|
|
203
|
+
beginDevtoolsLog(): Promise<void>;
|
|
204
|
+
_disableAsyncStacks: (() => Promise<void>) | undefined;
|
|
204
205
|
/**
|
|
205
206
|
* Stop recording to devtoolsLog and return log contents.
|
|
206
|
-
* @return {LH.DevtoolsLog}
|
|
207
|
+
* @return {Promise<LH.DevtoolsLog>}
|
|
207
208
|
*/
|
|
208
|
-
endDevtoolsLog(): LH.DevtoolsLog
|
|
209
|
+
endDevtoolsLog(): Promise<LH.DevtoolsLog>;
|
|
209
210
|
url(): Promise<string>;
|
|
210
211
|
}
|
|
211
212
|
import * as LH from "../../../types/lh.js";
|
|
@@ -16,6 +16,7 @@ import {fetchResponseBodyFromCache} from '../../gather/driver/network.js';
|
|
|
16
16
|
import {DevtoolsMessageLog} from '../../gather/gatherers/devtools-log.js';
|
|
17
17
|
import TraceGatherer from '../../gather/gatherers/trace.js';
|
|
18
18
|
import {getBrowserVersion} from '../../gather/driver/environment.js';
|
|
19
|
+
import {enableAsyncStacks} from '../../gather/driver/prepare.js';
|
|
19
20
|
|
|
20
21
|
// Controls how long to wait for a response after sending a DevTools protocol command.
|
|
21
22
|
const DEFAULT_PROTOCOL_TIMEOUT = 30000;
|
|
@@ -443,17 +444,19 @@ class Driver {
|
|
|
443
444
|
/**
|
|
444
445
|
* Begin recording devtools protocol messages.
|
|
445
446
|
*/
|
|
446
|
-
beginDevtoolsLog() {
|
|
447
|
+
async beginDevtoolsLog() {
|
|
448
|
+
this._disableAsyncStacks = await enableAsyncStacks(this);
|
|
447
449
|
this._devtoolsLog.reset();
|
|
448
450
|
this._devtoolsLog.beginRecording();
|
|
449
451
|
}
|
|
450
452
|
|
|
451
453
|
/**
|
|
452
454
|
* Stop recording to devtoolsLog and return log contents.
|
|
453
|
-
* @return {LH.DevtoolsLog}
|
|
455
|
+
* @return {Promise<LH.DevtoolsLog>}
|
|
454
456
|
*/
|
|
455
|
-
endDevtoolsLog() {
|
|
457
|
+
async endDevtoolsLog() {
|
|
456
458
|
this._devtoolsLog.endRecording();
|
|
459
|
+
await this._disableAsyncStacks?.();
|
|
457
460
|
return this._devtoolsLog.messages;
|
|
458
461
|
}
|
|
459
462
|
|
|
@@ -235,7 +235,7 @@ class GatherRunner {
|
|
|
235
235
|
id: `lh:gather:getDevtoolsLog`,
|
|
236
236
|
};
|
|
237
237
|
log.time(status);
|
|
238
|
-
const devtoolsLog = driver.endDevtoolsLog();
|
|
238
|
+
const devtoolsLog = await driver.endDevtoolsLog();
|
|
239
239
|
const networkRecords = await NetworkRecords.request(devtoolsLog, passContext);
|
|
240
240
|
log.timeEnd(status);
|
|
241
241
|
|
package/core/lib/emulation.js
CHANGED
|
@@ -32,11 +32,11 @@ function parseUseragentIntoMetadata(userAgent, formFactor) {
|
|
|
32
32
|
{brand: 'Lighthouse', version: lighthouseVersion},
|
|
33
33
|
];
|
|
34
34
|
|
|
35
|
-
const
|
|
35
|
+
const motoGPowerDetails = {
|
|
36
36
|
platform: 'Android',
|
|
37
|
-
platformVersion: '
|
|
37
|
+
platformVersion: '11.0',
|
|
38
38
|
architecture: '',
|
|
39
|
-
model: '
|
|
39
|
+
model: 'moto g power (2022)',
|
|
40
40
|
};
|
|
41
41
|
const macDesktopDetails = {
|
|
42
42
|
platform: 'macOS',
|
|
@@ -50,9 +50,9 @@ function parseUseragentIntoMetadata(userAgent, formFactor) {
|
|
|
50
50
|
brands,
|
|
51
51
|
fullVersion,
|
|
52
52
|
// Since config users can supply a custom useragent, they likely are emulating something
|
|
53
|
-
// other than Moto
|
|
53
|
+
// other than Moto G Power and MacOS Desktop.
|
|
54
54
|
// TODO: Determine how to thoughtfully expose this metadata/client-hints configurability.
|
|
55
|
-
...(mobile ?
|
|
55
|
+
...(mobile ? motoGPowerDetails : macDesktopDetails),
|
|
56
56
|
mobile,
|
|
57
57
|
};
|
|
58
58
|
}
|
|
@@ -1930,8 +1930,8 @@ const UIStrings = {
|
|
|
1930
1930
|
|
|
1931
1931
|
/** Descriptive explanation for emulation setting when no device emulation is set. */
|
|
1932
1932
|
runtimeNoEmulation: 'No emulation',
|
|
1933
|
-
/** Descriptive explanation for emulation setting when emulating a Moto
|
|
1934
|
-
runtimeMobileEmulation: 'Emulated Moto
|
|
1933
|
+
/** Descriptive explanation for emulation setting when emulating a Moto G Power mobile device. */
|
|
1934
|
+
runtimeMobileEmulation: 'Emulated Moto G Power',
|
|
1935
1935
|
/** Descriptive explanation for emulation setting when emulating a generic desktop form factor, as opposed to a mobile-device like form factor. */
|
|
1936
1936
|
runtimeDesktopEmulation: 'Emulated Desktop',
|
|
1937
1937
|
/** Descriptive explanation for a runtime setting that is set to an unknown value. */
|
package/dist/report/flow.js
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
* 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
|
|
31
31
|
* 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.
|
|
32
32
|
*/
|
|
33
|
-
const de=le.RATINGS;class me{static prepareReportResult(e){const a=JSON.parse(JSON.stringify(e));!function(e){e.configSettings.locale||(e.configSettings.locale="en"),e.configSettings.formFactor||(e.configSettings.formFactor=e.configSettings.emulatedFormFactor),e.finalDisplayedUrl=le.getFinalDisplayedUrl(e),e.mainDocumentUrl=le.getMainDocumentUrl(e);for(const a of Object.values(e.audits))if("not_applicable"!==a.scoreDisplayMode&&"not-applicable"!==a.scoreDisplayMode||(a.scoreDisplayMode="notApplicable"),a.details){if(void 0!==a.details.type&&"diagnostic"!==a.details.type||(a.details.type="debugdata"),"filmstrip"===a.details.type)for(const e of a.details.items)e.data.startsWith(ce)||(e.data=ce+e.data);if("table"===a.details.type)for(const e of a.details.headings){const{itemType:a,text:n}=e;void 0!==a&&(e.valueType=a,delete e.itemType),void 0!==n&&(e.label=n,delete e.text);const t=e.subItemsHeading?.itemType;e.subItemsHeading&&void 0!==t&&(e.subItemsHeading.valueType=t,delete e.subItemsHeading.itemType)}}const[a]=e.lighthouseVersion.split(".").map(Number),n=e.categories.performance;if(a<9&&n){e.categoryGroups||(e.categoryGroups={}),e.categoryGroups.hidden={title:""};for(const e of n.auditRefs)e.group?["load-opportunities","diagnostics"].includes(e.group)&&delete e.group:e.group="hidden"}if(e.environment||(e.environment={benchmarkIndex:0}),e.configSettings.screenEmulation||(e.configSettings.screenEmulation={}),e.i18n||(e.i18n={}),e.audits["full-page-screenshot"]){const a=e.audits["full-page-screenshot"].details;e.fullPageScreenshot=a?{screenshot:a.screenshot,nodes:a.nodes}:null,delete e.audits["full-page-screenshot"]}}(a);for(const e of Object.values(a.audits))me.classifyEntities(a.entities,e);if("object"!=typeof a.categories)throw new Error("No categories provided.");const n=new Map;for(const e of Object.values(a.categories))e.auditRefs.forEach((e=>{e.relevantAudits&&e.relevantAudits.forEach((a=>{const t=n.get(a)||[];t.push(e),n.set(a,t)}))})),e.auditRefs.forEach((e=>{const t=a.audits[e.id];e.result=t,n.has(e.id)&&(e.relevantMetrics=n.get(e.id)),a.stackPacks&&a.stackPacks.forEach((a=>{a.descriptions[e.id]&&(e.stackPacks=e.stackPacks||[],e.stackPacks.push({title:a.title,iconDataURL:a.iconDataURL,description:a.descriptions[e.id]}))}))}));return a}static getUrlLocatorFn(e){const a=e.find((e=>"url"===e.valueType))?.key;if(a&&"string"==typeof a)return e=>{const n=e[a];if("string"==typeof n)return n};const n=e.find((e=>"source-location"===e.valueType))?.key;return n?e=>{const a=e[n];if("object"==typeof a&&"source-location"===a.type)return a.url}:void 0}static classifyEntities(e,a){if(!e)return;if("opportunity"!==a.details?.type&&"table"!==a.details?.type)return;const{items:n,headings:t}=a.details;if(!n.length||n.some((e=>e.entity)))return;const i=me.getUrlLocatorFn(t);if(i)for(const a of n){const n=i(a);if(!n)continue;let t="";try{t=le.parseURL(n).origin}catch{}if(!t)continue;const o=e.find((e=>e.origins.includes(t)));o&&(a.entity=o.name)}}static getEmulationDescriptions(e){let a,n,t;const i=e.throttling,o=ue.i18n,r=ue.strings;switch(e.throttlingMethod){case"provided":t=n=a=r.throttlingProvided;break;case"devtools":{const{cpuSlowdownMultiplier:e,requestLatencyMs:s}=i;a=`${o.formatNumber(e)}x slowdown (DevTools)`,n=`${o.formatMilliseconds(s)} HTTP RTT, ${o.formatKbps(i.downloadThroughputKbps)} down, ${o.formatKbps(i.uploadThroughputKbps)} up (DevTools)`;t=(()=>562.5===s&&i.downloadThroughputKbps===1638.4*.9&&675===i.uploadThroughputKbps)()?r.runtimeSlow4g:r.runtimeCustom;break}case"simulate":{const{cpuSlowdownMultiplier:e,rttMs:s,throughputKbps:l}=i;a=`${o.formatNumber(e)}x slowdown (Simulated)`,n=`${o.formatMilliseconds(s)} TCP RTT, ${o.formatKbps(l)} throughput (Simulated)`;t=(()=>150===s&&1638.4===l)()?r.runtimeSlow4g:r.runtimeCustom;break}default:t=a=n=r.runtimeUnknown}const s="devtools"!==e.channel&&e.screenEmulation.disabled,l="devtools"===e.channel?"mobile"===e.formFactor:e.screenEmulation.mobile;let p=r.runtimeMobileEmulation;s?p=r.runtimeNoEmulation:l||(p=r.runtimeDesktopEmulation);return{deviceEmulation:p,screenEmulation:s?void 0:`${e.screenEmulation.width}x${e.screenEmulation.height}, DPR ${e.screenEmulation.deviceScaleFactor}`,cpuThrottling:a,networkThrottling:n,summary: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)>=de.PASS.minScore}}static calculateRating(e,a){if("manual"===a||"notApplicable"===a)return de.PASS.label;if("error"===a)return de.ERROR.label;if(null===e)return de.FAIL.label;let n=de.FAIL.label;return e>=de.PASS.minScore?n=de.PASS.label:e>=de.AVERAGE.minScore&&(n=de.AVERAGE.label),n}static calculateCategoryFraction(e){let a=0,n=0,t=0,i=0;for(const o of e.auditRefs){const e=me.showAsPassed(o.result);"hidden"!==o.group&&"manual"!==o.result.scoreDisplayMode&&"notApplicable"!==o.result.scoreDisplayMode&&("informative"!==o.result.scoreDisplayMode?(++a,i+=o.weight,e&&n++):e||++t)}return{numPassed:n,numPassableAudits:a,numInformative:t,totalWeight:i}}static isPluginCategory(e){return e.startsWith("lighthouse-plugin-")}static shouldDisplayAsFraction(e){return"timespan"===e||"snapshot"===e}}const he={varianceDisclaimer:"Values are estimated and may vary. The [performance score is calculated](https://developer.chrome.com/docs/lighthouse/performance/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:"Unthrottled CPU/Memory Power",runtimeSettingsAxeVersion:"Axe version",runtimeSettingsScreenEmulation:"Screen emulation",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"},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"})}),ve=()=>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"})]}),be=()=>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"})}),ye=()=>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"})]}),_e=()=>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"})}),Ce=()=>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"})}),we=()=>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"})}),ke=()=>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"})]}),Se=()=>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=T(void 0),Pe=T({});function Ue(e){return new URLSearchParams(location.hash.replace("#","?")).get(e)}function xe(...e){const a=[];for(const n of e){if(!n)continue;if("string"==typeof n){a.push(n);continue}const e=Object.entries(n).filter((([e,a])=>a)).map((([e])=>e));a.push(...e)}return a.join(" ")}function Le(e,a){switch(e){case"navigation":return a.navigationDescription;case"timespan":return a.timespanDescription;case"snapshot":return a.snapshotDescription}}function ze(){const e=X(Ae);if(!e)throw Error("useFlowResult must be called in the FlowResultContext");return e}function Ie(){const e=ze(),[a,n]=function(...e){const[a,n]=J(e.map(Ue));return q((()=>{function t(){const t=e.map(Ue);t.every(((e,n)=>e===a[n]))||n(t)}return window.addEventListener("hashchange",t),()=>window.removeEventListener("hashchange",t)}),[a]),a}("index","anchor");return Y((()=>{if(!a)return null;const t=Number(a);if(!Number.isFinite(t))return console.warn(`Invalid hash index: ${a}`),null;const i=e.steps[t];return i?{currentLhr:i.lhr,index:t,anchor:n}:(console.warn(`No flow step at index ${t}`),null)}),[a,e,n])}function Ne(e,a){const n=Z(null);return K((()=>{if(!n.current)return;const a=e();return n.current.append(a),()=>{n.current?.contains(a)&&n.current.removeChild(a)}}),a),n}const Te=()=>D("div",{className:"Separator",role:"separator"}),Re=({mode:e})=>D(h,{children:["navigation"===e&&D(ve,{}),"timespan"===e&&D(fe,{}),"snapshot"===e&&D(be,{})]}),De=({mode:e})=>D("div",{className:"FlowSegment",children:[D("div",{className:"FlowSegment__top-line"}),e&&D(Re,{mode:e}),D("div",{className:"FlowSegment__bottom-line"})]}),Ee=({frames:e,width:a,height:n})=>{const[t,i]=J(0),o=t%e.length;return q((()=>{const a=setInterval((()=>i((a=>(a+1)%e.length))),500);return()=>clearInterval(a)}),[e.length]),D("img",{className:"FlowStepThumbnail","data-testid":"FlowStepAnimatedThumbnail",src:e[o].data,style:{width:a,height:n},alt:"Animated screenshots of a page tested by Lighthouse"})},je=({lhr:e,width:a,height:n})=>{const t=function(e){const a=e.audits["screenshot-thumbnails"];if(!a)return;return a.details&&"filmstrip"===a.details.type&&a.details.items||void 0}(e),i=function(e){const{width:a,height:n}=e.configSettings.screenEmulation;return{width:a,height:n}}(e);if(a&&void 0===n?n=i.height*a/i.width:n&&void 0===a&&(a=i.width*n/i.height),!a||!n)return console.warn(new Error("FlowStepThumbnail requested without any dimensions").stack),D(h,{});let o;if(t?.length){if(o=t[t.length-1].data,"timespan"===e.gatherMode)return D(Ee,{frames:t,width:a,height:n})}else o=le.getFullPageScreenshot(e)?.screenshot.data;return D(h,{children:o&&D("img",{className:"FlowStepThumbnail",src:o,style:{width:a,height:n},alt:"Screenshot of a page tested by Lighthouse"})})};var Me,Fe=function(){function e(a,n,t,i){this.message=a,this.expected=n,this.found=t,this.location=i,this.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,e)}return function(e,a){function n(){this.constructor=e}n.prototype=a.prototype,e.prototype=new n}(e,Error),e.buildMessage=function(e,a){var n={literal:function(e){return'"'+i(e.text)+'"'},class:function(e){var a,n="";for(a=0;a<e.parts.length;a++)n+=e.parts[a]instanceof Array?o(e.parts[a][0])+"-"+o(e.parts[a][1]):o(e.parts[a]);return"["+(e.inverted?"^":"")+n+"]"},any:function(e){return"any character"},end:function(e){return"end of input"},other:function(e){return e.description}};function t(e){return e.charCodeAt(0).toString(16).toUpperCase()}function i(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"+t(e)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(e){return"\\x"+t(e)}))}function o(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"+t(e)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(e){return"\\x"+t(e)}))}return"Expected "+function(e){var a,t,i,o=new Array(e.length);for(a=0;a<e.length;a++)o[a]=(i=e[a],n[i.type](i));if(o.sort(),o.length>0){for(a=1,t=1;a<o.length;a++)o[a-1]!==o[a]&&(o[t]=o[a],t++);o.length=t}switch(o.length){case 1:return o[0];case 2:return o[0]+" or "+o[1];default:return o.slice(0,-1).join(", ")+", or "+o[o.length-1]}}(e)+" but "+function(e){return e?'"'+i(e)+'"':"end of input"}(a)+" found."},{SyntaxError:e,parse:function(a,n){n=void 0!==n?n:{};var t,i={},o={start:pe},r=pe,s=function(e){return e.join("")},l=te("{",!1),p=",",u=te(",",!1),c=te("}",!1),d="number",m=te("number",!1),h="date",g=te("date",!1),v="time",f=te("time",!1),b="plural",y=te("plural",!1),_="selectordinal",C=te("selectordinal",!1),w="select",k=te("select",!1),S=te("=",!1),A="offset:",P=te("offset:",!1),U=oe("whitespace"),x=/^[ \t\n\r]/,L=ie([" ","\t","\n","\r"],!1,!1),z=oe("optionalWhitespace"),I=/^[0-9]/,N=ie([["0","9"]],!1,!1),T=/^[0-9a-f]/i,R=ie([["0","9"],["a","f"]],!1,!0),D=te("0",!1),E=/^[1-9]/,j=ie([["1","9"]],!1,!1),M="'",F=te("'",!1),B=/^[ \t\n\r,.+={}#]/,O=ie([" ","\t","\n","\r",",",".","+","=","{","}","#"],!1,!1),H={type:"any"},W=/^[^{}\\\0-\x1F\x7F \t\n\r]/,V=ie(["{","}","\\",["\0",""],""," ","\t","\n","\r"],!0,!1),G=te("\\\\",!1),$=te("\\#",!1),J=te("\\{",!1),q=te("\\}",!1),K=te("\\u",!1),Z=0,Y=0,X=[{line:1,column:1}],Q=0,ee=[],ae=0;if("startRule"in n){if(!(n.startRule in o))throw new Error("Can't start parsing from rule \""+n.startRule+'".');r=o[n.startRule]}function ne(){return se(Y,Z)}function te(e,a){return{type:"literal",text:e,ignoreCase:a}}function ie(e,a,n){return{type:"class",parts:e,inverted:a,ignoreCase:n}}function oe(e){return{type:"other",description:e}}function re(e){var n,t=X[e];if(t)return t;for(n=e-1;!X[n];)n--;for(t={line:(t=X[n]).line,column:t.column};n<e;)10===a.charCodeAt(n)?(t.line++,t.column=1):t.column++,n++;return X[e]=t,t}function se(e,a){var n=re(e),t=re(a);return{start:{offset:e,line:n.line,column:n.column},end:{offset:a,line:t.line,column:t.column}}}function le(e){Z<Q||(Z>Q&&(Q=Z,ee=[]),ee.push(e))}function pe(){return ue()}function ue(){var e,a,n;for(e=Z,a=[],n=ce();n!==i;)a.push(n),n=ce();return a!==i&&(Y=e,a={type:"messageFormatPattern",elements:a,location:ne()}),e=a}function ce(){var e;return(e=function(){var e,n;e=Z,(n=function(){var e,n,t,o,r,s;e=Z,n=[],t=Z,(o=ge())!==i&&(r=we())!==i&&(s=ge())!==i?t=o=[o,r,s]:(Z=t,t=i);if(t!==i)for(;t!==i;)n.push(t),t=Z,(o=ge())!==i&&(r=we())!==i&&(s=ge())!==i?t=o=[o,r,s]:(Z=t,t=i);else n=i;n!==i&&(Y=e,n=n.reduce((function(e,a){return e.concat(a)}),[]).join(""));(e=n)===i&&(e=Z,e=(n=he())!==i?a.substring(e,Z):n);return e}())!==i&&(Y=e,n={type:"messageTextElement",value:n,location:ne()});return e=n}())===i&&(e=function(){var e,n,t,o,r,S,A;e=Z,123===a.charCodeAt(Z)?(n="{",Z++):(n=i,0===ae&&le(l));n!==i&&ge()!==i&&(t=function(){var e,a,n;if((e=be())===i){for(e=Z,a=[],n=ye();n!==i;)a.push(n),n=ye();a!==i&&(Y=e,a=s(a)),e=a}return e}())!==i&&ge()!==i?(o=Z,44===a.charCodeAt(Z)?(r=p,Z++):(r=i,0===ae&&le(u)),r!==i&&(S=ge())!==i&&(A=function(){var e;(e=function(){var e,n,t,o,r,s;e=Z,a.substr(Z,6)===d?(n=d,Z+=6):(n=i,0===ae&&le(m));n===i&&(a.substr(Z,4)===h?(n=h,Z+=4):(n=i,0===ae&&le(g)),n===i&&(a.substr(Z,4)===v?(n=v,Z+=4):(n=i,0===ae&&le(f))));n!==i&&ge()!==i?(t=Z,44===a.charCodeAt(Z)?(o=p,Z++):(o=i,0===ae&&le(u)),o!==i&&(r=ge())!==i&&(s=we())!==i?t=o=[o,r,s]:(Z=t,t=i),t===i&&(t=null),t!==i?(Y=e,e=n={type:n+"Format",style:(l=t)&&l[2],location:ne()}):(Z=e,e=i)):(Z=e,e=i);var l;return e}())===i&&(e=function(){var e,n,t,o;e=Z,a.substr(Z,6)===b?(n=b,Z+=6):(n=i,0===ae&&le(y));n!==i&&ge()!==i?(44===a.charCodeAt(Z)?(t=p,Z++):(t=i,0===ae&&le(u)),t!==i&&ge()!==i&&(o=me())!==i?(Y=e,e=n={type:(r=o).type,ordinal:!1,offset:r.offset||0,options:r.options,location:ne()}):(Z=e,e=i)):(Z=e,e=i);var r;return e}())===i&&(e=function(){var e,n,t,o;e=Z,a.substr(Z,13)===_?(n=_,Z+=13):(n=i,0===ae&&le(C));n!==i&&ge()!==i?(44===a.charCodeAt(Z)?(t=p,Z++):(t=i,0===ae&&le(u)),t!==i&&ge()!==i&&(o=me())!==i?(Y=e,e=n={type:(r=o).type,ordinal:!0,offset:r.offset||0,options:r.options,location:ne()}):(Z=e,e=i)):(Z=e,e=i);var r;return e}())===i&&(e=function(){var e,n,t,o,r;e=Z,a.substr(Z,6)===w?(n=w,Z+=6):(n=i,0===ae&&le(k));if(n!==i)if(ge()!==i)if(44===a.charCodeAt(Z)?(t=p,Z++):(t=i,0===ae&&le(u)),t!==i)if(ge()!==i){if(o=[],(r=de())!==i)for(;r!==i;)o.push(r),r=de();else o=i;o!==i?(Y=e,e=n=function(e){return{type:"selectFormat",options:e,location:ne()}}(o)):(Z=e,e=i)}else Z=e,e=i;else Z=e,e=i;else Z=e,e=i;else Z=e,e=i;return e}());return e}())!==i?o=r=[r,S,A]:(Z=o,o=i),o===i&&(o=null),o!==i&&(r=ge())!==i?(125===a.charCodeAt(Z)?(S="}",Z++):(S=i,0===ae&&le(c)),S!==i?(Y=e,e=n={type:"argumentElement",id:t,format:(P=o)&&P[2],location:ne()}):(Z=e,e=i)):(Z=e,e=i)):(Z=e,e=i);var P;return e}()),e}function de(){var e,n,t,o,r;return e=Z,ge()!==i&&(n=function(){var e,n,t,o;return e=Z,n=Z,61===a.charCodeAt(Z)?(t="=",Z++):(t=i,0===ae&&le(S)),t!==i&&(o=be())!==i?n=t=[t,o]:(Z=n,n=i),(e=n!==i?a.substring(e,Z):n)===i&&(e=we()),e}())!==i&&ge()!==i?(123===a.charCodeAt(Z)?(t="{",Z++):(t=i,0===ae&&le(l)),t!==i&&(o=ue())!==i?(125===a.charCodeAt(Z)?(r="}",Z++):(r=i,0===ae&&le(c)),r!==i?(Y=e,e={type:"optionalFormatPattern",selector:n,value:o,location:ne()}):(Z=e,e=i)):(Z=e,e=i)):(Z=e,e=i),e}function me(){var e,n,t,o;if(e=Z,(n=function(){var e,n,t;return e=Z,a.substr(Z,7)===A?(n=A,Z+=7):(n=i,0===ae&&le(P)),n!==i&&ge()!==i&&(t=be())!==i?(Y=e,e=n=t):(Z=e,e=i),e}())===i&&(n=null),n!==i)if(ge()!==i){if(t=[],(o=de())!==i)for(;o!==i;)t.push(o),o=de();else t=i;t!==i?(Y=e,e=n=function(e,a){return{type:"pluralFormat",offset:e,options:a,location:ne()}}(n,t)):(Z=e,e=i)}else Z=e,e=i;else Z=e,e=i;return e}function he(){var e,n;if(ae++,e=[],x.test(a.charAt(Z))?(n=a.charAt(Z),Z++):(n=i,0===ae&&le(L)),n!==i)for(;n!==i;)e.push(n),x.test(a.charAt(Z))?(n=a.charAt(Z),Z++):(n=i,0===ae&&le(L));else e=i;return ae--,e===i&&(n=i,0===ae&&le(U)),e}function ge(){var e,n,t;for(ae++,e=Z,n=[],t=he();t!==i;)n.push(t),t=he();return e=n!==i?a.substring(e,Z):n,ae--,e===i&&(n=i,0===ae&&le(z)),e}function ve(){var e;return I.test(a.charAt(Z))?(e=a.charAt(Z),Z++):(e=i,0===ae&&le(N)),e}function fe(){var e;return T.test(a.charAt(Z))?(e=a.charAt(Z),Z++):(e=i,0===ae&&le(R)),e}function be(){var e,n,t,o,r,s;if(e=Z,48===a.charCodeAt(Z)?(n="0",Z++):(n=i,0===ae&&le(D)),n===i){if(n=Z,t=Z,E.test(a.charAt(Z))?(o=a.charAt(Z),Z++):(o=i,0===ae&&le(j)),o!==i){for(r=[],s=ve();s!==i;)r.push(s),s=ve();r!==i?t=o=[o,r]:(Z=t,t=i)}else Z=t,t=i;n=t!==i?a.substring(n,Z):t}return n!==i&&(Y=e,n=parseInt(n,10)),e=n}function ye(){var e,n,t;return e=Z,n=Z,ae++,39===a.charCodeAt(Z)?(t=M,Z++):(t=i,0===ae&&le(F)),t===i&&(B.test(a.charAt(Z))?(t=a.charAt(Z),Z++):(t=i,0===ae&&le(O))),ae--,t===i?n=void 0:(Z=n,n=i),n!==i?(a.length>Z?(t=a.charAt(Z),Z++):(t=i,0===ae&&le(H)),t!==i?(Y=e,e=n=t):(Z=e,e=i)):(Z=e,e=i),e===i&&(e=Z,39===a.charCodeAt(Z)?(n=M,Z++):(n=i,0===ae&&le(F)),n!==i&&(t=function(){var e;B.test(a.charAt(Z))?(e=a.charAt(Z),Z++):(e=i,0===ae&&le(O));e===i&&(e=_e());return e}())!==i?(Y=e,e=n=t):(Z=e,e=i)),e}function _e(){var e;return 39===a.charCodeAt(Z)?(e=M,Z++):(e=i,0===ae&&le(F)),e}function Ce(){var e,n,t,o,r,s,l,p,u;return e=Z,39===a.charCodeAt(Z)?(n=M,Z++):(n=i,0===ae&&le(F)),n!==i&&(t=_e())!==i?(Y=e,e=n=t):(Z=e,e=i),e===i&&(W.test(a.charAt(Z))?(e=a.charAt(Z),Z++):(e=i,0===ae&&le(V)),e===i&&(e=Z,"\\\\"===a.substr(Z,2)?(n="\\\\",Z+=2):(n=i,0===ae&&le(G)),n!==i&&(Y=e,n="\\"),(e=n)===i&&(e=Z,"\\#"===a.substr(Z,2)?(n="\\#",Z+=2):(n=i,0===ae&&le($)),n!==i&&(Y=e,n="\\#"),(e=n)===i&&(e=Z,"\\{"===a.substr(Z,2)?(n="\\{",Z+=2):(n=i,0===ae&&le(J)),n!==i&&(Y=e,n="{"),(e=n)===i&&(e=Z,"\\}"===a.substr(Z,2)?(n="\\}",Z+=2):(n=i,0===ae&&le(q)),n!==i&&(Y=e,n="}"),(e=n)===i&&(e=Z,"\\u"===a.substr(Z,2)?(n="\\u",Z+=2):(n=i,0===ae&&le(K)),n!==i?(t=Z,o=Z,(r=fe())!==i&&(s=fe())!==i&&(l=fe())!==i&&(p=fe())!==i?o=r=[r,s,l,p]:(Z=o,o=i),(t=o!==i?a.substring(t,Z):o)!==i?(Y=e,u=t,e=n=String.fromCharCode(parseInt(u,16))):(Z=e,e=i)):(Z=e,e=i))))))),e}function we(){var e,a,n;if(e=Z,a=[],(n=Ce())!==i)for(;n!==i;)a.push(n),n=Ce();else a=i;return a!==i&&(Y=e,a=s(a)),e=a}if((t=r())!==i&&Z===a.length)return t;throw t!==i&&Z<a.length&&le({type:"end"}),function(a,n,t){return new e(e.buildMessage(a,n),a,n,t)}(ee,Q<a.length?a.charAt(Q):null,Q<a.length?se(Q,Q+1):se(Q,Q))}}}(),Be=(Me=function(e,a){return(Me=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,a){e.__proto__=a}||function(e,a){for(var n in a)a.hasOwnProperty(n)&&(e[n]=a[n])})(e,a)},function(e,a){function n(){this.constructor=e}Me(e,a),e.prototype=null===a?Object.create(a):(n.prototype=a.prototype,new n)}),Oe=function(){function e(e,a,n){this.locales=[],this.formats={number:{},date:{},time:{}},this.pluralNumberFormat=null,this.currentPlural=null,this.pluralStack=[],this.locales=e,this.formats=a,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 a=this;if(!e||"messageFormatPattern"!==e.type)throw new Error('Message AST is not of type: "messageFormatPattern"');var n=e.elements,t=n.filter((function(e){return"messageTextElement"===e.type||"argumentElement"===e.type})).map((function(e){return"messageTextElement"===e.type?a.compileMessageText(e):a.compileArgument(e)}));if(t.length!==n.length)throw new Error("Message element does not have a valid type");return t},e.prototype.compileMessageText=function(e){return this.currentPlural&&/(^|[^\\])#/g.test(e.value)?(this.pluralNumberFormat||(this.pluralNumberFormat=new Intl.NumberFormat(this.locales)),new Ge(this.currentPlural.id,this.currentPlural.format.offset,this.pluralNumberFormat,e.value)):e.value.replace(/\\#/g,"#")},e.prototype.compileArgument=function(e){var a=e.format,n=e.id,t=this.formatters;if(!a)return new We(n);var i=this.formats,o=this.locales;switch(a.type){case"numberFormat":return{id:n,format:t.getNumberFormat(o,i.number[a.style]).format};case"dateFormat":return{id:n,format:t.getDateTimeFormat(o,i.date[a.style]).format};case"timeFormat":return{id:n,format:t.getDateTimeFormat(o,i.time[a.style]).format};case"pluralFormat":return new Ve(n,a.offset,this.compileOptions(e),t.getPluralRules(o,{type:a.ordinal?"ordinal":"cardinal"}));case"selectFormat":return new $e(n,this.compileOptions(e));default:throw new Error("Message element does not have a valid format type")}},e.prototype.compileOptions=function(e){var a=this,n=e.format,t=n.options;this.pluralStack.push(this.currentPlural),this.currentPlural="pluralFormat"===n.type?e:null;var i=t.reduce((function(e,n){return e[n.selector]=a.compileMessage(n.value),e}),{});return this.currentPlural=this.pluralStack.pop(),i},e}(),He=function(e){this.id=e},We=function(e){function a(){return null!==e&&e.apply(this,arguments)||this}return Be(a,e),a.prototype.format=function(e){return e||"number"==typeof e?"string"==typeof e?e:String(e):""},a}(He),Ve=function(){function e(e,a,n,t){this.id=e,this.offset=a,this.options=n,this.pluralRules=t}return e.prototype.getOption=function(e){var a=this.options;return a["="+e]||a[this.pluralRules.select(e-this.offset)]||a.other},e}(),Ge=function(e){function a(a,n,t,i){var o=e.call(this,a)||this;return o.offset=n,o.numberFormat=t,o.string=i,o}return Be(a,e),a.prototype.format=function(e){var a=this.numberFormat.format(e-this.offset);return this.string.replace(/(^|[^\\])#/g,"$1"+a).replace(/\\#/g,"#")},a}(He),$e=function(){function e(e,a){this.id=e,this.options=a}return e.prototype.getOption=function(e){var a=this.options;return a[e]||a.other},e}();function Je(e){return!!e.options}var qe=function(){var e=function(a,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,a){e.__proto__=a}||function(e,a){for(var n in a)a.hasOwnProperty(n)&&(e[n]=a[n])})(a,n)};return function(a,n){function t(){this.constructor=a}e(a,n),a.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)}}(),Ke=function(){return(Ke=Object.assign||function(e){for(var a,n=1,t=arguments.length;n<t;n++)for(var i in a=arguments[n])Object.prototype.hasOwnProperty.call(a,i)&&(e[i]=a[i]);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 ea.defaultLocale}}function Ye(e,a){for(var n="",t=0,i=e;t<i.length;t++){var o=i[t];if("string"!=typeof o){var r=o.id;if(!a||!(r in a))throw new Qe("A value must be provided for: "+r,r);var s=a[r];Je(o)?n+=Ye(o.getOption(s),a):n+=o.format(s)}else n+=o}return n}function Xe(e,a){return a?Object.keys(e).reduce((function(n,t){var i,o;return n[t]=(i=e[t],(o=a[t])?Ke({},i||{},o||{},Object.keys(i).reduce((function(e,a){return e[a]=Ke({},i[a],o[a]||{}),e}),{})):i),n}),Ke({},e)):e}var Qe=function(e){function a(a,n){var t=e.call(this,a)||this;return t.variableId=n,t}return qe(a,e),a}(Error);var ea=function(){function e(a,n,t,i){var o=this;if(void 0===n&&(n=e.defaultLocale),this.format=function(e){try{return Ye(o.pattern,e)}catch(e){throw e.variableId?new Error("The intl string context variable '"+e.variableId+"' was not provided to the string '"+o.message+"'"):e}},"string"==typeof a){if(!e.__parse)throw new TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`");this.ast=e.__parse(a)}else this.ast=a;if(this.message=a,!this.ast||"messageFormatPattern"!==this.ast.type)throw new TypeError("A message must be provided as a String or AST.");var r=Xe(e.formats,t);this.locale=Ze(n||[]);var s=i&&i.formatters||{getNumberFormat:function(){for(var e,a=[],n=0;n<arguments.length;n++)a[n]=arguments[n];return new((e=Intl.NumberFormat).bind.apply(e,[void 0].concat(a)))},getDateTimeFormat:function(){for(var e,a=[],n=0;n<arguments.length;n++)a[n]=arguments[n];return new((e=Intl.DateTimeFormat).bind.apply(e,[void 0].concat(a)))},getPluralRules:function(){for(var e,a=[],n=0;n<arguments.length;n++)a[n]=arguments[n];return new((e=Intl.PluralRules).bind.apply(e,[void 0].concat(a)))}};this.pattern=new Oe(n,r,s).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}();ea.__parse=Fe.parse,
|
|
33
|
+
const de=le.RATINGS;class me{static prepareReportResult(e){const a=JSON.parse(JSON.stringify(e));!function(e){e.configSettings.locale||(e.configSettings.locale="en"),e.configSettings.formFactor||(e.configSettings.formFactor=e.configSettings.emulatedFormFactor),e.finalDisplayedUrl=le.getFinalDisplayedUrl(e),e.mainDocumentUrl=le.getMainDocumentUrl(e);for(const a of Object.values(e.audits))if("not_applicable"!==a.scoreDisplayMode&&"not-applicable"!==a.scoreDisplayMode||(a.scoreDisplayMode="notApplicable"),a.details){if(void 0!==a.details.type&&"diagnostic"!==a.details.type||(a.details.type="debugdata"),"filmstrip"===a.details.type)for(const e of a.details.items)e.data.startsWith(ce)||(e.data=ce+e.data);if("table"===a.details.type)for(const e of a.details.headings){const{itemType:a,text:n}=e;void 0!==a&&(e.valueType=a,delete e.itemType),void 0!==n&&(e.label=n,delete e.text);const t=e.subItemsHeading?.itemType;e.subItemsHeading&&void 0!==t&&(e.subItemsHeading.valueType=t,delete e.subItemsHeading.itemType)}}const[a]=e.lighthouseVersion.split(".").map(Number),n=e.categories.performance;if(a<9&&n){e.categoryGroups||(e.categoryGroups={}),e.categoryGroups.hidden={title:""};for(const e of n.auditRefs)e.group?["load-opportunities","diagnostics"].includes(e.group)&&delete e.group:e.group="hidden"}if(e.environment||(e.environment={benchmarkIndex:0}),e.configSettings.screenEmulation||(e.configSettings.screenEmulation={}),e.i18n||(e.i18n={}),e.audits["full-page-screenshot"]){const a=e.audits["full-page-screenshot"].details;e.fullPageScreenshot=a?{screenshot:a.screenshot,nodes:a.nodes}:null,delete e.audits["full-page-screenshot"]}}(a);for(const e of Object.values(a.audits))me.classifyEntities(a.entities,e);if("object"!=typeof a.categories)throw new Error("No categories provided.");const n=new Map;for(const e of Object.values(a.categories))e.auditRefs.forEach((e=>{e.relevantAudits&&e.relevantAudits.forEach((a=>{const t=n.get(a)||[];t.push(e),n.set(a,t)}))})),e.auditRefs.forEach((e=>{const t=a.audits[e.id];e.result=t,n.has(e.id)&&(e.relevantMetrics=n.get(e.id)),a.stackPacks&&a.stackPacks.forEach((a=>{a.descriptions[e.id]&&(e.stackPacks=e.stackPacks||[],e.stackPacks.push({title:a.title,iconDataURL:a.iconDataURL,description:a.descriptions[e.id]}))}))}));return a}static getUrlLocatorFn(e){const a=e.find((e=>"url"===e.valueType))?.key;if(a&&"string"==typeof a)return e=>{const n=e[a];if("string"==typeof n)return n};const n=e.find((e=>"source-location"===e.valueType))?.key;return n?e=>{const a=e[n];if("object"==typeof a&&"source-location"===a.type)return a.url}:void 0}static classifyEntities(e,a){if(!e)return;if("opportunity"!==a.details?.type&&"table"!==a.details?.type)return;const{items:n,headings:t}=a.details;if(!n.length||n.some((e=>e.entity)))return;const i=me.getUrlLocatorFn(t);if(i)for(const a of n){const n=i(a);if(!n)continue;let t="";try{t=le.parseURL(n).origin}catch{}if(!t)continue;const o=e.find((e=>e.origins.includes(t)));o&&(a.entity=o.name)}}static getEmulationDescriptions(e){let a,n,t;const i=e.throttling,o=ue.i18n,r=ue.strings;switch(e.throttlingMethod){case"provided":t=n=a=r.throttlingProvided;break;case"devtools":{const{cpuSlowdownMultiplier:e,requestLatencyMs:s}=i;a=`${o.formatNumber(e)}x slowdown (DevTools)`,n=`${o.formatMilliseconds(s)} HTTP RTT, ${o.formatKbps(i.downloadThroughputKbps)} down, ${o.formatKbps(i.uploadThroughputKbps)} up (DevTools)`;t=(()=>562.5===s&&i.downloadThroughputKbps===1638.4*.9&&675===i.uploadThroughputKbps)()?r.runtimeSlow4g:r.runtimeCustom;break}case"simulate":{const{cpuSlowdownMultiplier:e,rttMs:s,throughputKbps:l}=i;a=`${o.formatNumber(e)}x slowdown (Simulated)`,n=`${o.formatMilliseconds(s)} TCP RTT, ${o.formatKbps(l)} throughput (Simulated)`;t=(()=>150===s&&1638.4===l)()?r.runtimeSlow4g:r.runtimeCustom;break}default:t=a=n=r.runtimeUnknown}const s="devtools"!==e.channel&&e.screenEmulation.disabled,l="devtools"===e.channel?"mobile"===e.formFactor:e.screenEmulation.mobile;let p=r.runtimeMobileEmulation;s?p=r.runtimeNoEmulation:l||(p=r.runtimeDesktopEmulation);return{deviceEmulation:p,screenEmulation:s?void 0:`${e.screenEmulation.width}x${e.screenEmulation.height}, DPR ${e.screenEmulation.deviceScaleFactor}`,cpuThrottling:a,networkThrottling:n,summary: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)>=de.PASS.minScore}}static calculateRating(e,a){if("manual"===a||"notApplicable"===a)return de.PASS.label;if("error"===a)return de.ERROR.label;if(null===e)return de.FAIL.label;let n=de.FAIL.label;return e>=de.PASS.minScore?n=de.PASS.label:e>=de.AVERAGE.minScore&&(n=de.AVERAGE.label),n}static calculateCategoryFraction(e){let a=0,n=0,t=0,i=0;for(const o of e.auditRefs){const e=me.showAsPassed(o.result);"hidden"!==o.group&&"manual"!==o.result.scoreDisplayMode&&"notApplicable"!==o.result.scoreDisplayMode&&("informative"!==o.result.scoreDisplayMode?(++a,i+=o.weight,e&&n++):e||++t)}return{numPassed:n,numPassableAudits:a,numInformative:t,totalWeight:i}}static isPluginCategory(e){return e.startsWith("lighthouse-plugin-")}static shouldDisplayAsFraction(e){return"timespan"===e||"snapshot"===e}}const he={varianceDisclaimer:"Values are estimated and may vary. The [performance score is calculated](https://developer.chrome.com/docs/lighthouse/performance/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:"Unthrottled CPU/Memory Power",runtimeSettingsAxeVersion:"Axe version",runtimeSettingsScreenEmulation:"Screen emulation",footerIssue:"File an issue",runtimeNoEmulation:"No emulation",runtimeMobileEmulation:"Emulated Moto G Power",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"},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"})}),ve=()=>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"})]}),be=()=>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"})}),ye=()=>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"})]}),_e=()=>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"})}),Ce=()=>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"})}),we=()=>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"})}),ke=()=>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"})]}),Se=()=>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=T(void 0),Pe=T({});function Ue(e){return new URLSearchParams(location.hash.replace("#","?")).get(e)}function xe(...e){const a=[];for(const n of e){if(!n)continue;if("string"==typeof n){a.push(n);continue}const e=Object.entries(n).filter((([e,a])=>a)).map((([e])=>e));a.push(...e)}return a.join(" ")}function Le(e,a){switch(e){case"navigation":return a.navigationDescription;case"timespan":return a.timespanDescription;case"snapshot":return a.snapshotDescription}}function ze(){const e=X(Ae);if(!e)throw Error("useFlowResult must be called in the FlowResultContext");return e}function Ie(){const e=ze(),[a,n]=function(...e){const[a,n]=J(e.map(Ue));return q((()=>{function t(){const t=e.map(Ue);t.every(((e,n)=>e===a[n]))||n(t)}return window.addEventListener("hashchange",t),()=>window.removeEventListener("hashchange",t)}),[a]),a}("index","anchor");return Y((()=>{if(!a)return null;const t=Number(a);if(!Number.isFinite(t))return console.warn(`Invalid hash index: ${a}`),null;const i=e.steps[t];return i?{currentLhr:i.lhr,index:t,anchor:n}:(console.warn(`No flow step at index ${t}`),null)}),[a,e,n])}function Ne(e,a){const n=Z(null);return K((()=>{if(!n.current)return;const a=e();return n.current.append(a),()=>{n.current?.contains(a)&&n.current.removeChild(a)}}),a),n}const Te=()=>D("div",{className:"Separator",role:"separator"}),Re=({mode:e})=>D(h,{children:["navigation"===e&&D(ve,{}),"timespan"===e&&D(fe,{}),"snapshot"===e&&D(be,{})]}),De=({mode:e})=>D("div",{className:"FlowSegment",children:[D("div",{className:"FlowSegment__top-line"}),e&&D(Re,{mode:e}),D("div",{className:"FlowSegment__bottom-line"})]}),Ee=({frames:e,width:a,height:n})=>{const[t,i]=J(0),o=t%e.length;return q((()=>{const a=setInterval((()=>i((a=>(a+1)%e.length))),500);return()=>clearInterval(a)}),[e.length]),D("img",{className:"FlowStepThumbnail","data-testid":"FlowStepAnimatedThumbnail",src:e[o].data,style:{width:a,height:n},alt:"Animated screenshots of a page tested by Lighthouse"})},je=({lhr:e,width:a,height:n})=>{const t=function(e){const a=e.audits["screenshot-thumbnails"];if(!a)return;return a.details&&"filmstrip"===a.details.type&&a.details.items||void 0}(e),i=function(e){const{width:a,height:n}=e.configSettings.screenEmulation;return{width:a,height:n}}(e);if(a&&void 0===n?n=i.height*a/i.width:n&&void 0===a&&(a=i.width*n/i.height),!a||!n)return console.warn(new Error("FlowStepThumbnail requested without any dimensions").stack),D(h,{});let o;if(t?.length){if(o=t[t.length-1].data,"timespan"===e.gatherMode)return D(Ee,{frames:t,width:a,height:n})}else o=le.getFullPageScreenshot(e)?.screenshot.data;return D(h,{children:o&&D("img",{className:"FlowStepThumbnail",src:o,style:{width:a,height:n},alt:"Screenshot of a page tested by Lighthouse"})})};var Me,Fe=function(){function e(a,n,t,i){this.message=a,this.expected=n,this.found=t,this.location=i,this.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,e)}return function(e,a){function n(){this.constructor=e}n.prototype=a.prototype,e.prototype=new n}(e,Error),e.buildMessage=function(e,a){var n={literal:function(e){return'"'+i(e.text)+'"'},class:function(e){var a,n="";for(a=0;a<e.parts.length;a++)n+=e.parts[a]instanceof Array?o(e.parts[a][0])+"-"+o(e.parts[a][1]):o(e.parts[a]);return"["+(e.inverted?"^":"")+n+"]"},any:function(e){return"any character"},end:function(e){return"end of input"},other:function(e){return e.description}};function t(e){return e.charCodeAt(0).toString(16).toUpperCase()}function i(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"+t(e)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(e){return"\\x"+t(e)}))}function o(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"+t(e)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(e){return"\\x"+t(e)}))}return"Expected "+function(e){var a,t,i,o=new Array(e.length);for(a=0;a<e.length;a++)o[a]=(i=e[a],n[i.type](i));if(o.sort(),o.length>0){for(a=1,t=1;a<o.length;a++)o[a-1]!==o[a]&&(o[t]=o[a],t++);o.length=t}switch(o.length){case 1:return o[0];case 2:return o[0]+" or "+o[1];default:return o.slice(0,-1).join(", ")+", or "+o[o.length-1]}}(e)+" but "+function(e){return e?'"'+i(e)+'"':"end of input"}(a)+" found."},{SyntaxError:e,parse:function(a,n){n=void 0!==n?n:{};var t,i={},o={start:pe},r=pe,s=function(e){return e.join("")},l=te("{",!1),p=",",u=te(",",!1),c=te("}",!1),d="number",m=te("number",!1),h="date",g=te("date",!1),v="time",f=te("time",!1),b="plural",y=te("plural",!1),_="selectordinal",C=te("selectordinal",!1),w="select",k=te("select",!1),S=te("=",!1),A="offset:",P=te("offset:",!1),U=oe("whitespace"),x=/^[ \t\n\r]/,L=ie([" ","\t","\n","\r"],!1,!1),z=oe("optionalWhitespace"),I=/^[0-9]/,N=ie([["0","9"]],!1,!1),T=/^[0-9a-f]/i,R=ie([["0","9"],["a","f"]],!1,!0),D=te("0",!1),E=/^[1-9]/,j=ie([["1","9"]],!1,!1),M="'",F=te("'",!1),B=/^[ \t\n\r,.+={}#]/,O=ie([" ","\t","\n","\r",",",".","+","=","{","}","#"],!1,!1),H={type:"any"},W=/^[^{}\\\0-\x1F\x7F \t\n\r]/,V=ie(["{","}","\\",["\0",""],""," ","\t","\n","\r"],!0,!1),G=te("\\\\",!1),$=te("\\#",!1),J=te("\\{",!1),q=te("\\}",!1),K=te("\\u",!1),Z=0,Y=0,X=[{line:1,column:1}],Q=0,ee=[],ae=0;if("startRule"in n){if(!(n.startRule in o))throw new Error("Can't start parsing from rule \""+n.startRule+'".');r=o[n.startRule]}function ne(){return se(Y,Z)}function te(e,a){return{type:"literal",text:e,ignoreCase:a}}function ie(e,a,n){return{type:"class",parts:e,inverted:a,ignoreCase:n}}function oe(e){return{type:"other",description:e}}function re(e){var n,t=X[e];if(t)return t;for(n=e-1;!X[n];)n--;for(t={line:(t=X[n]).line,column:t.column};n<e;)10===a.charCodeAt(n)?(t.line++,t.column=1):t.column++,n++;return X[e]=t,t}function se(e,a){var n=re(e),t=re(a);return{start:{offset:e,line:n.line,column:n.column},end:{offset:a,line:t.line,column:t.column}}}function le(e){Z<Q||(Z>Q&&(Q=Z,ee=[]),ee.push(e))}function pe(){return ue()}function ue(){var e,a,n;for(e=Z,a=[],n=ce();n!==i;)a.push(n),n=ce();return a!==i&&(Y=e,a={type:"messageFormatPattern",elements:a,location:ne()}),e=a}function ce(){var e;return(e=function(){var e,n;e=Z,(n=function(){var e,n,t,o,r,s;e=Z,n=[],t=Z,(o=ge())!==i&&(r=we())!==i&&(s=ge())!==i?t=o=[o,r,s]:(Z=t,t=i);if(t!==i)for(;t!==i;)n.push(t),t=Z,(o=ge())!==i&&(r=we())!==i&&(s=ge())!==i?t=o=[o,r,s]:(Z=t,t=i);else n=i;n!==i&&(Y=e,n=n.reduce((function(e,a){return e.concat(a)}),[]).join(""));(e=n)===i&&(e=Z,e=(n=he())!==i?a.substring(e,Z):n);return e}())!==i&&(Y=e,n={type:"messageTextElement",value:n,location:ne()});return e=n}())===i&&(e=function(){var e,n,t,o,r,S,A;e=Z,123===a.charCodeAt(Z)?(n="{",Z++):(n=i,0===ae&&le(l));n!==i&&ge()!==i&&(t=function(){var e,a,n;if((e=be())===i){for(e=Z,a=[],n=ye();n!==i;)a.push(n),n=ye();a!==i&&(Y=e,a=s(a)),e=a}return e}())!==i&&ge()!==i?(o=Z,44===a.charCodeAt(Z)?(r=p,Z++):(r=i,0===ae&&le(u)),r!==i&&(S=ge())!==i&&(A=function(){var e;(e=function(){var e,n,t,o,r,s;e=Z,a.substr(Z,6)===d?(n=d,Z+=6):(n=i,0===ae&&le(m));n===i&&(a.substr(Z,4)===h?(n=h,Z+=4):(n=i,0===ae&&le(g)),n===i&&(a.substr(Z,4)===v?(n=v,Z+=4):(n=i,0===ae&&le(f))));n!==i&&ge()!==i?(t=Z,44===a.charCodeAt(Z)?(o=p,Z++):(o=i,0===ae&&le(u)),o!==i&&(r=ge())!==i&&(s=we())!==i?t=o=[o,r,s]:(Z=t,t=i),t===i&&(t=null),t!==i?(Y=e,e=n={type:n+"Format",style:(l=t)&&l[2],location:ne()}):(Z=e,e=i)):(Z=e,e=i);var l;return e}())===i&&(e=function(){var e,n,t,o;e=Z,a.substr(Z,6)===b?(n=b,Z+=6):(n=i,0===ae&&le(y));n!==i&&ge()!==i?(44===a.charCodeAt(Z)?(t=p,Z++):(t=i,0===ae&&le(u)),t!==i&&ge()!==i&&(o=me())!==i?(Y=e,e=n={type:(r=o).type,ordinal:!1,offset:r.offset||0,options:r.options,location:ne()}):(Z=e,e=i)):(Z=e,e=i);var r;return e}())===i&&(e=function(){var e,n,t,o;e=Z,a.substr(Z,13)===_?(n=_,Z+=13):(n=i,0===ae&&le(C));n!==i&&ge()!==i?(44===a.charCodeAt(Z)?(t=p,Z++):(t=i,0===ae&&le(u)),t!==i&&ge()!==i&&(o=me())!==i?(Y=e,e=n={type:(r=o).type,ordinal:!0,offset:r.offset||0,options:r.options,location:ne()}):(Z=e,e=i)):(Z=e,e=i);var r;return e}())===i&&(e=function(){var e,n,t,o,r;e=Z,a.substr(Z,6)===w?(n=w,Z+=6):(n=i,0===ae&&le(k));if(n!==i)if(ge()!==i)if(44===a.charCodeAt(Z)?(t=p,Z++):(t=i,0===ae&&le(u)),t!==i)if(ge()!==i){if(o=[],(r=de())!==i)for(;r!==i;)o.push(r),r=de();else o=i;o!==i?(Y=e,e=n=function(e){return{type:"selectFormat",options:e,location:ne()}}(o)):(Z=e,e=i)}else Z=e,e=i;else Z=e,e=i;else Z=e,e=i;else Z=e,e=i;return e}());return e}())!==i?o=r=[r,S,A]:(Z=o,o=i),o===i&&(o=null),o!==i&&(r=ge())!==i?(125===a.charCodeAt(Z)?(S="}",Z++):(S=i,0===ae&&le(c)),S!==i?(Y=e,e=n={type:"argumentElement",id:t,format:(P=o)&&P[2],location:ne()}):(Z=e,e=i)):(Z=e,e=i)):(Z=e,e=i);var P;return e}()),e}function de(){var e,n,t,o,r;return e=Z,ge()!==i&&(n=function(){var e,n,t,o;return e=Z,n=Z,61===a.charCodeAt(Z)?(t="=",Z++):(t=i,0===ae&&le(S)),t!==i&&(o=be())!==i?n=t=[t,o]:(Z=n,n=i),(e=n!==i?a.substring(e,Z):n)===i&&(e=we()),e}())!==i&&ge()!==i?(123===a.charCodeAt(Z)?(t="{",Z++):(t=i,0===ae&&le(l)),t!==i&&(o=ue())!==i?(125===a.charCodeAt(Z)?(r="}",Z++):(r=i,0===ae&&le(c)),r!==i?(Y=e,e={type:"optionalFormatPattern",selector:n,value:o,location:ne()}):(Z=e,e=i)):(Z=e,e=i)):(Z=e,e=i),e}function me(){var e,n,t,o;if(e=Z,(n=function(){var e,n,t;return e=Z,a.substr(Z,7)===A?(n=A,Z+=7):(n=i,0===ae&&le(P)),n!==i&&ge()!==i&&(t=be())!==i?(Y=e,e=n=t):(Z=e,e=i),e}())===i&&(n=null),n!==i)if(ge()!==i){if(t=[],(o=de())!==i)for(;o!==i;)t.push(o),o=de();else t=i;t!==i?(Y=e,e=n=function(e,a){return{type:"pluralFormat",offset:e,options:a,location:ne()}}(n,t)):(Z=e,e=i)}else Z=e,e=i;else Z=e,e=i;return e}function he(){var e,n;if(ae++,e=[],x.test(a.charAt(Z))?(n=a.charAt(Z),Z++):(n=i,0===ae&&le(L)),n!==i)for(;n!==i;)e.push(n),x.test(a.charAt(Z))?(n=a.charAt(Z),Z++):(n=i,0===ae&&le(L));else e=i;return ae--,e===i&&(n=i,0===ae&&le(U)),e}function ge(){var e,n,t;for(ae++,e=Z,n=[],t=he();t!==i;)n.push(t),t=he();return e=n!==i?a.substring(e,Z):n,ae--,e===i&&(n=i,0===ae&&le(z)),e}function ve(){var e;return I.test(a.charAt(Z))?(e=a.charAt(Z),Z++):(e=i,0===ae&&le(N)),e}function fe(){var e;return T.test(a.charAt(Z))?(e=a.charAt(Z),Z++):(e=i,0===ae&&le(R)),e}function be(){var e,n,t,o,r,s;if(e=Z,48===a.charCodeAt(Z)?(n="0",Z++):(n=i,0===ae&&le(D)),n===i){if(n=Z,t=Z,E.test(a.charAt(Z))?(o=a.charAt(Z),Z++):(o=i,0===ae&&le(j)),o!==i){for(r=[],s=ve();s!==i;)r.push(s),s=ve();r!==i?t=o=[o,r]:(Z=t,t=i)}else Z=t,t=i;n=t!==i?a.substring(n,Z):t}return n!==i&&(Y=e,n=parseInt(n,10)),e=n}function ye(){var e,n,t;return e=Z,n=Z,ae++,39===a.charCodeAt(Z)?(t=M,Z++):(t=i,0===ae&&le(F)),t===i&&(B.test(a.charAt(Z))?(t=a.charAt(Z),Z++):(t=i,0===ae&&le(O))),ae--,t===i?n=void 0:(Z=n,n=i),n!==i?(a.length>Z?(t=a.charAt(Z),Z++):(t=i,0===ae&&le(H)),t!==i?(Y=e,e=n=t):(Z=e,e=i)):(Z=e,e=i),e===i&&(e=Z,39===a.charCodeAt(Z)?(n=M,Z++):(n=i,0===ae&&le(F)),n!==i&&(t=function(){var e;B.test(a.charAt(Z))?(e=a.charAt(Z),Z++):(e=i,0===ae&&le(O));e===i&&(e=_e());return e}())!==i?(Y=e,e=n=t):(Z=e,e=i)),e}function _e(){var e;return 39===a.charCodeAt(Z)?(e=M,Z++):(e=i,0===ae&&le(F)),e}function Ce(){var e,n,t,o,r,s,l,p,u;return e=Z,39===a.charCodeAt(Z)?(n=M,Z++):(n=i,0===ae&&le(F)),n!==i&&(t=_e())!==i?(Y=e,e=n=t):(Z=e,e=i),e===i&&(W.test(a.charAt(Z))?(e=a.charAt(Z),Z++):(e=i,0===ae&&le(V)),e===i&&(e=Z,"\\\\"===a.substr(Z,2)?(n="\\\\",Z+=2):(n=i,0===ae&&le(G)),n!==i&&(Y=e,n="\\"),(e=n)===i&&(e=Z,"\\#"===a.substr(Z,2)?(n="\\#",Z+=2):(n=i,0===ae&&le($)),n!==i&&(Y=e,n="\\#"),(e=n)===i&&(e=Z,"\\{"===a.substr(Z,2)?(n="\\{",Z+=2):(n=i,0===ae&&le(J)),n!==i&&(Y=e,n="{"),(e=n)===i&&(e=Z,"\\}"===a.substr(Z,2)?(n="\\}",Z+=2):(n=i,0===ae&&le(q)),n!==i&&(Y=e,n="}"),(e=n)===i&&(e=Z,"\\u"===a.substr(Z,2)?(n="\\u",Z+=2):(n=i,0===ae&&le(K)),n!==i?(t=Z,o=Z,(r=fe())!==i&&(s=fe())!==i&&(l=fe())!==i&&(p=fe())!==i?o=r=[r,s,l,p]:(Z=o,o=i),(t=o!==i?a.substring(t,Z):o)!==i?(Y=e,u=t,e=n=String.fromCharCode(parseInt(u,16))):(Z=e,e=i)):(Z=e,e=i))))))),e}function we(){var e,a,n;if(e=Z,a=[],(n=Ce())!==i)for(;n!==i;)a.push(n),n=Ce();else a=i;return a!==i&&(Y=e,a=s(a)),e=a}if((t=r())!==i&&Z===a.length)return t;throw t!==i&&Z<a.length&&le({type:"end"}),function(a,n,t){return new e(e.buildMessage(a,n),a,n,t)}(ee,Q<a.length?a.charAt(Q):null,Q<a.length?se(Q,Q+1):se(Q,Q))}}}(),Be=(Me=function(e,a){return(Me=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,a){e.__proto__=a}||function(e,a){for(var n in a)a.hasOwnProperty(n)&&(e[n]=a[n])})(e,a)},function(e,a){function n(){this.constructor=e}Me(e,a),e.prototype=null===a?Object.create(a):(n.prototype=a.prototype,new n)}),Oe=function(){function e(e,a,n){this.locales=[],this.formats={number:{},date:{},time:{}},this.pluralNumberFormat=null,this.currentPlural=null,this.pluralStack=[],this.locales=e,this.formats=a,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 a=this;if(!e||"messageFormatPattern"!==e.type)throw new Error('Message AST is not of type: "messageFormatPattern"');var n=e.elements,t=n.filter((function(e){return"messageTextElement"===e.type||"argumentElement"===e.type})).map((function(e){return"messageTextElement"===e.type?a.compileMessageText(e):a.compileArgument(e)}));if(t.length!==n.length)throw new Error("Message element does not have a valid type");return t},e.prototype.compileMessageText=function(e){return this.currentPlural&&/(^|[^\\])#/g.test(e.value)?(this.pluralNumberFormat||(this.pluralNumberFormat=new Intl.NumberFormat(this.locales)),new Ge(this.currentPlural.id,this.currentPlural.format.offset,this.pluralNumberFormat,e.value)):e.value.replace(/\\#/g,"#")},e.prototype.compileArgument=function(e){var a=e.format,n=e.id,t=this.formatters;if(!a)return new We(n);var i=this.formats,o=this.locales;switch(a.type){case"numberFormat":return{id:n,format:t.getNumberFormat(o,i.number[a.style]).format};case"dateFormat":return{id:n,format:t.getDateTimeFormat(o,i.date[a.style]).format};case"timeFormat":return{id:n,format:t.getDateTimeFormat(o,i.time[a.style]).format};case"pluralFormat":return new Ve(n,a.offset,this.compileOptions(e),t.getPluralRules(o,{type:a.ordinal?"ordinal":"cardinal"}));case"selectFormat":return new $e(n,this.compileOptions(e));default:throw new Error("Message element does not have a valid format type")}},e.prototype.compileOptions=function(e){var a=this,n=e.format,t=n.options;this.pluralStack.push(this.currentPlural),this.currentPlural="pluralFormat"===n.type?e:null;var i=t.reduce((function(e,n){return e[n.selector]=a.compileMessage(n.value),e}),{});return this.currentPlural=this.pluralStack.pop(),i},e}(),He=function(e){this.id=e},We=function(e){function a(){return null!==e&&e.apply(this,arguments)||this}return Be(a,e),a.prototype.format=function(e){return e||"number"==typeof e?"string"==typeof e?e:String(e):""},a}(He),Ve=function(){function e(e,a,n,t){this.id=e,this.offset=a,this.options=n,this.pluralRules=t}return e.prototype.getOption=function(e){var a=this.options;return a["="+e]||a[this.pluralRules.select(e-this.offset)]||a.other},e}(),Ge=function(e){function a(a,n,t,i){var o=e.call(this,a)||this;return o.offset=n,o.numberFormat=t,o.string=i,o}return Be(a,e),a.prototype.format=function(e){var a=this.numberFormat.format(e-this.offset);return this.string.replace(/(^|[^\\])#/g,"$1"+a).replace(/\\#/g,"#")},a}(He),$e=function(){function e(e,a){this.id=e,this.options=a}return e.prototype.getOption=function(e){var a=this.options;return a[e]||a.other},e}();function Je(e){return!!e.options}var qe=function(){var e=function(a,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,a){e.__proto__=a}||function(e,a){for(var n in a)a.hasOwnProperty(n)&&(e[n]=a[n])})(a,n)};return function(a,n){function t(){this.constructor=a}e(a,n),a.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)}}(),Ke=function(){return(Ke=Object.assign||function(e){for(var a,n=1,t=arguments.length;n<t;n++)for(var i in a=arguments[n])Object.prototype.hasOwnProperty.call(a,i)&&(e[i]=a[i]);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 ea.defaultLocale}}function Ye(e,a){for(var n="",t=0,i=e;t<i.length;t++){var o=i[t];if("string"!=typeof o){var r=o.id;if(!a||!(r in a))throw new Qe("A value must be provided for: "+r,r);var s=a[r];Je(o)?n+=Ye(o.getOption(s),a):n+=o.format(s)}else n+=o}return n}function Xe(e,a){return a?Object.keys(e).reduce((function(n,t){var i,o;return n[t]=(i=e[t],(o=a[t])?Ke({},i||{},o||{},Object.keys(i).reduce((function(e,a){return e[a]=Ke({},i[a],o[a]||{}),e}),{})):i),n}),Ke({},e)):e}var Qe=function(e){function a(a,n){var t=e.call(this,a)||this;return t.variableId=n,t}return qe(a,e),a}(Error);var ea=function(){function e(a,n,t,i){var o=this;if(void 0===n&&(n=e.defaultLocale),this.format=function(e){try{return Ye(o.pattern,e)}catch(e){throw e.variableId?new Error("The intl string context variable '"+e.variableId+"' was not provided to the string '"+o.message+"'"):e}},"string"==typeof a){if(!e.__parse)throw new TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`");this.ast=e.__parse(a)}else this.ast=a;if(this.message=a,!this.ast||"messageFormatPattern"!==this.ast.type)throw new TypeError("A message must be provided as a String or AST.");var r=Xe(e.formats,t);this.locale=Ze(n||[]);var s=i&&i.formatters||{getNumberFormat:function(){for(var e,a=[],n=0;n<arguments.length;n++)a[n]=arguments[n];return new((e=Intl.NumberFormat).bind.apply(e,[void 0].concat(a)))},getDateTimeFormat:function(){for(var e,a=[],n=0;n<arguments.length;n++)a[n]=arguments[n];return new((e=Intl.DateTimeFormat).bind.apply(e,[void 0].concat(a)))},getPluralRules:function(){for(var e,a=[],n=0;n<arguments.length;n++)a[n]=arguments[n];return new((e=Intl.PluralRules).bind.apply(e,[void 0].concat(a)))}};this.pattern=new Oe(n,r,s).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}();ea.__parse=Fe.parse,
|
|
34
34
|
/**
|
|
35
35
|
* @license Copyright 2021 The Lighthouse Authors. All Rights Reserved.
|
|
36
36
|
* 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
|
|
@@ -47,7 +47,7 @@ class o{constructor(e,t){this._document=e,this._lighthouseChannel="unknown",this
|
|
|
47
47
|
* 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
|
|
48
48
|
* 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.
|
|
49
49
|
*/
|
|
50
|
-
const s=r.RATINGS;class c{static prepareReportResult(e){const t=JSON.parse(JSON.stringify(e));!function(e){e.configSettings.locale||(e.configSettings.locale="en"),e.configSettings.formFactor||(e.configSettings.formFactor=e.configSettings.emulatedFormFactor),e.finalDisplayedUrl=r.getFinalDisplayedUrl(e),e.mainDocumentUrl=r.getMainDocumentUrl(e);for(const t of Object.values(e.audits))if("not_applicable"!==t.scoreDisplayMode&&"not-applicable"!==t.scoreDisplayMode||(t.scoreDisplayMode="notApplicable"),t.details){if(void 0!==t.details.type&&"diagnostic"!==t.details.type||(t.details.type="debugdata"),"filmstrip"===t.details.type)for(const e of t.details.items)e.data.startsWith(l)||(e.data=l+e.data);if("table"===t.details.type)for(const e of t.details.headings){const{itemType:t,text:n}=e;void 0!==t&&(e.valueType=t,delete e.itemType),void 0!==n&&(e.label=n,delete e.text);const r=e.subItemsHeading?.itemType;e.subItemsHeading&&void 0!==r&&(e.subItemsHeading.valueType=r,delete e.subItemsHeading.itemType)}}const[t]=e.lighthouseVersion.split(".").map(Number),n=e.categories.performance;if(t<9&&n){e.categoryGroups||(e.categoryGroups={}),e.categoryGroups.hidden={title:""};for(const e of n.auditRefs)e.group?["load-opportunities","diagnostics"].includes(e.group)&&delete e.group:e.group="hidden"}if(e.environment||(e.environment={benchmarkIndex:0}),e.configSettings.screenEmulation||(e.configSettings.screenEmulation={}),e.i18n||(e.i18n={}),e.audits["full-page-screenshot"]){const t=e.audits["full-page-screenshot"].details;e.fullPageScreenshot=t?{screenshot:t.screenshot,nodes:t.nodes}:null,delete e.audits["full-page-screenshot"]}}(t);for(const e of Object.values(t.audits))c.classifyEntities(t.entities,e);if("object"!=typeof t.categories)throw new Error("No categories provided.");const n=new Map;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 getUrlLocatorFn(e){const t=e.find((e=>"url"===e.valueType))?.key;if(t&&"string"==typeof t)return e=>{const n=e[t];if("string"==typeof n)return n};const n=e.find((e=>"source-location"===e.valueType))?.key;return n?e=>{const t=e[n];if("object"==typeof t&&"source-location"===t.type)return t.url}:void 0}static classifyEntities(e,t){if(!e)return;if("opportunity"!==t.details?.type&&"table"!==t.details?.type)return;const{items:n,headings:o}=t.details;if(!n.length||n.some((e=>e.entity)))return;const i=c.getUrlLocatorFn(o);if(i)for(const t of n){const n=i(t);if(!n)continue;let o="";try{o=r.parseURL(n).origin}catch{}if(!o)continue;const a=e.find((e=>e.origins.includes(o)));a&&(t.entity=a.name)}}static getEmulationDescriptions(e){let t,n,r;const o=e.throttling,i=a.i18n,l=a.strings;switch(e.throttlingMethod){case"provided":r=n=t=l.throttlingProvided;break;case"devtools":{const{cpuSlowdownMultiplier:e,requestLatencyMs:a}=o;t=`${i.formatNumber(e)}x slowdown (DevTools)`,n=`${i.formatMilliseconds(a)} HTTP RTT, ${i.formatKbps(o.downloadThroughputKbps)} down, ${i.formatKbps(o.uploadThroughputKbps)} up (DevTools)`;r=(()=>562.5===a&&o.downloadThroughputKbps===1638.4*.9&&675===o.uploadThroughputKbps)()?l.runtimeSlow4g:l.runtimeCustom;break}case"simulate":{const{cpuSlowdownMultiplier:e,rttMs:a,throughputKbps:s}=o;t=`${i.formatNumber(e)}x slowdown (Simulated)`,n=`${i.formatMilliseconds(a)} TCP RTT, ${i.formatKbps(s)} throughput (Simulated)`;r=(()=>150===a&&1638.4===s)()?l.runtimeSlow4g:l.runtimeCustom;break}default:r=t=n=l.runtimeUnknown}const s="devtools"!==e.channel&&e.screenEmulation.disabled,c="devtools"===e.channel?"mobile"===e.formFactor:e.screenEmulation.mobile;let d=l.runtimeMobileEmulation;s?d=l.runtimeNoEmulation:c||(d=l.runtimeDesktopEmulation);return{deviceEmulation:d,screenEmulation:s?void 0:`${e.screenEmulation.width}x${e.screenEmulation.height}, DPR ${e.screenEmulation.deviceScaleFactor}`,cpuThrottling:t,networkThrottling:n,summary:r}}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)>=s.PASS.minScore}}static calculateRating(e,t){if("manual"===t||"notApplicable"===t)return s.PASS.label;if("error"===t)return s.ERROR.label;if(null===e)return s.FAIL.label;let n=s.FAIL.label;return e>=s.PASS.minScore?n=s.PASS.label:e>=s.AVERAGE.minScore&&(n=s.AVERAGE.label),n}static calculateCategoryFraction(e){let t=0,n=0,r=0,o=0;for(const i of e.auditRefs){const e=c.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}}static isPluginCategory(e){return e.startsWith("lighthouse-plugin-")}static shouldDisplayAsFraction(e){return"timespan"===e||"snapshot"===e}}const d={varianceDisclaimer:"Values are estimated and may vary. The [performance score is calculated](https://developer.chrome.com/docs/lighthouse/performance/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:"Unthrottled CPU/Memory Power",runtimeSettingsAxeVersion:"Axe version",runtimeSettingsScreenEmulation:"Screen emulation",footerIssue:"File an issue",runtimeNoEmulation:"No emulation",runtimeMobileEmulation:"Emulated Moto
|
|
50
|
+
const s=r.RATINGS;class c{static prepareReportResult(e){const t=JSON.parse(JSON.stringify(e));!function(e){e.configSettings.locale||(e.configSettings.locale="en"),e.configSettings.formFactor||(e.configSettings.formFactor=e.configSettings.emulatedFormFactor),e.finalDisplayedUrl=r.getFinalDisplayedUrl(e),e.mainDocumentUrl=r.getMainDocumentUrl(e);for(const t of Object.values(e.audits))if("not_applicable"!==t.scoreDisplayMode&&"not-applicable"!==t.scoreDisplayMode||(t.scoreDisplayMode="notApplicable"),t.details){if(void 0!==t.details.type&&"diagnostic"!==t.details.type||(t.details.type="debugdata"),"filmstrip"===t.details.type)for(const e of t.details.items)e.data.startsWith(l)||(e.data=l+e.data);if("table"===t.details.type)for(const e of t.details.headings){const{itemType:t,text:n}=e;void 0!==t&&(e.valueType=t,delete e.itemType),void 0!==n&&(e.label=n,delete e.text);const r=e.subItemsHeading?.itemType;e.subItemsHeading&&void 0!==r&&(e.subItemsHeading.valueType=r,delete e.subItemsHeading.itemType)}}const[t]=e.lighthouseVersion.split(".").map(Number),n=e.categories.performance;if(t<9&&n){e.categoryGroups||(e.categoryGroups={}),e.categoryGroups.hidden={title:""};for(const e of n.auditRefs)e.group?["load-opportunities","diagnostics"].includes(e.group)&&delete e.group:e.group="hidden"}if(e.environment||(e.environment={benchmarkIndex:0}),e.configSettings.screenEmulation||(e.configSettings.screenEmulation={}),e.i18n||(e.i18n={}),e.audits["full-page-screenshot"]){const t=e.audits["full-page-screenshot"].details;e.fullPageScreenshot=t?{screenshot:t.screenshot,nodes:t.nodes}:null,delete e.audits["full-page-screenshot"]}}(t);for(const e of Object.values(t.audits))c.classifyEntities(t.entities,e);if("object"!=typeof t.categories)throw new Error("No categories provided.");const n=new Map;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 getUrlLocatorFn(e){const t=e.find((e=>"url"===e.valueType))?.key;if(t&&"string"==typeof t)return e=>{const n=e[t];if("string"==typeof n)return n};const n=e.find((e=>"source-location"===e.valueType))?.key;return n?e=>{const t=e[n];if("object"==typeof t&&"source-location"===t.type)return t.url}:void 0}static classifyEntities(e,t){if(!e)return;if("opportunity"!==t.details?.type&&"table"!==t.details?.type)return;const{items:n,headings:o}=t.details;if(!n.length||n.some((e=>e.entity)))return;const i=c.getUrlLocatorFn(o);if(i)for(const t of n){const n=i(t);if(!n)continue;let o="";try{o=r.parseURL(n).origin}catch{}if(!o)continue;const a=e.find((e=>e.origins.includes(o)));a&&(t.entity=a.name)}}static getEmulationDescriptions(e){let t,n,r;const o=e.throttling,i=a.i18n,l=a.strings;switch(e.throttlingMethod){case"provided":r=n=t=l.throttlingProvided;break;case"devtools":{const{cpuSlowdownMultiplier:e,requestLatencyMs:a}=o;t=`${i.formatNumber(e)}x slowdown (DevTools)`,n=`${i.formatMilliseconds(a)} HTTP RTT, ${i.formatKbps(o.downloadThroughputKbps)} down, ${i.formatKbps(o.uploadThroughputKbps)} up (DevTools)`;r=(()=>562.5===a&&o.downloadThroughputKbps===1638.4*.9&&675===o.uploadThroughputKbps)()?l.runtimeSlow4g:l.runtimeCustom;break}case"simulate":{const{cpuSlowdownMultiplier:e,rttMs:a,throughputKbps:s}=o;t=`${i.formatNumber(e)}x slowdown (Simulated)`,n=`${i.formatMilliseconds(a)} TCP RTT, ${i.formatKbps(s)} throughput (Simulated)`;r=(()=>150===a&&1638.4===s)()?l.runtimeSlow4g:l.runtimeCustom;break}default:r=t=n=l.runtimeUnknown}const s="devtools"!==e.channel&&e.screenEmulation.disabled,c="devtools"===e.channel?"mobile"===e.formFactor:e.screenEmulation.mobile;let d=l.runtimeMobileEmulation;s?d=l.runtimeNoEmulation:c||(d=l.runtimeDesktopEmulation);return{deviceEmulation:d,screenEmulation:s?void 0:`${e.screenEmulation.width}x${e.screenEmulation.height}, DPR ${e.screenEmulation.deviceScaleFactor}`,cpuThrottling:t,networkThrottling:n,summary:r}}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)>=s.PASS.minScore}}static calculateRating(e,t){if("manual"===t||"notApplicable"===t)return s.PASS.label;if("error"===t)return s.ERROR.label;if(null===e)return s.FAIL.label;let n=s.FAIL.label;return e>=s.PASS.minScore?n=s.PASS.label:e>=s.AVERAGE.minScore&&(n=s.AVERAGE.label),n}static calculateCategoryFraction(e){let t=0,n=0,r=0,o=0;for(const i of e.auditRefs){const e=c.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}}static isPluginCategory(e){return e.startsWith("lighthouse-plugin-")}static shouldDisplayAsFraction(e){return"timespan"===e||"snapshot"===e}}const d={varianceDisclaimer:"Values are estimated and may vary. The [performance score is calculated](https://developer.chrome.com/docs/lighthouse/performance/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:"Unthrottled CPU/Memory Power",runtimeSettingsAxeVersion:"Axe version",runtimeSettingsScreenEmulation:"Screen emulation",footerIssue:"File an issue",runtimeNoEmulation:"No emulation",runtimeMobileEmulation:"Emulated Moto G Power",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"};
|
|
51
51
|
/**
|
|
52
52
|
* @license
|
|
53
53
|
* Copyright 2017 The Lighthouse Authors. All Rights Reserved.
|
|
@@ -68,8 +68,8 @@ describe('SidebarRuntimeSettings', () => {
|
|
|
68
68
|
} as any;
|
|
69
69
|
const root = render(<SidebarRuntimeSettings settings={settings}/>, {wrapper});
|
|
70
70
|
|
|
71
|
-
expect(root.getByText('Emulated Moto
|
|
72
|
-
expect(root.queryByText('Emulated Moto
|
|
71
|
+
expect(root.getByText('Emulated Moto G Power - 200x200, DPR 3')).toBeTruthy();
|
|
72
|
+
expect(root.queryByText('Emulated Moto G Power -')).toBeFalsy();
|
|
73
73
|
expect(root.getByText('Slow 4G throttling')).toBeTruthy();
|
|
74
74
|
expect(root.getByText('4x slowdown'));
|
|
75
75
|
});
|
|
@@ -110,7 +110,7 @@ describe('SidebarRuntimeSettings', () => {
|
|
|
110
110
|
const root = render(<SidebarRuntimeSettings settings={settings}/>, {wrapper});
|
|
111
111
|
|
|
112
112
|
expect(root.getByText('No emulation')).toBeTruthy();
|
|
113
|
-
expect(root.queryByText('Emulated Moto
|
|
113
|
+
expect(root.queryByText('Emulated Moto G Power -')).toBeFalsy();
|
|
114
114
|
expect(root.getByText('Provided by environment')).toBeTruthy();
|
|
115
115
|
});
|
|
116
116
|
});
|
package/package.json
CHANGED
|
@@ -413,8 +413,8 @@ const UIStrings = {
|
|
|
413
413
|
|
|
414
414
|
/** Descriptive explanation for emulation setting when no device emulation is set. */
|
|
415
415
|
runtimeNoEmulation: 'No emulation',
|
|
416
|
-
/** Descriptive explanation for emulation setting when emulating a Moto
|
|
417
|
-
runtimeMobileEmulation: 'Emulated Moto
|
|
416
|
+
/** Descriptive explanation for emulation setting when emulating a Moto G Power mobile device. */
|
|
417
|
+
runtimeMobileEmulation: 'Emulated Moto G Power',
|
|
418
418
|
/** Descriptive explanation for emulation setting when emulating a generic desktop form factor, as opposed to a mobile-device like form factor. */
|
|
419
419
|
runtimeDesktopEmulation: 'Emulated Desktop',
|
|
420
420
|
/** Descriptive explanation for a runtime setting that is set to an unknown value. */
|
|
@@ -160,7 +160,7 @@ describe('PerfCategoryRenderer', () => {
|
|
|
160
160
|
const oppElements = [...categoryDOM.querySelectorAll('.lh-audit--load-opportunity')];
|
|
161
161
|
expect(oppElements.map(e => e.id).sort()).toEqual(oppAudits.map(a => a.id).sort());
|
|
162
162
|
expect(oppElements.length).toBeGreaterThan(0);
|
|
163
|
-
expect(oppElements.length).toMatchInlineSnapshot('
|
|
163
|
+
expect(oppElements.length).toMatchInlineSnapshot('6');
|
|
164
164
|
|
|
165
165
|
const oppElement = oppElements[0];
|
|
166
166
|
const oppSparklineBarElement = oppElement.querySelector('.lh-sparkline__bar');
|
|
@@ -217,11 +217,11 @@ describe('ReportRenderer', () => {
|
|
|
217
217
|
expect(items.length).toBeGreaterThanOrEqual(6);
|
|
218
218
|
|
|
219
219
|
const itemsTxt = items.map(el => `${el.textContent} ${el.title}`).join('\n');
|
|
220
|
-
expect(itemsTxt).toContain('Moto
|
|
220
|
+
expect(itemsTxt).toContain('Moto G Power');
|
|
221
221
|
expect(itemsTxt).toContain('RTT');
|
|
222
222
|
expect(itemsTxt).toMatch(/\dx/);
|
|
223
223
|
expect(itemsTxt).toContain(sampleResults.environment.networkUserAgent);
|
|
224
|
-
expect(itemsTxt).toMatch('
|
|
224
|
+
expect(itemsTxt).toMatch('412x823, DPR 1.75');
|
|
225
225
|
});
|
|
226
226
|
});
|
|
227
227
|
|
|
@@ -40,9 +40,9 @@ describe('util helpers', () => {
|
|
|
40
40
|
it('builds device emulation string', () => {
|
|
41
41
|
const get = settings => ReportUtils.getEmulationDescriptions(settings).deviceEmulation;
|
|
42
42
|
/* eslint-disable max-len */
|
|
43
|
-
assert.equal(get({formFactor: 'mobile', screenEmulation: {disabled: false, mobile: true}}), 'Emulated Moto
|
|
43
|
+
assert.equal(get({formFactor: 'mobile', screenEmulation: {disabled: false, mobile: true}}), 'Emulated Moto G Power');
|
|
44
44
|
assert.equal(get({formFactor: 'mobile', screenEmulation: {disabled: true, mobile: true}}), 'No emulation');
|
|
45
|
-
assert.equal(get({formFactor: 'mobile', screenEmulation: {disabled: true, mobile: true}, channel: 'devtools'}), 'Emulated Moto
|
|
45
|
+
assert.equal(get({formFactor: 'mobile', screenEmulation: {disabled: true, mobile: true}, channel: 'devtools'}), 'Emulated Moto G Power');
|
|
46
46
|
assert.equal(get({formFactor: 'desktop', screenEmulation: {disabled: false, mobile: false}}), 'Emulated Desktop');
|
|
47
47
|
assert.equal(get({formFactor: 'desktop', screenEmulation: {disabled: true, mobile: false}}), 'No emulation');
|
|
48
48
|
assert.equal(get({formFactor: 'desktop', screenEmulation: {disabled: true, mobile: true}, channel: 'devtools'}), 'Emulated Desktop');
|
|
@@ -3084,7 +3084,7 @@
|
|
|
3084
3084
|
"message": "Emulated Desktop"
|
|
3085
3085
|
},
|
|
3086
3086
|
"report/renderer/report-utils.js | runtimeMobileEmulation": {
|
|
3087
|
-
"message": "Emulated Moto
|
|
3087
|
+
"message": "Emulated Moto G Power"
|
|
3088
3088
|
},
|
|
3089
3089
|
"report/renderer/report-utils.js | runtimeNoEmulation": {
|
|
3090
3090
|
"message": "No emulation"
|
|
@@ -3084,7 +3084,7 @@
|
|
|
3084
3084
|
"message": "Êḿûĺât́êd́ D̂éŝḱt̂óp̂"
|
|
3085
3085
|
},
|
|
3086
3086
|
"report/renderer/report-utils.js | runtimeMobileEmulation": {
|
|
3087
|
-
"message": "Êḿûĺât́êd́ M̂ót̂ó Ĝ
|
|
3087
|
+
"message": "Êḿûĺât́êd́ M̂ót̂ó Ĝ Ṕôẃêŕ"
|
|
3088
3088
|
},
|
|
3089
3089
|
"report/renderer/report-utils.js | runtimeNoEmulation": {
|
|
3090
3090
|
"message": "N̂ó êḿûĺât́îón̂"
|