import{Settings as e}from"../common/common.js";import{ls as t}from"../platform/platform.js";import{Runtime as i}from"../root/root.js";import{ViewManager as n,ActionRegistration as o}from"../ui/ui.js";let a,l;async function r(){return a||(await i.Runtime.instance().loadModulePromise("timeline"),a=await import("./timeline.js")),a}function c(e){return void 0===a?[]:e(a)}n.registerViewExtension({location:"panel",id:"timeline",title:()=>t`Performance`,commandPrompt:()=>t`Show Performance`,order:50,loadView:async()=>(await r()).TimelinePanel.TimelinePanel.instance()}),n.registerViewExtension({location:"panel",id:"js_profiler",title:()=>t`JavaScript Profiler`,commandPrompt:()=>t`Show JavaScript Profiler`,persistence:"closeable",order:65,loadView:async()=>(await async function(){return l||(await i.Runtime.instance().loadModulePromise("profiler"),l=await import("../profiler/profiler.js")),l}()).ProfilesPanel.JSProfilerPanel.instance()}),o.registerActionExtension({actionId:"timeline.toggle-recording",category:o.ActionCategory.PERFORMANCE,iconClass:"largeicon-start-recording",toggleable:!0,toggledIconClass:"largeicon-stop-recording",toggleWithRedColor:!0,contextTypes:()=>c((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>(await r()).TimelinePanel.ActionDelegate.instance(),options:[{value:!0,title:()=>t`Record`},{value:!1,title:()=>t`Stop`}],bindings:[{platform:"windows,linux",shortcut:"Ctrl+E"},{platform:"mac",shortcut:"Meta+E"}]}),o.registerActionExtension({actionId:"timeline.record-reload",iconClass:"largeicon-refresh",contextTypes:()=>c((e=>[e.TimelinePanel.TimelinePanel])),category:o.ActionCategory.PERFORMANCE,title:()=>t`Start profiling and reload page`,loadActionDelegate:async()=>(await r()).TimelinePanel.ActionDelegate.instance(),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+E"},{platform:"mac",shortcut:"Meta+Shift+E"}]}),o.registerActionExtension({category:o.ActionCategory.PERFORMANCE,actionId:"timeline.save-to-file",contextTypes:()=>c((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>(await r()).TimelinePanel.ActionDelegate.instance(),title:()=>t`Save profile…`,bindings:[{platform:"windows,linux",shortcut:"Ctrl+S"},{platform:"mac",shortcut:"Meta+S"}]}),o.registerActionExtension({category:o.ActionCategory.PERFORMANCE,actionId:"timeline.load-from-file",contextTypes:()=>c((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>(await r()).TimelinePanel.ActionDelegate.instance(),title:()=>t`Load profile…`,bindings:[{platform:"windows,linux",shortcut:"Ctrl+0"},{platform:"mac",shortcut:"Meta+0"}]}),o.registerActionExtension({actionId:"timeline.jump-to-previous-frame",category:o.ActionCategory.PERFORMANCE,title:()=>t`Previous frame`,contextTypes:()=>c((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>(await r()).TimelinePanel.ActionDelegate.instance(),bindings:[{shortcut:"["}]}),o.registerActionExtension({actionId:"timeline.jump-to-next-frame",category:o.ActionCategory.PERFORMANCE,title:()=>t`Next frame`,contextTypes:()=>c((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>(await r()).TimelinePanel.ActionDelegate.instance(),bindings:[{shortcut:"]"}]}),o.registerActionExtension({actionId:"timeline.show-history",loadActionDelegate:async()=>(await r()).TimelinePanel.ActionDelegate.instance(),category:o.ActionCategory.PERFORMANCE,title:()=>t`Show recent timeline sessions`,contextTypes:()=>c((e=>[e.TimelinePanel.TimelinePanel])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+H"},{platform:"mac",shortcut:"Meta+Y"}]}),o.registerActionExtension({actionId:"timeline.previous-recording",category:o.ActionCategory.PERFORMANCE,loadActionDelegate:async()=>(await r()).TimelinePanel.ActionDelegate.instance(),title:()=>t`Previous recording`,contextTypes:()=>c((e=>[e.TimelinePanel.TimelinePanel])),bindings:[{platform:"windows,linux",shortcut:"Alt+Left"},{platform:"mac",shortcut:"Meta+Left"}]}),o.registerActionExtension({actionId:"timeline.next-recording",category:o.ActionCategory.PERFORMANCE,loadActionDelegate:async()=>(await r()).TimelinePanel.ActionDelegate.instance(),title:()=>t`Next recording`,contextTypes:()=>c((e=>[e.TimelinePanel.TimelinePanel])),bindings:[{platform:"windows,linux",shortcut:"Alt+Right"},{platform:"mac",shortcut:"Meta+Right"}]}),e.registerSettingExtension({category:e.SettingCategoryObject.PERFORMANCE,title:()=>t`Hide chrome frame in Layers view`,settingName:"frameViewerHideChromeWindow",settingType:e.SettingTypeObject.BOOLEAN,defaultValue:!1});
