/*!--------------------------------------------------------
 * Copyright (C) Microsoft Corporation. All rights reserved.
 *--------------------------------------------------------*/
(function(){var e=["exports","require","vs/base/common/lifecycle","vs/base/common/event","vs/base/common/buffer","vs/base/common/errors","vs/base/common/platform","vs/base/common/functional","vs/base/parts/ipc/common/ipc","vs/base/common/cancellation","vs/base/parts/ipc/common/ipc.net","vs/base/common/async","vs/base/common/process","vs/base/common/path","vs/base/common/uuid","vs/base/common/iterator","vs/base/common/linkedList","vs/base/parts/ipc/node/ipc.net","vs/platform/instantiation/common/instantiation","os","net","vs/platform/driver/node/driver"],t=function(t){for(var s=[],n=0,i=t.length;n<i;n++)s[n]=e[t[n]];return s};define(e[4],t([1,0]),function(e,t){"use strict";function s(){return new o}Object.defineProperty(t,"__esModule",{value:!0}),t.hasBuffer="undefined"!=typeof Buffer;let n,i;class r{static alloc(e){return new r(t.hasBuffer?Buffer.allocUnsafe(e):new Uint8Array(e))}static wrap(e){return t.hasBuffer&&!Buffer.isBuffer(e)&&(e=Buffer.from(e.buffer,e.byteOffset,e.byteLength)),new r(e)}
static fromString(e){return t.hasBuffer?new r(Buffer.from(e)):(n||(n=new TextEncoder),new r(n.encode(e)))}static concat(e,t){if(void 0===t){t=0;for(let s=0,n=e.length;s<n;s++)t+=e[s].byteLength}const s=r.alloc(t);let n=0;for(let t=0,i=e.length;t<i;t++){const i=e[t];s.set(i,n),n+=i.byteLength}return s}constructor(e){this.buffer=e,this.byteLength=this.buffer.byteLength}toString(){return t.hasBuffer?this.buffer.toString():(i||(i=new TextDecoder),i.decode(this.buffer))}slice(e,t){return new r(this.buffer.slice(e,t))}set(e,t){this.buffer.set(e.buffer,t)}readUInt32BE(e){return function(e,t){return e[t]*Math.pow(2,24)+e[t+1]*Math.pow(2,16)+e[t+2]*Math.pow(2,8)+e[t+3]}(this.buffer,e)}writeUInt32BE(e,t){!function(e,t,s){e[s+3]=t,t>>>=8,e[s+2]=t,t>>>=8,e[s+1]=t,t>>>=8,e[s]=t}(this.buffer,e,t)}readUInt8(e){return function(e,t){return e[t]}(this.buffer,e)}writeUInt8(e,t){!function(e,t,s){e[s]=t}(this.buffer,e,t)}}t.VSBuffer=r,t.readableToBuffer=function(e){const t=[];let s;for(;s=e.read();)t.push(s);return r.concat(t)},
t.bufferToReadable=function(e){let t=!1;return{read:()=>t?null:(t=!0,e)}},t.streamToBuffer=function(e){return new Promise((t,s)=>{const n=[];e.on("data",e=>n.push(e)),e.on("error",e=>s(e)),e.on("end",()=>t(r.concat(n)))})},t.bufferToStream=function(e){const t=s();return t.end(e),t},t.writeableBufferStream=s;class o{constructor(){this.state={flowing:!1,ended:!1,destroyed:!1},this.buffer={data:[],error:[]},this.listeners={data:[],error:[],end:[]}}pause(){this.state.destroyed||(this.state.flowing=!1)}resume(){this.state.destroyed||this.state.flowing||(this.state.flowing=!0,this.flowData(),this.flowErrors(),this.flowEnd())}write(e){this.state.destroyed||(this.state.flowing?this.listeners.data.forEach(t=>t(e)):this.buffer.data.push(e))}error(e){this.state.destroyed||(this.state.flowing?this.listeners.error.forEach(t=>t(e)):this.buffer.error.push(e))}end(e){this.state.destroyed||(e instanceof Error?this.error(e):e&&this.write(e),this.state.flowing?(this.listeners.end.forEach(e=>e()),
this.destroy()):this.state.ended=!0)}on(e,t){if(!this.state.destroyed)switch(e){case"data":this.listeners.data.push(t),this.resume();break;case"end":this.listeners.end.push(t),this.state.flowing&&this.flowEnd()&&this.destroy();break;case"error":this.listeners.error.push(t),this.state.flowing&&this.flowErrors()}}flowData(){if(this.buffer.data.length>0){const e=r.concat(this.buffer.data);this.listeners.data.forEach(t=>t(e)),this.buffer.data.length=0}}flowErrors(){if(this.listeners.error.length>0){for(const e of this.buffer.error)this.listeners.error.forEach(t=>t(e));this.buffer.error.length=0}}flowEnd(){return!!this.state.ended&&(this.listeners.end.forEach(e=>e()),this.listeners.end.length>0)}destroy(){this.state.destroyed||(this.state.destroyed=!0,this.state.ended=!0,this.buffer.data.length=0,this.buffer.error.length=0,this.listeners.data.length=0,this.listeners.error.length=0,this.listeners.end.length=0)}}}),define(e[5],t([1,0]),function(e,t){"use strict";function s(e){
return e instanceof Error&&e.name===i&&e.message===i}Object.defineProperty(t,"__esModule",{value:!0});class n{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{if(e.stack)throw new Error(e.message+"\n\n"+e.stack);throw e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}}t.ErrorHandler=n,t.errorHandler=new n,t.setUnexpectedErrorHandler=function(e){t.errorHandler.setUnexpectedErrorHandler(e)},t.onUnexpectedError=function(e){s(e)||t.errorHandler.onUnexpectedError(e)},t.onUnexpectedExternalError=function(e){s(e)||t.errorHandler.onUnexpectedExternalError(e)},
t.transformErrorForSerialization=function(e){if(e instanceof Error){let{name:t,message:s}=e;return{$isError:!0,name:t,message:s,stack:e.stacktrace||e.stack}}return e};const i="Canceled";t.isPromiseCanceledError=s,t.canceled=function(){const 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){const 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[7],t([1,0]),function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.once=function(e){const t=this;let s,n=!1;return function(){return n?s:(n=!0,
s=e.apply(t,arguments))}}}),define(e[15],t([1,0]),function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FIN={done:!0,value:void 0};var s;!function(e){function s(e,t){for(let s=e.next();!s.done;s=e.next())t(s.value)}const n={next:()=>t.FIN};e.empty=function(){return n},e.fromArray=function(e,s=0,n=e.length){return{next:()=>s>=n?t.FIN:{done:!1,value:e[s++]}}},e.from=function(t){return t?Array.isArray(t)?e.fromArray(t):t:e.empty()},e.map=function(e,s){return{next(){const n=e.next();return n.done?t.FIN:{done:!1,value:s(n.value)}}}},e.filter=function(e,s){return{next(){for(;;){const n=e.next();if(n.done)return t.FIN;if(s(n.value))return{done:!1,value:n.value}}}}},e.forEach=s,e.collect=function(e){const t=[];return s(e,e=>t.push(e)),t}}(s=t.Iterator||(t.Iterator={})),t.getSequenceIterator=function(e){return Array.isArray(e)?s.fromArray(e):e};class n{constructor(e,t=0,s=e.length,n=t-1){this.items=e,this.start=t,this.end=s,this.index=n}first(){return this.index=this.start,this.current()}
next(){return this.index=Math.min(this.index+1,this.end),this.current()}current(){return this.index===this.start-1||this.index===this.end?null:this.items[this.index]}}t.ArrayIterator=n;class i extends n{constructor(e,t=0,s=e.length,n=t-1){super(e,t,s,n)}current(){return super.current()}previous(){return this.index=Math.max(this.index-1,this.start-1),this.current()}first(){return this.index=this.start,this.current()}last(){return this.index=this.end-1,this.current()}parent(){return null}}t.ArrayNavigator=i;class r{constructor(e,t){this.iterator=e,this.fn=t}next(){return this.fn(this.iterator.next())}}t.MappedIterator=r;class o extends r{constructor(e,t){super(e,t),this.navigator=e}current(){return this.fn(this.navigator.current())}previous(){return this.fn(this.navigator.previous())}parent(){return this.fn(this.navigator.parent())}first(){return this.fn(this.navigator.first())}last(){return this.fn(this.navigator.last())}next(){return this.fn(this.navigator.next())}}t.MappedNavigator=o}),
define(e[2],t([1,0,7]),function(e,t,s){"use strict";function n(e,...t){if(Array.isArray(e))return e.forEach(e=>e&&e.dispose()),[];if(0!==t.length)return n(e),n(t),[];if(e)return e.dispose(),e}Object.defineProperty(t,"__esModule",{value:!0}),t.isDisposable=function(e){return"function"==typeof e.dispose&&0===e.dispose.length},t.dispose=n,t.combinedDisposable=function(...e){return{dispose:()=>n(e)}},t.toDisposable=function(e){return{dispose(){e()}}};class i{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed=!0,this.clear()}clear(){this._toDispose.forEach(e=>e.dispose()),this._toDispose.clear()}add(e){return this._isDisposed?(console.warn("Registering disposable on object that has already been disposed."),e.dispose()):this._toDispose.add(e),e}}t.DisposableStore=i;class r{constructor(){this._store=new i}dispose(){this._store.dispose()}_register(e){return this._store.add(e)}}r.None=Object.freeze({dispose(){}}),t.Disposable=r;class o{constructor(){this.references=Object.create(null)
}acquire(e){let t=this.references[e];t||(t=this.references[e]={counter:0,object:this.createReferencedObject(e)});const{object:n}=t,i=s.once(()=>{0==--t.counter&&(this.destroyReferencedObject(e,t.object),delete this.references[e])});return t.counter++,{object:n,dispose:i}}}t.ReferenceCollection=o;class c{constructor(e){this.object=e}dispose(){}}t.ImmortalReference=c}),define(e[16],t([1,0,15]),function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});class n{constructor(e){this.element=e,this.next=n.Undefined,this.prev=n.Undefined}}n.Undefined=new n(void 0);class i{constructor(){this._first=n.Undefined,this._last=n.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===n.Undefined}clear(){this._first=n.Undefined,this._last=n.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){const s=new n(e);if(this._first===n.Undefined)this._first=s,this._last=s;else if(t){const e=this._last;this._last=s,s.prev=e,e.next=s
}else{const e=this._first;this._first=s,s.next=e,e.prev=s}this._size+=1;let i=!1;return()=>{i||(i=!0,this._remove(s))}}shift(){if(this._first!==n.Undefined){const e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==n.Undefined){const e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==n.Undefined&&e.next!==n.Undefined){const t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===n.Undefined&&e.next===n.Undefined?(this._first=n.Undefined,this._last=n.Undefined):e.next===n.Undefined?(this._last=this._last.prev,this._last.next=n.Undefined):e.prev===n.Undefined&&(this._first=this._first.next,this._first.prev=n.Undefined);this._size-=1}iterator(){let e,t=this._first;return{next:()=>t===n.Undefined?s.FIN:(e?e.value=t.element:e={done:!1,value:t.element},t=t.next,e)}}toArray(){const e=[];for(let t=this._first;t!==n.Undefined;t=t.next)e.push(t.element);return e}}t.LinkedList=i});var s=this&&this.__awaiter||function(e,t,s,n){return new(s||(s=Promise))(function(i,r){
function o(e){try{a(n.next(e))}catch(e){r(e)}}function c(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){e.done?i(e.value):new s(function(t){t(e.value)}).then(o,c)}a((n=n.apply(e,t||[])).next())})};define(e[3],t([1,0,5,7,2,16]),function(e,t,n,i,r,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var c;!function(e){function t(e){return(t,s=null,n)=>{let i,r=!1;return i=e(e=>{if(!r)return i?i.dispose():r=!0,t.call(s,e)},null,n),r&&i.dispose(),i}}function s(e,t){return c((s,n=null,i)=>e(e=>s.call(n,t(e)),null,i))}function n(e,t){return c((s,n=null,i)=>e(e=>{t(e),s.call(n,e)},null,i))}function i(e,t){return c((s,n=null,i)=>e(e=>t(e)&&s.call(n,e),null,i))}function o(e,t,n){let i=n;return s(e,e=>i=t(i,e))}function c(e){let t;const s=new l({onFirstListenerAdd(){t=e(s.fire,s)},onLastListenerRemove(){t.dispose()}});return s.event}function a(e){let t,s=!0;return i(e,e=>{const n=s||e!==t;return s=!1,t=e,n})}const h={dispose(){}};e.None=function(){return h},e.once=t,e.map=s,e.forEach=n,e.filter=i,
e.signal=function(e){return e},e.any=function(...e){return(t,s=null,n)=>r.combinedDisposable(...e.map(e=>e(e=>t.call(s,e),null,n)))},e.reduce=o,e.snapshot=c,e.debounce=function(e,t,s=100,n=!1,i){let r,o=void 0,c=void 0,a=0;const h=new l({leakWarningThreshold:i,onFirstListenerAdd(){r=e(e=>{a++,o=t(o,e),n&&!c&&h.fire(o),clearTimeout(c),c=setTimeout(()=>{const e=o;o=void 0,c=void 0,(!n||a>1)&&h.fire(e),a=0},s)})},onLastListenerRemove(){r.dispose()}});return h.event},e.stopwatch=function(e){const n=(new Date).getTime();return s(t(e),e=>(new Date).getTime()-n)},e.latch=a,e.buffer=function(e,t=!1,s=[]){let n=s.slice(),i=e(e=>{n?n.push(e):o.fire(e)});const r=()=>{n&&n.forEach(e=>o.fire(e)),n=null},o=new l({onFirstListenerAdd(){i||(i=e(e=>o.fire(e)))},onFirstListenerDidAdd(){n&&(t?setTimeout(r):r())},onLastListenerRemove(){i&&i.dispose(),i=null}});return o.event};class u{constructor(e){this.event=e}map(e){return new u(s(this.event,e))}forEach(e){return new u(n(this.event,e))}filter(e){return new u(i(this.event,e))}
reduce(e,t){return new u(o(this.event,e,t))}latch(){return new u(a(this.event))}on(e,t,s){return this.event(e,t,s)}once(e,s,n){return t(this.event)(e,s,n)}}e.chain=function(e){return new u(e)},e.fromNodeEventEmitter=function(e,t,s=(e=>e)){const n=(...e)=>i.fire(s(...e)),i=new l({onFirstListenerAdd:()=>e.on(t,n),onLastListenerRemove:()=>e.removeListener(t,n)});return i.event},e.fromPromise=function(e){const t=new l;let s=!1;return e.then(void 0,()=>null).then(()=>{s?t.fire(void 0):setTimeout(()=>t.fire(void 0),0)}),s=!0,t.event},e.toPromise=function(e){return new Promise(s=>t(e)(s))}}(c=t.Event||(t.Event={}));let a=-1;t.setGlobalLeakWarningThreshold=function(e){const t=a;return a=e,{dispose(){a=t}}};class h{constructor(e,t=Math.random().toString(18).slice(2,5)){this.customThreshold=e,this.name=t,this._warnCountdown=0}dispose(){this._stacks&&this._stacks.clear()}check(e){let t=a;if("number"==typeof this.customThreshold&&(t=this.customThreshold),t<=0||e<t)return;this._stacks||(this._stacks=new Map)
;const s=(new Error).stack.split("\n").slice(3).join("\n"),n=this._stacks.get(s)||0;if(this._stacks.set(s,n+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=.5*t;let s,n=0;this._stacks.forEach((e,t)=>{(!s||n<e)&&(s=t,n=e)}),console.warn(`[${this.name}] potential listener LEAK detected, having ${e} listeners already. MOST frequent listener (${n}):`),console.warn(s)}return()=>{const e=this._stacks.get(s)||0;this._stacks.set(s,e-1)}}}class l{constructor(e){this._disposed=!1,this._options=e,this._leakageMon=a>0?new h(this._options&&this._options.leakWarningThreshold):void 0}get event(){return this._event||(this._event=((e,t,s)=>{this._listeners||(this._listeners=new o.LinkedList);const n=this._listeners.isEmpty();n&&this._options&&this._options.onFirstListenerAdd&&this._options.onFirstListenerAdd(this);const i=this._listeners.push(t?[e,t]:e);n&&this._options&&this._options.onFirstListenerDidAdd&&this._options.onFirstListenerDidAdd(this),
this._options&&this._options.onListenerDidAdd&&this._options.onListenerDidAdd(this,e,t);let r;this._leakageMon&&(r=this._leakageMon.check(this._listeners.size));let c;return c={dispose:()=>{if(r&&r(),c.dispose=l._noop,!this._disposed&&(i(),this._options&&this._options.onLastListenerRemove)){this._listeners&&!this._listeners.isEmpty()||this._options.onLastListenerRemove(this)}}},Array.isArray(s)&&s.push(c),c})),this._event}fire(e){if(this._listeners){this._deliveryQueue||(this._deliveryQueue=new o.LinkedList);for(let t=this._listeners.iterator(),s=t.next();!s.done;s=t.next())this._deliveryQueue.push([s.value,e]);for(;this._deliveryQueue.size>0;){const[e,t]=this._deliveryQueue.shift();try{"function"==typeof e?e.call(void 0,t):e[0].call(e[1],t)}catch(e){n.onUnexpectedError(e)}}}}dispose(){this._listeners&&this._listeners.clear(),this._deliveryQueue&&this._deliveryQueue.clear(),this._leakageMon&&this._leakageMon.dispose(),this._disposed=!0}}l._noop=function(){},t.Emitter=l;class u extends l{constructor(e){
super(e),this._isPaused=0,this._eventQueue=new o.LinkedList,this._mergeFn=e&&e.merge}pause(){this._isPaused++}resume(){if(0!==this._isPaused&&0==--this._isPaused)if(this._mergeFn){const e=this._eventQueue.toArray();this._eventQueue.clear(),super.fire(this._mergeFn(e))}else for(;!this._isPaused&&0!==this._eventQueue.size;)super.fire(this._eventQueue.shift())}fire(e){this._listeners&&(0!==this._isPaused?this._eventQueue.push(e):super.fire(e))}}t.PauseableEmitter=u;class d extends l{fireAsync(e){return s(this,void 0,void 0,function*(){if(this._listeners){this._asyncDeliveryQueue||(this._asyncDeliveryQueue=[]);for(let t=this._listeners.iterator(),s=t.next();!s.done;s=t.next()){const t=[];this._asyncDeliveryQueue.push([s.value,e(t,"function"==typeof s.value?s.value:s.value[0]),t])}for(;this._asyncDeliveryQueue.length>0;){const[e,t,s]=this._asyncDeliveryQueue.shift();try{"function"==typeof e?e.call(void 0,t):e[0].call(e[1],t)}catch(e){n.onUnexpectedError(e);continue}Object.freeze(s),yield Promise.all(s)}}})}}
t.AsyncEmitter=d;class f{constructor(){this.hasListeners=!1,this.events=[],this.emitter=new l({onFirstListenerAdd:()=>this.onFirstListenerAdd(),onLastListenerRemove:()=>this.onLastListenerRemove()})}get event(){return this.emitter.event}add(e){const t={event:e,listener:null};this.events.push(t),this.hasListeners&&this.hook(t);return r.toDisposable(i.once(()=>{this.hasListeners&&this.unhook(t);const e=this.events.indexOf(t);this.events.splice(e,1)}))}onFirstListenerAdd(){this.hasListeners=!0,this.events.forEach(e=>this.hook(e))}onLastListenerRemove(){this.hasListeners=!1,this.events.forEach(e=>this.unhook(e))}hook(e){e.listener=e.event(e=>this.emitter.fire(e))}unhook(e){e.listener&&e.listener.dispose(),e.listener=null}dispose(){this.emitter.dispose()}}t.EventMultiplexer=f;class p{constructor(){this.buffers=[]}wrapEvent(e){return(t,s,n)=>e(e=>{const n=this.buffers[this.buffers.length-1];n?n.push(()=>t.call(s,e)):t.call(s,e)},void 0,n)}bufferEvents(e){const t=[];this.buffers.push(t);const s=e()
;return this.buffers.pop(),t.forEach(e=>e()),s}}t.EventBufferer=p;class m{constructor(){this.listening=!1,this.inputEvent=c.None,this.inputEventListener=r.Disposable.None,this.emitter=new l({onFirstListenerDidAdd:()=>{this.listening=!0,this.inputEventListener=this.inputEvent(this.emitter.fire,this.emitter)},onLastListenerRemove:()=>{this.listening=!1,this.inputEventListener.dispose()}}),this.event=this.emitter.event}set input(e){this.inputEvent=e,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=e(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}}t.Relay=m}),define(e[9],t([1,0,3]),function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=Object.freeze(function(e,t){const s=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(s)}}});var i;!function(e){e.isCancellationToken=function(t){
return t===e.None||t===e.Cancelled||t instanceof r||!(!t||"object"!=typeof t)&&"boolean"==typeof t.isCancellationRequested&&"function"==typeof t.onCancellationRequested},e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:s.Event.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:n})}(i=t.CancellationToken||(t.CancellationToken={}));class r{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?n:(this._emitter||(this._emitter=new s.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}}class o{constructor(e){this._token=void 0,this._parentListener=void 0,this._parentListener=e&&e.onCancellationRequested(this.cancel,this)}get token(){return this._token||(this._token=new r),this._token}cancel(){
this._token?this._token instanceof r&&this._token.cancel():this._token=i.Cancelled}dispose(){this._parentListener&&this._parentListener.dispose(),this._token?this._token instanceof r&&this._token.dispose():this._token=i.None}}t.CancellationTokenSource=o}),define(e[11],t([1,0,9,5,3,2]),function(e,t,n,i,r,o){"use strict";function c(e){return e&&"function"==typeof e.then}function a(e){const t=new n.CancellationTokenSource,s=e(t.token),r=new Promise((e,n)=>{t.token.onCancellationRequested(()=>{n(i.canceled())}),Promise.resolve(s).then(s=>{t.dispose(),e(s)},e=>{t.dispose(),n(e)})});return new class{cancel(){t.cancel()}then(e,t){return r.then(e,t)}catch(e){return this.then(void 0,e)}finally(e){return r.finally(e)}}}function h(e,t){return t?new Promise((s,n)=>{const r=setTimeout(s,e);t.onCancellationRequested(()=>{clearTimeout(r),n(i.canceled())})}):a(t=>h(e,t))}function l(e){function t(r){void 0!==r&&null!==r&&s.push(r);const o=n<i?e[n++]():null;return o?o.then(t):Promise.resolve(s)}const s=[];let n=0
;const i=e.length;return Promise.resolve(null).then(t)}Object.defineProperty(t,"__esModule",{value:!0}),t.isThenable=c,t.createCancelablePromise=a,t.raceCancellation=function(e,t,s){return Promise.race([e,new Promise(e=>t.onCancellationRequested(()=>e(s)))])},t.asPromise=function(e){return new Promise((t,s)=>{const n=e();c(n)?n.then(t,s):t(n)})};class u{constructor(){this.activePromise=null,this.queuedPromise=null,this.queuedPromiseFactory=null}queue(e){if(this.activePromise){if(this.queuedPromiseFactory=e,!this.queuedPromise){const e=()=>{this.queuedPromise=null;const e=this.queue(this.queuedPromiseFactory);return this.queuedPromiseFactory=null,e};this.queuedPromise=new Promise(t=>{this.activePromise.then(e,e).then(t)})}return new Promise((e,t)=>{this.queuedPromise.then(e,t)})}return this.activePromise=e(),new Promise((e,t)=>{this.activePromise.then(t=>{this.activePromise=null,e(t)},e=>{this.activePromise=null,t(e)})})}}t.Throttler=u;class d{constructor(){this.current=Promise.resolve(null)}queue(e){
return this.current=this.current.then(()=>e())}}t.Sequencer=d;class f{constructor(e){this.defaultDelay=e,this.timeout=null,this.completionPromise=null,this.doResolve=null,this.task=null}trigger(e,t=this.defaultDelay){return this.task=e,this.cancelTimeout(),this.completionPromise||(this.completionPromise=new Promise((e,t)=>{this.doResolve=e,this.doReject=t}).then(()=>{this.completionPromise=null,this.doResolve=null;const e=this.task;return this.task=null,e()})),this.timeout=setTimeout(()=>{this.timeout=null,this.doResolve(null)},t),this.completionPromise}isTriggered(){return null!==this.timeout}cancel(){this.cancelTimeout(),this.completionPromise&&(this.doReject(i.canceled()),this.completionPromise=null)}cancelTimeout(){null!==this.timeout&&(clearTimeout(this.timeout),this.timeout=null)}dispose(){this.cancelTimeout()}}t.Delayer=f;class p{constructor(e){this.delayer=new f(e),this.throttler=new u}trigger(e,t){return this.delayer.trigger(()=>this.throttler.queue(e),t)}isTriggered(){
return this.delayer.isTriggered()}cancel(){this.delayer.cancel()}dispose(){this.delayer.dispose()}}t.ThrottledDelayer=p;class m{constructor(){this._isOpen=!1,this._promise=new Promise((e,t)=>{this._completePromise=e})}isOpen(){return this._isOpen}open(){this._isOpen=!0,this._completePromise(!0)}wait(){return this._promise}}t.Barrier=m,t.timeout=h,t.disposableTimeout=function(e,t=0){const s=setTimeout(e,t);return o.toDisposable(()=>clearTimeout(s))},t.ignoreErrors=function(e){return e.then(void 0,e=>void 0)},t.sequence=l,t.first=function(e,t=(e=>!!e),s=null){let n=0;const i=e.length,r=()=>{if(n>=i)return Promise.resolve(s);const o=e[n++];return Promise.resolve(o()).then(e=>t(e)?Promise.resolve(e):r())};return r()};class g{constructor(e){this._size=0,this.maxDegreeOfParalellism=e,this.outstandingPromises=[],this.runningPromises=0,this._onFinished=new r.Emitter}get onFinished(){return this._onFinished.event}get size(){return this._size}queue(e){return this._size++,new Promise((t,s)=>{
this.outstandingPromises.push({factory:e,c:t,e:s}),this.consume()})}consume(){for(;this.outstandingPromises.length&&this.runningPromises<this.maxDegreeOfParalellism;){const e=this.outstandingPromises.shift();this.runningPromises++;const t=e.factory();t.then(e.c,e.e),t.then(()=>this.consumed(),()=>this.consumed())}}consumed(){this._size--,this.runningPromises--,this.outstandingPromises.length>0?this.consume():this._onFinished.fire()}dispose(){this._onFinished.dispose()}}t.Limiter=g;class _ extends g{constructor(){super(1)}}t.Queue=_;class v{constructor(){this.queues=Object.create(null)}queueFor(e){const t=e.toString();if(!this.queues[t]){const e=new _;e.onFinished(()=>{e.dispose(),delete this.queues[t]}),this.queues[t]=e}return this.queues[t]}}t.ResourceQueue=v;class w extends o.Disposable{constructor(e,t){super(),this._token=-1,"function"==typeof e&&"number"==typeof t&&this.setIfNotSet(e,t)}dispose(){this.cancel(),super.dispose()}cancel(){-1!==this._token&&(clearTimeout(this._token),this._token=-1)}
cancelAndSet(e,t){this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){-1===this._token&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}}t.TimeoutTimer=w;class k extends o.Disposable{constructor(){super(),this._token=-1}dispose(){this.cancel(),super.dispose()}cancel(){-1!==this._token&&(clearInterval(this._token),this._token=-1)}cancelAndSet(e,t){this.cancel(),this._token=setInterval(()=>{e()},t)}}t.IntervalTimer=k;class b{constructor(e,t){this.timeoutToken=-1,this.runner=e,this.timeout=t,this.timeoutHandler=this.onTimeout.bind(this)}dispose(){this.cancel(),this.runner=null}cancel(){this.isScheduled()&&(clearTimeout(this.timeoutToken),this.timeoutToken=-1)}schedule(e=this.timeout){this.cancel(),this.timeoutToken=setTimeout(this.timeoutHandler,e)}isScheduled(){return-1!==this.timeoutToken}onTimeout(){this.timeoutToken=-1,this.runner&&this.doRun()}doRun(){this.runner&&this.runner()}}t.RunOnceScheduler=b;class C extends b{constructor(e,t){super(e,t),this.units=[]}work(e){
this.units.push(e),this.isScheduled()||this.schedule()}doRun(){const e=this.units;this.units=[],this.runner&&this.runner(e)}dispose(){this.units=[],super.dispose()}}t.RunOnceWorker=C,function(){if("function"!=typeof requestIdleCallback||"function"!=typeof cancelIdleCallback){const e=Object.freeze({didTimeout:!0,timeRemaining:()=>15});t.runWhenIdle=(t=>{const s=setTimeout(()=>t(e));let n=!1;return{dispose(){n||(n=!0,clearTimeout(s))}}})}else t.runWhenIdle=((e,t)=>{const s=requestIdleCallback(e,"number"==typeof t?{timeout:t}:void 0);let n=!1;return{dispose(){n||(n=!0,cancelIdleCallback(s))}}})}();class y{constructor(e){this._didRun=!1,this._executor=(()=>{try{this._value=e()}catch(e){this._error=e}finally{this._didRun=!0}}),this._handle=t.runWhenIdle(()=>this._executor())}dispose(){this._handle.dispose()}getValue(){if(this._didRun||(this._handle.dispose(),this._executor()),this._error)throw this._error;return this._value}}t.IdleValue=y,t.retry=function(e,t,n){return s(this,void 0,void 0,function*(){let s
;for(let i=0;i<n;i++)try{return yield e()}catch(e){s=e,yield h(t)}return Promise.reject(s)})}}),define(e[6],t([1,0]),function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=!1,n=!1,i=!1,r=!1,o=!1,c=void 0,a="en",h=void 0;const l="undefined"!=typeof process&&void 0!==process.versions&&void 0!==process.versions.electron&&"renderer"===process.type;if("object"!=typeof navigator||l){if("object"==typeof process){s="win32"===process.platform,n="darwin"===process.platform,i="linux"===process.platform,c="en",a="en";const e=process.env.VSCODE_NLS_CONFIG;if(e)try{const t=JSON.parse(e),s=t.availableLanguages["*"];c=t.locale,a=s||"en",h=t._translationsConfigFile}catch(e){}r=!0}}else{const e=navigator.userAgent;s=e.indexOf("Windows")>=0,n=e.indexOf("Macintosh")>=0,i=e.indexOf("Linux")>=0,o=!0,a=c=navigator.language}!function(e){e[e.Web=0]="Web",e[e.Mac=1]="Mac",e[e.Linux=2]="Linux",e[e.Windows=3]="Windows"}(t.Platform||(t.Platform={})),t.PlatformToString=function(e){switch(e){case 0:return"Web"
;case 1:return"Mac";case 2:return"Linux";case 3:return"Windows"}};let u=0;r&&(n?u=1:s?u=3:i&&(u=2)),t.isWindows=s,t.isMacintosh=n,t.isLinux=i,t.isNative=r,t.isWeb=o,t.platform=u,t.isRootUser=function(){return r&&!s&&0===process.getuid()},t.language=a;!function(e){e.value=function(){return t.language},e.isDefaultVariant=function(){return 2===t.language.length?"en"===t.language:t.language.length>=3&&"e"===t.language[0]&&"n"===t.language[1]&&"-"===t.language[2]},e.isDefault=function(){return"en"===t.language}}(t.Language||(t.Language={})),t.locale=c,t.translationsConfigFile=h;const d="object"==typeof self?self:"object"==typeof global?global:{};t.globals=d;let f=null;t.setImmediate=function(e){return null===f&&(f=t.globals.setImmediate?t.globals.setImmediate.bind(t.globals):"undefined"!=typeof process&&"function"==typeof process.nextTick?process.nextTick.bind(process):t.globals.setTimeout.bind(t.globals)),f(e)};!function(e){e[e.Windows=1]="Windows",e[e.Macintosh=2]="Macintosh",e[e.Linux=3]="Linux"
}(t.OperatingSystem||(t.OperatingSystem={})),t.OS=n?2:s?1:3}),define(e[12],t([1,0,6]),function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n="undefined"==typeof process?{cwd:()=>"/",env:Object.create(null),get platform(){return s.isWindows?"win32":s.isMacintosh?"darwin":"linux"},nextTick:e=>s.setImmediate(e)}:process;t.cwd=n.cwd,t.env=n.env,t.platform=n.platform,t.nextTick=n.nextTick}),define(e[13],t([1,0,12]),function(e,t,s){"use strict";function n(e,t){if("string"!=typeof e)throw new g(t,"string",e)}function i(e){return e===p||e===m}function r(e){return e===p}function o(e){return e>=h&&e<=u||e>=l&&e<=d}function c(e,t,s,n){let i,r="",o=0,c=-1,a=0;for(let h=0;h<=e.length;++h){if(h<e.length)i=e.charCodeAt(h);else{if(n(i))break;i=p}if(n(i)){if(c===h-1||1===a);else if(c!==h-1&&2===a){if(r.length<2||2!==o||r.charCodeAt(r.length-1)!==f||r.charCodeAt(r.length-2)!==f){if(r.length>2){const e=r.lastIndexOf(s);-1===e?(r="",o=0):o=(r=r.slice(0,e)).length-1-r.lastIndexOf(s),c=h,a=0;continue
}if(2===r.length||1===r.length){r="",o=0,c=h,a=0;continue}}t&&(r.length>0?r+=`${s}..`:r="..",o=2)}else r.length>0?r+=s+e.slice(c+1,h):r=e.slice(c+1,h),o=h-c-1;c=h,a=0}else i===f&&-1!==a?++a:a=-1}return r}function a(e,t){const s=t.dir||t.root,n=t.base||(t.name||"")+(t.ext||"");return s?s===t.root?s+n:s+e+n:n}Object.defineProperty(t,"__esModule",{value:!0});const h=65,l=97,u=90,d=122,f=46,p=47,m=92;class g extends Error{constructor(e,t,s){let n;"string"==typeof t&&0===t.indexOf("not ")?(n="must not be",t=t.replace(/^not /,"")):n="must be";let i=`The "${e}" ${-1!==e.indexOf(".")?"property":"argument"} ${n} of type ${t}`;super(i+=`. Received type ${typeof s}`)}}t.win32={resolve(...e){let t="",r="",a=!1;for(let c=e.length-1;c>=-1;c--){let h;if(c>=0?h=e[c]:t?void 0!==(h=s.env["="+t]||s.cwd())&&h.slice(0,3).toLowerCase()===t.toLowerCase()+"\\"||(h=t+"\\"):h=s.cwd(),n(h,"path"),0===h.length)continue;const l=h.length;let u=0,d="",f=!1;const p=h.charCodeAt(0);if(l>1)if(i(p))if(f=!0,i(h.charCodeAt(1))){let e=2,t=e
;for(;e<l&&!i(h.charCodeAt(e));++e);if(e<l&&e!==t){const s=h.slice(t,e);for(t=e;e<l&&i(h.charCodeAt(e));++e);if(e<l&&e!==t){for(t=e;e<l&&!i(h.charCodeAt(e));++e);e===l?(d="\\\\"+s+"\\"+h.slice(t),u=e):e!==t&&(d="\\\\"+s+"\\"+h.slice(t,e),u=e)}}}else u=1;else o(p)&&58===h.charCodeAt(1)&&(d=h.slice(0,2),u=2,l>2&&i(h.charCodeAt(2))&&(f=!0,u=3));else i(p)&&(u=1,f=!0);if(!(d.length>0&&t.length>0&&d.toLowerCase()!==t.toLowerCase())&&(0===t.length&&d.length>0&&(t=d),a||(r=h.slice(u)+"\\"+r,a=f),t.length>0&&a))break}return r=c(r,!a,"\\",i),t+(a?"\\":"")+r||"."},normalize(e){n(e,"path");const t=e.length;if(0===t)return".";let s,r=0,a=!1;const h=e.charCodeAt(0);if(t>1)if(i(h))if(a=!0,i(e.charCodeAt(1))){let n=2,o=n;for(;n<t&&!i(e.charCodeAt(n));++n);if(n<t&&n!==o){const c=e.slice(o,n);for(o=n;n<t&&i(e.charCodeAt(n));++n);if(n<t&&n!==o){for(o=n;n<t&&!i(e.charCodeAt(n));++n);if(n===t)return"\\\\"+c+"\\"+e.slice(o)+"\\";n!==o&&(s="\\\\"+c+"\\"+e.slice(o,n),r=n)}}}else r=1;else o(h)&&58===e.charCodeAt(1)&&(s=e.slice(0,2),
r=2,t>2&&i(e.charCodeAt(2))&&(a=!0,r=3));else if(i(h))return"\\";let l;return 0!==(l=r<t?c(e.slice(r),!a,"\\",i):"").length||a||(l="."),l.length>0&&i(e.charCodeAt(t-1))&&(l+="\\"),void 0===s?a?l.length>0?"\\"+l:"\\":l.length>0?l:"":a?l.length>0?s+"\\"+l:s+"\\":l.length>0?s+l:s},isAbsolute(e){n(e,"path");const t=e.length;if(0===t)return!1;const s=e.charCodeAt(0);return!!i(s)||!!(o(s)&&t>2&&58===e.charCodeAt(1)&&i(e.charCodeAt(2)))},join(...e){if(0===e.length)return".";let s,r;for(let t=0;t<e.length;++t){const i=e[t];n(i,"path"),i.length>0&&(void 0===s?s=r=i:s+="\\"+i)}if(void 0===s)return".";let o=!0,c=0;if("string"==typeof r&&i(r.charCodeAt(0))){++c;const e=r.length;e>1&&i(r.charCodeAt(1))&&(++c,e>2&&(i(r.charCodeAt(2))?++c:o=!1))}if(o){for(;c<s.length&&i(s.charCodeAt(c));++c);c>=2&&(s="\\"+s.slice(c))}return t.win32.normalize(s)},relative(e,s){if(n(e,"from"),n(s,"to"),e===s)return"";const i=t.win32.resolve(e),r=t.win32.resolve(s);if(i===r)return"";if(e=i.toLowerCase(),s=r.toLowerCase(),e===s)return"";let o=0
;for(;o<e.length&&e.charCodeAt(o)===m;++o);let c=e.length;for(;c-1>o&&e.charCodeAt(c-1)===m;--c);const a=c-o;let h=0;for(;h<s.length&&s.charCodeAt(h)===m;++h);let l=s.length;for(;l-1>h&&s.charCodeAt(l-1)===m;--l);const u=l-h,d=a<u?a:u;let f=-1,p=0;for(;p<=d;++p){if(p===d){if(u>d){if(s.charCodeAt(h+p)===m)return r.slice(h+p+1);if(2===p)return r.slice(h+p)}a>d&&(e.charCodeAt(o+p)===m?f=p:2===p&&(f=3));break}const t=e.charCodeAt(o+p);if(t!==s.charCodeAt(h+p))break;t===m&&(f=p)}if(p!==d&&-1===f)return r;let g="";for(-1===f&&(f=0),p=o+f+1;p<=c;++p)p!==c&&e.charCodeAt(p)!==m||(0===g.length?g+="..":g+="\\..");return g.length>0?g+r.slice(h+f,l):(h+=f,r.charCodeAt(h)===m&&++h,r.slice(h,l))},toNamespacedPath(e){if("string"!=typeof e)return e;if(0===e.length)return"";const s=t.win32.resolve(e);if(s.length>=3)if(s.charCodeAt(0)===m){if(s.charCodeAt(1)===m){const e=s.charCodeAt(2);if(63!==e&&e!==f)return"\\\\?\\UNC\\"+s.slice(2)}}else if(o(s.charCodeAt(0))&&58===s.charCodeAt(1)&&s.charCodeAt(2)===m)return"\\\\?\\"+s
;return e},dirname(e){n(e,"path");const t=e.length;if(0===t)return".";let s=-1,r=-1,c=!0,a=0;const h=e.charCodeAt(0);if(t>1)if(i(h)){if(s=a=1,i(e.charCodeAt(1))){let n=2,r=n;for(;n<t&&!i(e.charCodeAt(n));++n);if(n<t&&n!==r){for(r=n;n<t&&i(e.charCodeAt(n));++n);if(n<t&&n!==r){for(r=n;n<t&&!i(e.charCodeAt(n));++n);if(n===t)return e;n!==r&&(s=a=n+1)}}}}else o(h)&&58===e.charCodeAt(1)&&(s=a=2,t>2&&i(e.charCodeAt(2))&&(s=a=3));else if(i(h))return e;for(let s=t-1;s>=a;--s)if(i(e.charCodeAt(s))){if(!c){r=s;break}}else c=!1;if(-1===r){if(-1===s)return".";r=s}return e.slice(0,r)},basename(e,t){void 0!==t&&n(t,"ext"),n(e,"path");let s,r=0,c=-1,a=!0;if(e.length>=2){o(e.charCodeAt(0))&&58===e.charCodeAt(1)&&(r=2)}if(void 0!==t&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";let n=t.length-1,o=-1;for(s=e.length-1;s>=r;--s){const h=e.charCodeAt(s);if(i(h)){if(!a){r=s+1;break}}else-1===o&&(a=!1,o=s+1),n>=0&&(h===t.charCodeAt(n)?-1==--n&&(c=s):(n=-1,c=o))}return r===c?c=o:-1===c&&(c=e.length),
e.slice(r,c)}for(s=e.length-1;s>=r;--s)if(i(e.charCodeAt(s))){if(!a){r=s+1;break}}else-1===c&&(a=!1,c=s+1);return-1===c?"":e.slice(r,c)},extname(e){n(e,"path");let t=0,s=-1,r=0,c=-1,a=!0,h=0;e.length>=2&&58===e.charCodeAt(1)&&o(e.charCodeAt(0))&&(t=r=2);for(let n=e.length-1;n>=t;--n){const t=e.charCodeAt(n);if(i(t)){if(!a){r=n+1;break}}else-1===c&&(a=!1,c=n+1),t===f?-1===s?s=n:1!==h&&(h=1):-1!==s&&(h=-1)}return-1===s||-1===c||0===h||1===h&&s===c-1&&s===r+1?"":e.slice(s,c)},format(e){if(null===e||"object"!=typeof e)throw new g("pathObject","Object",e);return a("\\",e)},parse(e){n(e,"path");const t={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return t;const s=e.length;let r=0,c=e.charCodeAt(0);if(s>1){if(i(c)){if(r=1,i(e.charCodeAt(1))){let t=2,n=t;for(;t<s&&!i(e.charCodeAt(t));++t);if(t<s&&t!==n){for(n=t;t<s&&i(e.charCodeAt(t));++t);if(t<s&&t!==n){for(n=t;t<s&&!i(e.charCodeAt(t));++t);t===s?r=t:t!==n&&(r=t+1)}}}}else if(o(c)&&58===e.charCodeAt(1)){if(r=2,!(s>2))return t.root=t.dir=e,t
;if(i(e.charCodeAt(2))){if(3===s)return t.root=t.dir=e,t;r=3}}}else if(i(c))return t.root=t.dir=e,t;r>0&&(t.root=e.slice(0,r));let a=-1,h=r,l=-1,u=!0,d=e.length-1,p=0;for(;d>=r;--d)if(c=e.charCodeAt(d),i(c)){if(!u){h=d+1;break}}else-1===l&&(u=!1,l=d+1),c===f?-1===a?a=d:1!==p&&(p=1):-1!==a&&(p=-1);return-1===a||-1===l||0===p||1===p&&a===l-1&&a===h+1?-1!==l&&(t.base=t.name=e.slice(h,l)):(t.name=e.slice(h,a),t.base=e.slice(h,l),t.ext=e.slice(a,l)),t.dir=h>0&&h!==r?e.slice(0,h-1):t.root,t},sep:"\\",delimiter:";",win32:null,posix:null},t.posix={resolve(...e){let t="",i=!1;for(let r=e.length-1;r>=-1&&!i;r--){let o;n(o=r>=0?e[r]:s.cwd(),"path"),0!==o.length&&(t=o+"/"+t,i=o.charCodeAt(0)===p)}return t=c(t,!i,"/",r),i?t.length>0?"/"+t:"/":t.length>0?t:"."},normalize(e){if(n(e,"path"),0===e.length)return".";const t=e.charCodeAt(0)===p,s=e.charCodeAt(e.length-1)===p;return 0!==(e=c(e,!t,"/",r)).length||t||(e="."),e.length>0&&s&&(e+="/"),t?"/"+e:e},isAbsolute:e=>(n(e,"path"),e.length>0&&e.charCodeAt(0)===p),join(...e){
if(0===e.length)return".";let s;for(let t=0;t<e.length;++t){const e=arguments[t];n(e,"path"),e.length>0&&(void 0===s?s=e:s+="/"+e)}return void 0===s?".":t.posix.normalize(s)},relative(e,s){if(n(e,"from"),n(s,"to"),e===s)return"";if(e=t.posix.resolve(e),s=t.posix.resolve(s),e===s)return"";let i=1;for(;i<e.length&&e.charCodeAt(i)===p;++i);const r=e.length,o=r-i;let c=1;for(;c<s.length&&s.charCodeAt(c)===p;++c);const a=s.length-c,h=o<a?o:a;let l=-1,u=0;for(;u<=h;++u){if(u===h){if(a>h){if(s.charCodeAt(c+u)===p)return s.slice(c+u+1);if(0===u)return s.slice(c+u)}else o>h&&(e.charCodeAt(i+u)===p?l=u:0===u&&(l=0));break}const t=e.charCodeAt(i+u);if(t!==s.charCodeAt(c+u))break;t===p&&(l=u)}let d="";for(u=i+l+1;u<=r;++u)u!==r&&e.charCodeAt(u)!==p||(0===d.length?d+="..":d+="/..");return d.length>0?d+s.slice(c+l):(c+=l,s.charCodeAt(c)===p&&++c,s.slice(c))},toNamespacedPath:e=>e,dirname(e){if(n(e,"path"),0===e.length)return".";const t=e.charCodeAt(0)===p;let s=-1,i=!0;for(let t=e.length-1;t>=1;--t)if(e.charCodeAt(t)===p){
if(!i){s=t;break}}else i=!1;return-1===s?t?"/":".":t&&1===s?"//":e.slice(0,s)},basename(e,t){void 0!==t&&n(t,"ext"),n(e,"path");let s,i=0,r=-1,o=!0;if(void 0!==t&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";let n=t.length-1,c=-1;for(s=e.length-1;s>=0;--s){const a=e.charCodeAt(s);if(a===p){if(!o){i=s+1;break}}else-1===c&&(o=!1,c=s+1),n>=0&&(a===t.charCodeAt(n)?-1==--n&&(r=s):(n=-1,r=c))}return i===r?r=c:-1===r&&(r=e.length),e.slice(i,r)}for(s=e.length-1;s>=0;--s)if(e.charCodeAt(s)===p){if(!o){i=s+1;break}}else-1===r&&(o=!1,r=s+1);return-1===r?"":e.slice(i,r)},extname(e){n(e,"path");let t=-1,s=0,i=-1,r=!0,o=0;for(let n=e.length-1;n>=0;--n){const c=e.charCodeAt(n);if(c!==p)-1===i&&(r=!1,i=n+1),c===f?-1===t?t=n:1!==o&&(o=1):-1!==t&&(o=-1);else if(!r){s=n+1;break}}return-1===t||-1===i||0===o||1===o&&t===i-1&&t===s+1?"":e.slice(t,i)},format(e){if(null===e||"object"!=typeof e)throw new g("pathObject","Object",e);return a("/",e)},parse(e){n(e,"path");const t={root:"",dir:"",base:"",ext:"",
name:""};if(0===e.length)return t;const s=e.charCodeAt(0)===p;let i;s?(t.root="/",i=1):i=0;let r=-1,o=0,c=-1,a=!0,h=e.length-1,l=0;for(;h>=i;--h){const t=e.charCodeAt(h);if(t!==p)-1===c&&(a=!1,c=h+1),t===f?-1===r?r=h:1!==l&&(l=1):-1!==r&&(l=-1);else if(!a){o=h+1;break}}return-1===r||-1===c||0===l||1===l&&r===c-1&&r===o+1?-1!==c&&(t.base=t.name=0===o&&s?e.slice(1,c):e.slice(o,c)):(0===o&&s?(t.name=e.slice(1,r),t.base=e.slice(1,c)):(t.name=e.slice(o,r),t.base=e.slice(o,c)),t.ext=e.slice(r,c)),o>0?t.dir=e.slice(0,o-1):s&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null},t.posix.win32=t.win32.win32=t.win32,t.posix.posix=t.win32.posix=t.posix,t.normalize="win32"===s.platform?t.win32.normalize:t.posix.normalize,t.isAbsolute="win32"===s.platform?t.win32.isAbsolute:t.posix.isAbsolute,t.join="win32"===s.platform?t.win32.join:t.posix.join,t.resolve="win32"===s.platform?t.win32.resolve:t.posix.resolve,t.relative="win32"===s.platform?t.win32.relative:t.posix.relative,
t.dirname="win32"===s.platform?t.win32.dirname:t.posix.dirname,t.basename="win32"===s.platform?t.win32.basename:t.posix.basename,t.extname="win32"===s.platform?t.win32.extname:t.posix.extname,t.format="win32"===s.platform?t.win32.format:t.posix.format,t.parse="win32"===s.platform?t.win32.parse:t.posix.parse,t.toNamespacedPath="win32"===s.platform?t.win32.toNamespacedPath:t.posix.toNamespacedPath,t.sep="win32"===s.platform?t.win32.sep:t.posix.sep,t.delimiter="win32"===s.platform?t.win32.delimiter:t.posix.delimiter}),define(e[14],t([1,0]),function(e,t){"use strict";function s(){return new r}function n(e){return o.test(e)}Object.defineProperty(t,"__esModule",{value:!0});class i{constructor(e){this._value=e}asHex(){return this._value}}class r extends i{constructor(){
super([r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),"-",r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),"-","4",r._randomHex(),r._randomHex(),r._randomHex(),"-",r._oneOf(r._timeHighBits),r._randomHex(),r._randomHex(),r._randomHex(),"-",r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex()].join(""))}static _oneOf(e){return e[Math.floor(e.length*Math.random())]}static _randomHex(){return r._oneOf(r._chars)}}r._chars=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],r._timeHighBits=["8","9","a","b"],t.v4=s;const o=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;t.isUUID=n,t.parse=function(e){if(!n(e))throw new Error("invalid uuid");return new i(e)},t.generateUuid=function(){return s().asHex()}}),define(e[8],t([1,0,3,2,11,9,5,4]),function(e,t,n,i,r,o,c,a){"use strict"
;function h(e){const t=a.VSBuffer.alloc(4);return t.writeUInt32BE(e,0),t}function l(e){return e.read(4).readUInt32BE(0)}function u(e){const t=a.VSBuffer.alloc(1);return t.writeUInt8(e,0),t}function d(e,t){if(void 0===t)e.write(w.Undefined);else if("string"==typeof t){const s=a.VSBuffer.fromString(t);e.write(w.String),e.write(h(s.byteLength)),e.write(s)}else if(k&&Buffer.isBuffer(t)){const s=a.VSBuffer.wrap(t);e.write(w.Buffer),e.write(h(s.byteLength)),e.write(s)}else if(t instanceof a.VSBuffer)e.write(w.VSBuffer),e.write(h(t.byteLength)),e.write(t);else if(Array.isArray(t)){e.write(w.Array),e.write(h(t.length));for(const s of t)d(e,s)}else{const s=a.VSBuffer.fromString(JSON.stringify(t));e.write(w.Object),e.write(h(s.byteLength)),e.write(s)}}function f(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)).buffer;case v.VSBuffer:return e.read(l(e));case v.Array:{const t=l(e),s=[];for(let n=0;n<t;n++)s.push(f(e));return s}
case v.Object:return JSON.parse(e.read(l(e)).toString())}}function p(e){return{call:(t,s,n)=>e.then(e=>e.call(t,s,n)),listen(t,s){const i=new n.Relay;return e.then(e=>i.input=e.listen(t,s)),i.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 m;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Idle=1]="Idle"}(m||(m={}));class g{constructor(e){this.buffer=e,this.pos=0}read(e){const t=this.buffer.slice(this.pos,this.pos+e);return this.pos+=t.byteLength,t}}class _{constructor(){this.buffers=[]}get buffer(){return a.VSBuffer.concat(this.buffers)}write(e){this.buffers.push(e)}}var v
;!function(e){e[e.Undefined=0]="Undefined",e[e.String=1]="String",e[e.Buffer=2]="Buffer",e[e.VSBuffer=3]="VSBuffer",e[e.Array=4]="Array",e[e.Object=5]="Object"}(v||(v={}));const w={Undefined:u(v.Undefined),String:u(v.String),Buffer:u(v.Buffer),VSBuffer:u(v.VSBuffer),Array:u(v.Array),Object:u(v.Object)},k="undefined"!=typeof Buffer;class b{constructor(e,t){this.protocol=e,this.ctx=t,this.channels=new Map,this.activeRequests=new Map,this.protocolListener=this.protocol.onMessage(e=>this.onRawMessage(e)),this.sendResponse({type:200})}registerChannel(e,t){this.channels.set(e,t)}sendResponse(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)}}send(e,t){const s=new _;d(s,e),d(s,t),this.sendBuffer(s.buffer)}sendBuffer(e){try{this.protocol.send(e)}catch(e){}}onRawMessage(e){const t=new g(e),s=f(t),n=f(t),i=s[0];switch(i){case 100:return this.onPromise({type:i,id:s[1],channelName:s[2],name:s[3],arg:n});case 102:return this.onEventListen({
type:i,id:s[1],channelName:s[2],name:s[3],arg:n});case 101:case 103:return this.disposeActiveRequest({type:i,id:s[1]})}}onPromise(e){const t=this.channels.get(e.channelName);if(!t)throw new Error("Unknown channel");const s=new o.CancellationTokenSource;let n;try{n=t.call(this.ctx,e.name,e.arg,s.token)}catch(e){n=Promise.reject(e)}const r=e.id;n.then(t=>{this.sendResponse({id:r,data:t,type:201}),this.activeRequests.delete(e.id)},t=>{t instanceof Error?this.sendResponse({id:r,data:{message:t.message,name:t.name,stack:t.stack?t.stack.split?t.stack.split("\n"):t.stack:void 0},type:202}):this.sendResponse({id:r,data:t,type:203}),this.activeRequests.delete(e.id)});const c=i.toDisposable(()=>s.cancel());this.activeRequests.set(e.id,c)}onEventListen(e){const t=this.channels.get(e.channelName);if(!t)throw new Error("Unknown channel");const s=e.id,n=t.listen(this.ctx,e.name,e.arg)(e=>this.sendResponse({id:s,data:e,type:204}));this.activeRequests.set(e.id,n)}disposeActiveRequest(e){const t=this.activeRequests.get(e.id)
;t&&(t.dispose(),this.activeRequests.delete(e.id))}dispose(){this.protocolListener&&(this.protocolListener.dispose(),this.protocolListener=null),this.activeRequests.forEach(e=>e.dispose()),this.activeRequests.clear()}}t.ChannelServer=b;class C{constructor(e){this.protocol=e,this.state=m.Uninitialized,this.activeRequests=new Set,this.handlers=new Map,this.lastRequestId=0,this._onDidInitialize=new n.Emitter,this.onDidInitialize=this._onDidInitialize.event,this.protocolListener=this.protocol.onMessage(e=>this.onBuffer(e))}getChannel(e){const t=this;return{call:(s,n,i)=>t.requestPromise(e,s,n,i),listen:(s,n)=>t.requestEvent(e,s,n)}}requestPromise(e,t,s,n=o.CancellationToken.None){const a=this.lastRequestId++,h={id:a,type:100,channelName:e,name:t,arg:s};if(n.isCancellationRequested)return Promise.reject(c.canceled());let l;return new Promise((e,t)=>{if(n.isCancellationRequested)return t(c.canceled());let s=r.createCancelablePromise(e=>this.whenInitialized());s.then(()=>{s=null;this.handlers.set(a,s=>{
switch(s.type){case 201:this.handlers.delete(a),e(s.data);break;case 202:this.handlers.delete(a);const n=new Error(s.data.message);n.stack=s.data.stack,n.name=s.data.name,t(n);break;case 203:this.handlers.delete(a),t(s.data)}}),this.sendRequest(h)});const o=()=>{s?(s.cancel(),s=null):this.sendRequest({id:a,type:101}),t(c.canceled())},u=n.onCancellationRequested(o);l=i.combinedDisposable(i.toDisposable(o),u),this.activeRequests.add(l)}).finally(()=>this.activeRequests.delete(l))}requestEvent(e,t,s){const i=this.lastRequestId++,o={id:i,type:102,channelName:e,name:t,arg:s};let c=null;const a=new n.Emitter({onFirstListenerAdd:()=>{(c=r.createCancelablePromise(e=>this.whenInitialized())).then(()=>{c=null,this.activeRequests.add(a),this.sendRequest(o)})},onLastListenerRemove:()=>{c?(c.cancel(),c=null):(this.activeRequests.delete(a),this.sendRequest({id:i,type:103}))}});return this.handlers.set(i,e=>a.fire(e.data)),a.event}sendRequest(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])}}send(e,t){const s=new _;d(s,e),d(s,t),this.sendBuffer(s.buffer)}sendBuffer(e){try{this.protocol.send(e)}catch(e){}}onBuffer(e){const t=new g(e),s=f(t),n=f(t);switch(s[0]){case 200:return this.onResponse({type:s[0]});case 201:case 202:case 204:case 203:return this.onResponse({type:s[0],id:s[1],data:n})}}onResponse(e){if(200===e.type)return this.state=m.Idle,void this._onDidInitialize.fire();const t=this.handlers.get(e.id);t&&t(e)}whenInitialized(){return this.state===m.Idle?Promise.resolve():n.Event.toPromise(this.onDidInitialize)}dispose(){this.protocolListener&&(this.protocolListener.dispose(),this.protocolListener=null),this.activeRequests.forEach(e=>e.dispose()),this.activeRequests.clear()}}t.ChannelClient=C;class y{constructor(e){this.channels=new Map,this._connections=new Set,this._onDidChangeConnections=new n.Emitter,this.onDidChangeConnections=this._onDidChangeConnections.event,
e(({protocol:e,onDidClientDisconnect:t})=>{n.Event.once(e.onMessage)(s=>{const n=f(new g(s)),i=new b(e,n),r=new C(e);this.channels.forEach((e,t)=>i.registerChannel(t,e));const o={channelClient:r,ctx:n};this._connections.add(o),this._onDidChangeConnections.fire(o),t(()=>{i.dispose(),r.dispose(),this._connections.delete(o)})})})}get connections(){const e=[];return this._connections.forEach(t=>e.push(t)),e}getChannel(e,t){const s=this;return{call:(n,i,r)=>p(t.routeCall(s,n,i).then(t=>t.channelClient.getChannel(e))).call(n,i,r),listen:(n,i)=>p(t.routeEvent(s,n,i).then(t=>t.channelClient.getChannel(e))).listen(n,i)}}registerChannel(e,t){this.channels.set(e,t)}dispose(){this.channels.clear(),this._connections.clear(),this._onDidChangeConnections.dispose()}}t.IPCServer=y;class A{constructor(e,t){const s=new _;d(s,t),e.send(s.buffer),this.channelClient=new C(e),this.channelServer=new b(e,t)}getChannel(e){return this.channelClient.getChannel(e)}registerChannel(e,t){this.channelServer.registerChannel(e,t)}dispose(){
this.channelClient.dispose(),this.channelServer.dispose()}}t.IPCClient=A,t.getDelayedChannel=p,t.getNextTickChannel=function(e){let t=!1;return{call:(s,n,i)=>t?e.call(s,n,i):r.timeout(0).then(()=>t=!0).then(()=>e.call(s,n,i)),listen(s,i){if(t)return e.listen(s,i);const o=new n.Relay;return r.timeout(0).then(()=>t=!0).then(()=>o.input=e.listen(s,i)),o.event}}};class E{constructor(e){this.fn=e}routeCall(e){return this.route(e)}routeEvent(e){return this.route(e)}route(e){return s(this,void 0,void 0,function*(){for(const t of e.connections)if(yield Promise.resolve(this.fn(t.ctx)))return Promise.resolve(t);return yield n.Event.toPromise(e.onDidChangeConnections),yield this.route(e)})}}t.StaticRouter=E}),define(e[10],t([1,0,3,8,2,4,6]),function(e,t,s,n,i,r,o){"use strict";function c(){return h||(h=r.VSBuffer.alloc(0)),h}function a(e){let t,n=!1,i=!1,r=[];const c=()=>{if(!i){for(i=!0;n&&r.length>0;)t.fire(r.shift());i=!1}};return e(e=>{r.push(e),c()}),(t=new s.Emitter({onFirstListenerAdd:()=>{n=!0,
"undefined"!=typeof process?process.nextTick(c):o.setImmediate(c)},onLastListenerRemove:()=>{n=!1}})).event}Object.defineProperty(t,"__esModule",{value:!0});let h=null;class l{get byteLength(){return this._totalLength}constructor(){this._chunks=[],this._totalLength=0}acceptChunk(e){this._chunks.push(e),this._totalLength+=e.byteLength}read(e){return this._read(e,!0)}peek(e){return this._read(e,!1)}_read(e,t){if(0===e)return c();if(e>this._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===e){const s=this._chunks[0];return t&&(this._chunks.shift(),this._totalLength-=e),s}if(this._chunks[0].byteLength>e){const s=this._chunks[0].slice(0,e);return t&&(this._chunks[0]=this._chunks[0].slice(e),this._totalLength-=e),s}let s=r.VSBuffer.alloc(e),n=0,i=0;for(;e>0;){const r=this._chunks[i];if(r.byteLength>e){const o=r.slice(0,e);s.set(o,n),n+=e,t&&(this._chunks[i]=r.slice(e),this._totalLength-=e),e-=e}else s.set(r,n),n+=r.byteLength,t?(this._chunks.shift(),
this._totalLength-=r.byteLength):i++,e-=r.byteLength}return s}}t.ChunkStream=l;var u;!function(e){e[e.None=0]="None",e[e.Regular=1]="Regular",e[e.Control=2]="Control",e[e.Ack=3]="Ack",e[e.KeepAlive=4]="KeepAlive",e[e.Disconnect=5]="Disconnect"}(u||(u={}));!function(e){e[e.HeaderLength=13]="HeaderLength",e[e.AcknowledgeTime=2e3]="AcknowledgeTime",e[e.AcknowledgeTimeoutTime=1e4]="AcknowledgeTimeoutTime",e[e.KeepAliveTime=5e3]="KeepAliveTime",e[e.KeepAliveTimeoutTime=1e4]="KeepAliveTimeoutTime",e[e.ReconnectionGraceTime=108e5]="ReconnectionGraceTime"}(t.ProtocolConstants||(t.ProtocolConstants={}));class d{constructor(e,t,s,n){this.type=e,this.id=t,this.ack=s,this.data=n,this.writtenTime=0}get size(){return this.data.byteLength}}class f extends i.Disposable{constructor(e){super(),this._onMessage=this._register(new s.Emitter),this.onMessage=this._onMessage.event,this._state={readHead:!0,readLen:13,messageType:0,id:0,ack:0},this._socket=e,this._isDisposed=!1,this._incomingData=new l,
this._register(this._socket.onData(e=>this.acceptChunk(e))),this.lastReadTime=Date.now()}acceptChunk(e){if(e&&0!==e.byteLength)for(this.lastReadTime=Date.now(),this._incomingData.acceptChunk(e);this._incomingData.byteLength>=this._state.readLen;){const e=this._incomingData.read(this._state.readLen);if(this._state.readHead)this._state.readHead=!1,this._state.readLen=e.readUInt32BE(9),this._state.messageType=e.readUInt8(0),this._state.id=e.readUInt32BE(1),this._state.ack=e.readUInt32BE(5);else{const t=this._state.messageType,s=this._state.id,n=this._state.ack;if(this._state.readHead=!0,this._state.readLen=13,this._state.messageType=0,this._state.id=0,this._state.ack=0,this._onMessage.fire(new d(t,s,n,e)),this._isDisposed)break}}}readEntireBuffer(){return this._incomingData.read(this._incomingData.byteLength)}dispose(){this._isDisposed=!0,super.dispose()}}class p{constructor(e){this._isDisposed=!1,this._socket=e,this._data=[],this._totalLength=0,this.lastWriteTime=0}dispose(){this.flush(),this._isDisposed=!0}
flush(){this._writeNow()}write(e){if(this._isDisposed)return console.warn("Cannot write message in a disposed ProtocolWriter"),void console.warn(e);e.writtenTime=Date.now(),this.lastWriteTime=Date.now();const t=r.VSBuffer.alloc(13);t.writeUInt8(e.type,0),t.writeUInt32BE(e.id,1),t.writeUInt32BE(e.ack,5),t.writeUInt32BE(e.data.byteLength,9),this._writeSoon(t,e.data)}_bufferAdd(e,t){const s=0===this._totalLength;return this._data.push(e,t),this._totalLength+=e.byteLength+t.byteLength,s}_bufferTake(){const e=r.VSBuffer.concat(this._data,this._totalLength);return this._data.length=0,this._totalLength=0,e}_writeSoon(e,t){this._bufferAdd(e,t)&&o.setImmediate(()=>{this._writeNow()})}_writeNow(){0!==this._totalLength&&this._socket.write(this._bufferTake())}}class m extends i.Disposable{constructor(e){super(),this._onMessage=new s.Emitter,this.onMessage=this._onMessage.event,this._onClose=new s.Emitter,this.onClose=this._onClose.event,this._socket=e,this._socketWriter=this._register(new p(this._socket)),
this._socketReader=this._register(new f(this._socket)),this._register(this._socketReader.onMessage(e=>{1===e.type&&this._onMessage.fire(e.data)})),this._register(this._socket.onClose(()=>this._onClose.fire()))}getSocket(){return this._socket}sendDisconnect(){}send(e){this._socketWriter.write(new d(1,0,0,e))}}t.Protocol=m;class g extends n.IPCClient{constructor(e,t){super(e,t),this.protocol=e}static fromSocket(e,t){return new g(new m(e),t)}get onClose(){return this.protocol.onClose}dispose(){super.dispose();const e=this.protocol.getSocket();this.protocol.sendDisconnect(),this.protocol.dispose(),e.end()}}t.Client=g,t.createBufferedEvent=a;class _{constructor(e){this.data=e,this.next=null}}class v{constructor(){this._first=null,this._last=null}peek(){return this._first?this._first.data:null}toArray(){let e=[],t=0,s=this._first;for(;s;)e[t++]=s.data,s=s.next;return e}pop(){if(this._first)return this._first===this._last?(this._first=null,void(this._last=null)):void(this._first=this._first.next)}push(e){
const t=new _(e);if(!this._first)return this._first=t,void(this._last=t);this._last.next=t,this._last=t}}class w{constructor(e,t=null){this._onControlMessage=new s.Emitter,this.onControlMessage=a(this._onControlMessage.event),this._onMessage=new s.Emitter,this.onMessage=a(this._onMessage.event),this._onClose=new s.Emitter,this.onClose=a(this._onClose.event),this._onSocketClose=new s.Emitter,this.onSocketClose=a(this._onSocketClose.event),this._onSocketTimeout=new s.Emitter,this.onSocketTimeout=a(this._onSocketTimeout.event),this._isReconnecting=!1,this._outgoingUnackMsg=new v,this._outgoingMsgId=0,this._outgoingAckId=0,this._outgoingAckTimeout=null,this._incomingMsgId=0,this._incomingAckId=0,this._incomingMsgLastTime=0,this._incomingAckTimeout=null,this._outgoingKeepAliveTimeout=null,this._incomingKeepAliveTimeout=null,this._socketDisposables=[],this._socket=e,this._socketWriter=new p(this._socket),this._socketDisposables.push(this._socketWriter),this._socketReader=new f(this._socket),
this._socketDisposables.push(this._socketReader),this._socketDisposables.push(this._socketReader.onMessage(e=>this._receiveMessage(e))),this._socketDisposables.push(this._socket.onClose(()=>this._onSocketClose.fire())),t&&this._socketReader.acceptChunk(t),this._sendKeepAliveCheck(),this._recvKeepAliveCheck()}get unacknowledgedCount(){return this._outgoingMsgId-this._outgoingAckId}dispose(){this._outgoingAckTimeout&&(clearTimeout(this._outgoingAckTimeout),this._outgoingAckTimeout=null),this._incomingAckTimeout&&(clearTimeout(this._incomingAckTimeout),this._incomingAckTimeout=null),this._outgoingKeepAliveTimeout&&(clearTimeout(this._outgoingKeepAliveTimeout),this._outgoingKeepAliveTimeout=null),this._incomingKeepAliveTimeout&&(clearTimeout(this._incomingKeepAliveTimeout),this._incomingKeepAliveTimeout=null),this._socketDisposables=i.dispose(this._socketDisposables)}sendDisconnect(){const e=new d(5,0,0,c());this._socketWriter.write(e),this._socketWriter.flush()}_sendKeepAliveCheck(){
if(this._outgoingKeepAliveTimeout)return;const e=Date.now()-this._socketWriter.lastWriteTime;if(e>=5e3){const e=new d(4,0,0,c());return this._socketWriter.write(e),void this._sendKeepAliveCheck()}this._outgoingKeepAliveTimeout=setTimeout(()=>{this._outgoingKeepAliveTimeout=null,this._sendKeepAliveCheck()},5e3-e+5)}_recvKeepAliveCheck(){if(this._incomingKeepAliveTimeout)return;const e=Date.now()-this._socketReader.lastReadTime;e>=1e4?this._onSocketTimeout.fire(void 0):this._incomingKeepAliveTimeout=setTimeout(()=>{this._incomingKeepAliveTimeout=null,this._recvKeepAliveCheck()},1e4-e+5)}getSocket(){return this._socket}beginAcceptReconnection(e,t){this._isReconnecting=!0,this._socketDisposables=i.dispose(this._socketDisposables),this._socket=e,this._socketWriter=new p(this._socket),this._socketDisposables.push(this._socketWriter),this._socketReader=new f(this._socket),this._socketDisposables.push(this._socketReader),this._socketDisposables.push(this._socketReader.onMessage(e=>this._receiveMessage(e))),
this._socketDisposables.push(this._socket.onClose(()=>this._onSocketClose.fire())),this._socketReader.acceptChunk(t)}endAcceptReconnection(){this._isReconnecting=!1;const e=this._outgoingUnackMsg.toArray();for(let t=0,s=e.length;t<s;t++)this._socketWriter.write(e[t]);this._recvAckCheck(),this._sendKeepAliveCheck(),this._recvKeepAliveCheck()}acceptDisconnect(){this._onClose.fire()}_receiveMessage(e){if(e.ack>this._outgoingAckId)for(this._outgoingAckId=e.ack;;){const t=this._outgoingUnackMsg.peek();if(!(t&&t.id<=e.ack))break;this._outgoingUnackMsg.pop()}1===e.type?e.id>this._incomingMsgId&&(e.id!==this._incomingMsgId+1&&console.error(`PROTOCOL CORRUPTION, LAST SAW MSG ${this._incomingMsgId} AND HAVE NOW RECEIVED MSG ${e.id}`),this._incomingMsgId=e.id,this._incomingMsgLastTime=Date.now(),this._sendAckCheck(),this._onMessage.fire(e.data)):2===e.type?this._onControlMessage.fire(e.data):5===e.type&&this._onClose.fire()}readEntireBuffer(){return this._socketReader.readEntireBuffer()}flush(){
this._socketWriter.flush()}send(e){const t=++this._outgoingMsgId;this._incomingAckId=this._incomingMsgId;const s=new d(1,t,this._incomingAckId,e);this._outgoingUnackMsg.push(s),this._isReconnecting||(this._socketWriter.write(s),this._recvAckCheck())}sendControl(e){const t=new d(2,0,0,e);this._socketWriter.write(t)}_sendAckCheck(){if(this._incomingMsgId<=this._incomingAckId)return;if(this._incomingAckTimeout)return;const e=Date.now()-this._incomingMsgLastTime;e>=2e3?this._sendAck():this._incomingAckTimeout=setTimeout(()=>{this._incomingAckTimeout=null,this._sendAckCheck()},2e3-e+5)}_recvAckCheck(){if(this._outgoingMsgId<=this._outgoingAckId)return;if(this._outgoingAckTimeout)return;const e=this._outgoingUnackMsg.peek(),t=Date.now()-e.writtenTime;t>=1e4?this._onSocketTimeout.fire(void 0):this._outgoingAckTimeout=setTimeout(()=>{this._outgoingAckTimeout=null,this._recvAckCheck()},1e4-t+5)}_sendAck(){if(this._incomingMsgId<=this._incomingAckId)return;this._incomingAckId=this._incomingMsgId
;const e=new d(3,0,this._incomingAckId,c());this._socketWriter.write(e)}}t.PersistentProtocol=w}),define(e[17],t([1,0,20,3,8,13,19,14,2,4,10]),function(e,t,s,n,i,r,o,c,a,h,l){"use strict";Object.defineProperty(t,"__esModule",{value:!0});class u{constructor(e){this.socket=e}dispose(){this.socket.destroy()}onData(e){const t=t=>e(h.VSBuffer.wrap(t));return this.socket.on("data",t),{dispose:()=>this.socket.off("data",t)}}onClose(e){return this.socket.on("close",e),{dispose:()=>this.socket.off("close",e)}}onEnd(e){return this.socket.on("end",e),{dispose:()=>this.socket.off("end",e)}}write(e){this.socket.destroyed||this.socket.write(e.buffer)}end(){this.socket.end()}}t.NodeSocket=u;var d;!function(e){e[e.MinHeaderByteSize=2]="MinHeaderByteSize"}(d||(d={}));var f;!function(e){e[e.PeekHeader=1]="PeekHeader",e[e.ReadHeader=2]="ReadHeader",e[e.ReadBody=3]="ReadBody",e[e.Fin=4]="Fin"}(f||(f={}));class p extends a.Disposable{constructor(e){super(),this._onData=this._register(new n.Emitter),this._state={state:1,readLen:2,
mask:0},this.socket=e,this._incomingData=new l.ChunkStream,this._register(this.socket.onData(e=>this._acceptChunk(e)))}dispose(){this.socket.dispose()}onData(e){return this._onData.event(e)}onClose(e){return this.socket.onClose(e)}onEnd(e){return this.socket.onEnd(e)}write(e){let t=2;e.byteLength<126?t+=0:e.byteLength<Math.pow(2,16)?t+=2:t+=8;const s=h.VSBuffer.alloc(t);if(s.writeUInt8(130,0),e.byteLength<126)s.writeUInt8(e.byteLength,1);else if(e.byteLength<Math.pow(2,16)){s.writeUInt8(126,1);let t=1;s.writeUInt8(e.byteLength>>>8&255,++t),s.writeUInt8(e.byteLength>>>0&255,++t)}else{s.writeUInt8(127,1);let t=1;s.writeUInt8(0,++t),s.writeUInt8(0,++t),s.writeUInt8(0,++t),s.writeUInt8(0,++t),s.writeUInt8(e.byteLength>>>24&255,++t),s.writeUInt8(e.byteLength>>>16&255,++t),s.writeUInt8(e.byteLength>>>8&255,++t),s.writeUInt8(e.byteLength>>>0&255,++t)}this.socket.write(h.VSBuffer.concat([s,e]))}end(){this.socket.end()}_acceptChunk(e){
if(0!==e.byteLength)for(this._incomingData.acceptChunk(e);this._incomingData.byteLength>=this._state.readLen;)if(1===this._state.state){const e=this._incomingData.peek(this._state.readLen).readUInt8(1),t=(128&e)>>>7,s=127&e;this._state.state=2,this._state.readLen=2+(t?4:0)+(126===s?2:0)+(127===s?8:0),this._state.mask=0}else if(2===this._state.state){const e=this._incomingData.read(this._state.readLen),t=e.readUInt8(1),s=(128&t)>>>7;let n=127&t,i=1;126===n?n=e.readUInt8(++i)*Math.pow(2,8)+e.readUInt8(++i):127===n&&(n=0*e.readUInt8(++i)+0*e.readUInt8(++i)+0*e.readUInt8(++i)+0*e.readUInt8(++i)+e.readUInt8(++i)*Math.pow(2,24)+e.readUInt8(++i)*Math.pow(2,16)+e.readUInt8(++i)*Math.pow(2,8)+e.readUInt8(++i));let r=0;s&&(r=e.readUInt8(++i)*Math.pow(2,24)+e.readUInt8(++i)*Math.pow(2,16)+e.readUInt8(++i)*Math.pow(2,8)+e.readUInt8(++i)),this._state.state=3,this._state.readLen=n,this._state.mask=r}else if(3===this._state.state){const e=this._incomingData.read(this._state.readLen);!function(e,t){if(0===t)return
;let s=e.byteLength>>>2;for(let n=0;n<s;n++){const s=e.readUInt32BE(4*n);e.writeUInt32BE(s^t,4*n)}let n=4*s,i=e.byteLength-n;const r=t>>>24&255,o=t>>>16&255,c=t>>>8&255;i>=1&&e.writeUInt8(e.readUInt8(n)^r,n),i>=2&&e.writeUInt8(e.readUInt8(n+1)^o,n+1),i>=3&&e.writeUInt8(e.readUInt8(n+2)^c,n+2)}(e,this._state.mask),this._state.state=1,this._state.readLen=2,this._state.mask=0,this._onData.fire(e)}}}t.WebSocketNodeSocket=p,t.generateRandomPipeName=function(){const e=c.generateUuid();return"win32"===process.platform?`\\\\.\\pipe\\vscode-ipc-${e}-sock`:r.join(o.tmpdir(),`vscode-ipc-${e}.sock`)};class m extends i.IPCServer{static toClientConnectionEvent(e){const t=n.Event.fromNodeEventEmitter(e,"connection");return n.Event.map(t,e=>({protocol:new l.Protocol(new u(e)),onDidClientDisconnect:n.Event.once(n.Event.fromNodeEventEmitter(e,"close"))}))}constructor(e){super(m.toClientConnectionEvent(e)),this.server=e}dispose(){super.dispose(),this.server&&(this.server.close(),this.server=null)}}t.Server=m,
t.serve=function(e){return new Promise((t,n)=>{const i=s.createServer();i.on("error",n),i.listen(e,()=>{i.removeListener("error",n),t(new m(i))})})},t.connect=function(e,t){return new Promise((n,i)=>{const r=s.createConnection(e,()=>{r.removeListener("error",i),n(l.Client.fromSocket(new u(r),t))});r.once("error",i)})}}),define(e[18],t([1,0]),function(e,t){"use strict";function s(e,t,s,n){t[i.DI_TARGET]===t?t[i.DI_DEPENDENCIES].push({id:e,index:s,optional:n}):(t[i.DI_DEPENDENCIES]=[{id:e,index:s,optional:n}],t[i.DI_TARGET]=t)}function n(e){if(i.serviceIds.has(e))return i.serviceIds.get(e);const t=function(e,n,i){if(3!==arguments.length)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");s(t,e,i,!1)};return t.toString=(()=>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=n("instantiationService"),t.createDecorator=n,t.optional=function(e){return function(t,n,i){if(3!==arguments.length)throw new Error("@optional-decorator can only be used to decorate a parameter");s(e,t,i,!0)}}}),define(e[21],t([1,0,17,18]),function(e,t,n,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ID="driverService",t.IDriver=i.createDecorator(t.ID);class r{constructor(e){this.driver=e}listen(e,t){throw new Error("No event found")}call(e,t,s){switch(t){case"getWindowIds":return this.driver.getWindowIds();case"capturePage":return this.driver.capturePage(s);case"reloadWindow":return this.driver.reloadWindow(s);case"exitApplication":return this.driver.exitApplication();case"dispatchKeybinding":return this.driver.dispatchKeybinding(s[0],s[1]);case"click":return this.driver.click(s[0],s[1],s[2],s[3]);case"doubleClick":return this.driver.doubleClick(s[0],s[1]);case"setValue":return this.driver.setValue(s[0],s[1],s[2]);case"getTitle":
return this.driver.getTitle(s[0]);case"isActiveElement":return this.driver.isActiveElement(s[0],s[1]);case"getElements":return this.driver.getElements(s[0],s[1],s[2]);case"typeInEditor":return this.driver.typeInEditor(s[0],s[1],s[2]);case"getTerminalBuffer":return this.driver.getTerminalBuffer(s[0],s[1]);case"writeInTerminal":return this.driver.writeInTerminal(s[0],s[1],s[2])}throw new Error(`Call not found: ${t}`)}}t.DriverChannel=r;class o{constructor(e){this.channel=e}getWindowIds(){return this.channel.call("getWindowIds")}capturePage(e){return this.channel.call("capturePage",e)}reloadWindow(e){return this.channel.call("reloadWindow",e)}exitApplication(){return this.channel.call("exitApplication")}dispatchKeybinding(e,t){return this.channel.call("dispatchKeybinding",[e,t])}click(e,t,s,n){return this.channel.call("click",[e,t,s,n])}doubleClick(e,t){return this.channel.call("doubleClick",[e,t])}setValue(e,t,s){return this.channel.call("setValue",[e,t,s])}getTitle(e){return this.channel.call("getTitle",[e])}
isActiveElement(e,t){return this.channel.call("isActiveElement",[e,t])}getElements(e,t,s){return this.channel.call("getElements",[e,t,s])}typeInEditor(e,t,s){return this.channel.call("typeInEditor",[e,t,s])}getTerminalBuffer(e,t){return this.channel.call("getTerminalBuffer",[e,t])}writeInTerminal(e,t,s){return this.channel.call("writeInTerminal",[e,t,s])}}t.DriverChannelClient=o;class c{constructor(e){this.registry=e}listen(e,t){throw new Error(`Event not found: ${t}`)}call(e,t,s){switch(t){case"registerWindowDriver":return this.registry.registerWindowDriver(s);case"reloadWindowDriver":return this.registry.reloadWindowDriver(s)}throw new Error(`Call not found: ${t}`)}}t.WindowDriverRegistryChannel=c;class a{constructor(e){this.channel=e}registerWindowDriver(e){return this.channel.call("registerWindowDriver",e)}reloadWindowDriver(e){return this.channel.call("reloadWindowDriver",e)}}t.WindowDriverRegistryChannelClient=a;class h{constructor(e){this.driver=e}listen(e,t){throw new Error(`No event found: ${t}`)}
call(e,t,s){switch(t){case"click":return this.driver.click(s[0],s[1],s[2]);case"doubleClick":return this.driver.doubleClick(s);case"setValue":return this.driver.setValue(s[0],s[1]);case"getTitle":return this.driver.getTitle();case"isActiveElement":return this.driver.isActiveElement(s);case"getElements":return this.driver.getElements(s[0],s[1]);case"typeInEditor":return this.driver.typeInEditor(s[0],s[1]);case"getTerminalBuffer":return this.driver.getTerminalBuffer(s);case"writeInTerminal":return this.driver.writeInTerminal(s[0],s[1])}throw new Error(`Call not found: ${t}`)}}t.WindowDriverChannel=h;class l{constructor(e){this.channel=e}click(e,t,s){return this.channel.call("click",[e,t,s])}doubleClick(e){return this.channel.call("doubleClick",e)}setValue(e,t){return this.channel.call("setValue",[e,t])}getTitle(){return this.channel.call("getTitle")}isActiveElement(e){return this.channel.call("isActiveElement",e)}getElements(e,t){return this.channel.call("getElements",[e,t])}typeInEditor(e,t){
return this.channel.call("typeInEditor",[e,t])}getTerminalBuffer(e){return this.channel.call("getTerminalBuffer",e)}writeInTerminal(e,t){return this.channel.call("writeInTerminal",[e,t])}}t.WindowDriverChannelClient=l,t.connect=function(e){return s(this,void 0,void 0,function*(){const t=yield n.connect(e,"driverClient"),s=t.getChannel("driver");return{client:t,driver:new o(s)}})}})}).call(this);
//# sourceMappingURL=https://ticino.blob.core.windows.net/sourcemaps/553cfb2c2205db5f15f3ee8395bbd5cf066d357d/core/vs/platform/driver/node/driver.js.map
