Reland "[Lighthouse] Rename Audits panel to Lighthouse"

This reverts commit 065146856295c7ebf01d538820d3f2e60c383335.

Reason for revert: Cause of failure has been remedied. See: https://chromium-review.googlesource.com/c/chromium/src/+/2055398

Original change's description:
> Revert "[Lighthouse] Rename Audits panel to Lighthouse"
>
> This reverts commit 2ae53ef04d84c4201836eb63238e97bc180ea54d.
>
> Reason for revert: This CL breaks CI: https://ci.chromium.org/p/devtools-frontend/builders/ci/DevTools%20Linux/453. It looks like the layout test expects audits not lighthouse in the name, so it's probably in need of a 3-way merge.
>
> Original change's description:
> > [Lighthouse] Rename Audits panel to Lighthouse
> >
> > Change-Id: Ia2ab175d2a3b6c8ded73aff8ff0f5582f5a8fa0c
> > Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2044605
> > Commit-Queue: Connor Clark <cjamcl@chromium.org>
> > Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
> > Reviewed-by: Paul Irish <paulirish@chromium.org>
>
> TBR=paulirish@chromium.org,aerotwist@chromium.org,tvanderlippe@chromium.org,cjamcl@chromium.org
>
> Change-Id: Ia6d5f42a0e6ece4352696c51bf0de5754774cb0a
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2051983
> Reviewed-by: Paul Lewis <aerotwist@chromium.org>
> Commit-Queue: Paul Lewis <aerotwist@chromium.org>

TBR=paulirish@chromium.org,aerotwist@chromium.org,tvanderlippe@chromium.org,cjamcl@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 1052111
Change-Id: I638ca9bd5cd94e02fb7318f2a7d7c66fca40e6c8
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2056866
Reviewed-by: Connor Clark <cjamcl@chromium.org>
Reviewed-by: Paul Irish <paulirish@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Connor Clark <cjamcl@chromium.org>
diff --git a/front_end/lighthouse/LighthouseController.js b/front_end/lighthouse/LighthouseController.js
new file mode 100644
index 0000000..c951078
--- /dev/null
+++ b/front_end/lighthouse/LighthouseController.js
@@ -0,0 +1,289 @@
+// Copyright 2018 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * @implements {SDK.SDKModelObserver<!SDK.ServiceWorkerManager>}
+ * @unrestricted
+ */
+export class LighthouseController extends Common.Object {
+  constructor(protocolService) {
+    super();
+
+    protocolService.registerStatusCallback(
+        message => this.dispatchEventToListeners(Events.AuditProgressChanged, {message}));
+
+    for (const preset of Presets) {
+      preset.setting.addChangeListener(this.recomputePageAuditability.bind(this));
+    }
+
+    self.SDK.targetManager.observeModels(SDK.ServiceWorkerManager, this);
+    self.SDK.targetManager.addEventListener(
+        SDK.TargetManager.Events.InspectedURLChanged, this.recomputePageAuditability, this);
+  }
+
+  /**
+   * @override
+   * @param {!SDK.ServiceWorkerManager} serviceWorkerManager
+   */
+  modelAdded(serviceWorkerManager) {
+    if (this._manager) {
+      return;
+    }
+
+    this._manager = serviceWorkerManager;
+    this._serviceWorkerListeners = [
+      this._manager.addEventListener(
+          SDK.ServiceWorkerManager.Events.RegistrationUpdated, this.recomputePageAuditability, this),
+      this._manager.addEventListener(
+          SDK.ServiceWorkerManager.Events.RegistrationDeleted, this.recomputePageAuditability, this),
+    ];
+
+    this.recomputePageAuditability();
+  }
+
+  /**
+   * @override
+   * @param {!SDK.ServiceWorkerManager} serviceWorkerManager
+   */
+  modelRemoved(serviceWorkerManager) {
+    if (this._manager !== serviceWorkerManager) {
+      return;
+    }
+
+    Common.EventTarget.removeEventListeners(this._serviceWorkerListeners);
+    this._manager = null;
+    this.recomputePageAuditability();
+  }
+
+  /**
+   * @return {boolean}
+   */
+  _hasActiveServiceWorker() {
+    if (!this._manager) {
+      return false;
+    }
+
+    const mainTarget = this._manager.target();
+    if (!mainTarget) {
+      return false;
+    }
+
+    const inspectedURL = Common.ParsedURL.fromString(mainTarget.inspectedURL());
+    const inspectedOrigin = inspectedURL && inspectedURL.securityOrigin();
+    for (const registration of this._manager.registrations().values()) {
+      if (registration.securityOrigin !== inspectedOrigin) {
+        continue;
+      }
+
+      for (const version of registration.versions.values()) {
+        if (version.controlledClients.length > 1) {
+          return true;
+        }
+      }
+    }
+
+    return false;
+  }
+
+  /**
+   * @return {boolean}
+   */
+  _hasAtLeastOneCategory() {
+    return Presets.some(preset => preset.setting.get());
+  }
+
+  /**
+   * @return {?string}
+   */
+  _unauditablePageMessage() {
+    if (!this._manager) {
+      return null;
+    }
+
+    const mainTarget = this._manager.target();
+    const inspectedURL = mainTarget && mainTarget.inspectedURL();
+    if (inspectedURL && !/^(http|chrome-extension)/.test(inspectedURL)) {
+      return Common.UIString(
+          'Can only audit HTTP/HTTPS pages and Chrome extensions. Navigate to a different page to start an audit.');
+    }
+
+    return null;
+  }
+
+  /**
+   * @return {!Promise<string>}
+   */
+  async _evaluateInspectedURL() {
+    const mainTarget = this._manager.target();
+    const runtimeModel = mainTarget.model(SDK.RuntimeModel);
+    const executionContext = runtimeModel && runtimeModel.defaultExecutionContext();
+    let inspectedURL = mainTarget.inspectedURL();
+    if (!executionContext) {
+      return inspectedURL;
+    }
+
+    // Evaluate location.href for a more specific URL than inspectedURL provides so that SPA hash navigation routes
+    // will be respected and audited.
+    try {
+      const result = await executionContext.evaluate(
+          {
+            expression: 'window.location.href',
+            objectGroup: 'lighthouse',
+            includeCommandLineAPI: false,
+            silent: false,
+            returnByValue: true,
+            generatePreview: false
+          },
+          /* userGesture */ false, /* awaitPromise */ false);
+      if (!result.exceptionDetails && result.object) {
+        inspectedURL = result.object.value;
+        result.object.release();
+      }
+    } catch (err) {
+      console.error(err);
+    }
+
+    return inspectedURL;
+  }
+
+  /**
+   * @return {!Object}
+   */
+  getFlags() {
+    const flags = {
+      // DevTools handles all the emulation. This tells Lighthouse to not bother with emulation.
+      internalDisableDeviceScreenEmulation: true
+    };
+    for (const runtimeSetting of RuntimeSettings) {
+      runtimeSetting.setFlags(flags, runtimeSetting.setting.get());
+    }
+    return flags;
+  }
+
+  /**
+   * @return {!Array<string>}
+   */
+  getCategoryIDs() {
+    const categoryIDs = [];
+    for (const preset of Presets) {
+      if (preset.setting.get()) {
+        categoryIDs.push(preset.configID);
+      }
+    }
+    return categoryIDs;
+  }
+
+  /**
+   * @param {{force: boolean}=} options
+   * @return {!Promise<string>}
+   */
+  async getInspectedURL(options) {
+    if (options && options.force || !this._inspectedURL) {
+      this._inspectedURL = await this._evaluateInspectedURL();
+    }
+    return this._inspectedURL;
+  }
+
+  recomputePageAuditability() {
+    const hasActiveServiceWorker = this._hasActiveServiceWorker();
+    const hasAtLeastOneCategory = this._hasAtLeastOneCategory();
+    const unauditablePageMessage = this._unauditablePageMessage();
+
+    let helpText = '';
+    if (hasActiveServiceWorker) {
+      helpText = Common.UIString(
+          'Multiple tabs are being controlled by the same service worker. Close your other tabs on the same origin to audit this page.');
+    } else if (!hasAtLeastOneCategory) {
+      helpText = Common.UIString('At least one category must be selected.');
+    } else if (unauditablePageMessage) {
+      helpText = unauditablePageMessage;
+    }
+
+    this.dispatchEventToListeners(Events.PageAuditabilityChanged, {helpText});
+  }
+}
+
+/** @type {!Array.<!Lighthouse.Preset>} */
+export const Presets = [
+  // configID maps to Lighthouse's Object.keys(config.categories)[0] value
+  {
+    setting: self.Common.settings.createSetting('lighthouse.cat_perf', true),
+    configID: 'performance',
+    title: ls`Performance`,
+    description: ls`How long does this app take to show content and become usable`
+  },
+  {
+    setting: self.Common.settings.createSetting('lighthouse.cat_pwa', true),
+    configID: 'pwa',
+    title: ls`Progressive Web App`,
+    description: ls`Does this page meet the standard of a Progressive Web App`
+  },
+  {
+    setting: self.Common.settings.createSetting('lighthouse.cat_best_practices', true),
+    configID: 'best-practices',
+    title: ls`Best practices`,
+    description: ls`Does this page follow best practices for modern web development`
+  },
+  {
+    setting: self.Common.settings.createSetting('lighthouse.cat_a11y', true),
+    configID: 'accessibility',
+    title: ls`Accessibility`,
+    description: ls`Is this page usable by people with disabilities or impairments`
+  },
+  {
+    setting: self.Common.settings.createSetting('lighthouse.cat_seo', true),
+    configID: 'seo',
+    title: ls`SEO`,
+    description: ls`Is this page optimized for search engine results ranking`
+  },
+  {
+    setting: self.Common.settings.createSetting('lighthouse.cat_pubads', false),
+    plugin: true,
+    configID: 'lighthouse-plugin-publisher-ads',
+    title: ls`Publisher Ads`,
+    description: ls`Is this page optimized for ad speed and quality`
+  },
+];
+
+/** @type {!Array.<!Lighthouse.RuntimeSetting>} */
+export const RuntimeSettings = [
+  {
+    setting: self.Common.settings.createSetting('lighthouse.device_type', 'mobile'),
+    description: ls`Apply mobile emulation during auditing`,
+    setFlags: (flags, value) => {
+      // See Audits.AuditsPanel._setupEmulationAndProtocolConnection()
+      flags.emulatedFormFactor = value;
+    },
+    options: [
+      {label: ls`Mobile`, value: 'mobile'},
+      {label: ls`Desktop`, value: 'desktop'},
+    ],
+  },
+  {
+    // This setting is disabled, but we keep it around to show in the UI.
+    setting: self.Common.settings.createSetting('lighthouse.throttling', true),
+    title: ls`Simulated throttling`,
+    // We will disable this when we have a Lantern trace viewer within DevTools.
+    learnMore:
+        'https://github.com/GoogleChrome/lighthouse/blob/master/docs/throttling.md#devtools-lighthouse-panel-throttling',
+    setFlags: (flags, value) => {
+      flags.throttlingMethod = value ? 'simulate' : 'devtools';
+    },
+  },
+  {
+    setting: self.Common.settings.createSetting('lighthouse.clear_storage', true),
+    title: ls`Clear storage`,
+    description: ls`Reset storage (localStorage, IndexedDB, etc) before auditing. (Good for performance & PWA testing)`,
+    setFlags: (flags, value) => {
+      flags.disableStorageReset = !value;
+    },
+  },
+];
+
+export const Events = {
+  PageAuditabilityChanged: Symbol('PageAuditabilityChanged'),
+  AuditProgressChanged: Symbol('AuditProgressChanged'),
+  RequestLighthouseStart: Symbol('RequestLighthouseStart'),
+  RequestLighthouseCancel: Symbol('RequestLighthouseCancel'),
+};
diff --git a/front_end/lighthouse/LighthousePanel.js b/front_end/lighthouse/LighthousePanel.js
new file mode 100644
index 0000000..8165055
--- /dev/null
+++ b/front_end/lighthouse/LighthousePanel.js
@@ -0,0 +1,385 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+import * as Common from '../common/common.js';  // eslint-disable-line no-unused-vars
+
+import {Events, LighthouseController} from './LighthouseController.js';
+import {ProtocolService} from './LighthouseProtocolService.js';
+import {LighthouseReportRenderer, LighthouseReportUIFeatures} from './LighthouseReportRenderer.js';
+import {Item, ReportSelector} from './LighthouseReportSelector.js';
+import {StartView} from './LighthouseStartView.js';
+import {StatusView} from './LighthouseStatusView.js';
+
+/**
+ * @unrestricted
+ */
+export class LighthousePanel extends UI.Panel {
+  constructor() {
+    super('lighthouse');
+    this.registerRequiredCSS('lighthouse/lighthouse/report.css');
+    this.registerRequiredCSS('lighthouse/lighthousePanel.css');
+
+    this._protocolService = new ProtocolService();
+    this._controller = new LighthouseController(this._protocolService);
+    this._startView = new StartView(this._controller);
+    this._statusView = new StatusView(this._controller);
+
+    this._unauditableExplanation = null;
+    this._cachedRenderedReports = new Map();
+
+    this._dropTarget = new UI.DropTarget(
+        this.contentElement, [UI.DropTarget.Type.File], Common.UIString.UIString('Drop Lighthouse JSON here'),
+        this._handleDrop.bind(this));
+
+    this._controller.addEventListener(Events.PageAuditabilityChanged, this._refreshStartAuditUI.bind(this));
+    this._controller.addEventListener(Events.AuditProgressChanged, this._refreshStatusUI.bind(this));
+    this._controller.addEventListener(Events.RequestLighthouseStart, this._startLighthouse.bind(this));
+    this._controller.addEventListener(Events.RequestLighthouseCancel, this._cancelLighthouse.bind(this));
+
+    this._renderToolbar();
+    this._auditResultsElement = this.contentElement.createChild('div', 'lighthouse-results-container');
+    this._renderStartView();
+
+    this._controller.recomputePageAuditability();
+  }
+
+  /**
+   * @param {!Common.EventTarget.EventTargetEvent} evt
+   */
+  _refreshStartAuditUI(evt) {
+    // PageAuditabilityChanged fires multiple times during an audit, which we want to ignore.
+    if (this._isLHAttached) {
+      return;
+    }
+
+    this._unauditableExplanation = evt.data.helpText;
+    this._startView.setUnauditableExplanation(evt.data.helpText);
+    this._startView.setStartButtonEnabled(!evt.data.helpText);
+  }
+
+  /**
+   * @param {!Common.EventTarget.EventTargetEvent} evt
+   */
+  _refreshStatusUI(evt) {
+    this._statusView.updateStatus(evt.data.message);
+  }
+
+  _refreshToolbarUI() {
+    this._clearButton.setEnabled(this._reportSelector.hasItems());
+  }
+
+  _clearAll() {
+    this._reportSelector.clearAll();
+    this._renderStartView();
+    this._refreshToolbarUI();
+  }
+
+  _renderToolbar() {
+    const lighthouseToolbarContainer = this.element.createChild('div', 'lighthouse-toolbar-container');
+
+    const toolbar = new UI.Toolbar('', lighthouseToolbarContainer);
+
+    this._newButton = new UI.ToolbarButton(Common.UIString.UIString('Perform an audit\u2026'), 'largeicon-add');
+    toolbar.appendToolbarItem(this._newButton);
+    this._newButton.addEventListener(UI.ToolbarButton.Events.Click, this._renderStartView.bind(this));
+
+    toolbar.appendSeparator();
+
+    this._reportSelector = new ReportSelector(() => this._renderStartView());
+    toolbar.appendToolbarItem(this._reportSelector.comboBox());
+
+    this._clearButton = new UI.ToolbarButton(Common.UIString.UIString('Clear all'), 'largeicon-clear');
+    toolbar.appendToolbarItem(this._clearButton);
+    this._clearButton.addEventListener(UI.ToolbarButton.Events.Click, this._clearAll.bind(this));
+
+    this._settingsPane = new UI.HBox();
+    this._settingsPane.show(this.contentElement);
+    this._settingsPane.element.classList.add('lighthouse-settings-pane');
+    this._settingsPane.element.appendChild(this._startView.settingsToolbar().element);
+    this._showSettingsPaneSetting = self.Common.settings.createSetting('lighthouseShowSettingsToolbar', false);
+
+    this._rightToolbar = new UI.Toolbar('', lighthouseToolbarContainer);
+    this._rightToolbar.appendSeparator();
+    this._rightToolbar.appendToolbarItem(
+        new UI.ToolbarSettingToggle(this._showSettingsPaneSetting, 'largeicon-settings-gear', ls`Lighthouse settings`));
+    this._showSettingsPaneSetting.addChangeListener(this._updateSettingsPaneVisibility.bind(this));
+    this._updateSettingsPaneVisibility();
+
+    this._refreshToolbarUI();
+  }
+
+  _updateSettingsPaneVisibility() {
+    this._settingsPane.element.classList.toggle('hidden', !this._showSettingsPaneSetting.get());
+  }
+
+  /**
+   * @param {boolean} show
+   */
+  _toggleSettingsDisplay(show) {
+    this._rightToolbar.element.classList.toggle('hidden', !show);
+    this._settingsPane.element.classList.toggle('hidden', !show);
+    this._updateSettingsPaneVisibility();
+  }
+
+  _renderStartView() {
+    this._auditResultsElement.removeChildren();
+    this._statusView.hide();
+
+    this._reportSelector.selectNewReport();
+    this.contentElement.classList.toggle('in-progress', false);
+
+    this._startView.show(this.contentElement);
+    this._toggleSettingsDisplay(true);
+    this._startView.setUnauditableExplanation(this._unauditableExplanation);
+    this._startView.setStartButtonEnabled(!this._unauditableExplanation);
+    if (!this._unauditableExplanation) {
+      this._startView.focusStartButton();
+    }
+
+    this._newButton.setEnabled(false);
+    this._refreshToolbarUI();
+    this.setDefaultFocusedChild(this._startView);
+  }
+
+  /**
+   * @param {string} inspectedURL
+   */
+  _renderStatusView(inspectedURL) {
+    this.contentElement.classList.toggle('in-progress', true);
+    this._statusView.setInspectedURL(inspectedURL);
+    this._statusView.show(this.contentElement);
+  }
+
+  _beforePrint() {
+    this._statusView.show(this.contentElement);
+    this._statusView.toggleCancelButton(false);
+    this._statusView.renderText(ls`Printing`, ls`The print popup window is open. Please close it to continue.`);
+  }
+
+  _afterPrint() {
+    this._statusView.hide();
+    this._statusView.toggleCancelButton(true);
+  }
+
+  /**
+   * @param {!ReportRenderer.ReportJSON} lighthouseResult
+   * @param {!ReportRenderer.RunnerResultArtifacts=} artifacts
+   */
+  _renderReport(lighthouseResult, artifacts) {
+    this._toggleSettingsDisplay(false);
+    this.contentElement.classList.toggle('in-progress', false);
+    this._startView.hideWidget();
+    this._statusView.hide();
+    this._auditResultsElement.removeChildren();
+    this._newButton.setEnabled(true);
+    this._refreshToolbarUI();
+
+    const cachedRenderedReport = this._cachedRenderedReports.get(lighthouseResult);
+    if (cachedRenderedReport) {
+      this._auditResultsElement.appendChild(cachedRenderedReport);
+      return;
+    }
+
+    const reportContainer = this._auditResultsElement.createChild('div', 'lh-vars lh-root lh-devtools');
+
+    const dom = new DOM(/** @type {!Document} */ (this._auditResultsElement.ownerDocument));
+    const renderer = new LighthouseReportRenderer(dom);
+
+    const templatesHTML = Root.Runtime.cachedResources['lighthouse/lighthouse/templates.html'];
+    const templatesDOM = new DOMParser().parseFromString(templatesHTML, 'text/html');
+    if (!templatesDOM) {
+      return;
+    }
+
+    renderer.setTemplateContext(templatesDOM);
+    const el = renderer.renderReport(lighthouseResult, reportContainer);
+    LighthouseReportRenderer.addViewTraceButton(el, artifacts);
+    // Linkifying requires the target be loaded. Do not block the report
+    // from rendering, as this is just an embellishment and the main target
+    // could take awhile to load.
+    this._waitForMainTargetLoad().then(() => {
+      LighthouseReportRenderer.linkifyNodeDetails(el);
+      LighthouseReportRenderer.linkifySourceLocationDetails(el);
+    });
+    LighthouseReportRenderer.handleDarkMode(el);
+
+    const features = new LighthouseReportUIFeatures(dom);
+    features.setBeforePrint(this._beforePrint.bind(this));
+    features.setAfterPrint(this._afterPrint.bind(this));
+    features.setTemplateContext(templatesDOM);
+    features.initFeatures(lighthouseResult);
+
+    this._cachedRenderedReports.set(lighthouseResult, reportContainer);
+  }
+
+  _waitForMainTargetLoad() {
+    const mainTarget = self.SDK.targetManager.mainTarget();
+    const resourceTreeModel = mainTarget.model(SDK.ResourceTreeModel);
+    return resourceTreeModel.once(SDK.ResourceTreeModel.Events.Load);
+  }
+
+  /**
+   * @param {!ReportRenderer.ReportJSON} lighthouseResult
+   * @param {!ReportRenderer.RunnerResultArtifacts=} artifacts
+   */
+  _buildReportUI(lighthouseResult, artifacts) {
+    if (lighthouseResult === null) {
+      return;
+    }
+
+    const optionElement = new Item(
+        lighthouseResult, () => this._renderReport(lighthouseResult, artifacts), this._renderStartView.bind(this));
+    this._reportSelector.prepend(optionElement);
+    this._refreshToolbarUI();
+    this._renderReport(lighthouseResult);
+  }
+
+  /**
+   * @param {!DataTransfer} dataTransfer
+   */
+  _handleDrop(dataTransfer) {
+    const items = dataTransfer.items;
+    if (!items.length) {
+      return;
+    }
+    const item = items[0];
+    if (item.kind === 'file') {
+      const entry = items[0].webkitGetAsEntry();
+      if (!entry.isFile) {
+        return;
+      }
+      entry.file(file => {
+        const reader = new FileReader();
+        reader.onload = () => this._loadedFromFile(/** @type {string} */ (reader.result));
+        reader.readAsText(file);
+      });
+    }
+  }
+
+  /**
+   * @param {string} report
+   */
+  _loadedFromFile(report) {
+    const data = JSON.parse(report);
+    if (!data['lighthouseVersion']) {
+      return;
+    }
+    this._buildReportUI(/** @type {!ReportRenderer.ReportJSON} */ (data));
+  }
+
+  /**
+   * @param {!Common.EventTarget.EventTargetEvent} event
+   */
+  async _startLighthouse(event) {
+    Host.userMetrics.actionTaken(Host.UserMetrics.Action.LighthouseStarted);
+
+    try {
+      const inspectedURL = await this._controller.getInspectedURL({force: true});
+      const categoryIDs = this._controller.getCategoryIDs();
+      const flags = this._controller.getFlags();
+
+      await this._setupEmulationAndProtocolConnection();
+
+      this._renderStatusView(inspectedURL);
+
+      const lighthouseResponse = await this._protocolService.startLighthouse(inspectedURL, categoryIDs, flags);
+
+      if (lighthouseResponse && lighthouseResponse.fatal) {
+        const error = new Error(lighthouseResponse.message);
+        error.stack = lighthouseResponse.stack;
+        throw error;
+      }
+
+      if (!lighthouseResponse) {
+        throw new Error('Auditing failed to produce a result');
+      }
+
+      Host.userMetrics.actionTaken(Host.UserMetrics.Action.LighthouseFinished);
+
+      await this._resetEmulationAndProtocolConnection();
+      this._buildReportUI(lighthouseResponse.lhr, lighthouseResponse.artifacts);
+      // Give focus to the new audit button when completed
+      this._newButton.element.focus();
+      const keyboardInitiated = /** @type {boolean} */ (event.data);
+      if (keyboardInitiated) {
+        UI.markAsFocusedByKeyboard(this._newButton.element);
+      }
+    } catch (err) {
+      await this._resetEmulationAndProtocolConnection();
+      if (err instanceof Error) {
+        this._statusView.renderBugReport(err);
+      }
+    }
+  }
+
+  async _cancelLighthouse() {
+    this._statusView.updateStatus(ls`Cancelling`);
+    await this._resetEmulationAndProtocolConnection();
+    this._renderStartView();
+  }
+
+  /**
+   * We set the device emulation on the DevTools-side for two reasons:
+   * 1. To workaround some odd device metrics emulation bugs like occuluding viewports
+   * 2. To get the attractive device outline
+   *
+   * We also set flags.internalDisableDeviceScreenEmulation = true to let LH only apply UA emulation
+   */
+  async _setupEmulationAndProtocolConnection() {
+    const flags = this._controller.getFlags();
+
+    const emulationModel = self.singleton(Emulation.DeviceModeModel);
+    this._stateBefore = {
+      emulation: {
+        enabled: emulationModel.enabledSetting().get(),
+        outlineEnabled: emulationModel.deviceOutlineSetting().get(),
+        toolbarControlsEnabled: emulationModel.toolbarControlsEnabledSetting().get()
+      },
+      network: {conditions: self.SDK.multitargetNetworkManager.networkConditions()}
+    };
+
+    emulationModel.toolbarControlsEnabledSetting().set(false);
+    if (flags.emulatedFormFactor === 'desktop') {
+      emulationModel.enabledSetting().set(false);
+      emulationModel.emulate(Emulation.DeviceModeModel.Type.None, null, null);
+    } else if (flags.emulatedFormFactor === 'mobile') {
+      emulationModel.enabledSetting().set(true);
+      emulationModel.deviceOutlineSetting().set(true);
+
+      for (const device of Emulation.EmulatedDevicesList.instance().standard()) {
+        if (device.title === 'Nexus 5X') {
+          emulationModel.emulate(Emulation.DeviceModeModel.Type.Device, device, device.modes[0], 1);
+        }
+      }
+    }
+
+    await this._protocolService.attach();
+    this._isLHAttached = true;
+  }
+
+  async _resetEmulationAndProtocolConnection() {
+    if (!this._isLHAttached) {
+      return;
+    }
+
+    this._isLHAttached = false;
+    await this._protocolService.detach();
+
+    if (this._stateBefore) {
+      const emulationModel = self.singleton(Emulation.DeviceModeModel);
+      emulationModel.enabledSetting().set(this._stateBefore.emulation.enabled);
+      emulationModel.deviceOutlineSetting().set(this._stateBefore.emulation.outlineEnabled);
+      emulationModel.toolbarControlsEnabledSetting().set(this._stateBefore.emulation.toolbarControlsEnabled);
+      self.SDK.multitargetNetworkManager.setNetworkConditions(this._stateBefore.network.conditions);
+      delete this._stateBefore;
+    }
+
+    Emulation.InspectedPagePlaceholder.instance().update(true);
+
+    const resourceTreeModel = self.SDK.targetManager.mainTarget().model(SDK.ResourceTreeModel);
+    // reload to reset the page state
+    const inspectedURL = await this._controller.getInspectedURL();
+    await resourceTreeModel.navigate(inspectedURL);
+  }
+}
diff --git a/front_end/lighthouse/LighthouseProtocolService.js b/front_end/lighthouse/LighthouseProtocolService.js
new file mode 100644
index 0000000..4290ede
--- /dev/null
+++ b/front_end/lighthouse/LighthouseProtocolService.js
@@ -0,0 +1,94 @@
+// Copyright 2018 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+export class ProtocolService extends Common.Object {
+  constructor() {
+    super();
+    /** @type {?Protocol.Connection} */
+    this._rawConnection = null;
+    /** @type {?Services.ServiceManager.Service} */
+    this._backend = null;
+    /** @type {?Promise} */
+    this._backendPromise = null;
+    /** @type {?function(string)} */
+    this._status = null;
+  }
+
+  /**
+   * @return {!Promise<undefined>}
+   */
+  async attach() {
+    await self.SDK.targetManager.suspendAllTargets();
+    const childTargetManager = self.SDK.targetManager.mainTarget().model(SDK.ChildTargetManager);
+    this._rawConnection = await childTargetManager.createParallelConnection(this._dispatchProtocolMessage.bind(this));
+  }
+
+  /**
+   * @param {string} auditURL
+   * @param {!Array<string>} categoryIDs
+   * @param {!Object} flags
+   * @return {!Promise<!ReportRenderer.RunnerResult>}
+   */
+  startLighthouse(auditURL, categoryIDs, flags) {
+    return this._send('start', {url: auditURL, categoryIDs, flags});
+  }
+
+  /**
+   * @return {!Promise<undefined>}
+   */
+  async detach() {
+    await this._send('stop');
+    await this._backend.dispose();
+    delete this._backend;
+    delete this._backendPromise;
+    await this._rawConnection.disconnect();
+    await self.SDK.targetManager.resumeAllTargets();
+  }
+
+  /**
+   *  @param {function (string): undefined} callback
+   */
+  registerStatusCallback(callback) {
+    this._status = callback;
+  }
+
+  /**
+   * @param {(!Object|string)} message
+   */
+  _dispatchProtocolMessage(message) {
+    this._send('dispatchProtocolMessage', {message: JSON.stringify(message)});
+  }
+
+  _initWorker() {
+    this._backendPromise =
+        Services.serviceManager.createAppService('lighthouse_worker', 'LighthouseService').then(backend => {
+          if (this._backend) {
+            return;
+          }
+          this._backend = backend;
+          this._backend.on('statusUpdate', result => this._status(result.message));
+          this._backend.on('sendProtocolMessage', result => this._sendProtocolMessage(result.message));
+        });
+  }
+
+  /**
+   * @param {string} message
+   */
+  _sendProtocolMessage(message) {
+    this._rawConnection.sendRawMessage(message);
+  }
+
+  /**
+   * @param {string} method
+   * @param {!Object=} params
+   * @return {!Promise<!ReportRenderer.RunnerResult>}
+   */
+  _send(method, params) {
+    if (!this._backendPromise) {
+      this._initWorker();
+    }
+
+    return this._backendPromise.then(_ => this._backend.send(method, params));
+  }
+}
diff --git a/front_end/lighthouse/LighthouseReportRenderer.js b/front_end/lighthouse/LighthouseReportRenderer.js
new file mode 100644
index 0000000..c31dd2b
--- /dev/null
+++ b/front_end/lighthouse/LighthouseReportRenderer.js
@@ -0,0 +1,187 @@
+// Copyright 2018 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+const MaxLengthForLinks = 40;
+
+/**
+ * @override
+ */
+export class LighthouseReportRenderer extends ReportRenderer {
+  /**
+   * @param {!Element} el Parent element to render the report into.
+   * @param {!ReportRenderer.RunnerResultArtifacts=} artifacts
+   */
+  static addViewTraceButton(el, artifacts) {
+    if (!artifacts || !artifacts.traces || !artifacts.traces.defaultPass) {
+      return;
+    }
+
+    const container = el.querySelector('.lh-audit-group');
+    const columnsEl = container.querySelector('.lh-columns');
+    // There will be no columns if just the PWA category.
+    if (!columnsEl) {
+      return;
+    }
+
+    const defaultPassTrace = artifacts.traces.defaultPass;
+    const timelineButton = UI.createTextButton(Common.UIString('View Trace'), onViewTraceClick, 'view-trace');
+    container.insertBefore(timelineButton, columnsEl.nextSibling);
+
+    async function onViewTraceClick() {
+      Host.userMetrics.actionTaken(Host.UserMetrics.Action.LighthouseViewTrace);
+      await self.UI.inspectorView.showPanel('timeline');
+      Timeline.TimelinePanel.instance().loadFromEvents(defaultPassTrace.traceEvents);
+    }
+  }
+
+  /**
+   * @param {!Element} el
+   */
+  static async linkifyNodeDetails(el) {
+    const mainTarget = self.SDK.targetManager.mainTarget();
+    const domModel = mainTarget.model(SDK.DOMModel);
+
+    for (const origElement of el.getElementsByClassName('lh-node')) {
+      /** @type {!DetailsRenderer.NodeDetailsJSON} */
+      const detailsItem = origElement.dataset;
+      if (!detailsItem.path) {
+        continue;
+      }
+
+      const nodeId = await domModel.pushNodeByPathToFrontend(detailsItem.path);
+
+      if (!nodeId) {
+        continue;
+      }
+      const node = domModel.nodeForId(nodeId);
+      if (!node) {
+        continue;
+      }
+
+      const element = await Common.Linkifier.linkify(node, {tooltip: detailsItem.snippet});
+      origElement.title = '';
+      origElement.textContent = '';
+      origElement.appendChild(element);
+    }
+  }
+
+  /**
+   * @param {!Element} el
+   */
+  static async linkifySourceLocationDetails(el) {
+    for (const origElement of el.getElementsByClassName('lh-source-location')) {
+      /** @type {!DetailsRenderer.SourceLocationDetailsJSON} */
+      const detailsItem = origElement.dataset;
+      if (!detailsItem.sourceUrl || !detailsItem.sourceLine || !detailsItem.sourceColumn) {
+        continue;
+      }
+      const url = detailsItem.sourceUrl;
+      const line = Number(detailsItem.sourceLine);
+      const column = Number(detailsItem.sourceColumn);
+      const element =
+          await Components.Linkifier.linkifyURL(url, {lineNumber: line, column, maxLength: MaxLengthForLinks});
+      origElement.title = '';
+      origElement.textContent = '';
+      origElement.appendChild(element);
+    }
+  }
+
+  /**
+   * @param {!Element} el
+   */
+  static handleDarkMode(el) {
+    if (self.UI.themeSupport.themeName() === 'dark') {
+      el.classList.add('dark');
+    }
+  }
+}
+
+/**
+ * @override
+ */
+export class LighthouseReportUIFeatures extends ReportUIFeatures {
+  /**
+   * @param {!DOM} dom
+   */
+  constructor(dom) {
+    super(dom);
+    this._beforePrint = null;
+    this._afterPrint = null;
+  }
+
+  /**
+   * @param {?function()} beforePrint
+   */
+  setBeforePrint(beforePrint) {
+    this._beforePrint = beforePrint;
+  }
+
+  /**
+   * @param {?function()} afterPrint
+   */
+  setAfterPrint(afterPrint) {
+    this._afterPrint = afterPrint;
+  }
+
+  /**
+   * Returns the html that recreates this report.
+   * @return {string}
+   * @protected
+   */
+  getReportHtml() {
+    this.resetUIState();
+    return Lighthouse.ReportGenerator.generateReportHtml(this.json);
+  }
+
+  /**
+   * Downloads a file (blob) using the system dialog prompt.
+   * @param {!Blob|!File} blob The file to save.
+   */
+  async _saveFile(blob) {
+    const domain = new Common.ParsedURL(this.json.finalUrl).domain();
+    const sanitizedDomain = domain.replace(/[^a-z0-9.-]+/gi, '_');
+    const timestamp = new Date(this.json.fetchTime).toISO8601Compact();
+    const ext = blob.type.match('json') ? '.json' : '.html';
+    const basename = `${sanitizedDomain}-${timestamp}${ext}`;
+    const text = await blob.text();
+    self.Workspace.fileManager.save(basename, text, true /* forceSaveAs */);
+  }
+
+  async _print() {
+    const document = this.getDocument();
+    const clonedReport = document.querySelector('.lh-root').cloneNode(true /* deep */);
+    const printWindow = window.open('', '_blank', 'channelmode=1,status=1,resizable=1');
+    const style = printWindow.document.createElement('style');
+    style.textContent = Root.Runtime.cachedResources['lighthouse/lighthouse/report.css'];
+    printWindow.document.head.appendChild(style);
+    printWindow.document.body.replaceWith(clonedReport);
+    // Linkified nodes are shadow elements, which aren't exposed via `cloneNode`.
+    await LighthouseReportRenderer.linkifyNodeDetails(clonedReport);
+
+    if (this._beforePrint) {
+      this._beforePrint();
+    }
+    printWindow.focus();
+    printWindow.print();
+    printWindow.close();
+    if (this._afterPrint) {
+      this._afterPrint();
+    }
+  }
+
+  /**
+   * @suppress {visibility}
+   * @return {!Document}
+   */
+  getDocument() {
+    return this._document;
+  }
+
+  /**
+   * @suppress {visibility}
+   */
+  resetUIState() {
+    this._resetUIState();
+  }
+}
diff --git a/front_end/lighthouse/LighthouseReportSelector.js b/front_end/lighthouse/LighthouseReportSelector.js
new file mode 100644
index 0000000..0639fde
--- /dev/null
+++ b/front_end/lighthouse/LighthouseReportSelector.js
@@ -0,0 +1,133 @@
+// Copyright 2018 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+export class ReportSelector {
+  constructor(renderNewLighthouseView) {
+    this._renderNewLighthouseView = renderNewLighthouseView;
+    this._newLighthouseItem = createElement('option');
+    this._comboBox = new UI.ToolbarComboBox(this._handleChange.bind(this), ls`Reports`, 'lighthouse-report');
+    this._comboBox.setMaxWidth(180);
+    this._comboBox.setMinWidth(140);
+    this._itemByOptionElement = new Map();
+    this._setEmptyState();
+  }
+
+  _setEmptyState() {
+    this._comboBox.selectElement().removeChildren();
+
+    this._comboBox.setEnabled(false);
+    this._newLighthouseItem = createElement('option');
+    this._newLighthouseItem.label = Common.UIString('(new report)');
+    this._comboBox.selectElement().appendChild(this._newLighthouseItem);
+    this._comboBox.select(this._newLighthouseItem);
+  }
+
+  /**
+   * @param {!Event} event
+   */
+  _handleChange(event) {
+    const item = this._selectedItem();
+    if (item) {
+      item.select();
+    } else {
+      this._renderNewLighthouseView();
+    }
+  }
+
+  /**
+   * @return {!Item}
+   */
+  _selectedItem() {
+    const option = this._comboBox.selectedOption();
+    return this._itemByOptionElement.get(option);
+  }
+
+  /**
+   * @return {boolean}
+   */
+  hasCurrentSelection() {
+    return !!this._selectedItem();
+  }
+
+  /**
+   * @return {boolean}
+   */
+  hasItems() {
+    return this._itemByOptionElement.size > 0;
+  }
+
+  /**
+   * @return {!UI.ToolbarComboBox}
+   */
+  comboBox() {
+    return this._comboBox;
+  }
+
+  /**
+   * @param {!Item} item
+   */
+  prepend(item) {
+    const optionEl = item.optionElement();
+    const selectEl = this._comboBox.selectElement();
+
+    this._itemByOptionElement.set(optionEl, item);
+    selectEl.insertBefore(optionEl, selectEl.firstElementChild);
+    this._comboBox.setEnabled(true);
+    this._comboBox.select(optionEl);
+    item.select();
+  }
+
+  clearAll() {
+    for (const elem of this._comboBox.options()) {
+      if (elem === this._newLighthouseItem) {
+        continue;
+      }
+
+      this._itemByOptionElement.get(elem).delete();
+      this._itemByOptionElement.delete(elem);
+    }
+
+    this._setEmptyState();
+  }
+
+  selectNewReport() {
+    this._comboBox.select(this._newLighthouseItem);
+  }
+}
+
+export class Item {
+  /**
+   * @param {!ReportRenderer.ReportJSON} lighthouseResult
+   * @param {function()} renderReport
+   * @param {function()} showLandingCallback
+   */
+  constructor(lighthouseResult, renderReport, showLandingCallback) {
+    this._lighthouseResult = lighthouseResult;
+    this._renderReport = renderReport;
+    this._showLandingCallback = showLandingCallback;
+
+    const url = new Common.ParsedURL(lighthouseResult.finalUrl);
+    const timestamp = lighthouseResult.fetchTime;
+    this._element = createElement('option');
+    this._element.label = `${new Date(timestamp).toLocaleTimeString()} - ${url.domain()}`;
+  }
+
+  select() {
+    this._renderReport();
+  }
+
+  /**
+   * @return {!Element}
+   */
+  optionElement() {
+    return this._element;
+  }
+
+  delete() {
+    if (this._element) {
+      this._element.remove();
+    }
+    this._showLandingCallback();
+  }
+}
diff --git a/front_end/lighthouse/LighthouseStartView.js b/front_end/lighthouse/LighthouseStartView.js
new file mode 100644
index 0000000..7e6d6b2
--- /dev/null
+++ b/front_end/lighthouse/LighthouseStartView.js
@@ -0,0 +1,185 @@
+// Copyright 2018 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+import {Events, LighthouseController, Presets, RuntimeSettings} from './LighthouseController.js';  // eslint-disable-line no-unused-vars
+import {RadioSetting} from './RadioSetting.js';
+
+/**
+ * @unrestricted
+ */
+export class StartView extends UI.Widget {
+  /**
+   * @param {!LighthouseController} controller
+   */
+  constructor(controller) {
+    super();
+    this.registerRequiredCSS('lighthouse/lighthouseStartView.css');
+    this._controller = controller;
+    this._settingsToolbar = new UI.Toolbar('');
+    this._render();
+  }
+
+  /**
+   * @return {!UI.Toolbar}
+   */
+  settingsToolbar() {
+    return this._settingsToolbar;
+  }
+
+  /**
+   * @param {string} settingName
+   * @param {string} label
+   * @param {!Element} parentElement
+   */
+  _populateRuntimeSettingAsRadio(settingName, label, parentElement) {
+    const runtimeSetting = RuntimeSettings.find(item => item.setting.name === settingName);
+    if (!runtimeSetting || !runtimeSetting.options) {
+      throw new Error(`${settingName} is not a setting with options`);
+    }
+
+    const control = new RadioSetting(runtimeSetting.options, runtimeSetting.setting, runtimeSetting.description);
+    parentElement.appendChild(control.element);
+    UI.ARIAUtils.setAccessibleName(control.element, label);
+  }
+
+  /**
+   * @param {string} settingName
+   * @param {!UI.Toolbar} toolbar
+   */
+  _populateRuntimeSettingAsToolbarCheckbox(settingName, toolbar) {
+    const runtimeSetting = RuntimeSettings.find(item => item.setting.name === settingName);
+    if (!runtimeSetting || !runtimeSetting.title) {
+      throw new Error(`${settingName} is not a setting with a title`);
+    }
+
+    runtimeSetting.setting.setTitle(runtimeSetting.title);
+    const control = new UI.ToolbarSettingCheckbox(runtimeSetting.setting, runtimeSetting.description);
+    toolbar.appendToolbarItem(control);
+    if (runtimeSetting.learnMore) {
+      const link = UI.XLink.create(runtimeSetting.learnMore, ls`Learn more`, 'lighthouse-learn-more');
+      link.style.padding = '5px';
+      control.element.appendChild(link);
+    }
+  }
+
+  /**
+   * @param {!UI.Fragment} fragment
+   */
+  _populateFormControls(fragment) {
+    // Populate the device type
+    const deviceTypeFormElements = fragment.$('device-type-form-elements');
+    this._populateRuntimeSettingAsRadio('lighthouse.device_type', ls`Device`, deviceTypeFormElements);
+
+    // Populate the categories
+    const categoryFormElements = fragment.$('categories-form-elements');
+    const pluginFormElements = fragment.$('plugins-form-elements');
+    for (const preset of Presets) {
+      const formElements = preset.plugin ? pluginFormElements : categoryFormElements;
+      preset.setting.setTitle(preset.title);
+      const checkbox = new UI.ToolbarSettingCheckbox(preset.setting);
+      const row = formElements.createChild('div', 'vbox lighthouse-launcher-row');
+      row.title = preset.description;
+      row.appendChild(checkbox.element);
+    }
+    UI.ARIAUtils.markAsGroup(categoryFormElements);
+    UI.ARIAUtils.setAccessibleName(categoryFormElements, ls`Categories`);
+    UI.ARIAUtils.markAsGroup(pluginFormElements);
+    UI.ARIAUtils.setAccessibleName(pluginFormElements, ls`Community Plugins (beta)`);
+  }
+
+  _render() {
+    this._populateRuntimeSettingAsToolbarCheckbox('lighthouse.clear_storage', this._settingsToolbar);
+    this._populateRuntimeSettingAsToolbarCheckbox('lighthouse.throttling', this._settingsToolbar);
+
+    this._startButton = UI.createTextButton(
+        ls`Generate report`,
+        () => this._controller.dispatchEventToListeners(
+            Events.RequestLighthouseStart,
+            /* keyboardInitiated */ UI.elementIsFocusedByKeyboard(this._startButton)),
+        /* className */ '', /* primary */ true);
+    this.setDefaultFocusedElement(this._startButton);
+
+    const auditsDescription = ls
+    `Identify and fix common problems that affect your site's performance, accessibility, and user experience.`;  // crbug.com/972969
+
+    const fragment = UI.Fragment.build`
+      <div class="vbox lighthouse-start-view">
+        <header>
+          <div class="lighthouse-logo"></div>
+          <div class="lighthouse-start-button-container hbox">
+            ${this._startButton}
+            </div>
+          <div $="help-text" class="lighthouse-help-text hidden"></div>
+          <div class="lighthouse-start-view-text">
+            <span>${auditsDescription}</span>
+            ${UI.XLink.create('https://developers.google.com/web/tools/lighthouse/', ls`Learn more`)}
+          </div>
+        </header>
+        <form>
+          <div class="lighthouse-form-categories">
+            <div class="lighthouse-form-section">
+              <div class="lighthouse-form-section-label">
+                ${ls`Categories`}
+              </div>
+              <div class="lighthouse-form-elements" $="categories-form-elements"></div>
+            </div>
+            <div class="lighthouse-form-section">
+              <div class="lighthouse-form-section-label">
+                <div class="lighthouse-icon-label">${ls`Community Plugins (beta)`}</div>
+              </div>
+              <div class="lighthouse-form-elements" $="plugins-form-elements"></div>
+            </div>
+          </div>
+          <div class="lighthouse-form-section">
+            <div class="lighthouse-form-section-label">
+              ${ls`Device`}
+            </div>
+            <div class="lighthouse-form-elements" $="device-type-form-elements"></div>
+          </div>
+        </form>
+      </div>
+    `;
+
+    this._helpText = fragment.$('help-text');
+    this._populateFormControls(fragment);
+    this.contentElement.appendChild(fragment.element());
+    this.contentElement.style.overflow = 'auto';
+  }
+
+  /**
+   * @override
+   */
+  onResize() {
+    const useNarrowLayout = this.contentElement.offsetWidth < 560;
+    const startViewEl = this.contentElement.querySelector('.lighthouse-start-view');
+    startViewEl.classList.toggle('hbox', !useNarrowLayout);
+    startViewEl.classList.toggle('vbox', useNarrowLayout);
+  }
+
+  focusStartButton() {
+    this._startButton.focus();
+  }
+
+  /**
+   * @param {boolean} isEnabled
+   */
+  setStartButtonEnabled(isEnabled) {
+    if (this._helpText) {
+      this._helpText.classList.toggle('hidden', isEnabled);
+    }
+
+    if (this._startButton) {
+      this._startButton.disabled = !isEnabled;
+    }
+  }
+
+  /**
+   * @param {?string} text
+   */
+  setUnauditableExplanation(text) {
+    if (this._helpText) {
+      this._helpText.textContent = text;
+    }
+  }
+}
diff --git a/front_end/lighthouse/LighthouseStatusView.js b/front_end/lighthouse/LighthouseStatusView.js
new file mode 100644
index 0000000..5014898
--- /dev/null
+++ b/front_end/lighthouse/LighthouseStatusView.js
@@ -0,0 +1,375 @@
+// Copyright 2018 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+import {Events, LighthouseController, RuntimeSettings} from './LighthouseController.js';  // eslint-disable-line no-unused-vars
+
+export class StatusView {
+  /**
+   * @param {!LighthouseController} controller
+   */
+  constructor(controller) {
+    this._controller = controller;
+
+    this._statusView = null;
+    this._statusHeader = null;
+    this._progressWrapper = null;
+    this._progressBar = null;
+    this._statusText = null;
+    this._cancelButton = null;
+
+    this._inspectedURL = '';
+    this._textChangedAt = 0;
+    this._fastFactsQueued = FastFacts.slice();
+    this._currentPhase = null;
+    this._scheduledTextChangeTimeout = null;
+    this._scheduledFastFactTimeout = null;
+
+    this._dialog = new UI.Dialog();
+    this._dialog.setDimmed(true);
+    this._dialog.setCloseOnEscape(false);
+    this._dialog.setOutsideClickCallback(event => event.consume(true));
+    this._render();
+  }
+
+  _render() {
+    const dialogRoot =
+        UI.createShadowRootWithCoreStyles(this._dialog.contentElement, 'lighthouse/lighthouseDialog.css');
+    const lighthouseViewElement = dialogRoot.createChild('div', 'lighthouse-view vbox');
+
+    const cancelButton = UI.createTextButton(ls`Cancel`, this._cancel.bind(this));
+    const fragment = UI.Fragment.build`
+      <div class="lighthouse-view vbox">
+        <h2 $="status-header">Auditing your web page\u2026</h2>
+        <div class="lighthouse-status vbox" $="status-view">
+          <div class="lighthouse-progress-wrapper" $="progress-wrapper">
+            <div class="lighthouse-progress-bar" $="progress-bar"></div>
+          </div>
+          <div class="lighthouse-status-text" $="status-text"></div>
+        </div>
+        ${cancelButton}
+      </div>
+    `;
+
+    lighthouseViewElement.appendChild(fragment.element());
+
+    this._statusView = fragment.$('status-view');
+    this._statusHeader = fragment.$('status-header');
+    this._progressWrapper = fragment.$('progress-wrapper');
+    this._progressBar = fragment.$('progress-bar');
+    this._statusText = fragment.$('status-text');
+    // Use StatusPhases array index as progress bar value
+    UI.ARIAUtils.markAsProgressBar(this._progressBar, 0, StatusPhases.length - 1);
+    this._cancelButton = cancelButton;
+    UI.ARIAUtils.markAsStatus(this._statusText);
+
+    this._dialog.setDefaultFocusedElement(cancelButton);
+    this._dialog.setSizeBehavior(UI.GlassPane.SizeBehavior.SetExactWidthMaxHeight);
+    this._dialog.setMaxContentSize(new UI.Size(500, 400));
+  }
+
+  _reset() {
+    this._resetProgressBarClasses();
+    clearTimeout(this._scheduledFastFactTimeout);
+
+    this._textChangedAt = 0;
+    this._fastFactsQueued = FastFacts.slice();
+    this._currentPhase = null;
+    this._scheduledTextChangeTimeout = null;
+    this._scheduledFastFactTimeout = null;
+  }
+
+  /**
+   * @param {!Element} dialogRenderElement
+   */
+  show(dialogRenderElement) {
+    this._reset();
+    this.updateStatus(ls`Loading\u2026`);
+
+    const parsedURL = Common.ParsedURL.fromString(this._inspectedURL);
+    const pageHost = parsedURL && parsedURL.host;
+    const statusHeader = pageHost ? ls`Auditing ${pageHost}` : ls`Auditing your web page`;
+    this._renderStatusHeader(statusHeader);
+    this._dialog.show(dialogRenderElement);
+  }
+
+  /**
+   * @param {string=} statusHeader
+   */
+  _renderStatusHeader(statusHeader) {
+    this._statusHeader.textContent = `${statusHeader}\u2026`;
+  }
+
+  hide() {
+    if (this._dialog.isShowing()) {
+      this._dialog.hide();
+    }
+  }
+
+  /**
+   * @param {string=} url
+   */
+  setInspectedURL(url = '') {
+    this._inspectedURL = url;
+  }
+
+  /**
+   * @param {?string} message
+   */
+  updateStatus(message) {
+    if (!message || !this._statusText) {
+      return;
+    }
+
+    if (message.startsWith('Cancel')) {
+      this._commitTextChange(Common.UIString('Cancelling\u2026'));
+      clearTimeout(this._scheduledFastFactTimeout);
+      return;
+    }
+
+    const nextPhase = this._getPhaseForMessage(message);
+    const nextPhaseIndex = StatusPhases.indexOf(nextPhase);
+    const currentPhaseIndex = StatusPhases.indexOf(this._currentPhase);
+    if (!nextPhase && !this._currentPhase) {
+      this._commitTextChange(Common.UIString('Lighthouse is warming up\u2026'));
+      clearTimeout(this._scheduledFastFactTimeout);
+    } else if (nextPhase && (!this._currentPhase || currentPhaseIndex < nextPhaseIndex)) {
+      this._currentPhase = nextPhase;
+      const text = this._getMessageForPhase(nextPhase);
+      this._scheduleTextChange(text);
+      this._scheduleFastFactCheck();
+      this._resetProgressBarClasses();
+      this._progressBar.classList.add(nextPhase.progressBarClass);
+      UI.ARIAUtils.setProgressBarValue(this._progressBar, nextPhaseIndex, text);
+    }
+  }
+
+  _cancel() {
+    this._controller.dispatchEventToListeners(Events.RequestLighthouseCancel);
+  }
+
+  /**
+   * @param {!StatusPhases} phase
+   * @return {string}
+   */
+  _getMessageForPhase(phase) {
+    if (phase.message) {
+      return phase.message;
+    }
+
+    const deviceType = RuntimeSettings.find(item => item.setting.name === 'lighthouse.device_type').setting.get();
+    const throttling = RuntimeSettings.find(item => item.setting.name === 'lighthouse.throttling').setting.get();
+    const match = LoadingMessages.find(item => {
+      return item.deviceType === deviceType && item.throttling === throttling;
+    });
+
+    return match ? match.message : ls`Lighthouse is loading your page`;
+  }
+
+  /**
+   * @param {string} message
+   * @return {?StatusPhases}
+   */
+  _getPhaseForMessage(message) {
+    return StatusPhases.find(phase => message.startsWith(phase.statusMessagePrefix));
+  }
+
+  _resetProgressBarClasses() {
+    if (!this._progressBar) {
+      return;
+    }
+
+    this._progressBar.className = 'lighthouse-progress-bar';
+  }
+
+  _scheduleFastFactCheck() {
+    if (!this._currentPhase || this._scheduledFastFactTimeout) {
+      return;
+    }
+
+    this._scheduledFastFactTimeout = setTimeout(() => {
+      this._updateFastFactIfNecessary();
+      this._scheduledFastFactTimeout = null;
+
+      this._scheduleFastFactCheck();
+    }, 100);
+  }
+
+  _updateFastFactIfNecessary() {
+    const now = performance.now();
+    if (now - this._textChangedAt < fastFactRotationInterval) {
+      return;
+    }
+    if (!this._fastFactsQueued.length) {
+      return;
+    }
+
+    const fastFactIndex = Math.floor(Math.random() * this._fastFactsQueued.length);
+    this._scheduleTextChange(ls`\ud83d\udca1 ${this._fastFactsQueued[fastFactIndex]}`);
+    this._fastFactsQueued.splice(fastFactIndex, 1);
+  }
+
+  /**
+   * @param {string} text
+   */
+  _commitTextChange(text) {
+    if (!this._statusText) {
+      return;
+    }
+    this._textChangedAt = performance.now();
+    this._statusText.textContent = text;
+  }
+
+  /**
+   * @param {string} text
+   */
+  _scheduleTextChange(text) {
+    if (this._scheduledTextChangeTimeout) {
+      clearTimeout(this._scheduledTextChangeTimeout);
+    }
+
+    const msSinceLastChange = performance.now() - this._textChangedAt;
+    const msToTextChange = minimumTextVisibilityDuration - msSinceLastChange;
+
+    this._scheduledTextChangeTimeout = setTimeout(() => {
+      this._commitTextChange(text);
+    }, Math.max(msToTextChange, 0));
+  }
+
+  /**
+   * @param {!Error} err
+   */
+  renderBugReport(err) {
+    console.error(err);
+    clearTimeout(this._scheduledFastFactTimeout);
+    clearTimeout(this._scheduledTextChangeTimeout);
+    this._resetProgressBarClasses();
+    this._progressBar.classList.add('errored');
+
+    this._commitTextChange('');
+    this._statusText.createChild('p').createTextChild(Common.UIString('Ah, sorry! We ran into an error.'));
+    if (KnownBugPatterns.some(pattern => pattern.test(err.message))) {
+      const message = Common.UIString(
+          'Try to navigate to the URL in a fresh Chrome profile without any other tabs or extensions open and try again.');
+      this._statusText.createChild('p').createTextChild(message);
+    } else {
+      this._renderBugReportBody(err, this._inspectedURL);
+    }
+  }
+
+  /**
+   * @param {string} statusHeader
+   * @param {string} text
+   */
+  renderText(statusHeader, text) {
+    this._renderStatusHeader(statusHeader);
+    this._commitTextChange(text);
+  }
+
+  /**
+   * @param {boolean} show
+   */
+  toggleCancelButton(show) {
+    this._cancelButton.style.visibility = show ? 'visible' : 'hidden';
+  }
+
+  /**
+   * @param {!Error} err
+   * @param {string} auditURL
+   */
+  _renderBugReportBody(err, auditURL) {
+    const issueBody = `
+${err.message}
+\`\`\`
+Channel: DevTools
+Initial URL: ${auditURL}
+Chrome Version: ${navigator.userAgent.match(/Chrome\/(\S+)/)[1]}
+Stack Trace: ${err.stack}
+\`\`\`
+`;
+    this._statusText.createChild('p').createTextChild(
+        ls`If this issue is reproducible, please report it at the Lighthouse GitHub repo.`);
+    this._statusText.createChild('code', 'monospace').createTextChild(issueBody.trim());
+  }
+}
+
+/** @const */
+export const fastFactRotationInterval = 6000;
+
+/** @const */
+export const minimumTextVisibilityDuration = 3000;
+
+/** @type {!Array.<!RegExp>} */
+const KnownBugPatterns = [
+  /PARSING_PROBLEM/,
+  /DOCUMENT_REQUEST/,
+  /READ_FAILED/,
+  /TRACING_ALREADY_STARTED/,
+  /^You must provide a url to the runner/,
+  /^You probably have multiple tabs open/,
+];
+
+/** @typedef {{message: string, progressBarClass: string}} */
+export const StatusPhases = [
+  {
+    id: 'loading',
+    progressBarClass: 'loading',
+    statusMessagePrefix: 'Loading page',
+  },
+  {
+    id: 'gathering',
+    progressBarClass: 'gathering',
+    message: ls`Lighthouse is gathering information about the page to compute your score.`,
+    statusMessagePrefix: 'Gathering',
+  },
+  {
+    id: 'auditing',
+    progressBarClass: 'auditing',
+    message: ls`Almost there! Lighthouse is now generating your report.`,
+    statusMessagePrefix: 'Auditing',
+  }
+];
+
+/** @typedef {{message: string, deviceType: string, throttling: string}} */
+const LoadingMessages = [
+  {
+    deviceType: 'mobile',
+    throttling: 'on',
+    message: ls`Lighthouse is loading your page with throttling to measure performance on a mobile device on 3G.`,
+  },
+  {
+    deviceType: 'desktop',
+    throttling: 'on',
+    message: ls`Lighthouse is loading your page with throttling to measure performance on a slow desktop on 3G.`,
+  },
+  {
+    deviceType: 'mobile',
+    throttling: 'off',
+    message: ls`Lighthouse is loading your page with mobile emulation.`,
+  },
+  {
+    deviceType: 'desktop',
+    throttling: 'off',
+    message: ls`Lighthouse is loading your page.`,
+  },
+];
+
+const FastFacts = [
+  ls
+`1MB takes a minimum of 5 seconds to download on a typical 3G connection [Source: WebPageTest and DevTools 3G definition].`,
+    ls`Rebuilding Pinterest pages for performance increased conversion rates by 15% [Source: WPO Stats]`, ls
+`By reducing the response size of JSON needed for displaying comments, Instagram saw increased impressions [Source: WPO Stats]`,
+    ls`Walmart saw a 1% increase in revenue for every 100ms improvement in page load [Source: WPO Stats]`, ls
+`If a site takes >1 second to become interactive, users lose attention, and their perception of completing the page task is broken [Source: Google Developers Blog]`,
+    ls`75% of global mobile users in 2016 were on 2G or 3G [Source: GSMA Mobile]`,
+    ls`The average user device costs less than 200 USD. [Source: International Data Corporation]`, ls
+`19 seconds is the average time a mobile web page takes to load on a 3G connection [Source: Google DoubleClick blog]`,
+    ls
+`70% of mobile pages take nearly 7 seconds for the visual content above the fold to display on the screen. [Source: Think with Google]`,
+    ls
+`As page load time increases from one second to seven seconds, the probability of a mobile site visitor bouncing increases 113%. [Source: Think with Google]`,
+    ls
+`As the number of elements on a page increases from 400 to 6,000, the probability of conversion drops 95%. [Source: Think with Google]`,
+    ls`70% of mobile pages weigh over 1MB, 36% over 2MB, and 12% over 4MB. [Source: Think with Google]`, ls
+  `Lighthouse only simulates mobile performance; to measure performance on a real device, try WebPageTest.org [Source: Lighthouse team]`,
+];
diff --git a/front_end/lighthouse/OWNERS b/front_end/lighthouse/OWNERS
new file mode 100644
index 0000000..adbdad6
--- /dev/null
+++ b/front_end/lighthouse/OWNERS
@@ -0,0 +1 @@
+file://LIGHTHOUSE_OWNERS
diff --git a/front_end/lighthouse/RadioSetting.js b/front_end/lighthouse/RadioSetting.js
new file mode 100644
index 0000000..eb43526
--- /dev/null
+++ b/front_end/lighthouse/RadioSetting.js
@@ -0,0 +1,68 @@
+// Copyright 2018 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+export class RadioSetting {
+  /**
+   * @param {!Array<!{value: string, label: string}>} options
+   * @param {!Common.Setting} setting
+   * @param {string} description
+   */
+  constructor(options, setting, description) {
+    this._setting = setting;
+    this._options = options;
+
+    this.element = createElement('div', 'audits-radio-group');
+    this.element.title = description;
+    UI.ARIAUtils.setDescription(this.element, description);
+    UI.ARIAUtils.markAsRadioGroup(this.element);
+
+    this._radioElements = [];
+    for (const option of this._options) {
+      const fragment = UI.Fragment.build`
+        <label $="label" class="audits-radio">
+          <input $="input" type="radio" value=${option.value} name=${setting.name}>
+          ${option.label}
+        </label>
+      `;
+
+      this.element.appendChild(fragment.element());
+      if (option.title) {
+        UI.Tooltip.install(fragment.$('label'), option.title);
+      }
+      const radioElement = fragment.$('input');
+      radioElement.addEventListener('change', this._valueChanged.bind(this));
+      this._radioElements.push(radioElement);
+    }
+
+    this._ignoreChangeEvents = false;
+    this._selectedIndex = -1;
+
+    setting.addChangeListener(this._settingChanged, this);
+    this._settingChanged();
+  }
+
+  _updateUI() {
+    this._ignoreChangeEvents = true;
+    this._radioElements[this._selectedIndex].checked = true;
+    this._ignoreChangeEvents = false;
+  }
+
+  _settingChanged() {
+    const value = this._setting.get();
+    this._selectedIndex = this._options.findIndex(option => option.value === value);
+    this._updateUI();
+  }
+
+  /**
+   * @param {!Event} event
+   */
+  _valueChanged(event) {
+    if (this._ignoreChangeEvents) {
+      return;
+    }
+
+    const selectedRadio = this._radioElements.find(radio => radio.checked);
+    this._setting.set(selectedRadio.value);
+  }
+}
diff --git a/front_end/lighthouse/lighthouse-legacy.js b/front_end/lighthouse/lighthouse-legacy.js
new file mode 100644
index 0000000..772c44a
--- /dev/null
+++ b/front_end/lighthouse/lighthouse-legacy.js
@@ -0,0 +1,32 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+import * as LighthouseModule from './lighthouse.js';
+
+self.Lighthouse = self.Lighthouse || {};
+Lighthouse = Lighthouse || {};
+
+/** @type {!LighthouseReportGenerator} */
+Lighthouse.ReportGenerator;
+
+/**
+ * @constructor
+ */
+Lighthouse.LighthousePanel = LighthouseModule.LighthousePanel.LighthousePanel;
+
+/**
+ * @constructor
+ */
+Lighthouse.ReportSelector = LighthouseModule.LighthouseReportSelector.ReportSelector;
+
+/**
+* @constructor
+*/
+Lighthouse.StatusView = LighthouseModule.LighthouseStatusView.StatusView;
+
+/** @typedef {{setting: !Common.Setting, configID: string, title: string, description: string}} */
+Lighthouse.Preset;
+
+/** @typedef {{setting: !Common.Setting, description: string, setFlags: function(!Object, string), options: (!Array|undefined), title: (string|undefined)}} */
+Lighthouse.RuntimeSetting;
diff --git a/front_end/lighthouse/lighthouse.js b/front_end/lighthouse/lighthouse.js
new file mode 100644
index 0000000..06c0afb
--- /dev/null
+++ b/front_end/lighthouse/lighthouse.js
@@ -0,0 +1,26 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+import './lighthouse/report.js';
+import './lighthouse/report-generator.js';
+
+import * as LighthouseController from './LighthouseController.js';
+import * as LighthousePanel from './LighthousePanel.js';
+import * as LighthouseProtocolService from './LighthouseProtocolService.js';
+import * as LighthouseReportRenderer from './LighthouseReportRenderer.js';
+import * as LighthouseReportSelector from './LighthouseReportSelector.js';
+import * as LighthouseStartView from './LighthouseStartView.js';
+import * as LighthouseStatusView from './LighthouseStatusView.js';
+import * as RadioSetting from './RadioSetting.js';
+
+export {
+  LighthouseController,
+  LighthousePanel,
+  LighthouseProtocolService,
+  LighthouseReportRenderer,
+  LighthouseReportSelector,
+  LighthouseStartView,
+  LighthouseStatusView,
+  RadioSetting,
+};
diff --git a/front_end/lighthouse/lighthouse/LICENSE b/front_end/lighthouse/lighthouse/LICENSE
new file mode 100644
index 0000000..a4c5efd
--- /dev/null
+++ b/front_end/lighthouse/lighthouse/LICENSE
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright 2014 Google Inc.
+
+   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
+
+   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.
diff --git a/front_end/lighthouse/lighthouse/README.chromium b/front_end/lighthouse/lighthouse/README.chromium
new file mode 100644
index 0000000..7619599
--- /dev/null
+++ b/front_end/lighthouse/lighthouse/README.chromium
@@ -0,0 +1,8 @@
+Name: Lighthouse is a performance auditing component written in JavaScript that works in the browser.
+Short Name: lighthouse
+URL: github.com/GoogleChrome/lighthouse
+License: Apache License 2.0
+Security Critical: no
+
+This directory contains Chromium's version of the lighthouse report assets, including renderer.
+
diff --git a/front_end/lighthouse/lighthouse/report-generator.js b/front_end/lighthouse/lighthouse/report-generator.js
new file mode 100644
index 0000000..2a35653
--- /dev/null
+++ b/front_end/lighthouse/lighthouse/report-generator.js
@@ -0,0 +1,160 @@
+(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}(g.Lighthouse || (g.Lighthouse = {})).ReportGenerator = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({"./html/html-report-assets.js":[function(require,module,exports){
+/**
+ * @license Copyright 2019 Google Inc. All Rights Reserved.
+ * 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
+ * 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.
+ */
+'use strict';
+
+/**
+ * @fileoverview Instead of loading report assets form the filesystem, in Devtools we must load
+ * them via Root.Runtime.cachedResources. We use this module to shim
+ * lighthouse-core/report/html/html-report-assets.js in Devtools.
+ */
+
+/* global Root */
+
+// @ts-ignore: Root.Runtime exists in Devtools.
+const cachedResources = Root.Runtime.cachedResources;
+
+// Getters are necessary because the DevTools bundling processes
+// resources after this module is resolved. These properties are not
+// read from immediately, so we can defer reading with getters and everything
+// is going to be OK.
+module.exports = {
+  get REPORT_CSS() {
+    return cachedResources['lighthouse/lighthouse/report.css'];
+  },
+  get REPORT_JAVASCRIPT() {
+    return cachedResources['lighthouse/lighthouse/report.js'];
+  },
+  get REPORT_TEMPLATE() {
+    return cachedResources['lighthouse/lighthouse/template.html'];
+  },
+  get REPORT_TEMPLATES() {
+    return cachedResources['lighthouse/lighthouse/templates.html'];
+  },
+};
+
+},{}],1:[function(require,module,exports){
+/**
+ * @license Copyright 2017 Google Inc. All Rights Reserved.
+ * 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
+ * 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.
+ */
+'use strict';
+
+const htmlReportAssets = require('./html/html-report-assets.js');
+
+class ReportGenerator {
+  /**
+   * Replaces all the specified strings in source without serial replacements.
+   * @param {string} source
+   * @param {!Array<{search: string, replacement: string}>} replacements
+   * @return {string}
+   */
+  static replaceStrings(source, replacements) {
+    if (replacements.length === 0) {
+      return source;
+    }
+
+    const firstReplacement = replacements[0];
+    const nextReplacements = replacements.slice(1);
+    return source
+        .split(firstReplacement.search)
+        .map(part => ReportGenerator.replaceStrings(part, nextReplacements))
+        .join(firstReplacement.replacement);
+  }
+
+  /**
+   * Returns the report HTML as a string with the report JSON and renderer JS inlined.
+   * @param {LH.Result} lhr
+   * @return {string}
+   */
+  static generateReportHtml(lhr) {
+    const sanitizedJson = JSON.stringify(lhr)
+      .replace(/</g, '\\u003c') // replaces opening script tags
+      .replace(/\u2028/g, '\\u2028') // replaces line separators ()
+      .replace(/\u2029/g, '\\u2029'); // replaces paragraph separators
+    const sanitizedJavascript = htmlReportAssets.REPORT_JAVASCRIPT.replace(/<\//g, '\\u003c/');
+
+    return ReportGenerator.replaceStrings(htmlReportAssets.REPORT_TEMPLATE, [
+      {search: '%%LIGHTHOUSE_JSON%%', replacement: sanitizedJson},
+      {search: '%%LIGHTHOUSE_JAVASCRIPT%%', replacement: sanitizedJavascript},
+      {search: '/*%%LIGHTHOUSE_CSS%%*/', replacement: htmlReportAssets.REPORT_CSS},
+      {search: '%%LIGHTHOUSE_TEMPLATES%%', replacement: htmlReportAssets.REPORT_TEMPLATES},
+    ]);
+  }
+
+  /**
+   * Converts the results to a CSV formatted string
+   * Each row describes the result of 1 audit with
+   *  - the name of the category the audit belongs to
+   *  - the name of the audit
+   *  - a description of the audit
+   *  - the score type that is used for the audit
+   *  - the score value of the audit
+   *
+   * @param {LH.Result} lhr
+   * @return {string}
+   */
+  static generateReportCSV(lhr) {
+    // To keep things "official" we follow the CSV specification (RFC4180)
+    // The document describes how to deal with escaping commas and quotes etc.
+    const CRLF = '\r\n';
+    const separator = ',';
+    /** @param {string} value @return {string} */
+    const escape = value => `"${value.replace(/"/g, '""')}"`;
+
+    // Possible TODO: tightly couple headers and row values
+    const header = ['category', 'name', 'title', 'type', 'score'];
+    const table = Object.values(lhr.categories).map(category => {
+      return category.auditRefs.map(auditRef => {
+        const audit = lhr.audits[auditRef.id];
+        // CSV validator wants all scores to be numeric, use -1 for now
+        const numericScore = audit.score === null ? -1 : audit.score;
+        return [category.title, audit.id, audit.title, audit.scoreDisplayMode, numericScore]
+          .map(value => value.toString())
+          .map(escape);
+      });
+    });
+
+    return [header].concat(...table)
+      .map(row => row.join(separator)).join(CRLF);
+  }
+
+  /**
+   * Creates the results output in a format based on the `mode`.
+   * @param {LH.Result} lhr
+   * @param {LH.Config.Settings['output']} outputModes
+   * @return {string|string[]}
+   */
+  static generateReport(lhr, outputModes) {
+    const outputAsArray = Array.isArray(outputModes);
+    if (typeof outputModes === 'string') outputModes = [outputModes];
+
+    const output = outputModes.map(outputMode => {
+      // HTML report.
+      if (outputMode === 'html') {
+        return ReportGenerator.generateReportHtml(lhr);
+      }
+      // CSV report.
+      if (outputMode === 'csv') {
+        return ReportGenerator.generateReportCSV(lhr);
+      }
+      // JSON report.
+      if (outputMode === 'json') {
+        return JSON.stringify(lhr, null, 2);
+      }
+
+      throw new Error('Invalid output mode: ' + outputMode);
+    });
+
+    return outputAsArray ? output : output[0];
+  }
+}
+
+module.exports = ReportGenerator;
+
+},{"./html/html-report-assets.js":"./html/html-report-assets.js"}]},{},[1])(1)
+});
diff --git a/front_end/lighthouse/lighthouse/report.css b/front_end/lighthouse/lighthouse/report.css
new file mode 100644
index 0000000..e6d40ba
--- /dev/null
+++ b/front_end/lighthouse/lighthouse/report.css
@@ -0,0 +1,1509 @@
+/**
+ * @license
+ * Copyright 2017 Google Inc. All Rights Reserved.
+ *
+ * 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
+ *
+ * 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.
+ */
+
+/*
+  Naming convention:
+
+  If a variable is used for a specific component: --{component}-{property name}-{modifier}
+
+  Both {component} and {property name} should be kebab-case. If the target is the entire page,
+  use 'report' for the component. The property name should not be abbreviated. Use the
+  property name the variable is intended for - if it's used for multiple, a common descriptor
+  is fine (ex: 'size' for a variable applied to 'width' and 'height'). If a variable is shared
+  across multiple components, either create more variables or just drop the "{component}-"
+  part of the name. Append any modifiers at the end (ex: 'big', 'dark').
+
+  For colors: --color-{hue}-{intensity}
+
+  {intensity} is the Material Design tag - 700, A700, etc.
+*/
+.lh-vars {
+  /* Palette using Material Design Colors
+   * https://www.materialui.co/colors */
+  --color-amber-50: #FFF8E1;
+  --color-blue-200: #90CAF9;
+  --color-blue-900: #0D47A1;
+  --color-blue-A700: #2962FF;
+  --color-cyan-500: #00BCD4;
+  --color-gray-100: #F5F5F5;
+  --color-gray-200: #E0E0E0;
+  --color-gray-400: #BDBDBD;
+  --color-gray-50: #FAFAFA;
+  --color-gray-500: #9E9E9E;
+  --color-gray-600: #757575;
+  --color-gray-700: #616161;
+  --color-gray-800: #424242;
+  --color-gray-900: #212121;
+  --color-gray: #000000;
+  --color-green-700: #018642;
+  --color-green: #0CCE6B;
+  --color-orange-700: #D04900;
+  --color-orange: #FFA400;
+  --color-red-700: #EB0F00;
+  --color-red: #FF4E42;
+  --color-teal-600: #00897B;
+  --color-white: #FFFFFF;
+
+  /* Context-specific colors */
+  --color-average-secondary: var(--color-orange-700);
+  --color-average: var(--color-orange);
+  --color-fail-secondary: var(--color-red-700);
+  --color-fail: var(--color-red);
+  --color-informative: var(--color-blue-900);
+  --color-pass-secondary: var(--color-green-700);
+  --color-pass: var(--color-green);
+  --color-hover: var(--color-gray-50);
+
+  /* Component variables */
+  --audit-description-padding-left: calc(var(--score-icon-size) + var(--score-icon-margin-left) + var(--score-icon-margin-right));
+  --audit-explanation-line-height: 16px;
+  --audit-group-margin-bottom: 40px;
+  --audit-group-padding-vertical: 8px;
+  --audit-margin-horizontal: 5px;
+  --audit-padding-vertical: 8px;
+  --category-header-font-size: 20px;
+  --category-padding: 40px;
+  --chevron-line-stroke: var(--color-gray-600);
+  --chevron-size: 12px;
+  --default-padding: 12px;
+  --env-item-background-color: var(--color-gray-100);
+  --env-item-font-size: 28px;
+  --env-item-line-height: 36px;
+  --env-item-padding: 10px 0px;
+  --env-name-min-width: 220px;
+  --footer-padding-vertical: 16px;
+  --gauge-circle-size-big: 112px;
+  --gauge-circle-size: 80px;
+  --gauge-label-font-size-big: 28px;
+  --gauge-label-font-size: 20px;
+  --gauge-label-line-height-big: 36px;
+  --gauge-label-line-height: 26px;
+  --gauge-percentage-font-size-big: 38px;
+  --gauge-percentage-font-size: 28px;
+  --gauge-wrapper-width: 148px;
+  --header-line-height: 24px;
+  --highlighter-background-color: var(--report-text-color);
+  --icon-square-size: calc(var(--score-icon-size) * 0.88);
+  --image-preview-size: 48px;
+  --metric-toggle-lines-fill: #7F7F7F;
+  --metrics-toggle-background-color: var(--color-gray-200);
+  --plugin-badge-background-color: var(--color-white);
+  --plugin-badge-size-big: calc(var(--gauge-circle-size-big) / 2.7);
+  --plugin-badge-size: calc(var(--gauge-circle-size) / 2.7);
+  --plugin-icon-size: 65%;
+  --pwa-icon-margin: 0 6px 0 -2px;
+  --pwa-icon-size: var(--topbar-logo-size);
+  --report-background-color: #fff;
+  --report-border-color-secondary: #ebebeb;
+  --report-font-family-monospace: 'Roboto Mono', 'Menlo', 'dejavu sans mono', 'Consolas', 'Lucida Console', monospace;
+  --report-font-family: Roboto, Helvetica, Arial, sans-serif;
+  --report-font-size: 16px;
+  --report-line-height: 24px;
+  --report-min-width: 400px;
+  --report-text-color-secondary: var(--color-gray-800);
+  --report-text-color: var(--color-gray-900);
+  --report-width: calc(60 * var(--report-font-size));
+  --score-container-padding: 8px;
+  --score-icon-background-size: 24px;
+  --score-icon-margin-left: 4px;
+  --score-icon-margin-right: 12px;
+  --score-icon-margin: 0 var(--score-icon-margin-right) 0 var(--score-icon-margin-left);
+  --score-icon-size: 12px;
+  --scores-container-padding: 20px 0 20px 0;
+  --scorescale-height: 6px;
+  --scorescale-width: 18px;
+  --section-padding-vertical: 12px;
+  --snippet-background-color: var(--color-gray-50);
+  --snippet-color: var(--color-gray-800);
+  --sparkline-height: 5px;
+  --stackpack-padding-horizontal: 10px;
+  --sticky-header-background-color: var(--report-background-color);
+  --table-higlight-background-color: hsla(0, 0%, 75%, 0.1);
+  --tools-icon-color: var(--color-gray-600);
+  --tools-icon-size: var(--score-icon-background-size);
+  --topbar-background-color: var(--color-gray-100);
+  --topbar-height: 32px;
+  --topbar-logo-size: 24px;
+  --topbar-padding: 0 8px;
+  --toplevel-warning-padding: 22px;
+
+  /* SVGs */
+  --plugin-icon-url-dark: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="%23FFFFFF"><path d="M0 0h24v24H0z" fill="none"/><path d="M20.5 11H19V7c0-1.1-.9-2-2-2h-4V3.5C13 2.12 11.88 1 10.5 1S8 2.12 8 3.5V5H4c-1.1 0-1.99.9-1.99 2v3.8H3.5c1.49 0 2.7 1.21 2.7 2.7s-1.21 2.7-2.7 2.7H2V20c0 1.1.9 2 2 2h3.8v-1.5c0-1.49 1.21-2.7 2.7-2.7 1.49 0 2.7 1.21 2.7 2.7V22H17c1.1 0 2-.9 2-2v-4h1.5c1.38 0 2.5-1.12 2.5-2.5S21.88 11 20.5 11z"/></svg>');
+  --plugin-icon-url: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="%23757575"><path d="M0 0h24v24H0z" fill="none"/><path d="M20.5 11H19V7c0-1.1-.9-2-2-2h-4V3.5C13 2.12 11.88 1 10.5 1S8 2.12 8 3.5V5H4c-1.1 0-1.99.9-1.99 2v3.8H3.5c1.49 0 2.7 1.21 2.7 2.7s-1.21 2.7-2.7 2.7H2V20c0 1.1.9 2 2 2h3.8v-1.5c0-1.49 1.21-2.7 2.7-2.7 1.49 0 2.7 1.21 2.7 2.7V22H17c1.1 0 2-.9 2-2v-4h1.5c1.38 0 2.5-1.12 2.5-2.5S21.88 11 20.5 11z"/></svg>');
+
+  --pass-icon-url: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48"><title>check</title><path fill="%23178239" d="M24 4C12.95 4 4 12.95 4 24c0 11.04 8.95 20 20 20 11.04 0 20-8.96 20-20 0-11.05-8.96-20-20-20zm-4 30L10 24l2.83-2.83L20 28.34l15.17-15.17L38 16 20 34z"/></svg>');
+  --average-icon-url: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48"><title>info</title><path fill="%23E67700" d="M24 4C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4zm2 30h-4V22h4v12zm0-16h-4v-4h4v4z"/></svg>');
+  --fail-icon-url: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48"><title>warn</title><path fill="%23C7221F" d="M2 42h44L24 4 2 42zm24-6h-4v-4h4v4zm0-8h-4v-8h4v8z"/></svg>');
+
+  --pwa-fast-reliable-gray-url: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="nonzero"><circle fill="%23DAE0E3" cx="12" cy="12" r="12"/><path d="M12.3 4l6.3 2.8V11c0 3.88-2.69 7.52-6.3 8.4C8.69 18.52 6 14.89 6 11V6.8L12.3 4zm-.56 12.88l3.3-5.79.04-.08c.05-.1.01-.29-.26-.29h-1.96l.56-3.92h-.56L9.6 12.52c0 .03.07-.12-.03.07-.11.2-.12.37.2.37h1.97l-.56 3.92h.56z" fill="%23FFF"/></g></svg>');
+  --pwa-installable-gray-url: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="nonzero"><circle fill="%23DAE0E3" cx="12" cy="12" r="12"/><path d="M12 5a7 7 0 1 0 0 14 7 7 0 0 0 0-14zm3.5 7.7h-2.8v2.8h-1.4v-2.8H8.5v-1.4h2.8V8.5h1.4v2.8h2.8v1.4z" fill="%23FFF"/></g></svg>');
+  --pwa-optimized-gray-url: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><rect fill="%23DAE0E3" width="24" height="24" rx="12"/><path fill="%23FFF" d="M12 15.07l3.6 2.18-.95-4.1 3.18-2.76-4.2-.36L12 6.17l-1.64 3.86-4.2.36 3.2 2.76-.96 4.1z"/><path d="M5 5h14v14H5z"/></g></svg>');
+
+  --pwa-fast-reliable-gray-url-dark: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="nonzero"><circle fill="%23424242" cx="12" cy="12" r="12"/><path d="M12.3 4l6.3 2.8V11c0 3.88-2.69 7.52-6.3 8.4C8.69 18.52 6 14.89 6 11V6.8L12.3 4zm-.56 12.88l3.3-5.79.04-.08c.05-.1.01-.29-.26-.29h-1.96l.56-3.92h-.56L9.6 12.52c0 .03.07-.12-.03.07-.11.2-.12.37.2.37h1.97l-.56 3.92h.56z" fill="%23FFF"/></g></svg>');
+  --pwa-installable-gray-url-dark: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="nonzero"><circle fill="%23424242" cx="12" cy="12" r="12"/><path d="M12 5a7 7 0 1 0 0 14 7 7 0 0 0 0-14zm3.5 7.7h-2.8v2.8h-1.4v-2.8H8.5v-1.4h2.8V8.5h1.4v2.8h2.8v1.4z" fill="%23FFF"/></g></svg>');
+  --pwa-optimized-gray-url-dark: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><rect fill="%23424242" width="24" height="24" rx="12"/><path fill="%23FFF" d="M12 15.07l3.6 2.18-.95-4.1 3.18-2.76-4.2-.36L12 6.17l-1.64 3.86-4.2.36 3.2 2.76-.96 4.1z"/><path d="M5 5h14v14H5z"/></g></svg>');
+
+  --pwa-fast-reliable-color-url: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg"><g fill-rule="nonzero" fill="none"><circle fill="%230CCE6B" cx="12" cy="12" r="12"/><path d="M12 4.3l6.3 2.8v4.2c0 3.88-2.69 7.52-6.3 8.4-3.61-.88-6.3-4.51-6.3-8.4V7.1L12 4.3zm-.56 12.88l3.3-5.79.04-.08c.05-.1.01-.29-.26-.29h-1.96l.56-3.92h-.56L9.3 12.82c0 .03.07-.12-.03.07-.11.2-.12.37.2.37h1.97l-.56 3.92h.56z" fill="%23FFF"/></g></svg>');
+  --pwa-installable-color-url: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg"><g fill-rule="nonzero" fill="none"><circle fill="%230CCE6B" cx="12" cy="12" r="12"/><path d="M12 5a7 7 0 1 0 0 14 7 7 0 0 0 0-14zm3.5 7.7h-2.8v2.8h-1.4v-2.8H8.5v-1.4h2.8V8.5h1.4v2.8h2.8v1.4z" fill="%23FFF"/></g></svg>');
+  --pwa-optimized-color-url: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><rect fill="%230CCE6B" width="24" height="24" rx="12"/><path d="M5 5h14v14H5z"/><path fill="%23FFF" d="M12 15.07l3.6 2.18-.95-4.1 3.18-2.76-4.2-.36L12 6.17l-1.64 3.86-4.2.36 3.2 2.76-.96 4.1z"/></g></svg>');
+}
+
+@media not print {
+  .lh-vars.dark {
+    /* Pallete */
+    --color-gray-200: var(--color-gray-800);
+    --color-gray-400: var(--color-gray-600);
+    --color-gray-50: #757575;
+    --color-gray-600: var(--color-gray-500);
+    --color-green-700: var(--color-green);
+    --color-orange-700: var(--color-orange);
+    --color-red-700: var(--color-red);
+    --color-teal-600: var(--color-cyan-500);
+
+    /* Context-specific colors */
+    --color-hover: rgba(0, 0, 0, 0.2);
+    --color-informative: var(--color-blue-200);
+
+    /* Component variables */
+    --env-item-background-color: var(--color-gray);
+    --plugin-badge-background-color: var(--color-gray-800);
+    --report-background-color: var(--color-gray-900);
+    --report-border-color-secondary: var(--color-gray-200);
+    --report-text-color-secondary: var(--color-gray-400);
+    --report-text-color: var(--color-gray-100);
+    --topbar-background-color: var(--color-gray);
+
+    /* SVGs */
+    --plugin-icon-url: var(--plugin-icon-url-dark);
+    --pwa-fast-reliable-gray-url: var(--pwa-fast-reliable-gray-url-dark);
+    --pwa-installable-gray-url: var(--pwa-installable-gray-url-dark);
+    --pwa-optimized-gray-url: var(--pwa-optimized-gray-url-dark);
+  }
+}
+
+@media only screen and (max-width: 480px) {
+  .lh-vars {
+    --audit-group-margin-bottom: 20px;
+    --category-padding: 24px;
+    --env-name-min-width: 120px;
+    --gauge-circle-size-big: 96px;
+    --gauge-circle-size: 72px;
+    --gauge-label-font-size-big: 22px;
+    --gauge-label-font-size: 14px;
+    --gauge-label-line-height-big: 26px;
+    --gauge-label-line-height: 20px;
+    --gauge-percentage-font-size-big: 34px;
+    --gauge-percentage-font-size: 26px;
+    --gauge-wrapper-width: 112px;
+    --header-padding: 16px 0 16px 0;
+    --image-preview-size: 24px;
+    --plugin-icon-size: 75%;
+    --pwa-icon-margin: 0 7px 0 -3px;
+    --report-font-size: 14px;
+    --report-line-height: 20px;
+    --score-icon-margin-left: 2px;
+    --score-icon-size: 10px;
+    --topbar-height: 28px;
+    --topbar-logo-size: 20px;
+  }
+
+  /* Not enough space to adequately show the relative savings bars. */
+  .lh-sparkline {
+    display: none;
+  }
+}
+
+.lh-vars.lh-devtools {
+  --audit-explanation-line-height: 14px;
+  --audit-group-margin-bottom: 20px;
+  --audit-group-padding-vertical: 12px;
+  --audit-padding-vertical: 4px;
+  --category-header-font-size: 16px;
+  --category-padding: 12px;
+  --default-padding: 12px;
+  --env-name-min-width: 120px;
+  --footer-padding-vertical: 8px;
+  --gauge-circle-size-big: 72px;
+  --gauge-circle-size: 64px;
+  --gauge-label-font-size-big: 22px;
+  --gauge-label-font-size: 14px;
+  --gauge-label-line-height-big: 26px;
+  --gauge-label-line-height: 20px;
+  --gauge-percentage-font-size-big: 34px;
+  --gauge-percentage-font-size: 26px;
+  --gauge-wrapper-width: 97px;
+  --header-line-height: 20px;
+  --header-padding: 16px 0 16px 0;
+  --plugin-icon-size: 75%;
+  --pwa-icon-margin: 0 7px 0 -3px;
+  --report-font-family-monospace: 'Menlo', 'dejavu sans mono', 'Consolas', 'Lucida Console', monospace;
+  --report-font-family: '.SFNSDisplay-Regular', 'Helvetica Neue', 'Lucida Grande', sans-serif;
+  --report-font-size: 12px;
+  --report-line-height: 20px;
+  --score-icon-margin-left: 2px;
+  --score-icon-size: 10px;
+  --section-padding-vertical: 8px;
+}
+
+.lh-devtools.lh-root {
+  height: 100%;
+}
+.lh-devtools.lh-root img {
+  /* Override devtools default 'min-width: 0' so svg without size in a flexbox isn't collapsed. */
+  min-width: auto;
+}
+.lh-devtools .lh-container {
+  overflow-y: scroll;
+  height: calc(100% - var(--topbar-height));
+}
+@media print {
+  .lh-devtools .lh-container {
+    overflow: unset;
+  }
+}
+.lh-devtools .lh-sticky-header {
+  /* This is normally the height of the topbar, but we want it to stick to the top of our scroll container .lh-container` */
+  top: 0;
+}
+
+@keyframes fadeIn {
+  0% { opacity: 0;}
+  100% { opacity: 0.6;}
+}
+
+.lh-root *, .lh-root *::before, .lh-root *::after {
+  box-sizing: border-box;
+  -webkit-font-smoothing: antialiased;
+}
+
+.lh-root {
+  font-family: var(--report-font-family);
+  font-size: var(--report-font-size);
+  margin: 0;
+  line-height: var(--report-line-height);
+  background: var(--report-background-color);
+  scroll-behavior: smooth;
+  color: var(--report-text-color);
+}
+
+.lh-root :focus {
+    outline: -webkit-focus-ring-color auto 3px;
+}
+.lh-root summary:focus {
+    outline: none;
+    box-shadow: 0 0 0 1px hsl(217, 89%, 61%);
+}
+
+.lh-root [hidden] {
+  display: none !important;
+}
+
+.lh-root details > summary {
+  cursor: pointer;
+}
+
+.lh-container {
+  /*
+  Text wrapping in the report is so much FUN!
+  We have a `word-break: break-word;` globally here to prevent a few common scenarios, namely
+  long non-breakable text (usually URLs) found in:
+    1. The footer
+    2. .lh-node (outerHTML)
+    3. .lh-code
+
+  With that sorted, the next challenge is appropriate column sizing and text wrapping inside our
+  .lh-details tables. Even more fun.
+    * We don't want table headers ("Potential Savings (ms)") to wrap or their column values, but
+    we'd be happy for the URL column to wrap if the URLs are particularly long.
+    * We want the narrow columns to remain narrow, providing the most column width for URL
+    * We don't want the table to extend past 100% width.
+    * Long URLs in the URL column can wrap. Util.getURLDisplayName maxes them out at 64 characters,
+      but they do not get any overflow:ellipsis treatment.
+  */
+  word-break: break-word;
+}
+
+.lh-audit-group a,
+.lh-category-header__description a,
+.lh-audit__description a,
+.lh-footer a {
+  color: var(--color-informative);
+}
+
+.lh-audit__description, .lh-audit__stackpack {
+  --inner-audit-padding-right: var(--stackpack-padding-horizontal);
+  padding-left: var(--audit-description-padding-left);
+  padding-right: var(--inner-audit-padding-right);
+  padding-top: 8px;
+  padding-bottom: 8px;
+}
+
+.lh-details {
+  font-size: var(--report-font-size);
+  margin-top: var(--default-padding);
+  margin-bottom: var(--default-padding);
+  margin-left: var(--audit-description-padding-left);
+  /* whatever the .lh-details side margins are */
+  width: 100%;
+}
+
+.lh-details.flex .lh-code {
+  max-width: 70%;
+}
+
+.lh-audit__stackpack {
+  display: flex;
+  align-items: center;
+}
+
+.lh-audit__stackpack__img {
+  max-width: 50px;
+  margin-right: var(--default-padding)
+}
+
+/* Report header */
+
+.report-icon {
+  opacity: 0.7;
+}
+.report-icon:hover {
+  opacity: 1;
+}
+.report-icon[disabled] {
+  opacity: 0.3;
+  pointer-events: none;
+}
+
+.report-icon--print {
+  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 8H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3zm-3 11H8v-5h8v5zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-1-9H6v4h12V3z"/><path fill="none" d="M0 0h24v24H0z"/></svg>');
+}
+.report-icon--copy {
+  background-image: url('data:image/svg+xml;utf8,<svg height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M0 0h24v24H0z" fill="none"/><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg>');
+}
+.report-icon--open {
+  background-image: url('data:image/svg+xml;utf8,<svg height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M0 0h24v24H0z" fill="none"/><path d="M19 4H5c-1.11 0-2 .9-2 2v12c0 1.1.89 2 2 2h4v-2H5V8h14v10h-4v2h4c1.1 0 2-.9 2-2V6c0-1.1-.89-2-2-2zm-7 6l-4 4h3v6h2v-6h3l-4-4z"/></svg>');
+}
+.report-icon--download {
+  background-image: url('data:image/svg+xml;utf8,<svg height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"/><path d="M0 0h24v24H0z" fill="none"/></svg>');
+}
+.report-icon--dark {
+  background-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 100 125"><path d="M50 23.587c-16.27 0-22.799 12.574-22.799 21.417 0 12.917 10.117 22.451 12.436 32.471h20.726c2.32-10.02 12.436-19.554 12.436-32.471 0-8.843-6.528-21.417-22.799-21.417zM39.637 87.161c0 3.001 1.18 4.181 4.181 4.181h.426l.41 1.231C45.278 94.449 46.042 95 48.019 95h3.963c1.978 0 2.74-.551 3.365-2.427l.409-1.231h.427c3.002 0 4.18-1.18 4.18-4.181V80.91H39.637v6.251zM50 18.265c1.26 0 2.072-.814 2.072-2.073v-9.12C52.072 5.813 51.26 5 50 5c-1.259 0-2.072.813-2.072 2.073v9.12c0 1.259.813 2.072 2.072 2.072zM68.313 23.727c.994.774 2.135.634 2.91-.357l5.614-7.187c.776-.992.636-2.135-.356-2.909-.992-.776-2.135-.636-2.91.357l-5.613 7.186c-.778.993-.636 2.135.355 2.91zM91.157 36.373c-.306-1.222-1.291-1.815-2.513-1.51l-8.85 2.207c-1.222.305-1.814 1.29-1.51 2.512.305 1.223 1.291 1.814 2.513 1.51l8.849-2.206c1.223-.305 1.816-1.291 1.511-2.513zM86.757 60.48l-8.331-3.709c-1.15-.512-2.225-.099-2.736 1.052-.512 1.151-.1 2.224 1.051 2.737l8.33 3.707c1.15.514 2.225.101 2.736-1.05.513-1.149.1-2.223-1.05-2.737zM28.779 23.37c.775.992 1.917 1.131 2.909.357.992-.776 1.132-1.917.357-2.91l-5.615-7.186c-.775-.992-1.917-1.132-2.909-.357s-1.131 1.917-.356 2.909l5.614 7.187zM21.715 39.583c.305-1.223-.288-2.208-1.51-2.513l-8.849-2.207c-1.222-.303-2.208.289-2.513 1.511-.303 1.222.288 2.207 1.511 2.512l8.848 2.206c1.222.304 2.208-.287 2.513-1.509zM21.575 56.771l-8.331 3.711c-1.151.511-1.563 1.586-1.05 2.735.511 1.151 1.586 1.563 2.736 1.052l8.331-3.711c1.151-.511 1.563-1.586 1.05-2.735-.512-1.15-1.585-1.562-2.736-1.052z"/></svg>');
+}
+
+/* Node */
+.lh-node__snippet {
+  font-family: var(--report-font-family-monospace);
+  color: var(--color-teal-600);
+  font-size: 12px;
+  line-height: 1.5em;
+}
+
+/* Score */
+
+.lh-audit__score-icon {
+  width: var(--score-icon-size);
+  height: var(--score-icon-size);
+  margin: var(--score-icon-margin);
+}
+
+.lh-audit--pass .lh-audit__display-text {
+  color: var(--color-pass-secondary);
+}
+.lh-audit--pass .lh-audit__score-icon {
+  border-radius: 100%;
+  background: var(--color-pass);
+}
+
+.lh-audit--average .lh-audit__display-text {
+  color: var(--color-average-secondary);
+}
+.lh-audit--average .lh-audit__score-icon {
+  background: var(--color-average);
+  width: var(--icon-square-size);
+  height: var(--icon-square-size);
+}
+
+.lh-audit--fail .lh-audit__display-text {
+  color: var(--color-fail-secondary);
+}
+.lh-audit--fail .lh-audit__score-icon,
+.lh-audit--error .lh-audit__score-icon {
+  border-left: calc(var(--score-icon-size) / 2) solid transparent;
+  border-right: calc(var(--score-icon-size) / 2) solid transparent;
+  border-bottom: var(--score-icon-size) solid var(--color-fail);
+}
+
+.lh-audit--manual .lh-audit__display-text,
+.lh-audit--notapplicable .lh-audit__display-text {
+  color: var(--color-gray-600);
+}
+.lh-audit--manual .lh-audit__score-icon,
+.lh-audit--notapplicable .lh-audit__score-icon {
+  border-radius: 100%;
+  background: var(--color-gray-400);
+}
+
+.lh-audit--informative .lh-audit__display-text {
+  color: var(--color-gray-600);
+}
+
+.lh-audit--informative .lh-audit__score-icon {
+  border: none;
+  border-radius: 100%;
+  background: var(--color-gray-400);
+}
+
+.lh-audit__description,
+.lh-audit__stackpack {
+  color: var(--report-text-color-secondary);
+}
+.lh-category-header__description  {
+  font-size: var(--report-font-size);
+  text-align: center;
+  margin: 0px auto;
+  max-width: 400px;
+}
+
+
+.lh-audit__display-text,
+.lh-load-opportunity__sparkline,
+.lh-chevron-container {
+  margin: 0 var(--audit-margin-horizontal);
+}
+.lh-chevron-container {
+  margin-right: 0;
+}
+
+.lh-audit__title-and-text {
+  flex: 1;
+}
+
+/* Prepend display text with em dash separator. But not in Opportunities. */
+.lh-audit__display-text:not(:empty):before {
+  content: '—';
+  margin-right: var(--audit-margin-horizontal);
+}
+.lh-audit-group.lh-audit-group--load-opportunities .lh-audit__display-text:not(:empty):before {
+  display: none;
+}
+
+/* Expandable Details (Audit Groups, Audits) */
+.lh-audit__header {
+  display: flex;
+  align-items: center;
+  font-weight: 500;
+  padding: var(--audit-padding-vertical) 0;
+}
+
+.lh-audit--load-opportunity .lh-audit__header {
+  display: block;
+}
+
+.lh-audit__header:hover {
+  background-color: var(--color-hover);
+}
+
+/* Hide the expandable arrow icon, three ways: via the CSS Counter Styles spec, for webkit/blink browsers, hiding the polyfilled icon */
+/* https://github.com/javan/details-element-polyfill/blob/master/src/details-element-polyfill/polyfill.sass */
+.lh-audit-group > summary,
+.lh-expandable-details > summary {
+  list-style-type: none;
+}
+.lh-audit-group > summary::-webkit-details-marker,
+.lh-expandable-details > summary::-webkit-details-marker {
+  display: none;
+}
+.lh-audit-group > summary:before,
+.lh-expandable-details > summary:before {
+  display: none;
+}
+
+
+/* Perf Metric */
+
+.lh-columns {
+  display: flex;
+  width: 100%;
+}
+@media screen and (max-width: 640px) {
+  .lh-columns {
+    flex-wrap: wrap;
+
+  }
+}
+
+.lh-column {
+  flex: 1;
+}
+.lh-column:first-of-type {
+  margin-right: 24px;
+}
+
+@media screen and (max-width: 800px) {
+  .lh-column:first-of-type {
+    margin-right: 8px;
+  }
+}
+@media screen and (max-width: 640px) {
+  .lh-column {
+    flex-basis: 100%;
+  }
+  .lh-column:first-of-type {
+    margin-right: 0px;
+  }
+  .lh-column:first-of-type .lh-metric:last-of-type {
+    border-bottom: 0;
+  }
+}
+
+
+.lh-metric {
+  border-bottom: 1px solid var(--report-border-color-secondary);
+}
+.lh-metric:first-of-type {
+  border-top: 1px solid var(--report-border-color-secondary);
+}
+
+.lh-metric__innerwrap {
+  display: grid;
+  grid-template-columns: var(--audit-description-padding-left) 10fr 3fr;
+  align-items: center;
+  padding: 10px 0;
+}
+
+.lh-metric__details {
+  order: -1;
+}
+
+.lh-metric__title {
+  flex: 1;
+  font-weight: 500;
+}
+
+.lh-metrics__disclaimer {
+  color: var(--color-gray-600);
+  margin: var(--section-padding-vertical) 0;
+}
+.lh-metrics__disclaimer a {
+  color: var(--color-gray-700);
+}
+
+.lh-metric__description {
+  display: none;
+  grid-column-start: 2;
+  grid-column-end: 3;
+  color: var(--report-text-color-secondary);
+}
+
+.lh-metric__value {
+  white-space: nowrap; /* No wrapping between metric value and the icon */
+  font-weight: 500;
+  justify-self: end;
+}
+
+/* No-JS toggle switch */
+/* Keep this selector sync'd w/ `magicSelector` in report-ui-features-test.js */
+ .lh-metrics-toggle__input:checked ~ .lh-columns .lh-metric__description {
+  display: block;
+}
+
+.lh-metrics-toggle__input {
+  cursor: pointer;
+  opacity: 0;
+  position: absolute;
+  right: 0;
+  width: 74px;
+  height: 28px;
+  top: -3px;
+}
+.lh-metrics-toggle__label {
+  display: flex;
+  background-color: #eee;
+  border-radius: 20px;
+  overflow: hidden;
+  position: absolute;
+  right: 0;
+  top: -3px;
+  pointer-events: none;
+}
+.lh-metrics-toggle__input:focus + label {
+  outline: -webkit-focus-ring-color auto 3px;
+}
+.lh-metrics-toggle__icon {
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  padding: 2px 5px;
+  width: 50%;
+  height: 28px;
+}
+.lh-metrics-toggle__input:not(:checked) + label .lh-metrics-toggle__icon--less,
+.lh-metrics-toggle__input:checked + label .lh-metrics-toggle__icon--more {
+  background-color: var(--color-blue-A700);
+  --metric-toggle-lines-fill: var(--color-white);
+}
+.lh-metrics-toggle__lines {
+  fill: var(--metric-toggle-lines-fill);
+}
+
+.lh-metrics-toggle__label  {
+  background-color: var(--metrics-toggle-background-color);
+}
+
+.lh-metrics-toggle__label .lh-metrics-toggle__icon--less {
+  padding-left: 8px;
+}
+.lh-metrics-toggle__label .lh-metrics-toggle__icon--more {
+  padding-right: 8px;
+}
+
+/* Pushes the metric description toggle button to the right. */
+.lh-audit-group--metrics .lh-audit-group__header {
+  display: flex;
+}
+.lh-audit-group--metrics .lh-audit-group__header span.lh-audit-group__title {
+  flex: 1;
+}
+
+.lh-metric .lh-metric__innerwrap::before {
+  content: '';
+  width: var(--score-icon-size);
+  height: var(--score-icon-size);
+  display: inline-block;
+  margin: var(--score-icon-margin);
+}
+
+.lh-metric--pass .lh-metric__value {
+  color: var(--color-pass-secondary);
+}
+.lh-metric--pass .lh-metric__innerwrap::before {
+  border-radius: 100%;
+  background: var(--color-pass);
+}
+
+.lh-metric--average .lh-metric__value {
+  color: var(--color-average-secondary);
+}
+.lh-metric--average .lh-metric__innerwrap::before {
+  background: var(--color-average);
+  width: var(--icon-square-size);
+  height: var(--icon-square-size);
+}
+
+.lh-metric--fail .lh-metric__value {
+  color: var(--color-fail-secondary);
+}
+.lh-metric--fail .lh-metric__innerwrap::before,
+.lh-metric--error .lh-metric__innerwrap::before {
+  border-left: calc(var(--score-icon-size) / 2) solid transparent;
+  border-right: calc(var(--score-icon-size) / 2) solid transparent;
+  border-bottom: var(--score-icon-size) solid var(--color-fail);
+}
+
+.lh-metric--error .lh-metric__value,
+.lh-metric--error .lh-metric__description {
+  color: var(--color-fail-secondary);
+}
+
+/* Perf load opportunity */
+
+.lh-load-opportunity__cols {
+  display: flex;
+  align-items: flex-start;
+}
+
+.lh-load-opportunity__header .lh-load-opportunity__col {
+  color: var(--color-gray-600);
+  display: unset;
+  line-height: calc(2.3 * var(--report-font-size));
+}
+
+.lh-load-opportunity__col {
+  display: flex;
+}
+
+.lh-load-opportunity__col--one {
+  flex: 5;
+  align-items: center;
+  margin-right: 2px;
+}
+.lh-load-opportunity__col--two {
+  flex: 4;
+  text-align: right;
+}
+
+.lh-audit--load-opportunity .lh-audit__display-text {
+  text-align: right;
+  flex: 0 0 calc(3 * var(--report-font-size));
+}
+
+
+/* Sparkline */
+
+.lh-load-opportunity__sparkline {
+  flex: 1;
+  margin-top: calc((var(--report-line-height) - var(--sparkline-height)) / 2);
+}
+
+.lh-sparkline {
+  height: var(--sparkline-height);
+  width: 100%;
+}
+
+.lh-sparkline__bar {
+  height: 100%;
+  float: right;
+}
+
+.lh-audit--pass .lh-sparkline__bar {
+  background: var(--color-pass);
+}
+
+.lh-audit--average .lh-sparkline__bar {
+  background: var(--color-average);
+}
+
+.lh-audit--fail .lh-sparkline__bar {
+  background: var(--color-fail);
+}
+
+
+
+/* Filmstrip */
+
+.lh-filmstrip-container {
+  /* smaller gap between metrics and filmstrip */
+  margin: -8px auto 0 auto;
+}
+
+.lh-filmstrip {
+  display: flex;
+  flex-direction: row;
+  justify-content: space-between;
+  padding-bottom: var(--default-padding);
+}
+
+.lh-filmstrip__frame {
+  text-align: right;
+  position: relative;
+}
+
+.lh-filmstrip__thumbnail {
+  border: 1px solid var(--report-border-color-secondary);
+  max-height: 100px;
+  max-width: 60px;
+}
+
+@media screen and (max-width: 750px) {
+  .lh-filmstrip {
+    flex-wrap: wrap;
+  }
+  .lh-filmstrip__frame {
+    width: 20%;
+    margin-bottom: 5px;
+  }
+  .lh-filmstrip__thumbnail {
+    display: block;
+    margin: auto;
+  }
+}
+
+/* Audit */
+
+.lh-audit {
+  border-bottom: 1px solid var(--report-border-color-secondary);
+}
+
+/* Apply border-top to just the first audit. */
+.lh-audit {
+  border-top: 1px solid var(--report-border-color-secondary);
+}
+.lh-audit ~ .lh-audit {
+  border-top: none;
+}
+
+
+.lh-audit--error .lh-audit__display-text {
+  color: var(--color-fail);
+}
+
+/* Audit Group */
+
+.lh-audit-group {
+  margin-bottom: var(--audit-group-margin-bottom);
+  position: relative;
+}
+
+.lh-audit-group__header::before {
+  /* By default, groups don't get an icon */
+  content: none;
+  width: var(--pwa-icon-size);
+  height: var(--pwa-icon-size);
+  margin: var(--pwa-icon-margin);
+  display: inline-block;
+  vertical-align: middle;
+}
+
+/* Style the "over budget" columns red. */
+.lh-audit-group--budgets .lh-table tbody tr td:nth-child(4),
+.lh-audit-group--budgets .lh-table tbody tr td:nth-child(5){
+  color: var(--color-red-700);
+}
+
+/* Align the "over budget request count" text to be close to the "over budget bytes" column. */
+.lh-audit-group--budgets .lh-table tbody tr td:nth-child(4){
+  text-align: right;
+}
+
+.lh-audit-group--budgets .lh-table {
+  width: 100%;
+}
+
+.lh-audit-group--pwa-fast-reliable .lh-audit-group__header::before {
+  content: '';
+  background-image: var(--pwa-fast-reliable-gray-url);
+}
+.lh-audit-group--pwa-installable .lh-audit-group__header::before {
+  content: '';
+  background-image: var(--pwa-installable-gray-url);
+}
+.lh-audit-group--pwa-optimized .lh-audit-group__header::before {
+  content: '';
+  background-image: var(--pwa-optimized-gray-url);
+}
+.lh-audit-group--pwa-fast-reliable.lh-badged .lh-audit-group__header::before {
+  background-image: var(--pwa-fast-reliable-color-url);
+}
+.lh-audit-group--pwa-installable.lh-badged .lh-audit-group__header::before {
+  background-image: var(--pwa-installable-color-url);
+}
+.lh-audit-group--pwa-optimized.lh-badged .lh-audit-group__header::before {
+  background-image: var(--pwa-optimized-color-url);
+}
+
+.lh-audit-group--metrics .lh-audit-group__summary {
+  margin-top: 0;
+  margin-bottom: 0;
+}
+
+.lh-audit-group__summary {
+  display: flex;
+  justify-content: space-between;
+  margin-top: calc(var(--category-padding) * 1.5);
+  margin-bottom: var(--category-padding);
+}
+
+.lh-audit-group__itemcount {
+  color: var(--color-gray-600);
+  font-weight: bold;
+}
+.lh-audit-group__header .lh-chevron {
+  margin-top: calc((var(--report-line-height) - 5px) / 2);
+}
+
+.lh-audit-group__header {
+  font-size: var(--report-font-size);
+  margin: 0 0 var(--audit-group-padding-vertical);
+  /* When the header takes 100% width, the chevron becomes small. */
+  max-width: calc(100% - var(--chevron-size));
+}
+/* max-width makes the metric toggle not flush. metrics doesn't have a chevron so unset. */
+.lh-audit-group--metrics .lh-audit-group__header {
+  max-width: unset;
+}
+
+.lh-audit-group__header span.lh-audit-group__title {
+  font-weight: bold;
+}
+
+.lh-audit-group__header span.lh-audit-group__itemcount {
+  font-weight: bold;
+  color: var(--color-gray-600);
+}
+
+.lh-audit-group__header span.lh-audit-group__description {
+  font-weight: 500;
+  color: var(--color-gray-600);
+}
+.lh-audit-group__header span.lh-audit-group__description::before {
+  content: '—';
+  margin: 0px var(--audit-margin-horizontal);
+}
+
+.lh-clump > .lh-audit-group__header,
+.lh-audit-group--diagnostics .lh-audit-group__header,
+.lh-audit-group--load-opportunities .lh-audit-group__header,
+.lh-audit-group--metrics .lh-audit-group__header,
+.lh-audit-group--pwa-fast-reliable .lh-audit-group__header,
+.lh-audit-group--pwa-installable .lh-audit-group__header,
+.lh-audit-group--pwa-optimized .lh-audit-group__header {
+  margin-top: var(--audit-group-padding-vertical);
+}
+
+.lh-audit-explanation {
+  margin: var(--audit-padding-vertical) 0 calc(var(--audit-padding-vertical) / 2) var(--audit-margin-horizontal);
+  line-height: var(--audit-explanation-line-height);
+  display: inline-block;
+}
+
+.lh-audit--fail .lh-audit-explanation {
+  color: var(--color-fail);
+}
+
+/* Report */
+.lh-list > div:not(:last-child) {
+  padding-bottom: 20px;
+}
+
+.lh-header-container {
+  display: block;
+  margin: 0 auto;
+  position: relative;
+  word-wrap: break-word;
+}
+
+.lh-report {
+  min-width: var(--report-min-width);
+}
+
+.lh-exception {
+  font-size: large;
+}
+
+.lh-code {
+  white-space: normal;
+  margin-top: 0;
+  font-size: 85%;
+}
+
+.lh-warnings {
+  --item-margin: calc(var(--report-line-height) / 6);
+  color: var(--color-average);
+  margin: var(--audit-padding-vertical) 0;
+  padding: calc(var(--audit-padding-vertical) / 2) var(--audit-padding-vertical);
+}
+.lh-warnings span {
+  font-weight: bold;
+}
+
+.lh-warnings--toplevel {
+  --item-margin: calc(var(--header-line-height) / 4);
+  color: var(--report-text-color-secondary);
+  margin-left: auto;
+  margin-right: auto;
+  max-width: calc(var(--report-width) - var(--category-padding) * 2);
+  background-color: var(--color-amber-50);
+  padding: var(--toplevel-warning-padding);
+}
+
+.lh-warnings ul {
+  padding-left: calc(var(--category-padding) * 2);
+  margin: 0;
+}
+.lh-warnings li {
+  margin: var(--item-margin) 0;
+}
+.lh-warnings li:last-of-type {
+  margin-bottom: 0;
+}
+
+.lh-scores-header {
+  display: flex;
+  flex-wrap: wrap;
+  justify-content: center;
+}
+.lh-scores-header__solo {
+  padding: 0;
+  border: 0;
+}
+
+/* Gauge */
+
+.lh-gauge__wrapper--pass {
+  color: var(--color-pass);
+  fill: var(--color-pass);
+  stroke: var(--color-pass);
+}
+
+.lh-gauge__wrapper--average {
+  color: var(--color-average);
+  fill: var(--color-average);
+  stroke: var(--color-average);
+}
+
+.lh-gauge__wrapper--fail {
+  color: var(--color-fail);
+  fill: var(--color-fail);
+  stroke: var(--color-fail);
+}
+
+.lh-gauge {
+  stroke-linecap: round;
+  width: var(--gauge-circle-size);
+  height: var(--gauge-circle-size);
+}
+
+.lh-category .lh-gauge {
+  --gauge-circle-size: var(--gauge-circle-size-big);
+}
+
+.lh-gauge-base {
+    opacity: 0.1;
+    stroke: var(--circle-background);
+    stroke-width: var(--circle-border-width);
+}
+
+.lh-gauge-arc {
+    fill: none;
+    stroke: var(--circle-color);
+    stroke-width: var(--circle-border-width);
+    animation: load-gauge var(--transition-length) ease forwards;
+    animation-delay: 250ms;
+}
+
+.lh-gauge__svg-wrapper {
+  position: relative;
+  height: var(--gauge-circle-size);
+}
+.lh-category .lh-gauge__svg-wrapper {
+  --gauge-circle-size: var(--gauge-circle-size-big);
+}
+
+/* The plugin badge overlay */
+.lh-gauge__wrapper--plugin .lh-gauge__svg-wrapper::before {
+  width: var(--plugin-badge-size);
+  height: var(--plugin-badge-size);
+  background-color: var(--plugin-badge-background-color);
+  background-image: var(--plugin-icon-url);
+  background-repeat: no-repeat;
+  background-size: var(--plugin-icon-size);
+  background-position: 58% 50%;
+  content: "";
+  position: absolute;
+  right: -6px;
+  bottom: 0px;
+  display: block;
+  z-index: 100;
+  box-shadow: 0 0 4px rgba(0,0,0,.2);
+  border-radius: 25%;
+}
+.lh-category .lh-gauge__wrapper--plugin .lh-gauge__svg-wrapper::before {
+  width: var(--plugin-badge-size-big);
+  height: var(--plugin-badge-size-big);
+}
+
+@keyframes load-gauge {
+  from { stroke-dasharray: 0 352; }
+}
+
+.lh-gauge__percentage {
+  width: 100%;
+  height: var(--gauge-circle-size);
+  position: absolute;
+  font-family: var(--report-font-family-monospace);
+  font-size: calc(var(--gauge-circle-size) * 0.34 + 1.3px);
+  line-height: 0;
+  text-align: center;
+  top: calc(var(--score-container-padding) + var(--gauge-circle-size) / 2);
+}
+
+.lh-category .lh-gauge__percentage {
+  --gauge-circle-size: var(--gauge-circle-size-big);
+  --gauge-percentage-font-size: var(--gauge-percentage-font-size-big);
+}
+
+.lh-gauge__wrapper {
+  position: relative;
+  display: flex;
+  align-items: center;
+  flex-direction: column;
+  text-decoration: none;
+  padding: var(--score-container-padding);
+
+  --circle-border-width: 8;
+  --transition-length: 1s;
+
+  /* Contain the layout style paint & layers during animation*/
+  contain: content;
+  will-change: opacity; /* Only using for layer promotion */
+}
+
+.lh-gauge__label {
+  font-size: var(--gauge-label-font-size);
+  line-height: var(--gauge-label-line-height);
+  margin-top: 10px;
+  text-align: center;
+  color: var(--report-text-color);
+}
+
+/* TODO(#8185) use more BEM (.lh-gauge__label--big) instead of relying on descendant selector */
+.lh-category .lh-gauge__label {
+  --gauge-label-font-size: var(--gauge-label-font-size-big);
+  --gauge-label-line-height: var(--gauge-label-line-height-big);
+  margin-top: 14px;
+}
+
+
+.lh-scores-header .lh-gauge__wrapper,
+.lh-scores-header .lh-gauge--pwa__wrapper,
+.lh-sticky-header .lh-gauge__wrapper,
+.lh-sticky-header .lh-gauge--pwa__wrapper {
+  width: var(--gauge-wrapper-width);
+}
+
+.lh-scorescale {
+  display: inline-flex;
+  margin: 12px auto 0 auto;
+  border: 1px solid var(--color-gray-200);
+  border-radius: 20px;
+  padding: 8px 8px;
+}
+
+.lh-scorescale-range {
+  display: flex;
+  align-items: center;
+  margin: 0 12px;
+  font-family: var(--report-font-family-monospace);
+  white-space: nowrap;
+}
+
+.lh-scorescale-range::before {
+  content: '';
+  width: var(--scorescale-width);
+  height: var(--scorescale-height);
+  border-radius: 10px;
+  display: block;
+  margin-right: 10px;
+}
+
+.lh-scorescale-range--pass::before {
+  background-color: var(--color-pass);
+}
+
+.lh-scorescale-range--average::before {
+  background-color: var(--color-average);
+}
+
+.lh-scorescale-range--fail::before {
+  background-color: var(--color-fail);
+}
+
+/* Hide category score gauages if it's a single category report */
+.lh-header--solo-category .lh-scores-wrapper {
+  display: none;
+}
+
+
+.lh-categories {
+  width: 100%;
+  overflow: hidden;
+}
+
+.lh-category {
+  padding: var(--category-padding);
+  max-width: var(--report-width);
+  margin: 0 auto;
+}
+
+.lh-category-wrapper {
+  border-bottom: 1px solid var(--color-gray-200);
+}
+
+.lh-category-wrapper:first-of-type {
+  border-top: 1px solid var(--color-gray-200);
+}
+
+/* section hash link jump should preserve fixed header
+   https://css-tricks.com/hash-tag-links-padding/
+*/
+.lh-category > .lh-permalink {
+  --sticky-header-height: calc(var(--gauge-circle-size) + var(--score-container-padding) * 2);
+  --topbar-plus-header: calc(var(--topbar-height) + var(--sticky-header-height));
+  margin-top: calc(var(--topbar-plus-header) * -1);
+  padding-bottom: var(--topbar-plus-header);
+  display: block;
+  visibility: hidden;
+}
+
+.lh-category-header {
+  font-size: var(--category-header-font-size);
+  min-height: var(--gauge-circle-size);
+  margin-bottom: var(--section-padding-vertical);
+}
+
+.lh-category-header .lh-score__gauge {
+  max-width: 400px;
+  width: auto;
+  margin: 0px auto;
+}
+
+.lh-category-header .lh-audit__title {
+  font-size: var(--category-header-font-size);
+  line-height: var(--header-line-height);
+}
+
+#lh-log {
+  position: fixed;
+  background-color: #323232;
+  color: #fff;
+  min-height: 48px;
+  min-width: 288px;
+  padding: 16px 24px;
+  box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26);
+  border-radius: 2px;
+  margin: 12px;
+  font-size: 14px;
+  cursor: default;
+  transition: transform 0.3s, opacity 0.3s;
+  transform: translateY(100px);
+  opacity: 0;
+  bottom: 0;
+  left: 0;
+  z-index: 3;
+}
+
+#lh-log.show {
+  opacity: 1;
+  transform: translateY(0);
+}
+
+/* 964 fits the min-width of the filmstrip */
+@media screen and (max-width: 964px) {
+  .lh-report {
+    margin-left: 0;
+    width: 100%;
+  }
+}
+
+@media print {
+  body {
+    -webkit-print-color-adjust: exact; /* print background colors */
+  }
+  .lh-container {
+    display: block;
+  }
+  .lh-report {
+    margin-left: 0;
+    padding-top: 0;
+  }
+  .lh-categories {
+    margin-top: 0;
+  }
+}
+
+.lh-table {
+  border-collapse: collapse;
+  /* Can't assign padding to table, so shorten the width instead. */
+  width: calc(100% - var(--audit-description-padding-left));
+}
+
+.lh-table thead th {
+  font-weight: normal;
+  color: var(--color-gray-600);
+  /* See text-wrapping comment on .lh-container. */
+  word-break: normal;
+}
+
+.lh-table tbody tr:nth-child(odd) {
+  background-color: var(--table-higlight-background-color);
+}
+
+.lh-table th,
+.lh-table td {
+  padding: 8px 6px;
+}
+.lh-table th:first-child {
+  padding-left: 0;
+}
+.lh-table th:last-child {
+  padding-right: 0;
+}
+
+/* Looks unnecessary, but mostly for keeping the <th>s left-aligned */
+.lh-table-column--text,
+.lh-table-column--url,
+/* .lh-table-column--thumbnail, */
+/* .lh-table-column--empty,*/
+.lh-table-column--code,
+.lh-table-column--node {
+  text-align: left;
+}
+
+.lh-table-column--bytes,
+.lh-table-column--timespanMs,
+.lh-table-column--ms,
+.lh-table-column--numeric {
+  text-align: right;
+  word-break: normal;
+}
+
+
+
+.lh-table .lh-table-column--thumbnail {
+  width: var(--image-preview-size);
+  padding: 0;
+}
+
+.lh-table-column--url {
+  min-width: 250px;
+}
+
+/* Keep columns narrow if they follow the URL column */
+/* 12% was determined to be a decent narrow width, but wide enough for column headings */
+.lh-table-column--url + th.lh-table-column--bytes,
+.lh-table-column--url + .lh-table-column--bytes + th.lh-table-column--bytes,
+.lh-table-column--url + .lh-table-column--ms,
+.lh-table-column--url + .lh-table-column--ms + th.lh-table-column--bytes,
+.lh-table-column--url + .lh-table-column--bytes + th.lh-table-column--timespanMs {
+  width: 12%;
+}
+
+
+.lh-text__url-host {
+  display: inline;
+}
+
+.lh-text__url-host {
+  margin-left: calc(var(--report-font-size) / 2);
+  opacity: 0.6;
+  font-size: 90%
+}
+
+.lh-thumbnail {
+  object-fit: cover;
+  width: var(--image-preview-size);
+  height: var(--image-preview-size);
+  display: block;
+}
+
+.lh-unknown pre {
+  overflow: scroll;
+  border: solid 1px var(--color-gray-200);
+}
+
+.lh-text__url > a {
+  color: inherit;
+  text-decoration: none;
+}
+
+.lh-text__url > a:hover {
+  text-decoration: underline dotted #999;
+}
+
+/* Chevron
+   https://codepen.io/paulirish/pen/LmzEmK
+ */
+.lh-chevron {
+  --chevron-angle: 42deg;
+  /* Edge doesn't support transform: rotate(calc(...)), so we define it here */
+  --chevron-angle-right: -42deg;
+  width: var(--chevron-size);
+  height: var(--chevron-size);
+  margin-top: calc((var(--report-line-height) - 12px) / 2);
+}
+
+.lh-chevron__lines {
+  transition: transform 0.4s;
+  transform: translateY(var(--report-line-height));
+}
+.lh-chevron__line {
+ stroke: var(--chevron-line-stroke);
+ stroke-width: var(--chevron-size);
+ stroke-linecap: square;
+ transform-origin: 50%;
+ transform: rotate(var(--chevron-angle));
+ transition: transform 300ms, stroke 300ms;
+}
+
+.lh-audit-group > summary > .lh-audit-group__summary > .lh-chevron .lh-chevron__line-right,
+.lh-audit-group[open] > summary > .lh-audit-group__summary > .lh-chevron .lh-chevron__line-left,
+.lh-audit > .lh-expandable-details .lh-chevron__line-right,
+.lh-audit > .lh-expandable-details[open] .lh-chevron__line-left {
+ transform: rotate(var(--chevron-angle-right));
+}
+
+.lh-audit-group[open] > summary > .lh-audit-group__summary > .lh-chevron .lh-chevron__line-right,
+.lh-audit > .lh-expandable-details[open] .lh-chevron__line-right {
+  transform: rotate(var(--chevron-angle));
+}
+
+.lh-audit-group[open] > summary > .lh-audit-group__summary > .lh-chevron .lh-chevron__lines,
+.lh-audit > .lh-expandable-details[open] .lh-chevron__lines {
+ transform: translateY(calc(var(--chevron-size) * -1));
+}
+
+
+
+/* Tooltip */
+.tooltip-boundary {
+  position: relative;
+}
+
+.tooltip {
+  position: absolute;
+  display: none; /* Don't retain these layers when not needed */
+  opacity: 0;
+  background: #ffffff;
+  min-width: 246px;
+  max-width: 275px;
+  padding: 15px;
+  border-radius: 5px;
+  text-align: initial;
+}
+/* shrink tooltips to not be cutoff on left edge of narrow viewports
+   45vw is chosen to be ~= width of the left column of metrics
+*/
+@media screen and (max-width: 535px) {
+  .tooltip {
+    min-width: 45vw;
+    padding: 3vw;
+  }
+}
+
+.tooltip-boundary:hover {
+  background-color: var(--color-hover);
+}
+
+.tooltip-boundary:hover .tooltip {
+  display: block;
+  animation: fadeInTooltip 250ms;
+  animation-fill-mode: forwards;
+  animation-delay: 850ms;
+  bottom: 100%;
+  z-index: 1;
+  will-change: opacity;
+  right: 0;
+  pointer-events: none;
+}
+
+.tooltip::before {
+  content: "";
+  border: solid transparent;
+  border-bottom-color: #fff;
+  border-width: 10px;
+  position: absolute;
+  bottom: -20px;
+  right: 6px;
+  transform: rotate(180deg);
+  pointer-events: none;
+}
+
+@keyframes fadeInTooltip {
+  0% { opacity: 0; }
+  75% { opacity: 1; }
+  100% { opacity: 1;  filter: drop-shadow(1px 0px 1px #aaa) drop-shadow(0px 2px 4px hsla(206, 6%, 25%, 0.15)); pointer-events: auto; }
+}
diff --git a/front_end/lighthouse/lighthouse/report.js b/front_end/lighthouse/lighthouse/report.js
new file mode 100644
index 0000000..0f63105
--- /dev/null
+++ b/front_end/lighthouse/lighthouse/report.js
@@ -0,0 +1,4209 @@
+/**
+ * @license
+ * Copyright 2017 Google Inc. All Rights Reserved.
+ *
+ * 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
+ *
+ * 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.
+ */
+'use strict';
+
+/* globals self, URL */
+
+const ELLIPSIS = '\u2026';
+const NBSP = '\xa0';
+const PASS_THRESHOLD = 0.9;
+const SCREENSHOT_PREFIX = 'data:image/jpeg;base64,';
+
+const RATINGS = {
+  PASS: {label: 'pass', minScore: PASS_THRESHOLD},
+  AVERAGE: {label: 'average', minScore: 0.5},
+  FAIL: {label: 'fail'},
+  ERROR: {label: 'error'},
+};
+
+// 25 most used tld plus one domains (aka public suffixes) from http archive.
+// @see https://github.com/GoogleChrome/lighthouse/pull/5065#discussion_r191926212
+// The canonical list is https://publicsuffix.org/learn/ but we're only using subset to conserve bytes
+const listOfTlds = [
+  'com', 'co', 'gov', 'edu', 'ac', 'org', 'go', 'gob', 'or', 'net', 'in', 'ne', 'nic', 'gouv',
+  'web', 'spb', 'blog', 'jus', 'kiev', 'mil', 'wi', 'qc', 'ca', 'bel', 'on',
+];
+
+class Util {
+  static get PASS_THRESHOLD() {
+    return PASS_THRESHOLD;
+  }
+
+  static get MS_DISPLAY_VALUE() {
+    return `%10d${NBSP}ms`;
+  }
+
+  /**
+   * Returns a new LHR that's reshaped for slightly better ergonomics within the report rendereer.
+   * Also, sets up the localized UI strings used within renderer and makes changes to old LHRs to be
+   * compatible with current renderer.
+   * The LHR passed in is not mutated.
+   * TODO(team): we all agree the LHR shape change is technical debt we should fix
+   * @param {LH.Result} result
+   * @return {LH.ReportResult}
+   */
+  static prepareReportResult(result) {
+    // If any mutations happen to the report within the renderers, we want the original object untouched
+    const clone = /** @type {LH.ReportResult} */ (JSON.parse(JSON.stringify(result)));
+
+    // If LHR is older (≤3.0.3), it has no locale setting. Set default.
+    if (!clone.configSettings.locale) {
+      clone.configSettings.locale = 'en';
+    }
+
+    for (const audit of Object.values(clone.audits)) {
+      // Turn 'not-applicable' (LHR <4.0) and 'not_applicable' (older proto versions)
+      // into 'notApplicable' (LHR ≥4.0).
+      // @ts-ignore tsc rightly flags that these values shouldn't occur.
+      // eslint-disable-next-line max-len
+      if (audit.scoreDisplayMode === 'not_applicable' || audit.scoreDisplayMode === 'not-applicable') {
+        audit.scoreDisplayMode = 'notApplicable';
+      }
+
+      if (audit.details) {
+        // Turn `auditDetails.type` of undefined (LHR <4.2) and 'diagnostic' (LHR <5.0)
+        // into 'debugdata' (LHR ≥5.0).
+        // @ts-ignore tsc rightly flags that these values shouldn't occur.
+        if (audit.details.type === undefined || audit.details.type === 'diagnostic') {
+          audit.details.type = 'debugdata';
+        }
+
+        // Add the jpg data URL prefix to filmstrip screenshots without them (LHR <5.0).
+        if (audit.details.type === 'filmstrip') {
+          for (const screenshot of audit.details.items) {
+            if (!screenshot.data.startsWith(SCREENSHOT_PREFIX)) {
+              screenshot.data = SCREENSHOT_PREFIX + screenshot.data;
+            }
+          }
+        }
+      }
+    }
+
+    // Set locale for number/date formatting and grab localized renderer strings from the LHR.
+    Util.setNumberDateLocale(clone.configSettings.locale);
+    if (clone.i18n && clone.i18n.rendererFormattedStrings) {
+      Util.updateAllUIStrings(clone.i18n.rendererFormattedStrings);
+    }
+
+    // For convenience, smoosh all AuditResults into their auditRef (which has just weight & group)
+    if (typeof clone.categories !== 'object') throw new Error('No categories provided.');
+    for (const category of Object.values(clone.categories)) {
+      category.auditRefs.forEach(auditRef => {
+        const result = clone.audits[auditRef.id];
+        auditRef.result = result;
+
+        // attach the stackpacks to the auditRef object
+        if (clone.stackPacks) {
+          clone.stackPacks.forEach(pack => {
+            if (pack.descriptions[auditRef.id]) {
+              auditRef.stackPacks = auditRef.stackPacks || [];
+              auditRef.stackPacks.push({
+                title: pack.title,
+                iconDataURL: pack.iconDataURL,
+                description: pack.descriptions[auditRef.id],
+              });
+            }
+          });
+        }
+      });
+    }
+
+    return clone;
+  }
+
+
+  /**
+   * @param {LH.I18NRendererStrings} rendererFormattedStrings
+   */
+  static updateAllUIStrings(rendererFormattedStrings) {
+    // TODO(i18n): don't mutate these here but on the LHR and pass that around everywhere
+    for (const [key, value] of Object.entries(rendererFormattedStrings)) {
+      Util.UIStrings[key] = value;
+    }
+  }
+
+  /**
+   * Used to determine if the "passed" for the purposes of showing up in the "failed" or "passed"
+   * sections of the report.
+   *
+   * @param {{score: (number|null), scoreDisplayMode: string}} audit
+   * @return {boolean}
+   */
+  static showAsPassed(audit) {
+    switch (audit.scoreDisplayMode) {
+      case 'manual':
+      case 'notApplicable':
+        return true;
+      case 'error':
+      case 'informative':
+        return false;
+      case 'numeric':
+      case 'binary':
+      default:
+        return Number(audit.score) >= RATINGS.PASS.minScore;
+    }
+  }
+
+  /**
+   * Convert a score to a rating label.
+   * @param {number|null} score
+   * @param {string=} scoreDisplayMode
+   * @return {string}
+   */
+  static calculateRating(score, scoreDisplayMode) {
+    // Handle edge cases first, manual and not applicable receive 'pass', errored audits receive 'error'
+    if (scoreDisplayMode === 'manual' || scoreDisplayMode === 'notApplicable') {
+      return RATINGS.PASS.label;
+    } else if (scoreDisplayMode === 'error') {
+      return RATINGS.ERROR.label;
+    } else if (score === null) {
+      return RATINGS.FAIL.label;
+    }
+
+    // At this point, we're rating a standard binary/numeric audit
+    let rating = RATINGS.FAIL.label;
+    if (score >= RATINGS.PASS.minScore) {
+      rating = RATINGS.PASS.label;
+    } else if (score >= RATINGS.AVERAGE.minScore) {
+      rating = RATINGS.AVERAGE.label;
+    }
+    return rating;
+  }
+
+  /**
+   * Format number.
+   * @param {number} number
+   * @param {number=} granularity Number of decimal places to include. Defaults to 0.1.
+   * @return {string}
+   */
+  static formatNumber(number, granularity = 0.1) {
+    const coarseValue = Math.round(number / granularity) * granularity;
+    return Util.numberFormatter.format(coarseValue);
+  }
+
+  /**
+   * @param {number} size
+   * @param {number=} granularity Controls how coarse the displayed value is, defaults to .01
+   * @return {string}
+   */
+  static formatBytesToKB(size, granularity = 0.1) {
+    const kbs = Util.numberFormatter.format(Math.round(size / 1024 / granularity) * granularity);
+    return `${kbs}${NBSP}KB`;
+  }
+
+  /**
+   * @param {number} ms
+   * @param {number=} granularity Controls how coarse the displayed value is, defaults to 10
+   * @return {string}
+   */
+  static formatMilliseconds(ms, granularity = 10) {
+    const coarseTime = Math.round(ms / granularity) * granularity;
+    return `${Util.numberFormatter.format(coarseTime)}${NBSP}ms`;
+  }
+
+  /**
+   * @param {number} ms
+   * @param {number=} granularity Controls how coarse the displayed value is, defaults to 0.1
+   * @return {string}
+   */
+  static formatSeconds(ms, granularity = 0.1) {
+    const coarseTime = Math.round(ms / 1000 / granularity) * granularity;
+    return `${Util.numberFormatter.format(coarseTime)}${NBSP}s`;
+  }
+
+  /**
+   * Format time.
+   * @param {string} date
+   * @return {string}
+   */
+  static formatDateTime(date) {
+    /** @type {Intl.DateTimeFormatOptions} */
+    const options = {
+      month: 'short', day: 'numeric', year: 'numeric',
+      hour: 'numeric', minute: 'numeric', timeZoneName: 'short',
+    };
+    let formatter = new Intl.DateTimeFormat(Util.numberDateLocale, options);
+
+    // Force UTC if runtime timezone could not be detected.
+    // See https://github.com/GoogleChrome/lighthouse/issues/1056
+    const tz = formatter.resolvedOptions().timeZone;
+    if (!tz || tz.toLowerCase() === 'etc/unknown') {
+      options.timeZone = 'UTC';
+      formatter = new Intl.DateTimeFormat(Util.numberDateLocale, options);
+    }
+    return formatter.format(new Date(date));
+  }
+  /**
+   * Converts a time in milliseconds into a duration string, i.e. `1d 2h 13m 52s`
+   * @param {number} timeInMilliseconds
+   * @return {string}
+   */
+  static formatDuration(timeInMilliseconds) {
+    let timeInSeconds = timeInMilliseconds / 1000;
+    if (Math.round(timeInSeconds) === 0) {
+      return 'None';
+    }
+
+    /** @type {Array<string>} */
+    const parts = [];
+    const unitLabels = /** @type {Object<string, number>} */ ({
+      d: 60 * 60 * 24,
+      h: 60 * 60,
+      m: 60,
+      s: 1,
+    });
+
+    Object.keys(unitLabels).forEach(label => {
+      const unit = unitLabels[label];
+      const numberOfUnits = Math.floor(timeInSeconds / unit);
+      if (numberOfUnits > 0) {
+        timeInSeconds -= numberOfUnits * unit;
+        parts.push(`${numberOfUnits}\xa0${label}`);
+      }
+    });
+
+    return parts.join(' ');
+  }
+
+  /**
+   * Split a string by markdown code spans (enclosed in `backticks`), splitting
+   * into segments that were enclosed in backticks (marked as `isCode === true`)
+   * and those that outside the backticks (`isCode === false`).
+   * @param {string} text
+   * @return {Array<{isCode: true, text: string}|{isCode: false, text: string}>}
+   */
+  static splitMarkdownCodeSpans(text) {
+    /** @type {Array<{isCode: true, text: string}|{isCode: false, text: string}>} */
+    const segments = [];
+
+    // Split on backticked code spans.
+    const parts = text.split(/`(.*?)`/g);
+    for (let i = 0; i < parts.length; i ++) {
+      const text = parts[i];
+
+      // Empty strings are an artifact of splitting, not meaningful.
+      if (!text) continue;
+
+      // Alternates between plain text and code segments.
+      const isCode = i % 2 !== 0;
+      segments.push({
+        isCode,
+        text,
+      });
+    }
+
+    return segments;
+  }
+
+  /**
+   * Split a string on markdown links (e.g. [some link](https://...)) into
+   * segments of plain text that weren't part of a link (marked as
+   * `isLink === false`), and segments with text content and a URL that did make
+   * up a link (marked as `isLink === true`).
+   * @param {string} text
+   * @return {Array<{isLink: true, text: string, linkHref: string}|{isLink: false, text: string}>}
+   */
+  static splitMarkdownLink(text) {
+    /** @type {Array<{isLink: true, text: string, linkHref: string}|{isLink: false, text: string}>} */
+    const segments = [];
+
+    const parts = text.split(/\[([^\]]+?)\]\((https?:\/\/.*?)\)/g);
+    while (parts.length) {
+      // Shift off the same number of elements as the pre-split and capture groups.
+      const [preambleText, linkText, linkHref] = parts.splice(0, 3);
+
+      if (preambleText) { // Skip empty text as it's an artifact of splitting, not meaningful.
+        segments.push({
+          isLink: false,
+          text: preambleText,
+        });
+      }
+
+      // Append link if there are any.
+      if (linkText && linkHref) {
+        segments.push({
+          isLink: true,
+          text: linkText,
+          linkHref,
+        });
+      }
+    }
+
+    return segments;
+  }
+
+  /**
+   * @param {URL} parsedUrl
+   * @param {{numPathParts?: number, preserveQuery?: boolean, preserveHost?: boolean}=} options
+   * @return {string}
+   */
+  static getURLDisplayName(parsedUrl, options) {
+    // Closure optional properties aren't optional in tsc, so fallback needs undefined  values.
+    options = options || {numPathParts: undefined, preserveQuery: undefined,
+      preserveHost: undefined};
+    const numPathParts = options.numPathParts !== undefined ? options.numPathParts : 2;
+    const preserveQuery = options.preserveQuery !== undefined ? options.preserveQuery : true;
+    const preserveHost = options.preserveHost || false;
+
+    let name;
+
+    if (parsedUrl.protocol === 'about:' || parsedUrl.protocol === 'data:') {
+      // Handle 'about:*' and 'data:*' URLs specially since they have no path.
+      name = parsedUrl.href;
+    } else {
+      name = parsedUrl.pathname;
+      const parts = name.split('/').filter(part => part.length);
+      if (numPathParts && parts.length > numPathParts) {
+        name = ELLIPSIS + parts.slice(-1 * numPathParts).join('/');
+      }
+
+      if (preserveHost) {
+        name = `${parsedUrl.host}/${name.replace(/^\//, '')}`;
+      }
+      if (preserveQuery) {
+        name = `${name}${parsedUrl.search}`;
+      }
+    }
+
+    const MAX_LENGTH = 64;
+    // Always elide hexadecimal hash
+    name = name.replace(/([a-f0-9]{7})[a-f0-9]{13}[a-f0-9]*/g, `$1${ELLIPSIS}`);
+    // Also elide other hash-like mixed-case strings
+    name = name.replace(/([a-zA-Z0-9-_]{9})(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])[a-zA-Z0-9-_]{10,}/g,
+      `$1${ELLIPSIS}`);
+    // Also elide long number sequences
+    name = name.replace(/(\d{3})\d{6,}/g, `$1${ELLIPSIS}`);
+    // Merge any adjacent ellipses
+    name = name.replace(/\u2026+/g, ELLIPSIS);
+
+    // Elide query params first
+    if (name.length > MAX_LENGTH && name.includes('?')) {
+      // Try to leave the first query parameter intact
+      name = name.replace(/\?([^=]*)(=)?.*/, `?$1$2${ELLIPSIS}`);
+
+      // Remove it all if it's still too long
+      if (name.length > MAX_LENGTH) {
+        name = name.replace(/\?.*/, `?${ELLIPSIS}`);
+      }
+    }
+
+    // Elide too long names next
+    if (name.length > MAX_LENGTH) {
+      const dotIndex = name.lastIndexOf('.');
+      if (dotIndex >= 0) {
+        name = name.slice(0, MAX_LENGTH - 1 - (name.length - dotIndex)) +
+          // Show file extension
+          `${ELLIPSIS}${name.slice(dotIndex)}`;
+      } else {
+        name = name.slice(0, MAX_LENGTH - 1) + ELLIPSIS;
+      }
+    }
+
+    return name;
+  }
+
+  /**
+   * Split a URL into a file, hostname and origin for easy display.
+   * @param {string} url
+   * @return {{file: string, hostname: string, origin: string}}
+   */
+  static parseURL(url) {
+    const parsedUrl = new URL(url);
+    return {
+      file: Util.getURLDisplayName(parsedUrl),
+      hostname: parsedUrl.hostname,
+      origin: parsedUrl.origin,
+    };
+  }
+
+  /**
+   * @param {string|URL} value
+   * @return {URL}
+   */
+  static createOrReturnURL(value) {
+    if (value instanceof URL) {
+      return value;
+    }
+
+    return new URL(value);
+  }
+
+  /**
+   * Gets the tld of a domain
+   *
+   * @param {string} hostname
+   * @return {string} tld
+   */
+  static getTld(hostname) {
+    const tlds = hostname.split('.').slice(-2);
+
+    if (!listOfTlds.includes(tlds[0])) {
+      return `.${tlds[tlds.length - 1]}`;
+    }
+
+    return `.${tlds.join('.')}`;
+  }
+
+  /**
+   * Returns a primary domain for provided hostname (e.g. www.example.com -> example.com).
+   * @param {string|URL} url hostname or URL object
+   * @returns {string}
+   */
+  static getRootDomain(url) {
+    const hostname = Util.createOrReturnURL(url).hostname;
+    const tld = Util.getTld(hostname);
+
+    // tld is .com or .co.uk which means we means that length is 1 to big
+    // .com => 2 & .co.uk => 3
+    const splitTld = tld.split('.');
+
+    // get TLD + root domain
+    return hostname.split('.').slice(-splitTld.length).join('.');
+  }
+
+  /**
+   * @param {LH.Config.Settings} settings
+   * @return {Array<{name: string, description: string}>}
+   */
+  static getEnvironmentDisplayValues(settings) {
+    const emulationDesc = Util.getEmulationDescriptions(settings);
+
+    return [
+      {
+        name: 'Device',
+        description: emulationDesc.deviceEmulation,
+      },
+      {
+        name: 'Network throttling',
+        description: emulationDesc.networkThrottling,
+      },
+      {
+        name: 'CPU throttling',
+        description: emulationDesc.cpuThrottling,
+      },
+    ];
+  }
+
+  /**
+   * @param {LH.Config.Settings} settings
+   * @return {{deviceEmulation: string, networkThrottling: string, cpuThrottling: string, summary: string}}
+   */
+  static getEmulationDescriptions(settings) {
+    let cpuThrottling;
+    let networkThrottling;
+    let summary;
+
+    const throttling = settings.throttling;
+
+    switch (settings.throttlingMethod) {
+      case 'provided':
+        cpuThrottling = 'Provided by environment';
+        networkThrottling = 'Provided by environment';
+        summary = 'No throttling applied';
+        break;
+      case 'devtools': {
+        const {cpuSlowdownMultiplier, requestLatencyMs} = throttling;
+        cpuThrottling = `${Util.formatNumber(cpuSlowdownMultiplier)}x slowdown (DevTools)`;
+        networkThrottling = `${Util.formatNumber(requestLatencyMs)}${NBSP}ms HTTP RTT, ` +
+          `${Util.formatNumber(throttling.downloadThroughputKbps)}${NBSP}Kbps down, ` +
+          `${Util.formatNumber(throttling.uploadThroughputKbps)}${NBSP}Kbps up (DevTools)`;
+        summary = 'Throttled Slow 4G network';
+        break;
+      }
+      case 'simulate': {
+        const {cpuSlowdownMultiplier, rttMs, throughputKbps} = throttling;
+        cpuThrottling = `${Util.formatNumber(cpuSlowdownMultiplier)}x slowdown (Simulated)`;
+        networkThrottling = `${Util.formatNumber(rttMs)}${NBSP}ms TCP RTT, ` +
+          `${Util.formatNumber(throughputKbps)}${NBSP}Kbps throughput (Simulated)`;
+        summary = 'Simulated Slow 4G network';
+        break;
+      }
+      default:
+        cpuThrottling = 'Unknown';
+        networkThrottling = 'Unknown';
+        summary = 'Unknown';
+    }
+
+    let deviceEmulation = 'No emulation';
+    if (settings.emulatedFormFactor === 'mobile') deviceEmulation = 'Emulated Nexus 5X';
+    if (settings.emulatedFormFactor === 'desktop') deviceEmulation = 'Emulated Desktop';
+
+    return {
+      deviceEmulation,
+      cpuThrottling,
+      networkThrottling,
+      summary: `${deviceEmulation}, ${summary}`,
+    };
+  }
+
+  /**
+   * Set the locale to be used for Util's number and date formatting functions.
+   * @param {LH.Locale} locale
+   */
+  static setNumberDateLocale(locale) {
+    // When testing, use a locale with more exciting numeric formatting
+    if (locale === 'en-XA') locale = 'de';
+
+    Util.numberDateLocale = locale;
+    Util.numberFormatter = new Intl.NumberFormat(locale);
+  }
+
+  /**
+   * Returns only lines that are near a message, or the first few lines if there are
+   * no line messages.
+   * @param {LH.Audit.Details.SnippetValue['lines']} lines
+   * @param {LH.Audit.Details.SnippetValue['lineMessages']} lineMessages
+   * @param {number} surroundingLineCount Number of lines to include before and after
+   * the message. If this is e.g. 2 this function might return 5 lines.
+   */
+  static filterRelevantLines(lines, lineMessages, surroundingLineCount) {
+    if (lineMessages.length === 0) {
+      // no lines with messages, just return the first bunch of lines
+      return lines.slice(0, surroundingLineCount * 2 + 1);
+    }
+
+    const minGapSize = 3;
+    const lineNumbersToKeep = new Set();
+    // Sort messages so we can check lineNumbersToKeep to see how big the gap to
+    // the previous line is.
+    lineMessages = lineMessages.sort((a, b) => (a.lineNumber || 0) - (b.lineNumber || 0));
+    lineMessages.forEach(({lineNumber}) => {
+      let firstSurroundingLineNumber = lineNumber - surroundingLineCount;
+      let lastSurroundingLineNumber = lineNumber + surroundingLineCount;
+
+      while (firstSurroundingLineNumber < 1) {
+        // make sure we still show (surroundingLineCount * 2 + 1) lines in total
+        firstSurroundingLineNumber++;
+        lastSurroundingLineNumber++;
+      }
+      // If only a few lines would be omitted normally then we prefer to include
+      // extra lines to avoid the tiny gap
+      if (lineNumbersToKeep.has(firstSurroundingLineNumber - minGapSize - 1)) {
+        firstSurroundingLineNumber -= minGapSize;
+      }
+      for (let i = firstSurroundingLineNumber; i <= lastSurroundingLineNumber; i++) {
+        const surroundingLineNumber = i;
+        lineNumbersToKeep.add(surroundingLineNumber);
+      }
+    });
+
+    return lines.filter(line => lineNumbersToKeep.has(line.lineNumber));
+  }
+
+  /**
+   * @param {string} categoryId
+   */
+  static isPluginCategory(categoryId) {
+    return categoryId.startsWith('lighthouse-plugin-');
+  }
+}
+
+/**
+ * This value is updated on each run to the locale of the report
+ * @type {LH.Locale}
+ */
+Util.numberDateLocale = 'en';
+
+/**
+ * This value stays in sync with Util.numberDateLocale.
+ * @type {Intl.NumberFormat}
+ */
+Util.numberFormatter = new Intl.NumberFormat(Util.numberDateLocale);
+
+/**
+ * Report-renderer-specific strings.
+ * @type {LH.I18NRendererStrings}
+ */
+Util.UIStrings = {
+  /** Disclaimer shown to users below the metric values (First Contentful Paint, Time to Interactive, etc) to warn them that the numbers they see will likely change slightly the next time they run Lighthouse. */
+  varianceDisclaimer: 'Values are estimated and may vary. The performance score is [based only on these metrics](https://github.com/GoogleChrome/lighthouse/blob/d2ec9ffbb21de9ad1a0f86ed24575eda32c796f0/docs/scoring.md#how-are-the-scores-weighted).',
+  /** Column heading label for the listing of opportunity audits. Each audit title represents an opportunity. There are only 2 columns, so no strict character limit.  */
+  opportunityResourceColumnLabel: 'Opportunity',
+  /** Column heading label for the estimated page load savings of opportunity audits. Estimated Savings is the total amount of time (in seconds) that Lighthouse computed could be reduced from the total page load time, if the suggested action is taken. There are only 2 columns, so no strict character limit. */
+  opportunitySavingsColumnLabel: 'Estimated Savings',
+
+  /** An error string displayed next to a particular audit when it has errored, but not provided any specific error message. */
+  errorMissingAuditInfo: 'Report error: no audit information',
+  /** A label, shown next to an audit title or metric title, indicating that there was an error computing it. The user can hover on the label to reveal a tooltip with the extended error message. Translation should be short (< 20 characters). */
+  errorLabel: 'Error!',
+  /** This label is shown above a bulleted list of warnings. It is shown directly below an audit that produced warnings. Warnings describe situations the user should be aware of, as Lighthouse was unable to complete all the work required on this audit. For example, The 'Unable to decode image (biglogo.jpg)' warning may show up below an image encoding audit. */
+  warningHeader: 'Warnings: ',
+  /** The tooltip text on an expandable chevron icon. Clicking the icon expands a section to reveal a list of audit results that was hidden by default. */
+  auditGroupExpandTooltip: 'Show audits',
+  /** Section heading shown above a list of passed audits that contain warnings. Audits under this section do not negatively impact the score, but Lighthouse has generated some potentially actionable suggestions that should be reviewed. This section is expanded by default and displays after the failing audits. */
+  warningAuditsGroupTitle: 'Passed audits but with warnings',
+  /** Section heading shown above a list of audits that are passing. 'Passed' here refers to a passing grade. This section is collapsed by default, as the user should be focusing on the failed audits instead. Users can click this heading to reveal the list. */
+  passedAuditsGroupTitle: 'Passed audits',
+  /** Section heading shown above a list of audits that do not apply to the page. For example, if an audit is 'Are images optimized?', but the page has no images on it, the audit will be marked as not applicable. This is neither passing or failing. This section is collapsed by default, as the user should be focusing on the failed audits instead. Users can click this heading to reveal the list. */
+  notApplicableAuditsGroupTitle: 'Not applicable',
+  /** Section heading shown above a list of audits that were not computed by Lighthouse. They serve as a list of suggestions for the user to go and manually check. For example, Lighthouse can't automate testing cross-browser compatibility, so that is listed within this section, so the user is reminded to test it themselves. This section is collapsed by default, as the user should be focusing on the failed audits instead. Users can click this heading to reveal the list. */
+  manualAuditsGroupTitle: 'Additional items to manually check',
+
+  /** Label shown preceding any important warnings that may have invalidated the entire report. For example, if the user has Chrome extensions installed, they may add enough performance overhead that Lighthouse's performance metrics are unreliable. If shown, this will be displayed at the top of the report UI. */
+  toplevelWarningsMessage: 'There were issues affecting this run of Lighthouse:',
+
+  /** String of text shown in a graphical representation of the flow of network requests for the web page. This label represents the initial network request that fetches an HTML page. This navigation may be redirected (eg. Initial navigation to http://example.com redirects to https://www.example.com). */
+  crcInitialNavigation: 'Initial Navigation',
+  /** Label of value shown in the summary of critical request chains. Refers to the total amount of time (milliseconds) of the longest critical path chain/sequence of network requests. Example value: 2310 ms */
+  crcLongestDurationLabel: 'Maximum critical path latency:',
+
+  /** Label for button that shows all lines of the snippet when clicked */
+  snippetExpandButtonLabel: 'Expand snippet',
+  /** Label for button that only shows a few lines of the snippet when clicked */
+  snippetCollapseButtonLabel: 'Collapse snippet',
+
+  /** Explanation shown to users below performance results to inform them that the test was done with a 4G network connection and to warn them that the numbers they see will likely change slightly the next time they run Lighthouse. 'Lighthouse' becomes link text to additional documentation. */
+  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.',
+  /** Title of the lab data section of the Performance category. Within this section are various speed metrics which quantify the pageload performance into values presented in seconds and milliseconds. "Lab" is an abbreviated form of "laboratory", and refers to the fact that the data is from a controlled test of a website, not measurements from real users visiting that site.  */
+  labDataTitle: 'Lab Data',
+
+  /** This label is for a checkbox above a table of items loaded by a web page. The checkbox is used to show or hide third-party (or "3rd-party") resources in the table, where "third-party resources" refers to items loaded by a web page from URLs that aren't controlled by the owner of the web page. */
+  thirdPartyResourcesLabel: 'Show 3rd-party resources',
+};
+
+if (typeof module !== 'undefined' && module.exports) {
+  module.exports = Util;
+} else {
+  self.Util = Util;
+}
+;
+/**
+ * @license
+ * Copyright 2017 Google Inc. All Rights Reserved.
+ *
+ * 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
+ *
+ * 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.
+ */
+'use strict';
+
+/* globals URL self Util */
+
+/** @typedef {HTMLElementTagNameMap & {[id: string]: HTMLElement}} HTMLElementByTagName */
+
+class DOM {
+  /**
+   * @param {Document} document
+   */
+  constructor(document) {
+    /** @type {Document} */
+    this._document = document;
+    /** @type {string} */
+    this._lighthouseChannel = 'unknown';
+  }
+
+  /**
+   * @template {string} T
+   * @param {T} name
+   * @param {string=} className
+   * @param {Object<string, (string|undefined)>=} attrs Attribute key/val pairs.
+   *     Note: if an attribute key has an undefined value, this method does not
+   *     set the attribute on the node.
+   * @return {HTMLElementByTagName[T]}
+   */
+  createElement(name, className, attrs = {}) {
+    const element = this._document.createElement(name);
+    if (className) {
+      element.className = className;
+    }
+    Object.keys(attrs).forEach(key => {
+      const value = attrs[key];
+      if (typeof value !== 'undefined') {
+        element.setAttribute(key, value);
+      }
+    });
+    return element;
+  }
+
+  /**
+   * @return {DocumentFragment}
+   */
+  createFragment() {
+    return this._document.createDocumentFragment();
+  }
+
+  /**
+   * @template {string} T
+   * @param {Element} parentElem
+   * @param {T} elementName
+   * @param {string=} className
+   * @param {Object<string, (string|undefined)>=} attrs Attribute key/val pairs.
+   *     Note: if an attribute key has an undefined value, this method does not
+   *     set the attribute on the node.
+   * @return {HTMLElementByTagName[T]}
+   */
+  createChildOf(parentElem, elementName, className, attrs) {
+    const element = this.createElement(elementName, className, attrs);
+    parentElem.appendChild(element);
+    return element;
+  }
+
+  /**
+   * @param {string} selector
+   * @param {ParentNode} context
+   * @return {DocumentFragment} A clone of the template content.
+   * @throws {Error}
+   */
+  cloneTemplate(selector, context) {
+    const template = /** @type {?HTMLTemplateElement} */ (context.querySelector(selector));
+    if (!template) {
+      throw new Error(`Template not found: template${selector}`);
+    }
+
+    const clone = this._document.importNode(template.content, true);
+
+    // Prevent duplicate styles in the DOM. After a template has been stamped
+    // for the first time, remove the clone's styles so they're not re-added.
+    if (template.hasAttribute('data-stamped')) {
+      this.findAll('style', clone).forEach(style => style.remove());
+    }
+    template.setAttribute('data-stamped', 'true');
+
+    return clone;
+  }
+
+  /**
+   * Resets the "stamped" state of the templates.
+   */
+  resetTemplates() {
+    this.findAll('template[data-stamped]', this._document).forEach(t => {
+      t.removeAttribute('data-stamped');
+    });
+  }
+
+  /**
+   * @param {string} text
+   * @return {Element}
+   */
+  convertMarkdownLinkSnippets(text) {
+    const element = this.createElement('span');
+
+    for (const segment of Util.splitMarkdownLink(text)) {
+      if (!segment.isLink) {
+        // Plain text segment.
+        element.appendChild(this._document.createTextNode(segment.text));
+        continue;
+      }
+
+      // Otherwise, append any links found.
+      const url = new URL(segment.linkHref);
+
+      const DOCS_ORIGINS = ['https://developers.google.com', 'https://web.dev'];
+      if (DOCS_ORIGINS.includes(url.origin)) {
+        url.searchParams.set('utm_source', 'lighthouse');
+        url.searchParams.set('utm_medium', this._lighthouseChannel);
+      }
+
+      const a = this.createElement('a');
+      a.rel = 'noopener';
+      a.target = '_blank';
+      a.textContent = segment.text;
+      a.href = url.href;
+      element.appendChild(a);
+    }
+
+    return element;
+  }
+
+  /**
+   * @param {string} markdownText
+   * @return {Element}
+   */
+  convertMarkdownCodeSnippets(markdownText) {
+    const element = this.createElement('span');
+
+    for (const segment of Util.splitMarkdownCodeSpans(markdownText)) {
+      if (segment.isCode) {
+        const pre = this.createElement('code');
+        pre.textContent = segment.text;
+        element.appendChild(pre);
+      } else {
+        element.appendChild(this._document.createTextNode(segment.text));
+      }
+    }
+
+    return element;
+  }
+
+  /**
+   * The channel to use for UTM data when rendering links to the documentation.
+   * @param {string} lighthouseChannel
+   */
+  setLighthouseChannel(lighthouseChannel) {
+    this._lighthouseChannel = lighthouseChannel;
+  }
+
+  /**
+   * @return {Document}
+   */
+  document() {
+    return this._document;
+  }
+
+  /**
+   * TODO(paulirish): import and conditionally apply the DevTools frontend subclasses instead of this
+   * @return {boolean}
+   */
+  isDevTools() {
+    return !!this._document.querySelector('.lh-devtools');
+  }
+
+  /**
+   * Guaranteed context.querySelector. Always returns an element or throws if
+   * nothing matches query.
+   * @param {string} query
+   * @param {ParentNode} context
+   * @return {HTMLElement}
+   */
+  find(query, context) {
+    /** @type {?HTMLElement} */
+    const result = context.querySelector(query);
+    if (result === null) {
+      throw new Error(`query ${query} not found`);
+    }
+    return result;
+  }
+
+  /**
+   * Helper for context.querySelectorAll. Returns an Array instead of a NodeList.
+   * @param {string} query
+   * @param {ParentNode} context
+   * @return {Array<HTMLElement>}
+   */
+  findAll(query, context) {
+    return Array.from(context.querySelectorAll(query));
+  }
+}
+
+if (typeof module !== 'undefined' && module.exports) {
+  module.exports = DOM;
+} else {
+  self.DOM = DOM;
+}
+;
+/*
+Details Element Polyfill 2.4.0
+Copyright © 2019 Javan Makhmali
+ */
+(function() {
+  "use strict";
+  var element = document.createElement("details");
+  var elementIsNative = typeof HTMLDetailsElement != "undefined" && element instanceof HTMLDetailsElement;
+  var support = {
+    open: "open" in element || elementIsNative,
+    toggle: "ontoggle" in element
+  };
+  var styles = '\ndetails, summary {\n  display: block;\n}\ndetails:not([open]) > *:not(summary) {\n  display: none;\n}\nsummary::before {\n  content: "â–º";\n  padding-right: 0.3rem;\n  font-size: 0.6rem;\n  cursor: default;\n}\n[open] > summary::before {\n  content: "â–¼";\n}\n';
+  var _ref = [], forEach = _ref.forEach, slice = _ref.slice;
+  if (!support.open) {
+    polyfillStyles();
+    polyfillProperties();
+    polyfillToggle();
+    polyfillAccessibility();
+  }
+  if (support.open && !support.toggle) {
+    polyfillToggleEvent();
+  }
+  function polyfillStyles() {
+    document.head.insertAdjacentHTML("afterbegin", "<style>" + styles + "</style>");
+  }
+  function polyfillProperties() {
+    var prototype = document.createElement("details").constructor.prototype;
+    var setAttribute = prototype.setAttribute, removeAttribute = prototype.removeAttribute;
+    var open = Object.getOwnPropertyDescriptor(prototype, "open");
+    Object.defineProperties(prototype, {
+      open: {
+        get: function get() {
+          if (this.tagName == "DETAILS") {
+            return this.hasAttribute("open");
+          } else {
+            if (open && open.get) {
+              return open.get.call(this);
+            }
+          }
+        },
+        set: function set(value) {
+          if (this.tagName == "DETAILS") {
+            return value ? this.setAttribute("open", "") : this.removeAttribute("open");
+          } else {
+            if (open && open.set) {
+              return open.set.call(this, value);
+            }
+          }
+        }
+      },
+      setAttribute: {
+        value: function value(name, _value) {
+          var _this = this;
+          var call = function call() {
+            return setAttribute.call(_this, name, _value);
+          };
+          if (name == "open" && this.tagName == "DETAILS") {
+            var wasOpen = this.hasAttribute("open");
+            var result = call();
+            if (!wasOpen) {
+              var summary = this.querySelector("summary");
+              if (summary) summary.setAttribute("aria-expanded", true);
+              triggerToggle(this);
+            }
+            return result;
+          }
+          return call();
+        }
+      },
+      removeAttribute: {
+        value: function value(name) {
+          var _this2 = this;
+          var call = function call() {
+            return removeAttribute.call(_this2, name);
+          };
+          if (name == "open" && this.tagName == "DETAILS") {
+            var wasOpen = this.hasAttribute("open");
+            var result = call();
+            if (wasOpen) {
+              var summary = this.querySelector("summary");
+              if (summary) summary.setAttribute("aria-expanded", false);
+              triggerToggle(this);
+            }
+            return result;
+          }
+          return call();
+        }
+      }
+    });
+  }
+  function polyfillToggle() {
+    onTogglingTrigger(function(element) {
+      element.hasAttribute("open") ? element.removeAttribute("open") : element.setAttribute("open", "");
+    });
+  }
+  function polyfillToggleEvent() {
+    if (window.MutationObserver) {
+      new MutationObserver(function(mutations) {
+        forEach.call(mutations, function(mutation) {
+          var target = mutation.target, attributeName = mutation.attributeName;
+          if (target.tagName == "DETAILS" && attributeName == "open") {
+            triggerToggle(target);
+          }
+        });
+      }).observe(document.documentElement, {
+        attributes: true,
+        subtree: true
+      });
+    } else {
+      onTogglingTrigger(function(element) {
+        var wasOpen = element.getAttribute("open");
+        setTimeout(function() {
+          var isOpen = element.getAttribute("open");
+          if (wasOpen != isOpen) {
+            triggerToggle(element);
+          }
+        }, 1);
+      });
+    }
+  }
+  function polyfillAccessibility() {
+    setAccessibilityAttributes(document);
+    if (window.MutationObserver) {
+      new MutationObserver(function(mutations) {
+        forEach.call(mutations, function(mutation) {
+          forEach.call(mutation.addedNodes, setAccessibilityAttributes);
+        });
+      }).observe(document.documentElement, {
+        subtree: true,
+        childList: true
+      });
+    } else {
+      document.addEventListener("DOMNodeInserted", function(event) {
+        setAccessibilityAttributes(event.target);
+      });
+    }
+  }
+  function setAccessibilityAttributes(root) {
+    findElementsWithTagName(root, "SUMMARY").forEach(function(summary) {
+      var details = findClosestElementWithTagName(summary, "DETAILS");
+      summary.setAttribute("aria-expanded", details.hasAttribute("open"));
+      if (!summary.hasAttribute("tabindex")) summary.setAttribute("tabindex", "0");
+      if (!summary.hasAttribute("role")) summary.setAttribute("role", "button");
+    });
+  }
+  function eventIsSignificant(event) {
+    return !(event.defaultPrevented || event.ctrlKey || event.metaKey || event.shiftKey || event.target.isContentEditable);
+  }
+  function onTogglingTrigger(callback) {
+    addEventListener("click", function(event) {
+      if (eventIsSignificant(event)) {
+        if (event.which <= 1) {
+          var element = findClosestElementWithTagName(event.target, "SUMMARY");
+          if (element && element.parentNode && element.parentNode.tagName == "DETAILS") {
+            callback(element.parentNode);
+          }
+        }
+      }
+    }, false);
+    addEventListener("keydown", function(event) {
+      if (eventIsSignificant(event)) {
+        if (event.keyCode == 13 || event.keyCode == 32) {
+          var element = findClosestElementWithTagName(event.target, "SUMMARY");
+          if (element && element.parentNode && element.parentNode.tagName == "DETAILS") {
+            callback(element.parentNode);
+            event.preventDefault();
+          }
+        }
+      }
+    }, false);
+  }
+  function triggerToggle(element) {
+    var event = document.createEvent("Event");
+    event.initEvent("toggle", false, false);
+    element.dispatchEvent(event);
+  }
+  function findElementsWithTagName(root, tagName) {
+    return (root.tagName == tagName ? [ root ] : []).concat(typeof root.getElementsByTagName == "function" ? slice.call(root.getElementsByTagName(tagName)) : []);
+  }
+  function findClosestElementWithTagName(element, tagName) {
+    if (typeof element.closest == "function") {
+      return element.closest(tagName);
+    } else {
+      while (element) {
+        if (element.tagName == tagName) {
+          return element;
+        } else {
+          element = element.parentNode;
+        }
+      }
+    }
+  }
+})();
+;
+/**
+ * @license
+ * Copyright 2017 Google Inc. All Rights Reserved.
+ *
+ * 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
+ *
+ * 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.
+ */
+'use strict';
+
+/* globals self CriticalRequestChainRenderer SnippetRenderer Util URL */
+
+/** @typedef {import('./dom.js')} DOM */
+
+const URL_PREFIXES = ['http://', 'https://', 'data:'];
+
+class DetailsRenderer {
+  /**
+   * @param {DOM} dom
+   */
+  constructor(dom) {
+    /** @type {DOM} */
+    this._dom = dom;
+    /** @type {ParentNode} */
+    this._templateContext; // eslint-disable-line no-unused-expressions
+  }
+
+  /**
+   * @param {ParentNode} context
+   */
+  setTemplateContext(context) {
+    this._templateContext = context;
+  }
+
+  /**
+   * @param {LH.Audit.Details} details
+   * @return {Element|null}
+   */
+  render(details) {
+    switch (details.type) {
+      case 'filmstrip':
+        return this._renderFilmstrip(details);
+      case 'list':
+        return this._renderList(details);
+      case 'table':
+        return this._renderTable(details);
+      case 'criticalrequestchain':
+        return CriticalRequestChainRenderer.render(this._dom, this._templateContext, details, this);
+      case 'opportunity':
+        return this._renderTable(details);
+
+      // Internal-only details, not for rendering.
+      case 'screenshot':
+      case 'debugdata':
+        return null;
+
+      default: {
+        // @ts-ignore tsc thinks this is unreachable, but be forward compatible
+        // with new unexpected detail types.
+        return this._renderUnknown(details.type, details);
+      }
+    }
+  }
+
+  /**
+   * @param {{value: number, granularity?: number}} details
+   * @return {Element}
+   */
+  _renderBytes(details) {
+    // TODO: handle displayUnit once we have something other than 'kb'
+    const value = Util.formatBytesToKB(details.value, details.granularity);
+    return this._renderText(value);
+  }
+
+  /**
+   * @param {{value: number, granularity?: number, displayUnit?: string}} details
+   * @return {Element}
+   */
+  _renderMilliseconds(details) {
+    let value = Util.formatMilliseconds(details.value, details.granularity);
+    if (details.displayUnit === 'duration') {
+      value = Util.formatDuration(details.value);
+    }
+
+    return this._renderText(value);
+  }
+
+  /**
+   * @param {string} text
+   * @return {HTMLElement}
+   */
+  renderTextURL(text) {
+    const url = text;
+
+    let displayedPath;
+    let displayedHost;
+    let title;
+    try {
+      const parsed = Util.parseURL(url);
+      displayedPath = parsed.file === '/' ? parsed.origin : parsed.file;
+      displayedHost = parsed.file === '/' ? '' : `(${parsed.hostname})`;
+      title = url;
+    } catch (e) {
+      displayedPath = url;
+    }
+
+    const element = this._dom.createElement('div', 'lh-text__url');
+    element.appendChild(this._renderLink({text: displayedPath, url}));
+
+    if (displayedHost) {
+      const hostElem = this._renderText(displayedHost);
+      hostElem.classList.add('lh-text__url-host');
+      element.appendChild(hostElem);
+    }
+
+    if (title) {
+      element.title = url;
+      // set the url on the element's dataset which we use to check 3rd party origins
+      element.dataset.url = url;
+    }
+    return element;
+  }
+
+  /**
+   * @param {{text: string, url: string}} details
+   * @return {Element}
+   */
+  _renderLink(details) {
+    const allowedProtocols = ['https:', 'http:'];
+    let url;
+    try {
+      url = new URL(details.url);
+    } catch (_) {}
+
+    if (!url || !allowedProtocols.includes(url.protocol)) {
+      // Fall back to just the link text if invalid or protocol not allowed.
+      return this._renderText(details.text);
+    }
+
+    const a = this._dom.createElement('a');
+    a.rel = 'noopener';
+    a.target = '_blank';
+    a.textContent = details.text;
+    a.href = url.href;
+
+    return a;
+  }
+
+  /**
+   * @param {string} text
+   * @return {Element}
+   */
+  _renderText(text) {
+    const element = this._dom.createElement('div', 'lh-text');
+    element.textContent = text;
+    return element;
+  }
+
+  /**
+   * @param {string} text
+   * @return {Element}
+   */
+  _renderNumeric(text) {
+    const element = this._dom.createElement('div', 'lh-numeric');
+    element.textContent = text;
+    return element;
+  }
+
+  /**
+   * Create small thumbnail with scaled down image asset.
+   * @param {string} details
+   * @return {Element}
+   */
+  _renderThumbnail(details) {
+    const element = this._dom.createElement('img', 'lh-thumbnail');
+    const strValue = details;
+    element.src = strValue;
+    element.title = strValue;
+    element.alt = '';
+    return element;
+  }
+
+  /**
+   * @param {string} type
+   * @param {*} value
+   */
+  _renderUnknown(type, value) {
+    // eslint-disable-next-line no-console
+    console.error(`Unknown details type: ${type}`, value);
+    const element = this._dom.createElement('details', 'lh-unknown');
+    this._dom.createChildOf(element, 'summary').textContent =
+      `We don't know how to render audit details of type \`${type}\`. ` +
+      'The Lighthouse version that collected this data is likely newer than the Lighthouse ' +
+      'version of the report renderer. Expand for the raw JSON.';
+    this._dom.createChildOf(element, 'pre').textContent = JSON.stringify(value, null, 2);
+    return element;
+  }
+
+  /**
+   * Render a details item value for embedding in a table. Renders the value
+   * based on the heading's valueType, unless the value itself has a `type`
+   * property to override it.
+   * @param {LH.Audit.Details.TableItem[string] | LH.Audit.Details.OpportunityItem[string]} value
+   * @param {LH.Audit.Details.OpportunityColumnHeading} heading
+   * @return {Element|null}
+   */
+  _renderTableValue(value, heading) {
+    if (typeof value === 'undefined' || value === null) {
+      return null;
+    }
+
+    // First deal with the possible object forms of value.
+    if (typeof value === 'object') {
+      // The value's type overrides the heading's for this column.
+      switch (value.type) {
+        case 'code': {
+          return this._renderCode(value.value);
+        }
+        case 'link': {
+          return this._renderLink(value);
+        }
+        case 'node': {
+          return this.renderNode(value);
+        }
+        case 'url': {
+          return this.renderTextURL(value.value);
+        }
+        default: {
+          return this._renderUnknown(value.type, value);
+        }
+      }
+    }
+
+    // Next, deal with primitives.
+    switch (heading.valueType) {
+      case 'bytes': {
+        const numValue = Number(value);
+        return this._renderBytes({value: numValue, granularity: 1});
+      }
+      case 'code': {
+        const strValue = String(value);
+        return this._renderCode(strValue);
+      }
+      case 'ms': {
+        const msValue = {
+          value: Number(value),
+          granularity: heading.granularity,
+          displayUnit: heading.displayUnit,
+        };
+        return this._renderMilliseconds(msValue);
+      }
+      case 'numeric': {
+        const strValue = String(value);
+        return this._renderNumeric(strValue);
+      }
+      case 'text': {
+        const strValue = String(value);
+        return this._renderText(strValue);
+      }
+      case 'thumbnail': {
+        const strValue = String(value);
+        return this._renderThumbnail(strValue);
+      }
+      case 'timespanMs': {
+        const numValue = Number(value);
+        return this._renderMilliseconds({value: numValue});
+      }
+      case 'url': {
+        const strValue = String(value);
+        if (URL_PREFIXES.some(prefix => strValue.startsWith(prefix))) {
+          return this.renderTextURL(strValue);
+        } else {
+          // Fall back to <pre> rendering if not actually a URL.
+          return this._renderCode(strValue);
+        }
+      }
+      default: {
+        return this._renderUnknown(heading.valueType, value);
+      }
+    }
+  }
+
+  /**
+   * Get the headings of a table-like details object, converted into the
+   * OpportunityColumnHeading type until we have all details use the same
+   * heading format.
+   * @param {LH.Audit.Details.Table|LH.Audit.Details.Opportunity} tableLike
+   * @return {Array<LH.Audit.Details.OpportunityColumnHeading>} header
+   */
+  _getCanonicalizedTableHeadings(tableLike) {
+    if (tableLike.type === 'opportunity') {
+      return tableLike.headings;
+    }
+
+    return tableLike.headings.map(heading => {
+      return {
+        key: heading.key,
+        label: heading.text,
+        valueType: heading.itemType,
+        displayUnit: heading.displayUnit,
+        granularity: heading.granularity,
+      };
+    });
+  }
+
+  /**
+   * @param {LH.Audit.Details.Table|LH.Audit.Details.Opportunity} details
+   * @return {Element}
+   */
+  _renderTable(details) {
+    if (!details.items.length) return this._dom.createElement('span');
+
+    const tableElem = this._dom.createElement('table', 'lh-table');
+    const theadElem = this._dom.createChildOf(tableElem, 'thead');
+    const theadTrElem = this._dom.createChildOf(theadElem, 'tr');
+
+    const headings = this._getCanonicalizedTableHeadings(details);
+
+    for (const heading of headings) {
+      const valueType = heading.valueType || 'text';
+      const classes = `lh-table-column--${valueType}`;
+      const labelEl = this._dom.createElement('div', 'lh-text');
+      labelEl.textContent = heading.label;
+      this._dom.createChildOf(theadTrElem, 'th', classes).appendChild(labelEl);
+    }
+
+    const tbodyElem = this._dom.createChildOf(tableElem, 'tbody');
+    for (const row of details.items) {
+      const rowElem = this._dom.createChildOf(tbodyElem, 'tr');
+      for (const heading of headings) {
+        const value = row[heading.key];
+        const valueElement = this._renderTableValue(value, heading);
+
+        if (valueElement) {
+          const classes = `lh-table-column--${heading.valueType}`;
+          this._dom.createChildOf(rowElem, 'td', classes).appendChild(valueElement);
+        } else {
+          this._dom.createChildOf(rowElem, 'td', 'lh-table-column--empty');
+        }
+      }
+    }
+    return tableElem;
+  }
+
+  /**
+   * @param {LH.Audit.Details.List} details
+   * @return {Element}
+   */
+  _renderList(details) {
+    const listContainer = this._dom.createElement('div', 'lh-list');
+
+    details.items.forEach(item => {
+      const snippetEl = SnippetRenderer.render(this._dom, this._templateContext, item, this);
+      listContainer.appendChild(snippetEl);
+    });
+
+    return listContainer;
+  }
+
+  /**
+   * @param {LH.Audit.Details.NodeValue} item
+   * @return {Element}
+   * @protected
+   */
+  renderNode(item) {
+    const element = this._dom.createElement('span', 'lh-node');
+    if (item.nodeLabel) {
+      const nodeLabelEl = this._dom.createElement('div');
+      nodeLabelEl.textContent = item.nodeLabel;
+      element.appendChild(nodeLabelEl);
+    }
+    if (item.snippet) {
+      const snippetEl = this._dom.createElement('div');
+      snippetEl.classList.add('lh-node__snippet');
+      snippetEl.textContent = item.snippet;
+      element.appendChild(snippetEl);
+    }
+    if (item.selector) {
+      element.title = item.selector;
+    }
+    if (item.path) element.setAttribute('data-path', item.path);
+    if (item.selector) element.setAttribute('data-selector', item.selector);
+    if (item.snippet) element.setAttribute('data-snippet', item.snippet);
+
+    return element;
+  }
+
+  /**
+   * @param {LH.Audit.Details.Filmstrip} details
+   * @return {Element}
+   */
+  _renderFilmstrip(details) {
+    const filmstripEl = this._dom.createElement('div', 'lh-filmstrip');
+
+    for (const thumbnail of details.items) {
+      const frameEl = this._dom.createChildOf(filmstripEl, 'div', 'lh-filmstrip__frame');
+      this._dom.createChildOf(frameEl, 'img', 'lh-filmstrip__thumbnail', {
+        src: thumbnail.data,
+        alt: `Screenshot`,
+      });
+    }
+    return filmstripEl;
+  }
+
+  /**
+   * @param {string} text
+   * @return {Element}
+   */
+  _renderCode(text) {
+    const pre = this._dom.createElement('pre', 'lh-code');
+    pre.textContent = text;
+    return pre;
+  }
+}
+
+if (typeof module !== 'undefined' && module.exports) {
+  module.exports = DetailsRenderer;
+} else {
+  self.DetailsRenderer = DetailsRenderer;
+}
+;
+/**
+ * @license
+ * Copyright 2017 Google Inc. All Rights Reserved.
+ *
+ * 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
+ *
+ * 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.
+ */
+'use strict';
+
+/**
+ * @fileoverview This file contains helpers for constructing and rendering the
+ * critical request chains network tree.
+ */
+
+/* globals self Util */
+
+/** @typedef {import('./dom.js')} DOM */
+
+class CriticalRequestChainRenderer {
+  /**
+   * Create render context for critical-request-chain tree display.
+   * @param {LH.Audit.SimpleCriticalRequestNode} tree
+   * @return {{tree: LH.Audit.SimpleCriticalRequestNode, startTime: number, transferSize: number}}
+   */
+  static initTree(tree) {
+    let startTime = 0;
+    const rootNodes = Object.keys(tree);
+    if (rootNodes.length > 0) {
+      const node = tree[rootNodes[0]];
+      startTime = node.request.startTime;
+    }
+
+    return {tree, startTime, transferSize: 0};
+  }
+
+  /**
+   * Helper to create context for each critical-request-chain node based on its
+   * parent. Calculates if this node is the last child, whether it has any
+   * children itself and what the tree looks like all the way back up to the root,
+   * so the tree markers can be drawn correctly.
+   * @param {LH.Audit.SimpleCriticalRequestNode} parent
+   * @param {string} id
+   * @param {number} startTime
+   * @param {number} transferSize
+   * @param {Array<boolean>=} treeMarkers
+   * @param {boolean=} parentIsLastChild
+   * @return {CRCSegment}
+   */
+  static createSegment(parent, id, startTime, transferSize, treeMarkers, parentIsLastChild) {
+    const node = parent[id];
+    const siblings = Object.keys(parent);
+    const isLastChild = siblings.indexOf(id) === (siblings.length - 1);
+    const hasChildren = !!node.children && Object.keys(node.children).length > 0;
+
+    // Copy the tree markers so that we don't change by reference.
+    const newTreeMarkers = Array.isArray(treeMarkers) ? treeMarkers.slice(0) : [];
+
+    // Add on the new entry.
+    if (typeof parentIsLastChild !== 'undefined') {
+      newTreeMarkers.push(!parentIsLastChild);
+    }
+
+    return {
+      node,
+      isLastChild,
+      hasChildren,
+      startTime,
+      transferSize: transferSize + node.request.transferSize,
+      treeMarkers: newTreeMarkers,
+    };
+  }
+
+  /**
+   * Creates the DOM for a tree segment.
+   * @param {DOM} dom
+   * @param {DocumentFragment} tmpl
+   * @param {CRCSegment} segment
+   * @param {DetailsRenderer} detailsRenderer
+   * @return {Node}
+   */
+  static createChainNode(dom, tmpl, segment, detailsRenderer) {
+    const chainsEl = dom.cloneTemplate('#tmpl-lh-crc__chains', tmpl);
+
+    // Hovering over request shows full URL.
+    dom.find('.crc-node', chainsEl).setAttribute('title', segment.node.request.url);
+
+    const treeMarkeEl = dom.find('.crc-node__tree-marker', chainsEl);
+
+    // Construct lines and add spacers for sub requests.
+    segment.treeMarkers.forEach(separator => {
+      if (separator) {
+        treeMarkeEl.appendChild(dom.createElement('span', 'tree-marker vert'));
+        treeMarkeEl.appendChild(dom.createElement('span', 'tree-marker'));
+      } else {
+        treeMarkeEl.appendChild(dom.createElement('span', 'tree-marker'));
+        treeMarkeEl.appendChild(dom.createElement('span', 'tree-marker'));
+      }
+    });
+
+    if (segment.isLastChild) {
+      treeMarkeEl.appendChild(dom.createElement('span', 'tree-marker up-right'));
+      treeMarkeEl.appendChild(dom.createElement('span', 'tree-marker right'));
+    } else {
+      treeMarkeEl.appendChild(dom.createElement('span', 'tree-marker vert-right'));
+      treeMarkeEl.appendChild(dom.createElement('span', 'tree-marker right'));
+    }
+
+    if (segment.hasChildren) {
+      treeMarkeEl.appendChild(dom.createElement('span', 'tree-marker horiz-down'));
+    } else {
+      treeMarkeEl.appendChild(dom.createElement('span', 'tree-marker right'));
+    }
+
+    // Fill in url, host, and request size information.
+    const url = segment.node.request.url;
+    const linkEl = detailsRenderer.renderTextURL(url);
+    const treevalEl = dom.find('.crc-node__tree-value', chainsEl);
+    treevalEl.appendChild(linkEl);
+
+    if (!segment.hasChildren) {
+      const {startTime, endTime, transferSize} = segment.node.request;
+      const span = dom.createElement('span', 'crc-node__chain-duration');
+      span.textContent = ' - ' + Util.formatMilliseconds((endTime - startTime) * 1000) + ', ';
+      const span2 = dom.createElement('span', 'crc-node__chain-duration');
+      span2.textContent = Util.formatBytesToKB(transferSize, 0.01);
+
+      treevalEl.appendChild(span);
+      treevalEl.appendChild(span2);
+    }
+
+    return chainsEl;
+  }
+
+  /**
+   * Recursively builds a tree from segments.
+   * @param {DOM} dom
+   * @param {DocumentFragment} tmpl
+   * @param {CRCSegment} segment
+   * @param {Element} elem Parent element.
+   * @param {LH.Audit.Details.CriticalRequestChain} details
+   * @param {DetailsRenderer} detailsRenderer
+   */
+  static buildTree(dom, tmpl, segment, elem, details, detailsRenderer) {
+    elem.appendChild(CRCRenderer.createChainNode(dom, tmpl, segment, detailsRenderer));
+    if (segment.node.children) {
+      for (const key of Object.keys(segment.node.children)) {
+        const childSegment = CRCRenderer.createSegment(segment.node.children, key,
+          segment.startTime, segment.transferSize, segment.treeMarkers, segment.isLastChild);
+        CRCRenderer.buildTree(dom, tmpl, childSegment, elem, details, detailsRenderer);
+      }
+    }
+  }
+
+  /**
+   * @param {DOM} dom
+   * @param {ParentNode} templateContext
+   * @param {LH.Audit.Details.CriticalRequestChain} details
+   * @param {DetailsRenderer} detailsRenderer
+   * @return {Element}
+   */
+  static render(dom, templateContext, details, detailsRenderer) {
+    const tmpl = dom.cloneTemplate('#tmpl-lh-crc', templateContext);
+    const containerEl = dom.find('.lh-crc', tmpl);
+
+    // Fill in top summary.
+    dom.find('.crc-initial-nav', tmpl).textContent = Util.UIStrings.crcInitialNavigation;
+    dom.find('.lh-crc__longest_duration_label', tmpl).textContent =
+        Util.UIStrings.crcLongestDurationLabel;
+    dom.find('.lh-crc__longest_duration', tmpl).textContent =
+        Util.formatMilliseconds(details.longestChain.duration);
+
+    // Construct visual tree.
+    const root = CRCRenderer.initTree(details.chains);
+    for (const key of Object.keys(root.tree)) {
+      const segment = CRCRenderer.createSegment(root.tree, key, root.startTime, root.transferSize);
+      CRCRenderer.buildTree(dom, tmpl, segment, containerEl, details, detailsRenderer);
+    }
+
+    return dom.find('.lh-crc-container', tmpl);
+  }
+}
+
+// Alias b/c the name is really long.
+const CRCRenderer = CriticalRequestChainRenderer;
+
+// Allow Node require()'ing.
+if (typeof module !== 'undefined' && module.exports) {
+  module.exports = CriticalRequestChainRenderer;
+} else {
+  self.CriticalRequestChainRenderer = CriticalRequestChainRenderer;
+}
+
+/** @typedef {{
+      node: LH.Audit.SimpleCriticalRequestNode[string],
+      isLastChild: boolean,
+      hasChildren: boolean,
+      startTime: number,
+      transferSize: number,
+      treeMarkers: Array<boolean>
+  }} CRCSegment
+ */
+;
+/**
+ * @license Copyright 2019 Google Inc. All Rights Reserved.
+ * 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
+ * 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.
+ */
+'use strict';
+
+/* globals self, Util */
+
+/** @typedef {import('./details-renderer')} DetailsRenderer */
+
+/** @enum {number} */
+const LineVisibility = {
+  /** Show regardless of whether the snippet is collapsed or expanded */
+  ALWAYS: 0,
+  WHEN_COLLAPSED: 1,
+  WHEN_EXPANDED: 2,
+};
+
+/** @enum {number} */
+const LineContentType = {
+  /** A line of content */
+  CONTENT_NORMAL: 0,
+  /** A line of content that's emphasized by setting the CSS background color */
+  CONTENT_HIGHLIGHTED: 1,
+  /** Use when some lines are hidden, shows the "..." placeholder */
+  PLACEHOLDER: 2,
+  /** A message about a line of content or the snippet in general */
+  MESSAGE: 3,
+};
+
+/** @typedef {{
+    content: string;
+    lineNumber: string | number;
+    contentType: LineContentType;
+    truncated?: boolean;
+    visibility?: LineVisibility;
+}} LineDetails */
+
+const classNamesByContentType = {
+  [LineContentType.CONTENT_NORMAL]: ['lh-snippet__line--content'],
+  [LineContentType.CONTENT_HIGHLIGHTED]: [
+    'lh-snippet__line--content',
+    'lh-snippet__line--content-highlighted',
+  ],
+  [LineContentType.PLACEHOLDER]: ['lh-snippet__line--placeholder'],
+  [LineContentType.MESSAGE]: ['lh-snippet__line--message'],
+};
+
+/**
+ * @param {LH.Audit.Details.SnippetValue['lines']} lines
+ * @param {number} lineNumber
+ * @return {{line?: LH.Audit.Details.SnippetValue['lines'][0], previousLine?: LH.Audit.Details.SnippetValue['lines'][0]}}
+ */
+function getLineAndPreviousLine(lines, lineNumber) {
+  return {
+    line: lines.find(l => l.lineNumber === lineNumber),
+    previousLine: lines.find(l => l.lineNumber === lineNumber - 1),
+  };
+}
+
+/**
+ * @param {LH.Audit.Details.SnippetValue["lineMessages"]} messages
+ * @param {number} lineNumber
+ */
+function getMessagesForLineNumber(messages, lineNumber) {
+  return messages.filter(h => h.lineNumber === lineNumber);
+}
+
+/**
+ * @param {LH.Audit.Details.SnippetValue} details
+ * @return {LH.Audit.Details.SnippetValue['lines']}
+ */
+function getLinesWhenCollapsed(details) {
+  const SURROUNDING_LINES_TO_SHOW_WHEN_COLLAPSED = 2;
+  return Util.filterRelevantLines(
+    details.lines,
+    details.lineMessages,
+    SURROUNDING_LINES_TO_SHOW_WHEN_COLLAPSED
+  );
+}
+
+/**
+ * Render snippet of text with line numbers and annotations.
+ * By default we only show a few lines around each annotation and the user
+ * can click "Expand snippet" to show more.
+ * Content lines with annotations are highlighted.
+ */
+class SnippetRenderer {
+  /**
+   * @param {DOM} dom
+   * @param {DocumentFragment} tmpl
+   * @param {LH.Audit.Details.SnippetValue} details
+   * @param {DetailsRenderer} detailsRenderer
+   * @param {function} toggleExpandedFn
+   * @return {DocumentFragment}
+   */
+  static renderHeader(dom, tmpl, details, detailsRenderer, toggleExpandedFn) {
+    const linesWhenCollapsed = getLinesWhenCollapsed(details);
+    const canExpand = linesWhenCollapsed.length < details.lines.length;
+
+    const header = dom.cloneTemplate('#tmpl-lh-snippet__header', tmpl);
+    dom.find('.lh-snippet__title', header).textContent = details.title;
+
+    const {
+      snippetCollapseButtonLabel,
+      snippetExpandButtonLabel,
+    } = Util.UIStrings;
+    dom.find(
+      '.lh-snippet__btn-label-collapse',
+      header
+    ).textContent = snippetCollapseButtonLabel;
+    dom.find(
+      '.lh-snippet__btn-label-expand',
+      header
+    ).textContent = snippetExpandButtonLabel;
+
+    const toggleExpandButton = dom.find('.lh-snippet__toggle-expand', header);
+    // If we're already showing all the available lines of the snippet, we don't need an
+    // expand/collapse button and can remove it from the DOM.
+    // If we leave the button in though, wire up the click listener to toggle visibility!
+    if (!canExpand) {
+      toggleExpandButton.remove();
+    } else {
+      toggleExpandButton.addEventListener('click', () => toggleExpandedFn());
+    }
+
+    // We only show the source node of the snippet in DevTools because then the user can
+    // access the full element detail. Just being able to see the outer HTML isn't very useful.
+    if (details.node && dom.isDevTools()) {
+      const nodeContainer = dom.find('.lh-snippet__node', header);
+      nodeContainer.appendChild(detailsRenderer.renderNode(details.node));
+    }
+
+    return header;
+  }
+
+  /**
+   * Renders a line (text content, message, or placeholder) as a DOM element.
+   * @param {DOM} dom
+   * @param {DocumentFragment} tmpl
+   * @param {LineDetails} lineDetails
+   * @return {Element}
+   */
+  static renderSnippetLine(
+      dom,
+      tmpl,
+      {content, lineNumber, truncated, contentType, visibility}
+  ) {
+    const clonedTemplate = dom.cloneTemplate('#tmpl-lh-snippet__line', tmpl);
+    const contentLine = dom.find('.lh-snippet__line', clonedTemplate);
+    const {classList} = contentLine;
+
+    classNamesByContentType[contentType].forEach(typeClass =>
+      classList.add(typeClass)
+    );
+
+    if (visibility === LineVisibility.WHEN_COLLAPSED) {
+      classList.add('lh-snippet__show-if-collapsed');
+    } else if (visibility === LineVisibility.WHEN_EXPANDED) {
+      classList.add('lh-snippet__show-if-expanded');
+    }
+
+    const lineContent = content + (truncated ? '…' : '');
+    const lineContentEl = dom.find('.lh-snippet__line code', contentLine);
+    if (contentType === LineContentType.MESSAGE) {
+      lineContentEl.appendChild(dom.convertMarkdownLinkSnippets(lineContent));
+    } else {
+      lineContentEl.textContent = lineContent;
+    }
+
+    dom.find(
+      '.lh-snippet__line-number',
+      contentLine
+    ).textContent = lineNumber.toString();
+
+    return contentLine;
+  }
+
+  /**
+   * @param {DOM} dom
+   * @param {DocumentFragment} tmpl
+   * @param {{message: string}} message
+   * @return {Element}
+   */
+  static renderMessage(dom, tmpl, message) {
+    return SnippetRenderer.renderSnippetLine(dom, tmpl, {
+      lineNumber: ' ',
+      content: message.message,
+      contentType: LineContentType.MESSAGE,
+    });
+  }
+
+  /**
+   * @param {DOM} dom
+   * @param {DocumentFragment} tmpl
+   * @param {LineVisibility} visibility
+   * @return {Element}
+   */
+  static renderOmittedLinesPlaceholder(dom, tmpl, visibility) {
+    return SnippetRenderer.renderSnippetLine(dom, tmpl, {
+      lineNumber: '…',
+      content: '',
+      visibility,
+      contentType: LineContentType.PLACEHOLDER,
+    });
+  }
+
+  /**
+   * @param {DOM} dom
+   * @param {DocumentFragment} tmpl
+   * @param {LH.Audit.Details.SnippetValue} details
+   * @return {DocumentFragment}
+   */
+  static renderSnippetContent(dom, tmpl, details) {
+    const template = dom.cloneTemplate('#tmpl-lh-snippet__content', tmpl);
+    const snippetEl = dom.find('.lh-snippet__snippet-inner', template);
+
+    // First render messages that don't belong to specific lines
+    details.generalMessages.forEach(m =>
+      snippetEl.append(SnippetRenderer.renderMessage(dom, tmpl, m))
+    );
+    // Then render the lines and their messages, as well as placeholders where lines are omitted
+    snippetEl.append(SnippetRenderer.renderSnippetLines(dom, tmpl, details));
+
+    return template;
+  }
+
+  /**
+   * @param {DOM} dom
+   * @param {DocumentFragment} tmpl
+   * @param {LH.Audit.Details.SnippetValue} details
+   * @return {DocumentFragment}
+   */
+  static renderSnippetLines(dom, tmpl, details) {
+    const {lineMessages, generalMessages, lineCount, lines} = details;
+    const linesWhenCollapsed = getLinesWhenCollapsed(details);
+    const hasOnlyGeneralMessages =
+      generalMessages.length > 0 && lineMessages.length === 0;
+
+    const lineContainer = dom.createFragment();
+
+    // When a line is not shown in the collapsed state we try to see if we also need an
+    // omitted lines placeholder for the expanded state, rather than rendering two separate
+    // placeholders.
+    let hasPendingOmittedLinesPlaceholderForCollapsedState = false;
+
+    for (let lineNumber = 1; lineNumber <= lineCount; lineNumber++) {
+      const {line, previousLine} = getLineAndPreviousLine(lines, lineNumber);
+      const {
+        line: lineWhenCollapsed,
+        previousLine: previousLineWhenCollapsed,
+      } = getLineAndPreviousLine(linesWhenCollapsed, lineNumber);
+
+      const showLineWhenCollapsed = !!lineWhenCollapsed;
+      const showPreviousLineWhenCollapsed = !!previousLineWhenCollapsed;
+
+      // If we went from showing lines in the collapsed state to not showing them
+      // we need to render a placeholder
+      if (showPreviousLineWhenCollapsed && !showLineWhenCollapsed) {
+        hasPendingOmittedLinesPlaceholderForCollapsedState = true;
+      }
+      // If we are back to lines being visible in the collapsed and the placeholder
+      // hasn't been rendered yet then render it now
+      if (
+        showLineWhenCollapsed &&
+        hasPendingOmittedLinesPlaceholderForCollapsedState
+      ) {
+        lineContainer.append(
+          SnippetRenderer.renderOmittedLinesPlaceholder(
+            dom,
+            tmpl,
+            LineVisibility.WHEN_COLLAPSED
+          )
+        );
+        hasPendingOmittedLinesPlaceholderForCollapsedState = false;
+      }
+
+      // Render omitted lines placeholder if we have not already rendered one for this gap
+      const isFirstOmittedLineWhenExpanded = !line && !!previousLine;
+      const isFirstLineOverallAndIsOmittedWhenExpanded =
+        !line && lineNumber === 1;
+      if (
+        isFirstOmittedLineWhenExpanded ||
+        isFirstLineOverallAndIsOmittedWhenExpanded
+      ) {
+        // In the collapsed state we don't show omitted lines placeholders around
+        // the edges of the snippet
+        const hasRenderedAllLinesVisibleWhenCollapsed = !linesWhenCollapsed.some(
+          l => l.lineNumber > lineNumber
+        );
+        const onlyShowWhenExpanded =
+          hasRenderedAllLinesVisibleWhenCollapsed || lineNumber === 1;
+        lineContainer.append(
+          SnippetRenderer.renderOmittedLinesPlaceholder(
+            dom,
+            tmpl,
+            onlyShowWhenExpanded
+              ? LineVisibility.WHEN_EXPANDED
+              : LineVisibility.ALWAYS
+          )
+        );
+        hasPendingOmittedLinesPlaceholderForCollapsedState = false;
+      }
+
+      if (!line) {
+        // Can't render the line if we don't know its content (instead we've rendered a placeholder)
+        continue;
+      }
+
+      // Now render the line and any messages
+      const messages = getMessagesForLineNumber(lineMessages, lineNumber);
+      const highlightLine = messages.length > 0 || hasOnlyGeneralMessages;
+      const contentLineDetails = Object.assign({}, line, {
+        contentType: highlightLine
+          ? LineContentType.CONTENT_HIGHLIGHTED
+          : LineContentType.CONTENT_NORMAL,
+        visibility: lineWhenCollapsed
+          ? LineVisibility.ALWAYS
+          : LineVisibility.WHEN_EXPANDED,
+      });
+      lineContainer.append(
+        SnippetRenderer.renderSnippetLine(dom, tmpl, contentLineDetails)
+      );
+
+      messages.forEach(message => {
+        lineContainer.append(SnippetRenderer.renderMessage(dom, tmpl, message));
+      });
+    }
+
+    return lineContainer;
+  }
+
+  /**
+   * @param {DOM} dom
+   * @param {ParentNode} templateContext
+   * @param {LH.Audit.Details.SnippetValue} details
+   * @param {DetailsRenderer} detailsRenderer
+   * @return {Element}
+   */
+  static render(dom, templateContext, details, detailsRenderer) {
+    const tmpl = dom.cloneTemplate('#tmpl-lh-snippet', templateContext);
+    const snippetEl = dom.find('.lh-snippet', tmpl);
+
+    const header = SnippetRenderer.renderHeader(
+      dom,
+      tmpl,
+      details,
+      detailsRenderer,
+      () => snippetEl.classList.toggle('lh-snippet--expanded')
+    );
+    const content = SnippetRenderer.renderSnippetContent(dom, tmpl, details);
+    snippetEl.append(header, content);
+
+    return snippetEl;
+  }
+}
+
+// Allow Node require()'ing.
+if (typeof module !== 'undefined' && module.exports) {
+  module.exports = SnippetRenderer;
+} else {
+  self.SnippetRenderer = SnippetRenderer;
+}
+;
+/**
+ * @license Copyright 2017 Google Inc. All Rights Reserved.
+ * 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
+ * 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.
+ */
+'use strict';
+
+/* global URL */
+
+/**
+ * @fileoverview
+ * @suppress {reportUnknownTypes}
+ */
+
+/**
+ * Generate a filenamePrefix of hostname_YYYY-MM-DD_HH-MM-SS
+ * Date/time uses the local timezone, however Node has unreliable ICU
+ * support, so we must construct a YYYY-MM-DD date format manually. :/
+ * @param {{finalUrl: string, fetchTime: string}} lhr
+ * @return {string}
+ */
+function getFilenamePrefix(lhr) {
+  const hostname = new URL(lhr.finalUrl).hostname;
+  const date = (lhr.fetchTime && new Date(lhr.fetchTime)) || new Date();
+
+  const timeStr = date.toLocaleTimeString('en-US', {hour12: false});
+  const dateParts = date.toLocaleDateString('en-US', {
+    year: 'numeric', month: '2-digit', day: '2-digit',
+  }).split('/');
+  // @ts-ignore - parts exists
+  dateParts.unshift(dateParts.pop());
+  const dateStr = dateParts.join('-');
+
+  const filenamePrefix = `${hostname}_${dateStr}_${timeStr}`;
+  // replace characters that are unfriendly to filenames
+  return filenamePrefix.replace(/[/?<>\\:*|"]/g, '-');
+}
+
+// don't attempt to export in the browser.
+if (typeof module !== 'undefined' && module.exports) {
+  module.exports = {getFilenamePrefix};
+}
+;
+/**
+ * @license
+ * Copyright 2017 Google Inc. All Rights Reserved.
+ *
+ * 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
+ *
+ * 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.
+ */
+'use strict';
+
+/**
+ * Logs messages via a UI butter.
+ */
+class Logger {
+  /**
+   * @param {Element} element
+   */
+  constructor(element) {
+    /** @type {Element} */
+    this.el = element;
+    this._id = undefined;
+  }
+
+  /**
+   * Shows a butter bar.
+   * @param {string} msg The message to show.
+   * @param {boolean=} autoHide True to hide the message after a duration.
+   *     Default is true.
+   */
+  log(msg, autoHide = true) {
+    this._id && clearTimeout(this._id);
+
+    this.el.textContent = msg;
+    this.el.classList.add('show');
+    if (autoHide) {
+      this._id = setTimeout(_ => {
+        this.el.classList.remove('show');
+      }, 7000);
+    }
+  }
+
+  /**
+   * @param {string} msg
+   */
+  warn(msg) {
+    this.log('Warning: ' + msg);
+  }
+
+  /**
+   * @param {string} msg
+   */
+  error(msg) {
+    this.log(msg);
+
+    // Rethrow to make sure it's auditable as an error, but in a setTimeout so page
+    // recovers gracefully and user can try loading a report again.
+    setTimeout(_ => {
+      throw new Error(msg);
+    }, 0);
+  }
+
+  /**
+   * Explicitly hides the butter bar.
+   */
+  hide() {
+    this._id && clearTimeout(this._id);
+    this.el.classList.remove('show');
+  }
+}
+
+if (typeof module !== 'undefined' && module.exports) {
+  module.exports = Logger;
+}
+;
+/**
+ * @license
+ * Copyright 2017 Google Inc. All Rights Reserved.
+ *
+ * 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
+ *
+ * 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.
+ */
+'use strict';
+
+/* eslint-env browser */
+
+/**
+ * @fileoverview Adds tools button, print, and other dynamic functionality to
+ * the report.
+ */
+
+/* globals getFilenamePrefix Util */
+
+/**
+ * @param {HTMLTableElement} tableEl
+ * @return {Array<HTMLTableRowElement>}
+ */
+function getTableRows(tableEl) {
+  return Array.from(tableEl.tBodies[0].rows);
+}
+
+class ReportUIFeatures {
+  /**
+   * @param {DOM} dom
+   */
+  constructor(dom) {
+    /** @type {LH.Result} */
+    this.json; // eslint-disable-line no-unused-expressions
+    /** @type {DOM} */
+    this._dom = dom;
+    /** @type {Document} */
+    this._document = this._dom.document();
+    /** @type {ParentNode} */
+    this._templateContext = this._dom.document();
+    /** @type {DropDown} */
+    this._dropDown = new DropDown(this._dom);
+    /** @type {boolean} */
+    this._copyAttempt = false;
+    /** @type {HTMLElement} */
+    this.topbarEl; // eslint-disable-line no-unused-expressions
+    /** @type {HTMLElement} */
+    this.scoreScaleEl; // eslint-disable-line no-unused-expressions
+    /** @type {HTMLElement} */
+    this.stickyHeaderEl; // eslint-disable-line no-unused-expressions
+    /** @type {HTMLElement} */
+    this.highlightEl; // eslint-disable-line no-unused-expressions
+
+    this.onMediaQueryChange = this.onMediaQueryChange.bind(this);
+    this.onCopy = this.onCopy.bind(this);
+    this.onDropDownMenuClick = this.onDropDownMenuClick.bind(this);
+    this.onKeyUp = this.onKeyUp.bind(this);
+    this.collapseAllDetails = this.collapseAllDetails.bind(this);
+    this.expandAllDetails = this.expandAllDetails.bind(this);
+    this._toggleDarkTheme = this._toggleDarkTheme.bind(this);
+    this._updateStickyHeaderOnScroll = this._updateStickyHeaderOnScroll.bind(this);
+  }
+
+  /**
+   * Adds tools button, print, and other functionality to the report. The method
+   * should be called whenever the report needs to be re-rendered.
+   * @param {LH.Result} report
+   */
+  initFeatures(report) {
+    this.json = report;
+
+    this._setupMediaQueryListeners();
+    this._dropDown.setup(this.onDropDownMenuClick);
+    this._setupThirdPartyFilter();
+    this._setUpCollapseDetailsAfterPrinting();
+    this._resetUIState();
+    this._document.addEventListener('keyup', this.onKeyUp);
+    this._document.addEventListener('copy', this.onCopy);
+
+    const topbarLogo = this._dom.find('.lh-topbar__logo', this._document);
+    topbarLogo.addEventListener('click', () => this._toggleDarkTheme());
+
+    let turnOffTheLights = false;
+    // Do not query the system preferences for DevTools - DevTools should only apply dark theme
+    // if dark is selected in the settings panel.
+    if (!this._dom.isDevTools() && window.matchMedia('(prefers-color-scheme: dark)').matches) {
+      turnOffTheLights = true;
+    }
+
+    // Fireworks.
+    const scoresAll100 = Object.values(report.categories).every(cat => cat.score === 1);
+    const hasAllCoreCategories =
+      Object.keys(report.categories).filter(id => !Util.isPluginCategory(id)).length >= 5;
+    if (scoresAll100 && hasAllCoreCategories) {
+      turnOffTheLights = true;
+      this._enableFireworks();
+    }
+
+    if (turnOffTheLights) {
+      this._toggleDarkTheme(true);
+    }
+
+    // There is only a sticky header when at least 2 categories are present.
+    if (Object.keys(this.json.categories).length >= 2) {
+      this._setupStickyHeaderElements();
+      const containerEl = this._dom.find('.lh-container', this._document);
+      const elToAddScrollListener = this._getScrollParent(containerEl);
+      elToAddScrollListener.addEventListener('scroll', this._updateStickyHeaderOnScroll);
+
+      // Use ResizeObserver where available.
+      // TODO: there is an issue with incorrect position numbers and, as a result, performance
+      // issues due to layout thrashing.
+      // See https://github.com/GoogleChrome/lighthouse/pull/9023/files#r288822287 for details.
+      // For now, limit to DevTools.
+      if (this._dom.isDevTools()) {
+        const resizeObserver = new window.ResizeObserver(this._updateStickyHeaderOnScroll);
+        resizeObserver.observe(containerEl);
+      } else {
+        window.addEventListener('resize', this._updateStickyHeaderOnScroll);
+      }
+    }
+
+    // Show the metric descriptions by default when there is an error.
+    const hasMetricError = report.categories.performance && report.categories.performance.auditRefs
+      .some(audit => Boolean(audit.group === 'metrics' && report.audits[audit.id].errorMessage));
+    if (hasMetricError) {
+      const toggleInputEl = /** @type {HTMLInputElement} */ (
+        this._dom.find('.lh-metrics-toggle__input', this._document));
+      toggleInputEl.checked = true;
+    }
+  }
+
+  /**
+   * Define a custom element for <templates> to be extracted from. For example:
+   *     this.setTemplateContext(new DOMParser().parseFromString(htmlStr, 'text/html'))
+   * @param {ParentNode} context
+   */
+  setTemplateContext(context) {
+    this._templateContext = context;
+  }
+
+  /**
+   * Finds the first scrollable ancestor of `element`. Falls back to the document.
+   * @param {HTMLElement} element
+   * @return {Node}
+   */
+  _getScrollParent(element) {
+    const {overflowY} = window.getComputedStyle(element);
+    const isScrollable = overflowY !== 'visible' && overflowY !== 'hidden';
+
+    if (isScrollable) {
+      return element;
+    }
+
+    if (element.parentElement) {
+      return this._getScrollParent(element.parentElement);
+    }
+
+    return document;
+  }
+
+  _enableFireworks() {
+    const scoresContainer = this._dom.find('.lh-scores-container', this._document);
+    scoresContainer.classList.add('score100');
+    scoresContainer.addEventListener('click', _ => {
+      scoresContainer.classList.toggle('fireworks-paused');
+    });
+  }
+
+  /**
+   * Fires a custom DOM event on target.
+   * @param {string} name Name of the event.
+   * @param {Node=} target DOM node to fire the event on.
+   * @param {*=} detail Custom data to include.
+   */
+  _fireEventOn(name, target = this._document, detail) {
+    const event = new CustomEvent(name, detail ? {detail} : undefined);
+    target.dispatchEvent(event);
+  }
+
+  _setupMediaQueryListeners() {
+    const mediaQuery = self.matchMedia('(max-width: 500px)');
+    mediaQuery.addListener(this.onMediaQueryChange);
+    // Ensure the handler is called on init
+    this.onMediaQueryChange(mediaQuery);
+  }
+
+  /**
+   * Handle media query change events.
+   * @param {MediaQueryList|MediaQueryListEvent} mql
+   */
+  onMediaQueryChange(mql) {
+    const root = this._dom.find('.lh-root', this._document);
+    root.classList.toggle('lh-narrow', mql.matches);
+  }
+
+  _setupThirdPartyFilter() {
+    // Some audits should not display the third party filter option.
+    const thirdPartyFilterAuditExclusions = [
+      // This audit deals explicitly with third party resources.
+      'uses-rel-preconnect',
+    ];
+
+    // Get all tables with a text url column.
+    /** @type {Array<HTMLTableElement>} */
+    const tables = Array.from(this._document.querySelectorAll('.lh-table'));
+    const tablesWithUrls = tables
+      .filter(el => el.querySelector('td.lh-table-column--url'))
+      .filter(el => {
+        const containingAudit = el.closest('.lh-audit');
+        if (!containingAudit) throw new Error('.lh-table not within audit');
+        return !thirdPartyFilterAuditExclusions.includes(containingAudit.id);
+      });
+
+    tablesWithUrls.forEach((tableEl, index) => {
+      const urlItems = this._getUrlItems(tableEl);
+      const thirdPartyRows = this._getThirdPartyRows(tableEl, urlItems, this.json.finalUrl);
+
+      // create input box
+      const filterTemplate = this._dom.cloneTemplate('#tmpl-lh-3p-filter', this._templateContext);
+      const filterInput =
+        /** @type {HTMLInputElement} */ (this._dom.find('input', filterTemplate));
+      const id = `lh-3p-filter-label--${index}`;
+
+      filterInput.id = id;
+      filterInput.addEventListener('change', e => {
+        // Remove rows from the dom and keep track of them to re-add on uncheck.
+        // Why removing instead of hiding? To keep nth-child(even) background-colors working.
+        if (e.target instanceof HTMLInputElement && !e.target.checked) {
+          for (const row of thirdPartyRows.values()) {
+            row.remove();
+          }
+        } else {
+          // Add row elements back to original positions.
+          for (const [position, row] of thirdPartyRows.entries()) {
+            const childrenArr = getTableRows(tableEl);
+            tableEl.tBodies[0].insertBefore(row, childrenArr[position]);
+          }
+        }
+      });
+
+      this._dom.find('label', filterTemplate).setAttribute('for', id);
+      this._dom.find('.lh-3p-filter-count', filterTemplate).textContent =
+          `${thirdPartyRows.size}`;
+      this._dom.find('.lh-3p-ui-string', filterTemplate).textContent =
+          Util.UIStrings.thirdPartyResourcesLabel;
+
+      // If all or none of the rows are 3rd party, disable the checkbox.
+      if (thirdPartyRows.size === urlItems.length || !thirdPartyRows.size) {
+        filterInput.disabled = true;
+        filterInput.checked = thirdPartyRows.size === urlItems.length;
+      }
+
+      // Finally, add checkbox to the DOM.
+      if (!tableEl.parentNode) return; // Keep tsc happy.
+      tableEl.parentNode.insertBefore(filterTemplate, tableEl);
+    });
+  }
+
+  /**
+   * From a table with URL entries, finds the rows containing third-party URLs
+   * and returns a Map of those rows, mapping from row index to row Element.
+   * @param {HTMLTableElement} el
+   * @param {string} finalUrl
+   * @param {Array<HTMLElement>} urlItems
+   * @return {Map<number, HTMLTableRowElement>}
+   */
+  _getThirdPartyRows(el, urlItems, finalUrl) {
+    const finalUrlRootDomain = Util.getRootDomain(finalUrl);
+
+    /** @type {Map<number, HTMLTableRowElement>} */
+    const thirdPartyRows = new Map();
+    for (const urlItem of urlItems) {
+      const datasetUrl = urlItem.dataset.url;
+      if (!datasetUrl) continue;
+      const isThirdParty = Util.getRootDomain(datasetUrl) !== finalUrlRootDomain;
+      if (!isThirdParty) continue;
+
+      const urlRowEl = urlItem.closest('tr');
+      if (urlRowEl) {
+        const rowPosition = getTableRows(el).indexOf(urlRowEl);
+        thirdPartyRows.set(rowPosition, urlRowEl);
+      }
+    }
+
+    return thirdPartyRows;
+  }
+
+  /**
+   * From a table, finds and returns URL items.
+   * @param {HTMLTableElement} tableEl
+   * @return {Array<HTMLElement>}
+   */
+  _getUrlItems(tableEl) {
+    return this._dom.findAll('.lh-text__url', tableEl);
+  }
+
+  _setupStickyHeaderElements() {
+    this.topbarEl = this._dom.find('.lh-topbar', this._document);
+    this.scoreScaleEl = this._dom.find('.lh-scorescale', this._document);
+    this.stickyHeaderEl = this._dom.find('.lh-sticky-header', this._document);
+
+    // Highlighter will be absolutely positioned at first gauge, then transformed on scroll.
+    this.highlightEl = this._dom.createChildOf(this.stickyHeaderEl, 'div', 'lh-highlighter');
+  }
+
+  /**
+   * Handle copy events.
+   * @param {ClipboardEvent} e
+   */
+  onCopy(e) {
+    // Only handle copy button presses (e.g. ignore the user copying page text).
+    if (this._copyAttempt && e.clipboardData) {
+      // We want to write our own data to the clipboard, not the user's text selection.
+      e.preventDefault();
+      e.clipboardData.setData('text/plain', JSON.stringify(this.json, null, 2));
+
+      this._fireEventOn('lh-log', this._document, {
+        cmd: 'log', msg: 'Report JSON copied to clipboard',
+      });
+    }
+
+    this._copyAttempt = false;
+  }
+
+  /**
+   * Copies the report JSON to the clipboard (if supported by the browser).
+   */
+  onCopyButtonClick() {
+    this._fireEventOn('lh-analytics', this._document, {
+      cmd: 'send',
+      fields: {hitType: 'event', eventCategory: 'report', eventAction: 'copy'},
+    });
+
+    try {
+      if (this._document.queryCommandSupported('copy')) {
+        this._copyAttempt = true;
+
+        // Note: In Safari 10.0.1, execCommand('copy') returns true if there's
+        // a valid text selection on the page. See http://caniuse.com/#feat=clipboard.
+        if (!this._document.execCommand('copy')) {
+          this._copyAttempt = false; // Prevent event handler from seeing this as a copy attempt.
+
+          this._fireEventOn('lh-log', this._document, {
+            cmd: 'warn', msg: 'Your browser does not support copy to clipboard.',
+          });
+        }
+      }
+    } catch (/** @type {Error} */ e) {
+      this._copyAttempt = false;
+      this._fireEventOn('lh-log', this._document, {cmd: 'log', msg: e.message});
+    }
+  }
+
+  /**
+   * Resets the state of page before capturing the page for export.
+   * When the user opens the exported HTML page, certain UI elements should
+   * be in their closed state (not opened) and the templates should be unstamped.
+   */
+  _resetUIState() {
+    this._dropDown.close();
+    this._dom.resetTemplates();
+  }
+
+  /**
+   * Handler for tool button.
+   * @param {Event} e
+   */
+  onDropDownMenuClick(e) {
+    e.preventDefault();
+
+    const el = /** @type {?Element} */ (e.target);
+
+    if (!el || !el.hasAttribute('data-action')) {
+      return;
+    }
+
+    switch (el.getAttribute('data-action')) {
+      case 'copy':
+        this.onCopyButtonClick();
+        break;
+      case 'print-summary':
+        this.collapseAllDetails();
+        this._print();
+        break;
+      case 'print-expanded':
+        this.expandAllDetails();
+        this._print();
+        break;
+      case 'save-json': {
+        const jsonStr = JSON.stringify(this.json, null, 2);
+        this._saveFile(new Blob([jsonStr], {type: 'application/json'}));
+        break;
+      }
+      case 'save-html': {
+        const htmlStr = this.getReportHtml();
+        try {
+          this._saveFile(new Blob([htmlStr], {type: 'text/html'}));
+        } catch (/** @type {Error} */ e) {
+          this._fireEventOn('lh-log', this._document, {
+            cmd: 'error', msg: 'Could not export as HTML. ' + e.message,
+          });
+        }
+        break;
+      }
+      case 'open-viewer': {
+        const viewerPath = '/lighthouse/viewer/';
+        ReportUIFeatures.openTabAndSendJsonReport(this.json, viewerPath);
+        break;
+      }
+      case 'save-gist': {
+        this.saveAsGist();
+        break;
+      }
+      case 'toggle-dark': {
+        this._toggleDarkTheme();
+        break;
+      }
+    }
+
+    this._dropDown.close();
+  }
+
+  _print() {
+    self.print();
+  }
+
+  /**
+   * Keyup handler for the document.
+   * @param {KeyboardEvent} e
+   */
+  onKeyUp(e) {
+    // Ctrl+P - Expands audit details when user prints via keyboard shortcut.
+    if ((e.ctrlKey || e.metaKey) && e.keyCode === 80) {
+      this._dropDown.close();
+    }
+  }
+
+  /**
+   * Opens a new tab to the online viewer and sends the local page's JSON results
+   * to the online viewer using postMessage.
+   * @param {LH.Result} reportJson
+   * @param {string} viewerPath
+   * @protected
+   */
+  static openTabAndSendJsonReport(reportJson, viewerPath) {
+    const VIEWER_ORIGIN = 'https://googlechrome.github.io';
+    // Chrome doesn't allow us to immediately postMessage to a popup right
+    // after it's created. Normally, we could also listen for the popup window's
+    // load event, however it is cross-domain and won't fire. Instead, listen
+    // for a message from the target app saying "I'm open".
+    const json = reportJson;
+    window.addEventListener('message', function msgHandler(messageEvent) {
+      if (messageEvent.origin !== VIEWER_ORIGIN) {
+        return;
+      }
+      if (popup && messageEvent.data.opened) {
+        popup.postMessage({lhresults: json}, VIEWER_ORIGIN);
+        window.removeEventListener('message', msgHandler);
+      }
+    });
+
+    // The popup's window.name is keyed by version+url+fetchTime, so we reuse/select tabs correctly
+    // @ts-ignore - If this is a v2 LHR, use old `generatedTime`.
+    const fallbackFetchTime = /** @type {string} */ (json.generatedTime);
+    const fetchTime = json.fetchTime || fallbackFetchTime;
+    const windowName = `${json.lighthouseVersion}-${json.requestedUrl}-${fetchTime}`;
+    const popup = window.open(`${VIEWER_ORIGIN}${viewerPath}`, windowName);
+  }
+
+  /**
+   * Expands all audit `<details>`.
+   * Ideally, a print stylesheet could take care of this, but CSS has no way to
+   * open a `<details>` element.
+   */
+  expandAllDetails() {
+    const details = /** @type {Array<HTMLDetailsElement>} */ (this._dom.findAll(
+        '.lh-categories details', this._document));
+    details.map(detail => detail.open = true);
+  }
+
+  /**
+   * Collapses all audit `<details>`.
+   * open a `<details>` element.
+   */
+  collapseAllDetails() {
+    const details = /** @type {Array<HTMLDetailsElement>} */ (this._dom.findAll(
+        '.lh-categories details', this._document));
+    details.map(detail => detail.open = false);
+  }
+
+  /**
+   * Sets up listeners to collapse audit `<details>` when the user closes the
+   * print dialog, all `<details>` are collapsed.
+   */
+  _setUpCollapseDetailsAfterPrinting() {
+    // FF and IE implement these old events.
+    if ('onbeforeprint' in self) {
+      self.addEventListener('afterprint', this.collapseAllDetails);
+    } else {
+      const win = /** @type {Window} */ (self);
+      // Note: FF implements both window.onbeforeprint and media listeners. However,
+      // it doesn't matchMedia doesn't fire when matching 'print'.
+      win.matchMedia('print').addListener(mql => {
+        if (mql.matches) {
+          this.expandAllDetails();
+        } else {
+          this.collapseAllDetails();
+        }
+      });
+    }
+  }
+
+  /**
+   * Returns the html that recreates this report.
+   * @return {string}
+   * @protected
+   */
+  getReportHtml() {
+    this._resetUIState();
+    return this._document.documentElement.outerHTML;
+  }
+
+  /**
+   * Save json as a gist. Unimplemented in base UI features.
+   * @protected
+   */
+  saveAsGist() {
+    throw new Error('Cannot save as gist from base report');
+  }
+
+  /**
+   * Downloads a file (blob) using a[download].
+   * @param {Blob|File} blob The file to save.
+   * @private
+   */
+  _saveFile(blob) {
+    const filename = getFilenamePrefix({
+      finalUrl: this.json.finalUrl,
+      fetchTime: this.json.fetchTime,
+    });
+
+    const ext = blob.type.match('json') ? '.json' : '.html';
+    const href = URL.createObjectURL(blob);
+
+    const a = this._dom.createElement('a');
+    a.download = `${filename}${ext}`;
+    a.href = href;
+    this._document.body.appendChild(a); // Firefox requires anchor to be in the DOM.
+    a.click();
+
+    // cleanup.
+    this._document.body.removeChild(a);
+    setTimeout(_ => URL.revokeObjectURL(href), 500);
+  }
+
+  /**
+   * @private
+   * @param {boolean} [force]
+   */
+  _toggleDarkTheme(force) {
+    const el = this._dom.find('.lh-vars', this._document);
+    // This seems unnecessary, but in DevTools, passing "undefined" as the second
+    // parameter acts like passing "false".
+    // https://github.com/ChromeDevTools/devtools-frontend/blob/dd6a6d4153647c2a4203c327c595692c5e0a4256/front_end/dom_extension/DOMExtension.js#L809-L819
+    if (typeof force === 'undefined') {
+      el.classList.toggle('dark');
+    } else {
+      el.classList.toggle('dark', force);
+    }
+  }
+
+  _updateStickyHeaderOnScroll() {
+    // Show sticky header when the score scale begins to go underneath the topbar.
+    const topbarBottom = this.topbarEl.getBoundingClientRect().bottom;
+    const scoreScaleTop = this.scoreScaleEl.getBoundingClientRect().top;
+    const showStickyHeader = topbarBottom >= scoreScaleTop;
+
+    // Highlight mini gauge when section is in view.
+    // In view = the last category that starts above the middle of the window.
+    const categoryEls = Array.from(this._document.querySelectorAll('.lh-category'));
+    const categoriesAboveTheMiddle =
+      categoryEls.filter(el => el.getBoundingClientRect().top - window.innerHeight / 2 < 0);
+    const highlightIndex =
+      categoriesAboveTheMiddle.length > 0 ? categoriesAboveTheMiddle.length - 1 : 0;
+
+    // Category order matches gauge order in sticky header.
+    const gaugeWrapperEls = this.stickyHeaderEl.querySelectorAll('.lh-gauge__wrapper');
+    const gaugeToHighlight = gaugeWrapperEls[highlightIndex];
+    const origin = gaugeWrapperEls[0].getBoundingClientRect().left;
+    const offset = gaugeToHighlight.getBoundingClientRect().left - origin;
+
+    // Mutate at end to avoid layout thrashing.
+    this.highlightEl.style.transform = `translate(${offset}px)`;
+    this.stickyHeaderEl.classList.toggle('lh-sticky-header--visible', showStickyHeader);
+  }
+}
+
+class DropDown {
+  /**
+   * @param {DOM} dom
+   */
+  constructor(dom) {
+    /** @type {DOM} */
+    this._dom = dom;
+    /** @type {HTMLElement} */
+    this._toggleEl; // eslint-disable-line no-unused-expressions
+    /** @type {HTMLElement} */
+    this._menuEl; // eslint-disable-line no-unused-expressions
+
+    this.onDocumentKeyDown = this.onDocumentKeyDown.bind(this);
+    this.onToggleClick = this.onToggleClick.bind(this);
+    this.onToggleKeydown = this.onToggleKeydown.bind(this);
+    this.onMenuKeydown = this.onMenuKeydown.bind(this);
+
+    this._getNextMenuItem = this._getNextMenuItem.bind(this);
+    this._getNextSelectableNode = this._getNextSelectableNode.bind(this);
+    this._getPreviousMenuItem = this._getPreviousMenuItem.bind(this);
+  }
+
+  /**
+   * @param {function(MouseEvent): any} menuClickHandler
+   */
+  setup(menuClickHandler) {
+    this._toggleEl = this._dom.find('.lh-tools__button', this._dom.document());
+    this._toggleEl.addEventListener('click', this.onToggleClick);
+    this._toggleEl.addEventListener('keydown', this.onToggleKeydown);
+
+    this._menuEl = this._dom.find('.lh-tools__dropdown', this._dom.document());
+    this._menuEl.addEventListener('keydown', this.onMenuKeydown);
+    this._menuEl.addEventListener('click', menuClickHandler);
+  }
+
+  close() {
+    this._toggleEl.classList.remove('active');
+    this._toggleEl.setAttribute('aria-expanded', 'false');
+    if (this._menuEl.contains(this._dom.document().activeElement)) {
+      // Refocus on the tools button if the drop down last had focus
+      this._toggleEl.focus();
+    }
+    this._dom.document().removeEventListener('keydown', this.onDocumentKeyDown);
+  }
+
+  /**
+   * @param {HTMLElement} firstFocusElement
+   */
+  open(firstFocusElement) {
+    if (this._toggleEl.classList.contains('active')) {
+      // If the drop down is already open focus on the element
+      firstFocusElement.focus();
+    } else {
+      // Wait for drop down transition to complete so options are focusable.
+      this._menuEl.addEventListener('transitionend', () => {
+        firstFocusElement.focus();
+      }, {once: true});
+    }
+
+    this._toggleEl.classList.add('active');
+    this._toggleEl.setAttribute('aria-expanded', 'true');
+    this._dom.document().addEventListener('keydown', this.onDocumentKeyDown);
+  }
+
+  /**
+   * Click handler for tools button.
+   * @param {Event} e
+   */
+  onToggleClick(e) {
+    e.preventDefault();
+    e.stopImmediatePropagation();
+
+    if (this._toggleEl.classList.contains('active')) {
+      this.close();
+    } else {
+      this.open(this._getNextMenuItem());
+    }
+  }
+
+  /**
+   * Handler for tool button.
+   * @param {KeyboardEvent} e
+   */
+  onToggleKeydown(e) {
+    switch (e.code) {
+      case 'ArrowUp':
+        e.preventDefault();
+        this.open(this._getPreviousMenuItem());
+        break;
+      case 'ArrowDown':
+      case 'Enter':
+      case ' ':
+        e.preventDefault();
+        this.open(this._getNextMenuItem());
+        break;
+      default:
+       // no op
+    }
+  }
+
+  /**
+   * Handler for tool DropDown.
+   * @param {KeyboardEvent} e
+   */
+  onMenuKeydown(e) {
+    const el = /** @type {?HTMLElement} */ (e.target);
+
+    switch (e.code) {
+      case 'ArrowUp':
+        e.preventDefault();
+        this._getPreviousMenuItem(el).focus();
+        break;
+      case 'ArrowDown':
+        e.preventDefault();
+        this._getNextMenuItem(el).focus();
+        break;
+      case 'Home':
+        e.preventDefault();
+        this._getNextMenuItem().focus();
+        break;
+      case 'End':
+        e.preventDefault();
+        this._getPreviousMenuItem().focus();
+        break;
+      default:
+       // no op
+    }
+  }
+
+  /**
+   * Keydown handler for the document.
+   * @param {KeyboardEvent} e
+   */
+  onDocumentKeyDown(e) {
+    if (e.keyCode === 27) { // ESC
+      this.close();
+    }
+  }
+
+  /**
+   * @param {Array<Node>} allNodes
+   * @param {?Node=} startNode
+   * @returns {Node}
+   */
+  _getNextSelectableNode(allNodes, startNode) {
+    const nodes = allNodes.filter((node) => {
+      if (!(node instanceof HTMLElement)) {
+        return false;
+      }
+
+      // 'Save as Gist' option may be disabled.
+      if (node.hasAttribute('disabled')) {
+        return false;
+      }
+
+      // 'Save as Gist' option may have display none.
+      if (window.getComputedStyle(node).display === 'none') {
+        return false;
+      }
+
+      return true;
+    });
+
+    let nextIndex = startNode ? (nodes.indexOf(startNode) + 1) : 0;
+    if (nextIndex >= nodes.length) {
+      nextIndex = 0;
+    }
+
+    return nodes[nextIndex];
+  }
+
+  /**
+   * @param {?Element=} startEl
+   * @returns {HTMLElement}
+   */
+  _getNextMenuItem(startEl) {
+    const nodes = Array.from(this._menuEl.childNodes);
+    return /** @type {HTMLElement} */ (this._getNextSelectableNode(nodes, startEl));
+  }
+
+  /**
+   * @param {?Element=} startEl
+   * @returns {HTMLElement}
+   */
+  _getPreviousMenuItem(startEl) {
+    const nodes = Array.from(this._menuEl.childNodes).reverse();
+    return /** @type {HTMLElement} */ (this._getNextSelectableNode(nodes, startEl));
+  }
+}
+
+if (typeof module !== 'undefined' && module.exports) {
+  module.exports = ReportUIFeatures;
+} else {
+  self.ReportUIFeatures = ReportUIFeatures;
+}
+;
+/**
+ * @license
+ * Copyright 2017 Google Inc. All Rights Reserved.
+ *
+ * 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
+ *
+ * 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.
+ */
+'use strict';
+
+/* globals self, Util */
+
+/** @typedef {import('./dom.js')} DOM */
+/** @typedef {import('./report-renderer.js')} ReportRenderer */
+/** @typedef {import('./details-renderer.js')} DetailsRenderer */
+/** @typedef {import('./util.js')} Util */
+/** @typedef {'failed'|'warning'|'manual'|'passed'|'notApplicable'} TopLevelClumpId */
+
+class CategoryRenderer {
+  /**
+   * @param {DOM} dom
+   * @param {DetailsRenderer} detailsRenderer
+   */
+  constructor(dom, detailsRenderer) {
+    /** @type {DOM} */
+    this.dom = dom;
+    /** @type {DetailsRenderer} */
+    this.detailsRenderer = detailsRenderer;
+    /** @type {ParentNode} */
+    this.templateContext = this.dom.document();
+
+    this.detailsRenderer.setTemplateContext(this.templateContext);
+  }
+
+  /**
+   * Display info per top-level clump. Define on class to avoid race with Util init.
+   */
+  get _clumpTitles() {
+    return {
+      warning: Util.UIStrings.warningAuditsGroupTitle,
+      manual: Util.UIStrings.manualAuditsGroupTitle,
+      passed: Util.UIStrings.passedAuditsGroupTitle,
+      notApplicable: Util.UIStrings.notApplicableAuditsGroupTitle,
+    };
+  }
+
+  /**
+   * @param {LH.ReportResult.AuditRef} audit
+   * @return {Element}
+   */
+  renderAudit(audit) {
+    const tmpl = this.dom.cloneTemplate('#tmpl-lh-audit', this.templateContext);
+    return this.populateAuditValues(audit, tmpl);
+  }
+
+  /**
+   * Populate an DOM tree with audit details. Used by renderAudit and renderOpportunity
+   * @param {LH.ReportResult.AuditRef} audit
+   * @param {DocumentFragment} tmpl
+   * @return {Element}
+   */
+  populateAuditValues(audit, tmpl) {
+    const auditEl = this.dom.find('.lh-audit', tmpl);
+    auditEl.id = audit.result.id;
+    const scoreDisplayMode = audit.result.scoreDisplayMode;
+
+    if (audit.result.displayValue) {
+      this.dom.find('.lh-audit__display-text', auditEl).textContent = audit.result.displayValue;
+    }
+
+    const titleEl = this.dom.find('.lh-audit__title', auditEl);
+    titleEl.appendChild(this.dom.convertMarkdownCodeSnippets(audit.result.title));
+    this.dom.find('.lh-audit__description', auditEl)
+        .appendChild(this.dom.convertMarkdownLinkSnippets(audit.result.description));
+
+    if (audit.stackPacks) {
+      audit.stackPacks.forEach(pack => {
+        const packElm = this.dom.createElement('div');
+        packElm.classList.add('lh-audit__stackpack');
+
+        const packElmImg = this.dom.createElement('img');
+        packElmImg.classList.add('lh-audit__stackpack__img');
+        packElmImg.src = pack.iconDataURL;
+        packElmImg.alt = pack.title;
+        packElm.appendChild(packElmImg);
+
+        packElm.appendChild(this.dom.convertMarkdownLinkSnippets(pack.description));
+
+        this.dom.find('.lh-audit__stackpacks', auditEl)
+          .appendChild(packElm);
+      });
+    }
+
+    const header = /** @type {HTMLDetailsElement} */ (this.dom.find('details', auditEl));
+    if (audit.result.details) {
+      const elem = this.detailsRenderer.render(audit.result.details);
+      if (elem) {
+        elem.classList.add('lh-details');
+        header.appendChild(elem);
+      }
+    }
+
+    // Add chevron SVG to the end of the summary
+    this.dom.find('.lh-chevron-container', auditEl).appendChild(this._createChevron());
+    this._setRatingClass(auditEl, audit.result.score, scoreDisplayMode);
+
+    if (audit.result.scoreDisplayMode === 'error') {
+      auditEl.classList.add(`lh-audit--error`);
+      const textEl = this.dom.find('.lh-audit__display-text', auditEl);
+      textEl.textContent = Util.UIStrings.errorLabel;
+      textEl.classList.add('tooltip-boundary');
+      const tooltip = this.dom.createChildOf(textEl, 'div', 'tooltip tooltip--error');
+      tooltip.textContent = audit.result.errorMessage || Util.UIStrings.errorMissingAuditInfo;
+    } else if (audit.result.explanation) {
+      const explEl = this.dom.createChildOf(titleEl, 'div', 'lh-audit-explanation');
+      explEl.textContent = audit.result.explanation;
+    }
+    const warnings = audit.result.warnings;
+    if (!warnings || warnings.length === 0) return auditEl;
+
+    // Add list of warnings or singular warning
+    const warningsEl = this.dom.createChildOf(titleEl, 'div', 'lh-warnings');
+    this.dom.createChildOf(warningsEl, 'span').textContent = Util.UIStrings.warningHeader;
+    if (warnings.length === 1) {
+      warningsEl.appendChild(this.dom.document().createTextNode(warnings.join('')));
+    } else {
+      const warningsUl = this.dom.createChildOf(warningsEl, 'ul');
+      for (const warning of warnings) {
+        const item = this.dom.createChildOf(warningsUl, 'li');
+        item.textContent = warning;
+      }
+    }
+    return auditEl;
+  }
+
+  /**
+   * @return {HTMLElement}
+   */
+  _createChevron() {
+    const chevronTmpl = this.dom.cloneTemplate('#tmpl-lh-chevron', this.templateContext);
+    const chevronEl = this.dom.find('.lh-chevron', chevronTmpl);
+    return chevronEl;
+  }
+
+  /**
+   * @param {Element} element DOM node to populate with values.
+   * @param {number|null} score
+   * @param {string} scoreDisplayMode
+   * @return {Element}
+   */
+  _setRatingClass(element, score, scoreDisplayMode) {
+    const rating = Util.calculateRating(score, scoreDisplayMode);
+    element.classList.add(`lh-audit--${scoreDisplayMode.toLowerCase()}`);
+    if (scoreDisplayMode !== 'informative') {
+      element.classList.add(`lh-audit--${rating}`);
+    }
+    return element;
+  }
+
+  /**
+   * @param {LH.ReportResult.Category} category
+   * @param {Record<string, LH.Result.ReportGroup>} groupDefinitions
+   * @return {Element}
+   */
+  renderCategoryHeader(category, groupDefinitions) {
+    const tmpl = this.dom.cloneTemplate('#tmpl-lh-category-header', this.templateContext);
+
+    const gaugeContainerEl = this.dom.find('.lh-score__gauge', tmpl);
+    const gaugeEl = this.renderScoreGauge(category, groupDefinitions);
+    gaugeContainerEl.appendChild(gaugeEl);
+
+    if (category.description) {
+      const descEl = this.dom.convertMarkdownLinkSnippets(category.description);
+      this.dom.find('.lh-category-header__description', tmpl).appendChild(descEl);
+    }
+
+    return /** @type {Element} */ (tmpl.firstElementChild);
+  }
+
+  /**
+   * Renders the group container for a group of audits. Individual audit elements can be added
+   * directly to the returned element.
+   * @param {LH.Result.ReportGroup} group
+   * @return {Element}
+   */
+  renderAuditGroup(group) {
+    const groupEl = this.dom.createElement('div', 'lh-audit-group');
+
+    const auditGroupHeader = this.dom.createElement('div', 'lh-audit-group__header');
+
+    this.dom.createChildOf(auditGroupHeader, 'span', 'lh-audit-group__title')
+      .textContent = group.title;
+    if (group.description) {
+      const descriptionEl = this.dom.convertMarkdownLinkSnippets(group.description);
+      descriptionEl.classList.add('lh-audit-group__description');
+      auditGroupHeader.appendChild(descriptionEl);
+    }
+    groupEl.appendChild(auditGroupHeader);
+
+    return groupEl;
+  }
+
+  /**
+   * Takes an array of auditRefs, groups them if requested, then returns an
+   * array of audit and audit-group elements.
+   * @param {Array<LH.ReportResult.AuditRef>} auditRefs
+   * @param {Object<string, LH.Result.ReportGroup>} groupDefinitions
+   * @return {Array<Element>}
+   */
+  _renderGroupedAudits(auditRefs, groupDefinitions) {
+    // Audits grouped by their group (or under notAGroup).
+    /** @type {Map<string, Array<LH.ReportResult.AuditRef>>} */
+    const grouped = new Map();
+
+    // Add audits without a group first so they will appear first.
+    const notAGroup = 'NotAGroup';
+    grouped.set(notAGroup, []);
+
+    for (const auditRef of auditRefs) {
+      const groupId = auditRef.group || notAGroup;
+      const groupAuditRefs = grouped.get(groupId) || [];
+      groupAuditRefs.push(auditRef);
+      grouped.set(groupId, groupAuditRefs);
+    }
+
+    /** @type {Array<Element>} */
+    const auditElements = [];
+
+    for (const [groupId, groupAuditRefs] of grouped) {
+      if (groupId === notAGroup) {
+        // Push not-grouped audits individually.
+        for (const auditRef of groupAuditRefs) {
+          auditElements.push(this.renderAudit(auditRef));
+        }
+        continue;
+      }
+
+      // Push grouped audits as a group.
+      const groupDef = groupDefinitions[groupId];
+      const auditGroupElem = this.renderAuditGroup(groupDef);
+      for (const auditRef of groupAuditRefs) {
+        auditGroupElem.appendChild(this.renderAudit(auditRef));
+      }
+      auditGroupElem.classList.add(`lh-audit-group--${groupId}`);
+      auditElements.push(auditGroupElem);
+    }
+
+    return auditElements;
+  }
+
+  /**
+   * Take a set of audits, group them if they have groups, then render in a top-level
+   * clump that can't be expanded/collapsed.
+   * @param {Array<LH.ReportResult.AuditRef>} auditRefs
+   * @param {Object<string, LH.Result.ReportGroup>} groupDefinitions
+   * @return {Element}
+   */
+  renderUnexpandableClump(auditRefs, groupDefinitions) {
+    const clumpElement = this.dom.createElement('div');
+    const elements = this._renderGroupedAudits(auditRefs, groupDefinitions);
+    elements.forEach(elem => clumpElement.appendChild(elem));
+    return clumpElement;
+  }
+
+  /**
+   * Take a set of audits and render in a top-level, expandable clump that starts
+   * in a collapsed state.
+   * @param {Exclude<TopLevelClumpId, 'failed'>} clumpId
+   * @param {{auditRefs: Array<LH.ReportResult.AuditRef>, description?: string}} clumpOpts
+   * @return {Element}
+   */
+  renderClump(clumpId, {auditRefs, description}) {
+    const clumpTmpl = this.dom.cloneTemplate('#tmpl-lh-clump', this.templateContext);
+    const clumpElement = this.dom.find('.lh-clump', clumpTmpl);
+
+    if (clumpId === 'warning') {
+      clumpElement.setAttribute('open', '');
+    }
+
+    const summaryInnerEl = this.dom.find('.lh-audit-group__summary', clumpElement);
+    const chevronEl = summaryInnerEl.appendChild(this._createChevron());
+    chevronEl.title = Util.UIStrings.auditGroupExpandTooltip;
+
+    const headerEl = this.dom.find('.lh-audit-group__header', clumpElement);
+    const title = this._clumpTitles[clumpId];
+    this.dom.find('.lh-audit-group__title', headerEl).textContent = title;
+    if (description) {
+      const descriptionEl = this.dom.convertMarkdownLinkSnippets(description);
+      descriptionEl.classList.add('lh-audit-group__description');
+      headerEl.appendChild(descriptionEl);
+    }
+
+    const itemCountEl = this.dom.find('.lh-audit-group__itemcount', clumpElement);
+    itemCountEl.textContent = `(${auditRefs.length})`;
+
+    // Add all audit results to the clump.
+    const auditElements = auditRefs.map(this.renderAudit.bind(this));
+    clumpElement.append(...auditElements);
+
+    clumpElement.classList.add(`lh-clump--${clumpId.toLowerCase()}`);
+    return clumpElement;
+  }
+
+  /**
+   * @param {ParentNode} context
+   */
+  setTemplateContext(context) {
+    this.templateContext = context;
+    this.detailsRenderer.setTemplateContext(context);
+  }
+
+  /**
+   * @param {LH.ReportResult.Category} category
+   * @param {Record<string, LH.Result.ReportGroup>} groupDefinitions
+   * @return {DocumentFragment}
+   */
+  renderScoreGauge(category, groupDefinitions) { // eslint-disable-line no-unused-vars
+    const tmpl = this.dom.cloneTemplate('#tmpl-lh-gauge', this.templateContext);
+    const wrapper = /** @type {HTMLAnchorElement} */ (this.dom.find('.lh-gauge__wrapper', tmpl));
+    wrapper.href = `#${category.id}`;
+    wrapper.classList.add(`lh-gauge__wrapper--${Util.calculateRating(category.score)}`);
+
+    if (Util.isPluginCategory(category.id)) {
+      wrapper.classList.add('lh-gauge__wrapper--plugin');
+    }
+
+    // Cast `null` to 0
+    const numericScore = Number(category.score);
+    const gauge = this.dom.find('.lh-gauge', tmpl);
+    // 352 is ~= 2 * Math.PI * gauge radius (56)
+    // https://codepen.io/xgad/post/svg-radial-progress-meters
+    // score of 50: `stroke-dasharray: 176 352`;
+    /** @type {?SVGCircleElement} */
+    const gaugeArc = gauge.querySelector('.lh-gauge-arc');
+    if (gaugeArc) {
+      gaugeArc.style.strokeDasharray = `${numericScore * 352} 352`;
+    }
+
+    const scoreOutOf100 = Math.round(numericScore * 100);
+    const percentageEl = this.dom.find('.lh-gauge__percentage', tmpl);
+    percentageEl.textContent = scoreOutOf100.toString();
+    if (category.score === null) {
+      percentageEl.textContent = '?';
+      percentageEl.title = Util.UIStrings.errorLabel;
+    }
+
+    this.dom.find('.lh-gauge__label', tmpl).textContent = category.title;
+    return tmpl;
+  }
+
+  /**
+   * @param {LH.ReportResult.AuditRef} audit
+   * @return {boolean}
+   */
+  _auditHasWarning(audit) {
+    return Boolean(audit.result.warnings && audit.result.warnings.length);
+  }
+
+  /**
+   * Returns the id of the top-level clump to put this audit in.
+   * @param {LH.ReportResult.AuditRef} auditRef
+   * @return {TopLevelClumpId}
+   */
+  _getClumpIdForAuditRef(auditRef) {
+    const scoreDisplayMode = auditRef.result.scoreDisplayMode;
+    if (scoreDisplayMode === 'manual' || scoreDisplayMode === 'notApplicable') {
+      return scoreDisplayMode;
+    }
+
+    if (Util.showAsPassed(auditRef.result)) {
+      if (this._auditHasWarning(auditRef)) {
+        return 'warning';
+      } else {
+        return 'passed';
+      }
+    } else {
+      return 'failed';
+    }
+  }
+
+  /**
+   * Renders a set of top level sections (clumps), under a status of failed, warning,
+   * manual, passed, or notApplicable. The result ends up something like:
+   *
+   * failed clump
+   *   ├── audit 1 (w/o group)
+   *   ├── audit 2 (w/o group)
+   *   ├── audit group
+   *   |  ├── audit 3
+   *   |  └── audit 4
+   *   └── audit group
+   *      ├── audit 5
+   *      └── audit 6
+   * other clump (e.g. 'manual')
+   *   ├── audit 1
+   *   ├── audit 2
+   *   ├── …
+   *   â‹®
+   * @param {LH.ReportResult.Category} category
+   * @param {Object<string, LH.Result.ReportGroup>} [groupDefinitions]
+   * @return {Element}
+   */
+  render(category, groupDefinitions = {}) {
+    const element = this.dom.createElement('div', 'lh-category');
+    this.createPermalinkSpan(element, category.id);
+    element.appendChild(this.renderCategoryHeader(category, groupDefinitions));
+
+    // Top level clumps for audits, in order they will appear in the report.
+    /** @type {Map<TopLevelClumpId, Array<LH.ReportResult.AuditRef>>} */
+    const clumps = new Map();
+    clumps.set('failed', []);
+    clumps.set('warning', []);
+    clumps.set('manual', []);
+    clumps.set('passed', []);
+    clumps.set('notApplicable', []);
+
+    // Sort audits into clumps.
+    for (const auditRef of category.auditRefs) {
+      const clumpId = this._getClumpIdForAuditRef(auditRef);
+      const clump = /** @type {Array<LH.ReportResult.AuditRef>} */ (clumps.get(clumpId)); // already defined
+      clump.push(auditRef);
+      clumps.set(clumpId, clump);
+    }
+
+    // Render each clump.
+    for (const [clumpId, auditRefs] of clumps) {
+      if (auditRefs.length === 0) continue;
+
+      if (clumpId === 'failed') {
+        const clumpElem = this.renderUnexpandableClump(auditRefs, groupDefinitions);
+        clumpElem.classList.add(`lh-clump--failed`);
+        element.appendChild(clumpElem);
+        continue;
+      }
+
+      const description = clumpId === 'manual' ? category.manualDescription : undefined;
+      const clumpElem = this.renderClump(clumpId, {auditRefs, description});
+      element.appendChild(clumpElem);
+    }
+
+    return element;
+  }
+
+  /**
+   * Create a non-semantic span used for hash navigation of categories
+   * @param {Element} element
+   * @param {string} id
+   */
+  createPermalinkSpan(element, id) {
+    const permalinkEl = this.dom.createChildOf(element, 'span', 'lh-permalink');
+    permalinkEl.id = id;
+  }
+}
+
+if (typeof module !== 'undefined' && module.exports) {
+  module.exports = CategoryRenderer;
+} else {
+  self.CategoryRenderer = CategoryRenderer;
+}
+;
+/**
+ * @license
+ * Copyright 2018 Google Inc. All Rights Reserved.
+ *
+ * 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
+ *
+ * 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.
+ */
+'use strict';
+
+/* globals self, Util, CategoryRenderer */
+
+/** @typedef {import('./dom.js')} DOM */
+
+class PerformanceCategoryRenderer extends CategoryRenderer {
+  /**
+   * @param {LH.ReportResult.AuditRef} audit
+   * @return {Element}
+   */
+  _renderMetric(audit) {
+    const tmpl = this.dom.cloneTemplate('#tmpl-lh-metric', this.templateContext);
+    const element = this.dom.find('.lh-metric', tmpl);
+    element.id = audit.result.id;
+    const rating = Util.calculateRating(audit.result.score, audit.result.scoreDisplayMode);
+    element.classList.add(`lh-metric--${rating}`);
+
+    const titleEl = this.dom.find('.lh-metric__title', tmpl);
+    titleEl.textContent = audit.result.title;
+
+    const valueEl = this.dom.find('.lh-metric__value', tmpl);
+    valueEl.textContent = audit.result.displayValue || '';
+
+    const descriptionEl = this.dom.find('.lh-metric__description', tmpl);
+    descriptionEl.appendChild(this.dom.convertMarkdownLinkSnippets(audit.result.description));
+
+    if (audit.result.scoreDisplayMode === 'error') {
+      descriptionEl.textContent = '';
+      valueEl.textContent = 'Error!';
+      const tooltip = this.dom.createChildOf(descriptionEl, 'span');
+      tooltip.textContent = audit.result.errorMessage || 'Report error: no metric information';
+    }
+
+    return element;
+  }
+
+  /**
+   * @param {LH.ReportResult.AuditRef} audit
+   * @param {number} scale
+   * @return {Element}
+   */
+  _renderOpportunity(audit, scale) {
+    const oppTmpl = this.dom.cloneTemplate('#tmpl-lh-opportunity', this.templateContext);
+    const element = this.populateAuditValues(audit, oppTmpl);
+    element.id = audit.result.id;
+
+    if (!audit.result.details || audit.result.scoreDisplayMode === 'error') {
+      return element;
+    }
+    const details = audit.result.details;
+    if (details.type !== 'opportunity') {
+      return element;
+    }
+
+    // Overwrite the displayValue with opportunity's wastedMs
+    const displayEl = this.dom.find('.lh-audit__display-text', element);
+    const sparklineWidthPct = `${details.overallSavingsMs / scale * 100}%`;
+    this.dom.find('.lh-sparkline__bar', element).style.width = sparklineWidthPct;
+    displayEl.textContent = Util.formatSeconds(details.overallSavingsMs, 0.01);
+
+    // Set [title] tooltips
+    if (audit.result.displayValue) {
+      const displayValue = audit.result.displayValue;
+      this.dom.find('.lh-load-opportunity__sparkline', element).title = displayValue;
+      displayEl.title = displayValue;
+    }
+
+    return element;
+  }
+
+  /**
+   * Get an audit's wastedMs to sort the opportunity by, and scale the sparkline width
+   * Opportunities with an error won't have a details object, so MIN_VALUE is returned to keep any
+   * erroring opportunities last in sort order.
+   * @param {LH.ReportResult.AuditRef} audit
+   * @return {number}
+   */
+  _getWastedMs(audit) {
+    if (audit.result.details && audit.result.details.type === 'opportunity') {
+      const details = audit.result.details;
+      if (typeof details.overallSavingsMs !== 'number') {
+        throw new Error('non-opportunity details passed to _getWastedMs');
+      }
+      return details.overallSavingsMs;
+    } else {
+      return Number.MIN_VALUE;
+    }
+  }
+
+  /**
+   * @param {LH.ReportResult.Category} category
+   * @param {Object<string, LH.Result.ReportGroup>} groups
+   * @param {'PSI'=} environment 'PSI' and undefined are the only valid values
+   * @return {Element}
+   * @override
+   */
+  render(category, groups, environment) {
+    const element = this.dom.createElement('div', 'lh-category');
+    if (environment === 'PSI') {
+      const gaugeEl = this.dom.createElement('div', 'lh-score__gauge');
+      gaugeEl.appendChild(this.renderScoreGauge(category, groups));
+      element.appendChild(gaugeEl);
+    } else {
+      this.createPermalinkSpan(element, category.id);
+      element.appendChild(this.renderCategoryHeader(category, groups));
+    }
+
+    // Metrics.
+    const metricAuditsEl = this.renderAuditGroup(groups.metrics);
+
+    // Metric descriptions toggle.
+    const toggleTmpl = this.dom.cloneTemplate('#tmpl-lh-metrics-toggle', this.templateContext);
+    const _toggleEl = this.dom.find('.lh-metrics-toggle', toggleTmpl);
+    metricAuditsEl.append(..._toggleEl.childNodes);
+
+    const metricAudits = category.auditRefs.filter(audit => audit.group === 'metrics');
+    const keyMetrics = metricAudits.filter(a => a.weight >= 3);
+    const otherMetrics = metricAudits.filter(a => a.weight < 3);
+
+    const metricsBoxesEl = this.dom.createChildOf(metricAuditsEl, 'div', 'lh-columns');
+    const metricsColumn1El = this.dom.createChildOf(metricsBoxesEl, 'div', 'lh-column');
+    const metricsColumn2El = this.dom.createChildOf(metricsBoxesEl, 'div', 'lh-column');
+
+    keyMetrics.forEach(item => {
+      metricsColumn1El.appendChild(this._renderMetric(item));
+    });
+    otherMetrics.forEach(item => {
+      metricsColumn2El.appendChild(this._renderMetric(item));
+    });
+
+    // 'Values are estimated and may vary' is used as the category description for PSI
+    if (environment !== 'PSI') {
+      const estValuesEl = this.dom.createChildOf(metricAuditsEl, 'div', 'lh-metrics__disclaimer');
+      const disclaimerEl = this.dom.convertMarkdownLinkSnippets(Util.UIStrings.varianceDisclaimer);
+      estValuesEl.appendChild(disclaimerEl);
+    }
+
+    metricAuditsEl.classList.add('lh-audit-group--metrics');
+    element.appendChild(metricAuditsEl);
+
+    // Filmstrip
+    const timelineEl = this.dom.createChildOf(element, 'div', 'lh-filmstrip-container');
+    const thumbnailAudit = category.auditRefs.find(audit => audit.id === 'screenshot-thumbnails');
+    const thumbnailResult = thumbnailAudit && thumbnailAudit.result;
+    if (thumbnailResult && thumbnailResult.details) {
+      timelineEl.id = thumbnailResult.id;
+      const filmstripEl = this.detailsRenderer.render(thumbnailResult.details);
+      filmstripEl && timelineEl.appendChild(filmstripEl);
+    }
+
+    // Budgets
+    const budgetAudit = category.auditRefs.find(audit => audit.id === 'performance-budget');
+    if (budgetAudit && budgetAudit.result.details) {
+      const table = this.detailsRenderer.render(budgetAudit.result.details);
+      if (table) {
+        table.id = budgetAudit.id;
+        table.classList.add('lh-audit');
+        const budgetsGroupEl = this.renderAuditGroup(groups.budgets);
+        budgetsGroupEl.appendChild(table);
+        budgetsGroupEl.classList.add('lh-audit-group--budgets');
+        element.appendChild(budgetsGroupEl);
+      }
+    }
+
+    // Opportunities
+    const opportunityAudits = category.auditRefs
+        .filter(audit => audit.group === 'load-opportunities' && !Util.showAsPassed(audit.result))
+        .sort((auditA, auditB) => this._getWastedMs(auditB) - this._getWastedMs(auditA));
+
+    if (opportunityAudits.length) {
+      // Scale the sparklines relative to savings, minimum 2s to not overstate small savings
+      const minimumScale = 2000;
+      const wastedMsValues = opportunityAudits.map(audit => this._getWastedMs(audit));
+      const maxWaste = Math.max(...wastedMsValues);
+      const scale = Math.max(Math.ceil(maxWaste / 1000) * 1000, minimumScale);
+      const groupEl = this.renderAuditGroup(groups['load-opportunities']);
+      const tmpl = this.dom.cloneTemplate('#tmpl-lh-opportunity-header', this.templateContext);
+
+      this.dom.find('.lh-load-opportunity__col--one', tmpl).textContent =
+        Util.UIStrings.opportunityResourceColumnLabel;
+      this.dom.find('.lh-load-opportunity__col--two', tmpl).textContent =
+        Util.UIStrings.opportunitySavingsColumnLabel;
+
+      const headerEl = this.dom.find('.lh-load-opportunity__header', tmpl);
+      groupEl.appendChild(headerEl);
+      opportunityAudits.forEach(item => groupEl.appendChild(this._renderOpportunity(item, scale)));
+      groupEl.classList.add('lh-audit-group--load-opportunities');
+      element.appendChild(groupEl);
+    }
+
+    // Diagnostics
+    const diagnosticAudits = category.auditRefs
+        .filter(audit => audit.group === 'diagnostics' && !Util.showAsPassed(audit.result))
+        .sort((a, b) => {
+          const scoreA = a.result.scoreDisplayMode === 'informative' ? 100 : Number(a.result.score);
+          const scoreB = b.result.scoreDisplayMode === 'informative' ? 100 : Number(b.result.score);
+          return scoreA - scoreB;
+        });
+
+    if (diagnosticAudits.length) {
+      const groupEl = this.renderAuditGroup(groups['diagnostics']);
+      diagnosticAudits.forEach(item => groupEl.appendChild(this.renderAudit(item)));
+      groupEl.classList.add('lh-audit-group--diagnostics');
+      element.appendChild(groupEl);
+    }
+
+    // Passed audits
+    const passedAudits = category.auditRefs
+        .filter(audit => (audit.group === 'load-opportunities' || audit.group === 'diagnostics') &&
+            Util.showAsPassed(audit.result));
+
+    if (!passedAudits.length) return element;
+
+    const clumpOpts = {
+      auditRefs: passedAudits,
+      groupDefinitions: groups,
+    };
+    const passedElem = this.renderClump('passed', clumpOpts);
+    element.appendChild(passedElem);
+    return element;
+  }
+}
+
+if (typeof module !== 'undefined' && module.exports) {
+  module.exports = PerformanceCategoryRenderer;
+} else {
+  self.PerformanceCategoryRenderer = PerformanceCategoryRenderer;
+}
+;
+/**
+ * @license
+ * Copyright 2018 Google Inc. All Rights Reserved.
+ *
+ * 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
+ *
+ * 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.
+ */
+'use strict';
+
+/* globals self, Util, CategoryRenderer */
+
+/**
+ * An always-increasing counter for making unique SVG ID suffixes.
+ */
+const getUniqueSuffix = (() => {
+  let svgSuffix = 0;
+  return function() {
+    return svgSuffix++;
+  };
+})();
+
+class PwaCategoryRenderer extends CategoryRenderer {
+  /**
+   * @param {LH.ReportResult.Category} category
+   * @param {Object<string, LH.Result.ReportGroup>} [groupDefinitions]
+   * @return {Element}
+   */
+  render(category, groupDefinitions = {}) {
+    const categoryElem = this.dom.createElement('div', 'lh-category');
+    this.createPermalinkSpan(categoryElem, category.id);
+    categoryElem.appendChild(this.renderCategoryHeader(category, groupDefinitions));
+
+    const auditRefs = category.auditRefs;
+
+    // Regular audits aren't split up into pass/fail/notApplicable clumps, they're
+    // all put in a top-level clump that isn't expandable/collapsible.
+    const regularAuditRefs = auditRefs.filter(ref => ref.result.scoreDisplayMode !== 'manual');
+    const auditsElem = this._renderAudits(regularAuditRefs, groupDefinitions);
+    categoryElem.appendChild(auditsElem);
+
+    // Manual audits are still in a manual clump.
+    const manualAuditRefs = auditRefs.filter(ref => ref.result.scoreDisplayMode === 'manual');
+    const manualElem = this.renderClump('manual',
+      {auditRefs: manualAuditRefs, description: category.manualDescription});
+    categoryElem.appendChild(manualElem);
+
+    return categoryElem;
+  }
+
+  /**
+   * @param {LH.ReportResult.Category} category
+   * @param {Record<string, LH.Result.ReportGroup>} groupDefinitions
+   * @return {DocumentFragment}
+   */
+  renderScoreGauge(category, groupDefinitions) {
+    // Defer to parent-gauge style if category error.
+    if (category.score === null) {
+      return super.renderScoreGauge(category, groupDefinitions);
+    }
+
+    const tmpl = this.dom.cloneTemplate('#tmpl-lh-gauge--pwa', this.templateContext);
+    const wrapper = /** @type {HTMLAnchorElement} */ (this.dom.find('.lh-gauge--pwa__wrapper',
+      tmpl));
+    wrapper.href = `#${category.id}`;
+
+    // Correct IDs in case multiple instances end up in the page.
+    const svgRoot = tmpl.querySelector('svg');
+    if (!svgRoot) throw new Error('no SVG element found in PWA score gauge template');
+    PwaCategoryRenderer._makeSvgReferencesUnique(svgRoot);
+
+    const allGroups = this._getGroupIds(category.auditRefs);
+    const passingGroupIds = this._getPassingGroupIds(category.auditRefs);
+
+    if (passingGroupIds.size === allGroups.size) {
+      wrapper.classList.add('lh-badged--all');
+    } else {
+      for (const passingGroupId of passingGroupIds) {
+        wrapper.classList.add(`lh-badged--${passingGroupId}`);
+      }
+    }
+
+    this.dom.find('.lh-gauge__label', tmpl).textContent = category.title;
+    wrapper.title = this._getGaugeTooltip(category.auditRefs, groupDefinitions);
+    return tmpl;
+  }
+
+  /**
+   * Returns the group IDs found in auditRefs.
+   * @param {Array<LH.ReportResult.AuditRef>} auditRefs
+   * @return {Set<string>}
+   */
+  _getGroupIds(auditRefs) {
+    const groupIds = auditRefs.map(ref => ref.group).filter(/** @return {g is string} */ g => !!g);
+    return new Set(groupIds);
+  }
+
+  /**
+   * Returns the group IDs whose audits are all considered passing.
+   * @param {Array<LH.ReportResult.AuditRef>} auditRefs
+   * @return {Set<string>}
+   */
+  _getPassingGroupIds(auditRefs) {
+    const uniqueGroupIds = this._getGroupIds(auditRefs);
+
+    // Remove any that have a failing audit.
+    for (const auditRef of auditRefs) {
+      if (!Util.showAsPassed(auditRef.result) && auditRef.group) {
+        uniqueGroupIds.delete(auditRef.group);
+      }
+    }
+
+    return uniqueGroupIds;
+  }
+
+  /**
+   * Returns a tooltip string summarizing group pass rates.
+   * @param {Array<LH.ReportResult.AuditRef>} auditRefs
+   * @param {Record<string, LH.Result.ReportGroup>} groupDefinitions
+   * @return {string}
+   */
+  _getGaugeTooltip(auditRefs, groupDefinitions) {
+    const groupIds = this._getGroupIds(auditRefs);
+
+    const tips = [];
+    for (const groupId of groupIds) {
+      const groupAuditRefs = auditRefs.filter(ref => ref.group === groupId);
+      const auditCount = groupAuditRefs.length;
+      const passedCount = groupAuditRefs.filter(ref => Util.showAsPassed(ref.result)).length;
+
+      const title = groupDefinitions[groupId].title;
+      tips.push(`${title}: ${passedCount}/${auditCount}`);
+    }
+
+    return tips.join(', ');
+  }
+
+  /**
+   * Render non-manual audits in groups, giving a badge to any group that has
+   * all passing audits.
+   * @param {Array<LH.ReportResult.AuditRef>} auditRefs
+   * @param {Object<string, LH.Result.ReportGroup>} groupDefinitions
+   * @return {Element}
+   */
+  _renderAudits(auditRefs, groupDefinitions) {
+    const auditsElem = this.renderUnexpandableClump(auditRefs, groupDefinitions);
+
+    // Add a 'badged' class to group if all audits in that group pass.
+    const passsingGroupIds = this._getPassingGroupIds(auditRefs);
+    for (const groupId of passsingGroupIds) {
+      const groupElem = this.dom.find(`.lh-audit-group--${groupId}`, auditsElem);
+      groupElem.classList.add('lh-badged');
+    }
+
+    return auditsElem;
+  }
+
+  /**
+   * Alters SVG id references so multiple instances of an SVG element can coexist
+   * in a single page. If `svgRoot` has a `<defs>` block, gives all elements defined
+   * in it unique ids, then updates id references (`<use xlink:href="...">`,
+   * `fill="url(#...)"`) to the altered ids in all descendents of `svgRoot`.
+   * @param {SVGElement} svgRoot
+   */
+  static _makeSvgReferencesUnique(svgRoot) {
+    const defsEl = svgRoot.querySelector('defs');
+    if (!defsEl) return;
+
+    const idSuffix = getUniqueSuffix();
+    const elementsToUpdate = defsEl.querySelectorAll('[id]');
+    for (const el of elementsToUpdate) {
+      const oldId = el.id;
+      const newId = `${oldId}-${idSuffix}`;
+      el.id = newId;
+
+      // Update all <use>s.
+      const useEls = svgRoot.querySelectorAll(`use[href="#${oldId}"]`);
+      for (const useEl of useEls) {
+        useEl.setAttribute('href', `#${newId}`);
+      }
+
+      // Update all fill="url(#...)"s.
+      const fillEls = svgRoot.querySelectorAll(`[fill="url(#${oldId})"]`);
+      for (const fillEl of fillEls) {
+        fillEl.setAttribute('fill', `url(#${newId})`);
+      }
+    }
+  }
+}
+
+if (typeof module !== 'undefined' && module.exports) {
+  module.exports = PwaCategoryRenderer;
+} else {
+  self.PwaCategoryRenderer = PwaCategoryRenderer;
+}
+;
+/**
+ * @license
+ * Copyright 2017 Google Inc. All Rights Reserved.
+ *
+ * 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
+ *
+ * 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.
+ */
+'use strict';
+
+/**
+ * @fileoverview The entry point for rendering the Lighthouse report based on the JSON output.
+ *    This file is injected into the report HTML along with the JSON report.
+ *
+ * Dummy text for ensuring report robustness: </script> pre$`post %%LIGHTHOUSE_JSON%%
+ */
+
+/** @typedef {import('./dom.js')} DOM */
+
+/* globals self, Util, DetailsRenderer, CategoryRenderer, PerformanceCategoryRenderer, PwaCategoryRenderer */
+
+class ReportRenderer {
+  /**
+   * @param {DOM} dom
+   */
+  constructor(dom) {
+    /** @type {DOM} */
+    this._dom = dom;
+    /** @type {ParentNode} */
+    this._templateContext = this._dom.document();
+  }
+
+  /**
+   * @param {LH.Result} result
+   * @param {Element} container Parent element to render the report into.
+   * @return {Element}
+   */
+  renderReport(result, container) {
+    // Mutate the UIStrings if necessary (while saving originals)
+    const originalUIStrings = JSON.parse(JSON.stringify(Util.UIStrings));
+
+    this._dom.setLighthouseChannel(result.configSettings.channel || 'unknown');
+
+    const report = Util.prepareReportResult(result);
+
+    container.textContent = ''; // Remove previous report.
+    container.appendChild(this._renderReport(report));
+
+    // put the UIStrings back into original state
+    Util.updateAllUIStrings(originalUIStrings);
+
+    return container;
+  }
+
+  /**
+   * Define a custom element for <templates> to be extracted from. For example:
+   *     this.setTemplateContext(new DOMParser().parseFromString(htmlStr, 'text/html'))
+   * @param {ParentNode} context
+   */
+  setTemplateContext(context) {
+    this._templateContext = context;
+  }
+
+  /**
+   * @param {LH.ReportResult} report
+   * @return {DocumentFragment}
+   */
+  _renderReportTopbar(report) {
+    const el = this._dom.cloneTemplate('#tmpl-lh-topbar', this._templateContext);
+    const metadataUrl = /** @type {HTMLAnchorElement} */ (this._dom.find('.lh-topbar__url', el));
+    metadataUrl.href = metadataUrl.textContent = report.finalUrl;
+    metadataUrl.title = report.finalUrl;
+    return el;
+  }
+
+  /**
+   * @return {DocumentFragment}
+   */
+  _renderReportHeader() {
+    const el = this._dom.cloneTemplate('#tmpl-lh-heading', this._templateContext);
+    const domFragment = this._dom.cloneTemplate('#tmpl-lh-scores-wrapper', this._templateContext);
+    const placeholder = this._dom.find('.lh-scores-wrapper-placeholder', el);
+    /** @type {HTMLDivElement} */ (placeholder.parentNode).replaceChild(domFragment, placeholder);
+    return el;
+  }
+
+  /**
+   * @param {LH.ReportResult} report
+   * @return {DocumentFragment}
+   */
+  _renderReportFooter(report) {
+    const footer = this._dom.cloneTemplate('#tmpl-lh-footer', this._templateContext);
+
+    const env = this._dom.find('.lh-env__items', footer);
+    env.id = 'runtime-settings';
+    const envValues = Util.getEnvironmentDisplayValues(report.configSettings || {});
+    [
+      {name: 'URL', description: report.finalUrl},
+      {name: 'Fetch time', description: Util.formatDateTime(report.fetchTime)},
+      ...envValues,
+      {name: 'User agent (host)', description: report.userAgent},
+      {name: 'User agent (network)', description: report.environment &&
+        report.environment.networkUserAgent},
+      {name: 'CPU/Memory Power', description: report.environment &&
+        report.environment.benchmarkIndex.toFixed(0)},
+    ].forEach(runtime => {
+      if (!runtime.description) return;
+
+      const item = this._dom.cloneTemplate('#tmpl-lh-env__items', env);
+      this._dom.find('.lh-env__name', item).textContent = runtime.name;
+      this._dom.find('.lh-env__description', item).textContent = runtime.description;
+      env.appendChild(item);
+    });
+
+    this._dom.find('.lh-footer__version', footer).textContent = report.lighthouseVersion;
+    return footer;
+  }
+
+  /**
+   * Returns a div with a list of top-level warnings, or an empty div if no warnings.
+   * @param {LH.ReportResult} report
+   * @return {Node}
+   */
+  _renderReportWarnings(report) {
+    if (!report.runWarnings || report.runWarnings.length === 0) {
+      return this._dom.createElement('div');
+    }
+
+    const container = this._dom.cloneTemplate('#tmpl-lh-warnings--toplevel', this._templateContext);
+    const message = this._dom.find('.lh-warnings__msg', container);
+    message.textContent = Util.UIStrings.toplevelWarningsMessage;
+
+    const warnings = this._dom.find('ul', container);
+    for (const warningString of report.runWarnings) {
+      const warning = warnings.appendChild(this._dom.createElement('li'));
+      warning.textContent = warningString;
+    }
+
+    return container;
+  }
+
+  /**
+   * @param {LH.ReportResult} report
+   * @param {CategoryRenderer} categoryRenderer
+   * @param {Record<string, CategoryRenderer>} specificCategoryRenderers
+   * @return {DocumentFragment[]}
+   */
+  _renderScoreGauges(report, categoryRenderer, specificCategoryRenderers) {
+    // Group gauges in this order: default, pwa, plugins.
+    const defaultGauges = [];
+    const customGauges = []; // PWA.
+    const pluginGauges = [];
+
+    for (const category of Object.values(report.categories)) {
+      const renderer = specificCategoryRenderers[category.id] || categoryRenderer;
+      const categoryGauge = renderer.renderScoreGauge(category, report.categoryGroups || {});
+
+      if (Util.isPluginCategory(category.id)) {
+        pluginGauges.push(categoryGauge);
+      } else if (renderer.renderScoreGauge === categoryRenderer.renderScoreGauge) {
+        // The renderer for default categories is just the default CategoryRenderer.
+        // If the functions are equal, then renderer is an instance of CategoryRenderer.
+        // For example, the PWA category uses PwaCategoryRenderer, which overrides
+        // CategoryRenderer.renderScoreGauge, so it would fail this check and be placed
+        // in the customGauges bucket.
+        defaultGauges.push(categoryGauge);
+      } else {
+        customGauges.push(categoryGauge);
+      }
+    }
+
+    return [...defaultGauges, ...customGauges, ...pluginGauges];
+  }
+
+  /**
+   * @param {LH.ReportResult} report
+   * @return {DocumentFragment}
+   */
+  _renderReport(report) {
+    const detailsRenderer = new DetailsRenderer(this._dom);
+    const categoryRenderer = new CategoryRenderer(this._dom, detailsRenderer);
+    categoryRenderer.setTemplateContext(this._templateContext);
+
+    /** @type {Record<string, CategoryRenderer>} */
+    const specificCategoryRenderers = {
+      performance: new PerformanceCategoryRenderer(this._dom, detailsRenderer),
+      pwa: new PwaCategoryRenderer(this._dom, detailsRenderer),
+    };
+    Object.values(specificCategoryRenderers).forEach(renderer => {
+      renderer.setTemplateContext(this._templateContext);
+    });
+
+    const headerContainer = this._dom.createElement('div');
+    headerContainer.appendChild(this._renderReportHeader());
+
+    const reportContainer = this._dom.createElement('div', 'lh-container');
+    const reportSection = this._dom.createElement('div', 'lh-report');
+    reportSection.appendChild(this._renderReportWarnings(report));
+
+    let scoreHeader;
+    const isSoloCategory = Object.keys(report.categories).length === 1;
+    if (!isSoloCategory) {
+      scoreHeader = this._dom.createElement('div', 'lh-scores-header');
+    } else {
+      headerContainer.classList.add('lh-header--solo-category');
+    }
+
+    if (scoreHeader) {
+      const scoreScale = this._dom.cloneTemplate('#tmpl-lh-scorescale', this._templateContext);
+      const scoresContainer = this._dom.find('.lh-scores-container', headerContainer);
+      scoreHeader.append(
+        ...this._renderScoreGauges(report, categoryRenderer, specificCategoryRenderers));
+      scoresContainer.appendChild(scoreHeader);
+      scoresContainer.appendChild(scoreScale);
+
+      const stickyHeader = this._dom.createElement('div', 'lh-sticky-header');
+      stickyHeader.append(
+        ...this._renderScoreGauges(report, categoryRenderer, specificCategoryRenderers));
+      reportContainer.appendChild(stickyHeader);
+    }
+
+    const categories = reportSection.appendChild(this._dom.createElement('div', 'lh-categories'));
+    for (const category of Object.values(report.categories)) {
+      const renderer = specificCategoryRenderers[category.id] || categoryRenderer;
+      // .lh-category-wrapper is full-width and provides horizontal rules between categories.
+      // .lh-category within has the max-width: var(--report-width);
+      const wrapper = renderer.dom.createChildOf(categories, 'div', 'lh-category-wrapper');
+      wrapper.appendChild(renderer.render(category, report.categoryGroups));
+    }
+
+    const reportFragment = this._dom.createFragment();
+    const topbarDocumentFragment = this._renderReportTopbar(report);
+
+    reportFragment.appendChild(topbarDocumentFragment);
+    reportFragment.appendChild(reportContainer);
+    reportContainer.appendChild(headerContainer);
+    reportContainer.appendChild(reportSection);
+    reportSection.appendChild(this._renderReportFooter(report));
+
+    return reportFragment;
+  }
+}
+
+/** @type {LH.I18NRendererStrings} */
+ReportRenderer._UIStringsStash = {};
+
+if (typeof module !== 'undefined' && module.exports) {
+  module.exports = ReportRenderer;
+} else {
+  self.ReportRenderer = ReportRenderer;
+}
diff --git a/front_end/lighthouse/lighthouse/template.html b/front_end/lighthouse/lighthouse/template.html
new file mode 100644
index 0000000..e5950a4
--- /dev/null
+++ b/front_end/lighthouse/lighthouse/template.html
@@ -0,0 +1,79 @@
+<!--
+@license
+Copyright 2018 Google Inc. All Rights Reserved.
+
+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
+
+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.
+-->
+<!doctype html>
+<html lang="en">
+<head>
+  <meta charset="utf-8">
+  <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
+  <link rel="icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAEhklEQVR4AWJxL/BhIAesev1U5tcflpncgNrKIsqNIwzC9feMpDUzs70kOczMzMzJJcxwCTMzncPMnOwtzBwzMzPb0vRfeZPp0VhPS5I39V5fdiXV1/VD+9QC7OVn9BsyH1XIoEI1PfmJvLFowVV564+34DFUHudbmfDh4kVXh//7XwE+WjS/YfXZe3yr4j2rqj1AIhSB7hZ8ZtPZu/zw8cK523U4wE1/rvPfWrz4zs0m9ZdC9yUJAlASdBAgocRegfF/f3/h/PuaFsxMdwjAR0vm1+06eMMfIrhLqTWqdH4EumU2SPfMhigJAlRQbZrgrRsl9U+Y2DYDFCz3ILC9kiAiqSrMwbWT0nceEnR+9Kggc2zjOJCASDENkg0a5HfZZgDP81CM3CrQs2Z1+o7DJ6ePr8sK0AOCHv5Jjdt3evyYSaZ351VIStIxPRAUtrBYbxC6w+BZ0ivVSBKkIhJhemSyZpfB00EiPO2VjzYkxhcqXQqCWCShGplvi3y0QxqbuBurMjyJeWnkHZuAEgIQGsUBqwrfjZ+IlBgKyRJzVVYF8O6qFWdh86YzQzMrZigYmxAyfvHgLZQ/LC1CbeniW2Hkqr/PH16SgvGuf2/uzNMBwJA/njxizGPtSyAf7EziJCMGRDRdhoAC4PL1A/SrKQMAAQkEfpJAcRQdrBJ7gNwjSpJsdwK+CANBkqa1LgQB4IicV9nYUct7gaxuDJUErQIiEAiMxLVOFlKzIktPpT0ggpdpC/8YAHnxbgkUY4tAAFSR7AAXNyAAWHJrA/kHGjzg5nleuwFO7Nd/IoDw4Pm58+4jNLmYG0wRA5bErc2Mr3Y+dXTDW1VvwqbJkzMCHQ4S1GTCBOIgUHJrGdEwqzR+jAp/o2qAZelUDoQnruEEdDclJI6576AlNVfc+22XN/+Y1vnJD0Yind6UpEEvn/Hqq15EYjCW7jZCJEpnNvDgkyelDjs106kuux2AAXCSobULOWP8mLhYlpoDMK4qAFXJGk+grtH8YXVz5KJblqaG1+VUdTc0I290bmUQAriGITRbdQnom0aoFj8kx1+wMD2ifncAXUQE4SkDqN1hE0jEophs1SUwZAOhUAiMCLwRtamtTZtbbmZErSAUHbSysaoEmnrsakiMiUAURi283gN6wans9oX8rOCrj7/JP35DFD+iQ7Au/K2KE1jzx6ujjUnXFH9KjEq6ZlhsTBICrNLJf47Pv/pkHzvup1w4dmUbEei0+bcXRqJuh5kVARQ8byyYxOwNGr7A87xh1tp8sGT+uMInrwi++Xj7TQz2d27NvwEkrOflAFQGIDA5khASBCGdO2/Z/MnLPwYfv5TFhjW7QhVKAB6afwe2LpFlFsCnlQEosgQgDsdOG1/LKeNqJS4JCSPJ/i+TakwEARor7gER1Iva5JmPOJK0RUqmoPnnlzFCtmIAhAAQEIQRgDaiYPIauNXcnDlRIrWNFY3hm7PG9YRqr7IV7HrCgAC17befjEvRq2nGhAHtBqDpOuI/I1diUUAMYIxEdyejBJqLnNoszGZtfiX/CztGv2mq+sdaAAAAAElFTkSuQmCC">
+  <title>Lighthouse Report</title>
+  <style>/*%%LIGHTHOUSE_CSS%%*/</style>
+</head>
+<body class="lh-root lh-vars">
+  <noscript>Lighthouse report requires JavaScript. Please enable.</noscript>
+  <div hidden>%%LIGHTHOUSE_TEMPLATES%%</div>
+
+  <main><!-- report populated here --></main>
+
+  <div id="lh-log"></div>
+
+  <script>%%LIGHTHOUSE_JAVASCRIPT%%
+  //# sourceURL=compiled-reportrenderer.js
+  </script>
+  <script>window.__LIGHTHOUSE_JSON__ = %%LIGHTHOUSE_JSON%%;</script>
+  <script>
+    function __initLighthouseReport__() {
+      const dom = new DOM(document);
+      const renderer = new ReportRenderer(dom);
+
+      const container = document.querySelector('main');
+      renderer.renderReport(window.__LIGHTHOUSE_JSON__, container);
+
+      // Hook in JS features and page-level event listeners after the report
+      // is in the document.
+      const features = new ReportUIFeatures(dom);
+      features.initFeatures(window.__LIGHTHOUSE_JSON__);
+    }
+    window.addEventListener('DOMContentLoaded', __initLighthouseReport__);
+
+    document.addEventListener('lh-analytics', e => {
+      if (window.ga) {
+        ga(e.detail.cmd, e.detail.fields);
+      }
+    });
+
+    document.addEventListener('lh-log', e => {
+      const logger = new Logger(document.querySelector('#lh-log'));
+
+      switch (e.detail.cmd) {
+        case 'log':
+          logger.log(e.detail.msg);
+          break;
+        case 'warn':
+          logger.warn(e.detail.msg);
+          break;
+        case 'error':
+          logger.error(e.detail.msg);
+          break;
+        case 'hide':
+          logger.hide();
+          break;
+      }
+    });
+  </script>
+</body>
+</html>
diff --git a/front_end/lighthouse/lighthouse/templates.html b/front_end/lighthouse/lighthouse/templates.html
new file mode 100644
index 0000000..57462c1
--- /dev/null
+++ b/front_end/lighthouse/lighthouse/templates.html
@@ -0,0 +1,944 @@
+<!--
+@license
+Copyright 2018 Google Inc. All Rights Reserved.
+
+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
+
+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.
+-->
+
+<!-- Lighthouse run warnings -->
+<template id="tmpl-lh-warnings--toplevel">
+  <div class="lh-warnings lh-warnings--toplevel">
+    <strong class="lh-warnings__msg"></strong>
+    <ul></ul>
+  </div>
+</template>
+
+<!-- Lighthouse score scale -->
+<template id="tmpl-lh-scorescale">
+  <div class="lh-scorescale">
+      <span class="lh-scorescale-range lh-scorescale-range--fail">0&ndash;49</span>
+      <span class="lh-scorescale-range lh-scorescale-range--average">50&ndash;89</span>
+      <span class="lh-scorescale-range lh-scorescale-range--pass">90&ndash;100</span>
+  </div>
+</template>
+
+<!-- Toggle arrow chevron -->
+<template id="tmpl-lh-chevron">
+  <svg class="lh-chevron" title="See audits" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 100 100">
+    <g class="lh-chevron__lines">
+      <path class="lh-chevron__line lh-chevron__line-left" d="M10 50h40"></path>
+      <path class="lh-chevron__line lh-chevron__line-right" d="M90 50H50"></path>
+    </g>
+  </svg>
+</template>
+
+<!-- Lighthouse category header -->
+<template id="tmpl-lh-category-header">
+  <div class="lh-category-header">
+    <div class="lh-score__gauge" role="heading" aria-level="2"></div>
+    <div class="lh-category-header__description"></div>
+  </div>
+</template>
+
+<!-- Lighthouse clump -->
+<template id="tmpl-lh-clump">
+  <!-- TODO: group classes shouldn't be reused for clumps. -->
+  <details class="lh-clump lh-audit-group">
+    <summary>
+      <div class="lh-audit-group__summary">
+        <div class="lh-audit-group__header">
+          <span class="lh-audit-group__title"></span>
+          <span class="lh-audit-group__itemcount"></span>
+          <!-- .lh-audit-group__description will be added here -->
+          <!-- .lh-metrics-toggle will be added here -->
+        </div>
+        <div class=""></div>
+      </div>
+    </summary>
+  </details>
+</template>
+
+<!-- Lighthouse metrics toggle -->
+<template id="tmpl-lh-metrics-toggle">
+  <div class="lh-metrics-toggle">
+    <input class="lh-metrics-toggle__input" type="checkbox" id="toggle-metric-descriptions" aria-label="Toggle the display of metric descriptions">
+    <label class="lh-metrics-toggle__label" for="toggle-metric-descriptions">
+      <div class="lh-metrics-toggle__icon lh-metrics-toggle__icon--less" aria-hidden="true">
+        <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="24" height="24" viewBox="0 0 24 24">
+          <path class="lh-metrics-toggle__lines" d="M4 9h16v2H4zm0 4h10v2H4z" />
+        </svg>
+      </div>
+      <div class="lh-metrics-toggle__icon lh-metrics-toggle__icon--more" aria-hidden="true">
+        <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
+          <path class="lh-metrics-toggle__lines" d="M3 18h12v-2H3v2zM3 6v2h18V6H3zm0 7h18v-2H3v2z" />
+        </svg>
+      </div>
+    </label>
+  </div>
+</template>
+
+<!-- Lighthouse audit -->
+<template id="tmpl-lh-audit">
+  <div class="lh-audit">
+    <details class="lh-expandable-details">
+      <summary>
+        <div class="lh-audit__header lh-expandable-details__summary">
+          <span class="lh-audit__score-icon"></span>
+          <span class="lh-audit__title-and-text">
+            <span class="lh-audit__title"></span>
+            <span class="lh-audit__display-text"></span>
+          </span>
+          <div class="lh-chevron-container"></div>
+        </div>
+      </summary>
+      <div class="lh-audit__description"></div>
+      <div class="lh-audit__stackpacks"></div>
+    </details>
+  </div>
+</template>
+
+<!-- Lighthouse perf metric -->
+<template id="tmpl-lh-metric">
+  <div class="lh-metric">
+    <div class="lh-metric__innerwrap">
+      <span class="lh-metric__title"></span>
+      <div class="lh-metric__value"></div>
+      <div class="lh-metric__description"></div>
+    </div>
+  </div>
+</template>
+
+<!-- Lighthouse perf opportunity -->
+<template id="tmpl-lh-opportunity">
+  <div class="lh-audit lh-audit--load-opportunity">
+    <details class="lh-expandable-details">
+        <summary>
+          <div class="lh-audit__header lh-expandable-details__summary">
+            <div class="lh-load-opportunity__cols">
+              <div class="lh-load-opportunity__col lh-load-opportunity__col--one">
+                <span class="lh-audit__score-icon"></span>
+                <div class="lh-audit__title"></div>
+              </div>
+              <div class="lh-load-opportunity__col lh-load-opportunity__col--two">
+                <div class="lh-load-opportunity__sparkline">
+                  <div class="lh-sparkline"><div class="lh-sparkline__bar"></div></div>
+                </div>
+                <div class="lh-audit__display-text"></div>
+                <div class="lh-chevron-container" title="See resources"></div>
+              </div>
+            </div>
+          </div>
+        </summary>
+      <div class="lh-audit__description"></div>
+      <div class="lh-audit__stackpacks"></div>
+    </details>
+  </div>
+</template>
+
+<!-- Lighthouse perf opportunity header -->
+<template id="tmpl-lh-opportunity-header">
+  <div class="lh-load-opportunity__header lh-load-opportunity__cols">
+    <div class="lh-load-opportunity__col lh-load-opportunity__col--one"></div>
+    <div class="lh-load-opportunity__col lh-load-opportunity__col--two"></div>
+  </div>
+</template>
+
+<!-- Lighthouse score container -->
+<template id="tmpl-lh-scores-wrapper">
+  <style>
+    .lh-scores-container {
+      display: flex;
+      flex-direction: column;
+      padding: var(--scores-container-padding);
+      position: relative;
+      width: 100%;
+    }
+
+    .lh-sticky-header {
+      --gauge-circle-size: 36px;
+      --plugin-badge-size: 18px;
+      --plugin-icon-size: 75%;
+      --gauge-wrapper-width: 60px;
+      --gauge-percentage-font-size: 13px;
+      position: sticky;
+      left: 0;
+      right: 0;
+      top: var(--topbar-height);
+      font-weight: 700;
+      display: none;
+      justify-content: center;
+      background-color: var(--sticky-header-background-color);
+      border-bottom: 1px solid var(--color-gray-200);
+      padding-top: var(--score-container-padding);
+      padding-bottom: 4px;
+      z-index: 1;
+      pointer-events: none;
+    }
+
+    .lh-sticky-header--visible {
+      display: grid;
+      grid-auto-flow: column;
+      pointer-events: auto;
+    }
+
+    /* Disable the gauge arc animation for the sticky header, so toggling display: none
+       does not play the animation. */
+    .lh-sticky-header .lh-gauge-arc {
+      animation: none;
+    }
+
+    .lh-sticky-header .lh-gauge__label {
+      display: none;
+    }
+
+    .lh-highlighter {
+      width: var(--gauge-wrapper-width);
+      height: 1px;
+      background-color: var(--highlighter-background-color);
+      /* Position at bottom of first gauge in sticky header. */
+      position: absolute;
+      grid-column: 1;
+      bottom: -1px;
+    }
+
+    .lh-gauge__wrapper:first-of-type {
+      contain: none;
+    }
+  </style>
+  <div class="lh-scores-wrapper">
+    <div class="lh-scores-container">
+      <div class="pyro">
+        <div class="before"></div>
+        <div class="after"></div>
+      </div>
+    </div>
+  </div>
+</template>
+
+<!-- Lighthouse topbar -->
+<template id="tmpl-lh-topbar">
+  <style>
+    .lh-topbar {
+      position: sticky;
+      top: 0;
+      left: 0;
+      right: 0;
+      z-index: 1000;
+      display: flex;
+      align-items: center;
+      height: var(--topbar-height);
+      background-color: var(--topbar-background-color);
+      padding: var(--topbar-padding);
+    }
+
+    .lh-topbar__logo {
+      width: var(--topbar-logo-size);
+      height: var(--topbar-logo-size);
+      user-select: none;
+      flex: none;
+    }
+    .lh-topbar__logo .shape {
+      fill: var(--report-text-color);
+    }
+
+    .lh-topbar__url {
+      margin: var(--topbar-padding);
+      text-decoration: none;
+      color: var(--report-text-color);
+      text-overflow: ellipsis;
+      overflow: hidden;
+      white-space: nowrap;
+    }
+
+    .lh-tools {
+      margin-left: auto;
+      will-change: transform;
+    }
+    .lh-tools__button {
+      width: var(--tools-icon-size);
+      height: var(--tools-icon-size);
+      cursor: pointer;
+      margin-right: 5px;
+      /* This is actually a button element, but we want to style it like a transparent div. */
+      display: flex;
+      background: none;
+      color: inherit;
+      border: none;
+      padding: 0;
+      font: inherit;
+      outline: inherit;
+    }
+    .lh-tools__button svg {
+      fill: var(--tools-icon-color);
+    }
+    .dark .lh-tools__button svg {
+      filter: invert(1);
+    }
+    .lh-tools__button.active + .lh-tools__dropdown {
+      opacity: 1;
+      clip: rect(-1px, 187px, 242px, -3px);
+      visibility: visible;
+    }
+    .lh-tools__dropdown {
+      position: absolute;
+      background-color: var(--report-background-color);
+      border: 1px solid var(--report-border-color);
+      border-radius: 3px;
+      padding: calc(var(--default-padding) / 2) 0;
+      cursor: pointer;
+      top: 36px;
+      right: 0;
+      box-shadow: 1px 1px 3px #ccc;
+      min-width: 125px;
+      clip: rect(0, 164px, 0, 0);
+      visibility: hidden;
+      opacity: 0;
+      transition: all 200ms cubic-bezier(0,0,0.2,1);
+    }
+    .lh-tools__dropdown a {
+      display: block;
+      color: currentColor;
+      text-decoration: none;
+      white-space: nowrap;
+      padding: 0 12px;
+      line-height: 2;
+    }
+    .lh-tools__dropdown a:hover,
+    .lh-tools__dropdown a:focus {
+      background-color: var(--color-gray-200);
+      outline: none;
+    }
+    .lh-tools__dropdown .report-icon {
+      cursor: pointer;
+      background-repeat: no-repeat;
+      background-position: 8px 50%;
+      background-size: 18px;
+      background-color: transparent;
+      text-indent: 18px;
+    }
+    .dark .report-icon {
+      color: var(--color-gray-900);
+      filter: invert(1);
+    }
+    .dark .lh-tools__dropdown a:hover,
+    .dark .lh-tools__dropdown a:focus {
+      background-color: #BDBDBD;
+    }
+    /* copy icon needs slight adjustments to look great */
+    .lh-tools__dropdown .report-icon--copy {
+      background-size: 16px;
+      background-position: 9px 50%;
+    }
+    /* save-as-gist option hidden in report */
+    .lh-tools__dropdown .lh-tools--gist {
+      display: none;
+    }
+
+    @media screen and (max-width: 964px) {
+      .lh-tools__dropdown {
+        right: 0;
+        left: initial;
+      }
+    }
+    @media print {
+      .lh-topbar {
+        position: static;
+        margin-left: 0;
+      }
+    }
+  </style>
+
+  <div class="lh-topbar">
+    <!-- Lighthouse logo.  -->
+    <svg class="lh-topbar__logo" viewBox="0 0 24 24">
+      <defs>
+        <linearGradient x1="57.456%" y1="13.086%" x2="18.259%" y2="72.322%" id="lh-topbar__logo--a">
+          <stop stop-color="#262626" stop-opacity=".1" offset="0%"/>
+          <stop stop-color="#262626" stop-opacity="0" offset="100%"/>
+        </linearGradient>
+        <linearGradient x1="100%" y1="50%" x2="0%" y2="50%" id="lh-topbar__logo--b">
+          <stop stop-color="#262626" stop-opacity=".1" offset="0%"/>
+          <stop stop-color="#262626" stop-opacity="0" offset="100%"/>
+        </linearGradient>
+        <linearGradient x1="58.764%" y1="65.756%" x2="36.939%" y2="50.14%" id="lh-topbar__logo--c">
+          <stop stop-color="#262626" stop-opacity=".1" offset="0%"/>
+          <stop stop-color="#262626" stop-opacity="0" offset="100%"/>
+        </linearGradient>
+        <linearGradient x1="41.635%" y1="20.358%" x2="72.863%" y2="85.424%" id="lh-topbar__logo--d">
+          <stop stop-color="#FFF" stop-opacity=".1" offset="0%"/>
+          <stop stop-color="#FFF" stop-opacity="0" offset="100%"/>
+        </linearGradient>
+      </defs>
+      <g fill="none" fill-rule="evenodd">
+        <path d="M12 3l4.125 2.625v3.75H18v2.25h-1.688l1.5 9.375H6.188l1.5-9.375H6v-2.25h1.875V5.648L12 3zm2.201 9.938L9.54 14.633 9 18.028l5.625-2.062-.424-3.028zM12.005 5.67l-1.88 1.207v2.498h3.75V6.86l-1.87-1.19z" fill="#F44B21"/>
+        <path fill="#FFF" d="M14.201 12.938L9.54 14.633 9 18.028l5.625-2.062z"/>
+        <path d="M6 18c-2.042 0-3.95-.01-5.813 0l1.5-9.375h4.326L6 18z" fill="url(#lh-topbar__logo--a)" fill-rule="nonzero" transform="translate(6 3)"/>
+        <path fill="#FFF176" fill-rule="nonzero" d="M13.875 9.375v-2.56l-1.87-1.19-1.88 1.207v2.543z"/>
+        <path fill="url(#lh-topbar__logo--b)" fill-rule="nonzero" d="M0 6.375h6v2.25H0z" transform="translate(6 3)"/>
+        <path fill="url(#lh-topbar__logo--c)" fill-rule="nonzero" d="M6 6.375H1.875v-3.75L6 0z" transform="translate(6 3)"/>
+        <path fill="url(#lh-topbar__logo--d)" fill-rule="nonzero" d="M6 0l4.125 2.625v3.75H12v2.25h-1.688l1.5 9.375H.188l1.5-9.375H0v-2.25h1.875V2.648z" transform="translate(6 3)"/>
+      </g>
+    </svg>
+
+    <a href="" class="lh-topbar__url" target="_blank" rel="noopener"></a>
+
+    <div class="lh-tools">
+      <button id="lh-tools-button" class="report-icon report-icon--share lh-tools__button" title="Tools menu" aria-label="Toggle report tools menu" aria-haspopup="menu" aria-expanded="false" aria-controls="lh-tools-dropdown">
+        <svg width="100%" height="100%" viewBox="0 0 24 24">
+            <path d="M0 0h24v24H0z" fill="none"/>
+            <path d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"/>
+        </svg>
+      </button>
+      <div id="lh-tools-dropdown" role="menu" class="lh-tools__dropdown" aria-labelledby="lh-tools-button">
+         <!-- TODO(i18n): localize tools dropdown -->
+        <a role="menuitem" tabindex="-1" href="#" class="report-icon report-icon--print" data-action="print-summary">Print Summary</a>
+        <a role="menuitem" tabindex="-1" href="#" class="report-icon report-icon--print" data-action="print-expanded">Print Expanded</a>
+        <a role="menuitem" tabindex="-1" href="#" class="report-icon report-icon--copy" data-action="copy">Copy JSON</a>
+        <a role="menuitem" tabindex="-1" href="#" class="report-icon report-icon--download" data-action="save-html">Save as HTML</a>
+        <a role="menuitem" tabindex="-1" href="#" class="report-icon report-icon--download" data-action="save-json">Save as JSON</a>
+        <a role="menuitem" tabindex="-1" href="#" class="report-icon report-icon--open lh-tools--viewer" data-action="open-viewer">Open in Viewer</a>
+        <a role="menuitem" tabindex="-1" href="#" class="report-icon report-icon--open lh-tools--gist" data-action="save-gist">Save as Gist</a>
+        <a role="menuitem" tabindex="-1" href="#" class="report-icon report-icon--dark" data-action="toggle-dark">Toggle Dark Theme</a>
+      </div>
+    </div>
+  </div>
+</template>
+
+<!-- Lighthouse header -->
+<template id="tmpl-lh-heading">
+  <style>
+    /* CSS Fireworks. Originally by Eddie Lin
+       https://codepen.io/paulirish/pen/yEVMbP
+    */
+    .pyro {
+      display: none;
+      z-index: 1;
+      pointer-events: none;
+    }
+    .score100 .pyro {
+      display: block;
+    }
+    .score100 .lh-lighthouse stop:first-child {
+      stop-color: hsla(200, 12%, 95%, 0);
+    }
+    .score100 .lh-lighthouse stop:last-child {
+      stop-color: hsla(65, 81%, 76%, 1);
+    }
+
+    .pyro > .before, .pyro > .after {
+      position: absolute;
+      width: 5px;
+      height: 5px;
+      border-radius: 2.5px;
+      box-shadow: 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff;
+      animation: 1s bang ease-out infinite backwards,  1s gravity ease-in infinite backwards,  5s position linear infinite backwards;
+      animation-delay: 1s, 1s, 1s;
+    }
+
+    .pyro > .after {
+      animation-delay: 2.25s, 2.25s, 2.25s;
+      animation-duration: 1.25s, 1.25s, 6.25s;
+    }
+    .fireworks-paused .pyro > div {
+      animation-play-state: paused;
+    }
+
+    @keyframes bang {
+      to {
+        box-shadow: -70px -115.67px #47ebbc, -28px -99.67px #eb47a4, 58px -31.67px #7eeb47, 13px -141.67px #eb47c5, -19px 6.33px #7347eb, -2px -74.67px #ebd247, 24px -151.67px #eb47e0, 57px -138.67px #b4eb47, -51px -104.67px #479eeb, 62px 8.33px #ebcf47, -93px 0.33px #d547eb, -16px -118.67px #47bfeb, 53px -84.67px #47eb83, 66px -57.67px #eb47bf, -93px -65.67px #91eb47, 30px -13.67px #86eb47, -2px -59.67px #83eb47, -44px 1.33px #eb47eb, 61px -58.67px #47eb73, 5px -22.67px #47e8eb, -66px -28.67px #ebe247, 42px -123.67px #eb5547, -75px 26.33px #7beb47, 15px -52.67px #a147eb, 36px -51.67px #eb8347, -38px -12.67px #eb5547, -46px -59.67px #47eb81, 78px -114.67px #eb47ba, 15px -156.67px #eb47bf, -36px 1.33px #eb4783, -72px -86.67px #eba147, 31px -46.67px #ebe247, -68px 29.33px #47e2eb, -55px 19.33px #ebe047, -56px 27.33px #4776eb, -13px -91.67px #eb5547, -47px -138.67px #47ebc7, -18px -96.67px #eb47ac, 11px -88.67px #4783eb, -67px -28.67px #47baeb, 53px 10.33px #ba47eb, 11px 19.33px #5247eb, -5px -11.67px #eb4791, -68px -4.67px #47eba7, 95px -37.67px #eb478b, -67px -162.67px #eb5d47, -54px -120.67px #eb6847, 49px -12.67px #ebe047, 88px 8.33px #47ebda, 97px 33.33px #eb8147, 6px -71.67px #ebbc47;
+      }
+    }
+    @keyframes gravity {
+      to {
+        transform: translateY(80px);
+        opacity: 0;
+      }
+    }
+    @keyframes position {
+      0%, 19.9% {
+        margin-top: 4%;
+        margin-left: 47%;
+      }
+      20%, 39.9% {
+        margin-top: 7%;
+        margin-left: 30%;
+      }
+      40%, 59.9% {
+        margin-top: 6%;
+        margin-left: 70%;
+      }
+      60%, 79.9% {
+        margin-top: 3%;
+        margin-left: 20%;
+      }
+      80%, 99.9% {
+        margin-top: 3%;
+        margin-left: 80%;
+      }
+    }
+  </style>
+
+  <div class="lh-header-container">
+    <div class="lh-scores-wrapper-placeholder"></div>
+  </div>
+</template>
+
+
+<!-- Lighthouse footer -->
+<template id="tmpl-lh-footer">
+  <style>
+    .lh-footer {
+      padding: var(--footer-padding-vertical) calc(var(--default-padding) * 2);
+      max-width: var(--report-width);
+      margin: 0 auto;
+    }
+    .lh-footer .lh-generated {
+      text-align: center;
+    }
+    .lh-env__title {
+      font-size: var(--env-item-font-size-big);
+      line-height: var(--env-item-line-height-big);
+      text-align: center;
+      padding: var(--score-container-padding);
+    }
+    .lh-env {
+      padding: var(--default-padding) 0;
+    }
+    .lh-env__items {
+      padding-left: 16px;
+      margin: 0 0 var(--audits-margin-bottom);
+      padding: 0;
+    }
+    .lh-env__items .lh-env__item:nth-child(2n) {
+      background-color: var(--env-item-background-color);
+    }
+    .lh-env__item {
+      display: flex;
+      padding: var(--env-item-padding);
+      position: relative;
+    }
+    span.lh-env__name {
+      font-weight: bold;
+      min-width: var(--env-name-min-width);
+      flex: 0.5;
+      padding: 0 8px;
+    }
+    span.lh-env__description {
+      text-align: left;
+      flex: 1;
+    }
+  </style>
+  <footer class="lh-footer">
+    <!-- TODO(i18n): localize runtime settings -->
+    <div class="lh-env">
+      <div class="lh-env__title">Runtime Settings</div>
+      <ul class="lh-env__items">
+        <template id="tmpl-lh-env__items">
+          <li class="lh-env__item">
+            <span class="lh-env__name"></span>
+            <span class="lh-env__description"></span>
+          </li>
+        </template>
+      </ul>
+    </div>
+
+    <div class="lh-generated">
+      Generated by <b>Lighthouse</b> <span class="lh-footer__version"></span> |
+      <a href="https://github.com/GoogleChrome/Lighthouse/issues" target="_blank" rel="noopener">File an issue</a>
+    </div>
+  </footer>
+</template>
+
+<!-- Lighthouse score gauge -->
+<template id="tmpl-lh-gauge">
+  <a href="#" class="lh-gauge__wrapper">
+    <!-- Wrapper exists for the ::before plugin icon. Cannot create pseudo-elements on svgs. -->
+    <div class="lh-gauge__svg-wrapper">
+      <svg viewBox="0 0 120 120" class="lh-gauge">
+        <circle class="lh-gauge-base" r="56" cx="60" cy="60"></circle>
+        <circle class="lh-gauge-arc" transform="rotate(-90 60 60)" r="56" cx="60" cy="60"></circle>
+      </svg>
+    </div>
+    <div class="lh-gauge__percentage"></div>
+    <!-- TODO: should likely be an h2  -->
+    <div class="lh-gauge__label"></div>
+  </a>
+</template>
+
+
+<!-- Lighthouse PWA badge gauge -->
+<template id="tmpl-lh-gauge--pwa">
+  <style>
+    .lh-gauge--pwa .lh-gauge--pwa__component {
+      display: none;
+    }
+    .lh-gauge--pwa__wrapper:not(.lh-badged--all) .lh-gauge--pwa__logo > path {
+      /* Gray logo unless everything is passing. */
+      fill: #B0B0B0;
+    }
+
+    .lh-gauge--pwa__disc {
+      fill: var(--color-gray-200);
+    }
+
+    .lh-gauge--pwa__logo--primary-color {
+      fill: #304FFE;
+    }
+
+    .lh-gauge--pwa__logo--secondary-color {
+      fill: #3D3D3D;
+    }
+    .dark .lh-gauge--pwa__logo--secondary-color {
+      fill: #D8B6B6;
+    }
+
+    /* No passing groups. */
+    .lh-gauge--pwa__wrapper:not([class*='lh-badged--']) .lh-gauge--pwa__na-line {
+      display: inline;
+    }
+    /* Just optimized. Same n/a line as no passing groups. */
+    .lh-gauge--pwa__wrapper.lh-badged--pwa-optimized:not(.lh-badged--pwa-installable):not(.lh-badged--pwa-fast-reliable) .lh-gauge--pwa__na-line {
+      display: inline;
+    }
+
+    /* Just fast and reliable. */
+    .lh-gauge--pwa__wrapper.lh-badged--pwa-fast-reliable:not(.lh-badged--pwa-installable) .lh-gauge--pwa__fast-reliable-badge {
+      display: inline;
+    }
+
+    /* Just installable. */
+    .lh-gauge--pwa__wrapper.lh-badged--pwa-installable:not(.lh-badged--pwa-fast-reliable) .lh-gauge--pwa__installable-badge {
+      display: inline;
+    }
+
+    /* Fast and reliable and installable. */
+    .lh-gauge--pwa__wrapper.lh-badged--pwa-fast-reliable.lh-badged--pwa-installable .lh-gauge--pwa__fast-reliable-installable-badges {
+      display: inline;
+    }
+
+    /* All passing groups. */
+    .lh-gauge--pwa__wrapper.lh-badged--all .lh-gauge--pwa__check-circle {
+      display: inline;
+    }
+  </style>
+
+  <a href="#" class="lh-gauge__wrapper lh-gauge--pwa__wrapper">
+    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 60" class="lh-gauge lh-gauge--pwa">
+      <defs>
+        <linearGradient id="lh-gauge--pwa__check-circle__gradient" x1="50%" y1="0%" x2="50%" y2="100%">
+          <stop stop-color="#00C852" offset="0%"></stop>
+          <stop stop-color="#009688" offset="100%"></stop>
+        </linearGradient>
+        <linearGradient id="lh-gauge--pwa__installable__shadow-gradient" x1="76.056%" x2="24.111%" y1="82.995%" y2="24.735%">
+          <stop stop-color="#A5D6A7" offset="0%"></stop>
+          <stop stop-color="#80CBC4" offset="100%"></stop>
+        </linearGradient>
+        <linearGradient id="lh-gauge--pwa__fast-reliable__shadow-gradient" x1="76.056%" y1="82.995%" x2="25.678%" y2="26.493%">
+          <stop stop-color="#64B5F6" offset="0%"></stop>
+          <stop stop-color="#2979FF" offset="100%"></stop>
+        </linearGradient>
+
+        <g id="lh-gauge--pwa__fast-reliable-badge">
+          <circle fill="#FFFFFF" cx="10" cy="10" r="10"></circle>
+          <path fill="#304FFE" d="M10 3.58l5.25 2.34v3.5c0 3.23-2.24 6.26-5.25 7-3.01-.74-5.25-3.77-5.25-7v-3.5L10 3.58zm-.47 10.74l2.76-4.83.03-.07c.04-.08 0-.24-.22-.24h-1.64l.47-3.26h-.47l-2.7 4.77c-.02.01.05-.1-.04.05-.09.16-.1.31.18.31h1.63l-.47 3.27h.47z"/>
+        </g>
+        <g id="lh-gauge--pwa__installable-badge">
+          <circle fill="#FFFFFF" cx="10" cy="10" r="10"></circle>
+          <path fill="#009688" d="M10 4.167A5.835 5.835 0 0 0 4.167 10 5.835 5.835 0 0 0 10 15.833 5.835 5.835 0 0 0 15.833 10 5.835 5.835 0 0 0 10 4.167zm2.917 6.416h-2.334v2.334H9.417v-2.334H7.083V9.417h2.334V7.083h1.166v2.334h2.334v1.166z"/>
+        </g>
+      </defs>
+
+      <g stroke="none" fill-rule="nonzero">
+        <!-- Background and PWA logo (color by default) -->
+        <circle class="lh-gauge--pwa__disc" cx="30" cy="30" r="30"></circle>
+        <g class="lh-gauge--pwa__logo">
+          <path class="lh-gauge--pwa__logo--secondary-color" d="M35.66 19.39l.7-1.75h2L37.4 15 38.6 12l3.4 9h-2.51l-.58-1.61z"/>
+          <path class="lh-gauge--pwa__logo--primary-color" d="M33.52 21l3.65-9h-2.42l-2.5 5.82L30.5 12h-1.86l-1.9 5.82-1.35-2.65-1.21 3.72L25.4 21h2.38l1.72-5.2 1.64 5.2z"/>
+          <path class="lh-gauge--pwa__logo--secondary-color" fill-rule="nonzero" d="M20.3 17.91h1.48c.45 0 .85-.05 1.2-.15l.39-1.18 1.07-3.3a2.64 2.64 0 0 0-.28-.37c-.55-.6-1.36-.91-2.42-.91H18v9h2.3V17.9zm1.96-3.84c.22.22.33.5.33.87 0 .36-.1.65-.29.87-.2.23-.59.35-1.15.35h-.86v-2.41h.87c.52 0 .89.1 1.1.32z"/>
+        </g>
+
+        <!-- No badges. -->
+        <rect class="lh-gauge--pwa__component lh-gauge--pwa__na-line" fill="#FFFFFF" x="20" y="32" width="20" height="4" rx="2"></rect>
+
+        <!-- Just fast and reliable. -->
+        <g class="lh-gauge--pwa__component lh-gauge--pwa__fast-reliable-badge" transform="translate(20, 29)">
+          <path fill="url(#lh-gauge--pwa__fast-reliable__shadow-gradient)" d="M33.63 19.49A30 30 0 0 1 16.2 30.36L3 17.14 17.14 3l16.49 16.49z"/>
+          <use href="#lh-gauge--pwa__fast-reliable-badge" />
+        </g>
+
+        <!-- Just installable. -->
+        <g class="lh-gauge--pwa__component lh-gauge--pwa__installable-badge" transform="translate(20, 29)">
+          <path fill="url(#lh-gauge--pwa__installable__shadow-gradient)" d="M33.629 19.487c-4.272 5.453-10.391 9.39-17.415 10.869L3 17.142 17.142 3 33.63 19.487z"/>
+          <use href="#lh-gauge--pwa__installable-badge" />
+        </g>
+
+        <!-- Fast and reliable and installable. -->
+        <g class="lh-gauge--pwa__component lh-gauge--pwa__fast-reliable-installable-badges">
+          <g transform="translate(8, 29)"> <!-- fast and reliable -->
+            <path fill="url(#lh-gauge--pwa__fast-reliable__shadow-gradient)" d="M16.321 30.463L3 17.143 17.142 3l22.365 22.365A29.864 29.864 0 0 1 22 31c-1.942 0-3.84-.184-5.679-.537z"/>
+            <use href="#lh-gauge--pwa__fast-reliable-badge" />
+          </g>
+          <g transform="translate(32, 29)"> <!-- installable -->
+            <path fill="url(#lh-gauge--pwa__installable__shadow-gradient)" d="M25.982 11.84a30.107 30.107 0 0 1-13.08 15.203L3 17.143 17.142 3l8.84 8.84z"/>
+            <use href="#lh-gauge--pwa__installable-badge" />
+          </g>
+        </g>
+
+        <!-- Full PWA. -->
+        <g class="lh-gauge--pwa__component lh-gauge--pwa__check-circle" transform="translate(18, 28)">
+          <circle fill="#FFFFFF" cx="12" cy="12" r="12"></circle>
+          <path fill="url(#lh-gauge--pwa__check-circle__gradient)" d="M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"></path>
+        </g>
+      </g>
+    </svg>
+
+    <div class="lh-gauge__label"></div>
+  </a>
+</template>
+
+<!-- Lighthouse crtiical request chains component -->
+<template id="tmpl-lh-crc">
+  <div class="lh-crc-container">
+    <style>
+      .lh-crc .tree-marker {
+        width: 12px;
+        height: 26px;
+        display: block;
+        float: left;
+        background-position: top left;
+      }
+      .lh-crc .horiz-down {
+        background: url('data:image/svg+xml;utf8,<svg width="16" height="26" viewBox="0 0 16 26" xmlns="http://www.w3.org/2000/svg"><g fill="%23D8D8D8" fill-rule="evenodd"><path d="M16 12v2H-2v-2z"/><path d="M9 12v14H7V12z"/></g></svg>');
+      }
+      .lh-crc .right {
+        background: url('data:image/svg+xml;utf8,<svg width="16" height="26" viewBox="0 0 16 26" xmlns="http://www.w3.org/2000/svg"><path d="M16 12v2H0v-2z" fill="%23D8D8D8" fill-rule="evenodd"/></svg>');
+      }
+      .lh-crc .up-right {
+        background: url('data:image/svg+xml;utf8,<svg width="16" height="26" viewBox="0 0 16 26" xmlns="http://www.w3.org/2000/svg"><path d="M7 0h2v14H7zm2 12h7v2H9z" fill="%23D8D8D8" fill-rule="evenodd"/></svg>');
+      }
+      .lh-crc .vert-right {
+        background: url('data:image/svg+xml;utf8,<svg width="16" height="26" viewBox="0 0 16 26" xmlns="http://www.w3.org/2000/svg"><path d="M7 0h2v27H7zm2 12h7v2H9z" fill="%23D8D8D8" fill-rule="evenodd"/></svg>');
+      }
+      .lh-crc .vert {
+        background: url('data:image/svg+xml;utf8,<svg width="16" height="26" viewBox="0 0 16 26" xmlns="http://www.w3.org/2000/svg"><path d="M7 0h2v26H7z" fill="%23D8D8D8" fill-rule="evenodd"/></svg>');
+      }
+      .lh-crc .crc-tree {
+        font-size: 14px;
+        width: 100%;
+        overflow-x: auto;
+      }
+      .lh-crc .crc-node {
+        height: 26px;
+        line-height: 26px;
+        white-space: nowrap;
+      }
+      .lh-crc .crc-node__tree-value {
+        margin-left: 10px;
+      }
+      .lh-crc .crc-node__tree-value div {
+        display: inline;
+      }
+      .lh-crc .crc-node__chain-duration {
+        font-weight: 700;
+      }
+      .lh-crc .crc-initial-nav {
+        color: #595959;
+        font-style: italic;
+      }
+      .lh-crc__summary-value {
+        margin-bottom: 10px;
+      }
+    </style>
+    <div>
+      <div class="lh-crc__summary-value">
+        <span class="lh-crc__longest_duration_label"></span> <b class="lh-crc__longest_duration"></b>
+      </div>
+    </div>
+    <div class="lh-crc">
+      <div class="crc-initial-nav"></div>
+      <!-- stamp for each chain -->
+      <template id="tmpl-lh-crc__chains">
+        <div class="crc-node">
+          <span class="crc-node__tree-marker">
+
+          </span>
+          <span class="crc-node__tree-value">
+
+          </span>
+        </div>
+      </template>
+    </div>
+  </div>
+</template>
+
+<template id="tmpl-lh-3p-filter">
+  <style>
+    .lh-3p-filter {
+      background-color: var(--table-higlight-background-color);
+      color: var(--color-gray-600);
+      float: right;
+      padding: 6px;
+    }
+    .lh-3p-filter-label, .lh-3p-filter-input {
+      vertical-align: middle;
+      user-select: none;
+    }
+    .lh-3p-filter-input:disabled + .lh-3p-ui-string {
+      text-decoration: line-through;
+    }
+  </style>
+  <div class="lh-3p-filter">
+    <label class="lh-3p-filter-label">
+      <input type="checkbox" class="lh-3p-filter-input" checked />
+      <span class="lh-3p-ui-string">Show 3rd party resources</span> (<span class="lh-3p-filter-count"></span>)
+    </label>
+  </div>
+</template>
+
+<!-- Lighthouse snippet component -->
+<template id="tmpl-lh-snippet">
+    <div class="lh-snippet">
+      <style>
+          :root {
+            --snippet-highlight-light: #fbf1f2;
+            --snippet-highlight-dark: #ffd6d8;
+          }
+
+         .lh-snippet__header {
+          position: relative;
+          overflow: hidden;
+          padding: 10px;
+          border-bottom: none;
+          color: var(--snippet-color);
+          background-color: var(--snippet-background-color);
+          border: 1px solid var(--report-border-color-secondary);
+        }
+        .lh-snippet__title {
+          font-weight: bold;
+          float: left;
+        }
+        .lh-snippet__node {
+          float: left;
+          margin-left: 4px;
+        }
+        .lh-snippet__toggle-expand {
+          padding: 1px 7px;
+          margin-top: -1px;
+          margin-right: -7px;
+          float: right;
+          background: transparent;
+          border: none;
+          cursor: pointer;
+          font-size: 14px;
+          color: #0c50c7;
+        }
+
+        .lh-snippet__snippet {
+          overflow: auto;
+          border: 1px solid var(--report-border-color-secondary);
+        }
+        /* Container needed so that all children grow to the width of the scroll container */
+        .lh-snippet__snippet-inner {
+          display: inline-block;
+          min-width: 100%;
+        }
+
+        .lh-snippet:not(.lh-snippet--expanded) .lh-snippet__show-if-expanded {
+          display: none;
+        }
+        .lh-snippet.lh-snippet--expanded .lh-snippet__show-if-collapsed {
+          display: none;
+        }
+
+        .lh-snippet__line {
+          background: white;
+          white-space: pre;
+          display: flex;
+        }
+        .lh-snippet__line:not(.lh-snippet__line--message):first-child {
+          padding-top: 4px;
+        }
+        .lh-snippet__line:not(.lh-snippet__line--message):last-child {
+          padding-bottom: 4px;
+        }
+        .lh-snippet__line--content-highlighted {
+          background: var(--snippet-highlight-dark);
+        }
+        .lh-snippet__line--message {
+          background: var(--snippet-highlight-light);
+        }
+        .lh-snippet__line--message .lh-snippet__line-number {
+          padding-top: 10px;
+          padding-bottom: 10px;
+        }
+        .lh-snippet__line--message code {
+          padding: 10px;
+          padding-left: 5px;
+          color: var(--color-fail);
+          font-family: var(--report-font-family);
+        }
+        .lh-snippet__line--message code {
+          white-space: normal;
+        }
+        .lh-snippet__line-icon {
+          padding-top: 10px;
+          display: none;
+        }
+        .lh-snippet__line--message .lh-snippet__line-icon {
+          display: block;
+        }
+        .lh-snippet__line-icon:before {
+          content: "";
+          display: inline-block;
+          vertical-align: middle;
+          margin-right: 4px;
+          width: var(--score-icon-size);
+          height: var(--score-icon-size);
+          background-image: var(--fail-icon-url);
+        }
+        .lh-snippet__line-number {
+          flex-shrink: 0;
+          width: 40px;
+          text-align: right;
+          font-family: monospace;
+          padding-right: 5px;
+          margin-right: 5px;
+          color: var(--color-gray-600);
+          user-select: none;
+        }
+      </style>
+      <template id="tmpl-lh-snippet__header">
+        <div class="lh-snippet__header">
+          <div class="lh-snippet__title"></div>
+          <div class="lh-snippet__node"></div>
+          <button class="lh-snippet__toggle-expand">
+            <span class="lh-snippet__btn-label-collapse lh-snippet__show-if-expanded"></span>
+            <span class="lh-snippet__btn-label-expand lh-snippet__show-if-collapsed"></span>
+          </button>
+        </div>
+      </template>
+      <template id="tmpl-lh-snippet__content">
+        <div class="lh-snippet__snippet">
+          <div class="lh-snippet__snippet-inner"></div>
+        </div>
+      </template>
+      <template id="tmpl-lh-snippet__line">
+          <div class="lh-snippet__line">
+            <div class="lh-snippet__line-number"></div>
+            <div class="lh-snippet__line-icon"></div>
+            <code></code>
+          </div>
+        </template>
+    </div>
+  </template>
+
diff --git a/front_end/lighthouse/lighthouseDialog.css b/front_end/lighthouse/lighthouseDialog.css
new file mode 100644
index 0000000..3071eb1
--- /dev/null
+++ b/front_end/lighthouse/lighthouseDialog.css
@@ -0,0 +1,116 @@
+/*
+ * Copyright 2017 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+.lighthouse-view {
+    --view-horizontal-margin: 20px;
+    margin: 7px var(--view-horizontal-margin);
+    flex: auto;
+    align-items: center;
+    width: 100%;
+    max-width: 500px;
+}
+
+.lighthouse-view h2 {
+    color: #666;
+    font-weight: bold;
+    font-size: 14px;
+    flex: none;
+    width: 100%;
+    text-align: left;
+}
+
+.lighthouse-view button {
+    z-index: 10;
+    margin-left: auto;
+    margin-right: 0px;
+}
+
+.lighthouse-status {
+    width: 100%;
+    flex: auto;
+    align-items: center;
+    color: #666;
+}
+
+.lighthouse-status-text {
+    text-align: center;
+    min-height: 50px;
+    margin-bottom: 10px;
+    display: flex;
+    justify-content: center;
+    flex-direction: column;
+    max-width: 100%;
+}
+
+.lighthouse-status-text code {
+    user-select: text;
+    text-align: left;
+    white-space: pre-wrap;
+    overflow: auto;
+}
+
+.lighthouse-progress-wrapper {
+    width: calc(100% + 2 * var(--view-horizontal-margin));
+    height: 2px;
+    background-color: #E1F5FE;
+    position: relative;
+    margin: 10px;
+}
+
+.lighthouse-progress-bar {
+    width: 0%;
+    height: 100%;
+    background: #039BE5;
+    position: absolute;
+    transform-origin: left;
+    animation-fill-mode: forwards;
+    animation-timing-function: ease-out;
+    --progress-bar-loading-duration: 45s;
+    --progress-bar-gathering-duration: 12s;
+    --progress-bar-gathering-percent: 70%;
+    --progress-bar-auditing-duration: 5s;
+    --progress-bar-auditing-percent: 95%;
+}
+
+.lighthouse-progress-bar.errored {
+    width: 100%;
+    background: #E50303;
+}
+
+.lighthouse-progress-bar.loading {
+    animation-duration: var(--progress-bar-loading-duration);
+    animation-name: progressBarLoading;
+}
+
+@keyframes progressBarLoading {
+  0% { width: 0%; }
+  100% { width: var(--progress-bar-gathering-percent); }
+}
+
+.lighthouse-progress-bar.gathering {
+    animation-duration: var(--progress-bar-gathering-duration);
+    animation-name: progressBarGathering;
+}
+
+@keyframes progressBarGathering {
+  0% { width: var(--progress-bar-gathering-percent); }
+  100% { width: var(--progress-bar-auditing-percent); }
+}
+
+.lighthouse-progress-bar.auditing {
+    animation-duration: var(--progress-bar-auditing-duration);
+    animation-name: progressBarAuditing;
+}
+
+@keyframes progressBarAuditing {
+  0% { width: var(--progress-bar-auditing-percent); }
+  100% { width: 99%; }
+}
+
+.lighthouse-report-error {
+    display: block;
+    margin-top: 5px;
+}
diff --git a/front_end/lighthouse/lighthousePanel.css b/front_end/lighthouse/lighthousePanel.css
new file mode 100644
index 0000000..e3e46d2
--- /dev/null
+++ b/front_end/lighthouse/lighthousePanel.css
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2017 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+.toolbar {
+    background-color: var(--toolbar-bg-color);
+    border-bottom: var(--divider-border);
+}
+
+.lh-root {
+  --report-menu-width: 0;
+  user-select: text;
+}
+
+/* for View Trace button */
+.lh-audit-group {
+  position: relative;
+}
+button.view-trace {
+  margin: 10px;
+}
+
+.lighthouse-results-container {
+    position: relative;
+}
+
+/** `window.opener` is null for windows opened from DevTools. This breaks
+    the LH viewer app, so disable this feature. */
+.lh-tools--viewer {
+  display: none !important;
+}
+
+.lighthouse-settings-pane {
+  flex: none;
+}
+
+.lighthouse-settings-pane .toolbar {
+  flex: 1 1;
+}
+
+.lighthouse-toolbar-container {
+  display: flex;
+  flex: none;
+}
+
+.lighthouse-toolbar-container > :first-child {
+  flex: 1 1 auto;
+}
diff --git a/front_end/lighthouse/lighthouseStartView.css b/front_end/lighthouse/lighthouseStartView.css
new file mode 100644
index 0000000..0ec0c98
--- /dev/null
+++ b/front_end/lighthouse/lighthouseStartView.css
@@ -0,0 +1,117 @@
+/*
+ * Copyright 2018 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+.lighthouse-start-view {
+  font-family: Roboto, sans-serif;
+  font-size: var(--font-size);
+  line-height: 18px;
+
+  --color-blue: #0535C1;
+  /* for buttons */
+  --accent-color: var(--color-blue);
+  --color-bg: white;
+  --font-size: 14px;
+  --report-font-family: Roboto, Helvetica, Arial, sans-serif;
+}
+
+.lighthouse-start-view header {
+  flex: 2 1;
+  padding: 16px;
+  display: grid;
+  justify-items: center;
+}
+
+.lighthouse-logo {
+    width: 75px;
+    height: 75px;
+    flex-shrink: 0;
+    background-repeat: no-repeat;
+    background-size: contain;
+    background-image: url(Images/lighthouse_logo.svg);
+}
+
+.lighthouse-start-view-text {
+  margin: 0 40px;
+  text-align: center;
+}
+
+.lighthouse-start-view form {
+  display: contents;
+}
+
+.lighthouse-form-section {
+  padding: 8px;
+  flex: 1 1;
+}
+
+.lighthouse-start-view.vbox .lighthouse-form-categories {
+  border-top: 1px solid #ebebeb;
+  border-bottom: 1px solid #ebebeb;
+}
+
+.lighthouse-form-section-label {
+  margin: 7px 0 7px;
+  font-weight: 500;
+}
+
+.lighthouse-form-section input {
+  margin-top: 0;
+  margin-bottom: 0;
+  margin-left: 0;
+}
+
+.lighthouse-form-section-label i span {
+  position: relative;
+  top: -2px;
+}
+
+.lighthouse-form-section-label span.largeicon-checkmark {
+  top: -4px;
+}
+
+.lighthouse-radio {
+  display: flex;
+  align-items: center;
+}
+
+.lighthouse-start-button-container {
+  align-items: center;
+}
+
+.lighthouse-start-button-container button {
+  margin: 8px auto;
+  font-family: var(--report-font-family);
+  font-weight: 500;
+  font-size: var(--font-size);
+}
+.lighthouse-start-button-container button:disabled {
+  cursor: not-allowed;
+}
+
+.lighthouse-start-view .toolbar-dropdown-arrow {
+  display: none;
+}
+
+.lighthouse-launcher-row,
+.lighthouse-radio {
+  margin-bottom: 6px;
+}
+
+.lighthouse-launcher-row:last-of-type,
+.lighthouse-radio:last-of-type {
+  margin-bottom: 0;
+}
+
+.lighthouse-launcher-row .dimmed {
+  padding-left: 22px;
+}
+
+.lighthouse-help-text {
+  text-align: center;
+  color: red;
+  font-weight: bold;
+  padding-left: 10px;
+}
diff --git a/front_end/lighthouse/lighthouse_strings.grdp b/front_end/lighthouse/lighthouse_strings.grdp
new file mode 100644
index 0000000..28c66a2
--- /dev/null
+++ b/front_end/lighthouse/lighthouse_strings.grdp
@@ -0,0 +1,180 @@
+<?xml version="1.0" encoding="utf-8"?>
+<grit-part>
+  <message name="IDS_DEVTOOLS_026d213afe4c17e37ac8306b77e9f870" desc="Text in Lighthouse Status View">
+    Auditing your web page
+  </message>
+  <message name="IDS_DEVTOOLS_0503ffa75a95f35877fe7420d061b6a9" desc="Text in Lighthouse Controller">
+    Progressive Web App
+  </message>
+  <message name="IDS_DEVTOOLS_0f39dfdd740bf99080ca83e56e2cfb4c" desc="Text in Lighthouse Status View">
+    💡 <ph name="THIS__FASTFACTSQUEUED_FASTFACTINDEX_">$1s<ex>75% of global mobile users in 2016 were on 2G or 3G [Source: GSMA Mobile]</ex></ph>
+  </message>
+  <message name="IDS_DEVTOOLS_1076f1bac69647c846ac3b822b133518" desc="Fast fact in the pop-up dialog when lighthouse is running in the Lighthouse panel">
+    The average user device costs less than 200 USD. [Source: <ph name="LOCKED_1">International Data Corporation</ph>]
+  </message>
+  <message name="IDS_DEVTOOLS_161bf73e31de6b8e3d856815473cbe1c" desc="Text of the timeline button in Lighthouse Report Renderer">
+    View Trace
+  </message>
+  <message name="IDS_DEVTOOLS_169ece87d3c6b79c2c8d69892927857c" desc="Fast fact in the pop-up dialog when lighthouse is running in the Lighthouse panel">
+    19 seconds is the average time a mobile web page takes to load on a 3G connection [Source: <ph name="LOCKED_1">Google DoubleClick blog</ph>]
+  </message>
+  <message name="IDS_DEVTOOLS_17de62900ceac9101c8814b4c4874328" desc="Text in Lighthouse Controller">
+    Apply mobile emulation during auditing
+  </message>
+  <message name="IDS_DEVTOOLS_1b6afe2c9d75a77ce44cca9a356bf3ef" desc="Text that appears when user drag and drop something (for example, a file) in Lighthouse Panel">
+    Drop Lighthouse JSON here
+  </message>
+  <message name="IDS_DEVTOOLS_2046d43f4cc1f59c06f764da2ca2355a" desc="Status text in the Lighthouse panel">
+    The print popup window is open. Please close it to continue.
+  </message>
+  <message name="IDS_DEVTOOLS_24e8ca2483129261096ba8ba0fbcd247" desc="Fast fact in the pop-up dialog when lighthouse is running in the Lighthouse panel">
+    70% of mobile pages take nearly 7 seconds for the visual content above the fold to display on the screen. [Source: <ph name="LOCKED_1">Think with Google</ph>]
+  </message>
+  <message name="IDS_DEVTOOLS_2a96c07a6c11ca7add2b1ffde86efe25" desc="Text in Lighthouse Controller">
+    Can only audit HTTP/HTTPS pages and <ph name="LOCKED_1">Chrome</ph> extensions. Navigate to a different page to start an audit.
+  </message>
+  <message name="IDS_DEVTOOLS_39680b3025b1f8d881f9d983623bf071" desc="Text in Lighthouse Status View">
+    <ph name="LOCKED_1">Lighthouse</ph> is loading your page
+  </message>
+  <message name="IDS_DEVTOOLS_3b7e043f46813f1d8ffbd462eb77fb6c" desc="Text in Lighthouse Controller">
+    How long does this app take to show content and become usable
+  </message>
+  <message name="IDS_DEVTOOLS_43a6eb8709bea6ad1b8e128bf174d80e" desc="Help text in Lighthouse Controller">
+    Is this page optimized for ad speed and quality
+  </message>
+  <message name="IDS_DEVTOOLS_47e2dbd37d8d524f5c4105a96db27b59" desc="Fast fact in the pop-up dialog when lighthouse is running in the Lighthouse panel">
+    75% of global mobile users in 2016 were on 2G or 3G [Source: <ph name="LOCKED_1">GSMA Mobile</ph>]
+  </message>
+  <message name="IDS_DEVTOOLS_4ab5093468559edd5940ac59f1c6ac02" desc="Text in Lighthouse Status View">
+    Try to navigate to the URL in a fresh <ph name="LOCKED_1">Chrome</ph> profile without any other tabs or extensions open and try again.
+  </message>
+  <message name="IDS_DEVTOOLS_55f562701dc2cc775f9adc0478644b2a" desc="Tooltip text that appears when hovering over the largeicon add button in the Lighthouse Panel">
+    Perform an audit…
+  </message>
+  <message name="IDS_DEVTOOLS_56395991012586c2067aa7bcb5905b50" desc="Text in Lighthouse Panel">
+    Cancelling
+  </message>
+  <message name="IDS_DEVTOOLS_56846b99d193dbbd252ddca10d29aff4" desc="Text when lighthouse is loading the page in the Lighthouse panel">
+    <ph name="LOCKED_1">Lighthouse</ph> is loading your page with throttling to measure performance on a mobile device on 3G.
+  </message>
+  <message name="IDS_DEVTOOLS_5a73519018eaaacb7882caf8f0971ac1" desc="Fast fact in the pop-up dialog when lighthouse is running in the Lighthouse panel">
+    1MB takes a minimum of 5 seconds to download on a typical 3G connection [Source: <ph name="LOCKED_1">WebPageTest</ph> and <ph name="LOCKED_2">DevTools</ph> 3G definition].
+  </message>
+  <message name="IDS_DEVTOOLS_5d800f971c3d02bf5accd5f205e31f2a" desc="Text for option to enable simulated throttling in Lighthouse Panel">
+    Simulated throttling
+  </message>
+  <message name="IDS_DEVTOOLS_5f0c08bc61549e7455c9e8b46bfe9aa9" desc="Fast fact in the pop-up dialog when lighthouse is running in the Lighthouse panel">
+    70% of mobile pages weigh over 1MB, 36% over 2MB, and 12% over 4MB. [Source: <ph name="LOCKED_1">Think with Google</ph>]
+  </message>
+  <message name="IDS_DEVTOOLS_64a64ca70e7a909a5a96c07082070bfc" desc="Text of a DOM element in Lighthouse Status View">
+    Ah, sorry! We ran into an error.
+  </message>
+  <message name="IDS_DEVTOOLS_64d266bad80369458003a71a9e04dd50" desc="Text in Lighthouse Status View">
+    Cancelling…
+  </message>
+  <message name="IDS_DEVTOOLS_6556b7f666de143f5a9826e048d5dcd8" desc="Text in Lighthouse Controller">
+    Is this page usable by people with disabilities or impairments
+  </message>
+  <message name="IDS_DEVTOOLS_6565973a762b83f476e9a76a0015b539" desc="Help text in Lighthouse Controller">
+    At least one category must be selected.
+  </message>
+  <message name="IDS_DEVTOOLS_67aa731132e0e7bbabb1b3d3c363e7d6" desc="Help text in Lighthouse Controller">
+    Multiple tabs are being controlled by the same service worker. Close your other tabs on the same origin to audit this page.
+  </message>
+  <message name="IDS_DEVTOOLS_6e394d18cb68d551f58fa35f4dfc70bb" desc="Fast fact in the pop-up dialog when lighthouse is running in the Lighthouse panel">
+    As page load time increases from one second to seven seconds, the probability of a mobile site visitor bouncing increases 113%. [Source: <ph name="LOCKED_1">Think with Google</ph>]
+  </message>
+  <message name="IDS_DEVTOOLS_d7d305befb5ff987deb149b9f4e197d6" desc="Tooltip text that appears when hovering over the largeicon settings gear in show settings pane setting in start view of the audits panel">
+    Lighthouse settings
+  </message>
+  <message name="IDS_DEVTOOLS_6f4495ebc9e34bfc4a7748c568ddd6f0" desc="Text in Lighthouse Status View">
+    Community Plugins (beta)
+  </message>
+  <message name="IDS_DEVTOOLS_72c4a2e545d220fd8c9ead876a59a89d" desc="Text in Lighthouse Controller">
+    Is this page optimized for search engine results ranking
+  </message>
+  <message name="IDS_DEVTOOLS_73351c316c7866b1c5730af9c82b5ab3" desc="Text when lighthouse is loading the page in the Lighthouse panel">
+    <ph name="LOCKED_1">Lighthouse</ph> is loading your page with throttling to measure performance on a slow desktop on 3G.
+  </message>
+  <message name="IDS_DEVTOOLS_7387b82b5b5cbc317147961ff45142c5" desc="Fast fact in the pop-up dialog when lighthouse is running in the Lighthouse panel">
+    Walmart saw a 1% increase in revenue for every 100ms improvement in page load [Source: <ph name="LOCKED_1">WPO Stats</ph>]
+  </message>
+  <message name="IDS_DEVTOOLS_77d52e376f0c781e4f0d908f6d0b7ff2" desc="Fast fact in the pop-up dialog when lighthouse is running in the Lighthouse panel">
+    <ph name="LOCKED_1">Lighthouse</ph> only simulates mobile performance; to measure performance on a real device, try WebPageTest.org [Source: <ph name="LOCKED_2">Lighthouse</ph> team]
+  </message>
+  <message name="IDS_DEVTOOLS_78b8123c78d60b80d6a09618ad56c2cb" desc="Fast fact in the pop-up dialog when lighthouse is running in the Lighthouse panel">
+    Rebuilding Pinterest pages for performance increased conversion rates by 15% [Source: <ph name="LOCKED_1">WPO Stats</ph>]
+  </message>
+  <message name="IDS_DEVTOOLS_85856bb9b2517851d533ea44be65efc2" desc="New report item label in Lighthouse Report Selector">
+    (new report)
+  </message>
+  <message name="IDS_DEVTOOLS_88450f419690173d62fb0a30fb29a951" desc="Text in Lighthouse Status View">
+    Auditing <ph name="PAGEHOST">$1s<ex>github.com</ex></ph>
+  </message>
+  <message name="IDS_DEVTOOLS_8eb7115e5b4ba55f56931ec24c789f9e" desc="Text in Lighthouse Status View">
+    <ph name="LOCKED_1">Lighthouse</ph> is warming up…
+  </message>
+  <message name="IDS_DEVTOOLS_8fe967af0fb77d0261a6ead91bcd607f" desc="Text in Lighthouse Controller">
+    Reset storage (localStorage, IndexedDB, etc) before auditing. (Good for performance &amp; PWA testing)
+  </message>
+  <message name="IDS_DEVTOOLS_9103edac10b1749db57ca27386ff29dc" desc="Text when lighthouse is loading the page in the Lighthouse panel">
+    <ph name="LOCKED_1">Lighthouse</ph> is loading your page.
+  </message>
+  <message name="IDS_DEVTOOLS_a3456af9cc3d7cf0c2e288f889f050b7" desc="Fast fact in the pop-up dialog when lighthouse is running in the Lighthouse panel">
+    If a site takes &gt;1 second to become interactive, users lose attention, and their perception of completing the page task is broken [Source: <ph name="LOCKED_1">Google Developers Blog</ph>]
+  </message>
+  <message name="IDS_DEVTOOLS_a99169b94755be554b65f8dcc2c2b842" desc="Text in the pop-up dialog when lighthouse is gathering information in the Lighthouse panel">
+    <ph name="LOCKED_1">Lighthouse</ph> is gathering information about the page to compute your score.
+  </message>
+  <message name="IDS_DEVTOOLS_abef61c6093b932176b80c40ce8a4023" desc="Text in Lighthouse Controller">
+    Publisher Ads
+  </message>
+  <message name="IDS_DEVTOOLS_af1b98adf7f686b84cd0b443e022b7a0" desc="Title in the Lighthouse Start View for list of categories to run during audit">
+    Categories
+  </message>
+  <message name="IDS_DEVTOOLS_b002a564ceda05dbdf012a48a145d0d3" desc="Status header in the Lighthouse panel">
+    Printing
+  </message>
+  <message name="IDS_DEVTOOLS_bcb3798d312ed46335afe6b1c0ebd398" desc="Text in Lighthouse Start View labeling audit configuraion control group">
+    Lighthouse
+  </message>
+  <message name="IDS_DEVTOOLS_b1b01acb63f79615b05f6d816705d7d3" desc="Text in Lighthouse Controller">
+    Does this page meet the standard of a Progressive Web App
+  </message>
+  <message name="IDS_DEVTOOLS_b29bb7427a05d89f1dae6ab5459e2d5c" desc="Fast fact in the pop-up dialog when lighthouse is running in the Lighthouse panel">
+    By reducing the response size of JSON needed for displaying comments, Instagram saw increased impressions [Source: <ph name="LOCKED_1">WPO Stats</ph>]
+  </message>
+  <message name="IDS_DEVTOOLS_b40b80f075ebae0e3a75c6896abdc949" desc="Text of audits start button in Lighthouse Start View">
+    Generate report
+  </message>
+  <message name="IDS_DEVTOOLS_bcf2457dd80557dd7ebdc1504b6149e6" desc="Text in Lighthouse Controller">
+    Does this page follow best practices for modern web development
+  </message>
+  <message name="IDS_DEVTOOLS_c2ffe02d76c4f089648f1647b43e4ee5" desc="Text in Lighthouse Controller">
+    Best practices
+  </message>
+  <message name="IDS_DEVTOOLS_c91c7b93c28cd18741b71f727ee81ee3" desc="Title of combo box in audits report selector">
+    Reports
+  </message>
+  <message name="IDS_DEVTOOLS_d2f618fd63c7c2028cd527f60e761bc6" desc="Text when lighthouse is loading the page in the Lighthouse panel">
+    <ph name="LOCKED_1">Lighthouse</ph> is loading your page with mobile emulation.
+  </message>
+  <message name="IDS_DEVTOOLS_d88946b678e4c2f251d4e292e8142291" desc="Text in Lighthouse Controller">
+    SEO
+  </message>
+  <message name="IDS_DEVTOOLS_deeacee140c7d3a451440dd0e206e256" desc="Text in Lighthouse Start View">
+    Identify and fix common problems that affect your site&apos;s performance, accessibility, and user experience.
+  </message>
+  <message name="IDS_DEVTOOLS_e339ef3bcd3e92466fa83dc21e690a5b" desc="Fast fact in the pop-up dialog when lighthouse is running in the Lighthouse panel">
+    As the number of elements on a page increases from 400 to 6,000, the probability of conversion drops 95%. [Source: <ph name="LOCKED_1">Think with Google</ph>]
+  </message>
+  <message name="IDS_DEVTOOLS_ea60ba1496b05c6a5816fb75d0665c8d" desc="Text of a DOM element in Lighthouse Status View">
+    If this issue is reproducible, please report it at the <ph name="LOCKED_1">Lighthouse</ph> <ph name="LOCKED_2">GitHub</ph> repo.
+  </message>
+  <message name="IDS_DEVTOOLS_f3ddea8173e7a06f7a6a5dadc234fd3d" desc="Text in the pop-up dialog when lighthouse is auditing in the Lighthouse panel">
+    Almost there! <ph name="LOCKED_1">Lighthouse</ph> is now generating your report.
+  </message>
+  <message name="IDS_DEVTOOLS_fad0ce221c826eede253cb0956ca0700" desc="A search term referring to the linting application named Lighthouse that can be entered in the command menu">
+    <ph name="LOCKED_1">lighthouse</ph>
+  </message>
+</grit-part>
\ No newline at end of file
diff --git a/front_end/lighthouse/module.json b/front_end/lighthouse/module.json
new file mode 100644
index 0000000..8805003
--- /dev/null
+++ b/front_end/lighthouse/module.json
@@ -0,0 +1,50 @@
+{
+    "extensions": [
+        {
+            "type": "view",
+            "location": "panel",
+            "id": "lighthouse",
+            "title": "Lighthouse",
+            "order": 90,
+            "className": "Lighthouse.LighthousePanel",
+            "tags": "lighthouse, pwa"
+        }
+    ],
+    "dependencies": [
+        "components",
+        "emulation",
+        "timeline",
+        "inspector_main",
+        "sdk",
+        "services",
+        "ui"
+    ],
+    "scripts": [],
+    "modules": [
+        "lighthouse.js",
+        "lighthouse-legacy.js",
+        "lighthouse/report.js",
+        "lighthouse/report-generator.js",
+        "RadioSetting.js",
+        "LighthousePanel.js",
+        "LighthouseController.js",
+        "LighthouseReportSelector.js",
+        "LighthouseReportRenderer.js",
+        "LighthouseStartView.js",
+        "LighthouseStatusView.js",
+        "LighthouseProtocolService.js"
+    ],
+    "resources": [
+        "lighthouseDialog.css",
+        "lighthousePanel.css",
+        "lighthouseStartView.css",
+        "lighthouse/template.html",
+        "lighthouse/templates.html",
+        "lighthouse/report.css",
+        "lighthouse/report.js"
+    ],
+    "skip_compilation": [
+      "lighthouse/report.js",
+      "lighthouse/report-generator.js"
+  ]
+}