import"../test_runner/test_runner.js";import"../accessibility/accessibility-legacy.js";import"../elements_test_runner/elements_test_runner.js";import"../i18n/i18n.js";self.AccessibilityTestRunner=self.AccessibilityTestRunner||{},AccessibilityTestRunner.accessibilitySidebarPane=function(){return self.runtime.sharedInstance(Accessibility.AccessibilitySidebarView)},AccessibilityTestRunner.selectNodeAndWaitForAccessibility=function(e){return new Promise((i=>{ElementsTestRunner.selectNodeWithId(e,(function(){self.runtime.sharedInstance(Accessibility.AccessibilitySidebarView).doUpdate().then(i)}))}))},AccessibilityTestRunner.dumpSelectedElementAccessibilityNode=function(){const e=AccessibilityTestRunner.accessibilitySidebarPane();if(!e)return TestRunner.addResult("No sidebarPane in dumpSelectedElementAccessibilityNode"),void TestRunner.completeTest();AccessibilityTestRunner.dumpAccessibilityNode(e._axNodeSubPane._axNode)},AccessibilityTestRunner.dumpAccessibilityNode=function(e){if(!e)return TestRunner.addResult("<null>"),void TestRunner.completeTest();const i=[];if(i.push(e.role().value),i.push(e.name()?'"'+e.name().value+'"':"<undefined>"),e.properties())for(const t of e.properties())"value"in t&&i.push(t.name+'="'+t.value.value+'"');TestRunner.addResult(i.join(" "))},AccessibilityTestRunner.findARIAAttributeTreeElement=function(e){const i=AccessibilityTestRunner.accessibilitySidebarPane();if(!i)return TestRunner.addResult("Could not get Accessibility sidebar pane."),void TestRunner.completeTest();const t=i._ariaSubPane._treeOutline._rootElement._children;for(const s of t)if(s._attribute.name===e)return s;return null};