import*as SDK from"../sdk/sdk.js";import*as UI from"../ui/ui.js";import{AccessibilityTree}from"./AccessibilityTree.js";import{sdkNodeToAXNode}from"./AccessibilityTreeUtils.js";export class AccessibilityTreeView extends UI.Widget.VBox{constructor(e){super(),this.accessibilityTreeComponent=new AccessibilityTree,this.toggleButton=e,this.contentElement.appendChild(this.toggleButton),this.contentElement.appendChild(this.accessibilityTreeComponent)}async refreshAccessibilityTree(e){const i=e.domModel().target().model(SDK.AccessibilityModel.AccessibilityModel);if(!i)return null;return await i.requestRootNode()||null}async setNode(e){const i=await this.refreshAccessibilityTree(e);i&&(this.accessibilityTreeComponent.data={rootNode:sdkNodeToAXNode(null,i,this.accessibilityTreeComponent)})}}