import"../test_runner/test_runner.js";import"../lighthouse/lighthouse-legacy.js";self.LighthouseTestRunner=self.LighthouseTestRunner||{},LighthouseTestRunner._panel=function(){return UI.panels.lighthouse},LighthouseTestRunner.getContainerElement=function(){return LighthouseTestRunner._panel().contentElement},LighthouseTestRunner.getResultsElement=function(){return LighthouseTestRunner._panel()._auditResultsElement},LighthouseTestRunner.getDialogElement=function(){return LighthouseTestRunner._panel()._statusView._dialog.contentElement.shadowRoot.querySelector(".lighthouse-view")},LighthouseTestRunner.getSettingsElement=function(){return LighthouseTestRunner._panel()._settingsPane.element},LighthouseTestRunner.getRunButton=function(){const e=LighthouseTestRunner.getContainerElement();return e&&e.querySelectorAll("button")[0]},LighthouseTestRunner.getCancelButton=function(){const e=LighthouseTestRunner.getDialogElement();return e&&e.querySelectorAll("button")[0]},LighthouseTestRunner.openStartAudit=function(){LighthouseTestRunner._panel()._renderStartView()},LighthouseTestRunner.addStatusListener=function(e){TestRunner.addSniffer(Lighthouse.StatusView.prototype,"updateStatus",e,!0)},LighthouseTestRunner.waitForResults=function(){return new Promise((e=>{TestRunner.addSniffer(Lighthouse.LighthousePanel.prototype,"_buildReportUI",((t,n)=>e({lhr:t,artifacts:n})))}))},LighthouseTestRunner.forcePageAuditabilityCheck=function(){LighthouseTestRunner._panel()._controller.recomputePageAuditability()},LighthouseTestRunner._checkboxStateLabel=function(e){if(!e)return"missing";const t=e.textElement.textContent;return`[${e.checkboxElement.checked?"x":" "}] ${t}`},LighthouseTestRunner._buttonStateLabel=function(e){if(!e)return"missing";const t=e.disabled?"disabled":"enabled",n=window.getComputedStyle(e).getPropertyValue("visibility");return`${e.textContent}: ${t} ${n}`},LighthouseTestRunner.dumpStartAuditState=function(){TestRunner.addResult("\n========== Lighthouse Start Audit State ==========");const e=LighthouseTestRunner.getContainerElement(),t=[...e.querySelectorAll(".checkbox")],n=LighthouseTestRunner.getSettingsElement().querySelector(".lighthouse-settings-pane > div").shadowRoot;for(const s of n.querySelectorAll(".checkbox"))t.push(s);t.forEach((e=>{TestRunner.addResult(LighthouseTestRunner._checkboxStateLabel(e))}));const u=e.querySelector(".lighthouse-help-text");u.classList.contains("hidden")||TestRunner.addResult(`Help text: ${u.textContent}`),TestRunner.addResult(LighthouseTestRunner._buttonStateLabel(LighthouseTestRunner.getRunButton()))};