/*!--------------------------------------------------------
 * Copyright (C) Microsoft Corporation. All rights reserved.
 *--------------------------------------------------------*/
(function(){var e=["exports","require","vs/base/common/event","vs/base/common/errors","vs/base/common/lifecycle","vs/base/common/functional","vs/base/common/cancellation","vs/base/common/async","vs/base/common/linkedList","vs/base/common/iterator","vs/base/common/uuid","vs/base/parts/ipc/node/ipc","vs/base/parts/ipc/node/ipc.net","vs/platform/instantiation/common/instantiation","net","path","os","vs/platform/driver/node/driver"],t=function(t){for(var n=[],r=0,i=t.length;r<i;r++)n[r]=e[t[r]];return n};define(e[3],t([1,0]),function(e,t){"use strict";function n(e){return e instanceof Error&&e.name===i&&e.message===i}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(function(){if(e.stack)throw new Error(e.message+"\n\n"+e.stack);throw e},0)}}return e.prototype.addListener=function(e){var t=this;return this.listeners.push(e),function(){t._removeListener(e)}},e.prototype.emit=function(e){
this.listeners.forEach(function(t){t(e)})},e.prototype._removeListener=function(e){this.listeners.splice(this.listeners.indexOf(e),1)},e.prototype.setUnexpectedErrorHandler=function(e){this.unexpectedErrorHandler=e},e.prototype.getUnexpectedErrorHandler=function(){return this.unexpectedErrorHandler},e.prototype.onUnexpectedError=function(e){this.unexpectedErrorHandler(e),this.emit(e)},e.prototype.onUnexpectedExternalError=function(e){this.unexpectedErrorHandler(e)},e}();t.ErrorHandler=r,t.errorHandler=new r,t.setUnexpectedErrorHandler=function(e){t.errorHandler.setUnexpectedErrorHandler(e)},t.onUnexpectedError=function(e){n(e)||t.errorHandler.onUnexpectedError(e)},t.onUnexpectedExternalError=function(e){n(e)||t.errorHandler.onUnexpectedExternalError(e)},t.transformErrorForSerialization=function(e){if(e instanceof Error)return{$isError:!0,name:e.name,message:e.message,stack:e.stacktrace||e.stack};return e};var i="Canceled";t.isPromiseCanceledError=n,t.canceled=function(){var e=new Error(i)
;return e.name=e.message,e},t.illegalArgument=function(e){return e?new Error("Illegal argument: "+e):new Error("Illegal argument")},t.illegalState=function(e){return e?new Error("Illegal state: "+e):new Error("Illegal state")},t.readonly=function(e){return e?new Error("readonly property '"+e+" cannot be changed'"):new Error("readonly property cannot be changed")},t.disposed=function(e){var t=new Error(e+" has been disposed");return t.name="DISPOSED",t},t.getErrorMessage=function(e){return e?e.message?e.message:e.stack?e.stack.split("\n")[0]:String(e):"Error"}}),define(e[5],t([1,0]),function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.once=function(e){var t,n=this,r=!1;return function(){return r?t:(r=!0,t=e.apply(n,arguments))}}});var n=this&&this.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){
this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();define(e[9],t([1,0]),function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FIN={done:!0,value:void 0};var r;!function(e){function n(e,t){for(var n=e.next();!n.done;n=e.next())t(n.value)}var r={next:function(){return t.FIN}};e.empty=function(){return r},e.fromArray=function(e,n,r){return void 0===n&&(n=0),void 0===r&&(r=e.length),{next:function(){return n>=r?t.FIN:{done:!1,value:e[n++]}}}},e.from=function(t){return t?Array.isArray(t)?e.fromArray(t):t:e.empty()},e.map=function(e,n){return{next:function(){var r=e.next();return r.done?t.FIN:{done:!1,value:n(r.value)}}}},e.filter=function(e,n){return{next:function(){for(;;){var r=e.next();if(r.done)return t.FIN;if(n(r.value))return{done:!1,value:r.value}}}}},e.forEach=n,e.collect=function(e){var t=[];return n(e,function(e){return t.push(e)}),t}}(r=t.Iterator||(t.Iterator={})),t.getSequenceIterator=function(e){
return Array.isArray(e)?r.fromArray(e):e};var i=function(){function e(e,t,n,r){void 0===t&&(t=0),void 0===n&&(n=e.length),void 0===r&&(r=t-1),this.items=e,this.start=t,this.end=n,this.index=r}return e.prototype.first=function(){return this.index=this.start,this.current()},e.prototype.next=function(){return this.index=Math.min(this.index+1,this.end),this.current()},e.prototype.current=function(){return this.index===this.start-1||this.index===this.end?null:this.items[this.index]},e}();t.ArrayIterator=i;var o=function(e){function t(t,n,r,i){return void 0===n&&(n=0),void 0===r&&(r=t.length),void 0===i&&(i=n-1),e.call(this,t,n,r,i)||this}return n(t,e),t.prototype.current=function(){return e.prototype.current.call(this)},t.prototype.previous=function(){return this.index=Math.max(this.index-1,this.start-1),this.current()},t.prototype.first=function(){return this.index=this.start,this.current()},t.prototype.last=function(){return this.index=this.end-1,this.current()},t.prototype.parent=function(){return null},t}(i)
;t.ArrayNavigator=o;var s=function(){function e(e,t){this.iterator=e,this.fn=t}return e.prototype.next=function(){return this.fn(this.iterator.next())},e}();t.MappedIterator=s;var u=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.navigator=t,r}return n(t,e),t.prototype.current=function(){return this.fn(this.navigator.current())},t.prototype.previous=function(){return this.fn(this.navigator.previous())},t.prototype.parent=function(){return this.fn(this.navigator.parent())},t.prototype.first=function(){return this.fn(this.navigator.first())},t.prototype.last=function(){return this.fn(this.navigator.last())},t.prototype.next=function(){return this.fn(this.navigator.next())},t}(s);t.MappedNavigator=u}),define(e[4],t([1,0,5]),function(e,t,n){"use strict";function r(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return Array.isArray(e)?(e.forEach(function(e){return e&&e.dispose()}),[]):0!==t.length?(r(e),r(t),[]):e?(e.dispose(),e):void 0}Object.defineProperty(t,"__esModule",{
value:!0}),t.isDisposable=function(e){return"function"==typeof e.dispose&&0===e.dispose.length},t.dispose=r,t.combinedDisposable=function(e){return{dispose:function(){return r(e)}}},t.toDisposable=function(e){return{dispose:function(){e()}}};var i=function(){function e(){this._toDispose=[],this._lifecycle_disposable_isDisposed=!1}return Object.defineProperty(e.prototype,"toDispose",{get:function(){return this._toDispose},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){this._lifecycle_disposable_isDisposed=!0,this._toDispose=r(this._toDispose)},e.prototype._register=function(e){return this._lifecycle_disposable_isDisposed?(console.warn("Registering disposable on object that has already been disposed."),e.dispose()):this._toDispose.push(e),e},e.None=Object.freeze({dispose:function(){}}),e}();t.Disposable=i;var o=function(){function e(){this.references=Object.create(null)}return e.prototype.acquire=function(e){var t=this,r=this.references[e];r||(r=this.references[e]={counter:0,
object:this.createReferencedObject(e)});var i=r.object,o=n.once(function(){0==--r.counter&&(t.destroyReferencedObject(e,r.object),delete t.references[e])});return r.counter++,{object:i,dispose:o}},e}();t.ReferenceCollection=o;var s=function(){function e(e){this.object=e}return e.prototype.dispose=function(){},e}();t.ImmortalReference=s}),define(e[8],t([1,0,9]),function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){return function(e){this.element=e}}(),i=function(){function e(){this._size=0}return Object.defineProperty(e.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),e.prototype.isEmpty=function(){return!this._first},e.prototype.clear=function(){this._first=void 0,this._last=void 0,this._size=0},e.prototype.unshift=function(e){return this._insert(e,!1)},e.prototype.push=function(e){return this._insert(e,!0)},e.prototype._insert=function(e,t){var n=new r(e);if(this._first)if(t){var i=this._last;this._last=n,n.prev=i,i.next=n}else{
var o=this._first;this._first=n,n.next=o,o.prev=n}else this._first=n,this._last=n;return this._size+=1,this._remove.bind(this,n)},e.prototype.shift=function(){if(this._first){var e=this._first.element;return this._remove(this._first),e}},e.prototype.pop=function(){if(this._last){var e=this._last.element;return this._remove(this._last),e}},e.prototype._remove=function(e){for(var t=this._first;t instanceof r;){if(t===e){if(t.prev&&t.next){var n=t.prev;n.next=t.next,t.next.prev=n}else t.prev||t.next?t.next?t.prev||(this._first=this._first.next,this._first.prev=void 0):(this._last=this._last.prev,this._last.next=void 0):(this._first=void 0,this._last=void 0);this._size-=1;break}t=t.next}},e.prototype.iterator=function(){var e,t=this._first;return{next:function(){return t?(e?e.value=t.element:e={done:!1,value:t.element},t=t.next,e):n.FIN}}},e.prototype.toArray=function(){for(var e=[],t=this._first;t instanceof r;t=t.next)e.push(t.element);return e},e}();t.LinkedList=i})
;var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function u(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,u)}c((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(n){return function(s){return function(n){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,i&&(o=2&n[0]?i.return:n[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,n[1])).done)return o;switch(i=0,o&&(n=[2&n[0],o.value]),n[0]){case 0:case 1:o=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,i=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(o=u.trys,!(o=o.length>0&&o[o.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!o||n[1]>o[0]&&n[1]<o[3])){u.label=n[1];break}if(6===n[0]&&u.label<o[1]){u.label=o[1],o=n;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(n);break}
o[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],i=0}finally{r=o=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,s])}}var r,i,o,s,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return s={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s};define(e[2],t([1,0,3,5,4,8]),function(e,t,o,s,u,c){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a;!function(e){function t(e){return function(t,n,r){void 0===n&&(n=null);var i=!1,o=e(function(e){if(!i)return o?o.dispose():i=!0,t.call(n,e)},null,r);return i&&o.dispose(),o}}function n(e,t){return function(n,r,i){return void 0===r&&(r=null),e(function(e){return n.call(r,t(e))},null,i)}}function r(e,t){return function(n,r,i){return void 0===r&&(r=null),e(function(e){t(e),n.call(r,e)},null,i)}}function i(e,t){return function(n,r,i){return void 0===r&&(r=null),e(function(e){return t(e)&&n.call(r,e)},null,i)}}function o(e,t,r){var i=r
;return n(e,function(e){return i=t(i,e)})}function s(e){var t,n=!0;return i(e,function(e){var r=n||e!==t;return n=!1,t=e,r})}var c={dispose:function(){}};e.None=function(){return c},e.once=t,e.map=n,e.forEach=r,e.filter=i,e.signal=function(e){return e},e.any=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t,n,r){return void 0===n&&(n=null),u.combinedDisposable(e.map(function(e){return e(function(e){return t.call(n,e)},null,r)}))}},e.reduce=o,e.debounce=function(e,t,n,r,i){void 0===n&&(n=100),void 0===r&&(r=!1);var o,s=void 0,u=void 0,c=0,a=new h({leakWarningThreshold:i,onFirstListenerAdd:function(){o=e(function(e){c++,s=t(s,e),r&&!u&&a.fire(s),clearTimeout(u),u=setTimeout(function(){var e=s;s=void 0,u=void 0,(!r||c>1)&&a.fire(e),c=0},n)})},onLastListenerRemove:function(){o.dispose()}});return a.event},e.stopwatch=function(e){var r=(new Date).getTime();return n(t(e),function(e){return(new Date).getTime()-r})},e.latch=s,e.buffer=function(e,t,n){void 0===t&&(t=!1),
void 0===n&&(n=[]);var r=n.slice(),i=e(function(e){r?r.push(e):s.fire(e)}),o=function(){r&&r.forEach(function(e){return s.fire(e)}),r=null},s=new h({onFirstListenerAdd:function(){i||(i=e(function(e){return s.fire(e)}))},onFirstListenerDidAdd:function(){r&&(t?setTimeout(o):o())},onLastListenerRemove:function(){i&&i.dispose(),i=null}});return s.event},e.echo=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=[]),n=n.slice(),e(function(e){n.push(e),i.fire(e)});var r=function(e,t){return n.forEach(function(n){return e.call(t,n)})},i=new h({onListenerDidAdd:function(e,n,i){t?setTimeout(function(){return r(n,i)}):r(n,i)}});return i.event};var a=function(){function e(e){this._event=e}return Object.defineProperty(e.prototype,"event",{get:function(){return this._event},enumerable:!0,configurable:!0}),e.prototype.map=function(t){return new e(n(this._event,t))},e.prototype.forEach=function(t){return new e(r(this._event,t))},e.prototype.filter=function(t){return new e(i(this._event,t))},e.prototype.reduce=function(t,n){
return new e(o(this._event,t,n))},e.prototype.latch=function(){return new e(s(this._event))},e.prototype.on=function(e,t,n){return this._event(e,t,n)},e.prototype.once=function(e,n,r){return t(this._event)(e,n,r)},e}();e.chain=function(e){return new a(e)},e.fromNodeEventEmitter=function(e,t,n){void 0===n&&(n=function(e){return e});var r=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return i.fire(n.apply(void 0,e))},i=new h({onFirstListenerAdd:function(){return e.on(t,r)},onLastListenerRemove:function(){return e.removeListener(t,r)}});return i.event},e.fromPromise=function(e){var t=new h,n=!1;return e.then(void 0,function(){return null}).then(function(){n?t.fire(void 0):setTimeout(function(){return t.fire(void 0)},0)}),n=!0,t.event},e.toPromise=function(e){return new Promise(function(n){return t(e)(n)})}}(a=t.Event||(t.Event={}));var l=-1;t.setGlobalLeakWarningThreshold=function(e){var t=l;return l=e,{dispose:function(){l=t}}};var f=function(){function e(e,t){
void 0===t&&(t=Math.random().toString(18).slice(2,5)),this.customThreshold=e,this.name=t,this._warnCountdown=0}return e.prototype.dispose=function(){this._stacks&&this._stacks.clear()},e.prototype.check=function(e){var t=this,n=l;if("number"==typeof this.customThreshold&&(n=this.customThreshold),!(n<=0||e<n)){this._stacks||(this._stacks=new Map);var r=(new Error).stack.split("\n").slice(3).join("\n"),i=this._stacks.get(r)||0;if(this._stacks.set(r,i+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=.5*n;var o,s=0;this._stacks.forEach(function(e,t){(!o||s<e)&&(o=t,s=e)}),console.warn("["+this.name+"] potential listener LEAK detected, having "+e+" listeners already. MOST frequent listener ("+s+"):"),console.warn(o)}return function(){var e=t._stacks.get(r)||0;t._stacks.set(r,e-1)}}},e}(),h=function(){function e(e){this._disposed=!1,this._options=e,this._leakageMon=l>0?new f(this._options&&this._options.leakWarningThreshold):void 0}return Object.defineProperty(e.prototype,"event",{
get:function(){var t=this;return this._event||(this._event=function(n,r,i){t._listeners||(t._listeners=new c.LinkedList);var o=t._listeners.isEmpty();o&&t._options&&t._options.onFirstListenerAdd&&t._options.onFirstListenerAdd(t);var s=t._listeners.push(r?[n,r]:n);o&&t._options&&t._options.onFirstListenerDidAdd&&t._options.onFirstListenerDidAdd(t),t._options&&t._options.onListenerDidAdd&&t._options.onListenerDidAdd(t,n,r);var u;t._leakageMon&&(u=t._leakageMon.check(t._listeners.size));var a;return a={dispose:function(){if(u&&u(),a.dispose=e._noop,!t._disposed&&(s(),t._options&&t._options.onLastListenerRemove)){t._listeners&&!t._listeners.isEmpty()||t._options.onLastListenerRemove(t)}}},Array.isArray(i)&&i.push(a),a}),this._event},enumerable:!0,configurable:!0}),e.prototype.fire=function(e){if(this._listeners){this._deliveryQueue||(this._deliveryQueue=[]);for(var t=this._listeners.iterator(),n=t.next();!n.done;n=t.next())this._deliveryQueue.push([n.value,e]);for(;this._deliveryQueue.length>0;){
var r=this._deliveryQueue.shift(),i=r[0],s=r[1];try{"function"==typeof i?i.call(void 0,s):i[0].call(i[1],s)}catch(n){o.onUnexpectedError(n)}}}},e.prototype.dispose=function(){this._listeners&&(this._listeners=void 0),this._deliveryQueue&&(this._deliveryQueue.length=0),this._leakageMon&&this._leakageMon.dispose(),this._disposed=!0},e._noop=function(){},e}();t.Emitter=h;var p=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.fireAsync=function(e){return r(this,void 0,void 0,function(){var t,n,r,s,u,c;return i(this,function(i){switch(i.label){case 0:if(!this._listeners)return[2];for(this._asyncDeliveryQueue||(this._asyncDeliveryQueue=[]),t=this._listeners.iterator(),n=t.next();!n.done;n=t.next())c=[],this._asyncDeliveryQueue.push([n.value,e(c,"function"==typeof n.value?n.value:n.value[0]),c]);i.label=1;case 1:if(!(this._asyncDeliveryQueue.length>0))return[3,3];r=this._asyncDeliveryQueue.shift(),s=r[0],u=r[1],c=r[2];try{
"function"==typeof s?s.call(void 0,u):s[0].call(s[1],u)}catch(e){return o.onUnexpectedError(e),[3,1]}return Object.freeze(c),[4,Promise.all(c)];case 2:return i.sent(),[3,1];case 3:return[2]}})})},t}(h);t.AsyncEmitter=p;var d=function(){function e(){var e=this;this.hasListeners=!1,this.events=[],this.emitter=new h({onFirstListenerAdd:function(){return e.onFirstListenerAdd()},onLastListenerRemove:function(){return e.onLastListenerRemove()}})}return Object.defineProperty(e.prototype,"event",{get:function(){return this.emitter.event},enumerable:!0,configurable:!0}),e.prototype.add=function(e){var t=this,n={event:e,listener:null};this.events.push(n),this.hasListeners&&this.hook(n);return u.toDisposable(s.once(function(){t.hasListeners&&t.unhook(n);var e=t.events.indexOf(n);t.events.splice(e,1)}))},e.prototype.onFirstListenerAdd=function(){var e=this;this.hasListeners=!0,this.events.forEach(function(t){return e.hook(t)})},e.prototype.onLastListenerRemove=function(){var e=this;this.hasListeners=!1,
this.events.forEach(function(t){return e.unhook(t)})},e.prototype.hook=function(e){var t=this;e.listener=e.event(function(e){return t.emitter.fire(e)})},e.prototype.unhook=function(e){e.listener&&e.listener.dispose(),e.listener=null},e.prototype.dispose=function(){this.emitter.dispose()},e}();t.EventMultiplexer=d;var v=function(){function e(){this.buffers=[]}return e.prototype.wrapEvent=function(e){var t=this;return function(n,r,i){return e(function(e){var i=t.buffers[t.buffers.length-1];i?i.push(function(){return n.call(r,e)}):n.call(r,e)},void 0,i)}},e.prototype.bufferEvents=function(e){var t=[];this.buffers.push(t);var n=e();return this.buffers.pop(),t.forEach(function(e){return e()}),n},e}();t.EventBufferer=v;var m=function(){function e(){var e=this;this.listening=!1,this.inputEvent=a.None,this.inputEventListener=u.Disposable.None,this.emitter=new h({onFirstListenerDidAdd:function(){e.listening=!0,e.inputEventListener=e.inputEvent(e.emitter.fire,e.emitter)},onLastListenerRemove:function(){e.listening=!1,
e.inputEventListener.dispose()}}),this.event=this.emitter.event}return Object.defineProperty(e.prototype,"input",{set:function(e){this.inputEvent=e,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=e(this.emitter.fire,this.emitter))},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){this.inputEventListener.dispose(),this.emitter.dispose()},e}();t.Relay=m}),define(e[6],t([1,0,2]),function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=Object.freeze(function(e,t){var n=setTimeout(e.bind(t),0);return{dispose:function(){clearTimeout(n)}}});!function(e){e.isCancellationToken=function(t){return t===e.None||t===e.Cancelled||t instanceof o||!(!t||"object"!=typeof t)&&"boolean"==typeof t.isCancellationRequested&&"function"==typeof t.onCancellationRequested},e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:n.Event.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:i})
}(r=t.CancellationToken||(t.CancellationToken={}));var o=function(){function e(){this._isCancelled=!1,this._emitter=null}return e.prototype.cancel=function(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))},Object.defineProperty(e.prototype,"isCancellationRequested",{get:function(){return this._isCancelled},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"onCancellationRequested",{get:function(){return this._isCancelled?i:(this._emitter||(this._emitter=new n.Emitter),this._emitter.event)},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){this._emitter&&(this._emitter.dispose(),this._emitter=null)},e}(),s=function(){function e(){}return Object.defineProperty(e.prototype,"token",{get:function(){return this._token||(this._token=new o),this._token},enumerable:!0,configurable:!0}),e.prototype.cancel=function(){this._token?this._token instanceof o&&this._token.cancel():this._token=r.Cancelled},e.prototype.dispose=function(){
this._token?this._token instanceof o&&this._token.dispose():this._token=r.None},e}();t.CancellationTokenSource=s}),define(e[7],t([1,0,6,3,2,4]),function(e,t,r,i,o,s){"use strict";function u(e){return e&&"function"==typeof e.then}function c(e){var t=new r.CancellationTokenSource,n=e(t.token),o=new Promise(function(e,r){t.token.onCancellationRequested(function(){r(i.canceled())}),Promise.resolve(n).then(function(n){t.dispose(),e(n)},function(e){t.dispose(),r(e)})});return new(function(){function e(){}return e.prototype.cancel=function(){t.cancel()},e.prototype.then=function(e,t){return o.then(e,t)},e.prototype.catch=function(e){return this.then(void 0,e)},e.prototype.finally=function(e){return l(o,e||function(){})},e}())}function a(e,t){return t?new Promise(function(n,r){var o=setTimeout(n,e);t.onCancellationRequested(function(){clearTimeout(o),r(i.canceled())})}):c(function(t){return a(e,t)})}function l(e,t){function n(){try{t()}catch(e){i.onUnexpectedError(e)}}return e.then(function(e){return n()
},function(e){return n()}),Promise.resolve(e)}function f(e){function t(o){void 0!==o&&null!==o&&n.push(o);var s=r<i?e[r++]():null;return s?s.then(t):Promise.resolve(n)}var n=[],r=0,i=e.length;return Promise.resolve(null).then(t)}Object.defineProperty(t,"__esModule",{value:!0}),t.isThenable=u,t.createCancelablePromise=c,t.asPromise=function(e){return new Promise(function(t,n){var r=e();u(r)?r.then(t,n):t(r)})};var h=function(){function e(){this.activePromise=null,this.queuedPromise=null,this.queuedPromiseFactory=null}return e.prototype.queue=function(e){var t=this;if(this.activePromise){if(this.queuedPromiseFactory=e,!this.queuedPromise){var n=function(){t.queuedPromise=null;var e=t.queue(t.queuedPromiseFactory);return t.queuedPromiseFactory=null,e};this.queuedPromise=new Promise(function(e){t.activePromise.then(n,n).then(e)})}return new Promise(function(e,n){t.queuedPromise.then(e,n)})}return this.activePromise=e(),new Promise(function(e,n){t.activePromise.then(function(n){t.activePromise=null,e(n)
},function(e){t.activePromise=null,n(e)})})},e}();t.Throttler=h;var p=function(){function e(){this.current=Promise.resolve(null)}return e.prototype.queue=function(e){return this.current=this.current.then(function(){return e()})},e}();t.Sequencer=p;var d=function(){function e(e){this.defaultDelay=e,this.timeout=null,this.completionPromise=null,this.doResolve=null,this.task=null}return e.prototype.trigger=function(e,t){var n=this;return void 0===t&&(t=this.defaultDelay),this.task=e,this.cancelTimeout(),this.completionPromise||(this.completionPromise=new Promise(function(e,t){n.doResolve=e,n.doReject=t}).then(function(){n.completionPromise=null,n.doResolve=null;var e=n.task;return n.task=null,e()})),this.timeout=setTimeout(function(){n.timeout=null,n.doResolve(null)},t),this.completionPromise},e.prototype.isTriggered=function(){return null!==this.timeout},e.prototype.cancel=function(){this.cancelTimeout(),this.completionPromise&&(this.doReject(i.canceled()),this.completionPromise=null)},
e.prototype.cancelTimeout=function(){null!==this.timeout&&(clearTimeout(this.timeout),this.timeout=null)},e.prototype.dispose=function(){this.cancelTimeout()},e}();t.Delayer=d;var v=function(){function e(e){this.delayer=new d(e),this.throttler=new h}return e.prototype.trigger=function(e,t){var n=this;return this.delayer.trigger(function(){return n.throttler.queue(e)},t)},e.prototype.isTriggered=function(){return this.delayer.isTriggered()},e.prototype.cancel=function(){this.delayer.cancel()},e.prototype.dispose=function(){this.delayer.dispose()},e}();t.ThrottledDelayer=v;var m=function(){function e(){var e=this;this._isOpen=!1,this._promise=new Promise(function(t,n){e._completePromise=t})}return e.prototype.isOpen=function(){return this._isOpen},e.prototype.open=function(){this._isOpen=!0,this._completePromise(!0)},e.prototype.wait=function(){return this._promise},e}();t.Barrier=m,t.timeout=a,t.disposableTimeout=function(e,t){void 0===t&&(t=0);var n=setTimeout(e,t);return s.toDisposable(function(){
return clearTimeout(n)})},t.always=l,t.ignoreErrors=function(e){return e.then(void 0,function(e){})},t.sequence=f,t.first=function(e,t,n){void 0===t&&(t=function(e){return!!e}),void 0===n&&(n=null);var r=0,i=e.length,o=function(){if(r>=i)return Promise.resolve(n);var s=e[r++];return Promise.resolve(s()).then(function(e){return t(e)?Promise.resolve(e):o()})};return o()};var y=function(){function e(e){this._size=0,this.maxDegreeOfParalellism=e,this.outstandingPromises=[],this.runningPromises=0,this._onFinished=new o.Emitter}return Object.defineProperty(e.prototype,"onFinished",{get:function(){return this._onFinished.event},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),e.prototype.queue=function(e){var t=this;return this._size++,new Promise(function(n,r){t.outstandingPromises.push({factory:e,c:n,e:r}),t.consume()})},e.prototype.consume=function(){
for(var e=this;this.outstandingPromises.length&&this.runningPromises<this.maxDegreeOfParalellism;){var t=this.outstandingPromises.shift();this.runningPromises++;var n=t.factory();n.then(t.c,t.e),n.then(function(){return e.consumed()},function(){return e.consumed()})}},e.prototype.consumed=function(){this._size--,this.runningPromises--,this.outstandingPromises.length>0?this.consume():this._onFinished.fire()},e.prototype.dispose=function(){this._onFinished.dispose()},e}();t.Limiter=y;var _=function(e){function t(){return e.call(this,1)||this}return n(t,e),t}(y);t.Queue=_;var g=function(){function e(){this.queues=Object.create(null)}return e.prototype.queueFor=function(e){var t=this,n=e.toString();if(!this.queues[n]){var r=new _;r.onFinished(function(){r.dispose(),delete t.queues[n]}),this.queues[n]=r}return this.queues[n]},e}();t.ResourceQueue=g;var w=function(e){function t(t,n){var r=e.call(this)||this;return r._token=-1,"function"==typeof t&&"number"==typeof n&&r.setIfNotSet(t,n),r}return n(t,e),
t.prototype.dispose=function(){this.cancel(),e.prototype.dispose.call(this)},t.prototype.cancel=function(){-1!==this._token&&(clearTimeout(this._token),this._token=-1)},t.prototype.cancelAndSet=function(e,t){var n=this;this.cancel(),this._token=setTimeout(function(){n._token=-1,e()},t)},t.prototype.setIfNotSet=function(e,t){var n=this;-1===this._token&&(this._token=setTimeout(function(){n._token=-1,e()},t))},t}(s.Disposable);t.TimeoutTimer=w;var b=function(e){function t(){var t=e.call(this)||this;return t._token=-1,t}return n(t,e),t.prototype.dispose=function(){this.cancel(),e.prototype.dispose.call(this)},t.prototype.cancel=function(){-1!==this._token&&(clearInterval(this._token),this._token=-1)},t.prototype.cancelAndSet=function(e,t){this.cancel(),this._token=setInterval(function(){e()},t)},t}(s.Disposable);t.IntervalTimer=b;var E=function(){function e(e,t){this.timeoutToken=-1,this.runner=e,this.timeout=t,this.timeoutHandler=this.onTimeout.bind(this)}return e.prototype.dispose=function(){this.cancel(),
this.runner=null},e.prototype.cancel=function(){this.isScheduled()&&(clearTimeout(this.timeoutToken),this.timeoutToken=-1)},e.prototype.schedule=function(e){void 0===e&&(e=this.timeout),this.cancel(),this.timeoutToken=setTimeout(this.timeoutHandler,e)},e.prototype.isScheduled=function(){return-1!==this.timeoutToken},e.prototype.onTimeout=function(){this.timeoutToken=-1,this.runner&&this.doRun()},e.prototype.doRun=function(){this.runner&&this.runner()},e}();t.RunOnceScheduler=E;var k=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.units=[],r}return n(t,e),t.prototype.work=function(e){this.units.push(e),this.isScheduled()||this.schedule()},t.prototype.doRun=function(){var e=this.units;this.units=[],this.runner&&this.runner(e)},t.prototype.dispose=function(){this.units=[],e.prototype.dispose.call(this)},t}(E);t.RunOnceWorker=k,t.nfcall=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return new Promise(function(n,r){return e.apply(void 0,t.concat([function(e,t){
return e?r(e):n(t)}]))})},t.ninvoke=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return new Promise(function(r,i){return t.call.apply(t,[e].concat(n,[function(e,t){return e?i(e):r(t)}]))})},function(){if("function"!=typeof requestIdleCallback||"function"!=typeof cancelIdleCallback){var e=Object.freeze({didTimeout:!0,timeRemaining:function(){return 15}});t.runWhenIdle=function(t){var n=setTimeout(function(){return t(e)}),r=!1;return{dispose:function(){r||(r=!0,clearTimeout(n))}}}}else t.runWhenIdle=function(e,t){var n=requestIdleCallback(e,"number"==typeof t?{timeout:t}:void 0),r=!1;return{dispose:function(){r||(r=!0,cancelIdleCallback(n))}}}}();var C=function(){function e(e){var n=this;this._executor=function(){try{n._value=e()}catch(e){n._error=e}finally{n._didRun=!0}},this._handle=t.runWhenIdle(function(){return n._executor()})}return e.prototype.dispose=function(){this._handle.dispose()},e.prototype.getValue=function(){if(this._didRun||(this._handle.dispose(),this._executor()),
this._error)throw this._error;return this._value},e}();t.IdleValue=C}),define(e[10],t([1,0]),function(e,t){"use strict";function r(){return new s}function i(e){return u.test(e)}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e){this._value=e}return e.prototype.asHex=function(){return this._value},e}(),s=function(e){function t(){return e.call(this,[t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),"-",t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),"-","4",t._randomHex(),t._randomHex(),t._randomHex(),"-",t._oneOf(t._timeHighBits),t._randomHex(),t._randomHex(),t._randomHex(),"-",t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex()].join(""))||this}return n(t,e),t._oneOf=function(e){return e[Math.floor(e.length*Math.random())]},t._randomHex=function(){return t._oneOf(t._chars)},
t._chars=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],t._timeHighBits=["8","9","a","b"],t}(o);t.v4=r;var u=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;t.isUUID=i,t.parse=function(e){if(!i(e))throw new Error("invalid uuid");return new o(e)},t.generateUuid=function(){return r().asHex()}}),define(e[11],t([1,0,4,2,7,6,3]),function(e,t,n,o,s,u,c){"use strict";function a(e){var t=Buffer.allocUnsafe(4);return t.writeUInt32BE(e,0),t}function l(e){return e.read(4).readUInt32BE(0)}function f(e,t){if(void 0===t)e.write(_.Undefined);else if("string"==typeof t){i=Buffer.from(t);e.write(_.String),e.write(a(i.length)),e.write(i)}else if(Buffer.isBuffer(t))e.write(_.Buffer),e.write(a(t.length)),e.write(t);else if(Array.isArray(t)){e.write(_.Array),e.write(a(t.length));for(var n=0,r=t;n<r.length;n++){f(e,r[n])}}else{var i=Buffer.from(JSON.stringify(t));e.write(_.Object),e.write(a(i.length)),e.write(i)}}function h(e){switch(e.read(1).readUInt8(0)){case v.Undefined:return
;case v.String:return e.read(l(e)).toString();case v.Buffer:return e.read(l(e));case v.Array:for(var t=l(e),n=[],r=0;r<t;r++)n.push(h(e));return n;case v.Object:return JSON.parse(e.read(l(e)).toString())}}function p(e){return{call:function(t,n,r){return e.then(function(e){return e.call(t,n,r)})},listen:function(t,n){var r=new o.Relay;return e.then(function(e){return r.input=e.listen(t,n)}),r.event}}}Object.defineProperty(t,"__esModule",{value:!0});!function(e){e[e.Promise=100]="Promise",e[e.PromiseCancel=101]="PromiseCancel",e[e.EventListen=102]="EventListen",e[e.EventDispose=103]="EventDispose"}(t.RequestType||(t.RequestType={}));!function(e){e[e.Initialize=200]="Initialize",e[e.PromiseSuccess=201]="PromiseSuccess",e[e.PromiseError=202]="PromiseError",e[e.PromiseErrorObj=203]="PromiseErrorObj",e[e.EventFire=204]="EventFire"}(t.ResponseType||(t.ResponseType={}));var d;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Idle=1]="Idle"}(d||(d={}));var v,m=function(){function e(e){this.buffer=e,this.pos=0}
return e.prototype.read=function(e){var t=this.buffer.slice(this.pos,this.pos+e);return this.pos+=t.length,t},e}(),y=function(){function e(){this.buffers=[]}return Object.defineProperty(e.prototype,"buffer",{get:function(){return Buffer.concat(this.buffers)},enumerable:!0,configurable:!0}),e.prototype.write=function(e){this.buffers.push(e)},e}();!function(e){e[e.Undefined=0]="Undefined",e[e.String=1]="String",e[e.Buffer=2]="Buffer",e[e.Array=3]="Array",e[e.Object=4]="Object"}(v||(v={}));var _={Undefined:Buffer.alloc(1,v.Undefined),String:Buffer.alloc(1,v.String),Buffer:Buffer.alloc(1,v.Buffer),Array:Buffer.alloc(1,v.Array),Object:Buffer.alloc(1,v.Object)},g=function(){function e(e,t){var n=this;this.protocol=e,this.ctx=t,this.channels=new Map,this.activeRequests=new Map,this.protocolListener=this.protocol.onMessage(function(e){return n.onRawMessage(e)}),this.sendResponse({type:200})}return e.prototype.registerChannel=function(e,t){this.channels.set(e,t)},e.prototype.sendResponse=function(e){switch(e.type){
case 200:return this.send([e.type]);case 201:case 202:case 204:case 203:return this.send([e.type,e.id],e.data)}},e.prototype.send=function(e,t){void 0===t&&(t=void 0);var n=new y;f(n,e),f(n,t),this.sendBuffer(n.buffer)},e.prototype.sendBuffer=function(e){try{this.protocol.send(e)}catch(e){}},e.prototype.onRawMessage=function(e){var t=new m(e),n=h(t),r=h(t),i=n[0];switch(i){case 100:return this.onPromise({type:i,id:n[1],channelName:n[2],name:n[3],arg:r});case 102:return this.onEventListen({type:i,id:n[1],channelName:n[2],name:n[3],arg:r});case 101:case 103:return this.disposeActiveRequest({type:i,id:n[1]})}},e.prototype.onPromise=function(e){var t=this,r=this.channels.get(e.channelName);if(!r)throw new Error("Unknown channel");var i,o=new u.CancellationTokenSource;try{i=r.call(this.ctx,e.name,e.arg,o.token)}catch(e){i=Promise.reject(e)}var s=e.id;i.then(function(n){t.sendResponse({id:s,data:n,type:201}),t.activeRequests.delete(e.id)},function(n){n instanceof Error?t.sendResponse({id:s,data:{message:n.message,
name:n.name,stack:n.stack?n.stack.split?n.stack.split("\n"):n.stack:void 0},type:202}):t.sendResponse({id:s,data:n,type:203}),t.activeRequests.delete(e.id)});var c=n.toDisposable(function(){return o.cancel()});this.activeRequests.set(e.id,c)},e.prototype.onEventListen=function(e){var t=this,n=this.channels.get(e.channelName);if(!n)throw new Error("Unknown channel");var r=e.id,i=n.listen(this.ctx,e.name,e.arg)(function(e){return t.sendResponse({id:r,data:e,type:204})});this.activeRequests.set(e.id,i)},e.prototype.disposeActiveRequest=function(e){var t=this.activeRequests.get(e.id);t&&(t.dispose(),this.activeRequests.delete(e.id))},e.prototype.dispose=function(){this.protocolListener&&(this.protocolListener.dispose(),this.protocolListener=null),this.activeRequests.forEach(function(e){return e.dispose()}),this.activeRequests.clear()},e}();t.ChannelServer=g;var w=function(){function e(e){var t=this;this.protocol=e,this.state=d.Uninitialized,this.activeRequests=new Set,this.handlers=new Map,this.lastRequestId=0,
this._onDidInitialize=new o.Emitter,this.onDidInitialize=this._onDidInitialize.event,this.protocolListener=this.protocol.onMessage(function(e){return t.onBuffer(e)})}return e.prototype.getChannel=function(e){var t=this;return{call:function(n,r,i){return t.requestPromise(e,n,r,i)},listen:function(n,r){return t.requestEvent(e,n,r)}}},e.prototype.requestPromise=function(e,t,r,i){var o=this;void 0===i&&(i=u.CancellationToken.None);var a=this.lastRequestId++,l={id:a,type:100,channelName:e,name:t,arg:r};if(i.isCancellationRequested)return Promise.reject(c.canceled());var f,h=new Promise(function(e,t){if(i.isCancellationRequested)return t(c.canceled());var r=s.createCancelablePromise(function(e){return o.whenInitialized()});r.then(function(){r=null;o.handlers.set(a,function(n){switch(n.type){case 201:o.handlers.delete(a),e(n.data);break;case 202:o.handlers.delete(a);var r=new Error(n.data.message);r.stack=n.data.stack,r.name=n.data.name,t(r);break;case 203:o.handlers.delete(a),t(n.data)}}),o.sendRequest(l)})
;var u=function(){r?(r.cancel(),r=null):o.sendRequest({id:a,type:101}),t(c.canceled())},h=i.onCancellationRequested(u);f=n.combinedDisposable([n.toDisposable(u),h]),o.activeRequests.add(f)});return s.always(h,function(){return o.activeRequests.delete(f)}),h},e.prototype.requestEvent=function(e,t,n){var r=this,i=this.lastRequestId++,u={id:i,type:102,channelName:e,name:t,arg:n},c=null,a=new o.Emitter({onFirstListenerAdd:function(){(c=s.createCancelablePromise(function(e){return r.whenInitialized()})).then(function(){c=null,r.activeRequests.add(a),r.sendRequest(u)})},onLastListenerRemove:function(){c?(c.cancel(),c=null):(r.activeRequests.delete(a),r.sendRequest({id:i,type:103}))}});return this.handlers.set(i,function(e){return a.fire(e.data)}),a.event},e.prototype.sendRequest=function(e){switch(e.type){case 100:case 102:return this.send([e.type,e.id,e.channelName,e.name],e.arg);case 101:case 103:return this.send([e.type,e.id])}},e.prototype.send=function(e,t){void 0===t&&(t=void 0);var n=new y;f(n,e),f(n,t),
this.sendBuffer(n.buffer)},e.prototype.sendBuffer=function(e){try{this.protocol.send(e)}catch(e){}},e.prototype.onBuffer=function(e){var t=new m(e),n=h(t),r=h(t);switch(n[0]){case 200:return this.onResponse({type:n[0]});case 201:case 202:case 204:case 203:return this.onResponse({type:n[0],id:n[1],data:r})}},e.prototype.onResponse=function(e){if(200===e.type)return this.state=d.Idle,void this._onDidInitialize.fire();var t=this.handlers.get(e.id);t&&t(e)},e.prototype.whenInitialized=function(){return this.state===d.Idle?Promise.resolve():o.Event.toPromise(this.onDidInitialize)},e.prototype.dispose=function(){this.protocolListener&&(this.protocolListener.dispose(),this.protocolListener=null),this.activeRequests.forEach(function(e){return e.dispose()}),this.activeRequests.clear()},e}();t.ChannelClient=w;var b=function(){function e(e){var t=this;this.channels=new Map,this._connections=new Set,this._onDidChangeConnections=new o.Emitter,this.onDidChangeConnections=this._onDidChangeConnections.event,e(function(e){
var n=e.protocol,r=e.onDidClientDisconnect;o.Event.once(n.onMessage)(function(e){var i=h(new m(e)),o=new g(n,i),s=new w(n);t.channels.forEach(function(e,t){return o.registerChannel(t,e)});var u={channelClient:s,ctx:i};t._connections.add(u),t._onDidChangeConnections.fire(u),r(function(){o.dispose(),s.dispose(),t._connections.delete(u)})})})}return Object.defineProperty(e.prototype,"connections",{get:function(){var e=[];return this._connections.forEach(function(t){return e.push(t)}),e},enumerable:!0,configurable:!0}),e.prototype.getChannel=function(e,t){var n=this;return{call:function(r,i,o){return p(t.routeCall(n,r,i).then(function(t){return t.channelClient.getChannel(e)})).call(r,i,o)},listen:function(r,i){return p(t.routeEvent(n,r,i).then(function(t){return t.channelClient.getChannel(e)})).listen(r,i)}}},e.prototype.registerChannel=function(e,t){this.channels.set(e,t)},e.prototype.dispose=function(){this.channels.clear(),this._connections.clear(),this._onDidChangeConnections.dispose()},e}();t.IPCServer=b
;var E=function(){function e(e,t){var n=new y;f(n,t),e.send(n.buffer),this.channelClient=new w(e),this.channelServer=new g(e,t)}return e.prototype.getChannel=function(e){return this.channelClient.getChannel(e)},e.prototype.registerChannel=function(e,t){this.channelServer.registerChannel(e,t)},e.prototype.dispose=function(){this.channelClient.dispose(),this.channelServer.dispose()},e}();t.IPCClient=E,t.getDelayedChannel=p,t.getNextTickChannel=function(e){var t=!1;return{call:function(n,r,i){return t?e.call(n,r,i):s.timeout(0).then(function(){return t=!0}).then(function(){return e.call(n,r,i)})},listen:function(n,r){if(t)return e.listen(n,r);var i=new o.Relay;return s.timeout(0).then(function(){return t=!0}).then(function(){return i.input=e.listen(n,r)}),i.event}}};var k=function(){function e(e){this.fn=e}return e.prototype.routeCall=function(e){return this.route(e)},e.prototype.routeEvent=function(e){return this.route(e)},e.prototype.route=function(e){return r(this,void 0,void 0,function(){var t,n,r
;return i(this,function(i){switch(i.label){case 0:t=0,n=e.connections,i.label=1;case 1:return t<n.length?(r=n[t],[4,Promise.resolve(this.fn(r.ctx))]):[3,4];case 2:if(i.sent())return[2,Promise.resolve(r)];i.label=3;case 3:return t++,[3,1];case 4:return[4,o.Event.toPromise(e.onDidChangeConnections)];case 5:return i.sent(),[4,this.route(e)];case 6:return[2,i.sent()]}})})},e}();t.StaticRouter=k}),define(e[12],t([1,0,14,2,11,15,16,10,7]),function(e,t,r,i,o,s,u,c,a){"use strict";function l(e){var t,n=!1,r=!1,o=[],s=function(){if(!r){for(r=!0;n&&o.length>0;)t.fire(o.shift());r=!1}};return e(function(e){o.push(e),s()}),(t=new i.Emitter({onFirstListenerAdd:function(){n=!0,process.nextTick(s)},onLastListenerRemove:function(){n=!1}})).event}Object.defineProperty(t,"__esModule",{value:!0}),t.generateRandomPipeName=function(){var e=c.generateUuid();return"win32"===process.platform?"\\\\.\\pipe\\vscode-ipc-"+e+"-sock":s.join(u.tmpdir(),"vscode-ipc-"+e+".sock")};var f=function(){function e(t,n){var r=this;this._socket=t,
this._onMessage=new i.Emitter,this.onMessage=this._onMessage.event,this._onClose=new i.Emitter,this.onClose=this._onClose.event,this._writeBuffer=new(function(){function e(){this._data=[],this._totalLength=0}return e.prototype.add=function(e,t){var n=0===this._totalLength;return this._data.push(e,t),this._totalLength+=e.length+t.length,n},e.prototype.take=function(){var e=Buffer.concat(this._data,this._totalLength);return this._data.length=0,this._totalLength=0,e},e}()),this._isDisposed=!1,this._chunks=[];var o=0,s={readHead:!0,bodyLen:-1},u=function(t){for(r._chunks.push(t),o+=t.length;o>0;){if(s.readHead){if(!(o>=e._headerLen))break;n=Buffer.concat(r._chunks);s.bodyLen=n.readUInt32BE(0),s.readHead=!1;u=n.slice(e._headerLen);o=u.length,r._chunks=[u]}if(!s.readHead){if(!(o>=s.bodyLen))break;var n,i=(n=Buffer.concat(r._chunks)).slice(0,s.bodyLen),u=n.slice(s.bodyLen);if(o=u.length,r._chunks=[u],s.bodyLen=-1,s.readHead=!0,r._onMessage.fire(i),r._isDisposed)break}}},c=function(){if(n&&n.length>0){var e=n
;n=void 0,u(e)}};this._firstChunkTimer=new a.TimeoutTimer,this._firstChunkTimer.setIfNotSet(function(){c()},0),this._socketDataListener=function(e){c(),u(e)},t.on("data",this._socketDataListener),this._socketEndListener=function(){c()},t.on("end",this._socketEndListener),this._socketCloseListener=function(){r._onClose.fire()},t.once("close",this._socketCloseListener)}return e.prototype.dispose=function(){this._isDisposed=!0,this._firstChunkTimer.dispose(),this._socket.removeListener("data",this._socketDataListener),this._socket.removeListener("end",this._socketEndListener),this._socket.removeListener("close",this._socketCloseListener)},e.prototype.end=function(){this._socket.end()},e.prototype.getBuffer=function(){return Buffer.concat(this._chunks)},e.prototype.send=function(t){var n=Buffer.allocUnsafe(e._headerLen);n.writeUInt32BE(t.length,0,!0),this._writeSoon(n,t)},e.prototype._writeSoon=function(e,t){var n=this;this._writeBuffer.add(e,t)&&setImmediate(function(){
n._socket.destroyed||n._socket.write(n._writeBuffer.take())})},e._headerLen=4,e}();t.Protocol=f;var h=function(e){function t(n){var r=e.call(this,t.toClientConnectionEvent(n))||this;return r.server=n,r}return n(t,e),t.toClientConnectionEvent=function(e){var t=i.Event.fromNodeEventEmitter(e,"connection");return i.Event.map(t,function(e){return{protocol:new f(e),onDidClientDisconnect:i.Event.once(i.Event.fromNodeEventEmitter(e,"close"))}})},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.server&&(this.server.close(),this.server=null)},t}(o.IPCServer);t.Server=h;var p=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.protocol=t,r}return n(t,e),t.fromSocket=function(e,n){return new t(new f(e),n)},Object.defineProperty(t.prototype,"onClose",{get:function(){return this.protocol.onClose},enumerable:!0,configurable:!0}),t.prototype.dispose=function(){e.prototype.dispose.call(this),this.protocol.end()},t}(o.IPCClient);t.Client=p,t.serve=function(e){return new Promise(function(t,n){
var i=r.createServer();i.on("error",n),i.listen(e,function(){i.removeListener("error",n),t(new h(i))})})},t.connect=function(e,t){return new Promise(function(n,i){var o=r.createConnection(e,function(){o.removeListener("error",i),n(p.fromSocket(o,t))});o.once("error",i)})};var d=function(){function e(e){this._actual=e,this.onMessage=l(this._actual.onMessage),this.onClose=l(this._actual.onClose)}return e.prototype.send=function(e){this._actual.send(e)},e.prototype.end=function(){this._actual.end()},e}();t.BufferedProtocol=d}),define(e[13],t([1,0]),function(e,t){"use strict";function n(e,t,n,r){t[i.DI_TARGET]===t?t[i.DI_DEPENDENCIES].push({id:e,index:n,optional:r}):(t[i.DI_DEPENDENCIES]=[{id:e,index:n,optional:r}],t[i.DI_TARGET]=t)}function r(e){if(i.serviceIds.has(e))return i.serviceIds.get(e);var t=function(e,r,i){if(3!==arguments.length)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");n(t,e,i,!1)};return t.toString=function(){return e},i.serviceIds.set(e,t),t}
Object.defineProperty(t,"__esModule",{value:!0});var i;!function(e){e.serviceIds=new Map,e.DI_TARGET="$di$target",e.DI_DEPENDENCIES="$di$dependencies",e.getServiceDependencies=function(t){return t[e.DI_DEPENDENCIES]||[]}}(i=t._util||(t._util={})),t.IInstantiationService=r("instantiationService"),t.createDecorator=r,t.optional=function(e){return function(t,r,i){if(3!==arguments.length)throw new Error("@optional-decorator can only be used to decorate a parameter");n(e,t,i,!0)}}}),define(e[17],t([1,0,12,13]),function(e,t,n,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ID="driverService",t.IDriver=o.createDecorator(t.ID);var s=function(){function e(e){this.driver=e}return e.prototype.listen=function(e,t){throw new Error("No event found")},e.prototype.call=function(e,t,n){switch(t){case"getWindowIds":return this.driver.getWindowIds();case"capturePage":return this.driver.capturePage(n);case"reloadWindow":return this.driver.reloadWindow(n);case"exitApplication":
return this.driver.exitApplication();case"dispatchKeybinding":return this.driver.dispatchKeybinding(n[0],n[1]);case"click":return this.driver.click(n[0],n[1],n[2],n[3]);case"doubleClick":return this.driver.doubleClick(n[0],n[1]);case"setValue":return this.driver.setValue(n[0],n[1],n[2]);case"getTitle":return this.driver.getTitle(n[0]);case"isActiveElement":return this.driver.isActiveElement(n[0],n[1]);case"getElements":return this.driver.getElements(n[0],n[1],n[2]);case"typeInEditor":return this.driver.typeInEditor(n[0],n[1],n[2]);case"getTerminalBuffer":return this.driver.getTerminalBuffer(n[0],n[1]);case"writeInTerminal":return this.driver.writeInTerminal(n[0],n[1],n[2])}throw new Error("Call not found: "+t)},e}();t.DriverChannel=s;var u=function(){function e(e){this.channel=e}return e.prototype.getWindowIds=function(){return this.channel.call("getWindowIds")},e.prototype.capturePage=function(e){return this.channel.call("capturePage",e)},e.prototype.reloadWindow=function(e){
return this.channel.call("reloadWindow",e)},e.prototype.exitApplication=function(){return this.channel.call("exitApplication")},e.prototype.dispatchKeybinding=function(e,t){return this.channel.call("dispatchKeybinding",[e,t])},e.prototype.click=function(e,t,n,r){return this.channel.call("click",[e,t,n,r])},e.prototype.doubleClick=function(e,t){return this.channel.call("doubleClick",[e,t])},e.prototype.setValue=function(e,t,n){return this.channel.call("setValue",[e,t,n])},e.prototype.getTitle=function(e){return this.channel.call("getTitle",[e])},e.prototype.isActiveElement=function(e,t){return this.channel.call("isActiveElement",[e,t])},e.prototype.getElements=function(e,t,n){return this.channel.call("getElements",[e,t,n])},e.prototype.typeInEditor=function(e,t,n){return this.channel.call("typeInEditor",[e,t,n])},e.prototype.getTerminalBuffer=function(e,t){return this.channel.call("getTerminalBuffer",[e,t])},e.prototype.writeInTerminal=function(e,t,n){return this.channel.call("writeInTerminal",[e,t,n])},e}()
;t.DriverChannelClient=u;var c=function(){function e(e){this.registry=e}return e.prototype.listen=function(e,t){throw new Error("Event not found: "+t)},e.prototype.call=function(e,t,n){switch(t){case"registerWindowDriver":return this.registry.registerWindowDriver(n);case"reloadWindowDriver":return this.registry.reloadWindowDriver(n)}throw new Error("Call not found: "+t)},e}();t.WindowDriverRegistryChannel=c;var a=function(){function e(e){this.channel=e}return e.prototype.registerWindowDriver=function(e){return this.channel.call("registerWindowDriver",e)},e.prototype.reloadWindowDriver=function(e){return this.channel.call("reloadWindowDriver",e)},e}();t.WindowDriverRegistryChannelClient=a;var l=function(){function e(e){this.driver=e}return e.prototype.listen=function(e,t){throw new Error("No event found: "+t)},e.prototype.call=function(e,t,n){switch(t){case"click":return this.driver.click(n[0],n[1],n[2]);case"doubleClick":return this.driver.doubleClick(n);case"setValue":return this.driver.setValue(n[0],n[1])
;case"getTitle":return this.driver.getTitle();case"isActiveElement":return this.driver.isActiveElement(n);case"getElements":return this.driver.getElements(n[0],n[1]);case"typeInEditor":return this.driver.typeInEditor(n[0],n[1]);case"getTerminalBuffer":return this.driver.getTerminalBuffer(n);case"writeInTerminal":return this.driver.writeInTerminal(n[0],n[1])}throw new Error("Call not found: "+t)},e}();t.WindowDriverChannel=l;var f=function(){function e(e){this.channel=e}return e.prototype.click=function(e,t,n){return this.channel.call("click",[e,t,n])},e.prototype.doubleClick=function(e){return this.channel.call("doubleClick",e)},e.prototype.setValue=function(e,t){return this.channel.call("setValue",[e,t])},e.prototype.getTitle=function(){return this.channel.call("getTitle")},e.prototype.isActiveElement=function(e){return this.channel.call("isActiveElement",e)},e.prototype.getElements=function(e,t){return this.channel.call("getElements",[e,t])},e.prototype.typeInEditor=function(e,t){
return this.channel.call("typeInEditor",[e,t])},e.prototype.getTerminalBuffer=function(e){return this.channel.call("getTerminalBuffer",e)},e.prototype.writeInTerminal=function(e,t){return this.channel.call("writeInTerminal",[e,t])},e}();t.WindowDriverChannelClient=f,t.connect=function(e){return r(this,void 0,void 0,function(){var t,r,o;return i(this,function(i){switch(i.label){case 0:return[4,n.connect(e,"driverClient")];case 1:return t=i.sent(),r=t.getChannel("driver"),o=new u(r),[2,{client:t,driver:o}]}})})}})}).call(this);
//# sourceMappingURL=https://ticino.blob.core.windows.net/sourcemaps/bb1e228e30ce43ebb361c84fdf2f0d4fb7fda6ce/core/vs/platform/driver/node/driver.js.map
