code-server
Version:
Run VS Code on a remote server.
451 lines • 367 kB
JavaScript
/*!--------------------------------------------------------
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
/******************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
export function __extends(d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
export var __assign = function() {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
}
return __assign.apply(this, arguments);
}
export function __rest(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
}
export function __decorate(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
}
export function __param(paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
}
export function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
var _, done = false;
for (var i = decorators.length - 1; i >= 0; i--) {
var context = {};
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
if (kind === "accessor") {
if (result === void 0) continue;
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
if (_ = accept(result.get)) descriptor.get = _;
if (_ = accept(result.set)) descriptor.set = _;
if (_ = accept(result.init)) initializers.unshift(_);
}
else if (_ = accept(result)) {
if (kind === "field") initializers.unshift(_);
else descriptor[key] = _;
}
}
if (target) Object.defineProperty(target, contextIn.name, descriptor);
done = true;
};
export function __runInitializers(thisArg, initializers, value) {
var useValue = arguments.length > 2;
for (var i = 0; i < initializers.length; i++) {
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
}
return useValue ? value : void 0;
};
export function __propKey(x) {
return typeof x === "symbol" ? x : "".concat(x);
};
export function __setFunctionName(f, name, prefix) {
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
};
export function __metadata(metadataKey, metadataValue) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
}
export function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
export function __generator(thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
}
export var __createBinding = Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
});
export function __exportStar(m, o) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
}
export function __values(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
export function __read(o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
}
/** @deprecated */
export function __spread() {
for (var ar = [], i = 0; i < arguments.length; i++)
ar = ar.concat(__read(arguments[i]));
return ar;
}
/** @deprecated */
export function __spreadArrays() {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
}
export function __spreadArray(to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
}
export function __await(v) {
return this instanceof __await ? (this.v = v, this) : new __await(v);
}
export function __asyncGenerator(thisArg, _arguments, generator) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var g = generator.apply(thisArg, _arguments || []), i, q = [];
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
}
export function __asyncDelegator(o) {
var i, p;
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
}
export function __asyncValues(o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator], i;
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
}
export function __makeTemplateObject(cooked, raw) {
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
return cooked;
};
var __setModuleDefault = Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
};
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
export function __importStar(mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
}
export function __importDefault(mod) {
return (mod && mod.__esModule) ? mod : { default: mod };
}
export function __classPrivateFieldGet(receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
}
export function __classPrivateFieldSet(receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
}
export function __classPrivateFieldIn(state, receiver) {
if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
return typeof state === "function" ? receiver === state : state.has(receiver);
}
export function __addDisposableResource(env, value, async) {
if (value !== null && value !== void 0) {
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
var dispose, inner;
if (async) {
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
dispose = value[Symbol.asyncDispose];
}
if (dispose === void 0) {
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
dispose = value[Symbol.dispose];
if (async) inner = dispose;
}
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
env.stack.push({ value: value, dispose: dispose, async: async });
}
else if (async) {
env.stack.push({ async: true });
}
return value;
}
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
var e = new Error(message);
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
};
export function __disposeResources(env) {
function fail(e) {
env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
env.hasError = true;
}
var r, s = 0;
function next() {
while (r = env.stack.pop()) {
try {
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
if (r.dispose) {
var result = r.dispose.call(r.value);
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
}
else s |= 1;
}
catch (e) {
fail(e);
}
}
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
if (env.hasError) throw env.error;
}
return next();
}
export function __rewriteRelativeImportExtension(path, preserveJsx) {
if (typeof path === "string" && /^\.\.?\//.test(path)) {
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
});
}
return path;
}
export default {
__extends: __extends,
__assign: __assign,
__rest: __rest,
__decorate: __decorate,
__param: __param,
__esDecorate: __esDecorate,
__runInitializers: __runInitializers,
__propKey: __propKey,
__setFunctionName: __setFunctionName,
__metadata: __metadata,
__awaiter: __awaiter,
__generator: __generator,
__createBinding: __createBinding,
__exportStar: __exportStar,
__values: __values,
__read: __read,
__spread: __spread,
__spreadArrays: __spreadArrays,
__spreadArray: __spreadArray,
__await: __await,
__asyncGenerator: __asyncGenerator,
__asyncDelegator: __asyncDelegator,
__asyncValues: __asyncValues,
__makeTemplateObject: __makeTemplateObject,
__importStar: __importStar,
__importDefault: __importDefault,
__classPrivateFieldGet: __classPrivateFieldGet,
__classPrivateFieldSet: __classPrivateFieldSet,
__classPrivateFieldIn: __classPrivateFieldIn,
__addDisposableResource: __addDisposableResource,
__disposeResources: __disposeResources,
__rewriteRelativeImportExtension: __rewriteRelativeImportExtension,
};
var Tl=Object.defineProperty;var El=Object.getOwnPropertyDescriptor;var h=(r,e,t,n)=>{for(var i=n>1?void 0:n?El(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&Tl(e,t,i),i},ye=(r,e)=>(t,n)=>e(t,n,r);var Ee=class{constructor(e){this.executor=e;this._state=0}get hasValue(){return this._state===2}get value(){if(this._state===0){this._state=1;try{this._value=this.executor()}catch(e){this._error=e}finally{this._state=2}}else if(this._state===1)throw new Error("Cannot read the value of a lazy that is being initialized");if(this._error)throw this._error;return this._value}get rawValue(){return this._value}};var pi=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Le.isErrorNoTelemetry(e)?new Le(e.message+`
`+e.stack):new Error(e.message+`
`+e.stack):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)}},Bo=new pi;function Qe(r){fi(r)||Bo.onUnexpectedError(r)}function Vo(r){fi(r)||Bo.onUnexpectedExternalError(r)}var mi="Canceled";function fi(r){return r instanceof we?!0:r instanceof Error&&r.name===mi&&r.message===mi}var we=class extends Error{constructor(){super(mi),this.name=this.message}},No=class r extends Error{static{this._name="PendingMigrationError"}static is(e){return e instanceof r||e instanceof Error&&e.name===r._name}constructor(e){super(e),this.name=r._name}};function Ko(r){return r?new Error(`Illegal state: ${r}`):new Error("Illegal state")}var Le=class r extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof r)return e;let t=new r;return t.message=e.message,t.stack=e.stack,t}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}},Xe=class r extends Error{constructor(e){super(e||"An unexpected bug occurred."),Object.setPrototypeOf(this,r.prototype)}};function wl(r,e,t=0,n=r.length){let i=t,o=n;for(;i<o;){let s=Math.floor((i+o)/2);e(r[s])?i=s+1:o=s}return i-1}var $o=class r{constructor(e){this._array=e;this._findLastMonotonousLastIdx=0}static{this.assertInvariants=!1}findLastMonotonous(e){if(r.assertInvariants){if(this._prevFindLastPredicate){for(let n of this._array)if(this._prevFindLastPredicate(n)&&!e(n))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=e}let t=wl(this._array,e,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=t+1,t===-1?void 0:this._array[t]}};function zo(r){return r.filter(e=>!!e)}function hi(r,e){let t;if(typeof e=="number"){let n=e;t=()=>{let i=Math.sin(n++)*179426549;return i-Math.floor(i)}}else t=Math.random;for(let n=r.length-1;n>0;n-=1){let i=Math.floor(t()*(n+1)),o=r[n];r[n]=r[i],r[i]=o}}function Ho(r){return r[Math.floor(Math.random()*r.length)]}var jo;(a=>{function r(l){return l<0}a.isLessThan=r;function e(l){return l<=0}a.isLessThanOrEqual=e;function t(l){return l>0}a.isGreaterThan=t;function n(l){return l===0}a.isNeitherLessOrGreaterThan=n,a.greaterThan=1,a.lessThan=-1,a.neitherLessOrGreaterThan=0})(jo||={});function Go(r,e){return(t,n)=>e(r(t),r(n))}var Xo=(r,e)=>r-e;var qo=class r{constructor(e){this.iterate=e}static{this.empty=new r(e=>{})}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(e){return new r(t=>this.iterate(n=>e(n)?t(n):!0))}map(e){return new r(t=>this.iterate(n=>t(e(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>e(n)?(t=n,!1):!0),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(i=>((n||jo.isGreaterThan(e(i,t)))&&(n=!1,t=i),!0)),t}};function Zo(r,e){let t=Object.create(null);for(let n of r){let i=e(n),o=t[i];o||(o=t[i]=[]),o.push(n)}return t}var Yo,Jo,Qo=class{constructor(e,t){this.toKey=t;this._map=new Map;this[Yo]="SetWithKey";for(let n of e)this.add(n)}get size(){return this._map.size}add(e){let t=this.toKey(e);return this._map.set(t,e),this}delete(e){return this._map.delete(this.toKey(e))}has(e){return this._map.has(this.toKey(e))}*entries(){for(let e of this._map.values())yield[e,e]}keys(){return this.values()}*values(){for(let e of this._map.values())yield e}clear(){this._map.clear()}forEach(e,t){this._map.forEach(n=>e.call(t,n,n,this))}[(Jo=Symbol.iterator,Yo=Symbol.toStringTag,Jo)](){return this.values()}};var gi=class{constructor(e,t){this.uri=e;this.value=t}};function Pl(r){return Array.isArray(r)}var ts,lt=class r{constructor(e,t){this[ts]="ResourceMap";if(e instanceof r)this.map=new Map(e.map),this.toKey=t??r.defaultToKey;else if(Pl(e)){this.map=new Map,this.toKey=t??r.defaultToKey;for(let[n,i]of e)this.set(n,i)}else this.map=new Map,this.toKey=e??r.defaultToKey}static{this.defaultToKey=e=>e.toString()}set(e,t){return this.map.set(this.toKey(e),new gi(e,t)),this}get(e){return this.map.get(this.toKey(e))?.value}has(e){return this.map.has(this.toKey(e))}get size(){return this.map.size}clear(){this.map.clear()}delete(e){return this.map.delete(this.toKey(e))}forEach(e,t){typeof t<"u"&&(e=e.bind(t));for(let[n,i]of this.map)e(i.value,i.uri,this)}*values(){for(let e of this.map.values())yield e.value}*keys(){for(let e of this.map.values())yield e.uri}*entries(){for(let e of this.map.values())yield[e.uri,e.value]}*[(ts=Symbol.toStringTag,Symbol.iterator)](){for(let[,e]of this.map)yield[e.uri,e.value]}},ns,es=class{constructor(e,t){this[ns]="ResourceSet";!e||typeof e=="function"?this._map=new lt(e):(this._map=new lt(t),e.forEach(this.add,this))}get size(){return this._map.size}add(e){return this._map.set(e,e),this}clear(){this._map.clear()}delete(e){return this._map.delete(e)}forEach(e,t){this._map.forEach((n,i)=>e.call(t,i,i,this))}has(e){return this._map.has(e)}entries(){return this._map.entries()}keys(){return this._map.keys()}values(){return this._map.keys()}[(ns=Symbol.toStringTag,Symbol.iterator)](){return this.keys()}};var rs,yi=class{constructor(){this[rs]="LinkedMap";this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){return this._head?.value}get last(){return this._tail?.value}has(e){return this._map.has(e)}get(e,t=0){let n=this._map.get(e);if(n)return t!==0&&this.touch(n,t),n.value}set(e,t,n=0){let i=this._map.get(e);if(i)i.value=t,n!==0&&this.touch(i,n);else{switch(i={key:e,value:t,next:void 0,previous:void 0},n){case 0:this.addItemLast(i);break;case 1:this.addItemFirst(i);break;case 2:this.addItemLast(i);break;default:this.addItemLast(i);break}this._map.set(e,i),this._size++}return this}delete(e){return!!this.remove(e)}remove(e){let t=this._map.get(e);if(t)return this._map.delete(e),this.removeItem(t),this._size--,t.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");let e=this._head;return this._map.delete(e.key),this.removeItem(e),this._size--,e.value}forEach(e,t){let n=this._state,i=this._head;for(;i;){if(t?e.bind(t)(i.value,i.key,this):e(i.value,i.key,this),this._state!==n)throw new Error("LinkedMap got modified during iteration.");i=i.next}}keys(){let e=this,t=this._state,n=this._head,i={[Symbol.iterator](){return i},[Symbol.dispose](){},next(){if(e._state!==t)throw new Error("LinkedMap got modified during iteration.");if(n){let o={value:n.key,done:!1};return n=n.next,o}else return{value:void 0,done:!0}}};return i}values(){let e=this,t=this._state,n=this._head,i={[Symbol.iterator](){return i},[Symbol.dispose](){},next(){if(e._state!==t)throw new Error("LinkedMap got modified during iteration.");if(n){let o={value:n.value,done:!1};return n=n.next,o}else return{value:void 0,done:!0}}};return i}entries(){let e=this,t=this._state,n=this._head,i={[Symbol.iterator](){return i},[Symbol.dispose](){},next(){if(e._state!==t)throw new Error("LinkedMap got modified during iteration.");if(n){let o={value:[n.key,n.value],done:!1};return n=n.next,o}else return{value:void 0,done:!0}}};return i}[(rs=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(e){if(e>=this.size)return;if(e===0){this.clear();return}let t=this._head,n=this.size;for(;t&&n>e;)this._map.delete(t.key),t=t.next,n--;this._head=t,this._size=n,t&&(t.previous=void 0),this._state++}trimNew(e){if(e>=this.size)return;if(e===0){this.clear();return}let t=this._tail,n=this.size;for(;t&&n>e;)this._map.delete(t.key),t=t.previous,n--;this._tail=t,this._size=n,t&&(t.next=void 0),this._state++}addItemFirst(e){if(!this._head&&!this._tail)this._tail=e;else if(this._head)e.next=this._head,this._head.previous=e;else throw new Error("Invalid list");this._head=e,this._state++}addItemLast(e){if(!this._head&&!this._tail)this._head=e;else if(this._tail)e.previous=this._tail,this._tail.next=e;else throw new Error("Invalid list");this._tail=e,this._state++}removeItem(e){if(e===this._head&&e===this._tail)this._head=void 0,this._tail=void 0;else if(e===this._head){if(!e.next)throw new Error("Invalid list");e.next.previous=void 0,this._head=e.next}else if(e===this._tail){if(!e.previous)throw new Error("Invalid list");e.previous.next=void 0,this._tail=e.previous}else{let t=e.next,n=e.previous;if(!t||!n)throw new Error("Invalid list");t.previous=n,n.next=t}e.next=void 0,e.previous=void 0,this._state++}touch(e,t){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(t!==1&&t!==2)){if(t===1){if(e===this._head)return;let n=e.next,i=e.previous;e===this._tail?(i.next=void 0,this._tail=i):(n.previous=i,i.next=n),e.previous=void 0,e.next=this._head,this._head.previous=e,this._head=e,this._state++}else if(t===2){if(e===this._tail)return;let n=e.next,i=e.previous;e===this._head?(n.previous=void 0,this._head=n):(n.previous=i,i.next=n),e.next=void 0,e.previous=this._tail,this._tail.next=e,this._tail=e,this._state++}}}toJSON(){let e=[];return this.forEach((t,n)=>{e.push([n,t])}),e}fromJSON(e){this.clear();for(let[t,n]of e)this.set(t,n)}},vi=class extends yi{constructor(e,t=1){super(),this._limit=e,this._ratio=Math.min(Math.max(0,t),1)}get limit(){return this._limit}set limit(e){this._limit=e,this.checkTrim()}get ratio(){return this._ratio}set ratio(e){this._ratio=Math.min(Math.max(0,e),1),this.checkTrim()}get(e,t=2){return super.get(e,t)}peek(e){return super.get(e,0)}set(e,t){return super.set(e,t,2),this}checkTrim(){this.size>this._limit&&this.trim(Math.round(this._limit*this._ratio))}},At=class extends vi{constructor(e,t=1){super(e,t)}trim(e){this.trimOld(e)}set(e,t){return super.set(e,t),this.checkTrim(),this}};var Qn=class{constructor(){this.map=new Map}add(e,t){let n=this.map.get(e);n||(n=new Set,this.map.set(e,n)),n.add(t)}delete(e,t){let n=this.map.get(e);n&&(n.delete(t),n.size===0&&this.map.delete(e))}forEach(e,t){let n=this.map.get(e);n&&n.forEach(t)}get(e){let t=this.map.get(e);return t||new Set}};function is(r,e){if(r===e)return!0;if(r.size!==e.size)return!1;for(let[t,n]of r)if(!e.has(t)||e.get(t)!==n)return!1;for(let[t]of e)if(!r.has(t))return!1;return!0}function on(r,e){let t=this,n=!1,i;return function(){if(n)return i;if(n=!0,e)try{i=r.apply(t,arguments)}finally{e()}else i=r.apply(t,arguments);return i}}function Yn(r,e){if(!r)throw new Error(e?`Assertion failed (${e})`:"Assertion Failed")}function sn(r,e="unexpected state"){if(!r)throw typeof e=="string"?new Xe(`Assertion Failed: ${e}`):e}function G(r){return typeof r=="string"}function bi(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)&&!(r instanceof RegExp)&&!(r instanceof Date)}function De(r){return typeof r=="number"&&!isNaN(r)}function os(r){return!!r&&typeof r[Symbol.iterator]=="function"}function kl(r){return typeof r>"u"}function _i(r){return kl(r)||r===null}function ss(r,e){if(!r)throw new Error(e?`Unexpected type, expected '${e}'`:"Unexpected type")}function ut(r){return typeof r=="function"}function Jn(r,e){for(let t in e)if(!(t in r))return!1;return!0}var Ii;(di=>{function r(P){return!!P&&typeof P=="object"&&typeof P[Symbol.iterator]=="function"}di.is=r;let e=Object.freeze([]);function t(){return e}di.empty=t;function*n(P){yield P}di.single=n;function i(P){return r(P)?P:n(P)}di.wrap=i;function o(P){return P??e}di.from=o;function*s(P){for(let M=P.length-1;M>=0;M--)yield P[M]}di.reverse=s;function a(P){return!P||P[Symbol.iterator]().next().done===!0}di.isEmpty=a;function l(P){return P[Symbol.iterator]().next().value}di.first=l;function u(P,M){let z=0;for(let de of P)if(M(de,z++))return!0;return!1}di.some=u;function p(P,M){let z=0;for(let de of P)if(!M(de,z++))return!1;return!0}di.every=p;function c(P,M){for(let z of P)if(M(z))return z}di.find=c;function*d(P,M){for(let z of P)M(z)&&(yield z)}di.filter=d;function*m(P,M){let z=0;for(let de of P)yield M(de,z++)}di.map=m;function*f(P,M){let z=0;for(let de of P)yield*M(de,z++)}di.flatMap=f;function*b(...P){for(let M of P)os(M)?yield*M:yield M}di.concat=b;function E(P,M,z){let de=z;for(let ot of P)de=M(de,ot);return de}di.reduce=E;function q(P){let M=0;for(let z of P)M++;return M}di.length=q;function*H(P,M,z=P.length){for(M<-P.length&&(M=0),M<0&&(M+=P.length),z<0?z+=P.length:z>P.length&&(z=P.length);M<z;M++)yield P[M]}di.slice=H;function B(P,M=Number.POSITIVE_INFINITY){let z=[];if(M===0)return[z,P];let de=P[Symbol.iterator]();for(let ot=0;ot<M;ot++){let Xn=de.next();if(Xn.done)return[z,di.empty()];z.push(Xn.value)}return[z,{[Symbol.iterator](){return de}}]}di.consume=B;async function ge(P){let M=[];for await(let z of P)M.push(z);return M}di.asyncToArray=ge;async function ci(P){let M=[];for await(let z of P)M=M.concat(z);return M}di.asyncToArrayFlat=ci})(Ii||={});var Rl=!1,Ot=null;var as=class r{constructor(){this.livingDisposables=new Map}static{this.idx=0}getDisposableData(e){let t=this.livingDisposables.get(e);return t||(t={parent:null,source:null,isSingleton:!1,value:e,idx:r.idx++},this.livingDisposables.set(e,t)),t}trackDisposable(e){let t=this.getDisposableData(e);t.source||(t.source=new Error().stack)}setParent(e,t){let n=this.getDisposableData(e);n.parent=t}markAsDisposed(e){this.livingDisposables.delete(e)}markAsSingleton(e){this.getDisposableData(e).isSingleton=!0}getRootParent(e,t){let n=t.get(e);if(n)return n;let i=e.parent?this.getRootParent(this.getDisposableData(e.parent),t):e;return t.set(e,i),i}getTrackedDisposables(){let e=new Map;return[...this.livingDisposables.entries()].filter(([,n])=>n.source!==null&&!this.getRootParent(n,e).isSingleton).flatMap(([n])=>n)}computeLeakingDisposables(e=10,t){let n;if(t)n=t;else{let l=new Map,u=[...this.livingDisposables.values()].filter(c=>c.source!==null&&!this.getRootParent(c,l).isSingleton);if(u.length===0)return;let p=new Set(u.map(c=>c.value));if(n=u.filter(c=>!(c.parent&&p.has(c.parent))),n.length===0)throw new Error("There are cyclic diposable chains!")}if(!n)return;function i(l){function u(c,d){for(;c.length>0&&d.some(m=>typeof m=="string"?m===c[0]:c[0].match(m));)c.shift()}let p=l.source.split(`
`).map(c=>c.trim().replace("at ","")).filter(c=>c!=="");return u(p,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),p.reverse()}let o=new Qn;for(let l of n){let u=i(l);for(let p=0;p<=u.length;p++)o.add(u.slice(0,p).join(`
`),l)}n.sort(Go(l=>l.idx,Xo));let s="",a=0;for(let l of n.slice(0,e)){a++;let u=i(l),p=[];for(let c=0;c<u.length;c++){let d=u[c];d=`(shared with ${o.get(u.slice(0,c+1).join(`
`)).size}/${n.length} leaks) at ${d}`;let f=o.get(u.slice(0,c).join(`
`)),b=Zo([...f].map(E=>i(E)[c]),E=>E);delete b[u[c]];for(let[E,q]of Object.entries(b))q&&p.unshift(` - stacktraces of ${q.length} other leaks continue with ${E}`);p.unshift(d)}s+=`
==================== Leaking disposable ${a}/${n.length}: ${l.value.constructor.name} ====================
${p.join(`
`)}
============================================================
`}return n.length>e&&(s+=`
... and ${n.length-e} more leaking disposables
`),{leaks:n,details:s}}};function Ll(r){Ot=r}if(Rl){let r="__is_disposable_tracked__";Ll(new class{trackDisposable(e){let t=new Error("Potentially leaked disposable").stack;setTimeout(()=>{e[r]||console.log(t)},3e3)}setParent(e,t){if(e&&e!==C.None)try{e[r]=!0}catch{}}markAsDisposed(e){if(e&&e!==C.None)try{e[r]=!0}catch{}}markAsSingleton(e){}})}function an(r){return Ot?.trackDisposable(r),r}function ln(r){Ot?.markAsDisposed(r)}function ct(r,e){Ot?.setParent(r,e)}function Dl(r,e){if(Ot)for(let t of r)Ot.setParent(t,e)}function ls(r){return typeof r=="object"&&r!==null&&typeof r.dispose=="function"&&r.dispose.length===0}function Pe(r){if(Ii.is(r)){let e=[];for(let t of r)if(t)try{t.dispose()}catch(n){e.push(n)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(r)?[]:r}else if(r)return r.dispose(),r}function us(...r){let e=Q(()=>Pe(r));return Dl(r,e),e}var Ti=class{constructor(e){this._isDisposed=!1,this._fn=e,an(this)}dispose(){if(!this._isDisposed){if(!this._fn)throw new Error("Unbound disposable context: Need to use an arrow function to preserve the value of this");this._isDisposed=!0,ln(this),this._fn()}}};function Q(r){return new Ti(r)}var me=class r{constructor(){this._toDispose=new Set;this._isDisposed=!1;an(this)}static{this.DISABLE_DISPOSED_WARNING=!1}dispose(){this._isDisposed||(ln(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Pe(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e||e===C.None)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return ct(e,this),this._isDisposed?r.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.delete(e)&&ct(e,null)}assertNotDisposed(){this._isDisposed&&Qe(new Xe("Object disposed"))}},C=class{constructor(){this._store=new me;an(this),ct(this._store,this)}static{this.None=Object.freeze({dispose(){}})}dispose(){ln(this),this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}},Mt=class{constructor(){this._isDisposed=!1;an(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&ct(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,ln(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&ct(e,null),e}},Zn=class{constructor(e){this._disposable=new Mt;this._isDisposed=!1;this._disposable.value=e}get value(){return this._disposable.value}set value(e){this._isDisposed||e===this._disposable.value||(this._disposable.value=e)}dispose(){this._isDisposed=!0,this._disposable.dispose()}};var Ut=class{constructor(e=new Map){this._isDisposed=!1;this._store=e,an(this)}dispose(){ln(this),this._isDisposed=!0,this.clearAndDisposeAll()}clearAndDisposeAll(){if(this._store.size)try{Pe(this._store.values())}finally{this._store.clear()}}has(e){return this._store.has(e)}get size(){return this._store.size}get(e){return this._store.get(e)}set(e,t,n=!1){this._isDisposed&&console.warn(new Error("Trying to add a disposable to a DisposableMap that has already been disposed of. The added object will be leaked!").stack),n||this._store.get(e)?.dispose(),this._store.set(e,t),ct(t,this)}deleteAndDispose(e){this._store.get(e)?.dispose(),this._store.delete(e)}deleteAndLeak(e){let t=this._store.get(e);return t&&ct(t,null),this._store.delete(e),t}keys(){return this._store.keys()}values(){return this._store.values()}[Symbol.iterator](){return this._store[Symbol.iterator]()}};var un=typeof Buffer<"u",Ol=new Ee(()=>new Uint8Array(256)),Ei,wi,ee=class r{static alloc(e){return un?new r(Buffer.allocUnsafe(e)):new r(new Uint8Array(e))}static wrap(e){return un&&!Buffer.isBuffer(e)&&(e=Buffer.from(e.buffer,e.byteOffset,e.byteLength)),new r(e)}static fromString(e,t){return!(t?.dontUseNodeBuffer||!1)&&un?new r(Buffer.from(e)):(Ei||(Ei=new TextEncoder),new r(Ei.encode(e)))}static fromByteArray(e){let t=r.alloc(e.length);for(let n=0,i=e.length;n<i;n++)t.buffer[n]=e[n];return t}static concat(e,t){if(typeof t>"u"){t=0;for(let o=0,s=e.length;o<s;o++)t+=e[o].byteLength}let n=r.alloc(t),i=0;for(let o=0,s=e.length;o<s;o++){let a=e[o];n.set(a,i),i+=a.byteLength}return n}static isNativeBuffer(e){return un&&Buffer.isBuffer(e)}constructor(e){this.buffer=e,this.byteLength=this.buffer.byteLength}clone(){let e=r.alloc(this.byteLength);return e.set(this),e}toString(){return un?this.buffer.toString():(wi||(wi=new TextDecoder(void 0,{ignoreBOM:!0})),wi.decode(this.buffer))}slice(e,t){return new r(this.buffer.subarray(e,t))}set(e,t){if(e instanceof r)this.buffer.set(e.buffer,t);else if(e instanceof Uint8Array)this.buffer.set(e,t);else if(e instanceof ArrayBuffer)this.buffer.set(new Uint8Array(e),t);else if(ArrayBuffer.isView(e))this.buffer.set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),t);else throw new Error("Unknown argument 'array'")}readUInt32BE(e){return Ul(this.buffer,e)}writeUInt32BE(e,t){Fl(this.buffer,e,t)}readUInt32LE(e){return Nl(this.buffer,e)}writeUInt32LE(e,t){Bl(this.buffer,e,t)}readUInt8(e){return Vl(this.buffer,e)}writeUInt8(e,t){Kl(this.buffer,e,t)}indexOf(e,t=0){return Ml(this.buffer,e instanceof r?e.buffer:e,t)}equals(e){return this===e?!0:this.byteLength!==e.byteLength?!1:this.buffer.every((t,n)=>t===e.buffer[n])}};function Ml(r,e,t=0){let n=e.byteLength,i=r.byteLength;if(n===0)return 0;if(n===1)return r.indexOf(e[0],t);if(n>i-t)return-1;let o=Ol.value;o.fill(e.length);for(let u=0;u<e.length;u++)o[e[u]]=e.length-u-1;let s=t+e.length-1,a=s,l=-1;for(;s<i;)if(r[s]===e[a]){if(a===0){l=s;break}s--,a--}else s+=Math.max(e.length-a,o[r[s]]),a=e.length-1;return l}function Ul(r,e){return r[e]*2**24+r[e+1]*2**16+r[e+2]*2**8+r[e+3]}function Fl(r,e,t){r[t+3]=e,e=e>>>8,r[t+2]=e,e=e>>>8,r[t+1]=e,e=e>>>8,r[t]=e}function Nl(r,e){return r[e+0]<<0>>>0|r[e+1]<<8>>>0|r[e+2]<<16>>>0|r[e+3]<<24>>>0}function Bl(r,e,t){r[t+0]=e&255,e=e>>>8,r[t+1]=e&255,e=e>>>8,r[t+2]=e&255,e=e>>>8,r[t+3]=e&255}function Vl(r,e){return r[e]}function Kl(r,e,t){r[t]=e}var cs="0123456789abcdef";function ds({buffer:r}){let e="";for(let t=0;t<r.length;t++){let n=r[t];e+=cs[n>>>4],e+=cs[n&15]}return e}function Wl(){return globalThis._VSCODE_NLS_MESSAGES}function Si(){return globalThis._VSCODE_NLS_LANGUAGE}var $l=Si()==="pseudo"||typeof document<"u"&&document.location&&typeof document.location.hash=="string"&&document.location.hash.indexOf("pseudo=true")>=0;function ps(r,e){let t;return e.length===0?t=r:t=r.replace(/\{(\d+)\}/g,(n,i)=>{let o=parseInt(i,10),s=e[o],a=n;return typeof s=="string"?a=s:(typeof s=="number"||typeof s=="boolean"||s===void 0||s===null)&&(a=String(s)),a}),$l&&(t="\uFF3B"+t.replace(/[aouei]/g,"$&$&")+"\uFF3D"),t}function g(r,e,...t){return ps(typeof r=="number"?ql(r,e):e,t)}function ql(r,e){let t=Wl()?.[r];if(typeof t!="string"){if(typeof e=="string")return e;throw new Error(`!!! NLS MISSING: ${r} !!!`)}return t}var dt="en",dn=!1,pn=!1,cn=!1,zl=!1,fs=!1,Ci=!1,Hl=!1,hs=!1,jl=!1,Gl=!1,er,tr=dt,ms=dt,Xl,Fe,Ne=globalThis,ve;typeof Ne.vscode<"u"&&typeof Ne.vscode.process<"u"?ve=Ne.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(ve=process);var gs=typeof ve?.versions?.electron=="string",Ql=gs&&ve?.type==="renderer";if(typeof ve=="object"){dn=ve.platform==="win32",pn=ve.platform==="darwin",cn=ve.platform==="linux",zl=cn&&!!ve.env.SNAP&&!!ve.env.SNAP_REVISION,Hl=gs,jl=!!ve.env.CI||!!ve.env.BUILD_ARTIFACTSTAGINGDIRECTORY||!!ve.env.GITHUB_WORKSPACE,er=dt,tr=dt;let r=ve.env.VSCODE_NLS_CONFIG;if(r)try{let e=JSON.parse(r);er=e.userLocale,ms=e.osLocale,tr=e.resolvedLanguage||dt,Xl=e.languagePack?.translationsConfigFile}catch{}fs=!0}else typeof navigator=="object"&&!Ql?(Fe=navigator.userAgent,dn=Fe.indexOf("Windows")>=0,pn=Fe.indexOf("Macintosh")>=0,hs=(Fe.indexOf("Macintosh")>=0||Fe.indexOf("iPad")>=0||Fe.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,cn=Fe.indexOf("Linux")>=0,Gl=Fe?.indexOf("Mobi")>=0,Ci=!0,tr=Si()||dt,er=navigator.language.toLowerCase(),ms=er):console.error("Unable to resolve platform.");var nr=0;pn?nr=1:dn?nr=3:cn&&(nr=2);var w=dn,be=pn,Ae=cn;var ys=fs;var pt=Ci,Yl=Ci&&typeof Ne.importScripts=="function",vs=Yl?Ne.origin:void 0;var bs=nr,Ce=Fe,Ye=tr,Jl;(n=>{function r(){return Ye}n.value=r;function e(){return Ye.length===2?Ye==="en":Ye.length>=3?Ye[0]==="e"&&Ye[1]==="n"&&Ye[2]==="-":!1}n.isDefaultVariant=e;function t(){return Ye==="en"}n.isDefault=t})(Jl||={});var Zl=typeof Ne.postMessage=="function"&&!Ne.importScripts,_s=(()=>{if(Zl){let r=[];Ne.addEventListener("message",t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,i=r.length;n<i;n++){let o=r[n];if(o.id===t.data.vscodeScheduleAsyncWork){r.splice(n,1),o.callback();return}}});let e=0;return t=>{let n=++e;r.push({id:n,callback:t}),Ne.postMessage({vscodeScheduleAsyncWork:n},"*")}}return r=>setTimeout(r)})();var rr=pn||hs?2:dn?1:3;var ki=!!(Ce&&Ce.indexOf("Chrome")>=0),xs=!!(Ce&&Ce.indexOf("Firefox")>=0),Is=!!(!ki&&Ce&&Ce.indexOf("Safari")>=0),Ts=!!(Ce&&Ce.indexOf("Edg/")>=0),Tp=!!(Ce&&Ce.indexOf("Android")>=0),Ep=!!(Ce&&Ce.indexOf("Electron")>=0);var mt,Li=globalThis.vscode;if(typeof Li<"u"&&typeof Li.process<"u"){let r=Li.process;mt={get platform(){return r.platform},get arch(){return r.arch},get env(){return r.env},cwd(){return r.cwd()}}}else typeof process<"u"&&typeof process?.versions?.node=="string"?mt={get platform(){return process.platform},get arch(){return process.arch},get env(){return process.env},cwd(){return process.env.VSCODE_CWD||process.cwd()}}:mt={get platform(){return w?"win32":be?"darwin":"linux"},get arch(){},get env(){return{}},cwd(){return"/"}};var ft=mt.cwd,ne=mt.env,ir=mt.platform,Pp=mt.arch;var eu=65,tu=97,nu=90,ru=122,ht=46,ae=47,_e=92,Be=58,iu=63,or=class extends Error{constructor(e,t,n){let i;typeof t=="string"&&t.indexOf("not ")===0?(i="must not be",t=t.replace(/^not /,"")):i="must be";let o=e.indexOf(".")!==-1?"property":"argument",s=`The "${e}" ${o} ${i} of type ${t}`;s+=`. Received type ${typeof n}`,super(s),this.code="ERR_INVALID_ARG_TYPE"}};function ou(r,e){if(r===null||typeof r!="object")throw new or(e,"Object",r)}function J(r,e){if(typeof r!="string")throw new or(e,"string",r)}var xe=ir==="win32";function N(r){return r===ae||r===_e}function Ai(r){return r===ae}function Ve(r){return r>=eu&&r<=nu||r>=tu&&r<=ru}function sr(r,e,t,n){let i="",o=0,s=-1,a=0,l=0;for(let u=0;u<=r.length;++u){if(u<r.length)l=r.charCodeAt(u);else{if(n(l))break;l=ae}if(n(l)){if(!(s===u-1||a===1))if(a===2){if(i.length<2||o!==2||i.charCodeAt(i.length-1)!==ht||i.charCodeAt(i.length-2)!==ht){if(i.length>2){let p=i.lastIndexOf(t);p===-1?(i="",o=0):(i=i.slice(0,p),o=i.length-1-i.lastIndexOf(t)),s=u,a=0;continue}else if(i.length!==0){i="",o=0,s=u,a=0;continue}}e&&(i+=i.length>0?`${t}..`:"..",o=2)}else i.length>0?i+=`${t}${r.slice(s+1,u)}`:i=r.slice(s+1,u),o=u-s-1;s=u,a=0}else l===ht&&a!==-1?++a:a=-1}return i}function su(r){return r?`${r[0]==="."?"":"."}${r}`:""}function Es(r,e){ou(e,"pathObject");let t=e.dir||e.root,n=e.base||`${e.name||""}${su(e.ext)}`;return t?t===e.root?`${t}${n}`:`${t}${r}${n}`:n}var Z={resolve(...r){let e="",t="",n=!1;for(let i=r.length-1;i>=-1;i--){let o;if(i>=0){if(o=r[i],J(o,`paths[${i}]`),o.length===0)continue}else e.length===0?o=ft():(o=ne[`=${e}`]||ft(),(o===void 0||o.slice(0,2).toLowerCase()!==e.toLowerCase()&&o.charCodeAt(2)===_e)&&(o=`${e}\\`));let s=o.length,a=0,l="",u=!1,p=o.charCodeAt(0);if(s===1)N(p)&&(a=1,u=!0);else if(N(p))if(u=!0,N(o.charCodeAt(1))){let c=2,d=c;for(;c<s&&!N(o.charCodeAt(c));)c++;if(c<s&&c!==d){let m=o.slice(d,c);for(d=c;c<s&&N(o.charCodeAt(c));)c++;if(c<s&&c!==d){for(d=c;c<s&&!N(o.charCodeAt(c));)c++;(c===s||c!==d)&&(l=`\\\\${m}\\${o.slice(d,c)}`,a=c)}}}else a=1;else Ve(p)&&o.charCodeAt(1)===Be&&(l=o.slice(0,2),a=2,s>2&&N(o.charCodeAt(2))&&(u=!0,a=3));if(l.length>0)if(e.length>0){if(l.toLowerCase()!==e.toLowerCase())continue}else e=l;if(n){if(e.length>0)break}else if(t=`${o.slice(a)}\\${t}`,n=u,u&&e.length>0)break}return t=sr(t,!n,"\\",N),n?`${e}\\${t}`:`${e}${t}`||"."},normalize(r){J(r,"path");let e=r.length;if(e===0)return".";let t=0,n,i=!1,o=r.charCodeAt(0);if(e===1)return Ai(o)?"\\":r;if(N(o))if(i=!0,N(r.charCodeAt(1))){let a=2,l=a;for(;a<e&&!N(r.charCodeAt(a));)a++;if(a<e&&a!==l){let u=r.slice(l,a);for(l=a;a<e&&N(r.charCodeAt(a));)a++;if(a<e&&a!==l){for(l=a;a<e&&!N(r.charCodeAt(a));)a++;if(a===e)return`\\\\${u}\\${r.slice(l)}\\`;a!==l&&(n=`\\\\${u}\\${r.slice(l,a)}`,t=a)}}}else t=1;else Ve(o)&&r.charCodeAt(1)===Be&&(n=r.slice(0,2),t=2,e>2&&N(r.charCodeAt(2))&&(i=!0,t=3));let s=t<e?sr(r.slice(t),!i,"\\",N):"";if(s.length===0&&!i&&(s="."),s.length>0&&N(r.charCodeAt(e-1))&&(s+="\\"),!i&&n===void 0&&r.includes(":")){if(s.length>=2&&Ve(s.charCodeAt(0))&&s.charCodeAt(1)===Be)return`.\\${s}`;let a=r.indexOf(":");do if(a===e-1||N(r.charCodeAt(a+1)))return`.\\${s}`;while((a=r.indexOf(":",a+1))!==-1)}return n===void 0?i?`\\${s}`:s:i?`${n}\\${s}`:`${n}${s}`},isAbsolute(r){J(r,"path");let e=r.length;if(e===0)return!1;let t=r.charCodeAt(0);return N(t)||e>2&&Ve(t)&&r.charCodeAt(1)===Be&&N(r.charCodeAt(2))},join(...r){if(r.length===0)return".";let e,t;for(let o=0;o<r.length;++o){let s=r[o];J(s,"path"),s.length>0&&(e===void 0?e=t=s:e+=`\\${s}`)}if(e===void 0)return".";let n=!0,i=0;if(typeof t=="string"&&N(t.charCodeAt(0))){++i;let o=t.length;o>1&&N(t.charCodeAt(1))&&(++i,o>2&&(N(t.charCodeAt(2))?++i:n=!1))}if(n){for(;i<e.length&&N(e.charCodeAt(i));)i++;i>=2&&(e=`\\${e.slice(i)}`)}return Z.normalize(e)},relative(r,e){if(J(r,"from"),J(e,"to"),r===e)return"";let t=Z.resolve(r),n=Z.resolve(e);if(t===n||(r=t.toLowerCase(),e=n.toLowerCase(),r===e))return"";if(t.length!==r.length||n.length!==e.length){let f=t.split("\\"),b=n.split("\\");f[f.length-1]===""&&f.pop(),b[b.length-1]===""&&b.pop();let E=f.length,q=b.length,H=E<q?E:q,B;for(B=0;B<H&&f[B].toLowerCase()===b[B].toLowerCase();B++);return B===0?n:B===H?q>H?b.slice(B).join("\\"):E>H?"..\\".repeat(E-1-B)+"..":"":"..\\".repeat(E-B)+b.slice(B).join("\\")}let i=0;for(;i<r.length&&r.charCodeAt(i)===_e;)i++;let o=r.length;for(;o-1>i&&r.charCodeAt(o-1)===_e;)o--;let s=o-i,a=0;for(;a<e.length&&e.charCodeAt(a)===_e;)a++;let l=e.length;for(;l-1>a&&e.charCodeAt(l-1)===_e;)l--;let u=l-a,p=s<u?s:u,c=-1,d=0;for(;d<p;d++){let f=r.charCodeAt(i+d);if(f!==e.charCodeAt(a+d))break;f===_e&&(c=d)}if(d!==p){if(c===-1)return n}else{if(u>p){if(e.charCodeAt(a+d)===_e)return n.slice(a+d+1);if(d===2)return n.slice(a+d)}s>p&&(r.charCodeAt(i+d)===_e?c=d:d===2&&(c=3)),c===-1&&(c=0)}let m="";for(d=i+c+1;d<=o;++d)(d===o||r.charCodeAt(d)===_e)&&(m+=m.length===0?"..":"\\..");return a+=c,m.length>0?`${m}${n.slice(a,l)}`:(n.charCodeAt(a)===_e&&++a,n.slice(a,l))},toNamespacedPath(r){if(typeof r!="string"||r.length===0)return r;let e=Z.resolve(r);if(e.length<=2)return r;if(e.charCodeAt(0)===_e){if(e.charCodeAt(1)===_e){let t=e.charCodeAt(2);if(t!==iu&&t!==ht)return`\\\\?\\UNC\\${e.slice(2)}`}}else if(Ve(e.charCodeAt(0))&&e.charCodeAt(1)===Be&&e.charCodeAt(2)===_e)return`\\\\?\\${e}`;return e},dirname(r){J(r,"path");let e=r.length;if(e===0)return".";let t=-1,n=0,i=r.charCodeAt(0);if(e===1)return N(i)?r:".";if(N(i)){if(t=n=1,N(r.charCodeAt(1))){let a=2,l=a;for(;a<e&&!N(r.charCodeAt(a));)a++;if(a<e&&a!==l){for(l=a;a<e&&N(r.charCodeAt(a));)a++;if(a<e&&a!==l){for(l=a;a<e&&!N(r.charCodeAt(a));)a++;if(a===e)return r;a!==l&&(t=n=a+1)}}}}else Ve(i)&&r.charCodeAt(1)===Be&&(t=e>2&&N(r.charCodeAt(2))?3:2,n=t);let o=-1,s=!0;for(let a=e-1;a>=n;--a)if(N(r.charCodeAt(a))){if(!s){o=a;break}}else s=!1;if(o===-1){if(t===-1)return".";o=t}return r.slice(0,o)},basename(r,e){e!==void 0&&J(e,"suffix"),J(r,"path");let t=0,n=-1,i=!0,o;if(r.length>=2&&Ve(r.charCodeAt(0))&&r.charCodeAt(1)===Be&&(t=2),e!==void 0&&e.length>0&&e.length<=r.length){if(e===r)return"";let s=e.length-1,a=-1;for(o=r.length-1;o>=t;--o){let l=r.charCodeAt(o);if(N(l)){if(!i){t=o+1;break}}else a===-1&&(i=!1,a=o+1),s>=0&&(l===e.charCodeAt(s)?--s===-1&&(n=o):(s=-1,n=a))}return t===n?n=a:n===-1&&(n=r.length),r.slice(t,n)}for(o=r.length-1;o>=t;--o)if(N(r.charCodeAt(o))){if(!i){t=o+1;break}}else n===-1&&(i=!1,n=o+1);return n===-1?"":r.slice(t,n)},extname(r){J(r,"path");let e=0,t=-1,n=0,i=-1,o=!0,s=0;r.length>=2&&r.charCodeAt(1)===Be&&Ve(r.charCodeAt(0))&&(e=n=2);for(let a=r.length-1;a>=e;--a){let l=r.charCodeAt(a);if(N(l)){if(!o){n=a+1;break}continue}i===-1&&(o=!1,i=a+1),l===ht?t===-1?t=a:s!==1&&(s=1):t!==-1&&(s=-1)}return t===-1||i===-1||s===0||s===1&&t===i-1&&t===n+1?"":r.slice(t,i)},format:Es.bind(null,"\\"),parse(r){J(r,"path");let e={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return e;let t=r.length,n=0,i=r.charCodeAt(0);if(t===1)return N(i)?(e.root=e.dir=r,e):(e.base=e.name=r,e);if(N(i)){if(n=1,N(r.charCodeAt(1))){let c=2,d=c;for(;c<t&&!N(r.charCodeAt(c));)c++;if(c<t&&c!==d){for(d=c;c<t&&N(r.charCodeAt(c));)c++;if(c<t&&c!==d){for(d=c;c<t&&!N(r.charCodeAt(c));)c++;c===t?n=c:c!==d&&(n=c+1)}}}}else if(Ve(i)&&r.charCodeAt(1)===Be){if(t<=2)return e.root=e.dir=r,e;if(n=2,N(r.charCodeAt(2))){if(t===3)return e.root=e.dir=r,e;n=3}}n>0&&(e.root=r.slice(0,n));let o=-1,s=n,a=-1,l=!0,u=r.length-1,p=0;for(;u>=n;--u){if(i=r.charCodeAt(u),N(i)){if(!l){s=u+1;break}continue}a===-1&&(l=!1,a=u+1),i===ht?o===-1?o=u:p!==1&&(p=1):o!==-1&&(p=-1)}return a!==-1&&(o===-1||p===0||p===1&&o===a-1&&o===s+1?e.base=e.name=r.slice(s,a):(e.name=r.slice(s,o),e.base=r.slice(s,a),e.ext=r.slice(o,a))),s>0&&s!==n?e.dir=r.slice(0,s-1):e.dir=e.root,e},sep:"\\",delimiter:";",win32:null,posix:null},au=(()=>{if(xe){let r=/\\/g;return()=>{let e=ft().replace(r,"/");return e.slice(e.indexOf("/"))}}return()=>ft()})(),K={resolve(...r){let e="",t=!1;for(let n=r.length-1;n>=0&&!t;n--){let i=r[n];J(i,`paths[${n}]`),i.length!==0&&(e=`${i}/${e}`,t=i.charCodeAt(0)===ae)}if(!t){let n=au();e=`${n}/${e}`,t=n.charCodeAt(0)===ae}return e=sr(e,!t,"/",Ai),t?`/${e}`:e.length>0?e:"."},normalize(r){if(J(r,"path"),r.length===0)return".";let e=r.charCodeAt(0)===ae,t=r.charCodeAt(r.length-1)===ae;return r=sr(r,!e,"/",Ai),r.length===0?e?"/":t?"./":".":(t&&(r+="/"),e?`/${r}`:r)},isAbsolute(r){return J(r,"path"),r.length>0&&r.charCodeAt(0)===ae},join(...r){if(r.length===0)return".";let e=[];for(let t=0;t<r.length;++t){let n=r[t];J(n,"path"),n.length>0&&e.push(n)}return e.length===0?".":K.normalize(e.join("/"))},relative(r,e){if(J(r,"from"),J(e,"to"),r===e||(r=K.resolve(r),e=K.resolve(e),r===e))return"";let t=1,n=r.length,i=n-t,o=1,s=e.length-o,a=i<s?i:s,l=-1,u=0;for(;u<a;u++){let c=r.charCodeAt(t+u);if(c!==e.charCodeAt(o+u))break;c===ae&&(l=u)}if(u===a)if(s>a){if(e.charCodeAt(o+u)===ae)return e.slice(o+u+1);if(u===0)return e.slice(o+u)}else i>a&&(r.charCodeAt(t+u)===ae?l=u:u===0&&(l=0));let p="";for(u=t+l+1;u<=n;++u)(u===n||r.charCodeAt(u)===ae)&&(p+=p.length===0?"..":"/..");return`${p}${e.slice(o+l)}`},toNamespacedPath(r){return r},dirname(r){if(J(r,"path"),r.length===0)return".";let e=r.charCodeAt(0)===ae,t=-1,n=!0;for(let i=r.length-1;i>=1;--i)if(r.charCodeAt(i)===ae){if(!n){t=i;break}}else n=!1;return t===-1?e?"/":".":e&&t===1?"//":r.slice(0,t)},basename(r,e){e!==void 0&&J(e,"suffix"),J(r,"path");let t=0,n=-1,i=!0,o;if(e!==void 0&&e.length>0&&e.length<=r.length){if(e===r)return"";let s=e.length-1,a=-1;for(o=r.length-1;o>=0;--o){let l=r.charCodeAt(o);if(l===ae){if(!i){t=o+1;break}}else a===-1&&(i=!1,a=o+1),s>=0&&(l===e.charCodeAt(s)?--s===-1&&(n=o):(s=-1,n=a))}return t===n?n=a:n===-1&&(n=r.length),r.slice(t,n)}for(o=r.length-1;o>=0;--o)if(r.charCodeAt(o)===ae){if(!i){t=o+1;break}}else n===-1&&(i=!1,n=o+1);return n===-1?"":r.slice(t,n)},extname(r){J(r,"path");let e=-1,t=0,n=-1,i=!0,o=0;for(let s=r.length-1;s>=0;--s){let a=r[s];if(a==="/"){if(!i){t=s+1;break}continue}n===-1&&(i=!1,n=s+1),a==="."?e===-1?e=s:o!==1&&(o=1):e!==-1&&(o=-1)}return e===-1||n===-1||o===0||o===1&&e===n-1&&e===t+1?"":r.slice(e,n)},format:Es.bind(null,"/"),parse(r){J(r,"path");let e={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return e;let t=r.charCodeAt(0)===ae,n;t?(e.root="/",n=1):n=0;let i=-1,o=0,s=-1,a=!0,l=r.length-1,u=0;for(;l>=n;--l){let p=r.charCodeAt(l);if(p===ae){if(!a){o=l+1;break}continue}s===-1&&(a=!1,s=l+1),p===ht?i===-1?i=l:u!==1&&(u=1):i!==-1&&(u=-1)}if(s!==-1){let p=o===0&&t?1:o;i===-1||u===0||u===1&&i===s-1&&i===o+1?e.base=e.name=r.slice(p,s):(e.name=r.slice(p,i),e.base=r.slice(p,s),e.ext=r.slice(i,s))}return o>0?e.dir=r.slice(0,o-1):t&&(e.dir="/"),e},sep:"/",delimiter:":",win32:null,posix:null};K.win32=Z.win32=Z;K.posix=Z.posix=K;var ke=xe?Z.normalize:K.normalize,ar=xe?Z.isAbsolute:K.isAbsolute,O=xe?Z.join:K.join,gt=xe?Z.resolve:K.resolve,ws=xe?Z.relative:K.relative,Ke=xe?Z.dirname:K.dirname,yt=xe?Z.basename:K.basename,Cp=xe?Z.extname:K.extname,kp=xe?Z.format:K.format,Ss=xe?Z.parse:K.parse,Rp=xe?Z.toNamespacedPath:K.toNamespacedPath,We=xe?Z.sep:K.sep,lr=xe?Z.delimiter:K.delimiter;var lu=/^\w[\w\d+.-]*$/,uu=/^\//,cu=/^\/\//;function du(r,e){if(!r.scheme&&e)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${r.authority}", path: "${r.path}", query: "${r.query}", fragment: "${r.fragment}"}`);if(r.scheme&&!lu.test(r.scheme)){let t=[...r.scheme.matchAll(/[^\w\d+.-]/gu)],n=t.length>0?` Found '${t[0][0]}' at index ${t[0].index} (${t.length} total)`:"";throw new Error(`[UriError]: Scheme contains illegal characters.${n} (len:${r.scheme.length})`)}if(r.path){if(r.authority){if(!uu.test(r.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(cu.test(r.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}function pu(r,e){return!r&&!e?"file":r}function mu(r,e){switch(r){case"https":case"http":case"file":e?e[0]!==Re&&(e=Re+e):e=Re;break}return e}var X="",Re="/",fu=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,A=class r{static isUri(e){return e instanceof r?!0:!e||typeof e!="object"?!1:typeof e.authority=="string"&&typeof e.fragment=="string"&&typeof e.path=="string"&&typeof e.query=="string"&&typeof e.scheme=="string"&&typeof e.fsPath=="string"&&typeof e.with=="function"&&typeof e.toString=="function"}constructor(e,t,n,i,o,s=!1){typeof e=="object"?(this.scheme=e.scheme||X,this.authority=e.authority||X,this.path=e.path||X,this.query=e.query||X,this.fragment=e.fragment||X):(this.scheme=pu(e,s),this.authority=t||X,this.path=mu(this.scheme,n||X),this.query=i||X,this.fragment=o||X,du(this,s))}get fsPath(){return mn(this,!1)}with(e){if(!e)return this;let{scheme:t,authority:n,path:i,query:o,fragment:s}=e;return t===void 0?t=this.scheme:t===null&&(t=X),n===void 0?n=this.authority:n===null&&(n=X),i===void 0?i=this.path:i===null&&(i=X),o===void 0?o=this.query:o===null&&(o=X),s===void 0?s=this.fragment:s===null&&(s=X),t===this.scheme&&n===this.authority&&i===this.path&&o===this.query&&s===this.fragment?this:new Je(t,n,i,o,s)}static parse(e,t=!1){let n=fu.exec(e);return n?new Je(n[2]||X,ur(n[4]||X),ur(n[5]||X),ur(n[7]||X),ur(n[9]||X),t):new Je(X,X,X,X,X)}static file(e){let t=X;if(w&&(e=e.replace(/\\/g,Re)),e[0]===Re&&e[1]===Re){let n=e.indexOf(Re,2);n===-1?(t=e.substring(2),e=Re):(t=e.substring(2,n),e=e.substring(n)||Re)}return new Je("file",t,e,X,X)}static from(e,t){return new Je(e.scheme,e.authority,e.path,e.query,e.fragment,t)}static joinPath(e,...t){if(!e.path)throw new Error(`[UriError]: cannot call joinPath on URI without path: ${e.toString()}`);let n;return w&&e.scheme==="file"?n=r.file(Z.join(mn(e,!0),...t)).path:n=K.join(e.path,...t),e.with({path:n})}toString(e=!1){return Oi(this,e)}toJSON(){return this}static revive(e){if(e){if(e instanceof r)return e;{let t=new Je(e);return t._formatted=e.external??null,t._fsPath=e._sep===Rs?e.fsPath??null:null,t}}else return e}[Symbol.for("debug.description")](){return`URI(${this.toString()})`}};var Rs=w?1:void 0,Je=class extends A{constructor(){super(...arguments);this._formatted=null;this._fsPath=null}get fsPath(){return this._fsPath||(this._fsPath=mn(this,!1)),this._fsPath}toString(t=!1){return t?Oi(this,!0):(this._formatted||(this._formatted=Oi(this,!1)),this._formatted)}toJSON(){let t={$mid:1};return this._fsPath&&(t.fsPath=this._fsPath,t._sep=Rs),this._formatted&&(t.external=this._formatted),this.path&&(t.path=this.path),this.scheme&&(t.scheme=this.scheme),this.authority&&(t.authority=this.authority),this.query&&(t.query=this.query),this.fragment&&(t.fragment=this.fragment),t}},Ls={58:"%3A",47:"%2F",63:"%3F",35:"%23",91:"%5B",93:"%5D",64:"%40",33:"%21",36:"%24",38:"%26",39:"%27",40:"%28",41:"%29",42:"%2A",43:"%2B",44:"%2C",59:"%3B",61:"%3D",32:"%20"};function Ps(r,e,t){let n,i=-1;for(let o=0;o<r.length;o++){let s=r.charCodeAt(o);if(s>=97&&s<=122||s>=65&&s<=90||s>=48&&s<=57||s===45||s===46||s===95||s===126||e&&s===47||t&&s===91||t&&s===93||t&&s===58)i!==-1&&(n+=encodeURIComponent(r.substring(i,o)),i=-1),n!==void 0&&(n+=r.charAt(o));else{n===void 0&&(n=r.substr(0,o));let a=Ls[s];a!==void 0?(i!==-1&&(n+=encodeURIComponent(r.substring(i,o)),i=-1),n+=a):i===-1&&(i=o)}}return i!==-1&&(n+=encodeURIComponent(r.substring(i))),n!==void 0?n:r}function hu(r){let e;for(let t=0;t<r.length;t++){let n=r.charCodeAt(t);n===35||n===63?(e===void 0&&(e=r.substr(0,t)),e+=Ls[n]):e!==void 0&&(e+=r[t])}return e!==void 0?e:r}function mn(r,e){let t;return r.authority&&r.path.length>1&&r.scheme==="file"?t=`//${r.authority}${r.path}`:r.path.charCodeAt(0)===47&&(r.path.charCodeAt(1)>=65&&r.path.charCodeAt(1)<=90||r.path.charCodeAt(1)>=97&&r.path.charCodeAt(1)<=122)&&r.path.charCodeAt(2)===58?e?t=r.path.substr(1):t=r.path[1].toLowerCase()+r.path.substr(2):t=r.path,w&&(t=t.replace(/\//g,"\\")),t}function Oi(r,e){let t=e?hu:Ps,n="",{scheme:i,authority:o,path:s,query:a,fragment:l}=r;if(i&&(n+=i,n+=":"),(o||i==="file")&&(n+=Re,n+=Re),o){let u=o.indexOf("@");if(u!==-1){let p=o.substr(0,u);o=o.substr(u+1),u=p.lastIndexOf(":"),u===-1?n+=t(p,!1,!1):(n+=t(p.substr(0,u),!1,!1),n+=":",n+=t(p.substr(u+1),!1,!0)),n+="@"}o=o.toLowerCase(),u=o.lastIndexOf(":"),u===-1?n+=t(o,!1,!0):(n+=t(o.substr(0,u),!1,!0),n+=o.substr(u))}if(s){if(s.length>=3&&s.charCodeAt(0)===47&&s.charCodeAt(2)===58){let u=s.charCodeAt(1);u>=65&&u<=90&&(s=`/${String.fromCharCode(u+32)}:${s.substr(3)}`)}else if(s.length>=2&&s.charCodeAt(1)===58){let u=s.charCodeAt(0);u>=65&&u<=90&&(s=`${String.fromCharCode(u+32)}:${s.substr(2)}`)}n+=t(s,!0,!1)}return a&&(n+="?",n+=t(a,!1,!1)),l&&(n+="#",n+=e?l:Ps(l,!1,!1)),n}function Ds(r){try{return decodeURIComponent(r)}catch{return r.length>3?r.substr(0,3)+Ds(r.substr(3)):r}}var Cs=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function ur(r){return r.match(Cs)?r.replace(Cs,e=>Ds(e)):r}var As=new class{transformIncoming(r){return r}transformOutgoing(r){return r}transformOutgoingURI(r){return r}transformOutgoingScheme(r){return r}};var Os=class r{static{this.Undefined=new r(void 0)}constructor(e){this.element=e,this.next=r.Undefined,this.prev=r.Undefined}};var gu=globalThis.performance.now.bind(globalThis.performance),cr=class r{static create(e){return new r(e)}constructor(e){this._now=e===!1?Date.now:gu,this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}};var Ms=!1,yu=!1,vu=100,Us=6e4;function Fs(){return!!ne.VSCODE_DEV}var S;(st=>{st.None=()=>C.None;function e(I){if(yu){let{onDidAddListener:v}=I,_=Bt.create(),x=0;I.onDidAddListener=()=>{++x===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),_.print()),v?.()}}}function t(I,v,_){return m(I,()=>{},0,void 0,v??!0,void 0,_)}st.defer=t;function n(I){return(v,_=null,x)=>{let T=!1,k;return k=I(U=>{if(!T)return k?k.dispose():T=!0,v.call(_,U)},null,x),T&&k.dispose(),k}}st.once=n;function i(I,v){return st.once(st.filter(I,v))}st.onceIf=i;function o(I,v,_){return c((x,T=null,k)=>I(U=>x.call(T,v(U)),null,k),_)}st.map=o;function s(I,v,_){return c((x,T=null,k)=>I(U=>{v(U),x.call(T,U)},null,k),_)}st.forEach=s;function a(I,v,_){return c((x,T=null,k)=>I(U=>v(U)&&x.call(T,U),null,k),_)}st.filter=a;function l(I){return I}st.signal=l;function u(...I){return(v,_=null,x)=>{let T=us(...I.map(k=>k(U=>v.call(_,U))));return d(T,x)}}st.any=u;function p(I,v,_,x){let T=_;return o(I,k=>(T=v(T,k),T),x)}st.reduce=p;function c(I,v){let _,x={onWillAddFirstListener(){_=I(T.fire,T)},onDidRemoveLastListener(){_?.dispose()}};v||e(x);let T=new y(x);return v?.add(T),T.event}function d(I,v){return v instanceof Array?v.push(I):v&&v.add(I),I}function m(I,v,_=100,x=!1,T=!1,k,U){let oe,j,ue,se=0,pe,Ue={leakWarningThreshold:k,onWillAddFirstListener(){oe=I(Uo=>{se++,j=v(j,Uo),x&&!ue&&(at.fire(j),j=void 0),pe=()=>{let Fo=j;j=void 0,ue=void 0,(!x||se>1)&&at.fire(Fo),se=0},typeof _=="number"?(ue&&clearTimeout(ue),ue=setTimeout(pe,_)):ue===void 0&&(ue=null,queueMicrotask(pe))})},onWillRemoveListener(){T&&se>0&&pe?.()},onDidRemoveLastListener(){pe=void 0,oe.dispose()}};U||e(Ue);let at=new y(Ue);return U?.add(at),at.event}st.debounce=m;function f(I,v=0,_,x){return st.debounce(I,(T,k)=>T?(T.push(k),T):[k],v,void 0,_??!0,void 0,x)}st.accumulate=f;function b(I,v,_=100,x=!0,T=!0,k,U){let oe,j,ue,se=0,pe={leakWarningThreshold:k,onWillAddFirstListener(){oe=I(at=>{se++,j=v(j,at),ue===void 0&&(x&&(Ue.fire(j),j=void 0,se=0),typeof _=="number"?ue=setTimeout(()=>{T&&se>0&&Ue.fire(j),j=void 0,ue=void 0,se=0},_):(ue=0,queueMicrotask(()=>{T&&se>0&&Ue.fire(j),j=void 0,ue=void 0,se=0})))})},onDidRemoveLastListener(){oe.dispose()}};U||e(pe);let Ue=new y(pe);return U?.add(Ue),Ue.event}st.throttle=b;function E(I,v=(x,T)=>x===T,_){let x=!0,T;return a(I,k=>{let U=x||!v(k,T);return x=!1,T=k,U},_)}st.latch=E;function q(I,v,_){return[st.filter(I,v,_),st.filter(I,x=>!v(x),_)]}st.split=q;function H(I,v,_=!1,x=[],T){let k=x.slice(),U;Fs()&&(U={stack:Bt.create(),timerId:setTimeout(()=>{k&&k.length>0&&U&&!U.warned&&(U.warned=!0,console.warn(`[Event.buffer][${v}] potential LEAK detected: ${k.length} events buffered for ${Us/1e3}s without being consumed. Buffered here:`),U.stack.print())},Us),warned:!1},T&&T.add(Q(()=>clearTimeout(U.timerId))));let oe=()=>{U&&clearTimeout(U.timerId)},j=I(pe=>{k?(k.push(pe),Fs()&&U&&!U.warned&&k.length>=vu&&(U.warned=!0,console.warn(`[Event.buffer][${v}] potential LEAK detected: ${k.length} events buffered without being consumed. Buffered here:`),U.stack.print())):se.fire(pe)});T&&T.add(j);let ue=()=>{k?.forEach(pe=>se.fire(pe)),k=null,oe()},se=new y({onWillAddFirstListener(){j||(j=I(pe=>se.fire(pe)),T&&T.add(j))},onDidAddFirstListener(){k&&(_?setTimeout(ue):ue())},onDidRemoveLastListener(){j&&j.dispose(),j=null,oe()}});return T&&T.add(se),se.event}st.buffer=H;function B(I,v){return(x,T,k)=>{let U=v(new ci);return I(function(oe){let j=U.evaluate(oe);j!==ge&&x.call(T,j)},void 0,k)}}st.chain=B;let ge=Symbol("HaltChainable");class ci{constructor(){this.steps=[]}map(v){return this.steps.push(v),this}forEach(v){return this.steps.push(_=>(v(_),_)),this}filter(v){return this.steps.push(_=>v(_)?_:ge),this}reduce(v,_){let x=_;return this.steps.push(T=>(x=v(x,T),x)),this}latch(v=(_,x)=>_===x){let _=!0,x;return this.steps.push(T=>{let k=_||!v(T,x);return _=!1,x=T,k?T:ge}),this}evaluate(v){for(let _ of this.steps)if(v=_(v),v===ge)break;return v}}function di(I,v,_=x=>x){let x=(...oe)=>U.fire(_(...oe)),T=()=>I.on(v,x),k=()=>I.removeListener(v,x),U=new y({onWillAddFirstListener:T,onDidRemoveLastListener:k});return U.event}st.fromNodeEventEmitter=di;function P(I,v,_=x=>x){let x=(...oe)=>U.fire(_(...oe)),T=()=>I.addEventListener(v,x),k=()=>I.removeEventListener(v,x),U=new y({onWillAddFirstListener:T,onDidRemoveLastListener:k});return U.event}st.fromDOMEventEmitter=P;function M(I,v){let _,x,T=new Promise(k=>{x=n(I)(k),Bi(x,v),_=()=>{Bs(x,v)}});return T.cancel=_,v&&T.finally(()=>Bs(x,v)),T}st.toPromise=M;function z(I,v){return I(_=>v.fire(_))}st.forward=z;function de(I,v,_){return v(_),I(x=>v(x))}st.runAndSubscribe=de;class ot{constructor(v,_){this._observable=v;this._counter=0;this._hasChanged=!1;let x={onWillAddFirstListener:()=>{v.addObserver(this),this._observable.reportChanges()},onDidRemoveLastListener:()=>{v.removeObserver(this)}};_||e(x),this.emitter=new y(x),_&&_.add(this.emitter)}beginUpdate(v){this._counter++}handlePossibleChange(v){}handleChange(v,_){this._hasChanged=!0}endUpdate(v){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function Xn(I,v){return new ot(I,v).emitter.event}st.fromObservable=Xn;function Il(I){return(v,_,x)=>{let T=0,k=!1,U={beginUpdate(){T++},endUpdate(){T--,T===0&&(I.reportChanges(),k&&(k=!1,v.call(_)))},handlePossibleChange(){},handleChange(){k=!0}};I.addObserver(U),I.reportChanges();let oe={dispose(){I.removeObserver(U)}};return Bi(oe,x),oe}}st.fromObservableLight=Il})(S||={});var Mi=class r{constructor(e){this.listenerCount=0;this.invocationCount=0;this.elapsedOverall=0;this.durations=[];this.name=`${e}_${r._idPool++}`,r.all.add(this)}static{this.all=new Set}static{this._idPool=0}start(e){this._stopWatch=new cr,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}},Ns=-1;var bu=1;function Vs(){return(bu++).toString(16).padStart(3,"0")}var Ui=class{constructor(e,t,n=Vs()){this._errorHandler=e;this.threshold=t;this.name=n;this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t<n)return;this._stacks||(this._stacks=new Map);let i=e.value,o=this._stacks.get(i)||0;if(this._stacks.set(i,o+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=n*.5;let[s,a]=this.getMostFrequentStack(),l=/^[0-9a-f]+$/i.test(this.name)?void 0:this.name,u=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${a}):`;console.warn(u),console.warn(s);let p=a/t>.3?"dominated":"popular",c=new dr(p,u,s,t,l);this._errorHandler(c)}return()=>{let s=this._stacks.get(i)||0;s<=1?this._stacks.delete(i):this._stacks.set(i,s-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[n,i]of this._stacks)(!e||t<i)&&(e=[n,i],t=i);return e}},Bt=class r{constructor(e){this.value=e}static create(){let e=new Error;return new r(e.stack??"")}print(){console.warn(this.value.split(`
`).slice(2).join(`
`))}},dr=class r extends Error{constructor(e,t,n,i,o){super(o?`[${o}] potential listener LEAK detected, ${e}`:`potential listener LEAK detected, ${e}`),this.name="ListenerLeakError",this.kind=e,this.listenerCount=i,this.details=t,this.stack=n}static is(e){return e instanceof r||e instanceof Error&&typeof e.kind=="string"&&typeof e.listenerCount=="number"}},Fi=class extends dr{constructor(e,t,n,i,o){super(e,t,n,i,o),this.name="ListenerRefusalError"}},_u=0,Nt=class{constructor(e){this.value=e;this.id=_u++}},xu=2,Iu=(r,e)=>{if(r instanceof Nt)e(r);else for(let t=0;t<r.length;t++){let n=r[t];n&&e(n)}},y=class{constructor(e){this._size=0;this._options=e,(Ns>0||this._options?.leakWarningThreshold)&&(this._leakWarningThreshold=this._options?.leakWarningThreshold??Ns,this._leakWarningName=this._options?.leakWarningName??Vs(),this._leakWarningErrorHandler=this._options?.onListenerError??Qe),this._perfMon=this._options?._profName?new Mi(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}_getLeakageMonitor(){if(!(this._leakWarningThreshold===void 0||this._leakWarningName===void 0||this._leakWarningErrorHandler===void 0))return this._leakageMon??=new Ui(this._leakWarningErrorHandler,this._leakWarningThreshold,this._leakWarningName)}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(Ms){let e=this._listeners;queueMicrotask(()=>{Iu(e,t=>t.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??=(e,t,n)=>{if(this._leakWarningThreshold!==void 0&&this._size>this._leakWarningThreshold**2){let l=this._getLeakageMonitor();if(l){let u=`[${l.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${l.threshold})`;console.warn(u);let p=l.getMostFrequentStack()??["UNKNOWN stack",-1],c=p[1]/this._size>.3?"dominated":"popular",d=new Fi(c,`${u}. HINT: Stack shows most frequent listener (${p[1]}-times)`,p[0],this._size,this._options?.leakWarningName);return(this._options?.onListenerError||Qe)(d),C.None}}if(this._disposed)return C.None;t&&(e=e.bind(t));let i=new Nt(e),o,s;if(this._leakWarningThreshold!==void 0&&this._size>=Math.ceil(this._leakWarningThreshold*.2)){let l=this._getLeakageMonitor();l&&(i.stack=Bt.create(),o=l.check(i.stack,this._size+1))}Ms&&(i.stack=s??Bt.create()),this._listeners?this._listeners instanceof Nt?(this._deliveryQueue??=new Ni,this._listeners=[this._listeners,i]):this._listeners.push(i):(this._options?.onWillAddFirstListener?.(this),this._listeners=i,this._options?.onDidAddFirstListener?.(this)),this._options?.onDidAddListener?.(this),this._size++;let a=Q(()=>{o?.(),this._removeListener(i)});return Bi(a,n),a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[n]=void 0;let i=this._deliveryQueue.current===this;if(this._size*xu<=t.length){let o=0;for(let s=0;s<t.length;s++)t[s]?t[o++]=t[s]:i&&o<this._deliveryQueue.end&&(this._deliveryQueue.end--,o<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=o}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||Qe;if(!n){e.value(t);return}try{e.value(t)}catch(i){n(i)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof Nt)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}};var Ni=class{constructor(){this.i=-1;this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}};var pr=class{constructor(){this.hasListeners=!1;this.events=[];this.emitter=new y({onWillAddFirstListener:()=>this.onFirstListenerAdd(),onDidRemoveLastListener:()=>this.onLastListenerRemove()})}get event(){return this.emitter.event}add(e){let t={event:e,listener:null};return this.events.push(t),this.hasListeners&&this.hook(t),Q(on(()=>{this.hasListeners&&this.unhook(t);let i=this.events.indexOf(t);this.events.splice(i,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(t=>this.emitter.fire(t))}unhook(e){e.listener?.dispose(),e.listener=null}dispose(){this.emitter.dispose();for(let e of this.events)e.listener?.dispose();this.events=[]}};var mr=class{constructor(){this.listening=!1;this.inputEvent=S.None;this.inputEventListener=C.None;this.emitter=new y({onDidAddFirstListener:()=>{this.listening=!0,this.inputEventListener=this.inputEvent(this.emitter.fire,this.emitter)},onDidRemoveLastListener:()=>{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()}};function Bi(r,e){e instanceof me?e.add(r):Array.isArray(e)&&e.push(r)}function Bs(r,e){if(e instanceof me)e.delete(r);else if(Array.isArray(e)){let t=e.indexOf(r);t!==-1&&e.splice(t,1)}r.dispose()}var Ks=Object.freeze(function(r,e){let t=setTimeout(r.bind(e),0);return{dispose(){clearTimeout(t)}}}),bt;(n=>{function r(i){return i===n.None||i===n.Cancelled||i instanceof Vt?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}n.isCancellationToken=r,n.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:S.None}),n.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Ks})})(bt||={});var Vt=class{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?Ks:(this._emitter||(this._emitter=new y),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Oe=class{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 Vt),this._token}cancel(){this._token?this._token instanceof Vt&&this._token.cancel():this._token=bt.Cancelled}dispose(e=!1){e&&this.cancel(),this._parentListener?.dispose(),this._token?this._token instanceof Vt&&this._token.dispose():this._token=bt.None}};function Tu(r){return r}var fr=class{constructor(e,t){this.lastCache=void 0;this.lastArgKey=void 0;typeof e=="function"?(this._fn=e,this._computeKey=Tu):(this._fn=t,this._computeKey=e.getCacheKey)}get(e){let t=this._computeKey(e);return this.lastArgKey!==t&&(this.lastArgKey=t,this.lastCache=this._fn(e)),this.lastCache}};function Hs(r){return!r||typeof r!="string"?!0:r.trim().length===0}var Eu=/{(\d+)}/g;function _t(r,...e){return e.length===0?r:r.replace(Eu,function(t,n){let i=parseInt(n,10);return isNaN(i)||i<0||i>=e.length?t:e[i]})}function Vi(r,e){if(!r||!e)return r;let t=e.length,n=r.length;if(t===1){let o=n,s=e.charCodeAt(0);for(;o>0&&r.charCodeAt(o-1)===s;)o--;return r.substring(0,o)}let i=n;for(;i>0&&r.endsWith(e,i);)i-=t;return r.substring(0,i)}function fn(r,e){return r<e?-1:r>e?1:0}function hr(r,e,t=0,n=r.length,i=0,o=e.length){for(;t<n&&i<o;t++,i++){let l=r.charCodeAt(t),u=e.charCodeAt(i);if(l<u)return-1;if(l>u)return 1}let s=n-t,a=o-i;return s<a?-1:s>a?1:0}function Ki(r,e){return Kt(r,e,0,r.length,0,e.length)}function Kt(r,e,t=0,n=r.length,i=0,o=e.length){for(;t<n&&i<o;t++,i++){let l=r.charCodeAt(t),u=e.charCodeAt(i);if(l===u)continue;if(l>=128||u>=128)return hr(r.toLowerCase(),e.toLowerCase(),t,n,i,o);Ws(l)&&(l-=32),Ws(u)&&(u-=32);let p=l-u;if(p!==0)return p}let s=n-t,a=o-i;return s<a?-1:s>a?1:0}function Ws(r){return r>=97&&r<=122}function Wi(r){return r>=65&&r<=90}function gr(r,e){return r.length===e.length&&Kt(r,e)===0}function yr(r,e){let t=e.length;return t<=r.length&&Kt(r,e,0,t)===0}function js(r){return 55296<=r&&r<=56319}function $i(r){return 56320<=r&&r<=57343}function Gs(r,e){return(r-55296<<10)+(e-56320)+65536}var wu=/(?:\x1b\[|\x9b)[=?>!]?[\d;:]*["$#'* ]?[a-zA-Z@^`{}|~]/,Su=/(?:\x1b\]|\x9d).*?(?:\x1b\\|\x07|\x9c)/,Pu=/\x1b(?:[ #%\(\)\*\+\-\.\/]?[a-zA-Z0-9\|}~@])/,Cu=new RegExp("(?:"+[wu.source,Su.source,Pu.source].join("|")+")","g");function ku(r){return r&&(r=r.replace(Cu,"")),r}var Ru=/\\\[.*?\\\]/g;function Xs(r){return ku(r).replace(Ru,"")}var mm=String.fromCharCode(65279);var $s=class r{static{this._INSTANCE=null}static getInstance(){return r._INSTANCE||(r._INSTANCE=new r),r._INSTANCE}constructor(){this._data=Lu()}getGraphemeBreakType(e){if(e<32)return e===10?3:e===13?2:4;if(e<127)return 0;let t=this._data,n=t.length/3,i=1;for(;i<=n;)if(e<t[3*i])i=2*i;else if(e>t[3*i+1])i=2*i+1;else return t[3*i+2];return 0}};function Lu(){return JSON.parse("[0,0,0,51229,51255,12,44061,44087,12,127462,127487,6,7083,7085,5,47645,47671,12,54813,54839,12,128678,128678,14,3270,3270,5,9919,9923,14,45853,45879,12,49437,49463,12,53021,53047,12,71216,71218,7,128398,128399,14,129360,129374,14,2519,2519,5,4448,4519,9,9742,9742,14,12336,12336,14,44957,44983,12,46749,46775,12,48541,48567,12,50333,50359,12,52125,52151,12,53917,53943,12,69888,69890,5,73018,73018,5,127990,127990,14,128558,128559,14,128759,128760,14,129653,129655,14,2027,2035,5,2891,2892,7,3761,3761,5,6683,6683,5,8293,8293,4,9825,9826,14,9999,9999,14,43452,43453,5,44509,44535,12,45405,45431,12,46301,46327,12,47197,47223,12,48093,48119,12,48989,49015,12,49885,49911,12,50781,50807,12,51677,51703,12,52573,52599,12,53469,53495,12,54365,54391,12,65279,65279,4,70471,70472,7,72145,72147,7,119173,119179,5,127799,127818,14,128240,128244,14,128512,128512,14,128652,128652,14,128721,128722,14,129292,129292,14,129445,129450,14,129734,129743,14,1476,1477,5,2366,2368,7,2750,2752,7,3076,3076,5,3415,3415,5,4141,4144,5,6109,6109,5,6964,6964,5,7394,7400,5,9197,9198,14,9770,9770,14,9877,9877,14,9968,9969,14,10084,10084,14,43052,43052,5,43713,43713,5,44285,44311,12,44733,44759,12,45181,45207,12,45629,45655,12,46077,46103,12,46525,46551,12,46973,46999,12,47421,47447,12,47869,47895,12,48317,48343,12,48765,48791,12,49213,49239,12,49661,49687,12,50109,50135,12,50557,50583,12,51005,51031,12,51453,51479,12,51901,51927,12,52349,52375,12,52797,52823,12,53245,53271,12,53693,53719,12,54141,54167,12,54589,54615,12,55037,55063,12,69506,69509,5,70191,70193,5,70841,70841,7,71463,71467,5,72330,72342,5,94031,94031,5,123628,123631,5,127763,127765,14,127941,127941,14,128043,128062,14,128302,128317,14,128465,128467,14,128539,128539,14,128640,128640,14,128662,128662,14,128703,128703,14,128745,128745,14,129004,129007,14,129329,129330,14,129402,129402,14,129483,129483,14,129686,129704,14,130048,131069,14,173,173,4,1757,1757,1,2200,2207,5,2434,2435,7,2631,2632,5,2817,2817,5,3008,3008,5,3201,3201,5,3387,3388,5,3542,3542,5,3902,3903,7,4190,4192,5,6002,6003,5,6439,6440,5,6765,6770,7,7019,7027,5,7154,7155,7,8205,8205,13,8505,8505,14,9654,9654,14,9757,9757,14,9792,9792,14,9852,9853,14,9890,9894,14,9937,9937,14,9981,9981,14,10035,10036,14,11035,11036,14,42654,42655,5,43346,43347,7,43587,43587,5,44006,44007,7,44173,44199,12,44397,44423,12,44621,44647,12,44845,44871,12,45069,45095,12,45293,45319,12,45517,45543,12,45741,45767,12,45965,45991,12,46189,46215,12,46413,46439,12,46637,46663,12,46861,46887,12,47085,47111,12,47309,47335,12,47533,47559,12,47757,47783,12,47981,48007,12,48205,48231,12,48429,48455,12,48653,48679,12,48877,48903,12,49101,49127,12,49325,49351,12,49549,49575,12,49773,49799,12,49997,50023,12,50221,50247,12,50445,50471,12,50669,50695,12,50893,50919,12,51117,51143,12,51341,51367,12,51565,51591,12,51789,51815,12,52013,52039,12,52237,52263,12,52461,52487,12,52685,52711,12,52909,52935,12,53133,53159,12,53357,53383,12,53581,53607,12,53805,53831,12,54029,54055,12,54253,54279,12,54477,54503,12,54701,54727,12,54925,54951,12,55149,55175,12,68101,68102,5,69762,69762,7,70067,70069,7,70371,70378,5,70720,70721,7,71087,71087,5,71341,71341,5,71995,71996,5,72249,72249,7,72850,72871,5,73109,73109,5,118576,118598,5,121505,121519,5,127245,127247,14,127568,127569,14,127777,127777,14,127872,127891,14,127956,127967,14,128015,128016,14,128110,128172,14,128259,128259,14,128367,128368,14,128424,128424,14,128488,128488,14,128530,128532,14,128550,128551,14,128566,128566,14,128647,128647,14,128656,128656,14,128667,128673,14,128691,128693,14,128715,128715,14,128728,128732,14,128752,128752,14,128765,128767,14,129096,129103,14,129311,129311,14,129344,129349,14,129394,129394,14,129413,129425,14,129466,129471,14,129511,129535,14,129664,129666,14,129719,129722,14,129760,129767,14,917536,917631,5,13,13,2,1160,1161,5,1564,1564,4,1807,1807,1,2085,2087,5,2307,2307,7,2382,2383,7,2497,2500,5,2563,2563,7,2677,2677,5,2763,2764,7,2879,2879,5,2914,2915,5,3021,3021,5,3142,3144,5,3263,3263,5,3285,3286,5,3398,3400,7,3530,3530,5,3633,3633,5,3864,3865,5,3974,3975,5,4155,4156,7,4229,4230,5,5909,5909,7,6078,6085,7,6277,6278,5,6451,6456,7,6744,6750,5,6846,6846,5,6972,6972,5,7074,7077,5,7146,7148,7,7222,7223,5,7416,7417,5,8234,8238,4,8417,8417,5,9000,9000,14,9203,9203,14,9730,9731,14,9748,9749,14,9762,9763,14,9776,9783,14,9800,9811,14,9831,9831,14,9872,9873,14,9882,9882,14,9900,9903,14,9929,9933,14,9941,9960,14,9974,9974,14,9989,9989,14,10006,10006,14,10062,10062,14,10160,10160,14,11647,11647,5,12953,12953,14,43019,43019,5,43232,43249,5,43443,43443,5,43567,43568,7,43696,43696,5,43765,43765,7,44013,44013,5,44117,44143,12,44229,44255,12,44341,44367,12,44453,44479,12,44565,44591,12,44677,44703,12,44789,44815,12,44901,44927,12,45013,45039,12,45125,45151,12,45237,45263,12,45349,45375,12,45461,45487,12,45573,45599,12,45685,45711,12,45797,45823,12,45909,45935,12,46021,46047,12,46133,46159,12,46245,46271,12,46357,46383,12,46469,46495,12,46581,46607,12,46693,46719,12,46805,46831,12,46917,46943,12,47029,47055,12,47141,47167,12,47253,47279,12,47365,47391,12,47477,47503,12,47589,47615,12,47701,47727,12,47813,47839,12,47925,47951,12,48037,48063,12,48149,48175,12,48261,48287,12,48373,48399,12,48485,48511,12,48597,48623,12,48709,48735,12,48821,48847,12,48933,48959,12,49045,49071,12,49157,49183,12,49269,49295,12,49381,49407,12,49493,49519,12,49605,49631,12,49717,49743,12,49829,49855,12,49941,49967,12,50053,50079,12,50165,50191,12,50277,50303,12,50389,50415,12,50501,50527,12,50613,50639,12,50725,50751,12,50837,50863,12,50949,50975,12,51061,51087,12,51173,51199,12,51285,51311,12,51397,51423,12,51509,51535,12,51621,51647,12,51733,51759,12,51845,51871,12,51957,51983,12,52069,52095,12,52181,52207,12,52293,52319,12,52405,52431,12,52517,52543,12,52629,52655,12,52741,52767,12,52853,52879,12,52965,52991,12,53077,53103,12,53189,53215,12,53301,53327,12,53413,53439,12,53525,53551,12,53637,53663,12,53749,53775,12,53861,53887,12,53973,53999,12,54085,54111,12,54197,54223,12,54309,54335,12,54421,54447,12,54533,54559,12,54645,54671,12,54757,54783,12,54869,54895,12,54981,55007,12,55093,55119,12,55243,55291,10,66045,66045,5,68325,68326,5,69688,69702,5,69817,69818,5,69957,69958,7,70089,70092,5,70198,70199,5,70462,70462,5,70502,70508,5,70750,70750,5,70846,70846,7,71100,71101,5,71230,71230,7,71351,71351,5,71737,71738,5,72000,72000,7,72160,72160,5,72273,72278,5,72752,72758,5,72882,72883,5,73031,73031,5,73461,73462,7,94192,94193,7,119149,119149,7,121403,121452,5,122915,122916,5,126980,126980,14,127358,127359,14,127535,127535,14,127759,127759,14,127771,127771,14,127792,127793,14,127825,127867,14,127897,127899,14,127945,127945,14,127985,127986,14,128000,128007,14,128021,128021,14,128066,128100,14,128184,128235,14,128249,128252,14,128266,128276,14,128335,128335,14,128379,128390,14,128407,128419,14,128444,128444,14,128481,128481,14,128499,128499,14,128526,128526,14,128536,128536,14,128543,128543,14,128556,128556,14,128564,128564,14,128577,128580,14,128643,128645,14,128649,128649,14,128654,128654,14,128660,128660,14,128664,128664,14,128675,128675,14,128686,128689,14,128695,128696,14,128705,128709,14,128717,128719,14,128725,128725,14,128736,128741,14,128747,128748,14,128755,128755,14,128762,128762,14,128981,128991,14,129009,129023,14,129160,129167,14,129296,129304,14,129320,129327,14,129340,129342,14,129356,129356,14,129388,129392,14,129399,129400,14,129404,129407,14,129432,129442,14,129454,129455,14,129473,129474,14,129485,129487,14,129648,129651,14,129659,129660,14,129671,129679,14,129709,129711,14,129728,129730,14,129751,129753,14,129776,129782,14,917505,917505,4,917760,917999,5,10,10,3,127,159,4,768,879,5,1471,1471,5,1536,1541,1,1648,1648,5,1767,1768,5,1840,1866,5,2070,2073,5,2137,2139,5,2274,2274,1,2363,2363,7,2377,2380,7,2402,2403,5,2494,2494,5,2507,2508,7,2558,2558,5,2622,2624,7,2641,2641,5,2691,2691,7,2759,2760,5,2786,2787,5,2876,2876,5,2881,2884,5,2901,2902,5,3006,3006,5,3014,3016,7,3072,3072,5,3134,3136,5,3157,3158,5,3260,3260,5,3266,3266,5,3274,3275,7,3328,3329,5,3391,3392,7,3405,3405,5,3457,3457,5,3536,3537,7,3551,3551,5,3636,3642,5,3764,3772,5,3895,3895,5,3967,3967,7,3993,4028,5,4146,4151,5,4182,4183,7,4226,4226,5,4253,4253,5,4957,4959,5,5940,5940,7,6070,6070,7,6087,6088,7,6158,6158,4,6432,6434,5,6448,6449,7,6679,6680,5,6742,6742,5,6754,6754,5,6783,6783,5,6912,6915,5,6966,6970,5,6978,6978,5,7042,7042,7,7080,7081,5,7143,7143,7,7150,7150,7,7212,7219,5,7380,7392,5,7412,7412,5,8203,8203,4,8232,8232,4,8265,8265,14,8400,8412,5,8421,8432,5,8617,8618,14,9167,9167,14,9200,9200,14,9410,9410,14,9723,9726,14,9733,9733,14,9745,9745,14,9752,9752,14,9760,9760,14,9766,9766,14,9774,9774,14,9786,9786,14,9794,9794,14,9823,9823,14,9828,9828,14,9833,9850,14,9855,9855,14,9875,9875,14,9880,9880,14,9885,9887,14,9896,9897,14,9906,9916,14,9926,9927,14,9935,9935,14,9939,9939,14,9962,9962,14,9972,9972,14,9978,9978,14,9986,9986,14,9997,9997,14,10002,10002,14,10017,10017,14,10055,10055,14,10071,10071,14,10133,10135,14,10548,10549,14,11093,11093,14,12330,12333,5,12441,12442,5,42608,42610,5,43010,43010,5,43045,43046,5,43188,43203,7,43302,43309,5,43392,43394,5,43446,43449,5,43493,43493,5,43571,43572,7,43597,43597,7,43703,43704,5,43756,43757,5,44003,44004,7,44009,44010,7,44033,44059,12,44089,44115,12,44145,44171,12,44201,44227,12,44257,44283,12,44313,44339,12,44369,44395,12,44425,44451,12,44481,44507,12,44537,44563,12,44593,44619,12,44649,44675,12,44705,44731,12,44761,44787,12,44817,44843,12,44873,44899,12,44929,44955,12,44985,45011,12,45041,45067,12,45097,45123,12,45153,45179,12,45209,45235,12,45265,45291,12,45321,45347,12,45377,45403,12,45433,45459,12,45489,45515,12,45545,45571,12,45601,45627,12,45657,45683,12,45713,45739,12,45769,45795,12,45825,45851,12,45881,45907,12,45937,45963,12,45993,46019,12,46049,46075,12,46105,46131,12,46161,46187,12,46217,46243,12,46273,46299,12,46329,46355,12,46385,46411,12,46441,46467,12,46497,46523,12,46553,46579,12,46609,46635,12,46665,46691,12,46721,46747,12,46777,46803,12,46833,46859,12,46889,46915,12,46945,46971,12,47001,47027,12,47057,47083,12,47113,47139,12,47169,47195,12,47225,47251,12,47281,47307,12,47337,47363,12,47393,47419,12,47449,47475,12,47505,47531,12,47561,47587,12,47617,47643,12,47673,47699,12,47729,47755,12,47785,47811,12,47841,47867,12,47897,47923,12,47953,47979,12,48009,48035,12,48065,48091,12,48121,48147,12,48177,48203,12,48233,48259,12,48289,48315,12,48345,48371,12,48401,48427,12,48457,48483,12,48513,48539,12,48569,48595,12,48625,48651,12,48681,48707,12,48737,48763,12,48793,48819,12,48849,48875,12,48905,48931,12,48961,48987,12,49017,49043,12,49073,49099,12,49129,49155,12,49185,49211,12,49241,49267,12,49297,49323,12,49353,49379,12,49409,49435,12,49465,49491,12,49521,49547,12,49577,49603,12,49633,49659,12,49689,49715,12,49745,49771,12,49801,49827,12,49857,49883,12,49913,49939,12,49969,49995,12,50025,50051,12,50081,50107,12,50137,50163,12,50193,50219,12,50249,50275,12,50305,50331,12,50361,50387,12,50417,50443,12,50473,50499,12,50529,50555,12,50585,50611,12,50641,50667,12,50697,50723,12,50753,50779,12,50809,50835,12,50865,50891,12,50921,50947,12,50977,51003,12,51033,51059,12,51089,51115,12,51145,51171,12,51201,51227,12,51257,51283,12,51313,51339,12,51369,51395,12,51425,51451,12,51481,51507,12,51537,51563,12,51593,51619,12,51649,51675,12,51705,51731,12,51761,51787,12,51817,51843,12,51873,51899,12,51929,51955,12,51985,52011,12,52041,52067,12,52097,52123,12,52153,52179,12,52209,52235,12,52265,52291,12,52321,52347,12,52377,52403,12,52433,52459,12,52489,52515,12,52545,52571,12,52601,52627,12,52657,52683,12,52713,52739,12,52769,52795,12,52825,52851,12,52881,52907,12,52937,52963,12,52993,53019,12,53049,53075,12,53105,53131,12,53161,53187,12,53217,53243,12,53273,53299,12,53329,53355,12,53385,53411,12,53441,53467,12,53497,53523,12,53553,53579,12,53609,53635,12,53665,53691,12,53721,53747,12,53777,53803,12,53833,53859,12,53889,53915,12,53945,53971,12,54001,54027,12,54057,54083,12,54113,54139,12,54169,54195,12,54225,54251,12,54281,54307,12,54337,54363,12,54393,54419,12,54449,54475,12,54505,54531,12,54561,54587,12,54617,54643,12,54673,54699,12,54729,54755,12,54785,54811,12,54841,54867,12,54897,54923,12,54953,54979,12,55009,55035,12,55065,55091,12,55121,55147,12,55177,55203,12,65024,65039,5,65520,65528,4,66422,66426,5,68152,68154,5,69291,69292,5,69633,69633,5,69747,69748,5,69811,69814,5,69826,69826,5,69932,69932,7,70016,70017,5,70079,70080,7,70095,70095,5,70196,70196,5,70367,70367,5,70402,70403,7,70464,70464,5,70487,70487,5,70709,70711,7,70725,70725,7,70833,70834,7,70843,70844,7,70849,70849,7,71090,71093,5,71103,71104,5,71227,71228,7,71339,71339,5,71344,71349,5,71458,71461,5,71727,71735,5,71985,71989,7,71998,71998,5,72002,72002,7,72154,72155,5,72193,72202,5,72251,72254,5,72281,72283,5,72344,72345,5,72766,72766,7,72874,72880,5,72885,72886,5,73023,73029,5,73104,73105,5,73111,73111,5,92912,92916,5,94095,94098,5,113824,113827,4,119142,119142,7,119155,119162,4,119362,119364,5,121476,121476,5,122888,122904,5,123184,123190,5,125252,125258,5,127183,127183,14,127340,127343,14,127377,127386,14,127491,127503,14,127548,127551,14,127744,127756,14,127761,127761,14,127769,127769,14,127773,127774,14,127780,127788,14,127796,127797,14,127820,127823,14,127869,127869,14,127894,127895,14,127902,127903,14,127943,127943,14,127947,127950,14,127972,127972,14,127988,127988,14,127992,127994,14,128009,128011,14,128019,128019,14,128023,128041,14,128064,128064,14,128102,128107,14,128174,128181,14,128238,128238,14,128246,128247,14,128254,128254,14,128264,128264,14,128278,128299,14,128329,128330,14,128348,128359,14,128371,128377,14,128392,128393,14,128401,128404,14,128421,128421,14,128433,128434,14,128450,128452,14,128476,128478,14,128483,128483,14,128495,128495,14,128506,128506,14,128519,128520,14,128528,128528,14,128534,128534,14,128538,128538,14,128540,128542,14,128544,128549,14,128552,128555,14,128557,128557,14,128560,128563,14,128565,128565,14,128567,128576,14,128581,128591,14,128641,128642,14,128646,128646,14,128648,128648,14,128650,128651,14,128653,128653,14,128655,128655,14,128657,128659,14,128661,128661,14,128663,128663,14,128665,128666,14,128674,128674,14,128676,128677,14,128679,128685,14,128690,128690,14,128694,128694,14,128697,128702,14,128704,128704,14,128710,128714,14,128716,128716,14,128720,128720,14,128723,128724,14,128726,128727,14,128733,128735,14,128742,128744,14,128746,128746,14,128749,128751,14,128753,128754,14,128756,128758,14,128761,128761,14,128763,128764,14,128884,128895,14,128992,129003,14,129008,129008,14,129036,129039,14,129114,129119,14,129198,129279,14,129293,129295,14,129305,129310,14,129312,129319,14,129328,129328,14,129331,129338,14,129343,129343,14,129351,129355,14,129357,129359,14,129375,129387,14,129393,129393,14,129395,129398,14,129401,129401,14,129403,129403,14,129408,129412,14,129426,129431,14,129443,129444,14,129451,129453,14,129456,129465,14,129472,129472,14,129475,129482,14,129484,129484,14,129488,129510,14,129536,129647,14,129652,129652,14,129656,129658,14,129661,129663,14,129667,129670,14,129680,129685,14,129705,129708,14,129712,129718,14,129723,129727,14,129731,129733,14,129744,129750,14,129754,129759,14,129768,129775,14,129783,129791,14,917504,917504,4,917506,917535,4,917632,917759,4,918000,921599,4,0,9,4,11,12,4,14,31,4,169,169,14,174,174,14,1155,1159,5,1425,1469,5,1473,1474,5,1479,1479,5,1552,1562,5,1611,1631,5,1750,1756,5,1759,1764,5,1770,1773,5,1809,1809,5,1958,1968,5,2045,2045,5,2075,2083,5,2089,2093,5,2192,2193,1,2250,2273,5,2275,2306,5,2362,2362,5,2364,2364,5,2369,2376,5,2381,2381,5,2385,2391,5,2433,2433,5,2492,2492,5,2495,2496,7,2503,2504,7,2509,2509,5,2530,2531,5,2561,2562,5,2620,2620,5,2625,2626,5,2635,2637,5,2672,2673,5,2689,2690,5,2748,2748,5,2753,2757,5,2761,2761,7,2765,2765,5,2810,2815,5,2818,2819,7,2878,2878,5,2880,2880,7,2887,2888,7,2893,2893,5,2903,2903,5,2946,2946,5,3007,3007,7,3009,3010,7,3018,3020,7,3031,3031,5,3073,3075,7,3132,3132,5,3137,3140,7,3146,3149,5,3170,3171,5,3202,3203,7,3262,3262,7,3264,3265,7,3267,3268,7,3271,3272,7,3276,3277,5,3298,3299,5,3330,3331,7,3390,3390,5,3393,3396,5,3402,3404,7,3406,3406,1,3426,3427,5,3458,3459,7,3535,3535,5,3538,3540,5,3544,3550,7,3570,3571,7,3635,3635,7,3655,3662,5,3763,3763,7,3784,3789,5,3893,3893,5,3897,3897,5,3953,3966,5,3968,3972,5,3981,3991,5,4038,4038,5,4145,4145,7,4153,4154,5,4157,4158,5,4184,4185,5,4209,4212,5,4228,4228,7,4237,4237,5,4352,4447,8,4520,4607,10,5906,5908,5,5938,5939,5,5970,5971,5,6068,6069,5,6071,6077,5,6086,6086,5,6089,6099,5,6155,6157,5,6159,6159,5,6313,6313,5,6435,6438,7,6441,6443,7,6450,6450,5,6457,6459,5,6681,6682,7,6741,6741,7,6743,6743,7,6752,6752,5,6757,6764,5,6771,6780,5,6832,6845,5,6847,6862,5,6916,6916,7,6965,6965,5,6971,6971,7,6973,6977,7,6979,6980,7,7040,7041,5,7073,7073,7,7078,7079,7,7082,7082,7,7142,7142,5,7144,7145,5,7149,7149,5,7151,7153,5,7204,7211,7,7220,7221,7,7376,7378,5,7393,7393,7,7405,7405,5,7415,7415,7,7616,7679,5,8204,8204,5,8206,8207,4,8233,8233,4,8252,8252,14,8288,8292,4,8294,8303,4,8413,8416,5,8418,8420,5,8482,8482,14,8596,8601,14,8986,8987,14,9096,9096,14,9193,9196,14,9199,9199,14,9201,9202,14,9208,9210,14,9642,9643,14,9664,9664,14,9728,9729,14,9732,9732,14,9735,9741,14,9743,9744,14,9746,9746,14,9750,9751,14,9753,9756,14,9758,9759,14,9761,9761,14,9764,9765,14,9767,9769,14,9771,9773,14,9775,9775,14,9784,9785,14,9787,9791,14,9793,9793,14,9795,9799,14,9812,9822,14,9824,9824,14,9827,9827,14,9829,9830,14,9832,9832,14,9851,9851,14,9854,9854,14,9856,9861,14,9874,9874,14,9876,9876,14,9878,9879,14,9881,9881,14,9883,9884,14,9888,9889,14,9895,9895,14,9898,9899,14,9904,9905,14,9917,9918,14,9924,9925,14,9928,9928,14,9934,9934,14,9936,9936,14,9938,9938,14,9940,9940,14,9961,9961,14,9963,9967,14,9970,9971,14,9973,9973,14,9975,9977,14,9979,9980,14,9982,9985,14,9987,9988,14,9992,9996,14,9998,9998,14,10000,10001,14,10004,10004,14,10013,10013,14,10024,10024,14,10052,10052,14,10060,10060,14,10067,10069,14,10083,10083,14,10085,10087,14,10145,10145,14,10175,10175,14,11013,11015,14,11088,11088,14,11503,11505,5,11744,11775,5,12334,12335,5,12349,12349,14,12951,12951,14,42607,42607,5,42612,42621,5,42736,42737,5,43014,43014,5,43043,43044,7,43047,43047,7,43136,43137,7,43204,43205,5,43263,43263,5,43335,43345,5,43360,43388,8,43395,43395,7,43444,43445,7,43450,43451,7,43454,43456,7,43561,43566,5,43569,43570,5,43573,43574,5,43596,43596,5,43644,43644,5,43698,43700,5,43710,43711,5,43755,43755,7,43758,43759,7,43766,43766,5,44005,44005,5,44008,44008,5,44012,44012,7,44032,44032,11,44060,44060,11,44088,44088,11,44116,44116,11,44144,44144,11,44172,44172,11,44200,44200,11,44228,44228,11,44256,44256,11,44284,44284,11,44312,44312,11,44340,44340,11,44368,44368,11,44396,44396,11,44424,44424,11,44452,44452,11,44480,44480,11,44508,44508,11,44536,44536,11,44564,44564,11,44592,44592,11,44620,44620,11,44648,44648,11,44676,44676,11,44704,44704,11,44732,44732,11,44760,44760,11,44788,44788,11,44816,44816,11,44844,44844,11,44872,44872,11,44900,44900,11,44928,44928,11,44956,44956,11,44984,44984,11,45012,45012,11,45040,45040,11,45068,45068,11,45096,45096,11,45124,45124,11,45152,45152,11,45180,45180,11,45208,45208,11,45236,45236,11,45264,45264,11,45292,45292,11,45320,45320,11,45348,45348,11,45376,45376,11,45404,45404,11,45432,45432,11,45460,45460,11,45488,45488,11,45516,45516,11,45544,45544,11,45572,45572,11,45600,45600,11,45628,45628,11,45656,45656,11,45684,45684,11,45712,45712,11,45740,45740,11,45768,45768,11,45796,45796,11,45824,45824,11,45852,45852,11,45880,45880,11,45908,45908,11,45936,45936,11,45964,45964,11,45992,45992,11,46020,46020,11,46048,46048,11,46076,46076,11,46104,46104,11,46132,46132,11,46160,46160,11,46188,46188,11,46216,46216,11,46244,46244,11,46272,46272,11,46300,46300,11,46328,46328,11,46356,46356,11,46384,46384,11,46412,46412,11,46440,46440,11,46468,46468,11,46496,46496,11,46524,46524,11,46552,46552,11,46580,46580,11,46608,46608,11,46636,46636,11,46664,46664,11,46692,46692,11,46720,46720,11,46748,46748,11,46776,46776,11,46804,46804,11,46832,46832,11,46860,46860,11,46888,46888,11,46916,46916,11,46944,46944,11,46972,46972,11,47000,47000,11,47028,47028,11,47056,47056,11,47084,47084,11,47112,47112,11,47140,47140,11,47168,47168,11,47196,47196,11,47224,47224,11,47252,47252,11,47280,47280,11,47308,47308,11,47336,47336,11,47364,47364,11,47392,47392,11,47420,47420,11,47448,47448,11,47476,47476,11,47504,47504,11,47532,47532,11,47560,47560,11,47588,47588,11,47616,47616,11,47644,47644,11,47672,47672,11,47700,47700,11,47728,47728,11,47756,47756,11,47784,47784,11,47812,47812,11,47840,47840,11,47868,47868,11,47896,47896,11,47924,47924,11,47952,47952,11,47980,47980,11,48008,48008,11,48036,48036,11,48064,48064,11,48092,48092,11,48120,48120,11,48148,48148,11,48176,48176,11,48204,48204,11,48232,48232,11,48260,48260,11,48288,48288,11,48316,48316,11,48344,48344,11,48372,48372,11,48400,48400,11,48428,48428,11,48456,48456,11,48484,48484,11,48512,48512,11,48540,48540,11,48568,48568,11,48596,48596,11,48624,48624,11,48652,48652,11,48680,48680,11,48708,48708,11,48736,48736,11,48764,48764,11,48792,48792,11,48820,48820,11,48848,48848,11,48876,48876,11,48904,48904,11,48932,48932,11,48960,48960,11,48988,48988,11,49016,49016,11,49044,49044,11,49072,49072,11,49100,49100,11,49128,49128,11,49156,49156,11,49184,49184,11,49212,49212,11,49240,49240,11,49268,49268,11,49296,49296,11,49324,49324,11,49352,49352,11,49380,49380,11,49408,49408,11,49436,49436,11,49464,49464,11,49492,49492,11,49520,49520,11,49548,49548,11,49576,49576,11,49604,49604,11,49632,49632,11,49660,49660,11,49688,49688,11,49716,49716,11,49744,49744,11,49772,49772,11,49800,49800,11,49828,49828,11,49856,49856,11,49884,49884,11,49912,49912,11,49940,49940,11,49968,49968,11,49996,49996,11,50024,50024,11,50052,50052,11,50080,50080,11,50108,50108,11,50136,50136,11,50164,50164,11,50192,50192,11,50220,50220,11,50248,50248,11,50276,50276,11,50304,50304,11,50332,50332,11,50360,50360,11,50388,50388,11,50416,50416,11,50444,50444,11,50472,50472,11,50500,50500,11,50528,50528,11,50556,50556,11,50584,50584,11,50612,50612,11,50640,50640,11,50668,50668,11,50696,50696,11,50724,50724,11,50752,50752,11,50780,50780,11,50808,50808,11,50836,50836,11,50864,50864,11,50892,50892,11,50920,50920,11,50948,50948,11,50976,50976,11,51004,51004,11,51032,51032,11,51060,51060,11,51088,51088,11,51116,51116,11,51144,51144,11,51172,51172,11,51200,51200,11,51228,51228,11,51256,51256,11,51284,51284,11,51312,51312,11,51340,51340,11,51368,51368,11,51396,51396,11,51424,51424,11,51452,51452,11,51480,51480,11,51508,51508,11,51536,51536,11,51564,51564,11,51592,51592,11,51620,51620,11,51648,51648,11,51676,51676,11,51704,51704,11,51732,51732,11,51760,51760,11,51788,51788,11,51816,51816,11,51844,51844,11,51872,51872,11,51900,51900,11,51928,51928,11,51956,51956,11,51984,51984,11,52012,52012,11,52040,52040,11,52068,52068,11,52096,52096,11,52124,52124,11,52152,52152,11,52180,52180,11,52208,52208,11,52236,52236,11,52264,52264,11,52292,52292,11,52320,52320,11,52348,52348,11,52376,52376,11,52404,52404,11,52432,52432,11,52460,52460,11,52488,52488,11,52516,52516,11,52544,52544,11,52572,52572,11,52600,52600,11,52628,52628,11,52656,52656,11,52684,52684,11,52712,52712,11,52740,52740,11,52768,52768,11,52796,52796,11,52824,52824,11,52852,52852,11,52880,52880,11,52908,52908,11,52936,52936,11,52964,52964,11,52992,52992,11,53020,53020,11,53048,53048,11,53076,53076,11,53104,53104,11,53132,53132,11,53160,53160,11,53188,53188,11,53216,53216,11,53244,53244,11,53272,53272,11,53300,53300,11,53328,53328,11,53356,53356,11,53384,53384,11,53412,53412,11,53440,53440,11,53468,53468,11,53496,53496,11,53524,53524,11,53552,53552,11,53580,53580,11,53608,53608,11,53636,53636,11,53664,53664,11,53692,53692,11,53720,53720,11,53748,53748,11,53776,53776,11,53804,53804,11,53832,53832,11,53860,53860,11,53888,53888,11,53916,53916,11,53944,53944,11,53972,53972,11,54000,54000,11,54028,54028,11,54056,54056,11,54084,54084,11,54112,54112,11,54140,54140,11,54168,54168,11,54196,54196,11,54224,54224,11,54252,54252,11,54280,54280,11,54308,54308,11,54336,54336,11,54364,54364,11,54392,54392,11,54420,54420,11,54448,54448,11,54476,54476,11,54504,54504,11,54532,54532,11,54560,54560,11,54588,54588,11,54616,54616,11,54644,54644,11,54672,54672,11,54700,54700,11,54728,54728,11,54756,54756,11,54784,54784,11,54812,54812,11,54840,54840,11,54868,54868,11,54896,54896,11,54924,54924,11,54952,54952,11,54980,54980,11,55008,55008,11,55036,55036,11,55064,55064,11,55092,55092,11,55120,55120,11,55148,55148,11,55176,55176,11,55216,55238,9,64286,64286,5,65056,65071,5,65438,65439,5,65529,65531,4,66272,66272,5,68097,68099,5,68108,68111,5,68159,68159,5,68900,68903,5,69446,69456,5,69632,69632,7,69634,69634,7,69744,69744,5,69759,69761,5,69808,69810,7,69815,69816,7,69821,69821,1,69837,69837,1,69927,69931,5,69933,69940,5,70003,70003,5,70018,70018,7,70070,70078,5,70082,70083,1,70094,70094,7,70188,70190,7,70194,70195,7,70197,70197,7,70206,70206,5,70368,70370,7,70400,70401,5,70459,70460,5,70463,70463,7,70465,70468,7,70475,70477,7,70498,70499,7,70512,70516,5,70712,70719,5,70722,70724,5,70726,70726,5,70832,70832,5,70835,70840,5,70842,70842,5,70845,70845,5,70847,70848,5,70850,70851,5,71088,71089,7,71096,71099,7,71102,71102,7,71132,71133,5,71219,71226,5,71229,71229,5,71231,71232,5,71340,71340,7,71342,71343,7,71350,71350,7,71453,71455,5,71462,71462,7,71724,71726,7,71736,71736,7,71984,71984,5,71991,71992,7,71997,71997,7,71999,71999,1,72001,72001,1,72003,72003,5,72148,72151,5,72156,72159,7,72164,72164,7,72243,72248,5,72250,72250,1,72263,72263,5,72279,72280,7,72324,72329,1,72343,72343,7,72751,72751,7,72760,72765,5,72767,72767,5,72873,72873,7,72881,72881,7,72884,72884,7,73009,73014,5,73020,73021,5,73030,73030,1,73098,73102,7,73107,73108,7,73110,73110,7,73459,73460,5,78896,78904,4,92976,92982,5,94033,94087,7,94180,94180,5,113821,113822,5,118528,118573,5,119141,119141,5,119143,119145,5,119150,119154,5,119163,119170,5,119210,119213,5,121344,121398,5,121461,121461,5,121499,121503,5,122880,122886,5,122907,122913,5,122918,122922,5,123566,123566,5,125136,125142,5,126976,126979,14,126981,127182,14,127184,127231,14,127279,127279,14,127344,127345,14,127374,127374,14,127405,127461,14,127489,127490,14,127514,127514,14,127538,127546,14,127561,127567,14,127570,127743,14,127757,127758,14,127760,127760,14,127762,127762,14,127766,127768,14,127770,127770,14,127772,127772,14,127775,127776,14,127778,127779,14,127789,127791,14,127794,127795,14,127798,127798,14,127819,127819,14,127824,127824,14,127868,127868,14,127870,127871,14,127892,127893,14,127896,127896,14,127900,127901,14,127904,127940,14,127942,127942,14,127944,127944,14,127946,127946,14,127951,127955,14,127968,127971,14,127973,127984,14,127987,127987,14,127989,127989,14,127991,127991,14,127995,127999,5,128008,128008,14,128012,128014,14,128017,128018,14,128020,128020,14,128022,128022,14,128042,128042,14,128063,128063,14,128065,128065,14,128101,128101,14,128108,128109,14,128173,128173,14,128182,128183,14,128236,128237,14,128239,128239,14,128245,128245,14,128248,128248,14,128253,128253,14,128255,128258,14,128260,128263,14,128265,128265,14,128277,128277,14,128300,128301,14,128326,128328,14,128331,128334,14,128336,128347,14,128360,128366,14,128369,128370,14,128378,128378,14,128391,128391,14,128394,128397,14,128400,128400,14,128405,128406,14,128420,128420,14,128422,128423,14,128425,128432,14,128435,128443,14,128445,128449,14,128453,128464,14,128468,128475,14,128479,128480,14,128482,128482,14,128484,128487,14,128489,128494,14,128496,128498,14,128500,128505,14,128507,128511,14,128513,128518,14,128521,128525,14,128527,128527,14,128529,128529,14,128533,128533,14,128535,128535,14,128537,128537,14]")}var qs=class r{constructor(e){this.confusableDictionary=e}static{this.ambiguousCharacterData=new Ee(()=>JSON.parse('{"_common":[8232,32,8233,32,5760,32,8192,32,8193,32,8194,32,8195,32,8196,32,8197,32,8198,32,8200,32,8201,32,8202,32,8287,32,8199,32,8239,32,2042,95,65101,95,65102,95,65103,95,8208,45,8209,45,8210,45,65112,45,1748,45,8259,45,727,45,8722,45,10134,45,11450,45,1549,44,1643,44,184,44,42233,44,894,59,2307,58,2691,58,1417,58,1795,58,1796,58,5868,58,65072,58,6147,58,6153,58,8282,58,1475,58,760,58,42889,58,8758,58,720,58,42237,58,451,33,11601,33,660,63,577,63,2429,63,5038,63,42731,63,119149,46,8228,46,1793,46,1794,46,42510,46,68176,46,1632,46,1776,46,42232,46,1373,96,65287,96,8219,96,1523,96,8242,96,1370,96,8175,96,65344,96,900,96,8189,96,8125,96,8127,96,8190,96,697,96,884,96,712,96,714,96,715,96,756,96,699,96,701,96,700,96,702,96,42892,96,1497,96,2036,96,2037,96,5194,96,5836,96,94033,96,94034,96,65339,91,10088,40,10098,40,12308,40,64830,40,65341,93,10089,41,10099,41,12309,41,64831,41,10100,123,119060,123,10101,125,65342,94,8270,42,1645,42,8727,42,66335,42,5941,47,8257,47,8725,47,8260,47,9585,47,10187,47,10744,47,119354,47,12755,47,12339,47,11462,47,20031,47,12035,47,65340,92,65128,92,8726,92,10189,92,10741,92,10745,92,119311,92,119355,92,12756,92,20022,92,12034,92,42872,38,708,94,710,94,5869,43,10133,43,66203,43,8249,60,10094,60,706,60,119350,60,5176,60,5810,60,5120,61,11840,61,12448,61,42239,61,8250,62,10095,62,707,62,119351,62,5171,62,94015,62,8275,126,732,126,8128,126,8764,126,65372,124,65293,45,118002,50,120784,50,120794,50,120804,50,120814,50,120824,50,130034,50,42842,50,423,50,1000,50,42564,50,5311,50,42735,50,119302,51,118003,51,120785,51,120795,51,120805,51,120815,51,120825,51,130035,51,42923,51,540,51,439,51,42858,51,11468,51,1248,51,94011,51,71882,51,118004,52,120786,52,120796,52,120806,52,120816,52,120826,52,130036,52,5070,52,71855,52,118005,53,120787,53,120797,53,120807,53,120817,53,120827,53,130037,53,444,53,71867,53,118006,54,120788,54,120798,54,120808,54,120818,54,120828,54,130038,54,11474,54,5102,54,71893,54,119314,55,118007,55,120789,55,120799,55,120809,55,120819,55,120829,55,130039,55,66770,55,71878,55,2819,56,2538,56,2666,56,125131,56,118008,56,120790,56,120800,56,120810,56,120820,56,120830,56,130040,56,547,56,546,56,66330,56,2663,57,2920,57,2541,57,3437,57,118009,57,120791,57,120801,57,120811,57,120821,57,120831,57,130041,57,42862,57,11466,57,71884,57,71852,57,71894,57,9082,97,65345,97,119834,97,119886,97,119938,97,119990,97,120042,97,120094,97,120146,97,120198,97,120250,97,120302,97,120354,97,120406,97,120458,97,593,97,945,97,120514,97,120572,97,120630,97,120688,97,120746,97,65313,65,117974,65,119808,65,119860,65,119912,65,119964,65,120016,65,120068,65,120120,65,120172,65,120224,65,120276,65,120328,65,120380,65,120432,65,913,65,120488,65,120546,65,120604,65,120662,65,120720,65,5034,65,5573,65,42222,65,94016,65,66208,65,119835,98,119887,98,119939,98,119991,98,120043,98,120095,98,120147,98,120199,98,120251,98,120303,98,120355,98,120407,98,120459,98,388,98,5071,98,5234,98,5551,98,65314,66,8492,66,117975,66,119809,66,119861,66,119913,66,120017,66,120069,66,120121,66,120173,66,120225,66,120277,66,120329,66,120381,66,120433,66,42932,66,914,66,120489,66,120547,66,120605,66,120663,66,120721,66,5108,66,5623,66,42192,66,66178,66,66209,66,66305,66,65347,99,8573,99,119836,99,119888,99,119940,99,119992,99,120044,99,120096,99,120148,99,120200,99,120252,99,120304,99,120356,99,120408,99,120460,99,7428,99,1010,99,11429,99,43951,99,66621,99,128844,67,71913,67,71922,67,65315,67,8557,67,8450,67,8493,67,117976,67,119810,67,119862,67,119914,67,119966,67,120018,67,120174,67,120226,67,120278,67,120330,67,120382,67,120434,67,1017,67,11428,67,5087,67,42202,67,66210,67,66306,67,66581,67,66844,67,8574,100,8518,100,119837,100,119889,100,119941,100,119993,100,120045,100,120097,100,120149,100,120201,100,120253,100,120305,100,120357,100,120409,100,120461,100,1281,100,5095,100,5231,100,42194,100,8558,68,8517,68,117977,68,119811,68,119863,68,119915,68,119967,68,120019,68,120071,68,120123,68,120175,68,120227,68,120279,68,120331,68,120383,68,120435,68,5024,68,5598,68,5610,68,42195,68,8494,101,65349,101,8495,101,8519,101,119838,101,119890,101,119942,101,120046,101,120098,101,120150,101,120202,101,120254,101,120306,101,120358,101,120410,101,120462,101,43826,101,1213,101,8959,69,65317,69,8496,69,117978,69,119812,69,119864,69,119916,69,120020,69,120072,69,120124,69,120176,69,120228,69,120280,69,120332,69,120384,69,120436,69,917,69,120492,69,120550,69,120608,69,120666,69,120724,69,11577,69,5036,69,42224,69,71846,69,71854,69,66182,69,119839,102,119891,102,119943,102,119995,102,120047,102,120099,102,120151,102,120203,102,120255,102,120307,102,120359,102,120411,102,120463,102,43829,102,42905,102,383,102,7837,102,1412,102,119315,70,8497,70,117979,70,119813,70,119865,70,119917,70,120021,70,120073,70,120125,70,120177,70,120229,70,120281,70,120333,70,120385,70,120437,70,42904,70,988,70,120778,70,5556,70,42205,70,71874,70,71842,70,66183,70,66213,70,66853,70,65351,103,8458,103,119840,103,119892,103,119944,103,120048,103,120100,103,120152,103,120204,103,120256,103,120308,103,120360,103,120412,103,120464,103,609,103,7555,103,397,103,1409,103,117980,71,119814,71,119866,71,119918,71,119970,71,120022,71,120074,71,120126,71,120178,71,120230,71,120282,71,120334,71,120386,71,120438,71,1292,71,5056,71,5107,71,42198,71,65352,104,8462,104,119841,104,119945,104,119997,104,120049,104,120101,104,120153,104,120205,104,120257,104,120309,104,120361,104,120413,104,120465,104,1211,104,1392,104,5058,104,65320,72,8459,72,8460,72,8461,72,117981,72,119815,72,119867,72,119919,72,120023,72,120179,72,120231,72,120283,72,120335,72,120387,72,120439,72,919,72,120494,72,120552,72,120610,72,120668,72,120726,72,11406,72,5051,72,5500,72,42215,72,66255,72,731,105,9075,105,65353,105,8560,105,8505,105,8520,105,119842,105,119894,105,119946,105,119998,105,120050,105,120102,105,120154,105,120206,105,120258,105,120310,105,120362,105,120414,105,120466,105,120484,105,618,105,617,105,953,105,8126,105,890,105,120522,105,120580,105,120638,105,120696,105,120754,105,1110,105,42567,105,1231,105,43893,105,5029,105,71875,105,65354,106,8521,106,119843,106,119895,106,119947,106,119999,106,120051,106,120103,106,120155,106,120207,106,120259,106,120311,106,120363,106,120415,106,120467,106,1011,106,1112,106,65322,74,117983,74,119817,74,119869,74,119921,74,119973,74,120025,74,120077,74,120129,74,120181,74,120233,74,120285,74,120337,74,120389,74,120441,74,42930,74,895,74,1032,74,5035,74,5261,74,42201,74,119844,107,119896,107,119948,107,120000,107,120052,107,120104,107,120156,107,120208,107,120260,107,120312,107,120364,107,120416,107,120468,107,8490,75,65323,75,117984,75,119818,75,119870,75,119922,75,119974,75,120026,75,120078,75,120130,75,120182,75,120234,75,120286,75,120338,75,120390,75,120442,75,922,75,120497,75,120555,75,120613,75,120671,75,120729,75,11412,75,5094,75,5845,75,42199,75,66840,75,1472,108,8739,73,9213,73,65512,73,1633,108,1777,73,66336,108,125127,108,118001,108,120783,73,120793,73,120803,73,120813,73,120823,73,130033,73,65321,73,8544,73,8464,73,8465,73,117982,108,119816,73,119868,73,119920,73,120024,73,120128,73,120180,73,120232,73,120284,73,120336,73,120388,73,120440,73,65356,108,8572,73,8467,108,119845,108,119897,108,119949,108,120001,108,120053,108,120105,73,120157,73,120209,73,120261,73,120313,73,120365,73,120417,73,120469,73,448,73,120496,73,120554,73,120612,73,120670,73,120728,73,11410,73,1030,73,1216,73,1493,108,1503,108,1575,108,126464,108,126592,108,65166,108,65165,108,1994,108,11599,73,5825,73,42226,73,93992,73,66186,124,66313,124,119338,76,8556,76,8466,76,117985,76,119819,76,119871,76,119923,76,120027,76,120079,76,120131,76,120183,76,120235,76,120287,76,120339,76,120391,76,120443,76,11472,76,5086,76,5290,76,42209,76,93974,76,71843,76,71858,76,66587,76,66854,76,65325,77,8559,77,8499,77,117986,77,119820,77,119872,77,119924,77,120028,77,120080,77,120132,77,120184,77,120236,77,120288,77,120340,77,120392,77,120444,77,924,77,120499,77,120557,77,120615,77,120673,77,120731,77,1018,77,11416,77,5047,77,5616,77,5846,77,42207,77,66224,77,66321,77,119847,110,119899,110,119951,110,120003,110,120055,110,120107,110,120159,110,120211,110,120263,110,120315,110,120367,110,120419,110,120471,110,1400,110,1404,110,65326,78,8469,78,117987,78,119821,78,119873,78,119925,78,119977,78,120029,78,120081,78,120185,78,120237,78,120289,78,120341,78,120393,78,120445,78,925,78,120500,78,120558,78,120616,78,120674,78,120732,78,11418,78,42208,78,66835,78,3074,111,3202,111,3330,111,3458,111,2406,111,2662,111,2790,111,3046,111,3174,111,3302,111,3430,111,3664,111,3792,111,4160,111,1637,111,1781,111,65359,111,8500,111,119848,111,119900,111,119952,111,120056,111,120108,111,120160,111,120212,111,120264,111,120316,111,120368,111,120420,111,120472,111,7439,111,7441,111,43837,111,959,111,120528,111,120586,111,120644,111,120702,111,120760,111,963,111,120532,111,120590,111,120648,111,120706,111,120764,111,11423,111,4351,111,1413,111,1505,111,1607,111,126500,111,126564,111,126596,111,65259,111,65260,111,65258,111,65257,111,1726,111,64428,111,64429,111,64427,111,64426,111,1729,111,64424,111,64425,111,64423,111,64422,111,1749,111,3360,111,4125,111,66794,111,71880,111,71895,111,66604,111,1984,79,2534,79,2918,79,12295,79,70864,79,71904,79,118000,79,120782,79,120792,79,120802,79,120812,79,120822,79,130032,79,65327,79,117988,79,119822,79,119874,79,119926,79,119978,79,120030,79,120082,79,120134,79,120186,79,120238,79,120290,79,120342,79,120394,79,120446,79,927,79,120502,79,120560,79,120618,79,120676,79,120734,79,11422,79,1365,79,11604,79,4816,79,2848,79,66754,79,42227,79,71861,79,66194,79,66219,79,66564,79,66838,79,9076,112,65360,112,119849,112,119901,112,119953,112,120005,112,120057,112,120109,112,120161,112,120213,112,120265,112,120317,112,120369,112,120421,112,120473,112,961,112,120530,112,120544,112,120588,112,120602,112,120646,112,120660,112,120704,112,120718,112,120762,112,120776,112,11427,112,65328,80,8473,80,117989,80,119823,80,119875,80,119927,80,119979,80,120031,80,120083,80,120187,80,120239,80,120291,80,120343,80,120395,80,120447,80,929,80,120504,80,120562,80,120620,80,120678,80,120736,80,11426,80,5090,80,5229,80,42193,80,66197,80,119850,113,119902,113,119954,113,120006,113,120058,113,120110,113,120162,113,120214,113,120266,113,120318,113,120370,113,120422,113,120474,113,1307,113,1379,113,1382,113,8474,81,117990,81,119824,81,119876,81,119928,81,119980,81,120032,81,120084,81,120188,81,120240,81,120292,81,120344,81,120396,81,120448,81,11605,81,119851,114,119903,114,119955,114,120007,114,120059,114,120111,114,120163,114,120215,114,120267,114,120319,114,120371,114,120423,114,120475,114,43847,114,43848,114,7462,114,11397,114,43905,114,119318,82,8475,82,8476,82,8477,82,117991,82,119825,82,119877,82,119929,82,120033,82,120189,82,120241,82,120293,82,120345,82,120397,82,120449,82,422,82,5025,82,5074,82,66740,82,5511,82,42211,82,94005,82,65363,115,119852,115,119904,115,119956,115,120008,115,120060,115,120112,115,120164,115,120216,115,120268,115,120320,115,120372,115,120424,115,120476,115,42801,115,445,115,1109,115,43946,115,71873,115,66632,115,65331,83,117992,83,119826,83,119878,83,119930,83,119982,83,120034,83,120086,83,120138,83,120190,83,120242,83,120294,83,120346,83,120398,83,120450,83,1029,83,1359,83,5077,83,5082,83,42210,83,94010,83,66198,83,66592,83,119853,116,119905,116,119957,116,120009,116,120061,116,120113,116,120165,116,120217,116,120269,116,120321,116,120373,116,120425,116,120477,116,8868,84,10201,84,128872,84,65332,84,117993,84,119827,84,119879,84,119931,84,119983,84,120035,84,120087,84,120139,84,120191,84,120243,84,120295,84,120347,84,120399,84,120451,84,932,84,120507,84,120565,84,120623,84,120681,84,120739,84,11430,84,5026,84,42196,84,93962,84,71868,84,66199,84,66225,84,66325,84,119854,117,119906,117,119958,117,120010,117,120062,117,120114,117,120166,117,120218,117,120270,117,120322,117,120374,117,120426,117,120478,117,42911,117,7452,117,43854,117,43858,117,651,117,965,117,120534,117,120592,117,120650,117,120708,117,120766,117,1405,117,66806,117,71896,117,8746,85,8899,85,117994,85,119828,85,119880,85,119932,85,119984,85,120036,85,120088,85,120140,85,120192,85,120244,85,120296,85,120348,85,120400,85,120452,85,1357,85,4608,85,66766,85,5196,85,42228,85,94018,85,71864,85,8744,118,8897,118,65366,118,8564,118,119855,118,119907,118,119959,118,120011,118,120063,118,120115,118,120167,118,120219,118,120271,118,120323,118,120375,118,120427,118,120479,118,7456,118,957,118,120526,118,120584,118,120642,118,120700,118,120758,118,1141,118,1496,118,71430,118,43945,118,71872,118,119309,86,1639,86,1783,86,8548,86,117995,86,119829,86,119881,86,119933,86,119985,86,120037,86,120089,86,120141,86,120193,86,120245,86,120297,86,120349,86,120401,86,120453,86,1140,86,11576,86,5081,86,5167,86,42719,86,42214,86,93960,86,71840,86,66845,86,623,119,119856,119,119908,119,119960,119,120012,119,120064,119,120116,119,120168,119,120220,119,120272,119,120324,119,120376,119,120428,119,120480,119,7457,119,1121,119,1309,119,1377,119,71434,119,71438,119,71439,119,43907,119,71910,87,71919,87,117996,87,119830,87,119882,87,119934,87,119986,87,120038,87,120090,87,120142,87,120194,87,120246,87,120298,87,120350,87,120402,87,120454,87,1308,87,5043,87,5076,87,42218,87,5742,120,10539,120,10540,120,10799,120,65368,120,8569,120,119857,120,119909,120,119961,120,120013,120,120065,120,120117,120,120169,120,120221,120,120273,120,120325,120,120377,120,120429,120,120481,120,5441,120,5501,120,5741,88,9587,88,66338,88,71916,88,65336,88,8553,88,117997,88,119831,88,119883,88,119935,88,119987,88,120039,88,120091,88,120143,88,120195,88,120247,88,120299,88,120351,88,120403,88,120455,88,42931,88,935,88,120510,88,120568,88,120626,88,120684,88,120742,88,11436,88,11613,88,5815,88,42219,88,66192,88,66228,88,66327,88,66855,88,611,121,7564,121,65369,121,119858,121,119910,121,119962,121,120014,121,120066,121,120118,121,120170,121,120222,121,120274,121,120326,121,120378,121,120430,121,120482,121,655,121,7935,121,43866,121,947,121,8509,121,120516,121,120574,121,120632,121,120690,121,120748,121,1199,121,4327,121,71900,121,65337,89,117998,89,119832,89,119884,89,119936,89,119988,89,120040,89,120092,89,120144,89,120196,89,120248,89,120300,89,120352,89,120404,89,120456,89,933,89,978,89,120508,89,120566,89,120624,89,120682,89,120740,89,11432,89,1198,89,5033,89,5053,89,42220,89,94019,89,71844,89,66226,89,119859,122,119911,122,119963,122,120015,122,120067,122,120119,122,120171,122,120223,122,120275,122,120327,122,120379,122,120431,122,120483,122,7458,122,43923,122,71876,122,71909,90,66293,90,65338,90,8484,90,8488,90,117999,90,119833,90,119885,90,119937,90,119989,90,120041,90,120197,90,120249,90,120301,90,120353,90,120405,90,120457,90,918,90,120493,90,120551,90,120609,90,120667,90,120725,90,5059,90,42204,90,71849,90,65282,34,65283,35,65284,36,65285,37,65286,38,65290,42,65291,43,65294,46,65295,47,65296,48,65298,50,65299,51,65300,52,65301,53,65302,54,65303,55,65304,56,65305,57,65308,60,65309,61,65310,62,65312,64,65316,68,65318,70,65319,71,65324,76,65329,81,65330,82,65333,85,65334,86,65335,87,65343,95,65346,98,65348,100,65350,102,65355,107,65357,109,65358,110,65361,113,65362,114,65364,116,65365,117,65367,119,65370,122,65371,123,65373,125,119846,109],"_default":[160,32,8211,45,65374,126,8218,44,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"cs":[65374,126,8218,44,65306,58,65281,33,8216,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"de":[65374,126,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"es":[8211,45,65374,126,8218,44,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"fr":[65374,126,8218,44,65306,58,65281,33,8216,96,8245,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"it":[160,32,8211,45,65374,126,8218,44,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"ja":[8211,45,8218,44,65281,33,8216,96,8245,96,180,96,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65292,44,65297,49,65307,59],"ko":[8211,45,65374,126,8218,44,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"pl":[65374,126,65306,58,65281,33,8216,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"pt-BR":[65374,126,8218,44,65306,58,65281,33,8216,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"qps-ploc":[160,32,8211,45,65374,126,8218,44,65306,58,65281,33,8216,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"ru":[65374,126,8218,44,65306,58,65281,33,8216,96,8245,96,180,96,12494,47,305,105,921,73,1009,112,215,120,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"tr":[160,32,8211,45,65374,126,8218,44,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"zh-hans":[160,32,65374,126,8218,44,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65297,49],"zh-hant":[8211,45,65374,126,8218,44,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89]}'))}static{this.cache=new fr(e=>{let t=e.split(",");function n(c){let d=new Map;for(let m=0;m<c.length;m+=2)d.set(c[m],c[m+1]);return d}function i(c,d){let m=new Map(c);for(let[f,b]of d)m.set(f,b);return m}function o(c,d){if(!c)return d;let m=new Map;for(let[f,b]of c)d.has(f)&&m.set(f,b);return m}let s=this.ambiguousCharacterData.value,a=t.filter(c=>!c.startsWith("_")&&Object.hasOwn(s,c));a.length===0&&(a=["_default"]);let l;for(let c of a){let d=n(s[c]);l=o(l,d)}let u=n(s._common),p=i(u,l);return new r(p)})}static getInstance(e){return r.cache.get(Array.from(e).join(","))}static{this._locales=new Ee(()=>Object.keys(r.ambiguousCharacterData.value).filter(e=>!e.startsWith("_")))}static getLocales(){return r._locales.value}isAmbiguous(e){return this.confusableDictionary.has(e)}containsAmbiguousCharacter(e){for(let t=0;t<e.length;t++){let n=e.codePointAt(t);if(typeof n=="number"&&this.isAmbiguous(n))return!0}return!1}getPrimaryConfusable(e){return this.confusableDictionary.get(e)}getConfusableCodePoints(){return new Set(this.confusableDictionary.keys())}},zs=class r{static getRawData(){return JSON.parse('{"_common":[11,12,13,127,847,1564,4447,4448,6068,6069,6155,6156,6157,6158,7355,7356,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8204,8205,8206,8207,8234,8235,8236,8237,8238,8239,8287,8288,8289,8290,8291,8292,8293,8294,8295,8296,8297,8298,8299,8300,8301,8302,8303,10240,12644,65024,65025,65026,65027,65028,65029,65030,65031,65032,65033,65034,65035,65036,65037,65038,65039,65279,65440,65520,65521,65522,65523,65524,65525,65526,65527,65528,65532,78844,119155,119156,119157,119158,119159,119160,119161,119162,917504,917505,917506,917507,917508,917509,917510,917511,917512,917513,917514,917515,917516,917517,917518,917519,917520,917521,917522,917523,917524,917525,917526,917527,917528,917529,917530,917531,917532,917533,917534,917535,917536,917537,917538,917539,917540,917541,917542,917543,917544,917545,917546,917547,917548,917549,917550,917551,917552,917553,917554,917555,917556,917557,917558,917559,917560,917561,917562,917563,917564,917565,917566,917567,917568,917569,917570,917571,917572,917573,917574,917575,917576,917577,917578,917579,917580,917581,917582,917583,917584,917585,917586,917587,917588,917589,917590,917591,917592,917593,917594,917595,917596,917597,917598,917599,917600,917601,917602,917603,917604,917605,917606,917607,917608,917609,917610,917611,917612,917613,917614,917615,917616,917617,917618,917619,917620,917621,917622,917623,917624,917625,917626,917627,917628,917629,917630,917631,917760,917761,917762,917763,917764,917765,917766,917767,917768,917769,917770,917771,917772,917773,917774,917775,917776,917777,917778,917779,917780,917781,917782,917783,917784,917785,917786,917787,917788,917789,917790,917791,917792,917793,917794,917795,917796,917797,917798,917799,917800,917801,917802,917803,917804,917805,917806,917807,917808,917809,917810,917811,917812,917813,917814,917815,917816,917817,917818,917819,917820,917821,917822,917823,917824,917825,917826,917827,917828,917829,917830,917831,917832,917833,917834,917835,917836,917837,917838,917839,917840,917841,917842,917843,917844,917845,917846,917847,917848,917849,917850,917851,917852,917853,917854,917855,917856,917857,917858,917859,917860,917861,917862,917863,917864,917865,917866,917867,917868,917869,917870,917871,917872,917873,917874,917875,917876,917877,917878,917879,917880,917881,917882,917883,917884,917885,917886,917887,917888,917889,917890,917891,917892,917893,917894,917895,917896,917897,917898,917899,917900,917901,917902,917903,917904,917905,917906,917907,917908,917909,917910,917911,917912,917913,917914,917915,917916,917917,917918,917919,917920,917921,917922,917923,917924,917925,917926,917927,917928,917929,917930,917931,917932,917933,917934,917935,917936,917937,917938,917939,917940,917941,917942,917943,917944,917945,917946,917947,917948,917949,917950,917951,917952,917953,917954,917955,917956,917957,917958,917959,917960,917961,917962,917963,917964,917965,917966,917967,917968,917969,917970,917971,917972,917973,917974,917975,917976,917977,917978,917979,917980,917981,917982,917983,917984,917985,917986,917987,917988,917989,917990,917991,917992,917993,917994,917995,917996,917997,917998,917999],"cs":[173,8203,12288],"de":[173,8203,12288],"es":[8203,12288],"fr":[173,8203,12288],"it":[160,173,12288],"ja":[173],"ko":[173,12288],"pl":[173,8203,12288],"pt-BR":[173,8203,12288],"qps-ploc":[160,173,8203,12288],"ru":[173,12288],"tr":[160,173,8203,12288],"zh-hans":[160,173,8203,12288],"zh-hant":[173,12288]}')}static{this._data=void 0}static getData(){return this._data||(this._data=new Set([...Object.values(r.getRawData())].flat())),this._data}static isInvisibleCharacter(e){return r.getData().has(e)}static containsInvisibleCharacter(e){for(let t=0;t<e.length;t++){let n=e.codePointAt(t);if(typeof n=="number"&&(r.isInvisibleCharacter(n)||n===32))return!0}return!1}static get codePoints(){return r.getData()}};function Ze(r){return r===47||r===92}function qi(r){return r.replace(/[\\/]/g,K.sep)}function Ys(r){return r.indexOf("/")===-1&&(r=qi(r)),/^[a-zA-Z]:(\/|$)/.test(r)&&(r="/"+r),r}function zi(r,e=K.sep){if(!r)return"";let t=r.length,n=r.charCodeAt(0);if(Ze(n)){if(Ze(r.charCodeAt(1))&&!Ze(r.charCodeAt(2))){let o=3,s=o;for(;o<t&&!Ze(r.charCodeAt(o));o++);if(s!==o&&!Ze(r.charCodeAt(o+1))){for(o+=1;o<t;o++)if(Ze(r.charCodeAt(o)))return r.slice(0,o+1).replace(/[\\/]/g,e)}}return e}else if(Js(n)&&r.charCodeAt(1)===58)return Ze(r.charCodeAt(2))?r.slice(0,2)+e:r.slice(0,2);let i=r.indexOf("://");if(i!==-1){for(i+=3;i<t;i++)if(Ze(r.charCodeAt(i)))return r.slice(0,i+1)}return""}function hn(r,e,t,n=!1){let i=n?K.sep:We;if(r===e)return!0;if(!r||!e||((r.indexOf("..")>=0||e.indexOf("..")>=0)&&(r=n?K.normalize(r):ke(r),e=n?K.normalize(e):ke(e)),e.length>r.length))return!1;if(t){if(!yr(r,e))return!1;if(e.length===r.length)return!0;let s=e.length;return e.charAt(e.length-1)===i&&s--,r.charAt(s)===i}return e.charAt(e.length-1)!==i&&(e+=i),r.indexOf(e)===0}function Js(r){return r>=65&&r<=90||r>=97&&r<=122}function Hi(r){let e=ke(r);return w?r.length>3?!1:Du(e)&&(r.length===2||e.charCodeAt(2)===92):e===K.sep}function Du(r,e=w){return e?Js(r.charCodeAt(0))&&r.charCodeAt(1)===58:!1}var Au="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",Ou="BDEFGHIJKMOQRSTUVWXYZbdefghijkmoqrstuvwxyz0123456789";function Zs(r,e,t=8){let n="";for(let o=0;o<t;o++){let s;o===0&&w&&!e&&(t===3||t===4)?s=Ou:s=Au,n+=s.charAt(Math.floor(Math.random()*s.length))}let i;return e?i=`${e}-${n}`:i=n,r?O(r,i):i}var te;(R=>(R.inMemory="inmemory",R.vscode="vscode",R.internal="private",R.walkThrough="walkThrough",R.walkThroughSnippet="walkThroughSnippet",R.http="http",R.https="https",R.file="file",R.mailto="mailto",R.untitled="untitled",R.data="data",R.command="command",R.vscodeRemote="vscode-remote",R.vscodeRemoteResource="vscode-remote-resource",R.vscodeManagedRemoteResource="vscode-managed-remote-resource",R.vscodeUserData="vscode-userdata",R.vscodeCustomEditor="vscode-custom-editor",R.vscodeNotebookCell="vscode-notebook-cell",R.vscodeNotebookCellMetadata="vscode-notebook-cell-metadata",R.vscodeNotebookCellMetadataDiff="vscode-notebook-cell-metadata-diff",R.vscodeNotebookCellOutput="vscode-notebook-cell-output",R.vscodeNotebookCellOutputDiff="vscode-notebook-cell-output-diff",R.vscodeNotebookMetadata="vscode-notebook-metadata",R.vscodeInteractiveInput="vscode-interactive-input",R.vscodeSettings="vscode-settings",R.vscodeWorkspaceTrust="vscode-workspace-trust",R.vscodeTerminal="vscode-terminal",R.vscodeImageCarousel="vscode-image-carousel",R.vscodeChatCodeBlock="vscode-chat-code-block",R.vscodeChatCodeCompareBlock="vscode-chat-code-compare-block",R.vscodeChatEditor="vscode-chat-editor",R.vscodeChatInput="chatSessionInput",R.sessionsChatInput="sessions-chat",R.vscodeLocalChatSession="vscode-chat-session",R.vscodeChatResponseResource="vscode-chat-response-resource",R.webviewPanel="webview-panel",R.vscodeWebview="vscode-webview",R.vscodeBrowser="vscode-browser",R.extension="extension",R.vscodeFileResource="vscode-file",R.tmp="tmp",R.vsls="vsls",R.vscodeSourceControl="vscode-scm",R.commentsInput="comment",R.codeSetting="code-setting",R.outputChannel="output",R.accessibleView="accessible-view",R.chatEditingSnapshotScheme="chat-editing-snapshot-text-model",R.chatEditingModel="chat-editing-text-model",R.copilotPr="copilot-pr"))(te||={});var Uu="tkn",ji=class{constructor(){this._hosts=Object.create(null);this._ports=Object.create(null);this._connectionTokens=Object.create(null);this._preferredWebSchema="http";this._delegate=null;this._serverRootPath="/"}setPreferredWebSchema(e){this._preferredWebSchema=e}setDelegate(e){this._delegate=e}setServerRootPath(e,t){this._serverRootPath=K.join(t??"/",Nu(e))}getServerRootPath(){return this._serverRootPath}get _remoteResourcesPath(){return K.join(this._serverRootPath,te.vscodeRemoteResource)}set(e,t,n){this._hosts[e]=t,this._ports[e]=n}setConnectionToken(e,t){this._connectionTokens[e]=t}getPreferredWebSchema(){return this._preferredWebSchema}rewrite(e){if(this._delegate)try{return this._delegate(e)}catch(a){return Vo(a),e}let t=e.authority,n=this._hosts[t];n&&n.indexOf(":")!==-1&&n.indexOf("[")===-1&&(n=`[${n}]`);let i=this._ports[t],o=this._connectionTokens[t],s=`path=${encodeURIComponent(e.path)}`;return typeof o=="string"&&(s+=`&${Uu}=${encodeURIComponent(o)}`),A.from({scheme:pt?this._preferredWebSchema:te.vscodeRemoteResource,authority:`${n}:${i}`,path:pt?(window.location.pathname+"/"+this._remoteResourcesPath).replace(/\/\/+/g,"/"):this._remoteResourcesPath,query:s})}},Fu=new ji;function Nu(r){return`${r.quality??"oss"}-${r.commit??"dev"}`}var Bu="vscode-app",Gi=class r{static{this.FALLBACK_AUTHORITY=Bu}asBrowserUri(e){let t=this.toUri(e);return this.uriToBrowserUri(t)}uriToBrowserUri(e){return e.scheme===te.vscodeRemote?Fu.rewrite(e):e.scheme===te.file&&(ys||vs===`${te.vscodeFileResource}://${r.FALLBACK_AUTHORITY}`)?e.with({scheme:te.vscodeFileResource,authority:e.authority||r.FALLBACK_AUTHORITY,query:null,fragment:null}):e}asFileUri(e){let t=this.toUri(e);return this.uriToFileUri(t)}uriToFileUri(e){return e.scheme===te.vscodeFileResource?e.with({scheme:te.file,authority:e.authority!==r.FALLBACK_AUTHORITY?e.authority:null,query:null,fragment:null}):e}toUri(e){if(A.isUri(e))return e;if(globalThis._VSCODE_FILE_ROOT){let t=globalThis._VSCODE_FILE_ROOT;if(/^\w[\w\d+.-]*:\/\//.test(t))return A.joinPath(A.parse(t,!0),e);let n=O(t,e);return A.file(n)}throw new Error("Cannot determine URI for module id!")}},$e=new Gi,xm=Object.freeze({"Cache-Control":"no-cache, no-store"}),Im=Object.freeze({"Document-Policy":"include-js-call-stacks-in-crash-reports"}),Vu;(o=>{let r=new Map([["1",{"Cross-Origin-Opener-Policy":"same-origin"}],["2",{"Cross-Origin-Embedder-Policy":"require-corp"}],["3",{"Cross-Origin-Opener-Policy":"same-origin","Cross-Origin-Embedder-Policy":"require-corp"}]]);o.CoopAndCoep=Object.freeze(r.get("3"));let t="vscode-coi";function n(s){let a;typeof s=="string"?a=new URL(s).searchParams:s instanceof URL?a=s.searchParams:A.isUri(s)&&(a=new URL(s.toString(!0)).searchParams);let l=a?.get(t);if(l)return r.get(l)}o.getHeadersFromQuery=n;function i(s,a,l){if(!globalThis.crossOriginIsolated)return;let u=a&&l?"3":l?"2":"1";s instanceof URLSearchParams?s.set(t,u):s[t]=u}o.addSearchParam=i})(Vu||={});function qe(r){return mn(r,!0)}var gn=class{constructor(e){this._ignorePathCasing=e}compare(e,t,n=!1){return e===t?0:fn(this.getComparisonKey(e,n),this.getComparisonKey(t,n))}isEqual(e,t,n=!1){return e===t?!0:!e||!t?!1:this.getComparisonKey(e,n)===this.getComparisonKey(t,n)}getComparisonKey(e,t=!1){return e.with({path:this._ignorePathCasing(e)?e.path.toLowerCase():void 0,fragment:t?null:void 0}).toString()}ignorePathCasing(e){return this._ignorePathCasing(e)}isEqualOrParent(e,t,n=!1){if(e.scheme===t.scheme){if(e.scheme===te.file)return hn(qe(e),qe(t),this._ignorePathCasing(e))&&e.query===t.query&&(n||e.fragment===t.fragment);if(ea(e.authority,t.authority))return hn(e.path,t.path,this._ignorePathCasing(e),!0)&&e.query===t.query&&(n||e.fragment===t.fragment)}return!1}joinPath(e,...t){return A.joinPath(e,...t)}basenameOrAuthority(e){return Ku(e)||e.authority}basename(e,t){return K.basename(e.path,t)}extname(e){return K.extname(e.path)}dirname(e){if(e.path.length===0)return e;let t;return e.scheme===te.file?t=A.file(Ke(qe(e))).path:(t=K.dirname(e.path),e.authority&&t.length&&t.charCodeAt(0)!==47&&(console.error(`dirname("${e.toString})) resulted in a relative path`),t="/")),e.with({path:t})}normalizePath(e){if(!e.path.length)return e;let t;return e.scheme===te.file?t=A.file(ke(qe(e))).path:t=K.normalize(e.path),e.with({path:t})}relativePath(e,t){if(e.scheme!==t.scheme||!ea(e.authority,t.authority))return;if(e.scheme===te.file){let o=ws(qe(e),qe(t));return w?qi(o):o}let n=e.path||"/",i=t.path||"/";if(this._ignorePathCasing(e)){let o=0;for(let s=Math.min(n.length,i.length);o<s&&!(n.charCodeAt(o)!==i.charCodeAt(o)&&n.charAt(o).toLowerCase()!==i.charAt(o).toLowerCase());o++);n=i.substr(0,o)+n.substr(o)}return K.relative(n,i)}resolvePath(e,t){if(e.scheme===te.file){let n=A.file(gt(qe(e),t));return e.with({authority:n.authority,path:n.path})}return t=Ys(t),e.with({path:K.resolve(e.path,t)})}isAbsolutePath(e){return!!e.path&&e.path[0]==="/"}isEqualAuthority(e,t){return e===t||e!==void 0&&t!==void 0&&gr(e,t)}hasTrailingPathSeparator(e,t=We){if(e.scheme===te.file){let n=qe(e);return n.length>zi(n).length&&n[n.length-1]===t}else{let n=e.path;return n.length>1&&n.charCodeAt(n.length-1)===47&&!/^[a-zA-Z]:(\/$|\\$)/.test(e.fsPath)}}removeTrailingPathSeparator(e,t=We){return ta(e,t)?e.with({path:e.path.substr(0,e.path.length-1)}):e}addTrailingPathSeparator(e,t=We){let n=!1;if(e.scheme===te.file){let i=qe(e);n=i!==void 0&&i.length===zi(i).length&&i[i.length-1]===t}else{t="/";let i=e.path;n=i.length===1&&i.charCodeAt(i.length-1)===47}return!n&&!ta(e,t)?e.with({path:e.path+"/"}):e}},$=new gn(()=>!1),na=new gn(r=>r.scheme===te.file?!Ae:!0),km=new gn(r=>!0),Rm=$.isEqual.bind($),Lm=$.isEqualOrParent.bind($),Dm=$.getComparisonKey.bind($),Am=$.basenameOrAuthority.bind($),Ku=$.basename.bind($),Om=$.extname.bind($),Mm=$.dirname.bind($),Ie=$.joinPath.bind($),Um=$.normalizePath.bind($),Fm=$.relativePath.bind($),Nm=$.resolvePath.bind($),Bm=$.isAbsolutePath.bind($),ea=$.isEqualAuthority.bind($),ta=$.hasTrailingPathSeparator.bind($),Vm=$.removeTrailingPathSeparator.bind($),Km=$.addTrailingPathSeparator.bind($);var Wu;(o=>{o.META_DATA_LABEL="label",o.META_DATA_DESCRIPTION="description",o.META_DATA_SIZE="size",o.META_DATA_MIME="mime";function i(s){let a=new Map;s.path.substring(s.path.indexOf(";")+1,s.path.lastIndexOf(";")).split(";").forEach(p=>{let[c,d]=p.split(":");c&&d&&a.set(c,d)});let u=s.path.substring(0,s.path.indexOf(";"));return u&&a.set(o.META_DATA_MIME,u),a}o.parseMetaData=i})(Wu||={});function _n(r){let e=new Oe,t=r(e.token),n=!1,i=new Promise((o,s)=>{let a=e.token.onCancellationRequested(()=>{n=!0,a.dispose(),s(new we)});Promise.resolve(t).then(l=>{a.dispose(),e.dispose(),n?ls(l)&&l.dispose():o(l)},l=>{a.dispose(),e.dispose(),s(l)})});return new class{cancel(){e.cancel(),e.dispose()}then(o,s){return i.then(o,s)}catch(o){return this.then(void 0,o)}finally(o){return i.finally(o)}}}var Qi=class{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}},vr=class extends Qi{constructor(e){super(),this._timeout=setTimeout(()=>this.open(),e)}open(){clearTimeout(this._timeout),super.open()}};function fe(r,e){return e?new Promise((t,n)=>{let i=setTimeout(()=>{o.dispose(),t()},r),o=e.onCancellationRequested(()=>{clearTimeout(i),o.dispose(),n(new we)})}):_n(t=>fe(r,t))}var rf=2**31-1;var Yi=class{constructor(e){this._size=0;this._isDisposed=!1;this.maxDegreeOfParalellism=e,this.outstandingPromises=[],this.runningPromises=0,this._onDrained=new y}whenIdle(){return this.size>0?S.toPromise(this.onDrained):Promise.resolve()}get onDrained(){return this._onDrained.event}get size(){return this._size}queue(e){if(this._isDisposed)throw new Error("Object has been disposed");return this._size++,new Promise((t,n)=>{this.outstandingPromises.push({factory:e,c:t,e:n}),this.consume()})}consume(){for(;this.outstandingPromises.length&&this.runningPromises<this.maxDegreeOfParalellism;){let e=this.outstandingPromises.shift();this.runningPromises++;let t=e.factory();t.then(e.c,e.e),t.then(()=>this.consumed(),()=>this.consumed())}}consumed(){this._isDisposed||(this.runningPromises--,--this._size===0&&this._onDrained.fire(),this.outstandingPromises.length>0&&this.consume())}clear(){if(this._isDisposed)throw new Error("Object has been disposed");this.outstandingPromises.length=0,this._size=this.runningPromises}dispose(){this._isDisposed=!0,this.outstandingPromises.length=0,this._size=0,this._onDrained.dispose()}},yn=class extends Yi{constructor(){super(1)}};var br=class{constructor(){this.queues=new Map;this.drainers=new Set;this.drainListeners=void 0;this.drainListenerCount=0}async whenDrained(){if(this.isDrained())return;let e=new bn;return this.drainers.add(e),e.p}isDrained(){for(let[,e]of this.queues)if(e.size>0)return!1;return!0}queueSize(e,t=$){let n=t.getComparisonKey(e);return this.queues.get(n)?.size??0}queueFor(e,t,n=$){let i=n.getComparisonKey(e),o=this.queues.get(i);if(!o){o=new yn;let s=this.drainListenerCount++,a=S.once(o.onDrained)(()=>{o?.dispose(),this.queues.delete(i),this.onDidQueueDrain(),this.drainListeners?.deleteAndDispose(s),this.drainListeners?.size===0&&(this.drainListeners.dispose(),this.drainListeners=void 0)});this.drainListeners||(this.drainListeners=new Ut),this.drainListeners.set(s,a),this.queues.set(i,o)}return o.queue(t)}onDidQueueDrain(){this.isDrained()&&this.releaseDrainers()}releaseDrainers(){for(let e of this.drainers)e.complete();this.drainers.clear()}dispose(){for(let[,e]of this.queues)e.dispose();this.queues.clear(),this.releaseDrainers(),this.drainListeners?.dispose()}};var _r=class{constructor(e,t){this.timeoutToken=void 0,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=void 0)}schedule(e=this.timeout){this.cancel(),this.timeoutToken=setTimeout(this.timeoutHandler,e)}get delay(){return this.timeout}set delay(e){this.timeout=e}isScheduled(){return this.timeoutToken!==void 0}flush(){this.isScheduled()&&(this.cancel(),this.doRun())}onTimeout(){this.timeoutToken=void 0,this.runner&&this.doRun()}doRun(){this.runner?.()}},vn=class{constructor(e,t){t%1e3!==0&&console.warn(`ProcessTimeRunOnceScheduler resolution is 1s, ${t}ms is not a multiple of 1000ms.`),this.runner=e,this.timeout=t,this.counter=0,this.intervalToken=void 0,this.intervalHandler=this.onInterval.bind(this)}dispose(){this.cancel(),this.runner=null}cancel(){this.isScheduled()&&(clearInterval(this.intervalToken),this.intervalToken=void 0)}schedule(e=this.timeout){e%1e3!==0&&console.warn(`ProcessTimeRunOnceScheduler resolution is 1s, ${e}ms is not a multiple of 1000ms.`),this.cancel(),this.counter=Math.ceil(e/1e3),this.intervalToken=setInterval(this.intervalHandler,1e3)}isScheduled(){return this.intervalToken!==void 0}onInterval(){this.counter--,!(this.counter>0)&&(clearInterval(this.intervalToken),this.intervalToken=void 0,this.runner?.())}};var $u,Xi;(function(){let r=globalThis;typeof r.requestIdleCallback!="function"||typeof r.cancelIdleCallback!="function"?Xi=(e,t,n)=>{_s(()=>{if(i)return;let o=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,o-Date.now())}}))});let i=!1;return{dispose(){i||(i=!0)}}}:Xi=(e,t,n)=>{let i=e.requestIdleCallback(t,typeof n=="number"?{timeout:n}:void 0),o=!1;return{dispose(){o||(o=!0,e.cancelIdleCallback(i))}}},$u=(e,t)=>Xi(globalThis,e,t)})();var bn=class r{static fromPromise(e){let t=new r;return t.settleWith(e),t}get isRejected(){return this.outcome?.outcome===1}get isResolved(){return this.outcome?.outcome===0}get isSettled(){return!!this.outcome}get value(){return this.outcome?.outcome===0?this.outcome?.value:void 0}constructor(){this.p=new Promise((e,t)=>{this.completeCallback=e,this.errorCallback=t})}complete(e){return this.isSettled?Promise.resolve():new Promise(t=>{this.completeCallback(e),this.outcome={outcome:0,value:e},t()})}error(e){return this.isSettled?Promise.resolve():new Promise(t=>{this.errorCallback(e),this.outcome={outcome:1,value:e},t()})}settleWith(e){return e.then(t=>this.complete(t),t=>this.error(t))}cancel(){return this.error(new we)}},Zi;(t=>{async function r(n){let i,o=await Promise.all(n.map(s=>s.then(a=>a,a=>{i||(i=a)})));if(typeof i<"u")throw i;return o}t.settled=r;function e(n){return new Promise(async(i,o)=>{try{await n(i,o)}catch(s){o(s)}})}t.withAsyncBody=e})(Zi||={});var ra=class r{static fromArray(e){return new r(t=>{t.emitMany(e)})}static fromPromise(e){return new r(async t=>{t.emitMany(await e)})}static fromPromisesResolveOrder(e){return new r(async t=>{await Promise.all(e.map(async n=>t.emitOne(await n)))})}static merge(e){return new r(async t=>{await Promise.all(e.map(async n=>{for await(let i of n)t.emitOne(i)}))})}static{this.EMPTY=r.fromArray([])}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new y,queueMicrotask(async()=>{let n={emitOne:i=>this.emitOne(i),emitMany:i=>this.emitMany(i),reject:i=>this.reject(i)};try{await Promise.resolve(e(n)),this.resolve()}catch(i){this.reject(i)}finally{n.emitOne=()=>{},n.emitMany=()=>{},n.reject=()=>{}}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await S.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(e,t){return new r(async n=>{for await(let i of e)n.emitOne(t(i))})}map(e){return r.map(this,e)}static filter(e,t){return new r(async n=>{for await(let i of e)t(i)&&n.emitOne(i)})}filter(e){return r.filter(this,e)}static coalesce(e){return r.filter(e,t=>!!t)}coalesce(){return r.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return r.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};var Ji=class{constructor(){this._unsatisfiedConsumers=[];this._unconsumedValues=[]}get hasFinalValue(){return!!this._finalValue}produce(e){if(this._ensureNoFinalValue(),this._unsatisfiedConsumers.length>0){let t=this._unsatisfiedConsumers.shift();this._resolveOrRejectDeferred(t,e)}else this._unconsumedValues.push(e)}produceFinal(e){this._ensureNoFinalValue(),this._finalValue=e;for(let t of this._unsatisfiedConsumers)this._resolveOrRejectDeferred(t,e);this._unsatisfiedConsumers.length=0}_ensureNoFinalValue(){if(this._finalValue)throw new Xe("ProducerConsumer: cannot produce after final value has been set")}_resolveOrRejectDeferred(e,t){t.ok?e.complete(t.value):e.error(t.error)}consume(){if(this._unconsumedValues.length>0||this._finalValue){let e=this._unconsumedValues.length>0?this._unconsumedValues.shift():this._finalValue;return e.ok?Promise.resolve(e.value):Promise.reject(e.error)}else{let e=new bn;return this._unsatisfiedConsumers.push(e),e.p}}},ia=class r{constructor(e,t){this._onReturn=t;this._producerConsumer=new Ji;this._iterator={next:()=>this._producerConsumer.consume(),return:()=>(this._onReturn?.(),Promise.resolve({done:!0,value:void 0})),throw:async e=>(this._finishError(e),{done:!0,value:void 0})};queueMicrotask(async()=>{let n=e({emitOne:i=>this._producerConsumer.produce({ok:!0,value:{done:!1,value:i}}),emitMany:i=>{for(let o of i)this._producerConsumer.produce({ok:!0,value:{done:!1,value:o}})},reject:i=>this._finishError(i)});if(!this._producerConsumer.hasFinalValue)try{await n,this._finishOk()}catch(i){this._finishError(i)}})}static fromArray(e){return new r(t=>{t.emitMany(e)})}static fromPromise(e){return new r(async t=>{t.emitMany(await e)})}static fromPromisesResolveOrder(e){return new r(async t=>{await Promise.all(e.map(async n=>t.emitOne(await n)))})}static merge(e){return new r(async t=>{await Promise.all(e.map(async n=>{for await(let i of n)t.emitOne(i)}))})}static{this.EMPTY=r.fromArray([])}static map(e,t){return new r(async n=>{for await(let i of e)n.emitOne(t(i))})}static tee(e){let t,n,i=new bn,o=async()=>{if(!(!t||!n))try{for await(let l of e)t.emitOne(l),n.emitOne(l)}catch(l){t.reject(l),n.reject(l)}finally{i.complete()}},s=new r(async l=>(t=l,o(),i.p)),a=new r(async l=>(n=l,o(),i.p));return[s,a]}map(e){return r.map(this,e)}static coalesce(e){return r.filter(e,t=>!!t)}coalesce(){return r.coalesce(this)}static filter(e,t){return new r(async n=>{for await(let i of e)t(i)&&n.emitOne(i)})}filter(e){return r.filter(this,e)}_finishOk(){this._producerConsumer.hasFinalValue||this._producerConsumer.produceFinal({ok:!0,value:{done:!0,value:void 0}})}_finishError(e){this._producerConsumer.hasFinalValue||this._producerConsumer.produceFinal({ok:!1,error:e})}[Symbol.asyncIterator](){return this._iterator}};function oa(r){return(e,t,n)=>{let i=null,o=null;if(typeof n.value=="function"?(i="value",o=n.value):typeof n.get=="function"&&(i="get",o=n.get),!o||typeof t=="symbol")throw new Error("not supported");n[i]=r(o,t)}}function L(r,e,t){let n=null,i=null;if(typeof t.value=="function"?(n="value",i=t.value,i.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof t.get=="function"&&(n="get",i=t.get),!i)throw new Error("not supported");let o=`$memoize$${e}`;t[n]=function(...s){return this.hasOwnProperty(o)||Object.defineProperty(this,o,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,s)}),this[o]}}function Wt(r,e,t){return oa((n,i)=>{let o=`$debounce$${i}`,s=`$debounce$result$${i}`;return function(...a){this[s]||(this[s]=t?t():void 0),clearTimeout(this[o]),e&&(this[s]=e(this[s],...a),a=[this[s]]),this[o]=setTimeout(()=>{n.apply(this,a),this[s]=t?t():void 0},r)}})}function xr(r,e,t){return oa((n,i)=>{let o=`$throttle$timer$${i}`,s=`$throttle$result$${i}`,a=`$throttle$lastRun$${i}`,l=`$throttle$pending$${i}`;return function(...u){if(this[s]||(this[s]=t?t():void 0),(this[a]===null||this[a]===void 0)&&(this[a]=-Number.MAX_VALUE),e&&(this[s]=e(this[s],...u)),this[l])return;let p=this[a]+r;p<=Date.now()?(this[a]=Date.now(),n.apply(this,[this[s]]),this[s]=t?t():void 0):(this[l]=!0,this[o]=setTimeout(()=>{this[l]=!1,this[a]=Date.now(),n.apply(this,[this[s]]),this[s]=t?t():void 0},p-Date.now()))}})}function xn(r,e=0){if(!r||e>200)return r;if(typeof r=="object"){switch(r.$mid){case 1:return A.revive(r);case 2:return new RegExp(r.source,r.flags);case 17:return new Date(r.source)}if(r instanceof ee||r instanceof Uint8Array)return r;if(Array.isArray(r))for(let t=0;t<r.length;++t)r[t]=xn(r[t],e+1);else for(let t in r)Object.hasOwnProperty.call(r,t)&&(r[t]=xn(r[t],e+1))}return r}function zt(r){switch(r){case 100:return"req";case 101:return"cancel";case 102:return"subscribe";case 103:return"unsubscribe"}}function Ir(r){switch(r){case 200:return"init";case 201:return"reply:";case 202:case 203:return"replyErr:";case 204:return"event:"}}function $t(r){let e=0;for(let t=0;;t+=7){let n=r.read(1);if(e|=(n.buffer[0]&127)<<t,!(n.buffer[0]&128))return e}}var qu=et(0);function qt(r,e){if(e===0){r.write(qu);return}let t=0;for(let i=e;i!==0;i=i>>>7)t++;let n=ee.alloc(t);for(let i=0;e!==0;i++)n.buffer[i]=e&127,e=e>>>7,e>0&&(n.buffer[i]|=128);r.write(n)}var Tn=class{constructor(e){this.buffer=e;this.pos=0}read(e){let t=this.buffer.slice(this.pos,this.pos+e);return this.pos+=t.byteLength,t}},Tr=class{constructor(){this.buffers=[]}get buffer(){return ee.concat(this.buffers)}write(e){this.buffers.push(e)}dispose(){this.buffers.length=0}};function et(r){let e=ee.alloc(1);return e.writeUInt8(r,0),e}var xt={Undefined:et(0),String:et(1),Buffer:et(2),VSBuffer:et(3),Array:et(4),Object:et(5),Uint:et(6)};function En(r,e){if(typeof e>"u")r.write(xt.Undefined);else if(typeof e=="string"){let t=ee.fromString(e);r.write(xt.String),qt(r,t.byteLength),r.write(t)}else if(ee.isNativeBuffer(e)){let t=ee.wrap(e);r.write(xt.Buffer),qt(r,t.byteLength),r.write(t)}else if(e instanceof ee)r.write(xt.VSBuffer),qt(r,e.byteLength),r.write(e);else if(Array.isArray(e)){r.write(xt.Array),qt(r,e.length);for(let t of e)En(r,t)}else if(typeof e=="number"&&(e|0)===e)r.write(xt.Uint),qt(r,e);else{let t=ee.fromString(JSON.stringify(e));r.write(xt.Object),qt(r,t.byteLength),r.write(t)}}function Ht(r){switch(r.read(1).readUInt8(0)){case 0:return;case 1:return r.read($t(r)).toString();case 2:return r.read($t(r)).buffer;case 3:return r.read($t(r));case 4:{let t=$t(r),n=[];for(let i=0;i<t;i++)n.push(Ht(r));return n}case 5:return JSON.parse(r.read($t(r)).toString());case 6:return $t(r)}}var wn=class{constructor(e,t,n=null,i=1e3){this.protocol=e;this.ctx=t;this.logger=n;this.timeoutDelay=i;this.channels=new Map;this.activeRequests=new Map;this.pendingRequests=new Map;this.protocolListener=this.protocol.onMessage(o=>this.onRawMessage(o)),this.sendResponse({type:200})}registerChannel(e,t){this.channels.set(e,t),setTimeout(()=>this.flushPendingRequests(e),0)}sendResponse(e){switch(e.type){case 200:{let t=this.send([e.type]);this.logger?.logOutgoing(t,0,1,Ir(e.type));return}case 201:case 202:case 204:case 203:{let t=this.send([e.type,e.id],e.data);this.logger?.logOutgoing(t,e.id,1,Ir(e.type),e.data);return}}}send(e,t=void 0){let n=new Tr;try{return En(n,e),En(n,t),this.sendBuffer(n.buffer)}finally{n.dispose()}}sendBuffer(e){try{return this.protocol.send(e),e.byteLength}catch{return 0}}onRawMessage(e){let t=new Tn(e),n=Ht(t),i=Ht(t),o=n[0];switch(o){case 100:return this.logger?.logIncoming(e.byteLength,n[1],1,`${zt(o)}: ${n[2]}.${n[3]}`,i),this.onPromise({type:o,id:n[1],channelName:n[2],name:n[3],arg:i});case 102:return this.logger?.logIncoming(e.byteLength,n[1],1,`${zt(o)}: ${n[2]}.${n[3]}`,i),this.onEventListen({type:o,id:n[1],channelName:n[2],name:n[3],arg:i});case 101:return this.logger?.logIncoming(e.byteLength,n[1],1,`${zt(o)}`),this.disposeActiveRequest({type:o,id:n[1]});case 103:return this.logger?.logIncoming(e.byteLength,n[1],1,`${zt(o)}`),this.disposeActiveRequest({type:o,id:n[1]})}}onPromise(e){let t=this.channels.get(e.channelName);if(!t){this.collectPendingRequest(e);return}let n=new Oe,i;try{i=t.call(this.ctx,e.name,e.arg,n.token)}catch(a){i=Promise.reject(a)}let o=e.id;i.then(a=>{this.sendResponse({id:o,data:a,type:201})},a=>{a instanceof Error?this.sendResponse({id:o,data:{message:a.message,name:a.name,stack:a.stack?a.stack.split(`
`):void 0},type:202}):this.sendResponse({id:o,data:a,type:203})}).finally(()=>{s.dispose(),this.activeRequests.delete(e.id)});let s=Q(()=>n.cancel());this.activeRequests.set(e.id,s)}onEventListen(e){let t=this.channels.get(e.channelName);if(!t){this.collectPendingRequest(e);return}let n=e.id,o=t.listen(this.ctx,e.name,e.arg)(s=>this.sendResponse({id:n,data:s,type:204}));this.activeRequests.set(e.id,o)}disposeActiveRequest(e){let t=this.activeRequests.get(e.id);t&&(t.dispose(),this.activeRequests.delete(e.id))}collectPendingRequest(e){let t=this.pendingRequests.get(e.channelName);t||(t=[],this.pendingRequests.set(e.channelName,t));let n=setTimeout(()=>{console.error(`Unknown channel: ${e.channelName}`),e.type===100&&this.sendResponse({id:e.id,data:{name:"Unknown channel",message:`Channel name '${e.channelName}' timed out after ${this.timeoutDelay}ms`,stack:void 0},type:202})},this.timeoutDelay);t.push({request:e,timeoutTimer:n})}flushPendingRequests(e){let t=this.pendingRequests.get(e);if(t){for(let n of t)switch(clearTimeout(n.timeoutTimer),n.request.type){case 100:this.onPromise(n.request);break;case 102:this.onEventListen(n.request);break}this.pendingRequests.delete(e)}}dispose(){this.protocolListener&&(this.protocolListener.dispose(),this.protocolListener=null),Pe(this.activeRequests.values()),this.activeRequests.clear()}};var In=class{constructor(e,t=null){this.protocol=e;this.isDisposed=!1;this.state=0;this.activeRequests=new Set;this.handlers=new Map;this.lastRequestId=0;this._onDidInitialize=new y;this.onDidInitialize=this._onDidInitialize.event;this.protocolListener=this.protocol.onMessage(n=>this.onBuffer(n)),this.logger=t}getChannel(e){let t=this;return{call(n,i,o){return t.isDisposed?Promise.reject(new we):t.requestPromise(e,n,i,o)},listen(n,i){return t.isDisposed?S.None:t.requestEvent(e,n,i)}}}requestPromise(e,t,n,i=bt.None){let o=this.lastRequestId++,a={id:o,type:100,channelName:e,name:t,arg:n};if(i.isCancellationRequested)return Promise.reject(new we);let l,u;return new Promise((c,d)=>{if(i.isCancellationRequested)return d(new we);let m=()=>{let E=q=>{switch(q.type){case 201:this.handlers.delete(o),c(q.data);break;case 202:{this.handlers.delete(o);let H=new Error(q.data.message);H.stack=Array.isArray(q.data.stack)?q.data.stack.join(`
`):q.data.stack,H.name=q.data.name,d(H);break}case 203:this.handlers.delete(o),d(q.data);break}};this.handlers.set(o,E);try{this.sendRequest(a)}catch(q){this.handlers.delete(o),d(q)}},f=null;this.state===1?m():(f=_n(E=>this.whenInitialized()),f.then(()=>{f=null,m()},()=>{}));let b=()=>{f?(f.cancel(),f=null):this.sendRequest({id:o,type:101}),d(new we)};l=i.onCancellationRequested(b),u={dispose:on(()=>{b(),l.dispose()})},this.activeRequests.add(u)}).finally(()=>{l?.dispose(),this.activeRequests.delete(u)})}requestEvent(e,t,n){let i=this.lastRequestId++,s={id:i,type:102,channelName:e,name:t,arg:n},a=null,l=new y({onWillAddFirstListener:()=>{let u=c=>l.fire(c.data);this.handlers.set(i,u);let p=()=>{this.activeRequests.add(l),this.sendRequest(s)};this.state===1?p():(a=_n(c=>this.whenInitialized()),a.then(()=>{a=null,p()},()=>{}))},onDidRemoveLastListener:()=>{a?(a.cancel(),a=null):(this.activeRequests.delete(l),this.sendRequest({id:i,type:103})),this.handlers.delete(i)}});return l.event}sendRequest(e){switch(e.type){case 100:case 102:{let t=this.send([e.type,e.id,e.channelName,e.name],e.arg);this.logger?.logOutgoing(t,e.id,0,`${zt(e.type)}: ${e.channelName}.${e.name}`,e.arg);return}case 101:case 103:{let t=this.send([e.type,e.id]);this.logger?.logOutgoing(t,e.id,0,zt(e.type));return}}}send(e,t=void 0){let n=new Tr;try{return En(n,e),En(n,t),this.sendBuffer(n.buffer)}finally{n.dispose()}}sendBuffer(e){try{return this.protocol.send(e),e.byteLength}catch{return 0}}onBuffer(e){let t=new Tn(e),n=Ht(t),i=Ht(t),o=n[0];switch(o){case 200:return this.logger?.logIncoming(e.byteLength,0,0,Ir(o)),this.onResponse({type:n[0]});case 201:case 202:case 204:case 203:return this.logger?.logIncoming(e.byteLength,n[1],0,Ir(o),i),this.onResponse({type:n[0],id:n[1],data:i})}}onResponse(e){if(e.type===200){this.state=1,this._onDidInitialize.fire();return}this.handlers.get(e.id)?.(e)}get onDidInitializePromise(){return S.toPromise(this.onDidInitialize)}whenInitialized(){return this.state===1?Promise.resolve():this.onDidInitializePromise}dispose(){this.isDisposed=!0,this.protocolListener&&(this.protocolListener.dispose(),this.protocolListener=null),Pe(this.activeRequests.values()),this.activeRequests.clear(),this._onDidInitialize.dispose()}};h([L],In.prototype,"onDidInitializePromise",1);var Er=class{constructor(e,t,n){this.channels=new Map;this._connections=new Set;this._onDidAddConnection=new y;this.onDidAddConnection=this._onDidAddConnection.event;this._onDidRemoveConnection=new y;this.onDidRemoveConnection=this._onDidRemoveConnection.event;this.disposables=new me;this.disposables.add(e(({protocol:i,onDidClientDisconnect:o})=>{let s=S.once(i.onMessage),a=new me,l=s(u=>{let p=new Tn(u),c=Ht(p),d=new wn(i,c,t,n),m=new In(i,t);this.channels.forEach((b,E)=>d.registerChannel(E,b));let f={channelServer:d,channelClient:m,ctx:c};this._connections.add(f),this._onDidAddConnection.fire(f),a.add(o(()=>{d.dispose(),m.dispose(),this._connections.delete(f),this._onDidRemoveConnection.fire(f),this.disposables.delete(a),a.dispose()}))});a.add(l),this.disposables.add(a)}))}get connections(){let e=[];return this._connections.forEach(t=>e.push(t)),e}getChannel(e,t){let n=this;return{call(i,o,s){let a;if(ut(t)){let u=Ho(n.connections.filter(t));a=u?Promise.resolve(u):S.toPromise(S.filter(n.onDidAddConnection,t))}else a=t.routeCall(n,i,o);let l=a.then(u=>u.channelClient.getChannel(e));return sa(l).call(i,o,s)},listen(i,o){if(ut(t))return n.getMulticastEvent(e,t,i,o);let s=t.routeEvent(n,i,o).then(a=>a.channelClient.getChannel(e));return sa(s).listen(i,o)}}}getMulticastEvent(e,t,n,i){let o=this,s,a=new y({onWillAddFirstListener:()=>{s=new me;let l=new pr,u=new Map,p=d=>{let f=d.channelClient.getChannel(e).listen(n,i),b=l.add(f);u.set(d,b)},c=d=>{let m=u.get(d);m&&(m.dispose(),u.delete(d))};o.connections.filter(t).forEach(p),S.filter(o.onDidAddConnection,t)(p,void 0,s),o.onDidRemoveConnection(c,void 0,s),l.event(a.fire,a,s),s.add(l)},onDidRemoveLastListener:()=>{s?.dispose(),s=void 0}});return o.disposables.add(a),a.event}registerChannel(e,t){this.channels.set(e,t);for(let n of this._connections)n.channelServer.registerChannel(e,t)}dispose(){this.disposables.dispose();for(let e of this._connections)e.channelClient.dispose(),e.channelServer.dispose();this._connections.clear(),this.channels.clear(),this._onDidAddConnection.dispose(),this._onDidRemoveConnection.dispose()}};function sa(r){return{call(e,t,n){return r.then(i=>i.call(e,t,n))},listen(e,t){let n=new mr;return r.then(i=>n.input=i.listen(e,t),()=>n.dispose()),n.event}}}var wr;(i=>{function r(o,s,a){let l=o,u=a?.disableMarshalling,p=a?.unbufferedEvents?new Set(a.unbufferedEvents):void 0,c=new Map;for(let d in l)t(d)&&!p?.has(d)&&c.set(d,S.buffer(l[d],d,!0,void 0,s));return new class{listen(d,m,f){let b=c.get(m);if(b)return b;let E=l[m];if(typeof E=="function"){if(n(m))return E.call(l,f);if(t(m))return p?.has(m)?l[m]:(c.set(m,S.buffer(l[m],m,!0,void 0,s)),c.get(m))}throw new Le(`Event not found: ${m}`)}call(d,m,f){let b=l[m];if(typeof b=="function"){if(!u&&Array.isArray(f))for(let q=0;q<f.length;q++)f[q]=xn(f[q]);let E=b.apply(l,f);return E instanceof Promise||(E=Promise.resolve(E)),E}throw new Le(`Method not found: ${m}`)}}}i.fromService=r;function e(o,s){let a=s?.disableMarshalling;return new Proxy({},{get(l,u){if(typeof u=="string")return s?.properties?.has(u)?s.properties.get(u):u==="then"?void 0:n(u)?function(p){return o.listen(u,p)}:t(u)?o.listen(u):async function(...p){let c;s&&!_i(s.context)?c=[s.context,...p]:c=p;let d=await o.call(u,c);return a?d:xn(d)};throw new Le(`Property not found: ${String(u)}`)}})}i.toService=e;function t(o){return o[0]==="o"&&o[1]==="n"&&Wi(o.charCodeAt(2))}function n(o){return/^onDynamic/.test(o)&&Wi(o.charCodeAt(9))}})(wr||={});import{fork as T1}from"child_process";function Sn(r,e){if(r===e)return!0;if(r==null||e===null||e===void 0||typeof r!=typeof e||typeof r!="object"||Array.isArray(r)!==Array.isArray(e))return!1;let t,n;if(Array.isArray(r)){if(r.length!==e.length)return!1;for(t=0;t<r.length;t++)if(!Sn(r[t],e[t]))return!1}else{let i=[];for(n in r)i.push(n);i.sort();let o=[];for(n in e)o.push(n);if(o.sort(),!Sn(i,o))return!1;for(t=0;t<i.length;t++)if(!Sn(r[i[t]],e[i[t]]))return!1}return!0}function eo(r,e){let t=e.toLowerCase(),n=Object.keys(r).find(i=>i.toLowerCase()===t);return n?r[n]:r[e]}import*as dc from"child_process";import{promises as ga}from"fs";import*as D from"fs";import{tmpdir as Xu}from"os";import{promisify as Pn}from"util";var zu=new At(1e4);function to(r){return aa(r,"NFC",zu)}var Hu=new At(1e4);function ju(r){return aa(r,"NFD",Hu)}var Gu=/[^\u0000-\u0080]/;function aa(r,e,t){if(!r)return r;let n=t.get(r);if(n)return n;let i;return Gu.test(r)?i=r.normalize(e):i=r,t.set(r,i),i}var qf=(function(){let r=new At(1e4),e=/[\u0300-\u036f]/g;return function(t){let n=r.get(t);if(n)return n;let i=ju(t).replace(e,""),o=(i.length===t.length?i:t).toLowerCase();return r.set(t,o),o}})();async function ca(r,e=0,t){if(Hi(r))throw new Error("rimraf - will refuse to recursively delete root");return e===0?no(r):Qu(r,t)}async function Qu(r,e=Zs(Xu())){try{try{await D.promises.rename(r,e)}catch(t){return t.code==="ENOENT"?void 0:no(r)}no(e).catch(()=>{})}catch(t){if(t.code!=="ENOENT")throw t}}async function no(r){return D.promises.rm(r,{recursive:!0,force:!0,maxRetries:3})}async function Sr(r,e){try{return await la(r,e)}catch(t){if(t.code==="ENOENT"&&w&&Hi(r))try{return await la(`${r}.`,e)}catch{}throw t}}async function la(r,e){return Ju(await(e?Yu(r):D.promises.readdir(r)))}async function Yu(r){try{return await D.promises.readdir(r,{withFileTypes:!0})}catch(n){n.code!=="ENOENT"&&console.warn("[node.js fs] readdir with filetypes failed with error: ",n)}let e=[],t=await Sr(r);for(let n of t){let i=!1,o=!1,s=!1;try{let a=await D.promises.lstat(O(r,n));i=a.isFile(),o=a.isDirectory(),s=a.isSymbolicLink()}catch(a){a.code!=="ENOENT"&&console.warn("[node.js fs] unexpected error from lstat after readdir: ",a)}e.push({name:n,isFile:()=>i,isDirectory:()=>o,isSymbolicLink:()=>s})}return e}function Ju(r){return r.map(e=>typeof e=="string"?be?to(e):e:(e.name=be?to(e.name):e.name,e))}async function Zu(r){let e=await Sr(r),t=[];for(let n of e)await ze.existsDirectory(O(r,n))&&t.push(n);return t}var ze;(n=>{async function r(i){let o;try{if(o=await D.promises.lstat(i),!o.isSymbolicLink())return{stat:o}}catch{}try{return{stat:await D.promises.stat(i),symbolicLink:o?.isSymbolicLink()?{dangling:!1}:void 0}}catch(s){if(s.code==="ENOENT"&&o)return{stat:o,symbolicLink:{dangling:!0}};if(w&&s.code==="EACCES")try{return{stat:await D.promises.stat(await D.promises.readlink(i)),symbolicLink:{dangling:!1}}}catch(a){if(a.code==="ENOENT"&&o)return{stat:o,symbolicLink:{dangling:!0}};throw a}throw s}}n.stat=r;async function e(i){try{let{stat:o,symbolicLink:s}=await n.stat(i);return o.isFile()&&s?.dangling!==!0}catch{}return!1}n.existsFile=e;async function t(i){try{let{stat:o,symbolicLink:s}=await n.stat(i);return o.isDirectory()&&s?.dangling!==!0}catch{}return!1}n.existsDirectory=t})(ze||={});var ec=new br;function tc(r,e,t){return ec.queueFor(A.file(r),()=>{let n=ic(t);return new Promise((i,o)=>rc(r,e,n,s=>s?o(s):i()))},na)}var da=!0;function nc(r){da=r}function rc(r,e,t,n){if(!da)return D.writeFile(r,e,{mode:t.mode,flag:t.flag},n);D.open(r,t.flag,t.mode,(i,o)=>{if(i)return n(i);D.writeFile(o,e,s=>{if(s)return D.close(o,()=>n(s));D.fdatasync(o,a=>(a&&(console.warn("[node.js fs] fdatasync is now disabled for this session because it failed: ",a),nc(!1)),D.close(o,l=>n(l))))})})}function ic(r){return r?{mode:typeof r.mode=="number"?r.mode:438,flag:typeof r.flag=="string"?r.flag:"w"}:{mode:438,flag:"w"}}async function oc(r,e,t=6e4){if(r!==e)try{w&&typeof t=="number"?await pa(r,e,Date.now(),t):await D.promises.rename(r,e)}catch(n){if(r.toLowerCase()!==e.toLowerCase()&&n.code==="EXDEV"||r.endsWith("."))await ma(r,e,{preserveSymlinks:!1}),await ca(r,1);else throw n}}async function pa(r,e,t,n,i=0){try{return await D.promises.rename(r,e)}catch(o){if(o.code!=="EACCES"&&o.code!=="EPERM"&&o.code!=="EBUSY")throw o;if(Date.now()-t>=n)throw console.error(`[node.js fs] rename failed after ${i} retries with error: ${o}`),o;if(i===0){let s=!1;try{let{stat:a}=await ze.stat(e);a.isFile()||(s=!0)}catch{}if(s)throw o}return await fe(Math.min(100,i*10)),pa(r,e,t,n,i+1)}}async function ma(r,e,t){return fa(r,e,{root:{source:r,target:e},options:t,handledSourcePaths:new Set})}var ua=511;async function fa(r,e,t){if(t.handledSourcePaths.has(r))return;t.handledSourcePaths.add(r);let{stat:n,symbolicLink:i}=await ze.stat(r);if(i){if(t.options.preserveSymlinks)try{return await lc(r,e,t)}catch{}if(i.dangling)return}return n.isDirectory()?sc(r,e,n.mode&ua,t):ac(r,e,n.mode&ua)}async function sc(r,e,t,n){await D.promises.mkdir(e,{recursive:!0,mode:t});let i=await Sr(r);for(let o of i)await fa(O(r,o),O(e,o),n)}async function ac(r,e,t){await D.promises.copyFile(r,e),await D.promises.chmod(e,t)}async function lc(r,e,t){let n=await D.promises.readlink(r);hn(n,t.root.source,!Ae)&&(n=O(t.root.target,n.substr(t.root.source.length+1))),await D.promises.symlink(n,e)}async function uc(r){try{return await Pn(D.realpath)(r)}catch{let e=cc(r);return await D.promises.access(e,D.constants.R_OK),e}}function cc(r){return Vi(ke(r),We)}var Cn=new class{get read(){return(r,e,t,n,i)=>new Promise((o,s)=>{D.read(r,e,t,n,i,(a,l,u)=>a?s(a):o({bytesRead:l,buffer:u}))})}get write(){return(r,e,t,n,i)=>new Promise((o,s)=>{D.write(r,e,t,n,i,(a,l,u)=>a?s(a):o({bytesWritten:l,buffer:u}))})}get fdatasync(){return Pn(D.fdatasync)}get open(){return Pn(D.open)}get close(){return Pn(D.close)}get ftruncate(){return Pn(D.ftruncate)}async exists(r){try{return await D.promises.access(r),!0}catch{return!1}}get readdir(){return Sr}get readDirsInDir(){return Zu}get writeFile(){return tc}get rm(){return ca}get rename(){return oc}get copy(){return ma}get realpath(){return uc}};function ya(r=ne){return r.comspec||"cmd.exe"}async function pc(r){if(await Cn.exists(r)){let e;try{e=await ga.stat(r)}catch(t){t.message.startsWith("EACCES")&&(e=await ga.lstat(r))}return e?!e.isDirectory():!1}return!1}async function va(r,e,t,n=ne,i=pc){if(ar(r))return await i(r)?r:void 0;if(e===void 0&&(e=ft()),Ke(r)!=="."){let l=O(e,r);return await i(l)?l:void 0}let s=eo(n,"PATH");if(t===void 0&&G(s)&&(t=s.split(lr)),t===void 0||t.length===0){let l=O(e,r);return await i(l)?l:void 0}for(let l of t){let u;if(ar(l)?u=O(l,r):u=O(e,l,r),w){let c=(eo(n,"PATHEXT")||".COM;.EXE;.BAT;.CMD").split(";").map(async d=>{let m=u+d;return await i(m)?m:void 0});for(let d of c){let m=await d;if(m)return m}}if(await i(u))return u}let a=O(e,r);return await i(a)?a:void 0}var Pr=class extends wn{constructor(e){super({send:t=>{try{process.send?.(t.buffer.toString("base64"))}catch{}},onMessage:S.fromNodeEventEmitter(process,"message",t=>ee.wrap(Buffer.from(t,"base64")))},e),process.once("disconnect",()=>this.dispose())}};function Cr(r){return!!r.parentPort}var ro=class{constructor(e){this.port=e;this.onMessage=S.fromNodeEventEmitter(this.port,"message",t=>t.data?ee.wrap(t.data):ee.alloc(0)),e.start()}send(e){this.port.postMessage(e.buffer)}disconnect(){this.port.close()}},kr=class r extends Er{static getOnDidClientConnect(e){ss(Cr(process),"Electron Utility Process");let t=new y;return process.parentPort.on("message",n=>{if(e?.handledClientConnection(n))return;let i=n.ports.at(0);i&&t.fire(i)}),S.map(t.event,n=>({protocol:new ro(n),onDidClientDisconnect:S.fromNodeEventEmitter(n,"close")}))}constructor(e){super(r.getOnDidClientConnect(e))}};import fc from"minimist";var Z1={o:g(2724,null),e:g(2708,null),t:g(2738,null),m:g(2719,null)};var ba={chat:{type:"subcommand",description:"Pass in a prompt to run in a chat session in the current working directory.",options:{_:{type:"string[]",description:g(2728,null)},mode:{type:"string",cat:"o",alias:"m",args:"mode",description:g(2695,null)},"add-file":{type:"string[]",cat:"o",alias:"a",args:"path",description:g(2690,null)},maximize:{type:"boolean",cat:"o",description:g(2694,null)},"reuse-window":{type:"boolean",cat:"o",alias:"r",description:g(2731,null)},"new-window":{type:"boolean",cat:"o",alias:"n",description:g(2722,null)},profile:{type:"string",cat:"o",args:"profileName",description:g(2727,null)},help:{type:"boolean",alias:"h",description:g(2710,null)}}},"serve-web":{type:"subcommand",description:"Run a server that displays the editor UI in browsers.",options:{"cli-data-dir":{type:"string",args:"dir",description:g(2696,null)},"disable-telemetry":{type:"boolean"},"telemetry-level":{type:"string"}}},agent:{type:"subcommand",description:"Start and interact with AI agent hosts.",options:{"cli-data-dir":{type:"string",args:"dir",description:g(2696,null)},"disable-telemetry":{type:"boolean"},"telemetry-level":{type:"string"}}},tunnel:{type:"subcommand",description:"Make the current machine accessible from vscode.dev or other machines through a secure tunnel.",options:{"cli-data-dir":{type:"string",args:"dir",description:g(2696,null)},"disable-telemetry":{type:"boolean"},"telemetry-level":{type:"string"},user:{type:"subcommand",options:{login:{type:"subcommand",options:{provider:{type:"string"},"access-token":{type:"string"}}}}}}},diff:{type:"boolean",cat:"o",alias:"d",args:["file","file"],description:g(2700,null)},merge:{type:"boolean",cat:"o",alias:"m",args:["path1","path2","base","result"],description:g(2720,null)},add:{type:"boolean",cat:"o",alias:"a",args:"folder",description:g(2689,null)},remove:{type:"boolean",cat:"o",args:"folder",description:g(2729,null)},goto:{type:"boolean",cat:"o",alias:"g",args:"file:line[:character]",description:g(2709,null)},"new-window":{type:"boolean",cat:"o",alias:"n",description:g(2721,null)},"reuse-window":{type:"boolean",cat:"o",alias:"r",description:g(2730,null)},agents:{type:"boolean",cat:"o",deprecates:["sessions"],description:g(2692,null)},wait:{type:"boolean",cat:"o",alias:"w",description:g(2748,null)},waitMarkerFilePath:{type:"string"},locale:{type:"string",cat:"o",args:"locale",description:g(2716,null)},"user-data-dir":{type:"string",cat:"o",args:"dir",description:g(2745,null)},profile:{type:"string",cat:"o",args:"profileName",description:g(2727,null)},help:{type:"boolean",cat:"o",alias:"h",description:g(2710,null)},"stdin-to-clipboard":{type:"boolean",cat:"o",alias:"c",description:g(2697,null)},"extensions-dir":{type:"string",deprecates:["extensionHomePath"],cat:"e",args:"dir",description:g(2707,null)},"extensions-download-dir":{type:"string"},"builtin-extensions-dir":{type:"string"},"shared-data-dir":{type:"string"},"list-extensions":{type:"boolean",cat:"e",description:g(2715,null)},"agent-plugins-dir":{type:"string"},"agents-user-data-dir":{type:"string"},"agents-extensions-dir":{type:"string"},"show-versions":{type:"boolean",cat:"e",description:g(2732,null)},category:{type:"string",allowEmptyValue:!0,cat:"e",description:g(2693,null),args:"category"},"install-extension":{type:"string[]",cat:"e",args:"ext-id | path",description:g(2714,null)},"pre-release":{type:"boolean",cat:"e",description:g(2713,null)},"uninstall-extension":{type:"string[]",cat:"e",args:"ext-id",description:g(2740,null)},"update-extensions":{type:"boolean",cat:"e",description:g(2743,null)},"enable-proposed-api":{type:"string[]",allowEmptyValue:!0,cat:"e",args:"ext-id",description:g(2706,null)},"add-mcp":{type:"string[]",cat:"m",args:"json",description:g(2691,null)},version:{type:"boolean",cat:"t",alias:"v",description:g(2747,null)},verbose:{type:"boolean",cat:"t",global:!0,description:g(2746,null)},log:{type:"string[]",cat:"t",args:"level",global:!0,description:g(2718,null)},status:{type:"boolean",alias:"s",cat:"t",description:g(2733,null)},"prof-startup":{type:"boolean",cat:"t",description:g(2726,null)},"prof-append-timers":{type:"string"},"prof-duration-markers":{type:"string[]"},"prof-duration-markers-file":{type:"string"},"no-cached-data":{type:"boolean"},"prof-startup-prefix":{type:"string"},"prof-v8-extensions":{type:"boolean"},"disable-extensions":{type:"boolean",deprecates:["disableExtensions"],cat:"t",description:g(2703,null)},"disable-extension":{type:"string[]",cat:"t",args:"ext-id",description:g(2702,null)},sync:{type:"string",cat:"t",description:g(2739,null),args:["on | off"]},"inspect-extensions":{type:"string",allowEmptyValue:!0,deprecates:["debugPluginHost"],args:"port",cat:"t",description:g(2712,null)},"inspect-brk-extensions":{type:"string",allowEmptyValue:!0,deprecates:["debugBrkPluginHost"],args:"port",cat:"t",description:g(2711,null)},"disable-lcd-text":{type:"boolean",cat:"t",description:g(2705,null)},"disable-gpu":{type:"boolean",cat:"t",description:g(2704,null)},"disable-chromium-sandbox":{type:"boolean",cat:"t",description:g(2701,null)},sandbox:{type:"boolean"},"locate-shell-integration-path":{type:"string",cat:"t",args:["shell"],description:g(2717,null)},telemetry:{type:"boolean",cat:"t",description:g(2736,null)},remote:{type:"string",allowEmptyValue:!0},"folder-uri":{type:"string[]",cat:"o",args:"uri"},"file-uri":{type:"string[]",cat:"o",args:"uri"},"locate-extension":{type:"string[]"},extensionDevelopmentPath:{type:"string[]"},extensionDevelopmentKind:{type:"string[]"},extensionTestsPath:{type:"string"},extensionEnvironment:{type:"string"},debugId:{type:"string"},debugRenderer:{type:"boolean"},"inspect-ptyhost":{type:"string",allowEmptyValue:!0},"inspect-brk-ptyhost":{type:"string",allowEmptyValue:!0},"inspect-agenthost":{type:"string",allowEmptyValue:!0},"inspect-brk-agenthost":{type:"string",allowEmptyValue:!0},"inspect-sharedprocess":{type:"string",allowEmptyValue:!0},"inspect-brk-sharedprocess":{type:"string",allowEmptyValue:!0},"export-default-configuration":{type:"string"},"export-policy-data":{type:"string",allowEmptyValue:!0},"export-default-keybindings":{type:"string",allowEmptyValue:!0},"install-source":{type:"string"},"enable-smoke-test-driver":{type:"boolean"},"skip-sessions-welcome":{type:"boolean"},logExtensionHostCommunication:{type:"boolean"},"skip-release-notes":{type:"boolean"},"skip-welcome":{type:"boolean"},"disable-telemetry":{type:"boolean"},"telemetry-level":{type:"string"},"disable-updates":{type:"boolean"},"share-secrets-with-agents-app":{type:"boolean"},transient:{type:"boolean",cat:"t",description:g(2737,null)},"use-inmemory-secretstorage":{type:"boolean",deprecates:["disable-keytar"]},"password-store":{type:"string"},"disable-workspace-trust":{type:"boolean"},"disable-crash-reporter":{type:"boolean"},"crash-reporter-directory":{type:"string"},"crash-reporter-id":{type:"string"},"skip-add-to-recently-opened":{type:"boolean"},"open-url":{type:"boolean"},"file-write":{type:"boolean"},"file-chmod":{type:"boolean"},"install-builtin-extension":{type:"string[]"},force:{type:"boolean"},"do-not-sync":{type:"boolean"},"do-not-include-pack-dependencies":{type:"boolean"},trace:{type:"boolean"},"trace-memory-infra":{type:"boolean"},"trace-category-filter":{type:"string"},"trace-options":{type:"string"},"preserve-env":{type:"boolean"},"force-user-env":{type:"boolean"},"force-disable-user-env":{type:"boolean"},"open-devtools":{type:"boolean"},"disable-gpu-sandbox":{type:"boolean"},logsPath:{type:"string"},"__enable-file-policy":{type:"boolean"},editSessionId:{type:"string"},continueOn:{type:"string"},"enable-coi":{type:"boolean"},"unresponsive-sample-interval":{type:"string"},"unresponsive-sample-period":{type:"string"},"enable-rdp-display-tracking":{type:"boolean"},"disable-layout-restore":{type:"boolean"},"disable-experiments":{type:"boolean"},"no-proxy-server":{type:"boolean"},"no-sandbox":{type:"boolean",alias:"sandbox"},"proxy-server":{type:"string"},"proxy-bypass-list":{type:"string"},"proxy-pac-url":{type:"string"},"js-flags":{type:"string"},inspect:{type:"string",allowEmptyValue:!0},"inspect-brk":{type:"string",allowEmptyValue:!0},nolazy:{type:"boolean"},"force-device-scale-factor":{type:"string"},"force-renderer-accessibility":{type:"boolean"},"ignore-certificate-errors":{type:"boolean"},"allow-insecure-localhost":{type:"boolean"},"log-net-log":{type:"string"},vmodule:{type:"string"},_urls:{type:"string[]"},"disable-dev-shm-usage":{type:"boolean"},"profile-temp":{type:"boolean"},"ozone-platform":{type:"string"},"enable-tracing":{type:"string"},"trace-startup-format":{type:"string"},"trace-startup-file":{type:"string"},"trace-startup-duration":{type:"string"},"xdg-portal-required-version":{type:"string"},_:{type:"string[]"}},hc={onUnknownOption:()=>{},onMultipleValues:()=>{},onEmptyValue:()=>{},onDeprecatedOption:()=>{}};function io(r,e,t=hc){let n=r.find((d,m)=>d.length>0&&d[0]!=="-"&&e.hasOwnProperty(d)&&e[d].type==="subcommand"),i={},o=["_"],s=[],a={},l;for(let d in e){let m=e[d];m.type==="subcommand"?d===n&&(l=m):(m.alias&&(i[d]=m.alias),m.type==="string"||m.type==="string[]"?(o.push(d),m.deprecates&&o.push(...m.deprecates)):m.type==="boolean"&&(s.push(d),m.deprecates&&s.push(...m.deprecates)),m.global&&(a[d]=m))}if(l&&n){let d=a;for(let E in l.options)d[E]=l.options[E];let m=r.filter(E=>E!==n),f=t.getSubcommandReporter?t.getSubcommandReporter(n):void 0,b=io(m,d,f);return{[n]:b,_:[]}}let u=fc(r,{string:o,boolean:s,alias:i}),p={},c=u;p._=u._.map(d=>String(d)).filter(d=>d.length>0),delete c._;for(let d in e){let m=e[d];if(m.type==="subcommand")continue;m.alias&&delete c[m.alias];let f=c[d];if(m.deprecates)for(let b of m.deprecates)c.hasOwnProperty(b)&&(f||(f=c[b],f&&t.onDeprecatedOption(b,m.deprecationMessage||g(2699,null,d))),delete c[b]);if(typeof f<"u"){if(m.type==="string[]"){if(Array.isArray(f)||(f=[f]),!m.allowEmptyValue){let b=f.filter(E=>E.length>0);b.length!==f.length&&(t.onEmptyValue(d),f=b.length>0?b:void 0)}}else m.type==="string"&&(Array.isArray(f)?(f=f.pop(),t.onMultipleValues(d,f)):!f&&!m.allowEmptyValue&&(t.onEmptyValue(d),f=void 0));p[d]=f,m.deprecationMessage&&t.onDeprecatedOption(d,m.deprecationMessage)}delete c[d]}for(let d in c)t.onUnknownOption(d);return p}import{homedir as Ec,tmpdir as wc}from"os";var gc=60,yc=gc*60,oo=yc*24,ih=oo*7,oh=oo*30,sh=oo*365;function _a(r){return r.getFullYear()+"-"+String(r.getMonth()+1).padStart(2,"0")+"-"+String(r.getDate()).padStart(2,"0")+"T"+String(r.getHours()).padStart(2,"0")+":"+String(r.getMinutes()).padStart(2,"0")+":"+String(r.getSeconds()).padStart(2,"0")+"."+(r.getMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"}var xa=/^([^.]+\..+)[:=](.+)$/,W=class{constructor(e,t,n){this._args=e;this.paths=t;this.productService=n}get appRoot(){return Ke($e.asFileUri("").fsPath)}get userHome(){return A.file(this.paths.homeDir)}get userDataPath(){return this.paths.userDataDir}get appSettingsHome(){return A.file(O(this.userDataPath,"User"))}get tmpDir(){return A.file(this.paths.tmpDir)}get cacheHome(){return A.file(this.userDataPath)}get stateResource(){return Ie(this.appSettingsHome,"globalStorage","storage.json")}get userRoamingDataHome(){return this.appSettingsHome.with({scheme:te.vscodeUserData})}get userDataSyncHome(){return Ie(this.appSettingsHome,"sync")}get logsHome(){if(!this.args.logsPath){let e=_a(new Date).replace(/-|:|\.\d+Z$/g,"");this.args.logsPath=O(this.userDataPath,"logs",e)}return A.file(this.args.logsPath)}get sync(){return this.args.sync}get workspaceStorageHome(){return Ie(this.appSettingsHome,"workspaceStorage")}get localHistoryHome(){return Ie(this.appSettingsHome,"History")}get keyboardLayoutResource(){return Ie(this.userRoamingDataHome,"keyboardLayout.json")}get argvResource(){let e=ne.VSCODE_PORTABLE;return e?A.file(O(e,"argv.json")):Ie(this.appSettingsHome,"argv.json")}get isExtensionDevelopment(){return!!this.args.extensionDevelopmentPath}get untitledWorkspacesHome(){return A.file(O(this.userDataPath,"Workspaces"))}get builtinExtensionsPath(){let e=this.args["builtin-extensions-dir"];return e?gt(e):ke(O($e.asFileUri("").fsPath,"..","extensions"))}get extensionsDownloadLocation(){let e=this.args["extensions-download-dir"];return e?A.file(gt(e)):A.file(O(this.userDataPath,"CachedExtensionVSIXs"))}get extensionsPath(){let e=this.args["extensions-dir"];if(e)return gt(e);let t=ne.VSCODE_EXTENSIONS;if(t)return t;let n=ne.VSCODE_PORTABLE;return n?O(n,"extensions"):Ie(this.userHome,this.productService.dataFolderName,"extensions").fsPath}get appSharedDataHome(){let e=this.args["shared-data-dir"];if(e)return A.file(gt(e));let t=ne.VSCODE_PORTABLE;return t?A.file(O(t,"shared-data")):Ie(this.userHome,this.productService.sharedDataFolderName)}get extensionDevelopmentLocationURI(){let e=this.args.extensionDevelopmentPath;if(Array.isArray(e))return e.map(t=>/^[^:/?#]+?:\/\//.test(t)?A.parse(t):A.file(ke(t)))}get extensionDevelopmentKind(){return this.args.extensionDevelopmentKind?.map(e=>e==="ui"||e==="workspace"||e==="web"?e:"workspace")}get extensionTestsLocationURI(){let e=this.args.extensionTestsPath;if(e)return/^[^:/?#]+?:\/\//.test(e)?A.parse(e):A.file(ke(e))}get disableExtensions(){if(this.args["disable-extensions"])return!0;let e=this.args["disable-extension"];if(e){if(typeof e=="string")return[e];if(Array.isArray(e)&&e.length>0)return e}return!1}get skipBuiltinExtensions(){let e=ne.VSCODE_SKIP_BUILTIN_EXTENSIONS;return e?e.split(",").map(t=>t.trim()).filter(t=>t):[]}get debugExtensionHost(){return vc(this.args,this.isBuilt)}get debugRenderer(){return!!this.args.debugRenderer}get isBuilt(){return!ne.VSCODE_DEV}get verbose(){return!!this.args.verbose}get logLevel(){return this.args.log?.find(e=>!xa.test(e))}get extensionLogLevel(){let e=[];for(let t of this.args.log||[]){let n=xa.exec(t);n?.[1]&&n[2]&&e.push([n[1],n[2]])}return e.length?e:void 0}get serviceMachineIdResource(){return Ie(A.file(this.userDataPath),"machineid")}get crashReporterId(){return this.args["crash-reporter-id"]}get crashReporterDirectory(){return this.args["crash-reporter-directory"]}get disableTelemetry(){return!!this.args["disable-telemetry"]}get disableExperiments(){return!!this.args["disable-experiments"]}get disableWorkspaceTrust(){return!!this.args["disable-workspace-trust"]}get useInMemorySecretStorage(){return!!this.args["use-inmemory-secretstorage"]}get policyFile(){if(this.args["__enable-file-policy"]){let e=ne.VSCODE_PORTABLE;return e?A.file(O(e,"policy.json")):Ie(this.userHome,this.productService.dataFolderName,"policy.json")}}get agentSessionsWorkspace(){return Ie(this.appSettingsHome,"agent-sessions.code-workspace")}get editSessionId(){return this.args.editSessionId}get exportPolicyData(){return this.args["export-policy-data"]}get exportDefaultKeybindings(){return this.args["export-default-keybindings"]}get continueOn(){return this.args.continueOn}set continueOn(e){this.args.continueOn=e}get args(){return this._args}};h([L],W.prototype,"appRoot",1),h([L],W.prototype,"userHome",1),h([L],W.prototype,"userDataPath",1),h([L],W.prototype,"appSettingsHome",1),h([L],W.prototype,"tmpDir",1),h([L],W.prototype,"cacheHome",1),h([L],W.prototype,"stateResource",1),h([L],W.prototype,"userRoamingDataHome",1),h([L],W.prototype,"userDataSyncHome",1),h([L],W.prototype,"sync",1),h([L],W.prototype,"workspaceStorageHome",1),h([L],W.prototype,"localHistoryHome",1),h([L],W.prototype,"keyboardLayoutResource",1),h([L],W.prototype,"argvResource",1),h([L],W.prototype,"isExtensionDevelopment",1),h([L],W.prototype,"untitledWorkspacesHome",1),h([L],W.prototype,"builtinExtensionsPath",1),h([L],W.prototype,"extensionsDownloadLocation",1),h([L],W.prototype,"extensionsPath",1),h([L],W.prototype,"appSharedDataHome",1),h([L],W.prototype,"extensionDevelopmentLocationURI",1),h([L],W.prototype,"extensionDevelopmentKind",1),h([L],W.prototype,"extensionTestsLocationURI",1),h([L],W.prototype,"debugExtensionHost",1),h([L],W.prototype,"logLevel",1),h([L],W.prototype,"extensionLogLevel",1),h([L],W.prototype,"serviceMachineIdResource",1),h([L],W.prototype,"disableTelemetry",1),h([L],W.prototype,"disableExperiments",1),h([L],W.prototype,"disableWorkspaceTrust",1),h([L],W.prototype,"useInMemorySecretStorage",1),h([L],W.prototype,"policyFile",1),h([L],W.prototype,"agentSessionsWorkspace",1);function vc(r,e){return Ia(r["inspect-extensions"],r["inspect-brk-extensions"],5870,e,r.debugId,r.extensionEnvironment)}function Ia(r,e,t,n,i,o){let a=Number(e||r)||(n?null:t),l=a?!!e:!1,u;if(o)try{u=JSON.parse(o)}catch{}return{port:a,break:l,debugId:i,env:u}}import{homedir as Ta}from"os";import{resolve as bc,isAbsolute as _c,join as jt}from"path";var xc=process.env.VSCODE_CWD||process.cwd();function Ea(r,e){let t=Ic(r,e),n=[t];return _c(t)||n.unshift(xc),bc(...n)}function Ic(r,e){process.env.VSCODE_DEV&&(e="code-oss-dev");let t=process.env.VSCODE_PORTABLE;if(t)return jt(t,"user-data");let n=process.env.VSCODE_APPDATA;if(n)return jt(n,e);let i=r["user-data-dir"];return i||Tc(e)}function Tc(r){let e;switch(process.platform){case"win32":if(e=process.env.APPDATA,!e){let t=process.env.USERPROFILE;if(typeof t!="string")throw new Error("Windows: Unexpected undefined %USERPROFILE% environment variable");e=jt(t,"AppData","Roaming")}break;case"darwin":e=jt(Ta(),"Library","Application Support");break;case"linux":e=process.env.XDG_CONFIG_HOME||jt(Ta(),".config");break;default:throw new Error("Platform not supported")}return jt(e,r)}var Rr=class extends W{constructor(e,t){let n=Ec();super(e,{homeDir:n,tmpDir:wc(),userDataDir:Ea(e,t.nameShort)},t)}};function so(r,e){return e&&(r.stack||r.stacktrace)?g(116,null,Sa(r),wa(r.stack)||wa(r.stacktrace)):Sa(r)}function wa(r){return Array.isArray(r)?r.join(`
`):r}function Sa(r){return r.code==="ERR_UNC_HOST_NOT_ALLOWED"?`${r.message}. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.`:typeof r.code=="string"&&typeof r.errno=="number"&&typeof r.syscall=="string"?g(115,null,r.message):r.message||g(113,null)}function ao(r=null,e=!1){if(!r)return g(113,null);if(Array.isArray(r)){let t=zo(r),n=ao(t[0],e);return t.length>1?g(114,null,n,t.length):n}if(G(r))return r;if(r.detail){let t=r.detail;if(t.error)return so(t.error,e);if(t.exception)return so(t.exception,e)}return r.stack?so(r,e):r.message?r.message:g(113,null)}function Ca(r){return uo(r,0)}function uo(r,e){switch(typeof r){case"object":return r===null?He(349,e):Array.isArray(r)?Pc(r,e):Cc(r,e);case"string":return ka(r,e);case"boolean":return Sc(r,e);case"number":return He(r,e);case"undefined":return He(937,e);default:return He(617,e)}}function He(r,e){return(e<<5)-e+r|0}function Sc(r,e){return He(r?433:863,e)}function ka(r,e){e=He(149417,e);for(let t=0,n=r.length;t<n;t++)e=He(r.charCodeAt(t),e);return e}function Pc(r,e){return e=He(104579,e),r.reduce((t,n)=>uo(n,t),e)}function Cc(r,e){return e=He(181387,e),Object.keys(r).sort().reduce((t,n)=>(t=ka(n,t),uo(r[n],t)),e)}function lo(r,e,t=32){let n=t-e,i=~((1<<n)-1);return(r<<e|(i&r)>>>n)>>>0}function kn(r,e=32){return r instanceof ArrayBuffer?ds(ee.wrap(new Uint8Array(r))):(r>>>0).toString(16).padStart(e/4,"0")}var Pa=class r{constructor(){this._h0=1732584193;this._h1=4023233417;this._h2=2562383102;this._h3=271733878;this._h4=3285377520;this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}static{this._bigBlock32=new DataView(new ArrayBuffer(320))}update(e){let t=e.length;if(t===0)return;let n=this._buff,i=this._buffLen,o=this._leftoverHighSurrogate,s,a;for(o!==0?(s=o,a=-1,o=0):(s=e.charCodeAt(0),a=0);;){let l=s;if(js(s))if(a+1<t){let u=e.charCodeAt(a+1);$i(u)?(a++,l=Gs(s,u)):l=65533}else{o=s;break}else $i(s)&&(l=65533);if(i=this._push(n,i,l),a++,a<t)s=e.charCodeAt(a);else break}this._buffLen=i,this._leftoverHighSurrogate=o}_push(e,t,n){return n<128?e[t++]=n:n<2048?(e[t++]=192|(n&1984)>>>6,e[t++]=128|(n&63)>>>0):n<65536?(e[t++]=224|(n&61440)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0):(e[t++]=240|(n&1835008)>>>18,e[t++]=128|(n&258048)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0),t>=64&&(this._step(),t-=64,this._totalLen+=64,e[0]=e[64],e[1]=e[65],e[2]=e[66]),t}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),kn(this._h0)+kn(this._h1)+kn(this._h2)+kn(this._h3)+kn(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,this._buff.subarray(this._buffLen).fill(0),this._buffLen>56&&(this._step(),this._buff.fill(0));let e=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(e/4294967296),!1),this._buffDV.setUint32(60,e%4294967296,!1),this._step()}_step(){let e=r._bigBlock32,t=this._buffDV;for(let c=0;c<64;c+=4)e.setUint32(c,t.getUint32(c,!1),!1);for(let c=64;c<320;c+=4)e.setUint32(c,lo(e.getUint32(c-12,!1)^e.getUint32(c-32,!1)^e.getUint32(c-56,!1)^e.getUint32(c-64,!1),1),!1);let n=this._h0,i=this._h1,o=this._h2,s=this._h3,a=this._h4,l,u,p;for(let c=0;c<80;c++)c<20?(l=i&o|~i&s,u=1518500249):c<40?(l=i^o^s,u=1859775393):c<60?(l=i&o|i&s|o&s,u=2400959708):(l=i^o^s,u=3395469782),p=lo(n,5)+l+a+u+e.getUint32(c*4,!1)&4294967295,a=s,s=o,o=lo(i,30),i=n,n=p;this._h0=this._h0+n&4294967295,this._h1=this._h1+i&4294967295,this._h2=this._h2+o&4294967295,this._h3=this._h3+s&4294967295,this._h4=this._h4+a&4294967295}};function co(...r){switch(r.length){case 1:return g(2680,null,r[0]);case 2:return g(2681,null,r[0],r[1]);case 3:return g(2682,null,r[0],r[1],r[2]);default:return}}var kc=g(2679,null),Rc=g(2678,null),tt=class r{constructor(){this._input="";this._start=0;this._current=0;this._tokens=[];this._errors=[];this.stringRe=/[a-zA-Z0-9_<>\-\./\\:\*\?\+\[\]\^,#@;"%\$\p{L}-]+/uy}static getLexeme(e){switch(e.type){case 0:return"(";case 1:return")";case 2:return"!";case 3:return e.isTripleEq?"===":"==";case 4:return e.isTripleEq?"!==":"!=";case 5:return"<";case 6:return"<=";case 7:return">";case 8:return">=";case 9:return"=~";case 10:return e.lexeme;case 11:return"true";case 12:return"false";case 13:return"in";case 14:return"not";case 15:return"&&";case 16:return"||";case 17:return e.lexeme;case 18:return e.lexeme;case 19:return e.lexeme;case 20:return"EOF";default:throw Ko(`unhandled token type: ${JSON.stringify(e)}; have you forgotten to add a case?`)}}static{this._regexFlags=new Set(["i","g","s","m","y","u"].map(e=>e.charCodeAt(0)))}static{this._keywords=new Map([["not",14],["in",13],["false",12],["true",11]])}get errors(){return this._errors}reset(e){return this._input=e,this._start=0,this._current=0,this._tokens=[],this._errors=[],this}scan(){for(;!this._isAtEnd();)switch(this._start=this._current,this._advance()){case 40:this._addToken(0);break;case 41:this._addToken(1);break;case 33:if(this._match(61)){let t=this._match(61);this._tokens.push({type:4,offset:this._start,isTripleEq:t})}else this._addToken(2);break;case 39:this._quotedString();break;case 47:this._regex();break;case 61:if(this._match(61)){let t=this._match(61);this._tokens.push({type:3,offset:this._start,isTripleEq:t})}else this._match(126)?this._addToken(9):this._error(co("==","=~"));break;case 60:this._addToken(this._match(61)?6:5);break;case 62:this._addToken(this._match(61)?8:7);break;case 38:this._match(38)?this._addToken(15):this._error(co("&&"));break;case 124:this._match(124)?this._addToken(16):this._error(co("||"));break;case 32:case 13:case 9:case 10:case 160:break;default:this._string()}return this._start=this._current,this._addToken(20),Array.from(this._tokens)}_match(e){return this._isAtEnd()||this._input.charCodeAt(this._current)!==e?!1:(this._current++,!0)}_advance(){return this._input.charCodeAt(this._current++)}_peek(){return this._isAtEnd()?0:this._input.charCodeAt(this._current)}_addToken(e){this._tokens.push({type:e,offset:this._start})}_error(e){let t=this._start,n=this._input.substring(this._start,this._current),i={type:19,offset:this._start,lexeme:n};this._errors.push({offset:t,lexeme:n,additionalInfo:e}),this._tokens.push(i)}_string(){this.stringRe.lastIndex=this._start;let e=this.stringRe.exec(this._input);if(e){this._current=this._start+e[0].length;let t=this._input.substring(this._start,this._current),n=r._keywords.get(t);n?this._addToken(n):this._tokens.push({type:17,lexeme:t,offset:this._start})}}_quotedString(){for(;this._peek()!==39&&!this._isAtEnd();)this._advance();if(this._isAtEnd()){this._error(kc);return}this._advance(),this._tokens.push({type:18,lexeme:this._input.substring(this._start+1,this._current-1),offset:this._start+1})}_regex(){let e=this._current,t=!1,n=!1;for(;;){if(e>=this._input.length){this._current=e,this._error(Rc);return}let o=this._input.charCodeAt(e);if(t)t=!1;else if(o===47&&!n){e++;break}else o===91?n=!0:o===92?t=!0:o===93&&(n=!1);e++}for(;e<this._input.length&&r._regexFlags.has(this._input.charCodeAt(e));)e++;this._current=e;let i=this._input.substring(this._start,this._current);this._tokens.push({type:10,lexeme:i,offset:this._start})}_isAtEnd(){return this._current>=this._input.length}};var nt;(i=>{i.serviceIds=new Map,i.DI_TARGET="$di$target",i.DI_DEPENDENCIES="$di$dependencies";function n(o){return o[i.DI_DEPENDENCIES]||[]}i.getServiceDependencies=n})(nt||={});var Dh=Te("instantiationService");function Lc(r,e,t){e[nt.DI_TARGET]===e?e[nt.DI_DEPENDENCIES].push({id:r,index:t}):(e[nt.DI_DEPENDENCIES]=[{id:r,index:t}],e[nt.DI_TARGET]=e)}function Te(r){if(nt.serviceIds.has(r))return nt.serviceIds.get(r);let e=function(t,n,i){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Lc(e,t,i)};return e.toString=()=>r,nt.serviceIds.set(r,e),e}var re=new Map;re.set("false",!1);re.set("true",!0);re.set("isMac",be);re.set("isLinux",Ae);re.set("isWindows",w);re.set("isWeb",pt);re.set("isMacNative",be&&!pt);re.set("isEdge",Ts);re.set("isFirefox",xs);re.set("isChrome",ki);re.set("isSafari",Is);var Dc=Object.prototype.hasOwnProperty;var Ac={regexParsingWithErrorRecovery:!0},Oc=g(2659,null),Mc=g(2660,null),Uc=g(2662,null),Ra=g(2658,null),Fc=g(2665,null),Nc=g(2666,null),Bc=g(2663,null),Vc=g(2664,null),po=class r{constructor(e=Ac){this._config=e;this._scanner=new tt;this._tokens=[];this._current=0;this._parsingErrors=[];this._flagsGYRe=/g|y/g}static{this._parseError=new Error}get lexingErrors(){return this._scanner.errors}get parsingErrors(){return this._parsingErrors}parse(e){if(e===""){this._parsingErrors.push({message:Oc,offset:0,lexeme:"",additionalInfo:Mc});return}this._tokens=this._scanner.reset(e).scan(),this._current=0,this._parsingErrors=[];try{let t=this._expr();if(!this._isAtEnd()){let n=this._peek(),i=n.type===17?Nc:void 0;throw this._parsingErrors.push({message:Fc,offset:n.offset,lexeme:tt.getLexeme(n),additionalInfo:i}),r._parseError}return t}catch(t){if(t!==r._parseError)throw t;return}}_expr(){return this._or()}_or(){let e=[this._and()];for(;this._matchOne(16);){let t=this._and();e.push(t)}return e.length===1?e[0]:le.or(...e)}_and(){let e=[this._term()];for(;this._matchOne(15);){let t=this._term();e.push(t)}return e.length===1?e[0]:le.and(...e)}_term(){if(this._matchOne(2)){let e=this._peek();switch(e.type){case 11:return this._advance(),ce.INSTANCE;case 12:return this._advance(),he.INSTANCE;case 0:{this._advance();let t=this._expr();return this._consume(1,Ra),t?.negate()}case 17:return this._advance(),Tt.create(e.lexeme);default:throw this._errExpectedButGot("KEY | true | false | '(' expression ')'",e)}}return this._primary()}_primary(){let e=this._peek();switch(e.type){case 11:return this._advance(),le.true();case 12:return this._advance(),le.false();case 0:{this._advance();let t=this._expr();return this._consume(1,Ra),t}case 17:{let t=e.lexeme;if(this._advance(),this._matchOne(9)){let i=this._peek();if(!this._config.regexParsingWithErrorRecovery){if(this._advance(),i.type!==10)throw this._errExpectedButGot("REGEX",i);let o=i.lexeme,s=o.lastIndexOf("/"),a=s===o.length-1?void 0:this._removeFlagsGY(o.substring(s+1)),l;try{l=new RegExp(o.substring(1,s),a)}catch{throw this._errExpectedButGot("REGEX",i)}return Un.create(t,l)}switch(i.type){case 10:case 19:{let o=[i.lexeme];this._advance();let s=this._peek(),a=0;for(let d=0;d<i.lexeme.length;d++)i.lexeme.charCodeAt(d)===40?a++:i.lexeme.charCodeAt(d)===41&&a--;for(;!this._isAtEnd()&&s.type!==15&&s.type!==16;){switch(s.type){case 0:a++;break;case 1:a--;break;case 10:case 18:for(let d=0;d<s.lexeme.length;d++)s.lexeme.charCodeAt(d)===40?a++:i.lexeme.charCodeAt(d)===41&&a--}if(a<0)break;o.push(tt.getLexeme(s)),this._advance(),s=this._peek()}let l=o.join(""),u=l.lastIndexOf("/"),p=u===l.length-1?void 0:this._removeFlagsGY(l.substring(u+1)),c;try{c=new RegExp(l.substring(1,u),p)}catch{throw this._errExpectedButGot("REGEX",i)}return le.regex(t,c)}case 18:{let o=i.lexeme;this._advance();let s=null;if(!Hs(o)){let a=o.indexOf("/"),l=o.lastIndexOf("/");if(a!==l&&a>=0){let u=o.slice(a+1,l),p=o[l+1]==="i"?"i":"";try{s=new RegExp(u,p)}catch{throw this._errExpectedButGot("REGEX",i)}}}if(s===null)throw this._errExpectedButGot("REGEX",i);return Un.create(t,s)}default:throw this._errExpectedButGot("REGEX",this._peek())}}if(this._matchOne(14)){this._consume(13,Uc);let i=this._value();return le.notIn(t,i)}switch(this._peek().type){case 3:{this._advance();let i=this._value();if(this._previous().type===18)return le.equals(t,i);switch(i){case"true":return le.has(t);case"false":return le.not(t);default:return le.equals(t,i)}}case 4:{this._advance();let i=this._value();if(this._previous().type===18)return le.notEquals(t,i);switch(i){case"true":return le.not(t);case"false":return le.has(t);default:return le.notEquals(t,i)}}case 5:return this._advance(),On.create(t,this._value());case 6:return this._advance(),Mn.create(t,this._value());case 7:return this._advance(),Gt.create(t,this._value());case 8:return this._advance(),An.create(t,this._value());case 13:return this._advance(),le.in(t,this._value());default:return le.has(t)}}case 20:throw this._parsingErrors.push({message:Bc,offset:e.offset,lexeme:"",additionalInfo:Vc}),r._parseError;default:throw this._errExpectedButGot(`true | false | KEY
| KEY '=~' REGEX
| KEY ('==' | '!=' | '<' | '<=' | '>' | '>=' | 'in' | 'not' 'in') value`,this._peek())}}_value(){let e=this._peek();switch(e.type){case 17:case 18:return this._advance(),e.lexeme;case 11:return this._advance(),"true";case 12:return this._advance(),"false";case 13:return this._advance(),"in";default:return""}}_removeFlagsGY(e){return e.replaceAll(this._flagsGYRe,"")}_previous(){return this._tokens[this._current-1]}_matchOne(e){return this._check(e)?(this._advance(),!0):!1}_advance(){return this._isAtEnd()||this._current++,this._previous()}_consume(e,t){if(this._check(e))return this._advance();throw this._errExpectedButGot(t,this._peek())}_errExpectedButGot(e,t,n){let i=g(2661,null,e,tt.getLexeme(t)),o=t.offset,s=tt.getLexeme(t);return this._parsingErrors.push({message:i,offset:o,lexeme:s,additionalInfo:n}),r._parseError}_check(e){return this._peek().type===e}_peek(){return this._tokens[this._current]}_isAtEnd(){return this._peek().type===20}},le=class{static false(){return ce.INSTANCE}static true(){return he.INSTANCE}static has(e){return It.create(e)}static equals(e,t){return Ln.create(e,t)}static notEquals(e,t){return Dn.create(e,t)}static regex(e,t){return Un.create(e,t)}static in(e,t){return Lr.create(e,t)}static notIn(e,t){return Dr.create(e,t)}static not(e){return Tt.create(e)}static and(...e){return Ar.create(e,null,!0)}static or(...e){return Fn.create(e,null,!0)}static greater(e,t){return Gt.create(e,t)}static greaterEquals(e,t){return An.create(e,t)}static smaller(e,t){return On.create(e,t)}static smallerEquals(e,t){return Mn.create(e,t)}static{this._parser=new po({regexParsingWithErrorRecovery:!1})}static deserialize(e){return e==null?void 0:this._parser.parse(e)}};function Rn(r,e){return r.cmp(e)}var ce=class r{constructor(){this.type=0}static{this.INSTANCE=new r}cmp(e){return this.type-e.type}equals(e){return e.type===this.type}substituteConstants(){return this}evaluate(e){return!1}serialize(){return"false"}keys(){return[]}map(e){return this}negate(){return he.INSTANCE}},he=class r{constructor(){this.type=1}static{this.INSTANCE=new r}cmp(e){return this.type-e.type}equals(e){return e.type===this.type}substituteConstants(){return this}evaluate(e){return!0}serialize(){return"true"}keys(){return[]}map(e){return this}negate(){return ce.INSTANCE}},It=class r{constructor(e,t){this.key=e;this.negated=t;this.type=2}static create(e,t=null){let n=re.get(e);return typeof n=="boolean"?n?he.INSTANCE:ce.INSTANCE:new r(e,t)}cmp(e){return e.type!==this.type?this.type-e.type:Aa(this.key,e.key)}equals(e){return e.type===this.type?this.key===e.key:!1}substituteConstants(){let e=re.get(this.key);return typeof e=="boolean"?e?he.INSTANCE:ce.INSTANCE:this}evaluate(e){return!!e.getValue(this.key)}serialize(){return this.key}keys(){return[this.key]}map(e){return e.mapDefined(this.key)}negate(){return this.negated||(this.negated=Tt.create(this.key,this)),this.negated}},Ln=class r{constructor(e,t,n){this.key=e;this.value=t;this.negated=n;this.type=4}static create(e,t,n=null){if(typeof t=="boolean")return t?It.create(e,n):Tt.create(e,n);let i=re.get(e);return typeof i=="boolean"?t===(i?"true":"false")?he.INSTANCE:ce.INSTANCE:new r(e,t,n)}cmp(e){return e.type!==this.type?this.type-e.type:Et(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){let e=re.get(this.key);if(typeof e=="boolean"){let t=e?"true":"false";return this.value===t?he.INSTANCE:ce.INSTANCE}return this}evaluate(e){return e.getValue(this.key)==this.value}serialize(){return`${this.key} == '${this.value}'`}keys(){return[this.key]}map(e){return e.mapEquals(this.key,this.value)}negate(){return this.negated||(this.negated=Dn.create(this.key,this.value,this)),this.negated}},Lr=class r{constructor(e,t){this.key=e;this.valueKey=t;this.type=10;this.negated=null}static create(e,t){return new r(e,t)}cmp(e){return e.type!==this.type?this.type-e.type:Et(this.key,this.valueKey,e.key,e.valueKey)}equals(e){return e.type===this.type?this.key===e.key&&this.valueKey===e.valueKey:!1}substituteConstants(){return this}evaluate(e){let t=e.getValue(this.valueKey),n=e.getValue(this.key);if(Array.isArray(t)){if(t.includes(n))return!0;if(w&&typeof n=="string"&&n.startsWith("file:///")){let i=n.toLowerCase();return t.some(o=>typeof o=="string"&&o.toLowerCase()===i)}return!1}if(typeof n=="string"&&typeof t=="object"&&t!==null){if(Dc.call(t,n))return!0;if(w&&n.startsWith("file:///")){let i=n.toLowerCase();return Object.keys(t).some(o=>o.toLowerCase()===i)}return!1}return!1}serialize(){return`${this.key} in '${this.valueKey}'`}keys(){return[this.key,this.valueKey]}map(e){return e.mapIn(this.key,this.valueKey)}negate(){return this.negated||(this.negated=Dr.create(this.key,this.valueKey)),this.negated}},Dr=class r{constructor(e,t){this.key=e;this.valueKey=t;this.type=11;this._negated=Lr.create(e,t)}static create(e,t){return new r(e,t)}cmp(e){return e.type!==this.type?this.type-e.type:this._negated.cmp(e._negated)}equals(e){return e.type===this.type?this._negated.equals(e._negated):!1}substituteConstants(){return this}evaluate(e){return!this._negated.evaluate(e)}serialize(){return`${this.key} not in '${this.valueKey}'`}keys(){return this._negated.keys()}map(e){return e.mapNotIn(this.key,this.valueKey)}negate(){return this._negated}},Dn=class r{constructor(e,t,n){this.key=e;this.value=t;this.negated=n;this.type=5}static create(e,t,n=null){if(typeof t=="boolean")return t?Tt.create(e,n):It.create(e,n);let i=re.get(e);return typeof i=="boolean"?t===(i?"true":"false")?ce.INSTANCE:he.INSTANCE:new r(e,t,n)}cmp(e){return e.type!==this.type?this.type-e.type:Et(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){let e=re.get(this.key);if(typeof e=="boolean"){let t=e?"true":"false";return this.value===t?ce.INSTANCE:he.INSTANCE}return this}evaluate(e){return e.getValue(this.key)!=this.value}serialize(){return`${this.key} != '${this.value}'`}keys(){return[this.key]}map(e){return e.mapNotEquals(this.key,this.value)}negate(){return this.negated||(this.negated=Ln.create(this.key,this.value,this)),this.negated}},Tt=class r{constructor(e,t){this.key=e;this.negated=t;this.type=3}static create(e,t=null){let n=re.get(e);return typeof n=="boolean"?n?ce.INSTANCE:he.INSTANCE:new r(e,t)}cmp(e){return e.type!==this.type?this.type-e.type:Aa(this.key,e.key)}equals(e){return e.type===this.type?this.key===e.key:!1}substituteConstants(){let e=re.get(this.key);return typeof e=="boolean"?e?ce.INSTANCE:he.INSTANCE:this}evaluate(e){return!e.getValue(this.key)}serialize(){return`!${this.key}`}keys(){return[this.key]}map(e){return e.mapNot(this.key)}negate(){return this.negated||(this.negated=It.create(this.key,this)),this.negated}};function Mr(r,e){if(typeof r=="string"){let t=parseFloat(r);isNaN(t)||(r=t)}return typeof r=="string"||typeof r=="number"?e(r):ce.INSTANCE}var Gt=class r{constructor(e,t,n){this.key=e;this.value=t;this.negated=n;this.type=12}static create(e,t,n=null){return Mr(t,i=>new r(e,i,n))}cmp(e){return e.type!==this.type?this.type-e.type:Et(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){return this}evaluate(e){return typeof this.value=="string"?!1:parseFloat(e.getValue(this.key))>this.value}serialize(){return`${this.key} > ${this.value}`}keys(){return[this.key]}map(e){return e.mapGreater(this.key,this.value)}negate(){return this.negated||(this.negated=Mn.create(this.key,this.value,this)),this.negated}},An=class r{constructor(e,t,n){this.key=e;this.value=t;this.negated=n;this.type=13}static create(e,t,n=null){return Mr(t,i=>new r(e,i,n))}cmp(e){return e.type!==this.type?this.type-e.type:Et(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){return this}evaluate(e){return typeof this.value=="string"?!1:parseFloat(e.getValue(this.key))>=this.value}serialize(){return`${this.key} >= ${this.value}`}keys(){return[this.key]}map(e){return e.mapGreaterEquals(this.key,this.value)}negate(){return this.negated||(this.negated=On.create(this.key,this.value,this)),this.negated}},On=class r{constructor(e,t,n){this.key=e;this.value=t;this.negated=n;this.type=14}static create(e,t,n=null){return Mr(t,i=>new r(e,i,n))}cmp(e){return e.type!==this.type?this.type-e.type:Et(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){return this}evaluate(e){return typeof this.value=="string"?!1:parseFloat(e.getValue(this.key))<this.value}serialize(){return`${this.key} < ${this.value}`}keys(){return[this.key]}map(e){return e.mapSmaller(this.key,this.value)}negate(){return this.negated||(this.negated=An.create(this.key,this.value,this)),this.negated}},Mn=class r{constructor(e,t,n){this.key=e;this.value=t;this.negated=n;this.type=15}static create(e,t,n=null){return Mr(t,i=>new r(e,i,n))}cmp(e){return e.type!==this.type?this.type-e.type:Et(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){return this}evaluate(e){return typeof this.value=="string"?!1:parseFloat(e.getValue(this.key))<=this.value}serialize(){return`${this.key} <= ${this.value}`}keys(){return[this.key]}map(e){return e.mapSmallerEquals(this.key,this.value)}negate(){return this.negated||(this.negated=Gt.create(this.key,this.value,this)),this.negated}},Un=class r{constructor(e,t){this.key=e;this.regexp=t;this.type=7;this.negated=null}static create(e,t){return new r(e,t)}cmp(e){if(e.type!==this.type)return this.type-e.type;if(this.key<e.key)return-1;if(this.key>e.key)return 1;let t=this.regexp?this.regexp.source:"",n=e.regexp?e.regexp.source:"";return t<n?-1:t>n?1:0}equals(e){if(e.type===this.type){let t=this.regexp?this.regexp.source:"",n=e.regexp?e.regexp.source:"";return this.key===e.key&&t===n}return!1}substituteConstants(){return this}evaluate(e){let t=e.getValue(this.key);return this.regexp?this.regexp.test(t):!1}serialize(){let e=this.regexp?`/${this.regexp.source}/${this.regexp.flags}`:"/invalid/";return`${this.key} =~ ${e}`}keys(){return[this.key]}map(e){return e.mapRegex(this.key,this.regexp)}negate(){return this.negated||(this.negated=mo.create(this)),this.negated}},mo=class r{constructor(e){this._actual=e;this.type=8}static create(e){return new r(e)}cmp(e){return e.type!==this.type?this.type-e.type:this._actual.cmp(e._actual)}equals(e){return e.type===this.type?this._actual.equals(e._actual):!1}substituteConstants(){return this}evaluate(e){return!this._actual.evaluate(e)}serialize(){return`!(${this._actual.serialize()})`}keys(){return this._actual.keys()}map(e){return new r(this._actual.map(e))}negate(){return this._actual}};function Da(r){let e=null;for(let t=0,n=r.length;t<n;t++){let i=r[t].substituteConstants();if(r[t]!==i&&e===null){e=[];for(let o=0;o<t;o++)e[o]=r[o]}e!==null&&(e[t]=i)}return e===null?r:e}var Ar=class r{constructor(e,t){this.expr=e;this.negated=t;this.type=6}static create(e,t,n){return r._normalizeArr(e,t,n)}cmp(e){if(e.type!==this.type)return this.type-e.type;if(this.expr.length<e.expr.length)return-1;if(this.expr.length>e.expr.length)return 1;for(let t=0,n=this.expr.length;t<n;t++){let i=Rn(this.expr[t],e.expr[t]);if(i!==0)return i}return 0}equals(e){if(e.type===this.type){if(this.expr.length!==e.expr.length)return!1;for(let t=0,n=this.expr.length;t<n;t++)if(!this.expr[t].equals(e.expr[t]))return!1;return!0}return!1}substituteConstants(){let e=Da(this.expr);return e===this.expr?this:r.create(e,this.negated,!1)}evaluate(e){for(let t=0,n=this.expr.length;t<n;t++)if(!this.expr[t].evaluate(e))return!1;return!0}static _normalizeArr(e,t,n){let i=[],o=!1;for(let s of e)if(s){if(s.type===1){o=!0;continue}if(s.type===0)return ce.INSTANCE;if(s.type===6){i.push(...s.expr);continue}i.push(s)}if(i.length===0&&o)return he.INSTANCE;if(i.length!==0){if(i.length===1)return i[0];i.sort(Rn);for(let s=1;s<i.length;s++)i[s-1].equals(i[s])&&(i.splice(s,1),s--);if(i.length===1)return i[0];for(;i.length>1;){let s=i[i.length-1];if(s.type!==9)break;i.pop();let a=i.pop(),l=i.length===0,u=Fn.create(s.expr.map(p=>r.create([p,a],null,n)),null,l);u&&(i.push(u),i.sort(Rn))}if(i.length===1)return i[0];if(n){for(let s=0;s<i.length;s++)for(let a=s+1;a<i.length;a++)if(i[s].negate().equals(i[a]))return ce.INSTANCE;if(i.length===1)return i[0]}return new r(i,t)}}serialize(){return this.expr.map(e=>e.serialize()).join(" && ")}keys(){let e=[];for(let t of this.expr)e.push(...t.keys());return e}map(e){return new r(this.expr.map(t=>t.map(e)),null)}negate(){if(!this.negated){let e=[];for(let t of this.expr)e.push(t.negate());this.negated=Fn.create(e,this,!0)}return this.negated}},Fn=class r{constructor(e,t){this.expr=e;this.negated=t;this.type=9}static create(e,t,n){return r._normalizeArr(e,t,n)}cmp(e){if(e.type!==this.type)return this.type-e.type;if(this.expr.length<e.expr.length)return-1;if(this.expr.length>e.expr.length)return 1;for(let t=0,n=this.expr.length;t<n;t++){let i=Rn(this.expr[t],e.expr[t]);if(i!==0)return i}return 0}equals(e){if(e.type===this.type){if(this.expr.length!==e.expr.length)return!1;for(let t=0,n=this.expr.length;t<n;t++)if(!this.expr[t].equals(e.expr[t]))return!1;return!0}return!1}substituteConstants(){let e=Da(this.expr);return e===this.expr?this:r.create(e,this.negated,!1)}evaluate(e){for(let t=0,n=this.expr.length;t<n;t++)if(this.expr[t].evaluate(e))return!0;return!1}static _normalizeArr(e,t,n){let i=[],o=!1;if(e){for(let s=0,a=e.length;s<a;s++){let l=e[s];if(l){if(l.type===0){o=!0;continue}if(l.type===1)return he.INSTANCE;if(l.type===9){i=i.concat(l.expr);continue}i.push(l)}}if(i.length===0&&o)return ce.INSTANCE;i.sort(Rn)}if(i.length!==0){if(i.length===1)return i[0];for(let s=1;s<i.length;s++)i[s-1].equals(i[s])&&(i.splice(s,1),s--);if(i.length===1)return i[0];if(n){for(let s=0;s<i.length;s++)for(let a=s+1;a<i.length;a++)if(i[s].negate().equals(i[a]))return he.INSTANCE;if(i.length===1)return i[0]}return new r(i,t)}}serialize(){return this.expr.map(e=>e.serialize()).join(" || ")}keys(){let e=[];for(let t of this.expr)e.push(...t.keys());return e}map(e){return new r(this.expr.map(t=>t.map(e)),null)}negate(){if(!this.negated){let e=[];for(let t of this.expr)e.push(t.negate());for(;e.length>1;){let t=e.shift(),n=e.shift(),i=[];for(let o of La(t))for(let s of La(n))i.push(Ar.create([o,s],null,!1));e.unshift(r.create(i,null,!1))}this.negated=r.create(e,this,!0)}return this.negated}},Or=class r extends It{static{this._info=[]}static all(){return r._info.values()}constructor(e,t,n){super(e,null),this._defaultValue=t,typeof n=="object"?r._info.push({...n,key:e}):n!==!0&&r._info.push({key:e,description:n,type:t!=null?typeof t:void 0})}bindTo(e){return e.createKey(this.key,this._defaultValue)}getValue(e){return e.getContextKeyValue(this.key)}toNegated(){return this.negate()}isEqualTo(e){return Ln.create(this.key,e)}notEqualsTo(e){return Dn.create(this.key,e)}greater(e){return Gt.create(this.key,e)}},zh=Te("contextKeyService");function Aa(r,e){return r<e?-1:r>e?1:0}function Et(r,e,t,n){return r<t?-1:r>t?1:e<n?-1:e>n?1:0}function La(r){return r.type===9?r.expr:[r]}var Se=Te("logService"),ag=Te("loggerService");function fo(r){return De(r)}var Ma=3;function Kc(r,e){return r!==0&&r<=e}function Wc(r,e,t){switch(e){case 1:r.trace(t);break;case 2:r.debug(t);break;case 3:r.info(t);break;case 4:r.warn(t);break;case 5:r.error(t);break;case 0:break;default:throw new Error(`Invalid log level ${e}`)}}var Ua=!1,Oa=!1,$c=!1;function Nn(r,e){switch(r){case"debug":console.debug=e;break;case"error":console.error=e;break;case"info":console.info=e;break;case"log":console.log=e;break;case"warn":console.warn=e;break}}function Fa(r){let e={debug:console.debug,error:console.error,info:console.info,log:console.log,warn:console.warn},t=(i,o,s)=>{if(!$c){Oa=!0;try{Wc(r,o,wt(s))}catch{}finally{Oa=!1}}e[i].apply(console,s)},n={debug:(...i)=>t("debug",2,i),error:(...i)=>t("error",5,i),info:(...i)=>t("info",3,i),log:(...i)=>t("log",3,i),warn:(...i)=>t("warn",4,i)};return Nn("debug",n.debug),Nn("error",n.error),Nn("info",n.info),Nn("log",n.log),Nn("warn",n.warn),Q(()=>{console.debug===n.debug&&(console.debug=e.debug),console.error===n.error&&(console.error=e.error),console.info===n.info&&(console.info=e.info),console.log===n.log&&(console.log=e.log),console.warn===n.warn&&(console.warn=e.warn)})}function wt(r,e=!1){let t="";for(let n=0;n<r.length;n++){let i=r[n];if(i instanceof Error&&(i=ao(i,e)),typeof i=="object")try{i=JSON.stringify(i)}catch{}t+=(n>0?" ":"")+i}return t}var Ur=class extends C{constructor(){super(...arguments);this.level=Ma;this._onDidChangeLogLevel=this._register(new y)}get onDidChangeLogLevel(){return this._onDidChangeLogLevel.event}setLevel(t){this.level!==t&&(this.level=t,this._onDidChangeLogLevel.fire(this.level))}getLevel(){return this.level}checkLogLevel(t){return Kc(this.level,t)}canLog(t){return this._store.isDisposed?!1:this.checkLogLevel(t)}},Bn=class extends Ur{constructor(t){super();this.logAlways=t}checkLogLevel(t){return this.logAlways||super.checkLogLevel(t)}trace(t,...n){this.canLog(1)&&this.log(1,wt([t,...n],!0))}debug(t,...n){this.canLog(2)&&this.log(2,wt([t,...n]))}info(t,...n){this.canLog(3)&&this.log(3,wt([t,...n]))}warn(t,...n){this.canLog(4)&&this.log(4,wt([t,...n]))}error(t,...n){if(this.canLog(5))if(t instanceof Error){let i=Array.prototype.slice.call(arguments);i[0]=t.stack,this.log(5,wt(i))}else this.log(5,wt([t,...n]))}flush(){}};var Fr=class extends Ur{constructor(t){super();this.loggers=t;t.length&&this.setLevel(t[0].getLevel())}setLevel(t){for(let n of this.loggers)n.setLevel(t);super.setLevel(t)}trace(t,...n){for(let i of this.loggers)i.trace(t,...n)}debug(t,...n){for(let i of this.loggers)i.debug(t,...n)}info(t,...n){for(let i of this.loggers)i.info(t,...n)}warn(t,...n){for(let i of this.loggers)i.warn(t,...n)}error(t,...n){for(let i of this.loggers)i.error(t,...n)}flush(){for(let t of this.loggers)t.flush()}dispose(){for(let t of this.loggers)t.dispose();super.dispose()}},Vn=class extends C{constructor(t,n,i){super();this.logLevel=t;this.logsHome=n;this._loggers=new lt;this._onDidChangeLoggers=this._register(new y);this.onDidChangeLoggers=this._onDidChangeLoggers.event;this._onDidChangeLogLevel=this._register(new y);this.onDidChangeLogLevel=this._onDidChangeLogLevel.event;this._onDidChangeVisibility=this._register(new y);this.onDidChangeVisibility=this._onDidChangeVisibility.event;if(i)for(let o of i)this._loggers.set(o.resource,{logger:void 0,info:o})}getLoggerEntry(t){return G(t)?[...this._loggers.values()].find(n=>n.info.id===t):this._loggers.get(t)}getLogger(t){return this.getLoggerEntry(t)?.logger}createLogger(t,n){let i=this.toResource(t),o=G(t)?t:n?.id??Ca(i.toString()).toString(16),s=this._loggers.get(i)?.logger,a=n?.logLevel==="always"?1:n?.logLevel;s||(s=this.doCreateLogger(i,a??this.getLogLevel(i)??this.logLevel,{...n,id:o}));let l={logger:s,info:{resource:i,id:o,logLevel:a,name:n?.name,hidden:n?.hidden,group:n?.group,extensionId:n?.extensionId,when:n?.when}};return this.registerLogger(l.info),this._loggers.set(i,l),s}toResource(t){return G(t)?Ie(this.logsHome,`${t.replace(/[\\/:\*\?"<>\|]/g,"")}.log`):t}setLogLevel(t,n){if(A.isUri(t)){let i=t,o=n,s=this._loggers.get(i);s&&o!==s.info.logLevel&&(s.info.logLevel=o===this.logLevel?void 0:o,s.logger?.setLevel(o),this._loggers.set(s.info.resource,s),this._onDidChangeLogLevel.fire([i,o]))}else{this.logLevel=t;for(let[i,o]of this._loggers.entries())this._loggers.get(i)?.info.logLevel===void 0&&o.logger?.setLevel(this.logLevel);this._onDidChangeLogLevel.fire(this.logLevel)}}setVisibility(t,n){let i=this.getLoggerEntry(t);i&&n!==!i.info.hidden&&(i.info.hidden=!n,this._loggers.set(i.info.resource,i),this._onDidChangeVisibility.fire([i.info.resource,n]))}getLogLevel(t){let n;return t&&(n=this._loggers.get(t)?.info.logLevel),n??this.logLevel}registerLogger(t){let n=this._loggers.get(t.resource);n?n.info.hidden!==t.hidden&&this.setVisibility(t.resource,!t.hidden):(this._loggers.set(t.resource,{info:t,logger:void 0}),this._onDidChangeLoggers.fire({added:[t],removed:[]}))}deregisterLogger(t){let n=this.toResource(t),i=this._loggers.get(n);i&&(i.logger&&i.logger.dispose(),this._loggers.delete(n),this._onDidChangeLoggers.fire({added:[],removed:[i.info]}))}*getRegisteredLoggers(){for(let t of this._loggers.values())yield t.info}getRegisteredLogger(t){return this._loggers.get(t)?.info}dispose(){this._loggers.forEach(t=>t.logger?.dispose()),this._loggers.clear(),super.dispose()}};function Na(r){if(r.verbose)return 1;if(typeof r.logLevel=="string"){let e=zc(r.logLevel.toLowerCase());if(e!==void 0)return e}return Ma}function qc(r){switch(r){case 1:return"trace";case 2:return"debug";case 3:return"info";case 4:return"warn";case 5:return"error";case 0:return"off"}}function zc(r){switch(r){case"trace":return 1;case"debug":return 2;case"info":return 3;case"warn":return 4;case"error":return 5;case"critical":return 5;case"off":return 0}}var lg=new Or("logLevel",qc(3));var Nr=class{constructor(e,t){this.loggerService=e;this.getUriTransformer=t}listen(e,t){let n=this.getUriTransformer(e);switch(t){case"onDidChangeLoggers":return S.map(this.loggerService.onDidChangeLoggers,i=>({added:[...i.added].map(o=>this.transformLogger(o,n)),removed:[...i.removed].map(o=>this.transformLogger(o,n))}));case"onDidChangeVisibility":return S.map(this.loggerService.onDidChangeVisibility,i=>[n.transformOutgoingURI(i[0]),i[1]]);case"onDidChangeLogLevel":return S.map(this.loggerService.onDidChangeLogLevel,i=>fo(i)?i:[n.transformOutgoingURI(i[0]),i[1]])}throw new Error(`Event not found: ${t}`)}async call(e,t,n){let i=this.getUriTransformer(e);switch(t){case"setLogLevel":return fo(n[0])?this.loggerService.setLogLevel(n[0]):this.loggerService.setLogLevel(A.revive(i.transformIncoming(n[0][0])),n[0][1]);case"getRegisteredLoggers":return Promise.resolve([...this.loggerService.getRegisteredLoggers()].map(o=>this.transformLogger(o,i)))}throw new Error(`Call not found: ${t}`)}transformLogger(e,t){return{...e,resource:t.transformOutgoingURI(e.resource)}}};var Br=class extends C{constructor(e,t=[]){super(),this.logger=new Fr([e,...t]),this._register(e.onDidChangeLogLevel(n=>this.setLevel(n)))}get onDidChangeLogLevel(){return this.logger.onDidChangeLogLevel}setLevel(e){this.logger.setLevel(e)}getLevel(){return this.logger.getLevel()}trace(e,...t){this.logger.trace(e,...t)}debug(e,...t){this.logger.debug(e,...t)}info(e,...t){this.logger.info(e,...t)}warn(e,...t){this.logger.warn(e,...t)}error(e,...t){this.logger.error(e,...t)}flush(){this.logger.flush()}};var Vr=(function(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID.bind(crypto);let r=new Uint8Array(16),e=[];for(let t=0;t<256;t++)e.push(t.toString(16).padStart(2,"0"));return function(){crypto.getRandomValues(r),r[6]=r[6]&15|64,r[8]=r[8]&63|128;let n=0,i="";return i+=e[r[n++]],i+=e[r[n++]],i+=e[r[n++]],i+=e[r[n++]],i+="-",i+=e[r[n++]],i+=e[r[n++]],i+="-",i+=e[r[n++]],i+=e[r[n++]],i+="-",i+=e[r[n++]],i+=e[r[n++]],i+="-",i+=e[r[n++]],i+=e[r[n++]],i+=e[r[n++]],i+=e[r[n++]],i+=e[r[n++]],i+=e[r[n++]],i}})();var ho=class{constructor(){this._value="";this._pos=0}reset(e){return this._value=e,this._pos=0,this}next(){return this._pos+=1,this}hasNext(){return this._pos<this._value.length-1}cmp(e){let t=e.charCodeAt(0),n=this._value.charCodeAt(this._pos);return t-n}value(){return this._value[this._pos]}},go=class{constructor(e=!0){this._caseSensitive=e}reset(e){return this._value=e,this._from=0,this._to=0,this.next()}hasNext(){return this._to<this._value.length}next(){this._from=this._to;let e=!0;for(;this._to<this._value.length;this._to++)if(this._value.charCodeAt(this._to)===46)if(e)this._from++;else break;else e=!1;return this}cmp(e){return this._caseSensitive?hr(e,this._value,0,e.length,this._from,this._to):Kt(e,this._value,0,e.length,this._from,this._to)}value(){return this._value.substring(this._from,this._to)}},Kr=class{constructor(e=!0,t=!0){this._splitOnBackslash=e;this._caseSensitive=t}reset(e){this._from=0,this._to=0,this._value=e,this._valueLen=e.length;for(let t=e.length-1;t>=0;t--,this._valueLen--){let n=this._value.charCodeAt(t);if(!(n===47||this._splitOnBackslash&&n===92))break}return this.next()}hasNext(){return this._to<this._valueLen}next(){this._from=this._to;let e=!0;for(;this._to<this._valueLen;this._to++){let t=this._value.charCodeAt(this._to);if(t===47||this._splitOnBackslash&&t===92)if(e)this._from++;else break;else e=!1}return this}cmp(e){return this._caseSensitive?hr(e,this._value,0,e.length,this._from,this._to):Kt(e,this._value,0,e.length,this._from,this._to)}value(){return this._value.substring(this._from,this._to)}};var yo=class{constructor(e,t){this._ignorePathCasing=e;this._ignoreQueryAndFragment=t;this._states=[];this._stateIdx=0}reset(e){return this._value=e,this._states=[],this._value.scheme&&this._states.push(1),this._value.authority&&this._states.push(2),this._value.path&&(this._pathIterator=new Kr(!1,!this._ignorePathCasing(e)),this._pathIterator.reset(e.path),this._pathIterator.value()&&this._states.push(3)),this._ignoreQueryAndFragment(e)||(this._value.query&&this._states.push(4),this._value.fragment&&this._states.push(5)),this._stateIdx=0,this}next(){return this._states[this._stateIdx]===3&&this._pathIterator.hasNext()?this._pathIterator.next():this._stateIdx+=1,this}hasNext(){return this._states[this._stateIdx]===3&&this._pathIterator.hasNext()||this._stateIdx<this._states.length-1}cmp(e){if(this._states[this._stateIdx]===1)return Ki(e,this._value.scheme);if(this._states[this._stateIdx]===2)return Ki(e,this._value.authority);if(this._states[this._stateIdx]===3)return this._pathIterator.cmp(e);if(this._states[this._stateIdx]===4)return fn(e,this._value.query);if(this._states[this._stateIdx]===5)return fn(e,this._value.fragment);throw new Error}value(){if(this._states[this._stateIdx]===1)return this._value.scheme;if(this._states[this._stateIdx]===2)return this._value.authority;if(this._states[this._stateIdx]===3)return this._pathIterator.value();if(this._states[this._stateIdx]===4)return this._value.query;if(this._states[this._stateIdx]===5)return this._value.fragment;throw new Error}},je=class r{static{this.Val=Symbol("undefined_placeholder")}static wrap(e){return e===void 0?r.Val:e}static unwrap(e){return e===r.Val?void 0:e}},Xt=class{constructor(){this.height=1;this.value=void 0;this.key=void 0;this.left=void 0;this.mid=void 0;this.right=void 0}isEmpty(){return!this.left&&!this.mid&&!this.right&&this.value===void 0}rotateLeft(){let e=this.right;return this.right=e.left,e.left=this,this.updateHeight(),e.updateHeight(),e}rotateRight(){let e=this.left;return this.left=e.right,e.right=this,this.updateHeight(),e.updateHeight(),e}updateHeight(){this.height=1+Math.max(this.heightLeft,this.heightRight)}balanceFactor(){return this.heightRight-this.heightLeft}get heightLeft(){return this.left?.height??0}get heightRight(){return this.right?.height??0}};var Qt=class r{static forUris(e=()=>!1,t=()=>!1){return new r(new yo(e,t))}static forPaths(e=!1){return new r(new Kr(void 0,!e))}static forStrings(){return new r(new ho)}static forConfigKeys(){return new r(new go)}constructor(e){this._iter=e}clear(){this._root=void 0}fill(e,t){if(t){let n=t.slice(0);hi(n);for(let i of n)this.set(i,e)}else{let n=e.slice(0);hi(n);for(let i of n)this.set(i[0],i[1])}}set(e,t){let n=this._iter.reset(e),i;this._root||(this._root=new Xt,this._root.segment=n.value());let o=[];for(i=this._root;;){let a=n.cmp(i.segment);if(a>0)i.left||(i.left=new Xt,i.left.segment=n.value()),o.push([-1,i]),i=i.left;else if(a<0)i.right||(i.right=new Xt,i.right.segment=n.value()),o.push([1,i]),i=i.right;else if(n.hasNext())n.next(),i.mid||(i.mid=new Xt,i.mid.segment=n.value()),o.push([0,i]),i=i.mid;else break}let s=je.unwrap(i.value);i.value=je.wrap(t),i.key=e;for(let a=o.length-1;a>=0;a--){let l=o[a][1];l.updateHeight();let u=l.balanceFactor();if(u<-1||u>1){let p=o[a][0],c=o[a+1][0];if(p===1&&c===1)o[a][1]=l.rotateLeft();else if(p===-1&&c===-1)o[a][1]=l.rotateRight();else if(p===1&&c===-1)l.right=o[a+1][1]=o[a+1][1].rotateRight(),o[a][1]=l.rotateLeft();else if(p===-1&&c===1)l.left=o[a+1][1]=o[a+1][1].rotateLeft(),o[a][1]=l.rotateRight();else throw new Error;if(a>0)switch(o[a-1][0]){case-1:o[a-1][1].left=o[a][1];break;case 1:o[a-1][1].right=o[a][1];break;case 0:o[a-1][1].mid=o[a][1];break}else this._root=o[0][1]}}return s}get(e){return je.unwrap(this._getNode(e)?.value)}_getNode(e){let t=this._iter.reset(e),n=this._root;for(;n;){let i=t.cmp(n.segment);if(i>0)n=n.left;else if(i<0)n=n.right;else if(t.hasNext())t.next(),n=n.mid;else break}return n}has(e){let t=this._getNode(e);return!(t?.value===void 0&&t?.mid===void 0)}delete(e){return this._delete(e,!1)}deleteSuperstr(e){return this._delete(e,!0)}_delete(e,t){let n=this._iter.reset(e),i=[],o=this._root;for(;o;){let s=n.cmp(o.segment);if(s>0)i.push([-1,o]),o=o.left;else if(s<0)i.push([1,o]),o=o.right;else if(n.hasNext())n.next(),i.push([0,o]),o=o.mid;else break}if(o){if(t?(o.left=void 0,o.mid=void 0,o.right=void 0,o.height=1):(o.key=void 0,o.value=void 0),!o.mid&&!o.value)if(o.left&&o.right){let s=[[1,o]],a=this._min(o.right,s);if(a.key){o.key=a.key,o.value=a.value,o.segment=a.segment;let l=a.right;if(s.length>1){let[p,c]=s[s.length-1];switch(p){case-1:c.left=l;break;case 0:sn(!1);case 1:sn(!1)}}else o.right=l;let u=this._balanceByStack(s);if(i.length>0){let[p,c]=i[i.length-1];switch(p){case-1:c.left=u;break;case 0:c.mid=u;break;case 1:c.right=u;break}}else this._root=u}}else{let s=o.left??o.right;if(i.length>0){let[a,l]=i[i.length-1];switch(a){case-1:l.left=s;break;case 0:l.mid=s;break;case 1:l.right=s;break}}else this._root=s}this._root=this._balanceByStack(i)??this._root}}_min(e,t){for(;e.left;)t.push([-1,e]),e=e.left;return e}_balanceByStack(e){for(let t=e.length-1;t>=0;t--){let n=e[t][1];n.updateHeight();let i=n.balanceFactor();if(i>1?(n.right.balanceFactor()>=0||(n.right=n.right.rotateRight()),e[t][1]=n.rotateLeft()):i<-1&&(n.left.balanceFactor()<=0||(n.left=n.left.rotateLeft()),e[t][1]=n.rotateRight()),t>0)switch(e[t-1][0]){case-1:e[t-1][1].left=e[t][1];break;case 1:e[t-1][1].right=e[t][1];break;case 0:e[t-1][1].mid=e[t][1];break}else return e[0][1]}}findSubstr(e){let t=this._iter.reset(e),n=this._root,i;for(;n;){let o=t.cmp(n.segment);if(o>0)n=n.left;else if(o<0)n=n.right;else if(t.hasNext())t.next(),i=je.unwrap(n.value)||i,n=n.mid;else break}return n&&je.unwrap(n.value)||i}findSuperstr(e){return this._findSuperstrOrElement(e,!1)}_findSuperstrOrElement(e,t){let n=this._iter.reset(e),i=this._root;for(;i;){let o=n.cmp(i.segment);if(o>0)i=i.left;else if(o<0)i=i.right;else if(n.hasNext())n.next(),i=i.mid;else return i.mid?this._entries(i.mid):t?je.unwrap(i.value):void 0}}hasElementOrSubtree(e){return this._findSuperstrOrElement(e,!0)!==void 0}forEach(e){for(let[t,n]of this)e(n,t)}*[Symbol.iterator](){yield*this._entries(this._root)}_entries(e){let t=[];return this._dfsEntries(e,t),t[Symbol.iterator]()}_dfsEntries(e,t){e&&(e.left&&this._dfsEntries(e.left,t),e.value!==void 0&&t.push([e.key,je.unwrap(e.value)]),e.mid&&this._dfsEntries(e.mid,t),e.right&&this._dfsEntries(e.right,t))}_isBalanced(){let e=t=>{if(!t)return!0;let n=t.balanceFactor();return n<-1||n>1?!1:e(t.left)&&e(t.right)};return e(this._root)}};var qg=Te("fileService");var Ba=class r{constructor(e,t){this.ignorePathCasing=t;this.correlationId=void 0;this.added=new Ee(()=>{let e=Qt.forUris(()=>this.ignorePathCasing);return e.fill(this.rawAdded.map(t=>[t,!0])),e});this.updated=new Ee(()=>{let e=Qt.forUris(()=>this.ignorePathCasing);return e.fill(this.rawUpdated.map(t=>[t,!0])),e});this.deleted=new Ee(()=>{let e=Qt.forUris(()=>this.ignorePathCasing);return e.fill(this.rawDeleted.map(t=>[t,!0])),e});this.rawAdded=[];this.rawUpdated=[];this.rawDeleted=[];for(let n of e){switch(n.type){case 1:this.rawAdded.push(n.resource);break;case 0:this.rawUpdated.push(n.resource);break;case 2:this.rawDeleted.push(n.resource);break}this.correlationId!==r.MIXED_CORRELATION&&(typeof n.cId=="number"?this.correlationId===void 0?this.correlationId=n.cId:this.correlationId!==n.cId&&(this.correlationId=r.MIXED_CORRELATION):this.correlationId!==void 0&&(this.correlationId=r.MIXED_CORRELATION))}}static{this.MIXED_CORRELATION=null}contains(e,...t){return this.doContains(e,{includeChildren:!1},...t)}affects(e,...t){return this.doContains(e,{includeChildren:!0},...t)}doContains(e,t,...n){if(!e)return!1;let i=n.length>0;return!!((!i||n.includes(1))&&(this.added.value.get(e)||t.includeChildren&&this.added.value.findSuperstr(e))||(!i||n.includes(0))&&(this.updated.value.get(e)||t.includeChildren&&this.updated.value.findSuperstr(e))||(!i||n.includes(2))&&(this.deleted.value.findSubstr(e)||t.includeChildren&&this.deleted.value.findSuperstr(e)))}gotAdded(){return this.rawAdded.length>0}gotDeleted(){return this.rawDeleted.length>0}gotUpdated(){return this.rawUpdated.length>0}correlates(e){return this.correlationId===e}hasCorrelation(){return typeof this.correlationId=="number"}};var Wr=class r{static{this.KB=1024}static{this.MB=r.KB*r.KB}static{this.GB=r.MB*r.KB}static{this.TB=r.GB*r.KB}static formatSize(e){return De(e)||(e=0),e<r.KB?g(2874,null,e.toFixed(0)):e<r.MB?g(2876,null,(e/r.KB).toFixed(2)):e<r.GB?g(2877,null,(e/r.MB).toFixed(2)):e<r.TB?g(2875,null,(e/r.GB).toFixed(2)):g(2878,null,(e/r.TB).toFixed(2))}};async function Hc(r,e,t,n,i){try{let o=await import("@vscode/spdlog");o.setFlushOn(0);let s=await o.createAsyncRotatingLogger(r,e,t,n);return i?s.clearFormatters():s.setPattern("%Y-%m-%d %H:%M:%S.%e [%l] %v"),s}catch(o){console.error(o)}return null}function Va(r,e,t){switch(e){case 1:r.trace(t);break;case 2:r.debug(t);break;case 3:r.info(t);break;case 4:r.warn(t);break;case 5:r.error(t);break;case 0:break;default:throw new Error(`Invalid log level ${e}`)}}function Ka(r,e){switch(e){case 1:r.setLevel(0);break;case 2:r.setLevel(1);break;case 3:r.setLevel(2);break;case 4:r.setLevel(3);break;case 5:r.setLevel(4);break;case 0:r.setLevel(6);break;default:throw new Error(`Invalid log level ${e}`)}}var $r=class extends Bn{constructor(t,n,i,o,s){super();this.buffer=[];this.setLevel(s),this._loggerCreationPromise=this._createSpdLogLogger(t,n,i,o),this._register(this.onDidChangeLogLevel(a=>{this._logger&&Ka(this._logger,a)}))}async _createSpdLogLogger(t,n,i,o){let s=i?6:1,a=30/s*Wr.MB,l=await Hc(t,n,a,s,o);if(l){this._logger=l,Ka(this._logger,this.getLevel());for(let{level:u,message:p}of this.buffer)Va(this._logger,u,p);this.buffer=[]}}log(t,n){this._logger?Va(this._logger,t,n):this.getLevel()<=t&&this.buffer.push({level:t,message:n})}flush(){this._logger?this.flushLogger():this._loggerCreationPromise.then(()=>this.flushLogger())}dispose(){this._logger?this.disposeLogger():this._loggerCreationPromise.then(()=>this.disposeLogger()),super.dispose()}flushLogger(){this._logger&&this._logger.flush()}disposeLogger(){this._logger&&(this._logger.drop(),this._logger=void 0)}};var qr=class extends Vn{doCreateLogger(e,t,n){return new $r(Vr(),e.fsPath,!n?.donotRotate,!!n?.donotUseFormatters,t)}};function Wa(r,e){return r.dependencies?.[e]?.replace(/^[~^]/,"")}var ie,bo=globalThis.vscode;if(typeof bo<"u"&&typeof bo.context<"u"){let r=bo.context.configuration();if(r)ie=r.product;else throw new Error("Sandbox: unable to resolve product configuration from preload script.")}else if(globalThis._VSCODE_PRODUCT_JSON&&globalThis._VSCODE_PACKAGE_JSON){ie=globalThis._VSCODE_PRODUCT_JSON;let r=globalThis._VSCODE_PACKAGE_JSON;if(ne.VSCODE_DEV&&Object.assign(ie,{nameShort:`${ie.nameShort} Dev`,nameLong:`${ie.nameLong} Dev`,dataFolderName:`${ie.dataFolderName}-dev`,serverDataFolderName:ie.serverDataFolderName?`${ie.serverDataFolderName}-dev`:void 0}),ie.version||Object.assign(ie,{version:r.version}),!ie.copilotVersions){let e=Wa(r,"@github/copilot"),t=Wa(r,"@github/copilot-sdk");e&&t&&Object.assign(ie,{copilotVersions:{runtime:e,sdk:t}})}Object.assign(ie,{extensionsGallery:ne.EXTENSIONS_GALLERY?JSON.parse(ne.EXTENSIONS_GALLERY):ie.extensionsGallery||{serviceUrl:"https://open-vsx.org/vscode/gallery",itemUrl:"https://open-vsx.org/vscode/item",extensionUrlTemplate:"https://open-vsx.org/vscode/gallery/{publisher}/{name}/latest",resourceUrlTemplate:"https://open-vsx.org/vscode/asset/{publisher}/{name}/{version}/Microsoft.VisualStudio.Code.WebResources/{path}",controlUrl:"",recommendationsUrl:""},telemetryEndpoint:ne.CS_TELEMETRY_URL||ie.telemetryEndpoint||"https://v1.telemetry.coder.com/track"})}else ie={nameShort:"code-server",nameLong:"code-server",applicationName:"code-server",dataFolderName:".code-server",sharedDataFolderName:".vscode-oss-shared",win32MutexName:"codeserver",licenseName:"MIT",licenseUrl:"https://github.com/coder/code-server/blob/main/LICENSE",serverLicenseUrl:"https://github.com/microsoft/vscode/blob/main/LICENSE.txt",serverGreeting:[],serverLicense:[],serverLicensePrompt:"",serverApplicationName:"code-server-oss",serverDataFolderName:".vscode-server-oss",tunnelApplicationName:"code-tunnel-oss",win32DirName:"code-server",win32NameVersion:"code-server",win32RegValueName:"CodeOSS",win32x64AppId:"{{D77B7E06-80BA-4137-BCF4-654B95CCEBC5}",win32arm64AppId:"{{D1ACE434-89C5-48D1-88D3-E2991DF85475}",win32x64UserAppId:"{{CC6B787D-37A0-49E8-AE24-8559A032BE0C}",win32arm64UserAppId:"{{3AEBF0C8-F733-4AD4-BADE-FDB816D53D7B}",win32AppUserModelId:"coder.code-server",win32ShellNameShort:"c&ode-server",win32TunnelServiceMutex:"vscodeoss-tunnelservice",win32TunnelMutex:"vscodeoss-tunnel",darwinBundleIdentifier:"com.coder.code.server",darwinProfileUUID:"47827DD9-4734-49A0-AF80-7E19B11495CC",darwinProfilePayloadUUID:"CF808BE7-53F3-46C6-A7E2-7EDB98A5E959",linuxIconName:"com.coder.code.server",licenseFileName:"LICENSE.txt",reportIssueUrl:"https://github.com/coder/code-server/issues/new",nodejsArtifactFeed:"",electronArtifactFeed:"",urlProtocol:"code-oss",agentsTelemetryAppName:"agents",webviewContentExternalBaseUrlTemplate:"https://{{uuid}}.vscode-cdn.net/insider/ef65ac1ba57f57f2a3961bfe94aa20481caca4c6/out/vs/workbench/contrib/webview/browser/pre/",builtInExtensions:[{name:"ms-vscode.js-debug-companion",version:"1.1.3",sha256:"7380a890787452f14b2db7835dfa94de538caf358ebc263f9d46dd68ac52de93",repo:"https://github.com/microsoft/vscode-js-debug-companion",metadata:{id:"99cb0b7f-7354-4278-b8da-6cc79972169d",publisherId:{publisherId:"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee",publisherName:"ms-vscode",displayName:"Microsoft",flags:"verified"},publisherDisplayName:"Microsoft"}},{name:"ms-vscode.js-debug",version:"1.117.0",sha256:"854eeb8a785b1f41ba2bd02d7ccd4fdbe10021b61473293973c7e96d036c7fb8",repo:"https://github.com/microsoft/vscode-js-debug",metadata:{id:"25629058-ddac-4e17-abba-74678e126c5d",publisherId:{publisherId:"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee",publisherName:"ms-vscode",displayName:"Microsoft",flags:"verified"},publisherDisplayName:"Microsoft"}},{name:"ms-vscode.vscode-js-profile-table",version:"1.0.11",sha256:"a962a1e6a3baf74c9354b7f47fa96e6d6f0423a63bff55d7f976b6134a748ae9",repo:"https://github.com/microsoft/vscode-js-profile-visualizer",metadata:{id:"7e52b41b-71ad-457b-ab7e-0620f1fc4feb",publisherId:{publisherId:"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee",publisherName:"ms-vscode",displayName:"Microsoft",flags:"verified"},publisherDisplayName:"Microsoft"}}],defaultChatAgent:{extensionId:"GitHub.copilot",chatExtensionId:"GitHub.copilot-chat",chatExtensionOutputId:"GitHub.copilot-chat.GitHub Copilot Chat.log",chatExtensionOutputExtensionStateCommand:"github.copilot.debug.extensionState",documentationUrl:"https://aka.ms/github-copilot-overview",termsStatementUrl:"https://aka.ms/github-copilot-terms-statement",privacyStatementUrl:"https://aka.ms/github-copilot-privacy-statement",skusDocumentationUrl:"https://aka.ms/github-copilot-plans",optimizeUsageDocumentationUrl:"https://aka.ms/token-usage-tips",publicCodeMatchesUrl:"https://aka.ms/github-copilot-match-public-code",managePlanUrl:"https://aka.ms/github-copilot-manage-plan",upgradePlanUrl:"https://aka.ms/github-copilot-upgrade-plan",signUpUrl:"https://aka.ms/github-sign-up",provider:{default:{id:"github",name:"GitHub"},enterprise:{id:"github-enterprise",name:"GHE"},google:{id:"google",name:"Google"},apple:{id:"apple",name:"Apple"}},providerExtensionId:"vscode.github-authentication",providerUriSetting:"github-enterprise.uri",providerScopes:[["read:user","user:email","repo","workflow"],["user:email"],["read:user"]],entitlementUrl:"https://api.github.com/copilot_internal/user",entitlementSignupLimitedUrl:"https://api.github.com/copilot_internal/subscribe_limited_user",chatQuotaExceededContext:"github.copilot.chat.quotaExceeded",completionsQuotaExceededContext:"github.copilot.completions.quotaExceeded",walkthroughCommand:"github.copilot.open.walkthrough",completionsMenuCommand:"github.copilot.toggleStatusMenu",chatRefreshTokenCommand:"github.copilot.refreshToken",generateCommitMessageCommand:"github.copilot.git.generateCommitMessage",resolveMergeConflictsCommand:"github.copilot.git.resolveMergeConflicts",completionsAdvancedSetting:"github.copilot.advanced",completionsEnablementSetting:"github.copilot.enable",nextEditSuggestionsSetting:"github.copilot.nextEditSuggestions.enabled",tokenEntitlementUrl:"https://api.github.com/copilot_internal/v2/token",mcpRegistryDataUrl:"https://api.github.com/copilot/mcp_registry",managedSettingsUrl:"https://api.github.com/copilot_internal/managed_settings"},trustedExtensionAuthAccess:["vscode.git","vscode.github","github.vscode-pull-request-github","github.copilot","github.copilot-chat"],onboardingKeymaps:[{id:"vscode",label:"VS Code",description:"Default keyboard mapping"},{id:"sublime",label:"Sublime Text",extensionId:"ms-vscode.sublime-keybindings",description:"Keyboard mapping from Sublime Text"},{id:"intellij",label:"IntelliJ / JetBrains",extensionId:"k--kato.intellij-idea-keybindings",description:"Keyboard mapping from IntelliJ IDEA"},{id:"vim",label:"Vim",extensionId:"vscodevim.vim",description:"Vim modal editing"},{id:"eclipse",label:"Eclipse",extensionId:"alphabotsec.vscode-eclipse-keybindings",description:"Keyboard mapping from Eclipse"},{id:"notepadpp",label:"Notepad++",extensionId:"ms-vscode.notepadplusplus-keybindings",description:"Keyboard mapping from Notepad++"}],onboardingThemes:[{id:"dark-2026",label:"Dark 2026",themeId:"Dark 2026",type:"dark"},{id:"hc-dark",label:"Dark High Contrast",themeId:"Default High Contrast",type:"hcDark"},{id:"solarized-dark",label:"Solarized Dark",themeId:"Solarized Dark",type:"dark"},{id:"light-2026",label:"Light 2026",themeId:"Light 2026",type:"light"},{id:"hc-light",label:"Light High Contrast",themeId:"Default High Contrast Light",type:"hcLight"},{id:"solarized-light",label:"Solarized Light",themeId:"Solarized Light",type:"light"}],builtInExtensionsEnabledWithAutoUpdates:["GitHub.copilot-chat"],sessionsWindowAllowedExtensions:[],voiceWsUrl:"wss://falcon-caas.mai.microsoft.com/voice-code/api/v1/realtime/voice",enableTelemetry:!0,quality:"stable",codeServerVersion:"4.135.0",documentationUrl:"https://go.microsoft.com/fwlink/?LinkID=533484#vscode",keyboardShortcutsUrlMac:"https://go.microsoft.com/fwlink/?linkid=832143",keyboardShortcutsUrlLinux:"https://go.microsoft.com/fwlink/?linkid=832144",keyboardShortcutsUrlWin:"https://go.microsoft.com/fwlink/?linkid=832145",introductoryVideosUrl:"https://go.microsoft.com/fwlink/?linkid=832146",tipsAndTricksUrl:"https://go.microsoft.com/fwlink/?linkid=852118",newsletterSignupUrl:"https://www.research.net/r/vsc-newsletter",linkProtectionTrustedDomains:["https://open-vsx.org"],aiConfig:{ariaKey:"code-server"},version:"1.135.0",commit:"de89acbcdce9d9b870008a270c9f6466993d91f4",date:"2026-08-25T14:26:52Z"},Object.keys(ie).length===0&&Object.assign(ie,{version:"1.104.0-dev",nameShort:"Code - OSS Dev",nameLong:"Code - OSS Dev",applicationName:"code-oss",dataFolderName:".vscode-oss",urlProtocol:"code-oss",reportIssueUrl:"https://github.com/microsoft/vscode/issues/new",licenseName:"MIT",licenseUrl:"https://github.com/microsoft/vscode/blob/main/LICENSE.txt",serverLicenseUrl:"https://github.com/microsoft/vscode/blob/main/LICENSE.txt",defaultChatAgent:{extensionId:"GitHub.copilot",chatExtensionId:"GitHub.copilot-chat",provider:{default:{id:"github",name:"GitHub"},enterprise:{id:"github-enterprise",name:"GitHub Enterprise"}},providerScopes:[]}});var $a=ie;var _o=class{constructor(){this.data=new Map}add(e,t){Yn(G(e)),Yn(bi(t)),Yn(!this.data.has(e),"There is already an extension with this id"),this.data.set(e,t)}knows(e){return this.data.has(e)}as(e){return this.data.get(e)||null}dispose(){this.data.forEach(e=>{ut(e.dispose)&&e.dispose()}),this.data.clear()}},qa=new _o;var u0=Te("ptyService");var jc={Backend:"workbench.contributions.terminal.processBackend"},xo=class{constructor(){this._backends=new Map}get backends(){return this._backends}registerTerminalBackend(e){let t=this._sanitizeRemoteAuthority(e.remoteAuthority);if(this._backends.has(t))throw new Error(`A terminal backend with remote authority '${t}' was already registered.`);this._backends.set(t,e)}getTerminalBackend(e){return this._backends.get(this._sanitizeRemoteAuthority(e))}_sanitizeRemoteAuthority(e){return e?.toLowerCase()??""}};qa.add(jc.Backend,new xo);var c0=Te("localPtyService"),d0=Te("terminalLogService");var zr=class extends C{constructor(){super();this._onBeat=this._register(new y);this.onBeat=this._onBeat.event;let t=setInterval(()=>{this._onBeat.fire()},5e3);this._register(Q(()=>clearInterval(t)))}};import{execFile as _l,exec as Od}from"child_process";import{userInfo as rd}from"os";import*as Io from"os";var za=/^\d+$/,Gc=/^Microsoft.PowerShell_.*/,Xc=/^Microsoft.PowerShellPreview_.*/;var Kn;switch(process.arch){case"ia32":Kn=1;break;case"arm":case"arm64":Kn=2;break;default:Kn=0;break}var Yt;process.env.PROCESSOR_ARCHITEW6432?Yt=process.env.PROCESSOR_ARCHITEW6432==="ARM64"?2:0:process.env.PROCESSOR_ARCHITECTURE==="ARM64"?Yt=2:process.env.PROCESSOR_ARCHITECTURE==="X86"?Yt=1:Yt=0;var St=class{constructor(e,t,n){this.exePath=e;this.displayName=t;this.knownToExist=n}async exists(){return this.knownToExist===void 0&&(this.knownToExist=await ze.existsFile(this.exePath)),this.knownToExist}};function Qc({useAlternateBitness:r=!1}={}){return r?Kn===0?process.env["ProgramFiles(x86)"]||null:Yt===0&&process.env.ProgramW6432||null:process.env.ProgramFiles||null}async function Hr({useAlternateBitness:r=!1,findPreview:e=!1}={}){let t=Qc({useAlternateBitness:r});if(!t)return null;let n=O(t,"PowerShell");if(!await ze.existsDirectory(n))return null;let i=-1,o=null;for(let l of await Cn.readdir(n)){let u=-1;if(e){let c=l.indexOf("-");if(c<0)continue;let d=l.substring(0,c);if(!za.test(d)||l.substring(c+1)!=="preview")continue;u=parseInt(d,10)}else{if(!za.test(l))continue;u=parseInt(l,10)}if(u<=i)continue;let p=O(n,l,"pwsh.exe");await ze.existsFile(p)&&(o=p,i=u)}if(!o)return null;let s=t.includes("x86")?" (x86)":"",a=e?" Preview":"";return new St(o,`PowerShell${a}${s}`,!0)}async function Ha({findPreview:r}={}){if(!process.env.LOCALAPPDATA)return null;let e=O(process.env.LOCALAPPDATA,"Microsoft","WindowsApps");if(!await ze.existsDirectory(e))return null;let{pwshMsixDirRegex:t,pwshMsixName:n}=r?{pwshMsixDirRegex:Xc,pwshMsixName:"PowerShell Preview (Store)"}:{pwshMsixDirRegex:Gc,pwshMsixName:"PowerShell (Store)"};for(let i of await Cn.readdir(e))if(t.test(i)){let o=O(e,i,"pwsh.exe");return new St(o,n)}return null}function Yc(){let r=O(Io.homedir(),".dotnet","tools","pwsh.exe");return new St(r,".NET Core PowerShell Global Tool")}function Jc(){let r=O(Io.homedir(),"scoop","apps"),e=O(r,"pwsh","current","pwsh.exe");return new St(e,"PowerShell (Scoop)")}function Zc(){let r=O(process.env.windir,Kn===1&&Yt!==1?"SysNative":"System32","WindowsPowerShell","v1.0","powershell.exe");return new St(r,"Windows PowerShell",!0)}async function*ed(){let r=await Hr();r&&(yield r),r=await Hr({useAlternateBitness:!0}),r&&(yield r),r=await Ha(),r&&(yield r),r=Yc(),r&&(yield r),r=await Hr({findPreview:!0}),r&&(yield r),r=await Ha({findPreview:!0}),r&&(yield r),r=await Hr({useAlternateBitness:!0,findPreview:!0}),r&&(yield r),r=await Jc(),r&&(yield r),r=Zc(),r&&(yield r)}async function*td(){for await(let r of ed())await r.exists()&&(yield r)}async function ja(){for await(let r of td())return r;return null}async function Ga(r,e){return r===1?w?od():ya(e):id(r,e)}var To=null;function id(r,e){if(Ae&&r===2||be&&r===3)return"/bin/bash";if(!To){let t;if(w)t="/bin/bash";else{if(t=e.SHELL,!t)try{t=rd().shell}catch{}t||(t="sh"),t==="/bin/false"&&(t="/bin/bash")}To=t}return To}var Eo=null;async function od(){return Eo||(Eo=(await ja()).exePath),Eo}var Jt=class extends C{constructor(t,n){super();this._logService=n;this._lastRequestId=0;this._pendingRequests=new Map;this._pendingRequestDisposables=new Map;this._onCreateRequest=this._register(new y);this.onCreateRequest=this._onCreateRequest.event;this._timeout=t===void 0?15e3:t,this._register(Q(()=>{for(let i of this._pendingRequestDisposables.values())Pe(i)}))}createRequest(t){return new Promise((n,i)=>{let o=++this._lastRequestId;this._pendingRequests.set(o,n),this._onCreateRequest.fire({requestId:o,...t});let s=new Oe;fe(this._timeout,s.token).then(()=>i(`Request ${o} timed out (${this._timeout}ms)`)),this._pendingRequestDisposables.set(o,[Q(()=>s.cancel())])})}acceptReply(t,n){let i=this._pendingRequests.get(t);i?(this._pendingRequests.delete(t),Pe(this._pendingRequestDisposables.get(t)||[]),this._pendingRequestDisposables.delete(t),i(n)):this._logService.warn(`RequestStore#acceptReply was called without receiving a matching request ${t}`)}};Jt=h([ye(1,Se)],Jt);var jr=class{constructor(e){this._callback=e;this._terminalBufferMap=new Map}dispose(){for(let e of this._terminalBufferMap.values())e.dispose()}startBuffering(e,t,n=5){let i=t(o=>{let s=G(o)?o:o.data,a=this._terminalBufferMap.get(e);if(a){a.data.push(s);return}let l=setTimeout(()=>this.flushBuffer(e),n);a={data:[s],timeoutId:l,dispose:()=>{clearTimeout(l),this.flushBuffer(e),i.dispose()}},this._terminalBufferMap.set(e,a)});return i}stopBuffering(e){this._terminalBufferMap.get(e)?.dispose()}flushBuffer(e){let t=this._terminalBufferMap.get(e);t&&(this._terminalBufferMap.delete(e),this._callback(e,t.data.join("")))}};function Qa(r,e){let t=r;t.includes("\\")&&(t=t.replace(/\\/g,"\\\\"));let n;switch(e){case"bash":case"sh":case"zsh":case"gitbash":n={bothQuotes:o=>`$'${o.replace(/'/g,"\\'")}'`,singleQuotes:o=>`'${o.replace(/'/g,"\\'")}'`,noSingleQuotes:o=>`'${o}'`};break;case"fish":n={bothQuotes:o=>`"${o.replace(/"/g,'\\"')}"`,singleQuotes:o=>`'${o.replace(/'/g,"\\'")}'`,noSingleQuotes:o=>`'${o}'`};break;case"pwsh":n={bothQuotes:o=>`"${o.replace(/"/g,'`"')}"`,singleQuotes:o=>`'${o.replace(/'/g,"''")}'`,noSingleQuotes:o=>`'${o}'`};break;default:n={bothQuotes:o=>`$'${o.replace(/'/g,"\\'")}'`,singleQuotes:o=>`'${o.replace(/'/g,"\\'")}'`,noSingleQuotes:o=>`'${o}'`};break}let i=/[\`\$\|\&\>\~\#\!\^\*\;\<]/g;return t=t.replace(i,""),t.includes("'")&&t.includes('"')?n.bothQuotes(t):t.includes("'")?n.singleQuotes(t):n.noSingleQuotes(t)}function Ya(r){return r.match(/^['"].*['"]$/)&&(r=r.substring(1,r.length-1)),rr===1&&r&&r[1]===":"?r[0].toUpperCase()+r.substring(1):r}import*as en from"os";function ad(r){return new Map(r)}function ld(r){return new Map(r??[])}function Ja(r){return new Map(r.map(e=>[e[0],{map:ad(e[1]),descriptionMap:ld(e[2])}]))}var cd=new Map([[2,"APPEND"],[3,"PREPEND"],[1,"REPLACE"]]),dd=/^VSCODE_PYTHON_(PWSH|ZSH|BASH|FISH)_ACTIVATE/,pd="ms-python.vscode-python-envs",Gr=class{constructor(e){this.collections=e;this.map=new Map;this.descriptionMap=new Map;e.forEach((t,n)=>{this.populateDescriptionMap(t,n);let i=t.map.entries(),o=i.next();for(;!o.done;){let s=o.value[1],a=o.value[0];if(this.blockPythonActivationVar(a,n)){o=i.next();continue}let l=this.map.get(a);if(l||(l=[],this.map.set(a,l)),l.length>0&&l[0].type===1){o=i.next();continue}let u={extensionIdentifier:n,value:s.value,type:s.type,scope:s.scope,variable:s.variable,options:s.options};u.scope||delete u.scope,l.unshift(u),o=i.next()}})}async applyToProcessEnvironment(e,t,n){let i;w&&(i={},Object.keys(e).forEach(o=>i[o.toLowerCase()]=o));for(let[o,s]of this.getVariableMap(t)){let a=w&&i[o.toLowerCase()]||o;for(let l of s){let u=n?await n(l.value):l.value;if(!this.blockPythonActivationVar(l.variable,l.extensionIdentifier)){if(l.options?.applyAtProcessCreation??!0)switch(l.type){case 2:e[a]=(e[a]||"")+u;break;case 3:e[a]=u+(e[a]||"");break;case 1:e[a]=u;break}if(l.options?.applyAtShellIntegration??!1){let p=`VSCODE_ENV_${cd.get(l.type)}`;e[p]=(e[p]?e[p]+":":"")+o+"="+this._encodeColons(u)}}}}}_encodeColons(e){return e.replaceAll(":","\\x3a")}blockPythonActivationVar(e,t){return!!(dd.test(e)&&pd!==t)}diff(e,t){let n=new Map,i=new Map,o=new Map;if(e.getVariableMap(t).forEach((s,a)=>{let l=this.getVariableMap(t).get(a),u=el(s,l);u&&n.set(a,u)}),this.getVariableMap(t).forEach((s,a)=>{let l=e.getVariableMap(t).get(a),u=el(s,l);u&&o.set(a,u)}),this.getVariableMap(t).forEach((s,a)=>{let l=e.getVariableMap(t).get(a),u=md(s,l);u&&i.set(a,u)}),!(n.size===0&&i.size===0&&o.size===0))return{added:n,changed:i,removed:o}}getVariableMap(e){let t=new Map;for(let n of this.map.values()){let i=n.filter(o=>Za(o,e));i.length>0&&t.set(i[0].variable,i)}return t}getDescriptionMap(e){let t=new Map;for(let n of this.descriptionMap.values()){let i=n.filter(o=>Za(o,e,!0));for(let o of i)t.set(o.extensionIdentifier,o.description)}return t}populateDescriptionMap(e,t){if(!e.descriptionMap)return;let n=e.descriptionMap.entries(),i=n.next();for(;!i.done;){let o=i.value[1],s=i.value[0],a=this.descriptionMap.get(s);a||(a=[],this.descriptionMap.set(s,a));let l={extensionIdentifier:t,scope:o.scope,description:o.description};l.scope||delete l.scope,a.push(l),i=n.next()}}};function Za(r,e,t=!1){return r.scope?!!(r.scope.workspaceFolder&&e?.workspaceFolder&&r.scope.workspaceFolder.index===e.workspaceFolder.index):t?e===r.scope:!0}function el(r,e){if(!e)return r;let t=new Set;e.forEach(i=>t.add(i.extensionIdentifier));let n=[];return r.forEach(i=>{t.has(i.extensionIdentifier)||n.push(i)}),n.length===0?void 0:n}function md(r,e){if(!e)return;let t=new Map;e.forEach(i=>t.set(i.extensionIdentifier,i));let n=[];return r.forEach(i=>{let o=t.get(i.extensionIdentifier);o&&(i.type!==o.type||i.value!==o.value||i.scope?.workspaceFolder?.index!==o.scope?.workspaceFolder?.index)&&n.push(o)}),n.length===0?void 0:n}import{chmod as nl,realpathSync as hd,mkdirSync as gd}from"fs";import{promisify as rl}from"util";import*as Xr from"os";var Pt;async function fd(){if(Pt)return;if(!w){Pt={release:Xr.release(),buildNumber:0};return}let r,e;try{let t=await import("@vscode/windows-registry"),n="SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion",i=t.GetStringRegKey("HKEY_LOCAL_MACHINE",n,"CurrentBuild");i!==void 0&&(r=parseInt(i,10),isNaN(r)&&(r=void 0));let o=t.GetDWORDRegKey("HKEY_LOCAL_MACHINE",n,"CurrentMajorVersionNumber"),s=t.GetDWORDRegKey("HKEY_LOCAL_MACHINE",n,"CurrentMinorVersionNumber");o!==void 0&&s!==void 0&&i!==void 0&&(e=`${o}.${s}.${i}`)}catch{}finally{Pt={release:e||Xr.release(),buildNumber:r||tl()}}}async function Zt(){return Pt||await fd(),Pt.buildNumber}function So(){return Pt?Pt.buildNumber:w?tl():0}function tl(){let r=/(\d+)\.(\d+)\.(\d+)/g.exec(Xr.release());return r&&r.length===4?parseInt(r[3],10):0}async function al(r,e,t,n,i,o=!1){if(!e.shellIntegration.enabled)return{type:"failure",reason:"injectionSettingDisabled"};if(!r.executable)return{type:"failure",reason:"noExecutable"};if(r.isFeatureTerminal&&!r.forceShellIntegration)return{type:"failure",reason:"featureTerminal"};if(r.ignoreShellIntegration)return{type:"failure",reason:"ignoreShellIntegrationFlag"};let s=w?await Zt():0;if(w&&s<18309)return{type:"failure",reason:"unsupportedWindowsBuild"};let a=r.args,l=ir==="win32"?yt(r.executable).toLowerCase():yt(r.executable),u=$e.asFileUri("vs/workbench/contrib/terminal/common/scripts").fsPath,p="injection",c,d={VSCODE_INJECTION:"1"};e.shellIntegration.nonce&&(d.VSCODE_NONCE=e.shellIntegration.nonce);let m=["PATH","VIRTUAL_ENV","HOME","SHELL","PWD"];if(r.shellIntegrationEnvironmentReporting&&(w?(e.windowsUseConptyDll||s>=22631&&l!=="bash.exe")&&(d.VSCODE_SHELL_ENV_REPORTING=m.join(",")):d.VSCODE_SHELL_ENV_REPORTING=m.join(",")),w)return l==="pwsh.exe"||l==="powershell.exe"?(d.VSCODE_A11Y_MODE=e.isScreenReaderOptimized?"1":"0",!a||sl(a)?c=Y.get("windows-pwsh"):ol(a)&&(c=Y.get("windows-pwsh-login")),c?(c=[...c],c[c.length-1]=_t(c[c.length-1],u,""),d.VSCODE_STABLE=i.quality==="stable"?"1":"0",{type:p,newArgs:c,envMixin:d}):{type:"failure",reason:"unsupportedArgs"}):l==="bash.exe"?(!a||a.length===0?c=Y.get("bash"):Jr(a)&&(d.VSCODE_SHELL_LOGIN="1",Qr(e,d,l),c=Y.get("bash")),c?(c=[...c],c[c.length-1]=_t(c[c.length-1],u),d.VSCODE_STABLE=i.quality==="stable"?"1":"0",{type:p,newArgs:c,envMixin:d}):{type:"failure",reason:"unsupportedArgs"}):(n.warn(`Shell integration cannot be enabled for executable "${r.executable}" and args`,r.args),{type:"failure",reason:"unsupportedShell"});switch(l){case"bash":return!a||a.length===0?c=Y.get("bash"):Jr(a)&&(d.VSCODE_SHELL_LOGIN="1",Qr(e,d,l),c=Y.get("bash")),c?(c=[...c],c[c.length-1]=_t(c[c.length-1],u),d.VSCODE_STABLE=i.quality==="stable"?"1":"0",{type:p,newArgs:c,envMixin:d}):{type:"failure",reason:"unsupportedArgs"};case"fish":return!a||a.length===0?c=Y.get("fish"):Jr(a)?c=Y.get("fish-login"):(a===Y.get("fish")||a===Y.get("fish-login"))&&(c=a),c?(Qr(e,d,l),c=[...c],c[c.length-1]=_t(c[c.length-1],u),{type:p,newArgs:c,envMixin:d}):{type:"failure",reason:"unsupportedArgs"};case"pwsh":return!a||sl(a)?c=Y.get("pwsh"):ol(a)&&(c=Y.get("pwsh-login")),c?(c=[...c],c[c.length-1]=_t(c[c.length-1],u,""),d.VSCODE_STABLE=i.quality==="stable"?"1":"0",{type:p,newArgs:c,envMixin:d}):{type:"failure",reason:"unsupportedArgs"};case"zsh":{if(!a||a.length===0?c=Y.get("zsh"):Jr(a)?(c=Y.get("zsh-login"),Qr(e,d,l)):(a===Y.get("zsh")||a===Y.get("zsh-login"))&&(c=a),!c)return{type:"failure",reason:"unsupportedArgs"};c=[...c],c[c.length-1]=_t(c[c.length-1],u);let f;try{f=en.userInfo().username}catch{f="unknown"}let b=hd(en.tmpdir()),E=O(b,`${f}-${i.applicationName}-zsh`);if(!o)try{await rl(nl)(E,960)}catch(B){if(!B.message.includes("ENOENT"))return n.error(`Failed to set sticky bit on ${E}: ${B}`),{type:"failure",reason:"failedToSetStickyBit"};try{gd(E,{recursive:!0})}catch(ge){return n.error(`Failed to create zdotdir at ${E}: ${ge}`),{type:"failure",reason:"failedToCreateTmpDir"}}try{await rl(nl)(E,960)}catch(ge){return n.error(`Failed to set sticky bit on ${E}: ${ge}`),{type:"failure",reason:"failedToSetStickyBit"}}}d.ZDOTDIR=E;let q=t?.ZDOTDIR??en.homedir()??"~";d.USER_ZDOTDIR=q;let H=[];return H.push({source:O(u,"shellIntegration-rc.zsh"),dest:O(E,".zshrc")}),H.push({source:O(u,"shellIntegration-profile.zsh"),dest:O(E,".zprofile")}),H.push({source:O(u,"shellIntegration-env.zsh"),dest:O(E,".zshenv")}),H.push({source:O(u,"shellIntegration-login.zsh"),dest:O(E,".zlogin")}),{type:p,newArgs:c,envMixin:d,filesToCopy:H}}}return n.warn(`Shell integration cannot be enabled for executable "${r.executable}" and args`,r.args),{type:"failure",reason:"unsupportedShell"}}function Qr(r,e,t){if((be||t==="fish")&&r.environmentVariableCollections){let n=Ja(r.environmentVariableCollections),o=new Gr(n).getVariableMap({workspaceFolder:r.workspaceFolder}).get("PATH"),s=[];if(o)for(let a of o)a.type===3&&s.push(a.value);s.length>0&&(e.VSCODE_PATH_PREFIX=s.join(""))}}var Y=new Map;Y.set("windows-pwsh",["-noexit","-command",'try { . "{0}\\shellIntegration.ps1" } catch {}{1}']);Y.set("windows-pwsh-login",["-l","-noexit","-command",'try { . "{0}\\shellIntegration.ps1" } catch {}{1}']);Y.set("pwsh",["-noexit","-command",'. "{0}/shellIntegration.ps1"{1}']);Y.set("pwsh-login",["-l","-noexit","-command",'. "{0}/shellIntegration.ps1"']);Y.set("zsh",["-i"]);Y.set("zsh-login",["-il"]);Y.set("bash",["--init-file","{0}/shellIntegration-bash.sh"]);Y.set("fish",["--init-command",'source "{0}/shellIntegration.fish"']);Y.set("fish-login",["-l","--init-command",'source "{0}/shellIntegration.fish"']);var Yr=["-login","-l"],il=["--login","-l"],yd=["-i","--interactive"],Zr=["-nol","-nologo"];function ol(r){return G(r)?Yr.includes(r.toLowerCase()):r.length===1&&Yr.includes(r[0].toLowerCase())||r.length===2&&(Yr.includes(r[0].toLowerCase())||Yr.includes(r[1].toLowerCase()))&&(Zr.includes(r[0].toLowerCase())||Zr.includes(r[1].toLowerCase()))}function sl(r){return G(r)?Zr.includes(r.toLowerCase()):r.length===0||r?.length===1&&Zr.includes(r[0].toLowerCase())}function Jr(r){return G(r)||(r=r.filter(e=>!yd.includes(e.toLowerCase()))),G(r)&&il.includes(r.toLowerCase())||!G(r)&&r.length===1&&il.includes(r[0].toLowerCase())}var vd=/^(?:.*_)?(?:API_?KEY|TOKEN|SECRET|PASSWORD|PASSWD|PWD|CREDENTIAL|AUTH|PRIVATE_?KEY|ACCESS_?KEY|CLIENT_?SECRET|APIKEY)(?:_.*)?$/i,bd=[/^eyJ[a-zA-Z0-9\-_]+\.[a-zA-Z0-9\-_]+\.[a-zA-Z0-9\-_]+$/,/^gh[psuro]_[a-zA-Z0-9]{36}$/,/^github_pat_[a-zA-Z0-9]{22}_[a-zA-Z0-9]{59}$/,/^AIza[A-Za-z0-9_\-]{35}$/,/^xox[pbar]\-[A-Za-z0-9\-]+$/,/^[a-zA-Z0-9]{32,}$/];function Wn(r){if(!r)return r;let e={};for(let t of Object.keys(r)){let n=r[t];if(n===void 0)continue;if(vd.test(t)){e[t]="<REDACTED>";continue}let i=!1;for(let o of bd)if(o.test(n)){i=!0;break}e[t]=i?"<REDACTED>":n}return e}import*as tn from"fs";import{exec as Sd}from"child_process";var ll=Te("productService");import{exec as ei}from"child_process";import{totalmem as _d}from"os";var xd=/[a-zA-Z-]+\.js\b/g;function cl(r){return new Promise((e,t)=>{let n,i=new Map,o=_d();function s(l,u,p,c,d){let m=i.get(u);if(l===r||m){let f={name:a(p),cmd:p,pid:l,ppid:u,load:c,mem:w?d:o*(d/100)};i.set(l,f),l===r&&(n=f),m&&(m.children||(m.children=[]),m.children.push(f),m.children.length>1&&(m.children=m.children.sort((b,E)=>b.pid-E.pid)))}}function a(l){let u=/--utility-sub-type=network/i,p=/--crashes-directory/i,c=/conhost\.exe.+--headless/i,d=/--type=([a-zA-Z-]+)/;if(p.exec(l))return"electron-crash-reporter";if(c.exec(l))return"conpty-agent";let m=d.exec(l);if(m&&m.length===2)return m[1]==="renderer"?"window":m[1]==="utility"?u.exec(l)?"utility-network-service":"utility-process":m[1]==="extensionHost"?"extension-host":m[1];if(l.indexOf("node ")<0&&l.indexOf("node.exe")<0){let f="";do m=xd.exec(l),m&&(f+=m+" ");while(m);if(f)return`electron-nodejs (${f.trim()})`}return l}if(process.platform==="win32"){let l=u=>u.indexOf("\\\\?\\")===0||u.indexOf("\\??\\")===0?u.substring(4):u.indexOf('"\\\\?\\')===0||u.indexOf('"\\??\\')===0?'"'+u.substring(5):u;import("@vscode/windows-process-tree").then(u=>{u.getProcessList(r,p=>{if(!p){t(new Error(`Root process ${r} not found`));return}u.getProcessCpuUsage(p,c=>{let d=new Map;c.forEach(m=>{let f=l(m.commandLine||"");d.set(m.pid,{name:a(f),cmd:f,pid:m.pid,ppid:m.ppid,load:m.cpu||0,mem:m.memory||0})}),n=d.get(r),n?(d.forEach(m=>{let f=d.get(m.ppid);f&&(f.children||(f.children=[]),f.children.push(m))}),d.forEach(m=>{m.children&&(m.children=m.children.sort((f,b)=>f.pid-b.pid))}),e(n)):t(new Error(`Root process ${r} not found`))})},u.ProcessDataFlag.CommandLine|u.ProcessDataFlag.Memory)})}else{let l=function(){let u=[n],p=[];for(;u.length;){let d=u.shift();d&&(p.push(d.pid),d.children&&(u=u.concat(d.children)))}let c=JSON.stringify($e.asFileUri("vs/base/node/cpuUsage.sh").fsPath);c+=" "+p.join(" "),ei(c,{},(d,m,f)=>{if(d||f)t(d||new Error(f.toString()));else{let b=m.toString().split(`
`);for(let E=0;E<p.length;E++){let q=i.get(p[E]);q.load=parseFloat(b[E])}if(!n){t(new Error(`Root process ${r} not found`));return}e(n)}})};ei("which ps",{},(u,p,c)=>{if(u||c)if(process.platform!=="linux")t(u||new Error(c.toString()));else{let d=JSON.stringify($e.asFileUri("vs/base/node/ps.sh").fsPath);ei(d,{},(m,f,b)=>{m||b?t(m||new Error(b.toString())):(ul(f,s),l())})}else{let d=p.toString().trim();ei(`${d} -ax -o pid=,ppid=,pcpu=,pmem=,command=`,{maxBuffer:1e3*1024,env:{LC_NUMERIC:"en_US.UTF-8"}},(f,b,E)=>{f||E&&!E.includes("screen size is bogus")?t(f||new Error(E.toString())):(ul(b,s),process.platform==="linux"?l():n?e(n):t(new Error(`Root process ${r} not found`)))})}})}})}function ul(r,e){let t=/^\s*([0-9]+)\s+([0-9]+)\s+([0-9]+\.[0-9]+)\s+([0-9]+\.[0-9]+)\s+(.+)$/,n=r.toString().split(`
`);for(let i of n){let o=t.exec(i.trim());o&&o.length===6&&e(parseInt(o[1]),parseInt(o[2]),o[5],parseFloat(o[3]),parseFloat(o[4]))}}var ti=[],rt=class extends C{constructor(t,n){super();this._pid=t;this._logService=n;this._hasChildProcesses=!1;this._onDidChangeHasChildProcesses=this._register(new y);this.onDidChangeHasChildProcesses=this._onDidChangeHasChildProcesses.event}set hasChildProcesses(t){this._hasChildProcesses!==t&&(this._hasChildProcesses=t,this._logService.debug("ChildProcessMonitor: Has child processes changed",t),this._onDidChangeHasChildProcesses.fire(t))}get hasChildProcesses(){return this._hasChildProcesses}setPid(t){this._pid=t}handleInput(){this._refreshActive()}handleOutput(){this._refreshInactive()}async _refreshActive(){if(!this._store.isDisposed)try{let t=await cl(this._pid);this.hasChildProcesses=this._processContainsChildren(t)}catch(t){this._logService.debug("ChildProcessMonitor: Fetching process tree failed",t)}}_refreshInactive(){this._refreshActive()}_processContainsChildren(t){if(!t.children)return!1;if(t.children.length===1){let n=t.children[0],i;if(n.cmd.startsWith('"'))i=n.cmd.substring(1,n.cmd.indexOf('"',1));else{let o=n.cmd.indexOf(" ");o===-1?i=n.cmd:i=n.cmd.substring(0,o)}return ti.indexOf(Ss(i).name)===-1}return t.children.length>0}};h([Wt(1e3)],rt.prototype,"_refreshActive",1),h([xr(5e3)],rt.prototype,"_refreshInactive",1),rt=h([ye(1,Se)],rt);var Id=["cmd.exe","powershell.exe","pwsh.exe","bash.exe","git-cmd.exe","wsl.exe","ubuntu.exe","ubuntu1804.exe","kali.exe","debian.exe","opensuse-42.exe","sles-12.exe","julia.exe","nu.exe","node.exe","xonsh.exe"],Td=[/^python(\d(\.\d{0,2})?)?\.exe$/],Ed=[{regex:/[\\/]claude-code[\\/]/i,executable:"claude.exe"},{regex:/[\\/]codex[\\/]/i,executable:"codex.exe"},{regex:/[\\/]command-code[\\/]/i,executable:"commandcode.exe"},{regex:/[\\/]copilot[\\/]/i,executable:"copilot.exe"},{regex:/[\\/]gemini-cli[\\/]/i,executable:"gemini.exe"}],ni,$n=class extends C{constructor(t){super();this._rootProcessId=t;this._shellTitle="";this._onShellNameChanged=this._register(new y);this._onShellTypeChanged=this._register(new y);if(!w)throw new Error(`WindowsShellHelper cannot be instantiated on ${bs}`);this._startMonitoringShell()}get shellType(){return this._shellType}get shellTitle(){return this._shellTitle}get onShellNameChanged(){return this._onShellNameChanged.event}get onShellTypeChanged(){return this._onShellTypeChanged.event}async _startMonitoringShell(){this._store.isDisposed||this.checkShell()}async checkShell(){w&&(await fe(300),this.getShellName().then(t=>{let n=this.getShellType(t);n!==this._shellType&&(this._onShellTypeChanged.fire(n),this._onShellNameChanged.fire(t),this._shellType=n,this._shellTitle=t)}))}traverseTree(t){if(!t)return"";if(t.name==="node.exe"&&t.commandLine){for(let{regex:i,executable:o}of Ed)if(i.test(t.commandLine))return o}if(Id.indexOf(t.name)===-1)return t.name;for(let i of Td)if(t.name.match(i))return t.name;if(!t.children||t.children.length===0)return t.name;let n=0;for(;n<t.children.length;n++){let i=t.children[n];if(!i.children||i.children.length===0||i.children[0].name!=="conhost.exe")break}return n>=t.children.length?t.name:this.traverseTree(t.children[n])}async getShellName(){return this._store.isDisposed?Promise.resolve(""):this._currentRequest?this._currentRequest:(ni||(ni=await import("@vscode/windows-process-tree")),this._currentRequest=new Promise(t=>{ni.getProcessTree(this._rootProcessId,n=>{let i=this.traverseTree(n);this._currentRequest=void 0,t(i)},ni.ProcessDataFlag.CommandLine)}),this._currentRequest)}getShellType(t){switch(t.toLowerCase()){case"cmd.exe":return"cmd";case"powershell.exe":case"pwsh.exe":return"pwsh";case"bash.exe":case"git-cmd.exe":return"gitbash";case"julia.exe":return"julia";case"node.exe":return"node";case"nu.exe":return"nu";case"xonsh.exe":return"xonsh";case"claude.exe":return"claude";case"codex.exe":return"codex";case"commandcode.exe":return"commandcode";case"copilot.exe":return"copilot";case"gemini.exe":return"gemini";case"wsl.exe":case"ubuntu.exe":case"ubuntu1804.exe":case"kali.exe":case"debian.exe":case"opensuse-42.exe":case"sles-12.exe":return"wsl";default:return t.match(/python(\d(\.\d{0,2})?)?\.exe/)?"python":void 0}}};h([Wt(500)],$n.prototype,"checkShell",1);import{spawn as Pd}from"node-pty";var dl=new Map([["bash","bash"],["csh","csh"],["fish","fish"],["ksh","ksh"],["sh","sh"],["zsh","zsh"]]),pl=new Map([["claude","claude"],["codex","codex"],["commandcode","commandcode"],["copilot","copilot"],["gemini","gemini"],["pwsh","pwsh"],["powershell","pwsh"],["python","python"],["julia","julia"],["nu","nu"],["node","node"],["xonsh","xonsh"]]),Me=class extends C{constructor(t,n,i,o,s,a,l,u,p){super();this.shellLaunchConfig=t;this._executableEnv=a;this._options=l;this._logService=u;this._productService=p;this.id=0;this.shouldPersist=!1;this._properties={cwd:"",initialCwd:"",fixedDimensions:{cols:void 0,rows:void 0},title:"",shellType:void 0,hasChildProcesses:!0,resolvedShellLaunchConfig:{},overrideDimensions:void 0,failedShellIntegrationActivation:!1,usedShellIntegrationInjection:void 0,shellIntegrationInjectionFailureReason:void 0};this._currentTitle="";this._isPtyPaused=!1;this._unacknowledgedCharCount=0;this._onProcessData=this._register(new y);this.onProcessData=this._onProcessData.event;this._onProcessReady=this._register(new y);this.onProcessReady=this._onProcessReady.event;this._onDidChangeProperty=this._register(new y);this.onDidChangeProperty=this._onDidChangeProperty.event;this._onProcessExit=this._register(new y);this.onProcessExit=this._onProcessExit.event;let c;w?c=yt(this.shellLaunchConfig.executable||""):c="xterm-256color",this._initialCwd=n,this._properties.initialCwd=this._initialCwd,this._properties.cwd=this._initialCwd;let d=process.platform==="win32"&&So()>=18309,m=d&&this._options.windowsUseConptyDll;this._ptyOptions={name:c,cwd:n,env:s,cols:i,rows:o,useConpty:d,useConptyDll:m,conptyInheritCursor:d&&!!t.initialText},w&&(d&&i===0&&o===0&&this.shellLaunchConfig.executable?.endsWith("Git\\bin\\bash.exe")&&(this._delayedResizer=this._register(new Po),this._register(this._delayedResizer.onTrigger(f=>{this._delayedResizer?.dispose(),this._delayedResizer=void 0,f.cols&&f.rows&&this.resize(f.cols,f.rows)}))),this._register(this.onProcessReady(f=>{this._windowsShellHelper=this._register(new $n(f.pid)),this._register(this._windowsShellHelper.onShellTypeChanged(b=>this._onDidChangeProperty.fire({type:"shellType",value:b}))),this._register(this._windowsShellHelper.onShellNameChanged(b=>this._onDidChangeProperty.fire({type:"title",value:b})))}))),this._register(Q(()=>{this._titleInterval&&(clearInterval(this._titleInterval),this._titleInterval=void 0)})),this._register(Q(()=>{this._ptyProcess=void 0,this._processStartupComplete=void 0}))}static{this._lastKillOrStart=0}get exitMessage(){return this._exitMessage}get currentTitle(){return this._windowsShellHelper?.shellTitle||this._currentTitle}get shellType(){return w?this._windowsShellHelper?.shellType:dl.get(this._currentTitle)||pl.get(this._currentTitle)}get hasChildProcesses(){return this._childProcessMonitor?.hasChildProcesses||!1}async start(){let n=(await Promise.all([this._validateCwd(),this._validateExecutable()])).find(o=>o!==void 0);if(n)return n;let i=await al(this.shellLaunchConfig,this._options,this._ptyOptions.env,this._logService,this._productService);if(i.type==="injection"){if(this._onDidChangeProperty.fire({type:"usedShellIntegrationInjection",value:!0}),i.envMixin)for(let[o,s]of Object.entries(i.envMixin))this._ptyOptions.env||={},this._ptyOptions.env[o]=s;if(i.filesToCopy)for(let o of i.filesToCopy)try{await tn.promises.mkdir(Ke(o.dest),{recursive:!0}),await tn.promises.copyFile(o.source,o.dest)}catch{}}else this._onDidChangeProperty.fire({type:"failedShellIntegrationActivation",value:!0}),this._onDidChangeProperty.fire({type:"shellIntegrationInjectionFailureReason",value:i.reason}),this._options.shellIntegration.nonce&&(this._ptyOptions.env||={},this._ptyOptions.env.VSCODE_NONCE=this._options.shellIntegration.nonce);try{let o=i.type==="injection"?i:void 0;return await this.setupPtyProcess(this.shellLaunchConfig,this._ptyOptions,o),o?.newArgs?{injectedArgs:o.newArgs}:void 0}catch(o){this._logService.trace("node-pty.node-pty.IPty#spawn native exception",o);let s=o.message;return s?.includes("Cannot launch conpty")?{message:g(3102,null,"https://code.visualstudio.com/updates/v1_109#_removal-of-winpty-support","terminal.integrated.windowsUseConptyDll")}:{message:`A native exception occurred during launch (${s})`}}}async _validateCwd(){try{if(!(await tn.promises.stat(this._initialCwd)).isDirectory())return{message:g(3104,null,this._initialCwd.toString())}}catch(t){if(t?.code==="ENOENT")return{message:g(3103,null,this._initialCwd.toString())}}this._onDidChangeProperty.fire({type:"initialCwd",value:this._initialCwd})}async _validateExecutable(){let t=this.shellLaunchConfig;if(!t.executable)throw new Error("IShellLaunchConfig.executable not set");let n=t.cwd instanceof A?t.cwd.path:t.cwd,i=t.env&&t.env.PATH?t.env.PATH.split(lr):void 0,o=await va(t.executable,n,i,this._executableEnv);if(!o)return{message:g(3105,null,t.executable)};try{let s=await tn.promises.stat(o);if(!s.isFile()&&!s.isSymbolicLink())return{message:g(3106,null,t.executable)};t.executable=o}catch(s){if(s?.code!=="EACCES")throw s}}async setupPtyProcess(t,n,i){let o=i?.newArgs||t.args||[];await this._throttleKillSpawn();let s={...n,env:Wn(n.env)};this._logService.trace("node-pty.IPty#spawn",t.executable,o,s);let a=Pd(t.executable,o,n);if(this._ptyProcess=a,this._childProcessMonitor=this._register(new rt(a.pid,this._logService)),this._register(this._childProcessMonitor.onDidChangeHasChildProcesses(l=>this._onDidChangeProperty.fire({type:"hasChildProcesses",value:l}))),this._processStartupComplete=new Promise(l=>{this._register(this.onProcessReady(()=>l()))}),this._register(a.onData(l=>{this._unacknowledgedCharCount+=l.length,!this._isPtyPaused&&this._unacknowledgedCharCount>1e5&&(this._logService.trace(`Flow control: Pause (${this._unacknowledgedCharCount} > 100000)`),this._isPtyPaused=!0,a.pause()),this._logService.trace("node-pty.IPty#onData",l),this._onProcessData.fire(l),this._closeTimeout&&this._queueProcessExit(),this._windowsShellHelper?.checkShell(),this._childProcessMonitor?.handleOutput()})),this._register(a.onExit(l=>{this._exitCode=l.exitCode,this._queueProcessExit()})),a.pid>0)this._sendProcessId(a.pid);else{let l=a.onData(()=>{l.dispose(),this._childProcessMonitor?.setPid(a.pid),this._sendProcessId(a.pid)});this._register(l)}this._setupTitlePolling(a)}_setupTitlePolling(t){setTimeout(()=>this._sendProcessTitle(t)),w||(this._titleInterval=setInterval(()=>{this._currentTitle!==t.process&&this._sendProcessTitle(t)},200))}_queueProcessExit(){this._logService.getLevel()===1&&this._logService.trace("TerminalProcess#_queueProcessExit",new Error().stack?.replace(/^Error/,"")),this._closeTimeout&&clearTimeout(this._closeTimeout),this._closeTimeout=setTimeout(()=>{this._closeTimeout=void 0,this._kill()},250)}async _kill(){if(await this._processStartupComplete,!this._store.isDisposed){try{this._ptyProcess&&(await this._throttleKillSpawn(),this._logService.trace("node-pty.IPty#kill"),this._ptyProcess.kill())}catch{}this._onProcessExit.fire(this._exitCode||0),this.dispose()}}async _throttleKillSpawn(){if(!(!w||!Cd(this._ptyOptions)||!this._ptyOptions.useConpty)&&!this._ptyOptions.useConptyDll){for(;Date.now()-Me._lastKillOrStart<250;)this._logService.trace("Throttling kill/spawn call"),await fe(250-(Date.now()-Me._lastKillOrStart)+50);Me._lastKillOrStart=Date.now()}}_sendProcessId(t){this._onProcessReady.fire({pid:t,cwd:this._initialCwd,windowsPty:this.getWindowsPty()})}_sendProcessTitle(t){if(this._store.isDisposed)return;this._currentTitle=t.process??"",this._onDidChangeProperty.fire({type:"title",value:this._currentTitle});let n=this.currentTitle.replace(/ \(figterm\)$/g,"");if(w||(n=yt(n)),n.toLowerCase().startsWith("python"))this._onDidChangeProperty.fire({type:"shellType",value:"python"});else if(n.toLowerCase().startsWith("julia"))this._onDidChangeProperty.fire({type:"shellType",value:"julia"});else{let i=dl.get(n)||pl.get(n);this._onDidChangeProperty.fire({type:"shellType",value:i})}}shutdown(t){this._logService.getLevel()===1&&this._logService.trace("TerminalProcess#shutdown",new Error().stack?.replace(/^Error/,"")),t&&!w?this._kill():!this._closeTimeout&&!this._store.isDisposed&&(this._queueProcessExit(),setTimeout(()=>{this._closeTimeout&&!this._store.isDisposed&&(this._closeTimeout=void 0,this._kill())},5e3))}input(t,n=!1){this._logService.trace("node-pty.IPty#write",t,n),n?this._ptyProcess.write(Buffer.from(t,"binary")):this._ptyProcess.write(t),this._childProcessMonitor?.handleInput()}sendSignal(t){this._store.isDisposed||!this._ptyProcess||this._ptyProcess.kill(t)}async processBinary(t){this.input(t,!0)}async refreshProperty(t){switch(t){case"cwd":{let n=await this.getCwd();return n!==this._properties.cwd&&(this._properties.cwd=n,this._onDidChangeProperty.fire({type:"cwd",value:this._properties.cwd})),n}case"initialCwd":{let n=await this.getInitialCwd();return n!==this._properties.initialCwd&&(this._properties.initialCwd=n,this._onDidChangeProperty.fire({type:"initialCwd",value:this._properties.initialCwd})),n}case"title":return this.currentTitle;default:return this.shellType}}async updateProperty(t,n){t==="fixedDimensions"&&(this._properties.fixedDimensions=n)}resize(t,n,i,o){if(!this._store.isDisposed&&!(!De(t)||!De(n))&&this._ptyProcess){if(t=Math.max(t,1),n=Math.max(n,1),this._delayedResizer){this._delayedResizer.cols=t,this._delayedResizer.rows=n;return}this._logService.trace("node-pty.IPty#resize",t,n);try{let s=i!==void 0&&o!==void 0?{width:i,height:o}:void 0;this._ptyProcess.resize(t,n,s)}catch(s){if(this._logService.trace("node-pty.IPty#resize exception "+s.message),this._exitCode!==void 0&&s.message!=="ioctl(2) failed, EBADF"&&s.message!=="Cannot resize a pty that has already exited")throw s}}}clearBuffer(){this._ptyProcess?.clear()}acknowledgeDataEvent(t){this._unacknowledgedCharCount=Math.max(this._unacknowledgedCharCount-t,0),this._logService.trace(`Flow control: Ack ${t} chars (unacknowledged: ${this._unacknowledgedCharCount})`),this._isPtyPaused&&this._unacknowledgedCharCount<5e3&&(this._logService.trace(`Flow control: Resume (${this._unacknowledgedCharCount} < 5000)`),this._ptyProcess?.resume(),this._isPtyPaused=!1)}clearUnacknowledgedChars(){this._unacknowledgedCharCount=0,this._logService.trace("Flow control: Cleared all unacknowledged chars, forcing resume"),this._isPtyPaused&&(this._ptyProcess?.resume(),this._isPtyPaused=!1)}async setUnicodeVersion(t){}getInitialCwd(){return Promise.resolve(this._initialCwd)}async getCwd(){if(be)return new Promise(t=>{if(!this._ptyProcess){t(this._initialCwd);return}this._logService.trace("node-pty.IPty#pid"),Sd("lsof -OPln -p "+this._ptyProcess.pid+" | grep cwd",{env:{...process.env,LANG:"en_US.UTF-8"}},(n,i,o)=>{!n&&i!==""?t(i.substring(i.indexOf("/"),i.length-1)):(this._logService.error("lsof did not run successfully, it may not be on the $PATH?",n,i,o),t(this._initialCwd))})});if(Ae){if(!this._ptyProcess)return this._initialCwd;this._logService.trace("node-pty.IPty#pid");try{return await tn.promises.readlink(`/proc/${this._ptyProcess.pid}/cwd`)}catch{return this._initialCwd}}return this._initialCwd}getWindowsPty(){return w?{backend:"conpty",buildNumber:So()}:void 0}};Me=h([ye(7,Se),ye(8,ll)],Me);var Po=class extends C{constructor(){super();this._onTrigger=this._register(new y);this._timeout=setTimeout(()=>{this._onTrigger.fire({rows:this.rows,cols:this.cols})},1e3),this._register(Q(()=>clearTimeout(this._timeout)))}get onTrigger(){return this._onTrigger.event}};function Cd(r){return"useConpty"in r}var Ge=class extends C{constructor(){super(...arguments);this._map=new Map;this._onDidAddCapability=this._register(new y);this._onDidRemoveCapability=this._register(new y)}get onDidAddCapability(){return this._onDidAddCapability.event}get onDidRemoveCapability(){return this._onDidRemoveCapability.event}get onDidChangeCapabilities(){return S.map(S.any(this._onDidAddCapability.event,this._onDidRemoveCapability.event),()=>{},this._store)}get onDidAddCommandDetectionCapability(){return S.map(S.filter(this.onDidAddCapability,t=>t.id===2,this._store),t=>t.capability,this._store)}get onDidRemoveCommandDetectionCapability(){return S.map(S.filter(this.onDidRemoveCapability,t=>t.id===2,this._store),()=>{},this._store)}get onDidAddCwdDetectionCapability(){return S.map(S.filter(this.onDidAddCapability,t=>t.id===0,this._store),t=>t.capability,this._store)}get onDidRemoveCwdDetectionCapability(){return S.map(S.filter(this.onDidRemoveCapability,t=>t.id===0,this._store),()=>{},this._store)}get items(){return this._map.keys()}createOnDidRemoveCapabilityOfTypeEvent(t){return S.map(S.filter(this.onDidRemoveCapability,n=>n.id===t),n=>n.capability)}createOnDidAddCapabilityOfTypeEvent(t){return S.map(S.filter(this.onDidAddCapability,n=>n.id===t),n=>n.capability)}add(t,n){this._map.set(t,n),this._onDidAddCapability.fire(Co(t,n))}get(t){return this._map.get(t)}remove(t){let n=this._map.get(t);n&&(this._map.delete(t),this._onDidRemoveCapability.fire(Co(t,n)))}has(t){return this._map.has(t)}};h([L],Ge.prototype,"onDidChangeCapabilities",1),h([L],Ge.prototype,"onDidAddCommandDetectionCapability",1),h([L],Ge.prototype,"onDidRemoveCommandDetectionCapability",1),h([L],Ge.prototype,"onDidAddCwdDetectionCapability",1),h([L],Ge.prototype,"onDidRemoveCwdDetectionCapability",1);var Ct=class extends C{constructor(){super(...arguments);this._stores=[];this._onDidAddCapability=this._register(new y);this._onDidRemoveCapability=this._register(new y)}get onDidAddCapability(){return this._onDidAddCapability.event}get onDidRemoveCapability(){return this._onDidRemoveCapability.event}get onDidChangeCapabilities(){return S.map(S.any(this._onDidAddCapability.event,this._onDidRemoveCapability.event),()=>{},this._store)}get onDidAddCommandDetectionCapability(){return S.map(S.filter(this.onDidAddCapability,t=>t.id===2,this._store),t=>t.capability,this._store)}get onDidRemoveCommandDetectionCapability(){return S.map(S.filter(this.onDidRemoveCapability,t=>t.id===2,this._store),()=>{},this._store)}get onDidAddCwdDetectionCapability(){return S.map(S.filter(this.onDidAddCapability,t=>t.id===0,this._store),t=>t.capability,this._store)}get onDidRemoveCwdDetectionCapability(){return S.map(S.filter(this.onDidRemoveCapability,t=>t.id===0,this._store),()=>{},this._store)}get items(){return this._items()}createOnDidRemoveCapabilityOfTypeEvent(t){return S.map(S.filter(this.onDidRemoveCapability,n=>n.id===t),n=>n.capability)}createOnDidAddCapabilityOfTypeEvent(t){return S.map(S.filter(this.onDidAddCapability,n=>n.id===t),n=>n.capability)}*_items(){for(let t of this._stores)for(let n of t.items)yield n}has(t){for(let n of this._stores)for(let i of n.items)if(i===t)return!0;return!1}get(t){for(let n of this._stores){let i=n.get(t);if(i)return i}}add(t){this._stores.push(t);for(let n of t.items)this._onDidAddCapability.fire(Co(n,t.get(n)));this._register(t.onDidAddCapability(n=>this._onDidAddCapability.fire(n))),this._register(t.onDidRemoveCapability(n=>this._onDidRemoveCapability.fire(n)))}};h([L],Ct.prototype,"onDidChangeCapabilities",1),h([L],Ct.prototype,"onDidAddCommandDetectionCapability",1),h([L],Ct.prototype,"onDidRemoveCommandDetectionCapability",1),h([L],Ct.prototype,"onDidAddCwdDetectionCapability",1),h([L],Ct.prototype,"onDidRemoveCwdDetectionCapability",1);function Co(r,e){return{id:r,capability:e}}var qn=class r{constructor(e,t){this._xterm=e;this._properties=t}get command(){return this._properties.command}get commandLineConfidence(){return this._properties.commandLineConfidence}get isTrusted(){return this._properties.isTrusted}get timestamp(){return this._properties.timestamp}get duration(){return this._properties.duration}get promptStartMarker(){return this._properties.promptStartMarker}get marker(){return this._properties.marker}get endMarker(){return this._properties.endMarker}set endMarker(e){this._properties.endMarker=e}get executedMarker(){return this._properties.executedMarker}get aliases(){return this._properties.aliases}get wasReplayed(){return this._properties.wasReplayed}get cwd(){return this._properties.cwd}get exitCode(){return this._properties.exitCode}get commandStartLineContent(){return this._properties.commandStartLineContent}get markProperties(){return this._properties.markProperties}get executedX(){return this._properties.executedX}get startX(){return this._properties.startX}get id(){return this._properties.id}static deserialize(e,t,n){let i=e.buffer.normal,o=t.startLine!==void 0?e.registerMarker(t.startLine-(i.baseY+i.cursorY)):void 0;if(!o)return;let s=t.promptStartLine!==void 0?e.registerMarker(t.promptStartLine-(i.baseY+i.cursorY)):void 0,a=t.endLine!==void 0?e.registerMarker(t.endLine-(i.baseY+i.cursorY)):void 0,l=t.executedLine!==void 0?e.registerMarker(t.executedLine-(i.baseY+i.cursorY)):void 0;return new r(e,{command:n?"":t.command,commandLineConfidence:t.commandLineConfidence??"low",isTrusted:t.isTrusted,id:t.id,promptStartMarker:s,marker:o,startX:t.startX,endMarker:a,executedMarker:l,executedX:t.executedX,timestamp:t.timestamp,duration:t.duration,cwd:t.cwd,commandStartLineContent:t.commandStartLineContent,exitCode:t.exitCode,markProperties:t.markProperties,aliases:void 0,wasReplayed:!0})}serialize(e){return{promptStartLine:this.promptStartMarker?.line,startLine:this.marker?.line,startX:void 0,endLine:this.endMarker?.line,executedLine:this.executedMarker?.line,executedX:this.executedX,command:e?"":this.command,commandLineConfidence:e?"low":this.commandLineConfidence,isTrusted:this.isTrusted,cwd:this.cwd,exitCode:this.exitCode,commandStartLineContent:this.commandStartLineContent,timestamp:this.timestamp,duration:this.duration,markProperties:this.markProperties,id:this.id}}extractCommandLine(){return fl(this._xterm.buffer.active,this._xterm.cols,this.marker,this.startX,this.executedMarker,this.executedX)}getOutput(){if(!this.executedMarker||!this.endMarker)return;let e=this.executedMarker.line,t=this.endMarker.line;if(e===t)return;let n="",i="",o,s=this._xterm.buffer.active;for(let a=e;a<t;a++){if(o=s.getLine(a),!o)continue;let l=a+1<t?!!s.getLine(a+1)?.isWrapped:!1;i+=o.translateToString(!l),l||(n+=i+`
`,i="")}return i.length>0&&(n+=i),n===""?void 0:n}getOutputMatch(e){if(!this.executedMarker||!this.endMarker)return;let t=this.endMarker.line;if(t===-1)return;let n=this._xterm.buffer.active,i=Math.max(this.executedMarker.line,0),o=e.lineMatcher,s=G(o)?1:e.length||kd(o),a=[],l;if(e.anchor==="bottom")for(let u=t-(e.offset||0);u>=i;u--){let p=u,c=u;for(;p>=i&&n.getLine(p)?.isWrapped;)p--;if(u=p,a.unshift(ml(n,p,c,this._xterm.cols)),l||(l=a[0].match(o)),a.length>=s)break}else for(let u=i+(e.offset||0);u<t;u++){let p=u,c=u;for(;c+1<t&&n.getLine(c+1)?.isWrapped;)c++;if(u=c,a.push(ml(n,p,c,this._xterm.cols)),l||(l=a[a.length-1].match(o)),a.length>=s)break}return l?{regexMatch:l,outputLines:a}:void 0}hasOutput(){return!this.executedMarker?.isDisposed&&!this.endMarker?.isDisposed&&!!(this.executedMarker&&this.endMarker&&this.executedMarker.line<this.endMarker.line)}getPromptRowCount(){return hl(this,this._xterm.buffer.active)}getCommandRowCount(){return gl(this)}},zn=class{constructor(e,t){this._xterm=e;this.id=t??Vr()}serialize(e){if(this.commandStartMarker)return{promptStartLine:this.promptStartMarker?.line,startLine:this.commandStartMarker.line,startX:this.commandStartX,endLine:void 0,executedLine:void 0,executedX:void 0,command:"",commandLineConfidence:"low",isTrusted:!0,cwd:e,exitCode:void 0,commandStartLineContent:void 0,timestamp:0,duration:0,markProperties:void 0,id:this.id}}promoteToFullCommand(e,t,n,i){if(t===void 0&&this.command===void 0&&(this.command=""),this.command!==void 0&&!this.command.startsWith("\\")||n)return new qn(this._xterm,{command:n?"":this.command||"",commandLineConfidence:n?"low":this.commandLineConfidence||"low",isTrusted:!!this.isTrusted,id:this.id,promptStartMarker:this.promptStartMarker,marker:this.commandStartMarker,startX:this.commandStartX,endMarker:this.commandFinishedMarker,executedMarker:this.commandExecutedMarker,executedX:this.commandExecutedX,timestamp:Date.now(),duration:this.commandDuration||0,cwd:e,exitCode:t,commandStartLineContent:this.commandStartLineContent,markProperties:i})}markExecutedTime(){this.commandExecutedTimestamp===void 0&&(this.commandExecutedTimestamp=Date.now())}markFinishedTime(){this.commandDuration===void 0&&this.commandExecutedTimestamp!==void 0&&(this.commandDuration=Date.now()-this.commandExecutedTimestamp)}extractCommandLine(){return fl(this._xterm.buffer.active,this._xterm.cols,this.commandStartMarker,this.commandStartX,this.commandExecutedMarker,this.commandExecutedX)}getPromptRowCount(){return hl(this,this._xterm.buffer.active)}getCommandRowCount(){return gl(this)}};function fl(r,e,t,n,i,o){if(!t||!i||n===void 0||o===void 0)return"";let s="";for(let a=t.line;a<=i.line;a++){let l=r.getLine(a);l&&(s+=l.translateToString(!0,a===t.line?n:0,a===i.line?o:e))}return s}function ml(r,e,t,n){let i=Math.max(2048/n*2);t=Math.min(t,e+i);let o="";for(let s=e;s<=t;s++){let a=r.getLine(s);a&&(o+=a.translateToString(!0,0,n))}return o}function kd(r){if(!r.multiline)return 1;let e=r.source,t=1,n=e.indexOf("\\n");for(;n!==-1;)t++,n=e.indexOf("\\n",n+1);return t}function hl(r,e){let t=it(r)?r.marker:r.commandStartMarker;if(!t||!r.promptStartMarker)return 1;let n=1,i=r.promptStartMarker.line;for(;i<t.line&&(e.getLine(i)?.translateToString(!0)??"").length===0;)i++;return n=t.line-i+1,n}function gl(r){let e=it(r)?r.marker:r.commandStartMarker,t=it(r)?r.executedMarker:r.commandExecutedMarker;if(!e||!t)return 1;let i=Math.max(t.line,e.line)-e.line+1;return(it(r)?r.executedX:r.commandExecutedX)===0&&i--,i}function it(r){return!!r.hasOutput}var Rt=class extends C{constructor(t,n,i,o,s,a){super();this._xterm=t;this._logService=a;this._state=0;this._commandStartX=0;this._lastUserInput="";this._value="";this._cursorIndex=0;this._ghostTextIndex=-1;this._onDidStartInput=this._register(new y);this.onDidStartInput=this._onDidStartInput.event;this._onDidChangeInput=this._register(new y);this.onDidChangeInput=this._onDidChangeInput.event;this._onDidFinishInput=this._register(new y);this.onDidFinishInput=this._onDidFinishInput.event;this._onDidInterrupt=this._register(new y);this.onDidInterrupt=this._onDidInterrupt.event;this._register(S.any(this._xterm.onCursorMove,this._xterm.onData,this._xterm.onWriteParsed)(()=>this._sync())),this._register(this._xterm.onData(l=>this._handleUserInput(l))),this._register(n(l=>this._handleCommandStart(l))),this._register(i(()=>this._handleCommandStartChanged())),this._register(o(()=>this._handleCommandExecuted())),this._register(s(()=>this._handleCommandFinished())),this._register(this.onDidStartInput(()=>this._logCombinedStringIfTrace("PromptInputModel#onDidStartInput"))),this._register(this.onDidChangeInput(()=>this._logCombinedStringIfTrace("PromptInputModel#onDidChangeInput"))),this._register(this.onDidFinishInput(()=>this._logCombinedStringIfTrace("PromptInputModel#onDidFinishInput"))),this._register(this.onDidInterrupt(()=>this._logCombinedStringIfTrace("PromptInputModel#onDidInterrupt")))}get state(){return this._state}get value(){return this._value}get prefix(){return this._value.substring(0,this._cursorIndex)}get suffix(){return this._value.substring(this._cursorIndex,this._ghostTextIndex===-1?void 0:this._ghostTextIndex)}get cursorIndex(){return this._cursorIndex}get ghostTextIndex(){return this._ghostTextIndex}_logCombinedStringIfTrace(t){this._logService.getLevel()===1&&this._logService.trace(t,this.getCombinedString())}setShellType(t){this._shellType=t}setContinuationPrompt(t){this._continuationPrompt=t,this._sync()}setLastPromptLine(t){this._lastPromptLine=t,this._sync()}setConfidentCommandLine(t){this._value!==t&&(this._value=t,this._cursorIndex=-1,this._ghostTextIndex=-1,this._onDidChangeInput.fire(this._createStateObject()))}getCombinedString(t){let n=this._value.replaceAll(`
`,"\u23CE");if(this._cursorIndex===-1)return n;let i=`${n.substring(0,this.cursorIndex)}|`;return this.ghostTextIndex!==-1?(i+=`${n.substring(this.cursorIndex,this.ghostTextIndex)}[`,i+=`${n.substring(this.ghostTextIndex)}]`):i+=n.substring(this.cursorIndex),i==="|"&&t?"":i}serialize(){return{modelState:this._createStateObject(),commandStartX:this._commandStartX,lastPromptLine:this._lastPromptLine,continuationPrompt:this._continuationPrompt,lastUserInput:this._lastUserInput}}deserialize(t){this._value=t.modelState.value,this._cursorIndex=t.modelState.cursorIndex,this._ghostTextIndex=t.modelState.ghostTextIndex,this._commandStartX=t.commandStartX,this._lastPromptLine=t.lastPromptLine,this._continuationPrompt=t.continuationPrompt,this._lastUserInput=t.lastUserInput}_handleCommandStart(t){this._state!==1&&(this._state=1,this._commandStartMarker=t.marker,this._commandStartX=this._xterm.buffer.active.cursorX,this._value="",this._cursorIndex=0,this._onDidStartInput.fire(this._createStateObject()),this._onDidChangeInput.fire(this._createStateObject()),this._lastPromptLine&&this._commandStartX!==this._lastPromptLine.length&&this._xterm.buffer.active.getLine(this._commandStartMarker.line)?.translateToString(!0).startsWith(this._lastPromptLine)&&(this._commandStartX=this._lastPromptLine.length,this._sync()))}_handleCommandStartChanged(){this._state===1&&(this._commandStartX=this._xterm.buffer.active.cursorX,this._onDidChangeInput.fire(this._createStateObject()),this._sync())}_handleCommandExecuted(){if(this._state===2)return;this._cursorIndex=-1,this._ghostTextIndex!==-1&&(this._value=this._value.substring(0,this._ghostTextIndex),this._ghostTextIndex=-1);let t=this._createStateObject();this._lastUserInput===""&&(this._lastUserInput="",this._onDidInterrupt.fire(t)),this._state=2,this._onDidFinishInput.fire(t),this._onDidChangeInput.fire(t)}_handleCommandFinished(){this._value="",this._onDidChangeInput.fire(this._createStateObject())}_sync(){try{this._doSync()}catch(t){this._logService.error("Error while syncing prompt input model",t)}}_doSync(){if(this._state!==1)return;let t=this._commandStartMarker?.line;if(t===void 0)return;let n=this._xterm.buffer.active,i=n.getLine(t),o=n.baseY+n.cursorY,s,a=i?.translateToString(!0,this._commandStartX);if(this._shellType==="fish"&&(!i||!a)&&(t+=1,i=n.getLine(t),i&&(a=i.translateToString(!0),s=o===t?n.cursorX:a?.trimEnd().length)),i===void 0||a===void 0){this._logService.trace("PromptInputModel#_sync: no line");return}let l=a,u=-1;s===void 0&&(o===t?s=Math.min(this._getRelativeCursorIndex(this._commandStartX,n,i),a.length):s=a.trimEnd().length);for(let p=t+1;p<=o;p++){let c=n.getLine(p),d=c?.translateToString(!0);if(d&&c){if(c.isWrapped||o===p&&this._continuationPrompt&&!this._lineContainsContinuationPrompt(d)){l+=`${d}`;let m=this._getRelativeCursorIndex(0,n,c);o===p?s+=m:s+=d.length}else if(this._shellType==="fish")l.endsWith("\\")?(l=l.substring(0,l.length-1),l+=`${d.trim()}`,s+=d.trim().length-1):/^ {6,}/.test(d)?(l+=`
${d.trim()}`,s+=d.trim().length+1):(l+=d,s+=d.length);else if(this._continuationPrompt===void 0||this._lineContainsContinuationPrompt(d)){let m=this._trimContinuationPrompt(d);if(l+=`
${m}`,o===p){let f=this._getContinuationPromptCellWidth(c,d),b=this._getRelativeCursorIndex(f,n,c);s+=b+1}else s+=m.length+1}}}for(let p=o+1;p<n.baseY+this._xterm.rows;p++){let c=n.getLine(p),d=c?.translateToString(!0);if(d&&c)this._shellType==="fish"?l+=`${d}`:this._continuationPrompt===void 0||this._lineContainsContinuationPrompt(d)?l+=`
${this._trimContinuationPrompt(d)}`:l+=d;else break}this._logService.getLevel()===1&&this._logService.trace(`PromptInputModel#_sync: ${this.getCombinedString()}`);{let p=this._value.length-this._value.trimEnd().length;this._lastUserInput==="\x7F"&&(this._lastUserInput="",s===this._cursorIndex-1&&(this._value.trimEnd().length>l.trimEnd().length&&l.trimEnd().length<=s?p=Math.max(this._value.length-1-l.trimEnd().length,0):p=Math.max(p-1,0))),this._lastUserInput==="\x1B[3~"&&(this._lastUserInput="",s===this._cursorIndex&&(p=Math.max(p-1,0)));let c=l.split(`
`),d=c.length>1,m=l.trimEnd();if(!d){m.length<l.length&&(this._lastUserInput===" "&&(this._lastUserInput="",s>m.length&&s>this._cursorIndex&&p++),p=Math.max(s-m.length,p,0));let f=s===0?"":l[s-1];p>0&&s===this._cursorIndex+1&&this._lastUserInput!==""&&f!==" "&&(p=this._value.length-this._cursorIndex)}if(d){c[c.length-1]=c.at(-1)?.trimEnd()??"";let f=(c.length-1)*(this._continuationPrompt?.length??0);p=Math.max(0,s-l.length-f)}l=c.map(f=>f.trimEnd()).join(`
`)+" ".repeat(p)}u=this._scanForGhostText(n,i,s),(this._value!==l||this._cursorIndex!==s||this._ghostTextIndex!==u)&&(this._value=l,this._cursorIndex=s,this._ghostTextIndex=u,this._onDidChangeInput.fire(this._createStateObject()))}_handleUserInput(t){this._lastUserInput=t}_scanForGhostText(t,n,i){if(!this.value.trim().length)return-1;let o=-1,s=!1,a=t.cursorX;for(;a>0;){let l=n.getCell(--a);if(!l)break;if(l.getChars().trim().length>0){s=!this._isCellStyledLikeGhostText(l);break}}if(s){let l=0,u=t.cursorX;for(;u<n.length;){let p=n.getCell(u++);if(!p||p.getCode()===0)break;if(this._isCellStyledLikeGhostText(p)){o=i+l;break}l+=p.getChars().length}}return o===-1&&(o=this._scanForGhostTextAdvanced(t,n,i)),o>-1&&this.value.substring(o).endsWith(" ")&&(this._value=this.value.trim(),this.value.substring(o)||(o=-1)),o}_scanForGhostTextAdvanced(t,n,i){let o=-1,s=t.cursorX,a=new Map,l=n.getCell(s),u=l;for(;u&&s<n.length;){let c=this._getCellStyleAsString(u);a.set(c,[...a.get(c)??[],s]),u=n.getCell(++s),u?.getChars().trim().length&&(l=u)}if(!l?.getChars().trim().length||this._cellStylesMatch(n.getCell(this._commandStartX),l))return-1;let p=a.get(this._getCellStyleAsString(l));if(p){if(p[0]>t.cursorX+1&&this._isPositionRightPrompt(n,p[0]))return-1;for(let c=1;c<p.length;c++)if(p[c]!==p[c-1]+1)return-1;t.baseY+t.cursorY===this._commandStartMarker?.line?o=p[0]-this._commandStartX:o=p[0]}if(o!==-1)for(let c=t.cursorX;c>=this._commandStartX;c--){let d=n.getCell(c);if(d?.getChars.length&&d&&d.getCode()!==0&&this._cellStylesMatch(l,d))return-1}return o>=i?o:-1}_isPositionRightPrompt(t,n){let i=0;for(let o=n-1;o>=this._commandStartX;o--){let s=t.getCell(o);if(!s||s.getChars().trim().length===0){if(i++,i>=5)return!0}else i=0}return!1}_getCellStyleAsString(t){return`${t.getFgColor()}${t.getBgColor()}${t.isBold()}${t.isItalic()}${t.isDim()}${t.isUnderline()}${t.isBlink()}${t.isInverse()}${t.isInvisible()}${t.isStrikethrough()}${t.isOverline()}${t.getFgColorMode()}${t.getBgColorMode()}`}_cellStylesMatch(t,n){return!t||!n?!1:t.getFgColor()===n.getFgColor()&&t.getBgColor()===n.getBgColor()&&t.isBold()===n.isBold()&&t.isItalic()===n.isItalic()&&t.isDim()===n.isDim()&&t.isUnderline()===n.isUnderline()&&t.isBlink()===n.isBlink()&&t.isInverse()===n.isInverse()&&t.isInvisible()===n.isInvisible()&&t.isStrikethrough()===n.isStrikethrough()&&t.isOverline()===n.isOverline()&&t?.getBgColorMode()===n?.getBgColorMode()&&t?.getFgColorMode()===n?.getFgColorMode()}_trimContinuationPrompt(t){return this._lineContainsContinuationPrompt(t)&&(t=t.substring(this._continuationPrompt.length)),t}_lineContainsContinuationPrompt(t){return!!(this._continuationPrompt&&t.startsWith(this._continuationPrompt.trimEnd()))}_getContinuationPromptCellWidth(t,n){if(!this._continuationPrompt||!n.startsWith(this._continuationPrompt.trimEnd()))return 0;let i="",o=0,s;for(;i!==this._continuationPrompt&&(s=t.getCell(o++),!!s);)i+=s.getChars();return o}_getRelativeCursorIndex(t,n,i){return i?.translateToString(!1,t,n.cursorX).length??0}_isCellStyledLikeGhostText(t){return!!(t.isItalic()||t.isDim())}_createStateObject(){return Object.freeze({value:this._value,prefix:this.prefix,suffix:this.suffix,cursorIndex:this._cursorIndex,ghostTextIndex:this._ghostTextIndex})}};h([xr(0)],Rt.prototype,"_sync",1),Rt=h([ye(5,Se)],Rt);var Lt=class extends C{constructor(t,n){super();this._terminal=t;this._logService=n;this.type=2;this._commands=[];this._commandMarkers=[];this.__isCommandStorageDisabled=!1;this._hasRichCommandDetection=!1;this._isCurrentCommandInterrupted=!1;this._onCommandStarted=this._register(new y);this.onCommandStarted=this._onCommandStarted.event;this._onCommandStartChanged=this._register(new y);this.onCommandStartChanged=this._onCommandStartChanged.event;this._onBeforeCommandFinished=this._register(new y);this.onBeforeCommandFinished=this._onBeforeCommandFinished.event;this._onCommandFinished=this._register(new y);this.onCommandFinished=this._onCommandFinished.event;this._onCommandExecuted=this._register(new y);this.onCommandExecuted=this._onCommandExecuted.event;this._onCommandInvalidated=this._register(new y);this.onCommandInvalidated=this._onCommandInvalidated.event;this._onCurrentCommandInvalidated=this._register(new y);this.onCurrentCommandInvalidated=this._onCurrentCommandInvalidated.event;this._onSetRichCommandDetection=this._register(new y);this.onSetRichCommandDetection=this._onSetRichCommandDetection.event;this._currentCommand=new zn(this._terminal),this._promptInputModel=this._register(new Rt(this._terminal,this.onCommandStarted,this.onCommandStartChanged,this.onCommandExecuted,this.onCommandFinished,this._logService)),this._register(this._promptInputModel.onDidInterrupt(()=>this._isCurrentCommandInterrupted=!0)),this._register(this.onCommandExecuted(o=>{if(o.commandLineConfidence!=="high"){let s=o;o.command=s.extractCommandLine(),o.commandLineConfidence="low",it(s)?s.promptStartMarker&&s.marker&&s.executedMarker&&o.command.indexOf(`
`)===-1&&s.startX!==void 0&&s.startX>0&&(o.commandLineConfidence="medium"):s.promptStartMarker&&s.commandStartMarker&&s.commandExecutedMarker&&o.command.indexOf(`
`)===-1&&s.commandStartX!==void 0&&s.commandStartX>0&&(o.commandLineConfidence="medium")}})),this._register(this._terminal.parser.registerCsiHandler({final:"J"},o=>(o.length>=1&&o[0]===2&&(this._terminal.options.scrollOnEraseInDisplay||this._clearCommandsInViewport(),this._currentCommand.wasCleared=!0),!1)));let i=this;this._ptyHeuristicsHooks=new class{get onCurrentCommandInvalidatedEmitter(){return i._onCurrentCommandInvalidated}get onCommandStartedEmitter(){return i._onCommandStarted}get onCommandExecutedEmitter(){return i._onCommandExecuted}get dimensions(){return i._dimensions}get isCommandStorageDisabled(){return i.__isCommandStorageDisabled}get commandMarkers(){return i._commandMarkers}set commandMarkers(o){i._commandMarkers=o}get clearCommandsInViewport(){return i._clearCommandsInViewport.bind(i)}},this._ptyHeuristics=this._register(new Zn(new Hn(this._terminal,this,this._ptyHeuristicsHooks,this._logService))),this._dimensions={cols:this._terminal.cols,rows:this._terminal.rows},this._register(this._terminal.onResize(o=>this._handleResize(o))),this._register(this._terminal.onCursorMove(()=>this._handleCursorMove()))}get promptInputModel(){return this._promptInputModel}get hasRichCommandDetection(){return this._hasRichCommandDetection}get commands(){return this._commands}get executingCommand(){return this._currentCommand.command}get executingCommandObject(){if(this._currentCommand.commandStartMarker)return this._currentCommand.promoteToFullCommand(this._cwd,void 0,this._handleCommandStartOptions?.ignoreCommandLine??!1,void 0)}get executingCommandConfidence(){let t=this._currentCommand;return it(t)?t.commandLineConfidence:void 0}get currentCommand(){return this._currentCommand}get cwd(){return this._cwd}get promptTerminator(){return this._promptTerminator}_handleResize(t){this._ptyHeuristics.value.preHandleResize?.(t),this._dimensions.cols=t.cols,this._dimensions.rows=t.rows}_handleCursorMove(){this._store.isDisposed||this._terminal.buffer.active===this._terminal.buffer.normal&&this._currentCommand.commandStartMarker&&this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY<this._currentCommand.commandStartMarker.line&&(this._clearCommandsInViewport(),this._currentCommand.isInvalid=!0,this._onCurrentCommandInvalidated.fire({reason:"windows"}))}_clearCommandsInViewport(){let t=0;for(let n=this._commands.length-1;n>=0;n--){let i=this._commands[n].marker?.line;if(i&&i<this._terminal.buffer.active.baseY)break;t++}t>0&&this._onCommandInvalidated.fire(this._commands.splice(this._commands.length-t,t))}setContinuationPrompt(t){this._promptInputModel.setContinuationPrompt(t)}setPromptTerminator(t,n){this._logService.debug("CommandDetectionCapability#setPromptTerminator",t),this._promptTerminator=t,this._promptInputModel.setLastPromptLine(n)}setCwd(t){this._cwd=t}setIsWindowsPty(t){if(t&&!(this._ptyHeuristics.value instanceof Dt)){let n=this;this._ptyHeuristics.value=new Dt(this._terminal,this,new class{get onCurrentCommandInvalidatedEmitter(){return n._onCurrentCommandInvalidated}get onCommandStartedEmitter(){return n._onCommandStarted}get onCommandExecutedEmitter(){return n._onCommandExecuted}get dimensions(){return n._dimensions}get isCommandStorageDisabled(){return n.__isCommandStorageDisabled}get commandMarkers(){return n._commandMarkers}set commandMarkers(i){n._commandMarkers=i}get clearCommandsInViewport(){return n._clearCommandsInViewport.bind(n)}},this._logService)}else!t&&!(this._ptyHeuristics.value instanceof Hn)&&(this._ptyHeuristics.value=new Hn(this._terminal,this,this._ptyHeuristicsHooks,this._logService))}setHasRichCommandDetection(t){this._hasRichCommandDetection=t,this._onSetRichCommandDetection.fire(t)}setIsCommandStorageDisabled(){this.__isCommandStorageDisabled=!0}getCommandForLine(t){if(this._currentCommand.promptStartMarker&&t>=this._currentCommand.promptStartMarker?.line)return this._currentCommand;if(this._commands.length!==0&&!((this._commands[0].promptStartMarker??this._commands[0].marker).line>t)){for(let n=this.commands.length-1;n>=0;n--)if((this.commands[n].promptStartMarker??this.commands[n].marker).line<=t)return this.commands[n]}}getCwdForLine(t){if(this._currentCommand.promptStartMarker&&t>=this._currentCommand.promptStartMarker?.line)return this._cwd;let n=this.getCommandForLine(t);if(n&&it(n))return n.cwd}handlePromptStart(t){this._isCurrentCommandInterrupted=!1;let n=this.commands.at(-1);n?.endMarker&&n?.executedMarker&&n.endMarker.line===n.executedMarker.line&&n.executedMarker.line<this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY&&(this._logService.debug("CommandDetectionCapability#handlePromptStart adjusted commandFinished",`${n.endMarker.line} -> ${n.executedMarker.line+1}`),n.endMarker=jn(this._terminal,n.executedMarker,1)),this._currentCommand.promptStartMarker=t?.marker||(!this._currentCommand.wasCleared&&n?.endMarker?jn(this._terminal,n.endMarker):this._terminal.registerMarker(0)),this._currentCommand.wasCleared=!1}handleContinuationStart(){this._currentCommand.currentContinuationMarker=this._terminal.registerMarker(0),this._logService.debug("CommandDetectionCapability#handleContinuationStart",this._currentCommand.currentContinuationMarker)}handleContinuationEnd(){if(!this._currentCommand.currentContinuationMarker){this._logService.warn("CommandDetectionCapability#handleContinuationEnd Received continuation end without start");return}this._currentCommand.continuations||(this._currentCommand.continuations=[]),this._currentCommand.continuations.push({marker:this._currentCommand.currentContinuationMarker,end:this._terminal.buffer.active.cursorX}),this._currentCommand.currentContinuationMarker=void 0,this._logService.debug("CommandDetectionCapability#handleContinuationEnd",this._currentCommand.continuations[this._currentCommand.continuations.length-1])}handleRightPromptStart(){this._currentCommand.commandRightPromptStartX=this._terminal.buffer.active.cursorX,this._logService.debug("CommandDetectionCapability#handleRightPromptStart",this._currentCommand.commandRightPromptStartX)}handleRightPromptEnd(){this._currentCommand.commandRightPromptEndX=this._terminal.buffer.active.cursorX,this._logService.debug("CommandDetectionCapability#handleRightPromptEnd",this._currentCommand.commandRightPromptEndX)}handleCommandStart(t){if(this._handleCommandStartOptions=t,this._currentCommand.cwd=this._cwd,this._currentCommand.commandStartMarker=t?.marker||this._currentCommand.commandStartMarker,this._currentCommand.commandStartMarker?.line===this._terminal.buffer.active.cursorY){this._currentCommand.commandStartX=this._terminal.buffer.active.cursorX,this._onCommandStartChanged.fire(),this._logService.debug("CommandDetectionCapability#handleCommandStart",this._currentCommand.commandStartX,this._currentCommand.commandStartMarker?.line);return}this._ptyHeuristics.value.handleCommandStart(t)}setNextCommandId(t,n){this._nextCommandId={command:t,commandId:n}}handleCommandExecuted(t){this._ensureCurrentCommandId(this._currentCommand.command??this._currentCommand.extractCommandLine()),this._ptyHeuristics.value.handleCommandExecuted(t),this._currentCommand.markExecutedTime()}handleCommandFinished(t,n){if(this._currentCommand.commandExecutedMarker||this.handleCommandExecuted(),this._currentCommand.markFinishedTime(),this._ptyHeuristics.value.preHandleCommandFinished?.(),this._logService.debug("CommandDetectionCapability#handleCommandFinished",this._terminal.buffer.active.cursorX,n?.marker?.line,this._currentCommand.command,this._currentCommand),t===void 0&&!this._isCurrentCommandInterrupted){let o=this.commands.length>0?this.commands[this.commands.length-1]:void 0;this._currentCommand.command&&this._currentCommand.command.length>0&&o?.command===this._currentCommand.command&&(t=o.exitCode)}if(this._currentCommand.commandStartMarker===void 0||!this._terminal.buffer.active)return;this._currentCommand.commandFinishedMarker=n?.marker||this._terminal.registerMarker(0),this._ptyHeuristics.value.postHandleCommandFinished?.();let i=this._currentCommand.promoteToFullCommand(this._cwd,t,this._handleCommandStartOptions?.ignoreCommandLine??!1,n?.markProperties);i&&(this._commands.push(i),this._onBeforeCommandFinished.fire(i),this._logService.debug("CommandDetectionCapability#onCommandFinished",i),this._onCommandFinished.fire(i)),this._currentCommand=new zn(this._terminal),this._handleCommandStartOptions=void 0}_ensureCurrentCommandId(t){this._nextCommandId?.commandId&&(this._currentCommand.id!==this._nextCommandId.commandId&&(this._currentCommand.id=this._nextCommandId.commandId),this._nextCommandId=void 0)}setCommandLine(t,n){this._logService.debug("CommandDetectionCapability#setCommandLine",t,n),this._currentCommand.command=t,this._currentCommand.commandLineConfidence="high",this._currentCommand.isTrusted=n,n&&this._promptInputModel.setConfidentCommandLine(t)}serialize(){let t=this.commands.map(i=>i.serialize(this.__isCommandStorageDisabled)),n=this._currentCommand.serialize(this._cwd);return n&&t.push(n),{isWindowsPty:this._ptyHeuristics.value instanceof Dt,hasRichCommandDetection:this._hasRichCommandDetection,commands:t,promptInputModel:this._promptInputModel.serialize()}}deserialize(t){t.isWindowsPty&&this.setIsWindowsPty(t.isWindowsPty),t.hasRichCommandDetection&&this.setHasRichCommandDetection(t.hasRichCommandDetection);let n=this._terminal.buffer.normal;for(let i of t.commands){if(!i.endLine){let s=i.startLine!==void 0?this._terminal.registerMarker(i.startLine-(n.baseY+n.cursorY)):void 0;if(!s)continue;this._currentCommand.commandStartMarker=i.startLine!==void 0?this._terminal.registerMarker(i.startLine-(n.baseY+n.cursorY)):void 0,this._currentCommand.commandStartX=i.startX,this._currentCommand.promptStartMarker=i.promptStartLine!==void 0?this._terminal.registerMarker(i.promptStartLine-(n.baseY+n.cursorY)):void 0,this._cwd=i.cwd,this._onCommandStarted.fire({marker:s});continue}let o=qn.deserialize(this._terminal,i,this.__isCommandStorageDisabled);o&&(this._commands.push(o),this._logService.debug("CommandDetectionCapability#onCommandFinished",o),this._onCommandFinished.fire(o))}t.promptInputModel&&this._promptInputModel.deserialize(t.promptInputModel)}};h([Wt(500)],Lt.prototype,"_handleCursorMove",1),Lt=h([ye(1,Se)],Lt);var Hn=class extends C{constructor(t,n,i,o){super();this._terminal=t;this._capability=n;this._hooks=i;this._logService=o}handleCommandStart(t){let n=this._capability.currentCommand;n.commandStartX=this._terminal.buffer.active.cursorX,n.commandStartMarker=t?.marker||this._terminal.registerMarker(0),n.commandExecutedMarker?.dispose(),n.commandExecutedMarker=void 0,n.commandExecutedX=void 0;for(let i of this._hooks.commandMarkers)i.dispose();this._hooks.commandMarkers.length=0,this._hooks.onCommandStartedEmitter.fire({marker:t?.marker||n.commandStartMarker,markProperties:t?.markProperties}),this._logService.debug("CommandDetectionCapability#handleCommandStart",n.commandStartX,n.commandStartMarker?.line)}handleCommandExecuted(t){let n=this._capability.currentCommand;n.commandExecutedMarker=t?.marker||this._terminal.registerMarker(0),n.commandExecutedX=this._terminal.buffer.active.cursorX,this._logService.debug("CommandDetectionCapability#handleCommandExecuted",n.commandExecutedX,n.commandExecutedMarker?.line),!(!n.commandStartMarker||!n.commandExecutedMarker||n.commandStartX===void 0)&&(n.command=this._capability.promptInputModel.ghostTextIndex>-1?this._capability.promptInputModel.value.substring(0,this._capability.promptInputModel.ghostTextIndex):this._capability.promptInputModel.value,this._hooks.onCommandExecutedEmitter.fire(n))}};var Dt=class extends C{constructor(t,n,i,o){super();this._terminal=t;this._capability=n;this._hooks=i;this._logService=o;this._onCursorMoveListener=this._register(new Mt);this._tryAdjustCommandStartMarkerScannedLineCount=0;this._tryAdjustCommandStartMarkerPollCount=0;this._register(this._capability.onBeforeCommandFinished(s=>{(s.command.trim().toLowerCase()==="clear"||s.command.trim().toLowerCase()==="cls")&&(this._tryAdjustCommandStartMarkerScheduler?.cancel(),this._tryAdjustCommandStartMarkerScheduler=void 0,this._hooks.clearCommandsInViewport(),this._capability.currentCommand.isInvalid=!0,this._hooks.onCurrentCommandInvalidatedEmitter.fire({reason:"windows"}))}))}preHandleResize(t){let n=this._terminal.buffer.active.baseY,i=t.rows-this._hooks.dimensions.rows;i>0&&this._waitForCursorMove().then(()=>{let o=Math.min(i,n);for(let s=this._capability.commands.length-1;s>=0;s--){let a=this._capability.commands[s];if(!a.marker||a.marker.line<n||a.commandStartLineContent===void 0)break;let l=this._terminal.buffer.active.getLine(a.marker.line);if(!l||l.translateToString(!0)===a.commandStartLineContent)continue;let u=a.marker.line-o;this._terminal.buffer.active.getLine(u)?.translateToString(!0)===a.commandStartLineContent&&this._terminal._core._bufferService.buffer.lines.onDeleteEmitter.fire({index:this._terminal.buffer.active.baseY,amount:o})}})}handleCommandStart(){this._capability.currentCommand.commandStartX=this._terminal.buffer.active.cursorX,this._hooks.commandMarkers.length=0;let t=this._capability.currentCommand.commandStartMarker=this._capability.currentCommand.promptStartMarker?jn(this._terminal,this._capability.currentCommand.promptStartMarker):this._terminal.registerMarker(0);this._capability.currentCommand.commandStartX=0,this._tryAdjustCommandStartMarkerScannedLineCount=0,this._tryAdjustCommandStartMarkerPollCount=0,this._tryAdjustCommandStartMarkerScheduler=new _r(()=>this._tryAdjustCommandStartMarker(t),20),this._tryAdjustCommandStartMarkerScheduler.schedule()}_tryAdjustCommandStartMarker(t){if(this._store.isDisposed)return;let n=this._terminal.buffer.active,i=this._tryAdjustCommandStartMarkerScannedLineCount;for(;i<10&&t.line+i<n.baseY+this._terminal.rows;){if(this._cursorOnNextLine()){let o=this._getWindowsPrompt(t.line+i);if(o){let s=G(o)?o:o.prompt;if(this._capability.currentCommand.commandStartMarker=this._terminal.registerMarker(0),!G(o)&&o.likelySingleLine){this._logService.debug("CommandDetectionCapability#_tryAdjustCommandStartMarker adjusted promptStart",`${this._capability.currentCommand.promptStartMarker?.line} -> ${this._capability.currentCommand.commandStartMarker.line}`),this._capability.currentCommand.promptStartMarker?.dispose(),this._capability.currentCommand.promptStartMarker=jn(this._terminal,this._capability.currentCommand.commandStartMarker);let a=this._capability.commands.at(-1);a&&this._capability.currentCommand.commandStartMarker.line!==a.endMarker?.line&&(a.endMarker?.dispose(),a.endMarker=jn(this._terminal,this._capability.currentCommand.commandStartMarker))}this._capability.currentCommand.commandStartX=s.length,this._logService.debug("CommandDetectionCapability#_tryAdjustCommandStartMarker adjusted commandStart",`${t.line} -> ${this._capability.currentCommand.commandStartMarker.line}:${this._capability.currentCommand.commandStartX}`),this._flushPendingHandleCommandStartTask();return}}i++}i<10?(this._tryAdjustCommandStartMarkerScannedLineCount=i,++this._tryAdjustCommandStartMarkerPollCount<10?this._tryAdjustCommandStartMarkerScheduler?.schedule():this._flushPendingHandleCommandStartTask()):this._flushPendingHandleCommandStartTask()}_flushPendingHandleCommandStartTask(){if(this._tryAdjustCommandStartMarkerScheduler&&(this._tryAdjustCommandStartMarkerPollCount=10,this._tryAdjustCommandStartMarkerScheduler.flush(),this._tryAdjustCommandStartMarkerScheduler=void 0),this._capability.currentCommand.commandExecutedMarker||(this._onCursorMoveListener.value=this._terminal.onCursorMove(()=>{if(this._hooks.commandMarkers.length===0||this._hooks.commandMarkers[this._hooks.commandMarkers.length-1].line!==this._terminal.buffer.active.cursorY){let t=this._terminal.registerMarker(0);t&&this._hooks.commandMarkers.push(t)}})),this._capability.currentCommand.commandStartMarker){let t=this._terminal.buffer.active.getLine(this._capability.currentCommand.commandStartMarker.line);t&&(this._capability.currentCommand.commandStartLineContent=t.translateToString(!0))}this._hooks.onCommandStartedEmitter.fire({marker:this._capability.currentCommand.commandStartMarker}),this._logService.debug("CommandDetectionCapability#_handleCommandStartWindows",this._capability.currentCommand.commandStartX,this._capability.currentCommand.commandStartMarker?.line)}handleCommandExecuted(t){this._tryAdjustCommandStartMarkerScheduler&&this._flushPendingHandleCommandStartTask(),this._onCursorMoveListener.clear(),this._evaluateCommandMarkers(),this._capability.currentCommand.commandExecutedX=this._terminal.buffer.active.cursorX,this._hooks.onCommandExecutedEmitter.fire(this._capability.currentCommand),this._logService.debug("CommandDetectionCapability#handleCommandExecuted",this._capability.currentCommand.commandExecutedX,this._capability.currentCommand.commandExecutedMarker?.line)}preHandleCommandFinished(){this._capability.currentCommand.commandExecutedMarker||(this._hooks.commandMarkers.length===0&&(this._capability.currentCommand.commandStartMarker||(this._capability.currentCommand.commandStartMarker=this._terminal.registerMarker(0)),this._capability.currentCommand.commandStartMarker&&this._hooks.commandMarkers.push(this._capability.currentCommand.commandStartMarker)),this._evaluateCommandMarkers())}postHandleCommandFinished(){let t=this._capability.currentCommand,n=t.command,i=t.commandStartMarker?.line,o=t.commandExecutedMarker?.line;if(!n||n.length===0||i===void 0||i===-1||o===void 0||o===-1)return;let s=0,a=!1;for(let l=i;l<=o;l++){let u=this._terminal.buffer.active.getLine(l);if(!u)break;let p=u.translateToString(!0);for(let c=0;c<p.length;c++){for(;n.length<s&&n[s]===" ";)s++;if(p[c]===n[s]&&s++,s===n.length){let d=c>=this._terminal.cols-1;t.commandExecutedMarker=this._terminal.registerMarker(l-(this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY)+(d?1:0)),t.commandExecutedX=d?0:c+1,a=!0;break}}if(a)break}}_evaluateCommandMarkers(){if(this._hooks.commandMarkers.length!==0){if(this._hooks.commandMarkers=this._hooks.commandMarkers.sort((t,n)=>t.line-n.line),this._capability.currentCommand.commandStartMarker=this._hooks.commandMarkers[0],this._capability.currentCommand.commandStartMarker){let t=this._terminal.buffer.active.getLine(this._capability.currentCommand.commandStartMarker.line);t&&(this._capability.currentCommand.commandStartLineContent=t.translateToString(!0))}this._capability.currentCommand.commandExecutedMarker=this._hooks.commandMarkers[this._hooks.commandMarkers.length-1],this._hooks.onCommandExecutedEmitter.fire(this._capability.currentCommand)}}_cursorOnNextLine(){let t=this._capability.commands.at(-1);if(!t)return!0;let n=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,i=(t.endMarker?t.endMarker.line:t.marker?.line)??-1;return n>i}_waitForCursorMove(){let t=this._terminal.buffer.active.cursorX,n=this._terminal.buffer.active.cursorY,i=0;return new Promise((o,s)=>{let a=setInterval(()=>{if(t!==this._terminal.buffer.active.cursorX||n!==this._terminal.buffer.active.cursorY){o(),clearInterval(a);return}i+=10,i>1e3&&(clearInterval(a),o())},10)})}_getWindowsPrompt(t=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY){let n=this._terminal.buffer.active.getLine(t);if(!n)return;let i=n.translateToString(!0);if(!i)return;let o=i.match(/(?<prompt>(\(.+\)\s)?(?:PS.+>\s?))/)?.groups?.prompt;if(o){let p=this._adjustPrompt(o,i,">");if(p)return{prompt:p,likelySingleLine:!0}}let s=i.match(/.*\u276f(?=[^\u276f]*$)/g)?.[0];if(s){let p=this._adjustPrompt(s,i,"\u276F");if(p)return p}let a=i.match(/^(?<prompt>\$)/)?.groups?.prompt;if(a){let p=this._adjustPrompt(a,i,"$");if(p)return p}let l=i.match(/^(?<prompt>>>> )/g)?.groups?.prompt;if(l)return{prompt:l,likelySingleLine:!0};if(this._capability.promptTerminator&&(i===this._capability.promptTerminator||i.trim().endsWith(this._capability.promptTerminator))){let p=this._adjustPrompt(i,i,this._capability.promptTerminator);if(p)return p}let u=i.match(/^(?<prompt>(\(.+\)\s)?(?:[A-Z]:\\.*>))/);return u?.groups?.prompt?{prompt:u.groups.prompt,likelySingleLine:!0}:void 0}_adjustPrompt(t,n,i){if(t)return n===t&&t.endsWith(i)&&(t+=" "),t}};Dt=h([ye(3,Se)],Dt);function jn(r,e,t=0){return r.registerMarker(e.line-(r.buffer.active.baseY+r.buffer.active.cursorY)+t)}var ri=class extends C{constructor(){super(...arguments);this.type=0;this._cwd="";this._isTrusted=!0;this._cwds=new Map;this._onDidChangeCwd=this._register(new y);this.onDidChangeCwd=this._onDidChangeCwd.event}get cwds(){return Array.from(this._cwds.keys())}get isTrusted(){return this._isTrusted}getCwd(){return this._cwd}updateCwd(t,n=!0){let i=this._cwd!==t||this._isTrusted!==n;this._cwd=t,this._isTrusted=n;let o=this._cwds.get(this._cwd)||0;this._cwds.delete(this._cwd),this._cwds.set(this._cwd,o+1),i&&this._onDidChangeCwd.fire(t)}};var ii=class extends me{constructor(t,n){super();this._terminal=t;this._onDidExecuteText=n;this.type=3;this._commands=[];this._onCommandFinished=this.add(new y);this.onCommandFinished=this._onCommandFinished.event;this.add(this._terminal.onData(i=>this._onData(i))),this.add(this._terminal.parser.registerCsiHandler({final:"J"},i=>(i.length>=1&&(i[0]===2||i[0]===3)&&this._clearCommandsInViewport(),!1))),this._onDidExecuteText&&this.add(this._onDidExecuteText(()=>this._onEnter()))}get commands(){return this._commands}_onData(t){t==="\r"&&this._onEnter()}_onEnter(){if(this._terminal&&this._terminal.buffer.active.cursorX>=2){let t=this._terminal.registerMarker(0);t&&(this._commands.push(t),this._onCommandFinished.fire(t))}}_clearCommandsInViewport(){let t=0;for(let n=this._commands.length-1;n>=0&&!(this._commands[n].line<this._terminal.buffer.active.baseY);n--)t++;this._commands.splice(this._commands.length-t,t)}};var oi=class extends C{constructor(t){super();this._terminal=t;this.type=4;this._idToMarkerMap=new Map;this._anonymousMarkers=new Map;this._onMarkAdded=this._register(new y);this.onMarkAdded=this._onMarkAdded.event}*markers(){for(let t of this._idToMarkerMap.values())yield t;for(let t of this._anonymousMarkers.values())yield t}addMark(t){let n=t?.marker||this._terminal.registerMarker(),i=t?.id;n&&(i?(this._idToMarkerMap.set(i,n),n.onDispose(()=>this._idToMarkerMap.delete(i))):(this._anonymousMarkers.set(n.id,n),n.onDispose(()=>this._anonymousMarkers.delete(n.id))),this._onMarkAdded.fire({marker:n,id:i,hidden:t?.hidden,hoverMessage:t?.hoverMessage}))}getMark(t){return this._idToMarkerMap.get(t)}};var si=class extends C{constructor(){super(...arguments);this.type=5;this._env={value:new Map,isTrusted:!0};this._onDidChangeEnv=this._register(new y);this.onDidChangeEnv=this._onDidChangeEnv.event}get env(){return this._createStateObject()}setEnvironment(t,n){if(!Sn(this.env.value,t)){this._env.value.clear();for(let[i,o]of Object.entries(t))o!==void 0&&this._env.value.set(i,o);this._env.isTrusted=n,this._fireEnvChange()}}startEnvironmentSingleVar(t,n){t?this._pendingEnv={value:new Map,isTrusted:n}:this._pendingEnv={value:new Map(this._env.value),isTrusted:this._env.isTrusted&&n}}setEnvironmentSingleVar(t,n,i){this._pendingEnv&&t!==void 0&&n!==void 0&&(this._pendingEnv.value.set(t,n),this._pendingEnv.isTrusted&&=i)}endEnvironmentSingleVar(t){if(!this._pendingEnv)return;this._pendingEnv.isTrusted&&=t,!is(this._env.value,this._pendingEnv.value)&&(this._env=this._pendingEnv,this._fireEnvChange()),this._pendingEnv=void 0}deleteEnvironmentSingleVar(t,n,i){this._pendingEnv&&t!==void 0&&n!==void 0&&(this._pendingEnv.value.delete(t),this._pendingEnv.isTrusted&&=i)}_fireEnvChange(){this._onDidChangeEnv.fire(this._createStateObject())}_createStateObject(){return{value:Object.fromEntries(this._env.value),isTrusted:this._env.isTrusted}}};var ai=class extends C{constructor(){super(...arguments);this.type=6;this._onPromptTypeChanged=this._register(new y);this.onPromptTypeChanged=this._onPromptTypeChanged.event}get promptType(){return this._promptType}setPromptType(t){this._promptType=t,this._onPromptTypeChanged.fire(t)}};var li=class extends C{constructor(t,n,i,o,s){super();this._nonce=t;this._disableTelemetry=n;this._onDidExecuteText=i;this._telemetryService=o;this._logService=s;this.capabilities=this._register(new Ge);this._hasUpdatedTelemetry=!1;this._commonProtocolDisposables=[];this._seenSequences=new Set;this._status=0;this._onDidChangeStatus=this._register(new y);this.onDidChangeStatus=this._onDidChangeStatus.event;this._onDidChangeSeenSequences=this._register(new y);this.onDidChangeSeenSequences=this._onDidChangeSeenSequences.event;this._register(Q(()=>{this._clearActivationTimeout(),this._disposeCommonProtocol()}))}get seenSequences(){return this._seenSequences}get status(){return this._status}_disposeCommonProtocol(){Pe(this._commonProtocolDisposables),this._commonProtocolDisposables.length=0}activate(t){this._terminal=t,this.capabilities.add(3,this._register(new ii(this._terminal,this._onDidExecuteText))),this._register(t.parser.registerOscHandler(633,n=>this._handleVSCodeSequence(n))),this._register(t.parser.registerOscHandler(1337,n=>this._doHandleITermSequence(n))),this._commonProtocolDisposables.push(t.parser.registerOscHandler(133,n=>this._handleFinalTermSequence(n))),this._register(t.parser.registerOscHandler(7,n=>this._doHandleSetCwd(n))),this._register(t.parser.registerOscHandler(9,n=>this._doHandleSetWindowsFriendlyCwd(n))),this._ensureCapabilitiesOrAddFailureTelemetry()}getMarkerId(t,n){this._createOrGetBufferMarkDetection(t).getMark(n)}setNextCommandId(t,n){this._terminal&&this._createOrGetCommandDetection(this._terminal).setNextCommandId(t,n)}_markSequenceSeen(t){this._seenSequences.has(t)||(this._seenSequences.add(t),this._onDidChangeSeenSequences.fire(this._seenSequences))}_handleFinalTermSequence(t){let n=this._doHandleFinalTermSequence(t);return this._status===0&&(this._status=1,this._onDidChangeStatus.fire(this._status)),n}_doHandleFinalTermSequence(t){if(!this._terminal)return!1;let[n,...i]=t.split(";");switch(this._logService.trace(`ShellIntegrationAddon#_doHandleFinalTermSequence: received sequence ${n}`),this._markSequenceSeen(n),n){case"A":return this._createOrGetCommandDetection(this._terminal).handlePromptStart(),!0;case"B":return this._createOrGetCommandDetection(this._terminal).handleCommandStart({ignoreCommandLine:!0}),!0;case"C":return this._createOrGetCommandDetection(this._terminal).handleCommandExecuted(),!0;case"D":{let o=i.length===1?parseInt(i[0]):void 0;return this._createOrGetCommandDetection(this._terminal).handleCommandFinished(o),!0}}return!1}_handleVSCodeSequence(t){let n=this._doHandleVSCodeSequence(t);return!this._hasUpdatedTelemetry&&n&&(this._telemetryService?.publicLog2("terminal/shellIntegrationActivationSucceeded"),this._hasUpdatedTelemetry=!0,this._clearActivationTimeout()),this._status!==2&&(this._status=2,this._onDidChangeStatus.fire(this._status)),n}async _ensureCapabilitiesOrAddFailureTelemetry(){!this._telemetryService||this._disableTelemetry||(this._activationTimeout=setTimeout(()=>{!this.capabilities.get(2)&&!this.capabilities.get(0)&&(this._telemetryService?.publicLog2("terminal/shellIntegrationActivationTimeout"),this._logService.warn("Shell integration failed to add capabilities within 10 seconds")),this._hasUpdatedTelemetry=!0},1e4))}_clearActivationTimeout(){this._activationTimeout!==void 0&&(clearTimeout(this._activationTimeout),this._activationTimeout=void 0)}_doHandleVSCodeSequence(t){if(!this._terminal)return!1;let n=t.indexOf(";"),i=n===-1?t:t.substring(0,n);this._logService.trace(`ShellIntegrationAddon#_doHandleVSCodeSequence: received sequence ${i}`),this._markSequenceSeen(i);let o=n===-1?[]:t.substring(n+1).split(";");switch(i){case"A":return this._createOrGetCommandDetection(this._terminal).handlePromptStart(),!0;case"B":return this._createOrGetCommandDetection(this._terminal).handleCommandStart(),!0;case"C":return this._createOrGetCommandDetection(this._terminal).handleCommandExecuted(),!0;case"D":{let s=o[0],a=s!==void 0?parseInt(s):void 0;return this._createOrGetCommandDetection(this._terminal).handleCommandFinished(a),!0}case"E":{let s=o[0],a=o[1],l;return s!==void 0?l=Gn(s):l="",this._createOrGetCommandDetection(this._terminal).setCommandLine(l,a===this._nonce),!0}case"F":return this._createOrGetCommandDetection(this._terminal).handleContinuationStart(),!0;case"G":return this._createOrGetCommandDetection(this._terminal).handleContinuationEnd(),!0;case"EnvJson":{let s=o[0],a=o[1];if(s!==void 0)try{let l=JSON.parse(Gn(s));this._createOrGetShellEnvDetection().setEnvironment(l,a===this._nonce)}catch{this._logService.warn("Failed to parse environment from shell integration sequence",s)}return!0}case"EnvSingleStart":return this._createOrGetShellEnvDetection().startEnvironmentSingleVar(o[0]==="1",o[1]===this._nonce),!0;case"EnvSingleDelete":{let s=o[0],a=o[1],l=o[2];if(s!==void 0&&a!==void 0){let u=Gn(a);this._createOrGetShellEnvDetection().deleteEnvironmentSingleVar(s,u,l===this._nonce)}return!0}case"EnvSingleEntry":{let s=o[0],a=o[1],l=o[2];if(s!==void 0&&a!==void 0){let u=Gn(a);this._createOrGetShellEnvDetection().setEnvironmentSingleVar(s,u,l===this._nonce)}return!0}case"EnvSingleEnd":return this._createOrGetShellEnvDetection().endEnvironmentSingleVar(o[0]===this._nonce),!0;case"H":return this._createOrGetCommandDetection(this._terminal).handleRightPromptStart(),!0;case"I":return this._createOrGetCommandDetection(this._terminal).handleRightPromptEnd(),!0;case"P":{let s=o[0],a=s!==void 0?Gn(s):"",{key:l,value:u}=yl(a);if(u===void 0)return!0;switch(l){case"ContinuationPrompt":return this._updateContinuationPrompt(Xs(u)),!0;case"Cwd":{let p=o[1];return this._updateCwd(u,p!==void 0&&p===this._nonce),!0}case"IsWindows":return this._createOrGetCommandDetection(this._terminal).setIsWindowsPty(u==="True"),!0;case"HasRichCommandDetection":return this._createOrGetCommandDetection(this._terminal).setHasRichCommandDetection(u==="True"),!0;case"Prompt":{let p=u.replace(/\x1b\[[0-9;]*m/g,"");return this._updatePromptTerminator(p),!0}case"PromptType":return this._createOrGetPromptTypeDetection().setPromptType(u),!0;case"Task":return this._createOrGetBufferMarkDetection(this._terminal),this.capabilities.get(2)?.setIsCommandStorageDisabled(),!0}}case"SetMark":return this._createOrGetBufferMarkDetection(this._terminal).addMark(Rd(o)),!0}return!1}_updateContinuationPrompt(t){this._terminal&&this._createOrGetCommandDetection(this._terminal).setContinuationPrompt(t)}_updatePromptTerminator(t){if(!this._terminal)return;let n=t.substring(t.lastIndexOf(`
`)+1),o=n.trim().length===1?n:n.substring(n.lastIndexOf(" "));o&&this._createOrGetCommandDetection(this._terminal).setPromptTerminator(o,n)}_updateCwd(t,n=!0){t=Ya(t),this._createOrGetCwdDetection().updateCwd(t,n),this.capabilities.get(2)?.setCwd(t)}_doHandleITermSequence(t){if(!this._terminal)return!1;let[n]=t.split(";");switch(this._markSequenceSeen(`1337;${n}`),n){case"SetMark":this._createOrGetBufferMarkDetection(this._terminal).addMark();default:{let{key:i,value:o}=yl(n);if(o===void 0)return!0;if(i==="CurrentDir")return this._updateCwd(o,!1),!0}}return!1}_doHandleSetWindowsFriendlyCwd(t){if(!this._terminal)return!1;let[n,...i]=t.split(";");return this._markSequenceSeen(`9;${n}`),n==="9"?(i.length&&this._updateCwd(i[0],!1),!0):!1}_doHandleSetCwd(t){if(!this._terminal)return!1;let[n]=t.split(";");if(this._markSequenceSeen(`7;${n}`),n.match(/^file:\/\/.*\//)){let i=A.parse(n);if(i.path&&i.path.length>0)return this._updateCwd(i.path,!1),!0}return!1}serialize(){return!this._terminal||!this.capabilities.has(2)?{isWindowsPty:!1,hasRichCommandDetection:!1,commands:[],promptInputModel:void 0}:this._createOrGetCommandDetection(this._terminal).serialize()}deserialize(t){if(!this._terminal)throw new Error("Cannot restore commands before addon is activated");let n=this._createOrGetCommandDetection(this._terminal);n.deserialize(t),n.cwd&&this._updateCwd(n.cwd,!1)}_createOrGetCwdDetection(){let t=this.capabilities.get(0);return t||(t=this._register(new ri),this.capabilities.add(0,t)),t}_createOrGetCommandDetection(t){let n=this.capabilities.get(2);return n||(n=this._register(new Lt(t,this._logService)),this.capabilities.add(2,n)),n}_createOrGetBufferMarkDetection(t){let n=this.capabilities.get(4);return n||(n=this._register(new oi(t)),this.capabilities.add(4,n)),n}_createOrGetShellEnvDetection(){let t=this.capabilities.get(5);return t||(t=this._register(new si),this.capabilities.add(5,t)),t}_createOrGetPromptTypeDetection(){let t=this.capabilities.get(6);return t||(t=this._register(new ai),this.capabilities.add(6,t)),t}};function Gn(r){return r.replaceAll(/\\(\\|x([0-9a-f]{2}))/gi,(e,t,n)=>n?String.fromCharCode(parseInt(n,16)):t)}function yl(r){let e=r.indexOf("=");return e===-1?{key:r,value:void 0}:{key:r.substring(0,e),value:r.substring(1+e)}}function Rd(r){let e,t=!1;for(let n of r)n!==void 0&&(n==="Hidden"&&(t=!0),n.startsWith("Id=")&&(e=n.substring(3)));return{id:e,hidden:t}}function vl(r,e={}){let t="";return e.excludeLeadingNewLine||(t+=`\r
`),t+="\x1B[0m\x1B[7m * ",e.loudFormatting?t+="\x1B[0;104m":t+="\x1B[0m",t+=` ${r} \x1B[0m
\r`,t}function ko(r){let e=[];typeof r=="number"&&e.push("code/timeOrigin",r);function t(o,s){e.push(o,s?.startTime??Date.now())}function n(){let o=[];for(let s=0;s<e.length;s+=2)o.push({name:e[s],startTime:e[s+1]});return o}function i(o){if(typeof o>"u"){let s=e.length>=2&&e[0]==="code/timeOrigin",a=s?e[1]:void 0;e.length=0,s&&e.push("code/timeOrigin",a)}else for(let s=e.length-2;s>=0;s-=2)e[s]===o&&e.splice(s,2)}return{mark:t,getMarks:n,clearMarks:i}}function Ld(){if(typeof performance=="object"&&typeof performance.mark=="function"&&!performance.nodeTiming)return typeof performance.timeOrigin!="number"&&!performance.timing?ko():{mark(r,e){performance.mark(r,e)},clearMarks(r){performance.clearMarks(r)},getMarks(){let r=performance.timeOrigin;typeof r!="number"&&(r=(performance.timing.navigationStart||performance.timing.redirectStart||performance.timing.fetchStart)??0);let e=[{name:"code/timeOrigin",startTime:Math.round(r)}];for(let t of performance.getEntriesByType("mark"))e.push({name:t.name,startTime:Math.round(r+t.startTime)});return e}};if(typeof process=="object"){let r=performance?.timeOrigin;return ko(r)}else return console.trace("perf-util loaded in UNKNOWN environment"),ko()}function Dd(r){return r.MonacoPerformanceMarks||(r.MonacoPerformanceMarks=Ld()),r.MonacoPerformanceMarks}var Ro=Dd(globalThis),nn=Ro.mark,f2=Ro.clearMarks,bl=Ro.getMarks;import Md from"@xterm/headless";var ui=class extends C{constructor(t,n,i,o){super();this._pointer=0;this._paused=!1;this._throttled=!1;this._register(t.onProcessData(s=>{if(this._paused||this._throttled)return;let a=G(s)?s:s.data;for(let l=0;l<a.length;l++)a[l]===n[this._pointer]?this._pointer++:this._reset(),this._pointer===n.length&&(o.debug(`Auto reply match: "${n}", response: "${i}"`),t.input(i),this._throttled=!0,fe(1e3).then(()=>this._throttled=!1),this._reset())}))}_reset(){this._pointer=0}handleResize(){w&&(this._paused=!0)}handleInput(){this._paused=!1}};var rn=class{constructor(e){this._logService=e;this._autoReplies=new Map;this._terminalProcesses=new Map;this._autoResponders=new Map}async installAutoReply(e,t){this._autoReplies.set(e,t);for(let n of this._autoResponders.keys()){let i=this._terminalProcesses.get(n);if(!i){this._logService.error("Could not find terminal process to install auto reply");continue}this._processInstallAutoReply(n,i,e,t)}}async uninstallAllAutoReplies(){for(let e of this._autoReplies.keys())for(let t of this._autoResponders.values())t.get(e)?.dispose(),t.delete(e)}handleProcessReady(e,t){this._terminalProcesses.set(e,t),this._autoResponders.set(e,new Map);for(let[n,i]of this._autoReplies.entries())this._processInstallAutoReply(e,t,n,i)}handleProcessDispose(e){let t=this._autoResponders.get(e);if(t){for(let n of t.values())n.dispose();t.clear()}this._autoResponders.delete(e),this._terminalProcesses.delete(e)}handleProcessInput(e,t){let n=this._autoResponders.get(e);if(n)for(let i of n.values())i.handleInput()}handleProcessResize(e,t,n){let i=this._autoResponders.get(e);if(i)for(let o of i.values())o.handleResize()}_processInstallAutoReply(e,t,n,i){let o=this._autoResponders.get(e);o&&(o.get(n)?.dispose(),o.set(n,new ui(t,n,i,this._logService)))}};rn=h([ye(0,Se)],rn);var{Terminal:Ud}=Md;function Fd(r,e){if(r==="createProcess"&&e.length>5){let t=[...e];return e[5]&&typeof e[5]=="object"&&(t[5]=Wn(e[5])),e[6]&&typeof e[6]=="object"&&(t[6]=Wn(e[6])),t}return e}function V(r,e,t){if(!ut(t.value))throw new Error("not supported");let n="value",i=t.value;t[n]=async function(...o){if(this.traceRpcArgs.logService.getLevel()===1){let a=Fd(i.name,o);this.traceRpcArgs.logService.trace(`[RPC Request] PtyService#${i.name}(${a.map(l=>JSON.stringify(l)).join(", ")})`)}this.traceRpcArgs.simulatedLatency&&await fe(this.traceRpcArgs.simulatedLatency);let s;try{s=await i.apply(this,o)}catch(a){throw this.traceRpcArgs.logService.error(`[RPC Response] PtyService#${i.name}`,a),a}return this.traceRpcArgs.logService.getLevel()===1&&this.traceRpcArgs.logService.trace(`[RPC Response] PtyService#${i.name}`,s),s}}var Lo,Do,F=class extends C{constructor(t,n,i,o){super();this._logService=t;this._productService=n;this._reconnectConstants=i;this._simulatedLatency=o;this._ptys=new Map;this._workspaceLayoutInfos=new Map;this._revivedPtyIdMap=new Map;this._lastPtyId=0;this._onHeartbeat=this._register(new y);this.onHeartbeat=this._traceEvent("_onHeartbeat",this._onHeartbeat.event);this._onProcessData=this._register(new y);this.onProcessData=this._traceEvent("_onProcessData",this._onProcessData.event);this._onProcessReplay=this._register(new y);this.onProcessReplay=this._traceEvent("_onProcessReplay",this._onProcessReplay.event);this._onProcessReady=this._register(new y);this.onProcessReady=this._traceEvent("_onProcessReady",this._onProcessReady.event);this._onProcessExit=this._register(new y);this.onProcessExit=this._traceEvent("_onProcessExit",this._onProcessExit.event);this._onProcessOrphanQuestion=this._register(new y);this.onProcessOrphanQuestion=this._traceEvent("_onProcessOrphanQuestion",this._onProcessOrphanQuestion.event);this._onDidRequestDetach=this._register(new y);this.onDidRequestDetach=this._traceEvent("_onDidRequestDetach",this._onDidRequestDetach.event);this._onDidChangeProperty=this._register(new y);this.onDidChangeProperty=this._traceEvent("_onDidChangeProperty",this._onDidChangeProperty.event);this._register(Q(()=>{for(let s of this._ptys.values())s.shutdown(!0);this._ptys.clear()})),this._detachInstanceRequestStore=this._register(new Jt(void 0,this._logService)),this._register(this._detachInstanceRequestStore.onCreateRequest(this._onDidRequestDetach.fire,this._onDidRequestDetach)),this._autoRepliesContribution=new rn(this._logService),this._contributions=[this._autoRepliesContribution]}async installAutoReply(t,n){await this._autoRepliesContribution.installAutoReply(t,n)}async uninstallAllAutoReplies(){await this._autoRepliesContribution.uninstallAllAutoReplies()}_traceEvent(t,n){return n(i=>{this._logService.getLevel()===1&&this._logService.trace(`[RPC Event] PtyService#${t}.fire(${JSON.stringify(i)})`)}),n}get traceRpcArgs(){return{logService:this._logService,simulatedLatency:this._simulatedLatency}}async refreshIgnoreProcessNames(t){ti.length=0,ti.push(...t)}async requestDetachInstance(t,n){return this._detachInstanceRequestStore.createRequest({workspaceId:t,instanceId:n})}async acceptDetachInstanceReply(t,n){let i,o=this._ptys.get(n);o&&(i=await this._buildProcessDetails(n,o)),this._detachInstanceRequestStore.acceptReply(t,i)}async freePortKillProcess(t){let i=(await new Promise((o,s)=>{Od(w?`netstat -ano | findstr "${t}"`:`lsof -nP -iTCP -sTCP:LISTEN | grep ${t}`,{},(a,l)=>{if(a)return s("Problem occurred when listing active processes");o(l)})})).split(/\r?\n/).filter(o=>!!o.trim());if(i.length>=1){let o=/\s+(\d+)(?:\s+|$)/,s=i[0].match(o)?.[1];if(s)try{process.kill(Number.parseInt(s))}catch{}else throw new Error(`Processes for port ${t} were not found`);return{port:t,processId:s}}throw new Error(`Could not kill process with port ${t}`)}async serializeTerminalState(t){let n=[];for(let[o,s]of this._ptys.entries())s.hasWrittenData&&t.indexOf(o)!==-1&&n.push(Zi.withAsyncBody(async a=>{a({id:o,shellLaunchConfig:s.shellLaunchConfig,processDetails:await this._buildProcessDetails(o,s),processLaunchConfig:s.processLaunchOptions,unicodeVersion:s.unicodeVersion,replayEvent:await s.serializeNormalBuffer(),timestamp:Date.now()})}));let i={version:1,state:await Promise.all(n)};return JSON.stringify(i)}async reviveTerminalProcesses(t,n,i){let o=[];for(let s of n)o.push(this._reviveTerminalProcess(t,s));await Promise.all(o)}async _reviveTerminalProcess(t,n){let i=g(3101,null),o="";if(w){let l=n.replayEvent.events.length>0?n.replayEvent.events.at(-1):void 0;l&&(o+=`\r
`.repeat(l.rows-1)+"\x1B[H")}let s=await this.createProcess({...n.shellLaunchConfig,cwd:n.processDetails.cwd,color:n.processDetails.color,icon:n.processDetails.icon,name:n.processDetails.titleSource===0?n.processDetails.title:void 0,initialText:n.replayEvent.events[0].data+vl(i,{loudFormatting:!0})+o},n.processDetails.cwd,n.replayEvent.events[0].cols,n.replayEvent.events[0].rows,n.unicodeVersion,n.processLaunchConfig.env,n.processLaunchConfig.executableEnv,n.processLaunchConfig.options,!0,n.processDetails.workspaceId,n.processDetails.workspaceName,!0,n.replayEvent.events[0].data),a=this._getRevivingProcessId(t,n.id);this._revivedPtyIdMap.set(a,{newId:s,state:n}),this._logService.info(`Revived process, old id ${a} -> new id ${s}`)}async shutdownAll(){this.dispose()}async createProcess(t,n,i,o,s,a,l,u,p,c,d,m,f){if(t.attachPersistentProcess)throw new Error("Attempt to create a process when attach object was provided");let b=++this._lastPtyId,E=new Me(t,n,i,o,a,l,u,this._logService,this._productService),q={env:a,executableEnv:l,options:u},H=new Ao(b,E,c,d,p,i,o,q,s,this._reconnectConstants,this._logService,m&&G(t.initialText)?t.initialText:void 0,f,t.icon,t.color,t.name,t.fixedDimensions);return E.onProcessExit(B=>{for(let ge of this._contributions)ge.handleProcessDispose(b);H.dispose(),this._ptys.delete(b),this._onProcessExit.fire({id:b,event:B})}),H.onProcessData(B=>this._onProcessData.fire({id:b,event:B})),H.onProcessReplay(B=>this._onProcessReplay.fire({id:b,event:B})),H.onProcessReady(B=>this._onProcessReady.fire({id:b,event:B})),H.onProcessOrphanQuestion(()=>this._onProcessOrphanQuestion.fire({id:b})),H.onDidChangeProperty(B=>this._onDidChangeProperty.fire({id:b,property:B})),H.onPersistentProcessReady(()=>{for(let B of this._contributions)B.handleProcessReady(b,E)}),this._ptys.set(b,H),b}async attachToProcess(t){try{await this._throwIfNoPty(t).attach(),this._logService.info(`Persistent process reconnection "${t}"`)}catch(n){throw this._logService.warn(`Persistent process reconnection "${t}" failed`,n.message),n}}async updateTitle(t,n,i){this._throwIfNoPty(t).setTitle(n,i)}async updateIcon(t,n,i,o){this._throwIfNoPty(t).setIcon(n,i,o)}async clearBuffer(t){this._throwIfNoPty(t).clearBuffer()}async refreshProperty(t,n){return this._throwIfNoPty(t).refreshProperty(n)}async updateProperty(t,n,i){return this._throwIfNoPty(t).updateProperty(n,i)}async detachFromProcess(t,n){return this._throwIfNoPty(t).detach(n)}async reduceConnectionGraceTime(){for(let t of this._ptys.values())t.reduceGraceTime()}async listProcesses(){let t=Array.from(this._ptys.entries()).filter(([o,s])=>s.shouldPersistTerminal);this._logService.info(`Listing ${t.length} persistent terminals, ${this._ptys.size} total terminals`);let n=t.map(async([o,s])=>this._buildProcessDetails(o,s));return(await Promise.all(n)).filter(o=>o.isOrphan)}async getPerformanceMarks(){return bl()}async start(t){let n=this._ptys.get(t);return n?n.start():{message:`Could not find pty with id "${t}"`}}async shutdown(t,n){return this._ptys.get(t)?.shutdown(n)}async input(t,n){let i=this._throwIfNoPty(t);if(i){for(let o of this._contributions)o.handleProcessInput(t,n);i.input(n)}}async sendSignal(t,n){return this._throwIfNoPty(t).sendSignal(n)}async processBinary(t,n){return this._throwIfNoPty(t).writeBinary(n)}async resize(t,n,i,o,s){let a=this._throwIfNoPty(t);if(a){for(let l of this._contributions)l.handleProcessResize(t,n,i,o,s);a.resize(n,i,o,s)}}async getInitialCwd(t){return this._throwIfNoPty(t).getInitialCwd()}async getCwd(t){return this._throwIfNoPty(t).getCwd()}async acknowledgeDataEvent(t,n){return this._throwIfNoPty(t).acknowledgeDataEvent(n)}async setUnicodeVersion(t,n){return this._throwIfNoPty(t).setUnicodeVersion(n)}async setNextCommandId(t,n,i){return this._throwIfNoPty(t).setNextCommandId(n,i)}async getLatency(){return[]}async orphanQuestionReply(t){return this._throwIfNoPty(t).orphanQuestionReply()}async getDefaultSystemShell(t=rr){return Ga(t,process.env)}async getEnvironment(){return{...process.env}}async getWslPath(t,n){if(n==="win-to-unix"){if(!w)return t;if(await Zt()<17063)return t.replace(/\\/g,"/");let i=await this._getWSLExecutablePath();return i?new Promise(o=>{_l(i,["-e","wslpath",t],{},(a,l,u)=>{o(a?t:Qa(l.trim(),"bash"))}).stdin.end()}):t}if(n==="unix-to-win"&&w){if(await Zt()<17063)return t;let i=await this._getWSLExecutablePath();return i?new Promise(o=>{_l(i,["-e","wslpath","-w",t],{},(a,l,u)=>{o(a?t:l.trim())}).stdin.end()}):t}return t}async _getWSLExecutablePath(){let t=await Zt()>=16299,n=process.env.hasOwnProperty("PROCESSOR_ARCHITEW6432"),i=process.env.SystemRoot;if(i)return O(i,n?"Sysnative":"System32",t?"wsl.exe":"bash.exe")}async getRevivedPtyNewId(t,n){try{return this._revivedPtyIdMap.get(this._getRevivingProcessId(t,n))?.newId}catch(i){this._logService.warn(`Couldn't find terminal ID ${t}-${n}`,i.message)}}async setTerminalLayoutInfo(t){this._workspaceLayoutInfos.set(t.workspaceId,t)}async getTerminalLayoutInfo(t){nn("code/willGetTerminalLayoutInfo");let n=this._workspaceLayoutInfos.get(t.workspaceId);if(n){let i=new Set,s=(await Promise.all(n.tabs.map(async l=>this._expandTerminalTab(t.workspaceId,l,i)))).filter(l=>l.terminals.length>0),a=(await Promise.all(n.background?.map(l=>this._expandTerminalInstance(t.workspaceId,l,i))??[])).filter(l=>l.terminal!==null).map(l=>l.terminal);return nn("code/didGetTerminalLayoutInfo"),{tabs:s,background:a}}nn("code/didGetTerminalLayoutInfo")}async _expandTerminalTab(t,n,i){let s=(await Promise.all(n.terminals.map(a=>this._expandTerminalInstance(t,a,i)))).filter(a=>a.terminal!==null);return{isActive:n.isActive,activePersistentProcessId:n.activePersistentProcessId,terminals:s}}async _expandTerminalInstance(t,n,i){let o=!De(n),s=o?n.terminal:n;try{let a=this._getRevivingProcessId(t,s),l=this._revivedPtyIdMap.get(a)?.newId;this._logService.info(`Expanding terminal instance, old id ${a} -> new id ${l}`),this._revivedPtyIdMap.delete(a);let u=l??s;if(i.has(u))throw new Error(`Terminal ${u} has already been expanded`);i.add(u);let p=this._throwIfNoPty(u);return{terminal:{...p&&await this._buildProcessDetails(s,p,l!==void 0),id:u},relativeSize:o?n.relativeSize:0}}catch(a){return this._logService.warn("Couldn't get layout info, a terminal was probably disconnected",a.message),this._logService.debug("Reattach to wrong terminal debug info - layout info by id",n),this._logService.debug("Reattach to wrong terminal debug info - _revivePtyIdMap",Array.from(this._revivedPtyIdMap.values())),this._logService.debug("Reattach to wrong terminal debug info - _ptys ids",Array.from(this._ptys.keys())),{terminal:null,relativeSize:o?n.relativeSize:0}}}_getRevivingProcessId(t,n){return`${t}-${n}`}async _buildProcessDetails(t,n,i=!1){nn(`code/willBuildProcessDetails/${t}`);let[o,s]=await Promise.all([n.getCwd(),i?!0:n.isOrphaned()]),a={id:t,title:n.title,titleSource:n.titleSource,pid:n.pid,workspaceId:n.workspaceId,workspaceName:n.workspaceName,cwd:o,isOrphan:s,icon:n.icon,color:n.color,fixedDimensions:n.fixedDimensions,environmentVariableCollections:n.processLaunchOptions.options.environmentVariableCollections,reconnectionProperties:n.shellLaunchConfig.reconnectionProperties,waitOnExit:n.shellLaunchConfig.waitOnExit,hideFromUser:n.shellLaunchConfig.hideFromUser,isFeatureTerminal:n.shellLaunchConfig.isFeatureTerminal,type:n.shellLaunchConfig.type,hasChildProcesses:n.hasChildProcesses,shellIntegrationNonce:n.processLaunchOptions.options.shellIntegration.nonce,tabActions:n.shellLaunchConfig.tabActions};return nn(`code/didBuildProcessDetails/${t}`),a}_throwIfNoPty(t){let n=this._ptys.get(t);if(!n)throw new Le(`Could not find pty ${t} on pty host`);return n}};h([V],F.prototype,"installAutoReply",1),h([V],F.prototype,"uninstallAllAutoReplies",1),h([L],F.prototype,"traceRpcArgs",1),h([V],F.prototype,"refreshIgnoreProcessNames",1),h([V],F.prototype,"requestDetachInstance",1),h([V],F.prototype,"acceptDetachInstanceReply",1),h([V],F.prototype,"freePortKillProcess",1),h([V],F.prototype,"serializeTerminalState",1),h([V],F.prototype,"reviveTerminalProcesses",1),h([V],F.prototype,"shutdownAll",1),h([V],F.prototype,"createProcess",1),h([V],F.prototype,"attachToProcess",1),h([V],F.prototype,"updateTitle",1),h([V],F.prototype,"updateIcon",1),h([V],F.prototype,"clearBuffer",1),h([V],F.prototype,"refreshProperty",1),h([V],F.prototype,"updateProperty",1),h([V],F.prototype,"detachFromProcess",1),h([V],F.prototype,"reduceConnectionGraceTime",1),h([V],F.prototype,"listProcesses",1),h([V],F.prototype,"getPerformanceMarks",1),h([V],F.prototype,"start",1),h([V],F.prototype,"shutdown",1),h([V],F.prototype,"input",1),h([V],F.prototype,"sendSignal",1),h([V],F.prototype,"processBinary",1),h([V],F.prototype,"resize",1),h([V],F.prototype,"getInitialCwd",1),h([V],F.prototype,"getCwd",1),h([V],F.prototype,"acknowledgeDataEvent",1),h([V],F.prototype,"setUnicodeVersion",1),h([V],F.prototype,"setNextCommandId",1),h([V],F.prototype,"getLatency",1),h([V],F.prototype,"orphanQuestionReply",1),h([V],F.prototype,"getDefaultSystemShell",1),h([V],F.prototype,"getEnvironment",1),h([V],F.prototype,"getWslPath",1),h([V],F.prototype,"getRevivedPtyNewId",1),h([V],F.prototype,"setTerminalLayoutInfo",1),h([V],F.prototype,"getTerminalLayoutInfo",1);var Ao=class extends C{constructor(t,n,i,o,s,a,l,u,p,c,d,m,f,b,E,q,H){super();this._persistentProcessId=t;this._terminalProcess=n;this.workspaceId=i;this.workspaceName=o;this.shouldPersistTerminal=s;this.processLaunchOptions=u;this.unicodeVersion=p;this._logService=d;this._icon=b;this._color=E;this._pendingCommands=new Map;this._isStarted=!1;this._orphanRequestQueue=new yn;this._onProcessReplay=this._register(new y);this.onProcessReplay=this._onProcessReplay.event;this._onProcessReady=this._register(new y);this.onProcessReady=this._onProcessReady.event;this._onPersistentProcessReady=this._register(new y);this.onPersistentProcessReady=this._onPersistentProcessReady.event;this._onProcessData=this._register(new y);this.onProcessData=this._onProcessData.event;this._onProcessOrphanQuestion=this._register(new y);this.onProcessOrphanQuestion=this._onProcessOrphanQuestion.event;this._onDidChangeProperty=this._register(new y);this.onDidChangeProperty=this._onDidChangeProperty.event;this._inReplay=!1;this._pid=-1;this._cwd="";this._titleSource=1;this._interactionState=new Oo(`Persistent process "${this._persistentProcessId}" interaction state`,"None",this._logService),this._wasRevived=m!==void 0,this._serializer=new Mo(a,l,c.scrollback,p,m,u.options.shellIntegration.nonce,s?f:void 0,this._logService),q&&this.setTitle(q,0),this._fixedDimensions=H,this._orphanQuestionBarrier=null,this._orphanQuestionReplyTime=0,this._disconnectRunner1=this._register(new vn(()=>{this._logService.info(`Persistent process "${this._persistentProcessId}": The reconnection grace time of ${xl(c.graceTime)} has expired, shutting down pid "${this._pid}"`),this.shutdown(!0)},c.graceTime)),this._disconnectRunner2=this._register(new vn(()=>{this._logService.info(`Persistent process "${this._persistentProcessId}": The short reconnection grace time of ${xl(c.shortGraceTime)} has expired, shutting down pid ${this._pid}`),this.shutdown(!0)},c.shortGraceTime)),this._register(this._terminalProcess.onProcessExit(()=>this._bufferer.stopBuffering(this._persistentProcessId))),this._register(this._terminalProcess.onProcessReady(B=>{this._pid=B.pid,this._cwd=B.cwd,this._onProcessReady.fire(B)})),this._register(this._terminalProcess.onDidChangeProperty(B=>{this._onDidChangeProperty.fire(B)})),this._bufferer=new jr((B,ge)=>this._onProcessData.fire(ge)),this._register(this._bufferer.startBuffering(this._persistentProcessId,this._terminalProcess.onProcessData)),this._register(this.onProcessData(B=>this._serializer.handleData(B)))}get pid(){return this._pid}get shellLaunchConfig(){return this._terminalProcess.shellLaunchConfig}get hasWrittenData(){return this._interactionState.value!=="None"}get title(){return this._title||this._terminalProcess.currentTitle}get titleSource(){return this._titleSource}get icon(){return this._icon}get color(){return this._color}get fixedDimensions(){return this._fixedDimensions}get hasChildProcesses(){return this._terminalProcess.hasChildProcesses}setTitle(t,n){n===0&&(this._interactionState.setValue("Session","setTitle"),this._serializer.freeRawReviveBuffer()),this._title=t,this._titleSource=n}setIcon(t,n,i){(!this._icon||Jn(n,{id:!0})&&Jn(this._icon,{id:!0})&&n.id!==this._icon.id||!this.color||i!==this._color)&&(this._serializer.freeRawReviveBuffer(),t&&this._interactionState.setValue("Session","setIcon")),this._icon=n,this._color=i}_setFixedDimensions(t){this._fixedDimensions=t}async attach(){!this._disconnectRunner1.isScheduled()&&!this._disconnectRunner2.isScheduled()&&this._logService.warn(`Persistent process "${this._persistentProcessId}": Process had no disconnect runners but was an orphan`),this._disconnectRunner1.cancel(),this._disconnectRunner2.cancel()}async detach(t){this.shouldPersistTerminal&&(this._interactionState.value!=="None"||t)?this._disconnectRunner1.schedule():this.shutdown(!0)}serializeNormalBuffer(){return this._serializer.generateReplayEvent(!0,this._interactionState.value!=="Session")}async refreshProperty(t){return this._terminalProcess.refreshProperty(t)}async updateProperty(t,n){if(t==="fixedDimensions")return this._setFixedDimensions(n)}async start(){if(!this._isStarted){let t=await this._terminalProcess.start();return t&&Jn(t,{message:!0})||(this._isStarted=!0,this._wasRevived?this.triggerReplay():this._onPersistentProcessReady.fire()),t}this._onProcessReady.fire({pid:this._pid,cwd:this._cwd,windowsPty:this._terminalProcess.getWindowsPty()}),this._onDidChangeProperty.fire({type:"title",value:this._terminalProcess.currentTitle}),this._onDidChangeProperty.fire({type:"shellType",value:this._terminalProcess.shellType}),this.triggerReplay()}shutdown(t){return this._terminalProcess.shutdown(t)}input(t){if(this._interactionState.setValue("Session","input"),this._serializer.freeRawReviveBuffer(),!this._inReplay)return this._terminalProcess.input(t)}sendSignal(t){if(!this._inReplay)return this._terminalProcess.sendSignal(t)}writeBinary(t){return this._terminalProcess.processBinary(t)}resize(t,n,i,o){if(!this._inReplay)return this._serializer.handleResize(t,n),this._bufferer.flushBuffer(this._persistentProcessId),this._terminalProcess.resize(t,n,i,o)}async clearBuffer(){this._serializer.clearBuffer(),this._terminalProcess.clearBuffer()}setUnicodeVersion(t){this.unicodeVersion=t,this._serializer.setUnicodeVersion?.(t)}async setNextCommandId(t,n){this._serializer.setNextCommandId?.(t,n)}acknowledgeDataEvent(t){if(!this._inReplay)return this._terminalProcess.acknowledgeDataEvent(t)}getInitialCwd(){return this._terminalProcess.getInitialCwd()}getCwd(){return this._terminalProcess.getCwd()}async triggerReplay(){this._interactionState.value==="None"&&this._interactionState.setValue("ReplayOnly","triggerReplay");let t=await this._serializer.generateReplayEvent(),n=0;for(let i of t.events)n+=i.data.length;this._logService.info(`Persistent process "${this._persistentProcessId}": Replaying ${n} chars and ${t.events.length} size events`),this._onProcessReplay.fire(t),this._terminalProcess.clearUnacknowledgedChars(),this._onPersistentProcessReady.fire()}sendCommandResult(t,n,i){this._pendingCommands.get(t)&&this._pendingCommands.delete(t)}orphanQuestionReply(){if(this._orphanQuestionReplyTime=Date.now(),this._orphanQuestionBarrier){let t=this._orphanQuestionBarrier;this._orphanQuestionBarrier=null,t.open()}}reduceGraceTime(){this._disconnectRunner2.isScheduled()||this._disconnectRunner1.isScheduled()&&this._disconnectRunner2.schedule()}async isOrphaned(){return await this._orphanRequestQueue.queue(async()=>this._isOrphaned())}async _isOrphaned(){return this._disconnectRunner1.isScheduled()||this._disconnectRunner2.isScheduled()?!0:(this._orphanQuestionBarrier||(this._orphanQuestionBarrier=new vr(4e3),this._orphanQuestionReplyTime=0,this._onProcessOrphanQuestion.fire()),await this._orphanQuestionBarrier.wait(),Date.now()-this._orphanQuestionReplyTime>500)}},Oo=class{constructor(e,t,n){this._name=e;this._value=t;this._logService=n;this._log("initialized")}get value(){return this._value}setValue(e,t){this._value!==e&&(this._value=e,this._log(t))}_log(e){this._logService.debug(`MutationLogger "${this._name}" set to "${this._value}", reason: ${e}`)}},Mo=class{constructor(e,t,n,i,o,s,a,l){this._rawReviveBuffer=a;this._xterm=new Ud({cols:e,rows:t,scrollback:n,allowProposedApi:!0}),o&&this._xterm.writeln(o),this.setUnicodeVersion(i),this._shellIntegrationAddon=new li(s,!0,void 0,void 0,l),this._xterm.loadAddon(this._shellIntegrationAddon)}freeRawReviveBuffer(){this._rawReviveBuffer=void 0}handleData(e){this._xterm.write(e)}handleResize(e,t){this._xterm.resize(e,t)}clearBuffer(){this._xterm.clear()}setNextCommandId(e,t){this._shellIntegrationAddon.setNextCommandId(e,t)}async generateReplayEvent(e,t){let n=new(await this._getSerializeConstructor());this._xterm.loadAddon(n);let i={scrollback:this._xterm.options.scrollback};e&&(i.excludeAltBuffer=!0,i.excludeModes=!0);let o;return t&&this._rawReviveBuffer?o=this._rawReviveBuffer:o=n.serialize(i),{events:[{cols:this._xterm.cols,rows:this._xterm.rows,data:o}],commands:this._shellIntegrationAddon.serialize()}}async setUnicodeVersion(e){this._xterm.unicode.activeVersion!==e&&(e==="11"?(this._unicodeAddon=new(await this._getUnicode11Constructor()),this._xterm.loadAddon(this._unicodeAddon)):(this._unicodeAddon?.dispose(),this._unicodeAddon=void 0),this._xterm.unicode.activeVersion=e)}async _getUnicode11Constructor(){return Do||(Do=(await import("@xterm/addon-unicode11")).Unicode11Addon),Do}async _getSerializeConstructor(){return Lo||(Lo=(await import("@xterm/addon-serialize")).SerializeAddon),Lo}};function xl(r){let e=0,t=0,n=0;r>=1e3&&(n=Math.floor(r/1e3),r-=n*1e3),n>=60&&(t=Math.floor(n/60),n-=t*60),t>=60&&(e=Math.floor(t/60),t-=e*60);let i=e?`${e}h`:"",o=t?`${t}m`:"",s=n?`${n}s`:"",a=r?`${r}ms`:"";return`${i}${o}${s}${a}`}Nd();async function Nd(){let r=parseInt(process.env.VSCODE_STARTUP_DELAY??"0"),e=parseInt(process.env.VSCODE_LATENCY??"0"),t={graceTime:parseInt(process.env.VSCODE_RECONNECT_GRACE_TIME||"0"),shortGraceTime:parseInt(process.env.VSCODE_RECONNECT_SHORT_GRACE_TIME||"0"),scrollback:parseInt(process.env.VSCODE_RECONNECT_SCROLLBACK||"100")};delete process.env.VSCODE_RECONNECT_GRACE_TIME,delete process.env.VSCODE_RECONNECT_SHORT_GRACE_TIME,delete process.env.VSCODE_RECONNECT_SCROLLBACK,delete process.env.VSCODE_LATENCY,delete process.env.VSCODE_STARTUP_DELAY,r&&await fe(r);let n=Cr(process),i;n?i=new kr:i=new Pr("ptyHost");let o=new me,s={_serviceBrand:void 0,...$a},a=new Rr(io(process.argv,ba),s),l=new qr(Na(a),a.logsHome);i.registerChannel("logger",new Nr(l,()=>As));let u=l.createLogger("ptyhost",{name:g(3100,null)}),p=new Br(u);!a.isBuilt&&Ua&&o.add(Fa(p)),r&&p.warn(`Pty Host startup is delayed ${r}ms`),e&&p.warn(`Pty host is simulating ${e}ms latency`);let c=new zr;i.registerChannel("heartbeat",wr.fromService(c,o));let d=new F(p,s,t,e),m=wr.fromService(d,o);i.registerChannel("ptyHost",m),n&&i.registerChannel("ptyHostWindow",m),process.once("exit",()=>{p.trace("Pty host exiting"),p.dispose(),c.dispose(),d.dispose()})}