import*as Common from"../common/common.js";import*as Components from"../components/components.js";import*as Host from"../host/host.js";import{ls}from"../platform/platform.js";import*as SDK from"../sdk/sdk.js";let jsMainImplInstance;export class JsMainImpl extends Common.ObjectWrapper.ObjectWrapper{static instance(n={forceNew:null}){const{forceNew:e}=n;return jsMainImplInstance&&!e||(jsMainImplInstance=new JsMainImpl),jsMainImplInstance}run(){return Host.userMetrics.actionTaken(Host.UserMetrics.Action.ConnectToNodeJSDirectly),SDK.Connections.initMainConnection((()=>(SDK.SDKModel.TargetManager.instance().createTarget("main",ls`Main`,SDK.SDKModel.Type.Node,null).runtimeAgent().invoke_runIfWaitingForDebugger(),Promise.resolve())),Components.TargetDetachedDialog.TargetDetachedDialog.webSocketConnectionLost),Promise.resolve()}}Common.Runnable.registerEarlyInitializationRunnable(JsMainImpl.instance);