!function(e,t){for(var r in t)e[r]=t[r]}(exports,function(e){var t={};function r(n){if(t[n])return t[n].exports;var s=t[n]={i:n,l:!1,exports:{}};return e[n].call(s.exports,s,s.exports,r),s.l=!0,s.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)r.d(n,s,function(t){return e[t]}.bind(null,s));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(1),s=r(2),i="listening on.* (https?://\\S+|[0-9]+)",o="http://localhost:%s",a="${workspaceFolder}";class u extends n.Disposable{constructor(e){super(()=>this.internalDispose()),this.session=e,this.hasFired=!1,this.disposables=[],this.regexp=new RegExp(e.configuration.serverReadyAction.pattern||i)}static start(e){if(e.configuration.serverReadyAction){let t=u.detectors.get(e);return t||(t=new u(e),u.detectors.set(e,t)),t}}static stop(e){let t=u.detectors.get(e);t&&(u.detectors.delete(e),t.dispose())}static rememberShellPid(e,t){let r=u.detectors.get(e);r&&(r.shellPid=t)}internalDispose(){this.disposables.forEach(e=>e.dispose()),this.disposables=[]}async trackTerminals(){let e=[];for(let t of n.window.terminals)this.shellPid&&await t.processId!==this.shellPid||e.push(t);this.shellPid=void 0,e.forEach(e=>{this.disposables.push(e.onDidWriteData(e=>{this.detectPattern(e)}))})}detectPattern(e){if(!this.hasFired){const t=this.regexp.exec(e);t&&2===t.length&&(this.openExternalWithString(this.session,t[1]),this.hasFired=!0,this.internalDispose())}}openExternalWithString(e,t){if(t){if(/^[0-9]+$/.test(t)){const r=e.configuration.serverReadyAction;t=s.format(r.uriFormat||o,t)}this.openExternalWithUri(e,t)}}openExternalWithUri(e,t){const r=e.configuration.serverReadyAction;switch(r.action||"openExternally"){case"openExternally":n.env.openExternal(n.Uri.parse(t));break;case"debugWithChrome":n.debug.startDebugging(e.workspaceFolder,{type:"chrome",name:"Chrome Debug",request:"launch",url:t,webRoot:r.webRoot||a})}}}u.detectors=new Map,t.activate=function(e){e.subscriptions.push(n.debug.onDidChangeActiveDebugSession(e=>{if(e&&e.configuration.serverReadyAction){const t=u.start(e);t&&t.trackTerminals()}})),e.subscriptions.push(n.debug.onDidTerminateDebugSession(e=>{u.stop(e)}));const t=new Set;e.subscriptions.push(n.debug.registerDebugConfigurationProvider("*",{resolveDebugConfiguration:(r,s)=>(s.type&&s.serverReadyAction&&(t.has(s.type)||(t.add(s.type),function(e,t){e.subscriptions.push(n.debug.registerDebugAdapterTrackerFactory(t,{createDebugAdapterTracker(e){const t=u.start(e);if(t){let r;return{onDidSendMessage:e=>{"event"===e.type&&"output"===e.event&&e.body.output&&t.detectPattern(e.body.output),"request"===e.type&&"runInTerminal"===e.command&&e.arguments&&"integrated"===e.arguments.kind&&(r=e.seq)},onWillReceiveMessage:t=>{r&&"response"===t.type&&"runInTerminal"===t.command&&t.body&&r===t.request_seq&&(r=void 0,u.rememberShellPid(e,t.body.shellProcessId))}}}}}))}(e,s.type))),s)}))}},function(e,t){e.exports=require("vscode")},function(e,t){e.exports=require("util")}]));
//# sourceMappingURL=https://ticino.blob.core.windows.net/sourcemaps/154617d3d5afca9f8b8302d7fcca33e43b942f83/extensions/debug-server-ready/dist/extension.js.map