import{Settings as e}from"../common/common.js";import{ls as t}from"../platform/platform.js";import{Runtime as n}from"../root/root.js";import{ViewManager as i,ActionRegistration as o}from"../ui/ui.js";let a;async function s(){return a||(await n.Runtime.instance().loadModulePromise("elements"),a=await import("./elements.js")),a}function r(e){return void 0===a?[]:e(a)}i.registerViewExtension({location:"panel",id:"elements",title:t`Elements`,order:10,persistence:"permanent",hasToolbar:!1,loadView:async()=>(await s()).ElementsPanel.ElementsPanel.instance()}),i.registerViewExtension({location:"elements-sidebar",id:"elements.eventListeners",title:t`Event Listeners`,order:5,hasToolbar:!0,persistence:"permanent",loadView:async()=>(await s()).EventListenersWidget.EventListenersWidget.instance()}),i.registerViewExtension({location:"elements-sidebar",id:"elements.domProperties",title:t`Properties`,order:7,persistence:"permanent",loadView:async()=>(await s()).PropertiesWidget.PropertiesWidget.instance()}),i.registerViewExtension({experiment:n.ExperimentName.CAPTURE_NODE_CREATION_STACKS,location:"elements-sidebar",id:"elements.domCreation",title:t`Stack Trace`,order:10,persistence:"permanent",loadView:async()=>(await s()).NodeStackTraceWidget.NodeStackTraceWidget.instance()}),i.registerViewExtension({experiment:n.ExperimentName.CSS_GRID_FEATURES,location:"elements-sidebar",id:"elements.layout",title:t`Layout`,order:4,persistence:"permanent",loadView:async()=>(await s()).LayoutSidebarPane.LayoutSidebarPane.instance()}),o.registerActionExtension({actionId:"elements.hide-element",category:o.ActionCategory.ELEMENTS,title:t`Hide element`,loadActionDelegate:async()=>(await s()).ElementsPanel.ElementsActionDelegate.instance(),contextTypes:()=>r((e=>[e.ElementsPanel.ElementsPanel])),bindings:[{shortcut:"H"}]}),o.registerActionExtension({actionId:"elements.edit-as-html",category:o.ActionCategory.ELEMENTS,title:t`Edit as HTML`,loadActionDelegate:async()=>(await s()).ElementsPanel.ElementsActionDelegate.instance(),contextTypes:()=>r((e=>[e.ElementsPanel.ElementsPanel])),bindings:[{shortcut:"F2"}]}),o.registerActionExtension({actionId:"elements.undo",category:o.ActionCategory.ELEMENTS,title:t`Undo`,loadActionDelegate:async()=>(await s()).ElementsPanel.ElementsActionDelegate.instance(),contextTypes:()=>r((e=>[e.ElementsPanel.ElementsPanel])),bindings:[{shortcut:"Ctrl+Z",platform:"windows,linux"},{shortcut:"Meta+Z",platform:"mac"}]}),o.registerActionExtension({actionId:"elements.redo",category:o.ActionCategory.ELEMENTS,title:t`Redo`,loadActionDelegate:async()=>(await s()).ElementsPanel.ElementsActionDelegate.instance(),contextTypes:()=>r((e=>[e.ElementsPanel.ElementsPanel])),bindings:[{shortcut:"Ctrl+Y",platform:"windows,linux"},{shortcut:"Meta+Shift+Z",platform:"mac"}]}),o.registerActionExtension({actionId:"elements.capture-area-screenshot",loadActionDelegate:async()=>(await s()).InspectElementModeController.ToggleSearchActionDelegate.instance(),condition:n.ConditionName.CAN_DOCK,title:t`Capture area screenshot`,category:o.ActionCategory.SCREENSHOT}),o.registerActionExtension({category:o.ActionCategory.ELEMENTS,actionId:"elements.toggle-element-search",toggleable:!0,loadActionDelegate:async()=>(await s()).InspectElementModeController.ToggleSearchActionDelegate.instance(),title:t`Select an element in the page to inspect it`,iconClass:"largeicon-node-search",bindings:[{shortcut:"Ctrl+Shift+C",platform:"windows,linux"},{shortcut:"Meta+Shift+C",platform:"mac"}]}),e.registerSettingExtension({category:e.SettingCategoryObject.ELEMENTS,order:1,title:t`Show user agent shadow DOM`,settingName:"showUAShadowDOM",settingType:e.SettingTypeObject.BOOLEAN,defaultValue:!1}),e.registerSettingExtension({category:e.SettingCategoryObject.ELEMENTS,order:2,title:t`Word wrap`,settingName:"domWordWrap",settingType:e.SettingTypeObject.BOOLEAN,options:[{value:!0,title:t`Enable DOM word wrap`},{value:!1,title:t`Disable DOM word wrap`}],defaultValue:!0}),e.registerSettingExtension({category:e.SettingCategoryObject.ELEMENTS,order:3,title:t`Show HTML comments`,settingName:"showHTMLComments",settingType:e.SettingTypeObject.BOOLEAN,defaultValue:!0,options:[{value:!0,title:t`Show HTML comments`},{value:!1,title:t`Hide HTML comments`}]}),e.registerSettingExtension({category:e.SettingCategoryObject.ELEMENTS,order:4,title:t`Reveal DOM node on hover`,settingName:"highlightNodeOnHoverInOverlay",settingType:e.SettingTypeObject.BOOLEAN,defaultValue:!0}),e.registerSettingExtension({category:e.SettingCategoryObject.ELEMENTS,order:5,title:t`Show detailed inspect tooltip`,settingName:"showDetailedInspectTooltip",settingType:e.SettingTypeObject.BOOLEAN,defaultValue:!0}),e.registerSettingExtension({settingName:"showEventListenersForAncestors",settingType:e.SettingTypeObject.BOOLEAN,defaultValue:!0});
